@hello.nrfcloud.com/nrfcloud-api-helpers 5.3.89 → 6.0.0
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,10 @@
|
|
|
1
|
+
import type { FetchError } from './FetchError.js';
|
|
2
|
+
import type { ValidationError } from './validatedFetch.js';
|
|
3
|
+
export declare const cancelFOTAJob: ({ apiKey, endpoint, }: {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
endpoint: URL;
|
|
6
|
+
}, fetchImplementation?: typeof fetch) => (jobId: string) => Promise<{
|
|
7
|
+
error: FetchError | ValidationError;
|
|
8
|
+
} | {
|
|
9
|
+
success: true;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { validatedFetch } from './validatedFetch.js';
|
|
3
|
+
export const cancelFOTAJob = ({ apiKey, endpoint, }, fetchImplementation) => async (jobId) => {
|
|
4
|
+
const maybeSuccess = await validatedFetch({
|
|
5
|
+
endpoint,
|
|
6
|
+
apiKey,
|
|
7
|
+
}, fetchImplementation)({
|
|
8
|
+
resource: `fota-jobs/${jobId}/cancel`,
|
|
9
|
+
method: 'PUT',
|
|
10
|
+
}, Type.Any());
|
|
11
|
+
if ('error' in maybeSuccess)
|
|
12
|
+
return maybeSuccess;
|
|
13
|
+
return { success: true };
|
|
14
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Static } from '@sinclair/typebox';
|
|
2
2
|
import type { FetchError } from './FetchError.js';
|
|
3
3
|
import type { ValidationError } from './validatedFetch.js';
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const CreateFOTAJobType: import("@sinclair/typebox").TObject<{
|
|
5
5
|
jobId: import("@sinclair/typebox").TString;
|
|
6
6
|
}>;
|
|
7
7
|
export declare const createFOTAJob: ({ apiKey, endpoint, }: {
|
|
@@ -13,5 +13,5 @@ export declare const createFOTAJob: ({ apiKey, endpoint, }: {
|
|
|
13
13
|
}) => Promise<{
|
|
14
14
|
error: FetchError | ValidationError;
|
|
15
15
|
} | {
|
|
16
|
-
result: Static<typeof
|
|
16
|
+
result: Static<typeof CreateFOTAJobType>;
|
|
17
17
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Type } from '@sinclair/typebox';
|
|
2
2
|
import { JSONPayload, validatedFetch } from './validatedFetch.js';
|
|
3
|
-
export const
|
|
3
|
+
export const CreateFOTAJobType = Type.Object({
|
|
4
4
|
jobId: Type.String({
|
|
5
5
|
minLength: 1,
|
|
6
6
|
title: 'ID',
|
|
@@ -22,7 +22,7 @@ export const createFOTAJob = ({ apiKey, endpoint, }, fetchImplementation) => asy
|
|
|
22
22
|
autoApply: true,
|
|
23
23
|
deviceIdentifiers: [deviceId],
|
|
24
24
|
}),
|
|
25
|
-
},
|
|
25
|
+
}, CreateFOTAJobType);
|
|
26
26
|
if ('error' in maybeJob)
|
|
27
27
|
return maybeJob;
|
|
28
28
|
return maybeJob;
|
package/dist/api/index.d.ts
CHANGED
package/dist/api/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hello.nrfcloud.com/nrfcloud-api-helpers",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Helper functions for integrating nRF Cloud APIs in AWS lambdas written in TypeScript.",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./*": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@bifravst/prettier-config": "1.1.1",
|
|
37
37
|
"@commitlint/config-conventional": "19.5.0",
|
|
38
38
|
"@types/aws-lambda": "8.10.145",
|
|
39
|
-
"@types/node": "22.
|
|
39
|
+
"@types/node": "22.7.1",
|
|
40
40
|
"commitlint": "19.5.0",
|
|
41
41
|
"husky": "9.1.6",
|
|
42
42
|
"tsmatchers": "5.0.2",
|