@bikefinder/sdk 0.38.0 → 0.40.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.
@@ -1,6 +1,6 @@
1
1
  // ../common-contracts/src/shared.ts
2
2
  import { z } from "zod";
3
- var apiContractVersion = "2";
3
+ var apiContractVersion = "4";
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."
@@ -561,43 +561,37 @@ var trackerAdmission = z10.object({
561
561
  });
562
562
  var trackerLookupContract = oc8.meta({ operation: "read" }).errors(apiErrors).input(trackerLookupInput).output(trackerAdmission);
563
563
 
564
- // ../common-contracts/src/gcp/history.ts
564
+ // ../common-contracts/src/position-history.ts
565
565
  import { oc as oc9 } from "@orpc/contract";
566
566
  import { z as z11 } from "zod";
567
- var historyCursor = z11.object({
568
- ...timeCursorFields,
569
- scope: z11.string().regex(/^[a-f0-9]{64}$/)
570
- });
571
- var historyInput = z11.strictObject({
567
+ var positionSources = ["gnss", "wifi", "cellular"];
568
+ var positionSource = z11.enum(positionSources);
569
+ var cursor = z11.string().max(66e3).regex(/^[A-Za-z0-9_-]+$/);
570
+ var positionHistoryInput = z11.strictObject({
572
571
  deviceId: documentId,
573
- from: z11.iso.datetime(),
574
- until: z11.iso.datetime(),
572
+ from: z11.iso.datetime().describe("Inclusive measurement time, in UTC"),
573
+ until: z11.iso.datetime().describe("Exclusive measurement time, in UTC"),
574
+ sources: z11.array(positionSource).min(1).max(positionSources.length).refine((sources) => new Set(sources).size === sources.length, "Select each source once.").optional().describe("Omit to include all position sources."),
575
575
  limit: pageFields.limit,
576
- after: historyCursor.strict().optional()
577
- });
578
- var historyEntry = z11.object({
579
- ...documentFields,
580
- type: z11.string().nullable(),
581
- observedAt: z11.iso.datetime().nullable(),
582
- latitude: z11.number().nullable(),
583
- longitude: z11.number().nullable(),
576
+ after: cursor.optional()
577
+ });
578
+ var positionHistoryItem = z11.object({
579
+ id: z11.string(),
580
+ source: positionSource,
581
+ measuredAt: z11.iso.datetime(),
582
+ receivedAt: z11.iso.datetime(),
583
+ latitude: z11.number(),
584
+ longitude: z11.number(),
584
585
  accuracy: z11.number().nullable(),
585
- speed: z11.number().nullable(),
586
586
  altitude: z11.number().nullable(),
587
- heading: z11.number().nullable(),
588
- source: z11.string().nullable(),
589
- battery: z11.object({
590
- level: z11.int().nullable(),
591
- isCharging: z11.boolean().nullable(),
592
- source: z11.string().nullable(),
593
- observedAt: z11.iso.datetime().nullable()
594
- }).nullable()
595
- });
596
- var historyPage = z11.object({
597
- items: z11.array(historyEntry),
598
- nextAfter: historyCursor.nullable()
599
- });
600
- var historyContract = oc9.meta({ operation: "read" }).errors(apiErrors).input(historyInput).output(historyPage);
587
+ speed: z11.number().nullable(),
588
+ heading: z11.number().nullable()
589
+ });
590
+ var positionHistoryPage = z11.object({
591
+ items: z11.array(positionHistoryItem),
592
+ nextAfter: cursor.nullable()
593
+ });
594
+ var positionHistoryContract = oc9.meta({ operation: "read" }).errors(apiErrors).input(positionHistoryInput).output(positionHistoryPage);
601
595
 
602
596
  // ../customer-contracts/src/gcp/firmware.ts
603
597
  import { oc as oc10 } from "@orpc/contract";
@@ -847,15 +841,6 @@ var migratedSession = z18.strictObject({
847
841
  // ../customer-contracts/src/index.ts
848
842
  import { eventIterator as eventIterator3, oc as oc16 } from "@orpc/contract";
849
843
  import { z as z19 } from "zod";
850
-
851
- // ../customer-contracts/src/gcp/index.ts
852
- var gcpContract = {
853
- firmware: gen1FirmwareContract,
854
- bluetooth: bluetoothContract,
855
- history: historyContract
856
- };
857
-
858
- // ../customer-contracts/src/index.ts
859
844
  var procedure = oc16.errors(apiErrors).input(trackerInput);
860
845
  var trackerMode = z19.enum(["standard", "security", "tracking"]);
861
846
  var trackerModeRead = trackerInput;
@@ -867,6 +852,9 @@ var trackerModeStatus = z19.strictObject({
867
852
  version: z19.int().positive()
868
853
  });
869
854
  var trackerContract = {
855
+ positionHistory: positionHistoryContract,
856
+ bluetooth: bluetoothContract,
857
+ firmware: gen1FirmwareContract,
870
858
  positionRequests: positionRequestsContract,
871
859
  subscription: subscriptionAllocationContract,
872
860
  theft: theftContract,
@@ -894,8 +882,7 @@ var customerContract = {
894
882
  realtime: realtimeContract,
895
883
  subscriptions: subscriptionContract,
896
884
  account: accountContract,
897
- trackers: trackerContract,
898
- gcp: gcpContract
885
+ trackers: trackerContract
899
886
  };
900
887
 
901
888
  export {
@@ -959,11 +946,7 @@ export {
959
946
  trackerLookupInput,
960
947
  trackerAdmission,
961
948
  trackerLookupContract,
962
- historyCursor,
963
- historyInput,
964
- historyEntry,
965
- historyPage,
966
- historyContract,
949
+ positionSources,
967
950
  firmwareAvailability,
968
951
  trackerFirmwareRelease,
969
952
  firmwareAppInput,