@hello.nrfcloud.com/proto-map 5.1.0 → 5.2.1

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.
@@ -0,0 +1,9 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ export var DeviceId = Type.RegExp(/^[a-zA-Z0-9:_-]{1,128}$/, {
3
+ title: "Device ID",
4
+ description: "Must follow the AWS IoT limitations for Thing names."
5
+ });
6
+ export var PublicDeviceId = Type.RegExp(/^[a-z]{8}-[a-z]{8}-[a-z]{8}$/, {
7
+ title: "Public Device ID",
8
+ description: "This is the format of @nordicsemiconductor/random-words which is used for public IDs."
9
+ });
@@ -0,0 +1,44 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { Context } from "./Context.js";
3
+ import { PublicDeviceId } from "./DeviceId.js";
4
+ import { LwM2MObjectID, models } from "@hello.nrfcloud.com/proto-map";
5
+ export var LwM2MObjectInstance = Type.Object({
6
+ ObjectID: Type.Enum(LwM2MObjectID, {
7
+ description: "The LwM2M Object IDs defined in @hello.nrfcloud.com/proto-map"
8
+ }),
9
+ ObjectVersion: Type.Optional(Type.String({
10
+ pattern: "^[0-9]+.[0-9]+$",
11
+ default: "1.0",
12
+ description: "The Object Version of an Object is composed of 2 digits separated by a dot '.'.\nSee https://www.openmobilealliance.org/release/LightweightM2M/V1_1_1-20190617-A/OMA-TS-LightweightM2M_Core-V1_1_1-20190617-A.pdf Section 7.2.2"
13
+ })),
14
+ ObjectInstanceID: Type.Optional(Type.Integer({
15
+ minimum: 0,
16
+ default: 0
17
+ })),
18
+ Resources: Type.Record(Type.Integer({
19
+ minimum: 0
20
+ }), Type.Union([
21
+ Type.String(),
22
+ Type.Number(),
23
+ Type.Boolean()
24
+ ]))
25
+ });
26
+ export var Model = Type.Union(Object.keys(models).map(function(s) {
27
+ return Type.Literal(s);
28
+ }), {
29
+ title: "Model",
30
+ description: "Must be one of the models defined in @hello.nrfcloud.com/proto-map"
31
+ });
32
+ export var PublicDevice = Type.Object({
33
+ "@context": Type.Literal(Context.device.toString()),
34
+ id: PublicDeviceId,
35
+ model: Model,
36
+ state: Type.Optional(Type.Array(LwM2MObjectInstance))
37
+ }, {
38
+ title: "Public device",
39
+ description: "A device that is publicly visible."
40
+ });
41
+ export var Devices = Type.Object({
42
+ "@context": Type.Literal(Context.devices.toString()),
43
+ devices: Type.Array(PublicDevice)
44
+ });
@@ -0,0 +1,7 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { Context } from "./Context.js";
3
+ import { DeviceId } from "./DeviceId.js";
4
+ export var ShareDeviceOwnershipConfirmed = Type.Object({
5
+ "@context": Type.Literal(Context.shareDevice.ownershipConfirmed.toString()),
6
+ id: DeviceId
7
+ });
@@ -0,0 +1,7 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { Context } from "./Context.js";
3
+ import { PublicDeviceId } from "./DeviceId.js";
4
+ export var ShareDeviceRequest = Type.Object({
5
+ "@context": Type.Literal(Context.shareDevice.request.toString()),
6
+ id: PublicDeviceId
7
+ });
package/dist/api/index.js CHANGED
@@ -1 +1,5 @@
1
1
  export * from "./Context.js";
2
+ export * from "./DeviceId.js";
3
+ export * from "./Devices.js";
4
+ export * from "./ShareDeviceOwnershipConfirmed.js";
5
+ export * from "./ShareDeviceRequest.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hello.nrfcloud.com/proto-map",
3
- "version": "5.1.0",
3
+ "version": "5.2.1",
4
4
  "description": "Documents the communication protocol between devices, the hello.nrfcloud.com/map backend and web application",
5
5
  "type": "module",
6
6
  "exports": {
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "./*": {
12
12
  "default": "./dist/*/index.js",
13
- "types": "./dist/*/index.d.ts"
13
+ "types": "./*/index.ts"
14
14
  }
15
15
  },
16
16
  "repository": {