@bikefinder/sdk 0.23.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,23 +1,29 @@
1
1
  # @bikefinder/sdk
2
2
 
3
+ Version 0.28.0 adds live photo metadata pages through
4
+ `client.api.trackers.photos.watchPage`. Deploy this API endpoint before updating
5
+ consumers that subscribe to photos. The SDK uses the canonical API contracts directly for HTTP and WebSocket
6
+ responses. Deploy the API's availability-state contract before updating consumers;
7
+ retired nullable response formats are rejected rather than translated.
8
+
3
9
  Typed customer HTTP and WebSocket client for the [API](../../README.md).
4
- Version 0.23 replaces the previous generated REST methods and custom realtime
10
+ Version 0.24 replaces the previous generated REST methods and custom realtime
5
11
  protocol with native oRPC contracts, validation and async iterators. Staff tools
6
12
  use [@bikefinder/staff-sdk](../staff-sdk/README.md).
7
13
 
8
14
  ```ts
9
- import { createBikeFinderClient, ORPCError } from '@bikefinder/sdk';
15
+ import { createBikeFinderClient, ORPCError } from "@bikefinder/sdk";
10
16
 
11
17
  const client = createBikeFinderClient({
12
- baseUrl: 'https://api.prod.bikefinder.com',
18
+ baseUrl: "https://api.prod.bikefinder.com",
13
19
  accessToken: () => session.getAccessToken(),
14
20
  onReconnect: () => restartActiveViews(),
15
21
  });
16
22
 
17
- const tracker = await client.api.trackers.get({ id: trackerId });
23
+ const tracker = await client.api.trackers.get({ deviceId });
18
24
  const controller = new AbortController();
19
25
  const changes = await client.api.trackers.watch(
20
- { id: trackerId },
26
+ { deviceId },
21
27
  { signal: controller.signal },
22
28
  );
23
29
  for await (const tracker of changes) updateTracker(tracker);
@@ -36,24 +42,29 @@ HTTP requests omit cookies, disable caching and refuse redirects.
36
42
  to loopback development endpoints. Each procedure accepts an optional second
37
43
  argument containing `signal`. `dispose()` cancels requests, uploads and the
38
44
  shared socket. Typed failures use `ORPCError` with `code`, `status` and `data`.
45
+ Disposal is idempotent and emits one `closed` state; its intentional cancellation
46
+ does not call `onConnectionError`.
39
47
 
40
48
  Full reconnects end existing subscriptions. Use `onReconnect` to explicitly
41
49
  subscribe again. The SDK does not replay events or retry writes automatically.
42
50
  Retain the original request ID when explicitly retrying an uncertain mutation.
43
51
 
44
- Photos use the normal typed HTTP API for authorization and metadata. The upload
52
+ Photo metadata supports HTTP `list` and WebSocket `watchPage`, with the same
53
+ cursor pagination and current-member authorization. Each watch ends if membership
54
+ is revoked, credentials expire, or the tracker is recreated. Use small pages
55
+ (e.g. `limit: 20`) to stay within the encoded realtime frame limit. The upload
45
56
  helper sends JPEG bytes directly to private staging storage, then asks the API
46
57
  to sanitize and publish the image:
47
58
 
48
59
  ```ts
49
60
  const result = await client.uploadPhoto({
50
- id: trackerId,
61
+ deviceId,
51
62
  requestId: crypto.randomUUID(),
52
- kind: 'bike',
63
+ kind: "bike",
53
64
  body: jpegBlob,
54
65
  });
55
66
  const download = await client.api.trackers.photos.download({
56
- id: trackerId,
67
+ deviceId,
57
68
  photoId: result.photoId,
58
69
  });
59
70
  ```
@@ -61,3 +72,20 @@ const download = await client.api.trackers.photos.download({
61
72
  Uploads are limited to 10 MiB. Download URLs expire after two minutes; request a
62
73
  fresh reference if one expires. Photo bytes do not travel over WebSockets.
63
74
  Runtime schemas are available from `@bikefinder/sdk/schemas`.
75
+
76
+ Version 0.27 makes responses tolerant of added fields while preserving validation
77
+ of known fields and strict request inputs. Reading summaries use
78
+ `state: 'available' | 'unavailable'`; account preferences contain effective values.
79
+ Recoverable presentation-data problems appear in `readIssues`. Declared error
80
+ data includes a trace ID and typed `recovery` instructions. Keep the original
81
+ request ID when following `retry_same_request` or `read_operation` guidance.
82
+
83
+ Push registrations identify an installation with a persistent UUID and report
84
+ its OS permission separately from `account.preferences.notifications`. Register
85
+ with a nullable token; unregister by installation ID. Changing permission on one
86
+ phone never changes the account preference or another phone's registration.
87
+
88
+ React Native callers can supply `uploadPhoto({ ..., sha256 })`, where `sha256`
89
+ uses the platform crypto implementation and returns a 32-byte ArrayBuffer. The
90
+ default uses Web Crypto. Realtime frames are limited to 32 KiB after encoding;
91
+ reduce page/selection sizes when the API returns `payload_too_large`.