@fantastic.dev/better-stripe 0.53.0 → 0.54.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 (121) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +116 -2
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  5. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +58 -1
  6. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  7. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +116 -2
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  9. package/dist/client/connect/payoutSyncTestHelpers.d.ts +58 -1
  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 +1 -0
  14. package/dist/client/index.js.map +1 -1
  15. package/dist/client/usage/client.d.ts +2 -2
  16. package/dist/client/usage/client.d.ts.map +1 -1
  17. package/dist/client/usage/client.js +3 -3
  18. package/dist/client/usage/client.js.map +1 -1
  19. package/dist/client/usage/deliveryClient.d.ts +64 -0
  20. package/dist/client/usage/deliveryClient.d.ts.map +1 -0
  21. package/dist/client/usage/deliveryClient.js +60 -0
  22. package/dist/client/usage/deliveryClient.js.map +1 -0
  23. package/dist/client/usage/deliveryProtocol.d.ts +130 -0
  24. package/dist/client/usage/deliveryProtocol.d.ts.map +1 -0
  25. package/dist/client/usage/deliveryProtocol.js +21 -0
  26. package/dist/client/usage/deliveryProtocol.js.map +1 -0
  27. package/dist/client/usage/deliveryProvider.d.ts +32 -0
  28. package/dist/client/usage/deliveryProvider.d.ts.map +1 -0
  29. package/dist/client/usage/deliveryProvider.js +127 -0
  30. package/dist/client/usage/deliveryProvider.js.map +1 -0
  31. package/dist/client/usage/index.d.ts +3 -0
  32. package/dist/client/usage/index.d.ts.map +1 -1
  33. package/dist/client/usage/index.js +1 -0
  34. package/dist/client/usage/index.js.map +1 -1
  35. package/dist/client/webhooks/handler.d.ts.map +1 -1
  36. package/dist/client/webhooks/handler.js +2 -1
  37. package/dist/client/webhooks/handler.js.map +1 -1
  38. package/dist/client/webhooks/meterErrors.d.ts +5 -0
  39. package/dist/client/webhooks/meterErrors.d.ts.map +1 -0
  40. package/dist/client/webhooks/meterErrors.js +98 -0
  41. package/dist/client/webhooks/meterErrors.js.map +1 -0
  42. package/dist/client/webhooks/v2.d.ts.map +1 -1
  43. package/dist/client/webhooks/v2.js +5 -0
  44. package/dist/client/webhooks/v2.js.map +1 -1
  45. package/dist/component/_generated/api.d.ts +14 -0
  46. package/dist/component/_generated/api.d.ts.map +1 -1
  47. package/dist/component/_generated/api.js.map +1 -1
  48. package/dist/component/_generated/component.d.ts +170 -0
  49. package/dist/component/_generated/component.d.ts.map +1 -1
  50. package/dist/component/balanceFunding/mutations.d.ts +43 -43
  51. package/dist/component/earnings/triggers.d.ts +104 -2
  52. package/dist/component/earnings/triggers.d.ts.map +1 -1
  53. package/dist/component/refundHistory/queries.d.ts +1 -1
  54. package/dist/component/schema.d.ts +58 -1
  55. package/dist/component/schema.js +3 -0
  56. package/dist/component/schema.js.map +1 -1
  57. package/dist/component/usage/schema.d.ts +96 -1
  58. package/dist/component/usage/schema.d.ts.map +1 -1
  59. package/dist/component/usage/schema.js +11 -2
  60. package/dist/component/usage/schema.js.map +1 -1
  61. package/dist/component/usageDelivery/bridge.d.ts +25 -0
  62. package/dist/component/usageDelivery/bridge.d.ts.map +1 -0
  63. package/dist/component/usageDelivery/bridge.js +45 -0
  64. package/dist/component/usageDelivery/bridge.js.map +1 -0
  65. package/dist/component/usageDelivery/fields.d.ts +78 -0
  66. package/dist/component/usageDelivery/fields.d.ts.map +1 -0
  67. package/dist/component/usageDelivery/fields.js +38 -0
  68. package/dist/component/usageDelivery/fields.js.map +1 -0
  69. package/dist/component/usageDelivery/helpers.d.ts +83 -0
  70. package/dist/component/usageDelivery/helpers.d.ts.map +1 -0
  71. package/dist/component/usageDelivery/helpers.js +63 -0
  72. package/dist/component/usageDelivery/helpers.js.map +1 -0
  73. package/dist/component/usageDelivery/mutations.d.ts +97 -0
  74. package/dist/component/usageDelivery/mutations.d.ts.map +1 -0
  75. package/dist/component/usageDelivery/mutations.js +153 -0
  76. package/dist/component/usageDelivery/mutations.js.map +1 -0
  77. package/dist/component/usageDelivery/queries.d.ts +113 -0
  78. package/dist/component/usageDelivery/queries.d.ts.map +1 -0
  79. package/dist/component/usageDelivery/queries.js +22 -0
  80. package/dist/component/usageDelivery/queries.js.map +1 -0
  81. package/dist/component/usageDelivery/schema.d.ts +79 -0
  82. package/dist/component/usageDelivery/schema.d.ts.map +1 -0
  83. package/dist/component/usageDelivery/schema.js +30 -0
  84. package/dist/component/usageDelivery/schema.js.map +1 -0
  85. package/dist/component/usageDelivery/steps.d.ts +85 -0
  86. package/dist/component/usageDelivery/steps.d.ts.map +1 -0
  87. package/dist/component/usageDelivery/steps.js +154 -0
  88. package/dist/component/usageDelivery/steps.js.map +1 -0
  89. package/dist/component/usageDelivery/workflow.d.ts +15 -0
  90. package/dist/component/usageDelivery/workflow.d.ts.map +1 -0
  91. package/dist/component/usageDelivery/workflow.js +28 -0
  92. package/dist/component/usageDelivery/workflow.js.map +1 -0
  93. package/docs/README.md +3 -1
  94. package/docs/metering-setup.md +1 -1
  95. package/docs/usage-delivery.md +143 -0
  96. package/package.json +3 -2
  97. package/src/client/index.ts +16 -0
  98. package/src/client/usage/client.ts +5 -2
  99. package/src/client/usage/deliveryClient.ts +130 -0
  100. package/src/client/usage/deliveryProtocol.ts +26 -0
  101. package/src/client/usage/deliveryProvider.test.ts +207 -0
  102. package/src/client/usage/deliveryProvider.ts +155 -0
  103. package/src/client/usage/index.ts +13 -0
  104. package/src/client/webhooks/handler.ts +2 -1
  105. package/src/client/webhooks/meterErrors.test.ts +164 -0
  106. package/src/client/webhooks/meterErrors.ts +118 -0
  107. package/src/client/webhooks/v2.ts +5 -0
  108. package/src/component/_generated/api.ts +14 -0
  109. package/src/component/_generated/component.ts +302 -0
  110. package/src/component/schema.ts +6 -0
  111. package/src/component/usage/schema.ts +11 -2
  112. package/src/component/usageDelivery/bridge.ts +56 -0
  113. package/src/component/usageDelivery/concurrency.test.ts +62 -0
  114. package/src/component/usageDelivery/fields.ts +59 -0
  115. package/src/component/usageDelivery/helpers.ts +77 -0
  116. package/src/component/usageDelivery/mutations.ts +185 -0
  117. package/src/component/usageDelivery/queries.ts +25 -0
  118. package/src/component/usageDelivery/schema.ts +33 -0
  119. package/src/component/usageDelivery/steps.ts +171 -0
  120. package/src/component/usageDelivery/workflow.test.ts +402 -0
  121. package/src/component/usageDelivery/workflow.ts +36 -0
@@ -22,14 +22,6 @@ export declare const begin: import("convex/server").RegisteredMutation<"public",
22
22
  requestKey: string;
23
23
  scopeKey: string;
24
24
  }, Promise<{
25
- reason: "identity_changed" | "revision_changed" | "scope_busy";
26
- retryable: false;
27
- status: "conflict";
28
- } | {
29
- reason: "policy_invalid";
30
- retryable: false;
31
- status: "rejected";
32
- } | {
33
25
  operation: {
34
26
  accountId: string;
35
27
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -40,6 +32,14 @@ export declare const begin: import("convex/server").RegisteredMutation<"public",
40
32
  } | {
41
33
  enabled: boolean;
42
34
  status: "unchanged";
35
+ } | {
36
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
37
+ retryable: false;
38
+ status: "conflict";
39
+ } | {
40
+ reason: "policy_invalid";
41
+ retryable: false;
42
+ status: "rejected";
43
43
  } | {
44
44
  reason: "provider_pending";
45
45
  retryable: true;
@@ -395,14 +395,6 @@ export declare const prepare: import("convex/server").RegisteredMutation<"public
395
395
  requestKey: string;
396
396
  scopeKey: string;
397
397
  }, Promise<{
398
- reason: "identity_changed" | "revision_changed" | "scope_busy";
399
- retryable: false;
400
- status: "conflict";
401
- } | {
402
- reason: "policy_invalid";
403
- retryable: false;
404
- status: "rejected";
405
- } | {
406
398
  operation: {
407
399
  accountId: string;
408
400
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -413,6 +405,14 @@ export declare const prepare: import("convex/server").RegisteredMutation<"public
413
405
  } | {
414
406
  enabled: boolean;
415
407
  status: "unchanged";
408
+ } | {
409
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
410
+ retryable: false;
411
+ status: "conflict";
412
+ } | {
413
+ reason: "policy_invalid";
414
+ retryable: false;
415
+ status: "rejected";
416
416
  } | {
417
417
  reason: "provider_pending";
418
418
  retryable: true;
@@ -595,6 +595,22 @@ export declare const startWorkflow: import("convex/server").RegisteredMutation<"
595
595
  } & {
596
596
  providerAction: string;
597
597
  }, Promise<{
598
+ reason: "history_incomplete" | "provider_outcome_unknown";
599
+ retryable: false;
600
+ status: "unknown";
601
+ } | {
602
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
603
+ retryable: false;
604
+ status: "conflict";
605
+ } | {
606
+ reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
607
+ retryable: false;
608
+ status: "rejected";
609
+ } | {
610
+ reason: "provider_pending";
611
+ retryable: true;
612
+ status: "not_ready";
613
+ } | {
598
614
  operation: {
599
615
  accountId: string;
600
616
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -611,7 +627,16 @@ export declare const startWorkflow: import("convex/server").RegisteredMutation<"
611
627
  version: number;
612
628
  };
613
629
  status: "canceled";
614
- } | {
630
+ }>>;
631
+ export declare const resumeWorkflow: import("convex/server").RegisteredMutation<"public", {
632
+ accountId: string;
633
+ definitionVersion: string;
634
+ operationId: import("convex/values").GenericId<"balanceFundingOperations">;
635
+ providerApiVersion: string;
636
+ scopeKey: string;
637
+ stripeSubscriptionId: string;
638
+ version: number;
639
+ }, Promise<{
615
640
  reason: "history_incomplete" | "provider_outcome_unknown";
616
641
  retryable: false;
617
642
  status: "unknown";
@@ -627,16 +652,7 @@ export declare const startWorkflow: import("convex/server").RegisteredMutation<"
627
652
  reason: "provider_pending";
628
653
  retryable: true;
629
654
  status: "not_ready";
630
- }>>;
631
- export declare const resumeWorkflow: import("convex/server").RegisteredMutation<"public", {
632
- accountId: string;
633
- definitionVersion: string;
634
- operationId: import("convex/values").GenericId<"balanceFundingOperations">;
635
- providerApiVersion: string;
636
- scopeKey: string;
637
- stripeSubscriptionId: string;
638
- version: number;
639
- }, Promise<{
655
+ } | {
640
656
  operation: {
641
657
  accountId: string;
642
658
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -653,22 +669,6 @@ export declare const resumeWorkflow: import("convex/server").RegisteredMutation<
653
669
  version: number;
654
670
  };
655
671
  status: "canceled";
656
- } | {
657
- reason: "history_incomplete" | "provider_outcome_unknown";
658
- retryable: false;
659
- status: "unknown";
660
- } | {
661
- reason: "identity_changed" | "revision_changed" | "scope_busy";
662
- retryable: false;
663
- status: "conflict";
664
- } | {
665
- reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
666
- retryable: false;
667
- status: "rejected";
668
- } | {
669
- reason: "provider_pending";
670
- retryable: true;
671
- status: "not_ready";
672
672
  }>>;
673
673
  export declare const cancelWorkflow: import("convex/server").RegisteredMutation<"public", {
674
674
  accountId: string;
@@ -2016,6 +2016,45 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
2016
2016
  searchIndexes: {};
2017
2017
  vectorIndexes: {};
2018
2018
  };
2019
+ usageDeliveryErrors: {
2020
+ document: {
2021
+ _creationTime: number;
2022
+ _id: import("convex/values").GenericId<"usageDeliveryErrors">;
2023
+ code: "archived_meter" | "meter_event_customer_not_found" | "meter_event_dimension_count_too_high" | "meter_event_invalid_value" | "meter_event_no_customer_defined" | "meter_event_value_not_found" | "no_meter" | "timestamp_in_future" | "timestamp_too_far_in_past";
2024
+ dedupe: string;
2025
+ eventId: import("convex/values").GenericId<"usageEvents">;
2026
+ observedAt: number;
2027
+ providerEventId: string;
2028
+ scopeKey: string;
2029
+ };
2030
+ fieldPaths: "_id" | ("_creationTime" | "code" | "dedupe" | "eventId" | "observedAt" | "providerEventId" | "scopeKey");
2031
+ indexes: {
2032
+ by_id: ["_id"];
2033
+ by_creation_time: ["_creationTime"];
2034
+ by_dedupe: ["dedupe", "_creationTime"];
2035
+ by_event: ["eventId", "_creationTime"];
2036
+ };
2037
+ searchIndexes: {};
2038
+ vectorIndexes: {};
2039
+ };
2040
+ usageDeliveryLocks: {
2041
+ document: {
2042
+ _creationTime: number;
2043
+ _id: import("convex/values").GenericId<"usageDeliveryLocks">;
2044
+ eventId?: import("convex/values").GenericId<"usageEvents"> | undefined;
2045
+ key: string;
2046
+ leaseUntil: number;
2047
+ nextAttemptAt: number;
2048
+ };
2049
+ fieldPaths: "_id" | ("_creationTime" | "eventId" | "key" | "leaseUntil" | "nextAttemptAt");
2050
+ indexes: {
2051
+ by_id: ["_id"];
2052
+ by_creation_time: ["_creationTime"];
2053
+ by_key: ["key", "_creationTime"];
2054
+ };
2055
+ searchIndexes: {};
2056
+ vectorIndexes: {};
2057
+ };
2019
2058
  usageEvents: {
2020
2059
  document: {
2021
2060
  _creationTime: number;
@@ -2043,18 +2082,30 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
2043
2082
  _creationTime: number;
2044
2083
  _id: import("convex/values").GenericId<"usageOutbox">;
2045
2084
  attempts: number;
2085
+ definitionVersion?: 1 | undefined;
2046
2086
  dispatch?: string | undefined;
2047
2087
  eventId: import("convex/values").GenericId<"usageEvents">;
2088
+ firstSendAt?: number | undefined;
2089
+ held?: boolean | undefined;
2090
+ leaseUntil?: number | undefined;
2048
2091
  nextAttemptAt: number;
2092
+ provider?: string | undefined;
2049
2093
  providerIdentifier: string;
2094
+ reason?: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
2095
+ receipt?: {
2096
+ created: number;
2097
+ identifier: string;
2098
+ } | undefined;
2050
2099
  scopeKey: string;
2051
2100
  state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
2101
+ workflowId?: string | undefined;
2052
2102
  };
2053
- fieldPaths: "_id" | ("_creationTime" | "attempts" | "dispatch" | "eventId" | "nextAttemptAt" | "providerIdentifier" | "scopeKey" | "state");
2103
+ fieldPaths: "_id" | ("_creationTime" | "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId");
2054
2104
  indexes: {
2055
2105
  by_id: ["_id"];
2056
2106
  by_creation_time: ["_creationTime"];
2057
2107
  by_event: ["eventId", "_creationTime"];
2108
+ by_provider_identifier: ["providerIdentifier", "_creationTime"];
2058
2109
  by_scope_state: ["scopeKey", "state", "_creationTime"];
2059
2110
  by_state_next: ["state", "nextAttemptAt", "_creationTime"];
2060
2111
  };
@@ -4136,6 +4187,45 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4136
4187
  searchIndexes: {};
4137
4188
  vectorIndexes: {};
4138
4189
  };
4190
+ usageDeliveryErrors: {
4191
+ document: {
4192
+ _creationTime: number;
4193
+ _id: import("convex/values").GenericId<"usageDeliveryErrors">;
4194
+ code: "archived_meter" | "meter_event_customer_not_found" | "meter_event_dimension_count_too_high" | "meter_event_invalid_value" | "meter_event_no_customer_defined" | "meter_event_value_not_found" | "no_meter" | "timestamp_in_future" | "timestamp_too_far_in_past";
4195
+ dedupe: string;
4196
+ eventId: import("convex/values").GenericId<"usageEvents">;
4197
+ observedAt: number;
4198
+ providerEventId: string;
4199
+ scopeKey: string;
4200
+ };
4201
+ fieldPaths: "_id" | ("_creationTime" | "code" | "dedupe" | "eventId" | "observedAt" | "providerEventId" | "scopeKey");
4202
+ indexes: {
4203
+ by_id: ["_id"];
4204
+ by_creation_time: ["_creationTime"];
4205
+ by_dedupe: ["dedupe", "_creationTime"];
4206
+ by_event: ["eventId", "_creationTime"];
4207
+ };
4208
+ searchIndexes: {};
4209
+ vectorIndexes: {};
4210
+ };
4211
+ usageDeliveryLocks: {
4212
+ document: {
4213
+ _creationTime: number;
4214
+ _id: import("convex/values").GenericId<"usageDeliveryLocks">;
4215
+ eventId?: import("convex/values").GenericId<"usageEvents"> | undefined;
4216
+ key: string;
4217
+ leaseUntil: number;
4218
+ nextAttemptAt: number;
4219
+ };
4220
+ fieldPaths: "_id" | ("_creationTime" | "eventId" | "key" | "leaseUntil" | "nextAttemptAt");
4221
+ indexes: {
4222
+ by_id: ["_id"];
4223
+ by_creation_time: ["_creationTime"];
4224
+ by_key: ["key", "_creationTime"];
4225
+ };
4226
+ searchIndexes: {};
4227
+ vectorIndexes: {};
4228
+ };
4139
4229
  usageEvents: {
4140
4230
  document: {
4141
4231
  _creationTime: number;
@@ -4163,18 +4253,30 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4163
4253
  _creationTime: number;
4164
4254
  _id: import("convex/values").GenericId<"usageOutbox">;
4165
4255
  attempts: number;
4256
+ definitionVersion?: 1 | undefined;
4166
4257
  dispatch?: string | undefined;
4167
4258
  eventId: import("convex/values").GenericId<"usageEvents">;
4259
+ firstSendAt?: number | undefined;
4260
+ held?: boolean | undefined;
4261
+ leaseUntil?: number | undefined;
4168
4262
  nextAttemptAt: number;
4263
+ provider?: string | undefined;
4169
4264
  providerIdentifier: string;
4265
+ reason?: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
4266
+ receipt?: {
4267
+ created: number;
4268
+ identifier: string;
4269
+ } | undefined;
4170
4270
  scopeKey: string;
4171
4271
  state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
4272
+ workflowId?: string | undefined;
4172
4273
  };
4173
- fieldPaths: "_id" | ("_creationTime" | "attempts" | "dispatch" | "eventId" | "nextAttemptAt" | "providerIdentifier" | "scopeKey" | "state");
4274
+ fieldPaths: "_id" | ("_creationTime" | "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId");
4174
4275
  indexes: {
4175
4276
  by_id: ["_id"];
4176
4277
  by_creation_time: ["_creationTime"];
4177
4278
  by_event: ["eventId", "_creationTime"];
4279
+ by_provider_identifier: ["providerIdentifier", "_creationTime"];
4178
4280
  by_scope_state: ["scopeKey", "state", "_creationTime"];
4179
4281
  by_state_next: ["state", "nextAttemptAt", "_creationTime"];
4180
4282
  };
@@ -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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?: undefined;
57
57
  } | {
58
- reason?: undefined;
58
+ readonly reason?: undefined;
59
59
  status: "observed";
60
60
  refund: {
61
61
  _creationTime: number;
@@ -1,4 +1,35 @@
1
1
  declare const _default: import("convex/server").SchemaDefinition<{
2
+ usageDeliveryLocks: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
+ eventId?: import("convex/values").GenericId<"usageEvents"> | undefined;
4
+ key: string;
5
+ leaseUntil: number;
6
+ nextAttemptAt: number;
7
+ }, {
8
+ key: import("convex/values").VString<string, "required">;
9
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents"> | undefined, "optional">;
10
+ leaseUntil: import("convex/values").VFloat64<number, "required">;
11
+ nextAttemptAt: import("convex/values").VFloat64<number, "required">;
12
+ }, "required", "eventId" | "key" | "leaseUntil" | "nextAttemptAt">, {
13
+ by_key: ["key", "_creationTime"];
14
+ }, {}, {}>;
15
+ usageDeliveryErrors: import("convex/server").TableDefinition<import("convex/values").VObject<{
16
+ code: "archived_meter" | "meter_event_customer_not_found" | "meter_event_dimension_count_too_high" | "meter_event_invalid_value" | "meter_event_no_customer_defined" | "meter_event_value_not_found" | "no_meter" | "timestamp_in_future" | "timestamp_too_far_in_past";
17
+ dedupe: string;
18
+ eventId: import("convex/values").GenericId<"usageEvents">;
19
+ observedAt: number;
20
+ providerEventId: string;
21
+ scopeKey: string;
22
+ }, {
23
+ scopeKey: import("convex/values").VString<string, "required">;
24
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
25
+ providerEventId: import("convex/values").VString<string, "required">;
26
+ code: import("convex/values").VUnion<"archived_meter" | "meter_event_customer_not_found" | "meter_event_dimension_count_too_high" | "meter_event_invalid_value" | "meter_event_no_customer_defined" | "meter_event_value_not_found" | "no_meter" | "timestamp_in_future" | "timestamp_too_far_in_past", [import("convex/values").VLiteral<"meter_event_customer_not_found", "required">, import("convex/values").VLiteral<"meter_event_no_customer_defined", "required">, import("convex/values").VLiteral<"meter_event_dimension_count_too_high", "required">, import("convex/values").VLiteral<"archived_meter", "required">, import("convex/values").VLiteral<"timestamp_too_far_in_past", "required">, import("convex/values").VLiteral<"timestamp_in_future", "required">, import("convex/values").VLiteral<"meter_event_value_not_found", "required">, import("convex/values").VLiteral<"meter_event_invalid_value", "required">, import("convex/values").VLiteral<"no_meter", "required">], "required", never>;
27
+ observedAt: import("convex/values").VFloat64<number, "required">;
28
+ dedupe: import("convex/values").VString<string, "required">;
29
+ }, "required", "code" | "dedupe" | "eventId" | "observedAt" | "providerEventId" | "scopeKey">, {
30
+ by_dedupe: ["dedupe", "_creationTime"];
31
+ by_event: ["eventId", "_creationTime"];
32
+ }, {}, {}>;
2
33
  usageCatalog: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
34
  firstAttemptAt: number;
4
35
  key: string;
@@ -43,13 +74,38 @@ declare const _default: import("convex/server").SchemaDefinition<{
43
74
  }, {}, {}>;
44
75
  usageOutbox: import("convex/server").TableDefinition<import("convex/values").VObject<{
45
76
  attempts: number;
77
+ definitionVersion?: 1 | undefined;
46
78
  dispatch?: string | undefined;
47
79
  eventId: import("convex/values").GenericId<"usageEvents">;
80
+ firstSendAt?: number | undefined;
81
+ held?: boolean | undefined;
82
+ leaseUntil?: number | undefined;
48
83
  nextAttemptAt: number;
84
+ provider?: string | undefined;
49
85
  providerIdentifier: string;
86
+ reason?: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
87
+ receipt?: {
88
+ created: number;
89
+ identifier: string;
90
+ } | undefined;
50
91
  scopeKey: string;
51
92
  state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
93
+ workflowId?: string | undefined;
52
94
  }, {
95
+ provider: import("convex/values").VString<string | undefined, "optional">;
96
+ workflowId: import("convex/values").VString<string | undefined, "optional">;
97
+ definitionVersion: import("convex/values").VLiteral<1 | undefined, "optional">;
98
+ firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
99
+ leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
100
+ held: import("convex/values").VBoolean<boolean | undefined, "optional">;
101
+ reason: import("convex/values").VUnion<"administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined, [import("convex/values").VLiteral<"rate_limited", "required">, import("convex/values").VLiteral<"provider_unavailable", "required">, import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"provider_rejected", "required">, import("convex/values").VLiteral<"retry_exhausted", "required">, import("convex/values").VLiteral<"delivery_window_expired", "required">, import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"administrative_hold", "required">], "optional", never>;
102
+ receipt: import("convex/values").VObject<{
103
+ created: number;
104
+ identifier: string;
105
+ } | undefined, {
106
+ identifier: import("convex/values").VString<string, "required">;
107
+ created: import("convex/values").VFloat64<number, "required">;
108
+ }, "optional", "created" | "identifier">;
53
109
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
54
110
  scopeKey: import("convex/values").VString<string, "required">;
55
111
  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>;
@@ -57,8 +113,9 @@ declare const _default: import("convex/server").SchemaDefinition<{
57
113
  nextAttemptAt: import("convex/values").VFloat64<number, "required">;
58
114
  providerIdentifier: import("convex/values").VString<string, "required">;
59
115
  dispatch: import("convex/values").VString<string | undefined, "optional">;
60
- }, "required", "attempts" | "dispatch" | "eventId" | "nextAttemptAt" | "providerIdentifier" | "scopeKey" | "state">, {
116
+ }, "required", "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
61
117
  by_event: ["eventId", "_creationTime"];
118
+ by_provider_identifier: ["providerIdentifier", "_creationTime"];
62
119
  by_scope_state: ["scopeKey", "state", "_creationTime"];
63
120
  by_state_next: ["state", "nextAttemptAt", "_creationTime"];
64
121
  }, {}, {}>;
@@ -1,3 +1,4 @@
1
+ import { errorsTable as usageDeliveryErrors, locksTable as usageDeliveryLocks, } from "./usageDelivery/fields.js";
1
2
  import { claimsTable as refundSyncClaimsTable } from "./refundSync/schema.js";
2
3
  import { operationsTable as processingCostReconciliationOperations } from "./processingCostReconciliation/schema.js";
3
4
  import { operationsTable as recoveryWorkflowOperations, requestsTable as recoveryWorkflowRequests, } from "./recoveryWorkflow/schema.js";
@@ -27,6 +28,8 @@ import { accountsTable } from "./core/schema";
27
28
  import { pricesTable, productsTable } from "./products/schema";
28
29
  import { webhookEventsTable } from "./webhooks/schema";
29
30
  export default defineSchema({
31
+ usageDeliveryLocks,
32
+ usageDeliveryErrors,
30
33
  usageCatalog: usageCatalogTable,
31
34
  usageEvents: usageEventsTable,
32
35
  usageOutbox: usageOutboxTable,
@@ -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,EAC3C,aAAa,IAAI,sBAAsB,GACxC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,aAA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C,OAAO;IACP,QAAQ,EAAE,aAAa;IACvB,eAAe,EAAE,oBAAoB;IAErC,WAAW;IACX,QAAQ,EAAE,aAAa;IACvB,MAAM,EAAE,WAAW;IAEnB,UAAU;IACV,aAAa,EAAE,kBAAkB;IACjC,gBAAgB,EAAE,qBAAqB;IACvC,QAAQ,EAAE,aAAa;IAEvB,UAAU;IACV,QAAQ,EAAE,aAAa;IACvB,OAAO,EAAE,YAAY;IACrB,iBAAiB,EAAE,sBAAsB;IACzC,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,cAAc;IACzB,mBAAmB,EAAE,wBAAwB;IAE7C,WAAW;IACX,aAAa,EAAE,kBAAkB;CAClC,CAAC,CAAC"}
@@ -60,15 +60,109 @@ export declare const usageEventsTable: import("convex/server").TableDefinition<i
60
60
  by_identity: ["identity", "_creationTime"];
61
61
  by_scope_time: ["scopeKey", "occurredAt", "_creationTime"];
62
62
  }, {}, {}>;
63
+ export declare const outboxFields: {
64
+ provider: import("convex/values").VString<string | undefined, "optional">;
65
+ workflowId: import("convex/values").VString<string | undefined, "optional">;
66
+ definitionVersion: import("convex/values").VLiteral<1 | undefined, "optional">;
67
+ firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
68
+ leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
69
+ held: import("convex/values").VBoolean<boolean | undefined, "optional">;
70
+ reason: import("convex/values").VUnion<"administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined, [import("convex/values").VLiteral<"rate_limited", "required">, import("convex/values").VLiteral<"provider_unavailable", "required">, import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"provider_rejected", "required">, import("convex/values").VLiteral<"retry_exhausted", "required">, import("convex/values").VLiteral<"delivery_window_expired", "required">, import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"administrative_hold", "required">], "optional", never>;
71
+ receipt: import("convex/values").VObject<{
72
+ created: number;
73
+ identifier: string;
74
+ } | undefined, {
75
+ identifier: import("convex/values").VString<string, "required">;
76
+ created: import("convex/values").VFloat64<number, "required">;
77
+ }, "optional", "created" | "identifier">;
78
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
79
+ scopeKey: import("convex/values").VString<string, "required">;
80
+ 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>;
81
+ attempts: import("convex/values").VFloat64<number, "required">;
82
+ nextAttemptAt: import("convex/values").VFloat64<number, "required">;
83
+ providerIdentifier: import("convex/values").VString<string, "required">;
84
+ dispatch: import("convex/values").VString<string | undefined, "optional">;
85
+ };
86
+ export declare const outboxDoc: import("convex/values").VObject<{
87
+ _creationTime: number;
88
+ _id: import("convex/values").GenericId<"usageOutbox">;
89
+ attempts: number;
90
+ definitionVersion?: 1 | undefined;
91
+ dispatch?: string | undefined;
92
+ eventId: import("convex/values").GenericId<"usageEvents">;
93
+ firstSendAt?: number | undefined;
94
+ held?: boolean | undefined;
95
+ leaseUntil?: number | undefined;
96
+ nextAttemptAt: number;
97
+ provider?: string | undefined;
98
+ providerIdentifier: string;
99
+ reason?: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
100
+ receipt?: {
101
+ created: number;
102
+ identifier: string;
103
+ } | undefined;
104
+ scopeKey: string;
105
+ state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
106
+ workflowId?: string | undefined;
107
+ }, {
108
+ provider: import("convex/values").VString<string | undefined, "optional">;
109
+ workflowId: import("convex/values").VString<string | undefined, "optional">;
110
+ definitionVersion: import("convex/values").VLiteral<1 | undefined, "optional">;
111
+ firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
112
+ leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
113
+ held: import("convex/values").VBoolean<boolean | undefined, "optional">;
114
+ reason: import("convex/values").VUnion<"administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined, [import("convex/values").VLiteral<"rate_limited", "required">, import("convex/values").VLiteral<"provider_unavailable", "required">, import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"provider_rejected", "required">, import("convex/values").VLiteral<"retry_exhausted", "required">, import("convex/values").VLiteral<"delivery_window_expired", "required">, import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"administrative_hold", "required">], "optional", never>;
115
+ receipt: import("convex/values").VObject<{
116
+ created: number;
117
+ identifier: string;
118
+ } | undefined, {
119
+ identifier: import("convex/values").VString<string, "required">;
120
+ created: import("convex/values").VFloat64<number, "required">;
121
+ }, "optional", "created" | "identifier">;
122
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
123
+ scopeKey: import("convex/values").VString<string, "required">;
124
+ 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>;
125
+ attempts: import("convex/values").VFloat64<number, "required">;
126
+ nextAttemptAt: import("convex/values").VFloat64<number, "required">;
127
+ providerIdentifier: import("convex/values").VString<string, "required">;
128
+ dispatch: import("convex/values").VString<string | undefined, "optional">;
129
+ _id: import("convex/values").VId<import("convex/values").GenericId<"usageOutbox">, "required">;
130
+ _creationTime: import("convex/values").VFloat64<number, "required">;
131
+ }, "required", "_creationTime" | "_id" | "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">;
63
132
  export declare const usageOutboxTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
64
133
  attempts: number;
134
+ definitionVersion?: 1 | undefined;
65
135
  dispatch?: string | undefined;
66
136
  eventId: import("convex/values").GenericId<"usageEvents">;
137
+ firstSendAt?: number | undefined;
138
+ held?: boolean | undefined;
139
+ leaseUntil?: number | undefined;
67
140
  nextAttemptAt: number;
141
+ provider?: string | undefined;
68
142
  providerIdentifier: string;
143
+ reason?: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
144
+ receipt?: {
145
+ created: number;
146
+ identifier: string;
147
+ } | undefined;
69
148
  scopeKey: string;
70
149
  state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
150
+ workflowId?: string | undefined;
71
151
  }, {
152
+ provider: import("convex/values").VString<string | undefined, "optional">;
153
+ workflowId: import("convex/values").VString<string | undefined, "optional">;
154
+ definitionVersion: import("convex/values").VLiteral<1 | undefined, "optional">;
155
+ firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
156
+ leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
157
+ held: import("convex/values").VBoolean<boolean | undefined, "optional">;
158
+ reason: import("convex/values").VUnion<"administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined, [import("convex/values").VLiteral<"rate_limited", "required">, import("convex/values").VLiteral<"provider_unavailable", "required">, import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"provider_rejected", "required">, import("convex/values").VLiteral<"retry_exhausted", "required">, import("convex/values").VLiteral<"delivery_window_expired", "required">, import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"administrative_hold", "required">], "optional", never>;
159
+ receipt: import("convex/values").VObject<{
160
+ created: number;
161
+ identifier: string;
162
+ } | undefined, {
163
+ identifier: import("convex/values").VString<string, "required">;
164
+ created: import("convex/values").VFloat64<number, "required">;
165
+ }, "optional", "created" | "identifier">;
72
166
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
73
167
  scopeKey: import("convex/values").VString<string, "required">;
74
168
  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>;
@@ -76,8 +170,9 @@ export declare const usageOutboxTable: import("convex/server").TableDefinition<i
76
170
  nextAttemptAt: import("convex/values").VFloat64<number, "required">;
77
171
  providerIdentifier: import("convex/values").VString<string, "required">;
78
172
  dispatch: import("convex/values").VString<string | undefined, "optional">;
79
- }, "required", "attempts" | "dispatch" | "eventId" | "nextAttemptAt" | "providerIdentifier" | "scopeKey" | "state">, {
173
+ }, "required", "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
80
174
  by_event: ["eventId", "_creationTime"];
175
+ by_provider_identifier: ["providerIdentifier", "_creationTime"];
81
176
  by_scope_state: ["scopeKey", "state", "_creationTime"];
82
177
  by_state_next: ["state", "nextAttemptAt", "_creationTime"];
83
178
  }, {}, {}>;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/component/usage/schema.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc;;;;;;;;;;8EAKzB,CAAC;AACH,eAAO,MAAM,iBAAiB,geAO7B,CAAC;AACF,eAAO,MAAM,WAAW;IACtB,aAAa;IACb,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,gBAAgB;IAChB,UAAU;IACV,UAAU;CACX,CAAC;AACF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;qJAInB,CAAC;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;UAEwB,CAAC;AACtD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;UAWoB,CAAC;AAClD,eAAO,MAAM,uBAAuB;;;;;;;;UAGF,CAAC;AAInC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;UAWuB,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/component/usage/schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc;;;;;;;;;;8EAKzB,CAAC;AACH,eAAO,MAAM,iBAAiB,geAO7B,CAAC;AACF,eAAO,MAAM,WAAW;IACtB,aAAa;IACb,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,gBAAgB;IAChB,UAAU;IACV,UAAU;CACX,CAAC;AACF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;qJAInB,CAAC;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;UAEwB,CAAC;AACtD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;CASxB,CAAC;AACF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ySAIpB,CAAC;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAIoB,CAAC;AAClD,eAAO,MAAM,uBAAuB;;;;;;;;UAGF,CAAC;AAInC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;UAWuB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { deliveryFields } from "../usageDelivery/fields.js";
1
2
  import { defineTable } from "convex/server";
2
3
  import { v } from "convex/values";
3
4
  export const scopeValidator = v.object({
@@ -24,7 +25,8 @@ export const eventDoc = v.object({
24
25
  export const usageEventsTable = defineTable(eventFields)
25
26
  .index("by_identity", ["identity"])
26
27
  .index("by_scope_time", ["scopeKey", "occurredAt"]);
27
- export const usageOutboxTable = defineTable({
28
+ export const outboxFields = {
29
+ ...deliveryFields,
28
30
  eventId: v.id("usageEvents"),
29
31
  scopeKey: v.string(),
30
32
  state: deliveryValidator,
@@ -32,7 +34,14 @@ export const usageOutboxTable = defineTable({
32
34
  nextAttemptAt: v.number(),
33
35
  providerIdentifier: v.string(),
34
36
  dispatch: v.optional(v.string()),
35
- })
37
+ };
38
+ export const outboxDoc = v.object({
39
+ _id: v.id("usageOutbox"),
40
+ _creationTime: v.number(),
41
+ ...outboxFields,
42
+ });
43
+ export const usageOutboxTable = defineTable(outboxFields)
44
+ .index("by_provider_identifier", ["providerIdentifier"])
36
45
  .index("by_event", ["eventId"])
37
46
  .index("by_state_next", ["state", "nextAttemptAt"])
38
47
  .index("by_scope_state", ["scopeKey", "state"]);