@bikefinder/sdk 0.39.0 → 0.41.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 = "3";
3
+ var apiContractVersion = "5";
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";
@@ -858,7 +852,7 @@ var trackerModeStatus = z19.strictObject({
858
852
  version: z19.int().positive()
859
853
  });
860
854
  var trackerContract = {
861
- history: historyContract,
855
+ positionHistory: positionHistoryContract,
862
856
  bluetooth: bluetoothContract,
863
857
  firmware: gen1FirmwareContract,
864
858
  positionRequests: positionRequestsContract,
@@ -952,11 +946,7 @@ export {
952
946
  trackerLookupInput,
953
947
  trackerAdmission,
954
948
  trackerLookupContract,
955
- historyCursor,
956
- historyInput,
957
- historyEntry,
958
- historyPage,
959
- historyContract,
949
+ positionSources,
960
950
  firmwareAvailability,
961
951
  trackerFirmwareRelease,
962
952
  firmwareAppInput,