@tstdl/base 0.91.32 → 0.91.33
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
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { NumberProperty } from '../schema/index.js';
|
|
11
11
|
import { Array } from '../schema/schemas/array.js';
|
|
12
12
|
import { Enumeration } from '../schema/schemas/enumeration.js';
|
|
13
13
|
export var PasswordStrength;
|
|
@@ -33,7 +33,7 @@ __decorate([
|
|
|
33
33
|
__metadata("design:type", Number)
|
|
34
34
|
], PasswordCheckResult.prototype, "strength", void 0);
|
|
35
35
|
__decorate([
|
|
36
|
-
|
|
36
|
+
NumberProperty({ optional: true }),
|
|
37
37
|
__metadata("design:type", Number)
|
|
38
38
|
], PasswordCheckResult.prototype, "pwned", void 0);
|
|
39
39
|
__decorate([
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { SetRequired } from 'type-fest';
|
|
1
2
|
import type { Decorator } from '../../reflection/index.js';
|
|
2
3
|
import type { TypedOmit } from '../../types.js';
|
|
3
4
|
import type { SchemaTestable } from '../schema.js';
|
|
4
5
|
import type { SchemaPropertyReflectionData } from './types.js';
|
|
5
6
|
export type SchemaPropertyDecoratorOptions = SchemaPropertyReflectionData;
|
|
7
|
+
export type SchemaPropertyDecoratorOptionsWithRequiredSchema = SetRequired<SchemaPropertyReflectionData, 'schema'>;
|
|
6
8
|
export type SchemaPropertyDecoratorOptionsWithoutSchema = TypedOmit<SchemaPropertyReflectionData, 'schema'>;
|
|
7
9
|
export declare function Property(schema: SchemaTestable, options?: SchemaPropertyDecoratorOptionsWithoutSchema): Decorator<'property' | 'accessor'>;
|
|
8
|
-
export declare function Property(options:
|
|
10
|
+
export declare function Property(options: SchemaPropertyDecoratorOptionsWithRequiredSchema): Decorator<'property' | 'accessor'>;
|
|
@@ -4,7 +4,7 @@ import { isSchemaTestable } from '../testable.js';
|
|
|
4
4
|
import { createSchemaPropertyDecorator } from './utils.js';
|
|
5
5
|
export function Property(schemaOrOptions, optionsOrNothing) {
|
|
6
6
|
if (isDefined(optionsOrNothing)) {
|
|
7
|
-
return createSchemaPropertyDecorator({ schema: schemaOrOptions
|
|
7
|
+
return createSchemaPropertyDecorator({ ...optionsOrNothing, schema: schemaOrOptions });
|
|
8
8
|
}
|
|
9
9
|
if (isSchemaTestable(schemaOrOptions)) {
|
|
10
10
|
return createSchemaPropertyDecorator({ schema: schemaOrOptions });
|
package/schema/schemas/object.js
CHANGED
|
@@ -163,7 +163,7 @@ function getObjectSchemaPropertiesFromReflection(metadata, type) {
|
|
|
163
163
|
}
|
|
164
164
|
let propertySchema = reflectionData?.schema ?? propertyMetadata.type;
|
|
165
165
|
if (isUndefined(propertySchema)) {
|
|
166
|
-
throw new Error(`Could not infer schema for "${String(key)}" on type ${type.name}. This happens if neither explicit @Property(type) is used nor reflection metadata is available.`);
|
|
166
|
+
throw new Error(`Could not infer schema for property "${String(key)}" on type ${type.name}. This happens if neither explicit @Property(type) is used nor reflection metadata is available.`);
|
|
167
167
|
}
|
|
168
168
|
if (reflectionData?.array == true) {
|
|
169
169
|
propertySchema = array(propertySchema);
|