@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
@@ -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,4 +1,6 @@
1
1
  import { AomCore } from "@aom-js/core";
2
+ import { defaultMetadataStorage } from "class-transformer/cjs/storage";
3
+ import { targetConstructorToSchema } from "class-validator-jsonschema";
2
4
  export class AomSchemas extends AomCore {
3
5
  constructor() {
4
6
  super(...arguments);
@@ -6,11 +8,14 @@ export class AomSchemas extends AomCore {
6
8
  }
7
9
  }
8
10
  export class Schemer {
9
- constructor(config) {
10
- this.render = config.render;
11
+ constructor(refPointerPrefix) {
12
+ this.refPointerPrefix = refPointerPrefix;
11
13
  }
12
- static config(config) {
13
- this.default = new this(config);
14
+ render(target) {
15
+ return targetConstructorToSchema(target, {
16
+ classTransformerMetadataStorage: defaultMetadataStorage,
17
+ refPointerPrefix: this.refPointerPrefix,
18
+ });
14
19
  }
15
20
  }
16
21
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/defines/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAIjD,MAAM,OAAO,UAAW,SAAQ,OAAO;IAAvC;;QAGE,gBAAW,GAAoC,IAAI,GAAG,EAAE,CAAC;IAC3D,CAAC;CAAA;AAED,MAAM,OAAO,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"}
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/defines/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAyB,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAUvE,MAAM,OAAO,UAAW,SAAQ,OAAO;IAAvC;;QAIE,gBAAW,GAAoC,IAAI,GAAG,EAAE,CAAC;IAI3D,CAAC;CAAA;AAED,MAAM,OAAO,OAAO;IAOlB,YAAY,gBAAwB;QAClC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAG3C,CAAC;IAGD,MAAM,CAAC,MAAmB;QACxB,OAAO,yBAAyB,CAAC,MAAM,EAAE;YACvC,+BAA+B,EAAE,sBAAsB;YACvD,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;SACxC,CAAC,CAAC;IACL,CAAC;CAYF"}
@@ -0,0 +1,247 @@
1
+ import { Allow, IsBoolean, IsDate, IsEnum, IsNumber, IsOptional, IsString } from "class-validator";
2
+ import { Max, MaxDate, MaxLength, Min, MinDate, MinLength, ValidateNested } from "class-validator";
3
+ import { Exclude, Transform, Type } from "class-transformer";
4
+ import { DecoratorsQueueStore } from "@aom-js/core";
5
+ import { JSONSchema } from "class-validator-jsonschema";
6
+ import { SchemaTypes } from "./types";
7
+ import { AomSchemas } from "./module";
8
+ import { IsNullable } from "./helpers";
9
+ function checkExistsSchemaParams($) {
10
+ if ($.schemaParams) {
11
+ throw new Error(`${$._.target.name}.${String($._.property)} already has defined schema params`);
12
+ }
13
+ }
14
+ const _String = (params) => {
15
+ return AomSchemas.propertyDecorator(($) => {
16
+ checkExistsSchemaParams($);
17
+ $.schemaName = SchemaTypes.STRING;
18
+ $.schemaParams = params;
19
+ const { originInstance, property } = $._;
20
+ const decorators = [
21
+ IsString({
22
+ each: params.isArray,
23
+ message: params.message,
24
+ groups: params.groups,
25
+ always: params.always,
26
+ }),
27
+ params.isOptional ? IsOptional() : undefined,
28
+ params.maxLength ? MaxLength(params.maxLength) : undefined,
29
+ params.minLength ? MinLength(params.minLength) : undefined,
30
+ params.nullable ? IsNullable() : undefined,
31
+ params.exclude ? Exclude() : undefined,
32
+ JSONSchema({
33
+ description: params.description,
34
+ deprecated: params.deprecated,
35
+ nullable: params.nullable,
36
+ default: params.default,
37
+ examples: params.examples,
38
+ readOnly: params.readOnly,
39
+ }),
40
+ ...(params.decorators || []),
41
+ ].filter(Boolean);
42
+ Reflect.decorate(decorators, originInstance, property);
43
+ }, DecoratorsQueueStore.LAST);
44
+ };
45
+ const _Number = (params) => {
46
+ return AomSchemas.propertyDecorator(($) => {
47
+ checkExistsSchemaParams($);
48
+ $.schemaName = SchemaTypes.NUMBER;
49
+ $.schemaParams = params;
50
+ const { originInstance, property } = $._;
51
+ const decorators = [
52
+ IsNumber({}, {
53
+ each: params.isArray,
54
+ message: params.message,
55
+ groups: params.groups,
56
+ always: params.always,
57
+ }),
58
+ params.isOptional ? IsOptional() : undefined,
59
+ params.maxValue ? Max(params.maxValue) : undefined,
60
+ params.minValue ? Min(params.minValue) : undefined,
61
+ params.exclude ? Exclude() : undefined,
62
+ JSONSchema({
63
+ description: params.description,
64
+ deprecated: params.deprecated,
65
+ nullable: params.nullable,
66
+ default: params.default,
67
+ examples: params.examples,
68
+ readOnly: params.readOnly,
69
+ }),
70
+ Transform(({ value }) => {
71
+ if (params.nullable && value === null)
72
+ return null;
73
+ return Number(value);
74
+ }),
75
+ ...(params.decorators || []),
76
+ ].filter(Boolean);
77
+ Reflect.decorate(decorators, originInstance, property);
78
+ }, DecoratorsQueueStore.LAST);
79
+ };
80
+ const _Boolean = (params) => {
81
+ return AomSchemas.propertyDecorator(($) => {
82
+ checkExistsSchemaParams($);
83
+ $.schemaName = SchemaTypes.BOOLEAN;
84
+ $.schemaParams = params;
85
+ const { originInstance, property } = $._;
86
+ const decorators = [
87
+ IsBoolean({
88
+ each: params.isArray,
89
+ message: params.message,
90
+ groups: params.groups,
91
+ always: params.always,
92
+ }),
93
+ params.isOptional ? IsOptional() : undefined,
94
+ params.nullable ? IsNullable() : undefined,
95
+ params.exclude ? Exclude() : undefined,
96
+ JSONSchema({
97
+ description: params.description,
98
+ deprecated: params.deprecated,
99
+ nullable: params.nullable,
100
+ default: params.default,
101
+ examples: params.examples,
102
+ readOnly: params.readOnly,
103
+ }),
104
+ Transform(({ value }) => {
105
+ if (params.nullable && value === null)
106
+ return null;
107
+ const isTrue = value === "true";
108
+ const isFalse = value === "false";
109
+ if (isTrue)
110
+ return true;
111
+ if (isFalse)
112
+ return false;
113
+ return typeof value === "boolean" ? value : Boolean(+value);
114
+ }),
115
+ ...(params.decorators || []),
116
+ ].filter(Boolean);
117
+ Reflect.decorate(decorators, originInstance, property);
118
+ }, DecoratorsQueueStore.LAST);
119
+ };
120
+ const _Any = (params) => {
121
+ return AomSchemas.propertyDecorator(($) => {
122
+ checkExistsSchemaParams($);
123
+ $.schemaName = SchemaTypes.ANY;
124
+ $.schemaParams = params;
125
+ const { originInstance, property } = $._;
126
+ const decorators = [
127
+ Allow({
128
+ each: params.isArray,
129
+ message: params.message,
130
+ groups: params.groups,
131
+ always: params.always,
132
+ }),
133
+ params.isOptional ? IsOptional() : undefined,
134
+ params.nullable ? IsNullable() : undefined,
135
+ params.exclude ? Exclude() : undefined,
136
+ JSONSchema({
137
+ description: params.description,
138
+ deprecated: params.deprecated,
139
+ nullable: params.nullable,
140
+ default: params.default,
141
+ examples: params.examples,
142
+ readOnly: params.readOnly,
143
+ }),
144
+ ...(params.decorators || []),
145
+ ].filter(Boolean);
146
+ Reflect.decorate(decorators, originInstance, property);
147
+ }, DecoratorsQueueStore.LAST);
148
+ };
149
+ const _Enum = (params) => {
150
+ return AomSchemas.propertyDecorator(($) => {
151
+ checkExistsSchemaParams($);
152
+ $.schemaName = SchemaTypes.ENUM;
153
+ $.schemaParams = params;
154
+ const { originInstance, property } = $._;
155
+ const decorators = [
156
+ IsEnum(params.value, {
157
+ each: params.isArray,
158
+ message: params.message,
159
+ groups: params.groups,
160
+ always: params.always,
161
+ }),
162
+ params.isOptional ? IsOptional() : undefined,
163
+ params.nullable ? IsNullable() : undefined,
164
+ params.exclude ? Exclude() : undefined,
165
+ JSONSchema({
166
+ description: params.description,
167
+ deprecated: params.deprecated,
168
+ nullable: params.nullable,
169
+ default: params.default,
170
+ examples: params.examples,
171
+ }),
172
+ ...(params.decorators || []),
173
+ ].filter(Boolean);
174
+ Reflect.decorate(decorators, originInstance, property);
175
+ }, DecoratorsQueueStore.LAST);
176
+ };
177
+ const _Date = (params) => {
178
+ return AomSchemas.propertyDecorator(($) => {
179
+ checkExistsSchemaParams($);
180
+ $.schemaName = SchemaTypes.DATE;
181
+ $.schemaParams = params;
182
+ const { target, property } = $._;
183
+ const decorators = [
184
+ IsDate({
185
+ each: params.isArray,
186
+ message: params.message,
187
+ groups: params.groups,
188
+ always: params.always,
189
+ }),
190
+ params.maxDate ? MaxDate(params.maxDate) : undefined,
191
+ params.minDate ? MinDate(params.minDate) : undefined,
192
+ params.isOptional ? IsOptional() : undefined,
193
+ params.nullable ? IsNullable() : undefined,
194
+ params.exclude ? Exclude() : undefined,
195
+ JSONSchema({
196
+ description: params.description,
197
+ deprecated: params.deprecated,
198
+ nullable: params.nullable,
199
+ default: params.default,
200
+ examples: params.examples,
201
+ }),
202
+ Transform(({ value }) => {
203
+ if (params.nullable && value === null)
204
+ return null;
205
+ return new Date(value);
206
+ }),
207
+ ].filter(Boolean);
208
+ Reflect.decorate(decorators, Object.getPrototypeOf(target), property);
209
+ }, DecoratorsQueueStore.LAST);
210
+ };
211
+ const _Type = (params) => {
212
+ return AomSchemas.propertyDecorator(($) => {
213
+ checkExistsSchemaParams($);
214
+ $.schemaParams = params;
215
+ $.schemaName = SchemaTypes.TYPE;
216
+ const { originInstance, property } = $._;
217
+ $._.root.connections.set(property, params.value);
218
+ const decorators = [
219
+ Type(params.value),
220
+ ValidateNested({
221
+ each: params.isArray,
222
+ message: params.message,
223
+ groups: params.groups,
224
+ always: params.always,
225
+ }),
226
+ params.isOptional ? IsOptional() : undefined,
227
+ params.nullable ? IsNullable() : undefined,
228
+ params.exclude ? Exclude() : undefined,
229
+ JSONSchema({
230
+ description: params.description,
231
+ deprecated: params.deprecated,
232
+ nullable: params.nullable,
233
+ }),
234
+ ].filter(Boolean);
235
+ Reflect.decorate(decorators, originInstance, property);
236
+ }, DecoratorsQueueStore.LAST);
237
+ };
238
+ export const PropertySchema = {
239
+ [SchemaTypes.STRING]: _String,
240
+ [SchemaTypes.NUMBER]: _Number,
241
+ [SchemaTypes.DATE]: _Date,
242
+ [SchemaTypes.BOOLEAN]: _Boolean,
243
+ [SchemaTypes.ENUM]: _Enum,
244
+ [SchemaTypes.ANY]: _Any,
245
+ [SchemaTypes.TYPE]: _Type,
246
+ };
247
+ //# sourceMappingURL=properties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/defines/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE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C,IAAI,CAAC,EAAE,KAAK;IACzB,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,QAAQ;IAC/B,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,KAAK;IACzB,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,IAAI;IACvB,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,KAAK;CAC1B,CAAC"}
@@ -1,2 +1,11 @@
1
- export {};
1
+ export var SchemaTypes;
2
+ (function (SchemaTypes) {
3
+ SchemaTypes["STRING"] = "String";
4
+ SchemaTypes["DATE"] = "Date";
5
+ SchemaTypes["NUMBER"] = "Number";
6
+ SchemaTypes["BOOLEAN"] = "Boolean";
7
+ SchemaTypes["ENUM"] = "Enum";
8
+ SchemaTypes["ANY"] = "Any";
9
+ SchemaTypes["TYPE"] = "Type";
10
+ })(SchemaTypes || (SchemaTypes = {}));
2
11
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/defines/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/defines/types.ts"],"names":[],"mappings":"AAsCA,MAAM,CAAN,IAAY,WAQX;AARD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,gCAAiB,CAAA;IACjB,kCAAmB,CAAA;IACnB,4BAAa,CAAA;IACb,0BAAW,CAAA;IACX,4BAAa,CAAA;AACf,CAAC,EARW,WAAW,KAAX,WAAW,QAQtB"}
package/dist/mjs/index.js CHANGED
@@ -1,4 +1,7 @@
1
+ import "reflect-metadata";
1
2
  export * from "./defines/decorators";
2
3
  export * from "./defines/types";
3
4
  export * from "./defines/module";
5
+ export { PropertySchema } from "./defines/properties";
6
+ export * from "./defines/mapped-types";
4
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,cAAc,wBAAwB,CAAC"}
@@ -1,4 +1,2 @@
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;
@@ -0,0 +1 @@
1
+ export * from "./is-nullable";
@@ -0,0 +1,2 @@
1
+ import { ValidationOptions } from "class-validator";
2
+ export declare function IsNullable(validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,5 @@
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';
@@ -0,0 +1,10 @@
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 {};
@@ -0,0 +1,4 @@
1
+ import { Type } from "./type.interface";
2
+ export interface MappedType<T> extends Type<T> {
3
+ new (): T;
4
+ }
@@ -0,0 +1,4 @@
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>>;
@@ -0,0 +1,4 @@
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>>;
@@ -0,0 +1,4 @@
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>>;
@@ -0,0 +1 @@
1
+ export type Type<T = any> = new (...args: any[]) => T;
@@ -0,0 +1,5 @@
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 {};
@@ -1,12 +1,15 @@
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
  }
@@ -0,0 +1,41 @@
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 {};
@@ -1,6 +1,28 @@
1
1
  import { ClassConstructor } from "@aom-js/core";
2
- export declare type ConnectionSchema = (() => ClassConstructor) | ClassConstructor;
3
- export declare type RenderHandler = (target: ClassConstructor) => any;
4
- export declare interface SchemerConfig {
5
- render: RenderHandler;
2
+ import { ValidationArguments } from "class-validator";
3
+ export declare type ConnectionSchema = () => ClassConstructor;
4
+ export declare interface BaseDescriptionsProperties {
5
+ description?: string;
6
+ deprecated?: boolean;
7
+ }
8
+ export declare interface CommonDescriptionsProperties extends BaseDescriptionsProperties {
9
+ nullable?: boolean;
10
+ examples?: any[];
11
+ isOptional?: boolean;
12
+ exclude?: boolean;
13
+ readOnly?: boolean;
14
+ isArray?: boolean;
15
+ message?: string | ((validationArguments: ValidationArguments) => string);
16
+ groups?: string[];
17
+ always?: boolean;
18
+ decorators?: PropertyDecorator[];
19
+ }
20
+ export declare enum SchemaTypes {
21
+ STRING = "String",
22
+ DATE = "Date",
23
+ NUMBER = "Number",
24
+ BOOLEAN = "Boolean",
25
+ ENUM = "Enum",
26
+ ANY = "Any",
27
+ TYPE = "Type"
6
28
  }
@@ -1,3 +1,6 @@
1
+ import "reflect-metadata";
1
2
  export * from "./defines/decorators";
2
3
  export * from "./defines/types";
3
4
  export * from "./defines/module";
5
+ export { PropertySchema } from "./defines/properties";
6
+ export * from "./defines/mapped-types";
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.2",
2
+ "version": "0.0.4",
3
3
  "name": "@aom-js/schemer",
4
4
  "description": "`@aom` meta-framework schemer code",
5
5
  "homepage": "https://github.com/aom-js/main#readme",
@@ -14,7 +14,11 @@
14
14
  "license": "ISC",
15
15
  "author": "Grigory B. Kholstinnikov (scarych)",
16
16
  "dependencies": {
17
- "@aom-js/core": "^0.0.1"
17
+ "@aom-js/core": "^0.0.2",
18
+ "class-transformer": "^0.5.1",
19
+ "class-validator": "^0.14.2",
20
+ "class-validator-jsonschema": "^5.1.0",
21
+ "reflect-metadata": "^0.2.2"
18
22
  },
19
23
  "devDependencies": {
20
24
  "@types/node": "^22.14.0",