@hello.nrfcloud.com/nrfcloud-api-helpers 5.3.89 → 6.0.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,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 CreatedFOTAJobType: import("@sinclair/typebox").TObject<{
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 CreatedFOTAJobType>;
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 CreatedFOTAJobType = Type.Object({
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
- }, CreatedFOTAJobType);
25
+ }, CreateFOTAJobType);
26
26
  if ('error' in maybeJob)
27
27
  return maybeJob;
28
28
  return maybeJob;
@@ -1,4 +1,5 @@
1
1
  export * from './bulkOps.js';
2
+ export * from './cancelFOTAJob.js';
2
3
  export * from './createAccountDevice.js';
3
4
  export * from './createFOTAJob.js';
4
5
  export * from './deleteAccountDevice.js';
package/dist/api/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './bulkOps.js';
2
+ export * from './cancelFOTAJob.js';
2
3
  export * from './createAccountDevice.js';
3
4
  export * from './createFOTAJob.js';
4
5
  export * from './deleteAccountDevice.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hello.nrfcloud.com/nrfcloud-api-helpers",
3
- "version": "5.3.89",
3
+ "version": "6.0.1",
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.6.1",
39
+ "@types/node": "22.7.2",
40
40
  "commitlint": "19.5.0",
41
41
  "husky": "9.1.6",
42
42
  "tsmatchers": "5.0.2",
@@ -83,9 +83,9 @@
83
83
  ],
84
84
  "prettier": "@bifravst/prettier-config",
85
85
  "peerDependencies": {
86
- "@aws-sdk/client-dynamodb": "^3.658.0",
87
- "@aws-sdk/client-ssm": "^3.658.0",
88
- "@aws-sdk/util-dynamodb": "^3.658.0",
86
+ "@aws-sdk/client-dynamodb": "^3.658.1",
87
+ "@aws-sdk/client-ssm": "^3.658.1",
88
+ "@aws-sdk/util-dynamodb": "^3.658.1",
89
89
  "@bifravst/aws-ssm-settings-helpers": "^1.2.32",
90
90
  "@hello.nrfcloud.com/proto": "^15.3.0",
91
91
  "@sinclair/typebox": "^0.33.12"