@tstdl/base 0.84.14 → 0.84.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.84.14",
3
+ "version": "0.84.15",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -63,7 +63,7 @@ function initializeSignals() {
63
63
  let quitReason;
64
64
  process.on("beforeExit", () => {
65
65
  if ((0, import_type_guards.isDefined)(quitReason)) {
66
- console.info("quit reason:", ...quitReason);
66
+ console.info("\nquit reason:", ...quitReason);
67
67
  }
68
68
  });
69
69
  for (const event of quitEvents) {
@@ -1,7 +1,9 @@
1
1
  import type { JsonPath } from '../../json-path/json-path.js';
2
- import type { CoercerContext, CoerceResult } from '../types/index.js';
2
+ import type { Schema } from '../schema.js';
3
+ import type { CoerceResult, CoercerContext } from '../types/index.js';
3
4
  import { SchemaValueCoercer } from '../types/index.js';
4
5
  export declare class Uint8ArrayCoercer extends SchemaValueCoercer {
6
+ static readonly byteNumberArraySchema: Schema<number[]>;
5
7
  readonly sourceType: ArrayConstructor;
6
8
  readonly targetType: Uint8ArrayConstructor;
7
9
  coerce(value: any[], path: JsonPath, { options }: CoercerContext): CoerceResult;
@@ -22,17 +22,21 @@ __export(uint8_array_coercer_exports, {
22
22
  uint8ArrayCoercer: () => uint8ArrayCoercer
23
23
  });
24
24
  module.exports = __toCommonJS(uint8_array_coercer_exports);
25
- var import_schema = require("../schema.js");
25
+ var import_lazy_property = require("../../utils/object/lazy-property.js");
26
26
  var import_schema_error = require("../schema.error.js");
27
+ var import_schema = require("../schema.js");
27
28
  var import_array = require("../schemas/array.js");
28
29
  var import_number = require("../schemas/number.js");
29
30
  var import_types = require("../types/index.js");
30
- const byteNumberArraySchema = (0, import_array.array)((0, import_number.number)({ integer: true, minimum: 0, maximum: 255 }));
31
31
  class Uint8ArrayCoercer extends import_types.SchemaValueCoercer {
32
+ static byteNumberArraySchema;
33
+ static {
34
+ (0, import_lazy_property.lazyProperty)(this, "byteNumberArraySchema", () => (0, import_array.array)((0, import_number.number)({ integer: true, minimum: 0, maximum: 255 })));
35
+ }
32
36
  sourceType = Array;
33
37
  targetType = Uint8Array;
34
38
  coerce(value, path, { options }) {
35
- const testResult = (0, import_schema.testSchema)(byteNumberArraySchema, value, options, path);
39
+ const testResult = (0, import_schema.testSchema)(Uint8ArrayCoercer.byteNumberArraySchema, value, options, path);
36
40
  if (!testResult.valid) {
37
41
  return { success: false, error: import_schema_error.SchemaError.couldNotCoerce(Uint8Array, Array, path, { inner: testResult.error, fast: options.fastErrors }) };
38
42
  }
@@ -27,7 +27,7 @@ var import_type_guards = require("../../utils/type-guards.js");
27
27
  var import_integer = require("../constraints/integer.js");
28
28
  var import_maximum = require("../constraints/maximum.js");
29
29
  var import_minimum = require("../constraints/minimum.js");
30
- var import_decorators = require("../decorators/index.js");
30
+ var import_utils = require("../decorators/utils.js");
31
31
  var import_types = require("../types/types.js");
32
32
  function number(options = {}) {
33
33
  const valueConstraints = (0, import_array.toArrayCopy)(options.valueConstraints ?? []);
@@ -46,5 +46,5 @@ function number(options = {}) {
46
46
  });
47
47
  }
48
48
  function NumberProperty(options) {
49
- return (0, import_decorators.createSchemaPropertyDecoratorFromSchema)(number(options));
49
+ return (0, import_utils.createSchemaPropertyDecoratorFromSchema)(number(options));
50
50
  }