@allgemein/schema-api 1.5.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/LICENSE +23 -0
- package/README.md +34 -0
- package/api/IBaseRef.d.ts +44 -0
- package/api/IBaseRef.js +4 -0
- package/api/IBaseRef.js.map +1 -0
- package/api/IBuildOptions.d.ts +31 -0
- package/api/IBuildOptions.js +4 -0
- package/api/IBuildOptions.js.map +1 -0
- package/api/IClassRef.d.ts +24 -0
- package/api/IClassRef.js +13 -0
- package/api/IClassRef.js.map +1 -0
- package/api/IEntityRef.d.ts +16 -0
- package/api/IEntityRef.js +11 -0
- package/api/IEntityRef.js.map +1 -0
- package/api/IJsonSchema.d.ts +11 -0
- package/api/IJsonSchema.js +26 -0
- package/api/IJsonSchema.js.map +1 -0
- package/api/ILookupRegistry.d.ts +60 -0
- package/api/ILookupRegistry.js +17 -0
- package/api/ILookupRegistry.js.map +1 -0
- package/api/IPropertyExtentions.d.ts +8 -0
- package/api/IPropertyExtentions.js +5 -0
- package/api/IPropertyExtentions.js.map +1 -0
- package/api/IPropertyRef.d.ts +28 -0
- package/api/IPropertyRef.js +13 -0
- package/api/IPropertyRef.js.map +1 -0
- package/api/ISchemaRef.d.ts +8 -0
- package/api/ISchemaRef.js +4 -0
- package/api/ISchemaRef.js.map +1 -0
- package/api/ISerializeSupport.d.ts +11 -0
- package/api/ISerializeSupport.js +26 -0
- package/api/ISerializeSupport.js.map +1 -0
- package/browser.d.ts +62 -0
- package/browser.js +117 -0
- package/browser.js.map +1 -0
- package/decorators/Embeddable.d.ts +2 -0
- package/decorators/Embeddable.js +14 -0
- package/decorators/Embeddable.js.map +1 -0
- package/decorators/Entity.d.ts +2 -0
- package/decorators/Entity.js +14 -0
- package/decorators/Entity.js.map +1 -0
- package/decorators/Namespace.d.ts +1 -0
- package/decorators/Namespace.js +20 -0
- package/decorators/Namespace.js.map +1 -0
- package/decorators/Property.d.ts +3 -0
- package/decorators/Property.js +59 -0
- package/decorators/Property.js.map +1 -0
- package/decorators/PropertyOf.d.ts +2 -0
- package/decorators/PropertyOf.js +28 -0
- package/decorators/PropertyOf.js.map +1 -0
- package/decorators/Schema.d.ts +2 -0
- package/decorators/Schema.js +14 -0
- package/decorators/Schema.js.map +1 -0
- package/decorators/validate/Hostname.d.ts +6 -0
- package/decorators/validate/Hostname.js +38 -0
- package/decorators/validate/Hostname.js.map +1 -0
- package/decorators/validate/Ip4.d.ts +6 -0
- package/decorators/validate/Ip4.js +37 -0
- package/decorators/validate/Ip4.js.map +1 -0
- package/decorators/validate/Ip6.d.ts +5 -0
- package/decorators/validate/Ip6.js +37 -0
- package/decorators/validate/Ip6.js.map +1 -0
- package/decorators/validate/IsEmail.d.ts +5 -0
- package/decorators/validate/IsEmail.js +37 -0
- package/decorators/validate/IsEmail.js.map +1 -0
- package/decorators/validate/IsNotEmpty.d.ts +5 -0
- package/decorators/validate/IsNotEmpty.js +36 -0
- package/decorators/validate/IsNotEmpty.js.map +1 -0
- package/decorators/validate/MaxLength.d.ts +6 -0
- package/decorators/validate/MaxLength.js +34 -0
- package/decorators/validate/MaxLength.js.map +1 -0
- package/decorators/validate/MinLength.d.ts +6 -0
- package/decorators/validate/MinLength.js +34 -0
- package/decorators/validate/MinLength.js.map +1 -0
- package/decorators/validate/Regex.d.ts +7 -0
- package/decorators/validate/Regex.js +46 -0
- package/decorators/validate/Regex.js.map +1 -0
- package/decorators/validate/Required.d.ts +5 -0
- package/decorators/validate/Required.js +34 -0
- package/decorators/validate/Required.js.map +1 -0
- package/decorators/validate/index.d.ts +9 -0
- package/decorators/validate/index.js +21 -0
- package/decorators/validate/index.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +15 -0
- package/index.js.map +1 -0
- package/lib/AbstractRef.d.ts +26 -0
- package/lib/AbstractRef.js +126 -0
- package/lib/AbstractRef.js.map +1 -0
- package/lib/AnnotationsHelper.d.ts +7 -0
- package/lib/AnnotationsHelper.js +97 -0
- package/lib/AnnotationsHelper.js.map +1 -0
- package/lib/ClassRef.d.ts +120 -0
- package/lib/ClassRef.js +319 -0
- package/lib/ClassRef.js.map +1 -0
- package/lib/Constants.d.ts +45 -0
- package/lib/Constants.js +65 -0
- package/lib/Constants.js.map +1 -0
- package/lib/DataContainer.d.ts +31 -0
- package/lib/DataContainer.js +148 -0
- package/lib/DataContainer.js.map +1 -0
- package/lib/LookupRegistry.d.ts +36 -0
- package/lib/LookupRegistry.js +106 -0
- package/lib/LookupRegistry.js.map +1 -0
- package/lib/SchemaRef.d.ts +14 -0
- package/lib/SchemaRef.js +51 -0
- package/lib/SchemaRef.js.map +1 -0
- package/lib/SchemaUtils.d.ts +39 -0
- package/lib/SchemaUtils.js +129 -0
- package/lib/SchemaUtils.js.map +1 -0
- package/lib/json-schema/Constants.d.ts +2 -0
- package/lib/json-schema/Constants.js +7 -0
- package/lib/json-schema/Constants.js.map +1 -0
- package/lib/json-schema/IJsonSchemaSerializeOptions.d.ts +40 -0
- package/lib/json-schema/IJsonSchemaSerializeOptions.js +4 -0
- package/lib/json-schema/IJsonSchemaSerializeOptions.js.map +1 -0
- package/lib/json-schema/IJsonSchemaSerializer.d.ts +7 -0
- package/lib/json-schema/IJsonSchemaSerializer.js +4 -0
- package/lib/json-schema/IJsonSchemaSerializer.js.map +1 -0
- package/lib/json-schema/IJsonSchemaUnserializeOptions.d.ts +41 -0
- package/lib/json-schema/IJsonSchemaUnserializeOptions.js +4 -0
- package/lib/json-schema/IJsonSchemaUnserializeOptions.js.map +1 -0
- package/lib/json-schema/IJsonSchemaUnserializer.d.ts +5 -0
- package/lib/json-schema/IJsonSchemaUnserializer.js +4 -0
- package/lib/json-schema/IJsonSchemaUnserializer.js.map +1 -0
- package/lib/json-schema/IParseOptions.d.ts +16 -0
- package/lib/json-schema/IParseOptions.js +6 -0
- package/lib/json-schema/IParseOptions.js.map +1 -0
- package/lib/json-schema/JsonSchema.d.ts +22 -0
- package/lib/json-schema/JsonSchema.js +109 -0
- package/lib/json-schema/JsonSchema.js.map +1 -0
- package/lib/json-schema/JsonSchema7.d.ts +16 -0
- package/lib/json-schema/JsonSchema7.js +22 -0
- package/lib/json-schema/JsonSchema7.js.map +1 -0
- package/lib/json-schema/JsonSchema7Serializer.d.ts +42 -0
- package/lib/json-schema/JsonSchema7Serializer.js +438 -0
- package/lib/json-schema/JsonSchema7Serializer.js.map +1 -0
- package/lib/json-schema/JsonSchema7Unserializer.d.ts +60 -0
- package/lib/json-schema/JsonSchema7Unserializer.js +499 -0
- package/lib/json-schema/JsonSchema7Unserializer.js.map +1 -0
- package/lib/options/IAbstractOptions.d.ts +19 -0
- package/lib/options/IAbstractOptions.js +4 -0
- package/lib/options/IAbstractOptions.js.map +1 -0
- package/lib/options/IAttributeOptions.d.ts +7 -0
- package/lib/options/IAttributeOptions.js +4 -0
- package/lib/options/IAttributeOptions.js.map +1 -0
- package/lib/options/IEntityOptions.d.ts +4 -0
- package/lib/options/IEntityOptions.js +4 -0
- package/lib/options/IEntityOptions.js.map +1 -0
- package/lib/options/IObjectOptions.d.ts +4 -0
- package/lib/options/IObjectOptions.js +4 -0
- package/lib/options/IObjectOptions.js.map +1 -0
- package/lib/options/IPropertyOptions.d.ts +24 -0
- package/lib/options/IPropertyOptions.js +4 -0
- package/lib/options/IPropertyOptions.js.map +1 -0
- package/lib/options/ISchemaOptions.d.ts +4 -0
- package/lib/options/ISchemaOptions.js +4 -0
- package/lib/options/ISchemaOptions.js.map +1 -0
- package/lib/registry/AbstractRegistry.d.ts +91 -0
- package/lib/registry/AbstractRegistry.js +135 -0
- package/lib/registry/AbstractRegistry.js.map +1 -0
- package/lib/registry/Binding.d.ts +9 -0
- package/lib/registry/Binding.js +17 -0
- package/lib/registry/Binding.js.map +1 -0
- package/lib/registry/DefaultEntityRef.d.ts +30 -0
- package/lib/registry/DefaultEntityRef.js +60 -0
- package/lib/registry/DefaultEntityRef.js.map +1 -0
- package/lib/registry/DefaultNamespacedRegistry.d.ts +153 -0
- package/lib/registry/DefaultNamespacedRegistry.js +511 -0
- package/lib/registry/DefaultNamespacedRegistry.js.map +1 -0
- package/lib/registry/DefaultPropertyRef.d.ts +44 -0
- package/lib/registry/DefaultPropertyRef.js +175 -0
- package/lib/registry/DefaultPropertyRef.js.map +1 -0
- package/lib/registry/MetadataRegistry.d.ts +52 -0
- package/lib/registry/MetadataRegistry.js +186 -0
- package/lib/registry/MetadataRegistry.js.map +1 -0
- package/lib/registry/RegistryFactory.d.ts +43 -0
- package/lib/registry/RegistryFactory.js +109 -0
- package/lib/registry/RegistryFactory.js.map +1 -0
- package/lib/serializer/ISerializeOptions.d.ts +10 -0
- package/lib/serializer/ISerializeOptions.js +4 -0
- package/lib/serializer/ISerializeOptions.js.map +1 -0
- package/lib/serializer/ISerializer.d.ts +5 -0
- package/lib/serializer/ISerializer.js +4 -0
- package/lib/serializer/ISerializer.js.map +1 -0
- package/lib/serializer/ISerializerFactory.d.ts +13 -0
- package/lib/serializer/ISerializerFactory.js +4 -0
- package/lib/serializer/ISerializerFactory.js.map +1 -0
- package/lib/serializer/IUnserializeOptions.d.ts +14 -0
- package/lib/serializer/IUnserializeOptions.js +4 -0
- package/lib/serializer/IUnserializeOptions.js.map +1 -0
- package/lib/serializer/IUnserializer.d.ts +5 -0
- package/lib/serializer/IUnserializer.js +4 -0
- package/lib/serializer/IUnserializer.js.map +1 -0
- package/lib/serializer/SerializerRegistry.d.ts +8 -0
- package/lib/serializer/SerializerRegistry.js +20 -0
- package/lib/serializer/SerializerRegistry.js.map +1 -0
- package/lib/validation/DefaultValidator.d.ts +14 -0
- package/lib/validation/DefaultValidator.js +221 -0
- package/lib/validation/DefaultValidator.js.map +1 -0
- package/lib/validation/IValidateOptions.d.ts +4 -0
- package/lib/validation/IValidateOptions.js +4 -0
- package/lib/validation/IValidateOptions.js.map +1 -0
- package/lib/validation/IValidationError.d.ts +10 -0
- package/lib/validation/IValidationError.js +4 -0
- package/lib/validation/IValidationError.js.map +1 -0
- package/lib/validation/IValidationMessage.d.ts +4 -0
- package/lib/validation/IValidationMessage.js +4 -0
- package/lib/validation/IValidationMessage.js.map +1 -0
- package/lib/validation/IValidationOptions.d.ts +1 -0
- package/lib/validation/IValidationOptions.js +30 -0
- package/lib/validation/IValidationOptions.js.map +1 -0
- package/lib/validation/IValidationResult.d.ts +7 -0
- package/lib/validation/IValidationResult.js +4 -0
- package/lib/validation/IValidationResult.js.map +1 -0
- package/lib/validation/IValidator.d.ts +9 -0
- package/lib/validation/IValidator.js +4 -0
- package/lib/validation/IValidator.js.map +1 -0
- package/lib/validation/IValidatorEntry.d.ts +7 -0
- package/lib/validation/IValidatorEntry.js +4 -0
- package/lib/validation/IValidatorEntry.js.map +1 -0
- package/lib/validation/IValidatorHandle.d.ts +2 -0
- package/lib/validation/IValidatorHandle.js +4 -0
- package/lib/validation/IValidatorHandle.js.map +1 -0
- package/lib/validation/Validator.d.ts +17 -0
- package/lib/validation/Validator.js +54 -0
- package/lib/validation/Validator.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/validation/Validator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAA+B;AAI/B,yDAAoD;AAOpD;;GAEG;AACH,MAAa,SAAS;IAUpB,MAAM,CAAC,GAAG,CAAC,EAAqB,EAAE,MAA8B;QAC9D,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;IAED,MAAM,CAAC,KAAK;QACV,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;IACjB,CAAC;IAED,MAAM,CAAO,oBAAoB,CAAC,EAAqC;;YACrE,IAAI,gBAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBACtB,OAAO,EAAE,CAAC;aACX;YACD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YAC1D,OAAO,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QAC5B,CAAC;KAAA;IAED,MAAM,CAAO,QAAQ,CAAC,QAAa,EAAE,GAA4B;;YAC/D,IAAI,gBAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;gBACpB,OAAO,EAAE,CAAC;aACX;YACD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;YACnE,OAAO,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QAC5B,CAAC;KAAA;;AAlCH,8BAmCC;AAjCgB,YAAE,GAAwB;IACvC,mCAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,mCAAgB,CAAC;CACjD,CAAC;AAEa,cAAI,GAA6B;IAC9C,mCAAgB,CAAC,cAAc,CAAC,IAAI,CAAC,mCAAgB,CAAC;CACvD,CAAC","file":"Validator.js","sourcesContent":["import {isEmpty} from 'lodash';\nimport {IValidationError} from './IValidationError';\nimport {IClassRef} from '../../api/IClassRef';\nimport {IEntityRef} from '../../api/IEntityRef';\nimport {DefaultValidator} from './DefaultValidator';\nimport {IValidatorEntry} from './IValidatorEntry';\n\n\nexport type validate_function = (instance: any, ref?: IClassRef | IEntityRef) => Promise<IValidationError[]>;\nexport type validate_info_function = (ref?: Function | IClassRef | IEntityRef) => Promise<IValidatorEntry[]>;\n\n/**\n * Abstraction for defualt validator functions\n */\nexport class Validator {\n\n private static fn: validate_function[] = [\n DefaultValidator.validate.bind(DefaultValidator)\n ];\n\n private static info: validate_info_function[] = [\n DefaultValidator.validationInfo.bind(DefaultValidator)\n ];\n\n static add(fn: validate_function, fnInfo: validate_info_function) {\n this.fn.push(fn);\n this.info.push(fnInfo);\n }\n\n static reset() {\n this.fn = [];\n this.info = [];\n }\n\n static async getValidationEntries(fn: Function | IClassRef | IEntityRef) {\n if (isEmpty(this.info)) {\n return [];\n }\n const data = await Promise.all(this.info.map(x => x(fn)));\n return [].concat(...data);\n }\n\n static async validate(instance: any, ref?: IClassRef | IEntityRef): Promise<IValidationError[]> {\n if (isEmpty(this.fn)) {\n return [];\n }\n const data = await Promise.all(this.fn.map(x => x(instance, ref)));\n return [].concat(...data);\n }\n}\n"],"sourceRoot":"../.."}
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@allgemein/schema-api",
|
|
3
|
+
"version": "1.5.0",
|
|
4
|
+
"description": "Library for schema api",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"private": false,
|
|
7
|
+
"browser": {
|
|
8
|
+
"./index.js": "./browser.js"
|
|
9
|
+
},
|
|
10
|
+
"directories": {
|
|
11
|
+
"doc": "docs/de"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"test": "nyc mocha test/functional/*.spec.ts",
|
|
15
|
+
"posttest": "nyc report --reporter=json && codecov -f coverage/*.json"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/allgemein-node/schema-api.git"
|
|
20
|
+
},
|
|
21
|
+
"author": "Robert Kania",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"keywords": [
|
|
24
|
+
"commons",
|
|
25
|
+
"allgemein",
|
|
26
|
+
"json-schema",
|
|
27
|
+
"typescript",
|
|
28
|
+
"schema",
|
|
29
|
+
"api"
|
|
30
|
+
],
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/allgemein-node/schema-api/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/allgemein-node/schema-api#readme",
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@allgemein/packaging": "^1.1.1",
|
|
37
|
+
"@testdeck/mocha": "^0.1.2",
|
|
38
|
+
"@types/chai": "^4.2.18",
|
|
39
|
+
"@types/glob": "^7.1.3",
|
|
40
|
+
"@types/json-schema": "^7.0.7",
|
|
41
|
+
"@types/lodash": "^4.14.170",
|
|
42
|
+
"@types/mocha": "^8.2.2",
|
|
43
|
+
"@types/node": "^15.6.1",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^4.26.1",
|
|
45
|
+
"@typescript-eslint/parser": "^4.26.1",
|
|
46
|
+
"chai": "^4.3.4",
|
|
47
|
+
"codecov": "^3.8.2",
|
|
48
|
+
"codelyzer": "^6.0.2",
|
|
49
|
+
"del": "6.0.0",
|
|
50
|
+
"eslint": "^7.28.0",
|
|
51
|
+
"eslint-plugin-import": "^2.23.4",
|
|
52
|
+
"got": "^11.8.2",
|
|
53
|
+
"gulp": "4.0.2",
|
|
54
|
+
"gulp-bump": "^3.2.0",
|
|
55
|
+
"gulp-clean": "^0.4.0",
|
|
56
|
+
"gulp-replace": "^1.1.3",
|
|
57
|
+
"gulp-shell": "0.8.0",
|
|
58
|
+
"gulp-sourcemaps": "3.0.0",
|
|
59
|
+
"gulp-typescript": "5.0.1",
|
|
60
|
+
"merge-stream": "^2.0.0",
|
|
61
|
+
"mocha": "^8.4.0",
|
|
62
|
+
"nyc": "^15.1.0",
|
|
63
|
+
"reflect-metadata": "^0.1.13",
|
|
64
|
+
"ts-node": "^10.0.0",
|
|
65
|
+
"typescript": "4.3.2"
|
|
66
|
+
},
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"@allgemein/base": "^1.5.6"
|
|
69
|
+
},
|
|
70
|
+
"peerDependencies": {
|
|
71
|
+
"reflect-metadata": "^0.1.13"
|
|
72
|
+
}
|
|
73
|
+
}
|