@usethrottle/webhook-types 3.0.0 → 4.0.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/package.json +9 -9
- package/dist/index.d.ts +0 -820
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -178
- package/dist/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usethrottle/webhook-types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "TypeScript discriminated unions for every Throttle outbound webhook event.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -10,21 +10,21 @@
|
|
|
10
10
|
"dist",
|
|
11
11
|
"README.md"
|
|
12
12
|
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"dev": "tsc --watch",
|
|
16
|
+
"test": "tsc --noEmit && vitest run --passWithNoTests"
|
|
17
|
+
},
|
|
13
18
|
"devDependencies": {
|
|
19
|
+
"@core/scopes": "workspace:*",
|
|
14
20
|
"@types/node": "^20.0.0",
|
|
15
21
|
"typescript": "^5.7.0",
|
|
16
|
-
"vitest": "^2.1.9"
|
|
17
|
-
"@core/scopes": "0.0.1"
|
|
22
|
+
"vitest": "^2.1.9"
|
|
18
23
|
},
|
|
19
24
|
"publishConfig": {
|
|
20
25
|
"access": "public"
|
|
21
26
|
},
|
|
22
27
|
"engines": {
|
|
23
28
|
"node": ">=20"
|
|
24
|
-
},
|
|
25
|
-
"scripts": {
|
|
26
|
-
"build": "tsc",
|
|
27
|
-
"dev": "tsc --watch",
|
|
28
|
-
"test": "tsc --noEmit && vitest run --passWithNoTests"
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,820 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @usethrottle/webhook-types
|
|
3
|
-
*
|
|
4
|
-
* TypeScript discriminated unions for every Throttle outbound webhook event.
|
|
5
|
-
* Keyed by `event.type` (legacy) or top-level `type` (ThrottleEventEnvelope),
|
|
6
|
-
* this lets your handler narrow the payload without casts.
|
|
7
|
-
*
|
|
8
|
-
* Coverage: every outbound event type emitted by the Throttle outbound bus
|
|
9
|
-
* is enumerated in `WebhookEventType`. The most-integrated events (cart,
|
|
10
|
-
* checkout, order, payment, fulfillment, subscription, customer core lifecycle)
|
|
11
|
-
* get typed `data` shapes. The remaining events resolve to
|
|
12
|
-
* `data: Record<string, unknown>`.
|
|
13
|
-
*
|
|
14
|
-
* Source of truth: `packages/platform-webhooks/src/outbound/events.ts` in the
|
|
15
|
-
* Throttle monorepo. The event registry there is the only place event names
|
|
16
|
-
* are allowed to be added; this package mirrors that file.
|
|
17
|
-
*
|
|
18
|
-
* Includes a Stripe-compatible signature verification helper.
|
|
19
|
-
*
|
|
20
|
-
* ## Wire format (ThrottleEventEnvelope)
|
|
21
|
-
*
|
|
22
|
-
* The outbound worker (`packages/platform-webhooks/src/outbound/dispatcher.ts`)
|
|
23
|
-
* delivers the following flat JSON body to your endpoint:
|
|
24
|
-
*
|
|
25
|
-
* ```json
|
|
26
|
-
* {
|
|
27
|
-
* "id": "<uuid-v7>",
|
|
28
|
-
* "type": "<event-type>",
|
|
29
|
-
* "version": "1",
|
|
30
|
-
* "createdAt": "<ISO-8601>",
|
|
31
|
-
* "environmentId": "<workspace-environment-uuid>",
|
|
32
|
-
* "workspaceId": "<ws_...>",
|
|
33
|
-
* "data": { ... }
|
|
34
|
-
* }
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* `version` is `'1'` for all currently-defined events; Throttle will increment
|
|
38
|
-
* it on breaking payload changes. `environmentId` identifies the workspace
|
|
39
|
-
* environment that emitted the event, so production and every non-production
|
|
40
|
-
* environment route independently. `applicationId` is not exposed at the
|
|
41
|
-
* envelope level.
|
|
42
|
-
*
|
|
43
|
-
* **Existing `WebhookEnvelope` consumers are unaffected** — the `event:
|
|
44
|
-
* { type, data }` nesting in that type is an in-memory representation only.
|
|
45
|
-
* The wire format flattens `type` and `data` to the top level of the envelope.
|
|
46
|
-
*
|
|
47
|
-
* The legacy `WebhookEnvelope` type (with its `event: { type, data }` nesting)
|
|
48
|
-
* is retained for back-compat and describes the in-memory representation used
|
|
49
|
-
* by internal consumers; external integrations should use `ThrottleEventEnvelope`.
|
|
50
|
-
*/
|
|
51
|
-
/**
|
|
52
|
-
* Versioned event envelope for webhook consumers and extension handlers.
|
|
53
|
-
* The `type` field is the discriminant key — cast to `ThrottleEvent` to
|
|
54
|
-
* narrow `data` without specifying the generic parameters:
|
|
55
|
-
*
|
|
56
|
-
* ```ts
|
|
57
|
-
* import type { ThrottleEvent, ThrottleEventOfType } from '@usethrottle/webhook-types';
|
|
58
|
-
*
|
|
59
|
-
* app.post('/webhook', (req, res) => {
|
|
60
|
-
* const event = req.body as ThrottleEvent;
|
|
61
|
-
* switch (event.type) {
|
|
62
|
-
* case 'order.created':
|
|
63
|
-
* console.log(event.data.order); // typed as OrderCreatedData['order']
|
|
64
|
-
* break;
|
|
65
|
-
* case 'payment.captured':
|
|
66
|
-
* console.log(event.data.paymentId, event.data.amount);
|
|
67
|
-
* break;
|
|
68
|
-
* }
|
|
69
|
-
* });
|
|
70
|
-
*
|
|
71
|
-
* // Or for a single-event handler:
|
|
72
|
-
* function onOrderCreated(ev: ThrottleEventOfType<'order.created'>) {
|
|
73
|
-
* console.log(ev.data.order);
|
|
74
|
-
* }
|
|
75
|
-
* ```
|
|
76
|
-
*
|
|
77
|
-
* @typeParam TType - The event type string literal, e.g. `'order.created'`
|
|
78
|
-
* @typeParam TData - The typed `data` payload for this event type
|
|
79
|
-
*/
|
|
80
|
-
export interface ThrottleEventEnvelope<TType extends string = string, TData = unknown> {
|
|
81
|
-
/** Stable event identifier (UUID v7). */
|
|
82
|
-
id: string;
|
|
83
|
-
/** Event type string — use this to narrow the `data` payload. */
|
|
84
|
-
type: TType;
|
|
85
|
-
/**
|
|
86
|
-
* Payload schema version. Currently `'1'` for all events.
|
|
87
|
-
* Throttle will increment this when a breaking field change lands.
|
|
88
|
-
*/
|
|
89
|
-
version: string;
|
|
90
|
-
/** ISO 8601 UTC timestamp the event was emitted. */
|
|
91
|
-
createdAt: string;
|
|
92
|
-
/** Workspace environment that owns the event source. */
|
|
93
|
-
environmentId: string;
|
|
94
|
-
/** Workspace that owns the event source (e.g. `"ws_..."`). */
|
|
95
|
-
workspaceId: string;
|
|
96
|
-
/** Typed event payload — shape depends on `type`. */
|
|
97
|
-
data: TData;
|
|
98
|
-
}
|
|
99
|
-
export interface WebhookEnvelope<T extends WebhookEvent = WebhookEvent> {
|
|
100
|
-
/** Stable event identifier (UUID v7). */
|
|
101
|
-
id: string;
|
|
102
|
-
/** Workspace that owns the event source. */
|
|
103
|
-
workspaceId: string;
|
|
104
|
-
/** Application (store) the event was emitted from. */
|
|
105
|
-
applicationId: string;
|
|
106
|
-
/** Workspace environment that owns the event source. */
|
|
107
|
-
environmentId: string;
|
|
108
|
-
/** ISO 8601 timestamp the event was emitted at. */
|
|
109
|
-
createdAt: string;
|
|
110
|
-
/** Discriminated union — narrow by `event.type`. */
|
|
111
|
-
event: T;
|
|
112
|
-
}
|
|
113
|
-
type CartId = string;
|
|
114
|
-
type OrderId = string;
|
|
115
|
-
type PaymentId = string;
|
|
116
|
-
type SubscriptionId = string;
|
|
117
|
-
type CustomerId = string;
|
|
118
|
-
export interface CartCreatedData {
|
|
119
|
-
cartId: CartId;
|
|
120
|
-
sequence: number;
|
|
121
|
-
applicationId: string;
|
|
122
|
-
customerId: string | null;
|
|
123
|
-
currency: string;
|
|
124
|
-
}
|
|
125
|
-
export interface CartUpdatedData {
|
|
126
|
-
cartId: CartId;
|
|
127
|
-
sequence: number;
|
|
128
|
-
changedFields: string[];
|
|
129
|
-
}
|
|
130
|
-
export interface CartItemAddedData {
|
|
131
|
-
cartId: CartId;
|
|
132
|
-
sequence: number;
|
|
133
|
-
itemId: string;
|
|
134
|
-
name: string;
|
|
135
|
-
quantity: number;
|
|
136
|
-
unitPrice: number;
|
|
137
|
-
}
|
|
138
|
-
export interface CartItemUpdatedData {
|
|
139
|
-
cartId: CartId;
|
|
140
|
-
sequence: number;
|
|
141
|
-
itemId: string;
|
|
142
|
-
quantity: number;
|
|
143
|
-
unitPrice: number;
|
|
144
|
-
}
|
|
145
|
-
export interface CartItemRemovedData {
|
|
146
|
-
cartId: CartId;
|
|
147
|
-
sequence: number;
|
|
148
|
-
itemId: string;
|
|
149
|
-
}
|
|
150
|
-
export interface CartShippingSelectedData {
|
|
151
|
-
cartId: CartId;
|
|
152
|
-
sequence: number;
|
|
153
|
-
methodId: string;
|
|
154
|
-
displayName: string;
|
|
155
|
-
rateAmount: number;
|
|
156
|
-
currency: string;
|
|
157
|
-
/** Optional carrier metadata, present when the selected rate carries it. */
|
|
158
|
-
carrier?: string | null;
|
|
159
|
-
serviceCode?: string | null;
|
|
160
|
-
estimatedDeliveryDays?: number | null;
|
|
161
|
-
}
|
|
162
|
-
export interface CartShippingClearedData {
|
|
163
|
-
cartId: CartId;
|
|
164
|
-
sequence: number;
|
|
165
|
-
}
|
|
166
|
-
export interface CartDiscountAppliedData {
|
|
167
|
-
cartId: CartId;
|
|
168
|
-
sequence: number;
|
|
169
|
-
code: string;
|
|
170
|
-
amount: number;
|
|
171
|
-
type: 'percentage' | 'fixed_amount';
|
|
172
|
-
discountTotal: number;
|
|
173
|
-
}
|
|
174
|
-
export interface CartDiscountRemovedData {
|
|
175
|
-
cartId: CartId;
|
|
176
|
-
sequence: number;
|
|
177
|
-
}
|
|
178
|
-
export interface CartTaxRecomputedData {
|
|
179
|
-
cartId: CartId;
|
|
180
|
-
sequence: number;
|
|
181
|
-
lineCount: number;
|
|
182
|
-
}
|
|
183
|
-
export interface CartCheckoutStartedData {
|
|
184
|
-
cartId: CartId;
|
|
185
|
-
sequence: number;
|
|
186
|
-
}
|
|
187
|
-
export interface CartConvertedData {
|
|
188
|
-
cartId: CartId;
|
|
189
|
-
sequence: number;
|
|
190
|
-
}
|
|
191
|
-
/** An address as embedded in the `cart.abandoned` payload (canonical CartAddress shape). */
|
|
192
|
-
export interface CartAbandonedAddress {
|
|
193
|
-
firstName?: string | null;
|
|
194
|
-
lastName?: string | null;
|
|
195
|
-
company?: string | null;
|
|
196
|
-
addressLine1?: string | null;
|
|
197
|
-
addressLine2?: string | null;
|
|
198
|
-
city?: string | null;
|
|
199
|
-
stateProvince?: string | null;
|
|
200
|
-
postalCode?: string | null;
|
|
201
|
-
/** ISO-3166-1 alpha-2. */
|
|
202
|
-
countryCode?: string | null;
|
|
203
|
-
phone?: string | null;
|
|
204
|
-
email?: string | null;
|
|
205
|
-
}
|
|
206
|
-
/** A single line item as embedded in the `cart.abandoned` payload. */
|
|
207
|
-
export interface CartAbandonedLineItem {
|
|
208
|
-
id: string;
|
|
209
|
-
type: string;
|
|
210
|
-
/** Merchant's external reference id for the item, if any. */
|
|
211
|
-
referenceId: string | null;
|
|
212
|
-
name: string;
|
|
213
|
-
quantity: number;
|
|
214
|
-
/** Minor units (e.g. cents). */
|
|
215
|
-
unitPrice: number;
|
|
216
|
-
/** Minor units. */
|
|
217
|
-
subtotal: number;
|
|
218
|
-
/** Minor units. */
|
|
219
|
-
total: number;
|
|
220
|
-
imageUrl: string | null;
|
|
221
|
-
}
|
|
222
|
-
export interface CartAbandonedData {
|
|
223
|
-
cartId: CartId;
|
|
224
|
-
sequence: number;
|
|
225
|
-
/** ISO-4217 currency code. */
|
|
226
|
-
currency?: string;
|
|
227
|
-
/** All amounts are minor units (e.g. cents). */
|
|
228
|
-
subtotal?: number;
|
|
229
|
-
taxTotal?: number;
|
|
230
|
-
shippingTotal?: number;
|
|
231
|
-
discountTotal?: number;
|
|
232
|
-
total?: number;
|
|
233
|
-
/** Number of distinct line items on the cart. */
|
|
234
|
-
itemCount?: number;
|
|
235
|
-
/**
|
|
236
|
-
* Who to recover. A linked customer carries a non-null `id`; a guest cart that
|
|
237
|
-
* only captured an email (via the cart's `customerEmail`) carries `id: null`.
|
|
238
|
-
* `null` when the cart has neither — webhook-only, no email to target.
|
|
239
|
-
*/
|
|
240
|
-
customer?: WebhookCustomer | null;
|
|
241
|
-
lineItems?: CartAbandonedLineItem[];
|
|
242
|
-
/** Shipping address as stored on the cart, or `null` if never set. */
|
|
243
|
-
shippingAddress?: CartAbandonedAddress | null;
|
|
244
|
-
/** Billing address as stored on the cart, or `null` if never set. */
|
|
245
|
-
billingAddress?: CartAbandonedAddress | null;
|
|
246
|
-
/**
|
|
247
|
-
* Clickable cart-recovery URL built from the app's `cartRecoveryUrlTemplate`,
|
|
248
|
-
* or `null` when no template is configured. Populated even for anonymous carts.
|
|
249
|
-
*/
|
|
250
|
-
recoveryUrl?: string | null;
|
|
251
|
-
}
|
|
252
|
-
export interface CartExpiredData {
|
|
253
|
-
cartId: CartId;
|
|
254
|
-
sequence: number;
|
|
255
|
-
}
|
|
256
|
-
export interface CartMergedData {
|
|
257
|
-
cartId: CartId;
|
|
258
|
-
sequence: number;
|
|
259
|
-
fromCartId: CartId;
|
|
260
|
-
toCustomerId: CustomerId;
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* @deprecated No code path emits `checkout.session.created`, so this payload
|
|
264
|
-
* never arrives. Removed from the `ThrottleEvent` union and the `@core/scopes`
|
|
265
|
-
* catalog on 2026-08-10; kept here only so restoring the event is a one-line
|
|
266
|
-
* change once an emit site exists.
|
|
267
|
-
*/
|
|
268
|
-
export interface CheckoutSessionCreatedData {
|
|
269
|
-
checkoutSessionId: string;
|
|
270
|
-
cartId?: CartId | null;
|
|
271
|
-
applicationId: string;
|
|
272
|
-
customerId?: CustomerId | null;
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* @deprecated No code path emits `checkout.session.completed`. See
|
|
276
|
-
* {@link CheckoutSessionCreatedData}.
|
|
277
|
-
*/
|
|
278
|
-
export interface CheckoutSessionCompletedData {
|
|
279
|
-
checkoutSessionId: string;
|
|
280
|
-
orderId?: OrderId | null;
|
|
281
|
-
customerId?: CustomerId | null;
|
|
282
|
-
}
|
|
283
|
-
type OrderRow = Record<string, unknown>;
|
|
284
|
-
/**
|
|
285
|
-
* Canonical order payment statuses. Mirrors the orders_payment_status_check
|
|
286
|
-
* constraint (migration 0179). NOT the same set as a single payment's status —
|
|
287
|
-
* `partially_paid` is a property of the ORDER (some money in, less than total),
|
|
288
|
-
* which no individual payment can express. Use this to narrow `order.paymentStatus`
|
|
289
|
-
* on the `OrderRow` embedded above.
|
|
290
|
-
*/
|
|
291
|
-
export declare const ORDER_PAYMENT_STATUSES: readonly ["pending", "authorized", "captured", "partially_paid", "partially_refunded", "refunded", "failed", "voided"];
|
|
292
|
-
export type OrderPaymentStatus = (typeof ORDER_PAYMENT_STATUSES)[number];
|
|
293
|
-
/**
|
|
294
|
-
* Canonical order lifecycle statuses. Mirrors the orders_status_check constraint
|
|
295
|
-
* and `ORDER_STATUSES` in `@commerce/orders`' status-model.ts, which is the
|
|
296
|
-
* source this set is kept in step with. A single monotonic sequence —
|
|
297
|
-
* `draft -> pending -> processing -> partially_fulfilled -> fulfilled ->
|
|
298
|
-
* closed`, with `cancelled` branching off — that absorbed the retired
|
|
299
|
-
* `fulfillmentStatus` axis. `completed` is gone; `fulfilled` is the happy-path
|
|
300
|
-
* end. Money lives on the separate `OrderPaymentStatus` axis above.
|
|
301
|
-
*/
|
|
302
|
-
export declare const ORDER_STATUSES: readonly ["draft", "pending", "processing", "partially_fulfilled", "fulfilled", "cancelled", "closed"];
|
|
303
|
-
export type OrderStatus = (typeof ORDER_STATUSES)[number];
|
|
304
|
-
/**
|
|
305
|
-
* Order events carry the buyer alongside the order.
|
|
306
|
-
*
|
|
307
|
-
* `order.customerId` is an internal UUID, so a destination keyed by email — most
|
|
308
|
-
* marketing and CRM tools — could not act on an order event alone; it had to
|
|
309
|
-
* have already received and stored the matching `customer.created`, and the
|
|
310
|
-
* ordering between the two is not guaranteed. The nested `customer` mirrors the
|
|
311
|
-
* shape `payment.*`, `subscription.*` and `cart.abandoned` already deliver, so
|
|
312
|
-
* one parser handles them all.
|
|
313
|
-
*
|
|
314
|
-
* Attached at delivery and additive: absent on deliveries from older server
|
|
315
|
-
* builds, and `null` for a guest order with no customer row.
|
|
316
|
-
*/
|
|
317
|
-
export interface OrderCreatedData extends CustomerEnrichedData {
|
|
318
|
-
order: OrderRow;
|
|
319
|
-
fromCart?: {
|
|
320
|
-
id: CartId;
|
|
321
|
-
};
|
|
322
|
-
sessionId?: string;
|
|
323
|
-
}
|
|
324
|
-
export interface OrderStatusTransitionData extends CustomerEnrichedData {
|
|
325
|
-
order: OrderRow;
|
|
326
|
-
status: OrderStatus;
|
|
327
|
-
previousStatus: OrderStatus;
|
|
328
|
-
/**
|
|
329
|
-
* The transition that produced this change. `SET_STATUS` means a human (or
|
|
330
|
-
* an integration acting for one) moved the order directly rather than the
|
|
331
|
-
* engine stepping it — see `manual` and `actor`.
|
|
332
|
-
*/
|
|
333
|
-
action: string;
|
|
334
|
-
reason?: string | null;
|
|
335
|
-
/** True when a merchant set the status by hand rather than the engine deriving it. */
|
|
336
|
-
manual?: boolean;
|
|
337
|
-
/** Who moved it. Absent on engine-driven transitions. */
|
|
338
|
-
actor?: {
|
|
339
|
-
type: 'user' | 'system' | 'integration';
|
|
340
|
-
id?: string | null;
|
|
341
|
-
} | null;
|
|
342
|
-
}
|
|
343
|
-
/** quote.requested / quote.proposed — sales quotes (B2B proposals).
|
|
344
|
-
* Merchant-shaped, but internal notes are never included (defense in depth). */
|
|
345
|
-
export interface QuoteEventRevisionData {
|
|
346
|
-
id: string;
|
|
347
|
-
revisionNumber: number;
|
|
348
|
-
state: string;
|
|
349
|
-
issuedAt?: string | null;
|
|
350
|
-
expiresAt?: string | null;
|
|
351
|
-
subtotal: number;
|
|
352
|
-
taxTotal: number;
|
|
353
|
-
discountTotal: number;
|
|
354
|
-
shippingTotal: number;
|
|
355
|
-
total: number;
|
|
356
|
-
paymentTerms: Record<string, unknown>;
|
|
357
|
-
depositAmount?: number | null;
|
|
358
|
-
}
|
|
359
|
-
export interface QuoteEventData {
|
|
360
|
-
quote: {
|
|
361
|
-
id: string;
|
|
362
|
-
quoteNumber: string;
|
|
363
|
-
status: string;
|
|
364
|
-
customerId?: string | null;
|
|
365
|
-
customerEmail?: string | null;
|
|
366
|
-
buyerReference?: string | null;
|
|
367
|
-
source: string;
|
|
368
|
-
currency: string;
|
|
369
|
-
assignedMemberId?: string | null;
|
|
370
|
-
expiresAt?: string | null;
|
|
371
|
-
createdAt: string;
|
|
372
|
-
};
|
|
373
|
-
revision?: QuoteEventRevisionData | null;
|
|
374
|
-
}
|
|
375
|
-
/** quote.comment_added — only fires for visibility='shared' comments; internal
|
|
376
|
-
* comments never reach webhooks (defense in depth). */
|
|
377
|
-
export interface QuoteCommentEventData extends QuoteEventData {
|
|
378
|
-
comment: {
|
|
379
|
-
id: string;
|
|
380
|
-
authorType: 'buyer' | 'merchant' | 'system';
|
|
381
|
-
body: string;
|
|
382
|
-
createdAt: string;
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
/** quote.declined — reason is the buyer- or rep-supplied free text, if any. */
|
|
386
|
-
export interface QuoteDeclinedEventData extends QuoteEventData {
|
|
387
|
-
declinedReason?: string | null;
|
|
388
|
-
}
|
|
389
|
-
/** quote.converted — the accepted revision's order now exists. */
|
|
390
|
-
export interface QuoteConvertedEventData extends QuoteEventData {
|
|
391
|
-
orderId: string;
|
|
392
|
-
}
|
|
393
|
-
/** quote.expired — the hourly expiry cron flipped a proposed quote past its
|
|
394
|
-
* revision's expiresAt. `revision` is null: the offer is no longer on the
|
|
395
|
-
* table, so only the quote identity is carried. */
|
|
396
|
-
export type QuoteExpiredEventData = QuoteEventData;
|
|
397
|
-
/** return.created / return.updated — RMA against an order (#690). */
|
|
398
|
-
export interface ReturnItemData {
|
|
399
|
-
lineItemId: string;
|
|
400
|
-
quantity: number;
|
|
401
|
-
amount: number;
|
|
402
|
-
}
|
|
403
|
-
export interface ReturnCreatedData {
|
|
404
|
-
returnId: string;
|
|
405
|
-
orderId: OrderId;
|
|
406
|
-
status: string;
|
|
407
|
-
reason?: string | null;
|
|
408
|
-
restock: boolean;
|
|
409
|
-
refundAmount: number;
|
|
410
|
-
items: ReturnItemData[];
|
|
411
|
-
}
|
|
412
|
-
export interface ReturnUpdatedData {
|
|
413
|
-
returnId: string;
|
|
414
|
-
orderId: OrderId;
|
|
415
|
-
status: string;
|
|
416
|
-
previousStatus: string;
|
|
417
|
-
restock: boolean;
|
|
418
|
-
refundAmount: number;
|
|
419
|
-
/** Set once the return completes and a refund is issued. */
|
|
420
|
-
refundPaymentId?: string | null;
|
|
421
|
-
}
|
|
422
|
-
export interface OrderSyncFailedData {
|
|
423
|
-
mappingId: string;
|
|
424
|
-
connectionId: string;
|
|
425
|
-
externalId: string;
|
|
426
|
-
attempts: number;
|
|
427
|
-
error: string;
|
|
428
|
-
}
|
|
429
|
-
export interface OrderSyncConflictData {
|
|
430
|
-
externalStatus: string;
|
|
431
|
-
throttleStatus: string;
|
|
432
|
-
dimension: string;
|
|
433
|
-
}
|
|
434
|
-
type PaymentRow = Record<string, unknown>;
|
|
435
|
-
/** payment.pending / payment.authorized / payment.voided — embed the full payment row. */
|
|
436
|
-
export interface PaymentEnvelopeData {
|
|
437
|
-
payment: PaymentRow;
|
|
438
|
-
}
|
|
439
|
-
/** payment.captured — flat payload with monetary fields. */
|
|
440
|
-
export interface PaymentCapturedData extends PaymentEnrichedData {
|
|
441
|
-
paymentId: PaymentId;
|
|
442
|
-
orderId: OrderId | null;
|
|
443
|
-
/** Amount captured. Equals `capturedAmount`; may be less than `authorizedAmount` on a partial capture. */
|
|
444
|
-
amount: number;
|
|
445
|
-
/** Amount actually captured (== `amount`). Present since partial-capture support. */
|
|
446
|
-
capturedAmount?: number;
|
|
447
|
-
/** Amount originally authorized. On a partial capture `capturedAmount < authorizedAmount`. */
|
|
448
|
-
authorizedAmount?: number;
|
|
449
|
-
currency: string;
|
|
450
|
-
processor?: string | null;
|
|
451
|
-
processorTransactionId?: string | null;
|
|
452
|
-
metadata?: Record<string, unknown> | null;
|
|
453
|
-
}
|
|
454
|
-
/** payment.failed — terminal failure/decline from the processor. */
|
|
455
|
-
export interface PaymentFailedData extends PaymentEnrichedData {
|
|
456
|
-
paymentId: PaymentId;
|
|
457
|
-
orderId: OrderId | null;
|
|
458
|
-
amount?: number | null;
|
|
459
|
-
currency?: string | null;
|
|
460
|
-
code?: string | null;
|
|
461
|
-
message?: string | null;
|
|
462
|
-
errorCode?: string | null;
|
|
463
|
-
errorMessage?: string | null;
|
|
464
|
-
/** Present when the failure arrived via a Gr4vy provider webhook. */
|
|
465
|
-
processorTransactionId?: string | null;
|
|
466
|
-
}
|
|
467
|
-
/** payment.refunded / payment.partially_refunded — flat refund payload. */
|
|
468
|
-
export interface PaymentRefundedData extends PaymentEnrichedData {
|
|
469
|
-
paymentId: PaymentId;
|
|
470
|
-
orderId: OrderId | null;
|
|
471
|
-
refundedAmount: number;
|
|
472
|
-
paymentAmount: number;
|
|
473
|
-
currency: string;
|
|
474
|
-
status?: string | null;
|
|
475
|
-
processor?: string | null;
|
|
476
|
-
gr4vyRefundId?: string | null;
|
|
477
|
-
}
|
|
478
|
-
/** payment.refund_failed */
|
|
479
|
-
export interface PaymentRefundFailedData extends PaymentEnrichedData {
|
|
480
|
-
paymentId: PaymentId;
|
|
481
|
-
orderId: OrderId | null;
|
|
482
|
-
amount: number;
|
|
483
|
-
currency: string;
|
|
484
|
-
gr4vyRefundId?: string | null;
|
|
485
|
-
errorCode?: string | null;
|
|
486
|
-
errorMessage?: string | null;
|
|
487
|
-
}
|
|
488
|
-
/** payment.vaulted — a reusable payment method was stored at checkout. */
|
|
489
|
-
export interface PaymentVaultedData {
|
|
490
|
-
customerId: CustomerId;
|
|
491
|
-
paymentMethodId: string;
|
|
492
|
-
gr4vyBuyerId: string;
|
|
493
|
-
processor: string;
|
|
494
|
-
checkoutSessionId: string;
|
|
495
|
-
recurring?: boolean | null;
|
|
496
|
-
}
|
|
497
|
-
export interface PaymentDisputedData {
|
|
498
|
-
paymentId: PaymentId;
|
|
499
|
-
reason: string;
|
|
500
|
-
openedAt: string;
|
|
501
|
-
}
|
|
502
|
-
export interface PaymentDisputeClearedData {
|
|
503
|
-
paymentId: PaymentId;
|
|
504
|
-
}
|
|
505
|
-
type FulfillmentRow = Record<string, unknown>;
|
|
506
|
-
type ShipmentRow = Record<string, unknown>;
|
|
507
|
-
export interface FulfillmentEnvelopeData {
|
|
508
|
-
fulfillment: FulfillmentRow;
|
|
509
|
-
order: {
|
|
510
|
-
id: OrderId;
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
export interface FulfillmentShipmentShippedData {
|
|
514
|
-
fulfillment: FulfillmentRow;
|
|
515
|
-
shipment: ShipmentRow;
|
|
516
|
-
order: {
|
|
517
|
-
id: OrderId;
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
|
-
/** fulfillment.digital.delivered — digital asset was delivered to the customer. */
|
|
521
|
-
export interface FulfillmentDigitalDeliveredData {
|
|
522
|
-
fulfillment: FulfillmentRow;
|
|
523
|
-
order: {
|
|
524
|
-
id: OrderId;
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
/**
|
|
528
|
-
* Customer identity attached to outbound payloads by the delivery worker.
|
|
529
|
-
*
|
|
530
|
-
* Delivered payloads carry Throttle's internal `customerId`, which means
|
|
531
|
-
* nothing outside Throttle — so every integrator had to call
|
|
532
|
-
* `GET /customers/{id}` on the hot path just to learn which of their own
|
|
533
|
-
* tenants an event belongs to. This carries BOTH external identifiers because
|
|
534
|
-
* they are distinct: `externalId` is the merchant's own customer id, while
|
|
535
|
-
* `externalCustomerId` is a per-connection mapping.
|
|
536
|
-
*
|
|
537
|
-
* `id` is nullable only for guest carts, which have an email but no customer
|
|
538
|
-
* row. Subscription and payment events always resolve a real row or omit the
|
|
539
|
-
* field entirely.
|
|
540
|
-
*/
|
|
541
|
-
export interface WebhookCustomer {
|
|
542
|
-
id: CustomerId | null;
|
|
543
|
-
email: string;
|
|
544
|
-
firstName: string | null;
|
|
545
|
-
lastName: string | null;
|
|
546
|
-
phone: string | null;
|
|
547
|
-
externalId: string | null;
|
|
548
|
-
externalCustomerId: string | null;
|
|
549
|
-
}
|
|
550
|
-
/** Mixin: every `subscription.*` payload carries the customer it belongs to. */
|
|
551
|
-
export interface CustomerEnrichedData {
|
|
552
|
-
/** Attached at delivery. Absent if the customer row could not be resolved. */
|
|
553
|
-
customer?: WebhookCustomer | null;
|
|
554
|
-
}
|
|
555
|
-
/**
|
|
556
|
-
* Mixin for flat `payment.*` payloads, which previously carried neither the
|
|
557
|
-
* customer nor the subscription a charge belonged to — making them unusable
|
|
558
|
-
* for billing-state sync without extra lookups.
|
|
559
|
-
*/
|
|
560
|
-
export interface PaymentEnrichedData extends CustomerEnrichedData {
|
|
561
|
-
/** Resolved from the payment's order at delivery. */
|
|
562
|
-
customerId?: CustomerId | null;
|
|
563
|
-
/** Present when the charge originated from a subscription. */
|
|
564
|
-
subscriptionId?: SubscriptionId | null;
|
|
565
|
-
}
|
|
566
|
-
type SubscriptionRow = Record<string, unknown>;
|
|
567
|
-
type PaymentMethodRow = Record<string, unknown>;
|
|
568
|
-
type WorkspaceRow = Record<string, unknown>;
|
|
569
|
-
type ChargeRow = Record<string, unknown>;
|
|
570
|
-
type InvoiceRow = Record<string, unknown>;
|
|
571
|
-
export interface SubscriptionEnvelopeData extends CustomerEnrichedData {
|
|
572
|
-
subscription: SubscriptionRow;
|
|
573
|
-
}
|
|
574
|
-
export interface SubscriptionUpdatedData extends CustomerEnrichedData {
|
|
575
|
-
subscription: SubscriptionRow;
|
|
576
|
-
cancelAtPeriodEnd?: boolean;
|
|
577
|
-
}
|
|
578
|
-
export interface SubscriptionCancelledData extends CustomerEnrichedData {
|
|
579
|
-
subscription: SubscriptionRow;
|
|
580
|
-
reason?: string | null;
|
|
581
|
-
atPeriodEnd?: boolean;
|
|
582
|
-
lastError?: string | null;
|
|
583
|
-
}
|
|
584
|
-
export interface SubscriptionRenewedData extends CustomerEnrichedData {
|
|
585
|
-
subscription: SubscriptionRow;
|
|
586
|
-
payment?: PaymentRow;
|
|
587
|
-
order?: OrderRow;
|
|
588
|
-
freeRenewal?: boolean;
|
|
589
|
-
}
|
|
590
|
-
export interface SubscriptionPaymentFailedData extends CustomerEnrichedData {
|
|
591
|
-
subscription: SubscriptionRow;
|
|
592
|
-
attempt: number;
|
|
593
|
-
nextRetryAt: string | null;
|
|
594
|
-
lastError: string;
|
|
595
|
-
}
|
|
596
|
-
/** subscription.backup_pm_used — a renewal fell back to the buyer's backup card (#665). */
|
|
597
|
-
export interface SubscriptionBackupPmUsedData extends CustomerEnrichedData {
|
|
598
|
-
subscription: SubscriptionRow;
|
|
599
|
-
payment?: PaymentRow;
|
|
600
|
-
backupPaymentMethod: {
|
|
601
|
-
cardLastFour?: string | null;
|
|
602
|
-
cardBrand?: string | null;
|
|
603
|
-
};
|
|
604
|
-
}
|
|
605
|
-
export interface SubscriptionTrialBlockedData extends CustomerEnrichedData {
|
|
606
|
-
subscriptionId: SubscriptionId;
|
|
607
|
-
customerId: CustomerId;
|
|
608
|
-
paymentMethodId: string;
|
|
609
|
-
reason: string;
|
|
610
|
-
requestedTrialDays: number;
|
|
611
|
-
}
|
|
612
|
-
/** Fired when a recurring checkout's subscription auto-create fails after the
|
|
613
|
-
* payment method was vaulted. There is no subscription row, so this carries the
|
|
614
|
-
* checkout/vault identifiers and the failure reason. */
|
|
615
|
-
export interface SubscriptionCreateFailedData extends CustomerEnrichedData {
|
|
616
|
-
checkoutSessionId: string;
|
|
617
|
-
customerId: CustomerId;
|
|
618
|
-
paymentMethodId: string;
|
|
619
|
-
gr4vyBuyerId: string;
|
|
620
|
-
recurring: boolean;
|
|
621
|
-
reason: string;
|
|
622
|
-
}
|
|
623
|
-
/** Fired when a plan change is applied — an immediate upgrade, or a deferred
|
|
624
|
-
* downgrade applied by the renewal cron at period end. */
|
|
625
|
-
export interface SubscriptionPlanChangedData extends CustomerEnrichedData {
|
|
626
|
-
subscription: SubscriptionRow;
|
|
627
|
-
previous: {
|
|
628
|
-
planReference: string;
|
|
629
|
-
amount: number;
|
|
630
|
-
};
|
|
631
|
-
}
|
|
632
|
-
/** Fired when a downgrade is scheduled to take effect at the next period end. */
|
|
633
|
-
export interface SubscriptionPlanChangeScheduledData extends CustomerEnrichedData {
|
|
634
|
-
subscription: SubscriptionRow;
|
|
635
|
-
pending: {
|
|
636
|
-
planReference: string;
|
|
637
|
-
planName: string | null;
|
|
638
|
-
interval: string;
|
|
639
|
-
amount: number;
|
|
640
|
-
};
|
|
641
|
-
/** ISO timestamp when the scheduled change takes effect (current period end). */
|
|
642
|
-
effectiveAt: string;
|
|
643
|
-
}
|
|
644
|
-
type CustomerRow = Record<string, unknown>;
|
|
645
|
-
type CartRow = Record<string, unknown>;
|
|
646
|
-
export interface DiscountAppliedData {
|
|
647
|
-
cart: CartRow;
|
|
648
|
-
code: string;
|
|
649
|
-
cartId: CartId;
|
|
650
|
-
}
|
|
651
|
-
export interface DiscountRemovedData {
|
|
652
|
-
cart: CartRow;
|
|
653
|
-
cartId: CartId;
|
|
654
|
-
}
|
|
655
|
-
export interface CustomerEnvelopeData {
|
|
656
|
-
customer: CustomerRow;
|
|
657
|
-
}
|
|
658
|
-
export interface CustomerPaymentMethodData {
|
|
659
|
-
paymentMethod: PaymentMethodRow;
|
|
660
|
-
}
|
|
661
|
-
export interface ShippingTaxProviderUnhealthyData {
|
|
662
|
-
connection_id: string;
|
|
663
|
-
axis: 'shipping' | 'tax';
|
|
664
|
-
provider: string;
|
|
665
|
-
/** Provider environment label: `sandbox` | `production`. */
|
|
666
|
-
environment: string;
|
|
667
|
-
/** Workspace environment row id. Many non-production environments share the
|
|
668
|
-
* `sandbox` label, so this is what actually identifies which one. */
|
|
669
|
-
environment_id: string;
|
|
670
|
-
application_id: string;
|
|
671
|
-
workspace_id: string;
|
|
672
|
-
consecutive_failures: number;
|
|
673
|
-
last_error_reason: string | null;
|
|
674
|
-
last_error_detail: string | null;
|
|
675
|
-
last_error_at: string;
|
|
676
|
-
fallback_policy: string;
|
|
677
|
-
}
|
|
678
|
-
export interface WorkspacePaymentMethodData {
|
|
679
|
-
workspace: WorkspaceRow;
|
|
680
|
-
paymentMethod: PaymentMethodRow;
|
|
681
|
-
}
|
|
682
|
-
export interface WorkspaceDefaultPaymentMethodChangedData {
|
|
683
|
-
workspace: WorkspaceRow;
|
|
684
|
-
paymentMethod: PaymentMethodRow;
|
|
685
|
-
previousPaymentMethod?: PaymentMethodRow | null;
|
|
686
|
-
}
|
|
687
|
-
export interface WorkspaceBackupPmUsedData {
|
|
688
|
-
workspace: WorkspaceRow;
|
|
689
|
-
primaryPaymentMethod: PaymentMethodRow;
|
|
690
|
-
backupPaymentMethod: PaymentMethodRow;
|
|
691
|
-
charge: ChargeRow;
|
|
692
|
-
}
|
|
693
|
-
export interface WorkspacePlatformChargeSucceededData {
|
|
694
|
-
workspace: WorkspaceRow;
|
|
695
|
-
invoice: InvoiceRow;
|
|
696
|
-
charge: ChargeRow;
|
|
697
|
-
}
|
|
698
|
-
export interface WorkspacePlatformChargeFailedData {
|
|
699
|
-
workspace: WorkspaceRow;
|
|
700
|
-
charge: ChargeRow;
|
|
701
|
-
error: string;
|
|
702
|
-
}
|
|
703
|
-
export interface WorkspaceTrialExpiredData {
|
|
704
|
-
workspace: WorkspaceRow;
|
|
705
|
-
expiredAt: string;
|
|
706
|
-
}
|
|
707
|
-
export interface ExtensionReviewEventData {
|
|
708
|
-
/** Summary of the extension under review. */
|
|
709
|
-
extension: {
|
|
710
|
-
id: string;
|
|
711
|
-
name: string;
|
|
712
|
-
slug: string;
|
|
713
|
-
};
|
|
714
|
-
/**
|
|
715
|
-
* Reviewer feedback. Present on `extension.review.changes_requested` and
|
|
716
|
-
* `extension.review.rejected`; absent on `approved` and `submitted`.
|
|
717
|
-
*/
|
|
718
|
-
feedback?: string;
|
|
719
|
-
}
|
|
720
|
-
export interface ExtensionReviewCommentEventData {
|
|
721
|
-
/** Summary of the extension under review. */
|
|
722
|
-
extension: {
|
|
723
|
-
id: string;
|
|
724
|
-
name: string;
|
|
725
|
-
slug: string;
|
|
726
|
-
};
|
|
727
|
-
/** The comment that was added. */
|
|
728
|
-
comment: {
|
|
729
|
-
body: string;
|
|
730
|
-
/** Human-readable author label, e.g. 'Throttle Staff'. */
|
|
731
|
-
author: string;
|
|
732
|
-
};
|
|
733
|
-
}
|
|
734
|
-
export interface ExtensionLifecycleEventData {
|
|
735
|
-
/** Summary of the extension. */
|
|
736
|
-
extension: {
|
|
737
|
-
id: string;
|
|
738
|
-
name: string;
|
|
739
|
-
slug: string;
|
|
740
|
-
};
|
|
741
|
-
/**
|
|
742
|
-
* Version tag. Present on `extension.review.auto_approved` (the safely
|
|
743
|
-
* auto-advanced version); absent on the other lifecycle events.
|
|
744
|
-
*/
|
|
745
|
-
version?: {
|
|
746
|
-
tag: string;
|
|
747
|
-
};
|
|
748
|
-
/**
|
|
749
|
-
* Takedown reason. Present on `extension.unpublished`; absent otherwise.
|
|
750
|
-
*/
|
|
751
|
-
reason?: string;
|
|
752
|
-
}
|
|
753
|
-
export interface InvoicePastDueData {
|
|
754
|
-
paymentId: string;
|
|
755
|
-
orderId: string;
|
|
756
|
-
invoiceNumber?: string | null;
|
|
757
|
-
daysPastDue: number;
|
|
758
|
-
tickFired: number;
|
|
759
|
-
dueDate: string;
|
|
760
|
-
totalAmount: number;
|
|
761
|
-
currency: string;
|
|
762
|
-
}
|
|
763
|
-
type Event<T extends string, D> = {
|
|
764
|
-
type: T;
|
|
765
|
-
data: D;
|
|
766
|
-
};
|
|
767
|
-
export type WebhookEvent = Event<'cart.created', CartCreatedData> | Event<'cart.updated', CartUpdatedData> | Event<'cart.item_added', CartItemAddedData> | Event<'cart.item_updated', CartItemUpdatedData> | Event<'cart.item_removed', CartItemRemovedData> | Event<'cart.shipping_selected', CartShippingSelectedData> | Event<'cart.shipping_cleared', CartShippingClearedData> | Event<'cart.discount_applied', CartDiscountAppliedData> | Event<'cart.discount_removed', CartDiscountRemovedData> | Event<'cart.tax_recomputed', CartTaxRecomputedData> | Event<'cart.checkout_started', CartCheckoutStartedData> | Event<'cart.converted', CartConvertedData> | Event<'cart.abandoned', CartAbandonedData> | Event<'cart.merged', CartMergedData> | Event<'order.created', OrderCreatedData> | Event<'order.updated', OrderStatusTransitionData> | Event<'order.fulfilled', OrderStatusTransitionData> | Event<'order.cancelled', OrderStatusTransitionData> | Event<'order.closed', OrderStatusTransitionData> | Event<'return.created', ReturnCreatedData> | Event<'return.updated', ReturnUpdatedData> | Event<'quote.requested', QuoteEventData> | Event<'quote.proposed', QuoteEventData> | Event<'quote.viewed', QuoteEventData> | Event<'quote.comment_added', QuoteCommentEventData> | Event<'quote.revision_requested', QuoteEventData> | Event<'quote.declined', QuoteDeclinedEventData> | Event<'quote.accepted', QuoteEventData> | Event<'quote.converted', QuoteConvertedEventData> | Event<'quote.expired', QuoteExpiredEventData> | Event<'order.sync_failed', OrderSyncFailedData> | Event<'order.sync_conflict', OrderSyncConflictData> | Event<'payment.pending', PaymentEnvelopeData> | Event<'payment.authorized', PaymentEnvelopeData> | Event<'payment.captured', PaymentCapturedData> | Event<'payment.failed', PaymentFailedData> | Event<'payment.voided', PaymentEnvelopeData> | Event<'payment.refunded', PaymentRefundedData> | Event<'payment.partially_refunded', PaymentRefundedData> | Event<'payment.refund_failed', PaymentRefundFailedData> | Event<'payment.vaulted', PaymentVaultedData> | Event<'payment.disputed', PaymentDisputedData> | Event<'payment.dispute_cleared', PaymentDisputeClearedData> | Event<'fulfillment.created', FulfillmentEnvelopeData> | Event<'fulfillment.completed', FulfillmentEnvelopeData> | Event<'fulfillment.cancelled', FulfillmentEnvelopeData> | Event<'fulfillment.shipment.shipped', FulfillmentShipmentShippedData> | Event<'fulfillment.shipment.delivered', FulfillmentEnvelopeData> | Event<'fulfillment.digital.delivered', FulfillmentDigitalDeliveredData> | Event<'subscription.created', SubscriptionEnvelopeData> | Event<'subscription.activated', SubscriptionEnvelopeData> | Event<'subscription.updated', SubscriptionUpdatedData> | Event<'subscription.plan_changed', SubscriptionPlanChangedData> | Event<'subscription.plan_change_scheduled', SubscriptionPlanChangeScheduledData> | Event<'subscription.paused', SubscriptionEnvelopeData> | Event<'subscription.resumed', SubscriptionEnvelopeData> | Event<'subscription.cancelled', SubscriptionCancelledData> | Event<'subscription.renewed', SubscriptionRenewedData> | Event<'subscription.past_due', SubscriptionEnvelopeData> | Event<'subscription.payment_failed', SubscriptionPaymentFailedData> | Event<'subscription.backup_pm_used', SubscriptionBackupPmUsedData> | Event<'subscription.create_failed', SubscriptionCreateFailedData> | Event<'subscription.trial_blocked', SubscriptionTrialBlockedData> | Event<'discount.applied', DiscountAppliedData> | Event<'discount.removed', DiscountRemovedData> | Event<'customer.created', CustomerEnvelopeData> | Event<'customer.updated', CustomerEnvelopeData> | Event<'customer.deleted', CustomerEnvelopeData> | Event<'customer.payment_method_added', CustomerPaymentMethodData> | Event<'customer.payment_method_removed', CustomerPaymentMethodData> | Event<'invoice.past_due', InvoicePastDueData> | Event<'shipping_tax.provider_connection.unhealthy', ShippingTaxProviderUnhealthyData> | Event<'workspace.payment_method.added', WorkspacePaymentMethodData> | Event<'workspace.payment_method.removed', WorkspacePaymentMethodData> | Event<'workspace.payment_method.default_changed', WorkspaceDefaultPaymentMethodChangedData> | Event<'workspace.payment_method.backup_set', WorkspacePaymentMethodData> | Event<'workspace.payment_method.backup_used', WorkspaceBackupPmUsedData> | Event<'workspace.platform_charge.succeeded', WorkspacePlatformChargeSucceededData> | Event<'workspace.platform_charge.failed', WorkspacePlatformChargeFailedData> | Event<'workspace.trial_expired', WorkspaceTrialExpiredData>;
|
|
768
|
-
/** Union of every event type string emitted by the Throttle outbound bus. */
|
|
769
|
-
export type WebhookEventType = WebhookEvent['type'];
|
|
770
|
-
/**
|
|
771
|
-
* A `ThrottleEventEnvelope` over the full `WebhookEvent` discriminated union.
|
|
772
|
-
* Cast incoming webhook bodies to this type and switch on `event.type` to
|
|
773
|
-
* get fully-narrowed `event.data` access with no explicit casts.
|
|
774
|
-
*
|
|
775
|
-
* ```ts
|
|
776
|
-
* const event = req.body as ThrottleEvent;
|
|
777
|
-
* if (event.type === 'order.created') {
|
|
778
|
-
* // event.data is OrderCreatedData here
|
|
779
|
-
* }
|
|
780
|
-
* ```
|
|
781
|
-
*/
|
|
782
|
-
export type ThrottleEvent = {
|
|
783
|
-
[E in WebhookEvent as E['type']]: ThrottleEventEnvelope<E['type'], E['data']>;
|
|
784
|
-
}[WebhookEvent['type']];
|
|
785
|
-
/**
|
|
786
|
-
* Narrows a `ThrottleEvent` to a specific event type.
|
|
787
|
-
* Useful for single-event handler signatures:
|
|
788
|
-
*
|
|
789
|
-
* ```ts
|
|
790
|
-
* function onPaymentCaptured(ev: ThrottleEventOfType<'payment.captured'>) {
|
|
791
|
-
* console.log(ev.data.paymentId, ev.data.amount);
|
|
792
|
-
* }
|
|
793
|
-
* ```
|
|
794
|
-
*/
|
|
795
|
-
export type ThrottleEventOfType<T extends WebhookEventType> = Extract<ThrottleEvent, {
|
|
796
|
-
type: T;
|
|
797
|
-
}>;
|
|
798
|
-
/** Runtime mirror of the WebhookEvent union — keep in lockstep with it.
|
|
799
|
-
* The `satisfies` clause makes tsc fail if a string is not a real union member.
|
|
800
|
-
* The parity test (event-parity.test.ts) makes it fail if any entry is missing
|
|
801
|
-
* from the @core/scopes canonical registry. */
|
|
802
|
-
export declare const WEBHOOK_EVENT_TYPES: readonly ["cart.created", "cart.updated", "cart.item_added", "cart.item_updated", "cart.item_removed", "cart.shipping_selected", "cart.shipping_cleared", "cart.discount_applied", "cart.discount_removed", "cart.tax_recomputed", "cart.checkout_started", "cart.converted", "cart.abandoned", "cart.merged", "order.created", "order.updated", "order.fulfilled", "order.cancelled", "order.closed", "order.sync_failed", "order.sync_conflict", "return.created", "return.updated", "quote.requested", "quote.proposed", "quote.viewed", "quote.comment_added", "quote.revision_requested", "quote.declined", "quote.accepted", "quote.converted", "quote.expired", "payment.pending", "payment.authorized", "payment.captured", "payment.failed", "payment.voided", "payment.refunded", "payment.partially_refunded", "payment.refund_failed", "payment.vaulted", "payment.disputed", "payment.dispute_cleared", "fulfillment.created", "fulfillment.completed", "fulfillment.cancelled", "fulfillment.shipment.shipped", "fulfillment.shipment.delivered", "fulfillment.digital.delivered", "subscription.created", "subscription.activated", "subscription.updated", "subscription.plan_changed", "subscription.plan_change_scheduled", "subscription.paused", "subscription.resumed", "subscription.cancelled", "subscription.renewed", "subscription.past_due", "subscription.payment_failed", "subscription.backup_pm_used", "subscription.create_failed", "subscription.trial_blocked", "discount.applied", "discount.removed", "customer.created", "customer.updated", "customer.deleted", "customer.payment_method_added", "customer.payment_method_removed", "invoice.past_due", "shipping_tax.provider_connection.unhealthy", "workspace.payment_method.added", "workspace.payment_method.removed", "workspace.payment_method.default_changed", "workspace.payment_method.backup_set", "workspace.payment_method.backup_used", "workspace.platform_charge.succeeded", "workspace.platform_charge.failed", "workspace.trial_expired"];
|
|
803
|
-
/**
|
|
804
|
-
* Verifies the `Throttle-Signature` header against the raw request body.
|
|
805
|
-
* Use this from your webhook handler BEFORE parsing the JSON.
|
|
806
|
-
*
|
|
807
|
-
* Header format: `t=<timestamp>,v1=<hex>`. The HMAC is computed over
|
|
808
|
-
* `${timestamp}.${rawBody}` with the endpoint's signing secret
|
|
809
|
-
* (returned as `signingSecret` when you created the endpoint via
|
|
810
|
-
* POST /api/v1/webhooks). Reject if the timestamp is more than
|
|
811
|
-
* `toleranceSeconds` old (default 5 minutes) — protects against replay.
|
|
812
|
-
*/
|
|
813
|
-
export declare function verifyWebhookSignature(args: {
|
|
814
|
-
header: string;
|
|
815
|
-
rawBody: string;
|
|
816
|
-
secret: string;
|
|
817
|
-
toleranceSeconds?: number;
|
|
818
|
-
}): boolean;
|
|
819
|
-
export {};
|
|
820
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAQH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,qBAAqB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,KAAK,GAAG,OAAO;IACnF,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,iEAAiE;IACjE,IAAI,EAAE,KAAK,CAAC;IACZ;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,aAAa,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,IAAI,EAAE,KAAK,CAAC;CACb;AAMD,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IACpE,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,aAAa,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,aAAa,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,KAAK,EAAE,CAAC,CAAC;CACV;AAMD,KAAK,MAAM,GAAG,MAAM,CAAC;AACrB,KAAK,OAAO,GAAG,MAAM,CAAC;AACtB,KAAK,SAAS,GAAG,MAAM,CAAC;AAExB,KAAK,cAAc,GAAG,MAAM,CAAC;AAC7B,KAAK,UAAU,GAAG,MAAM,CAAC;AAEzB,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,E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
2
|
-
* @usethrottle/webhook-types
|
|
3
|
-
*
|
|
4
|
-
* TypeScript discriminated unions for every Throttle outbound webhook event.
|
|
5
|
-
* Keyed by `event.type` (legacy) or top-level `type` (ThrottleEventEnvelope),
|
|
6
|
-
* this lets your handler narrow the payload without casts.
|
|
7
|
-
*
|
|
8
|
-
* Coverage: every outbound event type emitted by the Throttle outbound bus
|
|
9
|
-
* is enumerated in `WebhookEventType`. The most-integrated events (cart,
|
|
10
|
-
* checkout, order, payment, fulfillment, subscription, customer core lifecycle)
|
|
11
|
-
* get typed `data` shapes. The remaining events resolve to
|
|
12
|
-
* `data: Record<string, unknown>`.
|
|
13
|
-
*
|
|
14
|
-
* Source of truth: `packages/platform-webhooks/src/outbound/events.ts` in the
|
|
15
|
-
* Throttle monorepo. The event registry there is the only place event names
|
|
16
|
-
* are allowed to be added; this package mirrors that file.
|
|
17
|
-
*
|
|
18
|
-
* Includes a Stripe-compatible signature verification helper.
|
|
19
|
-
*
|
|
20
|
-
* ## Wire format (ThrottleEventEnvelope)
|
|
21
|
-
*
|
|
22
|
-
* The outbound worker (`packages/platform-webhooks/src/outbound/dispatcher.ts`)
|
|
23
|
-
* delivers the following flat JSON body to your endpoint:
|
|
24
|
-
*
|
|
25
|
-
* ```json
|
|
26
|
-
* {
|
|
27
|
-
* "id": "<uuid-v7>",
|
|
28
|
-
* "type": "<event-type>",
|
|
29
|
-
* "version": "1",
|
|
30
|
-
* "createdAt": "<ISO-8601>",
|
|
31
|
-
* "environmentId": "<workspace-environment-uuid>",
|
|
32
|
-
* "workspaceId": "<ws_...>",
|
|
33
|
-
* "data": { ... }
|
|
34
|
-
* }
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* `version` is `'1'` for all currently-defined events; Throttle will increment
|
|
38
|
-
* it on breaking payload changes. `environmentId` identifies the workspace
|
|
39
|
-
* environment that emitted the event, so production and every non-production
|
|
40
|
-
* environment route independently. `applicationId` is not exposed at the
|
|
41
|
-
* envelope level.
|
|
42
|
-
*
|
|
43
|
-
* **Existing `WebhookEnvelope` consumers are unaffected** — the `event:
|
|
44
|
-
* { type, data }` nesting in that type is an in-memory representation only.
|
|
45
|
-
* The wire format flattens `type` and `data` to the top level of the envelope.
|
|
46
|
-
*
|
|
47
|
-
* The legacy `WebhookEnvelope` type (with its `event: { type, data }` nesting)
|
|
48
|
-
* is retained for back-compat and describes the in-memory representation used
|
|
49
|
-
* by internal consumers; external integrations should use `ThrottleEventEnvelope`.
|
|
50
|
-
*/
|
|
51
|
-
import { createHmac, timingSafeEqual } from 'node:crypto';
|
|
52
|
-
/**
|
|
53
|
-
* Canonical order payment statuses. Mirrors the orders_payment_status_check
|
|
54
|
-
* constraint (migration 0179). NOT the same set as a single payment's status —
|
|
55
|
-
* `partially_paid` is a property of the ORDER (some money in, less than total),
|
|
56
|
-
* which no individual payment can express. Use this to narrow `order.paymentStatus`
|
|
57
|
-
* on the `OrderRow` embedded above.
|
|
58
|
-
*/
|
|
59
|
-
export const ORDER_PAYMENT_STATUSES = [
|
|
60
|
-
'pending',
|
|
61
|
-
'authorized',
|
|
62
|
-
'captured',
|
|
63
|
-
'partially_paid',
|
|
64
|
-
'partially_refunded',
|
|
65
|
-
'refunded',
|
|
66
|
-
'failed',
|
|
67
|
-
'voided',
|
|
68
|
-
];
|
|
69
|
-
/**
|
|
70
|
-
* Canonical order lifecycle statuses. Mirrors the orders_status_check constraint
|
|
71
|
-
* and `ORDER_STATUSES` in `@commerce/orders`' status-model.ts, which is the
|
|
72
|
-
* source this set is kept in step with. A single monotonic sequence —
|
|
73
|
-
* `draft -> pending -> processing -> partially_fulfilled -> fulfilled ->
|
|
74
|
-
* closed`, with `cancelled` branching off — that absorbed the retired
|
|
75
|
-
* `fulfillmentStatus` axis. `completed` is gone; `fulfilled` is the happy-path
|
|
76
|
-
* end. Money lives on the separate `OrderPaymentStatus` axis above.
|
|
77
|
-
*/
|
|
78
|
-
export const ORDER_STATUSES = [
|
|
79
|
-
'draft',
|
|
80
|
-
'pending',
|
|
81
|
-
'processing',
|
|
82
|
-
'partially_fulfilled',
|
|
83
|
-
'fulfilled',
|
|
84
|
-
'cancelled',
|
|
85
|
-
'closed',
|
|
86
|
-
];
|
|
87
|
-
/** Runtime mirror of the WebhookEvent union — keep in lockstep with it.
|
|
88
|
-
* The `satisfies` clause makes tsc fail if a string is not a real union member.
|
|
89
|
-
* The parity test (event-parity.test.ts) makes it fail if any entry is missing
|
|
90
|
-
* from the @core/scopes canonical registry. */
|
|
91
|
-
export const WEBHOOK_EVENT_TYPES = [
|
|
92
|
-
// Cart
|
|
93
|
-
'cart.created', 'cart.updated', 'cart.item_added', 'cart.item_updated', 'cart.item_removed',
|
|
94
|
-
'cart.shipping_selected', 'cart.shipping_cleared', 'cart.discount_applied', 'cart.discount_removed',
|
|
95
|
-
'cart.tax_recomputed', 'cart.checkout_started', 'cart.converted', 'cart.abandoned', 'cart.merged',
|
|
96
|
-
// Checkout session — removed 2026-08-10, see the union above.
|
|
97
|
-
// Order
|
|
98
|
-
'order.created', 'order.updated', 'order.fulfilled', 'order.cancelled', 'order.closed',
|
|
99
|
-
'order.sync_failed', 'order.sync_conflict',
|
|
100
|
-
// Return / RMA (#690)
|
|
101
|
-
'return.created', 'return.updated',
|
|
102
|
-
// Quote (sales quotes)
|
|
103
|
-
'quote.requested', 'quote.proposed', 'quote.viewed', 'quote.comment_added',
|
|
104
|
-
'quote.revision_requested', 'quote.declined', 'quote.accepted', 'quote.converted',
|
|
105
|
-
'quote.expired',
|
|
106
|
-
// Payment (authorization_failed / capture_failed / void_failed removed 2026-07-05:
|
|
107
|
-
// no live code path emits them — Gr4vy adapter not wired into PaymentService)
|
|
108
|
-
'payment.pending', 'payment.authorized', 'payment.captured',
|
|
109
|
-
'payment.failed', 'payment.voided',
|
|
110
|
-
'payment.refunded', 'payment.partially_refunded', 'payment.refund_failed', 'payment.vaulted',
|
|
111
|
-
'payment.disputed', 'payment.dispute_cleared',
|
|
112
|
-
// Fulfillment
|
|
113
|
-
'fulfillment.created', 'fulfillment.completed', 'fulfillment.cancelled',
|
|
114
|
-
'fulfillment.shipment.shipped', 'fulfillment.shipment.delivered',
|
|
115
|
-
'fulfillment.digital.delivered',
|
|
116
|
-
// Subscription
|
|
117
|
-
'subscription.created', 'subscription.activated', 'subscription.updated',
|
|
118
|
-
'subscription.plan_changed', 'subscription.plan_change_scheduled',
|
|
119
|
-
'subscription.paused',
|
|
120
|
-
'subscription.resumed', 'subscription.cancelled', 'subscription.renewed', 'subscription.past_due',
|
|
121
|
-
'subscription.payment_failed', 'subscription.backup_pm_used', 'subscription.create_failed',
|
|
122
|
-
'subscription.trial_blocked',
|
|
123
|
-
// Discount
|
|
124
|
-
'discount.applied', 'discount.removed',
|
|
125
|
-
// Customer
|
|
126
|
-
'customer.created', 'customer.updated', 'customer.deleted',
|
|
127
|
-
'customer.payment_method_added', 'customer.payment_method_removed',
|
|
128
|
-
// AR / Net30 invoice
|
|
129
|
-
'invoice.past_due',
|
|
130
|
-
// Shipping & tax provider health
|
|
131
|
-
'shipping_tax.provider_connection.unhealthy',
|
|
132
|
-
// Workspace payment methods (platform-billing)
|
|
133
|
-
'workspace.payment_method.added', 'workspace.payment_method.removed',
|
|
134
|
-
'workspace.payment_method.default_changed', 'workspace.payment_method.backup_set',
|
|
135
|
-
'workspace.payment_method.backup_used',
|
|
136
|
-
// Platform billing charges
|
|
137
|
-
'workspace.platform_charge.succeeded', 'workspace.platform_charge.failed',
|
|
138
|
-
// Workspace lifecycle
|
|
139
|
-
'workspace.trial_expired',
|
|
140
|
-
// NOTE: extension.* removed from the webhook contract (2026-07-05) — in-app +
|
|
141
|
-
// email notifications only, not deliverable webhooks.
|
|
142
|
-
];
|
|
143
|
-
const _assertAllEventsListed = true;
|
|
144
|
-
// ----------------------------------------------------------------------------
|
|
145
|
-
// Signature verification (Stripe-compatible scheme)
|
|
146
|
-
// ----------------------------------------------------------------------------
|
|
147
|
-
/**
|
|
148
|
-
* Verifies the `Throttle-Signature` header against the raw request body.
|
|
149
|
-
* Use this from your webhook handler BEFORE parsing the JSON.
|
|
150
|
-
*
|
|
151
|
-
* Header format: `t=<timestamp>,v1=<hex>`. The HMAC is computed over
|
|
152
|
-
* `${timestamp}.${rawBody}` with the endpoint's signing secret
|
|
153
|
-
* (returned as `signingSecret` when you created the endpoint via
|
|
154
|
-
* POST /api/v1/webhooks). Reject if the timestamp is more than
|
|
155
|
-
* `toleranceSeconds` old (default 5 minutes) — protects against replay.
|
|
156
|
-
*/
|
|
157
|
-
export function verifyWebhookSignature(args) {
|
|
158
|
-
const { header, rawBody, secret, toleranceSeconds = 300 } = args;
|
|
159
|
-
const parts = Object.fromEntries(header.split(',').map((p) => {
|
|
160
|
-
const [k, v] = p.split('=');
|
|
161
|
-
return [k.trim(), v?.trim()];
|
|
162
|
-
}));
|
|
163
|
-
if (!parts.t || !parts.v1)
|
|
164
|
-
return false;
|
|
165
|
-
const timestamp = Number(parts.t);
|
|
166
|
-
if (!Number.isFinite(timestamp))
|
|
167
|
-
return false;
|
|
168
|
-
if (Math.abs(Date.now() / 1000 - timestamp) > toleranceSeconds)
|
|
169
|
-
return false;
|
|
170
|
-
const expected = createHmac('sha256', secret)
|
|
171
|
-
.update(`${parts.t}.${rawBody}`)
|
|
172
|
-
.digest('hex');
|
|
173
|
-
const received = Buffer.from(parts.v1, 'hex');
|
|
174
|
-
if (received.length !== expected.length / 2)
|
|
175
|
-
return false;
|
|
176
|
-
return timingSafeEqual(received, Buffer.from(expected, 'hex'));
|
|
177
|
-
}
|
|
178
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAoQ1D;;;;;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