@fantastic.dev/better-stripe 0.55.0 → 0.56.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.
- package/CHANGELOG.md +6 -0
- package/README.md +3 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +216 -38
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +92 -3
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +216 -38
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +92 -3
- package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/usage/catalogPrices.d.ts +2 -0
- package/dist/client/usage/catalogPrices.d.ts.map +1 -1
- package/dist/client/usage/catalogPrices.js +15 -0
- package/dist/client/usage/catalogPrices.js.map +1 -1
- package/dist/client/usage/client.d.ts +2 -2
- package/dist/client/usage/client.d.ts.map +1 -1
- package/dist/client/usage/client.js +2 -2
- package/dist/client/usage/client.js.map +1 -1
- package/dist/client/usage/deliveryProvider.d.ts.map +1 -1
- package/dist/client/usage/deliveryProvider.js +26 -1
- package/dist/client/usage/deliveryProvider.js.map +1 -1
- package/dist/client/usage/index.d.ts +4 -0
- package/dist/client/usage/index.d.ts.map +1 -1
- package/dist/client/usage/index.js +1 -0
- package/dist/client/usage/index.js.map +1 -1
- package/dist/client/usage/subscription.fixtures.d.ts +118 -0
- package/dist/client/usage/subscription.fixtures.d.ts.map +1 -0
- package/dist/client/usage/subscription.fixtures.js +84 -0
- package/dist/client/usage/subscription.fixtures.js.map +1 -0
- package/dist/client/usage/subscriptionAbandonment.d.ts +8 -0
- package/dist/client/usage/subscriptionAbandonment.d.ts.map +1 -0
- package/dist/client/usage/subscriptionAbandonment.js +82 -0
- package/dist/client/usage/subscriptionAbandonment.js.map +1 -0
- package/dist/client/usage/subscriptionCancellation.d.ts +9 -0
- package/dist/client/usage/subscriptionCancellation.d.ts.map +1 -0
- package/dist/client/usage/subscriptionCancellation.js +39 -0
- package/dist/client/usage/subscriptionCancellation.js.map +1 -0
- package/dist/client/usage/subscriptionCheckout.d.ts +52 -0
- package/dist/client/usage/subscriptionCheckout.d.ts.map +1 -0
- package/dist/client/usage/subscriptionCheckout.js +94 -0
- package/dist/client/usage/subscriptionCheckout.js.map +1 -0
- package/dist/client/usage/subscriptionClient.d.ts +267 -0
- package/dist/client/usage/subscriptionClient.d.ts.map +1 -0
- package/dist/client/usage/subscriptionClient.js +93 -0
- package/dist/client/usage/subscriptionClient.js.map +1 -0
- package/dist/client/usage/subscriptionErrors.d.ts +5 -0
- package/dist/client/usage/subscriptionErrors.d.ts.map +1 -0
- package/dist/client/usage/subscriptionErrors.js +9 -0
- package/dist/client/usage/subscriptionErrors.js.map +1 -0
- package/dist/client/usage/subscriptionInvoiceSchema.d.ts +203 -0
- package/dist/client/usage/subscriptionInvoiceSchema.d.ts.map +1 -0
- package/dist/client/usage/subscriptionInvoiceSchema.js +108 -0
- package/dist/client/usage/subscriptionInvoiceSchema.js.map +1 -0
- package/dist/client/usage/subscriptionLifecycle.d.ts +80 -0
- package/dist/client/usage/subscriptionLifecycle.d.ts.map +1 -0
- package/dist/client/usage/subscriptionLifecycle.js +87 -0
- package/dist/client/usage/subscriptionLifecycle.js.map +1 -0
- package/dist/client/usage/subscriptionProvider.d.ts +111 -0
- package/dist/client/usage/subscriptionProvider.d.ts.map +1 -0
- package/dist/client/usage/subscriptionProvider.js +147 -0
- package/dist/client/usage/subscriptionProvider.js.map +1 -0
- package/dist/client/usage/subscriptionTerms.d.ts +161 -0
- package/dist/client/usage/subscriptionTerms.d.ts.map +1 -0
- package/dist/client/usage/subscriptionTerms.js +242 -0
- package/dist/client/usage/subscriptionTerms.js.map +1 -0
- package/dist/client/usage/subscriptionTransport.fixtures.d.ts +25 -0
- package/dist/client/usage/subscriptionTransport.fixtures.d.ts.map +1 -0
- package/dist/client/usage/subscriptionTransport.fixtures.js +203 -0
- package/dist/client/usage/subscriptionTransport.fixtures.js.map +1 -0
- package/dist/client/webhooks/processors.d.ts.map +1 -1
- package/dist/client/webhooks/processors.js +2 -0
- package/dist/client/webhooks/processors.js.map +1 -1
- package/dist/client/webhooks/usageSubscriptions.d.ts +5 -0
- package/dist/client/webhooks/usageSubscriptions.d.ts.map +1 -0
- package/dist/client/webhooks/usageSubscriptions.js +54 -0
- package/dist/client/webhooks/usageSubscriptions.js.map +1 -0
- package/dist/component/_generated/api.d.ts +14 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +160 -5
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/accountClosure/mutations.d.ts.map +1 -1
- package/dist/component/accountClosure/mutations.js +10 -0
- package/dist/component/accountClosure/mutations.js.map +1 -1
- package/dist/component/balanceFunding/preparationHandlers.d.ts +8 -8
- package/dist/component/balanceFunding/workflowValidators.d.ts +16 -16
- package/dist/component/earnings/triggers.d.ts +192 -4
- package/dist/component/earnings/triggers.d.ts.map +1 -1
- package/dist/component/payoutRelease/queries.d.ts +2 -2
- package/dist/component/payoutRelease/queries.d.ts.map +1 -1
- package/dist/component/schema.d.ts +92 -3
- package/dist/component/schema.js +5 -0
- package/dist/component/schema.js.map +1 -1
- package/dist/component/usage/mutations.d.ts.map +1 -1
- package/dist/component/usage/mutations.js +5 -0
- package/dist/component/usage/mutations.js.map +1 -1
- package/dist/component/usage/queries.d.ts +2 -0
- package/dist/component/usage/queries.d.ts.map +1 -1
- package/dist/component/usage/schema.d.ts +14 -7
- package/dist/component/usage/schema.d.ts.map +1 -1
- package/dist/component/usage/schema.js +5 -1
- package/dist/component/usage/schema.js.map +1 -1
- package/dist/component/usageDelivery/fields.d.ts +3 -2
- package/dist/component/usageDelivery/fields.d.ts.map +1 -1
- package/dist/component/usageDelivery/fields.js +2 -1
- package/dist/component/usageDelivery/fields.js.map +1 -1
- package/dist/component/usageDelivery/helpers.d.ts +4 -3
- package/dist/component/usageDelivery/helpers.d.ts.map +1 -1
- package/dist/component/usageDelivery/mutations.d.ts +3 -3
- package/dist/component/usageDelivery/queries.d.ts +17 -3
- package/dist/component/usageDelivery/queries.d.ts.map +1 -1
- package/dist/component/usageDelivery/queries.js +20 -3
- package/dist/component/usageDelivery/queries.js.map +1 -1
- package/dist/component/usageDelivery/schema.d.ts +2 -2
- package/dist/component/usageDelivery/steps.d.ts +1 -1
- package/dist/component/usageDelivery/steps.d.ts.map +1 -1
- package/dist/component/usageDelivery/steps.js +12 -1
- package/dist/component/usageDelivery/steps.js.map +1 -1
- package/dist/component/usageSubscriptions/abandonment.d.ts +4 -0
- package/dist/component/usageSubscriptions/abandonment.d.ts.map +1 -0
- package/dist/component/usageSubscriptions/abandonment.js +59 -0
- package/dist/component/usageSubscriptions/abandonment.js.map +1 -0
- package/dist/component/usageSubscriptions/acceptance.d.ts +11 -0
- package/dist/component/usageSubscriptions/acceptance.d.ts.map +1 -0
- package/dist/component/usageSubscriptions/acceptance.js +38 -0
- package/dist/component/usageSubscriptions/acceptance.js.map +1 -0
- package/dist/component/usageSubscriptions/helpers.d.ts +39 -0
- package/dist/component/usageSubscriptions/helpers.d.ts.map +1 -0
- package/dist/component/usageSubscriptions/helpers.js +28 -0
- package/dist/component/usageSubscriptions/helpers.js.map +1 -0
- package/dist/component/usageSubscriptions/history.d.ts +46 -0
- package/dist/component/usageSubscriptions/history.d.ts.map +1 -0
- package/dist/component/usageSubscriptions/history.js +46 -0
- package/dist/component/usageSubscriptions/history.js.map +1 -0
- package/dist/component/usageSubscriptions/mutations.d.ts +64 -0
- package/dist/component/usageSubscriptions/mutations.d.ts.map +1 -0
- package/dist/component/usageSubscriptions/mutations.js +252 -0
- package/dist/component/usageSubscriptions/mutations.js.map +1 -0
- package/dist/component/usageSubscriptions/queries.d.ts +81 -0
- package/dist/component/usageSubscriptions/queries.d.ts.map +1 -0
- package/dist/component/usageSubscriptions/queries.js +70 -0
- package/dist/component/usageSubscriptions/queries.js.map +1 -0
- package/dist/component/usageSubscriptions/retirement.d.ts +4 -0
- package/dist/component/usageSubscriptions/retirement.d.ts.map +1 -0
- package/dist/component/usageSubscriptions/retirement.js +80 -0
- package/dist/component/usageSubscriptions/retirement.js.map +1 -0
- package/dist/component/usageSubscriptions/schema.d.ts +191 -0
- package/dist/component/usageSubscriptions/schema.d.ts.map +1 -0
- package/dist/component/usageSubscriptions/schema.js +69 -0
- package/dist/component/usageSubscriptions/schema.js.map +1 -0
- package/dist/test.d.ts +6 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/test.js +15 -0
- package/dist/test.js.map +1 -0
- package/docs/README.md +2 -0
- package/docs/evidence/native-metering/clock-finalization-run.json +129 -0
- package/docs/evidence/native-metering/clock-lag-run.json +111 -0
- package/docs/evidence/native-metering/paid-run.json +107 -0
- package/docs/evidence/native-metering/promotional-run.json +103 -0
- package/docs/metered-usage.md +14 -0
- package/docs/metering-setup.md +5 -1
- package/docs/usage-subscriptions.md +278 -0
- package/package.json +4 -2
- package/src/client/index.ts +8 -0
- package/src/client/usage/catalogPrices.ts +21 -0
- package/src/client/usage/client.ts +2 -2
- package/src/client/usage/deliveryProvider.test.ts +70 -1
- package/src/client/usage/deliveryProvider.ts +43 -2
- package/src/client/usage/index.ts +9 -0
- package/src/client/usage/subscription.fixtures.ts +84 -0
- package/src/client/usage/subscriptionAbandonment.test.ts +124 -0
- package/src/client/usage/subscriptionAbandonment.ts +116 -0
- package/src/client/usage/subscriptionCancellation.ts +90 -0
- package/src/client/usage/subscriptionCheckout.test.ts +31 -0
- package/src/client/usage/subscriptionCheckout.ts +152 -0
- package/src/client/usage/subscriptionClient.test.ts +316 -0
- package/src/client/usage/subscriptionClient.ts +204 -0
- package/src/client/usage/subscriptionErrors.ts +14 -0
- package/src/client/usage/subscriptionInvoiceSchema.ts +116 -0
- package/src/client/usage/subscriptionLifecycle.ts +165 -0
- package/src/client/usage/subscriptionProvider.test.ts +48 -0
- package/src/client/usage/subscriptionProvider.ts +247 -0
- package/src/client/usage/subscriptionTerms.test.ts +158 -0
- package/src/client/usage/subscriptionTerms.ts +294 -0
- package/src/client/usage/subscriptionTransport.fixtures.ts +241 -0
- package/src/client/webhooks/processors.ts +2 -0
- package/src/client/webhooks/usageSubscriptions.test.ts +162 -0
- package/src/client/webhooks/usageSubscriptions.ts +81 -0
- package/src/component/_generated/api.ts +14 -0
- package/src/component/_generated/component.ts +200 -0
- package/src/component/accountClosure/mutations.ts +12 -0
- package/src/component/schema.ts +10 -0
- package/src/component/usage/mutations.ts +5 -0
- package/src/component/usage/schema.ts +5 -1
- package/src/component/usageDelivery/fields.ts +2 -0
- package/src/component/usageDelivery/queries.ts +30 -3
- package/src/component/usageDelivery/steps.ts +22 -1
- package/src/component/usageSubscriptions/abandonment.ts +80 -0
- package/src/component/usageSubscriptions/acceptance.test.ts +122 -0
- package/src/component/usageSubscriptions/acceptance.ts +66 -0
- package/src/component/usageSubscriptions/helpers.ts +33 -0
- package/src/component/usageSubscriptions/history.test.ts +69 -0
- package/src/component/usageSubscriptions/history.ts +68 -0
- package/src/component/usageSubscriptions/mutations.test.ts +205 -0
- package/src/component/usageSubscriptions/mutations.ts +275 -0
- package/src/component/usageSubscriptions/queries.ts +78 -0
- package/src/component/usageSubscriptions/retirement.ts +105 -0
- package/src/component/usageSubscriptions/schema.ts +73 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { managedBillingCutoff } from "../usageSubscriptions/acceptance.js";
|
|
1
2
|
import { v } from "convex/values";
|
|
2
3
|
import { mutation } from "../_generated/server.js";
|
|
3
4
|
import { prepareUsageRecord, } from "../../client/usage/records.js";
|
|
@@ -52,6 +53,9 @@ export const record = mutation({
|
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
55
|
const now = Math.floor(Date.now() / 1000);
|
|
56
|
+
const cutoff = await managedBillingCutoff(ctx, event, subscription);
|
|
57
|
+
if (cutoff !== null && now >= cutoff)
|
|
58
|
+
throw new Error("Managed usage billing period is closing or closed");
|
|
55
59
|
if (event.occurredAt < now - 35 * 86400 || event.occurredAt > now + 300)
|
|
56
60
|
throw new Error("Usage occurrence is outside the native delivery window");
|
|
57
61
|
if (event.binding.stripePriceId !== subscription.stripePriceId ||
|
|
@@ -83,6 +87,7 @@ export const record = mutation({
|
|
|
83
87
|
reservation.state !== "reserved"))
|
|
84
88
|
throw new Error("Usage reservation does not match event");
|
|
85
89
|
const eventId = await ctx.db.insert("usageEvents", {
|
|
90
|
+
subscriptionId: subscription.subscriptionId,
|
|
86
91
|
reservationId: args.reservationId,
|
|
87
92
|
scopeKey: key,
|
|
88
93
|
identity: event.identity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../src/component/usage/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EACL,kBAAkB,GAEnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE9D,4FAA4F;AAC5F,MAAM,CAAC,MAAM,MAAM,GAAG,QAAQ,CAAC;IAC7B,IAAI,EAAE;QACJ,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE;QAC5B,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC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AAW;YACb,MAAM,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,mBAAmB,EAAE,WAAW,CAAC,GAAG,EAAE;gBACvD,KAAK,EAAE,WAAW;gBAClB,OAAO;aACR,CAAC,CAAC;QACL,IAAI,IAAI,CAAC,QAAQ;YACf,MAAM,GAAG,CAAC,SAAS,CAAC,QAAQ,CAC1B,CAAC,EACD,IAAI,CAAC,QAAoC,EACzC,EAAE,OAAO,EAAE,CACZ,CAAC;QACJ,OAAO;YACL,OAAO;YACP,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,UAAU,EAAE,GAAG;YACf,QAAQ,EAAE,QAAiB;SAC5B,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -16,6 +16,7 @@ export declare const get: import("convex/server").RegisteredQuery<"public", {
|
|
|
16
16
|
recordJson: string;
|
|
17
17
|
reservationId?: import("convex/values").GenericId<"usageReservations"> | undefined;
|
|
18
18
|
scopeKey: string;
|
|
19
|
+
subscriptionId?: string | undefined;
|
|
19
20
|
subscriptionJson: string;
|
|
20
21
|
};
|
|
21
22
|
delivery: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
|
|
@@ -54,6 +55,7 @@ export declare const read: import("convex/server").RegisteredQuery<"public", {
|
|
|
54
55
|
recordJson: string;
|
|
55
56
|
reservationId?: import("convex/values").GenericId<"usageReservations"> | undefined;
|
|
56
57
|
scopeKey: string;
|
|
58
|
+
subscriptionId?: string | undefined;
|
|
57
59
|
subscriptionJson: string;
|
|
58
60
|
};
|
|
59
61
|
delivery: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/usage/queries.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/usage/queries.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;UAcd,CAAC;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCf,CAAC"}
|
|
@@ -11,6 +11,7 @@ export declare const scopeValidator: import("convex/values").VObject<{
|
|
|
11
11
|
}, "required", "customerAccount" | "livemode" | "meterId" | "stripeAccountId">;
|
|
12
12
|
export declare const deliveryValidator: 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>;
|
|
13
13
|
export declare const eventFields: {
|
|
14
|
+
subscriptionId: import("convex/values").VString<string | undefined, "optional">;
|
|
14
15
|
reservationId: import("convex/values").VId<import("convex/values").GenericId<"usageReservations"> | undefined, "optional">;
|
|
15
16
|
scopeKey: import("convex/values").VString<string, "required">;
|
|
16
17
|
identity: import("convex/values").VString<string, "required">;
|
|
@@ -28,8 +29,10 @@ export declare const eventDoc: import("convex/values").VObject<{
|
|
|
28
29
|
recordJson: string;
|
|
29
30
|
reservationId?: import("convex/values").GenericId<"usageReservations"> | undefined;
|
|
30
31
|
scopeKey: string;
|
|
32
|
+
subscriptionId?: string | undefined;
|
|
31
33
|
subscriptionJson: string;
|
|
32
34
|
}, {
|
|
35
|
+
subscriptionId: import("convex/values").VString<string | undefined, "optional">;
|
|
33
36
|
reservationId: import("convex/values").VId<import("convex/values").GenericId<"usageReservations"> | undefined, "optional">;
|
|
34
37
|
scopeKey: import("convex/values").VString<string, "required">;
|
|
35
38
|
identity: import("convex/values").VString<string, "required">;
|
|
@@ -39,7 +42,7 @@ export declare const eventDoc: import("convex/values").VObject<{
|
|
|
39
42
|
acceptedAt: import("convex/values").VFloat64<number, "required">;
|
|
40
43
|
_id: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
|
|
41
44
|
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
42
|
-
}, "required", "_creationTime" | "_id" | "acceptedAt" | "identity" | "occurredAt" | "recordJson" | "reservationId" | "scopeKey" | "subscriptionJson">;
|
|
45
|
+
}, "required", "_creationTime" | "_id" | "acceptedAt" | "identity" | "occurredAt" | "recordJson" | "reservationId" | "scopeKey" | "subscriptionId" | "subscriptionJson">;
|
|
43
46
|
export declare const usageEventsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
44
47
|
acceptedAt: number;
|
|
45
48
|
identity: string;
|
|
@@ -47,8 +50,10 @@ export declare const usageEventsTable: import("convex/server").TableDefinition<i
|
|
|
47
50
|
recordJson: string;
|
|
48
51
|
reservationId?: import("convex/values").GenericId<"usageReservations"> | undefined;
|
|
49
52
|
scopeKey: string;
|
|
53
|
+
subscriptionId?: string | undefined;
|
|
50
54
|
subscriptionJson: string;
|
|
51
55
|
}, {
|
|
56
|
+
subscriptionId: import("convex/values").VString<string | undefined, "optional">;
|
|
52
57
|
reservationId: import("convex/values").VId<import("convex/values").GenericId<"usageReservations"> | undefined, "optional">;
|
|
53
58
|
scopeKey: import("convex/values").VString<string, "required">;
|
|
54
59
|
identity: import("convex/values").VString<string, "required">;
|
|
@@ -56,8 +61,9 @@ export declare const usageEventsTable: import("convex/server").TableDefinition<i
|
|
|
56
61
|
subscriptionJson: import("convex/values").VString<string, "required">;
|
|
57
62
|
occurredAt: import("convex/values").VFloat64<number, "required">;
|
|
58
63
|
acceptedAt: import("convex/values").VFloat64<number, "required">;
|
|
59
|
-
}, "required", "acceptedAt" | "identity" | "occurredAt" | "recordJson" | "reservationId" | "scopeKey" | "subscriptionJson">, {
|
|
64
|
+
}, "required", "acceptedAt" | "identity" | "occurredAt" | "recordJson" | "reservationId" | "scopeKey" | "subscriptionId" | "subscriptionJson">, {
|
|
60
65
|
by_identity: ["identity", "_creationTime"];
|
|
66
|
+
by_scope_subscription: ["scopeKey", "subscriptionId", "_creationTime"];
|
|
61
67
|
by_scope_time: ["scopeKey", "occurredAt", "_creationTime"];
|
|
62
68
|
}, {}, {}>;
|
|
63
69
|
export declare const outboxFields: {
|
|
@@ -68,7 +74,7 @@ export declare const outboxFields: {
|
|
|
68
74
|
firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
69
75
|
leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
70
76
|
held: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
71
|
-
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>;
|
|
77
|
+
reason: import("convex/values").VUnion<"administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined, [import("convex/values").VLiteral<"billing_period_closed", "required">, 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>;
|
|
72
78
|
receipt: import("convex/values").VObject<{
|
|
73
79
|
created: number;
|
|
74
80
|
identifier: string;
|
|
@@ -98,7 +104,7 @@ export declare const outboxDoc: import("convex/values").VObject<{
|
|
|
98
104
|
nextAttemptAt: number;
|
|
99
105
|
provider?: string | undefined;
|
|
100
106
|
providerIdentifier: string;
|
|
101
|
-
reason?: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
107
|
+
reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
102
108
|
receipt?: {
|
|
103
109
|
created: number;
|
|
104
110
|
identifier: string;
|
|
@@ -114,7 +120,7 @@ export declare const outboxDoc: import("convex/values").VObject<{
|
|
|
114
120
|
firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
115
121
|
leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
116
122
|
held: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
117
|
-
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>;
|
|
123
|
+
reason: import("convex/values").VUnion<"administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined, [import("convex/values").VLiteral<"billing_period_closed", "required">, 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>;
|
|
118
124
|
receipt: import("convex/values").VObject<{
|
|
119
125
|
created: number;
|
|
120
126
|
identifier: string;
|
|
@@ -144,7 +150,7 @@ export declare const usageOutboxTable: import("convex/server").TableDefinition<i
|
|
|
144
150
|
nextAttemptAt: number;
|
|
145
151
|
provider?: string | undefined;
|
|
146
152
|
providerIdentifier: string;
|
|
147
|
-
reason?: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
153
|
+
reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
148
154
|
receipt?: {
|
|
149
155
|
created: number;
|
|
150
156
|
identifier: string;
|
|
@@ -160,7 +166,7 @@ export declare const usageOutboxTable: import("convex/server").TableDefinition<i
|
|
|
160
166
|
firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
161
167
|
leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
162
168
|
held: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
163
|
-
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>;
|
|
169
|
+
reason: import("convex/values").VUnion<"administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined, [import("convex/values").VLiteral<"billing_period_closed", "required">, 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>;
|
|
164
170
|
receipt: import("convex/values").VObject<{
|
|
165
171
|
created: number;
|
|
166
172
|
identifier: string;
|
|
@@ -206,5 +212,6 @@ export declare const usageReservationsTable: import("convex/server").TableDefini
|
|
|
206
212
|
eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents"> | undefined, "optional">;
|
|
207
213
|
}, "required", "eventId" | "planJson" | "scaledQuantity" | "scopeKey" | "sourceEventId" | "state">, {
|
|
208
214
|
by_scope_source: ["scopeKey", "sourceEventId", "_creationTime"];
|
|
215
|
+
by_scope_state: ["scopeKey", "state", "_creationTime"];
|
|
209
216
|
}, {}, {}>;
|
|
210
217
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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,cAAc;IACd,aAAa;IACb,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,gBAAgB;IAChB,UAAU;IACV,UAAU;CACX,CAAC;AACF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;wKAInB,CAAC;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;UAGwB,CAAC;AACtD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;CASxB,CAAC;AACF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6TAIpB,CAAC;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAIoB,CAAC;AAClD,eAAO,MAAM,uBAAuB;;;;;;;;UAGF,CAAC;AAInC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;UAac,CAAC"}
|
|
@@ -9,6 +9,7 @@ export const scopeValidator = v.object({
|
|
|
9
9
|
});
|
|
10
10
|
export const deliveryValidator = v.union(v.literal("queued"), v.literal("sending"), v.literal("provider_accepted"), v.literal("rejected"), v.literal("unknown"), v.literal("held"));
|
|
11
11
|
export const eventFields = {
|
|
12
|
+
subscriptionId: v.optional(v.string()),
|
|
12
13
|
reservationId: v.optional(v.id("usageReservations")),
|
|
13
14
|
scopeKey: v.string(),
|
|
14
15
|
identity: v.string(),
|
|
@@ -24,6 +25,7 @@ export const eventDoc = v.object({
|
|
|
24
25
|
});
|
|
25
26
|
export const usageEventsTable = defineTable(eventFields)
|
|
26
27
|
.index("by_identity", ["identity"])
|
|
28
|
+
.index("by_scope_subscription", ["scopeKey", "subscriptionId"])
|
|
27
29
|
.index("by_scope_time", ["scopeKey", "occurredAt"]);
|
|
28
30
|
export const outboxFields = {
|
|
29
31
|
...deliveryFields,
|
|
@@ -59,5 +61,7 @@ export const usageReservationsTable = defineTable({
|
|
|
59
61
|
scaledQuantity: v.string(),
|
|
60
62
|
state: v.union(v.literal("reserved"), v.literal("committed"), v.literal("released")),
|
|
61
63
|
eventId: v.optional(v.id("usageEvents")),
|
|
62
|
-
})
|
|
64
|
+
})
|
|
65
|
+
.index("by_scope_source", ["scopeKey", "sourceEventId"])
|
|
66
|
+
.index("by_scope_state", ["scopeKey", "state"]);
|
|
63
67
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/component/usage/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;IAC3B,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;CACtB,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CACtC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EACnB,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EACpB,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAC9B,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EACrB,CAAC,CAAC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CAAC;KACvD,KAAK,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,CAAC;KAC9B,KAAK,CAAC,eAAe,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;KAClD,KAAK,CAAC,gBAAgB,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;AAClD,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAC;IACjD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;AACnC,6EAA6E;AAC7E,6EAA6E;AAC7E,oEAAoE;AACpE,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAC;IAChD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,KAAK,EAAE,CAAC,CAAC,KAAK,CACZ,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EACrB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EACtB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CACtB;IACD,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;CACzC,CAAC;KACC,KAAK,CAAC,iBAAiB,EAAE,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;KACvD,KAAK,CAAC,gBAAgB,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const reason: import("convex/values").VUnion<"administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy", [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">], "required", never>;
|
|
1
|
+
export declare const reason: import("convex/values").VUnion<"administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy", [import("convex/values").VLiteral<"billing_period_closed", "required">, 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">], "required", never>;
|
|
2
2
|
export { usageDeliveryOutcomeValidator as outcome } from "../../client/usage/deliveryProtocol.js";
|
|
3
3
|
export declare const deliveryFields: {
|
|
4
4
|
historySequence: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
@@ -8,7 +8,7 @@ export declare const deliveryFields: {
|
|
|
8
8
|
firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
9
9
|
leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
10
10
|
held: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
11
|
-
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>;
|
|
11
|
+
reason: import("convex/values").VUnion<"administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined, [import("convex/values").VLiteral<"billing_period_closed", "required">, 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>;
|
|
12
12
|
receipt: import("convex/values").VObject<{
|
|
13
13
|
created: number;
|
|
14
14
|
identifier: string;
|
|
@@ -75,5 +75,6 @@ export declare const errorsTable: import("convex/server").TableDefinition<import
|
|
|
75
75
|
}, "required", "code" | "dedupe" | "eventId" | "observedAt" | "providerEventId" | "scopeKey">, {
|
|
76
76
|
by_dedupe: ["dedupe", "_creationTime"];
|
|
77
77
|
by_event: ["eventId", "_creationTime"];
|
|
78
|
+
by_scope: ["scopeKey", "_creationTime"];
|
|
78
79
|
}, {}, {}>;
|
|
79
80
|
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/component/usageDelivery/fields.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/component/usageDelivery/fields.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,q2BAUlB,CAAC;AACF,OAAO,EAAE,6BAA6B,IAAI,OAAO,EAAE,MAAM,wCAAwC,CAAC;AAClG,eAAO,MAAM,cAAc;IACzB,eAAe;IACf,QAAQ;IACR,UAAU;IACV,iBAAiB;IACjB,WAAW;IACX,UAAU;IACV,IAAI;IACJ,MAAM;IACN,OAAO;;;;;;;CAGR,CAAC;AACF,eAAO,MAAM,UAAU;;;;;;;;;;;;UAKI,CAAC;AAE5B,eAAO,MAAM,SAAS,i9BAUrB,CAAC;AACF,eAAO,MAAM,WAAW;IACtB,QAAQ;IACR,OAAO;IACP,eAAe;IACf,IAAI;IACJ,UAAU;IACV,MAAM;CACP,CAAC;AACF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;uHAInB,CAAC;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;UAGS,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineTable } from "convex/server";
|
|
2
2
|
import { v } from "convex/values";
|
|
3
|
-
export const reason = v.union(v.literal("rate_limited"), v.literal("provider_unavailable"), v.literal("provider_outcome_unknown"), v.literal("provider_rejected"), v.literal("retry_exhausted"), v.literal("delivery_window_expired"), v.literal("scope_busy"), v.literal("administrative_hold"));
|
|
3
|
+
export const reason = v.union(v.literal("billing_period_closed"), v.literal("rate_limited"), v.literal("provider_unavailable"), v.literal("provider_outcome_unknown"), v.literal("provider_rejected"), v.literal("retry_exhausted"), v.literal("delivery_window_expired"), v.literal("scope_busy"), v.literal("administrative_hold"));
|
|
4
4
|
export { usageDeliveryOutcomeValidator as outcome } from "../../client/usage/deliveryProtocol.js";
|
|
5
5
|
export const deliveryFields = {
|
|
6
6
|
historySequence: v.optional(v.number()),
|
|
@@ -35,5 +35,6 @@ export const errorDoc = v.object({
|
|
|
35
35
|
});
|
|
36
36
|
export const errorsTable = defineTable(errorFields)
|
|
37
37
|
.index("by_dedupe", ["dedupe"])
|
|
38
|
+
.index("by_scope", ["scopeKey"])
|
|
38
39
|
.index("by_event", ["eventId"]);
|
|
39
40
|
//# sourceMappingURL=fields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../src/component/usageDelivery/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAC3B,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,EACzB,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,EACjC,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,EACrC,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAC9B,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAC5B,CAAC,CAAC,OAAO,CAAC,yBAAyB,CAAC,EACpC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EACvB,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,CACjC,CAAC;AACF,OAAO,EAAE,6BAA6B,IAAI,OAAO,EAAE,MAAM,wCAAwC,CAAC;AAClG,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACvC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAChC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,iBAAiB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACnC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAA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?: import("convex/values").GenericId<"usageReservations"> | undefined;
|
|
16
16
|
scopeKey: string;
|
|
17
|
+
subscriptionId?: string | undefined;
|
|
17
18
|
subscriptionJson: string;
|
|
18
19
|
};
|
|
19
20
|
outbox: {
|
|
@@ -30,7 +31,7 @@ export declare function read(ctx: QueryCtx, args: {
|
|
|
30
31
|
nextAttemptAt: number;
|
|
31
32
|
provider?: string | undefined;
|
|
32
33
|
providerIdentifier: string;
|
|
33
|
-
reason?: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
34
|
+
reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
34
35
|
receipt?: {
|
|
35
36
|
created: number;
|
|
36
37
|
identifier: string;
|
|
@@ -52,7 +53,7 @@ export declare function statusOf(outbox: Doc<"usageOutbox">): {
|
|
|
52
53
|
state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
|
|
53
54
|
attempts: number;
|
|
54
55
|
held: boolean;
|
|
55
|
-
reason: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
56
|
+
reason: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
56
57
|
providerIdentifier: string;
|
|
57
58
|
receipt: {
|
|
58
59
|
created: number;
|
|
@@ -68,7 +69,7 @@ export declare function currentStatus(ctx: QueryCtx, outbox: Doc<"usageOutbox">)
|
|
|
68
69
|
state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
|
|
69
70
|
attempts: number;
|
|
70
71
|
held: boolean;
|
|
71
|
-
reason: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
72
|
+
reason: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
72
73
|
providerIdentifier: string;
|
|
73
74
|
receipt: {
|
|
74
75
|
created: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/component/usageDelivery/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACpB,MAAM,+BAA+B,CAAC;AAEvC,wBAAsB,IAAI,CACxB,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC,aAAa,CAAC,CAAA;CAAE
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/component/usageDelivery/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACpB,MAAM,+BAA+B,CAAC;AAEvC,wBAAsB,IAAI,CACxB,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC,aAAa,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAab,mBAAmB;GAE9D;AACD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,aAAa,CAAC;IAE/C,gBAAgB,EAAQ,KAAK,CAAC;QAC5B,eAAe,EAAE,MAAM,CAAC;QACxB,IAAI,EAAE,OAAO,eAAe,EAAE,KAAK,CACjC,cAAc,aAAa,EAAE,SAAS,CACvC,CAAC;QACF,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,yBAAyB;IACzB,OAAO;IACP,KAAK;IACL,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,kBAAkB;IAClB,OAAO;;;;EAEV;AACD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,mBAAmB;;;EAanD;AAED,wBAAsB,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,aAAa,CAAC;;;;;;;;;;;;;;;;;GAiB5E"}
|
|
@@ -13,7 +13,7 @@ export declare const start: import("convex/server").RegisteredMutation<"public",
|
|
|
13
13
|
state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
|
|
14
14
|
attempts: number;
|
|
15
15
|
held: boolean;
|
|
16
|
-
reason: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
16
|
+
reason: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
17
17
|
providerIdentifier: string;
|
|
18
18
|
receipt: {
|
|
19
19
|
created: number;
|
|
@@ -39,7 +39,7 @@ export declare const hold: import("convex/server").RegisteredMutation<"public",
|
|
|
39
39
|
state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
|
|
40
40
|
attempts: number;
|
|
41
41
|
held: boolean;
|
|
42
|
-
reason: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
42
|
+
reason: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
43
43
|
providerIdentifier: string;
|
|
44
44
|
receipt: {
|
|
45
45
|
created: number;
|
|
@@ -65,7 +65,7 @@ export declare const resume: import("convex/server").RegisteredMutation<"public"
|
|
|
65
65
|
state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
|
|
66
66
|
attempts: number;
|
|
67
67
|
held: boolean;
|
|
68
|
-
reason: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
68
|
+
reason: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
69
69
|
providerIdentifier: string;
|
|
70
70
|
receipt: {
|
|
71
71
|
created: number;
|
|
@@ -11,7 +11,7 @@ export declare const get: import("convex/server").RegisteredQuery<"public", {
|
|
|
11
11
|
state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
|
|
12
12
|
attempts: number;
|
|
13
13
|
held: boolean;
|
|
14
|
-
reason: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
14
|
+
reason: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
15
15
|
providerIdentifier: string;
|
|
16
16
|
receipt: {
|
|
17
17
|
created: number;
|
|
@@ -42,6 +42,7 @@ export declare const saved: import("convex/server").RegisteredQuery<"internal",
|
|
|
42
42
|
recordJson: string;
|
|
43
43
|
reservationId?: import("convex/values").GenericId<"usageReservations"> | undefined;
|
|
44
44
|
scopeKey: string;
|
|
45
|
+
subscriptionId?: string | undefined;
|
|
45
46
|
subscriptionJson: string;
|
|
46
47
|
};
|
|
47
48
|
outbox: {
|
|
@@ -58,7 +59,7 @@ export declare const saved: import("convex/server").RegisteredQuery<"internal",
|
|
|
58
59
|
nextAttemptAt: number;
|
|
59
60
|
provider?: string | undefined;
|
|
60
61
|
providerIdentifier: string;
|
|
61
|
-
reason?: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
62
|
+
reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
62
63
|
receipt?: {
|
|
63
64
|
created: number;
|
|
64
65
|
identifier: string;
|
|
@@ -67,6 +68,12 @@ export declare const saved: import("convex/server").RegisteredQuery<"internal",
|
|
|
67
68
|
state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
|
|
68
69
|
workflowId?: string | undefined;
|
|
69
70
|
};
|
|
71
|
+
billingCutoff: number | null;
|
|
72
|
+
managedCollection: {
|
|
73
|
+
method: "charge_automatically" | "send_invoice";
|
|
74
|
+
daysUntilDue: number | null;
|
|
75
|
+
defaultPaymentMethod: string | null;
|
|
76
|
+
} | null;
|
|
70
77
|
}>>;
|
|
71
78
|
export declare const snapshot: import("convex/server").RegisteredQuery<"public", {
|
|
72
79
|
eventId: import("convex/values").GenericId<"usageEvents">;
|
|
@@ -86,6 +93,7 @@ export declare const snapshot: import("convex/server").RegisteredQuery<"public",
|
|
|
86
93
|
recordJson: string;
|
|
87
94
|
reservationId?: import("convex/values").GenericId<"usageReservations"> | undefined;
|
|
88
95
|
scopeKey: string;
|
|
96
|
+
subscriptionId?: string | undefined;
|
|
89
97
|
subscriptionJson: string;
|
|
90
98
|
};
|
|
91
99
|
outbox: {
|
|
@@ -102,7 +110,7 @@ export declare const snapshot: import("convex/server").RegisteredQuery<"public",
|
|
|
102
110
|
nextAttemptAt: number;
|
|
103
111
|
provider?: string | undefined;
|
|
104
112
|
providerIdentifier: string;
|
|
105
|
-
reason?: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
113
|
+
reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
106
114
|
receipt?: {
|
|
107
115
|
created: number;
|
|
108
116
|
identifier: string;
|
|
@@ -111,5 +119,11 @@ export declare const snapshot: import("convex/server").RegisteredQuery<"public",
|
|
|
111
119
|
state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
|
|
112
120
|
workflowId?: string | undefined;
|
|
113
121
|
};
|
|
122
|
+
billingCutoff: number | null;
|
|
123
|
+
managedCollection: {
|
|
124
|
+
method: "charge_automatically" | "send_invoice";
|
|
125
|
+
daysUntilDue: number | null;
|
|
126
|
+
defaultPaymentMethod: string | null;
|
|
127
|
+
} | null;
|
|
114
128
|
}>>;
|
|
115
129
|
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/usageDelivery/queries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/usageDelivery/queries.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;GAKd,CAAC;AAsCH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAoC,CAAC;AACvD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA4B,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { managedBillingPolicy } from "../usageSubscriptions/acceptance.js";
|
|
2
|
+
import { subscriptionSnapshot } from "../usage/helpers.js";
|
|
1
3
|
import { query, internalQuery } from "../_generated/server.js";
|
|
2
4
|
import { refFields, status } from "./schema.js";
|
|
3
5
|
import { read, currentStatus } from "./helpers.js";
|
|
@@ -10,10 +12,25 @@ export const get = query({
|
|
|
10
12
|
});
|
|
11
13
|
const snapshotDefinition = {
|
|
12
14
|
args: refFields,
|
|
13
|
-
returns: v.object({
|
|
15
|
+
returns: v.object({
|
|
16
|
+
event: eventDoc,
|
|
17
|
+
outbox: outboxDoc,
|
|
18
|
+
billingCutoff: v.union(v.number(), v.null()),
|
|
19
|
+
managedCollection: v.union(v.null(), v.object({
|
|
20
|
+
method: v.union(v.literal("send_invoice"), v.literal("charge_automatically")),
|
|
21
|
+
daysUntilDue: v.union(v.number(), v.null()),
|
|
22
|
+
defaultPaymentMethod: v.union(v.string(), v.null()),
|
|
23
|
+
})),
|
|
24
|
+
}),
|
|
14
25
|
handler: async (ctx, args) => {
|
|
15
|
-
const { event, outbox } = await read(ctx, args);
|
|
16
|
-
|
|
26
|
+
const { event, outbox, record } = await read(ctx, args);
|
|
27
|
+
const policy = await managedBillingPolicy(ctx, record, subscriptionSnapshot(event.subscriptionJson));
|
|
28
|
+
return {
|
|
29
|
+
event,
|
|
30
|
+
outbox,
|
|
31
|
+
billingCutoff: policy?.cutoff ?? null,
|
|
32
|
+
managedCollection: policy?.collection ?? null,
|
|
33
|
+
};
|
|
17
34
|
},
|
|
18
35
|
};
|
|
19
36
|
const _refValidator = v.object(refFields);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/component/usageDelivery/queries.ts"],"names":[],"mappings":"AAA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YACN,aAAa,EAAE,MAAM,EAAE,MAAM,IAAI,IAAI;YACrC,iBAAiB,EAAE,MAAM,EAAE,UAAU,IAAI,IAAI;SAC9C,CAAC;IACJ,CAAC;CACF,CAAC;AACF,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAC1C,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -17,7 +17,7 @@ export declare const status: import("convex/values").VObject<{
|
|
|
17
17
|
eventId: import("convex/values").GenericId<"usageEvents">;
|
|
18
18
|
held: boolean;
|
|
19
19
|
providerIdentifier: string;
|
|
20
|
-
reason?: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
20
|
+
reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
21
21
|
receipt?: {
|
|
22
22
|
created: number;
|
|
23
23
|
identifier: string;
|
|
@@ -48,7 +48,7 @@ export declare const status: import("convex/values").VObject<{
|
|
|
48
48
|
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>;
|
|
49
49
|
attempts: import("convex/values").VFloat64<number, "required">;
|
|
50
50
|
held: import("convex/values").VBoolean<boolean, "required">;
|
|
51
|
-
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>;
|
|
51
|
+
reason: import("convex/values").VUnion<"administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined, [import("convex/values").VLiteral<"billing_period_closed", "required">, 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>;
|
|
52
52
|
providerIdentifier: import("convex/values").VString<string, "required">;
|
|
53
53
|
receipt: import("convex/values").VObject<{
|
|
54
54
|
created: number;
|
|
@@ -66,7 +66,7 @@ export declare const save: import("convex/server").RegisteredMutation<"internal"
|
|
|
66
66
|
state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
|
|
67
67
|
attempts: number;
|
|
68
68
|
held: boolean;
|
|
69
|
-
reason: "administrative_hold" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
69
|
+
reason: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
|
|
70
70
|
providerIdentifier: string;
|
|
71
71
|
receipt: {
|
|
72
72
|
created: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../../src/component/usageDelivery/steps.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../../src/component/usageDelivery/steps.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,KAAK;;;;;;;;;UAgBG,MAAM;;;;UAuBX,MAAM;;;;;UAoFV,OAAO;;;2BAIQ,CAAC;;;;;;;;;;;GAM1B,CAAC;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEf,CAAC;AACH,eAAO,MAAM,OAAO;;;;;;;;iBAoBlB,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { managedBillingCutoff } from "../usageSubscriptions/acceptance.js";
|
|
2
|
+
import { subscriptionSnapshot } from "../usage/helpers.js";
|
|
1
3
|
import { appendDeliveryHistory } from "../usageObservations/history.js";
|
|
2
4
|
import { internalMutation } from "../_generated/server.js";
|
|
3
5
|
import { v } from "convex/values";
|
|
@@ -8,7 +10,7 @@ export const claim = internalMutation({
|
|
|
8
10
|
args: refFields,
|
|
9
11
|
returns: v.union(v.object({ kind: v.literal("ready"), request: v.object(request) }), v.object({ kind: v.literal("wait"), delayMs: v.number() }), v.object({ kind: v.literal("done") })),
|
|
10
12
|
handler: async (ctx, args) => {
|
|
11
|
-
const { outbox, record } = await read(ctx, args), now = Math.floor(Date.now() / 1000);
|
|
13
|
+
const { event, outbox, record } = await read(ctx, args), now = Math.floor(Date.now() / 1000);
|
|
12
14
|
if (outbox.held ||
|
|
13
15
|
["provider_accepted", "rejected", "unknown", "held"].includes(outbox.state))
|
|
14
16
|
return { kind: "done" };
|
|
@@ -36,6 +38,15 @@ export const claim = internalMutation({
|
|
|
36
38
|
await appendDeliveryHistory(ctx, args.eventId, "unknown", outbox.attempts, `result:${outbox.attempts}:unknown`);
|
|
37
39
|
return { kind: "done" };
|
|
38
40
|
}
|
|
41
|
+
const cutoff = await managedBillingCutoff(ctx, record, subscriptionSnapshot(event.subscriptionJson));
|
|
42
|
+
if (cutoff !== null && now >= cutoff) {
|
|
43
|
+
await ctx.db.patch("usageOutbox", outbox._id, {
|
|
44
|
+
state: "held",
|
|
45
|
+
reason: "billing_period_closed",
|
|
46
|
+
});
|
|
47
|
+
await appendDeliveryHistory(ctx, args.eventId, "held", outbox.attempts, `billing-period:${outbox.attempts}`);
|
|
48
|
+
return { kind: "done" };
|
|
49
|
+
}
|
|
39
50
|
const keys = lockKeys(record);
|
|
40
51
|
const realm = await ctx.db
|
|
41
52
|
.query("usageDeliveryLocks")
|