@solid-nestjs/common 0.2.8 → 0.2.9

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 (161) hide show
  1. package/dist/adapters/index.d.ts +7 -0
  2. package/dist/adapters/index.d.ts.map +1 -0
  3. package/dist/adapters/index.js +23 -0
  4. package/dist/adapters/index.js.map +1 -0
  5. package/dist/adapters/validation.adapter.d.ts +20 -0
  6. package/dist/adapters/validation.adapter.d.ts.map +1 -0
  7. package/dist/adapters/validation.adapter.js +309 -0
  8. package/dist/adapters/validation.adapter.js.map +1 -0
  9. package/dist/decorator-registry/decorator-registry.d.ts +54 -0
  10. package/dist/decorator-registry/decorator-registry.d.ts.map +1 -0
  11. package/dist/decorator-registry/decorator-registry.js +161 -0
  12. package/dist/decorator-registry/decorator-registry.js.map +1 -0
  13. package/dist/decorator-registry/index.d.ts +2 -0
  14. package/dist/decorator-registry/index.d.ts.map +1 -0
  15. package/dist/decorator-registry/index.js +18 -0
  16. package/dist/decorator-registry/index.js.map +1 -0
  17. package/dist/decorators/index.d.ts +6 -0
  18. package/dist/decorators/index.d.ts.map +1 -1
  19. package/dist/decorators/index.js +6 -0
  20. package/dist/decorators/index.js.map +1 -1
  21. package/dist/decorators/solid-entity.decorator.d.ts +6 -0
  22. package/dist/decorators/solid-entity.decorator.d.ts.map +1 -0
  23. package/dist/decorators/solid-entity.decorator.js +23 -0
  24. package/dist/decorators/solid-entity.decorator.js.map +1 -0
  25. package/dist/decorators/solid-field.decorator.d.ts +7 -0
  26. package/dist/decorators/solid-field.decorator.d.ts.map +1 -0
  27. package/dist/decorators/solid-field.decorator.js +51 -0
  28. package/dist/decorators/solid-field.decorator.js.map +1 -0
  29. package/dist/decorators/solid-id.decorator.d.ts +9 -0
  30. package/dist/decorators/solid-id.decorator.d.ts.map +1 -0
  31. package/dist/decorators/solid-id.decorator.js +27 -0
  32. package/dist/decorators/solid-id.decorator.js.map +1 -0
  33. package/dist/decorators/solid-input.decorator.d.ts +6 -0
  34. package/dist/decorators/solid-input.decorator.d.ts.map +1 -0
  35. package/dist/decorators/solid-input.decorator.js +35 -0
  36. package/dist/decorators/solid-input.decorator.js.map +1 -0
  37. package/dist/decorators/solid-relation.decorator.d.ts +19 -0
  38. package/dist/decorators/solid-relation.decorator.d.ts.map +1 -0
  39. package/dist/decorators/solid-relation.decorator.js +66 -0
  40. package/dist/decorators/solid-relation.decorator.js.map +1 -0
  41. package/dist/decorators/solid-timestamp.decorator.d.ts +13 -0
  42. package/dist/decorators/solid-timestamp.decorator.d.ts.map +1 -0
  43. package/dist/decorators/solid-timestamp.decorator.js +49 -0
  44. package/dist/decorators/solid-timestamp.decorator.js.map +1 -0
  45. package/dist/helpers/args-helpers/class-generator.helper.d.ts +143 -0
  46. package/dist/helpers/args-helpers/class-generator.helper.d.ts.map +1 -0
  47. package/dist/helpers/args-helpers/class-generator.helper.js +221 -0
  48. package/dist/helpers/args-helpers/class-generator.helper.js.map +1 -0
  49. package/dist/helpers/args-helpers/create-groupby-request.helper.d.ts +83 -0
  50. package/dist/helpers/args-helpers/create-groupby-request.helper.d.ts.map +1 -0
  51. package/dist/helpers/args-helpers/create-groupby-request.helper.js +119 -0
  52. package/dist/helpers/args-helpers/create-groupby-request.helper.js.map +1 -0
  53. package/dist/helpers/args-helpers/decorator-builder.helper.d.ts +160 -0
  54. package/dist/helpers/args-helpers/decorator-builder.helper.d.ts.map +1 -0
  55. package/dist/helpers/args-helpers/decorator-builder.helper.js +161 -0
  56. package/dist/helpers/args-helpers/decorator-builder.helper.js.map +1 -0
  57. package/dist/helpers/args-helpers/field-config.helper.d.ts +98 -0
  58. package/dist/helpers/args-helpers/field-config.helper.d.ts.map +1 -0
  59. package/dist/helpers/args-helpers/field-config.helper.js +143 -0
  60. package/dist/helpers/args-helpers/field-config.helper.js.map +1 -0
  61. package/dist/helpers/args-helpers/groupby-args-from.helper.d.ts +87 -0
  62. package/dist/helpers/args-helpers/groupby-args-from.helper.d.ts.map +1 -0
  63. package/dist/helpers/args-helpers/groupby-args-from.helper.js +185 -0
  64. package/dist/helpers/args-helpers/groupby-args-from.helper.js.map +1 -0
  65. package/dist/helpers/args-helpers/index.d.ts +15 -0
  66. package/dist/helpers/args-helpers/index.d.ts.map +1 -0
  67. package/dist/helpers/args-helpers/index.js +58 -0
  68. package/dist/helpers/args-helpers/index.js.map +1 -0
  69. package/dist/helpers/args-helpers/type-inference.helper.d.ts +191 -0
  70. package/dist/helpers/args-helpers/type-inference.helper.d.ts.map +1 -0
  71. package/dist/helpers/args-helpers/type-inference.helper.js +330 -0
  72. package/dist/helpers/args-helpers/type-inference.helper.js.map +1 -0
  73. package/dist/helpers/class-generation/dynamic-class.helper.d.ts +101 -0
  74. package/dist/helpers/class-generation/dynamic-class.helper.d.ts.map +1 -0
  75. package/dist/helpers/class-generation/dynamic-class.helper.js +180 -0
  76. package/dist/helpers/class-generation/dynamic-class.helper.js.map +1 -0
  77. package/dist/helpers/class-generation/index.d.ts +9 -0
  78. package/dist/helpers/class-generation/index.d.ts.map +1 -0
  79. package/dist/helpers/class-generation/index.js +18 -0
  80. package/dist/helpers/class-generation/index.js.map +1 -0
  81. package/dist/helpers/decorators/decorator-utils.helper.d.ts +75 -0
  82. package/dist/helpers/decorators/decorator-utils.helper.d.ts.map +1 -0
  83. package/dist/helpers/decorators/decorator-utils.helper.js +92 -0
  84. package/dist/helpers/decorators/decorator-utils.helper.js.map +1 -0
  85. package/dist/helpers/decorators/index.d.ts +9 -0
  86. package/dist/helpers/decorators/index.d.ts.map +1 -0
  87. package/dist/helpers/decorators/index.js +16 -0
  88. package/dist/helpers/decorators/index.js.map +1 -0
  89. package/dist/helpers/dto-generator-base.helper.d.ts +19 -0
  90. package/dist/helpers/dto-generator-base.helper.d.ts.map +1 -0
  91. package/dist/helpers/dto-generator-base.helper.js +72 -0
  92. package/dist/helpers/dto-generator-base.helper.js.map +1 -0
  93. package/dist/helpers/index.d.ts +9 -0
  94. package/dist/helpers/index.d.ts.map +1 -1
  95. package/dist/helpers/index.js +9 -0
  96. package/dist/helpers/index.js.map +1 -1
  97. package/dist/helpers/metadata-extractor.helper.d.ts +26 -0
  98. package/dist/helpers/metadata-extractor.helper.d.ts.map +1 -0
  99. package/dist/helpers/metadata-extractor.helper.js +67 -0
  100. package/dist/helpers/metadata-extractor.helper.js.map +1 -0
  101. package/dist/helpers/package-detector.helper.d.ts +33 -0
  102. package/dist/helpers/package-detector.helper.d.ts.map +1 -0
  103. package/dist/helpers/package-detector.helper.js +82 -0
  104. package/dist/helpers/package-detector.helper.js.map +1 -0
  105. package/dist/helpers/property-filter.helper.d.ts +15 -0
  106. package/dist/helpers/property-filter.helper.d.ts.map +1 -0
  107. package/dist/helpers/property-filter.helper.js +44 -0
  108. package/dist/helpers/property-filter.helper.js.map +1 -0
  109. package/dist/helpers/type-inference.helper.d.ts +76 -0
  110. package/dist/helpers/type-inference.helper.d.ts.map +1 -0
  111. package/dist/helpers/type-inference.helper.js +205 -0
  112. package/dist/helpers/type-inference.helper.js.map +1 -0
  113. package/dist/helpers/validation-inference.helper.d.ts +18 -0
  114. package/dist/helpers/validation-inference.helper.d.ts.map +1 -0
  115. package/dist/helpers/validation-inference.helper.js +100 -0
  116. package/dist/helpers/validation-inference.helper.js.map +1 -0
  117. package/dist/index.d.ts +4 -0
  118. package/dist/index.d.ts.map +1 -1
  119. package/dist/index.js +4 -0
  120. package/dist/index.js.map +1 -1
  121. package/dist/interfaces/adapters/decorator-adapter.interface.d.ts +8 -0
  122. package/dist/interfaces/adapters/decorator-adapter.interface.d.ts.map +1 -0
  123. package/dist/interfaces/adapters/decorator-adapter.interface.js +3 -0
  124. package/dist/interfaces/adapters/decorator-adapter.interface.js.map +1 -0
  125. package/dist/interfaces/decorators/solid-field-options.interface.d.ts +55 -0
  126. package/dist/interfaces/decorators/solid-field-options.interface.d.ts.map +1 -0
  127. package/dist/interfaces/decorators/solid-field-options.interface.js +3 -0
  128. package/dist/interfaces/decorators/solid-field-options.interface.js.map +1 -0
  129. package/dist/interfaces/index.d.ts +3 -0
  130. package/dist/interfaces/index.d.ts.map +1 -1
  131. package/dist/interfaces/index.js +3 -0
  132. package/dist/interfaces/index.js.map +1 -1
  133. package/dist/interfaces/metadata/field-metadata.interface.d.ts +29 -0
  134. package/dist/interfaces/metadata/field-metadata.interface.d.ts.map +1 -0
  135. package/dist/interfaces/metadata/field-metadata.interface.js +3 -0
  136. package/dist/interfaces/metadata/field-metadata.interface.js.map +1 -0
  137. package/dist/metadata/index.d.ts +2 -0
  138. package/dist/metadata/index.d.ts.map +1 -0
  139. package/dist/metadata/index.js +18 -0
  140. package/dist/metadata/index.js.map +1 -0
  141. package/dist/metadata/metadata-storage.d.ts +54 -0
  142. package/dist/metadata/metadata-storage.d.ts.map +1 -0
  143. package/dist/metadata/metadata-storage.js +106 -0
  144. package/dist/metadata/metadata-storage.js.map +1 -0
  145. package/dist/registry/index.d.ts +2 -0
  146. package/dist/registry/index.d.ts.map +1 -0
  147. package/dist/registry/index.js +18 -0
  148. package/dist/registry/index.js.map +1 -0
  149. package/dist/registry/relation-adapter-registry.d.ts +11 -0
  150. package/dist/registry/relation-adapter-registry.d.ts.map +1 -0
  151. package/dist/registry/relation-adapter-registry.js +30 -0
  152. package/dist/registry/relation-adapter-registry.js.map +1 -0
  153. package/dist/types/dto-generation.types.d.ts +46 -0
  154. package/dist/types/dto-generation.types.d.ts.map +1 -0
  155. package/dist/types/dto-generation.types.js +6 -0
  156. package/dist/types/dto-generation.types.js.map +1 -0
  157. package/dist/types/index.d.ts +1 -0
  158. package/dist/types/index.d.ts.map +1 -1
  159. package/dist/types/index.js +1 -0
  160. package/dist/types/index.js.map +1 -1
  161. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property-filter.helper.js","sourceRoot":"","sources":["../../src/helpers/property-filter.helper.ts"],"names":[],"mappings":";;AAWA,4CAaC;AAKD,oDAeC;AAMD,8DASC;AA1DD,2EAKqC;AAErC;;GAEG;AACH,SAAgB,gBAAgB,CAC9B,WAAiB,EACjB,aAAuB,EACvB,kBAA6B;IAE7B,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxD,+BAA+B;QAC/B,yBAAyB,CAAC,WAAW,EAAE,aAAa,EAAE,kBAAkB,CAAC,CAAC;QAC1E,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED,oDAAoD;IACpD,OAAO,oBAAoB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;AAC1D,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAClC,WAAiB,EACjB,aAAuB;IAEvB,OAAO,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QACjC,qBAAqB;QACrB,IAAI,IAAA,yCAAa,EAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QAEtC,yBAAyB;QACzB,IAAI,IAAA,6CAAiB,EAAC,WAAW,EAAE,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QAEvD,0BAA0B;QAC1B,MAAM,IAAI,GAAG,IAAA,iDAAqB,EAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QACtD,OAAO,IAAA,sCAAU,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,SAAgB,yBAAyB,CACvC,WAAiB,EACjB,aAAuB,EACvB,kBAA4B,EAC5B,oBAA6B,KAAK;IAElC,6CAA6C;IAC7C,gFAAgF;IAChF,4DAA4D;AAC9D,CAAC"}
@@ -0,0 +1,76 @@
1
+ import 'reflect-metadata';
2
+ export interface TypeInfo {
3
+ type: any;
4
+ isOptional: boolean;
5
+ isArray: boolean;
6
+ arrayElementType?: any;
7
+ isEnum: boolean;
8
+ isPrimitive: boolean;
9
+ isDate: boolean;
10
+ isObject: boolean;
11
+ }
12
+ /**
13
+ * Infers type information from reflection metadata
14
+ */
15
+ export declare function inferTypeFromMetadata(target: any, propertyKey: string | symbol): TypeInfo;
16
+ /**
17
+ * Checks if a property is optional based on TypeScript metadata
18
+ */
19
+ export declare function isOptionalProperty(target: any, propertyKey: string | symbol): boolean;
20
+ /**
21
+ * More reliable optional detection using TypeScript compiler API metadata
22
+ * This would require additional setup with TypeScript transformers
23
+ */
24
+ export declare function isOptionalType(type: any): boolean;
25
+ /**
26
+ * Checks if a type represents an array
27
+ */
28
+ export declare function isArrayType(type: any): boolean;
29
+ /**
30
+ * Gets the element type of an array type
31
+ */
32
+ export declare function getArrayElementType(type: any): any;
33
+ /**
34
+ * Checks if a type is an enum
35
+ */
36
+ export declare function isEnumType(type: any): boolean;
37
+ /**
38
+ * Checks if a type is a primitive type
39
+ */
40
+ export declare function isPrimitiveType(type: any): boolean;
41
+ /**
42
+ * Checks if a type is a Date
43
+ */
44
+ export declare function isDateType(type: any): boolean;
45
+ /**
46
+ * Checks if a type is an object type (not primitive, not array, not date)
47
+ */
48
+ export declare function isObjectType(type: any): boolean;
49
+ /**
50
+ * Gets the constructor name of a type
51
+ */
52
+ export declare function getTypeDisplayName(type: any): string;
53
+ /**
54
+ * Maps TypeScript types to database column types
55
+ */
56
+ export declare function mapTypeToColumnType(type: any): string;
57
+ /**
58
+ * Generic type mapping utility - each adapter can use this as base
59
+ */
60
+ export declare function createTypeMapper<T>(typeMap: Map<any, T>, defaultValue: T): (type: any) => T;
61
+ /**
62
+ * Enhanced optional detection using property descriptor
63
+ */
64
+ export declare function detectOptionalFromDescriptor(target: any, propertyKey: string | symbol): boolean;
65
+ /**
66
+ * Utility to extract generic type information (limited at runtime)
67
+ */
68
+ export declare function extractGenericTypes(target: any, propertyKey: string | symbol): any[];
69
+ /**
70
+ * Enhanced type detection that checks for array properties and their element types
71
+ */
72
+ export declare function detectArrayInfo(target: any, propertyKey: string | symbol): {
73
+ isArray: boolean;
74
+ elementType?: any;
75
+ };
76
+ //# sourceMappingURL=type-inference.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-inference.helper.d.ts","s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AAE,GAAG,GAAG,MAAM,CAWrD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,IACvD,MAAM,GAAG,KAAG,CAAC,CAG9B;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,GAAG,EACX,WAAW,EAAE,MAAM,GAAG,MAAM,GAC3B,OAAO,CAuBT;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,EAAE,CAUpF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG;IAC1E,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,GAAG,CAAC;CACnB,CAoBA"}
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.inferTypeFromMetadata = inferTypeFromMetadata;
4
+ exports.isOptionalProperty = isOptionalProperty;
5
+ exports.isOptionalType = isOptionalType;
6
+ exports.isArrayType = isArrayType;
7
+ exports.getArrayElementType = getArrayElementType;
8
+ exports.isEnumType = isEnumType;
9
+ exports.isPrimitiveType = isPrimitiveType;
10
+ exports.isDateType = isDateType;
11
+ exports.isObjectType = isObjectType;
12
+ exports.getTypeDisplayName = getTypeDisplayName;
13
+ exports.mapTypeToColumnType = mapTypeToColumnType;
14
+ exports.createTypeMapper = createTypeMapper;
15
+ exports.detectOptionalFromDescriptor = detectOptionalFromDescriptor;
16
+ exports.extractGenericTypes = extractGenericTypes;
17
+ exports.detectArrayInfo = detectArrayInfo;
18
+ require("reflect-metadata");
19
+ /**
20
+ * Infers type information from reflection metadata
21
+ */
22
+ function inferTypeFromMetadata(target, propertyKey) {
23
+ const designType = Reflect.getMetadata('design:type', target, propertyKey);
24
+ const paramTypes = Reflect.getMetadata('design:paramtypes', target, propertyKey);
25
+ return {
26
+ type: designType,
27
+ isOptional: isOptionalProperty(target, propertyKey),
28
+ isArray: isArrayType(designType),
29
+ arrayElementType: getArrayElementType(designType),
30
+ isEnum: isEnumType(designType),
31
+ isPrimitive: isPrimitiveType(designType),
32
+ isDate: designType === Date,
33
+ isObject: isObjectType(designType),
34
+ };
35
+ }
36
+ /**
37
+ * Checks if a property is optional based on TypeScript metadata
38
+ */
39
+ function isOptionalProperty(target, propertyKey) {
40
+ // TypeScript optional information is lost at runtime, so we can't reliably detect it
41
+ // The SolidField decorator should use explicit options instead
42
+ // Return false by default - let the decorator options determine optionality
43
+ return false;
44
+ }
45
+ /**
46
+ * More reliable optional detection using TypeScript compiler API metadata
47
+ * This would require additional setup with TypeScript transformers
48
+ */
49
+ function isOptionalType(type) {
50
+ // Check if type includes undefined (union type)
51
+ if (type === undefined) {
52
+ return true;
53
+ }
54
+ // Check for union types that include undefined
55
+ // This is a simplified check - in reality we'd need more sophisticated type checking
56
+ return false;
57
+ }
58
+ /**
59
+ * Checks if a type represents an array
60
+ */
61
+ function isArrayType(type) {
62
+ return type === Array ||
63
+ (type && type.prototype && type.prototype.constructor === Array) ||
64
+ Array.isArray(type);
65
+ }
66
+ /**
67
+ * Gets the element type of an array type
68
+ */
69
+ function getArrayElementType(type) {
70
+ if (Array.isArray(type) && type.length > 0) {
71
+ return type[0];
72
+ }
73
+ // For generic arrays, we can't determine the element type at runtime
74
+ // without additional metadata
75
+ return undefined;
76
+ }
77
+ /**
78
+ * Checks if a type is an enum
79
+ */
80
+ function isEnumType(type) {
81
+ if (!type || typeof type !== 'object') {
82
+ return false;
83
+ }
84
+ // Check if it's an enum by checking if it has numeric and string keys
85
+ const keys = Object.keys(type);
86
+ const values = Object.values(type);
87
+ // TypeScript enums have both numeric and string keys
88
+ const hasStringKeys = keys.some(key => isNaN(Number(key)));
89
+ const hasNumericValues = values.some(value => typeof value === 'number');
90
+ return hasStringKeys && (hasNumericValues || values.every(value => typeof value === 'string'));
91
+ }
92
+ /**
93
+ * Checks if a type is a primitive type
94
+ */
95
+ function isPrimitiveType(type) {
96
+ return [String, Number, Boolean, Symbol, BigInt].includes(type);
97
+ }
98
+ /**
99
+ * Checks if a type is a Date
100
+ */
101
+ function isDateType(type) {
102
+ return type === Date;
103
+ }
104
+ /**
105
+ * Checks if a type is an object type (not primitive, not array, not date)
106
+ */
107
+ function isObjectType(type) {
108
+ return type &&
109
+ typeof type === 'function' &&
110
+ !isPrimitiveType(type) &&
111
+ !isDateType(type) &&
112
+ !isArrayType(type) &&
113
+ type !== Object;
114
+ }
115
+ /**
116
+ * Gets the constructor name of a type
117
+ */
118
+ function getTypeDisplayName(type) {
119
+ if (!type)
120
+ return 'unknown';
121
+ if (typeof type === 'function')
122
+ return type.name || 'Function';
123
+ if (typeof type === 'object')
124
+ return type.constructor?.name || 'Object';
125
+ return typeof type;
126
+ }
127
+ /**
128
+ * Maps TypeScript types to database column types
129
+ */
130
+ function mapTypeToColumnType(type) {
131
+ const typeMap = new Map([
132
+ [String, 'varchar'],
133
+ [Number, 'int'],
134
+ [Boolean, 'boolean'],
135
+ [Date, 'timestamp'],
136
+ [Buffer, 'blob'],
137
+ [Object, 'json'],
138
+ ]);
139
+ return typeMap.get(type) || 'varchar';
140
+ }
141
+ /**
142
+ * Generic type mapping utility - each adapter can use this as base
143
+ */
144
+ function createTypeMapper(typeMap, defaultValue) {
145
+ return function (type) {
146
+ return typeMap.get(type) || defaultValue;
147
+ };
148
+ }
149
+ /**
150
+ * Enhanced optional detection using property descriptor
151
+ */
152
+ function detectOptionalFromDescriptor(target, propertyKey) {
153
+ const descriptor = Object.getOwnPropertyDescriptor(target, propertyKey);
154
+ if (descriptor) {
155
+ // Check if it has a getter (computed property)
156
+ if (descriptor.get) {
157
+ return false; // Getters are usually not optional
158
+ }
159
+ // Check if it has an initial value of undefined
160
+ if (descriptor.value === undefined && descriptor.writable) {
161
+ return true;
162
+ }
163
+ }
164
+ // Check in constructor parameters (if available)
165
+ const paramTypes = Reflect.getMetadata('design:paramtypes', target.constructor);
166
+ if (paramTypes) {
167
+ // This would require more sophisticated analysis of constructor parameters
168
+ // to determine which properties are optional
169
+ }
170
+ return false;
171
+ }
172
+ /**
173
+ * Utility to extract generic type information (limited at runtime)
174
+ */
175
+ function extractGenericTypes(target, propertyKey) {
176
+ // This is very limited at runtime in TypeScript
177
+ // Would require compile-time analysis or additional metadata
178
+ const designType = Reflect.getMetadata('design:type', target, propertyKey);
179
+ if (isArrayType(designType)) {
180
+ return [getArrayElementType(designType)];
181
+ }
182
+ return [];
183
+ }
184
+ /**
185
+ * Enhanced type detection that checks for array properties and their element types
186
+ */
187
+ function detectArrayInfo(target, propertyKey) {
188
+ const designType = Reflect.getMetadata('design:type', target, propertyKey);
189
+ // Check if the property type is Array
190
+ if (designType === Array) {
191
+ // Try to get the actual property descriptor to analyze the type annotation
192
+ const descriptor = Object.getOwnPropertyDescriptor(target, propertyKey);
193
+ // For TypeScript arrays like SupplierProductDto[], the runtime type is just Array
194
+ // We need to rely on conventions or explicit type information
195
+ return {
196
+ isArray: true,
197
+ elementType: undefined // Will need to be provided explicitly or through other means
198
+ };
199
+ }
200
+ return {
201
+ isArray: false,
202
+ elementType: undefined
203
+ };
204
+ }
205
+ //# sourceMappingURL=type-inference.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-inference.helper.js","sourceRoot":"","sources":["../../src/helpers/type-inference.helper.ts"],"names":[],"mappings":";;AAgBA,sDAiBC;AAKD,gDAQC;AAMD,wCASC;AAKD,kCAIC;AAKD,kDAQC;AAKD,gCAcC;AAKD,0CAEC;AAKD,gCAEC;AAKD,oCAOC;AAKD,gDAKC;AAKD,kDAWC;AAKD,4CAIC;AAKD,oEA0BC;AAKD,kDAUC;AAKD,0CAuBC;AA7OD,4BAA0B;AAa1B;;GAEG;AACH,SAAgB,qBAAqB,CACnC,MAAW,EACX,WAA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AS;KACvB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { Type } from '@nestjs/common';
2
+ /**
3
+ * Infers validation decorators based on TypeScript design types
4
+ * Following the DECORATORS_AUTOMATIC_VALIDATION_INFERENCE specification
5
+ */
6
+ export declare function inferValidationDecorators(EntityClass: Type, propertyKey: string): {
7
+ decoratorName: string;
8
+ args?: any[];
9
+ }[];
10
+ /**
11
+ * Applies inferred validation decorators to a class property
12
+ */
13
+ export declare function applyInferredValidations(targetClass: Type, sourceClass: Type, propertyKey: string): void;
14
+ /**
15
+ * Checks if a property already has validation decorators applied
16
+ */
17
+ export declare function hasExistingValidation(targetClass: Type, propertyKey: string): boolean;
18
+ //# sourceMappingURL=validation-inference.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-inference.helper.d.ts","sourceRoot":"","sources":["../../src/helpers/validation-inference.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,IAAI,EACjB,WAAW,EAAE,MAAM,GAClB;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;CAAE,EAAE,CAmD3C;AAiBD;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,IAAI,EACjB,WAAW,EAAE,IAAI,EACjB,WAAW,EAAE,MAAM,GAClB,IAAI,CAoBN;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CASrF"}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.inferValidationDecorators = inferValidationDecorators;
4
+ exports.applyInferredValidations = applyInferredValidations;
5
+ exports.hasExistingValidation = hasExistingValidation;
6
+ const metadata_extractor_helper_1 = require("./metadata-extractor.helper");
7
+ /**
8
+ * Infers validation decorators based on TypeScript design types
9
+ * Following the DECORATORS_AUTOMATIC_VALIDATION_INFERENCE specification
10
+ */
11
+ function inferValidationDecorators(EntityClass, propertyKey) {
12
+ const propertyType = (0, metadata_extractor_helper_1.getPropertyDesignType)(EntityClass, propertyKey);
13
+ const decorators = [];
14
+ if (!propertyType) {
15
+ return decorators;
16
+ }
17
+ // Check if property is optional based on TypeScript metadata
18
+ const isOptional = isPropertyOptional(EntityClass, propertyKey);
19
+ if (isOptional) {
20
+ decorators.push({ decoratorName: 'IsOptional' });
21
+ }
22
+ // Basic type inference according to the specification table
23
+ switch (propertyType) {
24
+ case String:
25
+ decorators.push({ decoratorName: 'IsString' });
26
+ if (!isOptional) {
27
+ decorators.push({ decoratorName: 'IsNotEmpty' });
28
+ }
29
+ break;
30
+ case Number:
31
+ decorators.push({ decoratorName: 'IsNumber' });
32
+ break;
33
+ case Boolean:
34
+ decorators.push({ decoratorName: 'IsBoolean' });
35
+ break;
36
+ case Date:
37
+ decorators.push({ decoratorName: 'IsDate' });
38
+ break;
39
+ case Array:
40
+ decorators.push({ decoratorName: 'IsArray' });
41
+ break;
42
+ default:
43
+ // For custom classes/objects
44
+ if (typeof propertyType === 'function' && propertyType.name) {
45
+ // This is likely a custom class
46
+ decorators.push({ decoratorName: 'IsObject' });
47
+ decorators.push({ decoratorName: 'ValidateNested' });
48
+ }
49
+ break;
50
+ }
51
+ return decorators;
52
+ }
53
+ /**
54
+ * Checks if a property is optional based on TypeScript metadata
55
+ * This is a simplified check - in a full implementation, we might need
56
+ * more sophisticated type analysis
57
+ */
58
+ function isPropertyOptional(EntityClass, propertyKey) {
59
+ // Check if the property has undefined in its type union
60
+ // This is a simplified check - TypeScript reflection has limitations
61
+ // For now, we'll return false and rely on explicit nullable configurations
62
+ // In a full implementation, this would analyze the TypeScript AST or
63
+ // use more advanced reflection techniques
64
+ return false;
65
+ }
66
+ /**
67
+ * Applies inferred validation decorators to a class property
68
+ */
69
+ function applyInferredValidations(targetClass, sourceClass, propertyKey) {
70
+ const inferredDecorators = inferValidationDecorators(sourceClass, propertyKey);
71
+ // Apply each inferred decorator
72
+ inferredDecorators.forEach(({ decoratorName, args = [] }) => {
73
+ try {
74
+ // Dynamically import and apply the decorator
75
+ const decoratorModule = require('class-validator');
76
+ const decoratorFunction = decoratorModule[decoratorName];
77
+ if (decoratorFunction) {
78
+ const decorator = decoratorFunction(...args);
79
+ decorator(targetClass.prototype, propertyKey);
80
+ }
81
+ }
82
+ catch (error) {
83
+ // Silently fail if decorator can't be applied
84
+ // In production, this might be logged
85
+ console.warn(`Failed to apply inferred decorator ${decoratorName} to ${propertyKey}:`, error.message);
86
+ }
87
+ });
88
+ }
89
+ /**
90
+ * Checks if a property already has validation decorators applied
91
+ */
92
+ function hasExistingValidation(targetClass, propertyKey) {
93
+ // Check for existing class-validator metadata
94
+ const existingMetadata = Reflect.getMetadata('class-validator:validate', targetClass.prototype);
95
+ if (existingMetadata) {
96
+ return existingMetadata.some((meta) => meta.propertyName === propertyKey);
97
+ }
98
+ return false;
99
+ }
100
+ //# sourceMappingURL=validation-inference.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-inference.helper.js","sourceRoot":"","sources":["../../src/helpers/validation-inference.helper.ts"],"names":[],"mappings":";;AAOA,8DAsDC;AAoBD,4DAwBC;AAKD,sDASC;AAtHD,2EAAoE;AAEpE;;;GAGG;AACH,SAAgB,yBAAyB,CACvC,WAAiB,EACjB,WAAmB;IAEnB,MAAM,YAAY,GAAG,IAAA,iDAAqB,EAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACrE,MAAM,UAAU,GAA8C,EAAE,CAAC;IAEjE,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,6DAA6D;IAC7D,MAAM,UAAU,GAAG,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAEhE,IAAI,UAAU,EAAE,CAAC;QACf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
6
  export * from './enums';
7
7
  export * from './pipes';
8
+ export * from './metadata';
9
+ export * from './decorator-registry';
10
+ export * from './adapters';
11
+ export * from './registry';
8
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -21,4 +21,8 @@ __exportStar(require("./types"), exports);
21
21
  __exportStar(require("./helpers"), exports);
22
22
  __exportStar(require("./enums"), exports);
23
23
  __exportStar(require("./pipes"), exports);
24
+ __exportStar(require("./metadata"), exports);
25
+ __exportStar(require("./decorator-registry"), exports);
26
+ __exportStar(require("./adapters"), exports);
27
+ __exportStar(require("./registry"), exports);
24
28
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,+CAA6B;AAC7B,0CAAwB;AACxB,0CAAwB;AACxB,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,+CAA6B;AAC7B,0CAAwB;AACxB,0CAAwB;AACxB,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB;AACxB,6CAA2B;AAC3B,uDAAqC;AACrC,6CAA2B;AAC3B,6CAA2B"}
@@ -0,0 +1,8 @@
1
+ import { FieldMetadata } from '../metadata/field-metadata.interface';
2
+ export interface DecoratorAdapter {
3
+ name: string;
4
+ apply(target: any, propertyKey: string | symbol, metadata: FieldMetadata): void;
5
+ applyClassDecorator?(target: Function, type: 'entity' | 'input', options: any): void;
6
+ isAvailable(): boolean;
7
+ }
8
+ //# sourceMappingURL=decorator-adapter.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorator-adapter.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/adapters/decorator-adapter.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,sCAAsC,CAAC;AAErF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IAChF,mBAAmB,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI,CAAC;IACrF,WAAW,IAAI,OAAO,CAAC;CACxB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=decorator-adapter.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorator-adapter.interface.js","sourceRoot":"","sources":["../../../src/interfaces/adapters/decorator-adapter.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,55 @@
1
+ export interface SolidFieldOptions {
2
+ description?: string;
3
+ defaultValue?: any;
4
+ transform?: boolean;
5
+ skip?: string[];
6
+ adapters?: {
7
+ [adapterName: string]: any;
8
+ };
9
+ required?: boolean;
10
+ nullable?: boolean;
11
+ unique?: boolean;
12
+ index?: boolean;
13
+ isPrimaryKey?: boolean;
14
+ min?: number;
15
+ max?: number;
16
+ minLength?: number;
17
+ maxLength?: number;
18
+ pattern?: RegExp;
19
+ email?: boolean;
20
+ url?: boolean;
21
+ uuid?: boolean;
22
+ json?: boolean;
23
+ integer?: boolean;
24
+ float?: boolean;
25
+ positive?: boolean;
26
+ negative?: boolean;
27
+ array?: boolean;
28
+ arrayType?: () => Function;
29
+ enum?: object;
30
+ enumName?: string;
31
+ columnType?: string;
32
+ length?: number;
33
+ precision?: number;
34
+ scale?: number;
35
+ generated?: 'uuid' | 'increment' | boolean;
36
+ relation?: 'one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many';
37
+ target?: () => Function;
38
+ inverseSide?: (object: any) => any;
39
+ cascade?: boolean | ('insert' | 'update' | 'remove' | 'soft-remove' | 'recover')[];
40
+ eager?: boolean;
41
+ lazy?: boolean;
42
+ createdAt?: boolean;
43
+ updatedAt?: boolean;
44
+ deletedAt?: boolean;
45
+ example?: any;
46
+ deprecated?: boolean | string;
47
+ hidden?: boolean;
48
+ readOnly?: boolean;
49
+ writeOnly?: boolean;
50
+ responseOnly?: boolean;
51
+ skipValidation?: boolean;
52
+ minSize?: number;
53
+ maxSize?: number;
54
+ }
55
+ //# sourceMappingURL=solid-field-options.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solid-field-options.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/decorators/solid-field-options.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAEhC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IAGpB,IAAI,CAAC,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C;IACxB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;IACnC,OAAO,CAAC,EAAE,OAAO,GAAG,CAAC,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC;IACnF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IAGf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IAGpB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IAGvB,cAAc,CAAC,EAAE,OAAO,CAAC;IAGzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=solid-field-options.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solid-field-options.interface.js","sourceRoot":"","sources":["../../../src/interfaces/decorators/solid-field-options.interface.ts"],"names":[],"mappings":""}
@@ -3,4 +3,7 @@ export * from './structures';
3
3
  export * from './misc';
4
4
  export * from './inputs';
5
5
  export * from './outputs';
6
+ export * from './decorators/solid-field-options.interface';
7
+ export * from './metadata/field-metadata.interface';
8
+ export * from './adapters/decorator-adapter.interface';
6
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AACpD,cAAc,wCAAwC,CAAC"}
@@ -19,4 +19,7 @@ __exportStar(require("./structures"), exports);
19
19
  __exportStar(require("./misc"), exports);
20
20
  __exportStar(require("./inputs"), exports);
21
21
  __exportStar(require("./outputs"), exports);
22
+ __exportStar(require("./decorators/solid-field-options.interface"), exports);
23
+ __exportStar(require("./metadata/field-metadata.interface"), exports);
24
+ __exportStar(require("./adapters/decorator-adapter.interface"), exports);
22
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,+CAA6B;AAC7B,yCAAuB;AACvB,2CAAyB;AACzB,4CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,+CAA6B;AAC7B,yCAAuB;AACvB,2CAAyB;AACzB,4CAA0B;AAC1B,6EAA2D;AAC3D,sEAAoD;AACpD,yEAAuD"}
@@ -0,0 +1,29 @@
1
+ import { SolidFieldOptions } from '../decorators/solid-field-options.interface';
2
+ export interface FieldMetadata {
3
+ target: Function;
4
+ propertyKey: string | symbol;
5
+ type: any;
6
+ options: SolidFieldOptions;
7
+ isOptional: boolean;
8
+ adapterOptions?: any;
9
+ }
10
+ export interface EntityMetadata {
11
+ target: Function;
12
+ options: SolidEntityOptions;
13
+ type: 'entity' | 'input';
14
+ }
15
+ export interface SolidEntityOptions {
16
+ name?: string;
17
+ description?: string;
18
+ tableName?: string;
19
+ schema?: string;
20
+ skip?: string[];
21
+ adapters?: Record<string, any>;
22
+ }
23
+ export interface SolidInputOptions {
24
+ name?: string;
25
+ description?: string;
26
+ skip?: string[];
27
+ defaultSkip?: string[];
28
+ }
29
+ //# sourceMappingURL=field-metadata.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-metadata.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/metadata/field-metadata.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAEhF,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,QAAQ,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,IAAI,EAAE,GAAG,CAAC;IACV,OAAO,EAAE,iBAAiB,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,GAAG,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,QAAQ,CAAC;IACjB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=field-metadata.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-metadata.interface.js","sourceRoot":"","sources":["../../../src/interfaces/metadata/field-metadata.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './metadata-storage';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}