@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.
Files changed (228) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +34 -0
  3. package/api/IBaseRef.d.ts +44 -0
  4. package/api/IBaseRef.js +4 -0
  5. package/api/IBaseRef.js.map +1 -0
  6. package/api/IBuildOptions.d.ts +31 -0
  7. package/api/IBuildOptions.js +4 -0
  8. package/api/IBuildOptions.js.map +1 -0
  9. package/api/IClassRef.d.ts +24 -0
  10. package/api/IClassRef.js +13 -0
  11. package/api/IClassRef.js.map +1 -0
  12. package/api/IEntityRef.d.ts +16 -0
  13. package/api/IEntityRef.js +11 -0
  14. package/api/IEntityRef.js.map +1 -0
  15. package/api/IJsonSchema.d.ts +11 -0
  16. package/api/IJsonSchema.js +26 -0
  17. package/api/IJsonSchema.js.map +1 -0
  18. package/api/ILookupRegistry.d.ts +60 -0
  19. package/api/ILookupRegistry.js +17 -0
  20. package/api/ILookupRegistry.js.map +1 -0
  21. package/api/IPropertyExtentions.d.ts +8 -0
  22. package/api/IPropertyExtentions.js +5 -0
  23. package/api/IPropertyExtentions.js.map +1 -0
  24. package/api/IPropertyRef.d.ts +28 -0
  25. package/api/IPropertyRef.js +13 -0
  26. package/api/IPropertyRef.js.map +1 -0
  27. package/api/ISchemaRef.d.ts +8 -0
  28. package/api/ISchemaRef.js +4 -0
  29. package/api/ISchemaRef.js.map +1 -0
  30. package/api/ISerializeSupport.d.ts +11 -0
  31. package/api/ISerializeSupport.js +26 -0
  32. package/api/ISerializeSupport.js.map +1 -0
  33. package/browser.d.ts +62 -0
  34. package/browser.js +117 -0
  35. package/browser.js.map +1 -0
  36. package/decorators/Embeddable.d.ts +2 -0
  37. package/decorators/Embeddable.js +14 -0
  38. package/decorators/Embeddable.js.map +1 -0
  39. package/decorators/Entity.d.ts +2 -0
  40. package/decorators/Entity.js +14 -0
  41. package/decorators/Entity.js.map +1 -0
  42. package/decorators/Namespace.d.ts +1 -0
  43. package/decorators/Namespace.js +20 -0
  44. package/decorators/Namespace.js.map +1 -0
  45. package/decorators/Property.d.ts +3 -0
  46. package/decorators/Property.js +59 -0
  47. package/decorators/Property.js.map +1 -0
  48. package/decorators/PropertyOf.d.ts +2 -0
  49. package/decorators/PropertyOf.js +28 -0
  50. package/decorators/PropertyOf.js.map +1 -0
  51. package/decorators/Schema.d.ts +2 -0
  52. package/decorators/Schema.js +14 -0
  53. package/decorators/Schema.js.map +1 -0
  54. package/decorators/validate/Hostname.d.ts +6 -0
  55. package/decorators/validate/Hostname.js +38 -0
  56. package/decorators/validate/Hostname.js.map +1 -0
  57. package/decorators/validate/Ip4.d.ts +6 -0
  58. package/decorators/validate/Ip4.js +37 -0
  59. package/decorators/validate/Ip4.js.map +1 -0
  60. package/decorators/validate/Ip6.d.ts +5 -0
  61. package/decorators/validate/Ip6.js +37 -0
  62. package/decorators/validate/Ip6.js.map +1 -0
  63. package/decorators/validate/IsEmail.d.ts +5 -0
  64. package/decorators/validate/IsEmail.js +37 -0
  65. package/decorators/validate/IsEmail.js.map +1 -0
  66. package/decorators/validate/IsNotEmpty.d.ts +5 -0
  67. package/decorators/validate/IsNotEmpty.js +36 -0
  68. package/decorators/validate/IsNotEmpty.js.map +1 -0
  69. package/decorators/validate/MaxLength.d.ts +6 -0
  70. package/decorators/validate/MaxLength.js +34 -0
  71. package/decorators/validate/MaxLength.js.map +1 -0
  72. package/decorators/validate/MinLength.d.ts +6 -0
  73. package/decorators/validate/MinLength.js +34 -0
  74. package/decorators/validate/MinLength.js.map +1 -0
  75. package/decorators/validate/Regex.d.ts +7 -0
  76. package/decorators/validate/Regex.js +46 -0
  77. package/decorators/validate/Regex.js.map +1 -0
  78. package/decorators/validate/Required.d.ts +5 -0
  79. package/decorators/validate/Required.js +34 -0
  80. package/decorators/validate/Required.js.map +1 -0
  81. package/decorators/validate/index.d.ts +9 -0
  82. package/decorators/validate/index.js +21 -0
  83. package/decorators/validate/index.js.map +1 -0
  84. package/index.d.ts +1 -0
  85. package/index.js +15 -0
  86. package/index.js.map +1 -0
  87. package/lib/AbstractRef.d.ts +26 -0
  88. package/lib/AbstractRef.js +126 -0
  89. package/lib/AbstractRef.js.map +1 -0
  90. package/lib/AnnotationsHelper.d.ts +7 -0
  91. package/lib/AnnotationsHelper.js +97 -0
  92. package/lib/AnnotationsHelper.js.map +1 -0
  93. package/lib/ClassRef.d.ts +120 -0
  94. package/lib/ClassRef.js +319 -0
  95. package/lib/ClassRef.js.map +1 -0
  96. package/lib/Constants.d.ts +45 -0
  97. package/lib/Constants.js +65 -0
  98. package/lib/Constants.js.map +1 -0
  99. package/lib/DataContainer.d.ts +31 -0
  100. package/lib/DataContainer.js +148 -0
  101. package/lib/DataContainer.js.map +1 -0
  102. package/lib/LookupRegistry.d.ts +36 -0
  103. package/lib/LookupRegistry.js +106 -0
  104. package/lib/LookupRegistry.js.map +1 -0
  105. package/lib/SchemaRef.d.ts +14 -0
  106. package/lib/SchemaRef.js +51 -0
  107. package/lib/SchemaRef.js.map +1 -0
  108. package/lib/SchemaUtils.d.ts +39 -0
  109. package/lib/SchemaUtils.js +129 -0
  110. package/lib/SchemaUtils.js.map +1 -0
  111. package/lib/json-schema/Constants.d.ts +2 -0
  112. package/lib/json-schema/Constants.js +7 -0
  113. package/lib/json-schema/Constants.js.map +1 -0
  114. package/lib/json-schema/IJsonSchemaSerializeOptions.d.ts +40 -0
  115. package/lib/json-schema/IJsonSchemaSerializeOptions.js +4 -0
  116. package/lib/json-schema/IJsonSchemaSerializeOptions.js.map +1 -0
  117. package/lib/json-schema/IJsonSchemaSerializer.d.ts +7 -0
  118. package/lib/json-schema/IJsonSchemaSerializer.js +4 -0
  119. package/lib/json-schema/IJsonSchemaSerializer.js.map +1 -0
  120. package/lib/json-schema/IJsonSchemaUnserializeOptions.d.ts +41 -0
  121. package/lib/json-schema/IJsonSchemaUnserializeOptions.js +4 -0
  122. package/lib/json-schema/IJsonSchemaUnserializeOptions.js.map +1 -0
  123. package/lib/json-schema/IJsonSchemaUnserializer.d.ts +5 -0
  124. package/lib/json-schema/IJsonSchemaUnserializer.js +4 -0
  125. package/lib/json-schema/IJsonSchemaUnserializer.js.map +1 -0
  126. package/lib/json-schema/IParseOptions.d.ts +16 -0
  127. package/lib/json-schema/IParseOptions.js +6 -0
  128. package/lib/json-schema/IParseOptions.js.map +1 -0
  129. package/lib/json-schema/JsonSchema.d.ts +22 -0
  130. package/lib/json-schema/JsonSchema.js +109 -0
  131. package/lib/json-schema/JsonSchema.js.map +1 -0
  132. package/lib/json-schema/JsonSchema7.d.ts +16 -0
  133. package/lib/json-schema/JsonSchema7.js +22 -0
  134. package/lib/json-schema/JsonSchema7.js.map +1 -0
  135. package/lib/json-schema/JsonSchema7Serializer.d.ts +42 -0
  136. package/lib/json-schema/JsonSchema7Serializer.js +438 -0
  137. package/lib/json-schema/JsonSchema7Serializer.js.map +1 -0
  138. package/lib/json-schema/JsonSchema7Unserializer.d.ts +60 -0
  139. package/lib/json-schema/JsonSchema7Unserializer.js +499 -0
  140. package/lib/json-schema/JsonSchema7Unserializer.js.map +1 -0
  141. package/lib/options/IAbstractOptions.d.ts +19 -0
  142. package/lib/options/IAbstractOptions.js +4 -0
  143. package/lib/options/IAbstractOptions.js.map +1 -0
  144. package/lib/options/IAttributeOptions.d.ts +7 -0
  145. package/lib/options/IAttributeOptions.js +4 -0
  146. package/lib/options/IAttributeOptions.js.map +1 -0
  147. package/lib/options/IEntityOptions.d.ts +4 -0
  148. package/lib/options/IEntityOptions.js +4 -0
  149. package/lib/options/IEntityOptions.js.map +1 -0
  150. package/lib/options/IObjectOptions.d.ts +4 -0
  151. package/lib/options/IObjectOptions.js +4 -0
  152. package/lib/options/IObjectOptions.js.map +1 -0
  153. package/lib/options/IPropertyOptions.d.ts +24 -0
  154. package/lib/options/IPropertyOptions.js +4 -0
  155. package/lib/options/IPropertyOptions.js.map +1 -0
  156. package/lib/options/ISchemaOptions.d.ts +4 -0
  157. package/lib/options/ISchemaOptions.js +4 -0
  158. package/lib/options/ISchemaOptions.js.map +1 -0
  159. package/lib/registry/AbstractRegistry.d.ts +91 -0
  160. package/lib/registry/AbstractRegistry.js +135 -0
  161. package/lib/registry/AbstractRegistry.js.map +1 -0
  162. package/lib/registry/Binding.d.ts +9 -0
  163. package/lib/registry/Binding.js +17 -0
  164. package/lib/registry/Binding.js.map +1 -0
  165. package/lib/registry/DefaultEntityRef.d.ts +30 -0
  166. package/lib/registry/DefaultEntityRef.js +60 -0
  167. package/lib/registry/DefaultEntityRef.js.map +1 -0
  168. package/lib/registry/DefaultNamespacedRegistry.d.ts +153 -0
  169. package/lib/registry/DefaultNamespacedRegistry.js +511 -0
  170. package/lib/registry/DefaultNamespacedRegistry.js.map +1 -0
  171. package/lib/registry/DefaultPropertyRef.d.ts +44 -0
  172. package/lib/registry/DefaultPropertyRef.js +175 -0
  173. package/lib/registry/DefaultPropertyRef.js.map +1 -0
  174. package/lib/registry/MetadataRegistry.d.ts +52 -0
  175. package/lib/registry/MetadataRegistry.js +186 -0
  176. package/lib/registry/MetadataRegistry.js.map +1 -0
  177. package/lib/registry/RegistryFactory.d.ts +43 -0
  178. package/lib/registry/RegistryFactory.js +109 -0
  179. package/lib/registry/RegistryFactory.js.map +1 -0
  180. package/lib/serializer/ISerializeOptions.d.ts +10 -0
  181. package/lib/serializer/ISerializeOptions.js +4 -0
  182. package/lib/serializer/ISerializeOptions.js.map +1 -0
  183. package/lib/serializer/ISerializer.d.ts +5 -0
  184. package/lib/serializer/ISerializer.js +4 -0
  185. package/lib/serializer/ISerializer.js.map +1 -0
  186. package/lib/serializer/ISerializerFactory.d.ts +13 -0
  187. package/lib/serializer/ISerializerFactory.js +4 -0
  188. package/lib/serializer/ISerializerFactory.js.map +1 -0
  189. package/lib/serializer/IUnserializeOptions.d.ts +14 -0
  190. package/lib/serializer/IUnserializeOptions.js +4 -0
  191. package/lib/serializer/IUnserializeOptions.js.map +1 -0
  192. package/lib/serializer/IUnserializer.d.ts +5 -0
  193. package/lib/serializer/IUnserializer.js +4 -0
  194. package/lib/serializer/IUnserializer.js.map +1 -0
  195. package/lib/serializer/SerializerRegistry.d.ts +8 -0
  196. package/lib/serializer/SerializerRegistry.js +20 -0
  197. package/lib/serializer/SerializerRegistry.js.map +1 -0
  198. package/lib/validation/DefaultValidator.d.ts +14 -0
  199. package/lib/validation/DefaultValidator.js +221 -0
  200. package/lib/validation/DefaultValidator.js.map +1 -0
  201. package/lib/validation/IValidateOptions.d.ts +4 -0
  202. package/lib/validation/IValidateOptions.js +4 -0
  203. package/lib/validation/IValidateOptions.js.map +1 -0
  204. package/lib/validation/IValidationError.d.ts +10 -0
  205. package/lib/validation/IValidationError.js +4 -0
  206. package/lib/validation/IValidationError.js.map +1 -0
  207. package/lib/validation/IValidationMessage.d.ts +4 -0
  208. package/lib/validation/IValidationMessage.js +4 -0
  209. package/lib/validation/IValidationMessage.js.map +1 -0
  210. package/lib/validation/IValidationOptions.d.ts +1 -0
  211. package/lib/validation/IValidationOptions.js +30 -0
  212. package/lib/validation/IValidationOptions.js.map +1 -0
  213. package/lib/validation/IValidationResult.d.ts +7 -0
  214. package/lib/validation/IValidationResult.js +4 -0
  215. package/lib/validation/IValidationResult.js.map +1 -0
  216. package/lib/validation/IValidator.d.ts +9 -0
  217. package/lib/validation/IValidator.js +4 -0
  218. package/lib/validation/IValidator.js.map +1 -0
  219. package/lib/validation/IValidatorEntry.d.ts +7 -0
  220. package/lib/validation/IValidatorEntry.js +4 -0
  221. package/lib/validation/IValidatorEntry.js.map +1 -0
  222. package/lib/validation/IValidatorHandle.d.ts +2 -0
  223. package/lib/validation/IValidatorHandle.js +4 -0
  224. package/lib/validation/IValidatorHandle.js.map +1 -0
  225. package/lib/validation/Validator.d.ts +17 -0
  226. package/lib/validation/Validator.js +54 -0
  227. package/lib/validation/Validator.js.map +1 -0
  228. package/package.json +73 -0
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2019 Robert Kania
4
+
5
+ Permission is hereby granted, free of charge, to any person
6
+ obtaining a copy of this software and associated documentation
7
+ files (the "Software"), to deal in the Software without
8
+ restriction, including without limitation the rights to use,
9
+ copy, modify, merge, publish, distribute, sublicense, and/or
10
+ sell copies of the Software, and to permit persons to whom the
11
+ Software is furnished to do so, subject to the following
12
+ conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+
2
+ # @allgemein/schema-api
3
+
4
+ [![build>](https://circleci.com/gh/allgemein-node/schema-api.svg?style=shield)](https://app.circleci.com/pipelines/github/allgemein-node/schema-api)
5
+ [![codecov](https://codecov.io/gh/allgemein-node/schema-api/branch/master/graph/badge.svg)](https://codecov.io/gh/allgemein-node/schema-api)
6
+ [![Dependency Status](https://david-dm.org/allgemein-node/schema-api.svg)](https://david-dm.org/allgemein-node/schema-api)
7
+
8
+
9
+
10
+ With the decorators
11
+
12
+ @Entity
13
+
14
+ @Property
15
+
16
+ @PropertyOf
17
+
18
+ @Schema
19
+
20
+ @Object
21
+
22
+
23
+ can be used to define a instancable json schema.
24
+ This can be analysed and dynamically used to instance differetn kind of models.
25
+
26
+
27
+ Transformations:
28
+
29
+ internal runtime structure -> json schema
30
+ json schema -> internal runtime structure
31
+ annotation -> internal runtime structure
32
+ json schema -> generate classes ES6 + TS
33
+ generate classes ES6 + TS -> runtime loading
34
+ generate classes ES6 + TS -> json schema
@@ -0,0 +1,44 @@
1
+ import { METADATA_TYPE } from '../lib/Constants';
2
+ import { ILookupRegistry } from './ILookupRegistry';
3
+ export interface IBaseRef {
4
+ /**
5
+ * Original class name
6
+ */
7
+ name: string;
8
+ /**
9
+ * Name for backend system
10
+ */
11
+ storingName: string;
12
+ /**
13
+ * Name for processing and identifing
14
+ */
15
+ machineName: string;
16
+ /**
17
+ * meta data tpye
18
+ */
19
+ metaType: METADATA_TYPE;
20
+ /**
21
+ * Unique identifier
22
+ */
23
+ id(): string;
24
+ /**
25
+ * Return some options
26
+ */
27
+ getOptions(key?: string, defaultValue?: any): any;
28
+ /**
29
+ * Set some option
30
+ */
31
+ setOption(key: string, value: any): void;
32
+ /**
33
+ * Set options
34
+ */
35
+ setOptions(value: any): void;
36
+ /**
37
+ * Return the namespace name.
38
+ */
39
+ getNamespace(): string;
40
+ /**
41
+ * Return the registry.
42
+ */
43
+ getRegistry?(): ILookupRegistry;
44
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+
4
+ //# sourceMappingURL=IBaseRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/api/IBaseRef.ts"],"names":[],"mappings":"","file":"IBaseRef.js","sourcesContent":["import {METADATA_TYPE} from '../lib/Constants';\nimport {ILookupRegistry} from './ILookupRegistry';\n\n\nexport interface IBaseRef {\n\n /**\n * Original class name\n */\n name: string;\n\n /**\n * Name for backend system\n */\n storingName: string;\n\n /**\n * Name for processing and identifing\n */\n machineName: string;\n\n /**\n * meta data tpye\n */\n metaType: METADATA_TYPE;\n\n /**\n * Unique identifier\n */\n id(): string;\n\n\n /**\n * Return some options\n */\n getOptions(key?: string, defaultValue?: any): any;\n\n /**\n * Set some option\n */\n setOption(key: string, value: any): void;\n\n /**\n * Set options\n */\n setOptions(value: any): void;\n\n\n /**\n * Return the namespace name.\n */\n getNamespace(): string;\n\n /**\n * Return the registry.\n */\n getRegistry?(): ILookupRegistry;\n\n}\n"],"sourceRoot":".."}
@@ -0,0 +1,31 @@
1
+ import { IEntityRef } from "./IEntityRef";
2
+ import { IClassRef } from "./IClassRef";
3
+ /**
4
+ * Build options for generation of object instance
5
+ */
6
+ export interface IBuildOptions {
7
+ /**
8
+ * Do not add __CLASS__ and __NS__ in build
9
+ */
10
+ skipClassNamespaceInfo?: boolean;
11
+ /**
12
+ * If set only the object instance will be created and all object members will be copied
13
+ */
14
+ createAndCopy?: boolean;
15
+ /**
16
+ * Special callback for preprocessing
17
+ *
18
+ * @param entityRef
19
+ * @param from
20
+ * @param to
21
+ */
22
+ beforeBuild?: (entityRef: IEntityRef | IClassRef, from: any, to: any, options?: IBuildOptions) => void;
23
+ /**
24
+ * Special callback for postprocessing
25
+ *
26
+ * @param entityRef
27
+ * @param from
28
+ * @param to
29
+ */
30
+ afterBuild?: (entityRef: IEntityRef | IClassRef, from: any, to: any, options?: IBuildOptions) => void;
31
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+
4
+ //# sourceMappingURL=IBuildOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/api/IBuildOptions.ts"],"names":[],"mappings":"","file":"IBuildOptions.js","sourcesContent":["import {IEntityRef} from \"./IEntityRef\";\nimport {IClassRef} from \"./IClassRef\";\n\n/**\n * Build options for generation of object instance\n */\nexport interface IBuildOptions {\n\n\n /**\n * Do not add __CLASS__ and __NS__ in build\n */\n skipClassNamespaceInfo?: boolean;\n\n /**\n * If set only the object instance will be created and all object members will be copied\n */\n createAndCopy?: boolean;\n\n /**\n * Special callback for preprocessing\n *\n * @param entityRef\n * @param from\n * @param to\n */\n beforeBuild?: (entityRef: IEntityRef | IClassRef, from: any, to: any, options?: IBuildOptions) => void\n\n /**\n * Special callback for postprocessing\n *\n * @param entityRef\n * @param from\n * @param to\n */\n afterBuild?: (entityRef: IEntityRef | IClassRef, from: any, to: any, options?: IBuildOptions) => void\n}\n"],"sourceRoot":".."}
@@ -0,0 +1,24 @@
1
+ import { IPropertyRef } from './IPropertyRef';
2
+ import { IBuildOptions } from './IBuildOptions';
3
+ import { IBaseRef } from './IBaseRef';
4
+ import { ILookupRegistry } from './ILookupRegistry';
5
+ import { IEntityRef } from './IEntityRef';
6
+ export declare function isClassRef(x: any): x is IClassRef;
7
+ export interface IClassRef extends IBaseRef {
8
+ isPlaceholder(): boolean;
9
+ isAnonymous(): boolean;
10
+ getClass(create?: boolean): Function;
11
+ getPropertyRef(name: string): IPropertyRef;
12
+ getPropertyRefs(): IPropertyRef[];
13
+ getEntityRef(): IEntityRef;
14
+ hasEntityRef(): boolean;
15
+ create<T>(addinfo?: boolean): T;
16
+ build<T>(instance: any, options?: IBuildOptions): T;
17
+ getNamespace(): string;
18
+ switchNamespace(namespace: string): void;
19
+ getRegistry(): ILookupRegistry;
20
+ getExtend(): IClassRef;
21
+ getExtends(): IClassRef[];
22
+ addExtend(ref: IClassRef): IClassRef;
23
+ isOf(instance: any): boolean;
24
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isClassRef = void 0;
4
+ const Constants_1 = require("../lib/Constants");
5
+ function isClassRef(x) {
6
+ if (x !== undefined && x && x.metaType === Constants_1.METATYPE_CLASS_REF) {
7
+ return true;
8
+ }
9
+ return false;
10
+ }
11
+ exports.isClassRef = isClassRef;
12
+
13
+ //# sourceMappingURL=IClassRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/api/IClassRef.ts"],"names":[],"mappings":";;;AAIA,gDAAoD;AAIpD,SAAgB,UAAU,CAAC,CAAM;IAC/B,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAK,8BAAkB,EAAE;QAC7D,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AALD,gCAKC","file":"IClassRef.js","sourcesContent":["import {IPropertyRef} from './IPropertyRef';\nimport {IBuildOptions} from './IBuildOptions';\nimport {IBaseRef} from './IBaseRef';\nimport {ILookupRegistry} from './ILookupRegistry';\nimport {METATYPE_CLASS_REF} from '../lib/Constants';\nimport {IEntityRef} from './IEntityRef';\n\n\nexport function isClassRef(x: any): x is IClassRef {\n if (x !== undefined && x && x.metaType === METATYPE_CLASS_REF) {\n return true;\n }\n return false;\n}\n\n\nexport interface IClassRef extends IBaseRef {\n\n isPlaceholder(): boolean;\n\n isAnonymous(): boolean;\n\n getClass(create?: boolean): Function;\n\n getPropertyRef(name: string): IPropertyRef;\n\n getPropertyRefs(): IPropertyRef[];\n\n getEntityRef(): IEntityRef;\n\n hasEntityRef(): boolean;\n\n create<T>(addinfo?: boolean): T;\n\n build<T>(instance: any, options?: IBuildOptions): T;\n\n getNamespace(): string;\n\n switchNamespace(namespace: string): void;\n\n getRegistry(): ILookupRegistry;\n\n getExtend(): IClassRef;\n\n getExtends(): IClassRef[];\n\n addExtend(ref: IClassRef): IClassRef;\n\n isOf(instance: any): boolean;\n // toJson(withProperties?: boolean): IClassRefMetadata;\n\n}\n"],"sourceRoot":".."}
@@ -0,0 +1,16 @@
1
+ import { IPropertyRef } from './IPropertyRef';
2
+ import { IClassRef } from './IClassRef';
3
+ import { IBuildOptions } from './IBuildOptions';
4
+ import { IBaseRef } from './IBaseRef';
5
+ import { ISchemaRef } from './ISchemaRef';
6
+ export declare function isEntityRef(x: any): x is IEntityRef;
7
+ export interface IEntityRef extends IBaseRef {
8
+ getPropertyRef(name: string): IPropertyRef;
9
+ getPropertyRefs(): IPropertyRef[];
10
+ getSchemaRefs(): ISchemaRef | ISchemaRef[];
11
+ getClassRef(): IClassRef;
12
+ getClass(create?: boolean): Function;
13
+ create<T>(addinfo?: boolean): T;
14
+ build<T>(instance: any, options?: IBuildOptions): T;
15
+ isOf(instance: any): boolean;
16
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isEntityRef = void 0;
4
+ // import {IEntityRefMetadata} from "./metadata/IEntityRefMetadata";
5
+ function isEntityRef(x) {
6
+ var _a;
7
+ return ((_a = x) === null || _a === void 0 ? void 0 : _a.metaType) === 'entity';
8
+ }
9
+ exports.isEntityRef = isEntityRef;
10
+
11
+ //# sourceMappingURL=IEntityRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/api/IEntityRef.ts"],"names":[],"mappings":";;;AAMA,oEAAoE;AAIpE,SAAgB,WAAW,CAAC,CAAM;;IAChC,OAAO,CAAA,MAAC,CAAgB,0CAAE,QAAQ,MAAK,QAAQ,CAAC;AAClD,CAAC;AAFD,kCAEC","file":"IEntityRef.js","sourcesContent":["import {IPropertyRef} from './IPropertyRef';\nimport {IClassRef} from './IClassRef';\nimport {IBuildOptions} from './IBuildOptions';\nimport {IBaseRef} from './IBaseRef';\nimport {ISchemaRef} from './ISchemaRef';\n\n// import {IEntityRefMetadata} from \"./metadata/IEntityRefMetadata\";\n\n\n\nexport function isEntityRef(x: any): x is IEntityRef {\n return (x as IEntityRef)?.metaType === 'entity';\n}\n\nexport interface IEntityRef extends IBaseRef {\n\n\n getPropertyRef(name: string): IPropertyRef;\n\n getPropertyRefs(): IPropertyRef[];\n\n getSchemaRefs(): ISchemaRef | ISchemaRef[];\n\n getClassRef(): IClassRef;\n\n getClass(create?: boolean): Function;\n\n create<T>(addinfo?: boolean): T;\n\n build<T>(instance: any, options?: IBuildOptions): T;\n\n isOf(instance: any): boolean;\n\n // toJson(follow?:boolean): IEntityRefMetadata;\n\n}\n"],"sourceRoot":".."}
@@ -0,0 +1,11 @@
1
+ import { IJsonSchemaSerializeOptions } from '../lib/json-schema/IJsonSchemaSerializeOptions';
2
+ import { IClassRef } from './IClassRef';
3
+ import { IEntityRef } from './IEntityRef';
4
+ import { IJsonSchemaUnserializeOptions } from '../lib/json-schema/IJsonSchemaUnserializeOptions';
5
+ export declare function supportsJsonSchemaExport(x: any): x is IJsonSchema;
6
+ export declare function supportsJsonSchemaImport(x: any): x is IJsonSchema;
7
+ export declare function supportsJsonSchema(x: any): x is IJsonSchema;
8
+ export interface IJsonSchema {
9
+ toJsonSchema?(options?: IJsonSchemaSerializeOptions): Promise<any>;
10
+ fromJsonSchema?(data: any, options?: IJsonSchemaUnserializeOptions): Promise<IClassRef | IEntityRef | (IClassRef | IEntityRef)[]>;
11
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.supportsJsonSchema = exports.supportsJsonSchemaImport = exports.supportsJsonSchemaExport = void 0;
4
+ function supportsJsonSchemaExport(x) {
5
+ if (x.toJsonSchema) {
6
+ return true;
7
+ }
8
+ return false;
9
+ }
10
+ exports.supportsJsonSchemaExport = supportsJsonSchemaExport;
11
+ function supportsJsonSchemaImport(x) {
12
+ if (x.fromJsonSchema) {
13
+ return true;
14
+ }
15
+ return false;
16
+ }
17
+ exports.supportsJsonSchemaImport = supportsJsonSchemaImport;
18
+ function supportsJsonSchema(x) {
19
+ if (supportsJsonSchemaExport(x) && supportsJsonSchemaImport(x)) {
20
+ return true;
21
+ }
22
+ return false;
23
+ }
24
+ exports.supportsJsonSchema = supportsJsonSchema;
25
+
26
+ //# sourceMappingURL=IJsonSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/api/IJsonSchema.ts"],"names":[],"mappings":";;;AAMA,SAAgB,wBAAwB,CAAC,CAAM;IAC7C,IAAI,CAAC,CAAC,YAAY,EAAE;QAClB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AALD,4DAKC;AAED,SAAgB,wBAAwB,CAAC,CAAM;IAC7C,IAAI,CAAC,CAAC,cAAc,EAAE;QACpB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AALD,4DAKC;AAGD,SAAgB,kBAAkB,CAAC,CAAM;IACvC,IAAI,wBAAwB,CAAC,CAAC,CAAC,IAAI,wBAAwB,CAAC,CAAC,CAAC,EAAE;QAC9D,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AALD,gDAKC","file":"IJsonSchema.js","sourcesContent":["import {IJsonSchemaSerializeOptions} from '../lib/json-schema/IJsonSchemaSerializeOptions';\nimport {IClassRef} from './IClassRef';\nimport {IEntityRef} from './IEntityRef';\nimport {IJsonSchemaUnserializeOptions} from '../lib/json-schema/IJsonSchemaUnserializeOptions';\n\n\nexport function supportsJsonSchemaExport(x: any): x is IJsonSchema {\n if (x.toJsonSchema) {\n return true;\n }\n return false;\n}\n\nexport function supportsJsonSchemaImport(x: any): x is IJsonSchema {\n if (x.fromJsonSchema) {\n return true;\n }\n return false;\n}\n\n\nexport function supportsJsonSchema(x: any): x is IJsonSchema {\n if (supportsJsonSchemaExport(x) && supportsJsonSchemaImport(x)) {\n return true;\n }\n return false;\n}\n\n\nexport interface IJsonSchema {\n\n toJsonSchema?(options?: IJsonSchemaSerializeOptions): Promise<any>;\n\n fromJsonSchema?(data: any, options?: IJsonSchemaUnserializeOptions): Promise<IClassRef | IEntityRef | (IClassRef | IEntityRef)[]>;\n\n}\n"],"sourceRoot":".."}
@@ -0,0 +1,60 @@
1
+ import { IEntityRef } from './IEntityRef';
2
+ import { IPropertyRef } from './IPropertyRef';
3
+ import { LookupRegistry } from '../lib/LookupRegistry';
4
+ import { IClassRef } from './IClassRef';
5
+ import { ISchemaRef } from './ISchemaRef';
6
+ import { METADATA_TYPE } from '../lib/Constants';
7
+ export declare function isLookupRegistry(x: any): x is ILookupRegistry;
8
+ /**
9
+ *
10
+ */
11
+ export interface ILookupRegistry {
12
+ prepare?(): void;
13
+ reload?(): void;
14
+ getSchemaRefs<T extends ISchemaRef>(filter?: (x: ISchemaRef) => boolean): (T | ISchemaRef)[];
15
+ getSchemaRefsFor<T extends ISchemaRef>(fn: string): (T | ISchemaRef);
16
+ getSchemaRefsFor<T extends ISchemaRef>(fn: string | IEntityRef | IClassRef): T | ISchemaRef | (T | ISchemaRef)[];
17
+ getEntityRefFor<T extends IEntityRef>(fn: string | object | Function, skipNsCheck?: boolean): (T | IEntityRef);
18
+ getEntityRefs<T extends IEntityRef>(filter?: (x: IEntityRef) => boolean): (T | IEntityRef)[];
19
+ getPropertyRefsFor<T extends IPropertyRef>(fn: string | object | Function): (T | IPropertyRef)[];
20
+ getPropertyRef<T extends IPropertyRef>(ref: IClassRef | IEntityRef, name: string): (T | IPropertyRef);
21
+ getPropertyRefs<T extends IPropertyRef>(ref: IClassRef | IEntityRef): (T | IPropertyRef)[];
22
+ getLookupRegistry(): LookupRegistry;
23
+ list<X>(type: METADATA_TYPE, filter?: (x: any) => boolean): X[];
24
+ listEntities(filter?: (x: IEntityRef) => boolean): IEntityRef[];
25
+ listProperties(filter?: (x: IPropertyRef) => boolean): IPropertyRef[];
26
+ getClassRefFor(object: string | Function | IClassRef, type: METADATA_TYPE): IClassRef;
27
+ create<T>(context: string, options: any): T;
28
+ /**
29
+ * Add some entries of given context (mostly passing to same method of LookupRegistry)
30
+ *
31
+ * @param context
32
+ * @param entry
33
+ */
34
+ add<T>(context: string, entry: T): T;
35
+ /**
36
+ * Remove some entries of given context by search critieria (mostly passing to same method of LookupRegistry)
37
+ *
38
+ * @param context
39
+ * @param entry
40
+ */
41
+ remove<T>(context: string, search: any): T[];
42
+ /**
43
+ * Filter some entries of given context by search critieria (mostly passing to same method of LookupRegistry)
44
+ *
45
+ * @param context
46
+ * @param entry
47
+ */
48
+ filter<T>(context: string, search: any): T[];
49
+ /**
50
+ * Find some entries of given context by search critieria (mostly passing to same method of LookupRegistry)
51
+ *
52
+ * @param context
53
+ * @param entry
54
+ */
55
+ find<T>(context: string, search: any): T;
56
+ /**
57
+ * Reset registry data
58
+ */
59
+ reset(): void;
60
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isLookupRegistry = void 0;
4
+ const lodash_1 = require("lodash");
5
+ function isLookupRegistry(x) {
6
+ if (x !== undefined && x &&
7
+ lodash_1.isFunction(x['getLookupRegistry']) &&
8
+ lodash_1.isFunction(x['getEntityRefFor']) &&
9
+ lodash_1.isFunction(x['getPropertyRefs']) &&
10
+ lodash_1.isFunction(x['getEntities'])) {
11
+ return true;
12
+ }
13
+ return false;
14
+ }
15
+ exports.isLookupRegistry = isLookupRegistry;
16
+
17
+ //# sourceMappingURL=ILookupRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/api/ILookupRegistry.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AASlC,SAAgB,gBAAgB,CAAC,CAAM;IACrC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC;QACtB,mBAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC;QAClC,mBAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;QAChC,mBAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;QAChC,mBAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,EAC5B;QACA,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAVD,4CAUC","file":"ILookupRegistry.js","sourcesContent":["import {isFunction} from 'lodash';\nimport {IEntityRef} from './IEntityRef';\nimport {IPropertyRef} from './IPropertyRef';\nimport {LookupRegistry} from '../lib/LookupRegistry';\nimport {IClassRef} from './IClassRef';\nimport {ISchemaRef} from './ISchemaRef';\nimport {METADATA_TYPE} from '../lib/Constants';\n\n\nexport function isLookupRegistry(x: any): x is ILookupRegistry {\n if (x !== undefined && x &&\n isFunction(x['getLookupRegistry']) &&\n isFunction(x['getEntityRefFor']) &&\n isFunction(x['getPropertyRefs']) &&\n isFunction(x['getEntities'])\n ) {\n return true;\n }\n return false;\n}\n\n/**\n *\n */\nexport interface ILookupRegistry {\n\n prepare?(): void;\n\n reload?(): void;\n\n getSchemaRefs<T extends ISchemaRef>(filter?: (x: ISchemaRef) => boolean): (T | ISchemaRef)[];\n\n getSchemaRefsFor<T extends ISchemaRef>(fn: string): (T | ISchemaRef);\n\n getSchemaRefsFor<T extends ISchemaRef>(fn: string | IEntityRef | IClassRef): T | ISchemaRef | (T | ISchemaRef)[];\n\n getEntityRefFor<T extends IEntityRef>(fn: string | object | Function, skipNsCheck?: boolean): (T | IEntityRef);\n\n getEntityRefs<T extends IEntityRef>(filter?: (x: IEntityRef) => boolean): (T | IEntityRef)[];\n\n getPropertyRefsFor<T extends IPropertyRef>(fn: string | object | Function): (T | IPropertyRef)[];\n\n getPropertyRef<T extends IPropertyRef>(ref: IClassRef | IEntityRef, name: string): (T | IPropertyRef);\n\n getPropertyRefs<T extends IPropertyRef>(ref: IClassRef | IEntityRef): (T | IPropertyRef)[];\n\n getLookupRegistry(): LookupRegistry;\n\n list<X>(type: METADATA_TYPE, filter?: (x: any) => boolean): X[];\n\n listEntities(filter?: (x: IEntityRef) => boolean): IEntityRef[];\n\n\n listProperties(filter?: (x: IPropertyRef) => boolean): IPropertyRef[];\n\n getClassRefFor(object: string | Function | IClassRef, type: METADATA_TYPE): IClassRef;\n\n\n create<T>(context: string, options: any): T;\n\n /**\n * Add some entries of given context (mostly passing to same method of LookupRegistry)\n *\n * @param context\n * @param entry\n */\n add<T>(context: string, entry: T): T;\n\n /**\n * Remove some entries of given context by search critieria (mostly passing to same method of LookupRegistry)\n *\n * @param context\n * @param entry\n */\n remove<T>(context: string, search: any): T[];\n\n /**\n * Filter some entries of given context by search critieria (mostly passing to same method of LookupRegistry)\n *\n * @param context\n * @param entry\n */\n filter<T>(context: string, search: any): T[];\n\n /**\n * Find some entries of given context by search critieria (mostly passing to same method of LookupRegistry)\n *\n * @param context\n * @param entry\n */\n find<T>(context: string, search: any): T;\n\n /**\n * Reset registry data\n */\n reset(): void;\n\n}\n"],"sourceRoot":".."}
@@ -0,0 +1,8 @@
1
+ import { MERGE_TYPE, METADATA_TYPE } from '../lib/Constants';
2
+ export interface IPropertyExtentions {
3
+ type: METADATA_TYPE;
4
+ object: Function;
5
+ property?: string;
6
+ options: any;
7
+ merge?: MERGE_TYPE;
8
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // import {METADATA_AND_BIND_TYPE} from './Constants';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+
5
+ //# sourceMappingURL=IPropertyExtentions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/api/IPropertyExtentions.ts"],"names":[],"mappings":";AAAA,sDAAsD","file":"IPropertyExtentions.js","sourcesContent":["// import {METADATA_AND_BIND_TYPE} from './Constants';\n\nimport {MERGE_TYPE, METADATA_TYPE} from '../lib/Constants';\n\nexport interface IPropertyExtentions {\n\n type: METADATA_TYPE,\n\n object: Function,\n\n property?: string,\n\n options: any\n\n merge?: MERGE_TYPE;\n\n}\n"],"sourceRoot":".."}
@@ -0,0 +1,28 @@
1
+ import { IClassRef } from './IClassRef';
2
+ import { IBaseRef } from './IBaseRef';
3
+ import { IBuildOptions } from './IBuildOptions';
4
+ export declare function isPropertyRef(x: any): boolean;
5
+ export interface IPropertyRef extends IBaseRef {
6
+ /**
7
+ * Return if is identifier
8
+ */
9
+ isIdentifier(): boolean;
10
+ /**
11
+ * Return if property is a pattern property
12
+ */
13
+ isPattern(): boolean;
14
+ isReference(): boolean;
15
+ getType(): string | Function;
16
+ /**
17
+ * get class ref of the property
18
+ */
19
+ getClassRef(): IClassRef;
20
+ getTargetRef(): IClassRef;
21
+ /**
22
+ * If property is added by an extra class.
23
+ */
24
+ isAppended(): boolean;
25
+ isCollection(): boolean;
26
+ convert(i: any, options?: IBuildOptions): any;
27
+ get(instance: any): any;
28
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isPropertyRef = void 0;
4
+ const Constants_1 = require("../lib/Constants");
5
+ function isPropertyRef(x) {
6
+ if (x !== undefined && x && x.metaType === Constants_1.METATYPE_PROPERTY) {
7
+ return true;
8
+ }
9
+ return false;
10
+ }
11
+ exports.isPropertyRef = isPropertyRef;
12
+
13
+ //# sourceMappingURL=IPropertyRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/api/IPropertyRef.ts"],"names":[],"mappings":";;;AAGA,gDAAmD;AAEnD,SAAgB,aAAa,CAAC,CAAM;IAClC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAK,6BAAiB,EAAE;QAC5D,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AALD,sCAKC","file":"IPropertyRef.js","sourcesContent":["import {IClassRef} from './IClassRef';\nimport {IBaseRef} from './IBaseRef';\nimport {IBuildOptions} from './IBuildOptions';\nimport {METATYPE_PROPERTY} from '../lib/Constants';\n\nexport function isPropertyRef(x: any) {\n if (x !== undefined && x && x.metaType === METATYPE_PROPERTY) {\n return true;\n }\n return false;\n}\n\nexport interface IPropertyRef extends IBaseRef {\n\n /**\n * Return if is identifier\n */\n isIdentifier(): boolean;\n\n /**\n * Return if property is a pattern property\n */\n isPattern(): boolean;\n\n isReference(): boolean;\n\n getType(): string | Function;\n\n /**\n * get class ref of the property\n */\n getClassRef(): IClassRef;\n\n getTargetRef(): IClassRef;\n\n /**\n * If property is added by an extra class.\n */\n isAppended(): boolean;\n\n isCollection(): boolean;\n\n convert(i: any, options?: IBuildOptions): any;\n\n // toJson(follow?: boolean): IPropertyRefMetadata;\n\n get(instance: any): any;\n}\n"],"sourceRoot":".."}
@@ -0,0 +1,8 @@
1
+ import { IBaseRef } from './IBaseRef';
2
+ import { IEntityRef } from './IEntityRef';
3
+ export interface ISchemaRef extends IBaseRef {
4
+ name: string;
5
+ getNamespace(): string;
6
+ getEntityRefs(): IEntityRef[];
7
+ getEntityRefFor(value: string | Function): IEntityRef;
8
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+
4
+ //# sourceMappingURL=ISchemaRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/api/ISchemaRef.ts"],"names":[],"mappings":"","file":"ISchemaRef.js","sourcesContent":["import {IBaseRef} from './IBaseRef';\nimport {IEntityRef} from './IEntityRef';\n\nexport interface ISchemaRef extends IBaseRef {\n\n name: string;\n\n getNamespace(): string;\n\n getEntityRefs(): IEntityRef[];\n\n getEntityRefFor(value: string | Function): IEntityRef;\n}\n"],"sourceRoot":".."}
@@ -0,0 +1,11 @@
1
+ import { IClassRef } from './IClassRef';
2
+ import { IEntityRef } from './IEntityRef';
3
+ import { ISerializeOptions } from '../lib/serializer/ISerializeOptions';
4
+ import { IUnserializeOptions } from '../lib/serializer/IUnserializeOptions';
5
+ export declare function supportsSerialize(x: any): x is ISerializeSupport;
6
+ export declare function supportsUnserialize(x: any): x is ISerializeSupport;
7
+ export declare function supportsSerialization(x: any): x is ISerializeSupport;
8
+ export interface ISerializeSupport {
9
+ serialize?(options?: ISerializeOptions): Promise<any>;
10
+ unserialize?(data: any, options?: IUnserializeOptions): Promise<IClassRef | IEntityRef | (IClassRef | IEntityRef)[]>;
11
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.supportsSerialization = exports.supportsUnserialize = exports.supportsSerialize = void 0;
4
+ function supportsSerialize(x) {
5
+ if (x.serialize) {
6
+ return true;
7
+ }
8
+ return false;
9
+ }
10
+ exports.supportsSerialize = supportsSerialize;
11
+ function supportsUnserialize(x) {
12
+ if (x.unserialize) {
13
+ return true;
14
+ }
15
+ return false;
16
+ }
17
+ exports.supportsUnserialize = supportsUnserialize;
18
+ function supportsSerialization(x) {
19
+ if (supportsSerialize(x) && supportsUnserialize(x)) {
20
+ return true;
21
+ }
22
+ return false;
23
+ }
24
+ exports.supportsSerialization = supportsSerialization;
25
+
26
+ //# sourceMappingURL=ISerializeSupport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/api/ISerializeSupport.ts"],"names":[],"mappings":";;;AAQA,SAAgB,iBAAiB,CAAC,CAAM;IACtC,IAAI,CAAC,CAAC,SAAS,EAAE;QACf,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AALD,8CAKC;AAED,SAAgB,mBAAmB,CAAC,CAAM;IACxC,IAAI,CAAC,CAAC,WAAW,EAAE;QACjB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AALD,kDAKC;AAGD,SAAgB,qBAAqB,CAAC,CAAM;IAC1C,IAAI,iBAAiB,CAAC,CAAC,CAAC,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;QAClD,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AALD,sDAKC","file":"ISerializeSupport.js","sourcesContent":["import {IJsonSchemaSerializeOptions} from '../lib/json-schema/IJsonSchemaSerializeOptions';\nimport {IClassRef} from './IClassRef';\nimport {IEntityRef} from './IEntityRef';\nimport {IJsonSchemaUnserializeOptions} from '../lib/json-schema/IJsonSchemaUnserializeOptions';\nimport {ISerializeOptions} from '../lib/serializer/ISerializeOptions';\nimport {IUnserializeOptions} from '../lib/serializer/IUnserializeOptions';\n\n\nexport function supportsSerialize(x: any): x is ISerializeSupport {\n if (x.serialize) {\n return true;\n }\n return false;\n}\n\nexport function supportsUnserialize(x: any): x is ISerializeSupport {\n if (x.unserialize) {\n return true;\n }\n return false;\n}\n\n\nexport function supportsSerialization(x: any): x is ISerializeSupport {\n if (supportsSerialize(x) && supportsUnserialize(x)) {\n return true;\n }\n return false;\n}\n\n\nexport interface ISerializeSupport {\n\n serialize?(options?: ISerializeOptions): Promise<any>;\n\n unserialize?(data: any, options?: IUnserializeOptions): Promise<IClassRef | IEntityRef | (IClassRef | IEntityRef)[]>;\n\n}\n"],"sourceRoot":".."}
package/browser.d.ts ADDED
@@ -0,0 +1,62 @@
1
+ export { IBaseRef } from './api/IBaseRef';
2
+ export { IBuildOptions } from './api/IBuildOptions';
3
+ export { IClassRef } from './api/IClassRef';
4
+ export { IEntityRef } from './api/IEntityRef';
5
+ export { ILookupRegistry } from './api/ILookupRegistry';
6
+ export { IPropertyExtentions } from './api/IPropertyExtentions';
7
+ export { IPropertyRef } from './api/IPropertyRef';
8
+ export { ISchemaRef } from './api/ISchemaRef';
9
+ export { IJsonSchema, supportsJsonSchemaExport, supportsJsonSchema, supportsJsonSchemaImport } from './api/IJsonSchema';
10
+ export { Entity } from './decorators/Entity';
11
+ export { Property } from './decorators/Property';
12
+ export { Embeddable } from './decorators/Embeddable';
13
+ export { PropertyOf } from './decorators/PropertyOf';
14
+ export { Schema } from './decorators/Schema';
15
+ export { Namespace } from './decorators/Namespace';
16
+ export { Hostname, HOSTNAME_RFC1034_REGEX, IHostnameOptions, HOSTNAME_RFC952_REGEX } from './decorators/validate/Hostname';
17
+ export { Ip4, IP4_REGEX, IIp4Options } from './decorators/validate/Ip4';
18
+ export { Ip6, IP6_REGEX, IIp6Options } from './decorators/validate/Ip6';
19
+ export { IsEmail, MAIL_REGEX, IIsEmailOptions } from './decorators/validate/IsEmail';
20
+ export { Regex, IRegexOptions } from './decorators/validate/Regex';
21
+ export { Required, IRequiredOptions } from './decorators/validate/Required';
22
+ export { MinLength, IMinLengthOptions } from './decorators/validate/MinLength';
23
+ export { MaxLength, IMaxLengthOptions } from './decorators/validate/MaxLength';
24
+ export { IsNotEmpty, IIsNotEmptyOptions } from './decorators/validate/IsNotEmpty';
25
+ export { AbstractRef } from './lib/AbstractRef';
26
+ export { AbstractRegistry } from './lib/registry/AbstractRegistry';
27
+ export { AnnotationsHelper } from './lib/AnnotationsHelper';
28
+ export { ClassRef } from './lib/ClassRef';
29
+ export { METATYPE_SCHEMA, METATYPE_ENTITY, METATYPE_PROPERTY, METATYPE_CLASS_REF, METATYPE_NAMESPACE, METADATA_TYPE, DEFAULT_NAMESPACE, XS_ANNOTATION_OPTIONS_CACHE, MERGE_TYPE, IMinMax, ClassType, __CLASS__, __NS__, C_EVENT_ADD, C_EVENT_REMOVE, C_EVENT_UPDATE, C_PROP_NAME, CLASS_TYPE, GLOBAL_NAMESPACE, JS_DATA_TYPES, JS_PRIMATIVE_TYPES, METADATA_REGISTRY, METATYPE_EMBEDDABLE, OPT_CREAT_AND_COPY, REFLECT_DESIGN_TYPE, STATE_KEY, T_STRING, XS_DATA_TYPES, XS_DEFAULT_CLASSES, XS_DEFAULT_SCHEMA, METADATA_AND_BIND_TYPE, XS_ID_SEPARATOR, BINDING_SCHEMA_ENTITY, BINDING_SCHEMA_CLASS_REF } from './lib/Constants';
30
+ export { DataContainer } from './lib/DataContainer';
31
+ export { DRAFT_07 } from './lib/json-schema/Constants';
32
+ export { IJsonSchemaSerializeOptions } from './lib/json-schema/IJsonSchemaSerializeOptions';
33
+ export { IJsonSchemaSerializer } from './lib/json-schema/IJsonSchemaSerializer';
34
+ export { IJsonSchemaUnserializeOptions } from './lib/json-schema/IJsonSchemaUnserializeOptions';
35
+ export { IJsonSchemaUnserializer } from './lib/json-schema/IJsonSchemaUnserializer';
36
+ export { IParseOptions } from './lib/json-schema/IParseOptions';
37
+ export { JsonSchema } from './lib/json-schema/JsonSchema';
38
+ export { IJsonSchema7, IJsonSchema7Definition, hasClassInDefinition, hasClassPropertiesInDefinition, IJsonSchema7TypeName, JSON_SCHEMA_7_TYPES } from './lib/json-schema/JsonSchema7';
39
+ export { JsonSchema7Serializer } from './lib/json-schema/JsonSchema7Serializer';
40
+ export { JsonSchema7Unserializer } from './lib/json-schema/JsonSchema7Unserializer';
41
+ export { LookupRegistry } from './lib/LookupRegistry';
42
+ export { IAbstractOptions } from './lib/options/IAbstractOptions';
43
+ export { IEntityOptions } from './lib/options/IEntityOptions';
44
+ export { IObjectOptions } from './lib/options/IObjectOptions';
45
+ export { IPropertyOptions } from './lib/options/IPropertyOptions';
46
+ export { ISchemaOptions } from './lib/options/ISchemaOptions';
47
+ export { DefaultEntityRef } from './lib/registry/DefaultEntityRef';
48
+ export { DefaultNamespacedRegistry } from './lib/registry/DefaultNamespacedRegistry';
49
+ export { DefaultPropertyRef } from './lib/registry/DefaultPropertyRef';
50
+ export { MetadataRegistry } from './lib/registry/MetadataRegistry';
51
+ export { RegistryFactory } from './lib/registry/RegistryFactory';
52
+ export { Binding } from './lib/registry/Binding';
53
+ export { SchemaRef } from './lib/SchemaRef';
54
+ export { SchemaUtils } from './lib/SchemaUtils';
55
+ export { DefaultValidator } from './lib/validation/DefaultValidator';
56
+ export { IValidateOptions } from './lib/validation/IValidateOptions';
57
+ export { IValidatorEntry } from './lib/validation/IValidatorEntry';
58
+ export { IValidationError } from './lib/validation/IValidationError';
59
+ export { IValidationMessage } from './lib/validation/IValidationMessage';
60
+ export { IValidationResult } from './lib/validation/IValidationResult';
61
+ export { IValidator } from './lib/validation/IValidator';
62
+ export { Validator, validate_function } from './lib/validation/Validator';