@hello.nrfcloud.com/nrfcloud-api-helpers 3.0.1 → 3.0.2
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/dist/api/DeviceShadow.js +0 -1
- package/dist/api/devices.d.ts +5 -22
- package/dist/api/devices.js +2 -6
- package/package.json +1 -1
package/dist/api/DeviceShadow.js
CHANGED
package/dist/api/devices.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type Static } from '@sinclair/typebox';
|
|
2
2
|
import { ValidationError } from './validatedFetch.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { DeviceShadow } from './DeviceShadow.js';
|
|
4
|
+
declare const Devices: import("@sinclair/typebox").TObject<{
|
|
5
|
+
total: import("@sinclair/typebox").TInteger;
|
|
6
|
+
items: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
6
7
|
id: import("@sinclair/typebox").TString;
|
|
7
8
|
$meta: import("@sinclair/typebox").TObject<{
|
|
8
9
|
createdAt: import("@sinclair/typebox").TString;
|
|
@@ -15,24 +16,6 @@ declare const Device: import("@sinclair/typebox").TObject<{
|
|
|
15
16
|
}>;
|
|
16
17
|
}>>;
|
|
17
18
|
}>;
|
|
18
|
-
declare const Devices: import("@sinclair/typebox").TObject<{
|
|
19
|
-
total: import("@sinclair/typebox").TInteger;
|
|
20
|
-
items: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
21
|
-
id: import("@sinclair/typebox").TString;
|
|
22
|
-
state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
23
|
-
id: import("@sinclair/typebox").TString;
|
|
24
|
-
$meta: import("@sinclair/typebox").TObject<{
|
|
25
|
-
createdAt: import("@sinclair/typebox").TString;
|
|
26
|
-
updatedAt: import("@sinclair/typebox").TString;
|
|
27
|
-
}>;
|
|
28
|
-
state: import("@sinclair/typebox").TObject<{
|
|
29
|
-
reported: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TAny>;
|
|
30
|
-
desired: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TAny>>;
|
|
31
|
-
version: import("@sinclair/typebox").TNumber;
|
|
32
|
-
}>;
|
|
33
|
-
}>>;
|
|
34
|
-
}>>;
|
|
35
|
-
}>;
|
|
36
19
|
type FwType = 'APP' | 'MODEM' | 'BOOT' | 'SOFTDEVICE' | 'BOOTLOADER' | 'MDM_FULL';
|
|
37
20
|
export declare const devices: ({ endpoint, apiKey, }: {
|
|
38
21
|
endpoint: URL;
|
|
@@ -46,7 +29,7 @@ export declare const devices: ({ endpoint, apiKey, }: {
|
|
|
46
29
|
get: (id: string) => Promise<{
|
|
47
30
|
error: Error | ValidationError;
|
|
48
31
|
} | {
|
|
49
|
-
result: Static<typeof
|
|
32
|
+
result: Static<typeof DeviceShadow>;
|
|
50
33
|
}>;
|
|
51
34
|
updateState: (id: string, state: {
|
|
52
35
|
desired?: Record<string, any>;
|
package/dist/api/devices.js
CHANGED
|
@@ -2,15 +2,11 @@ import { Type } from '@sinclair/typebox';
|
|
|
2
2
|
import { slashless } from './slashless.js';
|
|
3
3
|
import { ValidationError, validatedFetch } from './validatedFetch.js';
|
|
4
4
|
import { DeviceShadow } from './DeviceShadow.js';
|
|
5
|
-
const Device = Type.Object({
|
|
6
|
-
id: Type.String(),
|
|
7
|
-
state: Type.Optional(DeviceShadow),
|
|
8
|
-
});
|
|
9
5
|
const Page = (Item) => Type.Object({
|
|
10
6
|
total: Type.Integer(),
|
|
11
7
|
items: Type.Array(Item),
|
|
12
8
|
});
|
|
13
|
-
const Devices = Page(
|
|
9
|
+
const Devices = Page(DeviceShadow);
|
|
14
10
|
/**
|
|
15
11
|
* @link https://api.nrfcloud.com/v1/#tag/IP-Devices/operation/ProvisionDevices
|
|
16
12
|
*/
|
|
@@ -30,7 +26,7 @@ export const devices = ({ endpoint, apiKey, }, fetchImplementation) => {
|
|
|
30
26
|
deviceNameFuzzy: 'oob-',
|
|
31
27
|
}).toString()}`,
|
|
32
28
|
}, Devices),
|
|
33
|
-
get: async (id) => vf({ resource: `devices/${encodeURIComponent(id)}` },
|
|
29
|
+
get: async (id) => vf({ resource: `devices/${encodeURIComponent(id)}` }, DeviceShadow),
|
|
34
30
|
updateState: async (id, state) => fetch(`${slashless(endpoint)}/v1/devices/${encodeURIComponent(id)}/state`, {
|
|
35
31
|
headers: {
|
|
36
32
|
...headers,
|