@bikefinder/staff-sdk 0.12.0 → 0.13.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 +9 -2
- package/dist/{chunk-TXAMHEXI.js → chunk-2RDQSYD5.js} +328 -4
- package/dist/index.d.ts +3569 -12
- package/dist/index.js +257 -9
- package/dist/schemas.d.ts +3313 -4
- package/dist/schemas.js +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,13 @@ Typed staff HTTP and WebSocket client for the [API](../../README.md). Version 0.
|
|
|
4
4
|
uses native oRPC contracts, Zod validation and async iterators. Customer apps use
|
|
5
5
|
[@bikefinder/sdk](../sdk/README.md). MCP invokes application workflows directly.
|
|
6
6
|
|
|
7
|
+
Version 0.13 adds compact tracker reads through `trackers.getDetails` and
|
|
8
|
+
`trackers.watchDetails`. Pass their `membership.revision` to
|
|
9
|
+
`trackers.members.list` and use `nextAfter` to continue. A revision conflict
|
|
10
|
+
means the roster changed or the tracker was recreated. Refresh the tracker
|
|
11
|
+
and start with its new membership revision. Deploy these API routes before
|
|
12
|
+
switching clients.
|
|
13
|
+
|
|
7
14
|
Version 0.12 returns the canonical bike, including its new revision, from
|
|
8
15
|
`client.api.trackers.bike.edit`. Bind the edit to the tracker resource with `trackerCreatedAt: tracker.createdAt`. Supply `expected` values for exactly the fields
|
|
9
16
|
in `changes`; the API compares them atomically and preserves unrelated edits.
|
|
@@ -15,8 +22,8 @@ Version 0.11 adds `client.api.accounts.erasure.review`, `submit`, `get` and
|
|
|
15
22
|
`retry`. Review the exact customer and retention policy with the requester before
|
|
16
23
|
submitting `confirmation: "ERASE CUSTOMER"` and the returned `reviewVersion`.
|
|
17
24
|
Keep the same request UUID across retries. `running` and `blocked` are incomplete;
|
|
18
|
-
`cleanupAfter`
|
|
19
|
-
|
|
25
|
+
`cleanupAfter` records when access preparation finished; deletion starts immediately
|
|
26
|
+
without an in-flight allowance. The active-account gate rejects existing tokens without waiting for expiry. See the
|
|
20
27
|
[erasure workflow](../../docs/customer-erasure.md).
|
|
21
28
|
|
|
22
29
|
```ts
|
|
@@ -242,6 +242,12 @@ var tracker = z2.object({
|
|
|
242
242
|
factoryResetReports: z2.boolean()
|
|
243
243
|
})
|
|
244
244
|
});
|
|
245
|
+
var customerTrackerDetails = tracker.omit({ members: true }).extend({
|
|
246
|
+
membership: z2.object({
|
|
247
|
+
accountId: z2.string(),
|
|
248
|
+
activeMemberCount: z2.int().nonnegative()
|
|
249
|
+
})
|
|
250
|
+
});
|
|
245
251
|
|
|
246
252
|
// ../../../accounts/packages/client/src/contracts.ts
|
|
247
253
|
import { z as z3 } from "zod";
|
|
@@ -294,7 +300,7 @@ var targetSchema = z3.strictObject({
|
|
|
294
300
|
var directoryIdentity = z3.strictObject({ accountId: documentId2, accountIds: z3.array(documentId2).min(1), email: z3.email(), emails: z3.array(z3.email()).min(1), directoryCreatedAt: z3.string().min(1) });
|
|
295
301
|
var cleanupRequest = z3.discriminatedUnion("action", [
|
|
296
302
|
z3.strictObject({ action: z3.literal("review"), identity: directoryIdentity }),
|
|
297
|
-
z3.strictObject({ action: z3.enum(["access", "
|
|
303
|
+
z3.strictObject({ action: z3.enum(["access", "firebase", "aws", "support_select", "commerce_subscriptions", "commerce_orders", "commerce_privacy", "commerce_customer"]), target: targetSchema }),
|
|
298
304
|
z3.strictObject({ action: z3.literal("support_delete"), contactIds: z3.array(z3.int().positive()) })
|
|
299
305
|
]);
|
|
300
306
|
var controlRequest = z3.discriminatedUnion("action", [
|
|
@@ -305,6 +311,7 @@ var controlRequest = z3.discriminatedUnion("action", [
|
|
|
305
311
|
]);
|
|
306
312
|
var failure = z3.strictObject({ status: z3.int().min(400).max(599), code: z3.string().regex(/^[a-z][a-z0-9_]{0,79}$/), message: z3.string().max(256) });
|
|
307
313
|
var completed = z3.strictObject({ completed: z3.literal(true) });
|
|
314
|
+
var batchCompletion = z3.strictObject({ completed: z3.boolean() });
|
|
308
315
|
|
|
309
316
|
// ../staff-contracts/src/erasure.ts
|
|
310
317
|
import { oc } from "@orpc/contract";
|
|
@@ -10407,6 +10414,190 @@ var observations_schema_default = {
|
|
|
10407
10414
|
"value"
|
|
10408
10415
|
],
|
|
10409
10416
|
additionalProperties: false
|
|
10417
|
+
},
|
|
10418
|
+
{
|
|
10419
|
+
type: "object",
|
|
10420
|
+
properties: {
|
|
10421
|
+
id: {
|
|
10422
|
+
$ref: "#/$defs/ObservationId",
|
|
10423
|
+
not: {
|
|
10424
|
+
const: "00000000000000000000000000000000"
|
|
10425
|
+
}
|
|
10426
|
+
},
|
|
10427
|
+
serialNumber: {
|
|
10428
|
+
type: "string",
|
|
10429
|
+
pattern: "^T[1-9][0-9A-HJKMNP-TV-Z]{6}$"
|
|
10430
|
+
},
|
|
10431
|
+
measuredAt: {
|
|
10432
|
+
type: "string",
|
|
10433
|
+
format: "date-time"
|
|
10434
|
+
},
|
|
10435
|
+
receivedAt: {
|
|
10436
|
+
type: "string",
|
|
10437
|
+
format: "date-time"
|
|
10438
|
+
},
|
|
10439
|
+
requestId: {
|
|
10440
|
+
anyOf: [
|
|
10441
|
+
{
|
|
10442
|
+
type: "integer",
|
|
10443
|
+
minimum: 1,
|
|
10444
|
+
maximum: 4294967295
|
|
10445
|
+
},
|
|
10446
|
+
{
|
|
10447
|
+
type: "null"
|
|
10448
|
+
}
|
|
10449
|
+
]
|
|
10450
|
+
},
|
|
10451
|
+
type: {
|
|
10452
|
+
const: "movement.accelerationChanged"
|
|
10453
|
+
},
|
|
10454
|
+
subject: {
|
|
10455
|
+
type: "null"
|
|
10456
|
+
},
|
|
10457
|
+
value: {
|
|
10458
|
+
type: "object",
|
|
10459
|
+
properties: {
|
|
10460
|
+
xMg: {
|
|
10461
|
+
type: "integer",
|
|
10462
|
+
minimum: -4e3,
|
|
10463
|
+
maximum: 4e3
|
|
10464
|
+
},
|
|
10465
|
+
yMg: {
|
|
10466
|
+
type: "integer",
|
|
10467
|
+
minimum: -4e3,
|
|
10468
|
+
maximum: 4e3
|
|
10469
|
+
},
|
|
10470
|
+
zMg: {
|
|
10471
|
+
type: "integer",
|
|
10472
|
+
minimum: -4e3,
|
|
10473
|
+
maximum: 4e3
|
|
10474
|
+
},
|
|
10475
|
+
changedAxes: {
|
|
10476
|
+
type: "integer",
|
|
10477
|
+
minimum: 1,
|
|
10478
|
+
maximum: 7
|
|
10479
|
+
}
|
|
10480
|
+
},
|
|
10481
|
+
required: [
|
|
10482
|
+
"xMg",
|
|
10483
|
+
"yMg",
|
|
10484
|
+
"zMg",
|
|
10485
|
+
"changedAxes"
|
|
10486
|
+
],
|
|
10487
|
+
additionalProperties: false
|
|
10488
|
+
}
|
|
10489
|
+
},
|
|
10490
|
+
required: [
|
|
10491
|
+
"id",
|
|
10492
|
+
"serialNumber",
|
|
10493
|
+
"measuredAt",
|
|
10494
|
+
"receivedAt",
|
|
10495
|
+
"requestId",
|
|
10496
|
+
"type",
|
|
10497
|
+
"subject",
|
|
10498
|
+
"value"
|
|
10499
|
+
],
|
|
10500
|
+
additionalProperties: false
|
|
10501
|
+
},
|
|
10502
|
+
{
|
|
10503
|
+
type: "object",
|
|
10504
|
+
properties: {
|
|
10505
|
+
id: {
|
|
10506
|
+
$ref: "#/$defs/ObservationId",
|
|
10507
|
+
not: {
|
|
10508
|
+
const: "00000000000000000000000000000000"
|
|
10509
|
+
}
|
|
10510
|
+
},
|
|
10511
|
+
serialNumber: {
|
|
10512
|
+
type: "string",
|
|
10513
|
+
pattern: "^T[1-9][0-9A-HJKMNP-TV-Z]{6}$"
|
|
10514
|
+
},
|
|
10515
|
+
measuredAt: {
|
|
10516
|
+
type: "string",
|
|
10517
|
+
format: "date-time"
|
|
10518
|
+
},
|
|
10519
|
+
receivedAt: {
|
|
10520
|
+
type: "string",
|
|
10521
|
+
format: "date-time"
|
|
10522
|
+
},
|
|
10523
|
+
requestId: {
|
|
10524
|
+
anyOf: [
|
|
10525
|
+
{
|
|
10526
|
+
type: "integer",
|
|
10527
|
+
minimum: 1,
|
|
10528
|
+
maximum: 4294967295
|
|
10529
|
+
},
|
|
10530
|
+
{
|
|
10531
|
+
type: "null"
|
|
10532
|
+
}
|
|
10533
|
+
]
|
|
10534
|
+
},
|
|
10535
|
+
type: {
|
|
10536
|
+
const: "battery.module.snapshot"
|
|
10537
|
+
},
|
|
10538
|
+
subject: {
|
|
10539
|
+
$ref: "#/$defs/ModuleSubject"
|
|
10540
|
+
},
|
|
10541
|
+
value: {
|
|
10542
|
+
type: "object",
|
|
10543
|
+
properties: {
|
|
10544
|
+
level: {
|
|
10545
|
+
type: "integer",
|
|
10546
|
+
minimum: 0,
|
|
10547
|
+
maximum: 100
|
|
10548
|
+
},
|
|
10549
|
+
voltageMv: {
|
|
10550
|
+
type: "integer",
|
|
10551
|
+
minimum: 0,
|
|
10552
|
+
maximum: 65535
|
|
10553
|
+
},
|
|
10554
|
+
currentMa: {
|
|
10555
|
+
type: "number",
|
|
10556
|
+
minimum: -3276.8,
|
|
10557
|
+
maximum: 3276.7
|
|
10558
|
+
},
|
|
10559
|
+
gaugeTemperatureC: {
|
|
10560
|
+
type: "integer",
|
|
10561
|
+
minimum: -128,
|
|
10562
|
+
maximum: 127
|
|
10563
|
+
},
|
|
10564
|
+
chargerState: {
|
|
10565
|
+
type: "string",
|
|
10566
|
+
enum: [
|
|
10567
|
+
"ready",
|
|
10568
|
+
"charging",
|
|
10569
|
+
"full",
|
|
10570
|
+
"fault"
|
|
10571
|
+
]
|
|
10572
|
+
},
|
|
10573
|
+
chargerFault: {
|
|
10574
|
+
type: "integer",
|
|
10575
|
+
minimum: 0,
|
|
10576
|
+
maximum: 7
|
|
10577
|
+
}
|
|
10578
|
+
},
|
|
10579
|
+
required: [
|
|
10580
|
+
"level",
|
|
10581
|
+
"voltageMv",
|
|
10582
|
+
"currentMa",
|
|
10583
|
+
"gaugeTemperatureC",
|
|
10584
|
+
"chargerState",
|
|
10585
|
+
"chargerFault"
|
|
10586
|
+
],
|
|
10587
|
+
additionalProperties: false
|
|
10588
|
+
}
|
|
10589
|
+
},
|
|
10590
|
+
required: [
|
|
10591
|
+
"id",
|
|
10592
|
+
"serialNumber",
|
|
10593
|
+
"measuredAt",
|
|
10594
|
+
"receivedAt",
|
|
10595
|
+
"requestId",
|
|
10596
|
+
"type",
|
|
10597
|
+
"subject",
|
|
10598
|
+
"value"
|
|
10599
|
+
],
|
|
10600
|
+
additionalProperties: false
|
|
10410
10601
|
}
|
|
10411
10602
|
]
|
|
10412
10603
|
},
|
|
@@ -11935,6 +12126,38 @@ var observations_schema_default = {
|
|
|
11935
12126
|
"subject"
|
|
11936
12127
|
],
|
|
11937
12128
|
additionalProperties: false
|
|
12129
|
+
},
|
|
12130
|
+
{
|
|
12131
|
+
type: "object",
|
|
12132
|
+
properties: {
|
|
12133
|
+
type: {
|
|
12134
|
+
const: "movement.accelerationChanged"
|
|
12135
|
+
},
|
|
12136
|
+
subject: {
|
|
12137
|
+
type: "null"
|
|
12138
|
+
}
|
|
12139
|
+
},
|
|
12140
|
+
required: [
|
|
12141
|
+
"type",
|
|
12142
|
+
"subject"
|
|
12143
|
+
],
|
|
12144
|
+
additionalProperties: false
|
|
12145
|
+
},
|
|
12146
|
+
{
|
|
12147
|
+
type: "object",
|
|
12148
|
+
properties: {
|
|
12149
|
+
type: {
|
|
12150
|
+
const: "battery.module.snapshot"
|
|
12151
|
+
},
|
|
12152
|
+
subject: {
|
|
12153
|
+
$ref: "#/$defs/ModuleSubject"
|
|
12154
|
+
}
|
|
12155
|
+
},
|
|
12156
|
+
required: [
|
|
12157
|
+
"type",
|
|
12158
|
+
"subject"
|
|
12159
|
+
],
|
|
12160
|
+
additionalProperties: false
|
|
11938
12161
|
}
|
|
11939
12162
|
]
|
|
11940
12163
|
}
|
|
@@ -12446,7 +12669,7 @@ var observationDefinitions = [
|
|
|
12446
12669
|
"requestScoped": false,
|
|
12447
12670
|
"presentation": {
|
|
12448
12671
|
"displayName": "Charging changed",
|
|
12449
|
-
"description": "
|
|
12672
|
+
"description": "Legacy charging transition retained for older firmware and stored history. New firmware reports battery.charging.status through diagnostics instead.",
|
|
12450
12673
|
"hiddenByDefault": true,
|
|
12451
12674
|
"formatter": "transition"
|
|
12452
12675
|
}
|
|
@@ -13338,7 +13561,7 @@ var observationDefinitions = [
|
|
|
13338
13561
|
"requestScoped": false,
|
|
13339
13562
|
"presentation": {
|
|
13340
13563
|
"displayName": "Power external power changed",
|
|
13341
|
-
"description": "
|
|
13564
|
+
"description": "Legacy external-power transition retained for older firmware and stored history. New firmware reports battery.externalPower at boot and on confirmed state changes instead.",
|
|
13342
13565
|
"hiddenByDefault": true,
|
|
13343
13566
|
"formatter": "transition"
|
|
13344
13567
|
}
|
|
@@ -14130,6 +14353,83 @@ var observationDefinitions = [
|
|
|
14130
14353
|
"description": "Full nRF9160 factory DEVICEID, encoded losslessly as 13 uppercase Crockford Base32 characters. The input bytes are the little-endian DEVICEID[0] word followed by little-endian DEVICEID[1], matching the physical flasher hardware ID. Captured once at startup; distinct from the assigned product serial.",
|
|
14131
14354
|
"hiddenByDefault": false
|
|
14132
14355
|
}
|
|
14356
|
+
},
|
|
14357
|
+
{
|
|
14358
|
+
"id": 185,
|
|
14359
|
+
"name": "movement.accelerationChanged",
|
|
14360
|
+
"role": "event",
|
|
14361
|
+
"subject": "device",
|
|
14362
|
+
"producer": "device",
|
|
14363
|
+
"requestScoped": false,
|
|
14364
|
+
"presentation": {
|
|
14365
|
+
"displayName": "Acceleration changed",
|
|
14366
|
+
"description": "Three-axis acceleration at the sample time. Bits 0, 1 and 2 identify the X, Y and Z axes that crossed the configured threshold.",
|
|
14367
|
+
"hiddenByDefault": false,
|
|
14368
|
+
"formatter": "fields",
|
|
14369
|
+
"fields": [
|
|
14370
|
+
{
|
|
14371
|
+
"path": "xMg",
|
|
14372
|
+
"unit": "mg"
|
|
14373
|
+
},
|
|
14374
|
+
{
|
|
14375
|
+
"path": "yMg",
|
|
14376
|
+
"unit": "mg"
|
|
14377
|
+
},
|
|
14378
|
+
{
|
|
14379
|
+
"path": "zMg",
|
|
14380
|
+
"unit": "mg"
|
|
14381
|
+
},
|
|
14382
|
+
{
|
|
14383
|
+
"path": "changedAxes"
|
|
14384
|
+
}
|
|
14385
|
+
]
|
|
14386
|
+
}
|
|
14387
|
+
},
|
|
14388
|
+
{
|
|
14389
|
+
"id": 186,
|
|
14390
|
+
"name": "battery.module.snapshot",
|
|
14391
|
+
"role": "measurement",
|
|
14392
|
+
"subject": "batteryModule",
|
|
14393
|
+
"producer": "device",
|
|
14394
|
+
"requestScoped": false,
|
|
14395
|
+
"presentation": {
|
|
14396
|
+
"displayName": "Battery module snapshot",
|
|
14397
|
+
"description": "Level, voltage, signed current, gauge temperature and charger state/fault from one complete validated module sample. MeasuredAt is the original sample time; gauge temperature is not necessarily cell temperature. The module identity is the observation subject. Raw thermistor ADC, guard internals, settings and registers remain separate diagnostics.",
|
|
14398
|
+
"hiddenByDefault": false,
|
|
14399
|
+
"formatter": "fields",
|
|
14400
|
+
"fields": [
|
|
14401
|
+
{
|
|
14402
|
+
"path": "level",
|
|
14403
|
+
"label": "Level",
|
|
14404
|
+
"unit": "%"
|
|
14405
|
+
},
|
|
14406
|
+
{
|
|
14407
|
+
"path": "voltageMv",
|
|
14408
|
+
"label": "Voltage",
|
|
14409
|
+
"unit": "mV"
|
|
14410
|
+
},
|
|
14411
|
+
{
|
|
14412
|
+
"path": "currentMa",
|
|
14413
|
+
"label": "Current",
|
|
14414
|
+
"unit": "mA",
|
|
14415
|
+
"precision": 1
|
|
14416
|
+
},
|
|
14417
|
+
{
|
|
14418
|
+
"path": "gaugeTemperatureC",
|
|
14419
|
+
"label": "Gauge temperature",
|
|
14420
|
+
"unit": "\xB0C"
|
|
14421
|
+
},
|
|
14422
|
+
{
|
|
14423
|
+
"path": "chargerState",
|
|
14424
|
+
"label": "Charger",
|
|
14425
|
+
"format": "label"
|
|
14426
|
+
},
|
|
14427
|
+
{
|
|
14428
|
+
"path": "chargerFault",
|
|
14429
|
+
"label": "Fault"
|
|
14430
|
+
}
|
|
14431
|
+
]
|
|
14432
|
+
}
|
|
14133
14433
|
}
|
|
14134
14434
|
];
|
|
14135
14435
|
|
|
@@ -14284,7 +14584,9 @@ var zDeviceSettings = z18.object({
|
|
|
14284
14584
|
wifiScanBudgetMs: z18.int().gte(100).lte(6e4).optional(),
|
|
14285
14585
|
wifiScanType: z18.enum(["active", "passive"]).optional(),
|
|
14286
14586
|
chargingStatusMaxAgeSeconds: z18.int().gte(30).lte(86400).optional(),
|
|
14287
|
-
reportIntervalOnBatterySeconds: z18.int().gte(0).lte(86400).optional()
|
|
14587
|
+
reportIntervalOnBatterySeconds: z18.int().gte(0).lte(86400).optional(),
|
|
14588
|
+
accelerationSamplingEnabled: z18.boolean().optional(),
|
|
14589
|
+
accelerationChangePercent: z18.int().gte(1).lte(100).optional()
|
|
14288
14590
|
}).strict();
|
|
14289
14591
|
|
|
14290
14592
|
// ../../../connectivity/packages/configuration-contracts/index.ts
|
|
@@ -15409,6 +15711,21 @@ var staffTracker = z32.object({
|
|
|
15409
15711
|
isBlacklisted: z32.boolean().nullable()
|
|
15410
15712
|
}).nullable()
|
|
15411
15713
|
});
|
|
15714
|
+
var staffTrackerDetails = staffTracker.omit({ members: true }).extend({
|
|
15715
|
+
membership: z32.object({
|
|
15716
|
+
revision: z32.string(),
|
|
15717
|
+
memberCount: z32.int().nonnegative()
|
|
15718
|
+
})
|
|
15719
|
+
});
|
|
15720
|
+
var staffTrackerMemberPageInput = trackerInput.extend({
|
|
15721
|
+
revision: z32.string().regex(/^[0-9a-f]{64}$/),
|
|
15722
|
+
after: z32.string().min(1).optional(),
|
|
15723
|
+
limit: z32.int().min(1).max(100).default(50)
|
|
15724
|
+
});
|
|
15725
|
+
var staffTrackerMemberPage = z32.object({
|
|
15726
|
+
items: z32.array(trackerMember.extend({ accountId: z32.string() })),
|
|
15727
|
+
nextAfter: z32.string().nullable()
|
|
15728
|
+
});
|
|
15412
15729
|
|
|
15413
15730
|
// ../staff-contracts/src/gcp/diagnostics.ts
|
|
15414
15731
|
import { oc as oc22, eventIterator as eventIterator6 } from "@orpc/contract";
|
|
@@ -16178,9 +16495,12 @@ var trackerContract = {
|
|
|
16178
16495
|
...trackerChangeContract,
|
|
16179
16496
|
members: {
|
|
16180
16497
|
...trackerChangeContract.members,
|
|
16498
|
+
list: oc32.meta({ operation: "read" }).errors(apiErrors).input(staffTrackerMemberPageInput).output(staffTrackerMemberPage),
|
|
16181
16499
|
add: oc32.errors(apiErrors).input(trackerMemberAddInput).output(z44.void())
|
|
16182
16500
|
},
|
|
16183
16501
|
list: oc32.meta({ operation: "read" }).errors(apiErrors).input(staffTrackerPageInput).output(staffTrackerPage),
|
|
16502
|
+
getDetails: procedure4.meta({ operation: "read" }).output(staffTrackerDetails),
|
|
16503
|
+
watchDetails: procedure4.meta({ operation: "read" }).output(eventIterator7(staffTrackerDetails)),
|
|
16184
16504
|
get: procedure4.meta({ operation: "read" }).output(staffTracker),
|
|
16185
16505
|
watch: procedure4.meta({ operation: "read" }).output(eventIterator7(staffTracker))
|
|
16186
16506
|
};
|
|
@@ -16211,6 +16531,7 @@ export {
|
|
|
16211
16531
|
trackerSummary,
|
|
16212
16532
|
trackerPage,
|
|
16213
16533
|
tracker,
|
|
16534
|
+
customerTrackerDetails,
|
|
16214
16535
|
erasureSelection,
|
|
16215
16536
|
erasureReference,
|
|
16216
16537
|
erasurePolicy,
|
|
@@ -16301,6 +16622,9 @@ export {
|
|
|
16301
16622
|
staffTrackerSummary,
|
|
16302
16623
|
staffTrackerPage,
|
|
16303
16624
|
staffTracker,
|
|
16625
|
+
staffTrackerDetails,
|
|
16626
|
+
staffTrackerMemberPageInput,
|
|
16627
|
+
staffTrackerMemberPage,
|
|
16304
16628
|
trackerBatteryDiagnostics,
|
|
16305
16629
|
trackerLatestReport,
|
|
16306
16630
|
trackerStatistics,
|