@hello.nrfcloud.com/proto
Version:
Documents the communication protocol between the hello.nrfcloud.com backend and the web application
69 lines (68 loc) • 2.38 kB
JavaScript
import { Type } from '@sinclair/typebox';
import { Context } from './Context.js';
import { IsoDateType } from './IsoDateType.js';
import { deviceId } from './deviceId.js';
export var FOTAJobStatus = /*#__PURE__*/ function(FOTAJobStatus) {
FOTAJobStatus["NEW"] = "NEW";
FOTAJobStatus["IN_PROGRESS"] = "IN_PROGRESS";
FOTAJobStatus["SUCCEEDED"] = "SUCCEEDED";
FOTAJobStatus["FAILED"] = "FAILED";
return FOTAJobStatus;
}({});
export var FOTAJobTarget = /*#__PURE__*/ function(FOTAJobTarget) {
FOTAJobTarget["application"] = "app";
FOTAJobTarget["modem"] = "modem";
return FOTAJobTarget;
}({});
export var UpgradePath = Type.Record(Type.RegExp(new RegExp("^(".concat([
'<',
'<=',
'>',
'>='
].join('|'), ")?[0-9]+.[0-9]+.[0-9]+$")), {
title: 'Version',
description: 'The version the bundle is targeting. Supports ranges (e.g >=1.0.0).'
}), Type.RegExp(/^(APP|MODEM|BOOT|SOFTDEVICE|BOOTLOADER|MDM_FULL)\*[0-9a-zA-Z]{8}\*.*$/, {
title: 'Bundle ID',
description: 'The nRF Cloud firmware bundle ID'
}), {
minProperties: 1,
additionalProperties: false
});
export var FOTAJob = Type.Object({
'@context': Type.Literal(Context.fotaJob.toString()),
id: Type.String({
minLength: 1,
title: 'ID',
description: 'The ID of the job.'
}),
deviceId: deviceId,
upgradePath: UpgradePath,
timestamp: IsoDateType('Time formatted as ISO 8601 string when the job was last updated.'),
status: Type.Enum(FOTAJobStatus, {
description: 'the status of the job'
}),
statusDetail: Type.String({
minLength: 1,
title: 'Status Detail',
description: 'Detailed information about the current status'
}),
reportedVersion: Type.String({
minLength: 1,
title: 'reported version',
description: 'The version of the target firmware that the device has reported.'
})
}, {
title: 'FOTAJob',
description: "Keeps track of the FOTA execution for a device's application or modem firmware that involves one or more sequential firmware updates."
});
export var FOTAJobs = Type.Object({
'@context': Type.Literal(Context.fotaJobs.toString()),
deviceId: deviceId,
jobs: Type.Array(FOTAJob, {
minItems: 0
})
}, {
title: 'FOTA jobs',
description: 'Lists the most recent FOTA jobs for a device.'
});