@vnodes/prop 0.0.23
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 +35 -0
- package/bin/version.mjs +12 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/array-prop.d.ts +4 -0
- package/dist/lib/array-prop.d.ts.map +1 -0
- package/dist/lib/array-prop.js +21 -0
- package/dist/lib/array-prop.js.map +1 -0
- package/dist/lib/common-validation-pipe.d.ts +8 -0
- package/dist/lib/common-validation-pipe.d.ts.map +1 -0
- package/dist/lib/common-validation-pipe.js +32 -0
- package/dist/lib/common-validation-pipe.js.map +1 -0
- package/dist/lib/is-class-type.d.ts +2 -0
- package/dist/lib/is-class-type.d.ts.map +1 -0
- package/dist/lib/is-class-type.js +5 -0
- package/dist/lib/is-class-type.js.map +1 -0
- package/dist/lib/is-enum-type.d.ts +2 -0
- package/dist/lib/is-enum-type.d.ts.map +1 -0
- package/dist/lib/is-enum-type.js +5 -0
- package/dist/lib/is-enum-type.js.map +1 -0
- package/dist/lib/normalize-property-options.d.ts +3 -0
- package/dist/lib/normalize-property-options.d.ts.map +1 -0
- package/dist/lib/normalize-property-options.js +37 -0
- package/dist/lib/normalize-property-options.js.map +1 -0
- package/dist/lib/number-prop.d.ts +4 -0
- package/dist/lib/number-prop.d.ts.map +1 -0
- package/dist/lib/number-prop.js +21 -0
- package/dist/lib/number-prop.js.map +1 -0
- package/dist/lib/prop-options.d.ts +48 -0
- package/dist/lib/prop-options.d.ts.map +1 -0
- package/dist/lib/prop-options.js +45 -0
- package/dist/lib/prop-options.js.map +1 -0
- package/dist/lib/prop.d.ts +24 -0
- package/dist/lib/prop.d.ts.map +1 -0
- package/dist/lib/prop.js +98 -0
- package/dist/lib/prop.js.map +1 -0
- package/dist/lib/string-format-prop.d.ts +4 -0
- package/dist/lib/string-format-prop.d.ts.map +1 -0
- package/dist/lib/string-format-prop.js +99 -0
- package/dist/lib/string-format-prop.js.map +1 -0
- package/dist/lib/string-prop.d.ts +4 -0
- package/dist/lib/string-prop.d.ts.map +1 -0
- package/dist/lib/string-prop.js +28 -0
- package/dist/lib/string-prop.js.map +1 -0
- package/package.json +65 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+

|
|
2
|
+

|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<img srcset="./assets/favicon.png, https://vnodes.github.io/vnodes/libs/prop/assets/favicon.png" alt="Logo" width="200" height="200" style="border-radius: 100%"/>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
## @vnodes/prop
|
|
12
|
+
|
|
13
|
+
@vnodes/prop
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add @vnodes/prop
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 💖 Support My Work
|
|
22
|
+
|
|
23
|
+
If you find my open-source contributions or the **@vnodes/prop** project helpful, consider supporting my work. Your sponsorship helps me maintain these projects and explore new enterprise patterns.
|
|
24
|
+
|
|
25
|
+
[](https://cash.app/$puqlib)
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 🤝 Connect with Me
|
|
30
|
+
|
|
31
|
+
<p align="left">
|
|
32
|
+
<a href="mailto:robert.brightline+vnodes-prop@gmail.com">
|
|
33
|
+
<img src="https://img.shields.io/badge/Email-D14836?style=for-the-badge&logo=gmail&logoColor=white" />
|
|
34
|
+
</a>
|
|
35
|
+
</p>
|
package/bin/version.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
9
|
+
const packageJsonPath = join(__dirname, '..', 'package.json');
|
|
10
|
+
const packageJson = readFileSync(packageJsonPath, { encoding: 'utf-8' });
|
|
11
|
+
const version = JSON.parse(packageJson).version;
|
|
12
|
+
console.log(version);
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './lib/array-prop.js';
|
|
2
|
+
export * from './lib/common-validation-pipe.js';
|
|
3
|
+
export * from './lib/is-class-type.js';
|
|
4
|
+
export * from './lib/is-enum-type.js';
|
|
5
|
+
export * from './lib/normalize-property-options.js';
|
|
6
|
+
export * from './lib/number-prop.js';
|
|
7
|
+
export * from './lib/prop.js';
|
|
8
|
+
export * from './lib/prop-options.js';
|
|
9
|
+
export * from './lib/string-format-prop.js';
|
|
10
|
+
export * from './lib/string-prop.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qCAAqC,CAAC;AACpD,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// @index(['./**/*.ts', '!./**/*.{spec,test}.ts'], f => `export * from '${f.path}.js'`)
|
|
2
|
+
export * from './lib/array-prop.js';
|
|
3
|
+
export * from './lib/common-validation-pipe.js';
|
|
4
|
+
export * from './lib/is-class-type.js';
|
|
5
|
+
export * from './lib/is-enum-type.js';
|
|
6
|
+
export * from './lib/normalize-property-options.js';
|
|
7
|
+
export * from './lib/number-prop.js';
|
|
8
|
+
export * from './lib/prop.js';
|
|
9
|
+
export * from './lib/prop-options.js';
|
|
10
|
+
export * from './lib/string-format-prop.js';
|
|
11
|
+
export * from './lib/string-prop.js';
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// @index(['./**/*.ts', '!./**/*.{spec,test}.ts'], f => `export * from '${f.path}.js'`)\nexport * from './lib/array-prop.js';\nexport * from './lib/common-validation-pipe.js';\nexport * from './lib/is-class-type.js';\nexport * from './lib/is-enum-type.js';\nexport * from './lib/normalize-property-options.js';\nexport * from './lib/number-prop.js';\nexport * from './lib/prop.js';\nexport * from './lib/prop-options.js';\nexport * from './lib/string-format-prop.js';\nexport * from './lib/string-prop.js';\n"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,cAAc,sBAAsB;AACpC,cAAc,kCAAkC;AAChD,cAAc,yBAAyB;AACvC,cAAc,wBAAwB;AACtC,cAAc,sCAAsC;AACpD,cAAc,uBAAuB;AACrC,cAAc,gBAAgB;AAC9B,cAAc,wBAAwB;AACtC,cAAc,8BAA8B;AAC5C,cAAc,uBAAuB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ValidationOptions } from '@vnodes/nestjs/class-validator';
|
|
2
|
+
import type { ApiPropertyOptions } from '@vnodes/nestjs/swagger';
|
|
3
|
+
export declare function ArrayProp(options: ApiPropertyOptions, validationOptions?: ValidationOptions): PropertyDecorator;
|
|
4
|
+
//# sourceMappingURL=array-prop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array-prop.d.ts","sourceRoot":"","sources":["../../src/lib/array-prop.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACpG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,wBAAgB,SAAS,CAAC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CAkB/G"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ArrayMaxSize, ArrayMinSize } from '@vnodes/nestjs/class-validator';
|
|
2
|
+
export function ArrayProp(options, validationOptions) {
|
|
3
|
+
return (...args)=>{
|
|
4
|
+
const decorators = new Set();
|
|
5
|
+
const add = (...propertyDecorators)=>{
|
|
6
|
+
for (const propertyDecorator of propertyDecorators){
|
|
7
|
+
decorators.add(propertyDecorator);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
const { minItems, maxItems } = options;
|
|
11
|
+
if (minItems) add(ArrayMinSize(minItems, validationOptions));
|
|
12
|
+
if (maxItems) add(ArrayMaxSize(maxItems, validationOptions));
|
|
13
|
+
for (const propertyDecorator of [
|
|
14
|
+
...decorators
|
|
15
|
+
]){
|
|
16
|
+
propertyDecorator(...args);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=array-prop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/array-prop.ts"],"sourcesContent":["import { ArrayMaxSize, ArrayMinSize, type ValidationOptions } from '@vnodes/nestjs/class-validator';\nimport type { ApiPropertyOptions } from '@vnodes/nestjs/swagger';\n\nexport function ArrayProp(options: ApiPropertyOptions, validationOptions?: ValidationOptions): PropertyDecorator {\n return (...args) => {\n const decorators: Set<PropertyDecorator> = new Set();\n const add = (...propertyDecorators: PropertyDecorator[]) => {\n for (const propertyDecorator of propertyDecorators) {\n decorators.add(propertyDecorator);\n }\n };\n\n const { minItems, maxItems } = options;\n\n if (minItems) add(ArrayMinSize(minItems, validationOptions));\n if (maxItems) add(ArrayMaxSize(maxItems, validationOptions));\n\n for (const propertyDecorator of [...decorators]) {\n propertyDecorator(...args);\n }\n };\n}\n"],"names":["ArrayMaxSize","ArrayMinSize","ArrayProp","options","validationOptions","args","decorators","Set","add","propertyDecorators","propertyDecorator","minItems","maxItems"],"mappings":"AAAA,SAASA,YAAY,EAAEC,YAAY,QAAgC,iCAAiC;AAGpG,OAAO,SAASC,UAAUC,OAA2B,EAAEC,iBAAqC;IACxF,OAAO,CAAC,GAAGC;QACP,MAAMC,aAAqC,IAAIC;QAC/C,MAAMC,MAAM,CAAC,GAAGC;YACZ,KAAK,MAAMC,qBAAqBD,mBAAoB;gBAChDH,WAAWE,GAAG,CAACE;YACnB;QACJ;QAEA,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,GAAGT;QAE/B,IAAIQ,UAAUH,IAAIP,aAAaU,UAAUP;QACzC,IAAIQ,UAAUJ,IAAIR,aAAaY,UAAUR;QAEzC,KAAK,MAAMM,qBAAqB;eAAIJ;SAAW,CAAE;YAC7CI,qBAAqBL;QACzB;IACJ;AACJ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ClassTransformOptions } from '@vnodes/nestjs/class-transformer';
|
|
2
|
+
import type { ValidatorOptions } from '@vnodes/nestjs/class-validator';
|
|
3
|
+
import { ValidationPipe } from '@vnodes/nestjs/common';
|
|
4
|
+
export declare const __validatorOptions: ValidatorOptions;
|
|
5
|
+
export declare const __transformOptions: ClassTransformOptions;
|
|
6
|
+
export declare const CommonValidationPipe: ValidationPipe;
|
|
7
|
+
export declare const CommonGRpcValidationPipe: ValidationPipe;
|
|
8
|
+
//# sourceMappingURL=common-validation-pipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-validation-pipe.d.ts","sourceRoot":"","sources":["../../src/lib/common-validation-pipe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAgC,cAAc,EAA8B,MAAM,uBAAuB,CAAC;AAGjH,eAAO,MAAM,kBAAkB,EAAE,gBAGhC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,qBAGhC,CAAC;AASF,eAAO,MAAM,oBAAoB,gBAAkD,CAAC;AAEpF,eAAO,MAAM,wBAAwB,gBAKnC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { UnprocessableEntityException, ValidationPipe } from '@vnodes/nestjs/common';
|
|
2
|
+
import { RpcException } from '@vnodes/nestjs/microservices';
|
|
3
|
+
export const __validatorOptions = {
|
|
4
|
+
whitelist: true,
|
|
5
|
+
forbidNonWhitelisted: true
|
|
6
|
+
};
|
|
7
|
+
export const __transformOptions = {
|
|
8
|
+
enableImplicitConversion: true,
|
|
9
|
+
exposeUnsetFields: false
|
|
10
|
+
};
|
|
11
|
+
const commonValidationPipeOptions = {
|
|
12
|
+
...__validatorOptions,
|
|
13
|
+
transformOptions: {
|
|
14
|
+
...__transformOptions
|
|
15
|
+
},
|
|
16
|
+
exceptionFactory (errors) {
|
|
17
|
+
throw new UnprocessableEntityException({
|
|
18
|
+
errors
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export const CommonValidationPipe = new ValidationPipe(commonValidationPipeOptions);
|
|
23
|
+
export const CommonGRpcValidationPipe = new ValidationPipe({
|
|
24
|
+
...commonValidationPipeOptions,
|
|
25
|
+
exceptionFactory (errors) {
|
|
26
|
+
throw new RpcException({
|
|
27
|
+
errors
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=common-validation-pipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/common-validation-pipe.ts"],"sourcesContent":["import type { ClassTransformOptions } from '@vnodes/nestjs/class-transformer';\nimport type { ValidatorOptions } from '@vnodes/nestjs/class-validator';\nimport { UnprocessableEntityException, ValidationPipe, type ValidationPipeOptions } from '@vnodes/nestjs/common';\nimport { RpcException } from '@vnodes/nestjs/microservices';\n\nexport const __validatorOptions: ValidatorOptions = {\n whitelist: true,\n forbidNonWhitelisted: true,\n};\n\nexport const __transformOptions: ClassTransformOptions = {\n enableImplicitConversion: true,\n exposeUnsetFields: false,\n};\n\nconst commonValidationPipeOptions: ValidationPipeOptions = {\n ...__validatorOptions,\n transformOptions: { ...__transformOptions },\n exceptionFactory(errors) {\n throw new UnprocessableEntityException({ errors });\n },\n};\nexport const CommonValidationPipe = new ValidationPipe(commonValidationPipeOptions);\n\nexport const CommonGRpcValidationPipe = new ValidationPipe({\n ...commonValidationPipeOptions,\n exceptionFactory(errors) {\n throw new RpcException({ errors });\n },\n});\n"],"names":["UnprocessableEntityException","ValidationPipe","RpcException","__validatorOptions","whitelist","forbidNonWhitelisted","__transformOptions","enableImplicitConversion","exposeUnsetFields","commonValidationPipeOptions","transformOptions","exceptionFactory","errors","CommonValidationPipe","CommonGRpcValidationPipe"],"mappings":"AAEA,SAASA,4BAA4B,EAAEC,cAAc,QAAoC,wBAAwB;AACjH,SAASC,YAAY,QAAQ,+BAA+B;AAE5D,OAAO,MAAMC,qBAAuC;IAChDC,WAAW;IACXC,sBAAsB;AAC1B,EAAE;AAEF,OAAO,MAAMC,qBAA4C;IACrDC,0BAA0B;IAC1BC,mBAAmB;AACvB,EAAE;AAEF,MAAMC,8BAAqD;IACvD,GAAGN,kBAAkB;IACrBO,kBAAkB;QAAE,GAAGJ,kBAAkB;IAAC;IAC1CK,kBAAiBC,MAAM;QACnB,MAAM,IAAIZ,6BAA6B;YAAEY;QAAO;IACpD;AACJ;AACA,OAAO,MAAMC,uBAAuB,IAAIZ,eAAeQ,6BAA6B;AAEpF,OAAO,MAAMK,2BAA2B,IAAIb,eAAe;IACvD,GAAGQ,2BAA2B;IAC9BE,kBAAiBC,MAAM;QACnB,MAAM,IAAIV,aAAa;YAAEU;QAAO;IACpC;AACJ,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-class-type.d.ts","sourceRoot":"","sources":["../../src/lib/is-class-type.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,WAExC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/is-class-type.ts"],"sourcesContent":["export function isClassType(type: unknown) {\n return type?.constructor?.name === 'Function';\n}\n"],"names":["isClassType","type","name"],"mappings":"AAAA,OAAO,SAASA,YAAYC,IAAa;IACrC,OAAOA,MAAM,aAAaC,SAAS;AACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-enum-type.d.ts","sourceRoot":"","sources":["../../src/lib/is-enum-type.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,WAEtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/is-enum-type.ts"],"sourcesContent":["export function isEnumType(type: object) {\n return type?.constructor?.name === 'Object';\n}\n"],"names":["isEnumType","type","name"],"mappings":"AAAA,OAAO,SAASA,WAAWC,IAAY;IACnC,OAAOA,MAAM,aAAaC,SAAS;AACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-property-options.d.ts","sourceRoot":"","sources":["../../src/lib/normalize-property-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGjE,wBAAgB,wBAAwB,CACpC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,GAC7B,kBAAkB,CAsCpB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { isClassType } from './is-class-type.js';
|
|
2
|
+
export function normalizePropertyOptions(options, target, propertyKey) {
|
|
3
|
+
if (!options) options = {};
|
|
4
|
+
if (options.required !== true) {
|
|
5
|
+
options.required = false;
|
|
6
|
+
}
|
|
7
|
+
if (options.enum) {
|
|
8
|
+
if (!Array.isArray(options.enum)) {
|
|
9
|
+
options.enum = Object.values(options.enum);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (!options.type) {
|
|
13
|
+
const rtype = Reflect.getMetadata('design:type', target, propertyKey);
|
|
14
|
+
if (!rtype) {
|
|
15
|
+
throw new Error(`Could not get the reflected type from metadata!`);
|
|
16
|
+
}
|
|
17
|
+
if (rtype === String || rtype === Number || rtype === Date || rtype === Boolean) {
|
|
18
|
+
options.type = rtype;
|
|
19
|
+
} else if (rtype === Array) {
|
|
20
|
+
options.required = false;
|
|
21
|
+
if (!options.type) {
|
|
22
|
+
options.type = [
|
|
23
|
+
String
|
|
24
|
+
];
|
|
25
|
+
options.isArray = undefined;
|
|
26
|
+
}
|
|
27
|
+
} else if (isClassType(rtype)) {
|
|
28
|
+
options.type = rtype;
|
|
29
|
+
}
|
|
30
|
+
if (!options.type) {
|
|
31
|
+
options.type = rtype;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return options;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=normalize-property-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/normalize-property-options.ts"],"sourcesContent":["import type { ApiPropertyOptions } from '@vnodes/nestjs/swagger';\nimport { isClassType } from './is-class-type.js';\n\nexport function normalizePropertyOptions(\n options: ApiPropertyOptions,\n target: object,\n propertyKey: string | symbol,\n): ApiPropertyOptions {\n if (!options) options = {};\n\n if (options.required !== true) {\n options.required = false;\n }\n\n if (options.enum) {\n if (!Array.isArray(options.enum)) {\n options.enum = Object.values(options.enum);\n }\n }\n\n if (!options.type) {\n const rtype = Reflect.getMetadata('design:type', target, propertyKey);\n\n if (!rtype) {\n throw new Error(`Could not get the reflected type from metadata!`);\n }\n\n if (rtype === String || rtype === Number || rtype === Date || rtype === Boolean) {\n options.type = rtype;\n } else if (rtype === Array) {\n options.required = false;\n if (!options.type) {\n options.type = [String];\n options.isArray = undefined;\n }\n } else if (isClassType(rtype)) {\n options.type = rtype;\n }\n\n if (!options.type) {\n options.type = rtype;\n }\n }\n\n return options;\n}\n"],"names":["isClassType","normalizePropertyOptions","options","target","propertyKey","required","enum","Array","isArray","Object","values","type","rtype","Reflect","getMetadata","Error","String","Number","Date","Boolean","undefined"],"mappings":"AACA,SAASA,WAAW,QAAQ,qBAAqB;AAEjD,OAAO,SAASC,yBACZC,OAA2B,EAC3BC,MAAc,EACdC,WAA4B;IAE5B,IAAI,CAACF,SAASA,UAAU,CAAC;IAEzB,IAAIA,QAAQG,QAAQ,KAAK,MAAM;QAC3BH,QAAQG,QAAQ,GAAG;IACvB;IAEA,IAAIH,QAAQI,IAAI,EAAE;QACd,IAAI,CAACC,MAAMC,OAAO,CAACN,QAAQI,IAAI,GAAG;YAC9BJ,QAAQI,IAAI,GAAGG,OAAOC,MAAM,CAACR,QAAQI,IAAI;QAC7C;IACJ;IAEA,IAAI,CAACJ,QAAQS,IAAI,EAAE;QACf,MAAMC,QAAQC,QAAQC,WAAW,CAAC,eAAeX,QAAQC;QAEzD,IAAI,CAACQ,OAAO;YACR,MAAM,IAAIG,MAAM,CAAC,+CAA+C,CAAC;QACrE;QAEA,IAAIH,UAAUI,UAAUJ,UAAUK,UAAUL,UAAUM,QAAQN,UAAUO,SAAS;YAC7EjB,QAAQS,IAAI,GAAGC;QACnB,OAAO,IAAIA,UAAUL,OAAO;YACxBL,QAAQG,QAAQ,GAAG;YACnB,IAAI,CAACH,QAAQS,IAAI,EAAE;gBACfT,QAAQS,IAAI,GAAG;oBAACK;iBAAO;gBACvBd,QAAQM,OAAO,GAAGY;YACtB;QACJ,OAAO,IAAIpB,YAAYY,QAAQ;YAC3BV,QAAQS,IAAI,GAAGC;QACnB;QAEA,IAAI,CAACV,QAAQS,IAAI,EAAE;YACfT,QAAQS,IAAI,GAAGC;QACnB;IACJ;IAEA,OAAOV;AACX"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ValidatorOptions } from '@vnodes/nestjs/class-validator';
|
|
2
|
+
import type { ApiPropertyOptions } from '@vnodes/nestjs/swagger';
|
|
3
|
+
export declare function NumberProp(options: ApiPropertyOptions, validationOptions?: ValidatorOptions): PropertyDecorator;
|
|
4
|
+
//# sourceMappingURL=number-prop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-prop.d.ts","sourceRoot":"","sources":["../../src/lib/number-prop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,wBAAgB,UAAU,CAAC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,EAAE,gBAAgB,GAAG,iBAAiB,CAkB/G"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Max, Min } from '@vnodes/nestjs/class-validator';
|
|
2
|
+
export function NumberProp(options, validationOptions) {
|
|
3
|
+
return (...args)=>{
|
|
4
|
+
const decorators = new Set();
|
|
5
|
+
const add = (...propertyDecorators)=>{
|
|
6
|
+
for (const propertyDecorator of propertyDecorators){
|
|
7
|
+
decorators.add(propertyDecorator);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
const { minimum, maximum } = options;
|
|
11
|
+
if (minimum !== undefined) add(Min(minimum, validationOptions));
|
|
12
|
+
if (maximum !== undefined) add(Max(maximum, validationOptions));
|
|
13
|
+
for (const propertyDecorator of [
|
|
14
|
+
...decorators
|
|
15
|
+
]){
|
|
16
|
+
propertyDecorator(...args);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=number-prop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/number-prop.ts"],"sourcesContent":["import { Max, Min, type ValidatorOptions } from '@vnodes/nestjs/class-validator';\nimport type { ApiPropertyOptions } from '@vnodes/nestjs/swagger';\n\nexport function NumberProp(options: ApiPropertyOptions, validationOptions?: ValidatorOptions): PropertyDecorator {\n return (...args) => {\n const decorators: Set<PropertyDecorator> = new Set();\n const add = (...propertyDecorators: PropertyDecorator[]) => {\n for (const propertyDecorator of propertyDecorators) {\n decorators.add(propertyDecorator);\n }\n };\n\n const { minimum, maximum } = options;\n\n if (minimum !== undefined) add(Min(minimum, validationOptions));\n if (maximum !== undefined) add(Max(maximum, validationOptions));\n\n for (const propertyDecorator of [...decorators]) {\n propertyDecorator(...args);\n }\n };\n}\n"],"names":["Max","Min","NumberProp","options","validationOptions","args","decorators","Set","add","propertyDecorators","propertyDecorator","minimum","maximum","undefined"],"mappings":"AAAA,SAASA,GAAG,EAAEC,GAAG,QAA+B,iCAAiC;AAGjF,OAAO,SAASC,WAAWC,OAA2B,EAAEC,iBAAoC;IACxF,OAAO,CAAC,GAAGC;QACP,MAAMC,aAAqC,IAAIC;QAC/C,MAAMC,MAAM,CAAC,GAAGC;YACZ,KAAK,MAAMC,qBAAqBD,mBAAoB;gBAChDH,WAAWE,GAAG,CAACE;YACnB;QACJ;QAEA,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGT;QAE7B,IAAIQ,YAAYE,WAAWL,IAAIP,IAAIU,SAASP;QAC5C,IAAIQ,YAAYC,WAAWL,IAAIR,IAAIY,SAASR;QAE5C,KAAK,MAAMM,qBAAqB;eAAIJ;SAAW,CAAE;YAC7CI,qBAAqBL;QACzB;IACJ;AACJ"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ApiPropertyOptions } from '@vnodes/nestjs/swagger';
|
|
2
|
+
import type { Keys } from '@vnodes/types';
|
|
3
|
+
export type PropOptions = ApiPropertyOptions;
|
|
4
|
+
export declare const ProOptionsMap: {
|
|
5
|
+
minItems: string;
|
|
6
|
+
type: string;
|
|
7
|
+
required: string;
|
|
8
|
+
enum: string;
|
|
9
|
+
nullable: string;
|
|
10
|
+
discriminator: string;
|
|
11
|
+
readOnly: string;
|
|
12
|
+
writeOnly: string;
|
|
13
|
+
xml: string;
|
|
14
|
+
externalDocs: string;
|
|
15
|
+
example: string;
|
|
16
|
+
examples: string;
|
|
17
|
+
deprecated: string;
|
|
18
|
+
allOf: string;
|
|
19
|
+
oneOf: string;
|
|
20
|
+
anyOf: string;
|
|
21
|
+
not: string;
|
|
22
|
+
items: string;
|
|
23
|
+
additionalProperties: string;
|
|
24
|
+
patternProperties: string;
|
|
25
|
+
description: string;
|
|
26
|
+
format: string;
|
|
27
|
+
default: string;
|
|
28
|
+
title: string;
|
|
29
|
+
multipleOf: string;
|
|
30
|
+
maximum: string;
|
|
31
|
+
exclusiveMaximum: string;
|
|
32
|
+
minimum: string;
|
|
33
|
+
exclusiveMinimum: string;
|
|
34
|
+
maxLength: string;
|
|
35
|
+
minLength: string;
|
|
36
|
+
pattern: string;
|
|
37
|
+
maxItems: string;
|
|
38
|
+
uniqueItems: string;
|
|
39
|
+
maxProperties: string;
|
|
40
|
+
minProperties: string;
|
|
41
|
+
'x-enumNames': string;
|
|
42
|
+
isArray: string;
|
|
43
|
+
name: string;
|
|
44
|
+
link: string;
|
|
45
|
+
};
|
|
46
|
+
export type PropOptionNames = Keys<PropOptions>;
|
|
47
|
+
export declare const propOptionKeys: PropOptionNames;
|
|
48
|
+
//# sourceMappingURL=prop-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop-options.d.ts","sourceRoot":"","sources":["../../src/lib/prop-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAE7C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCzB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;AAChD,eAAO,MAAM,cAAc,EAAiC,eAAe,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export const ProOptionsMap = {
|
|
2
|
+
minItems: 'minItems',
|
|
3
|
+
type: 'type',
|
|
4
|
+
required: 'required',
|
|
5
|
+
enum: 'enum',
|
|
6
|
+
nullable: 'nullable',
|
|
7
|
+
discriminator: 'discriminator',
|
|
8
|
+
readOnly: 'readOnly',
|
|
9
|
+
writeOnly: 'writeOnly',
|
|
10
|
+
xml: 'xml',
|
|
11
|
+
externalDocs: 'externalDocs',
|
|
12
|
+
example: 'example',
|
|
13
|
+
examples: 'examples',
|
|
14
|
+
deprecated: 'deprecated',
|
|
15
|
+
allOf: 'allOf',
|
|
16
|
+
oneOf: 'oneOf',
|
|
17
|
+
anyOf: 'anyOf',
|
|
18
|
+
not: 'not',
|
|
19
|
+
items: 'items',
|
|
20
|
+
additionalProperties: 'additionalProperties',
|
|
21
|
+
patternProperties: 'patternProperties',
|
|
22
|
+
description: 'description',
|
|
23
|
+
format: 'format',
|
|
24
|
+
default: 'default',
|
|
25
|
+
title: 'title',
|
|
26
|
+
multipleOf: 'multipleOf',
|
|
27
|
+
maximum: 'maximum',
|
|
28
|
+
exclusiveMaximum: 'exclusiveMaximum',
|
|
29
|
+
minimum: 'minimum',
|
|
30
|
+
exclusiveMinimum: 'exclusiveMinimum',
|
|
31
|
+
maxLength: 'maxLength',
|
|
32
|
+
minLength: 'minLength',
|
|
33
|
+
pattern: 'pattern',
|
|
34
|
+
maxItems: 'maxItems',
|
|
35
|
+
uniqueItems: 'uniqueItems',
|
|
36
|
+
maxProperties: 'maxProperties',
|
|
37
|
+
minProperties: 'minProperties',
|
|
38
|
+
'x-enumNames': 'x-enumNames',
|
|
39
|
+
isArray: 'isArray',
|
|
40
|
+
name: 'name',
|
|
41
|
+
link: 'link'
|
|
42
|
+
};
|
|
43
|
+
export const propOptionKeys = Object.keys(ProOptionsMap);
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=prop-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/prop-options.ts"],"sourcesContent":["import type { ApiPropertyOptions } from '@vnodes/nestjs/swagger';\nimport type { Keys } from '@vnodes/types';\n\nexport type PropOptions = ApiPropertyOptions;\n\nexport const ProOptionsMap = {\n minItems: 'minItems',\n type: 'type',\n required: 'required',\n enum: 'enum',\n nullable: 'nullable',\n discriminator: 'discriminator',\n readOnly: 'readOnly',\n writeOnly: 'writeOnly',\n xml: 'xml',\n externalDocs: 'externalDocs',\n example: 'example',\n examples: 'examples',\n deprecated: 'deprecated',\n allOf: 'allOf',\n oneOf: 'oneOf',\n anyOf: 'anyOf',\n not: 'not',\n items: 'items',\n additionalProperties: 'additionalProperties',\n patternProperties: 'patternProperties',\n description: 'description',\n format: 'format',\n default: 'default',\n title: 'title',\n multipleOf: 'multipleOf',\n maximum: 'maximum',\n exclusiveMaximum: 'exclusiveMaximum',\n minimum: 'minimum',\n exclusiveMinimum: 'exclusiveMinimum',\n maxLength: 'maxLength',\n minLength: 'minLength',\n pattern: 'pattern',\n maxItems: 'maxItems',\n uniqueItems: 'uniqueItems',\n maxProperties: 'maxProperties',\n minProperties: 'minProperties',\n 'x-enumNames': 'x-enumNames',\n isArray: 'isArray',\n name: 'name',\n link: 'link',\n};\n\nexport type PropOptionNames = Keys<PropOptions>;\nexport const propOptionKeys = Object.keys(ProOptionsMap) as PropOptionNames;\n"],"names":["ProOptionsMap","minItems","type","required","enum","nullable","discriminator","readOnly","writeOnly","xml","externalDocs","example","examples","deprecated","allOf","oneOf","anyOf","not","items","additionalProperties","patternProperties","description","format","default","title","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","maxItems","uniqueItems","maxProperties","minProperties","isArray","name","link","propOptionKeys","Object","keys"],"mappings":"AAKA,OAAO,MAAMA,gBAAgB;IACzBC,UAAU;IACVC,MAAM;IACNC,UAAU;IACVC,MAAM;IACNC,UAAU;IACVC,eAAe;IACfC,UAAU;IACVC,WAAW;IACXC,KAAK;IACLC,cAAc;IACdC,SAAS;IACTC,UAAU;IACVC,YAAY;IACZC,OAAO;IACPC,OAAO;IACPC,OAAO;IACPC,KAAK;IACLC,OAAO;IACPC,sBAAsB;IACtBC,mBAAmB;IACnBC,aAAa;IACbC,QAAQ;IACRC,SAAS;IACTC,OAAO;IACPC,YAAY;IACZC,SAAS;IACTC,kBAAkB;IAClBC,SAAS;IACTC,kBAAkB;IAClBC,WAAW;IACXC,WAAW;IACXC,SAAS;IACTC,UAAU;IACVC,aAAa;IACbC,eAAe;IACfC,eAAe;IACf,eAAe;IACfC,SAAS;IACTC,MAAM;IACNC,MAAM;AACV,EAAE;AAGF,OAAO,MAAMC,iBAAiBC,OAAOC,IAAI,CAAC1C,eAAkC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ValidationOptions } from '@vnodes/nestjs/class-validator';
|
|
2
|
+
import type { PropOptions } from './prop-options.js';
|
|
3
|
+
/**
|
|
4
|
+
* ## Examples
|
|
5
|
+
* ```typescript
|
|
6
|
+
* \@Prop() value: string;
|
|
7
|
+
* \@Prop() value: number;
|
|
8
|
+
* \@Prop() value: boolean;
|
|
9
|
+
* \@Prop() value: Date;
|
|
10
|
+
* \@Prop({ type: CustomObject }) value: CustomObject;
|
|
11
|
+
* \@Prop({ type: [String] }) value: string[];
|
|
12
|
+
* \@Prop({ enum: EnumClss }) value: EnumClss;
|
|
13
|
+
* \@Prop({ type:[EnumClss] enum: EnumClss }) value: EnumClss;
|
|
14
|
+
*
|
|
15
|
+
* ## Notes
|
|
16
|
+
* - properties are optional by defualt if required is not set true
|
|
17
|
+
* ```
|
|
18
|
+
* @param options Open api property options
|
|
19
|
+
* @param validationOptions property validation options from class-validator
|
|
20
|
+
* @returns -- {@link PropertyDecorator}
|
|
21
|
+
*/
|
|
22
|
+
export declare function Prop(options?: PropOptions, validationOptions?: ValidationOptions): PropertyDecorator;
|
|
23
|
+
export declare function OptionalProp(options?: PropOptions, validationOptions?: ValidationOptions): PropertyDecorator;
|
|
24
|
+
//# sourceMappingURL=prop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop.d.ts","sourceRoot":"","sources":["../../src/lib/prop.ts"],"names":[],"mappings":"AACA,OAAO,EAOH,KAAK,iBAAiB,EACzB,MAAM,gCAAgC,CAAC;AAOxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAgB,EAAE,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CAuDxG;AAED,wBAAgB,YAAY,CAAC,OAAO,GAAE,WAAgB,EAAE,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CAUhH"}
|
package/dist/lib/prop.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Expose, Type } from '@vnodes/nestjs/class-transformer';
|
|
2
|
+
import { IsBoolean, IsDate, IsDefined, IsEnum, IsOptional, ValidateNested } from '@vnodes/nestjs/class-validator';
|
|
3
|
+
import { ApiProperty } from '@vnodes/nestjs/swagger';
|
|
4
|
+
import { ArrayProp } from './array-prop.js';
|
|
5
|
+
import { isClassType } from './is-class-type.js';
|
|
6
|
+
import { normalizePropertyOptions } from './normalize-property-options.js';
|
|
7
|
+
import { NumberProp } from './number-prop.js';
|
|
8
|
+
import { StringProp } from './string-prop.js';
|
|
9
|
+
/**
|
|
10
|
+
* ## Examples
|
|
11
|
+
* ```typescript
|
|
12
|
+
* \@Prop() value: string;
|
|
13
|
+
* \@Prop() value: number;
|
|
14
|
+
* \@Prop() value: boolean;
|
|
15
|
+
* \@Prop() value: Date;
|
|
16
|
+
* \@Prop({ type: CustomObject }) value: CustomObject;
|
|
17
|
+
* \@Prop({ type: [String] }) value: string[];
|
|
18
|
+
* \@Prop({ enum: EnumClss }) value: EnumClss;
|
|
19
|
+
* \@Prop({ type:[EnumClss] enum: EnumClss }) value: EnumClss;
|
|
20
|
+
*
|
|
21
|
+
* ## Notes
|
|
22
|
+
* - properties are optional by defualt if required is not set true
|
|
23
|
+
* ```
|
|
24
|
+
* @param options Open api property options
|
|
25
|
+
* @param validationOptions property validation options from class-validator
|
|
26
|
+
* @returns -- {@link PropertyDecorator}
|
|
27
|
+
*/ export function Prop(options = {}, validationOptions) {
|
|
28
|
+
return (...args)=>{
|
|
29
|
+
options = normalizePropertyOptions(options, args[0], args[1]);
|
|
30
|
+
const safeType = options.type;
|
|
31
|
+
const decorators = new Set();
|
|
32
|
+
const add = (...propertyDecorators)=>{
|
|
33
|
+
for (const propertyDecorator of propertyDecorators){
|
|
34
|
+
decorators.add(propertyDecorator);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
if (options.enum) {
|
|
38
|
+
if (!Array.isArray(options.enum)) {
|
|
39
|
+
options.enum = Object.values(options.enum);
|
|
40
|
+
}
|
|
41
|
+
add(IsEnum(options.enum, {
|
|
42
|
+
...validationOptions,
|
|
43
|
+
message: `$property should be one of ${options.enum}`
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
if (Array.isArray(options.type)) {
|
|
47
|
+
add(ArrayProp(options, validationOptions));
|
|
48
|
+
add(Prop({
|
|
49
|
+
...options.items,
|
|
50
|
+
type: options.type[0]
|
|
51
|
+
}, {
|
|
52
|
+
each: true
|
|
53
|
+
}));
|
|
54
|
+
} else if (options.type === String) {
|
|
55
|
+
add(StringProp(options, validationOptions));
|
|
56
|
+
} else if (options.type === Number) {
|
|
57
|
+
add(NumberProp(options, validationOptions));
|
|
58
|
+
} else if (options.type === Boolean) {
|
|
59
|
+
add(IsBoolean(validationOptions));
|
|
60
|
+
} else if (options.type === Date) {
|
|
61
|
+
add(IsDate(validationOptions));
|
|
62
|
+
} else if (isClassType(options.type)) {
|
|
63
|
+
options.type = new options.type();
|
|
64
|
+
add(Type(()=>options.type));
|
|
65
|
+
add(ValidateNested(validationOptions));
|
|
66
|
+
} else if (typeof options.type === 'function') {
|
|
67
|
+
add(Type(options.type));
|
|
68
|
+
add(ValidateNested(validationOptions));
|
|
69
|
+
}
|
|
70
|
+
if (!validationOptions) {
|
|
71
|
+
add(ApiProperty({
|
|
72
|
+
...options,
|
|
73
|
+
type: safeType
|
|
74
|
+
}));
|
|
75
|
+
add(Expose());
|
|
76
|
+
if (options.required === true) {
|
|
77
|
+
add(IsDefined(validationOptions));
|
|
78
|
+
} else {
|
|
79
|
+
add(IsOptional(validationOptions));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
for (const decorator of [
|
|
83
|
+
...decorators
|
|
84
|
+
]){
|
|
85
|
+
decorator(...args);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export function OptionalProp(options = {}, validationOptions) {
|
|
90
|
+
return (...args)=>{
|
|
91
|
+
Prop({
|
|
92
|
+
...options,
|
|
93
|
+
required: false
|
|
94
|
+
}, validationOptions)(...args);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
//# sourceMappingURL=prop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/prop.ts"],"sourcesContent":["import { type ClassConstructor, Expose, Type } from '@vnodes/nestjs/class-transformer';\nimport {\n IsBoolean,\n IsDate,\n IsDefined,\n IsEnum,\n IsOptional,\n ValidateNested,\n type ValidationOptions,\n} from '@vnodes/nestjs/class-validator';\nimport { type ApiPropertyOptions as __ApiPropertyOptions, ApiProperty } from '@vnodes/nestjs/swagger';\nimport type { Any } from '@vnodes/types';\nimport { ArrayProp } from './array-prop.js';\nimport { isClassType } from './is-class-type.js';\nimport { normalizePropertyOptions } from './normalize-property-options.js';\nimport { NumberProp } from './number-prop.js';\nimport type { PropOptions } from './prop-options.js';\nimport { StringProp } from './string-prop.js';\n\n/**\n * ## Examples\n * ```typescript\n * \\@Prop() value: string;\n * \\@Prop() value: number;\n * \\@Prop() value: boolean;\n * \\@Prop() value: Date;\n * \\@Prop({ type: CustomObject }) value: CustomObject;\n * \\@Prop({ type: [String] }) value: string[];\n * \\@Prop({ enum: EnumClss }) value: EnumClss;\n * \\@Prop({ type:[EnumClss] enum: EnumClss }) value: EnumClss;\n *\n * ## Notes\n * - properties are optional by defualt if required is not set true\n * ```\n * @param options Open api property options\n * @param validationOptions property validation options from class-validator\n * @returns -- {@link PropertyDecorator}\n */\nexport function Prop(options: PropOptions = {}, validationOptions?: ValidationOptions): PropertyDecorator {\n return (...args) => {\n options = normalizePropertyOptions(options, args[0], args[1]);\n\n const safeType = options.type;\n\n const decorators = new Set<PropertyDecorator>();\n const add = (...propertyDecorators: PropertyDecorator[]) => {\n for (const propertyDecorator of propertyDecorators) {\n decorators.add(propertyDecorator);\n }\n };\n\n if (options.enum) {\n if (!Array.isArray(options.enum)) {\n options.enum = Object.values(options.enum);\n }\n add(IsEnum(options.enum, { ...validationOptions, message: `$property should be one of ${options.enum}` }));\n }\n\n if (Array.isArray(options.type)) {\n add(ArrayProp(options, validationOptions));\n add(Prop({ ...options.items, type: options.type[0] } as Any, { each: true }));\n } else if (options.type === String) {\n add(StringProp(options, validationOptions));\n } else if (options.type === Number) {\n add(NumberProp(options, validationOptions));\n } else if (options.type === Boolean) {\n add(IsBoolean(validationOptions));\n } else if (options.type === Date) {\n add(IsDate(validationOptions));\n } else if (isClassType(options.type)) {\n options.type = new (options.type as Any)();\n add(Type(() => options.type as ClassConstructor<unknown>));\n add(ValidateNested(validationOptions));\n } else if (typeof options.type === 'function') {\n add(Type(options.type as () => ClassConstructor<Any>));\n add(ValidateNested(validationOptions));\n }\n\n if (!validationOptions) {\n add(ApiProperty({ ...options, type: safeType } as __ApiPropertyOptions));\n add(Expose());\n\n if (options.required === true) {\n add(IsDefined(validationOptions));\n } else {\n add(IsOptional(validationOptions));\n }\n }\n\n for (const decorator of [...decorators]) {\n decorator(...args);\n }\n };\n}\n\nexport function OptionalProp(options: PropOptions = {}, validationOptions?: ValidationOptions): PropertyDecorator {\n return (...args) => {\n Prop(\n {\n ...options,\n required: false,\n } as PropOptions,\n validationOptions,\n )(...args);\n };\n}\n"],"names":["Expose","Type","IsBoolean","IsDate","IsDefined","IsEnum","IsOptional","ValidateNested","ApiProperty","ArrayProp","isClassType","normalizePropertyOptions","NumberProp","StringProp","Prop","options","validationOptions","args","safeType","type","decorators","Set","add","propertyDecorators","propertyDecorator","enum","Array","isArray","Object","values","message","items","each","String","Number","Boolean","Date","required","decorator","OptionalProp"],"mappings":"AAAA,SAAgCA,MAAM,EAAEC,IAAI,QAAQ,mCAAmC;AACvF,SACIC,SAAS,EACTC,MAAM,EACNC,SAAS,EACTC,MAAM,EACNC,UAAU,EACVC,cAAc,QAEX,iCAAiC;AACxC,SAA0DC,WAAW,QAAQ,yBAAyB;AAEtG,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,wBAAwB,QAAQ,kCAAkC;AAC3E,SAASC,UAAU,QAAQ,mBAAmB;AAE9C,SAASC,UAAU,QAAQ,mBAAmB;AAE9C;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASC,KAAKC,UAAuB,CAAC,CAAC,EAAEC,iBAAqC;IACjF,OAAO,CAAC,GAAGC;QACPF,UAAUJ,yBAAyBI,SAASE,IAAI,CAAC,EAAE,EAAEA,IAAI,CAAC,EAAE;QAE5D,MAAMC,WAAWH,QAAQI,IAAI;QAE7B,MAAMC,aAAa,IAAIC;QACvB,MAAMC,MAAM,CAAC,GAAGC;YACZ,KAAK,MAAMC,qBAAqBD,mBAAoB;gBAChDH,WAAWE,GAAG,CAACE;YACnB;QACJ;QAEA,IAAIT,QAAQU,IAAI,EAAE;YACd,IAAI,CAACC,MAAMC,OAAO,CAACZ,QAAQU,IAAI,GAAG;gBAC9BV,QAAQU,IAAI,GAAGG,OAAOC,MAAM,CAACd,QAAQU,IAAI;YAC7C;YACAH,IAAIjB,OAAOU,QAAQU,IAAI,EAAE;gBAAE,GAAGT,iBAAiB;gBAAEc,SAAS,CAAC,2BAA2B,EAAEf,QAAQU,IAAI,EAAE;YAAC;QAC3G;QAEA,IAAIC,MAAMC,OAAO,CAACZ,QAAQI,IAAI,GAAG;YAC7BG,IAAIb,UAAUM,SAASC;YACvBM,IAAIR,KAAK;gBAAE,GAAGC,QAAQgB,KAAK;gBAAEZ,MAAMJ,QAAQI,IAAI,CAAC,EAAE;YAAC,GAAU;gBAAEa,MAAM;YAAK;QAC9E,OAAO,IAAIjB,QAAQI,IAAI,KAAKc,QAAQ;YAChCX,IAAIT,WAAWE,SAASC;QAC5B,OAAO,IAAID,QAAQI,IAAI,KAAKe,QAAQ;YAChCZ,IAAIV,WAAWG,SAASC;QAC5B,OAAO,IAAID,QAAQI,IAAI,KAAKgB,SAAS;YACjCb,IAAIpB,UAAUc;QAClB,OAAO,IAAID,QAAQI,IAAI,KAAKiB,MAAM;YAC9Bd,IAAInB,OAAOa;QACf,OAAO,IAAIN,YAAYK,QAAQI,IAAI,GAAG;YAClCJ,QAAQI,IAAI,GAAG,IAAKJ,QAAQI,IAAI;YAChCG,IAAIrB,KAAK,IAAMc,QAAQI,IAAI;YAC3BG,IAAIf,eAAeS;QACvB,OAAO,IAAI,OAAOD,QAAQI,IAAI,KAAK,YAAY;YAC3CG,IAAIrB,KAAKc,QAAQI,IAAI;YACrBG,IAAIf,eAAeS;QACvB;QAEA,IAAI,CAACA,mBAAmB;YACpBM,IAAId,YAAY;gBAAE,GAAGO,OAAO;gBAAEI,MAAMD;YAAS;YAC7CI,IAAItB;YAEJ,IAAIe,QAAQsB,QAAQ,KAAK,MAAM;gBAC3Bf,IAAIlB,UAAUY;YAClB,OAAO;gBACHM,IAAIhB,WAAWU;YACnB;QACJ;QAEA,KAAK,MAAMsB,aAAa;eAAIlB;SAAW,CAAE;YACrCkB,aAAarB;QACjB;IACJ;AACJ;AAEA,OAAO,SAASsB,aAAaxB,UAAuB,CAAC,CAAC,EAAEC,iBAAqC;IACzF,OAAO,CAAC,GAAGC;QACPH,KACI;YACI,GAAGC,OAAO;YACVsB,UAAU;QACd,GACArB,sBACCC;IACT;AACJ"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ValidatorOptions } from '@vnodes/nestjs/class-validator';
|
|
2
|
+
import type { ApiPropertyOptions } from '@vnodes/nestjs/swagger';
|
|
3
|
+
export declare function StringFormatProp(options: ApiPropertyOptions, validationOptions?: ValidatorOptions): PropertyDecorator;
|
|
4
|
+
//# sourceMappingURL=string-format-prop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-format-prop.d.ts","sourceRoot":"","sources":["../../src/lib/string-format-prop.ts"],"names":[],"mappings":"AAAA,OAAO,EAUH,KAAK,gBAAgB,EACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,EAAE,gBAAgB,GAAG,iBAAiB,CAgGrH"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { IsEmail, IsFQDN, IsIP, IsISO8601, IsNumberString, IsStrongPassword, IsUrl, IsUUID, Matches } from '@vnodes/nestjs/class-validator';
|
|
2
|
+
export function StringFormatProp(options, validationOptions) {
|
|
3
|
+
return (...args)=>{
|
|
4
|
+
const { format } = options;
|
|
5
|
+
const decorators = new Set();
|
|
6
|
+
const add = (...propertyDecorators)=>{
|
|
7
|
+
for (const propertyDecorator of propertyDecorators){
|
|
8
|
+
decorators.add(propertyDecorator);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
switch(format){
|
|
12
|
+
case 'hostname':
|
|
13
|
+
{
|
|
14
|
+
add(IsFQDN({}, validationOptions));
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
case 'duration':
|
|
18
|
+
{
|
|
19
|
+
add(Matches(/^P(?!$)((\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/, {
|
|
20
|
+
...validationOptions,
|
|
21
|
+
message: '$property must be a valid duration'
|
|
22
|
+
}));
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
case 'password':
|
|
26
|
+
{
|
|
27
|
+
add(IsStrongPassword({
|
|
28
|
+
minLength: 6,
|
|
29
|
+
minLowercase: 1,
|
|
30
|
+
minNumbers: 1,
|
|
31
|
+
minSymbols: 1,
|
|
32
|
+
minUppercase: 1
|
|
33
|
+
}, validationOptions));
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case 'email':
|
|
37
|
+
{
|
|
38
|
+
add(IsEmail({}, validationOptions));
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case 'time':
|
|
42
|
+
case 'date-time':
|
|
43
|
+
case 'date':
|
|
44
|
+
{
|
|
45
|
+
add(IsISO8601({}, validationOptions));
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
case 'binary':
|
|
49
|
+
{
|
|
50
|
+
add(Matches(/^[0-1]{1,}$/, validationOptions));
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
case 'int32':
|
|
54
|
+
case 'int64':
|
|
55
|
+
case 'float':
|
|
56
|
+
case 'double':
|
|
57
|
+
{
|
|
58
|
+
add(IsNumberString({}, validationOptions));
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
case 'uri-reference':
|
|
62
|
+
case 'uri-template':
|
|
63
|
+
case 'uri':
|
|
64
|
+
{
|
|
65
|
+
add(IsUrl({
|
|
66
|
+
allow_fragments: true,
|
|
67
|
+
require_tld: false,
|
|
68
|
+
allow_protocol_relative_urls: true,
|
|
69
|
+
allow_query_components: true,
|
|
70
|
+
allow_trailing_dot: true,
|
|
71
|
+
allow_underscores: true
|
|
72
|
+
}, validationOptions));
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
case 'ipv4':
|
|
76
|
+
{
|
|
77
|
+
add(IsIP('4', validationOptions));
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
case 'ipv6':
|
|
81
|
+
{
|
|
82
|
+
add(IsIP('6', validationOptions));
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
case 'uuid':
|
|
86
|
+
{
|
|
87
|
+
add(IsUUID('all', validationOptions));
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
for (const propertyDecorator of [
|
|
92
|
+
...decorators
|
|
93
|
+
]){
|
|
94
|
+
propertyDecorator(...args);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//# sourceMappingURL=string-format-prop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/string-format-prop.ts"],"sourcesContent":["import {\n IsEmail,\n IsFQDN,\n IsIP,\n IsISO8601,\n IsNumberString,\n IsStrongPassword,\n IsUrl,\n IsUUID,\n Matches,\n type ValidatorOptions,\n} from '@vnodes/nestjs/class-validator';\nimport type { ApiPropertyOptions } from '@vnodes/nestjs/swagger';\n\nexport function StringFormatProp(options: ApiPropertyOptions, validationOptions?: ValidatorOptions): PropertyDecorator {\n return (...args) => {\n const { format } = options;\n const decorators: Set<PropertyDecorator> = new Set();\n const add = (...propertyDecorators: PropertyDecorator[]) => {\n for (const propertyDecorator of propertyDecorators) {\n decorators.add(propertyDecorator);\n }\n };\n\n switch (format) {\n case 'hostname': {\n add(IsFQDN({}, validationOptions));\n break;\n }\n case 'duration': {\n add(\n Matches(/^P(?!$)((\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?)(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+S)?)?$/, {\n ...validationOptions,\n message: '$property must be a valid duration',\n }),\n );\n break;\n }\n case 'password': {\n add(\n IsStrongPassword(\n {\n minLength: 6,\n minLowercase: 1,\n minNumbers: 1,\n minSymbols: 1,\n minUppercase: 1,\n },\n validationOptions,\n ),\n );\n break;\n }\n case 'email': {\n add(IsEmail({}, validationOptions));\n break;\n }\n case 'time':\n case 'date-time':\n case 'date': {\n add(IsISO8601({}, validationOptions));\n break;\n }\n case 'binary': {\n add(Matches(/^[0-1]{1,}$/, validationOptions));\n break;\n }\n case 'int32':\n case 'int64':\n case 'float':\n case 'double': {\n add(IsNumberString({}, validationOptions));\n break;\n }\n case 'uri-reference':\n case 'uri-template':\n case 'uri': {\n add(\n IsUrl(\n {\n allow_fragments: true,\n require_tld: false,\n allow_protocol_relative_urls: true,\n allow_query_components: true,\n allow_trailing_dot: true,\n allow_underscores: true,\n },\n validationOptions,\n ),\n );\n break;\n }\n case 'ipv4': {\n add(IsIP('4', validationOptions));\n break;\n }\n case 'ipv6': {\n add(IsIP('6', validationOptions));\n break;\n }\n case 'uuid': {\n add(IsUUID('all', validationOptions));\n break;\n }\n }\n\n for (const propertyDecorator of [...decorators]) {\n propertyDecorator(...args);\n }\n };\n}\n"],"names":["IsEmail","IsFQDN","IsIP","IsISO8601","IsNumberString","IsStrongPassword","IsUrl","IsUUID","Matches","StringFormatProp","options","validationOptions","args","format","decorators","Set","add","propertyDecorators","propertyDecorator","message","minLength","minLowercase","minNumbers","minSymbols","minUppercase","allow_fragments","require_tld","allow_protocol_relative_urls","allow_query_components","allow_trailing_dot","allow_underscores"],"mappings":"AAAA,SACIA,OAAO,EACPC,MAAM,EACNC,IAAI,EACJC,SAAS,EACTC,cAAc,EACdC,gBAAgB,EAChBC,KAAK,EACLC,MAAM,EACNC,OAAO,QAEJ,iCAAiC;AAGxC,OAAO,SAASC,iBAAiBC,OAA2B,EAAEC,iBAAoC;IAC9F,OAAO,CAAC,GAAGC;QACP,MAAM,EAAEC,MAAM,EAAE,GAAGH;QACnB,MAAMI,aAAqC,IAAIC;QAC/C,MAAMC,MAAM,CAAC,GAAGC;YACZ,KAAK,MAAMC,qBAAqBD,mBAAoB;gBAChDH,WAAWE,GAAG,CAACE;YACnB;QACJ;QAEA,OAAQL;YACJ,KAAK;gBAAY;oBACbG,IAAIf,OAAO,CAAC,GAAGU;oBACf;gBACJ;YACA,KAAK;gBAAY;oBACbK,IACIR,QAAQ,yEAAyE;wBAC7E,GAAGG,iBAAiB;wBACpBQ,SAAS;oBACb;oBAEJ;gBACJ;YACA,KAAK;gBAAY;oBACbH,IACIX,iBACI;wBACIe,WAAW;wBACXC,cAAc;wBACdC,YAAY;wBACZC,YAAY;wBACZC,cAAc;oBAClB,GACAb;oBAGR;gBACJ;YACA,KAAK;gBAAS;oBACVK,IAAIhB,QAAQ,CAAC,GAAGW;oBAChB;gBACJ;YACA,KAAK;YACL,KAAK;YACL,KAAK;gBAAQ;oBACTK,IAAIb,UAAU,CAAC,GAAGQ;oBAClB;gBACJ;YACA,KAAK;gBAAU;oBACXK,IAAIR,QAAQ,eAAeG;oBAC3B;gBACJ;YACA,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;gBAAU;oBACXK,IAAIZ,eAAe,CAAC,GAAGO;oBACvB;gBACJ;YACA,KAAK;YACL,KAAK;YACL,KAAK;gBAAO;oBACRK,IACIV,MACI;wBACImB,iBAAiB;wBACjBC,aAAa;wBACbC,8BAA8B;wBAC9BC,wBAAwB;wBACxBC,oBAAoB;wBACpBC,mBAAmB;oBACvB,GACAnB;oBAGR;gBACJ;YACA,KAAK;gBAAQ;oBACTK,IAAId,KAAK,KAAKS;oBACd;gBACJ;YACA,KAAK;gBAAQ;oBACTK,IAAId,KAAK,KAAKS;oBACd;gBACJ;YACA,KAAK;gBAAQ;oBACTK,IAAIT,OAAO,OAAOI;oBAClB;gBACJ;QACJ;QAEA,KAAK,MAAMO,qBAAqB;eAAIJ;SAAW,CAAE;YAC7CI,qBAAqBN;QACzB;IACJ;AACJ"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ValidationOptions } from '@vnodes/nestjs/class-validator';
|
|
2
|
+
import type { ApiPropertyOptions } from '@vnodes/nestjs/swagger';
|
|
3
|
+
export declare function StringProp(options: ApiPropertyOptions, validationOptions?: ValidationOptions): PropertyDecorator;
|
|
4
|
+
//# sourceMappingURL=string-prop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-prop.d.ts","sourceRoot":"","sources":["../../src/lib/string-prop.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,KAAK,iBAAiB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGjE,wBAAgB,UAAU,CAAC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CA2BhH"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IsNotEmpty, IsString, Matches, MaxLength, MinLength } from '@vnodes/nestjs/class-validator';
|
|
2
|
+
import { StringFormatProp } from './string-format-prop.js';
|
|
3
|
+
export function StringProp(options, validationOptions) {
|
|
4
|
+
return (...args)=>{
|
|
5
|
+
const decorators = new Set();
|
|
6
|
+
const add = (...propertyDecorators)=>{
|
|
7
|
+
for (const propertyDecorator of propertyDecorators){
|
|
8
|
+
decorators.add(propertyDecorator);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const { format, minLength, maxLength, pattern } = options;
|
|
12
|
+
add(IsString(validationOptions));
|
|
13
|
+
if (options.required === true) {
|
|
14
|
+
add(IsNotEmpty(validationOptions));
|
|
15
|
+
}
|
|
16
|
+
if (format) add(StringFormatProp(options, validationOptions));
|
|
17
|
+
if (minLength) add(MinLength(minLength, validationOptions));
|
|
18
|
+
if (maxLength) add(MaxLength(maxLength, validationOptions));
|
|
19
|
+
if (pattern) add(Matches(pattern, undefined, validationOptions));
|
|
20
|
+
for (const propertyDecorator of [
|
|
21
|
+
...decorators
|
|
22
|
+
]){
|
|
23
|
+
propertyDecorator(...args);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=string-prop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/string-prop.ts"],"sourcesContent":["import {\n IsNotEmpty,\n IsString,\n Matches,\n MaxLength,\n MinLength,\n type ValidationOptions,\n} from '@vnodes/nestjs/class-validator';\nimport type { ApiPropertyOptions } from '@vnodes/nestjs/swagger';\nimport { StringFormatProp } from './string-format-prop.js';\n\nexport function StringProp(options: ApiPropertyOptions, validationOptions?: ValidationOptions): PropertyDecorator {\n return (...args) => {\n const decorators: Set<PropertyDecorator> = new Set();\n const add = (...propertyDecorators: PropertyDecorator[]) => {\n for (const propertyDecorator of propertyDecorators) {\n decorators.add(propertyDecorator);\n }\n };\n\n const { format, minLength, maxLength, pattern } = options;\n\n add(IsString(validationOptions));\n\n if (options.required === true) {\n add(IsNotEmpty(validationOptions));\n }\n\n if (format) add(StringFormatProp(options, validationOptions));\n\n if (minLength) add(MinLength(minLength, validationOptions));\n if (maxLength) add(MaxLength(maxLength, validationOptions));\n if (pattern) add(Matches(pattern, undefined, validationOptions));\n\n for (const propertyDecorator of [...decorators]) {\n propertyDecorator(...args);\n }\n };\n}\n"],"names":["IsNotEmpty","IsString","Matches","MaxLength","MinLength","StringFormatProp","StringProp","options","validationOptions","args","decorators","Set","add","propertyDecorators","propertyDecorator","format","minLength","maxLength","pattern","required","undefined"],"mappings":"AAAA,SACIA,UAAU,EACVC,QAAQ,EACRC,OAAO,EACPC,SAAS,EACTC,SAAS,QAEN,iCAAiC;AAExC,SAASC,gBAAgB,QAAQ,0BAA0B;AAE3D,OAAO,SAASC,WAAWC,OAA2B,EAAEC,iBAAqC;IACzF,OAAO,CAAC,GAAGC;QACP,MAAMC,aAAqC,IAAIC;QAC/C,MAAMC,MAAM,CAAC,GAAGC;YACZ,KAAK,MAAMC,qBAAqBD,mBAAoB;gBAChDH,WAAWE,GAAG,CAACE;YACnB;QACJ;QAEA,MAAM,EAAEC,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAEC,OAAO,EAAE,GAAGX;QAElDK,IAAIX,SAASO;QAEb,IAAID,QAAQY,QAAQ,KAAK,MAAM;YAC3BP,IAAIZ,WAAWQ;QACnB;QAEA,IAAIO,QAAQH,IAAIP,iBAAiBE,SAASC;QAE1C,IAAIQ,WAAWJ,IAAIR,UAAUY,WAAWR;QACxC,IAAIS,WAAWL,IAAIT,UAAUc,WAAWT;QACxC,IAAIU,SAASN,IAAIV,QAAQgB,SAASE,WAAWZ;QAE7C,KAAK,MAAMM,qBAAqB;eAAIJ;SAAW,CAAE;YAC7CI,qBAAqBL;QACzB;IACJ;AACJ"}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vnodes/prop",
|
|
3
|
+
"version": "0.0.23",
|
|
4
|
+
"description": "@vnodes/prop",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"prop"
|
|
7
|
+
],
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Robert Brightline",
|
|
10
|
+
"email": "robert.brightline+vnodes-prop@gmail.com",
|
|
11
|
+
"url": "https://vnodes.github.io/vnodes"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://vnodes.github.io/vnodes/libs/prop",
|
|
14
|
+
"icon": "https://vnodes.github.io/vnodes/libs/prop/assets/favicon.png",
|
|
15
|
+
"funding": [
|
|
16
|
+
"https://cash.app/$puqlib"
|
|
17
|
+
],
|
|
18
|
+
"bin": {
|
|
19
|
+
"version": "./bin/version.mjs"
|
|
20
|
+
},
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"module": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
"./package.json": "./package.json",
|
|
27
|
+
".": {
|
|
28
|
+
"@vnodes/source": "./src/index.ts",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js",
|
|
31
|
+
"default": "./dist/index.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"bin",
|
|
37
|
+
"!**/*.tsbuildinfo"
|
|
38
|
+
],
|
|
39
|
+
"nx": {
|
|
40
|
+
"sourceRoot": "libs/prop/src",
|
|
41
|
+
"targets": {
|
|
42
|
+
"build": {},
|
|
43
|
+
"doc": {},
|
|
44
|
+
"lint": {}
|
|
45
|
+
},
|
|
46
|
+
"tags": [
|
|
47
|
+
"lib"
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@swc/helpers": "~0.5.18"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@vnodes/nestjs": "0.0.23",
|
|
55
|
+
"@vnodes/types": "0.0.23"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@vnodes/nestjs": "0.0.23",
|
|
59
|
+
"@vnodes/types": "0.0.23"
|
|
60
|
+
},
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public",
|
|
63
|
+
"tag": "latest"
|
|
64
|
+
}
|
|
65
|
+
}
|