@bikefinder/sdk 0.27.2 → 0.29.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,6 +1,15 @@
1
1
  # @bikefinder/sdk
2
2
 
3
- Version 0.27.2 uses the canonical API contracts directly for HTTP and WebSocket
3
+ Version 0.29.0 returns the canonical bike, including its new revision, from
4
+ `client.api.trackers.bike.edit`. Bind the edit to the tracker resource with `trackerCreatedAt: tracker.createdAt`. Supply `expected` values for exactly the fields in `changes`;
5
+ the API compares them atomically and preserves unrelated edits. Repeating an
6
+ already-applied edit succeeds. Use the result directly; saving needs no extra tracker reads. Deploy the matching API before updating consumers.
7
+ The public `@bikefinder/sdk/schemas` exports `errorData` and `errorRecovery` for
8
+ validating declared recovery instructions.
9
+
10
+ Version 0.28 adds live photo metadata pages through
11
+ `client.api.trackers.photos.watchPage`. Deploy this API endpoint before updating
12
+ consumers that subscribe to photos. The SDK uses the canonical API contracts directly for HTTP and WebSocket
4
13
  responses. Deploy the API's availability-state contract before updating consumers;
5
14
  retired nullable response formats are rejected rather than translated.
6
15
 
@@ -47,7 +56,10 @@ Full reconnects end existing subscriptions. Use `onReconnect` to explicitly
47
56
  subscribe again. The SDK does not replay events or retry writes automatically.
48
57
  Retain the original request ID when explicitly retrying an uncertain mutation.
49
58
 
50
- Photos use the normal typed HTTP API for authorization and metadata. The upload
59
+ Photo metadata supports HTTP `list` and WebSocket `watchPage`, with the same
60
+ cursor pagination and current-member authorization. Each watch ends if membership
61
+ is revoked, credentials expire, or the tracker is recreated. Use small pages
62
+ (e.g. `limit: 20`) to stay within the encoded realtime frame limit. The upload
51
63
  helper sends JPEG bytes directly to private staging storage, then asks the API
52
64
  to sanitize and publish the image:
53
65
 
@@ -487,9 +487,15 @@ var bikeChanges = z9.strictObject({
487
487
  );
488
488
  var bikeEditInput = z9.strictObject({
489
489
  deviceId: documentId,
490
- expectedRevision: z9.string().regex(/^[a-f0-9]{64}$/),
490
+ trackerCreatedAt: z9.iso.datetime(),
491
+ expected: trackerBike.omit({ revision: true }).partial().strict(),
491
492
  changes: bikeChanges
492
- });
493
+ }).refine(({ expected, changes }) => {
494
+ const fields2 = Object.entries(changes).filter(([, value]) => value !== void 0).map(([key]) => key);
495
+ return fields2.length === Object.keys(expected).length && fields2.every(
496
+ (key) => expected[key] !== void 0
497
+ );
498
+ }, "Supply reviewed values for exactly the changed bike fields.");
493
499
  var membershipName = z9.string().min(1).max(100).regex(/^[^\p{Cc}]+$/u).refine((value) => value.trim().length > 0, "Supply a display name.");
494
500
  var trackerClaimInput = z9.strictObject({
495
501
  deviceId: documentId,
@@ -507,7 +513,7 @@ var trackerMovementAlertsInput = z9.strictObject({
507
513
  enabled: z9.boolean()
508
514
  });
509
515
  var trackerChangeContract = {
510
- bike: { edit: oc7.errors(apiErrors).input(bikeEditInput).output(z9.void()) },
516
+ bike: { edit: oc7.errors(apiErrors).input(bikeEditInput).output(trackerBike) },
511
517
  movementAlerts: {
512
518
  set: oc7.errors(apiErrors).input(trackerMovementAlertsInput).output(z9.void())
513
519
  },
@@ -789,7 +795,11 @@ var trackerContract = {
789
795
  subscription: subscriptionAllocationContract,
790
796
  theft: theftContract,
791
797
  lookup: trackerLookupContract,
792
- photos: { ...trackerPhotoContract, uploads: photoUploadContract },
798
+ photos: {
799
+ ...trackerPhotoContract,
800
+ uploads: photoUploadContract,
801
+ watchPage: oc15.meta({ operation: "read" }).errors(apiErrors).input(photoPageInput).output(eventIterator3(photoPage))
802
+ },
793
803
  invitations: trackerInvitationContract,
794
804
  ...trackerChangeContract,
795
805
  claim: oc15.errors(apiErrors).input(trackerClaimInput).output(z18.void()),
@@ -809,6 +819,8 @@ var customerContract = {
809
819
  export {
810
820
  apiContractVersion,
811
821
  subscriptionInput,
822
+ errorRecovery,
823
+ errorData,
812
824
  pushToken,
813
825
  pushRegistrationInput,
814
826
  pushRemovalInput,