@bikefinder/sdk 0.32.1 → 0.33.1
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 +13 -1
- package/dist/{chunk-3EMQWFLN.js → chunk-IYM3P32E.js} +60 -11
- package/dist/index.d.ts +6466 -881
- package/dist/index.js +26 -10
- package/dist/schemas.d.ts +6466 -881
- package/dist/schemas.js +11 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @bikefinder/sdk
|
|
2
2
|
|
|
3
|
+
Version 0.33 adds `trackers.positionRequests` for eligible AWS trackers. Read
|
|
4
|
+
`capabilities` for the supported methods and last known eDRX interval, call
|
|
5
|
+
`submit` with a caller-generated request ID, and poll `get` while the request is
|
|
6
|
+
active. Reuse the request ID when retrying an uncertain submission. A tracker
|
|
7
|
+
acknowledgement moves the request to `measuring`. A matching location fix moves
|
|
8
|
+
it to `updated`. Deploy the matching API routes before enabling this flow.
|
|
9
|
+
|
|
3
10
|
Version 0.32 adds the optional `webSocket` constructor to `createBikeFinderClient`.
|
|
4
11
|
React Native clients can supply a constructor that sends an empty `Origin` header
|
|
5
12
|
for native realtime tickets. Other clients default to the platform WebSocket.
|
|
@@ -81,9 +88,10 @@ helper sends JPEG bytes directly to private staging storage, then asks the API
|
|
|
81
88
|
to sanitize and publish the image:
|
|
82
89
|
|
|
83
90
|
```ts
|
|
91
|
+
const requestId = crypto.randomUUID();
|
|
84
92
|
const result = await client.uploadPhoto({
|
|
85
93
|
deviceId,
|
|
86
|
-
requestId
|
|
94
|
+
requestId,
|
|
87
95
|
kind: "bike",
|
|
88
96
|
body: jpegBlob,
|
|
89
97
|
});
|
|
@@ -93,6 +101,10 @@ const download = await client.api.trackers.photos.download({
|
|
|
93
101
|
});
|
|
94
102
|
```
|
|
95
103
|
|
|
104
|
+
If the upload gets no storage response, the helper asks the API to verify and
|
|
105
|
+
complete the original upload. If the call still fails, keep the same request ID
|
|
106
|
+
and JPEG bytes when retrying.
|
|
107
|
+
|
|
96
108
|
Uploads are limited to 10 MiB. Download URLs expire after two minutes; request a
|
|
97
109
|
fresh reference if one expires. Photo bytes do not travel over WebSockets.
|
|
98
110
|
Runtime schemas are available from `@bikefinder/sdk/schemas`.
|
|
@@ -786,18 +786,61 @@ var theftContract = {
|
|
|
786
786
|
submit: oc14.errors(apiErrors).input(theftSubmission).output(z16.object({ reportId: documentId }))
|
|
787
787
|
};
|
|
788
788
|
|
|
789
|
-
// ../customer-contracts/src/
|
|
789
|
+
// ../customer-contracts/src/position-requests.ts
|
|
790
|
+
import { oc as oc15 } from "@orpc/contract";
|
|
790
791
|
import { z as z17 } from "zod";
|
|
791
|
-
var
|
|
792
|
-
var
|
|
792
|
+
var positionMethod = z17.enum(["cellular", "wifi", "gps"]);
|
|
793
|
+
var positionRequestInput = trackerInput.extend({ requestId });
|
|
794
|
+
var submitPositionRequestInput = positionRequestInput.extend({
|
|
795
|
+
method: positionMethod
|
|
796
|
+
});
|
|
797
|
+
var positionFix = z17.object({
|
|
798
|
+
id: z17.string(),
|
|
799
|
+
latitude: z17.number().min(-90).max(90),
|
|
800
|
+
longitude: z17.number().min(-180).max(180),
|
|
801
|
+
accuracy: z17.number().nonnegative().nullable(),
|
|
802
|
+
measuredAt: z17.iso.datetime({ offset: true })
|
|
803
|
+
});
|
|
804
|
+
var positionRequest = z17.object({
|
|
805
|
+
requestId,
|
|
806
|
+
method: positionMethod,
|
|
807
|
+
status: z17.enum([
|
|
808
|
+
"waiting",
|
|
809
|
+
"measuring",
|
|
810
|
+
"resolving",
|
|
811
|
+
"updated",
|
|
812
|
+
"no_fix",
|
|
813
|
+
"no_response",
|
|
814
|
+
"location_unavailable",
|
|
815
|
+
"failed"
|
|
816
|
+
]),
|
|
817
|
+
deliveryDeadline: z17.iso.datetime(),
|
|
818
|
+
resultDeadline: z17.iso.datetime(),
|
|
819
|
+
position: positionFix.nullable()
|
|
820
|
+
});
|
|
821
|
+
var positionRequestsContract = {
|
|
822
|
+
capabilities: oc15.meta({ operation: "read" }).errors(apiErrors).input(trackerInput).output(
|
|
823
|
+
z17.object({
|
|
824
|
+
methods: z17.array(positionMethod),
|
|
825
|
+
pagingIntervalMs: z17.int().positive().nullable()
|
|
826
|
+
})
|
|
827
|
+
),
|
|
828
|
+
submit: oc15.errors(apiErrors).input(submitPositionRequestInput).output(positionRequest),
|
|
829
|
+
get: oc15.meta({ operation: "read" }).errors(apiErrors).input(positionRequestInput).output(positionRequest.nullable())
|
|
830
|
+
};
|
|
831
|
+
|
|
832
|
+
// ../customer-contracts/src/session-migration.ts
|
|
833
|
+
import { z as z18 } from "zod";
|
|
834
|
+
var token = z18.string().min(1).max(16384).regex(/^[\x21-\x7e]+$/);
|
|
835
|
+
var migratedSession = z18.strictObject({
|
|
793
836
|
accessToken: token,
|
|
794
837
|
refreshToken: token,
|
|
795
|
-
expiresIn:
|
|
838
|
+
expiresIn: z18.int32().positive()
|
|
796
839
|
});
|
|
797
840
|
|
|
798
841
|
// ../customer-contracts/src/index.ts
|
|
799
|
-
import { eventIterator as eventIterator3, oc as
|
|
800
|
-
import { z as
|
|
842
|
+
import { eventIterator as eventIterator3, oc as oc16 } from "@orpc/contract";
|
|
843
|
+
import { z as z19 } from "zod";
|
|
801
844
|
|
|
802
845
|
// ../customer-contracts/src/gcp/index.ts
|
|
803
846
|
var gcpContract = {
|
|
@@ -807,21 +850,22 @@ var gcpContract = {
|
|
|
807
850
|
};
|
|
808
851
|
|
|
809
852
|
// ../customer-contracts/src/index.ts
|
|
810
|
-
var procedure =
|
|
853
|
+
var procedure = oc16.errors(apiErrors).input(trackerInput);
|
|
811
854
|
var trackerContract = {
|
|
855
|
+
positionRequests: positionRequestsContract,
|
|
812
856
|
subscription: subscriptionAllocationContract,
|
|
813
857
|
theft: theftContract,
|
|
814
858
|
lookup: trackerLookupContract,
|
|
815
859
|
photos: {
|
|
816
860
|
...trackerPhotoContract,
|
|
817
861
|
uploads: photoUploadContract,
|
|
818
|
-
watchPage:
|
|
862
|
+
watchPage: oc16.meta({ operation: "read" }).errors(apiErrors).input(photoPageInput).output(eventIterator3(photoPage))
|
|
819
863
|
},
|
|
820
864
|
invitations: trackerInvitationContract,
|
|
821
865
|
...trackerChangeContract,
|
|
822
|
-
claim:
|
|
823
|
-
list:
|
|
824
|
-
watchPage:
|
|
866
|
+
claim: oc16.errors(apiErrors).input(trackerClaimInput).output(z19.void()),
|
|
867
|
+
list: oc16.meta({ operation: "read" }).errors(apiErrors).input(pageInput).output(trackerPage),
|
|
868
|
+
watchPage: oc16.meta({ operation: "read" }).errors(apiErrors).input(pageInput).output(eventIterator3(trackerPage)),
|
|
825
869
|
getDetails: procedure.meta({ operation: "read" }).output(customerTrackerDetails),
|
|
826
870
|
watchDetails: procedure.meta({ operation: "read" }).output(eventIterator3(customerTrackerDetails)),
|
|
827
871
|
get: procedure.meta({ operation: "read" }).output(tracker),
|
|
@@ -927,6 +971,11 @@ export {
|
|
|
927
971
|
photoUploadContract,
|
|
928
972
|
theftSubmission,
|
|
929
973
|
theftContract,
|
|
974
|
+
positionMethod,
|
|
975
|
+
positionRequestInput,
|
|
976
|
+
submitPositionRequestInput,
|
|
977
|
+
positionRequest,
|
|
978
|
+
positionRequestsContract,
|
|
930
979
|
migratedSession,
|
|
931
980
|
customerContract
|
|
932
981
|
};
|