@bikefinder/staff-sdk 0.4.0 → 0.9.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/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  acquisitionOptions,
3
+ apiContractVersion,
3
4
  articleCandidate,
4
5
  auditContract,
5
6
  auditEntry,
@@ -9,7 +10,7 @@ import {
9
10
  batteryFirmwareInput,
10
11
  billingContract,
11
12
  billingReview,
12
- commandCatalog,
13
+ catalogFirmwareVersion,
13
14
  commandDefinitions,
14
15
  commandErrors,
15
16
  commandEventsInput,
@@ -36,6 +37,8 @@ import {
36
37
  currentObservation,
37
38
  denylistInput,
38
39
  deviceConnectivity,
40
+ deviceInput,
41
+ deviceLookupInput,
39
42
  diagnosticsContract,
40
43
  favorite,
41
44
  favoriteContract,
@@ -43,6 +46,13 @@ import {
43
46
  favoritePage,
44
47
  favoriteWrite,
45
48
  firmwareCancellationInput,
49
+ firmwareCatalogCapability,
50
+ firmwareCatalogContract,
51
+ firmwareCatalogFamily,
52
+ firmwareCatalogInput,
53
+ firmwareCatalogPublishInput,
54
+ firmwareCatalogRelease,
55
+ firmwareCatalogUploadInput,
46
56
  firmwareChip,
47
57
  firmwareExecution,
48
58
  firmwareOperationInput,
@@ -65,12 +75,13 @@ import {
65
75
  maintenanceContract,
66
76
  maintenanceInput,
67
77
  maintenanceOperation,
78
+ maximumFirmwareUploadBytes,
68
79
  moneyAmount,
69
- observation,
70
80
  observationEventsInput,
71
81
  observationHistoryInput,
72
82
  observationPage,
73
83
  observationReadInput,
84
+ observationResponse,
74
85
  observationSelectionInput,
75
86
  observationSeries,
76
87
  operationExecution,
@@ -88,7 +99,6 @@ import {
88
99
  staffAccountContract,
89
100
  staffAccountEmail,
90
101
  staffAccountInput,
91
- staffAccountSelection,
92
102
  staffCommandContract,
93
103
  staffConnectivityContract,
94
104
  staffContract,
@@ -127,9 +137,9 @@ import {
127
137
  trackerLatestReport,
128
138
  trackerStatistics,
129
139
  zDeviceSettings
130
- } from "./chunk-5QW6N6JG.js";
140
+ } from "./chunk-HF2DYHDY.js";
131
141
 
132
- // ../../src/Client/client.ts
142
+ // ../../src/client/client.ts
133
143
  import { createORPCClient, DynamicLink } from "@orpc/client";
134
144
  import { RPCLink as HttpLink } from "@orpc/client/fetch";
135
145
  import { RPCLink as WebSocketLink } from "@orpc/client/websocket";
@@ -160,6 +170,7 @@ function createApiClient(contract, audience, options) {
160
170
  const base = endpoint(options.baseUrl, "http");
161
171
  base.pathname = `${base.pathname.replace(/\/+$/, "")}/rpc`;
162
172
  const lifetime = new AbortController();
173
+ let disposed = false;
163
174
  const root = { [audience]: contract };
164
175
  function linkOptions() {
165
176
  return {
@@ -200,12 +211,13 @@ function createApiClient(contract, audience, options) {
200
211
  function websocket() {
201
212
  if (realtime) return realtime;
202
213
  options.onConnectionStateChange?.("connecting");
214
+ lifetime.signal.throwIfAborted();
203
215
  let opened = false;
204
216
  socket = new ReconnectingWebSocket(
205
217
  async () => {
206
218
  ticketError = void 0;
207
219
  const result = await tickets.ticket().catch((error) => {
208
- if (error instanceof Error) {
220
+ if (error instanceof Error && !disposed) {
209
221
  ticketError = error;
210
222
  options.onConnectionError?.(error);
211
223
  }
@@ -221,14 +233,13 @@ function createApiClient(contract, audience, options) {
221
233
  );
222
234
  const connection = socket;
223
235
  connection.addEventListener("open", () => {
236
+ if (disposed) return;
224
237
  options.onConnectionStateChange?.("connected");
225
- if (opened) options.onReconnect?.();
238
+ if (opened && !disposed) options.onReconnect?.();
226
239
  opened = true;
227
240
  });
228
241
  connection.addEventListener("close", () => {
229
- options.onConnectionStateChange?.(
230
- lifetime.signal.aborted ? "closed" : "reconnecting"
231
- );
242
+ if (!disposed) options.onConnectionStateChange?.("reconnecting");
232
243
  });
233
244
  connection.addEventListener("message", (event) => {
234
245
  let decoded;
@@ -282,6 +293,8 @@ function createApiClient(contract, audience, options) {
282
293
  return {
283
294
  api,
284
295
  dispose() {
296
+ if (disposed) return;
297
+ disposed = true;
285
298
  socket?.close(1e3, "Client disposed.");
286
299
  lifetime.abort(new DOMException("Client disposed.", "AbortError"));
287
300
  options.onConnectionStateChange?.("closed");
@@ -562,7 +575,7 @@ var observationValueSchema = {
562
575
  "type": "string",
563
576
  "minLength": 1,
564
577
  "maxLength": 23,
565
- "pattern": "^(slot:[0-7]|msp430:[0-9a-f]{16})$"
578
+ "pattern": "^(slot:[0-7]|ffffffffffffff0[0-7]|(?:msp430:)?(?!0000000000000000|ffffffffffffff)[0-9a-f]{16})$"
566
579
  },
567
580
  "Version": {
568
581
  "type": "string",
@@ -809,7 +822,7 @@ var observationValueSchema = {
809
822
  "type": "string",
810
823
  "minLength": 1,
811
824
  "maxLength": 23,
812
- "pattern": "^msp430:[0-9a-f]{16}$"
825
+ "pattern": "^(?:msp430:)?(?!0000000000000000|ffffffffffffff)[0-9a-f]{16}$"
813
826
  },
814
827
  {
815
828
  "type": "null"
@@ -7100,6 +7113,50 @@ var observationValueSchema = {
7100
7113
  "type": "integer",
7101
7114
  "minimum": 0,
7102
7115
  "maximum": 4294967295
7116
+ },
7117
+ "journalPageErases": {
7118
+ "type": "object",
7119
+ "properties": {
7120
+ "pageF8000": {
7121
+ "type": "integer",
7122
+ "minimum": 0,
7123
+ "maximum": 4294967295
7124
+ },
7125
+ "pageF9000": {
7126
+ "type": "integer",
7127
+ "minimum": 0,
7128
+ "maximum": 4294967295
7129
+ },
7130
+ "pageFA000": {
7131
+ "type": "integer",
7132
+ "minimum": 0,
7133
+ "maximum": 4294967295
7134
+ },
7135
+ "pageFB000": {
7136
+ "type": "integer",
7137
+ "minimum": 0,
7138
+ "maximum": 4294967295
7139
+ },
7140
+ "pageFC000": {
7141
+ "type": "integer",
7142
+ "minimum": 0,
7143
+ "maximum": 4294967295
7144
+ },
7145
+ "pageFD000": {
7146
+ "type": "integer",
7147
+ "minimum": 0,
7148
+ "maximum": 4294967295
7149
+ }
7150
+ },
7151
+ "required": [
7152
+ "pageF8000",
7153
+ "pageF9000",
7154
+ "pageFA000",
7155
+ "pageFB000",
7156
+ "pageFC000",
7157
+ "pageFD000"
7158
+ ],
7159
+ "additionalProperties": false
7103
7160
  }
7104
7161
  },
7105
7162
  "required": [
@@ -7115,11 +7172,12 @@ var observationValueSchema = {
7115
7172
  "settingsJournalBytesWritten",
7116
7173
  "settingsJournalPagesErased",
7117
7174
  "writeCalls",
7118
- "writeErrors"
7175
+ "writeErrors",
7176
+ "journalPageErases"
7119
7177
  ],
7120
7178
  "additionalProperties": false,
7121
7179
  "title": "flash.statistics",
7122
- "description": "One passive RAM snapshot of since-boot flash accounting. Successful driver-request bytes and pages include metadata and garbage collection; failed operations may have partial physical effects. The saturated flag applies to all counters. Reading this snapshot performs no flash I/O.",
7180
+ "description": "One passive RAM snapshot of since-boot flash accounting. Successful driver-request bytes and pages include metadata and garbage collection; failed operations may have partial physical effects. journalPageErases names each 4 KiB page by its starting address: 0xF8000, 0xF9000, 0xFA000 (settings), then 0xFB000, 0xFC000, 0xFD000 (connection). The saturated flag applies to all counters. Reading this snapshot performs no flash I/O.",
7123
7181
  "x-bf": {
7124
7182
  "definitionId": 180,
7125
7183
  "role": "measurement",
@@ -7128,27 +7186,27 @@ var observationValueSchema = {
7128
7186
  "requestScoped": false,
7129
7187
  "presentation": {
7130
7188
  "displayName": "flash.statistics",
7131
- "description": "One passive RAM snapshot of since-boot flash accounting. Successful driver-request bytes and pages include metadata and garbage collection; failed operations may have partial physical effects. The saturated flag applies to all counters. Reading this snapshot performs no flash I/O.",
7189
+ "description": "One passive RAM snapshot of since-boot flash accounting. Successful driver-request bytes and pages include metadata and garbage collection; failed operations may have partial physical effects. journalPageErases names each 4 KiB page by its starting address: 0xF8000, 0xF9000, 0xFA000 (settings), then 0xFB000, 0xFC000, 0xFD000 (connection). The saturated flag applies to all counters. Reading this snapshot performs no flash I/O.",
7132
7190
  "hiddenByDefault": true,
7133
7191
  "formatter": "fields",
7134
7192
  "fields": [
7135
7193
  {
7136
- "path": "bytesWritten"
7194
+ "path": "journalPageErases.pageF8000"
7137
7195
  },
7138
7196
  {
7139
- "path": "connectionJournalBytesWritten"
7197
+ "path": "journalPageErases.pageF9000"
7140
7198
  },
7141
7199
  {
7142
- "path": "connectionJournalPagesErased"
7200
+ "path": "journalPageErases.pageFA000"
7143
7201
  },
7144
7202
  {
7145
- "path": "eraseCalls"
7203
+ "path": "journalPageErases.pageFB000"
7146
7204
  },
7147
7205
  {
7148
- "path": "eraseErrors"
7206
+ "path": "journalPageErases.pageFC000"
7149
7207
  },
7150
7208
  {
7151
- "path": "otherBytesWritten"
7209
+ "path": "journalPageErases.pageFD000"
7152
7210
  }
7153
7211
  ]
7154
7212
  }
@@ -7471,6 +7529,26 @@ var observationValueSchema = {
7471
7529
  ]
7472
7530
  }
7473
7531
  }
7532
+ },
7533
+ "device.hardwareId": {
7534
+ "type": "string",
7535
+ "minLength": 13,
7536
+ "maxLength": 13,
7537
+ "pattern": "^[0-9A-F][0-9A-HJKMNP-TV-Z]{12}$",
7538
+ "title": "Hardware ID",
7539
+ "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.",
7540
+ "x-bf": {
7541
+ "definitionId": 184,
7542
+ "role": "state",
7543
+ "subject": "device",
7544
+ "producer": "device",
7545
+ "requestScoped": false,
7546
+ "presentation": {
7547
+ "displayName": "Hardware ID",
7548
+ "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.",
7549
+ "hiddenByDefault": false
7550
+ }
7551
+ }
7474
7552
  }
7475
7553
  }
7476
7554
  };
@@ -9874,27 +9952,27 @@ var observationDefinitions = [
9874
9952
  "requestScoped": false,
9875
9953
  "presentation": {
9876
9954
  "displayName": "flash.statistics",
9877
- "description": "One passive RAM snapshot of since-boot flash accounting. Successful driver-request bytes and pages include metadata and garbage collection; failed operations may have partial physical effects. The saturated flag applies to all counters. Reading this snapshot performs no flash I/O.",
9955
+ "description": "One passive RAM snapshot of since-boot flash accounting. Successful driver-request bytes and pages include metadata and garbage collection; failed operations may have partial physical effects. journalPageErases names each 4 KiB page by its starting address: 0xF8000, 0xF9000, 0xFA000 (settings), then 0xFB000, 0xFC000, 0xFD000 (connection). The saturated flag applies to all counters. Reading this snapshot performs no flash I/O.",
9878
9956
  "hiddenByDefault": true,
9879
9957
  "formatter": "fields",
9880
9958
  "fields": [
9881
9959
  {
9882
- "path": "bytesWritten"
9960
+ "path": "journalPageErases.pageF8000"
9883
9961
  },
9884
9962
  {
9885
- "path": "connectionJournalBytesWritten"
9963
+ "path": "journalPageErases.pageF9000"
9886
9964
  },
9887
9965
  {
9888
- "path": "connectionJournalPagesErased"
9966
+ "path": "journalPageErases.pageFA000"
9889
9967
  },
9890
9968
  {
9891
- "path": "eraseCalls"
9969
+ "path": "journalPageErases.pageFB000"
9892
9970
  },
9893
9971
  {
9894
- "path": "eraseErrors"
9972
+ "path": "journalPageErases.pageFC000"
9895
9973
  },
9896
9974
  {
9897
- "path": "otherBytesWritten"
9975
+ "path": "journalPageErases.pageFD000"
9898
9976
  }
9899
9977
  ]
9900
9978
  }
@@ -10014,6 +10092,19 @@ var observationDefinitions = [
10014
10092
  }
10015
10093
  ]
10016
10094
  }
10095
+ },
10096
+ {
10097
+ "id": 184,
10098
+ "name": "device.hardwareId",
10099
+ "role": "state",
10100
+ "subject": "device",
10101
+ "producer": "device",
10102
+ "requestScoped": false,
10103
+ "presentation": {
10104
+ "displayName": "Hardware ID",
10105
+ "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.",
10106
+ "hiddenByDefault": false
10107
+ }
10017
10108
  }
10018
10109
  ];
10019
10110
 
@@ -10025,6 +10116,7 @@ export {
10025
10116
  ORPCError,
10026
10117
  acquisitionDefinition,
10027
10118
  acquisitionOptions,
10119
+ apiContractVersion,
10028
10120
  articleCandidate,
10029
10121
  auditContract,
10030
10122
  auditEntry,
@@ -10034,7 +10126,7 @@ export {
10034
10126
  batteryFirmwareInput,
10035
10127
  billingContract,
10036
10128
  billingReview,
10037
- commandCatalog,
10129
+ catalogFirmwareVersion,
10038
10130
  commandDefinitions,
10039
10131
  commandErrors,
10040
10132
  commandEventsInput,
@@ -10062,6 +10154,8 @@ export {
10062
10154
  currentObservation,
10063
10155
  denylistInput,
10064
10156
  deviceConnectivity,
10157
+ deviceInput,
10158
+ deviceLookupInput,
10065
10159
  zDeviceSettings as deviceSettings,
10066
10160
  diagnosticsContract,
10067
10161
  favorite,
@@ -10070,6 +10164,13 @@ export {
10070
10164
  favoritePage,
10071
10165
  favoriteWrite,
10072
10166
  firmwareCancellationInput,
10167
+ firmwareCatalogCapability,
10168
+ firmwareCatalogContract,
10169
+ firmwareCatalogFamily,
10170
+ firmwareCatalogInput,
10171
+ firmwareCatalogPublishInput,
10172
+ firmwareCatalogRelease,
10173
+ firmwareCatalogUploadInput,
10073
10174
  firmwareChip,
10074
10175
  firmwareExecution,
10075
10176
  firmwareOperationInput,
@@ -10092,8 +10193,9 @@ export {
10092
10193
  maintenanceContract,
10093
10194
  maintenanceInput,
10094
10195
  maintenanceOperation,
10196
+ maximumFirmwareUploadBytes,
10095
10197
  moneyAmount,
10096
- observation,
10198
+ observationResponse as observation,
10097
10199
  observationDefinitions,
10098
10200
  observationEventsInput,
10099
10201
  observationHistoryInput,
@@ -10118,7 +10220,6 @@ export {
10118
10220
  staffAccountContract,
10119
10221
  staffAccountEmail,
10120
10222
  staffAccountInput,
10121
- staffAccountSelection,
10122
10223
  staffCommandContract,
10123
10224
  staffConnectivityContract,
10124
10225
  staffContract,