@tstdl/base 0.82.0 → 0.82.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.
- package/api/utils.js +3 -1
- package/api/utils.js.map +1 -1
- package/authentication/authentication-credentials.service.d.ts +2 -2
- package/authentication/authentication-session.repository.d.ts +6 -0
- package/authentication/{authentication-session.service.js → authentication-session.repository.js} +7 -6
- package/authentication/authentication-session.repository.js.map +1 -0
- package/authentication/authentication.service.d.ts +3 -3
- package/authentication/authentication.service.js +7 -7
- package/authentication/authentication.service.js.map +1 -1
- package/authentication/models/authentication-credentials.model.d.ts +6 -1
- package/authentication/models/authentication-credentials.model.js +9 -2
- package/authentication/models/authentication-credentials.model.js.map +1 -1
- package/authentication/models/authentication-session.model.d.ts +6 -1
- package/authentication/models/authentication-session.model.js +9 -2
- package/authentication/models/authentication-session.model.js.map +1 -1
- package/container/container.js +3 -3
- package/container/container.js.map +1 -1
- package/container/decorators.js +0 -1
- package/container/decorators.js.map +1 -1
- package/container/resolve-chain.js +1 -1
- package/container/resolve-chain.js.map +1 -1
- package/mail/mail.service.d.ts +3 -1
- package/mail/mail.service.js +11 -6
- package/mail/mail.service.js.map +1 -1
- package/mail/models/mail-data.model.d.ts +1 -0
- package/mail/module.d.ts +3 -1
- package/mail/module.js +6 -2
- package/mail/module.js.map +1 -1
- package/mail/tokens.d.ts +1 -0
- package/mail/tokens.js +2 -1
- package/mail/tokens.js.map +1 -1
- package/notification/api.d.ts +2 -5
- package/notification/api.js +2 -5
- package/notification/api.js.map +1 -1
- package/notification/models/index.d.ts +2 -0
- package/notification/models/index.js +19 -0
- package/notification/models/index.js.map +1 -0
- package/notification/models/notification-channel-job.model.d.ts +3 -0
- package/notification/models/notification-channel-job.model.js +3 -0
- package/notification/models/notification-channel-job.model.js.map +1 -0
- package/notification/models/notification.model.d.ts +27 -0
- package/notification/{model.js → models/notification.model.js} +28 -16
- package/notification/models/notification.model.js.map +1 -0
- package/notification/notification-channel.service.d.ts +5 -0
- package/notification/notification-channel.service.js +7 -0
- package/notification/notification-channel.service.js.map +1 -0
- package/notification/notification.service.d.ts +8 -0
- package/notification/notification.service.js +40 -0
- package/notification/notification.service.js.map +1 -0
- package/orm/decorators.d.ts +26 -0
- package/orm/decorators.js +170 -0
- package/orm/decorators.js.map +1 -1
- package/orm/entity-definition.model.d.ts +51 -0
- package/orm/entity-definition.model.js +27 -0
- package/orm/entity-definition.model.js.map +1 -0
- package/orm/index.d.ts +1 -0
- package/orm/index.js +18 -0
- package/orm/index.js.map +1 -0
- package/orm/models/entity.d.ts +22 -0
- package/orm/models/entity.js +87 -0
- package/orm/models/entity.js.map +1 -0
- package/orm/models/index.d.ts +1 -0
- package/orm/models/index.js +18 -0
- package/orm/models/index.js.map +1 -0
- package/orm/repository/mongo/classes.d.ts +25 -0
- package/orm/repository/mongo/classes.js +33 -0
- package/orm/repository/mongo/classes.js.map +1 -0
- package/orm/repository/mongo/module.d.ts +8 -0
- package/orm/repository/mongo/module.js +88 -0
- package/orm/repository/mongo/module.js.map +1 -0
- package/orm/repository/mongo/mongo-repository.d.ts +11 -0
- package/orm/repository/mongo/mongo-repository.js +55 -0
- package/orm/repository/mongo/mongo-repository.js.map +1 -0
- package/orm/repository/mongo/mongo-transaction.d.ts +10 -0
- package/orm/repository/mongo/mongo-transaction.js +28 -0
- package/orm/repository/mongo/mongo-transaction.js.map +1 -0
- package/orm/repository/repository.d.ts +75 -0
- package/orm/repository/repository.js +182 -0
- package/orm/repository/repository.js.map +1 -0
- package/orm/repository/transaction.d.ts +26 -0
- package/orm/repository/transaction.js +65 -0
- package/orm/repository/transaction.js.map +1 -0
- package/orm/{types.d.ts → types/definition.d.ts} +1 -1
- package/orm/{types.js → types/definition.js} +8 -8
- package/orm/types/definition.js.map +1 -0
- package/orm/types/index.d.ts +3 -0
- package/orm/types/index.js +20 -0
- package/orm/types/index.js.map +1 -0
- package/orm/types/options.d.ts +36 -0
- package/orm/types/options.js +5 -0
- package/orm/types/options.js.map +1 -0
- package/orm/types/query.d.ts +110 -0
- package/orm/types/query.js +10 -0
- package/orm/types/query.js.map +1 -0
- package/package.json +3 -3
- package/reflection/decorator-data.js +2 -1
- package/reflection/decorator-data.js.map +1 -1
- package/reflection/registry.d.ts +9 -8
- package/reflection/registry.js +25 -10
- package/reflection/registry.js.map +1 -1
- package/reflection/types.d.ts +2 -2
- package/reflection/utils.d.ts +3 -3
- package/reflection/utils.js +6 -6
- package/reflection/utils.js.map +1 -1
- package/schema/array-constraints/maximum-length.d.ts +2 -2
- package/schema/array-constraints/maximum-length.js +2 -2
- package/schema/array-constraints/maximum-length.js.map +1 -1
- package/schema/array-constraints/minimum-length.d.ts +2 -2
- package/schema/array-constraints/minimum-length.js +2 -2
- package/schema/array-constraints/minimum-length.js.map +1 -1
- package/schema/constraints/enumeration.d.ts +4 -4
- package/schema/constraints/enumeration.js +5 -5
- package/schema/constraints/enumeration.js.map +1 -1
- package/schema/constraints/generic.d.ts +2 -2
- package/schema/constraints/generic.js +2 -2
- package/schema/constraints/generic.js.map +1 -1
- package/schema/constraints/integer.d.ts +2 -2
- package/schema/constraints/integer.js +3 -2
- package/schema/constraints/integer.js.map +1 -1
- package/schema/constraints/literal.d.ts +2 -2
- package/schema/constraints/literal.js +2 -2
- package/schema/constraints/literal.js.map +1 -1
- package/schema/constraints/maximum-date.d.ts +2 -2
- package/schema/constraints/maximum-date.js +3 -2
- package/schema/constraints/maximum-date.js.map +1 -1
- package/schema/constraints/maximum-length.d.ts +2 -2
- package/schema/constraints/maximum-length.js +2 -2
- package/schema/constraints/maximum-length.js.map +1 -1
- package/schema/constraints/maximum.d.ts +2 -2
- package/schema/constraints/maximum.js +3 -2
- package/schema/constraints/maximum.js.map +1 -1
- package/schema/constraints/minimum-date.d.ts +2 -2
- package/schema/constraints/minimum-date.js +3 -2
- package/schema/constraints/minimum-date.js.map +1 -1
- package/schema/constraints/minimum-length.d.ts +2 -2
- package/schema/constraints/minimum-length.js +2 -2
- package/schema/constraints/minimum-length.js.map +1 -1
- package/schema/constraints/minimum.d.ts +2 -2
- package/schema/constraints/minimum.js +3 -2
- package/schema/constraints/minimum.js.map +1 -1
- package/schema/constraints/pattern.d.ts +2 -2
- package/schema/constraints/pattern.js +3 -2
- package/schema/constraints/pattern.js.map +1 -1
- package/schema/decorators/utils.d.ts +4 -1
- package/schema/decorators/utils.js +1 -1
- package/schema/decorators/utils.js.map +1 -1
- package/schema/schemas/array.d.ts +1 -1
- package/schema/schemas/array.js +2 -2
- package/schema/schemas/array.js.map +1 -1
- package/schema/schemas/date.d.ts +1 -1
- package/schema/schemas/date.js +2 -2
- package/schema/schemas/date.js.map +1 -1
- package/schema/schemas/enumeration.d.ts +1 -1
- package/schema/schemas/enumeration.js +2 -2
- package/schema/schemas/enumeration.js.map +1 -1
- package/schema/schemas/literal.d.ts +1 -1
- package/schema/schemas/literal.js +2 -2
- package/schema/schemas/literal.js.map +1 -1
- package/schema/schemas/number.d.ts +1 -1
- package/schema/schemas/number.js +2 -2
- package/schema/schemas/number.js.map +1 -1
- package/schema/schemas/omit.d.ts +2 -2
- package/schema/schemas/omit.js.map +1 -1
- package/schema/schemas/string.d.ts +1 -1
- package/schema/schemas/string.js +3 -3
- package/schema/schemas/string.js.map +1 -1
- package/schema/schemas/uint8-array.d.ts +1 -1
- package/schema/schemas/uint8-array.js +3 -3
- package/schema/schemas/uint8-array.js.map +1 -1
- package/schema/types/index.d.ts +5 -0
- package/schema/types/index.js +22 -0
- package/schema/types/index.js.map +1 -0
- package/schema/types/schema-array-constraint.d.ts +5 -0
- package/schema/types/schema-array-constraint.js +7 -0
- package/schema/types/schema-array-constraint.js.map +1 -0
- package/schema/types/schema-value-coercer.d.ts +8 -0
- package/schema/types/schema-value-coercer.js +7 -0
- package/schema/types/schema-value-coercer.js.map +1 -0
- package/schema/types/schema-value-constraint.d.ts +8 -0
- package/schema/types/schema-value-constraint.js +7 -0
- package/schema/types/schema-value-constraint.js.map +1 -0
- package/schema/types/schema-value-transformer.d.ts +7 -0
- package/schema/types/schema-value-transformer.js +7 -0
- package/schema/types/schema-value-transformer.js.map +1 -0
- package/schema/{types.d.ts → types/types.d.ts} +16 -26
- package/schema/types/types.js +174 -0
- package/schema/types/types.js.map +1 -0
- package/schema/utils/schema.js +1 -1
- package/schema/utils/schema.js.map +1 -1
- package/schema/utils/value-type.d.ts +1 -1
- package/schema/utils/value-type.js +1 -1
- package/schema/utils/value-type.js.map +1 -1
- package/utils/array/array.d.ts +14 -1
- package/utils/array/array.js +16 -2
- package/utils/array/array.js.map +1 -1
- package/utils/object/object.js +1 -2
- package/utils/object/object.js.map +1 -1
- package/authentication/authentication-session.service.d.ts +0 -6
- package/authentication/authentication-session.service.js.map +0 -1
- package/notification/model.d.ts +0 -18
- package/notification/model.js.map +0 -1
- package/orm/mongo/mongo-repository.d.ts +0 -2
- package/orm/mongo/mongo-repository.js +0 -7
- package/orm/mongo/mongo-repository.js.map +0 -1
- package/orm/types.js.map +0 -1
- package/schema/types.js +0 -102
- package/schema/types.js.map +0 -1
|
@@ -4,8 +4,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.Minimum = exports.MinimumConstraint = void 0;
|
|
5
5
|
const utils_1 = require("../decorators/utils");
|
|
6
6
|
const schema_error_1 = require("../schema.error");
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const schema_value_constraint_1 = require("../types/schema-value-constraint");
|
|
8
|
+
const types_1 = require("../types/types");
|
|
9
|
+
class MinimumConstraint extends schema_value_constraint_1.SchemaValueConstraint {
|
|
9
10
|
minimum;
|
|
10
11
|
suitableTypes = Number;
|
|
11
12
|
expects;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minimum.js","sourceRoot":"","sources":["../../../source/schema/constraints/minimum.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,+CAA2E;AAC3E,kDAA8C;
|
|
1
|
+
{"version":3,"file":"minimum.js","sourceRoot":"","sources":["../../../source/schema/constraints/minimum.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,+CAA2E;AAC3E,kDAA8C;AAC9C,8EAAyE;AAEzE,0CAA4C;AAE5C,MAAa,iBAAkB,SAAQ,+CAAqB;IACzC,OAAO,CAAS;IAExB,aAAa,GAAG,MAAM,CAAC;IACvB,OAAO,CAAS;IAEzB,YAAY,OAAe;QACzB,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc,EAAE,OAA0B;QAChE,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE;YACxB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACxI;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AApBD,8CAoBC;AAED,SAAgB,OAAO,CAAC,OAAe;IACrC,OAAO,IAAA,4CAAoC,EAAC,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAA,kBAAU,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC9G,CAAC;AAFD,0BAEC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { JsonPath } from "../../json-path/json-path";
|
|
2
2
|
import type { Decorator } from "../../reflection";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import { SchemaValueConstraint } from '../types/schema-value-constraint';
|
|
4
|
+
import type { ConstraintContext, ConstraintResult } from '../types/types';
|
|
5
5
|
export declare class PatternConstraint extends SchemaValueConstraint {
|
|
6
6
|
private readonly pattern;
|
|
7
7
|
private readonly patternName;
|
|
@@ -4,8 +4,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.Pattern = exports.PatternConstraint = void 0;
|
|
5
5
|
const utils_1 = require("../decorators/utils");
|
|
6
6
|
const schema_error_1 = require("../schema.error");
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const schema_value_constraint_1 = require("../types/schema-value-constraint");
|
|
8
|
+
const types_1 = require("../types/types");
|
|
9
|
+
class PatternConstraint extends schema_value_constraint_1.SchemaValueConstraint {
|
|
9
10
|
pattern;
|
|
10
11
|
patternName;
|
|
11
12
|
suitableTypes = String;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../../source/schema/constraints/pattern.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,+CAA2E;AAC3E,kDAA8C;
|
|
1
|
+
{"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../../source/schema/constraints/pattern.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,+CAA2E;AAC3E,kDAA8C;AAC9C,8EAAyE;AAEzE,0CAA4C;AAE5C,MAAa,iBAAkB,SAAQ,+CAAqB;IACzC,OAAO,CAAS;IAChB,WAAW,CAAqB;IAExC,aAAa,GAAG,MAAM,CAAC;IACvB,OAAO,CAAS;IAEzB,YAAY,OAAe,EAAE,cAAsB,WAAW;QAC5D,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,YAAY,IAAI,CAAC,WAAW,EAAE,CAAC;IAChD,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc,EAAE,OAA0B;QAChE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAC7B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,KAAK,GAAG,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACpI;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAtBD,8CAsBC;AAED,SAAgB,OAAO,CAAC,OAAe,EAAE,WAAoB;IAC3D,OAAO,IAAA,4CAAoC,EAAC,IAAI,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,IAAA,kBAAU,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC3H,CAAC;AAFD,0BAEC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { Decorator, PropertyMetadata } from "../../reflection";
|
|
2
2
|
import type { OneOrMany } from "../../types";
|
|
3
3
|
import type { Schema } from '../schema';
|
|
4
|
-
import type { SchemaArrayConstraint
|
|
4
|
+
import type { SchemaArrayConstraint } from '../types/schema-array-constraint';
|
|
5
|
+
import type { SchemaValueCoercer } from '../types/schema-value-coercer';
|
|
6
|
+
import type { SchemaValueConstraint } from '../types/schema-value-constraint';
|
|
7
|
+
import type { SchemaValueTransformer } from '../types/schema-value-transformer';
|
|
5
8
|
import type { PropertyOptions, SchemaPropertyReflectionData } from './types';
|
|
6
9
|
export declare function createSchemaPropertyDecorator(options: PropertyOptions): Decorator<'property' | 'accessor'>;
|
|
7
10
|
export declare function createSchemaPropertyDecoratorFromSchema(schema: Schema): Decorator<'property' | 'accessor'>;
|
|
@@ -7,7 +7,7 @@ const array_1 = require("../../utils/array/array");
|
|
|
7
7
|
const merge_1 = require("../../utils/merge");
|
|
8
8
|
const object_1 = require("../../utils/object");
|
|
9
9
|
const type_guards_1 = require("../../utils/type-guards");
|
|
10
|
-
const types_1 = require("../types");
|
|
10
|
+
const types_1 = require("../types/types");
|
|
11
11
|
function createSchemaPropertyDecorator(options) {
|
|
12
12
|
return (0, reflection_1.createPropertyOrAccessorDecorator)({
|
|
13
13
|
handler(_, metadata) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../source/schema/decorators/utils.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,iDAAiE;AAEjE,mDAA8C;AAC9C,6CAAsC;AACtC,+CAA8C;AAC9C,yDAAsE;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../source/schema/decorators/utils.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Decorator } from "../../reflection";
|
|
2
2
|
import type { OneOrMany } from "../../types";
|
|
3
3
|
import type { SchemaTestable } from '../schema';
|
|
4
|
-
import type { ValueSchema, ValueSchemaOptions } from '../types';
|
|
4
|
+
import type { ValueSchema, ValueSchemaOptions } from '../types/types';
|
|
5
5
|
export type ArrayOptions = ValueSchemaOptions & {
|
|
6
6
|
/** minimum array length */
|
|
7
7
|
minimumLength?: number;
|
package/schema/schemas/array.js
CHANGED
|
@@ -6,9 +6,9 @@ const array_1 = require("../../utils/array/array");
|
|
|
6
6
|
const type_guards_1 = require("../../utils/type-guards");
|
|
7
7
|
const array_constraints_1 = require("../array-constraints");
|
|
8
8
|
const utils_1 = require("../decorators/utils");
|
|
9
|
-
const types_1 = require("../types");
|
|
9
|
+
const types_1 = require("../types/types");
|
|
10
10
|
function array(innerValues, options = {}) {
|
|
11
|
-
const arrayConstraints = (0, array_1.
|
|
11
|
+
const arrayConstraints = (0, array_1.toArrayCopy)(options.arrayConstraints ?? []);
|
|
12
12
|
if ((0, type_guards_1.isDefined)(options.minimumLength)) {
|
|
13
13
|
arrayConstraints.push(new array_constraints_1.ArrayMaximumLengthConstraint(options.minimumLength));
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../source/schema/schemas/array.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../source/schema/schemas/array.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,mDAAkD;AAClD,yDAAgD;AAChD,4DAAoE;AACpE,+CAA8E;AAI9E,0CAA6C;AAU7C,SAAgB,KAAK,CAAI,WAAyC,EAAE,UAAwB,EAAE;IAC5F,MAAM,gBAAgB,GAA4B,IAAA,mBAAW,EAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;IAE9F,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,gBAAgB,CAAC,IAAI,CAAC,IAAI,gDAA4B,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KAChF;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,gBAAgB,CAAC,IAAI,CAAC,IAAI,gDAA4B,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KAChF;IAED,OAAO,IAAA,mBAAW,EAAM,WAAW,EAAE;QACnC,GAAG,OAAO;QACV,KAAK,EAAE,IAAI;QACX,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC;AAhBD,sBAgBC;AAED,SAAgB,KAAK,CAAC,WAAsC,EAAE,OAAsB;IAClF,OAAO,IAAA,+CAAuC,EAAC,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AAC9E,CAAC;AAFD,sBAEC"}
|
package/schema/schemas/date.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Decorator } from "../../reflection";
|
|
2
|
-
import type { ValueSchema, ValueSchemaOptions } from '../types';
|
|
2
|
+
import type { ValueSchema, ValueSchemaOptions } from '../types/types';
|
|
3
3
|
export type DateOptions = ValueSchemaOptions & {
|
|
4
4
|
minimum?: Date | number;
|
|
5
5
|
maximum?: Date | number;
|
package/schema/schemas/date.js
CHANGED
|
@@ -6,9 +6,9 @@ const array_1 = require("../../utils/array/array");
|
|
|
6
6
|
const type_guards_1 = require("../../utils/type-guards");
|
|
7
7
|
const constraints_1 = require("../constraints");
|
|
8
8
|
const decorators_1 = require("../decorators");
|
|
9
|
-
const types_1 = require("../types");
|
|
9
|
+
const types_1 = require("../types/types");
|
|
10
10
|
function date(options = {}) {
|
|
11
|
-
const constraints = (0, array_1.
|
|
11
|
+
const constraints = (0, array_1.toArrayCopy)(options.valueConstraints ?? []);
|
|
12
12
|
if ((0, type_guards_1.isDefined)(options.minimum)) {
|
|
13
13
|
constraints.push(new constraints_1.MinimumDateConstraint(options.minimum));
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../source/schema/schemas/date.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,
|
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../source/schema/schemas/date.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,mDAAkD;AAClD,yDAAgD;AAChD,gDAA8E;AAC9E,8CAAwE;AAGxE,0CAA6C;AAO7C,SAAgB,IAAI,CAAC,UAAuB,EAAE;IAC5C,MAAM,WAAW,GAA4B,IAAA,mBAAW,EAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;IAEzF,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC9B,WAAW,CAAC,IAAI,CAAC,IAAI,mCAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;KAC9D;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC9B,WAAW,CAAC,IAAI,CAAC,IAAI,mCAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;KAC9D;IAED,OAAO,IAAA,mBAAW,EAAC,IAAI,EAAE;QACvB,GAAG,OAAO;QACV,gBAAgB,EAAE,WAAW;KAC9B,CAAC,CAAC;AACL,CAAC;AAfD,oBAeC;AAED,SAAgB,YAAY,CAAC,OAAqB;IAChD,OAAO,IAAA,oDAAuC,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AAChE,CAAC;AAFD,oCAEC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Decorator } from "../../reflection";
|
|
2
2
|
import type { Enumeration as EnumerationType, EnumerationValue } from "../../types";
|
|
3
|
-
import type { ValueSchema, ValueSchemaOptions } from '../types';
|
|
3
|
+
import type { ValueSchema, ValueSchemaOptions } from '../types/types';
|
|
4
4
|
export type EnumerationOptions = ValueSchemaOptions;
|
|
5
5
|
export declare function enumeration<T extends EnumerationType>(enumerationValue: T, options?: EnumerationOptions): ValueSchema<EnumerationValue<T>>;
|
|
6
6
|
export declare function Enumeration(enumerationValue: EnumerationType, options?: EnumerationOptions): Decorator<'property' | 'accessor'>;
|
|
@@ -5,9 +5,9 @@ exports.Enumeration = exports.enumeration = void 0;
|
|
|
5
5
|
const array_1 = require("../../utils/array/array");
|
|
6
6
|
const constraints_1 = require("../constraints");
|
|
7
7
|
const decorators_1 = require("../decorators");
|
|
8
|
-
const types_1 = require("../types");
|
|
8
|
+
const types_1 = require("../types/types");
|
|
9
9
|
function enumeration(enumerationValue, options) {
|
|
10
|
-
const valueConstraints = (0, array_1.
|
|
10
|
+
const valueConstraints = (0, array_1.toArrayCopy)(options?.valueConstraints ?? []);
|
|
11
11
|
const enumerationConstraint = new constraints_1.EnumerationConstraint(enumerationValue);
|
|
12
12
|
valueConstraints.push(enumerationConstraint);
|
|
13
13
|
return (0, types_1.valueSchema)(enumerationConstraint.suitableTypes, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enumeration.js","sourceRoot":"","sources":["../../../source/schema/schemas/enumeration.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,
|
|
1
|
+
{"version":3,"file":"enumeration.js","sourceRoot":"","sources":["../../../source/schema/schemas/enumeration.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,mDAAkD;AAClD,gDAAuD;AACvD,8CAAwE;AAGxE,0CAA6C;AAI7C,SAAgB,WAAW,CAA4B,gBAAmB,EAAE,OAA4B;IACtG,MAAM,gBAAgB,GAA4B,IAAA,mBAAW,EAAC,OAAO,EAAE,gBAAgB,IAAI,EAAE,CAAC,CAAC;IAE/F,MAAM,qBAAqB,GAAG,IAAI,mCAAqB,CAAC,gBAAgB,CAAC,CAAC;IAC1E,gBAAgB,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAE7C,OAAO,IAAA,mBAAW,EAAC,qBAAqB,CAAC,aAAa,EAAE;QACtD,GAAG,OAAO;QACV,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC;AAVD,kCAUC;AAED,SAAgB,WAAW,CAAC,gBAAiC,EAAE,OAA4B;IACzF,OAAO,IAAA,oDAAuC,EAAC,WAAW,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC;AACzF,CAAC;AAFD,kCAEC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Decorator } from "../../reflection";
|
|
2
|
-
import type { ValueSchema, ValueSchemaOptions } from '../types';
|
|
2
|
+
import type { ValueSchema, ValueSchemaOptions } from '../types/types';
|
|
3
3
|
export type LiteralOptions = ValueSchemaOptions;
|
|
4
4
|
export declare function literal<T>(value: T, options?: LiteralOptions): ValueSchema<T>;
|
|
5
5
|
export declare function Literal(value: any): Decorator<'property' | 'accessor'>;
|
|
@@ -5,10 +5,10 @@ exports.Literal = exports.literal = void 0;
|
|
|
5
5
|
const array_1 = require("../../utils/array/array");
|
|
6
6
|
const constraints_1 = require("../constraints");
|
|
7
7
|
const decorators_1 = require("../decorators");
|
|
8
|
-
const types_1 = require("../types");
|
|
8
|
+
const types_1 = require("../types/types");
|
|
9
9
|
const utils_1 = require("../utils");
|
|
10
10
|
function literal(value, options) {
|
|
11
|
-
const valueConstraints = (0, array_1.
|
|
11
|
+
const valueConstraints = (0, array_1.toArrayCopy)(options?.valueConstraints ?? []);
|
|
12
12
|
valueConstraints.push(new constraints_1.LiteralConstraint(value));
|
|
13
13
|
return (0, types_1.valueSchema)((0, utils_1.getValueType)(value), {
|
|
14
14
|
...options,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"literal.js","sourceRoot":"","sources":["../../../source/schema/schemas/literal.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,
|
|
1
|
+
{"version":3,"file":"literal.js","sourceRoot":"","sources":["../../../source/schema/schemas/literal.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,mDAAkD;AAClD,gDAAmD;AACnD,8CAAwE;AAGxE,0CAA6C;AAC7C,oCAAwC;AAIxC,SAAgB,OAAO,CAAI,KAAQ,EAAE,OAAwB;IAC3D,MAAM,gBAAgB,GAA4B,IAAA,mBAAW,EAAC,OAAO,EAAE,gBAAgB,IAAI,EAAE,CAAC,CAAC;IAC/F,gBAAgB,CAAC,IAAI,CAAC,IAAI,+BAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;IAEpD,OAAO,IAAA,mBAAW,EAAC,IAAA,oBAAY,EAAC,KAAK,CAAC,EAAE;QACtC,GAAG,OAAO;QACV,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC;AARD,0BAQC;AAED,SAAgB,OAAO,CAAC,KAAU;IAChC,OAAO,IAAA,oDAAuC,EAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AACjE,CAAC;AAFD,0BAEC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Decorator } from "../../reflection";
|
|
2
|
-
import type { ValueSchema, ValueSchemaOptions } from '../types';
|
|
2
|
+
import type { ValueSchema, ValueSchemaOptions } from '../types/types';
|
|
3
3
|
export type NumberOptions = ValueSchemaOptions & {
|
|
4
4
|
minimum?: number;
|
|
5
5
|
maximum?: number;
|
package/schema/schemas/number.js
CHANGED
|
@@ -8,9 +8,9 @@ const integer_1 = require("../constraints/integer");
|
|
|
8
8
|
const maximum_1 = require("../constraints/maximum");
|
|
9
9
|
const minimum_1 = require("../constraints/minimum");
|
|
10
10
|
const decorators_1 = require("../decorators");
|
|
11
|
-
const types_1 = require("../types");
|
|
11
|
+
const types_1 = require("../types/types");
|
|
12
12
|
function number(options = {}) {
|
|
13
|
-
const valueConstraints = (0, array_1.
|
|
13
|
+
const valueConstraints = (0, array_1.toArrayCopy)(options.valueConstraints ?? []);
|
|
14
14
|
if ((0, type_guards_1.isDefined)(options.minimum)) {
|
|
15
15
|
valueConstraints.push(new minimum_1.MinimumConstraint(options.minimum));
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../../source/schema/schemas/number.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,
|
|
1
|
+
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../../source/schema/schemas/number.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,mDAAkD;AAClD,yDAAgD;AAChD,oDAA2D;AAC3D,oDAA2D;AAC3D,oDAA2D;AAC3D,8CAAwE;AAGxE,0CAA6C;AAQ7C,SAAgB,MAAM,CAAC,UAAyB,EAAE;IAChD,MAAM,gBAAgB,GAA4B,IAAA,mBAAW,EAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;IAE9F,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC9B,gBAAgB,CAAC,IAAI,CAAC,IAAI,2BAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;KAC/D;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC9B,gBAAgB,CAAC,IAAI,CAAC,IAAI,2BAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;KAC/D;IAED,IAAI,OAAO,CAAC,OAAO,IAAI,IAAI,EAAE;QAC3B,gBAAgB,CAAC,IAAI,CAAC,2BAAiB,CAAC,CAAC;KAC1C;IAED,OAAO,IAAA,mBAAW,EAAS,MAAM,EAAE;QACjC,GAAG,OAAO;QACV,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC;AAnBD,wBAmBC;AAED,SAAgB,cAAc,CAAC,OAAuB;IACpD,OAAO,IAAA,oDAAuC,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AAClE,CAAC;AAFD,wCAEC"}
|
package/schema/schemas/omit.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ObjectLiteral, OneOrMany } from "../../types";
|
|
2
2
|
import type { Simplify } from 'type-fest';
|
|
3
3
|
import type { ObjectSchema, ObjectSchemaOrType } from '../types';
|
|
4
|
-
export declare function omit<T extends
|
|
4
|
+
export declare function omit<T extends ObjectLiteral, K extends keyof T>(schemaOrType: ObjectSchemaOrType<T>, keys: OneOrMany<K>): ObjectSchema<Simplify<Omit<T, K>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit.js","sourceRoot":"","sources":["../../../source/schema/schemas/omit.ts"],"names":[],"mappings":";;;AACA,mDAA8C;AAC9C,sDAAsD;AAGtD,oCAAwC;AACxC,4CAAkD;AAElD,SAAgB,IAAI,
|
|
1
|
+
{"version":3,"file":"omit.js","sourceRoot":"","sources":["../../../source/schema/schemas/omit.ts"],"names":[],"mappings":";;;AACA,mDAA8C;AAC9C,sDAAsD;AAGtD,oCAAwC;AACxC,4CAAkD;AAElD,SAAgB,IAAI,CAA6C,YAAmC,EAAE,IAAkB;IACtH,MAAM,MAAM,GAAG,IAAA,wBAAe,EAAC,YAAY,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,IAAA,eAAO,EAAC,IAAI,CAAC,CAAC;IAE/B,MAAM,OAAO,GAAG,IAAA,sBAAa,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACjD,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAgB,CAAC,CAAC,CAAC;IAE9F,MAAM,YAAY,GAAG,IAAA,oBAAY,EAAC;QAChC,GAAG,MAAM;QACT,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,aAAa,CAA8B;KAC3E,CAAC,CAAC;IAEH,OAAO,YAAmD,CAAC;AAC7D,CAAC;AAbD,oBAaC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Decorator } from "../../reflection";
|
|
2
|
-
import type { ValueSchema, ValueSchemaOptions } from '../types';
|
|
2
|
+
import type { ValueSchema, ValueSchemaOptions } from '../types/types';
|
|
3
3
|
export type StringOptions = ValueSchemaOptions & {
|
|
4
4
|
/** trim */
|
|
5
5
|
trim?: boolean;
|
package/schema/schemas/string.js
CHANGED
|
@@ -7,10 +7,10 @@ const type_guards_1 = require("../../utils/type-guards");
|
|
|
7
7
|
const constraints_1 = require("../constraints");
|
|
8
8
|
const decorators_1 = require("../decorators");
|
|
9
9
|
const transformers_1 = require("../transformers");
|
|
10
|
-
const types_1 = require("../types");
|
|
10
|
+
const types_1 = require("../types/types");
|
|
11
11
|
function string(options = {}) {
|
|
12
|
-
const valueConstraints = (0, array_1.
|
|
13
|
-
const transformers = (0, array_1.
|
|
12
|
+
const valueConstraints = (0, array_1.toArrayCopy)(options.valueConstraints ?? []);
|
|
13
|
+
const transformers = (0, array_1.toArrayCopy)(options.transformers ?? []);
|
|
14
14
|
if ((0, type_guards_1.isDefined)(options.minimumLength)) {
|
|
15
15
|
valueConstraints.push(new constraints_1.MinimumLengthConstraint(options.minimumLength));
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../source/schema/schemas/string.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../source/schema/schemas/string.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,mDAAkD;AAClD,yDAAgD;AAChD,gDAAqG;AACrG,8CAAwE;AACxE,kDAA8F;AAI9F,0CAA6C;AA4B7C,SAAgB,MAAM,CAAC,UAAyB,EAAE;IAChD,MAAM,gBAAgB,GAA4B,IAAA,mBAAW,EAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;IAC9F,MAAM,YAAY,GAA6B,IAAA,mBAAW,EAAC,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;IAEvF,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,gBAAgB,CAAC,IAAI,CAAC,IAAI,qCAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KAC3E;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,gBAAgB,CAAC,IAAI,CAAC,IAAI,qCAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KAC3E;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC9B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;QAC9D,gBAAgB,CAAC,IAAI,CAAC,IAAI,+BAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;KAC5E;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC3B,YAAY,CAAC,IAAI,CAAC,IAAI,8BAAe,EAAE,CAAC,CAAC;KAC1C;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,SAAS,CAAC,EAAE;QAChC,YAAY,CAAC,IAAI,CAAC,IAAI,mCAAoB,EAAE,CAAC,CAAC;KAC/C;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,SAAS,CAAC,EAAE;QAChC,YAAY,CAAC,IAAI,CAAC,IAAI,mCAAoB,EAAE,CAAC,CAAC;KAC/C;IAED,OAAO,IAAA,mBAAW,EAAS,MAAM,EAAE;QACjC,GAAG,OAAO;QACV,gBAAgB;QAChB,YAAY;KACb,CAAC,CAAC;AACL,CAAC;AAlCD,wBAkCC;AAED,SAAgB,cAAc,CAAC,OAAuB;IACpD,OAAO,IAAA,oDAAuC,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AAClE,CAAC;AAFD,wCAEC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Decorator } from "../../reflection";
|
|
2
|
-
import type { ValueSchema, ValueSchemaOptions } from '../types';
|
|
2
|
+
import type { ValueSchema, ValueSchemaOptions } from '../types/types';
|
|
3
3
|
export type Uint8ArraySchemaOptions = ValueSchemaOptions & {
|
|
4
4
|
/** Minimum byte length */
|
|
5
5
|
minimumLength?: number;
|
|
@@ -8,10 +8,10 @@ const uint8_array_coercer_1 = require("../coercers/uint8-array.coercer");
|
|
|
8
8
|
const maximum_length_1 = require("../constraints/maximum-length");
|
|
9
9
|
const minimum_length_1 = require("../constraints/minimum-length");
|
|
10
10
|
const utils_1 = require("../decorators/utils");
|
|
11
|
-
const types_1 = require("../types");
|
|
11
|
+
const types_1 = require("../types/types");
|
|
12
12
|
function uint8Array(options = {}) {
|
|
13
|
-
const coercers = (0, array_1.
|
|
14
|
-
const valueConstraints = (0, array_1.
|
|
13
|
+
const coercers = (0, array_1.toArrayCopy)(options.coercers ?? []);
|
|
14
|
+
const valueConstraints = (0, array_1.toArrayCopy)(options.valueConstraints ?? []);
|
|
15
15
|
if (options.coerce == true) {
|
|
16
16
|
coercers.push(uint8_array_coercer_1.uint8ArrayCoercer);
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint8-array.js","sourceRoot":"","sources":["../../../source/schema/schemas/uint8-array.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,
|
|
1
|
+
{"version":3,"file":"uint8-array.js","sourceRoot":"","sources":["../../../source/schema/schemas/uint8-array.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,mDAAkD;AAClD,yDAAgD;AAChD,yEAAoE;AACpE,kEAAwE;AACxE,kEAAwE;AACxE,+CAA8E;AAI9E,0CAA6C;AAU7C,SAAgB,UAAU,CAAC,UAAmC,EAAE;IAC9D,MAAM,QAAQ,GAAyB,IAAA,mBAAW,EAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;IAC3E,MAAM,gBAAgB,GAA4B,IAAA,mBAAW,EAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;IAE9F,IAAI,OAAO,CAAC,MAAM,IAAI,IAAI,EAAE;QAC1B,QAAQ,CAAC,IAAI,CAAC,uCAAiB,CAAC,CAAC;KAClC;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,gBAAgB,CAAC,IAAI,CAAC,IAAI,wCAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KAC3E;IAED,IAAI,IAAA,uBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,gBAAgB,CAAC,IAAI,CAAC,IAAI,wCAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KAC3E;IAED,OAAO,IAAA,mBAAW,EAAC,UAAU,EAAE;QAC7B,GAAG,OAAO;QACV,QAAQ;QACR,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC;AArBD,gCAqBC;AAED,SAAgB,kBAAkB,CAAC,OAAiC;IAClE,OAAO,IAAA,+CAAuC,EAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;AACtE,CAAC;AAFD,gDAEC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./schema-array-constraint"), exports);
|
|
18
|
+
__exportStar(require("./schema-value-coercer"), exports);
|
|
19
|
+
__exportStar(require("./schema-value-constraint"), exports);
|
|
20
|
+
__exportStar(require("./schema-value-transformer"), exports);
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/schema/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,yDAAuC;AACvC,4DAA0C;AAC1C,6DAA2C;AAC3C,0CAAwB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JsonPath } from "../../json-path/json-path";
|
|
2
|
+
import type { ConstraintContext, ConstraintResult } from './types';
|
|
3
|
+
export declare abstract class SchemaArrayConstraint {
|
|
4
|
+
abstract validate(value: readonly unknown[], path: JsonPath, context: ConstraintContext): ConstraintResult;
|
|
5
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-array-constraint.js","sourceRoot":"","sources":["../../../source/schema/types/schema-array-constraint.ts"],"names":[],"mappings":";;;AAGA,MAAsB,qBAAqB;CAE1C;AAFD,sDAEC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JsonPath } from "../../json-path/json-path";
|
|
2
|
+
import type { OneOrMany } from "../../types";
|
|
3
|
+
import type { CoercerContext, CoerceResult, ValueType } from './types';
|
|
4
|
+
export declare abstract class SchemaValueCoercer {
|
|
5
|
+
abstract readonly sourceType: OneOrMany<ValueType>;
|
|
6
|
+
abstract readonly targetType: ValueType;
|
|
7
|
+
abstract coerce(value: unknown, path: JsonPath, context: CoercerContext): CoerceResult;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-value-coercer.js","sourceRoot":"","sources":["../../../source/schema/types/schema-value-coercer.ts"],"names":[],"mappings":";;;AAIA,MAAsB,kBAAkB;CAKvC;AALD,gDAKC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JsonPath } from "../../json-path/json-path";
|
|
2
|
+
import type { OneOrMany } from "../../types";
|
|
3
|
+
import type { ConstraintContext, ConstraintResult, ValueType } from './types';
|
|
4
|
+
export declare abstract class SchemaValueConstraint {
|
|
5
|
+
abstract readonly suitableTypes: OneOrMany<ValueType>;
|
|
6
|
+
abstract readonly expects: OneOrMany<string>;
|
|
7
|
+
abstract validate(value: unknown, path: JsonPath, context: ConstraintContext): ConstraintResult;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-value-constraint.js","sourceRoot":"","sources":["../../../source/schema/types/schema-value-constraint.ts"],"names":[],"mappings":";;;AAIA,MAAsB,qBAAqB;CAK1C;AALD,sDAKC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { JsonPath } from "../../json-path/json-path";
|
|
2
|
+
import type { OneOrMany } from "../../types";
|
|
3
|
+
import type { TransformerContext, TransformResult, ValueType } from './types';
|
|
4
|
+
export declare abstract class SchemaValueTransformer<T = any, O = any> {
|
|
5
|
+
abstract readonly sourceType?: OneOrMany<ValueType<T>>;
|
|
6
|
+
abstract transform(value: T, path: JsonPath, context: TransformerContext): TransformResult<O>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SchemaValueTransformer = void 0;
|
|
4
|
+
class SchemaValueTransformer {
|
|
5
|
+
}
|
|
6
|
+
exports.SchemaValueTransformer = SchemaValueTransformer;
|
|
7
|
+
//# sourceMappingURL=schema-value-transformer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-value-transformer.js","sourceRoot":"","sources":["../../../source/schema/types/schema-value-transformer.ts"],"names":[],"mappings":";;;AAIA,MAAsB,sBAAsB;CAI3C;AAJD,wDAIC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
1
|
+
import type { AbstractConstructor, OneOrMany, Record, Type, TypedOmit } from "../../types";
|
|
2
|
+
import type { NormalizedSchema, Schema, SchemaTestable } from '../schema';
|
|
3
|
+
import type { SchemaError } from '../schema.error';
|
|
4
|
+
import type { SchemaArrayConstraint } from './schema-array-constraint';
|
|
5
|
+
import type { SchemaValueCoercer } from './schema-value-coercer';
|
|
6
|
+
import type { SchemaValueConstraint } from './schema-value-constraint';
|
|
7
|
+
import type { SchemaValueTransformer } from './schema-value-transformer';
|
|
5
8
|
declare const schemaOutputTypeSymbol: unique symbol;
|
|
6
9
|
export type SchemaFactoryFunction<T> = (data: T) => T;
|
|
7
10
|
export type SchemaFactory<T> = {
|
|
@@ -89,24 +92,7 @@ export type Coercible = {
|
|
|
89
92
|
};
|
|
90
93
|
export declare const primitiveConstructors: ValueType[];
|
|
91
94
|
export declare const primitiveConstructorSet: Set<ValueType<any>>;
|
|
92
|
-
export declare abstract class SchemaArrayConstraint {
|
|
93
|
-
abstract validate(value: readonly unknown[], path: JsonPath, context: ConstraintContext): ConstraintResult;
|
|
94
|
-
}
|
|
95
95
|
export type OptionKeys<T extends Record> = readonly (keyof T)[];
|
|
96
|
-
export declare abstract class SchemaValueConstraint {
|
|
97
|
-
abstract readonly suitableTypes: OneOrMany<ValueType>;
|
|
98
|
-
abstract readonly expects: OneOrMany<string>;
|
|
99
|
-
abstract validate(value: unknown, path: JsonPath, context: ConstraintContext): ConstraintResult;
|
|
100
|
-
}
|
|
101
|
-
export declare abstract class SchemaValueTransformer<T = any, O = any> {
|
|
102
|
-
abstract readonly sourceType?: OneOrMany<ValueType<T>>;
|
|
103
|
-
abstract transform(value: T, path: JsonPath, context: TransformerContext): TransformResult<O>;
|
|
104
|
-
}
|
|
105
|
-
export declare abstract class SchemaValueCoercer {
|
|
106
|
-
abstract readonly sourceType: OneOrMany<ValueType>;
|
|
107
|
-
abstract readonly targetType: ValueType;
|
|
108
|
-
abstract coerce(value: unknown, path: JsonPath, context: CoercerContext): CoerceResult;
|
|
109
|
-
}
|
|
110
96
|
export type SchemaTestOptions = {
|
|
111
97
|
/**
|
|
112
98
|
* Try to convert wrong input into desired output.
|
|
@@ -160,16 +146,20 @@ export declare function objectSchema<T extends Record>(schema: ObjectSchema<T>):
|
|
|
160
146
|
export declare function valueSchema<T>(schema: OneOrMany<SchemaTestable<T>>, options?: TypedOmit<ValueSchema<T>, 'schema'>): ValueSchema<T>;
|
|
161
147
|
export declare function typeSchema<T>(type: ValueType<T>): TypeSchema<NormalizeValueType<T>>;
|
|
162
148
|
export declare function isSchema<T>(value: any): value is Schema<T>;
|
|
163
|
-
export declare function isObjectSchema<T extends Record>(schema:
|
|
164
|
-
export declare function isObjectSchema<T extends Record>(schema: any): schema is ObjectSchema<T>;
|
|
165
|
-
export declare function isValueSchema<T>(schema:
|
|
149
|
+
export declare function isObjectSchema<T extends Record = any>(schema: SchemaTestable<T>): schema is ObjectSchema<T>;
|
|
150
|
+
export declare function isObjectSchema<T extends Record = any>(schema: any): schema is ObjectSchema<T>;
|
|
151
|
+
export declare function isValueSchema<T>(schema: SchemaTestable<T>): schema is ValueSchema<T>;
|
|
166
152
|
export declare function isValueSchema<T>(schema: any): schema is ValueSchema<T>;
|
|
167
|
-
export declare function isTypeSchema<T>(schema:
|
|
153
|
+
export declare function isTypeSchema<T>(schema: SchemaTestable<T>): schema is TypeSchema<T>;
|
|
168
154
|
export declare function isTypeSchema<T>(schema: any): schema is TypeSchema<T>;
|
|
169
|
-
export declare function isDeferredValueType<T>(value:
|
|
155
|
+
export declare function isDeferredValueType<T>(value: SchemaTestable<T>): value is DeferredValueType<T>;
|
|
170
156
|
export declare function isDeferredValueType(value: any): value is DeferredValueType;
|
|
171
157
|
export declare function resolveValueTypes<T>(valueTypes: OneOrMany<ValueType<T>>): OneOrMany<ResolvedValueType<T>>;
|
|
172
158
|
export declare function resolveValueType<T>(valueType: ValueType<T>): ResolvedValueType<T>;
|
|
173
159
|
export declare function valueTypesOrSchemasToSchemas<T>(valueTypesOrSchemas: OneOrMany<SchemaTestable<T>>): OneOrMany<Schema<T>>;
|
|
174
160
|
export declare function schemaTestableToSchema<T>(valueTypeOrSchema: SchemaTestable<T>): Schema<T>;
|
|
161
|
+
export declare function optimizeObjectSchema<T>(schema: ObjectSchema<T>): ObjectSchema<T>;
|
|
162
|
+
export declare function optimizeObjectSchemaProperties<T>(properties: ObjectSchemaProperties<T>): ObjectSchemaProperties<T>;
|
|
163
|
+
export declare function optimizeValueSchema<T>(schema: ValueSchema<T>): ValueSchema<T>;
|
|
164
|
+
export declare function optimizeSchema<T>(schema: OneOrMany<SchemaTestable<T>>): OneOrMany<SchemaTestable<T>>;
|
|
175
165
|
export {};
|