@tstdl/base 0.91.0-beta8 → 0.91.0-beta9
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/examples/api/basic-overview.js +2 -2
- package/image-service/image-service.js +4 -4
- package/mail/mail.client.js +2 -2
- package/orm/entity.js +2 -2
- package/package.json +1 -1
- package/schema/schemas/bigint.d.ts +1 -1
- package/schema/schemas/bigint.js +1 -1
- package/schema/schemas/boolean.d.ts +0 -4
- package/schema/schemas/boolean.js +1 -7
- package/schema/schemas/date.d.ts +1 -1
- package/schema/schemas/date.js +1 -1
- package/schema/schemas/function.d.ts +1 -1
- package/schema/schemas/function.js +1 -1
- package/schema/schemas/number.d.ts +1 -5
- package/schema/schemas/number.js +1 -7
- package/schema/schemas/object.js +1 -1
- package/schema/schemas/readable-stream.d.ts +1 -1
- package/schema/schemas/readable-stream.js +1 -1
- package/schema/schemas/regexp.d.ts +1 -1
- package/schema/schemas/regexp.js +1 -1
- package/schema/schemas/string.d.ts +0 -4
- package/schema/schemas/string.js +1 -7
- package/schema/schemas/symbol.d.ts +0 -4
- package/schema/schemas/symbol.js +1 -7
- package/schema/schemas/uint8-array.d.ts +1 -1
- package/schema/schemas/uint8-array.js +3 -3
|
@@ -18,7 +18,7 @@ import { configureHttpClient } from '../../http/client/module.js';
|
|
|
18
18
|
import { configureNodeHttpServer } from '../../http/server/node/module.js';
|
|
19
19
|
import { inject } from '../../injector/inject.js';
|
|
20
20
|
import { WebServerModule } from '../../module/modules/web-server.module.js';
|
|
21
|
-
import {
|
|
21
|
+
import { NumberProperty, Property, array, boolean, number, object } from '../../schema/index.js';
|
|
22
22
|
import { timeout } from '../../utils/timing.js';
|
|
23
23
|
import { Agent } from 'undici';
|
|
24
24
|
class User {
|
|
@@ -26,7 +26,7 @@ class User {
|
|
|
26
26
|
name;
|
|
27
27
|
}
|
|
28
28
|
__decorate([
|
|
29
|
-
|
|
29
|
+
NumberProperty({ coerce: true }),
|
|
30
30
|
__metadata("design:type", Number)
|
|
31
31
|
], User.prototype, "id", void 0);
|
|
32
32
|
__decorate([
|
|
@@ -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 { Enumeration,
|
|
10
|
+
import { Enumeration, NumberProperty, Optional } from '../schema/index.js';
|
|
11
11
|
export var ImageResizeMode;
|
|
12
12
|
(function (ImageResizeMode) {
|
|
13
13
|
ImageResizeMode["Fit"] = "fit";
|
|
@@ -49,11 +49,11 @@ __decorate([
|
|
|
49
49
|
__metadata("design:type", String)
|
|
50
50
|
], ImageOptions.prototype, "resizeMode", void 0);
|
|
51
51
|
__decorate([
|
|
52
|
-
|
|
52
|
+
NumberProperty({ optional: true, coerce: true }),
|
|
53
53
|
__metadata("design:type", Number)
|
|
54
54
|
], ImageOptions.prototype, "width", void 0);
|
|
55
55
|
__decorate([
|
|
56
|
-
|
|
56
|
+
NumberProperty({ optional: true, coerce: true }),
|
|
57
57
|
__metadata("design:type", Number)
|
|
58
58
|
], ImageOptions.prototype, "height", void 0);
|
|
59
59
|
__decorate([
|
|
@@ -62,7 +62,7 @@ __decorate([
|
|
|
62
62
|
__metadata("design:type", String)
|
|
63
63
|
], ImageOptions.prototype, "origin", void 0);
|
|
64
64
|
__decorate([
|
|
65
|
-
|
|
65
|
+
NumberProperty({ optional: true, coerce: true }),
|
|
66
66
|
__metadata("design:type", Number)
|
|
67
67
|
], ImageOptions.prototype, "quality", void 0);
|
|
68
68
|
__decorate([
|
package/mail/mail.client.js
CHANGED
|
@@ -8,7 +8,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
10
|
import { Property } from '../schema/decorators/property.js';
|
|
11
|
-
import {
|
|
11
|
+
import { BooleanProperty } from '../schema/index.js';
|
|
12
12
|
import { Optional } from '../schema/schemas/optional.js';
|
|
13
13
|
export class MailClientAuthConfig {
|
|
14
14
|
user;
|
|
@@ -38,7 +38,7 @@ __decorate([
|
|
|
38
38
|
__metadata("design:type", Number)
|
|
39
39
|
], MailClientConfig.prototype, "port", void 0);
|
|
40
40
|
__decorate([
|
|
41
|
-
|
|
41
|
+
BooleanProperty({ optional: true }),
|
|
42
42
|
__metadata("design:type", Boolean)
|
|
43
43
|
], MailClientConfig.prototype, "secure", void 0);
|
|
44
44
|
__decorate([
|
package/orm/entity.js
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, Property, any, record } from '../schema/index.js';
|
|
11
11
|
export class EntityMetadata {
|
|
12
12
|
revision;
|
|
13
13
|
revisionTimestamp;
|
|
@@ -28,7 +28,7 @@ __decorate([
|
|
|
28
28
|
__metadata("design:type", Number)
|
|
29
29
|
], EntityMetadata.prototype, "createTimestamp", void 0);
|
|
30
30
|
__decorate([
|
|
31
|
-
|
|
31
|
+
NumberProperty({ nullable: true }),
|
|
32
32
|
__metadata("design:type", Object)
|
|
33
33
|
], EntityMetadata.prototype, "deleteTimestamp", void 0);
|
|
34
34
|
__decorate([
|
package/package.json
CHANGED
|
@@ -6,4 +6,4 @@ export declare class BigIntSchema extends Schema<bigint> {
|
|
|
6
6
|
_test(value: any, path: JsonPath, options: SchemaTestOptions): SchemaTestResult<bigint>;
|
|
7
7
|
}
|
|
8
8
|
export declare function bigint(): BigIntSchema;
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function BigIntProperty(options?: SchemaPropertyDecoratorOptions): SchemaPropertyDecorator;
|
package/schema/schemas/bigint.js
CHANGED
|
@@ -8,8 +8,4 @@ export declare class BooleanSchema extends SimpleSchema<boolean> {
|
|
|
8
8
|
_test(value: any, path: JsonPath, options: SchemaTestOptions): SchemaTestResult<boolean>;
|
|
9
9
|
}
|
|
10
10
|
export declare function boolean(options?: BooleanSchemaOptions): BooleanSchema;
|
|
11
|
-
export declare function Boolean(options?: BooleanSchemaOptions & SchemaPropertyDecoratorOptions): SchemaPropertyDecorator;
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated use {@link Boolean()} instead
|
|
14
|
-
*/
|
|
15
11
|
export declare function BooleanProperty(options?: BooleanSchemaOptions & SchemaPropertyDecoratorOptions): SchemaPropertyDecorator;
|
|
@@ -39,12 +39,6 @@ export class BooleanSchema extends SimpleSchema {
|
|
|
39
39
|
export function boolean(options) {
|
|
40
40
|
return new BooleanSchema(options);
|
|
41
41
|
}
|
|
42
|
-
export function Boolean(options) {
|
|
43
|
-
return Property(boolean(options), options);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated use {@link Boolean()} instead
|
|
47
|
-
*/
|
|
48
42
|
export function BooleanProperty(options) {
|
|
49
|
-
return
|
|
43
|
+
return Property(boolean(options), options);
|
|
50
44
|
}
|
package/schema/schemas/date.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ export declare class DateSchema extends SimpleSchema<globalThis.Date> {
|
|
|
7
7
|
constructor(options?: DateSchemaOptions);
|
|
8
8
|
}
|
|
9
9
|
export declare function date(options?: DateSchemaOptions): DateSchema;
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function DateProperty(options?: SchemaPropertyDecoratorOptions & DateSchemaOptions): SchemaPropertyDecorator;
|
package/schema/schemas/date.js
CHANGED
|
@@ -5,4 +5,4 @@ export declare class FunctionSchema extends SimpleSchema<Function> {
|
|
|
5
5
|
constructor(options?: FunctionSchemaOptions);
|
|
6
6
|
}
|
|
7
7
|
export declare function func(): FunctionSchema;
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function FunctionProperty(options?: SchemaPropertyDecoratorOptions): SchemaPropertyDecorator;
|
|
@@ -7,9 +7,5 @@ export declare class NumberSchema extends SimpleSchema<number> {
|
|
|
7
7
|
constructor(options?: NumberSchemaOptions);
|
|
8
8
|
}
|
|
9
9
|
export declare function number(options?: NumberSchemaOptions): NumberSchema;
|
|
10
|
-
export declare function Number(options?: SchemaPropertyDecoratorOptions & NumberSchemaOptions): SchemaPropertyDecorator;
|
|
11
|
-
export declare function Integer(options?: SchemaPropertyDecoratorOptions & NumberSchemaOptions): SchemaPropertyDecorator;
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated use {@link Number()} instead
|
|
14
|
-
*/
|
|
15
10
|
export declare function NumberProperty(options?: SchemaPropertyDecoratorOptions & NumberSchemaOptions): SchemaPropertyDecorator;
|
|
11
|
+
export declare function Integer(options?: SchemaPropertyDecoratorOptions & NumberSchemaOptions): SchemaPropertyDecorator;
|
package/schema/schemas/number.js
CHANGED
|
@@ -24,15 +24,9 @@ export class NumberSchema extends SimpleSchema {
|
|
|
24
24
|
export function number(options) {
|
|
25
25
|
return new NumberSchema(options);
|
|
26
26
|
}
|
|
27
|
-
export function
|
|
27
|
+
export function NumberProperty(options) {
|
|
28
28
|
return Property(number(options), options);
|
|
29
29
|
}
|
|
30
30
|
export function Integer(options) {
|
|
31
31
|
return Property(number({ ...options, integer: true }), options);
|
|
32
32
|
}
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated use {@link Number()} instead
|
|
35
|
-
*/
|
|
36
|
-
export function NumberProperty(options) {
|
|
37
|
-
return Number(options);
|
|
38
|
-
}
|
package/schema/schemas/object.js
CHANGED
|
@@ -155,7 +155,7 @@ function getObjectSchemaPropertiesFromReflection(metadata, type) {
|
|
|
155
155
|
for (const [key, propertyMetadata] of metadata.properties) {
|
|
156
156
|
const reflectionData = propertyMetadata.data.tryGet('schema');
|
|
157
157
|
if (isUndefined(reflectionData?.schema) && (propertyMetadata.type == Object)) {
|
|
158
|
-
throw new Error(`Schema of property "${String(key)}" on type ${type.name} is inferred as Object. This is most likely unwanted and happens when the property is defined as partial or the type is an union. Use an explicit @Property(Object) if wanted.`);
|
|
158
|
+
throw new Error(`Schema of property "${String(key)}" on type ${type.name} is inferred as Object. This is most likely unwanted and happens when the property is defined as partial or the type is an union. Use an explicit @Property(Object) if this is wanted.`);
|
|
159
159
|
}
|
|
160
160
|
let propertySchema = reflectionData?.schema ?? propertyMetadata.type;
|
|
161
161
|
if (reflectionData?.array == true) {
|
|
@@ -5,4 +5,4 @@ export declare class ReadableStreamSchema extends SimpleSchema<ReadableStream> {
|
|
|
5
5
|
constructor(options?: ReadableStreamSchemaOptions);
|
|
6
6
|
}
|
|
7
7
|
export declare function readableStream(options?: ReadableStreamSchemaOptions): ReadableStreamSchema;
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function ReadableStreamProperty(options?: SchemaPropertyDecoratorOptions & ReadableStreamSchemaOptions): SchemaPropertyDecorator;
|
|
@@ -9,6 +9,6 @@ export class ReadableStreamSchema extends SimpleSchema {
|
|
|
9
9
|
export function readableStream(options) {
|
|
10
10
|
return new ReadableStreamSchema(options);
|
|
11
11
|
}
|
|
12
|
-
export function
|
|
12
|
+
export function ReadableStreamProperty(options) {
|
|
13
13
|
return Property(readableStream(options), options);
|
|
14
14
|
}
|
|
@@ -5,4 +5,4 @@ export declare class RegExpSchema extends SimpleSchema<RegExp> {
|
|
|
5
5
|
constructor(options?: RegExpSchemaOptions);
|
|
6
6
|
}
|
|
7
7
|
export declare function regExp(options?: RegExpSchemaOptions): RegExpSchema;
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function RegExpProperty(options?: SchemaPropertyDecoratorOptions & RegExpSchemaOptions): SchemaPropertyDecorator;
|
package/schema/schemas/regexp.js
CHANGED
|
@@ -7,8 +7,4 @@ export declare class StringSchema extends SimpleSchema<string> {
|
|
|
7
7
|
constructor(options?: StringSchemaOptions);
|
|
8
8
|
}
|
|
9
9
|
export declare function string(options?: StringSchemaOptions): StringSchema;
|
|
10
|
-
export declare function String(options?: SchemaPropertyDecoratorOptions & StringSchemaOptions): SchemaPropertyDecorator;
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated use {@link String()} instead
|
|
13
|
-
*/
|
|
14
10
|
export declare function StringProperty(options?: SchemaPropertyDecoratorOptions & StringSchemaOptions): SchemaPropertyDecorator;
|
package/schema/schemas/string.js
CHANGED
|
@@ -19,12 +19,6 @@ export class StringSchema extends SimpleSchema {
|
|
|
19
19
|
export function string(options) {
|
|
20
20
|
return new StringSchema(options);
|
|
21
21
|
}
|
|
22
|
-
export function String(options) {
|
|
23
|
-
return Property(string(options), options);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated use {@link String()} instead
|
|
27
|
-
*/
|
|
28
22
|
export function StringProperty(options) {
|
|
29
|
-
return
|
|
23
|
+
return Property(string(options), options);
|
|
30
24
|
}
|
|
@@ -5,8 +5,4 @@ export declare class SymbolSchema extends Schema<symbol> {
|
|
|
5
5
|
_test(value: any, path: JsonPath, options: SchemaTestOptions): SchemaTestResult<symbol>;
|
|
6
6
|
}
|
|
7
7
|
export declare function symbol(): SymbolSchema;
|
|
8
|
-
export declare function Symbol(options?: SchemaPropertyDecoratorOptions): SchemaPropertyDecorator;
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated use {@link Symbol()} instead
|
|
11
|
-
*/
|
|
12
8
|
export declare function SymbolProperty(options?: SchemaPropertyDecoratorOptions): SchemaPropertyDecorator;
|
package/schema/schemas/symbol.js
CHANGED
|
@@ -14,12 +14,6 @@ export class SymbolSchema extends Schema {
|
|
|
14
14
|
export function symbol() {
|
|
15
15
|
return new SymbolSchema();
|
|
16
16
|
}
|
|
17
|
-
export function Symbol(options) {
|
|
18
|
-
return Property(symbol(), options);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated use {@link Symbol()} instead
|
|
22
|
-
*/
|
|
23
17
|
export function SymbolProperty(options) {
|
|
24
|
-
return
|
|
18
|
+
return Property(symbol(), options);
|
|
25
19
|
}
|
|
@@ -11,4 +11,4 @@ export declare class Uint8ArraySchema extends SimpleSchema<Uint8Array> {
|
|
|
11
11
|
constructor(options?: Uint8ArraySchemaOptions);
|
|
12
12
|
}
|
|
13
13
|
export declare function uint8Array(options?: Uint8ArraySchemaOptions): Uint8ArraySchema;
|
|
14
|
-
export declare function
|
|
14
|
+
export declare function Uint8ArrayProperty(schemaOptions?: Uint8ArraySchemaOptions, options?: SchemaPropertyDecoratorOptions): SchemaPropertyDecorator;
|
|
@@ -6,8 +6,8 @@ export class Uint8ArraySchema extends SimpleSchema {
|
|
|
6
6
|
constructor(options) {
|
|
7
7
|
super('Uint8Array', isUint8Array, options, {
|
|
8
8
|
constraints: [
|
|
9
|
-
isDefined(options?.minimumLength) ? (value) => (value.byteLength >= options.minimumLength) ? ({ success: true }) : ({ success: false, error: `
|
|
10
|
-
isDefined(options?.maximumLength) ? (value) => (value.byteLength <= options.maximumLength) ? ({ success: true }) : ({ success: false, error: `
|
|
9
|
+
isDefined(options?.minimumLength) ? (value) => (value.byteLength >= options.minimumLength) ? ({ success: true }) : ({ success: false, error: `Size must be at least ${options.minimumLength} bytes.` }) : null,
|
|
10
|
+
isDefined(options?.maximumLength) ? (value) => (value.byteLength <= options.maximumLength) ? ({ success: true }) : ({ success: false, error: `Size must be at most ${options.maximumLength} bytes.` }) : null
|
|
11
11
|
]
|
|
12
12
|
});
|
|
13
13
|
}
|
|
@@ -15,6 +15,6 @@ export class Uint8ArraySchema extends SimpleSchema {
|
|
|
15
15
|
export function uint8Array(options) {
|
|
16
16
|
return new Uint8ArraySchema(options);
|
|
17
17
|
}
|
|
18
|
-
export function
|
|
18
|
+
export function Uint8ArrayProperty(schemaOptions, options) {
|
|
19
19
|
return Property(uint8Array(schemaOptions), options);
|
|
20
20
|
}
|