@skmtc/core 0.0.800 → 0.0.803

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 (291) hide show
  1. package/esm/context/CoreContext.d.ts +2 -2
  2. package/esm/context/CoreContext.d.ts.map +1 -1
  3. package/esm/context/GenerateContext.d.ts +16 -3
  4. package/esm/context/GenerateContext.d.ts.map +1 -1
  5. package/esm/context/ParseContext.d.ts +3 -3
  6. package/esm/context/ParseContext.d.ts.map +1 -1
  7. package/esm/context/RenderContext.d.ts +153 -1
  8. package/esm/context/RenderContext.d.ts.map +1 -1
  9. package/esm/context/RenderContext.js +179 -0
  10. package/esm/context/types.d.ts +30 -0
  11. package/esm/context/types.d.ts.map +1 -1
  12. package/esm/dsl/model/ModelBase.d.ts +1 -1
  13. package/esm/dsl/model/ModelBase.d.ts.map +1 -1
  14. package/esm/dsl/model/ModelDriver.d.ts +62 -0
  15. package/esm/dsl/model/ModelDriver.d.ts.map +1 -1
  16. package/esm/dsl/model/ModelDriver.js +63 -1
  17. package/esm/dsl/model/toModelBase.d.ts +66 -0
  18. package/esm/dsl/model/toModelBase.d.ts.map +1 -1
  19. package/esm/dsl/model/toModelBase.js +46 -0
  20. package/esm/dsl/model/toModelEntry.d.ts +63 -0
  21. package/esm/dsl/model/toModelEntry.d.ts.map +1 -1
  22. package/esm/dsl/model/toModelEntry.js +63 -0
  23. package/esm/dsl/operation/OperationBase.d.ts +3 -3
  24. package/esm/dsl/operation/OperationBase.d.ts.map +1 -1
  25. package/esm/dsl/operation/OperationDriver.d.ts +84 -0
  26. package/esm/dsl/operation/OperationDriver.d.ts.map +1 -1
  27. package/esm/dsl/operation/OperationDriver.js +85 -1
  28. package/esm/dsl/operation/toOperationBase.d.ts +58 -0
  29. package/esm/dsl/operation/toOperationBase.d.ts.map +1 -1
  30. package/esm/dsl/operation/toOperationBase.js +46 -0
  31. package/esm/dsl/operation/toOperationEntry.d.ts +37 -0
  32. package/esm/dsl/operation/toOperationEntry.d.ts.map +1 -1
  33. package/esm/dsl/operation/toOperationEntry.js +28 -0
  34. package/esm/helpers/isEmpty.d.ts +1 -1
  35. package/esm/helpers/isEmpty.d.ts.map +1 -1
  36. package/esm/helpers/tracer.d.ts +1 -1
  37. package/esm/helpers/tracer.d.ts.map +1 -1
  38. package/esm/helpers/tracer.js +1 -1
  39. package/esm/mod.d.ts +52 -0
  40. package/esm/mod.d.ts.map +1 -1
  41. package/esm/mod.js +52 -0
  42. package/esm/oas/array/Array.d.ts +26 -0
  43. package/esm/oas/array/Array.d.ts.map +1 -1
  44. package/esm/oas/array/Array.js +26 -0
  45. package/esm/oas/array/array-types.d.ts +32 -11
  46. package/esm/oas/array/array-types.d.ts.map +1 -1
  47. package/esm/oas/array/array-types.js +16 -0
  48. package/esm/oas/array/toArray.d.ts +111 -0
  49. package/esm/oas/array/toArray.d.ts.map +1 -1
  50. package/esm/oas/array/toArray.js +115 -3
  51. package/esm/oas/boolean/Boolean.d.ts +26 -0
  52. package/esm/oas/boolean/Boolean.d.ts.map +1 -1
  53. package/esm/oas/boolean/Boolean.js +26 -0
  54. package/esm/oas/boolean/boolean-types.d.ts +1 -7
  55. package/esm/oas/boolean/boolean-types.d.ts.map +1 -1
  56. package/esm/oas/boolean/toBoolean.d.ts +57 -0
  57. package/esm/oas/boolean/toBoolean.d.ts.map +1 -1
  58. package/esm/oas/boolean/toBoolean.js +57 -0
  59. package/esm/oas/components/components-types.d.ts +19 -0
  60. package/esm/oas/components/components-types.d.ts.map +1 -0
  61. package/esm/oas/components/components-types.js +21 -0
  62. package/esm/oas/contact/contact-types.d.ts +9 -0
  63. package/esm/oas/contact/contact-types.d.ts.map +1 -0
  64. package/esm/oas/contact/contact-types.js +7 -0
  65. package/esm/oas/discriminator/discriminator-types.d.ts +1 -5
  66. package/esm/oas/discriminator/discriminator-types.d.ts.map +1 -1
  67. package/esm/oas/document/document-types.d.ts +16 -0
  68. package/esm/oas/document/document-types.d.ts.map +1 -0
  69. package/esm/oas/document/document-types.js +18 -0
  70. package/esm/oas/example/example-types.d.ts +1 -6
  71. package/esm/oas/example/example-types.d.ts.map +1 -1
  72. package/esm/oas/header/header-types.d.ts +50 -0
  73. package/esm/oas/header/header-types.d.ts.map +1 -0
  74. package/esm/oas/header/header-types.js +30 -0
  75. package/esm/oas/info/info-types.d.ts +14 -0
  76. package/esm/oas/info/info-types.d.ts.map +1 -0
  77. package/esm/oas/info/info-types.js +13 -0
  78. package/esm/oas/integer/integer-types.d.ts +3 -17
  79. package/esm/oas/integer/integer-types.d.ts.map +1 -1
  80. package/esm/oas/license/license-types.d.ts +9 -0
  81. package/esm/oas/license/license-types.d.ts.map +1 -0
  82. package/esm/oas/license/license-types.js +7 -0
  83. package/esm/oas/mediaType/mediaType-types.d.ts +1 -11
  84. package/esm/oas/mediaType/mediaType-types.d.ts.map +1 -1
  85. package/esm/oas/number/number-types.d.ts +2 -16
  86. package/esm/oas/number/number-types.d.ts.map +1 -1
  87. package/esm/oas/number/toNumber.d.ts +62 -0
  88. package/esm/oas/number/toNumber.d.ts.map +1 -1
  89. package/esm/oas/number/toNumber.js +62 -0
  90. package/esm/oas/operation/operation-types.d.ts +22 -0
  91. package/esm/oas/operation/operation-types.d.ts.map +1 -0
  92. package/esm/oas/operation/operation-types.js +35 -0
  93. package/esm/oas/parameter/Parameter.d.ts +47 -0
  94. package/esm/oas/parameter/Parameter.d.ts.map +1 -1
  95. package/esm/oas/parameter/Parameter.js +47 -0
  96. package/esm/oas/parameter/parameter-types.d.ts +3 -58
  97. package/esm/oas/parameter/parameter-types.d.ts.map +1 -1
  98. package/esm/oas/pathItem/pathItem-types.d.ts +12 -0
  99. package/esm/oas/pathItem/pathItem-types.d.ts.map +1 -0
  100. package/esm/oas/pathItem/pathItem-types.js +12 -0
  101. package/esm/oas/requestBody/requestBody-types.d.ts +10 -0
  102. package/esm/oas/requestBody/requestBody-types.d.ts.map +1 -0
  103. package/esm/oas/requestBody/requestBody-types.js +9 -0
  104. package/esm/oas/response/response-types.d.ts +12 -0
  105. package/esm/oas/response/response-types.d.ts.map +1 -0
  106. package/esm/oas/response/response-types.js +11 -0
  107. package/esm/oas/schema/toSchemasV3.js +2 -2
  108. package/esm/oas/server/toServerV3.d.ts.map +1 -1
  109. package/esm/oas/string/string-types.d.ts +2 -29
  110. package/esm/oas/string/string-types.d.ts.map +1 -1
  111. package/esm/oas/string/toString.d.ts +125 -1
  112. package/esm/oas/string/toString.d.ts.map +1 -1
  113. package/esm/oas/string/toString.js +119 -0
  114. package/esm/oas/tag/tag-types.d.ts +8 -0
  115. package/esm/oas/tag/tag-types.d.ts.map +1 -0
  116. package/esm/oas/tag/tag-types.js +8 -0
  117. package/esm/oas/union/union-types.d.ts +1 -12
  118. package/esm/oas/union/union-types.d.ts.map +1 -1
  119. package/esm/oas/unknown/unknown-types.d.ts +1 -7
  120. package/esm/oas/unknown/unknown-types.d.ts.map +1 -1
  121. package/esm/types/CustomValue.d.ts +58 -0
  122. package/esm/types/CustomValue.d.ts.map +1 -1
  123. package/esm/types/CustomValue.js +58 -0
  124. package/esm/types/DenoJson.d.ts +24 -0
  125. package/esm/types/DenoJson.d.ts.map +1 -1
  126. package/esm/types/DenoJson.js +12 -0
  127. package/esm/types/Enrichments.d.ts +103 -0
  128. package/esm/types/Enrichments.d.ts.map +1 -1
  129. package/esm/types/Enrichments.js +52 -0
  130. package/esm/types/GeneratedValue.d.ts +17 -0
  131. package/esm/types/GeneratedValue.d.ts.map +1 -1
  132. package/esm/types/Logger.d.ts +9 -0
  133. package/esm/types/Logger.d.ts.map +1 -0
  134. package/esm/types/Logger.js +1 -0
  135. package/esm/types/Preview.d.ts +37 -0
  136. package/esm/types/Preview.d.ts.map +1 -1
  137. package/esm/types/Preview.js +37 -0
  138. package/esm/types/Settings.d.ts +35 -0
  139. package/esm/types/Settings.d.ts.map +1 -1
  140. package/esm/types/Settings.js +27 -0
  141. package/esm/typescript/FunctionParameter.d.ts +4 -4
  142. package/esm/typescript/FunctionParameter.d.ts.map +1 -1
  143. package/esm/typescript/List.d.ts +40 -2
  144. package/esm/typescript/List.d.ts.map +1 -1
  145. package/esm/typescript/List.js +32 -0
  146. package/package.json +1 -1
  147. package/script/context/CoreContext.d.ts +2 -2
  148. package/script/context/CoreContext.d.ts.map +1 -1
  149. package/script/context/GenerateContext.d.ts +16 -3
  150. package/script/context/GenerateContext.d.ts.map +1 -1
  151. package/script/context/ParseContext.d.ts +3 -3
  152. package/script/context/ParseContext.d.ts.map +1 -1
  153. package/script/context/RenderContext.d.ts +153 -1
  154. package/script/context/RenderContext.d.ts.map +1 -1
  155. package/script/context/RenderContext.js +179 -0
  156. package/script/context/types.d.ts +30 -0
  157. package/script/context/types.d.ts.map +1 -1
  158. package/script/dsl/model/ModelBase.d.ts +1 -1
  159. package/script/dsl/model/ModelBase.d.ts.map +1 -1
  160. package/script/dsl/model/ModelDriver.d.ts +62 -0
  161. package/script/dsl/model/ModelDriver.d.ts.map +1 -1
  162. package/script/dsl/model/ModelDriver.js +63 -1
  163. package/script/dsl/model/toModelBase.d.ts +66 -0
  164. package/script/dsl/model/toModelBase.d.ts.map +1 -1
  165. package/script/dsl/model/toModelBase.js +46 -0
  166. package/script/dsl/model/toModelEntry.d.ts +63 -0
  167. package/script/dsl/model/toModelEntry.d.ts.map +1 -1
  168. package/script/dsl/model/toModelEntry.js +63 -0
  169. package/script/dsl/operation/OperationBase.d.ts +3 -3
  170. package/script/dsl/operation/OperationBase.d.ts.map +1 -1
  171. package/script/dsl/operation/OperationDriver.d.ts +84 -0
  172. package/script/dsl/operation/OperationDriver.d.ts.map +1 -1
  173. package/script/dsl/operation/OperationDriver.js +85 -1
  174. package/script/dsl/operation/toOperationBase.d.ts +58 -0
  175. package/script/dsl/operation/toOperationBase.d.ts.map +1 -1
  176. package/script/dsl/operation/toOperationBase.js +46 -0
  177. package/script/dsl/operation/toOperationEntry.d.ts +37 -0
  178. package/script/dsl/operation/toOperationEntry.d.ts.map +1 -1
  179. package/script/dsl/operation/toOperationEntry.js +28 -0
  180. package/script/helpers/isEmpty.d.ts +1 -1
  181. package/script/helpers/isEmpty.d.ts.map +1 -1
  182. package/script/helpers/tracer.d.ts +1 -1
  183. package/script/helpers/tracer.d.ts.map +1 -1
  184. package/script/helpers/tracer.js +1 -1
  185. package/script/mod.d.ts +52 -0
  186. package/script/mod.d.ts.map +1 -1
  187. package/script/mod.js +52 -0
  188. package/script/oas/array/Array.d.ts +26 -0
  189. package/script/oas/array/Array.d.ts.map +1 -1
  190. package/script/oas/array/Array.js +26 -0
  191. package/script/oas/array/array-types.d.ts +32 -11
  192. package/script/oas/array/array-types.d.ts.map +1 -1
  193. package/script/oas/array/array-types.js +17 -1
  194. package/script/oas/array/toArray.d.ts +111 -0
  195. package/script/oas/array/toArray.d.ts.map +1 -1
  196. package/script/oas/array/toArray.js +114 -2
  197. package/script/oas/boolean/Boolean.d.ts +26 -0
  198. package/script/oas/boolean/Boolean.d.ts.map +1 -1
  199. package/script/oas/boolean/Boolean.js +26 -0
  200. package/script/oas/boolean/boolean-types.d.ts +1 -7
  201. package/script/oas/boolean/boolean-types.d.ts.map +1 -1
  202. package/script/oas/boolean/toBoolean.d.ts +57 -0
  203. package/script/oas/boolean/toBoolean.d.ts.map +1 -1
  204. package/script/oas/boolean/toBoolean.js +57 -0
  205. package/script/oas/components/components-types.d.ts +19 -0
  206. package/script/oas/components/components-types.d.ts.map +1 -0
  207. package/script/oas/components/components-types.js +57 -0
  208. package/script/oas/contact/contact-types.d.ts +9 -0
  209. package/script/oas/contact/contact-types.d.ts.map +1 -0
  210. package/script/oas/contact/contact-types.js +43 -0
  211. package/script/oas/discriminator/discriminator-types.d.ts +1 -5
  212. package/script/oas/discriminator/discriminator-types.d.ts.map +1 -1
  213. package/script/oas/document/document-types.d.ts +16 -0
  214. package/script/oas/document/document-types.d.ts.map +1 -0
  215. package/script/oas/document/document-types.js +54 -0
  216. package/script/oas/example/example-types.d.ts +1 -6
  217. package/script/oas/example/example-types.d.ts.map +1 -1
  218. package/script/oas/header/header-types.d.ts +50 -0
  219. package/script/oas/header/header-types.d.ts.map +1 -0
  220. package/script/oas/header/header-types.js +66 -0
  221. package/script/oas/info/info-types.d.ts +14 -0
  222. package/script/oas/info/info-types.d.ts.map +1 -0
  223. package/script/oas/info/info-types.js +49 -0
  224. package/script/oas/integer/integer-types.d.ts +3 -17
  225. package/script/oas/integer/integer-types.d.ts.map +1 -1
  226. package/script/oas/license/license-types.d.ts +9 -0
  227. package/script/oas/license/license-types.d.ts.map +1 -0
  228. package/script/oas/license/license-types.js +43 -0
  229. package/script/oas/mediaType/mediaType-types.d.ts +1 -11
  230. package/script/oas/mediaType/mediaType-types.d.ts.map +1 -1
  231. package/script/oas/number/number-types.d.ts +2 -16
  232. package/script/oas/number/number-types.d.ts.map +1 -1
  233. package/script/oas/number/toNumber.d.ts +62 -0
  234. package/script/oas/number/toNumber.d.ts.map +1 -1
  235. package/script/oas/number/toNumber.js +62 -0
  236. package/script/oas/operation/operation-types.d.ts +22 -0
  237. package/script/oas/operation/operation-types.d.ts.map +1 -0
  238. package/script/oas/operation/operation-types.js +71 -0
  239. package/script/oas/parameter/Parameter.d.ts +47 -0
  240. package/script/oas/parameter/Parameter.d.ts.map +1 -1
  241. package/script/oas/parameter/Parameter.js +47 -0
  242. package/script/oas/parameter/parameter-types.d.ts +3 -58
  243. package/script/oas/parameter/parameter-types.d.ts.map +1 -1
  244. package/script/oas/pathItem/pathItem-types.d.ts +12 -0
  245. package/script/oas/pathItem/pathItem-types.d.ts.map +1 -0
  246. package/script/oas/pathItem/pathItem-types.js +48 -0
  247. package/script/oas/requestBody/requestBody-types.d.ts +10 -0
  248. package/script/oas/requestBody/requestBody-types.d.ts.map +1 -0
  249. package/script/oas/requestBody/requestBody-types.js +45 -0
  250. package/script/oas/response/response-types.d.ts +12 -0
  251. package/script/oas/response/response-types.d.ts.map +1 -0
  252. package/script/oas/response/response-types.js +47 -0
  253. package/script/oas/schema/toSchemasV3.js +2 -2
  254. package/script/oas/server/toServerV3.d.ts.map +1 -1
  255. package/script/oas/string/string-types.d.ts +2 -29
  256. package/script/oas/string/string-types.d.ts.map +1 -1
  257. package/script/oas/string/toString.d.ts +125 -1
  258. package/script/oas/string/toString.d.ts.map +1 -1
  259. package/script/oas/string/toString.js +119 -0
  260. package/script/oas/tag/tag-types.d.ts +8 -0
  261. package/script/oas/tag/tag-types.d.ts.map +1 -0
  262. package/script/oas/tag/tag-types.js +44 -0
  263. package/script/oas/union/union-types.d.ts +1 -12
  264. package/script/oas/union/union-types.d.ts.map +1 -1
  265. package/script/oas/unknown/unknown-types.d.ts +1 -7
  266. package/script/oas/unknown/unknown-types.d.ts.map +1 -1
  267. package/script/types/CustomValue.d.ts +58 -0
  268. package/script/types/CustomValue.d.ts.map +1 -1
  269. package/script/types/CustomValue.js +58 -0
  270. package/script/types/DenoJson.d.ts +24 -0
  271. package/script/types/DenoJson.d.ts.map +1 -1
  272. package/script/types/DenoJson.js +12 -0
  273. package/script/types/Enrichments.d.ts +103 -0
  274. package/script/types/Enrichments.d.ts.map +1 -1
  275. package/script/types/Enrichments.js +52 -0
  276. package/script/types/GeneratedValue.d.ts +17 -0
  277. package/script/types/GeneratedValue.d.ts.map +1 -1
  278. package/script/types/Logger.d.ts +9 -0
  279. package/script/types/Logger.d.ts.map +1 -0
  280. package/script/types/Logger.js +2 -0
  281. package/script/types/Preview.d.ts +37 -0
  282. package/script/types/Preview.d.ts.map +1 -1
  283. package/script/types/Preview.js +37 -0
  284. package/script/types/Settings.d.ts +35 -0
  285. package/script/types/Settings.d.ts.map +1 -1
  286. package/script/types/Settings.js +27 -0
  287. package/script/typescript/FunctionParameter.d.ts +4 -4
  288. package/script/typescript/FunctionParameter.d.ts.map +1 -1
  289. package/script/typescript/List.d.ts +40 -2
  290. package/script/typescript/List.d.ts.map +1 -1
  291. package/script/typescript/List.js +32 -0
@@ -38,6 +38,52 @@ const GeneratorKeys_js_1 = require("../../types/GeneratorKeys.js");
38
38
  const ModelBase_js_1 = require("./ModelBase.js");
39
39
  const v = __importStar(require("valibot"));
40
40
  const lodash_es_1 = require("lodash-es");
41
+ /**
42
+ * Creates a base model class constructor for generating type-safe model artifacts.
43
+ *
44
+ * This factory function creates a specialized ModelBase class that implements
45
+ * the provided configuration for identifier generation, export paths, and
46
+ * enrichment handling. The resulting class can be instantiated to generate
47
+ * model artifacts from OpenAPI schemas.
48
+ *
49
+ * @template EnrichmentType - Type of enrichments to apply to generated models
50
+ * @param config - Configuration defining the model generation behavior
51
+ * @returns Constructor function for creating model instances
52
+ *
53
+ * @example Creating a TypeScript interface generator
54
+ * ```typescript
55
+ * import { toModelBase } from '@skmtc/core';
56
+ *
57
+ * const TypeScriptModelBase = toModelBase({
58
+ * id: 'typescript-interfaces',
59
+ * toIdentifier: (refName) => new Identifier(pascalCase(refName)),
60
+ * toExportPath: (refName) => `./models/${kebabCase(refName)}.ts`,
61
+ * toEnrichmentSchema: () => v.object({
62
+ * includeValidation: v.optional(v.boolean()),
63
+ * readonly: v.optional(v.boolean())
64
+ * })
65
+ * });
66
+ *
67
+ * class TypeScriptModelGenerator extends TypeScriptModelBase {
68
+ * generate() {
69
+ * const enrichments = this.enrichments;
70
+ * const interface = generateInterface(this.schema, {
71
+ * readonly: enrichments?.readonly ?? false
72
+ * });
73
+ * this.register({ file: this.createFile(interface) });
74
+ * }
75
+ * }
76
+ * ```
77
+ *
78
+ * @example Creating a validation schema generator
79
+ * ```typescript
80
+ * const ValidationModelBase = toModelBase({
81
+ * id: 'zod-schemas',
82
+ * toIdentifier: (refName) => new Identifier(`${pascalCase(refName)}Schema`),
83
+ * toExportPath: (refName) => `./schemas/${kebabCase(refName)}.schema.ts`
84
+ * });
85
+ * ```
86
+ */
41
87
  const toModelBase = (config) => {
42
88
  var _a;
43
89
  return _a = class extends ModelBase_js_1.ModelBase {
@@ -11,6 +11,69 @@ type ToModelEntryArgs<EnrichmentType = undefined, Acc = void> = {
11
11
  toMappingModule?: ({ context, refName }: ToModelMappingArgs) => MappingModule;
12
12
  toEnrichmentRequest?: <RequestedEnrichment extends EnrichmentType>(refName: RefName) => EnrichmentRequest<RequestedEnrichment> | undefined;
13
13
  };
14
+ /**
15
+ * Creates a model transformation entry for the SKMTC pipeline.
16
+ *
17
+ * This function creates a standardized model entry that defines how to transform
18
+ * OpenAPI schema objects into model artifacts. Model entries are used by the
19
+ * generation pipeline to process schemas and create output files.
20
+ *
21
+ * The resulting entry includes transformation logic, preview generation,
22
+ * mapping generation, enrichment handling, and schema validation.
23
+ *
24
+ * @template EnrichmentType - Type of enrichments that can be applied to models
25
+ * @template Acc - Accumulator type for the transformation process
26
+ * @param args - Configuration for the model entry
27
+ * @param args.id - Unique identifier for this model entry
28
+ * @param args.transform - Function to transform schemas into artifacts
29
+ * @param args.toPreviewModule - Optional function to generate preview modules
30
+ * @param args.toMappingModule - Optional function to generate mapping modules
31
+ * @param args.toEnrichmentSchema - Optional function to provide enrichment validation
32
+ * @param args.toEnrichmentRequest - Optional function to request enrichments
33
+ * @returns Model entry object for use in the generation pipeline
34
+ *
35
+ * @example Basic model entry
36
+ * ```typescript
37
+ * import { toModelEntry } from '@skmtc/core';
38
+ *
39
+ * const typeScriptModelEntry = toModelEntry({
40
+ * id: 'typescript-models',
41
+ * transform: ({ context, refName, acc }) => {
42
+ * const schema = context.getSchemaByRefName(refName);
43
+ * const tsInterface = generateTypeScriptInterface(schema);
44
+ * return { ...acc, [refName]: tsInterface };
45
+ * },
46
+ * toPreviewModule: ({ context, refName }) => ({
47
+ * group: 'forms',
48
+ * title: `${refName} Model`,
49
+ * description: 'Generated TypeScript interface'
50
+ * })
51
+ * });
52
+ * ```
53
+ *
54
+ * @example Model entry with enrichments
55
+ * ```typescript
56
+ * const validationModelEntry = toModelEntry({
57
+ * id: 'validation-schemas',
58
+ * transform: ({ context, refName, acc }) => {
59
+ * const enrichments = context.getEnrichments(refName);
60
+ * const schema = context.getSchemaByRefName(refName);
61
+ * const validationSchema = generateValidationSchema(schema, {
62
+ * strict: enrichments?.strict ?? false
63
+ * });
64
+ * return { ...acc, [refName]: validationSchema };
65
+ * },
66
+ * toEnrichmentSchema: () => v.object({
67
+ * strict: v.optional(v.boolean()),
68
+ * nullable: v.optional(v.boolean())
69
+ * }),
70
+ * toEnrichmentRequest: (refName) => ({
71
+ * path: `models.${refName}`,
72
+ * schema: enrichmentSchema
73
+ * })
74
+ * });
75
+ * ```
76
+ */
14
77
  export declare const toModelEntry: <EnrichmentType = undefined, Acc = void>({ id, transform, toPreviewModule, toMappingModule, toEnrichmentSchema, toEnrichmentRequest }: ToModelEntryArgs<EnrichmentType, Acc>) => {
15
78
  id: string;
16
79
  type: "model";
@@ -1 +1 @@
1
- {"version":3,"file":"toModelEntry.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/toModelEntry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAClG,OAAO,KAAK,KAAK,CAAC,MAAM,SAAS,CAAA;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE1E,KAAK,gBAAgB,CAAC,cAAc,GAAG,SAAS,EAAE,GAAG,GAAG,IAAI,IAAI;IAC9D,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,kBAAkB,CAAC,GAAG,CAAC,KAAK,GAAG,CAAA;IACtE,kBAAkB,CAAC,EAAE,MAAM,CAAC,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;IAC1D,eAAe,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,wBAAwB,KAAK,aAAa,CAAA;IACnF,eAAe,CAAC,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AE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,kBAAkB,KAAK,aAAa,CAAC;IAC9E,kBAAkB,CAAC,EAAE,MAAM,CAAC,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;IAC3D,mBAAmB,CAAC,EAAE,CAAC,mBAAmB,SAAS,cAAc,EAC/D,OAAO,EAAE,OAAO,KACb,iBAAiB,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC;CAWzD,CAAA"}
@@ -1,6 +1,69 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toModelEntry = void 0;
4
+ /**
5
+ * Creates a model transformation entry for the SKMTC pipeline.
6
+ *
7
+ * This function creates a standardized model entry that defines how to transform
8
+ * OpenAPI schema objects into model artifacts. Model entries are used by the
9
+ * generation pipeline to process schemas and create output files.
10
+ *
11
+ * The resulting entry includes transformation logic, preview generation,
12
+ * mapping generation, enrichment handling, and schema validation.
13
+ *
14
+ * @template EnrichmentType - Type of enrichments that can be applied to models
15
+ * @template Acc - Accumulator type for the transformation process
16
+ * @param args - Configuration for the model entry
17
+ * @param args.id - Unique identifier for this model entry
18
+ * @param args.transform - Function to transform schemas into artifacts
19
+ * @param args.toPreviewModule - Optional function to generate preview modules
20
+ * @param args.toMappingModule - Optional function to generate mapping modules
21
+ * @param args.toEnrichmentSchema - Optional function to provide enrichment validation
22
+ * @param args.toEnrichmentRequest - Optional function to request enrichments
23
+ * @returns Model entry object for use in the generation pipeline
24
+ *
25
+ * @example Basic model entry
26
+ * ```typescript
27
+ * import { toModelEntry } from '@skmtc/core';
28
+ *
29
+ * const typeScriptModelEntry = toModelEntry({
30
+ * id: 'typescript-models',
31
+ * transform: ({ context, refName, acc }) => {
32
+ * const schema = context.getSchemaByRefName(refName);
33
+ * const tsInterface = generateTypeScriptInterface(schema);
34
+ * return { ...acc, [refName]: tsInterface };
35
+ * },
36
+ * toPreviewModule: ({ context, refName }) => ({
37
+ * group: 'forms',
38
+ * title: `${refName} Model`,
39
+ * description: 'Generated TypeScript interface'
40
+ * })
41
+ * });
42
+ * ```
43
+ *
44
+ * @example Model entry with enrichments
45
+ * ```typescript
46
+ * const validationModelEntry = toModelEntry({
47
+ * id: 'validation-schemas',
48
+ * transform: ({ context, refName, acc }) => {
49
+ * const enrichments = context.getEnrichments(refName);
50
+ * const schema = context.getSchemaByRefName(refName);
51
+ * const validationSchema = generateValidationSchema(schema, {
52
+ * strict: enrichments?.strict ?? false
53
+ * });
54
+ * return { ...acc, [refName]: validationSchema };
55
+ * },
56
+ * toEnrichmentSchema: () => v.object({
57
+ * strict: v.optional(v.boolean()),
58
+ * nullable: v.optional(v.boolean())
59
+ * }),
60
+ * toEnrichmentRequest: (refName) => ({
61
+ * path: `models.${refName}`,
62
+ * schema: enrichmentSchema
63
+ * })
64
+ * });
65
+ * ```
66
+ */
4
67
  const toModelEntry = ({ id, transform, toPreviewModule, toMappingModule, toEnrichmentSchema, toEnrichmentRequest }) => {
5
68
  return {
6
69
  id,
@@ -9,9 +9,9 @@ import type { Definition } from '../Definition.js';
9
9
  import type { Inserted } from '../Inserted.js';
10
10
  import type { ModelInsertable } from '../model/types.js';
11
11
  import type { RefName } from '../../types/RefName.js';
12
- import { OasSchema } from '../../oas/schema/Schema.js';
13
- import { OasRef } from '../../oas/ref/Ref.js';
14
- import { OasVoid } from '../../oas/void/Void.js';
12
+ import type { OasSchema } from '../../oas/schema/Schema.js';
13
+ import type { OasRef } from '../../oas/ref/Ref.js';
14
+ import type { OasVoid } from '../../oas/void/Void.js';
15
15
  /**
16
16
  * Constructor arguments for {@link OperationBase}.
17
17
  *
@@ -1 +1 @@
1
- {"version":3,"file":"OperationBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/OperationBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACM,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;CAMhD"}
@@ -12,17 +12,101 @@ type CreateOperationArgs<V extends GeneratedValue, T extends GenerationType, Enr
12
12
  destinationPath?: string;
13
13
  noExport?: boolean;
14
14
  };
15
+ /**
16
+ * Driver class for generating operation-based artifacts from OpenAPI operations.
17
+ *
18
+ * The `OperationDriver` manages the transformation of OpenAPI operation objects
19
+ * into code artifacts, handling path generation, identifier resolution, and
20
+ * definition management. It serves as the core orchestrator for operation-based
21
+ * code generation in the SKMTC pipeline.
22
+ *
23
+ * @template V - Type of generated values produced by this driver
24
+ * @template T - Type of generation strategy (e.g., 'function', 'class', 'hook')
25
+ * @template EnrichmentType - Type of enrichments that can be applied
26
+ *
27
+ * @example Basic usage in an operation generator
28
+ * ```typescript
29
+ * class APIClientGenerator extends OperationBase {
30
+ * generate() {
31
+ * const driver = new OperationDriver({
32
+ * context: this.context,
33
+ * insertable: this,
34
+ * operation: this.operation,
35
+ * generation: 'function'
36
+ * });
37
+ *
38
+ * const functionCode = driver.definition.toValueString();
39
+ * const file = this.createFile(functionCode);
40
+ * this.register({ file });
41
+ * }
42
+ * }
43
+ * ```
44
+ */
15
45
  export declare class OperationDriver<V extends GeneratedValue, T extends GenerationType, EnrichmentType = undefined> {
46
+ /** The generation context providing access to OAS objects and utilities */
16
47
  context: GenerateContext;
48
+ /** The insertable object that provides generation configuration */
17
49
  insertable: OperationInsertable<V, EnrichmentType>;
50
+ /** The OpenAPI operation object being processed */
18
51
  operation: OasOperation;
52
+ /** Content settings for customizing generation behavior */
19
53
  settings: ContentSettings<EnrichmentType>;
54
+ /** Optional custom destination path for generated files */
20
55
  destinationPath?: string;
56
+ /** The generated definition containing the transformed operation */
21
57
  definition: GeneratedDefinition<V, T>;
58
+ /** Whether to exclude this operation from exports */
22
59
  noExport?: boolean;
60
+ /**
61
+ * Creates a new OperationDriver instance.
62
+ *
63
+ * @param args - Configuration for the operation driver
64
+ * @param args.context - Generation context
65
+ * @param args.insertable - Insertable providing generation configuration
66
+ * @param args.operation - OpenAPI operation to process
67
+ * @param args.generation - Optional generation type
68
+ * @param args.destinationPath - Optional custom destination path
69
+ * @param args.noExport - Whether to exclude from exports
70
+ */
23
71
  constructor({ context, insertable, operation, generation, destinationPath, noExport }: CreateOperationArgs<V, T, EnrichmentType>);
72
+ /**
73
+ * Applies generation configuration to create the operation definition.
74
+ *
75
+ * This method handles the core generation logic for operations, including
76
+ * identifier resolution, export path management, and import registration
77
+ * for cross-file dependencies.
78
+ *
79
+ * @template T - The generation type
80
+ * @param args - Apply configuration arguments
81
+ * @param args.generation - Optional generation type (unused currently)
82
+ * @param args.destinationPath - Optional destination path for imports
83
+ * @returns Generated definition for the operation
84
+ */
24
85
  private apply;
86
+ /**
87
+ * Retrieves or creates a definition for the operation.
88
+ *
89
+ * This method first checks for cached definitions to avoid duplicate generation,
90
+ * then creates a new definition if none exists. It handles the complete operation
91
+ * transformation process including schema resolution and value generation.
92
+ *
93
+ * @param args - Definition retrieval arguments
94
+ * @param args.identifier - The identifier for the definition
95
+ * @param args.exportPath - The export path for the definition
96
+ * @returns Operation definition instance
97
+ */
25
98
  private getDefinition;
99
+ /**
100
+ * Type guard to verify a definition matches the expected generated value type.
101
+ *
102
+ * This method performs type narrowing to ensure a cached definition is compatible
103
+ * with the current generation requirements, including export path validation.
104
+ *
105
+ * @template V - The expected generated value type
106
+ * @param definition - The definition to verify (may be undefined)
107
+ * @param exportPath - Expected export path for validation
108
+ * @returns True if definition matches expected type and constraints
109
+ */
26
110
  private affirmDefinition;
27
111
  }
28
112
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"OperationDriver.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/OperationDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,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E,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IACrC,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;;;;;;;;OAUG;gBACS,EACV,OAAO,EACP,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,QAAQ,EACT,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,cAAc,CAAC;IAc5C;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,KAAK;IAuBb;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,aAAa;IA+BrB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,gBAAgB;CAqBzB"}
@@ -4,44 +4,92 @@ exports.OperationDriver = void 0;
4
4
  const normalize_js_1 = require("../../deps/jsr.io/@std/path/1.1.2/normalize.js");
5
5
  const Definition_js_1 = require("../Definition.js");
6
6
  const GeneratorKeys_js_1 = require("../../types/GeneratorKeys.js");
7
+ /**
8
+ * Driver class for generating operation-based artifacts from OpenAPI operations.
9
+ *
10
+ * The `OperationDriver` manages the transformation of OpenAPI operation objects
11
+ * into code artifacts, handling path generation, identifier resolution, and
12
+ * definition management. It serves as the core orchestrator for operation-based
13
+ * code generation in the SKMTC pipeline.
14
+ *
15
+ * @template V - Type of generated values produced by this driver
16
+ * @template T - Type of generation strategy (e.g., 'function', 'class', 'hook')
17
+ * @template EnrichmentType - Type of enrichments that can be applied
18
+ *
19
+ * @example Basic usage in an operation generator
20
+ * ```typescript
21
+ * class APIClientGenerator extends OperationBase {
22
+ * generate() {
23
+ * const driver = new OperationDriver({
24
+ * context: this.context,
25
+ * insertable: this,
26
+ * operation: this.operation,
27
+ * generation: 'function'
28
+ * });
29
+ *
30
+ * const functionCode = driver.definition.toValueString();
31
+ * const file = this.createFile(functionCode);
32
+ * this.register({ file });
33
+ * }
34
+ * }
35
+ * ```
36
+ */
7
37
  class OperationDriver {
38
+ /**
39
+ * Creates a new OperationDriver instance.
40
+ *
41
+ * @param args - Configuration for the operation driver
42
+ * @param args.context - Generation context
43
+ * @param args.insertable - Insertable providing generation configuration
44
+ * @param args.operation - OpenAPI operation to process
45
+ * @param args.generation - Optional generation type
46
+ * @param args.destinationPath - Optional custom destination path
47
+ * @param args.noExport - Whether to exclude from exports
48
+ */
8
49
  constructor({ context, insertable, operation, generation, destinationPath, noExport }) {
50
+ /** The generation context providing access to OAS objects and utilities */
9
51
  Object.defineProperty(this, "context", {
10
52
  enumerable: true,
11
53
  configurable: true,
12
54
  writable: true,
13
55
  value: void 0
14
56
  });
57
+ /** The insertable object that provides generation configuration */
15
58
  Object.defineProperty(this, "insertable", {
16
59
  enumerable: true,
17
60
  configurable: true,
18
61
  writable: true,
19
62
  value: void 0
20
63
  });
64
+ /** The OpenAPI operation object being processed */
21
65
  Object.defineProperty(this, "operation", {
22
66
  enumerable: true,
23
67
  configurable: true,
24
68
  writable: true,
25
69
  value: void 0
26
70
  });
71
+ /** Content settings for customizing generation behavior */
27
72
  Object.defineProperty(this, "settings", {
28
73
  enumerable: true,
29
74
  configurable: true,
30
75
  writable: true,
31
76
  value: void 0
32
77
  });
78
+ /** Optional custom destination path for generated files */
33
79
  Object.defineProperty(this, "destinationPath", {
34
80
  enumerable: true,
35
81
  configurable: true,
36
82
  writable: true,
37
83
  value: void 0
38
84
  });
85
+ /** The generated definition containing the transformed operation */
39
86
  Object.defineProperty(this, "definition", {
40
87
  enumerable: true,
41
88
  configurable: true,
42
89
  writable: true,
43
90
  value: void 0
44
91
  });
92
+ /** Whether to exclude this operation from exports */
45
93
  Object.defineProperty(this, "noExport", {
46
94
  enumerable: true,
47
95
  configurable: true,
@@ -59,7 +107,20 @@ class OperationDriver {
59
107
  });
60
108
  this.definition = this.apply({ generation, destinationPath });
61
109
  }
62
- apply({ generation, destinationPath } = {}) {
110
+ /**
111
+ * Applies generation configuration to create the operation definition.
112
+ *
113
+ * This method handles the core generation logic for operations, including
114
+ * identifier resolution, export path management, and import registration
115
+ * for cross-file dependencies.
116
+ *
117
+ * @template T - The generation type
118
+ * @param args - Apply configuration arguments
119
+ * @param args.generation - Optional generation type (unused currently)
120
+ * @param args.destinationPath - Optional destination path for imports
121
+ * @returns Generated definition for the operation
122
+ */
123
+ apply({ generation: _generation, destinationPath } = {}) {
63
124
  const { identifier, exportPath } = this.settings;
64
125
  // Everything is selected (for now)
65
126
  // if (/*!selected && */ generation !== 'force') {
@@ -74,6 +135,18 @@ class OperationDriver {
74
135
  }
75
136
  return definition;
76
137
  }
138
+ /**
139
+ * Retrieves or creates a definition for the operation.
140
+ *
141
+ * This method first checks for cached definitions to avoid duplicate generation,
142
+ * then creates a new definition if none exists. It handles the complete operation
143
+ * transformation process including schema resolution and value generation.
144
+ *
145
+ * @param args - Definition retrieval arguments
146
+ * @param args.identifier - The identifier for the definition
147
+ * @param args.exportPath - The export path for the definition
148
+ * @returns Operation definition instance
149
+ */
77
150
  getDefinition({ identifier, exportPath }) {
78
151
  const cachedDefinition = this.context.findDefinition({
79
152
  name: identifier.name,
@@ -99,6 +172,17 @@ class OperationDriver {
99
172
  });
100
173
  return definition;
101
174
  }
175
+ /**
176
+ * Type guard to verify a definition matches the expected generated value type.
177
+ *
178
+ * This method performs type narrowing to ensure a cached definition is compatible
179
+ * with the current generation requirements, including export path validation.
180
+ *
181
+ * @template V - The expected generated value type
182
+ * @param definition - The definition to verify (may be undefined)
183
+ * @param exportPath - Expected export path for validation
184
+ * @returns True if definition matches expected type and constraints
185
+ */
102
186
  affirmDefinition(definition, exportPath) {
103
187
  if (!definition) {
104
188
  return false;
@@ -3,11 +3,69 @@ import { OperationBase } from './OperationBase.js';
3
3
  import type { Identifier } from '../Identifier.js';
4
4
  import type { OperationInsertableArgs } from './types.js';
5
5
  import * as v from 'valibot';
6
+ /**
7
+ * Configuration for creating a base operation class.
8
+ *
9
+ * Defines the structure and behavior for operation generators, including
10
+ * identifier generation, export path resolution, and enrichment schemas.
11
+ *
12
+ * @template EnrichmentType - Type of enrichments to apply to generated operations
13
+ */
6
14
  export type BaseOperationConfig<EnrichmentType = undefined> = {
15
+ /** Unique identifier for the operation generator */
7
16
  id: string;
17
+ /** Function to generate identifiers from operations */
8
18
  toIdentifier: (operation: OasOperation) => Identifier;
19
+ /** Function to generate export paths from operations */
9
20
  toExportPath: (operation: OasOperation) => string;
21
+ /** Optional function to provide enrichment validation schema */
10
22
  toEnrichmentSchema?: () => v.BaseSchema<EnrichmentType, EnrichmentType, v.BaseIssue<unknown>>;
11
23
  };
24
+ /**
25
+ * Creates a base operation class constructor for generating type-safe operation artifacts.
26
+ *
27
+ * This factory function creates a specialized OperationBase class that implements
28
+ * the provided configuration for identifier generation, export paths, and
29
+ * enrichment handling. The resulting class can be instantiated to generate
30
+ * operation artifacts from OpenAPI operations.
31
+ *
32
+ * @template EnrichmentType - Type of enrichments to apply to generated operations
33
+ * @param config - Configuration defining the operation generation behavior
34
+ * @returns Constructor function for creating operation instances
35
+ *
36
+ * @example Creating a TypeScript function generator
37
+ * ```typescript
38
+ * import { toOperationBase } from '@skmtc/core';
39
+ *
40
+ * const TypeScriptOperationBase = toOperationBase({
41
+ * id: 'typescript-functions',
42
+ * toIdentifier: (operation) => new Identifier(camelCase(operation.operationId)),
43
+ * toExportPath: (operation) => `./operations/${kebabCase(operation.operationId)}.ts`,
44
+ * toEnrichmentSchema: () => v.object({
45
+ * includeValidation: v.optional(v.boolean()),
46
+ * asyncMode: v.optional(v.boolean())
47
+ * })
48
+ * });
49
+ *
50
+ * class TypeScriptOperationGenerator extends TypeScriptOperationBase {
51
+ * generate() {
52
+ * const enrichments = this.enrichments;
53
+ * const functionCode = generateFunction(this.operation, {
54
+ * async: enrichments?.asyncMode ?? true
55
+ * });
56
+ * this.register({ file: this.createFile(functionCode) });
57
+ * }
58
+ * }
59
+ * ```
60
+ *
61
+ * @example Creating a React hook generator
62
+ * ```typescript
63
+ * const ReactHookOperationBase = toOperationBase({
64
+ * id: 'react-hooks',
65
+ * toIdentifier: (operation) => new Identifier(`use${pascalCase(operation.operationId)}`),
66
+ * toExportPath: (operation) => `./hooks/${kebabCase(operation.operationId)}.hook.ts`
67
+ * });
68
+ * ```
69
+ */
12
70
  export declare const toOperationBase: <EnrichmentType = undefined>(config: BaseOperationConfig<EnrichmentType>) => new (args: OperationInsertableArgs<EnrichmentType>) => OperationBase<EnrichmentType>;
13
71
  //# sourceMappingURL=toOperationBase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toOperationBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/toOperationBase.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B,MAAM,MAAM,mBAAmB,CAAC,cAAc,GAAG,SAAS,IAAI;IAC5D,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,UAAU,CAAA;IACrD,YAAY,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,MAAM,CAAA;IACjD,kBAAkB,CAAC,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,cAAc,EAAE,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC9F,CAAA;AAOD,eAAO,MAAM,eAAe,GAAI,cAAc,GAAG,SAAS,EACxD,QAAQ,mBAAmB,CAAC,cAAc,CAAC,KAC1C,KAAK,IAAI,EAAE,uBAAuB,CAAC,cAAc,CAAC,KAAK,aAAa,CAAC,cAAc,CA6BrF,CAAA"}
1
+ {"version":3,"file":"toOperationBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/toOperationBase.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,CAAC,cAAc,GAAG,SAAS,IAAI;IAC5D,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAA;IACV,uDAAuD;IACvD,YAAY,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,UAAU,CAAA;IACrD,wDAAwD;IACxD,YAAY,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,MAAM,CAAA;IACjD,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,cAAc,EAAE,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC9F,CAAA;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc,GAAG,SAAS,EACxD,QAAQ,mBAAmB,CAAC,cAAc,CAAC,KAC1C,KAAK,IAAI,EAAE,uBAAuB,CAAC,cAAc,CAAC,KAAK,aAAa,CAAC,cAAc,CA6BrF,CAAA"}
@@ -38,6 +38,52 @@ const GeneratorKeys_js_1 = require("../../types/GeneratorKeys.js");
38
38
  const OperationBase_js_1 = require("./OperationBase.js");
39
39
  const v = __importStar(require("valibot"));
40
40
  const lodash_es_1 = require("lodash-es");
41
+ /**
42
+ * Creates a base operation class constructor for generating type-safe operation artifacts.
43
+ *
44
+ * This factory function creates a specialized OperationBase class that implements
45
+ * the provided configuration for identifier generation, export paths, and
46
+ * enrichment handling. The resulting class can be instantiated to generate
47
+ * operation artifacts from OpenAPI operations.
48
+ *
49
+ * @template EnrichmentType - Type of enrichments to apply to generated operations
50
+ * @param config - Configuration defining the operation generation behavior
51
+ * @returns Constructor function for creating operation instances
52
+ *
53
+ * @example Creating a TypeScript function generator
54
+ * ```typescript
55
+ * import { toOperationBase } from '@skmtc/core';
56
+ *
57
+ * const TypeScriptOperationBase = toOperationBase({
58
+ * id: 'typescript-functions',
59
+ * toIdentifier: (operation) => new Identifier(camelCase(operation.operationId)),
60
+ * toExportPath: (operation) => `./operations/${kebabCase(operation.operationId)}.ts`,
61
+ * toEnrichmentSchema: () => v.object({
62
+ * includeValidation: v.optional(v.boolean()),
63
+ * asyncMode: v.optional(v.boolean())
64
+ * })
65
+ * });
66
+ *
67
+ * class TypeScriptOperationGenerator extends TypeScriptOperationBase {
68
+ * generate() {
69
+ * const enrichments = this.enrichments;
70
+ * const functionCode = generateFunction(this.operation, {
71
+ * async: enrichments?.asyncMode ?? true
72
+ * });
73
+ * this.register({ file: this.createFile(functionCode) });
74
+ * }
75
+ * }
76
+ * ```
77
+ *
78
+ * @example Creating a React hook generator
79
+ * ```typescript
80
+ * const ReactHookOperationBase = toOperationBase({
81
+ * id: 'react-hooks',
82
+ * toIdentifier: (operation) => new Identifier(`use${pascalCase(operation.operationId)}`),
83
+ * toExportPath: (operation) => `./hooks/${kebabCase(operation.operationId)}.hook.ts`
84
+ * });
85
+ * ```
86
+ */
41
87
  const toOperationBase = (config) => {
42
88
  var _a;
43
89
  return _a = class extends OperationBase_js_1.OperationBase {