@bikefinder/sdk 0.33.3 → 0.35.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 +10 -7
- package/dist/{chunk-425MMPO2.js → chunk-ZSNSOMTF.js} +20 -2
- package/dist/index.d.ts +6973 -4193
- package/dist/index.js +111 -34
- package/dist/schemas.d.ts +6966 -4191
- package/dist/schemas.js +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,18 +41,17 @@ protocol with native oRPC contracts, validation and async iterators. Staff tools
|
|
|
41
41
|
use [@bikefinder/staff-sdk](../staff-sdk/README.md).
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
|
-
import { createBikeFinderClient
|
|
44
|
+
import { createBikeFinderClient } from "@bikefinder/sdk";
|
|
45
45
|
|
|
46
46
|
const client = createBikeFinderClient({
|
|
47
47
|
baseUrl: "https://api.prod.bikefinder.com",
|
|
48
48
|
accessToken: () => session.getAccessToken(),
|
|
49
|
-
onReconnect: () => restartActiveViews(),
|
|
50
49
|
});
|
|
51
50
|
|
|
52
51
|
const tracker = await client.api.trackers.getDetails({ deviceId });
|
|
53
52
|
const controller = new AbortController();
|
|
54
|
-
const changes =
|
|
55
|
-
{ deviceId },
|
|
53
|
+
const changes = client.watch(
|
|
54
|
+
(api, signal) => api.trackers.watchDetails({ deviceId }, { signal }),
|
|
56
55
|
{ signal: controller.signal },
|
|
57
56
|
);
|
|
58
57
|
for await (const tracker of changes) updateTracker(tracker);
|
|
@@ -74,8 +73,12 @@ shared socket. Typed failures use `ORPCError` with `code`, `status` and `data`.
|
|
|
74
73
|
Disposal is idempotent and emits one `closed` state; its intentional cancellation
|
|
75
74
|
does not call `onConnectionError`.
|
|
76
75
|
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
`client.watch()` reopens a read-only subscription after disconnects and retries
|
|
77
|
+
transient subscription failures with backoff. Authorization and other terminal
|
|
78
|
+
failures reach the caller. Snapshot watches emit current state on each
|
|
79
|
+
subscription. Event feeds resume with new events, so views that need history
|
|
80
|
+
should query it separately. A direct `client.api` iterator represents a single
|
|
81
|
+
subscription. Use `onReconnect` if a view needs to refresh its HTTP queries.
|
|
79
82
|
When the API advertises keepalive support, the browser SDK probes an idle socket
|
|
80
83
|
after five minutes while a visible page has active watches. A missed reply
|
|
81
84
|
triggers the usual reconnect. The reply checks the Gateway connection.
|
|
@@ -83,7 +86,7 @@ Each ticket attempt has its own deadline (`realtimeConnectTimeoutMs`, 30 seconds
|
|
|
83
86
|
by default), so a stalled token provider or ticket request can time out and retry.
|
|
84
87
|
Pending subscriptions wait through transient connection failures within the same
|
|
85
88
|
connection-wait deadline. Ticket admission errors such as a denied sign-in or
|
|
86
|
-
rate limit are returned immediately.
|
|
89
|
+
rate limit are returned immediately to direct callers.
|
|
87
90
|
Retain the original request ID when explicitly retrying an uncertain mutation.
|
|
88
91
|
|
|
89
92
|
Photo metadata supports HTTP `list` and WebSocket `watchPage`, with the same
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// ../common-contracts/src/shared.ts
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
var apiContractVersion = "
|
|
3
|
+
var apiContractVersion = "2";
|
|
4
4
|
var documentId = z.string().min(1).max(128).refine(
|
|
5
5
|
(value) => value.trim().length > 0 && ![".", ".."].includes(value) && !/[\\/\p{Cc}]/u.test(value) && !value.startsWith("__"),
|
|
6
6
|
"Invalid document ID."
|
|
@@ -432,7 +432,8 @@ var realtimeTicket = z7.object({
|
|
|
432
432
|
).optional()
|
|
433
433
|
});
|
|
434
434
|
var realtimeContract = {
|
|
435
|
-
ticket: oc5.errors(apiErrors).input(z7.void()).output(realtimeTicket)
|
|
435
|
+
ticket: oc5.errors(apiErrors).input(z7.void()).output(realtimeTicket),
|
|
436
|
+
ping: oc5.errors(apiErrors).input(z7.void()).output(z7.null())
|
|
436
437
|
};
|
|
437
438
|
|
|
438
439
|
// ../common-contracts/src/subscriptions.ts
|
|
@@ -852,6 +853,15 @@ var gcpContract = {
|
|
|
852
853
|
|
|
853
854
|
// ../customer-contracts/src/index.ts
|
|
854
855
|
var procedure = oc16.errors(apiErrors).input(trackerInput);
|
|
856
|
+
var trackerMode = z19.enum(["standard", "security", "tracking"]);
|
|
857
|
+
var trackerModeRead = trackerInput;
|
|
858
|
+
var trackerModeWrite = trackerInput.extend({ mode: trackerMode, expectedVersion: z19.int().positive() });
|
|
859
|
+
var trackerModeStatus = z19.strictObject({
|
|
860
|
+
desired: trackerMode,
|
|
861
|
+
reported: trackerMode.nullable(),
|
|
862
|
+
state: z19.enum(["applied", "pending", "rejected"]),
|
|
863
|
+
version: z19.int().positive()
|
|
864
|
+
});
|
|
855
865
|
var trackerContract = {
|
|
856
866
|
positionRequests: positionRequestsContract,
|
|
857
867
|
subscription: subscriptionAllocationContract,
|
|
@@ -864,6 +874,10 @@ var trackerContract = {
|
|
|
864
874
|
},
|
|
865
875
|
invitations: trackerInvitationContract,
|
|
866
876
|
...trackerChangeContract,
|
|
877
|
+
mode: {
|
|
878
|
+
get: oc16.meta({ operation: "read" }).errors(apiErrors).input(trackerModeRead).output(trackerModeStatus),
|
|
879
|
+
set: oc16.errors(apiErrors).input(trackerModeWrite).output(trackerModeStatus)
|
|
880
|
+
},
|
|
867
881
|
claim: oc16.errors(apiErrors).input(trackerClaimInput).output(z19.void()),
|
|
868
882
|
list: oc16.meta({ operation: "read" }).errors(apiErrors).input(pageInput).output(trackerPage),
|
|
869
883
|
watchPage: oc16.meta({ operation: "read" }).errors(apiErrors).input(pageInput).output(eventIterator3(trackerPage)),
|
|
@@ -978,5 +992,9 @@ export {
|
|
|
978
992
|
positionRequest,
|
|
979
993
|
positionRequestsContract,
|
|
980
994
|
migratedSession,
|
|
995
|
+
trackerMode,
|
|
996
|
+
trackerModeRead,
|
|
997
|
+
trackerModeWrite,
|
|
998
|
+
trackerModeStatus,
|
|
981
999
|
customerContract
|
|
982
1000
|
};
|