@isnap/sdk 1.1.0-next.83 → 1.1.0-next.85

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.
@@ -6,9 +6,28 @@ export type LookupResult = components['schemas']['Lookup'];
6
6
  export declare class LookupResource extends BaseResource {
7
7
  /**
8
8
  * `POST /v1/lookup` — check whether a handle is reachable on iMessage.
9
- * Synchronous: returns `imessage: true | false | null`. `null` means
10
- * the iMessage status is unknown and the handle should be treated as
11
- * SMS-safe (degrade to SMS instead of relying on iMessage delivery).
9
+ *
10
+ * Two outcomes. The client returns the envelope's `data` and does not
11
+ * surface the HTTP status, so branch on `pending` — the in-band signal:
12
+ *
13
+ * - **Terminal (`200`)** — `imessage: true | false | null`, and `pending`
14
+ * is absent. `null` means the iMessage status is unknown and the handle
15
+ * should be treated as SMS-safe (degrade to SMS instead of relying on
16
+ * iMessage delivery).
17
+ * - **Pending (`202`)** — a device probe was dispatched but had not
18
+ * answered within the wait budget. `pending: true`, `imessage: null`,
19
+ * plus `probe_id` and `retry_after` (seconds).
20
+ *
21
+ * Completion is poll-only — there is no `lookup.completed` webhook.
22
+ * Re-issue the same request after `retry_after`; the shared cache the
23
+ * probe warms answers `200`.
24
+ *
25
+ * ```ts
26
+ * const result = await client.lookup.check({ handle })
27
+ * if (result.pending) {
28
+ * setTimeout(retry, (result.retry_after ?? 1) * 1000)
29
+ * }
30
+ * ```
12
31
  */
13
32
  check(params: LookupRequest, opts?: RequestOptions): Promise<LookupResult>;
14
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../src/resources/lookup.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,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAA;AAClE,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAA;AAE1D,qBAAa,cAAe,SAAQ,YAAY;IAC9C;;;;;OAKG;IACH,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;CAG3E"}
1
+ {"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../src/resources/lookup.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,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAA;AAClE,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAA;AAE1D,qBAAa,cAAe,SAAQ,YAAY;IAC9C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;CAG3E"}
@@ -2,9 +2,28 @@ import { BaseResource } from './base.js';
2
2
  export class LookupResource extends BaseResource {
3
3
  /**
4
4
  * `POST /v1/lookup` — check whether a handle is reachable on iMessage.
5
- * Synchronous: returns `imessage: true | false | null`. `null` means
6
- * the iMessage status is unknown and the handle should be treated as
7
- * SMS-safe (degrade to SMS instead of relying on iMessage delivery).
5
+ *
6
+ * Two outcomes. The client returns the envelope's `data` and does not
7
+ * surface the HTTP status, so branch on `pending` — the in-band signal:
8
+ *
9
+ * - **Terminal (`200`)** — `imessage: true | false | null`, and `pending`
10
+ * is absent. `null` means the iMessage status is unknown and the handle
11
+ * should be treated as SMS-safe (degrade to SMS instead of relying on
12
+ * iMessage delivery).
13
+ * - **Pending (`202`)** — a device probe was dispatched but had not
14
+ * answered within the wait budget. `pending: true`, `imessage: null`,
15
+ * plus `probe_id` and `retry_after` (seconds).
16
+ *
17
+ * Completion is poll-only — there is no `lookup.completed` webhook.
18
+ * Re-issue the same request after `retry_after`; the shared cache the
19
+ * probe warms answers `200`.
20
+ *
21
+ * ```ts
22
+ * const result = await client.lookup.check({ handle })
23
+ * if (result.pending) {
24
+ * setTimeout(retry, (result.retry_after ?? 1) * 1000)
25
+ * }
26
+ * ```
8
27
  */
9
28
  check(params, opts) {
10
29
  return this.client.request('POST', '/v1/lookup', params, opts);
@@ -1 +1 @@
1
- {"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../src/resources/lookup.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAKxC,MAAM,OAAO,cAAe,SAAQ,YAAY;IAC9C;;;;;OAKG;IACH,KAAK,CAAC,MAAqB,EAAE,IAAqB;QAChD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAe,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;IAC9E,CAAC;CACF"}
1
+ {"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../src/resources/lookup.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAKxC,MAAM,OAAO,cAAe,SAAQ,YAAY;IAC9C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,KAAK,CAAC,MAAqB,EAAE,IAAqB;QAChD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAe,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;IAC9E,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isnap/sdk",
3
- "version": "1.1.0-next.83",
3
+ "version": "1.1.0-next.85",
4
4
  "description": "Official TypeScript SDK for the iSnap P2P telephony API",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -45,7 +45,8 @@
45
45
  "test": "vitest run",
46
46
  "test:watch": "vitest",
47
47
  "generate": "openapi-typescript ../backend/openapi.json -o src/generated/openapi.d.ts",
48
- "prepublishOnly": "bun run lint && bun run typecheck && bun run test && bun run build"
48
+ "verify:generated": "bun scripts/verify-generated.ts",
49
+ "prepublishOnly": "bun run verify:generated && bun run lint && bun run typecheck && bun run test && bun run build"
49
50
  },
50
51
  "engines": {
51
52
  "node": ">=20"