@solid-nestjs/common 0.2.6 → 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 (253) 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/enums/aggregate-function.enum.d.ts +42 -0
  46. package/dist/enums/aggregate-function.enum.d.ts.map +1 -0
  47. package/dist/enums/aggregate-function.enum.js +46 -0
  48. package/dist/enums/aggregate-function.enum.js.map +1 -0
  49. package/dist/enums/index.d.ts +1 -0
  50. package/dist/enums/index.d.ts.map +1 -1
  51. package/dist/enums/index.js +1 -0
  52. package/dist/enums/index.js.map +1 -1
  53. package/dist/helpers/args-helpers/class-generator.helper.d.ts +143 -0
  54. package/dist/helpers/args-helpers/class-generator.helper.d.ts.map +1 -0
  55. package/dist/helpers/args-helpers/class-generator.helper.js +221 -0
  56. package/dist/helpers/args-helpers/class-generator.helper.js.map +1 -0
  57. package/dist/helpers/args-helpers/create-groupby-request.helper.d.ts +83 -0
  58. package/dist/helpers/args-helpers/create-groupby-request.helper.d.ts.map +1 -0
  59. package/dist/helpers/args-helpers/create-groupby-request.helper.js +119 -0
  60. package/dist/helpers/args-helpers/create-groupby-request.helper.js.map +1 -0
  61. package/dist/helpers/args-helpers/decorator-builder.helper.d.ts +160 -0
  62. package/dist/helpers/args-helpers/decorator-builder.helper.d.ts.map +1 -0
  63. package/dist/helpers/args-helpers/decorator-builder.helper.js +161 -0
  64. package/dist/helpers/args-helpers/decorator-builder.helper.js.map +1 -0
  65. package/dist/helpers/args-helpers/field-config.helper.d.ts +98 -0
  66. package/dist/helpers/args-helpers/field-config.helper.d.ts.map +1 -0
  67. package/dist/helpers/args-helpers/field-config.helper.js +143 -0
  68. package/dist/helpers/args-helpers/field-config.helper.js.map +1 -0
  69. package/dist/helpers/args-helpers/groupby-args-from.helper.d.ts +87 -0
  70. package/dist/helpers/args-helpers/groupby-args-from.helper.d.ts.map +1 -0
  71. package/dist/helpers/args-helpers/groupby-args-from.helper.js +185 -0
  72. package/dist/helpers/args-helpers/groupby-args-from.helper.js.map +1 -0
  73. package/dist/helpers/args-helpers/index.d.ts +15 -0
  74. package/dist/helpers/args-helpers/index.d.ts.map +1 -0
  75. package/dist/helpers/args-helpers/index.js +58 -0
  76. package/dist/helpers/args-helpers/index.js.map +1 -0
  77. package/dist/helpers/args-helpers/type-inference.helper.d.ts +191 -0
  78. package/dist/helpers/args-helpers/type-inference.helper.d.ts.map +1 -0
  79. package/dist/helpers/args-helpers/type-inference.helper.js +330 -0
  80. package/dist/helpers/args-helpers/type-inference.helper.js.map +1 -0
  81. package/dist/helpers/class-generation/dynamic-class.helper.d.ts +101 -0
  82. package/dist/helpers/class-generation/dynamic-class.helper.d.ts.map +1 -0
  83. package/dist/helpers/class-generation/dynamic-class.helper.js +180 -0
  84. package/dist/helpers/class-generation/dynamic-class.helper.js.map +1 -0
  85. package/dist/helpers/class-generation/index.d.ts +9 -0
  86. package/dist/helpers/class-generation/index.d.ts.map +1 -0
  87. package/dist/helpers/class-generation/index.js +18 -0
  88. package/dist/helpers/class-generation/index.js.map +1 -0
  89. package/dist/helpers/decorators/decorator-utils.helper.d.ts +75 -0
  90. package/dist/helpers/decorators/decorator-utils.helper.d.ts.map +1 -0
  91. package/dist/helpers/decorators/decorator-utils.helper.js +92 -0
  92. package/dist/helpers/decorators/decorator-utils.helper.js.map +1 -0
  93. package/dist/helpers/decorators/index.d.ts +9 -0
  94. package/dist/helpers/decorators/index.d.ts.map +1 -0
  95. package/dist/helpers/decorators/index.js +16 -0
  96. package/dist/helpers/decorators/index.js.map +1 -0
  97. package/dist/helpers/dto-generator-base.helper.d.ts +19 -0
  98. package/dist/helpers/dto-generator-base.helper.d.ts.map +1 -0
  99. package/dist/helpers/dto-generator-base.helper.js +72 -0
  100. package/dist/helpers/dto-generator-base.helper.js.map +1 -0
  101. package/dist/helpers/index.d.ts +9 -0
  102. package/dist/helpers/index.d.ts.map +1 -1
  103. package/dist/helpers/index.js +9 -0
  104. package/dist/helpers/index.js.map +1 -1
  105. package/dist/helpers/metadata-extractor.helper.d.ts +26 -0
  106. package/dist/helpers/metadata-extractor.helper.d.ts.map +1 -0
  107. package/dist/helpers/metadata-extractor.helper.js +67 -0
  108. package/dist/helpers/metadata-extractor.helper.js.map +1 -0
  109. package/dist/helpers/package-detector.helper.d.ts +33 -0
  110. package/dist/helpers/package-detector.helper.d.ts.map +1 -0
  111. package/dist/helpers/package-detector.helper.js +82 -0
  112. package/dist/helpers/package-detector.helper.js.map +1 -0
  113. package/dist/helpers/property-filter.helper.d.ts +15 -0
  114. package/dist/helpers/property-filter.helper.d.ts.map +1 -0
  115. package/dist/helpers/property-filter.helper.js +44 -0
  116. package/dist/helpers/property-filter.helper.js.map +1 -0
  117. package/dist/helpers/type-inference.helper.d.ts +76 -0
  118. package/dist/helpers/type-inference.helper.d.ts.map +1 -0
  119. package/dist/helpers/type-inference.helper.js +205 -0
  120. package/dist/helpers/type-inference.helper.js.map +1 -0
  121. package/dist/helpers/validation-inference.helper.d.ts +18 -0
  122. package/dist/helpers/validation-inference.helper.d.ts.map +1 -0
  123. package/dist/helpers/validation-inference.helper.js +100 -0
  124. package/dist/helpers/validation-inference.helper.js.map +1 -0
  125. package/dist/index.d.ts +4 -0
  126. package/dist/index.d.ts.map +1 -1
  127. package/dist/index.js +4 -0
  128. package/dist/index.js.map +1 -1
  129. package/dist/interfaces/adapters/decorator-adapter.interface.d.ts +8 -0
  130. package/dist/interfaces/adapters/decorator-adapter.interface.d.ts.map +1 -0
  131. package/dist/interfaces/adapters/decorator-adapter.interface.js +3 -0
  132. package/dist/interfaces/adapters/decorator-adapter.interface.js.map +1 -0
  133. package/dist/interfaces/decorators/solid-field-options.interface.d.ts +55 -0
  134. package/dist/interfaces/decorators/solid-field-options.interface.d.ts.map +1 -0
  135. package/dist/interfaces/decorators/solid-field-options.interface.js +3 -0
  136. package/dist/interfaces/decorators/solid-field-options.interface.js.map +1 -0
  137. package/dist/interfaces/index.d.ts +5 -0
  138. package/dist/interfaces/index.d.ts.map +1 -1
  139. package/dist/interfaces/index.js +5 -0
  140. package/dist/interfaces/index.js.map +1 -1
  141. package/dist/interfaces/inputs/filters.interfaces.d.ts +36 -0
  142. package/dist/interfaces/inputs/filters.interfaces.d.ts.map +1 -0
  143. package/dist/interfaces/inputs/filters.interfaces.js +3 -0
  144. package/dist/interfaces/inputs/filters.interfaces.js.map +1 -0
  145. package/dist/interfaces/inputs/find-args.interface.d.ts +8 -0
  146. package/dist/interfaces/inputs/find-args.interface.d.ts.map +1 -0
  147. package/dist/interfaces/inputs/find-args.interface.js +3 -0
  148. package/dist/interfaces/inputs/find-args.interface.js.map +1 -0
  149. package/dist/interfaces/inputs/group-by-args.interface.d.ts +33 -0
  150. package/dist/interfaces/inputs/group-by-args.interface.d.ts.map +1 -0
  151. package/dist/interfaces/inputs/group-by-args.interface.js +3 -0
  152. package/dist/interfaces/inputs/group-by-args.interface.js.map +1 -0
  153. package/dist/interfaces/inputs/group-by-request.interface.d.ts +63 -0
  154. package/dist/interfaces/inputs/group-by-request.interface.d.ts.map +1 -0
  155. package/dist/interfaces/inputs/group-by-request.interface.js +3 -0
  156. package/dist/interfaces/inputs/group-by-request.interface.js.map +1 -0
  157. package/dist/interfaces/inputs/index.d.ts +6 -0
  158. package/dist/interfaces/inputs/index.d.ts.map +1 -0
  159. package/dist/interfaces/inputs/index.js +22 -0
  160. package/dist/interfaces/inputs/index.js.map +1 -0
  161. package/dist/interfaces/inputs/pagination-request.interface.d.ts +7 -0
  162. package/dist/interfaces/inputs/pagination-request.interface.d.ts.map +1 -0
  163. package/dist/interfaces/inputs/pagination-request.interface.js +3 -0
  164. package/dist/interfaces/inputs/pagination-request.interface.js.map +1 -0
  165. package/dist/interfaces/metadata/field-metadata.interface.d.ts +29 -0
  166. package/dist/interfaces/metadata/field-metadata.interface.d.ts.map +1 -0
  167. package/dist/interfaces/metadata/field-metadata.interface.js +3 -0
  168. package/dist/interfaces/metadata/field-metadata.interface.js.map +1 -0
  169. package/dist/interfaces/misc/group-by-args.interface.d.ts +33 -0
  170. package/dist/interfaces/misc/group-by-args.interface.d.ts.map +1 -0
  171. package/dist/interfaces/misc/group-by-args.interface.js +3 -0
  172. package/dist/interfaces/misc/group-by-args.interface.js.map +1 -0
  173. package/dist/interfaces/misc/group-by-request.interface.d.ts +63 -0
  174. package/dist/interfaces/misc/group-by-request.interface.d.ts.map +1 -0
  175. package/dist/interfaces/misc/group-by-request.interface.js +3 -0
  176. package/dist/interfaces/misc/group-by-request.interface.js.map +1 -0
  177. package/dist/interfaces/misc/group-by-response.interface.d.ts +59 -0
  178. package/dist/interfaces/misc/group-by-response.interface.d.ts.map +1 -0
  179. package/dist/interfaces/misc/group-by-response.interface.js +3 -0
  180. package/dist/interfaces/misc/group-by-response.interface.js.map +1 -0
  181. package/dist/interfaces/misc/group-by.interface.d.ts +145 -0
  182. package/dist/interfaces/misc/group-by.interface.d.ts.map +1 -0
  183. package/dist/interfaces/misc/group-by.interface.js +3 -0
  184. package/dist/interfaces/misc/group-by.interface.js.map +1 -0
  185. package/dist/interfaces/misc/index.d.ts +0 -4
  186. package/dist/interfaces/misc/index.d.ts.map +1 -1
  187. package/dist/interfaces/misc/index.js +0 -4
  188. package/dist/interfaces/misc/index.js.map +1 -1
  189. package/dist/interfaces/outputs/group-by-response.interface.d.ts +59 -0
  190. package/dist/interfaces/outputs/group-by-response.interface.d.ts.map +1 -0
  191. package/dist/interfaces/outputs/group-by-response.interface.js +3 -0
  192. package/dist/interfaces/outputs/group-by-response.interface.js.map +1 -0
  193. package/dist/interfaces/outputs/index.d.ts +3 -0
  194. package/dist/interfaces/outputs/index.d.ts.map +1 -0
  195. package/dist/interfaces/outputs/index.js +19 -0
  196. package/dist/interfaces/outputs/index.js.map +1 -0
  197. package/dist/interfaces/outputs/pagination-result.interface.d.ts +10 -0
  198. package/dist/interfaces/outputs/pagination-result.interface.d.ts.map +1 -0
  199. package/dist/interfaces/outputs/pagination-result.interface.js +3 -0
  200. package/dist/interfaces/outputs/pagination-result.interface.js.map +1 -0
  201. package/dist/interfaces/services/crud-service.interface.d.ts +2 -1
  202. package/dist/interfaces/services/crud-service.interface.d.ts.map +1 -1
  203. package/dist/interfaces/services/crud-service.interface.js.map +1 -1
  204. package/dist/interfaces/services/data-service.interface.d.ts +3 -1
  205. package/dist/interfaces/services/data-service.interface.d.ts.map +1 -1
  206. package/dist/interfaces/structures/common-services.index.d.ts +1 -0
  207. package/dist/interfaces/structures/common-services.index.d.ts.map +1 -0
  208. package/dist/interfaces/structures/common-services.index.js +2 -0
  209. package/dist/interfaces/structures/common-services.index.js.map +1 -0
  210. package/dist/interfaces/structures/crud-service-structure.interface.d.ts +2 -1
  211. package/dist/interfaces/structures/crud-service-structure.interface.d.ts.map +1 -1
  212. package/dist/interfaces/structures/data-service-structure.interface.d.ts +2 -1
  213. package/dist/interfaces/structures/data-service-structure.interface.d.ts.map +1 -1
  214. package/dist/interfaces/structures/entity-provider-structure.interface.d.ts +2 -1
  215. package/dist/interfaces/structures/entity-provider-structure.interface.d.ts.map +1 -1
  216. package/dist/interfaces/structures/entity-provider-structure.interface.js.map +1 -1
  217. package/dist/interfaces/structures/service-plugins.interface.d.ts +2 -1
  218. package/dist/interfaces/structures/service-plugins.interface.d.ts.map +1 -1
  219. package/dist/metadata/index.d.ts +2 -0
  220. package/dist/metadata/index.d.ts.map +1 -0
  221. package/dist/metadata/index.js +18 -0
  222. package/dist/metadata/index.js.map +1 -0
  223. package/dist/metadata/metadata-storage.d.ts +54 -0
  224. package/dist/metadata/metadata-storage.d.ts.map +1 -0
  225. package/dist/metadata/metadata-storage.js +106 -0
  226. package/dist/metadata/metadata-storage.js.map +1 -0
  227. package/dist/registry/index.d.ts +2 -0
  228. package/dist/registry/index.d.ts.map +1 -0
  229. package/dist/registry/index.js +18 -0
  230. package/dist/registry/index.js.map +1 -0
  231. package/dist/registry/relation-adapter-registry.d.ts +11 -0
  232. package/dist/registry/relation-adapter-registry.d.ts.map +1 -0
  233. package/dist/registry/relation-adapter-registry.js +30 -0
  234. package/dist/registry/relation-adapter-registry.js.map +1 -0
  235. package/dist/types/dto-generation.types.d.ts +46 -0
  236. package/dist/types/dto-generation.types.d.ts.map +1 -0
  237. package/dist/types/dto-generation.types.js +6 -0
  238. package/dist/types/dto-generation.types.js.map +1 -0
  239. package/dist/types/find-args.type.d.ts +9 -7
  240. package/dist/types/find-args.type.d.ts.map +1 -1
  241. package/dist/types/group-by.type.d.ts +41 -0
  242. package/dist/types/group-by.type.d.ts.map +1 -0
  243. package/dist/types/group-by.type.js +3 -0
  244. package/dist/types/group-by.type.js.map +1 -0
  245. package/dist/types/index.d.ts +2 -0
  246. package/dist/types/index.d.ts.map +1 -1
  247. package/dist/types/index.js +2 -0
  248. package/dist/types/index.js.map +1 -1
  249. package/package.json +2 -2
  250. package/dist/utils/object.utils.d.ts +0 -8
  251. package/dist/utils/object.utils.d.ts.map +0 -1
  252. package/dist/utils/object.utils.js +0 -11
  253. package/dist/utils/object.utils.js.map +0 -1
@@ -0,0 +1,160 @@
1
+ import { Type } from '@nestjs/common';
2
+ import 'reflect-metadata';
3
+ /**
4
+ * Common decorator configuration interface
5
+ */
6
+ export interface DecoratorConfig {
7
+ description?: string;
8
+ required?: boolean;
9
+ example?: any;
10
+ deprecated?: boolean;
11
+ }
12
+ /**
13
+ * Interface for decorator builders that create property decorators
14
+ */
15
+ export interface DecoratorBuilder {
16
+ /**
17
+ * Creates validation decorators for a property
18
+ */
19
+ createValidationDecorators(config: DecoratorConfig): PropertyDecorator[];
20
+ /**
21
+ * Creates type transformation decorators
22
+ */
23
+ createTransformDecorators(type: Type<any>, config: DecoratorConfig): PropertyDecorator[];
24
+ /**
25
+ * Creates documentation decorators (Swagger/GraphQL)
26
+ */
27
+ createDocumentationDecorators(type: Type<any>, config: DecoratorConfig): PropertyDecorator[];
28
+ /**
29
+ * Creates all decorators for a property and applies them to the target class
30
+ */
31
+ applyAllDecorators(targetClass: Type<any>, propertyName: string, type: Type<any>, config: DecoratorConfig): void;
32
+ }
33
+ /**
34
+ * Base decorator builder with common validation decorators
35
+ */
36
+ export declare abstract class BaseDecoratorBuilder implements DecoratorBuilder {
37
+ abstract createValidationDecorators(config: DecoratorConfig): PropertyDecorator[];
38
+ abstract createTransformDecorators(type: Type<any>, config: DecoratorConfig): PropertyDecorator[];
39
+ abstract createDocumentationDecorators(type: Type<any>, config: DecoratorConfig): PropertyDecorator[];
40
+ /**
41
+ * Creates all decorators for a property and applies them to the target class
42
+ *
43
+ * @param targetClass - The class to apply decorators to
44
+ * @param propertyName - The property name
45
+ * @param type - The property type
46
+ * @param config - Decorator configuration
47
+ */
48
+ applyAllDecorators(targetClass: Type<any>, propertyName: string, type: Type<any>, config: DecoratorConfig): void;
49
+ /**
50
+ * Creates common validation decorators that are used across all packages
51
+ *
52
+ * @param config - Configuration for the decorators
53
+ * @returns Array of common validation decorators
54
+ */
55
+ protected createCommonValidationDecorators(config: DecoratorConfig): PropertyDecorator[];
56
+ /**
57
+ * Creates common transformation decorators
58
+ *
59
+ * @param type - The property type
60
+ * @param config - Configuration for the decorators
61
+ * @returns Array of transformation decorators
62
+ */
63
+ protected createCommonTransformDecorators(type: Type<any>, config: DecoratorConfig): PropertyDecorator[];
64
+ }
65
+ /**
66
+ * Utility functions for working with decorators
67
+ */
68
+ export declare class DecoratorUtils {
69
+ /**
70
+ * Checks if a decorator has already been applied to a property
71
+ *
72
+ * @param targetClass - The class to check
73
+ * @param propertyName - The property name
74
+ * @param decoratorKey - The metadata key to look for
75
+ * @returns True if the decorator has been applied
76
+ */
77
+ static hasDecorator(targetClass: Type<any>, propertyName: string, decoratorKey: string): boolean;
78
+ /**
79
+ * Gets decorator metadata for a property
80
+ *
81
+ * @param targetClass - The class to get metadata from
82
+ * @param propertyName - The property name
83
+ * @param decoratorKey - The metadata key
84
+ * @returns The decorator metadata
85
+ */
86
+ static getDecoratorMetadata(targetClass: Type<any>, propertyName: string, decoratorKey: string): any;
87
+ /**
88
+ * Sets decorator metadata for a property
89
+ *
90
+ * @param targetClass - The class to set metadata on
91
+ * @param propertyName - The property name
92
+ * @param decoratorKey - The metadata key
93
+ * @param metadata - The metadata to set
94
+ */
95
+ static setDecoratorMetadata(targetClass: Type<any>, propertyName: string, decoratorKey: string, metadata: any): void;
96
+ /**
97
+ * Merges decorator metadata with existing metadata
98
+ *
99
+ * @param targetClass - The class to merge metadata on
100
+ * @param propertyName - The property name
101
+ * @param decoratorKey - The metadata key
102
+ * @param newMetadata - The new metadata to merge
103
+ */
104
+ static mergeDecoratorMetadata(targetClass: Type<any>, propertyName: string, decoratorKey: string, newMetadata: any): void;
105
+ }
106
+ /**
107
+ * Factory function for creating decorator builders
108
+ * This will be implemented by each package (rest-api, graphql, rest-graphql)
109
+ */
110
+ export interface DecoratorBuilderFactory {
111
+ /**
112
+ * Creates a decorator builder for WhereFields
113
+ */
114
+ createWhereFieldsDecoratorBuilder(): DecoratorBuilder;
115
+ /**
116
+ * Creates a decorator builder for OrderByFields
117
+ */
118
+ createOrderByFieldsDecoratorBuilder(): DecoratorBuilder;
119
+ /**
120
+ * Creates a decorator builder for GroupByFields
121
+ */
122
+ createGroupByFieldsDecoratorBuilder(): DecoratorBuilder;
123
+ }
124
+ /**
125
+ * Registry for decorator builder factories
126
+ * Each package will register its factory here
127
+ */
128
+ export declare class DecoratorBuilderRegistry {
129
+ private static factories;
130
+ /**
131
+ * Registers a decorator builder factory for a package
132
+ *
133
+ * @param packageName - Name of the package (e.g., 'rest-api', 'graphql', 'rest-graphql')
134
+ * @param factory - The factory instance
135
+ */
136
+ static registerFactory(packageName: string, factory: DecoratorBuilderFactory): void;
137
+ /**
138
+ * Gets a decorator builder factory for a package
139
+ *
140
+ * @param packageName - Name of the package
141
+ * @returns The factory instance or undefined if not found
142
+ */
143
+ static getFactory(packageName: string): DecoratorBuilderFactory | undefined;
144
+ /**
145
+ * Gets all registered package names
146
+ *
147
+ * @returns Array of registered package names
148
+ */
149
+ static getRegisteredPackages(): string[];
150
+ }
151
+ /**
152
+ * Applies logical operator fields (_and, _or) to a WhereFields class
153
+ * This is common functionality used across all packages
154
+ *
155
+ * @param targetClass - The WhereFields class to add operators to
156
+ * @param decoratorBuilder - The decorator builder to use
157
+ * @param className - The class name for nested types
158
+ */
159
+ export declare function addLogicalOperators(targetClass: Type<any>, decoratorBuilder: DecoratorBuilder, className: string): void;
160
+ //# sourceMappingURL=decorator-builder.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorator-builder.helper.d.ts","sourceRoot":"","sources":["../../../src/helpers/args-helpers/decorator-builder.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,kBAAkB,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,0BAA0B,CAAC,MAAM,EAAE,eAAe,GAAG,iBAAiB,EAAE,CAAC;IAEzE;;OAEG;IACH,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,eAAe,GAAG,iBAAiB,EAAE,CAAC;IAEzF;;OAEG;IACH,6BAA6B,CAAC,IAAI,EAAE,IAAI,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EAAE,IAAI,CAAC,GAAG,CAAC,EACtB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,GACnB,GAAG;IAIN;;;;;;;OAOG;IACH,MAAM,CAAC,oBAAoB,CACzB,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,EACtB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,GAAG,GACZ,IAAI;IAIP;;;;;;;OAOG;IACH,MAAM,CAAC,sBAAsB,CAC3B,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,EACtB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,GAAG,GACf,IAAI;CAKR;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,iCAAiC,IAAI,gBAAgB,CAAC;IAEtD;;OAEG;IACH,mCAAmC,IAAI,gBAAgB,CAAC;IAExD;;OAEG;IACH,mCAAmC,IAAI,gBAAgB,CAAC;CACzD;AAED;;;GAGG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAC,SAAS,CAA8C;IAEtE;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,GAAG,IAAI;IAInF;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS;IAI3E;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,IAAI,MAAM,EAAE;CAGzC;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,MAAM,GAChB,IAAI,CAsBN"}
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DecoratorBuilderRegistry = exports.DecoratorUtils = exports.BaseDecoratorBuilder = void 0;
4
+ exports.addLogicalOperators = addLogicalOperators;
5
+ const decorators_1 = require("../decorators");
6
+ require("reflect-metadata");
7
+ /**
8
+ * Base decorator builder with common validation decorators
9
+ */
10
+ class BaseDecoratorBuilder {
11
+ /**
12
+ * Creates all decorators for a property and applies them to the target class
13
+ *
14
+ * @param targetClass - The class to apply decorators to
15
+ * @param propertyName - The property name
16
+ * @param type - The property type
17
+ * @param config - Decorator configuration
18
+ */
19
+ applyAllDecorators(targetClass, propertyName, type, config) {
20
+ const decorators = [
21
+ ...this.createValidationDecorators(config),
22
+ ...this.createTransformDecorators(type, config),
23
+ ...this.createDocumentationDecorators(type, config)
24
+ ];
25
+ for (const decorator of decorators) {
26
+ (0, decorators_1.applyDecoratorToProperty)(decorator, targetClass, propertyName);
27
+ }
28
+ }
29
+ /**
30
+ * Creates common validation decorators that are used across all packages
31
+ *
32
+ * @param config - Configuration for the decorators
33
+ * @returns Array of common validation decorators
34
+ */
35
+ createCommonValidationDecorators(config) {
36
+ const decorators = [];
37
+ // These will be imported from class-validator in the specific implementations
38
+ // For now, we'll return an empty array and let the package-specific implementations handle this
39
+ return decorators;
40
+ }
41
+ /**
42
+ * Creates common transformation decorators
43
+ *
44
+ * @param type - The property type
45
+ * @param config - Configuration for the decorators
46
+ * @returns Array of transformation decorators
47
+ */
48
+ createCommonTransformDecorators(type, config) {
49
+ const decorators = [];
50
+ // Type transformation decorators will be handled by package-specific implementations
51
+ return decorators;
52
+ }
53
+ }
54
+ exports.BaseDecoratorBuilder = BaseDecoratorBuilder;
55
+ /**
56
+ * Utility functions for working with decorators
57
+ */
58
+ class DecoratorUtils {
59
+ /**
60
+ * Checks if a decorator has already been applied to a property
61
+ *
62
+ * @param targetClass - The class to check
63
+ * @param propertyName - The property name
64
+ * @param decoratorKey - The metadata key to look for
65
+ * @returns True if the decorator has been applied
66
+ */
67
+ static hasDecorator(targetClass, propertyName, decoratorKey) {
68
+ return Reflect.hasMetadata(decoratorKey, targetClass.prototype, propertyName);
69
+ }
70
+ /**
71
+ * Gets decorator metadata for a property
72
+ *
73
+ * @param targetClass - The class to get metadata from
74
+ * @param propertyName - The property name
75
+ * @param decoratorKey - The metadata key
76
+ * @returns The decorator metadata
77
+ */
78
+ static getDecoratorMetadata(targetClass, propertyName, decoratorKey) {
79
+ return Reflect.getMetadata(decoratorKey, targetClass.prototype, propertyName);
80
+ }
81
+ /**
82
+ * Sets decorator metadata for a property
83
+ *
84
+ * @param targetClass - The class to set metadata on
85
+ * @param propertyName - The property name
86
+ * @param decoratorKey - The metadata key
87
+ * @param metadata - The metadata to set
88
+ */
89
+ static setDecoratorMetadata(targetClass, propertyName, decoratorKey, metadata) {
90
+ Reflect.defineMetadata(decoratorKey, metadata, targetClass.prototype, propertyName);
91
+ }
92
+ /**
93
+ * Merges decorator metadata with existing metadata
94
+ *
95
+ * @param targetClass - The class to merge metadata on
96
+ * @param propertyName - The property name
97
+ * @param decoratorKey - The metadata key
98
+ * @param newMetadata - The new metadata to merge
99
+ */
100
+ static mergeDecoratorMetadata(targetClass, propertyName, decoratorKey, newMetadata) {
101
+ const existing = this.getDecoratorMetadata(targetClass, propertyName, decoratorKey) || {};
102
+ const merged = { ...existing, ...newMetadata };
103
+ this.setDecoratorMetadata(targetClass, propertyName, decoratorKey, merged);
104
+ }
105
+ }
106
+ exports.DecoratorUtils = DecoratorUtils;
107
+ /**
108
+ * Registry for decorator builder factories
109
+ * Each package will register its factory here
110
+ */
111
+ class DecoratorBuilderRegistry {
112
+ /**
113
+ * Registers a decorator builder factory for a package
114
+ *
115
+ * @param packageName - Name of the package (e.g., 'rest-api', 'graphql', 'rest-graphql')
116
+ * @param factory - The factory instance
117
+ */
118
+ static registerFactory(packageName, factory) {
119
+ this.factories.set(packageName, factory);
120
+ }
121
+ /**
122
+ * Gets a decorator builder factory for a package
123
+ *
124
+ * @param packageName - Name of the package
125
+ * @returns The factory instance or undefined if not found
126
+ */
127
+ static getFactory(packageName) {
128
+ return this.factories.get(packageName);
129
+ }
130
+ /**
131
+ * Gets all registered package names
132
+ *
133
+ * @returns Array of registered package names
134
+ */
135
+ static getRegisteredPackages() {
136
+ return Array.from(this.factories.keys());
137
+ }
138
+ }
139
+ exports.DecoratorBuilderRegistry = DecoratorBuilderRegistry;
140
+ DecoratorBuilderRegistry.factories = new Map();
141
+ /**
142
+ * Applies logical operator fields (_and, _or) to a WhereFields class
143
+ * This is common functionality used across all packages
144
+ *
145
+ * @param targetClass - The WhereFields class to add operators to
146
+ * @param decoratorBuilder - The decorator builder to use
147
+ * @param className - The class name for nested types
148
+ */
149
+ function addLogicalOperators(targetClass, decoratorBuilder, className) {
150
+ // Add _and field (array of same type)
151
+ decoratorBuilder.applyAllDecorators(targetClass, '_and', Array, {
152
+ description: `Logical AND conditions for ${className}`,
153
+ required: false
154
+ });
155
+ // Add _or field (array of same type)
156
+ decoratorBuilder.applyAllDecorators(targetClass, '_or', Array, {
157
+ description: `Logical OR conditions for ${className}`,
158
+ required: false
159
+ });
160
+ }
161
+ //# sourceMappingURL=decorator-builder.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorator-builder.helper.js","sourceRoot":"","sources":["../../../src/helpers/args-helpers/decorator-builder.helper.ts"],"names":[],"mappings":";;;AAyPA,kDA0BC;AAlRD,8CAAmF;AACnF,4BAA0B;AA0C1B;;GAEG;AACH,MAAsB,oBAAoB;IAMxC;;;;;;;OAOG;IACH,kBAAkB,CAChB,WAAsB,EACtB,YAAoB,EACpB,IAAe,EACf,MAAuB;QAEvB,MAAM,UAAU,GAAG;YACjB,GAAG,IAAI,CAAC,0BAA0B,CAAC,MAAM,CAAC;YAC1C,GAAG,IAAI,CAAC,yBAAyB,CAAC,IAAI,EAAE,MAAM,CAAC;YAC/C,GAAG,IAAI,CAAC,6BAA6B,CAAC,IAAI,EAAE,MAAM,CAAC;SACpD,CAAC;QAEF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,IAAA,qCAAsB,EAAC,SAA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AAE,GAAG,WAAW,EAAE,CAAC;QAC/C,IAAI,CAAC,oBAAoB,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;IAC7E,CAAC;CACF;AArED,wCAqEC;AAuBD;;;GAGG;AACH,MAAa,wBAAwB;IAGnC;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,WAAmB,EAAE,OAAgC;QAC1E,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,WAAmB;QACnC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,qBAAqB;QAC1B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;;AA9BH,4DA+BC;AA9BgB,kCAAS,GAAG,IAAI,GAAG,EAAmC,CAAC;AAgCxE;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CACjC,WAAsB,EACtB,gBAAkC,EAClC,SAAiB;IAEjB,sCAAsC;IACtC,gBAAgB,CAAC,kBAAkB,CACjC,WAAW,EACX,MAAM,EACN,KAAK,EACL;QACE,WAAW,EAAE,8BAA8B,SAAS,EAAE;QACtD,QAAQ,EAAE,KAAK;KAChB,CACF,CAAC;IAEF,qCAAqC;IACrC,gBAAgB,CAAC,kBAAkB,CACjC,WAAW,EACX,KAAK,EACL,KAAK,EACL;QACE,WAAW,EAAE,6BAA6B,SAAS,EAAE;QACrD,QAAQ,EAAE,KAAK;KAChB,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,98 @@
1
+ import { Type } from '@nestjs/common';
2
+ import { FieldConfig, ParsedFieldConfig } from './type-inference.helper';
3
+ /**
4
+ * Configuration types for different helper functions
5
+ */
6
+ export type WhereFieldsConfig<T> = {
7
+ [K in keyof T]?: FieldConfig;
8
+ } & {
9
+ [relationName: string]: FieldConfig;
10
+ };
11
+ export type OrderByFieldConfig = true | Type<any> | {
12
+ description?: string;
13
+ required?: boolean;
14
+ type?: Type<any>;
15
+ };
16
+ export type OrderByFieldsConfig<T> = {
17
+ [K in keyof T]?: OrderByFieldConfig;
18
+ } & {
19
+ [relationName: string]: OrderByFieldConfig;
20
+ };
21
+ export type GroupByFieldConfig = true | Type<any> | {
22
+ description?: string;
23
+ required?: boolean;
24
+ type?: Type<any>;
25
+ };
26
+ export type GroupByFieldsConfig<T> = {
27
+ [K in keyof T]?: GroupByFieldConfig;
28
+ } & {
29
+ [relationName: string]: GroupByFieldConfig;
30
+ };
31
+ /**
32
+ * Options for configuring the generated class
33
+ */
34
+ export interface ClassOptions {
35
+ name?: string;
36
+ description?: string;
37
+ isAbstract?: boolean;
38
+ decorators?: ClassDecorator[];
39
+ metadata?: Record<string, any>;
40
+ extends?: Type<any>;
41
+ }
42
+ /**
43
+ * Parsed class options with default values
44
+ */
45
+ export interface ParsedClassOptions {
46
+ name: string;
47
+ description?: string;
48
+ isAbstract: boolean;
49
+ decorators: ClassDecorator[];
50
+ metadata: Record<string, any>;
51
+ extends?: Type<any>;
52
+ }
53
+ /**
54
+ * Parses field configuration into a normalized format
55
+ *
56
+ * @param config - Raw field configuration
57
+ * @returns Parsed configuration with defaults
58
+ */
59
+ export declare function parseFieldConfig(config: FieldConfig): ParsedFieldConfig;
60
+ /**
61
+ * Parses OrderBy field configuration
62
+ *
63
+ * @param config - Raw OrderBy field configuration
64
+ * @returns Parsed configuration
65
+ */
66
+ export declare function parseOrderByConfig(config: OrderByFieldConfig): ParsedFieldConfig;
67
+ /**
68
+ * Parses GroupBy field configuration
69
+ *
70
+ * @param config - Raw GroupBy field configuration
71
+ * @returns Parsed configuration
72
+ */
73
+ export declare function parseGroupByConfig(config: GroupByFieldConfig): ParsedFieldConfig;
74
+ /**
75
+ * Parses class options with defaults
76
+ *
77
+ * @param entityName - Name of the entity for default naming
78
+ * @param suffix - Suffix for the class name (e.g., 'WhereFields')
79
+ * @param options - Raw class options
80
+ * @returns Parsed options with defaults
81
+ */
82
+ export declare function parseClassOptions(entityName: string, suffix: string, options?: ClassOptions): ParsedClassOptions;
83
+ /**
84
+ * Validates that a field configuration object is valid
85
+ *
86
+ * @param config - Configuration to validate
87
+ * @param fieldName - Name of the field (for error messages)
88
+ * @throws Error if configuration is invalid
89
+ */
90
+ export declare function validateFieldConfig(config: any, fieldName: string): void;
91
+ /**
92
+ * Validates class options
93
+ *
94
+ * @param options - Options to validate
95
+ * @throws Error if options are invalid
96
+ */
97
+ export declare function validateClassOptions(options: ClassOptions): void;
98
+ //# sourceMappingURL=field-config.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-config.helper.d.ts","sourceRoot":"","sources":["../../../src/helpers/args-helpers/field-config.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW;CAC7B,GAAG;IAEF,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC1B,IAAI,GACJ,IAAI,CAAC,GAAG,CAAC,GACT;IACE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;CAClB,CAAC;AAEN,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI;KAClC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,kBAAkB;CACpC,GAAG;IAEF,CAAC,YAAY,EAAE,MA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kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,iBAAiB,CAchF;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,YAAY,GACrB,kBAAkB,CASpB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAoCxE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAwBhE"}
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseFieldConfig = parseFieldConfig;
4
+ exports.parseOrderByConfig = parseOrderByConfig;
5
+ exports.parseGroupByConfig = parseGroupByConfig;
6
+ exports.parseClassOptions = parseClassOptions;
7
+ exports.validateFieldConfig = validateFieldConfig;
8
+ exports.validateClassOptions = validateClassOptions;
9
+ /**
10
+ * Parses field configuration into a normalized format
11
+ *
12
+ * @param config - Raw field configuration
13
+ * @returns Parsed configuration with defaults
14
+ */
15
+ function parseFieldConfig(config) {
16
+ if (config === true) {
17
+ return {};
18
+ }
19
+ if (typeof config === 'function') {
20
+ return { type: config };
21
+ }
22
+ if (typeof config === 'object' && config !== null) {
23
+ return { ...config };
24
+ }
25
+ throw new Error(`Invalid field configuration: ${config}`);
26
+ }
27
+ /**
28
+ * Parses OrderBy field configuration
29
+ *
30
+ * @param config - Raw OrderBy field configuration
31
+ * @returns Parsed configuration
32
+ */
33
+ function parseOrderByConfig(config) {
34
+ if (config === true) {
35
+ return {};
36
+ }
37
+ if (typeof config === 'function') {
38
+ return { type: config };
39
+ }
40
+ if (typeof config === 'object' && config !== null) {
41
+ return { ...config };
42
+ }
43
+ throw new Error(`Invalid OrderBy field configuration: ${config}`);
44
+ }
45
+ /**
46
+ * Parses GroupBy field configuration
47
+ *
48
+ * @param config - Raw GroupBy field configuration
49
+ * @returns Parsed configuration
50
+ */
51
+ function parseGroupByConfig(config) {
52
+ if (config === true) {
53
+ return { type: Boolean };
54
+ }
55
+ if (typeof config === 'function') {
56
+ return { type: config };
57
+ }
58
+ if (typeof config === 'object' && config !== null) {
59
+ return { ...config };
60
+ }
61
+ throw new Error(`Invalid GroupBy field configuration: ${config}`);
62
+ }
63
+ /**
64
+ * Parses class options with defaults
65
+ *
66
+ * @param entityName - Name of the entity for default naming
67
+ * @param suffix - Suffix for the class name (e.g., 'WhereFields')
68
+ * @param options - Raw class options
69
+ * @returns Parsed options with defaults
70
+ */
71
+ function parseClassOptions(entityName, suffix, options) {
72
+ return {
73
+ name: options?.name || `${entityName}${suffix}`,
74
+ description: options?.description,
75
+ isAbstract: options?.isAbstract ?? true,
76
+ decorators: options?.decorators || [],
77
+ metadata: options?.metadata || {},
78
+ extends: options?.extends
79
+ };
80
+ }
81
+ /**
82
+ * Validates that a field configuration object is valid
83
+ *
84
+ * @param config - Configuration to validate
85
+ * @param fieldName - Name of the field (for error messages)
86
+ * @throws Error if configuration is invalid
87
+ */
88
+ function validateFieldConfig(config, fieldName) {
89
+ if (config === undefined || config === null) {
90
+ throw new Error(`Field configuration for '${fieldName}' cannot be null or undefined`);
91
+ }
92
+ if (config === true) {
93
+ return; // Valid simple configuration
94
+ }
95
+ if (typeof config === 'function') {
96
+ return; // Valid type configuration
97
+ }
98
+ if (typeof config === 'object') {
99
+ // Validate object configuration
100
+ const validKeys = ['type', 'isPlain', 'description', 'required', 'example', 'deprecated', 'enum', 'enumName', 'isRelation'];
101
+ const configKeys = Object.keys(config);
102
+ for (const key of configKeys) {
103
+ if (!validKeys.includes(key)) {
104
+ throw new Error(`Invalid configuration key '${key}' for field '${fieldName}'. Valid keys: ${validKeys.join(', ')}`);
105
+ }
106
+ }
107
+ if (config.type && typeof config.type !== 'function') {
108
+ throw new Error(`Type for field '${fieldName}' must be a class constructor`);
109
+ }
110
+ if (config.enumName && typeof config.enumName !== 'string') {
111
+ throw new Error(`enumName for field '${fieldName}' must be a string`);
112
+ }
113
+ return;
114
+ }
115
+ throw new Error(`Invalid configuration type for field '${fieldName}'. Expected: true, Type<any>, or configuration object`);
116
+ }
117
+ /**
118
+ * Validates class options
119
+ *
120
+ * @param options - Options to validate
121
+ * @throws Error if options are invalid
122
+ */
123
+ function validateClassOptions(options) {
124
+ if (options.name && typeof options.name !== 'string') {
125
+ throw new Error('Class name must be a string');
126
+ }
127
+ if (options.description && typeof options.description !== 'string') {
128
+ throw new Error('Class description must be a string');
129
+ }
130
+ if (options.isAbstract !== undefined && typeof options.isAbstract !== 'boolean') {
131
+ throw new Error('isAbstract option must be a boolean');
132
+ }
133
+ if (options.decorators && !Array.isArray(options.decorators)) {
134
+ throw new Error('decorators option must be an array');
135
+ }
136
+ if (options.metadata && typeof options.metadata !== 'object') {
137
+ throw new Error('metadata option must be an object');
138
+ }
139
+ if (options.extends && typeof options.extends !== 'function') {
140
+ throw new Error('extends option must be a class constructor');
141
+ }
142
+ }
143
+ //# sourceMappingURL=field-config.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-config.helper.js","sourceRoot":"","sources":["../../../src/helpers/args-helpers/field-config.helper.ts"],"names":[],"mappings":";;AA2EA,4CAcC;AAQD,gDAcC;AAQD,gDAcC;AAUD,8CAaC;AASD,kDAoCC;AAQD,oDAwBC;AApKD;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,MAAmB;IAClD,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC1B,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAClD,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC;IACvB,CAAC;IAED,MA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+1,87 @@
1
+ import { Type } from '@nestjs/common';
2
+ import 'reflect-metadata';
3
+ /**
4
+ * Configuration for GroupByArgsFrom mixin
5
+ */
6
+ export interface GroupByArgsFromConfig {
7
+ findArgsType: Type<any>;
8
+ groupByFields: string[];
9
+ className?: string;
10
+ description?: string;
11
+ }
12
+ /**
13
+ * Extracted metadata from FindArgs class for GroupBy generation
14
+ */
15
+ export interface FindArgsMetadata {
16
+ className: string;
17
+ properties: Array<{
18
+ name: string;
19
+ type: any;
20
+ isOptional: boolean;
21
+ description?: string;
22
+ }>;
23
+ entityType?: Type<any>;
24
+ }
25
+ /**
26
+ * GroupByArgsFrom mixin helper that creates a GroupBy class from a FindArgs constructor.
27
+ *
28
+ * This function analyzes the provided FindArgs class and extracts relevant properties
29
+ * to generate a boolean-based GroupBy class, where each specified field becomes a
30
+ * boolean property indicating whether to group by that field.
31
+ *
32
+ * @template T - The FindArgs type
33
+ * @param config - Configuration specifying FindArgs type and fields to include
34
+ * @returns A function that can be used as a mixin base class
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * // Define FindArgs class
39
+ * export class FindProductArgs extends FindArgsFrom({
40
+ * whereType: ProductWhere,
41
+ * orderByType: ProductOrderBy
42
+ * }) {}
43
+ *
44
+ * // Create GroupBy from FindArgs
45
+ * const ProductGroupByFromArgs = GroupByArgsFrom({
46
+ * findArgsType: FindProductArgs,
47
+ * groupByFields: ['category', 'supplier', 'status'],
48
+ * className: 'ProductGroupByFromFindArgs'
49
+ * });
50
+ *
51
+ * // Usage in service or resolver
52
+ * function groupProducts(args: FindProductArgs): ProductGroupByFromArgs {
53
+ * return new ProductGroupByFromArgs();
54
+ * }
55
+ * ```
56
+ */
57
+ export declare function GroupByArgsFrom<T>(config: GroupByArgsFromConfig): Type<any>;
58
+ /**
59
+ * Extracts metadata from a FindArgs class for use in GroupBy generation
60
+ *
61
+ * @param findArgsType - The FindArgs class to analyze
62
+ * @returns Extracted metadata including properties and class information
63
+ */
64
+ export declare function extractFindArgsMetadata(findArgsType: Type<any>): FindArgsMetadata;
65
+ /**
66
+ * Gets the GroupBy configuration metadata from a class created by GroupByArgsFrom
67
+ *
68
+ * @param groupByClass - The class created by GroupByArgsFrom
69
+ * @returns The configuration metadata or undefined if not found
70
+ */
71
+ export declare function getGroupByArgsMetadata(groupByClass: Type<any>): any;
72
+ /**
73
+ * Gets the field metadata for a specific property in a GroupBy class
74
+ *
75
+ * @param groupByClass - The class created by GroupByArgsFrom
76
+ * @param fieldName - The field name to get metadata for
77
+ * @returns The field metadata or undefined if not found
78
+ */
79
+ export declare function getGroupByFieldMetadata(groupByClass: Type<any>, fieldName: string): any;
80
+ /**
81
+ * Validates that a class was created by GroupByArgsFrom
82
+ *
83
+ * @param groupByClass - The class to validate
84
+ * @returns True if the class was created by GroupByArgsFrom
85
+ */
86
+ export declare function isGroupByArgsFromClass(groupByClass: Type<any>): boolean;
87
+ //# sourceMappingURL=groupby-args-from.helper.d.ts.map