Repository navigation
Release Platform packages - #6
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
@codelitdev/billing@0.4.0
Minor Changes
7b4a9ad: The engine now owns the lifecycle mechanics that products re-implemented (ADR 0011).
runReconciliationBatchfirst queues stuck checkouts, interrupted plan changes, and subscriptions not reconciled recently. Thresholds are set withcreateBilling({ reconciliation }); passdiscover: falseto skip.paidThroughAtpasses.commercialStatere-checks the clock,runDeadlineBatchreleases the subscription and queues a reconciliation, andstartCheckoutreleases a lapsed entitlement itself.commercialState(entityId, { transaction })reads inside the caller's transaction; the Drizzle store locks the rows it reads.cancel,resumeCancellation, andstartPlanChangeread the subscription back from the provider, so read models update before the webhook arrives.billing.storeis internal.Product changes for this release
commercialState, inside your transaction when you reserve quota, instead of copying it into product tables or reading billing tables.billing.store.BillingStoreimplementations must addlistUnreconciledSubscriptions,listStuckCreatingCheckouts,listStuckPlanChanges, andrunInTransaction.7b4a9ad: Cancelling a subscription now keeps it active until the end of the paid period (ADR 0010). Previously the Dodo adapter ended it immediately, so the customer lost the time they had paid for.
commercialStatereportscancelAtPeriodEnd: trueandpaidThroughAtwhile a cancellation is scheduled, and the newresumeCancellationclears it. While a worker is sending a retried cancellation,resumeCancellationfails with a retryableoperation_conflicted, so the cancellation cannot land after the resume.Product changes for this release
commercialState().paidThroughAtwhencancelAtPeriodEndis true, and offer to resume.billing.resumeCancellation({ grant, entity, payer }), using acancellationgrant. Do not start a new checkout while the subscription is still active.resumeSubscription, andcancelSubscriptionmust schedule the cancellation at period end.7b4a9ad:
createDodoBillingProvideraccepts an optionalbrandId(ADR 0009). When products share one Dodo business, Dodo sends every event to every webhook endpoint. WithbrandIdset, a verified webhook whosebrand_idnames another brand is stored asignoredinstead of being processed and quarantined. Webhooks without abrand_idare processed as before.Product changes for this release
brandId, for example from aDODO_BRAND_IDenvironment variable.7b4a9ad: Add a Lemon Squeezy provider adapter and subscription adoption (ADR 0014).
@codelitdev/billing/providers/lemonsqueezyexportscreateLemonSqueezyBillingProvider({ apiKey, storeId, webhookSecrets }). Catalog offers use Lemon Squeezy variant IDs. Webhooks from other stores are stored asignored. A checkout offers only the chosen variant, so the buyer cannot switch plans on the Lemon Squeezy page.adoptProviderSubscription(engine andcreateOperations) takes over a subscription created outside the engine, such as one started with the provider before the product used this package. The subscription's product must be in the active catalog revision.commercialStatereports theproviderholding the paid subscription.resumeCancellationaccepts a subscription whose status iscancelledwhile its cancellation is only scheduled, which is how Lemon Squeezy reports it until the period ends.checkoutAssignsCustomer. For those, the first subscription from a payer's checkout moves the payer's customer record to the customer the provider chose. Lemon Squeezy declares it, because its checkout can create a new customer.intervalChangesBillImmediately. For those,startPlanChangewithdo_not_billto another billing interval fails withplan_change_not_supportedbefore the provider is called. Lemon Squeezy declares it, because such a change restarts and bills the period.immediatePlanChangesOnly. For those,startPlanChangewitheffectiveAt: "next_billing_date"fails withplan_change_not_supportedbefore an attempt is created. Lemon Squeezy declares it.catalog_revision_used_by_another_providerinstead of a database unique-key error.Product changes for this release
checkoutProvider: "lemonsqueezy", use variant IDs in the catalog, and mount its webhook at/webhooks/billing/lemonsqueezy.adoptProviderSubscriptionafter the catalog is verified.CommercialBillingStateobjects, such as test fixtures, must addprovider.7b4a9ad: A payer can switch offers while a checkout is open.
startCheckoutfor another offer, such as yearly after monthly, now replaces the payer's own open checkout instead of failing withcheckout_pendinguntil it expires. The old checkout becomesabandoned. If it is paid anyway, it becomesconflicted; it grants access when nothing else does, and otherwise the second subscription is quarantined. Another payer's open checkout still returnscheckout_pending.CreateCheckoutInputgains an optionalexpiresAt. The Lemon Squeezy adapter sends it as the checkout'sexpires_at, so the old page stops working when the attempt expires. Dodo checkout sessions take no expiry.Product changes for this release
checkout_pendingwhen a person switched intervals can keep it for the other-payer case.Patch Changes
FakeBillingProvidertakes an optionalprovidername, so tests can compose two providers. A new test covers serving subscriptions on one provider after checkout moves to another.@codelitdev/platform@0.4.0
Minor Changes
7b4a9ad: Add
@codelitdev/platform/billingand@codelitdev/platform/billing/drizzlewith the adapters products wrote themselves around@codelitdev/billing(ADR 0013): single-use action grants stored in Better Auth'sverificationtable, AES-256-GCM encryption for stored billing values, a return-URL validator, a maintenance worker runner, a webhook handler forPOST /webhooks/billing/<provider>(400 for a rejected signature or body, 503 when a verified webhook cannot be stored, so the provider retries), and HTTP mapping for billing errors.@codelitdev/billinganddrizzle-ormare optional peer dependencies; the root export is unchanged.Product changes for this release
BillingAuthorizationPortwithcreateBillingActionGrants. Issue a token from an authenticated route, send it with the billing request, and handlerecent_authentication_required.Patch Changes
@codelitdev/mcp-server-kit@0.4.0
Patch Changes
@codelitdev/platform-conformance@0.4.0
Patch Changes
@codelitdev/design-system@0.4.0
No changes in this release.
@codelitdev/oauth-server-kit@0.4.0
No changes in this release.
@codelitdev/observability@0.4.0
No changes in this release.
@codelitdev/platform-cli@0.4.0
No changes in this release.