@bikefinder/sdk 0.11.0 → 0.12.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.
@@ -1771,27 +1771,6 @@ export const zCurrentObservationControllerWakeCountsCurrent = z
1771
1771
  .nullish(),
1772
1772
  })
1773
1773
  .catchall(z.unknown());
1774
- export const zCurrentObservationDeviceBuildFingerprintCurrent = z
1775
- .object({
1776
- type: z.enum(["device.buildFingerprint"]),
1777
- value: z
1778
- .string()
1779
- .min(1)
1780
- .max(256)
1781
- .regex(/^[ -~]*$/),
1782
- deviceId: z.string(),
1783
- sourceObservationId: z.string(),
1784
- measuredAt: z.iso.datetime({ offset: true }),
1785
- receivedAt: z.iso.datetime({ offset: true }),
1786
- requestId: z
1787
- .int()
1788
- .min(0, { error: "Invalid value: Expected uint32 to be >= 0" })
1789
- .max(4294967295, {
1790
- error: "Invalid value: Expected uint32 to be <= 4294967295",
1791
- })
1792
- .nullish(),
1793
- })
1794
- .catchall(z.unknown());
1795
1774
  export const zCurrentObservationDeviceDiagnosticEventCurrent = z
1796
1775
  .object({
1797
1776
  type: z.enum(["device.diagnosticEvent"]),
@@ -2953,6 +2932,57 @@ export const zCurrentObservationPowerGnssMsCurrent = z
2953
2932
  .nullish(),
2954
2933
  })
2955
2934
  .catchall(z.unknown());
2935
+ export const zCurrentObservationPowerIdleStateCurrent = z
2936
+ .object({
2937
+ type: z.enum(["power.idleState"]),
2938
+ value: z
2939
+ .object({
2940
+ waitBoundMs: z.int().gte(0).lte(4294967295),
2941
+ boundaryCount: z.int().gte(0).lte(4294967295),
2942
+ uartState: z.enum([
2943
+ "unknown",
2944
+ "active",
2945
+ "suspended",
2946
+ "off",
2947
+ "suspending",
2948
+ ]),
2949
+ uartUsage: z.int().gte(-2147483648).lte(2147483647),
2950
+ uartEnabled: z.boolean(),
2951
+ uartBusy: z.boolean(),
2952
+ i2cState: z.enum([
2953
+ "unknown",
2954
+ "active",
2955
+ "suspended",
2956
+ "off",
2957
+ "suspending",
2958
+ ]),
2959
+ i2cUsage: z.int().gte(-2147483648).lte(2147483647),
2960
+ i2cEnabled: z.boolean(),
2961
+ hfClockDriverState: z.int().gte(0).lte(3),
2962
+ gpioInputs: z.int().gte(0).lte(4294967295),
2963
+ gpioOutputs: z.int().gte(0).lte(4294967295),
2964
+ gpioOutputEnable: z.int().gte(0).lte(4294967295),
2965
+ gpioPullUps: z.int().gte(0).lte(4294967295),
2966
+ gpioPullDowns: z.int().gte(0).lte(4294967295),
2967
+ gpioInputEnable: z.int().gte(0).lte(4294967295),
2968
+ gpioteEventPins: z.int().gte(0).lte(4294967295),
2969
+ batteryReadyMask: z.int().gte(0).lte(4294967295),
2970
+ gaugeVoltageModeMask: z.int().gte(0).lte(4294967295),
2971
+ })
2972
+ .catchall(z.unknown()),
2973
+ deviceId: z.string(),
2974
+ sourceObservationId: z.string(),
2975
+ measuredAt: z.iso.datetime({ offset: true }),
2976
+ receivedAt: z.iso.datetime({ offset: true }),
2977
+ requestId: z
2978
+ .int()
2979
+ .min(0, { error: "Invalid value: Expected uint32 to be >= 0" })
2980
+ .max(4294967295, {
2981
+ error: "Invalid value: Expected uint32 to be <= 4294967295",
2982
+ })
2983
+ .nullish(),
2984
+ })
2985
+ .catchall(z.unknown());
2956
2986
  export const zCurrentObservationPowerMqttEntriesCurrent = z
2957
2987
  .object({
2958
2988
  type: z.enum(["power.mqttEntries"]),
@@ -5271,9 +5301,6 @@ export const zCurrentObservation = z.discriminatedUnion("type", [
5271
5301
  zCurrentObservationConnectionTxPayloadBytesCurrent.extend({
5272
5302
  type: z.literal("connection.txPayloadBytes"),
5273
5303
  }),
5274
- zCurrentObservationDeviceBuildFingerprintCurrent.extend({
5275
- type: z.literal("device.buildFingerprint"),
5276
- }),
5277
5304
  zCurrentObservationDeviceDiagnosticEventCurrent.extend({
5278
5305
  type: z.literal("device.diagnosticEvent"),
5279
5306
  }),
@@ -5592,6 +5619,9 @@ export const zCurrentObservation = z.discriminatedUnion("type", [
5592
5619
  zCurrentObservationDiagnosticsStreamCompletedCurrent.extend({
5593
5620
  type: z.literal("diagnostics.streamCompleted"),
5594
5621
  }),
5622
+ zCurrentObservationPowerIdleStateCurrent.extend({
5623
+ type: z.literal("power.idleState"),
5624
+ }),
5595
5625
  ]);
5596
5626
  export const zDeviceObservationValues = z
5597
5627
  .object({
@@ -5870,12 +5900,6 @@ export const zDeviceObservationValues = z
5870
5900
  "connection.totalDnsMs": z.int().gte(0).lte(4294967295).optional(),
5871
5901
  "connection.totalReportMs": z.int().gte(0).lte(4294967295).optional(),
5872
5902
  "connection.txPayloadBytes": z.int().gte(0).lte(4294967295).optional(),
5873
- "device.buildFingerprint": z
5874
- .string()
5875
- .min(1)
5876
- .max(256)
5877
- .regex(/^[ -~]*$/)
5878
- .optional(),
5879
5903
  "device.diagnosticEvent": z
5880
5904
  .object({
5881
5905
  code: z.int().gte(0).lte(65535),
@@ -6366,6 +6390,42 @@ export const zDeviceObservationValues = z
6366
6390
  })
6367
6391
  .catchall(z.unknown())
6368
6392
  .optional(),
6393
+ "power.idleState": z
6394
+ .object({
6395
+ waitBoundMs: z.int().gte(0).lte(4294967295),
6396
+ boundaryCount: z.int().gte(0).lte(4294967295),
6397
+ uartState: z.enum([
6398
+ "unknown",
6399
+ "active",
6400
+ "suspended",
6401
+ "off",
6402
+ "suspending",
6403
+ ]),
6404
+ uartUsage: z.int().gte(-2147483648).lte(2147483647),
6405
+ uartEnabled: z.boolean(),
6406
+ uartBusy: z.boolean(),
6407
+ i2cState: z.enum([
6408
+ "unknown",
6409
+ "active",
6410
+ "suspended",
6411
+ "off",
6412
+ "suspending",
6413
+ ]),
6414
+ i2cUsage: z.int().gte(-2147483648).lte(2147483647),
6415
+ i2cEnabled: z.boolean(),
6416
+ hfClockDriverState: z.int().gte(0).lte(3),
6417
+ gpioInputs: z.int().gte(0).lte(4294967295),
6418
+ gpioOutputs: z.int().gte(0).lte(4294967295),
6419
+ gpioOutputEnable: z.int().gte(0).lte(4294967295),
6420
+ gpioPullUps: z.int().gte(0).lte(4294967295),
6421
+ gpioPullDowns: z.int().gte(0).lte(4294967295),
6422
+ gpioInputEnable: z.int().gte(0).lte(4294967295),
6423
+ gpioteEventPins: z.int().gte(0).lte(4294967295),
6424
+ batteryReadyMask: z.int().gte(0).lte(4294967295),
6425
+ gaugeVoltageModeMask: z.int().gte(0).lte(4294967295),
6426
+ })
6427
+ .catchall(z.unknown())
6428
+ .optional(),
6369
6429
  })
6370
6430
  .catchall(z.unknown());
6371
6431
  /**
@@ -8726,28 +8786,6 @@ export const zObservationControllerWakeCountsObservation = z
8726
8786
  .nullish(),
8727
8787
  })
8728
8788
  .catchall(z.unknown());
8729
- export const zObservationDeviceBuildFingerprintObservation = z
8730
- .object({
8731
- type: z.enum(["device.buildFingerprint"]),
8732
- value: z
8733
- .string()
8734
- .min(1)
8735
- .max(256)
8736
- .regex(/^[ -~]*$/),
8737
- deviceId: z.string(),
8738
- observationId: z.string(),
8739
- receivedAt: z.iso.datetime({ offset: true }),
8740
- ageMs: z.int().gte(0).lte(9007199254740991),
8741
- measuredAt: z.iso.datetime({ offset: true }),
8742
- requestId: z
8743
- .int()
8744
- .min(0, { error: "Invalid value: Expected uint32 to be >= 0" })
8745
- .max(4294967295, {
8746
- error: "Invalid value: Expected uint32 to be <= 4294967295",
8747
- })
8748
- .nullish(),
8749
- })
8750
- .catchall(z.unknown());
8751
8789
  export const zObservationDeviceDiagnosticEventObservation = z
8752
8790
  .object({
8753
8791
  type: z.enum(["device.diagnosticEvent"]),
@@ -10274,6 +10312,58 @@ export const zObservationPowerGnssMsObservation = z
10274
10312
  .nullish(),
10275
10313
  })
10276
10314
  .catchall(z.unknown());
10315
+ export const zObservationPowerIdleStateObservation = z
10316
+ .object({
10317
+ type: z.enum(["power.idleState"]),
10318
+ value: z
10319
+ .object({
10320
+ waitBoundMs: z.int().gte(0).lte(4294967295),
10321
+ boundaryCount: z.int().gte(0).lte(4294967295),
10322
+ uartState: z.enum([
10323
+ "unknown",
10324
+ "active",
10325
+ "suspended",
10326
+ "off",
10327
+ "suspending",
10328
+ ]),
10329
+ uartUsage: z.int().gte(-2147483648).lte(2147483647),
10330
+ uartEnabled: z.boolean(),
10331
+ uartBusy: z.boolean(),
10332
+ i2cState: z.enum([
10333
+ "unknown",
10334
+ "active",
10335
+ "suspended",
10336
+ "off",
10337
+ "suspending",
10338
+ ]),
10339
+ i2cUsage: z.int().gte(-2147483648).lte(2147483647),
10340
+ i2cEnabled: z.boolean(),
10341
+ hfClockDriverState: z.int().gte(0).lte(3),
10342
+ gpioInputs: z.int().gte(0).lte(4294967295),
10343
+ gpioOutputs: z.int().gte(0).lte(4294967295),
10344
+ gpioOutputEnable: z.int().gte(0).lte(4294967295),
10345
+ gpioPullUps: z.int().gte(0).lte(4294967295),
10346
+ gpioPullDowns: z.int().gte(0).lte(4294967295),
10347
+ gpioInputEnable: z.int().gte(0).lte(4294967295),
10348
+ gpioteEventPins: z.int().gte(0).lte(4294967295),
10349
+ batteryReadyMask: z.int().gte(0).lte(4294967295),
10350
+ gaugeVoltageModeMask: z.int().gte(0).lte(4294967295),
10351
+ })
10352
+ .catchall(z.unknown()),
10353
+ deviceId: z.string(),
10354
+ observationId: z.string(),
10355
+ receivedAt: z.iso.datetime({ offset: true }),
10356
+ ageMs: z.int().gte(0).lte(9007199254740991),
10357
+ measuredAt: z.iso.datetime({ offset: true }),
10358
+ requestId: z
10359
+ .int()
10360
+ .min(0, { error: "Invalid value: Expected uint32 to be >= 0" })
10361
+ .max(4294967295, {
10362
+ error: "Invalid value: Expected uint32 to be <= 4294967295",
10363
+ })
10364
+ .nullish(),
10365
+ })
10366
+ .catchall(z.unknown());
10277
10367
  export const zObservationPowerMqttEntriesObservation = z
10278
10368
  .object({
10279
10369
  type: z.enum(["power.mqttEntries"]),
@@ -10711,9 +10801,6 @@ export const zObservation = z.discriminatedUnion("type", [
10711
10801
  zObservationConnectionTxPayloadBytesObservation.extend({
10712
10802
  type: z.literal("connection.txPayloadBytes"),
10713
10803
  }),
10714
- zObservationDeviceBuildFingerprintObservation.extend({
10715
- type: z.literal("device.buildFingerprint"),
10716
- }),
10717
10804
  zObservationDeviceDiagnosticEventObservation.extend({
10718
10805
  type: z.literal("device.diagnosticEvent"),
10719
10806
  }),
@@ -11020,6 +11107,9 @@ export const zObservation = z.discriminatedUnion("type", [
11020
11107
  zObservationDiagnosticsStreamCompletedObservation.extend({
11021
11108
  type: z.literal("diagnostics.streamCompleted"),
11022
11109
  }),
11110
+ zObservationPowerIdleStateObservation.extend({
11111
+ type: z.literal("power.idleState"),
11112
+ }),
11023
11113
  ]);
11024
11114
  export const zObservationPage = z
11025
11115
  .object({
@@ -11202,6 +11292,48 @@ export const zPowerActivitiesValueItem = z.enum([
11202
11292
  "bleScan",
11203
11293
  "gnss",
11204
11294
  ]);
11295
+ /**
11296
+ * Last controller idle boundary
11297
+ *
11298
+ * Snapshot taken before the last nonzero controller wait, with its original evidence time. Device PM states and usage counts, UART/I2C enable bits, GPIO configuration, dedicated GPIOTE event pins, and battery configuration-owner masks are passive reads. The HF clock field is the Zephyr clock driver status (0 starting, 1 off, 2 on, 3 unknown), not a measurement of all hardware clock consumers. This is a boundary sample, not proof of continuous sleep or measured energy. No polling timer or automatic publication is added.
11299
+ */
11300
+ export const zPowerIdleStateValue = z
11301
+ .object({
11302
+ waitBoundMs: z.int().gte(0).lte(4294967295),
11303
+ boundaryCount: z.int().gte(0).lte(4294967295),
11304
+ uartState: z.enum(["unknown", "active", "suspended", "off", "suspending"]),
11305
+ uartUsage: z.int().gte(-2147483648).lte(2147483647),
11306
+ uartEnabled: z.boolean(),
11307
+ uartBusy: z.boolean(),
11308
+ i2cState: z.enum(["unknown", "active", "suspended", "off", "suspending"]),
11309
+ i2cUsage: z.int().gte(-2147483648).lte(2147483647),
11310
+ i2cEnabled: z.boolean(),
11311
+ hfClockDriverState: z.int().gte(0).lte(3),
11312
+ gpioInputs: z.int().gte(0).lte(4294967295),
11313
+ gpioOutputs: z.int().gte(0).lte(4294967295),
11314
+ gpioOutputEnable: z.int().gte(0).lte(4294967295),
11315
+ gpioPullUps: z.int().gte(0).lte(4294967295),
11316
+ gpioPullDowns: z.int().gte(0).lte(4294967295),
11317
+ gpioInputEnable: z.int().gte(0).lte(4294967295),
11318
+ gpioteEventPins: z.int().gte(0).lte(4294967295),
11319
+ batteryReadyMask: z.int().gte(0).lte(4294967295),
11320
+ gaugeVoltageModeMask: z.int().gte(0).lte(4294967295),
11321
+ })
11322
+ .catchall(z.unknown());
11323
+ export const zPowerIdleStateValueI2cState = z.enum([
11324
+ "unknown",
11325
+ "active",
11326
+ "suspended",
11327
+ "off",
11328
+ "suspending",
11329
+ ]);
11330
+ export const zPowerIdleStateValueUartState = z.enum([
11331
+ "unknown",
11332
+ "active",
11333
+ "suspended",
11334
+ "off",
11335
+ "suspending",
11336
+ ]);
11205
11337
  export const zPreferenceMapStyle = z.enum(["minimal", "satellite"]);
11206
11338
  export const zPreferencePatch = z
11207
11339
  .object({
@@ -11476,7 +11608,6 @@ export const zSubmitCommandRequest = z.union([
11476
11608
  z.literal(44),
11477
11609
  z.literal(45),
11478
11610
  z.literal(46),
11479
- z.literal(48),
11480
11611
  z.literal(49),
11481
11612
  z.literal(50),
11482
11613
  z.literal(52),
@@ -11572,6 +11703,7 @@ export const zSubmitCommandRequest = z.union([
11572
11703
  z.literal(164),
11573
11704
  z.literal(165),
11574
11705
  z.literal(166),
11706
+ z.literal(176),
11575
11707
  ]))
11576
11708
  .min(1)
11577
11709
  .max(32),
@@ -11684,7 +11816,6 @@ export const zSubmitCommandRequest = z.union([
11684
11816
  z.literal(44),
11685
11817
  z.literal(45),
11686
11818
  z.literal(46),
11687
- z.literal(48),
11688
11819
  z.literal(49),
11689
11820
  z.literal(50),
11690
11821
  z.literal(52),
@@ -11780,6 +11911,7 @@ export const zSubmitCommandRequest = z.union([
11780
11911
  z.literal(164),
11781
11912
  z.literal(165),
11782
11913
  z.literal(166),
11914
+ z.literal(176),
11783
11915
  ]))
11784
11916
  .min(1)
11785
11917
  .max(32),
package/dist/index.js CHANGED
@@ -40,10 +40,11 @@ export function createBikeFinderClient(options) {
40
40
  const connection = (path) => new HubConnectionBuilder()
41
41
  .withUrl(origin.origin + path, {
42
42
  transport: HttpTransportType.WebSockets,
43
- skipNegotiation: true,
44
- withCredentials: false,
43
+ // Negotiation enables stateful reconnect; cookies retain task affinity.
44
+ withCredentials: true,
45
45
  accessTokenFactory: getToken,
46
46
  })
47
+ .withStatefulReconnect()
47
48
  .withAutomaticReconnect()
48
49
  .configureLogging(LogLevel.None)
49
50
  .build();