@isnap/sdk 1.3.0 → 1.4.0-next.203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -0
- package/dist/client.js.map +1 -1
- package/dist/generated/openapi.d.ts +1784 -346
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/resources/apps.d.ts +11 -4
- package/dist/resources/apps.d.ts.map +1 -1
- package/dist/resources/apps.js +11 -4
- package/dist/resources/apps.js.map +1 -1
- package/dist/resources/lines.d.ts +206 -6
- package/dist/resources/lines.d.ts.map +1 -1
- package/dist/resources/lines.js +215 -6
- package/dist/resources/lines.js.map +1 -1
- package/dist/resources/macos-sessions.d.ts +48 -0
- package/dist/resources/macos-sessions.d.ts.map +1 -0
- package/dist/resources/macos-sessions.js +51 -0
- package/dist/resources/macos-sessions.js.map +1 -0
- package/dist/resources/preorders.d.ts +19 -7
- package/dist/resources/preorders.d.ts.map +1 -1
- package/dist/resources/preorders.js +19 -7
- package/dist/resources/preorders.js.map +1 -1
- package/dist/resources/webhooks.d.ts +1 -1
- package/dist/resources/webhooks.js +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +13 -5
- package/dist/version.js.map +1 -1
- package/dist/webhooks/types.d.ts +46 -3
- package/dist/webhooks/types.d.ts.map +1 -1
- package/dist/webhooks/types.js +3 -0
- package/dist/webhooks/types.js.map +1 -1
- package/dist/webhooks/verify.d.ts +22 -9
- package/dist/webhooks/verify.d.ts.map +1 -1
- package/dist/webhooks/verify.js +101 -29
- package/dist/webhooks/verify.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lines.js","sourceRoot":"","sources":["../../src/res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AA;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.
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
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
|
|
25
|
-
*
|
|
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
|
|
1
|
+
{"version":3,"file":"preorders.d.ts","sourceRoot":"","sources":["../../src/resources/preorders.ts"],"names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,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.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
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
|
|
20
|
-
*
|
|
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
|
|
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;;;;;;;;;;;;;;;;OAgBG;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;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAU,EAAE,IAAqB;QACvC,OAAO,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 `
|
|
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 `
|
|
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.
|
|
2
|
-
export declare const MIN_API_VERSION = "
|
|
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
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW,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.
|
|
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
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
|
|
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
|
package/dist/version.js.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/webhooks/types.d.ts
CHANGED
|
@@ -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'
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/webhooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAErE;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B;AA0BD,MAAM,MAAM,gBAAgB,GACxB,gBAAgB,GAChB,mBAAmB,GACnB,cAAc,GACd,mBAAmB,GACnB,gBAAgB,GAChB,kBAAkB,GAClB,cAAc,GACd,mBAAmB,GAMnB,4BAA4B,CAAA;AAEhC,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,UAAU,EAAE,WAAW,MAAM,EAAE,CAAA;IAC/B,IAAI,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAA;CAC3B;AAID,MAAM,MAAM,iBAAiB,GACzB,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,CAAA;AAEtB,wEAAwE;AACxE,KAAK,qBAAqB,GAAG;IAC3B,iBAAiB,EAAE,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,YAAY,CAAA;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAA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21
|
return event.event_type.startsWith('binding.');
|
|
22
22
|
}
|
|
23
|
+
export function isMacosSessionEvent(event) {
|
|
24
|
+
return event.event_type.startsWith('macos_session.');
|
|
25
|
+
}
|
|
23
26
|
export function isAdminEvent(event) {
|
|
24
27
|
return event.event_type.startsWith('webhook.');
|
|
25
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/webhooks/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/webhooks/types.ts"],"names":[],"mappings":"AAyWA,6EAA6E;AAE7E,MAAM,UAAU,cAAc,CAAC,KAAuB;IACpD,OAAO,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;AAChD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAuB;IACrD,OAAO,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;AACjD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,OAAO,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;AAC7C,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,KAAuB;IAEvB,OAAO,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAA;AACzD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAuB;IAClD,OAAO,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;AAC9C,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAuB;IACrD,OAAO,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,YAAY,CAAC,CAAA;AAClD,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAuB;IACpD,OAAO,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;AAChD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAuB;IACzD,OAAO,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAA;AACtD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAuB;IAClD,OAAO,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;AAChD,CAAC"}
|
|
@@ -13,12 +13,23 @@ export interface VerifyWebhookOptions {
|
|
|
13
13
|
*/
|
|
14
14
|
now?: () => number;
|
|
15
15
|
}
|
|
16
|
+
type WebhookHeaders = Record<string, string | string[] | undefined> | Headers;
|
|
16
17
|
/**
|
|
17
|
-
* Verify an incoming webhook delivery
|
|
18
|
+
* Verify an incoming webhook delivery. Every iSnap delivery carries two
|
|
19
|
+
* signatures over the same body, and this checks one of them:
|
|
18
20
|
*
|
|
19
|
-
* -
|
|
20
|
-
* `
|
|
21
|
-
*
|
|
21
|
+
* - **Standard Webhooks** (https://www.standardwebhooks.com), checked
|
|
22
|
+
* whenever a `webhook-signature` header is present: `webhook-id`,
|
|
23
|
+
* `webhook-timestamp`, and `webhook-signature` carrying `v1,` + base64
|
|
24
|
+
* `HMAC-SHA256(key, "<webhook-id>.<webhook-timestamp>.<rawBody>")`,
|
|
25
|
+
* where the key is the base64 decoding of the secret without its
|
|
26
|
+
* `whsec_` (or legacy `whs_`) prefix.
|
|
27
|
+
* - **The iSnap scheme**, the fallback when there is no
|
|
28
|
+
* `webhook-signature`: `X-iSnap-Signature` carries the hex-encoded
|
|
29
|
+
* `HMAC-SHA256(secret, "<timestamp>.<rawBody>")` and `X-iSnap-Timestamp`
|
|
30
|
+
* the unix-second issuance time.
|
|
31
|
+
*
|
|
32
|
+
* Both paths take the secret string exactly as the dashboard shows it.
|
|
22
33
|
*
|
|
23
34
|
* Throws `WebhookSignatureError` on missing headers, malformed
|
|
24
35
|
* timestamp, expired timestamp (outside `tolerance`), or signature
|
|
@@ -32,10 +43,12 @@ export interface VerifyWebhookOptions {
|
|
|
32
43
|
* Headers may be a `Record<string, string>` (e.g. Express's `req.headers`)
|
|
33
44
|
* or a `Headers` instance — both are read case-insensitively.
|
|
34
45
|
*
|
|
35
|
-
* **Consumers MUST dedupe by `event.event_id`**
|
|
36
|
-
* envelope (same `event_id`, same body,
|
|
37
|
-
* timestamp). Without consumer-side dedup, an
|
|
38
|
-
* model produces duplicate side-effects on the
|
|
46
|
+
* **Consumers MUST dedupe by `event.event_id`** (also sent as `webhook-id`)
|
|
47
|
+
* — retries replay the same envelope (same `event_id`, same body,
|
|
48
|
+
* refreshed timestamp and signatures). Without consumer-side dedup, an
|
|
49
|
+
* at-least-once delivery model produces duplicate side-effects on the
|
|
50
|
+
* partner system.
|
|
39
51
|
*/
|
|
40
|
-
export declare function verifyWebhook(rawBody: string, headers:
|
|
52
|
+
export declare function verifyWebhook(rawBody: string, headers: WebhookHeaders, secret: string | readonly string[], options?: VerifyWebhookOptions): WebhookEventBase;
|
|
53
|
+
export {};
|
|
41
54
|
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/webhooks/verify.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAIlD,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CACnB;AAED
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/webhooks/verify.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAIlD,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CACnB;AAED,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,OAAO,CAAA;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EAClC,OAAO,GAAE,oBAAyB,GACjC,gBAAgB,CAKlB"}
|