@appsemble/node-utils 0.39.1 → 0.40.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.
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.39.1/config/assets/logo.svg) Appsemble Node Utilities
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.40.0/config/assets/logo.svg) Appsemble Node Utilities
2
2
 
3
3
  > NodeJS utilities used by Appsemble internally.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@appsemble/node-utils)](https://www.npmjs.com/package/@appsemble/node-utils)
6
- [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.39.1/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.39.1)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.40.0/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.40.0)
7
7
  [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
8
8
 
9
9
  ## Table of Contents
@@ -26,5 +26,5 @@ compatibility is not guaranteed.
26
26
 
27
27
  ## License
28
28
 
29
- [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.39.1/LICENSE.md) ©
29
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.40.0/LICENSE.md) ©
30
30
  [Appsemble](https://appsemble.com)
package/app.js CHANGED
@@ -170,7 +170,7 @@ export async function patchDefinition(appPath, patches) {
170
170
  doc.setIn(key, createPatchValue(doc, value));
171
171
  }
172
172
  }
173
- const prettierOptions = (await resolveConfig(path, { editorconfig: true }));
173
+ const prettierOptions = (await resolveConfig(path, { editorconfig: true })) ?? {};
174
174
  prettierOptions.parser = 'yaml';
175
175
  await writeFile(path, await format(String(doc), prettierOptions));
176
176
  logger.verbose(`Successfully updated ${path}`);
package/jsonschema.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { type ValidatorResult } from 'jsonschema';
2
2
  import { type Context } from 'koa';
3
- export declare function handleValidatorResult(ctx: Context, result: ValidatorResult, msg?: string): void;
3
+ export declare function handleValidatorResult(ctx: Context, result: ValidatorResult, msg?: string, code?: string): void;
package/jsonschema.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { throwKoaError } from './koa.js';
2
- export function handleValidatorResult(ctx, result, msg = 'JSON schema validation failed') {
2
+ export function handleValidatorResult(ctx, result, msg = 'JSON schema validation failed', code) {
3
3
  if (!result.valid) {
4
4
  if (ctx.response === undefined) {
5
5
  throw new Error(msg, { cause: result.errors });
6
6
  }
7
- throwKoaError(ctx, 400, msg, { errors: result.errors });
7
+ throwKoaError(ctx, 400, msg, { code, errors: result.errors });
8
8
  }
9
9
  }
10
10
  //# sourceMappingURL=jsonschema.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/node-utils",
3
- "version": "0.39.1",
3
+ "version": "0.40.0",
4
4
  "description": "NodeJS utilities used by Appsemble internally.",
5
5
  "keywords": [
6
6
  "app",
@@ -40,9 +40,9 @@
40
40
  "test": "vitest"
41
41
  },
42
42
  "dependencies": {
43
- "@appsemble/lang-sdk": "0.39.1",
44
- "@appsemble/types": "0.39.1",
45
- "@appsemble/utils": "0.39.1",
43
+ "@appsemble/lang-sdk": "0.40.0",
44
+ "@appsemble/types": "0.40.0",
45
+ "@appsemble/utils": "0.40.0",
46
46
  "@aws-sdk/client-s3": "3.1130.0",
47
47
  "@aws-sdk/lib-storage": "3.1130.0",
48
48
  "@formatjs/fast-memoize": "^2.0.0",
package/s3.d.ts CHANGED
@@ -30,8 +30,15 @@ export interface InitS3ClientParams {
30
30
  * on demand.
31
31
  */
32
32
  bucket?: string;
33
+ /**
34
+ * The time in milliseconds a request may go without socket activity before it fails with a
35
+ * `TimeoutError`, which the client retries.
36
+ *
37
+ * When unset, a stalled connection lasts until the operating system gives up on it.
38
+ */
39
+ socketTimeout?: number;
33
40
  }
34
- export declare function initS3Client({ accessKey, bucket, endPoint, pathStyle, port, region, secretKey, useSSL, }: InitS3ClientParams): void;
41
+ export declare function initS3Client({ accessKey, bucket, endPoint, pathStyle, port, region, secretKey, socketTimeout, useSSL, }: InitS3ClientParams): void;
35
42
  /**
36
43
  * @returns The configured single bucket, or `undefined` in the bucket-per-app layout.
37
44
  */
package/s3.js CHANGED
@@ -11,7 +11,7 @@ let s3Region;
11
11
  export const blockAssetsBucketName = 'appsemble-block-assets';
12
12
  // S3 limits the number of keys in a single DeleteObjects request.
13
13
  const deleteBatchSize = 1000;
14
- export function initS3Client({ accessKey, bucket, endPoint, pathStyle = true, port = 9000, region = 'us-east-1', secretKey, useSSL = true, }) {
14
+ export function initS3Client({ accessKey, bucket, endPoint, pathStyle = true, port = 9000, region = 'us-east-1', secretKey, socketTimeout, useSSL = true, }) {
15
15
  try {
16
16
  s3Client = new S3Client({
17
17
  endpoint: `${useSSL ? 'https' : 'http'}://${endPoint}:${port}`,
@@ -22,6 +22,7 @@ export function initS3Client({ accessKey, bucket, endPoint, pathStyle = true, po
22
22
  // S3-compatible stores that do not implement flexible checksums.
23
23
  requestChecksumCalculation: 'WHEN_REQUIRED',
24
24
  responseChecksumValidation: 'WHEN_REQUIRED',
25
+ ...(socketTimeout && { requestHandler: { socketTimeout } }),
25
26
  });
26
27
  s3Bucket = bucket || undefined;
27
28
  s3Region = region;