@bikefinder/staff-sdk 0.4.0 → 0.8.2

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,6 @@ import {
9
10
  batteryFirmwareInput,
10
11
  billingContract,
11
12
  billingReview,
12
- commandCatalog,
13
13
  commandDefinitions,
14
14
  commandErrors,
15
15
  commandEventsInput,
@@ -36,6 +36,8 @@ import {
36
36
  currentObservation,
37
37
  denylistInput,
38
38
  deviceConnectivity,
39
+ deviceInput,
40
+ deviceLookupInput,
39
41
  diagnosticsContract,
40
42
  favorite,
41
43
  favoriteContract,
@@ -66,11 +68,11 @@ import {
66
68
  maintenanceInput,
67
69
  maintenanceOperation,
68
70
  moneyAmount,
69
- observation,
70
71
  observationEventsInput,
71
72
  observationHistoryInput,
72
73
  observationPage,
73
74
  observationReadInput,
75
+ observationResponse,
74
76
  observationSelectionInput,
75
77
  observationSeries,
76
78
  operationExecution,
@@ -88,7 +90,6 @@ import {
88
90
  staffAccountContract,
89
91
  staffAccountEmail,
90
92
  staffAccountInput,
91
- staffAccountSelection,
92
93
  staffCommandContract,
93
94
  staffConnectivityContract,
94
95
  staffContract,
@@ -127,9 +128,9 @@ import {
127
128
  trackerLatestReport,
128
129
  trackerStatistics,
129
130
  zDeviceSettings
130
- } from "./chunk-5QW6N6JG.js";
131
+ } from "./chunk-RLPKRCLR.js";
131
132
 
132
- // ../../src/Client/client.ts
133
+ // ../../src/client/client.ts
133
134
  import { createORPCClient, DynamicLink } from "@orpc/client";
134
135
  import { RPCLink as HttpLink } from "@orpc/client/fetch";
135
136
  import { RPCLink as WebSocketLink } from "@orpc/client/websocket";
@@ -160,6 +161,7 @@ function createApiClient(contract, audience, options) {
160
161
  const base = endpoint(options.baseUrl, "http");
161
162
  base.pathname = `${base.pathname.replace(/\/+$/, "")}/rpc`;
162
163
  const lifetime = new AbortController();
164
+ let disposed = false;
163
165
  const root = { [audience]: contract };
164
166
  function linkOptions() {
165
167
  return {
@@ -200,12 +202,13 @@ function createApiClient(contract, audience, options) {
200
202
  function websocket() {
201
203
  if (realtime) return realtime;
202
204
  options.onConnectionStateChange?.("connecting");
205
+ lifetime.signal.throwIfAborted();
203
206
  let opened = false;
204
207
  socket = new ReconnectingWebSocket(
205
208
  async () => {
206
209
  ticketError = void 0;
207
210
  const result = await tickets.ticket().catch((error) => {
208
- if (error instanceof Error) {
211
+ if (error instanceof Error && !disposed) {
209
212
  ticketError = error;
210
213
  options.onConnectionError?.(error);
211
214
  }
@@ -221,14 +224,13 @@ function createApiClient(contract, audience, options) {
221
224
  );
222
225
  const connection = socket;
223
226
  connection.addEventListener("open", () => {
227
+ if (disposed) return;
224
228
  options.onConnectionStateChange?.("connected");
225
- if (opened) options.onReconnect?.();
229
+ if (opened && !disposed) options.onReconnect?.();
226
230
  opened = true;
227
231
  });
228
232
  connection.addEventListener("close", () => {
229
- options.onConnectionStateChange?.(
230
- lifetime.signal.aborted ? "closed" : "reconnecting"
231
- );
233
+ if (!disposed) options.onConnectionStateChange?.("reconnecting");
232
234
  });
233
235
  connection.addEventListener("message", (event) => {
234
236
  let decoded;
@@ -282,6 +284,8 @@ function createApiClient(contract, audience, options) {
282
284
  return {
283
285
  api,
284
286
  dispose() {
287
+ if (disposed) return;
288
+ disposed = true;
285
289
  socket?.close(1e3, "Client disposed.");
286
290
  lifetime.abort(new DOMException("Client disposed.", "AbortError"));
287
291
  options.onConnectionStateChange?.("closed");
@@ -7100,6 +7104,50 @@ var observationValueSchema = {
7100
7104
  "type": "integer",
7101
7105
  "minimum": 0,
7102
7106
  "maximum": 4294967295
7107
+ },
7108
+ "journalPageErases": {
7109
+ "type": "object",
7110
+ "properties": {
7111
+ "pageF8000": {
7112
+ "type": "integer",
7113
+ "minimum": 0,
7114
+ "maximum": 4294967295
7115
+ },
7116
+ "pageF9000": {
7117
+ "type": "integer",
7118
+ "minimum": 0,
7119
+ "maximum": 4294967295
7120
+ },
7121
+ "pageFA000": {
7122
+ "type": "integer",
7123
+ "minimum": 0,
7124
+ "maximum": 4294967295
7125
+ },
7126
+ "pageFB000": {
7127
+ "type": "integer",
7128
+ "minimum": 0,
7129
+ "maximum": 4294967295
7130
+ },
7131
+ "pageFC000": {
7132
+ "type": "integer",
7133
+ "minimum": 0,
7134
+ "maximum": 4294967295
7135
+ },
7136
+ "pageFD000": {
7137
+ "type": "integer",
7138
+ "minimum": 0,
7139
+ "maximum": 4294967295
7140
+ }
7141
+ },
7142
+ "required": [
7143
+ "pageF8000",
7144
+ "pageF9000",
7145
+ "pageFA000",
7146
+ "pageFB000",
7147
+ "pageFC000",
7148
+ "pageFD000"
7149
+ ],
7150
+ "additionalProperties": false
7103
7151
  }
7104
7152
  },
7105
7153
  "required": [
@@ -7115,11 +7163,12 @@ var observationValueSchema = {
7115
7163
  "settingsJournalBytesWritten",
7116
7164
  "settingsJournalPagesErased",
7117
7165
  "writeCalls",
7118
- "writeErrors"
7166
+ "writeErrors",
7167
+ "journalPageErases"
7119
7168
  ],
7120
7169
  "additionalProperties": false,
7121
7170
  "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.",
7171
+ "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
7172
  "x-bf": {
7124
7173
  "definitionId": 180,
7125
7174
  "role": "measurement",
@@ -7128,27 +7177,27 @@ var observationValueSchema = {
7128
7177
  "requestScoped": false,
7129
7178
  "presentation": {
7130
7179
  "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.",
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.",
7132
7181
  "hiddenByDefault": true,
7133
7182
  "formatter": "fields",
7134
7183
  "fields": [
7135
7184
  {
7136
- "path": "bytesWritten"
7185
+ "path": "journalPageErases.pageF8000"
7137
7186
  },
7138
7187
  {
7139
- "path": "connectionJournalBytesWritten"
7188
+ "path": "journalPageErases.pageF9000"
7140
7189
  },
7141
7190
  {
7142
- "path": "connectionJournalPagesErased"
7191
+ "path": "journalPageErases.pageFA000"
7143
7192
  },
7144
7193
  {
7145
- "path": "eraseCalls"
7194
+ "path": "journalPageErases.pageFB000"
7146
7195
  },
7147
7196
  {
7148
- "path": "eraseErrors"
7197
+ "path": "journalPageErases.pageFC000"
7149
7198
  },
7150
7199
  {
7151
- "path": "otherBytesWritten"
7200
+ "path": "journalPageErases.pageFD000"
7152
7201
  }
7153
7202
  ]
7154
7203
  }
@@ -7471,6 +7520,26 @@ var observationValueSchema = {
7471
7520
  ]
7472
7521
  }
7473
7522
  }
7523
+ },
7524
+ "device.hardwareId": {
7525
+ "type": "string",
7526
+ "minLength": 13,
7527
+ "maxLength": 13,
7528
+ "pattern": "^[0-9A-F][0-9A-HJKMNP-TV-Z]{12}$",
7529
+ "title": "Hardware ID",
7530
+ "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.",
7531
+ "x-bf": {
7532
+ "definitionId": 184,
7533
+ "role": "state",
7534
+ "subject": "device",
7535
+ "producer": "device",
7536
+ "requestScoped": false,
7537
+ "presentation": {
7538
+ "displayName": "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
+ "hiddenByDefault": false
7541
+ }
7542
+ }
7474
7543
  }
7475
7544
  }
7476
7545
  };
@@ -9874,27 +9943,27 @@ var observationDefinitions = [
9874
9943
  "requestScoped": false,
9875
9944
  "presentation": {
9876
9945
  "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.",
9946
+ "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
9947
  "hiddenByDefault": true,
9879
9948
  "formatter": "fields",
9880
9949
  "fields": [
9881
9950
  {
9882
- "path": "bytesWritten"
9951
+ "path": "journalPageErases.pageF8000"
9883
9952
  },
9884
9953
  {
9885
- "path": "connectionJournalBytesWritten"
9954
+ "path": "journalPageErases.pageF9000"
9886
9955
  },
9887
9956
  {
9888
- "path": "connectionJournalPagesErased"
9957
+ "path": "journalPageErases.pageFA000"
9889
9958
  },
9890
9959
  {
9891
- "path": "eraseCalls"
9960
+ "path": "journalPageErases.pageFB000"
9892
9961
  },
9893
9962
  {
9894
- "path": "eraseErrors"
9963
+ "path": "journalPageErases.pageFC000"
9895
9964
  },
9896
9965
  {
9897
- "path": "otherBytesWritten"
9966
+ "path": "journalPageErases.pageFD000"
9898
9967
  }
9899
9968
  ]
9900
9969
  }
@@ -10014,6 +10083,19 @@ var observationDefinitions = [
10014
10083
  }
10015
10084
  ]
10016
10085
  }
10086
+ },
10087
+ {
10088
+ "id": 184,
10089
+ "name": "device.hardwareId",
10090
+ "role": "state",
10091
+ "subject": "device",
10092
+ "producer": "device",
10093
+ "requestScoped": false,
10094
+ "presentation": {
10095
+ "displayName": "Hardware ID",
10096
+ "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.",
10097
+ "hiddenByDefault": false
10098
+ }
10017
10099
  }
10018
10100
  ];
10019
10101
 
@@ -10025,6 +10107,7 @@ export {
10025
10107
  ORPCError,
10026
10108
  acquisitionDefinition,
10027
10109
  acquisitionOptions,
10110
+ apiContractVersion,
10028
10111
  articleCandidate,
10029
10112
  auditContract,
10030
10113
  auditEntry,
@@ -10034,7 +10117,6 @@ export {
10034
10117
  batteryFirmwareInput,
10035
10118
  billingContract,
10036
10119
  billingReview,
10037
- commandCatalog,
10038
10120
  commandDefinitions,
10039
10121
  commandErrors,
10040
10122
  commandEventsInput,
@@ -10062,6 +10144,8 @@ export {
10062
10144
  currentObservation,
10063
10145
  denylistInput,
10064
10146
  deviceConnectivity,
10147
+ deviceInput,
10148
+ deviceLookupInput,
10065
10149
  zDeviceSettings as deviceSettings,
10066
10150
  diagnosticsContract,
10067
10151
  favorite,
@@ -10093,7 +10177,7 @@ export {
10093
10177
  maintenanceInput,
10094
10178
  maintenanceOperation,
10095
10179
  moneyAmount,
10096
- observation,
10180
+ observationResponse as observation,
10097
10181
  observationDefinitions,
10098
10182
  observationEventsInput,
10099
10183
  observationHistoryInput,
@@ -10118,7 +10202,6 @@ export {
10118
10202
  staffAccountContract,
10119
10203
  staffAccountEmail,
10120
10204
  staffAccountInput,
10121
- staffAccountSelection,
10122
10205
  staffCommandContract,
10123
10206
  staffConnectivityContract,
10124
10207
  staffContract,