@pithy-sh/payments 0.6.1 → 0.7.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/README.md +6 -1
- package/dist/admin/coverage.d.ts.map +1 -1
- package/dist/admin/coverage.js +13 -7
- package/dist/admin/read.d.ts +60 -0
- package/dist/admin/read.d.ts.map +1 -1
- package/dist/admin/read.js +86 -2
- package/dist/audit/actions.d.ts +5 -0
- package/dist/audit/actions.d.ts.map +1 -1
- package/dist/audit/actions.js +6 -1
- package/dist/capability.d.ts +3 -3
- package/dist/capability.d.ts.map +1 -1
- package/dist/capability.js +14 -7
- package/dist/client/api.d.ts +25 -9
- package/dist/client/api.d.ts.map +1 -1
- package/dist/client/api.js +68 -12
- package/dist/client/hooks.d.ts +27 -39
- package/dist/client/hooks.d.ts.map +1 -1
- package/dist/client/hooks.js +166 -315
- package/dist/client/projection.d.ts +25 -18
- package/dist/client/projection.d.ts.map +1 -1
- package/dist/client/railChoice.d.ts +46 -0
- package/dist/client/railChoice.d.ts.map +1 -0
- package/dist/client/railChoice.js +48 -0
- package/dist/data/webhookEvent.d.ts +67 -0
- package/dist/data/webhookEvent.d.ts.map +1 -1
- package/dist/data/webhookEvent.js +76 -1
- package/dist/http/responses.d.ts +64 -0
- package/dist/http/responses.d.ts.map +1 -1
- package/dist/http/responses.js +34 -1
- package/dist/http/routes.d.ts +1 -0
- package/dist/http/routes.d.ts.map +1 -1
- package/dist/http/routes.js +64 -11
- package/dist/http/schemas.d.ts +19 -0
- package/dist/http/schemas.d.ts.map +1 -1
- package/dist/http/schemas.js +18 -1
- package/dist/http/scopes.d.ts +15 -6
- package/dist/http/scopes.d.ts.map +1 -1
- package/dist/http/scopes.js +55 -5
- package/dist/http/view.d.ts +9 -2
- package/dist/http/view.d.ts.map +1 -1
- package/dist/http/view.js +29 -1
- package/dist/http/webhookGuard.d.ts +7 -1
- package/dist/http/webhookGuard.d.ts.map +1 -1
- package/dist/http/webhookGuard.js +3 -2
- package/dist/migrations/0003_webhook_targets.d.ts +19 -0
- package/dist/migrations/0003_webhook_targets.d.ts.map +1 -0
- package/dist/migrations/0003_webhook_targets.js +29 -0
- package/dist/processing/activities.d.ts +9 -0
- package/dist/processing/activities.d.ts.map +1 -0
- package/dist/processing/activities.js +30 -0
- package/dist/projection/orphans.d.ts.map +1 -1
- package/dist/projection/orphans.js +15 -6
- package/dist/projection/targets.d.ts +50 -0
- package/dist/projection/targets.d.ts.map +1 -0
- package/dist/projection/targets.js +50 -0
- package/dist/purge/contribution.d.ts +32 -0
- package/dist/purge/contribution.d.ts.map +1 -0
- package/dist/purge/contribution.js +120 -0
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/dist/workflows/paddleSweep.d.ts.map +1 -1
- package/dist/workflows/paddleSweep.js +20 -9
- package/docs/lemon-squeezy.md +1 -1
- package/docs/paddle.md +2 -0
- package/package.json +6 -4
- package/src/admin/coverage.ts +13 -9
- package/src/admin/read.ts +135 -0
- package/src/audit/actions.ts +5 -0
- package/src/capability.ts +25 -15
- package/src/client/api.ts +74 -11
- package/src/client/hooks.ts +206 -301
- package/src/client/projection.ts +25 -18
- package/src/client/railChoice.ts +72 -0
- package/src/data/webhookEvent.ts +115 -0
- package/src/http/responses.ts +66 -0
- package/src/http/routes.ts +73 -11
- package/src/http/schemas.ts +26 -0
- package/src/http/scopes.ts +58 -6
- package/src/http/view.ts +31 -1
- package/src/http/webhookGuard.ts +23 -3
- package/src/migrations/0003_webhook_targets.ts +34 -0
- package/src/processing/activities.ts +34 -0
- package/src/projection/orphans.ts +28 -11
- package/src/projection/targets.ts +66 -0
- package/src/purge/contribution.ts +135 -0
- package/src/version.generated.ts +1 -1
- package/src/workflows/paddleSweep.ts +39 -14
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @pithy-sh/payments
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Five payment rails — Apple, Google, Stripe, Paddle, Lemon Squeezy — resolving to one cross-rail entitlement, in your own Worker and your own D1.
|
|
4
4
|
|
|
5
5
|
Buy Pro on iOS, be entitled on the web. That resolution is the whole product, and it is the same one **[RevenueCat](https://www.revenuecat.com)** built a very good business on — their SDKs, their store-quirk coverage and their dashboards are genuinely ahead of this package. The honest difference is not the feature list. It is **where the purchase history lives**: RevenueCat is a hosted data plane holding your customers' transactions, and this is ten tables in a D1 you own, written by a Worker you deploy.
|
|
6
6
|
|
|
@@ -48,6 +48,7 @@ _Everything else is on the site. `pithy.sh/docs` is canonical — new prose goes
|
|
|
48
48
|
| `GET /payments/admin/entitlements/:subjectType/:subjectId` | One subject's entitlements, override and resolved allowances | control-plane: `payments:entitlements:read` |
|
|
49
49
|
| `GET /payments/admin/overrides` | Every subject's override, and who is unrestricted | control-plane: `payments:entitlements:read` |
|
|
50
50
|
| `GET /payments/admin/usage-runs` | The usage-reporting passes this deployment has run | control-plane: `payments:usage:read` |
|
|
51
|
+
| `GET /payments/admin/webhook-events` | Every notification a store sent — projected, pending with its attempts, or abandoned — and the purchase and subscription rows it changed. Never the payload; an error crosses as its code | control-plane: `payments:webhooks:read` |
|
|
51
52
|
| `GET /payments/admin/reconcile-runs` | The reconciliation passes this deployment has run | control-plane: `payments:reconcile:read` |
|
|
52
53
|
| `POST /payments/admin/reconcile-runs` | Start a pass now, rather than waiting for the nightly one | control-plane: `payments:reconcile:run` |
|
|
53
54
|
|
|
@@ -160,6 +161,10 @@ The body is empty and there is no amount anywhere: every refund raised is for a
|
|
|
160
161
|
|
|
161
162
|
**None of the six accepts a subscription, a price, or a rail.** `change` and `preview` take one field, `productId`, and the route resolves the store's own price from the catalog; `cancel` takes `timing`, which is `now` or `at_period_end` in the customer's own terms rather than the store's; `keep` and `refund` take no body at all. A body naming a price would move a customer onto a plan the project does not sell, and a body naming a subscription would move somebody else's — so neither is refused by a check, and both are unreachable because there is nowhere to write them.
|
|
162
163
|
|
|
164
|
+
## A person's data
|
|
165
|
+
|
|
166
|
+
**Retained.** When an account is purged, payments erases nothing: *Kept for tax and accounting records, which the law requires a business to hold after an account is closed.* The purge records the step as retained with that basis, and an export hands back a user subject's purchases, entitlements, provider accounts, overrides, meter counters and usage reports — never the provider's payload. An organization's rows are the organization's. See [`@pithy-sh/auth`'s account lifecycle](../auth/docs/account-lifecycle.md#what-each-capability-does-with-a-persons-rows).
|
|
167
|
+
|
|
163
168
|
## License
|
|
164
169
|
|
|
165
170
|
MIT — adopter-side app value. The root `LICENSE` covers it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../src/admin/coverage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../src/admin/coverage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAUrD;;;;;;;;;;;;;;;;;;GAkBG;AAEH,8FAA8F;AAC9F,MAAM,MAAM,kBAAkB,GAC1B;IACE;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,iBAAiB,EAAE,GAAG,iBAAiB,EAAE,CAAC,CAAC;CACtE,GACD;IACE,+FAA+F;IAC/F,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEN,4EAA4E;AAC5E,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,cAAc,EAAE,kBAAkB,CAyFtF,CAAC"}
|
package/dist/admin/coverage.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
-
import { PAYMENTS_ENTITLEMENTS_READ_SCOPE, PAYMENTS_PURCHASES_READ_SCOPE, PAYMENTS_RECONCILE_READ_SCOPE, PAYMENTS_SUBSCRIPTIONS_READ_SCOPE, PAYMENTS_USAGE_READ_SCOPE } from "../http/scopes.js";
|
|
3
|
+
import { PAYMENTS_ENTITLEMENTS_READ_SCOPE, PAYMENTS_PURCHASES_READ_SCOPE, PAYMENTS_RECONCILE_READ_SCOPE, PAYMENTS_SUBSCRIPTIONS_READ_SCOPE, PAYMENTS_USAGE_READ_SCOPE, PAYMENTS_WEBHOOKS_READ_SCOPE } from "../http/scopes.js";
|
|
4
4
|
//#region src/admin/coverage.ts
|
|
5
5
|
/** Every payments table, and what a management client may learn from it. */
|
|
6
6
|
const PAYMENTS_TABLE_DISCLOSURE = {
|
|
@@ -28,13 +28,19 @@ const PAYMENTS_TABLE_DISCLOSURE = {
|
|
|
28
28
|
*/
|
|
29
29
|
pithyPaymentsProviderAccounts: { withheld: "Every row pairs a provider-side account identifier with a subject — a Pithy user, or an organization from the adopter's own membership model. In bulk that is a cross-reference from a store's id space into the adopter's, and nothing on this surface needs it: a purchase already names its subject and its rail." },
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
31
|
+
* The webhook-event log, on its own scope (#830).
|
|
32
|
+
*
|
|
33
|
+
* It was withheld, on the argument that every row is a raw provider payload and that the purchase's status
|
|
34
|
+
* and the audit trail answer what a delivery log is read for. The second half did not survive contact with
|
|
35
|
+
* the first adopter: a notification that arrived and **never** projected leaves no purchase status to read
|
|
36
|
+
* and no `payments/webhook_received` success to find — it is precisely the row nothing else explains, and
|
|
37
|
+
* the one `pithy-sh/dashboard#167` needs to say why a purchase is paid and not entitled.
|
|
38
|
+
*
|
|
39
|
+
* The first half still holds, so the read is a projection rather than a table dump: the payload is never
|
|
40
|
+
* selected (the event's type is read out of it by the database), and the stored `error` crosses as its code
|
|
41
|
+
* alone. See `read.ts`'s `listWebhookEvents` and `http/view.ts`'s `adminWebhookEventView`.
|
|
36
42
|
*/
|
|
37
|
-
pithyPaymentsWebhookEvents: {
|
|
43
|
+
pithyPaymentsWebhookEvents: { reads: [PAYMENTS_WEBHOOKS_READ_SCOPE] },
|
|
38
44
|
/**
|
|
39
45
|
* The reconciliation run log — operational state, on its own scope.
|
|
40
46
|
*
|
package/dist/admin/read.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { PaymentsReconcileRun } from "../data/reconcileRun";
|
|
|
10
10
|
import type { PurchaseStatus } from "../data/status";
|
|
11
11
|
import { type PaymentsSubject } from "../data/subject";
|
|
12
12
|
import { PaymentsUsageRun } from "../data/usageRun";
|
|
13
|
+
import { type PaymentsWebhookEventReadState } from "../data/webhookEvent";
|
|
13
14
|
/**
|
|
14
15
|
* The management read model — the queries behind the control-plane reads, and nothing else.
|
|
15
16
|
*
|
|
@@ -268,4 +269,63 @@ export interface ReconcileRunsQuery {
|
|
|
268
269
|
* leave behind and no personal identifier to mask — see `data/reconcileRun.ts`.
|
|
269
270
|
*/
|
|
270
271
|
export declare function listReconcileRuns(d1: D1Database, query?: ReconcileRunsQuery): Promise<PaymentsPage<PaymentsReconcileRun>>;
|
|
272
|
+
/**
|
|
273
|
+
* A recorded delivery as the management read selects it — every column but the payload, and the one fact read
|
|
274
|
+
* out of the payload by the database: the store's own name for the event.
|
|
275
|
+
*
|
|
276
|
+
* Derived from {@link PaymentsWebhookEvent} with `.pick`, so the row schema stays the one definition of the
|
|
277
|
+
* table and the codecs still decode the timestamps and the targets on the way out of D1.
|
|
278
|
+
*/
|
|
279
|
+
export declare const PaymentsWebhookEventRecord: z.ZodObject<{
|
|
280
|
+
id: z.ZodString;
|
|
281
|
+
rail: z.ZodEnum<{
|
|
282
|
+
apple: "apple";
|
|
283
|
+
google: "google";
|
|
284
|
+
lemonSqueezy: "lemonSqueezy";
|
|
285
|
+
paddle: "paddle";
|
|
286
|
+
stripe: "stripe";
|
|
287
|
+
}>;
|
|
288
|
+
providerEventId: z.ZodString;
|
|
289
|
+
receivedAt: z.ZodCodec<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodDate]>, z.ZodDate>;
|
|
290
|
+
processedAt: z.ZodNullable<z.ZodCodec<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodDate]>, z.ZodDate>>;
|
|
291
|
+
abandonedAt: z.ZodOptional<z.ZodNullable<z.ZodCodec<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodDate]>, z.ZodDate>>>;
|
|
292
|
+
error: z.ZodNullable<z.ZodString>;
|
|
293
|
+
attempts: z.ZodOptional<z.ZodNumber>;
|
|
294
|
+
projectedTargets: z.ZodOptional<z.ZodNullable<import("@pithy-sh/core/src/data/codecs").SqliteJson<z.ZodObject<{
|
|
295
|
+
purchaseIds: z.ZodArray<z.ZodString>;
|
|
296
|
+
subscriptionIds: z.ZodArray<z.ZodString>;
|
|
297
|
+
}, z.core.$strip>>>>;
|
|
298
|
+
}, z.core.$strip>;
|
|
299
|
+
/** {@link PaymentsWebhookEventRecord}, with the event type the database read out of the payload. */
|
|
300
|
+
export type PaymentsWebhookEventListing = z.output<typeof PaymentsWebhookEventRecord> & {
|
|
301
|
+
/** The store's own name for the event, or null when the payload names none in the shape of one. */
|
|
302
|
+
eventType: string | null;
|
|
303
|
+
};
|
|
304
|
+
/** What {@link listWebhookEvents} accepts. Every filter is optional; together they are an AND. */
|
|
305
|
+
export interface WebhookEventsQuery {
|
|
306
|
+
/** Restrict to one store. */
|
|
307
|
+
rail?: PaymentsRail;
|
|
308
|
+
/** Restrict to one state, as a management read names them. */
|
|
309
|
+
state?: PaymentsWebhookEventReadState;
|
|
310
|
+
/** Received at or after this instant. */
|
|
311
|
+
since?: Date;
|
|
312
|
+
/** Received before this instant. */
|
|
313
|
+
until?: Date;
|
|
314
|
+
/** Where to resume, from a previous page's `nextCursor`. A malformed one is a first page. */
|
|
315
|
+
cursor?: string;
|
|
316
|
+
/** How many rows to return, clamped by `pageLimit`. */
|
|
317
|
+
limit?: number;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Every notification a store sent, newest received first (#830).
|
|
321
|
+
*
|
|
322
|
+
* Ordered on `receivedAt` — when the delivery reached us — with the id as the tiebreak, on the index
|
|
323
|
+
* `payments_0003_webhook_targets` creates for exactly this. Named columns and never `payload`: the provider's
|
|
324
|
+
* document carries the customer's details, so it is not selected, and the one thing read out of it — the
|
|
325
|
+
* event's type — is read by the database.
|
|
326
|
+
*
|
|
327
|
+
* The state filter is the SQL spelling of `webhookEventReadState`, and `read.workers.test.ts` holds the two to
|
|
328
|
+
* each other over every shape a row takes.
|
|
329
|
+
*/
|
|
330
|
+
export declare function listWebhookEvents(d1: D1Database, query?: WebhookEventsQuery): Promise<PaymentsPage<PaymentsWebhookEventListing>>;
|
|
271
331
|
//# sourceMappingURL=read.d.ts.map
|
package/dist/admin/read.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/admin/read.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/admin/read.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAI5D,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAoB,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO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oBAAoB,CAAC,CAAC,CAyB7C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;iBAUkE,CAAC;AAE1G,oGAAoG;AACpG,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,0BAA0B,CAAC,GAAG;IACtF,mGAAmG;IACnG,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAqCF,kGAAkG;AAClG,MAAM,WAAW,kBAAkB;IACjC,6BAA6B;IAC7B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,6BAA6B,CAAC;IACtC,yCAAyC;IACzC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,oCAAoC;IACpC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,6FAA6F;IAC7F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,UAAU,EACd,KAAK,GAAE,kBAAuB,GAC7B,OAAO,CAAC,YAAY,CAAC,2BAA2B,CAAC,CAAC,CAwCpD"}
|
package/dist/admin/read.js
CHANGED
|
@@ -7,7 +7,9 @@ import { PaymentsPurchase } from "../data/purchase.js";
|
|
|
7
7
|
import { PaymentsReconcileRun } from "../data/reconcileRun.js";
|
|
8
8
|
import { PaymentsUsageReport } from "../data/usageReport.js";
|
|
9
9
|
import { PaymentsUsageRun } from "../data/usageRun.js";
|
|
10
|
-
import {
|
|
10
|
+
import { PaymentsWebhookEvent } from "../data/webhookEvent.js";
|
|
11
|
+
import { PAYMENTS_ENTITLEMENTS_TABLE, PAYMENTS_OVERRIDES_TABLE, PAYMENTS_PURCHASES_TABLE, PAYMENTS_RECONCILE_RUNS_TABLE, PAYMENTS_USAGE_REPORTS_TABLE, PAYMENTS_USAGE_RUNS_TABLE, PAYMENTS_WEBHOOK_EVENTS_TABLE, paymentsDatabase } from "../data/tables.js";
|
|
12
|
+
import { sql } from "kysely";
|
|
11
13
|
import { chunkByBoundParameters } from "@pithy-sh/core/src/data/boundParameters";
|
|
12
14
|
import { decodeCursor, pageLimit, toPage } from "@pithy-sh/core/src/data/cursor";
|
|
13
15
|
//#region src/admin/read.ts
|
|
@@ -244,5 +246,87 @@ async function listReconcileRuns(d1, query = {}) {
|
|
|
244
246
|
id: run.id
|
|
245
247
|
}));
|
|
246
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* A recorded delivery as the management read selects it — every column but the payload, and the one fact read
|
|
251
|
+
* out of the payload by the database: the store's own name for the event.
|
|
252
|
+
*
|
|
253
|
+
* Derived from {@link PaymentsWebhookEvent} with `.pick`, so the row schema stays the one definition of the
|
|
254
|
+
* table and the codecs still decode the timestamps and the targets on the way out of D1.
|
|
255
|
+
*/
|
|
256
|
+
const PaymentsWebhookEventRecord = PaymentsWebhookEvent.pick({
|
|
257
|
+
id: true,
|
|
258
|
+
rail: true,
|
|
259
|
+
providerEventId: true,
|
|
260
|
+
receivedAt: true,
|
|
261
|
+
processedAt: true,
|
|
262
|
+
abandonedAt: true,
|
|
263
|
+
error: true,
|
|
264
|
+
attempts: true,
|
|
265
|
+
projectedTargets: true
|
|
266
|
+
}).describe("One recorded delivery as a management read selects it — never the stored provider payload.");
|
|
267
|
+
/** The columns {@link PaymentsWebhookEventRecord} covers, as Kysely needs them. */
|
|
268
|
+
const WEBHOOK_EVENT_COLUMNS = Object.keys(PaymentsWebhookEventRecord.shape);
|
|
269
|
+
/**
|
|
270
|
+
* The shape an event name takes in every store's vocabulary — `customer.subscription.updated`,
|
|
271
|
+
* `DID_FAIL_TO_RENEW.GRACE_PERIOD`, `subscription_payment_refunded`, `subscription.4`. Anything else the
|
|
272
|
+
* payload holds at that path is withheld rather than echoed: it is the one string this read lifts out of a
|
|
273
|
+
* document it otherwise never touches.
|
|
274
|
+
*/
|
|
275
|
+
const EVENT_TYPE = /^[A-Za-z0-9_.]{1,128}$/;
|
|
276
|
+
/**
|
|
277
|
+
* Each store's event name, read **by the database** out of the stored payload, so the payload itself never
|
|
278
|
+
* reaches the Worker's memory on a management read.
|
|
279
|
+
*
|
|
280
|
+
* One path per rail, because each store names the field differently: Stripe's `type`, Paddle's `event_type`,
|
|
281
|
+
* Lemon Squeezy's `meta.event_name`, Apple's `notificationType` qualified by its `subtype`, and Google's
|
|
282
|
+
* notification block with its numeric type. `json_valid` first, so a payload that is somehow not JSON reads as
|
|
283
|
+
* no type rather than failing the page.
|
|
284
|
+
*/
|
|
285
|
+
const EVENT_TYPE_SQL = sql`case when json_valid(${sql.ref("payload")}) then case ${sql.ref("rail")}
|
|
286
|
+
when 'stripe' then json_extract(${sql.ref("payload")}, '$.type')
|
|
287
|
+
when 'paddle' then json_extract(${sql.ref("payload")}, '$.event_type')
|
|
288
|
+
when 'lemonSqueezy' then json_extract(${sql.ref("payload")}, '$.meta.event_name')
|
|
289
|
+
when 'apple' then json_extract(${sql.ref("payload")}, '$.notificationType') || coalesce('.' || json_extract(${sql.ref("payload")}, '$.subtype'), '')
|
|
290
|
+
when 'google' then coalesce(
|
|
291
|
+
'subscription.' || json_extract(${sql.ref("payload")}, '$.notification.subscriptionNotification.notificationType'),
|
|
292
|
+
'oneTimeProduct.' || json_extract(${sql.ref("payload")}, '$.notification.oneTimeProductNotification.notificationType'),
|
|
293
|
+
case when json_type(${sql.ref("payload")}, '$.notification.voidedPurchaseNotification') is not null then 'voidedPurchase' end,
|
|
294
|
+
case when json_type(${sql.ref("payload")}, '$.notification.testNotification') is not null then 'test' end
|
|
295
|
+
)
|
|
296
|
+
end end`;
|
|
297
|
+
/**
|
|
298
|
+
* Every notification a store sent, newest received first (#830).
|
|
299
|
+
*
|
|
300
|
+
* Ordered on `receivedAt` — when the delivery reached us — with the id as the tiebreak, on the index
|
|
301
|
+
* `payments_0003_webhook_targets` creates for exactly this. Named columns and never `payload`: the provider's
|
|
302
|
+
* document carries the customer's details, so it is not selected, and the one thing read out of it — the
|
|
303
|
+
* event's type — is read by the database.
|
|
304
|
+
*
|
|
305
|
+
* The state filter is the SQL spelling of `webhookEventReadState`, and `read.workers.test.ts` holds the two to
|
|
306
|
+
* each other over every shape a row takes.
|
|
307
|
+
*/
|
|
308
|
+
async function listWebhookEvents(d1, query = {}) {
|
|
309
|
+
const limit = pageLimit(query.limit);
|
|
310
|
+
const after = resume(query.cursor);
|
|
311
|
+
let selection = paymentsDatabase(d1).selectFrom(PAYMENTS_WEBHOOK_EVENTS_TABLE).select(WEBHOOK_EVENT_COLUMNS).select(EVENT_TYPE_SQL.as("eventType")).orderBy("receivedAt", "desc").orderBy("id", "desc").limit(limit + 1);
|
|
312
|
+
if (query.rail !== void 0) selection = selection.where("rail", "=", query.rail);
|
|
313
|
+
if (query.state === "projected") selection = selection.where("processedAt", "is not", null);
|
|
314
|
+
if (query.state === "pending") selection = selection.where("processedAt", "is", null).where("abandonedAt", "is", null);
|
|
315
|
+
if (query.state === "abandoned") selection = selection.where("processedAt", "is", null).where("abandonedAt", "is not", null);
|
|
316
|
+
if (query.since !== void 0) selection = selection.where("receivedAt", ">=", query.since.getTime());
|
|
317
|
+
if (query.until !== void 0) selection = selection.where("receivedAt", "<", query.until.getTime());
|
|
318
|
+
if (after) selection = selection.where((eb) => eb.or([eb("receivedAt", "<", after.sort), eb.and([eb("receivedAt", "=", after.sort), eb("id", "<", after.id)])]));
|
|
319
|
+
const rows = await selection.execute();
|
|
320
|
+
return toPage(rows.map((row) => {
|
|
321
|
+
const { eventType, ...columns } = row;
|
|
322
|
+
return {
|
|
323
|
+
...PaymentsWebhookEventRecord.parse(columns),
|
|
324
|
+
eventType: typeof eventType === "string" && EVENT_TYPE.test(eventType) ? eventType : null
|
|
325
|
+
};
|
|
326
|
+
}), limit, (event) => ({
|
|
327
|
+
sort: event.receivedAt.getTime(),
|
|
328
|
+
id: event.id
|
|
329
|
+
}));
|
|
330
|
+
}
|
|
247
331
|
//#endregion
|
|
248
|
-
export { PaymentsPurchaseRecord, lastReports, listEntitlements, listOverrides, listPurchases, listReconcileRuns, listSubscriptions, listUnrestrictedSubjects, listUsageRuns, readEntitlements, unrestrictedSubjects };
|
|
332
|
+
export { PaymentsPurchaseRecord, PaymentsWebhookEventRecord, lastReports, listEntitlements, listOverrides, listPurchases, listReconcileRuns, listSubscriptions, listUnrestrictedSubjects, listUsageRuns, listWebhookEvents, readEntitlements, unrestrictedSubjects };
|
package/dist/audit/actions.d.ts
CHANGED
|
@@ -220,6 +220,11 @@ export declare const PaymentsAuditActions: {
|
|
|
220
220
|
* A management client read the usage-reporting run log. Counts and filters only, as every management read.
|
|
221
221
|
*/
|
|
222
222
|
readonly usageRunsRead: "payments/usage_runs_read";
|
|
223
|
+
/**
|
|
224
|
+
* A management client read the webhook-event log (#830). Counts and filters only, as every management read:
|
|
225
|
+
* the events are already a queryable table, and copying them into the trail would make a second one.
|
|
226
|
+
*/
|
|
227
|
+
readonly webhookEventsRead: "payments/webhook_events_read";
|
|
223
228
|
};
|
|
224
229
|
/** One of the payments audit action codes. */
|
|
225
230
|
export type PaymentsAuditAction = (typeof PaymentsAuditActions)[keyof typeof PaymentsAuditActions];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/audit/actions.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,oBAAoB;IAC/B,2GAA2G;aAC3G,gBAAgB,EAAE,4BAA4B;IAC9C,6FAA6F;aAC7F,gBAAgB,EAAE,4BAA4B;IAC9C,iHAAiH;aACjH,eAAe,EAAE,2BAA2B;IAC5C,iHAAiH;aACjH,iBAAiB,EAAE,6BAA6B;IAChD;;;;;;;;;OASG;aACH,wBAAwB,EAAE,qCAAqC;IAC/D;;;;;;;OAOG;aACH,kBAAkB,EAAE,8BAA8B;IAClD;;;OAGG;aACH,eAAe,EAAE,2BAA2B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PaymentsAuditActions = {
|
|
|
220
220
|
/**
|
|
221
221
|
* A management client read the usage-reporting run log. Counts and filters only, as every management read.
|
|
222
222
|
*/
|
|
223
|
-
usageRunsRead: "payments/usage_runs_read"
|
|
223
|
+
usageRunsRead: "payments/usage_runs_read",
|
|
224
|
+
/**
|
|
225
|
+
* A management client read the webhook-event log (#830). Counts and filters only, as every management read:
|
|
226
|
+
* the events are already a queryable table, and copying them into the trail would make a second one.
|
|
227
|
+
*/
|
|
228
|
+
webhookEventsRead: "payments/webhook_events_read"
|
|
224
229
|
};
|
|
225
230
|
//#endregion
|
|
226
231
|
export { PaymentsAuditActions };
|
package/dist/capability.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export interface PaymentsCapability extends Capability<DatabaseSpecMap, KvNamesp
|
|
|
62
62
|
/**
|
|
63
63
|
* What a capability composed beside this one reads purchases through — `support`, showing an operator what a
|
|
64
64
|
* sender bought. Found in its `compose` hook, so it never imports this package and a project without
|
|
65
|
-
* payments bundles it
|
|
65
|
+
* payments bundles it. See `peer.ts`.
|
|
66
66
|
*/
|
|
67
67
|
paymentsPeer: PaymentsPeer;
|
|
68
68
|
/**
|
|
@@ -98,8 +98,8 @@ export interface PaymentsCapability extends Capability<DatabaseSpecMap, KvNamesp
|
|
|
98
98
|
* than at the first receipt. Auth is *not* listed — it is a seam: under `billingSubject: "user"` a purchase
|
|
99
99
|
* scopes to the authenticated caller, so with no auth capability composed every route denies, which is the
|
|
100
100
|
* right failure and needs no dependency edge. `@pithy-sh/ledger` is likewise a seam: `compose` finds it among
|
|
101
|
-
* the composed capabilities and hands its `ledgerPeer` to the routes, and nothing in this package imports it
|
|
102
|
-
*
|
|
101
|
+
* the composed capabilities and hands its `ledgerPeer` to the routes, and nothing in this package imports it.
|
|
102
|
+
* Only a product whose catalog entry declares `grants` ever calls it. Both belong in the manifest's
|
|
103
103
|
* `optionalCapabilities`.
|
|
104
104
|
*
|
|
105
105
|
* Under `billingSubject: "organization"` the holder is not the caller and cannot be derived from them, so
|
package/dist/capability.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,UAAU,EAGhB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAI3E,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAoB,MAAM,iBAAiB,CAAC;AAI7F,OAAO,KAAK,EAAE,uBAAuB,EAAuB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,UAAU,EAGhB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAI3E,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAoB,MAAM,iBAAiB,CAAC;AAI7F,OAAO,KAAK,EAAE,uBAAuB,EAAuB,MAAM,2BAA2B,CAAC;AAS9F,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,QAAQ,CAAC;AAMzD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAK7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG;IAClD;;;;OAIG;IACH,cAAc,CAAC,EAAE,uBAAuB,CAAC;IACzC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,wBAAwB,CAAC;CAC5C,CAAC;AAkQF;;;GAGG;AACH,KAAK,qBAAqB,GAAG,OAAO,iBAAiB,GAAG,OAAO,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE/F,6FAA6F;AAC7F,MAAM,WAAW,kBACf,SAAQ,UAAU,CAAC,eAAe,EAAE,kBAAkB,EAAE,UAAU,EAAE,qBAAqB,CAAC;IAC1F,4BAA4B;IAC5B,cAAc,EAAE,cAAc,CAAC;IAC/B;;;;OAIG;IACH,YAAY,EAAE,YAAY,CAAC;IAC3B;;;;OAIG;IACH,UAAU,EAAE,UAAU,CAAC;IACvB;;;;;OAKG;IACH,aAAa,EAAE;QAAE,eAAe,EAAE,wBAAwB,CAAA;KAAE,GAAG,SAAS,CAAC;CAC1E;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,kBAAkB,CAmIrE;AAED,sFAAsF;AACtF,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,IAAI,kBAAkB,CAE7F"}
|
package/dist/capability.js
CHANGED
|
@@ -12,7 +12,10 @@ import { paymentsAdminRoutes } from "./http/scopes.js";
|
|
|
12
12
|
import { registerPaymentsRoutes } from "./http/routes.js";
|
|
13
13
|
import { payments_0001_purchases } from "./migrations/0001_purchases.js";
|
|
14
14
|
import { payments_0002_allowances } from "./migrations/0002_allowances.js";
|
|
15
|
+
import { payments_0003_webhook_targets } from "./migrations/0003_webhook_targets.js";
|
|
15
16
|
import { paymentsPeer } from "./peer.js";
|
|
17
|
+
import { paymentsProcessing } from "./processing/activities.js";
|
|
18
|
+
import { paymentsUserPurge } from "./purge/contribution.js";
|
|
16
19
|
import { paymentsInapplicableSecrets, paymentsSecretBranches } from "./secret/branches.js";
|
|
17
20
|
import { paymentsExampleSeed } from "./seeds/example.js";
|
|
18
21
|
import { PACKAGE_NAME, PACKAGE_VERSION } from "./version.generated.js";
|
|
@@ -111,7 +114,7 @@ function checkLedgerGrants({ capabilities }, config) {
|
|
|
111
114
|
* `pithy.config.ts` is evaluated and the CLI evaluates it on nearly every command. Refusing the
|
|
112
115
|
* placeholder here would leave the adopter with no `pithy` at all in the project the scaffold just landed
|
|
113
116
|
* in. `requireImplementedSubject`, on the capability's `boot` hook, is where the placeholder is refused —
|
|
114
|
-
* `createEntrypoint` runs it and nothing else does, so the Worker still will not serve
|
|
117
|
+
* `createEntrypoint` runs it and nothing else does, so the Worker still will not serve.
|
|
115
118
|
*/
|
|
116
119
|
function requireResolvableSubject(config, resolveSubject) {
|
|
117
120
|
if (config.billingSubject !== "organization" || resolveSubject !== void 0) return;
|
|
@@ -152,8 +155,7 @@ function requireQuantityResolver(config, resolveQuantity) {
|
|
|
152
155
|
* **Nothing else can cross, and not merely by discipline.** Apple's issuer id and key, Google's
|
|
153
156
|
* service-account credentials, and Stripe's secret and webhook signing keys live in the secrets store
|
|
154
157
|
* behind `paymentsSecretsRegistry` — they are not in the config this closure can see, so there is no
|
|
155
|
-
* expression here that would reach them. What discipline does cover is the rest of the catalog:
|
|
156
|
-
* product's Apple and Google SKUs stay server-side because a browser has no use for them, and the
|
|
158
|
+
* expression here that would reach them. What discipline does cover is the rest of the catalog: the
|
|
157
159
|
* `grants` block stays server-side because a currency code and an amount describe the economy.
|
|
158
160
|
* `capability.test.ts` locks the key set and sweeps the serialized result for every credential shape.
|
|
159
161
|
*
|
|
@@ -180,6 +182,8 @@ function clientProjection(config, environment) {
|
|
|
180
182
|
entitlements: [...product.entitlements],
|
|
181
183
|
name: product.name,
|
|
182
184
|
skus: {
|
|
185
|
+
apple: product.apple?.productId ?? null,
|
|
186
|
+
google: product.google?.productId ?? null,
|
|
183
187
|
stripe: product.stripe?.priceId ?? null,
|
|
184
188
|
lemonSqueezy: product.lemonSqueezy?.variantId ?? null,
|
|
185
189
|
paddle: product.paddle?.priceId ?? null
|
|
@@ -231,8 +235,8 @@ function clientProjection(config, environment) {
|
|
|
231
235
|
* than at the first receipt. Auth is *not* listed — it is a seam: under `billingSubject: "user"` a purchase
|
|
232
236
|
* scopes to the authenticated caller, so with no auth capability composed every route denies, which is the
|
|
233
237
|
* right failure and needs no dependency edge. `@pithy-sh/ledger` is likewise a seam: `compose` finds it among
|
|
234
|
-
* the composed capabilities and hands its `ledgerPeer` to the routes, and nothing in this package imports it
|
|
235
|
-
*
|
|
238
|
+
* the composed capabilities and hands its `ledgerPeer` to the routes, and nothing in this package imports it.
|
|
239
|
+
* Only a product whose catalog entry declares `grants` ever calls it. Both belong in the manifest's
|
|
236
240
|
* `optionalCapabilities`.
|
|
237
241
|
*
|
|
238
242
|
* Under `billingSubject: "organization"` the holder is not the caller and cannot be derived from them, so
|
|
@@ -255,7 +259,8 @@ function payments(options) {
|
|
|
255
259
|
const peers = { ledger: void 0 };
|
|
256
260
|
const migrations = {
|
|
257
261
|
"0001_purchases": payments_0001_purchases,
|
|
258
|
-
"0002_allowances": payments_0002_allowances
|
|
262
|
+
"0002_allowances": payments_0002_allowances,
|
|
263
|
+
"0003_webhook_targets": payments_0003_webhook_targets
|
|
259
264
|
};
|
|
260
265
|
const workflows = reportedProducts(resolved).length > 0 ? {
|
|
261
266
|
...paymentsWorkflows,
|
|
@@ -297,7 +302,9 @@ function payments(options) {
|
|
|
297
302
|
subject,
|
|
298
303
|
ledger: () => peers.ledger
|
|
299
304
|
}),
|
|
300
|
-
seeds: [paymentsExampleSeed]
|
|
305
|
+
seeds: [paymentsExampleSeed],
|
|
306
|
+
purge: [paymentsUserPurge()],
|
|
307
|
+
processing: paymentsProcessing(resolved.rails)
|
|
301
308
|
});
|
|
302
309
|
return Object.assign(capability, {
|
|
303
310
|
paymentsConfig: resolved,
|
package/dist/client/api.d.ts
CHANGED
|
@@ -10,11 +10,12 @@
|
|
|
10
10
|
* after the file was written. So the calls, the error mapping, and the redirect-and-return dance ship
|
|
11
11
|
* here and upgrade with a minor release; the scaffolded stub renders and styles, and calls these.
|
|
12
12
|
*
|
|
13
|
-
* **
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* **Two transports, chosen by one option.** With no `origin`, every request is relative and carries
|
|
14
|
+
* `credentials: "include"` and nothing else: the SPA and its Worker share an origin, so the session rides
|
|
15
|
+
* an httpOnly cookie that JavaScript cannot read and the server's same-origin check covers CSRF. With an
|
|
16
|
+
* `origin` — a native app, which has no page origin to be relative to — the request goes to that origin
|
|
17
|
+
* with `credentials: "omit"`, and the caller hands in the bearer session's `fetch`, which adds the
|
|
18
|
+
* `Authorization` header. This module holds no credential either way.
|
|
18
19
|
*
|
|
19
20
|
* **Nothing here throws, and nothing here hides a failure either.** An unreachable Worker, an HTML error
|
|
20
21
|
* page from a proxy, a 500 — each becomes a renderable {@link PaymentsFailure} on a `PaymentsResult`, and
|
|
@@ -26,8 +27,8 @@
|
|
|
26
27
|
* The server's `requireEntitlement()` is still the security boundary. Nothing on this side of the wire
|
|
27
28
|
* protects a feature; it only decides what a screen shows.
|
|
28
29
|
*
|
|
29
|
-
* **No absolute URL literals, and no schema library.** Paths are relative
|
|
30
|
-
* origin
|
|
30
|
+
* **No absolute URL literals, and no schema library.** Paths are relative unless a caller names an
|
|
31
|
+
* origin, so a web bundle's calls follow whatever origin it is served from. Answers are narrowed by hand-written `is…(value: unknown): value is T`
|
|
31
32
|
* guards rather than Zod: this file is compiled into a browser bundle, and it must not drag the server's
|
|
32
33
|
* schema graph in behind it.
|
|
33
34
|
*/
|
|
@@ -238,7 +239,7 @@ export interface PaymentsRequestInit {
|
|
|
238
239
|
headers?: Record<string, string>;
|
|
239
240
|
/** The JSON body, already serialized. */
|
|
240
241
|
body?: string;
|
|
241
|
-
/** Cookie policy
|
|
242
|
+
/** Cookie policy: `include` for the same-origin cookie session, `omit` for a bearer call to an origin. */
|
|
242
243
|
credentials?: "include" | "same-origin" | "omit";
|
|
243
244
|
}
|
|
244
245
|
/** The slice of `Response` this module reads. */
|
|
@@ -272,6 +273,13 @@ export interface PaymentsGlobal {
|
|
|
272
273
|
}
|
|
273
274
|
/** What every call takes: where the routes are, and the seams a test replaces. */
|
|
274
275
|
export interface PaymentsClientOptions {
|
|
276
|
+
/**
|
|
277
|
+
* The Worker's absolute origin, such as `https://api.example.com`: an http(s) scheme and a host, with no
|
|
278
|
+
* path, query, fragment or trailing slash. Set it where there is no page origin to be relative to — a
|
|
279
|
+
* native app — and pass the bearer session's `fetch` beside it. The request then sends no cookie. Unset,
|
|
280
|
+
* every request is relative and carries the session cookie.
|
|
281
|
+
*/
|
|
282
|
+
origin?: string;
|
|
275
283
|
/** Where the payments routes mount. Defaults to {@link PAYMENTS_BASE_PATH}. */
|
|
276
284
|
basePath?: string;
|
|
277
285
|
/** The fetch to use. Defaults to the one on {@link PaymentsClientOptions.global}. */
|
|
@@ -283,6 +291,14 @@ export interface PaymentsClientOptions {
|
|
|
283
291
|
}
|
|
284
292
|
/** The worker could not be reached at all. Offline, or a DNS failure, or a hard CORS refusal. */
|
|
285
293
|
export declare const PAYMENTS_UNREACHABLE: PaymentsFailure;
|
|
294
|
+
/**
|
|
295
|
+
* The request would have left this app's backend, so it was never sent.
|
|
296
|
+
*
|
|
297
|
+
* Reached through a `basePath` that is not a rooted path, or an `origin` that is not a bare http(s) origin.
|
|
298
|
+
* Appended to an origin, `evil.example` or `//evil.example` names a different host, and the bearer session's
|
|
299
|
+
* `fetch` would hand it the credential.
|
|
300
|
+
*/
|
|
301
|
+
export declare const PAYMENTS_CROSS_ORIGIN: PaymentsFailure;
|
|
286
302
|
/** The worker answered with something this client cannot read. A proxy's HTML page, or a shape change. */
|
|
287
303
|
export declare const PAYMENTS_UNREADABLE: PaymentsFailure;
|
|
288
304
|
/** There is no browser here to send anywhere — server-side rendering, or a test with no DOM. */
|
|
@@ -292,7 +308,7 @@ export declare function isEntitlementView(value: unknown): value is EntitlementV
|
|
|
292
308
|
/** Whether a value is one purchase as the write routes return it. */
|
|
293
309
|
export declare function isPurchaseView(value: unknown): value is PurchaseView;
|
|
294
310
|
/**
|
|
295
|
-
* One call
|
|
311
|
+
* One call to this Worker, never throwing. **The only producer of that request.**
|
|
296
312
|
*
|
|
297
313
|
* The body is read before the status is judged, because a refusal's body is the failure a screen renders.
|
|
298
314
|
* A body that will not parse is the generic failure rather than a crash — a corporate proxy's HTML page
|
package/dist/client/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/client/api.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/client/api.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,uGAAuG;AACvG,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAE9C;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,cAAc,GAAG,QAAQ,CAAC;AAE3F;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,cAAc,GAAG,QAAQ,CAAC;AAEtE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,kBAAkB,EAAyC,CAAC;AAEzG,6FAA6F;AAC7F,MAAM,MAAM,yBAAyB,GAAG,SAAS,GAAG,YAAY,CAAC;AAEjE,+FAA+F;AAC/F,MAAM,MAAM,yBAAyB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAM7D;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,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