@hello.nrfcloud.com/proto-map 5.5.0 → 5.6.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.
- package/api/History.ts +2 -8
- package/api/ResourceUpdate.ts +3 -8
- package/api/Timestamp.spec.ts +14 -0
- package/api/Timestamp.ts +9 -0
- package/api/index.ts +1 -0
- package/dist/api/History.js +2 -6
- package/dist/api/ResourceUpdate.js +3 -7
- package/dist/api/Timestamp.js +7 -0
- package/dist/api/Timestamp.spec.js +12 -0
- package/dist/api/index.js +1 -0
- package/package.json +1 -1
package/api/History.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Resources,
|
|
8
8
|
} from './LwM2M.js'
|
|
9
9
|
import { PublicDeviceId } from './DeviceId.js'
|
|
10
|
+
import { Timestamp } from './Timestamp.js'
|
|
10
11
|
|
|
11
12
|
export const ResourceHistory = Type.Object(
|
|
12
13
|
{
|
|
@@ -16,14 +17,7 @@ export const ResourceHistory = Type.Object(
|
|
|
16
17
|
[
|
|
17
18
|
Resources,
|
|
18
19
|
Type.Object({
|
|
19
|
-
ts:
|
|
20
|
-
/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/,
|
|
21
|
-
{
|
|
22
|
-
title:
|
|
23
|
-
'Time when the update was received, formatted as ISO 8601',
|
|
24
|
-
examples: ['2024-04-19T08:45:00.000Z'],
|
|
25
|
-
},
|
|
26
|
-
),
|
|
20
|
+
ts: Timestamp,
|
|
27
21
|
}),
|
|
28
22
|
],
|
|
29
23
|
{
|
package/api/ResourceUpdate.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Resources,
|
|
8
8
|
} from './LwM2M.js'
|
|
9
9
|
import { PublicDeviceId } from './DeviceId.js'
|
|
10
|
+
import { Timestamp } from './Timestamp.js'
|
|
10
11
|
|
|
11
12
|
export const ResourceUpdate = Type.Object(
|
|
12
13
|
{
|
|
@@ -15,17 +16,11 @@ export const ResourceUpdate = Type.Object(
|
|
|
15
16
|
ObjectInstanceID,
|
|
16
17
|
ObjectVersion,
|
|
17
18
|
Resources,
|
|
18
|
-
ts:
|
|
19
|
-
/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/,
|
|
20
|
-
{
|
|
21
|
-
title: 'Time when the update was received, formatted as ISO 8601',
|
|
22
|
-
examples: ['2024-04-19T08:45:00.000Z'],
|
|
23
|
-
},
|
|
24
|
-
),
|
|
19
|
+
ts: Timestamp,
|
|
25
20
|
deviceId: PublicDeviceId,
|
|
26
21
|
},
|
|
27
22
|
{
|
|
28
|
-
title: 'Resource
|
|
23
|
+
title: 'Resource update',
|
|
29
24
|
description: 'Describes an update to a LwM2M resource for a device.',
|
|
30
25
|
},
|
|
31
26
|
)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { describe, it } from 'node:test'
|
|
2
|
+
import assert from 'node:assert/strict'
|
|
3
|
+
import { validate } from '../validate.js'
|
|
4
|
+
import { Timestamp } from './Timestamp.js'
|
|
5
|
+
import type { Static } from '@sinclair/typebox'
|
|
6
|
+
|
|
7
|
+
void describe('Timestamp', () => {
|
|
8
|
+
void it('should validate', () => {
|
|
9
|
+
const input: Static<typeof Timestamp> = '2024-04-19T08:30:00.000Z'
|
|
10
|
+
const maybeValid = validate(Timestamp)(input)
|
|
11
|
+
assert.equal('errors' in maybeValid, false)
|
|
12
|
+
assert.deepEqual('value' in maybeValid && maybeValid.value, input)
|
|
13
|
+
})
|
|
14
|
+
})
|
package/api/Timestamp.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Type } from '@sinclair/typebox'
|
|
2
|
+
|
|
3
|
+
export const Timestamp = Type.RegExp(
|
|
4
|
+
/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/,
|
|
5
|
+
{
|
|
6
|
+
title: 'Time when the update was received, formatted as ISO 8601',
|
|
7
|
+
examples: ['2024-04-19T08:45:00.000Z'],
|
|
8
|
+
},
|
|
9
|
+
)
|
package/api/index.ts
CHANGED
package/dist/api/History.js
CHANGED
|
@@ -2,17 +2,13 @@ import { Type } from "@sinclair/typebox";
|
|
|
2
2
|
import { Context } from "./Context.js";
|
|
3
3
|
import { ObjectID, ObjectInstanceID, ObjectVersion, Resources } from "./LwM2M.js";
|
|
4
4
|
import { PublicDeviceId } from "./DeviceId.js";
|
|
5
|
+
import { Timestamp } from "./Timestamp.js";
|
|
5
6
|
export var ResourceHistory = Type.Object({
|
|
6
7
|
"@context": Type.Literal(Context.history.resource.toString()),
|
|
7
8
|
partialInstances: Type.Array(Type.Intersect([
|
|
8
9
|
Resources,
|
|
9
10
|
Type.Object({
|
|
10
|
-
ts:
|
|
11
|
-
title: "Time when the update was received, formatted as ISO 8601",
|
|
12
|
-
examples: [
|
|
13
|
-
"2024-04-19T08:45:00.000Z"
|
|
14
|
-
]
|
|
15
|
-
})
|
|
11
|
+
ts: Timestamp
|
|
16
12
|
})
|
|
17
13
|
], {
|
|
18
14
|
title: "The resources of the object instance and the timestamp the data was received."
|
|
@@ -2,20 +2,16 @@ import { Type } from "@sinclair/typebox";
|
|
|
2
2
|
import { Context } from "./Context.js";
|
|
3
3
|
import { ObjectID, ObjectInstanceID, ObjectVersion, Resources } from "./LwM2M.js";
|
|
4
4
|
import { PublicDeviceId } from "./DeviceId.js";
|
|
5
|
+
import { Timestamp } from "./Timestamp.js";
|
|
5
6
|
export var ResourceUpdate = Type.Object({
|
|
6
7
|
"@context": Type.Literal(Context.resourceUpdate.toString()),
|
|
7
8
|
ObjectID: ObjectID,
|
|
8
9
|
ObjectInstanceID: ObjectInstanceID,
|
|
9
10
|
ObjectVersion: ObjectVersion,
|
|
10
11
|
Resources: Resources,
|
|
11
|
-
ts:
|
|
12
|
-
title: "Time when the update was received, formatted as ISO 8601",
|
|
13
|
-
examples: [
|
|
14
|
-
"2024-04-19T08:45:00.000Z"
|
|
15
|
-
]
|
|
16
|
-
}),
|
|
12
|
+
ts: Timestamp,
|
|
17
13
|
deviceId: PublicDeviceId
|
|
18
14
|
}, {
|
|
19
|
-
title: "Resource
|
|
15
|
+
title: "Resource update",
|
|
20
16
|
description: "Describes an update to a LwM2M resource for a device."
|
|
21
17
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
export var Timestamp = Type.RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/, {
|
|
3
|
+
title: "Time when the update was received, formatted as ISO 8601",
|
|
4
|
+
examples: [
|
|
5
|
+
"2024-04-19T08:45:00.000Z"
|
|
6
|
+
]
|
|
7
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { describe, it } from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { validate } from "../validate.js";
|
|
4
|
+
import { Timestamp } from "./Timestamp.js";
|
|
5
|
+
void describe("Timestamp", function() {
|
|
6
|
+
void it("should validate", function() {
|
|
7
|
+
var input = "2024-04-19T08:30:00.000Z";
|
|
8
|
+
var maybeValid = validate(Timestamp)(input);
|
|
9
|
+
assert.equal("errors" in maybeValid, false);
|
|
10
|
+
assert.deepEqual("value" in maybeValid && maybeValid.value, input);
|
|
11
|
+
});
|
|
12
|
+
});
|
package/dist/api/index.js
CHANGED
package/package.json
CHANGED