|
1 | 1 | import { Type, type Static } from '@sinclair/typebox'
|
2 | 2 | import type { ValidationError } from 'ajv'
|
3 | 3 | import { validatedFetch } from './validatedFetch.js'
|
| 4 | +import { FwType } from './devices.js' |
4 | 5 |
|
5 | 6 | export enum FOTAJobStatus {
|
6 | 7 | CREATED = 'CREATED',
|
@@ -32,6 +33,43 @@ export const FOTAJobType = Type.Object(
|
32 | 33 | createdAt: ts,
|
33 | 34 | lastUpdatedAt: Type.Optional(ts),
|
34 | 35 | completedAt: Type.Optional(ts),
|
| 36 | + firmware: Type.Optional( |
| 37 | + Type.Object({ |
| 38 | + bundleId: Type.String({ |
| 39 | + minLength: 1, |
| 40 | + examples: ['APP*439ddbc7*v2.0.0'], |
| 41 | + }), |
| 42 | + fileSize: Type.Number({ minimum: 1, examples: [385068] }), |
| 43 | + firmwareType: Type.Enum(FwType, { title: 'Firmware Type' }), |
| 44 | + host: Type.String({ |
| 45 | + minLength: 1, |
| 46 | + examples: ['firmware.nrfcloud.com'], |
| 47 | + }), |
| 48 | + uris: Type.Array( |
| 49 | + Type.String({ |
| 50 | + minLength: 1, |
| 51 | + examples: [ |
| 52 | + 'bbfe6b73-a46a-43ad-94bd-8e4b4a7847ce/APP*439ddbc7*v2.0.0/hello-nrfcloud-thingy91-v2.0.0-fwupd.bin', |
| 53 | + ], |
| 54 | + }), |
| 55 | + ), |
| 56 | + version: Type.String({ minLength: 1, examples: ['v2.0.0'] }), |
| 57 | + }), |
| 58 | + ), |
| 59 | + target: Type.Optional( |
| 60 | + Type.Object({ |
| 61 | + deviceIds: Type.Array( |
| 62 | + Type.String({ |
| 63 | + minLength: 1, |
| 64 | + title: 'Device ID', |
| 65 | + examples: ['oob-358299840021360'], |
| 66 | + }), |
| 67 | + ), |
| 68 | + tags: Type.Array( |
| 69 | + Type.String({ minLength: 1, title: 'Tag', examples: ['nrf9160'] }), |
| 70 | + ), |
| 71 | + }), |
| 72 | + ), |
35 | 73 | },
|
36 | 74 | {
|
37 | 75 | title: 'FOTA Job',
|
|
0 commit comments