@molecule/api-resource-firmware 1.0.3 → 1.0.4

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 CHANGED
@@ -3,15 +3,11 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-08-04T01:49:12.273Z
6
+ Generated: 2026-10-17T19:17:37.539Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-resource-firmware
10
10
 
11
- > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
12
- > It is written to be read by coding agents as much as by people, and is generated from this
13
- > package's source — edit `src/index.ts` JSDoc, not this file.
14
-
15
11
  `@molecule/api-resource-firmware` — owner-scoped firmware versions
16
12
  and OTA rollouts.
17
13
 
@@ -29,6 +25,10 @@ and OTA rollouts.
29
25
 
30
26
  Extracted from the iot-device-manager flagship.
31
27
 
28
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
29
+ > It is written to be read by coding agents as much as by people, and is generated from this
30
+ > package's source — edit `src/index.ts` JSDoc, not this file.
31
+
32
32
  ## Quick Start
33
33
 
34
34
  ```ts
@@ -68,6 +68,27 @@ npm install -D @types/express
68
68
 
69
69
  ### Interfaces
70
70
 
71
+ #### `FirmwareVersionRow`
72
+
73
+ Database row representing a firmware version artifact and its metadata.
74
+
75
+ ```typescript
76
+ interface FirmwareVersionRow {
77
+ id: string
78
+ owner_id: string
79
+ version: string
80
+ device_type: string
81
+ release_notes: string
82
+ download_url: string | null
83
+ checksum: string | null
84
+ file_size: number
85
+ status: FirmwareStatus
86
+ released_at: string | Date | null
87
+ created_at: string | Date
88
+ updated_at: string | Date
89
+ }
90
+ ```
91
+
71
92
  #### `FirmwareRolloutRow`
72
93
 
73
94
  Database row representing a firmware rollout targeting a fleet or set of devices.
@@ -108,27 +129,6 @@ interface FirmwareUpdateTaskRow {
108
129
  }
109
130
  ```
110
131
 
111
- #### `FirmwareVersionRow`
112
-
113
- Database row representing a firmware version artifact and its metadata.
114
-
115
- ```typescript
116
- interface FirmwareVersionRow {
117
- id: string
118
- owner_id: string
119
- version: string
120
- device_type: string
121
- release_notes: string
122
- download_url: string | null
123
- checksum: string | null
124
- file_size: number
125
- status: FirmwareStatus
126
- released_at: string | Date | null
127
- created_at: string | Date
128
- updated_at: string | Date
129
- }
130
- ```
131
-
132
132
  ### Types
133
133
 
134
134
  #### `DeviceTokenMiddleware`
@@ -149,20 +149,20 @@ Lifecycle state of a firmware version.
149
149
  type FirmwareStatus = 'draft' | 'published' | 'deprecated'
150
150
  ```
151
151
 
152
- #### `RolloutStatus`
152
+ #### `RolloutStrategy`
153
153
 
154
- Current state of a firmware rollout operation.
154
+ Deployment strategy used when rolling out a firmware version to devices.
155
155
 
156
156
  ```typescript
157
- type RolloutStatus = 'pending' | 'active' | 'completed' | 'failed' | 'canceled'
157
+ type RolloutStrategy = 'immediate' | 'canary' | 'gradual'
158
158
  ```
159
159
 
160
- #### `RolloutStrategy`
160
+ #### `RolloutStatus`
161
161
 
162
- Deployment strategy used when rolling out a firmware version to devices.
162
+ Current state of a firmware rollout operation.
163
163
 
164
164
  ```typescript
165
- type RolloutStrategy = 'immediate' | 'canary' | 'gradual'
165
+ type RolloutStatus = 'pending' | 'active' | 'completed' | 'failed' | 'canceled'
166
166
  ```
167
167
 
168
168
  #### `RolloutTaskStatus`
@@ -175,6 +175,41 @@ type RolloutTaskStatus = 'pending' | 'in_progress' | 'completed' | 'failed'
175
175
 
176
176
  ### Functions
177
177
 
178
+ #### `createFirmwareRouter(opts)`
179
+
180
+ Build the firmware router.
181
+
182
+ ```typescript
183
+ function createFirmwareRouter(opts: { requireDeviceToken: DeviceTokenMiddleware }): Router
184
+ ```
185
+
186
+ #### `isUuid(value)`
187
+
188
+ Whether a string is a syntactically valid UUID.
189
+
190
+ ```typescript
191
+ function isUuid(value: string): boolean
192
+ ```
193
+
194
+ #### `listFirmwareForOwner(userId, filters?)`
195
+
196
+ Owner-scoped firmware list.
197
+
198
+ ```typescript
199
+ function listFirmwareForOwner(
200
+ userId: string,
201
+ filters?: { device_type?: string; status?: string; page?: number; limit?: number },
202
+ ): Promise<FirmwareVersionRow[]>
203
+ ```
204
+
205
+ #### `getFirmwareForOwner(userId, id)`
206
+
207
+ Owner-scoped firmware read — null when missing or not owned.
208
+
209
+ ```typescript
210
+ function getFirmwareForOwner(userId: string, id: string): Promise<FirmwareVersionRow | null>
211
+ ```
212
+
178
213
  #### `createFirmwareForOwner(userId, input)`
179
214
 
180
215
  Create a draft firmware version.
@@ -193,12 +228,24 @@ function createFirmwareForOwner(
193
228
  ): Promise<FirmwareVersionRow | null>
194
229
  ```
195
230
 
196
- #### `createFirmwareRouter(opts)`
231
+ #### `updateFirmwareForOwner(userId, id, patch)`
197
232
 
198
- Build the firmware router.
233
+ Patch a firmware version owned by the user.
199
234
 
200
235
  ```typescript
201
- function createFirmwareRouter(opts: { requireDeviceToken: DeviceTokenMiddleware }): Router
236
+ function updateFirmwareForOwner(
237
+ userId: string,
238
+ id: string,
239
+ patch: Record<string, unknown>,
240
+ ): Promise<FirmwareVersionRow | null>
241
+ ```
242
+
243
+ #### `publishFirmwareForOwner(userId, id)`
244
+
245
+ Flip a firmware version to published + stamp `released_at`.
246
+
247
+ ```typescript
248
+ function publishFirmwareForOwner(userId: string, id: string): Promise<FirmwareVersionRow | null>
202
249
  ```
203
250
 
204
251
  #### `createRolloutForOwner(userId, input)`
@@ -221,33 +268,6 @@ function createRolloutForOwner(
221
268
  >
222
269
  ```
223
270
 
224
- #### `getFirmwareForOwner(userId, id)`
225
-
226
- Owner-scoped firmware read — null when missing or not owned.
227
-
228
- ```typescript
229
- function getFirmwareForOwner(userId: string, id: string): Promise<FirmwareVersionRow | null>
230
- ```
231
-
232
- #### `isUuid(value)`
233
-
234
- Whether a string is a syntactically valid UUID.
235
-
236
- ```typescript
237
- function isUuid(value: string): boolean
238
- ```
239
-
240
- #### `listFirmwareForOwner(userId, filters?)`
241
-
242
- Owner-scoped firmware list.
243
-
244
- ```typescript
245
- function listFirmwareForOwner(
246
- userId: string,
247
- filters?: { device_type?: string; status?: string; page?: number; limit?: number },
248
- ): Promise<FirmwareVersionRow[]>
249
- ```
250
-
251
271
  #### `listRolloutsForOwner(userId, filters?)`
252
272
 
253
273
  Owner-scoped rollout list.
@@ -259,14 +279,6 @@ function listRolloutsForOwner(
259
279
  ): Promise<FirmwareRolloutRow[]>
260
280
  ```
261
281
 
262
- #### `publishFirmwareForOwner(userId, id)`
263
-
264
- Flip a firmware version to published + stamp `released_at`.
265
-
266
- ```typescript
267
- function publishFirmwareForOwner(userId: string, id: string): Promise<FirmwareVersionRow | null>
268
- ```
269
-
270
282
  #### `recordRolloutDeviceStatus(opts)`
271
283
 
272
284
  Record a per-device task status report. Updates the rollout's
@@ -283,19 +295,45 @@ function recordRolloutDeviceStatus(opts: {
283
295
  }): Promise<{ ok: true } | { ok: false; reason: 'task_not_found' }>
284
296
  ```
285
297
 
286
- #### `updateFirmwareForOwner(userId, id, patch)`
298
+ ### Constants
287
299
 
288
- Patch a firmware version owned by the user.
300
+ #### `firmwareStatusSchema`
301
+
302
+ Allowed lifecycle states for a firmware version.
289
303
 
290
304
  ```typescript
291
- function updateFirmwareForOwner(
292
- userId: string,
293
- id: string,
294
- patch: Record<string, unknown>,
295
- ): Promise<FirmwareVersionRow | null>
305
+ const firmwareStatusSchema: z.ZodEnum<{
306
+ draft: 'draft'
307
+ published: 'published'
308
+ deprecated: 'deprecated'
309
+ }>
296
310
  ```
297
311
 
298
- ### Constants
312
+ #### `rolloutStrategySchema`
313
+
314
+ Allowed rollout delivery strategies.
315
+
316
+ ```typescript
317
+ const rolloutStrategySchema: z.ZodEnum<{
318
+ immediate: 'immediate'
319
+ canary: 'canary'
320
+ gradual: 'gradual'
321
+ }>
322
+ ```
323
+
324
+ #### `rolloutStatusSchema`
325
+
326
+ Allowed progress states for a firmware rollout.
327
+
328
+ ```typescript
329
+ const rolloutStatusSchema: z.ZodEnum<{
330
+ pending: 'pending'
331
+ completed: 'completed'
332
+ failed: 'failed'
333
+ active: 'active'
334
+ canceled: 'canceled'
335
+ }>
336
+ ```
299
337
 
300
338
  #### `createFirmwareSchema`
301
339
 
@@ -315,36 +353,25 @@ const createFirmwareSchema: z.ZodObject<
315
353
  >
316
354
  ```
317
355
 
318
- #### `createRolloutSchema`
356
+ #### `updateFirmwareSchema`
319
357
 
320
- Validator for creating a rollout.
358
+ Validator for patching a firmware version (release notes, status, etc).
321
359
 
322
360
  ```typescript
323
- const createRolloutSchema: z.ZodObject<
361
+ const updateFirmwareSchema: z.ZodObject<
324
362
  {
325
- firmware_id: z.ZodString
326
- device_ids: z.ZodOptional<z.ZodArray<z.ZodString>>
327
- fleet_id: z.ZodOptional<z.ZodNullable<z.ZodString>>
328
- strategy: z.ZodOptional<
329
- z.ZodEnum<{ immediate: 'immediate'; canary: 'canary'; gradual: 'gradual' }>
363
+ release_notes: z.ZodOptional<z.ZodString>
364
+ download_url: z.ZodOptional<z.ZodNullable<z.ZodString>>
365
+ checksum: z.ZodOptional<z.ZodNullable<z.ZodString>>
366
+ file_size: z.ZodOptional<z.ZodCoercedNumber<unknown>>
367
+ status: z.ZodOptional<
368
+ z.ZodEnum<{ draft: 'draft'; published: 'published'; deprecated: 'deprecated' }>
330
369
  >
331
370
  },
332
371
  z.core.$strip
333
372
  >
334
373
  ```
335
374
 
336
- #### `firmwareStatusSchema`
337
-
338
- Allowed lifecycle states for a firmware version.
339
-
340
- ```typescript
341
- const firmwareStatusSchema: z.ZodEnum<{
342
- draft: 'draft'
343
- published: 'published'
344
- deprecated: 'deprecated'
345
- }>
346
- ```
347
-
348
375
  #### `listFirmwareQuerySchema`
349
376
 
350
377
  Validator for the firmware-version list query params.
@@ -363,6 +390,24 @@ const listFirmwareQuerySchema: z.ZodObject<
363
390
  >
364
391
  ```
365
392
 
393
+ #### `createRolloutSchema`
394
+
395
+ Validator for creating a rollout.
396
+
397
+ ```typescript
398
+ const createRolloutSchema: z.ZodObject<
399
+ {
400
+ firmware_id: z.ZodString
401
+ device_ids: z.ZodOptional<z.ZodArray<z.ZodString>>
402
+ fleet_id: z.ZodOptional<z.ZodNullable<z.ZodString>>
403
+ strategy: z.ZodOptional<
404
+ z.ZodEnum<{ immediate: 'immediate'; canary: 'canary'; gradual: 'gradual' }>
405
+ >
406
+ },
407
+ z.core.$strip
408
+ >
409
+ ```
410
+
366
411
  #### `listRolloutsQuerySchema`
367
412
 
368
413
  Validator for the rollout-list query params.
@@ -406,51 +451,6 @@ const rolloutDeviceStatusSchema: z.ZodObject<
406
451
  >
407
452
  ```
408
453
 
409
- #### `rolloutStatusSchema`
410
-
411
- Allowed progress states for a firmware rollout.
412
-
413
- ```typescript
414
- const rolloutStatusSchema: z.ZodEnum<{
415
- pending: 'pending'
416
- completed: 'completed'
417
- failed: 'failed'
418
- active: 'active'
419
- canceled: 'canceled'
420
- }>
421
- ```
422
-
423
- #### `rolloutStrategySchema`
424
-
425
- Allowed rollout delivery strategies.
426
-
427
- ```typescript
428
- const rolloutStrategySchema: z.ZodEnum<{
429
- immediate: 'immediate'
430
- canary: 'canary'
431
- gradual: 'gradual'
432
- }>
433
- ```
434
-
435
- #### `updateFirmwareSchema`
436
-
437
- Validator for patching a firmware version (release notes, status, etc).
438
-
439
- ```typescript
440
- const updateFirmwareSchema: z.ZodObject<
441
- {
442
- release_notes: z.ZodOptional<z.ZodString>
443
- download_url: z.ZodOptional<z.ZodNullable<z.ZodString>>
444
- checksum: z.ZodOptional<z.ZodNullable<z.ZodString>>
445
- file_size: z.ZodOptional<z.ZodCoercedNumber<unknown>>
446
- status: z.ZodOptional<
447
- z.ZodEnum<{ draft: 'draft'; published: 'published'; deprecated: 'deprecated' }>
448
- >
449
- },
450
- z.core.$strip
451
- >
452
- ```
453
-
454
454
  ## Injection Notes
455
455
 
456
456
  ### Requirements
@@ -477,7 +477,7 @@ Peer dependencies:
477
477
  - `express`
478
478
  - `zod`
479
479
 
480
- The schema in `__setup__/firmware.sql` creates `firmware_versions`,
480
+ The schema in `src/__setup__/firmware.sql` creates `firmware_versions`,
481
481
  `firmware_rollouts`, and `firmware_update_tasks`. The resource also
482
482
  reads/writes `iot_devices`, `fleets`, `fleet_memberships`,
483
483
  `device_commands`, and `device_alerts` — those tables are owned by
package/dist/index.d.ts CHANGED
@@ -43,7 +43,7 @@
43
43
  * ```
44
44
  *
45
45
  * @remarks
46
- * The schema in `__setup__/firmware.sql` creates `firmware_versions`,
46
+ * The schema in `src/__setup__/firmware.sql` creates `firmware_versions`,
47
47
  * `firmware_rollouts`, and `firmware_update_tasks`. The resource also
48
48
  * reads/writes `iot_devices`, `fleets`, `fleet_memberships`,
49
49
  * `device_commands`, and `device_alerts` — those tables are owned by
package/dist/index.js CHANGED
@@ -43,7 +43,7 @@
43
43
  * ```
44
44
  *
45
45
  * @remarks
46
- * The schema in `__setup__/firmware.sql` creates `firmware_versions`,
46
+ * The schema in `src/__setup__/firmware.sql` creates `firmware_versions`,
47
47
  * `firmware_rollouts`, and `firmware_update_tasks`. The resource also
48
48
  * reads/writes `iot_devices`, `fleets`, `fleet_memberships`,
49
49
  * `device_commands`, and `device_alerts` — those tables are owned by
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-resource-firmware",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Owner-scoped firmware versions + OTA rollouts: draft/publish/deprecate, per-device update tasks, realtime command dispatch, device-token-authenticated status reporting. Extracted from iot-device-manager flagship.",
5
5
  "homepage": "https://www.molecule.dev/packages/api-resource-firmware",
6
6
  "type": "module",