@ddd-ts-kit/validation 0.12.0 → 0.13.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 +89 -7
- package/dist/class-validator/class-schema.d.ts +5 -0
- package/dist/class-validator/class-schema.d.ts.map +1 -1
- package/dist/class-validator/class-schema.js +1 -1
- package/dist/class-validator/class-schema.js.map +1 -1
- package/dist/class-validator/copy-class-metadata.d.ts +9 -0
- package/dist/class-validator/copy-class-metadata.d.ts.map +1 -0
- package/dist/class-validator/copy-class-metadata.js +52 -0
- package/dist/class-validator/copy-class-metadata.js.map +1 -0
- package/dist/class-validator/declared-properties.d.ts +4 -0
- package/dist/class-validator/declared-properties.d.ts.map +1 -0
- package/dist/class-validator/declared-properties.js +8 -0
- package/dist/class-validator/declared-properties.js.map +1 -0
- package/dist/class-validator/derived-class.d.ts +8 -0
- package/dist/class-validator/derived-class.d.ts.map +1 -0
- package/dist/class-validator/derived-class.js +25 -0
- package/dist/class-validator/derived-class.js.map +1 -0
- package/dist/class-validator/omit-class.d.ts +4 -0
- package/dist/class-validator/omit-class.d.ts.map +1 -0
- package/dist/class-validator/omit-class.js +6 -0
- package/dist/class-validator/omit-class.js.map +1 -0
- package/dist/class-validator/partial-class.d.ts +7 -0
- package/dist/class-validator/partial-class.d.ts.map +1 -0
- package/dist/class-validator/partial-class.js +17 -0
- package/dist/class-validator/partial-class.js.map +1 -0
- package/dist/class-validator/pick-class.d.ts +7 -0
- package/dist/class-validator/pick-class.d.ts.map +1 -0
- package/dist/class-validator/pick-class.js +16 -0
- package/dist/class-validator/pick-class.js.map +1 -0
- package/dist/class-validator/prototype-of.d.ts +4 -0
- package/dist/class-validator/prototype-of.d.ts.map +1 -0
- package/dist/class-validator/prototype-of.js +6 -0
- package/dist/class-validator/prototype-of.js.map +1 -0
- package/dist/class-validator/self-contained-schema.d.ts +6 -2
- package/dist/class-validator/self-contained-schema.d.ts.map +1 -1
- package/dist/class-validator/self-contained-schema.js +24 -9
- package/dist/class-validator/self-contained-schema.js.map +1 -1
- package/dist/class-validator.d.ts +3 -0
- package/dist/class-validator.d.ts.map +1 -1
- package/dist/class-validator.js +3 -0
- package/dist/class-validator.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/shared/definitions-pointer.d.ts +3 -0
- package/dist/shared/definitions-pointer.d.ts.map +1 -0
- package/dist/shared/definitions-pointer.js +3 -0
- package/dist/shared/definitions-pointer.js.map +1 -0
- package/dist/shared/is-record.d.ts +2 -0
- package/dist/shared/is-record.d.ts.map +1 -0
- package/dist/shared/is-record.js +4 -0
- package/dist/shared/is-record.js.map +1 -0
- package/dist/shared/shared-name-of.d.ts +8 -0
- package/dist/shared/shared-name-of.d.ts.map +1 -0
- package/dist/shared/shared-name-of.js +17 -0
- package/dist/shared/shared-name-of.js.map +1 -0
- package/dist/shared/shared-schema.d.ts +9 -0
- package/dist/shared/shared-schema.d.ts.map +1 -0
- package/dist/shared/shared-schema.js +36 -0
- package/dist/shared/shared-schema.js.map +1 -0
- package/dist/standard-schema/standard-schema-options.d.ts +8 -0
- package/dist/standard-schema/standard-schema-options.d.ts.map +1 -0
- package/dist/standard-schema/standard-schema-options.js +2 -0
- package/dist/standard-schema/standard-schema-options.js.map +1 -0
- package/dist/standard-schema/standard-schema-v1.d.ts +14 -1
- package/dist/standard-schema/standard-schema-v1.d.ts.map +1 -1
- package/dist/standard-schema/standard-schema.d.ts +6 -3
- package/dist/standard-schema/standard-schema.d.ts.map +1 -1
- package/dist/standard-schema/standard-schema.js +18 -4
- package/dist/standard-schema/standard-schema.js.map +1 -1
- package/dist/standard-schema.d.ts +2 -1
- package/dist/standard-schema.d.ts.map +1 -1
- package/dist/standard-schema.js.map +1 -1
- package/dist/typebox/definitions-of.d.ts +9 -0
- package/dist/typebox/definitions-of.d.ts.map +1 -0
- package/dist/typebox/definitions-of.js +56 -0
- package/dist/typebox/definitions-of.js.map +1 -0
- package/dist/typebox/typebox-schema-options.d.ts +8 -0
- package/dist/typebox/typebox-schema-options.d.ts.map +1 -0
- package/dist/typebox/typebox-schema-options.js +2 -0
- package/dist/typebox/typebox-schema-options.js.map +1 -0
- package/dist/typebox/typebox-schema.d.ts +11 -0
- package/dist/typebox/typebox-schema.d.ts.map +1 -0
- package/dist/typebox/typebox-schema.js +50 -0
- package/dist/typebox/typebox-schema.js.map +1 -0
- package/dist/typebox.d.ts +3 -0
- package/dist/typebox.d.ts.map +1 -0
- package/dist/typebox.js +2 -0
- package/dist/typebox.js.map +1 -0
- package/package.json +18 -9
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @ddd-ts-kit/validation
|
|
2
2
|
|
|
3
3
|
One `Schema` contract for input validation at the boundary, with adapters for zod,
|
|
4
|
-
class-validator and any Standard Schema library. Routes, DTOs and the OpenAPI generator depend
|
|
4
|
+
class-validator, TypeBox and any Standard Schema library. Routes, DTOs and the OpenAPI generator depend
|
|
5
5
|
on the contract, so the validation library can change without touching them.
|
|
6
6
|
|
|
7
7
|
Business rules do not belong here: they live in the domain and never import a validation library.
|
|
@@ -29,6 +29,8 @@ class): there is nothing to declare in a composition root.
|
|
|
29
29
|
- `Infer<typeof schema>` gives the parsed type.
|
|
30
30
|
- `customSchema(parse, jsonSchema?)` builds a schema from a plain function.
|
|
31
31
|
|
|
32
|
+
- `sharedSchema(name, schema)` documents a schema once, under `name` (see [shared schemas](#shared-schemas)).
|
|
33
|
+
|
|
32
34
|
The root entry imports no third-party package. Each adapter lives in its own subpath and its
|
|
33
35
|
library is an optional peer dependency: install only the one you use.
|
|
34
36
|
|
|
@@ -97,6 +99,53 @@ reachable from the class under `$defs`.
|
|
|
97
99
|
|
|
98
100
|
Requires `experimentalDecorators` in the project's `tsconfig.json`.
|
|
99
101
|
|
|
102
|
+
A DTO class declared once is reused whole (`classSchema(SlotDto, { shared: true })`, or nested
|
|
103
|
+
with `@ValidateNested()` and `@Type`), extended (`class BookBody extends SlotDto { ... }`) or in
|
|
104
|
+
part, through three helpers that copy the constraints, the nested types and the transformations
|
|
105
|
+
of the properties they keep:
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
import { omitClass, partialClass, pickClass } from '@ddd-ts-kit/validation/class-validator';
|
|
109
|
+
|
|
110
|
+
class RescheduleBody extends pickClass(AppointmentDto, ['startsAt', 'endsAt']) {}
|
|
111
|
+
class BookBody extends omitClass(AppointmentDto, ['status']) {}
|
|
112
|
+
class EditPatientBody extends partialClass(PatientDto) {} // every property optional, checked when present
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The class that extends a helper names the shape in the contract. Picking a property that carries
|
|
116
|
+
no constraint is refused: validation would strip it as unknown. A derived class nested in
|
|
117
|
+
another one through `@Type` declares at least one property of its own: class-validator-jsonschema
|
|
118
|
+
documents a class only from its own decorators.
|
|
119
|
+
|
|
120
|
+
## TypeBox
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
npm i typebox
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
import Type from 'typebox';
|
|
128
|
+
import { typeboxSchema } from '@ddd-ts-kit/validation/typebox';
|
|
129
|
+
|
|
130
|
+
const slot = Type.Object({ startsAt: Type.String({ format: 'date-time' }), minutes: Type.Integer({ default: 30 }) }, { $id: 'Slot' });
|
|
131
|
+
const book = typeboxSchema(Type.Object({ patientId: Type.String({ minLength: 1 }), slot }));
|
|
132
|
+
const page = typeboxSchema(Type.Object({ limit: Type.Integer() }), { coerce: true }); // query strings
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The schema is compiled once (`typebox/compile`). `parse` fills the defaults and drops the
|
|
136
|
+
properties the schema does not declare, as zod does, then checks; the issue code is the JSON
|
|
137
|
+
Schema keyword that failed (`required`, `format`, `minLength`...). `{ coerce: true }` converts
|
|
138
|
+
text to the declared types first, for path parameters and query strings. A TypeBox schema is
|
|
139
|
+
JSON Schema already: `toJsonSchema()` returns it, a nested schema built with an `$id` moved
|
|
140
|
+
under `$defs` and referenced, so it lands once in the contract; a schema with its own `$id` is
|
|
141
|
+
shared. A missing property is reported at its own path (`slot.startsAt`), as zod reports it, and
|
|
142
|
+
two different schemas under one `$id` are refused. `Type.Pick`, `Type.Omit` and `Type.Partial`
|
|
143
|
+
reuse a schema in part, as a new shape; `Type.Intersect([slot, Type.Object({...})])` extends it
|
|
144
|
+
and keeps the shared part a reference (`allOf: [{ $ref: Slot }, ...]`), while
|
|
145
|
+
`Type.Interface([slot], {...})` writes a new flat shape. (`Type.Composite` belongs to
|
|
146
|
+
`@sinclair/typebox` 0.34 and does not exist in TypeBox 1.)
|
|
147
|
+
Written for the `typebox` package, version 1 (the successor of `@sinclair/typebox`).
|
|
148
|
+
|
|
100
149
|
## Standard Schema (valibot, arktype, ...)
|
|
101
150
|
|
|
102
151
|
```ts
|
|
@@ -110,10 +159,43 @@ const placeOrder = standardSchema(
|
|
|
110
159
|
);
|
|
111
160
|
```
|
|
112
161
|
|
|
113
|
-
The adapter
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
162
|
+
The adapter validates with `~standard.validate` of Standard Schema v1. The JSON Schema of the
|
|
163
|
+
contract is the second argument when it is given (written by hand, or produced by the exporter of
|
|
164
|
+
your library); otherwise the one the library converts itself when it implements the companion
|
|
165
|
+
specification, Standard JSON Schema v1 (`~standard.jsonSchema`; verified with zod 4, while arktype
|
|
166
|
+
and valibot through `toStandardJsonSchema` of `@valibot/to-json-schema` announce it but are not
|
|
167
|
+
verified here), input side by default and `standardSchema(schema, undefined, { io: 'output' })`
|
|
168
|
+
for a response; otherwise `{}`, which the OpenAPI document shows as "any value". A schema the
|
|
169
|
+
library cannot write as JSON Schema (zod refuses `z.date()`, `z.coerce.date()`, `z.custom`) is
|
|
170
|
+
documented `{}` as well: pass its JSON Schema as the second argument. The specification carries no error code, so every issue
|
|
171
|
+
has the code `invalid`. A schema that validates asynchronously makes
|
|
119
172
|
`parse` throw: async schemas are not supported at the boundary.
|
|
173
|
+
|
|
174
|
+
## Shared schemas
|
|
175
|
+
|
|
176
|
+
A schema several routes use is declared once and documented once: the OpenAPI generator of
|
|
177
|
+
`@ddd-ts-kit/http` writes it in `components.schemas` and points at it with `$ref` from every
|
|
178
|
+
route, whole or nested. A schema is shared when its JSON Schema is a reference to one of its own
|
|
179
|
+
definitions (`{ $ref: '#/$defs/Slot', $defs: { Slot: ... } }`), the form each library reaches its
|
|
180
|
+
own way:
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
// zod: an id in its metadata, kept when the schema is nested in another one
|
|
184
|
+
const slot = z.object({ startsAt: z.iso.datetime(), endsAt: z.iso.datetime() }).meta({ id: 'Slot' });
|
|
185
|
+
const reschedule = zodSchema(slot);
|
|
186
|
+
const book = zodSchema(z.object({ patientId: z.uuid(), slot }));
|
|
187
|
+
|
|
188
|
+
// class-validator: the name of the class
|
|
189
|
+
const patient = classSchema(PatientDto, { shared: true });
|
|
190
|
+
|
|
191
|
+
// TypeBox: an $id in its options, kept when the schema is nested in another one
|
|
192
|
+
const money = Type.Object({ cents: Type.Integer(), currency: Type.String() }, { $id: 'Money' });
|
|
193
|
+
|
|
194
|
+
// any schema, the Standard Schema ones included
|
|
195
|
+
const amount = sharedSchema('Amount', standardSchema(amountSchema));
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
`sharedNameOf(jsonSchema)` answers the name a JSON Schema is shared under, if any. A shared
|
|
199
|
+
schema of the presentation layer lives where `generate schema` writes it: under
|
|
200
|
+
`presentation/http/schemas/` of its context, or under `presentation/` of the shared kernel when
|
|
201
|
+
several contexts answer with it; never in the domain.
|
|
@@ -7,6 +7,11 @@ export interface ClassSchemaOptions {
|
|
|
7
7
|
/** Merged over the defaults `{ whitelist: true, forbidNonWhitelisted: true }`. */
|
|
8
8
|
readonly validator?: ValidatorOptions;
|
|
9
9
|
readonly transform?: ClassTransformOptions;
|
|
10
|
+
/**
|
|
11
|
+
* Documented once, under the name of the class: the contract holds it in `components.schemas`
|
|
12
|
+
* and every route that uses it refers to it, as it already does for a nested class.
|
|
13
|
+
*/
|
|
14
|
+
readonly shared?: boolean;
|
|
10
15
|
}
|
|
11
16
|
export declare function classSchema<T extends object>(dto: DtoClass<T>, options?: ClassSchemaOptions): Schema<T>;
|
|
12
17
|
//# sourceMappingURL=class-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-schema.d.ts","sourceRoot":"","sources":["../../src/class-validator/class-schema.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAmB,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAA6D,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,MAAM,WAAW,kBAAkB;IACjC,kFAAkF;IAClF,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"class-schema.d.ts","sourceRoot":"","sources":["../../src/class-validator/class-schema.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAmB,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAA6D,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,MAAM,WAAW,kBAAkB;IACjC,kFAAkF;IAClF,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,GAAE,kBAAuB,GAAG,MAAM,CAAC,CAAC,CAAC,CAoB3G"}
|
|
@@ -18,7 +18,7 @@ export function classSchema(dto, options = {}) {
|
|
|
18
18
|
const errors = validateSync(instance, validatorOptions);
|
|
19
19
|
return errors.length === 0 ? ok(instance) : err(flatten(errors, ''));
|
|
20
20
|
},
|
|
21
|
-
toJsonSchema: () => selfContainedSchema(dto.
|
|
21
|
+
toJsonSchema: () => selfContainedSchema(dto, options.shared === true),
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
function flatten(errors, parent) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-schema.js","sourceRoot":"","sources":["../../src/class-validator/class-schema.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAA8B,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAsE,MAAM,iBAAiB,CAAC;AACnH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAI7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"class-schema.js","sourceRoot":"","sources":["../../src/class-validator/class-schema.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAA8B,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAsE,MAAM,iBAAiB,CAAC;AACnH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAI7C,OAAO,EAAE,mBAAmB,EAA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MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5E,IAAI;YACJ,IAAI;YACJ,OAAO;SACR,CAAC,CAAC,CAAC;QAEJ,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import type { DtoClass } from './dto-class.js';
|
|
3
|
+
/**
|
|
4
|
+
* Copies onto `target` what class-validator and class-transformer know of each property of
|
|
5
|
+
* `source`, its ancestors included, that `keeps` accepts: the constraints, the nested type, the
|
|
6
|
+
* transformations and the reflected type. Answers the properties copied.
|
|
7
|
+
*/
|
|
8
|
+
export declare function copyClassMetadata(source: DtoClass<object>, target: DtoClass<object>, keeps: (property: string) => boolean): string[];
|
|
9
|
+
//# sourceMappingURL=copy-class-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-class-metadata.d.ts","sourceRoot":"","sources":["../../src/class-validator/copy-class-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAS/C;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EACxB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EACxB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GACnC,MAAM,EAAE,CAiBV"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { TransformationType } from 'class-transformer';
|
|
3
|
+
import { defaultMetadataStorage } from 'class-transformer/cjs/storage.js';
|
|
4
|
+
import { getMetadataStorage } from 'class-validator';
|
|
5
|
+
import { prototypeOf } from './prototype-of.js';
|
|
6
|
+
const TRANSFORMATIONS = [
|
|
7
|
+
TransformationType.PLAIN_TO_CLASS,
|
|
8
|
+
TransformationType.CLASS_TO_PLAIN,
|
|
9
|
+
TransformationType.CLASS_TO_CLASS,
|
|
10
|
+
];
|
|
11
|
+
/**
|
|
12
|
+
* Copies onto `target` what class-validator and class-transformer know of each property of
|
|
13
|
+
* `source`, its ancestors included, that `keeps` accepts: the constraints, the nested type, the
|
|
14
|
+
* transformations and the reflected type. Answers the properties copied.
|
|
15
|
+
*/
|
|
16
|
+
export function copyClassMetadata(source, target, keeps) {
|
|
17
|
+
const storage = getMetadataStorage();
|
|
18
|
+
const copied = new Set();
|
|
19
|
+
for (const metadata of storage.getTargetValidationMetadatas(source, '', true, false)) {
|
|
20
|
+
if (keeps(metadata.propertyName)) {
|
|
21
|
+
storage.addValidationMetadata(Object.assign({}, metadata, { target }));
|
|
22
|
+
copied.add(metadata.propertyName);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
for (const property of copied) {
|
|
26
|
+
copyTransformations(source, target, property);
|
|
27
|
+
copyReflectedType(source, target, property);
|
|
28
|
+
}
|
|
29
|
+
return [...copied];
|
|
30
|
+
}
|
|
31
|
+
function copyTransformations(source, target, property) {
|
|
32
|
+
const type = typeMetadataOf(source, property);
|
|
33
|
+
if (type !== undefined) {
|
|
34
|
+
defaultMetadataStorage.addTypeMetadata({ ...type, target });
|
|
35
|
+
}
|
|
36
|
+
for (const transformation of TRANSFORMATIONS) {
|
|
37
|
+
for (const transform of defaultMetadataStorage.findTransformMetadatas(source, property, transformation)) {
|
|
38
|
+
defaultMetadataStorage.addTransformMetadata({ ...transform, target });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** class-transformer answers `undefined` for a property without `@Type`, which its declaration does not say. */
|
|
43
|
+
function typeMetadataOf(source, property) {
|
|
44
|
+
return defaultMetadataStorage.findTypeMetadata(source, property);
|
|
45
|
+
}
|
|
46
|
+
function copyReflectedType(source, target, property) {
|
|
47
|
+
const reflected = Reflect.getMetadata('design:type', prototypeOf(source), property);
|
|
48
|
+
if (reflected !== undefined) {
|
|
49
|
+
Reflect.defineMetadata('design:type', reflected, prototypeOf(target), property);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=copy-class-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-class-metadata.js","sourceRoot":"","sources":["../../src/class-validator/copy-class-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAqB,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,eAAe,GAAG;IACtB,kBAAkB,CAAC,cAAc;IACjC,kBAAkB,CAAC,cAAc;IACjC,kBAAkB,CAAC,cAAc;CAClC,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAwB,EACxB,MAAwB,EACxB,KAAoC;IAEpC,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC;IACrC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IAEjC,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,4BAA4B,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;QACrF,IAAI,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YACjC,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,QAA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AAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;IAClF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DtoClass } from './dto-class.js';
|
|
2
|
+
/** The properties of a class, its ancestors included, that carry at least one class-validator decorator. */
|
|
3
|
+
export declare function declaredProperties(dto: DtoClass<object>): Set<string>;
|
|
4
|
+
//# sourceMappingURL=declared-properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declared-properties.d.ts","sourceRoot":"","sources":["../../src/class-validator/declared-properties.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,4GAA4G;AAC5G,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAMrE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getMetadataStorage } from 'class-validator';
|
|
2
|
+
/** The properties of a class, its ancestors included, that carry at least one class-validator decorator. */
|
|
3
|
+
export function declaredProperties(dto) {
|
|
4
|
+
return new Set(getMetadataStorage()
|
|
5
|
+
.getTargetValidationMetadatas(dto, '', true, false)
|
|
6
|
+
.map((metadata) => metadata.propertyName));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=declared-properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declared-properties.js","sourceRoot":"","sources":["../../src/class-validator/declared-properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,4GAA4G;AAC5G,MAAM,UAAU,kBAAkB,CAAC,GAAqB;IACtD,OAAO,IAAI,GAAG,CACZ,kBAAkB,EAAE;SACjB,4BAA4B,CAAC,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC;SAClD,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DtoClass } from './dto-class.js';
|
|
2
|
+
/**
|
|
3
|
+
* A new class, named `name`, that validates and documents the properties of `base` that `keeps`
|
|
4
|
+
* accepts, and nothing else. It is meant to be extended by a class of the presentation layer,
|
|
5
|
+
* which gives it its name in the contract: `class CancelBody extends pickClass(...) {}`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function derivedClass<T extends object>(base: DtoClass<object>, name: string, keeps: (property: string) => boolean): DtoClass<T>;
|
|
8
|
+
//# sourceMappingURL=derived-class.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derived-class.d.ts","sourceRoot":"","sources":["../../src/class-validator/derived-class.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI/C;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAC3C,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EACtB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GACnC,QAAQ,CAAC,CAAC,CAAC,CAeb"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DeclarationError } from '@ddd-ts-kit/kernel/declarations';
|
|
2
|
+
import { copyClassMetadata } from './copy-class-metadata.js';
|
|
3
|
+
import { declaredProperties } from './declared-properties.js';
|
|
4
|
+
/**
|
|
5
|
+
* A new class, named `name`, that validates and documents the properties of `base` that `keeps`
|
|
6
|
+
* accepts, and nothing else. It is meant to be extended by a class of the presentation layer,
|
|
7
|
+
* which gives it its name in the contract: `class CancelBody extends pickClass(...) {}`.
|
|
8
|
+
*/
|
|
9
|
+
export function derivedClass(base, name, keeps) {
|
|
10
|
+
const derived = class {
|
|
11
|
+
};
|
|
12
|
+
// Two derived classes of one name would merge in class-validator-jsonschema, which groups by name.
|
|
13
|
+
Object.defineProperty(derived, 'name', { value: name });
|
|
14
|
+
const copied = copyClassMetadata(base, derived, keeps);
|
|
15
|
+
if (!validatesAs(derived, copied)) {
|
|
16
|
+
throw new DeclarationError(`${name} keeps no property of ${base.name} that carries a constraint: there is nothing to validate.`);
|
|
17
|
+
}
|
|
18
|
+
return derived;
|
|
19
|
+
}
|
|
20
|
+
/** True once the class carries a constraint for some property, and for every one copied: it then parses into a `T`. */
|
|
21
|
+
function validatesAs(derived, copied) {
|
|
22
|
+
const declared = declaredProperties(derived);
|
|
23
|
+
return copied.length > 0 && copied.every((property) => declared.has(property));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=derived-class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derived-class.js","sourceRoot":"","sources":["../../src/class-validator/derived-class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAsB,EACtB,IAAY,EACZ,KAAoC;IAEpC,MAAM,OAAO,GAAG;KAAQ,CAAC;IAEzB,mGAAmG;IACnG,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAExD,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAEvD,IAAI,CAAC,WAAW,CAAI,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,gBAAgB,CACxB,GAAG,IAAI,yBAAyB,IAAI,CAAC,IAAI,2DAA2D,CACrG,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,uHAAuH;AACvH,SAAS,WAAW,CAAmB,OAAyB,EAAE,MAAyB;IACzF,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAE7C,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DtoClass } from './dto-class.js';
|
|
2
|
+
/** Every property of a DTO class but `keys`, with their constraints, as a class to extend. */
|
|
3
|
+
export declare function omitClass<T extends object, K extends keyof T & string>(base: DtoClass<T>, keys: readonly K[]): DtoClass<Omit<T, K>>;
|
|
4
|
+
//# sourceMappingURL=omit-class.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omit-class.d.ts","sourceRoot":"","sources":["../../src/class-validator/omit-class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,8FAA8F;AAC9F,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EACpE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EACjB,IAAI,EAAE,SAAS,CAAC,EAAE,GACjB,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAMtB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { derivedClass } from './derived-class.js';
|
|
2
|
+
/** Every property of a DTO class but `keys`, with their constraints, as a class to extend. */
|
|
3
|
+
export function omitClass(base, keys) {
|
|
4
|
+
return derivedClass(base, `${base.name}_omit_${keys.join('_')}`, (property) => !keys.some((key) => key === property));
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=omit-class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omit-class.js","sourceRoot":"","sources":["../../src/class-validator/omit-class.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,8FAA8F;AAC9F,MAAM,UAAU,SAAS,CACvB,IAAiB,EACjB,IAAkB;IAElB,OAAO,YAAY,CACjB,IAAI,EACJ,GAAG,IAAI,CAAC,IAAI,SAAS,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EACrC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,QAAQ,CAAC,CACpD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DtoClass } from './dto-class.js';
|
|
2
|
+
/**
|
|
3
|
+
* Every property of a DTO class, each optional and checked by its constraints when present, as
|
|
4
|
+
* a class to extend: the body of a partial update, `class EditBody extends partialClass(PatientDto) {}`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function partialClass<T extends object>(base: DtoClass<T>): DtoClass<Partial<T>>;
|
|
7
|
+
//# sourceMappingURL=partial-class.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial-class.d.ts","sourceRoot":"","sources":["../../src/class-validator/partial-class.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAK/C;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAStF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IsOptional } from 'class-validator';
|
|
2
|
+
import { declaredProperties } from './declared-properties.js';
|
|
3
|
+
import { derivedClass } from './derived-class.js';
|
|
4
|
+
import { prototypeOf } from './prototype-of.js';
|
|
5
|
+
/**
|
|
6
|
+
* Every property of a DTO class, each optional and checked by its constraints when present, as
|
|
7
|
+
* a class to extend: the body of a partial update, `class EditBody extends partialClass(PatientDto) {}`.
|
|
8
|
+
*/
|
|
9
|
+
export function partialClass(base) {
|
|
10
|
+
const partial = derivedClass(base, `${base.name}_partial`, () => true);
|
|
11
|
+
const optional = IsOptional();
|
|
12
|
+
for (const property of declaredProperties(base)) {
|
|
13
|
+
optional(prototypeOf(partial), property);
|
|
14
|
+
}
|
|
15
|
+
return partial;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=partial-class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial-class.js","sourceRoot":"","sources":["../../src/class-validator/partial-class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAmB,IAAiB;IAC9D,MAAM,OAAO,GAAG,YAAY,CAAa,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IACnF,MAAM,QAAQ,GAAG,UAAU,EAAE,CAAC;IAE9B,KAAK,MAAM,QAAQ,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DtoClass } from './dto-class.js';
|
|
2
|
+
/**
|
|
3
|
+
* The properties `keys` of a DTO class, with their constraints, as a class to extend:
|
|
4
|
+
* `class RescheduleBody extends pickClass(AppointmentDto, ['startsAt', 'endsAt']) {}`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function pickClass<T extends object, K extends keyof T & string>(base: DtoClass<T>, keys: readonly K[]): DtoClass<Pick<T, K>>;
|
|
7
|
+
//# sourceMappingURL=pick-class.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pick-class.d.ts","sourceRoot":"","sources":["../../src/class-validator/pick-class.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI/C;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EACpE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EACjB,IAAI,EAAE,SAAS,CAAC,EAAE,GACjB,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAatB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DeclarationError } from '@ddd-ts-kit/kernel/declarations';
|
|
2
|
+
import { declaredProperties } from './declared-properties.js';
|
|
3
|
+
import { derivedClass } from './derived-class.js';
|
|
4
|
+
/**
|
|
5
|
+
* The properties `keys` of a DTO class, with their constraints, as a class to extend:
|
|
6
|
+
* `class RescheduleBody extends pickClass(AppointmentDto, ['startsAt', 'endsAt']) {}`.
|
|
7
|
+
*/
|
|
8
|
+
export function pickClass(base, keys) {
|
|
9
|
+
const declared = declaredProperties(base);
|
|
10
|
+
const undeclared = keys.filter((key) => !declared.has(key));
|
|
11
|
+
if (undeclared.length > 0) {
|
|
12
|
+
throw new DeclarationError(`${base.name} declares no constraint on ${undeclared.join(', ')}: picked, the property would be stripped as unknown. Decorate it in ${base.name} (@IsString(), @Allow(), ...).`);
|
|
13
|
+
}
|
|
14
|
+
return derivedClass(base, `${base.name}_pick_${keys.join('_')}`, (property) => keys.some((key) => key === property));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=pick-class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pick-class.js","sourceRoot":"","sources":["../../src/class-validator/pick-class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;GAGG;AACH,MAAM,UAAU,SAAS,CACvB,IAAiB,EACjB,IAAkB;IAElB,MAAM,QAAQ,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAE5D,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,gBAAgB,CACxB,GAAG,IAAI,CAAC,IAAI,8BAA8B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,uEAAuE,IAAI,CAAC,IAAI,gCAAgC,CAChL,CAAC;IACJ,CAAC;IAED,OAAO,YAAY,CAAa,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,SAAS,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,QAAQ,EAAE,EAAE,CACxF,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,QAAQ,CAAC,CACrC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-of.d.ts","sourceRoot":"","sources":["../../src/class-validator/prototype-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,CAIzD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** The object the instances of a class inherit from, where decorators record their metadata. */
|
|
2
|
+
export function prototypeOf(dto) {
|
|
3
|
+
const { prototype } = dto;
|
|
4
|
+
return typeof prototype === 'object' && prototype !== null ? prototype : {};
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=prototype-of.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-of.js","sourceRoot":"","sources":["../../src/class-validator/prototype-of.ts"],"names":[],"mappings":"AAEA,gGAAgG;AAChG,MAAM,UAAU,WAAW,CAAC,GAAqB;IAC/C,MAAM,EAAE,SAAS,EAAE,GAAoC,GAAG,CAAC;IAE3D,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9E,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { JsonSchema } from '../json-schema.js';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import type { DtoClass } from './dto-class.js';
|
|
3
|
+
/**
|
|
4
|
+
* The JSON Schema of a class, carrying under `$defs` only the classes reachable from it. Shared,
|
|
5
|
+
* the class itself is one of them and the schema is a reference to it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function selfContainedSchema(dto: DtoClass<object>, shared: boolean): JsonSchema;
|
|
4
8
|
//# sourceMappingURL=self-contained-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"self-contained-schema.d.ts","sourceRoot":"","sources":["../../src/class-validator/self-contained-schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"self-contained-schema.d.ts","sourceRoot":"","sources":["../../src/class-validator/self-contained-schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI/C;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,UAAU,CActF"}
|
|
@@ -1,26 +1,41 @@
|
|
|
1
1
|
import { defaultMetadataStorage } from 'class-transformer/cjs/storage.js';
|
|
2
2
|
import { validationMetadatasToSchemas } from 'class-validator-jsonschema';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
|
|
3
|
+
import { DEFINITIONS_POINTER } from '../shared/definitions-pointer.js';
|
|
4
|
+
/**
|
|
5
|
+
* The JSON Schema of a class, carrying under `$defs` only the classes reachable from it. Shared,
|
|
6
|
+
* the class itself is one of them and the schema is a reference to it.
|
|
7
|
+
*/
|
|
8
|
+
export function selfContainedSchema(dto, shared) {
|
|
6
9
|
const all = generatedSchemas();
|
|
7
|
-
const own = all
|
|
8
|
-
const defs = {};
|
|
10
|
+
const own = ownSchema(dto, all);
|
|
11
|
+
const defs = shared ? { [dto.name]: own } : {};
|
|
9
12
|
collectDefs(own, all, defs);
|
|
10
13
|
const names = Object.keys(defs).sort();
|
|
11
14
|
return {
|
|
12
15
|
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
13
|
-
...own,
|
|
16
|
+
...(shared ? { $ref: `${DEFINITIONS_POINTER}${dto.name}` } : own),
|
|
14
17
|
...(names.length > 0 ? { $defs: Object.fromEntries(names.map((name) => [name, defs[name]])) } : {}),
|
|
15
18
|
};
|
|
16
19
|
}
|
|
17
20
|
function generatedSchemas() {
|
|
18
21
|
const generated = validationMetadatasToSchemas({
|
|
19
22
|
classTransformerMetadataStorage: defaultMetadataStorage,
|
|
20
|
-
refPointerPrefix:
|
|
23
|
+
refPointerPrefix: DEFINITIONS_POINTER,
|
|
21
24
|
});
|
|
22
25
|
return Object.fromEntries(Object.entries(generated).map(([name, schema]) => [name, { ...schema }]));
|
|
23
26
|
}
|
|
27
|
+
/** A class that declares nothing itself (`class Body extends pickClass(...) {}`) is described by its nearest described ancestor. */
|
|
28
|
+
function ownSchema(dto, all) {
|
|
29
|
+
let ancestor = dto;
|
|
30
|
+
while (typeof ancestor === 'function' && ancestor.name !== '') {
|
|
31
|
+
const described = all[ancestor.name];
|
|
32
|
+
if (described !== undefined) {
|
|
33
|
+
return described;
|
|
34
|
+
}
|
|
35
|
+
ancestor = Object.getPrototypeOf(ancestor);
|
|
36
|
+
}
|
|
37
|
+
return { type: 'object' };
|
|
38
|
+
}
|
|
24
39
|
function collectDefs(node, all, defs) {
|
|
25
40
|
if (Array.isArray(node)) {
|
|
26
41
|
for (const item of node) {
|
|
@@ -42,8 +57,8 @@ function collectDefs(node, all, defs) {
|
|
|
42
57
|
}
|
|
43
58
|
}
|
|
44
59
|
function referencedDefinition(key, value) {
|
|
45
|
-
if (key === '$ref' && typeof value === 'string' && value.startsWith(
|
|
46
|
-
return value.slice(
|
|
60
|
+
if (key === '$ref' && typeof value === 'string' && value.startsWith(DEFINITIONS_POINTER)) {
|
|
61
|
+
return value.slice(DEFINITIONS_POINTER.length);
|
|
47
62
|
}
|
|
48
63
|
return undefined;
|
|
49
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"self-contained-schema.js","sourceRoot":"","sources":["../../src/class-validator/self-contained-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"self-contained-schema.js","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AE,KAAK,CAAC,CAAC;QAE9C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,iBAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,GAAW,EAAE,KAAc;IACvD,IAAI,GAAG,KAAK,MAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,CAAC;QACzF,OAAO,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY,EAAE,GAAkB,EAAE,IAAmB;IAC9E,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;IAEzB,iEAAiE;IACjE,IAAI,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QACrD,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;QACpB,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;AACH,CAAC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export { classSchema, type ClassSchemaOptions } from './class-validator/class-schema.js';
|
|
2
2
|
export type { DtoClass } from './class-validator/dto-class.js';
|
|
3
|
+
export { omitClass } from './class-validator/omit-class.js';
|
|
4
|
+
export { partialClass } from './class-validator/partial-class.js';
|
|
5
|
+
export { pickClass } from './class-validator/pick-class.js';
|
|
3
6
|
//# sourceMappingURL=class-validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-validator.d.ts","sourceRoot":"","sources":["../src/class-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACzF,YAAY,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"class-validator.d.ts","sourceRoot":"","sources":["../src/class-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACzF,YAAY,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dist/class-validator.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { classSchema } from './class-validator/class-schema.js';
|
|
2
|
+
export { omitClass } from './class-validator/omit-class.js';
|
|
3
|
+
export { partialClass } from './class-validator/partial-class.js';
|
|
4
|
+
export { pickClass } from './class-validator/pick-class.js';
|
|
2
5
|
//# sourceMappingURL=class-validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-validator.js","sourceRoot":"","sources":["../src/class-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA2B,MAAM,mCAAmC,CAAC"}
|
|
1
|
+
{"version":3,"file":"class-validator.js","sourceRoot":"","sources":["../src/class-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA2B,MAAM,mCAAmC,CAAC;AAEzF,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export type { Infer } from './infer.js';
|
|
|
4
4
|
export type { JsonSchema } from './json-schema.js';
|
|
5
5
|
export { parseOrThrow } from './parse-or-throw.js';
|
|
6
6
|
export type { Schema } from './schema.js';
|
|
7
|
+
export { sharedNameOf } from './shared/shared-name-of.js';
|
|
8
|
+
export { sharedSchema } from './shared/shared-schema.js';
|
|
7
9
|
export { ValidationError } from './validation-error.js';
|
|
8
10
|
export type { ValidationIssue } from './validation-issue.js';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { customSchema } from './custom-schema.js';
|
|
2
2
|
export { formatPath } from './format-path.js';
|
|
3
3
|
export { parseOrThrow } from './parse-or-throw.js';
|
|
4
|
+
export { sharedNameOf } from './shared/shared-name-of.js';
|
|
5
|
+
export { sharedSchema } from './shared/shared-schema.js';
|
|
4
6
|
export { ValidationError } from './validation-error.js';
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions-pointer.d.ts","sourceRoot":"","sources":["../../src/shared/definitions-pointer.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,eAAO,MAAM,mBAAmB,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions-pointer.js","sourceRoot":"","sources":["../../src/shared/definitions-pointer.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-record.d.ts","sourceRoot":"","sources":["../../src/shared/is-record.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE"}
|