@aom-js/schemer 0.0.2 → 0.0.4

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 (106) hide show
  1. package/dist/cjs/defines/decorators.d.ts +2 -4
  2. package/dist/cjs/defines/decorators.d.ts.map +1 -1
  3. package/dist/cjs/defines/decorators.js +43 -13
  4. package/dist/cjs/defines/decorators.js.map +1 -1
  5. package/dist/cjs/defines/helpers/index.d.ts +2 -0
  6. package/dist/cjs/defines/helpers/index.d.ts.map +1 -0
  7. package/dist/cjs/defines/helpers/index.js +18 -0
  8. package/dist/cjs/defines/helpers/index.js.map +1 -0
  9. package/dist/cjs/defines/helpers/is-nullable.d.ts +3 -0
  10. package/dist/cjs/defines/helpers/is-nullable.d.ts.map +1 -0
  11. package/dist/cjs/defines/helpers/is-nullable.js +10 -0
  12. package/dist/cjs/defines/helpers/is-nullable.js.map +1 -0
  13. package/dist/cjs/defines/mapped-types/index.d.ts +6 -0
  14. package/dist/cjs/defines/mapped-types/index.d.ts.map +1 -0
  15. package/dist/cjs/defines/mapped-types/index.js +22 -0
  16. package/dist/cjs/defines/mapped-types/index.js.map +1 -0
  17. package/dist/cjs/defines/mapped-types/intersection-type.helper.d.ts +11 -0
  18. package/dist/cjs/defines/mapped-types/intersection-type.helper.d.ts.map +1 -0
  19. package/dist/cjs/defines/mapped-types/intersection-type.helper.js +40 -0
  20. package/dist/cjs/defines/mapped-types/intersection-type.helper.js.map +1 -0
  21. package/dist/cjs/defines/mapped-types/mapped-type.interface.d.ts +5 -0
  22. package/dist/cjs/defines/mapped-types/mapped-type.interface.d.ts.map +1 -0
  23. package/dist/cjs/defines/mapped-types/mapped-type.interface.js +3 -0
  24. package/dist/cjs/defines/mapped-types/mapped-type.interface.js.map +1 -0
  25. package/dist/cjs/defines/mapped-types/omit-type.helper.d.ts +5 -0
  26. package/dist/cjs/defines/mapped-types/omit-type.helper.d.ts.map +1 -0
  27. package/dist/cjs/defines/mapped-types/omit-type.helper.js +29 -0
  28. package/dist/cjs/defines/mapped-types/omit-type.helper.js.map +1 -0
  29. package/dist/cjs/defines/mapped-types/partial-type.helper.d.ts +5 -0
  30. package/dist/cjs/defines/mapped-types/partial-type.helper.d.ts.map +1 -0
  31. package/dist/cjs/defines/mapped-types/partial-type.helper.js +26 -0
  32. package/dist/cjs/defines/mapped-types/partial-type.helper.js.map +1 -0
  33. package/dist/cjs/defines/mapped-types/pick-type.helper.d.ts +5 -0
  34. package/dist/cjs/defines/mapped-types/pick-type.helper.d.ts.map +1 -0
  35. package/dist/cjs/defines/mapped-types/pick-type.helper.js +29 -0
  36. package/dist/cjs/defines/mapped-types/pick-type.helper.js.map +1 -0
  37. package/dist/cjs/defines/mapped-types/type.interface.d.ts +2 -0
  38. package/dist/cjs/defines/mapped-types/type.interface.d.ts.map +1 -0
  39. package/dist/cjs/defines/mapped-types/type.interface.js +3 -0
  40. package/dist/cjs/defines/mapped-types/type.interface.js.map +1 -0
  41. package/dist/cjs/defines/mapped-types/types/remove-fields-with-type.type.d.ts +6 -0
  42. package/dist/cjs/defines/mapped-types/types/remove-fields-with-type.type.d.ts.map +1 -0
  43. package/dist/cjs/defines/mapped-types/types/remove-fields-with-type.type.js +3 -0
  44. package/dist/cjs/defines/mapped-types/types/remove-fields-with-type.type.js.map +1 -0
  45. package/dist/cjs/defines/module.d.ts +10 -7
  46. package/dist/cjs/defines/module.d.ts.map +1 -1
  47. package/dist/cjs/defines/module.js +9 -4
  48. package/dist/cjs/defines/module.js.map +1 -1
  49. package/dist/cjs/defines/properties.d.ts +42 -0
  50. package/dist/cjs/defines/properties.d.ts.map +1 -0
  51. package/dist/cjs/defines/properties.js +250 -0
  52. package/dist/cjs/defines/properties.js.map +1 -0
  53. package/dist/cjs/defines/types.d.ts +26 -4
  54. package/dist/cjs/defines/types.d.ts.map +1 -1
  55. package/dist/cjs/defines/types.js +11 -0
  56. package/dist/cjs/defines/types.js.map +1 -1
  57. package/dist/cjs/index.d.ts +3 -0
  58. package/dist/cjs/index.d.ts.map +1 -1
  59. package/dist/cjs/index.js +5 -0
  60. package/dist/cjs/index.js.map +1 -1
  61. package/dist/mjs/defines/decorators.js +44 -13
  62. package/dist/mjs/defines/decorators.js.map +1 -1
  63. package/dist/mjs/defines/helpers/index.js +2 -0
  64. package/dist/mjs/defines/helpers/index.js.map +1 -0
  65. package/dist/mjs/defines/helpers/is-nullable.js +7 -0
  66. package/dist/mjs/defines/helpers/is-nullable.js.map +1 -0
  67. package/dist/mjs/defines/mapped-types/index.js +6 -0
  68. package/dist/mjs/defines/mapped-types/index.js.map +1 -0
  69. package/dist/mjs/defines/mapped-types/intersection-type.helper.js +37 -0
  70. package/dist/mjs/defines/mapped-types/intersection-type.helper.js.map +1 -0
  71. package/dist/mjs/defines/mapped-types/mapped-type.interface.js +2 -0
  72. package/dist/mjs/defines/mapped-types/mapped-type.interface.js.map +1 -0
  73. package/dist/mjs/defines/mapped-types/omit-type.helper.js +26 -0
  74. package/dist/mjs/defines/mapped-types/omit-type.helper.js.map +1 -0
  75. package/dist/mjs/defines/mapped-types/partial-type.helper.js +23 -0
  76. package/dist/mjs/defines/mapped-types/partial-type.helper.js.map +1 -0
  77. package/dist/mjs/defines/mapped-types/pick-type.helper.js +26 -0
  78. package/dist/mjs/defines/mapped-types/pick-type.helper.js.map +1 -0
  79. package/dist/mjs/defines/mapped-types/type.interface.js +2 -0
  80. package/dist/mjs/defines/mapped-types/type.interface.js.map +1 -0
  81. package/dist/mjs/defines/mapped-types/types/remove-fields-with-type.type.js +2 -0
  82. package/dist/mjs/defines/mapped-types/types/remove-fields-with-type.type.js.map +1 -0
  83. package/dist/mjs/defines/module.js +9 -4
  84. package/dist/mjs/defines/module.js.map +1 -1
  85. package/dist/mjs/defines/properties.js +247 -0
  86. package/dist/mjs/defines/properties.js.map +1 -0
  87. package/dist/mjs/defines/types.js +10 -1
  88. package/dist/mjs/defines/types.js.map +1 -1
  89. package/dist/mjs/index.js +3 -0
  90. package/dist/mjs/index.js.map +1 -1
  91. package/dist/types/defines/decorators.d.ts +2 -4
  92. package/dist/types/defines/helpers/index.d.ts +1 -0
  93. package/dist/types/defines/helpers/is-nullable.d.ts +2 -0
  94. package/dist/types/defines/mapped-types/index.d.ts +5 -0
  95. package/dist/types/defines/mapped-types/intersection-type.helper.d.ts +10 -0
  96. package/dist/types/defines/mapped-types/mapped-type.interface.d.ts +4 -0
  97. package/dist/types/defines/mapped-types/omit-type.helper.d.ts +4 -0
  98. package/dist/types/defines/mapped-types/partial-type.helper.d.ts +4 -0
  99. package/dist/types/defines/mapped-types/pick-type.helper.d.ts +4 -0
  100. package/dist/types/defines/mapped-types/type.interface.d.ts +1 -0
  101. package/dist/types/defines/mapped-types/types/remove-fields-with-type.type.d.ts +5 -0
  102. package/dist/types/defines/module.d.ts +10 -7
  103. package/dist/types/defines/properties.d.ts +41 -0
  104. package/dist/types/defines/types.d.ts +26 -4
  105. package/dist/types/index.d.ts +3 -0
  106. package/package.json +6 -2
@@ -1,5 +1,3 @@
1
- import { Schemer } from "./module";
2
- import { ConnectionSchema } from "./types";
3
- export declare function ComponentSchema(schemer?: Schemer): ClassDecorator;
4
- export declare function ComponentConnect(schema: ConnectionSchema): PropertyDecorator;
1
+ import { BaseDescriptionsProperties } from "./types";
2
+ export declare function ComponentSchema(params?: BaseDescriptionsProperties): ClassDecorator;
5
3
  //# sourceMappingURL=decorators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../src/defines/decorators.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAc,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAQ3C,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,cAAc,CAQjE;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,iBAAiB,CAM5E"}
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../src/defines/decorators.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAQrD,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,0BAA0B,GAAG,cAAc,CA4FnF"}
@@ -1,20 +1,50 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ComponentSchema = ComponentSchema;
4
- exports.ComponentConnect = ComponentConnect;
4
+ const class_validator_jsonschema_1 = require("class-validator-jsonschema");
5
+ const core_1 = require("@aom-js/core");
5
6
  const module_1 = require("./module");
6
- function ComponentSchema(schemer) {
7
- if (!schemer) {
8
- schemer = module_1.Schemer.default;
9
- }
7
+ function ComponentSchema(params) {
10
8
  return module_1.AomSchemas.classDecorator(($) => {
11
- $.schemer = schemer;
12
- });
13
- }
14
- function ComponentConnect(schema) {
15
- return module_1.AomSchemas.propertyDecorator(($) => {
16
- const { property } = $._;
17
- $._.root.connections.set(property, schema);
18
- });
9
+ $.isComponentSchema = true;
10
+ const errors = [];
11
+ const inheritDecorators = (parent) => {
12
+ const $parent = $._.base.instance(parent);
13
+ $parent._.callstack.transferTo($);
14
+ const transferDescritorWithDecorators = (target, property, source, descriptor) => {
15
+ const curriedDescriptor = descriptor && descriptor.value
16
+ ? (...args) => Reflect.apply(descriptor.value, null, args)
17
+ : undefined;
18
+ Reflect.defineProperty(target, property, {
19
+ ...descriptor,
20
+ value: curriedDescriptor,
21
+ });
22
+ const $childInstance = $._.base.instance(target, property);
23
+ source._.callstack.transferTo($childInstance);
24
+ };
25
+ $parent._.origins.forEach((origin) => {
26
+ const $origin = origin.self;
27
+ const isClassOrigin = origin.target === $origin._.target;
28
+ if (isClassOrigin && !(0, core_1.hasOwnProperty)($._.target, $origin._.property)) {
29
+ transferDescritorWithDecorators($._.target, $origin._.property, $origin, origin.descriptor);
30
+ }
31
+ else if (!isClassOrigin && !(0, core_1.hasOwnProperty)($._.target.prototype, $origin._.property)) {
32
+ transferDescritorWithDecorators($._.target.prototype, $origin._.property, $origin, origin.descriptor);
33
+ }
34
+ else {
35
+ errors.push(new Error(`same property exists ${$._.target.name}.${origin.property.toString()}`));
36
+ }
37
+ });
38
+ };
39
+ inheritDecorators(Object.getPrototypeOf($._.target));
40
+ if (params) {
41
+ const decorators = [(0, class_validator_jsonschema_1.JSONSchema)({ ...params })];
42
+ Reflect.decorate(decorators, $._.target);
43
+ }
44
+ $._.apply();
45
+ if (errors.length) {
46
+ console.error("ComponentSchema inherit errors", errors);
47
+ }
48
+ }, core_1.DecoratorsQueueStore.INSTANT);
19
49
  }
20
50
  //# sourceMappingURL=decorators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../src/defines/decorators.ts"],"names":[],"mappings":";;AAUA,0CAQC;AAED,4CAMC;AAzBD,qCAA+C;AAS/C,SAAgB,eAAe,CAAC,OAAiB;IAE/C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,gBAAO,CAAC,OAAO,CAAC;IAC5B,CAAC;IACD,OAAO,mBAAU,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE;QACrC,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC;IACtB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,gBAAgB,CAAC,MAAwB;IAEvD,OAAO,mBAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE;QACxC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../src/defines/decorators.ts"],"names":[],"mappings":";;AAmBA,0CA4FC;AA9GD,2EAAwD;AAExD,uCAMsB;AACtB,qC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CAAC,MAAM,EAAE,CAAC;YAClB,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,MAAM,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC,EAAE,2BAAoB,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./is-nullable";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/defines/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./is-nullable"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/defines/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
@@ -0,0 +1,3 @@
1
+ import { ValidationOptions } from "class-validator";
2
+ export declare function IsNullable(validationOptions?: ValidationOptions): PropertyDecorator;
3
+ //# sourceMappingURL=is-nullable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-nullable.d.ts","sourceRoot":"","sources":["../../../../src/defines/helpers/is-nullable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAc,MAAM,iBAAiB,CAAC;AAEhE,wBAAgB,UAAU,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CAQnF"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IsNullable = IsNullable;
4
+ const class_validator_1 = require("class-validator");
5
+ function IsNullable(validationOptions) {
6
+ return (constructor, property) => {
7
+ return Reflect.decorate([(0, class_validator_1.ValidateIf)((_object, value) => value !== null, validationOptions)], constructor, property);
8
+ };
9
+ }
10
+ //# sourceMappingURL=is-nullable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-nullable.js","sourceRoot":"","sources":["../../../../src/defines/helpers/is-nullable.ts"],"names":[],"mappings":";;AAEA,gCAQC;AAVD,qDAAgE;AAEhE,SAAgB,UAAU,CAAC,iBAAqC;IAC9D,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE;QAC/B,OAAO,OAAO,CAAC,QAAQ,CACrB,CAAC,IAAA,4BAAU,EAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,EAAE,iBAAiB,CAAC,CAAC,EACnE,WAAW,EACX,QAAQ,CACT,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from "./mapped-type.interface";
2
+ export * from "./partial-type.helper";
3
+ export * from "./pick-type.helper";
4
+ export * from "./omit-type.helper";
5
+ export * from './intersection-type.helper';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/defines/mapped-types/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./mapped-type.interface"), exports);
18
+ __exportStar(require("./partial-type.helper"), exports);
19
+ __exportStar(require("./pick-type.helper"), exports);
20
+ __exportStar(require("./omit-type.helper"), exports);
21
+ __exportStar(require("./intersection-type.helper"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/defines/mapped-types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,wDAAsC;AACtC,qDAAmC;AACnC,qDAAmC;AACnC,6DAA2C"}
@@ -0,0 +1,11 @@
1
+ import { Type } from "./type.interface";
2
+ import { MappedType } from "./mapped-type.interface";
3
+ import { RemoveFieldsWithType } from "./types/remove-fields-with-type.type";
4
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
5
+ type ClassRefsToConstructors<T extends Type[]> = {
6
+ [U in keyof T]: T[U] extends Type<infer V> ? V : never;
7
+ };
8
+ type Intersection<T extends Type[]> = MappedType<RemoveFieldsWithType<UnionToIntersection<ClassRefsToConstructors<T>[number]>, Function>>;
9
+ export declare function IntersectionType<T extends Type[]>(...classRefs: T): Intersection<T>;
10
+ export {};
11
+ //# sourceMappingURL=intersection-type.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intersection-type.helper.d.ts","sourceRoot":"","sources":["../../../../src/defines/mapped-types/intersection-type.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAQ5E,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,GAC/F,CAAC,GACD,KAAK,CAAC;AAIV,KAAK,uBAAuB,CAAC,CAAC,SAAS,IAAI,EAAE,IAAI;KAC9C,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;CACvD,CAAC;AAOF,KAAK,YAAY,CAAC,CAAC,SAAS,IAAI,EAAE,IAAI,UAAU,CAC9C,oBAAoB,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CACxF,CAAC;AAKF,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,GAAG,SAAS,EAAE,CAAC,GAuDhC,YAAY,CAAC,CAAC,CAAC,CAChD"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IntersectionType = IntersectionType;
4
+ const module_1 = require("../module");
5
+ const decorators_1 = require("../decorators");
6
+ const properties_1 = require("../properties");
7
+ function IntersectionType(...classRefs) {
8
+ class IntersectionClassType {
9
+ }
10
+ const intersectionsMap = new Map();
11
+ const intersectionsProtoMap = new Map();
12
+ classRefs.forEach((classRef) => {
13
+ const $classInstance = module_1.AomSchemas.checkExists(classRef);
14
+ if (!$classInstance || !$classInstance.isComponentSchema) {
15
+ throw new Error(`${classRef.name} parent class is not ComponentSchema constructor`);
16
+ }
17
+ $classInstance._.origins.forEach((origin) => {
18
+ const { schemaName, schemaParams } = origin.self;
19
+ if (schemaName && schemaParams) {
20
+ const isClassOrigin = origin.target === origin._.target;
21
+ const target = isClassOrigin ? IntersectionClassType : IntersectionClassType.prototype;
22
+ const targetMap = isClassOrigin ? intersectionsMap : intersectionsProtoMap;
23
+ targetMap.set(origin.property, [target, origin.descriptor, schemaName, schemaParams]);
24
+ }
25
+ });
26
+ });
27
+ intersectionsMap.forEach((value, property) => {
28
+ const [target, descriptor, schemaName, schemaParams] = value;
29
+ Reflect.defineProperty(target, property, { ...descriptor });
30
+ Reflect.decorate([Reflect.apply(properties_1.PropertySchema[schemaName], undefined, [schemaParams])], target, property);
31
+ });
32
+ intersectionsProtoMap.forEach((value, property) => {
33
+ const [target, descriptor, schemaName, schemaParams] = value;
34
+ Reflect.defineProperty(target, property, { ...descriptor });
35
+ Reflect.decorate([Reflect.apply(properties_1.PropertySchema[schemaName], undefined, [schemaParams])], target, property);
36
+ });
37
+ Reflect.decorate([(0, decorators_1.ComponentSchema)()], IntersectionClassType);
38
+ return IntersectionClassType;
39
+ }
40
+ //# sourceMappingURL=intersection-type.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intersection-type.helper.js","sourceRoot":"","sources":["../../../../src/defines/mapped-types/intersection-type.helper.ts"],"names":[],"mappings":";;AAiCA,4CAwDC;AArFD,sCAAuC;AACvC,8CAAgD;AAGhD,8CAA+C;AAyB/C,SAAgB,gBAAgB,CAAmB,GAAG,SAAY;IAChE,MAAe,qBAAqB;KAAG;IAOvC,MAAM,gBAAgB,GAAqC,IAAI,GAAG,EAAE,CAAC;IAC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E,CAAC,CAAC;QAC5D,OAAO,CAAC,QAAQ,CAEd,CAAC,OAAO,CAAC,KAAK,CAAC,2BAAc,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,EACtE,MAAM,EACN,QAAQ,CACT,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,qBAAqB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QAChD,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC;QAC7D,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC;QAC5D,OAAO,CAAC,QAAQ,CAEd,CAAC,OAAO,CAAC,KAAK,CAAC,2BAAc,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,EACtE,MAAM,EACN,QAAQ,CACT,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAA,4BAAe,GAAE,CAAC,EAAE,qBAAqB,CAAC,CAAC;IAE7D,OAAO,qBAAwC,CAAC;AAClD,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Type } from "./type.interface";
2
+ export interface MappedType<T> extends Type<T> {
3
+ new (): T;
4
+ }
5
+ //# sourceMappingURL=mapped-type.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapped-type.interface.d.ts","sourceRoot":"","sources":["../../../../src/defines/mapped-types/mapped-type.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAMxC,MAAM,WAAW,UAAU,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,CAAC,CAAC;IAC5C,QAAQ,CAAC,CAAC;CACX"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=mapped-type.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapped-type.interface.js","sourceRoot":"","sources":["../../../../src/defines/mapped-types/mapped-type.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { Type } from "./type.interface";
2
+ import { MappedType } from "./mapped-type.interface";
3
+ import { RemoveFieldsWithType } from "./types/remove-fields-with-type.type";
4
+ export declare function OmitType<T, K extends keyof T>(classRef: Type<T>, keys: readonly K[]): MappedType<RemoveFieldsWithType<Omit<T, (typeof keys)[number]>, Function>>;
5
+ //# sourceMappingURL=omit-type.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"omit-type.helper.d.ts","sourceRoot":"","sources":["../../../../src/defines/mapped-types/omit-type.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAO5E,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,GA8B1D,UAAU,CAChC,oBAAoB,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,OAAO,IAAI,EAAE,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAC/D,CACF"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OmitType = OmitType;
4
+ const module_1 = require("../module");
5
+ const decorators_1 = require("../decorators");
6
+ const properties_1 = require("../properties");
7
+ function OmitType(classRef, keys) {
8
+ class OmitTypeClass {
9
+ }
10
+ const $classInstance = module_1.AomSchemas.checkExists(classRef);
11
+ if (!$classInstance || !$classInstance.isComponentSchema) {
12
+ throw new Error(`${classRef.name} parent class is not ComponentSchema constructor`);
13
+ }
14
+ $classInstance._.origins.forEach((origin) => {
15
+ const property = origin.property;
16
+ if (!keys.includes(property)) {
17
+ const { schemaName, schemaParams } = origin.self;
18
+ if (schemaName && schemaParams) {
19
+ const isClassOrigin = origin.target === origin._.target;
20
+ const target = isClassOrigin ? OmitTypeClass : OmitTypeClass.prototype;
21
+ Reflect.defineProperty(target, origin.property, { ...origin.descriptor });
22
+ Reflect.decorate([Reflect.apply(properties_1.PropertySchema[schemaName], undefined, [schemaParams])], target, origin.property);
23
+ }
24
+ }
25
+ });
26
+ Reflect.decorate([(0, decorators_1.ComponentSchema)()], OmitTypeClass);
27
+ return OmitTypeClass;
28
+ }
29
+ //# sourceMappingURL=omit-type.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"omit-type.helper.js","sourceRoot":"","sources":["../../../../src/defines/mapped-types/omit-type.helper.ts"],"names":[],"mappings":";;AASA,4BAiCC;AAtCD,sCAAuC;AACvC,8CAAgD;AAEhD,8CAA+C;AAE/C,SAAgB,QAAQ,CAAuB,QAAiB,EAAE,IAAkB;IAClF,MAAe,aAAa;KAAG;IAE/B,MAAM,cAAc,GAAG,mBAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACxD,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,CAAC,IAAI,kDAAkD,CAAC,CAAC;IACtF,CAAC;IAED,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QAC1C,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAa,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAG7B,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC;YACjD,IAAI,UAAU,IAAI,YAAY,EAAE,CAAC;gBAC/B,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;gBACxD,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC;gBAEvE,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;gBAC1E,OAAO,CAAC,QAAQ,CAEd,CAAC,OAAO,CAAC,KAAK,CAAC,2BAAc,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,EACtE,MAAM,EACN,MAAM,CAAC,QAAQ,CAChB,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAA,4BAAe,GAAE,CAAC,EAAE,aAAa,CAAC,CAAC;IAErD,OAAO,aAEN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Type } from "./type.interface";
2
+ import { MappedType } from "./mapped-type.interface";
3
+ import { RemoveFieldsWithType } from "./types/remove-fields-with-type.type";
4
+ export declare function PartialType<T>(classRef: Type<T>): MappedType<RemoveFieldsWithType<Partial<T>, Function>>;
5
+ //# sourceMappingURL=partial-type.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partial-type.helper.d.ts","sourceRoot":"","sources":["../../../../src/defines/mapped-types/partial-type.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAMrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAK5E,wBAAgB,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,GA4BnB,UAAU,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAClF"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PartialType = PartialType;
4
+ const module_1 = require("../module");
5
+ const decorators_1 = require("../decorators");
6
+ const properties_1 = require("../properties");
7
+ function PartialType(classRef) {
8
+ class PartialClassType {
9
+ }
10
+ const $classInstance = module_1.AomSchemas.checkExists(classRef);
11
+ if (!$classInstance || !$classInstance.isComponentSchema) {
12
+ throw new Error(`${classRef.name} parent class is not ComponentSchema constructor`);
13
+ }
14
+ $classInstance._.origins.forEach((origin) => {
15
+ const { schemaName, schemaParams } = origin.self;
16
+ if (schemaName && schemaParams) {
17
+ const isClassOrigin = origin.target === origin._.target;
18
+ const target = isClassOrigin ? PartialClassType : PartialClassType.prototype;
19
+ Reflect.defineProperty(target, origin.property, { ...origin.descriptor });
20
+ Reflect.decorate([Reflect.apply(properties_1.PropertySchema[schemaName], undefined, [{ ...schemaParams, isOptional: true }])], target, origin.property);
21
+ }
22
+ });
23
+ Reflect.decorate([(0, decorators_1.ComponentSchema)()], PartialClassType);
24
+ return PartialClassType;
25
+ }
26
+ //# sourceMappingURL=partial-type.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partial-type.helper.js","sourceRoot":"","sources":["../../../../src/defines/mapped-types/partial-type.helper.ts"],"names":[],"mappings":";;AAaA,kCA6BC;AAtCD,sCAAuC;AACvC,8CAAgD;AAEhD,8CAA+C;AAM/C,SAAgB,WAAW,CAAI,QAAiB;IAC9C,MAAe,gBAAgB;KAAG;IAElC,MAAM,cAAc,GAAG,mBAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACxD,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,CAAC,IAAI,kDAAkD,CAAC,CAAC;IACtF,CAAC;IAED,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QAG1C,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC;QACjD,IAAI,UAAU,IAAI,YAAY,EAAE,CAAC;YAC/B,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;YACxD,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,SAAS,CAAC;YAE7E,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;YAC1E,OAAO,CAAC,QAAQ,CAEd,CAAC,OAAO,CAAC,KAAK,CAAC,2BAAc,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAC/F,MAAM,EACN,MAAM,CAAC,QAAQ,CAChB,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAA,4BAAe,GAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC;IAExD,OAAO,gBAA0E,CAAC;AACpF,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Type } from "./type.interface";
2
+ import { MappedType } from "./mapped-type.interface";
3
+ import { RemoveFieldsWithType } from "./types/remove-fields-with-type.type";
4
+ export declare function PickType<T, K extends keyof T>(classRef: Type<T>, keys: readonly K[]): MappedType<RemoveFieldsWithType<Pick<T, (typeof keys)[number]>, Function>>;
5
+ //# sourceMappingURL=pick-type.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pick-type.helper.d.ts","sourceRoot":"","sources":["../../../../src/defines/mapped-types/pick-type.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAO5E,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,GA6B1D,UAAU,CAChC,oBAAoB,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,OAAO,IAAI,EAAE,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAC/D,CACF"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PickType = PickType;
4
+ const module_1 = require("../module");
5
+ const decorators_1 = require("../decorators");
6
+ const properties_1 = require("../properties");
7
+ function PickType(classRef, keys) {
8
+ class PickTypeClass {
9
+ }
10
+ const $classInstance = module_1.AomSchemas.checkExists(classRef);
11
+ if (!$classInstance || !$classInstance.isComponentSchema) {
12
+ throw new Error(`${classRef.name} parent class is not ComponentSchema constructor`);
13
+ }
14
+ $classInstance._.origins.forEach((origin) => {
15
+ const property = origin.property;
16
+ if (keys.includes(property)) {
17
+ const { schemaName, schemaParams } = origin.self;
18
+ if (schemaName && schemaParams) {
19
+ const isClassOrigin = origin.target === origin._.target;
20
+ const target = isClassOrigin ? PickTypeClass : PickTypeClass.prototype;
21
+ Reflect.defineProperty(target, origin.property, { ...origin.descriptor });
22
+ Reflect.decorate([Reflect.apply(properties_1.PropertySchema[schemaName], undefined, [schemaParams])], target, origin.property);
23
+ }
24
+ }
25
+ });
26
+ Reflect.decorate([(0, decorators_1.ComponentSchema)()], PickTypeClass);
27
+ return PickTypeClass;
28
+ }
29
+ //# sourceMappingURL=pick-type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ACN,MAAM,CAAC,QAAQ,CAChB,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAA,4BAAe,GAAE,CAAC,EAAE,aAAa,CAAC,CAAC;IAErD,OAAO,aAEN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export type Type<T = any> = new (...args: any[]) => T;
2
+ //# sourceMappingURL=type.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.interface.d.ts","sourceRoot":"","sources":["../../../../src/defines/mapped-types/type.interface.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,CAAC,CAAC,GAAG,GAAG,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=type.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.interface.js","sourceRoot":"","sources":["../../../../src/defines/mapped-types/type.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ type KeysWithType<T, Type> = {
2
+ [K in keyof T]: T[K] extends Type ? K : never;
3
+ }[keyof T];
4
+ export type RemoveFieldsWithType<T, Type> = Exclude<T, KeysWithType<T, Type>>;
5
+ export {};
6
+ //# sourceMappingURL=remove-fields-with-type.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-fields-with-type.type.d.ts","sourceRoot":"","sources":["../../../../../src/defines/mapped-types/types/remove-fields-with-type.type.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,CAAC,CAAC,EAAE,IAAI,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,KAAK;CAC9C,CAAC,MAAM,CAAC,CAAC,CAAC;AAEX,MAAM,MAAM,oBAAoB,CAAC,CAAC,EAAE,IAAI,IAAI,OAAO,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=remove-fields-with-type.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-fields-with-type.type.js","sourceRoot":"","sources":["../../../../../src/defines/mapped-types/types/remove-fields-with-type.type.ts"],"names":[],"mappings":""}
@@ -1,13 +1,16 @@
1
- import { AomCore, Property } from "@aom-js/core";
2
- import { ConnectionSchema, SchemerConfig, RenderHandler } from "./types";
1
+ import { AomCore, Constructor, Property } from "@aom-js/core";
2
+ import { targetConstructorToSchema } from "class-validator-jsonschema";
3
+ import { ConnectionSchema, CommonDescriptionsProperties, SchemaTypes } from "./types";
3
4
  export declare class AomSchemas extends AomCore {
4
5
  schemer: Schemer;
6
+ isComponentSchema: boolean;
5
7
  connections: Map<Property, ConnectionSchema>;
8
+ schemaName?: SchemaTypes;
9
+ schemaParams?: CommonDescriptionsProperties;
6
10
  }
7
- export declare class Schemer implements SchemerConfig {
8
- render: RenderHandler;
9
- constructor(config: SchemerConfig);
10
- static default: Schemer;
11
- static config(config: SchemerConfig): void;
11
+ export declare class Schemer {
12
+ private refPointerPrefix;
13
+ constructor(refPointerPrefix: string);
14
+ render(target: Constructor): ReturnType<typeof targetConstructorToSchema>;
12
15
  }
13
16
  //# sourceMappingURL=module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/defines/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEzE,qBAAa,UAAW,SAAQ,OAAO;IACrC,OAAO,EAAE,OAAO,CAAC;IAEjB,WAAW,EAAE,GAAG,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAa;CAC1D;AAED,qBAAa,OAAQ,YAAW,aAAa;IAE3C,MAAM,EAAE,aAAa,CAAC;gBAMV,MAAM,EAAE,aAAa;IAMjC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;IAMxB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa;CAGpC"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/defines/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,EACL,gBAAgB,EAGhB,4BAA4B,EAC5B,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,qBAAa,UAAW,SAAQ,OAAO;IACrC,OAAO,EAAE,OAAO,CAAC;IAEjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,WAAW,EAAE,GAAG,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAa;IAEzD,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,YAAY,CAAC,EAAE,4BAA4B,CAAC;CAC7C;AAED,qBAAa,OAAO;IAClB,OAAO,CAAC,gBAAgB,CAAS;gBAMrB,gBAAgB,EAAE,MAAM;IAOpC,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,CAAC,OAAO,yBAAyB,CAAC;CAiB1E"}
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Schemer = exports.AomSchemas = void 0;
4
4
  const core_1 = require("@aom-js/core");
5
+ const storage_1 = require("class-transformer/cjs/storage");
6
+ const class_validator_jsonschema_1 = require("class-validator-jsonschema");
5
7
  class AomSchemas extends core_1.AomCore {
6
8
  constructor() {
7
9
  super(...arguments);
@@ -10,11 +12,14 @@ class AomSchemas extends core_1.AomCore {
10
12
  }
11
13
  exports.AomSchemas = AomSchemas;
12
14
  class Schemer {
13
- constructor(config) {
14
- this.render = config.render;
15
+ constructor(refPointerPrefix) {
16
+ this.refPointerPrefix = refPointerPrefix;
15
17
  }
16
- static config(config) {
17
- this.default = new this(config);
18
+ render(target) {
19
+ return (0, class_validator_jsonschema_1.targetConstructorToSchema)(target, {
20
+ classTransformerMetadataStorage: storage_1.defaultMetadataStorage,
21
+ refPointerPrefix: this.refPointerPrefix,
22
+ });
18
23
  }
19
24
  }
20
25
  exports.Schemer = Schemer;
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/defines/module.ts"],"names":[],"mappings":";;;AAAA,uCAAiD;AAIjD,MAAa,UAAW,SAAQ,cAAO;IAAvC;;QAGE,gBAAW,GAAoC,IAAI,GAAG,EAAE,CAAC;IAC3D,CAAC;CAAA;AAJD,gCAIC;AAED,MAAa,OAAO;IAQlB,YAAY,MAAqB;QAE/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,CAAC;IASD,MAAM,CAAC,MAAM,CAAC,MAAqB;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CACF;AAvBD,0BAuBC"}
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/defines/module.ts"],"names":[],"mappings":";;;AAAA,uCAA8D;AAC9D,2DAAuE;AACvE,2EAAuE;AAUvE,MAAa,UAAW,SAAQ,cAAO;IAAvC;;QAIE,gBAAW,GAAoC,IAAI,GAAG,EAAE,CAAC;IAI3D,CAAC;CAAA;AARD,gCAQC;AAED,MAAa,OAAO;IAOlB,YAAY,gBAAwB;QAClC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAG3C,CAAC;IAGD,MAAM,CAAC,MAAmB;QACxB,OAAO,IAAA,sDAAyB,EAAC,MAAM,EAAE;YACvC,+BAA+B,EAAE,gCAAsB;YACvD,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;SACxC,CAAC,CAAC;IACL,CAAC;CAYF;AA/BD,0BA+BC"}
@@ -0,0 +1,42 @@
1
+ import { CommonDescriptionsProperties, ConnectionSchema } from "./types";
2
+ declare interface StringDescriptionsProperties extends CommonDescriptionsProperties {
3
+ minLength?: number;
4
+ maxLength?: number;
5
+ pattern?: string;
6
+ default?: string;
7
+ }
8
+ declare interface NumberDescriptionsProperties extends CommonDescriptionsProperties {
9
+ minValue?: number;
10
+ maxValue?: number;
11
+ default?: number;
12
+ }
13
+ declare interface BooleanDescriptionsProperties extends CommonDescriptionsProperties {
14
+ default?: boolean;
15
+ }
16
+ declare interface AnyDescriptionsProperties extends CommonDescriptionsProperties {
17
+ default?: any;
18
+ }
19
+ type EnumLike = Record<string, string | number>;
20
+ declare interface EnumDescriptionsProperties<T extends EnumLike> extends CommonDescriptionsProperties {
21
+ value: T;
22
+ default?: T[keyof T];
23
+ }
24
+ declare interface DateDescriptionsProperties extends CommonDescriptionsProperties {
25
+ minDate?: Date;
26
+ maxDate?: Date;
27
+ default?: Date;
28
+ }
29
+ declare interface TypeDescriptionsProperties extends CommonDescriptionsProperties {
30
+ value: ConnectionSchema;
31
+ }
32
+ export declare const PropertySchema: {
33
+ String: (params: StringDescriptionsProperties) => PropertyDecorator;
34
+ Number: (params: NumberDescriptionsProperties) => PropertyDecorator;
35
+ Date: (params: DateDescriptionsProperties) => PropertyDecorator;
36
+ Boolean: (params: BooleanDescriptionsProperties) => PropertyDecorator;
37
+ Enum: <T extends EnumLike>(params: EnumDescriptionsProperties<T>) => PropertyDecorator;
38
+ Any: (params: AnyDescriptionsProperties) => PropertyDecorator;
39
+ Type: (params: TypeDescriptionsProperties) => PropertyDecorator;
40
+ };
41
+ export {};
42
+ //# sourceMappingURL=properties.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../src/defines/properties.ts"],"names":[],"mappings":"AAMA,OAAO,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