@isnap/sdk 1.3.0 → 1.4.0-next.204

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +1 -1
  3. package/dist/client.d.ts +2 -0
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +3 -0
  6. package/dist/client.js.map +1 -1
  7. package/dist/generated/openapi.d.ts +1784 -346
  8. package/dist/index.d.ts +5 -3
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +2 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/resources/apps.d.ts +11 -4
  13. package/dist/resources/apps.d.ts.map +1 -1
  14. package/dist/resources/apps.js +11 -4
  15. package/dist/resources/apps.js.map +1 -1
  16. package/dist/resources/lines.d.ts +207 -6
  17. package/dist/resources/lines.d.ts.map +1 -1
  18. package/dist/resources/lines.js +216 -6
  19. package/dist/resources/lines.js.map +1 -1
  20. package/dist/resources/macos-sessions.d.ts +48 -0
  21. package/dist/resources/macos-sessions.d.ts.map +1 -0
  22. package/dist/resources/macos-sessions.js +51 -0
  23. package/dist/resources/macos-sessions.js.map +1 -0
  24. package/dist/resources/preorders.d.ts +19 -7
  25. package/dist/resources/preorders.d.ts.map +1 -1
  26. package/dist/resources/preorders.js +19 -7
  27. package/dist/resources/preorders.js.map +1 -1
  28. package/dist/resources/webhooks.d.ts +1 -1
  29. package/dist/resources/webhooks.js +1 -1
  30. package/dist/version.d.ts +2 -2
  31. package/dist/version.d.ts.map +1 -1
  32. package/dist/version.js +13 -5
  33. package/dist/version.js.map +1 -1
  34. package/dist/webhooks/types.d.ts +46 -3
  35. package/dist/webhooks/types.d.ts.map +1 -1
  36. package/dist/webhooks/types.js +3 -0
  37. package/dist/webhooks/types.js.map +1 -1
  38. package/dist/webhooks/verify.d.ts +22 -9
  39. package/dist/webhooks/verify.d.ts.map +1 -1
  40. package/dist/webhooks/verify.js +101 -29
  41. package/dist/webhooks/verify.js.map +1 -1
  42. package/package.json +1 -1
@@ -54,10 +54,18 @@ export class LinesResource extends BaseResource {
54
54
  }
55
55
  /**
56
56
  * `POST /v1/lines/{id}/activate` — commit a reserved line to `active`.
57
- * Wholesale partners use this as the second phase of reserve→activate (no
58
- * Stripe checkout, EOM-metered) and may pick the inbound-only rental variant
59
- * via `body.inbound_only`. Direct callers get the mock-sub test/dev shortcut
60
- * and `inbound_only` is ignored.
57
+ * **Wholesale partners only**: the second phase of reserve→activate (no
58
+ * Stripe checkout, EOM-metered), which may pick the inbound-only rental
59
+ * variant via `body.inbound_only`. Direct customers get `402
60
+ * checkout_required` — their line activates when the Stripe Checkout session
61
+ * from `billing.checkout()` is paid, and their `inbound_only` comes from the
62
+ * price they paid.
63
+ *
64
+ * `body.billing_anchor_at` states the date the customer who pays for this
65
+ * line is billed on — every line that customer holds then moves together: one
66
+ * full month at each occurrence, with a credit at the first occurrence for
67
+ * the days the activation month had already paid for past it. Omit it and the
68
+ * line is billed on its activation instant.
61
69
  */
62
70
  activate(id, body = {}, opts) {
63
71
  return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/activate`, body, opts);
@@ -66,6 +74,101 @@ export class LinesResource extends BaseResource {
66
74
  release(id, opts) {
67
75
  return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/release`, undefined, opts);
68
76
  }
77
+ /**
78
+ * `POST /v1/lines/{id}/terminate` — permanently END a line you own. The
79
+ * self-serve counterpart to the admin terminate, and the verb to call when
80
+ * your own customer cancels: `release()` only returns a *reserved*
81
+ * marketplace line to the shelf, while this ends a live `rental` line or a
82
+ * virtual `shared` line for good.
83
+ *
84
+ * The line comes back at the terminal `cancelled` status, keeping its owner.
85
+ * Queued messages fail, shared-fleet bindings release, device sessions are
86
+ * revoked, and `line.disconnected` fires with `reason: "customer_initiated"`.
87
+ * Billing stops in both shapes — a per-line Stripe subscription is cancelled
88
+ * immediately, and a wholesale partner's end-of-month active-line count drops
89
+ * the line in the same breath.
90
+ *
91
+ * **Idempotent.** Terminating an already-terminated line resolves with the
92
+ * unchanged line (200), never a `ConflictError` — so a retry after a timeout
93
+ * is always safe and no `opts.idempotencyKey` is needed for it.
94
+ *
95
+ * A BYOD line is terminable like any other: its device session is revoked,
96
+ * so the bridge or phone stops serving it, and it leaves the billable set.
97
+ *
98
+ * Refusals: `PermissionDeniedError` (403 `pool_line_not_terminable`) — an
99
+ * owned test line must go through `convertFromTest()` first; `NotFoundError`
100
+ * (404) — a line that does not exist, or one you do not own (the same code for
101
+ * both, so nothing leaks).
102
+ *
103
+ * `body` defaults to `{}` (not `undefined`) so the request always carries
104
+ * `Content-Type: application/json`; the route's body is optional and the
105
+ * handler treats a missing body as `{}`.
106
+ */
107
+ terminate(id, body = {}, opts) {
108
+ return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/terminate`, body, opts);
109
+ }
110
+ /**
111
+ * `POST /v1/lines/{id}/cancel` — schedule the END of a line you own for its
112
+ * next billing anniversary, and keep using it until then.
113
+ *
114
+ * This is the verb for "my own customer cancelled". The month is already paid
115
+ * for and iSnap never prorates, so `terminate()` — which ends the line on the
116
+ * spot — throws away days you have bought. The line stays fully `active` and
117
+ * bills exactly as before; iSnap ends it itself when `cancel_at` arrives and
118
+ * fires `line.terminated` with `origin: "scheduled_cancellation"`.
119
+ *
120
+ * The resolved line carries `cancel_at`: the next occurrence of its
121
+ * `anniversary_at` strictly after now, clamped to the last day of a shorter
122
+ * month (a line taken on the 31st renews on the 28th in February and on the
123
+ * 31st again in March — the clamp never sticks).
124
+ *
125
+ * **Idempotent, and in the way that matters here.** Cancelling an
126
+ * already-cancelled line resolves with the SAME `cancel_at`, never a
127
+ * recomputed one — so a retry that happens to land after the stored date has
128
+ * passed cannot push your own cancellation a month into the future.
129
+ *
130
+ * Refusals: `ConflictError` (409 `line_has_no_anniversary`) — the line has no
131
+ * anniversary to cancel at; state it with `setAnniversary()`, or end the line
132
+ * now with `terminate()`. `ConflictError` (409
133
+ * `line_not_customer_cancellable`) — only an `active` or `suspended` line can
134
+ * be cancelled. `PermissionDeniedError` (403 `pool_line_not_cancellable`) — an
135
+ * owned test line has no per-line anniversary. Rental, shared and BYOD lines
136
+ * are all cancellable. `NotFoundError` (404) — a line that does not exist,
137
+ * or one you do not own (the same code for both, so nothing leaks).
138
+ */
139
+ cancel(id, opts) {
140
+ return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/cancel`, undefined, opts);
141
+ }
142
+ /**
143
+ * `POST /v1/lines/{id}/uncancel` — undo a scheduled cancellation. `cancel_at`
144
+ * goes back to `null` and the line resumes renewing at its anniversary.
145
+ *
146
+ * **A no-op on a line that is not cancelled**: resolves 200 with the line and
147
+ * `cancel_at: null`, never an error — so a reconciliation loop that asserts
148
+ * "this line must not be cancelled" can run unconditionally.
149
+ *
150
+ * Refusal: `ConflictError` (409 `line_already_terminated`) once the
151
+ * anniversary has passed and iSnap has ended the line. That cannot be undone.
152
+ */
153
+ uncancel(id, opts) {
154
+ return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/uncancel`, undefined, opts);
155
+ }
156
+ /**
157
+ * `POST /v1/lines/{id}/anniversary` — state the instant you took this line,
158
+ * which becomes the day of the month it renews on and the date `cancel()`
159
+ * waits for.
160
+ *
161
+ * **For lines migrated from your own system**, whose real start date iSnap
162
+ * cannot know. A line taken through the iSnap API is stamped automatically at
163
+ * activation and needs no call.
164
+ *
165
+ * Refusal: `ConflictError` (409 `line_cancellation_pending`) while a
166
+ * cancellation is scheduled — that `cancel_at` was computed from the
167
+ * anniversary you are replacing, so uncancel, set the date, and cancel again.
168
+ */
169
+ setAnniversary(id, body, opts) {
170
+ return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/anniversary`, body, opts);
171
+ }
69
172
  /**
70
173
  * `POST /v1/lines/{id}/transfer-ownership` — reassign a line to a
71
174
  * different end-user account without re-pairing the underlying device.
@@ -92,8 +195,115 @@ export class LinesResource extends BaseResource {
92
195
  return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/convert-from-test`, undefined, opts);
93
196
  }
94
197
  /**
95
- * `PATCH /v1/lines/{id}` — merge-patch the line's free-form metadata
96
- * object. Null-valued keys delete those keys from the stored object.
198
+ * `POST /v1/lines/{id}/variant` — move a rental line you own between the
199
+ * INBOUND product (`inbound_only: true`) and the TWO-WAY product, **keeping
200
+ * the same phone number**, the same hardware and the same device session.
201
+ *
202
+ * `inbound_only` is not "receive-only": the line converses normally, it
203
+ * simply cannot OPEN a conversation. It may message only a handle that has
204
+ * messaged it first, and once that handle has, the exchange is unrestricted
205
+ * in both directions for good. A send that breaks the rule is a
206
+ * `PermissionDeniedError` (403 `outbound_first_forbidden`).
207
+ *
208
+ * **Idempotent on the value.** Asking for the variant the line already has
209
+ * resolves with the line and writes nothing — no audit row, no
210
+ * `line.variant_changed` event — so a retry after a timeout is safe and is
211
+ * not a second change. It is not a toggle: state the value you want.
212
+ *
213
+ * `body.effective` says WHEN, and defaults to `'now'` — the only behaviour
214
+ * before the field existed, so an existing call is unchanged.
215
+ *
216
+ * - `'now'`: as above. Use it for an UPGRADE, which the customer has just
217
+ * paid for and which must apply to the very next send.
218
+ * - `'next_anchor'`: store the change against the line's next billing
219
+ * anchor. Nothing moves today — `inbound_only` keeps its current value and
220
+ * the line keeps serving the product it is being billed for — and the
221
+ * resolved line carries `pending_variant: { inbound_only, effective_at }`.
222
+ * Use it for a DOWNGRADE, so the customer keeps the two-way product
223
+ * through the month they have already bought. iSnap applies it at the
224
+ * anchor and fires `line.variant_changed` with `data.scheduled: true`;
225
+ * cancel it beforehand with {@link LinesResource.cancelVariantChange}.
226
+ *
227
+ * `body.not_before` (ISO instant, `'next_anchor'` only, defaults to now) is
228
+ * the earliest instant the change may take effect. iSnap resolves it to the
229
+ * FIRST anchor occurrence at or after it, applying the anchor's own
230
+ * day-of-month clamp — so state your customer's paid-period end and let
231
+ * iSnap pick the occurrence rather than computing one yourself. A monthly
232
+ * customer needs nothing here; a QUARTERLY or ANNUAL customer does, because
233
+ * without it the change would land on the next anchor and take back
234
+ * capability they have already paid for. The resolved instant comes back as
235
+ * `pending_variant.effective_at`. An instant in the past is a
236
+ * `BadRequestError` (400 `not_before_in_the_past`) — it is refused rather
237
+ * than clamped, because for a long-period customer the silent repair and the
238
+ * correct answer differ by months of the product they bought.
239
+ *
240
+ * Scheduling is idempotent on the PENDING value the same way an immediate
241
+ * change is on the live one: re-scheduling the change already pending
242
+ * resolves with the line and the date it was already given, and writes
243
+ * nothing. A DIFFERENT pending change is a `ConflictError` (409
244
+ * `variant_change_already_pending`) — cancel it first, because there is no
245
+ * honest way to merge two answers to "what is this line at the anchor".
246
+ *
247
+ * **A scheduled call can legitimately resolve with `pending_variant: null`,
248
+ * and that is not a failure.** Scheduling the variant the line ALREADY
249
+ * carries writes nothing, because nothing is pending — the line will still
250
+ * be on that variant at the anchor. Do not retry it. Tell it apart from a
251
+ * silently-dropped `effective` (see the deploy-order warning below) by
252
+ * reading the top-level `inbound_only`: equal to what you asked for means
253
+ * already-at-target; different means the field never reached the server and
254
+ * the change was applied immediately.
255
+ *
256
+ * ⚠️ **Adopt `effective` and `not_before` only against a deployment that has
257
+ * them.** iSnap STRIPS unknown request properties rather than rejecting
258
+ * them, so an early call gets no 400 — it gets the field dropped and an
259
+ * ordinary immediate flip, applying a downgrade on the spot. Check
260
+ * `client.version()` before sending either field.
261
+ *
262
+ * An immediate change does NOT cancel a scheduled one: they are separate
263
+ * acts, and a partner who needs an urgent upgrade must not have their
264
+ * standing downgrade withdrawn by it. Use `cancelVariantChange` for that.
265
+ *
266
+ * Refusals: `ConflictError` (409) — `not_a_rental_line` (byod / pool /
267
+ * shared have no variant), `line_not_active` (the line must be in service),
268
+ * `variant_bound_to_stripe_price` (the line carries an iSnap Stripe
269
+ * subscription, whose price IS its variant; change the subscription
270
+ * instead). A line the caller does not own is a masked `NotFoundError`
271
+ * (404), like every other per-line verb.
272
+ */
273
+ setVariant(id, body, opts) {
274
+ return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/variant`, body, opts);
275
+ }
276
+ /**
277
+ * `DELETE /v1/lines/{id}/variant` — call off the variant change scheduled
278
+ * for this line's next billing anchor.
279
+ *
280
+ * The line's live `inbound_only` is never touched: the scheduling did not
281
+ * move it either, so the only effect is that `pending_variant` becomes
282
+ * `null` and nothing happens at the anchor.
283
+ *
284
+ * A line with no pending change is a `NotFoundError` (404
285
+ * `no_pending_variant_change`), which includes a change the anchor has
286
+ * already applied — there is nothing left to cancel, and the line's own
287
+ * `inbound_only` now carries the answer. A change applied while this request
288
+ * was in flight is a `ConflictError` (409 `variant_change_already_applied`),
289
+ * so the two outcomes are distinguishable from the code alone.
290
+ *
291
+ * Succeeds on a suspended or cancelled line: withdrawing an instruction must
292
+ * never be blocked by the state that made it moot.
293
+ */
294
+ cancelVariantChange(id, opts) {
295
+ return this.client.request('DELETE', `/v1/lines/${encodeURIComponent(id)}/variant`, undefined, opts);
296
+ }
297
+ /**
298
+ * `PATCH /v1/lines/{id}` — update the line's free-form metadata object, its
299
+ * billing anchor, or both.
300
+ *
301
+ * `metadata` is a MERGE: null-valued keys delete those keys from the stored
302
+ * object. `billing_anchor_at` is the date the customer who pays for this line
303
+ * is billed on — a change takes effect at the NEXT occurrence and never
304
+ * rewrites a period already billed, and `null` clears it so the line falls
305
+ * back to its activation instant. Send at least one of the two; a body that
306
+ * states neither is refused with `no_fields_to_patch`.
97
307
  */
98
308
  patch(id, body, opts) {
99
309
  return this.client.request('PATCH', `/v1/lines/${encodeURIComponent(id)}`, body, opts);
@@ -1 +1 @@
1
- {"version":3,"file":"lines.js","sourceRoot":"","sources":["../../src/resources/lines.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAqBxC,MAAM,OAAO,aAAc,SAAQ,YAAY;IAC7C;;;;;OAKG;IACH,IAAI,CAAC,QAAwB,EAAE,EAAE,IAAqB;QACpD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAA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,CAAC,EAAU,EAAE,IAAqB;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,aAAa,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAC3C,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;IAED,qFAAqF;IACrF,KAAK,CACH,EAAU,EACV,QAAwB,EAAE,EAC1B,IAAqB;QAErB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,aAAa,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAC3C,SAAS,EACT,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,CACjD,CAAA;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAU,EAAE,IAAqB;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,aAAa,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAC5C,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;IAED,6FAA6F;IAC7F,SAAS,CAAC,EAAU,EAAE,IAAqB;QACzC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,aAAa,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAC5C,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;IAED;;;;OAIG;IACH,YAAY,CACV,EAAU,EACV,IAAqB,EACrB,IAAqB;QAErB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,OAAO,EACP,aAAa,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAC5C,IAAI,EACJ,IAAI,CACL,CAAA;IACH,CAAC;CACF"}
@@ -0,0 +1,48 @@
1
+ import type { components } from '../generated/openapi.js';
2
+ import type { RequestOptions } from '../types.js';
3
+ import { BaseResource } from './base.js';
4
+ export type MacosSession = components['schemas']['MacosSession'];
5
+ /**
6
+ * Hosted macOS sessions rented on a wholesale partner's account (contract §2.16).
7
+ *
8
+ * A session is a macOS environment the partner runs their own iPhone's bridge
9
+ * against, with their OWN Apple ID signed into it. It is NOT a line: it carries
10
+ * no number and originates no messages, so nothing here has a direction, a
11
+ * platform or a capability.
12
+ *
13
+ * Direct customers do not use this resource — they buy sessions through
14
+ * `POST /v1/billing/mac-checkout` and every method here answers `403
15
+ * not_a_wholesale_partner` for them.
16
+ */
17
+ export declare class MacosSessionsResource extends BaseResource {
18
+ /**
19
+ * `POST /v1/macos-sessions/rent` — take one session out of iSnap stock.
20
+ *
21
+ * The tenancy starts immediately and `anniversary_at` is the day it was taken:
22
+ * that day of the month is what the session bills on, clamped to the last day
23
+ * of shorter months. Throws `ConflictError` (`409 no_macos_session_in_stock`)
24
+ * when no session is free — iSnap provisions one and attaches it, so the call
25
+ * does not need to be retried on a schedule.
26
+ *
27
+ * One call rents one session; rent three by calling three times.
28
+ */
29
+ rent(opts?: RequestOptions): Promise<MacosSession>;
30
+ /**
31
+ * `POST /v1/macos-sessions/{id}/cancel` — end the tenancy at its next anniversary.
32
+ *
33
+ * The session stays usable and keeps billing until `cancel_at`, the next
34
+ * occurrence of `anniversary_at` strictly after the call. Idempotent: a second
35
+ * call returns the `cancel_at` the first one set rather than pushing it a
36
+ * month further out.
37
+ */
38
+ cancel(id: string, opts?: RequestOptions): Promise<MacosSession>;
39
+ /**
40
+ * `POST /v1/macos-sessions/{id}/uncancel` — withdraw a pending cancellation.
41
+ *
42
+ * Clears `cancel_at` and leaves `anniversary_at` untouched, so the billing day
43
+ * does not move. Idempotent on a session that is not cancelled, and `404` once
44
+ * the release has already returned the session to stock.
45
+ */
46
+ uncancel(id: string, opts?: RequestOptions): Promise<MacosSession>;
47
+ }
48
+ //# sourceMappingURL=macos-sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"macos-sessions.d.ts","sourceRoot":"","sources":["../../src/resources/macos-sessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAA;AAEhE;;;;;;;;;;;GAWG;AACH,qBAAa,qBAAsB,SAAQ,YAAY;IACrD;;;;;;;;;;OAUG;IACH,IAAI,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAIlD;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAShE;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;CAQnE"}
@@ -0,0 +1,51 @@
1
+ import { BaseResource } from './base.js';
2
+ /**
3
+ * Hosted macOS sessions rented on a wholesale partner's account (contract §2.16).
4
+ *
5
+ * A session is a macOS environment the partner runs their own iPhone's bridge
6
+ * against, with their OWN Apple ID signed into it. It is NOT a line: it carries
7
+ * no number and originates no messages, so nothing here has a direction, a
8
+ * platform or a capability.
9
+ *
10
+ * Direct customers do not use this resource — they buy sessions through
11
+ * `POST /v1/billing/mac-checkout` and every method here answers `403
12
+ * not_a_wholesale_partner` for them.
13
+ */
14
+ export class MacosSessionsResource extends BaseResource {
15
+ /**
16
+ * `POST /v1/macos-sessions/rent` — take one session out of iSnap stock.
17
+ *
18
+ * The tenancy starts immediately and `anniversary_at` is the day it was taken:
19
+ * that day of the month is what the session bills on, clamped to the last day
20
+ * of shorter months. Throws `ConflictError` (`409 no_macos_session_in_stock`)
21
+ * when no session is free — iSnap provisions one and attaches it, so the call
22
+ * does not need to be retried on a schedule.
23
+ *
24
+ * One call rents one session; rent three by calling three times.
25
+ */
26
+ rent(opts) {
27
+ return this.client.request('POST', '/v1/macos-sessions/rent', undefined, opts);
28
+ }
29
+ /**
30
+ * `POST /v1/macos-sessions/{id}/cancel` — end the tenancy at its next anniversary.
31
+ *
32
+ * The session stays usable and keeps billing until `cancel_at`, the next
33
+ * occurrence of `anniversary_at` strictly after the call. Idempotent: a second
34
+ * call returns the `cancel_at` the first one set rather than pushing it a
35
+ * month further out.
36
+ */
37
+ cancel(id, opts) {
38
+ return this.client.request('POST', `/v1/macos-sessions/${encodeURIComponent(id)}/cancel`, undefined, opts);
39
+ }
40
+ /**
41
+ * `POST /v1/macos-sessions/{id}/uncancel` — withdraw a pending cancellation.
42
+ *
43
+ * Clears `cancel_at` and leaves `anniversary_at` untouched, so the billing day
44
+ * does not move. Idempotent on a session that is not cancelled, and `404` once
45
+ * the release has already returned the session to stock.
46
+ */
47
+ uncancel(id, opts) {
48
+ return this.client.request('POST', `/v1/macos-sessions/${encodeURIComponent(id)}/uncancel`, undefined, opts);
49
+ }
50
+ }
51
+ //# sourceMappingURL=macos-sessions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"macos-sessions.js","sourceRoot":"","sources":["../../src/resources/macos-sessions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAIxC;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,qBAAsB,SAAQ,YAAY;IACrD;;;;;;;;;;OAUG;IACH,IAAI,CAAC,IAAqB;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAe,MAAM,EAAE,yBAAyB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;IAC9F,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,EAAU,EAAE,IAAqB;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,MAAM,EACN,sBAAsB,kBAAkB,CAAC,EAAE,CAAC,SAAS,EACrD,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,EAAU,EAAE,IAAqB;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,MAAM,EACN,sBAAsB,kBAAkB,CAAC,EAAE,CAAC,WAAW,EACvD,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;CACF"}
@@ -10,19 +10,31 @@ export declare class PreOrdersResource extends BaseResource {
10
10
  /**
11
11
  * `POST /v1/pre-orders` — place a pre-order for a rental tier with no
12
12
  * in-stock inventory. Set `inbound_only: true` to request the inbound-only
13
- * rental variant. Returns a `provisioning` pre-order; ops procures the
14
- * hardware and the partner is notified via the `pre_order.fulfilled` webhook
15
- * when a matching line is ready. Direct customers get a Stripe
16
- * `stripe_client_secret` to confirm the first-month charge; wholesale
17
- * partners are billed EOM (no per-line Stripe sub).
13
+ * rental variant. `billing_tier` is optional and ORTHOGONAL to that plan —
14
+ * omitting it means `rental_iphone`, the only tier this flow mints, and
15
+ * `rental_iphone` covers BOTH rental products (`inbound_only` is what picks
16
+ * between them), so naming both is never a contradiction. When named it is
17
+ * answered rather than discarded (WHA-2949): `rental_android` is a
18
+ * `400 android_rental_not_purchasable` — no Android product exists in the
19
+ * Stripe catalogue — and a BYOD / virtual-shared / pool tier is a
20
+ * `400 tier_not_pre_orderable` whose message names the endpoint that
21
+ * acquires it instead. Returns a `draft` pre-order and NOTHING else: no
22
+ * line, no fulfillment task, no ops notification, no Stripe charge, and
23
+ * `stripe_client_secret` is always `null`. A draft costs nothing to place
24
+ * and binds nobody — call `confirm()` to engage the month and start
25
+ * procurement.
18
26
  */
19
27
  create(body: CreatePreOrderBody, opts?: RequestOptions): Promise<PreOrder>;
20
28
  /**
21
29
  * `POST /v1/pre-orders/{id}/confirm` — confirm a `draft` pre-order. The
22
30
  * binding step: engages the one-month commitment (full month, no proration)
23
31
  * and triggers procurement (mints the provisioning line + fulfillment task,
24
- * notifies ops, and for direct customers returns the first-month
25
- * `stripe_client_secret`). Only a draft can be confirmed.
32
+ * notifies ops). Returns the pre-order in `provisioning`; ops procures the
33
+ * hardware and the partner is notified via the `pre_order.fulfilled` webhook
34
+ * when a matching line is ready. Direct customers get a Stripe
35
+ * `stripe_client_secret` to confirm the first-month charge; wholesale
36
+ * partners are billed EOM (no per-line Stripe sub). Only a draft can be
37
+ * confirmed.
26
38
  */
27
39
  confirm(id: string, opts?: RequestOptions): Promise<PreOrder>;
28
40
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"preorders.d.ts","sourceRoot":"","sources":["../../src/resources/preorders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAA;AACxD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAAA;AAIpE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;AAE5E,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAC1C,KAAK,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAC/C,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAChC,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;AAEnG,qBAAa,iBAAkB,SAAQ,YAAY;IACjD;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,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,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;AAEnG,qBAAa,iBAAkB,SAAQ,YAAY;IACjD;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI1E;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAS7D;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,KAAK,GAAE,kBAAuB,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAOtF,kEAAkE;IAClE,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IASzD;;;;OAIG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;CAQ7D"}
@@ -3,11 +3,19 @@ export class PreOrdersResource extends BaseResource {
3
3
  /**
4
4
  * `POST /v1/pre-orders` — place a pre-order for a rental tier with no
5
5
  * in-stock inventory. Set `inbound_only: true` to request the inbound-only
6
- * rental variant. Returns a `provisioning` pre-order; ops procures the
7
- * hardware and the partner is notified via the `pre_order.fulfilled` webhook
8
- * when a matching line is ready. Direct customers get a Stripe
9
- * `stripe_client_secret` to confirm the first-month charge; wholesale
10
- * partners are billed EOM (no per-line Stripe sub).
6
+ * rental variant. `billing_tier` is optional and ORTHOGONAL to that plan —
7
+ * omitting it means `rental_iphone`, the only tier this flow mints, and
8
+ * `rental_iphone` covers BOTH rental products (`inbound_only` is what picks
9
+ * between them), so naming both is never a contradiction. When named it is
10
+ * answered rather than discarded (WHA-2949): `rental_android` is a
11
+ * `400 android_rental_not_purchasable` — no Android product exists in the
12
+ * Stripe catalogue — and a BYOD / virtual-shared / pool tier is a
13
+ * `400 tier_not_pre_orderable` whose message names the endpoint that
14
+ * acquires it instead. Returns a `draft` pre-order and NOTHING else: no
15
+ * line, no fulfillment task, no ops notification, no Stripe charge, and
16
+ * `stripe_client_secret` is always `null`. A draft costs nothing to place
17
+ * and binds nobody — call `confirm()` to engage the month and start
18
+ * procurement.
11
19
  */
12
20
  create(body, opts) {
13
21
  return this.client.request('POST', '/v1/pre-orders', body, opts);
@@ -16,8 +24,12 @@ export class PreOrdersResource extends BaseResource {
16
24
  * `POST /v1/pre-orders/{id}/confirm` — confirm a `draft` pre-order. The
17
25
  * binding step: engages the one-month commitment (full month, no proration)
18
26
  * and triggers procurement (mints the provisioning line + fulfillment task,
19
- * notifies ops, and for direct customers returns the first-month
20
- * `stripe_client_secret`). Only a draft can be confirmed.
27
+ * notifies ops). Returns the pre-order in `provisioning`; ops procures the
28
+ * hardware and the partner is notified via the `pre_order.fulfilled` webhook
29
+ * when a matching line is ready. Direct customers get a Stripe
30
+ * `stripe_client_secret` to confirm the first-month charge; wholesale
31
+ * partners are billed EOM (no per-line Stripe sub). Only a draft can be
32
+ * confirmed.
21
33
  */
22
34
  confirm(id, opts) {
23
35
  return this.client.request('POST', `/v1/pre-orders/${encodeURIComponent(id)}/confirm`, undefined, opts);
@@ -1 +1 @@
1
- {"version":3,"file":"preorders.js","sourceRoot":"","sources":["../../src/resources/preorders.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAcxC,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACjD;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAwB,EAAE,IAAqB;QACpD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAW,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IAC5E,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,EAAU,EAAE,IAAqB;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,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,MAAM,EACN,kBAAkB,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAClD,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;IAED;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,QAA4B,EAAE,EAAE,IAAqB;QACxD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAmB,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE;YAC/E,GAAG,IAAI;YACP,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE;SACpC,CAAC,CAAA;IACJ,CAAC;IAED,kEAAkE;IAClE,GAAG,CAAC,EAAU,EAAE,IAAqB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,kBAAkB,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAC1C,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,EAAU,EAAE,IAAqB;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,MAAM,EACN,kBAAkB,kBAAkB,CAAC,EAAE,CAAC,SAAS,EACjD,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;CACF"}
@@ -27,7 +27,7 @@ export declare class WebhooksResource extends BaseResource {
27
27
  /** `DELETE /v1/webhooks/{id}` — delete a subscription. Returns 204. */
28
28
  delete(id: string, opts?: RequestOptions): Promise<void>;
29
29
  /**
30
- * `POST /v1/webhooks/{id}/rotate-secret` — mint a new `whs_*` secret.
30
+ * `POST /v1/webhooks/{id}/rotate-secret` — mint a new `whsec_*` secret.
31
31
  * Old secret stays valid for 5 minutes (`old_secret_expires_at`) so the
32
32
  * caller can roll their verification code without dropping events.
33
33
  * Plaintext secret is returned ONCE.
@@ -26,7 +26,7 @@ export class WebhooksResource extends BaseResource {
26
26
  return this.client.request('DELETE', `/v1/webhooks/${encodeURIComponent(id)}`, undefined, opts);
27
27
  }
28
28
  /**
29
- * `POST /v1/webhooks/{id}/rotate-secret` — mint a new `whs_*` secret.
29
+ * `POST /v1/webhooks/{id}/rotate-secret` — mint a new `whsec_*` secret.
30
30
  * Old secret stays valid for 5 minutes (`old_secret_expires_at`) so the
31
31
  * caller can roll their verification code without dropping events.
32
32
  * Plaintext secret is returned ONCE.
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export declare const SDK_VERSION = "1.3.0";
2
- export declare const MIN_API_VERSION = "1.0.0";
1
+ export declare const SDK_VERSION = "1.4.0";
2
+ export declare const MIN_API_VERSION = "2.0.0";
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW,UAAU,CAAA;AAiBlC,eAAO,MAAM,eAAe,UAAU,CAAA"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW,UAAU,CAAA;AAyBlC,eAAO,MAAM,eAAe,UAAU,CAAA"}
package/dist/version.js CHANGED
@@ -4,7 +4,7 @@
4
4
  // contract surface. Hand-maintained: no build or publish step derives this
5
5
  // from `package.json`, so it MUST be bumped in the same commit as the
6
6
  // `version` field there. `src/version.test.ts` fails CI when they disagree.
7
- export const SDK_VERSION = '1.3.0';
7
+ export const SDK_VERSION = '1.4.0';
8
8
  // Minimum API version the SDK considers compatible. Reference-only
9
9
  // today: the client exposes `client.version()` to read `/v1/version` on
10
10
  // demand, but does NOT call it automatically at first request as a
@@ -17,8 +17,16 @@ export const SDK_VERSION = '1.3.0';
17
17
  // Bump this when the SDK starts using a feature that requires a specific
18
18
  // backend version (e.g. a new endpoint added in API minor X.Y.0 — the
19
19
  // SDK that wraps it sets MIN_API_VERSION to X.Y.0). Within a major
20
- // version (1.x), the API stays additive (oasdiff
21
- // `--deprecation-days-stable 30` enforced in CI), so a 1.0.0 SDK keeps
22
- // working against any 1.x backend without raising the floor.
23
- export const MIN_API_VERSION = '1.0.0';
20
+ // version, the API stays additive (oasdiff `--deprecation-days-stable 30`
21
+ // enforced in CI), so an SDK keeps working against any backend of the same
22
+ // major without raising the floor.
23
+ //
24
+ // WHA-2644 — raised from `1.0.0` to `2.0.0`. The premise the old value rested
25
+ // on ("within 1.x the API stays additive") is precisely what the pre-order
26
+ // strip broke: `PreOrder` lost `amount`, `billing_tier` and
27
+ // `stripe_payment_intent_id`, so the generated types in this package no longer
28
+ // describe ANY 1.x backend. Leaving the floor at `1.0.0` would have been the
29
+ // same class of defect the change removes — a field that says something the
30
+ // code does not do.
31
+ export const MIN_API_VERSION = '2.0.0';
24
32
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,yEAAyE;AACzE,wEAAwE;AACxE,2EAA2E;AAC3E,sEAAsE;AACtE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAA;AAElC,mEAAmE;AACnE,wEAAwE;AACxE,mEAAmE;AACnE,wEAAwE;AACxE,2EAA2E;AAC3E,gEAAgE;AAChE,uEAAuE;AACvE,oBAAoB;AACpB,EAAE;AACF,yEAAyE;AACzE,sEAAsE;AACtE,mEAAmE;AACnE,iDAAiD;AACjD,uEAAuE;AACvE,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAA"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,yEAAyE;AACzE,wEAAwE;AACxE,2EAA2E;AAC3E,sEAAsE;AACtE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAA;AAElC,mEAAmE;AACnE,wEAAwE;AACxE,mEAAmE;AACnE,wEAAwE;AACxE,2EAA2E;AAC3E,gEAAgE;AAChE,uEAAuE;AACvE,oBAAoB;AACpB,EAAE;AACF,yEAAyE;AACzE,sEAAsE;AACtE,mEAAmE;AACnE,0EAA0E;AAC1E,2EAA2E;AAC3E,mCAAmC;AACnC,EAAE;AACF,8EAA8E;AAC9E,2EAA2E;AAC3E,4DAA4D;AAC5D,+EAA+E;AAC/E,6EAA6E;AAC7E,4EAA4E;AAC5E,oBAAoB;AACpB,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAA"}
@@ -27,6 +27,18 @@ type ReactionEventDataBase = {
27
27
  reaction_id: string;
28
28
  reaction_type: ReactionType;
29
29
  reaction_emoji: string | null;
30
+ /**
31
+ * The `line_<base62>` publicId of the line the tapback happened on, and the
32
+ * routing key a consumer should prefer (WHA-3183). It is the line of the
33
+ * PARENT message — for a shared-plan parent the customer's virtual line, never
34
+ * the physical pool carrier the reporting session runs on.
35
+ *
36
+ * REQUIRED, not optional: both producers resolve it before they enqueue, and a
37
+ * consumer that has not persisted the parent has no other handle on the
38
+ * delivery. Declaring it optional would let that consumer compile against a
39
+ * payload it cannot route.
40
+ */
41
+ line_id: string;
30
42
  removed_at?: string;
31
43
  };
32
44
  /**
@@ -65,7 +77,7 @@ export interface ReactionEvent extends WebhookEventBase {
65
77
  event_type: `reaction.${string}`;
66
78
  data: ReactionEventData;
67
79
  }
68
- export type LineEventType = 'line.connected' | 'line.disconnected' | 'line.offline' | 'line.degraded' | 'line.apple_id_flagged' | 'line.quota_warning' | 'line.quota_exceeded' | 'line.capability_changed';
80
+ export type LineEventType = 'line.connected' | 'line.disconnected' | 'line.offline' | 'line.degraded' | 'line.apple_id_flagged' | 'line.quota_warning' | 'line.quota_exceeded' | 'line.capability_changed' | 'line.terminated' | 'line.variant_changed' | 'line.variant_scheduled' | 'line.variant_unscheduled';
69
81
  /**
70
82
  * `data` is intentionally typed as `Record<string, unknown>` until the
71
83
  * contract pins per-event-type field shapes. Today's payloads vary by
@@ -95,7 +107,7 @@ export interface TrialEvent extends WebhookEventBase {
95
107
  event_type: `trial.${string}`;
96
108
  data: Record<string, unknown>;
97
109
  }
98
- export type PreOrderEventType = 'pre_order.fulfilled' | 'pre_order.cancelled' | 'pre_order.refunded';
110
+ export type PreOrderEventType = 'pre_order.fulfilled' | 'pre_order.cancelled';
99
111
  /**
100
112
  * Pre-order lifecycle events fired when ops procures hardware against a
101
113
  * customer pre-order. `pre_order.fulfilled` carries the freshly-activated
@@ -127,6 +139,36 @@ export interface BindingEvent extends WebhookEventBase {
127
139
  event_type: `binding.${string}`;
128
140
  data: Record<string, unknown>;
129
141
  }
142
+ export type MacosSessionEventType = 'macos_session.rented' | 'macos_session.released';
143
+ /**
144
+ * Rented hosted macOS session lifecycle (contract §4.3.8). Fires on the
145
+ * PARTNER, never on a line, and only for the two changes the partner did
146
+ * NOT just cause — `rent`, `cancel` and `uncancel` are synchronous verbs
147
+ * whose own response already told the caller what happened.
148
+ *
149
+ * `macos_session.rented` is iSnap attaching a session OUT OF BAND: the
150
+ * fulfilment of a `rent` refused for want of stock, or the migration of a
151
+ * tenancy that predates the surface. `data` carries
152
+ * `{ macos_session_id, anniversary_at, rented_at }`.
153
+ *
154
+ * `macos_session.released` is the seat going back to stock. `data` carries
155
+ * `{ macos_session_id, anniversary_at (nullable), cancel_at (nullable),
156
+ * released_at, reason: 'cancelled' | 'detached_by_admin' }` — `reason`
157
+ * separating the cancellation coming due from an operator handing the
158
+ * session back.
159
+ *
160
+ * Routed by ACCOUNT, not by line: a rented session has no line by
161
+ * construction, so there is no `line_id` on this payload.
162
+ *
163
+ * Left as `Record<string, unknown>` for the same reason as `LineEvent`:
164
+ * `event_type` is the template literal `macos_session.${string}` so the
165
+ * guard keeps prefix-matching, and a concrete `data` shape here would
166
+ * mistype any future `macos_session.*` event.
167
+ */
168
+ export interface MacosSessionEvent extends WebhookEventBase {
169
+ event_type: `macos_session.${string}`;
170
+ data: Record<string, unknown>;
171
+ }
130
172
  /**
131
173
  * Administrative synthetic probe — the suspended-state health check that
132
174
  * decides whether a disabled subscription can be resumed. Not a partner
@@ -159,7 +201,7 @@ export interface AdminEvent extends WebhookEventBase {
159
201
  * }
160
202
  * ```
161
203
  */
162
- export type WebhookEvent = MessageEvent | ReactionEvent | LineEvent | TypingIndicatorEvent | TrialEvent | PreOrderEvent | BindingEvent | AdminEvent | WebhookEventBase;
204
+ export type WebhookEvent = MessageEvent | ReactionEvent | LineEvent | TypingIndicatorEvent | TrialEvent | PreOrderEvent | BindingEvent | MacosSessionEvent | AdminEvent | WebhookEventBase;
163
205
  export declare function isMessageEvent(event: WebhookEventBase): event is MessageEvent;
164
206
  export declare function isReactionEvent(event: WebhookEventBase): event is ReactionEvent;
165
207
  export declare function isLineEvent(event: WebhookEventBase): event is LineEvent;
@@ -167,6 +209,7 @@ export declare function isTypingIndicatorEvent(event: WebhookEventBase): event i
167
209
  export declare function isTrialEvent(event: WebhookEventBase): event is TrialEvent;
168
210
  export declare function isPreOrderEvent(event: WebhookEventBase): event is PreOrderEvent;
169
211
  export declare function isBindingEvent(event: WebhookEventBase): event is BindingEvent;
212
+ export declare function isMacosSessionEvent(event: WebhookEventBase): event is MacosSessionEvent;
170
213
  export declare function isAdminEvent(event: WebhookEventBase): event is AdminEvent;
171
214
  export {};
172
215
  //# sourceMappingURL=types.d.ts.map