@skmtc/core 0.0.799 → 0.0.802

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 (251) hide show
  1. package/esm/context/CoreContext.d.ts +0 -3
  2. package/esm/context/CoreContext.d.ts.map +1 -1
  3. package/esm/context/CoreContext.js +12 -17
  4. package/esm/context/GenerateContext.d.ts +35 -3
  5. package/esm/context/GenerateContext.d.ts.map +1 -1
  6. package/esm/context/GenerateContext.js +21 -1
  7. package/esm/context/ParseContext.d.ts +64 -3
  8. package/esm/context/ParseContext.d.ts.map +1 -1
  9. package/esm/context/ParseContext.js +61 -0
  10. package/esm/context/RenderContext.d.ts +151 -2
  11. package/esm/context/RenderContext.d.ts.map +1 -1
  12. package/esm/context/RenderContext.js +185 -11
  13. package/esm/context/ResultsHandler.d.ts +10 -3
  14. package/esm/context/ResultsHandler.d.ts.map +1 -1
  15. package/esm/context/types.d.ts +30 -0
  16. package/esm/context/types.d.ts.map +1 -1
  17. package/esm/dsl/model/ModelBase.d.ts +1 -1
  18. package/esm/dsl/model/ModelBase.d.ts.map +1 -1
  19. package/esm/dsl/model/ModelDriver.d.ts +62 -0
  20. package/esm/dsl/model/ModelDriver.d.ts.map +1 -1
  21. package/esm/dsl/model/ModelDriver.js +63 -1
  22. package/esm/dsl/model/toModelBase.d.ts +66 -0
  23. package/esm/dsl/model/toModelBase.d.ts.map +1 -1
  24. package/esm/dsl/model/toModelBase.js +46 -0
  25. package/esm/dsl/model/toModelEntry.d.ts +63 -0
  26. package/esm/dsl/model/toModelEntry.d.ts.map +1 -1
  27. package/esm/dsl/model/toModelEntry.js +63 -0
  28. package/esm/dsl/model/types.d.ts +51 -4
  29. package/esm/dsl/model/types.d.ts.map +1 -1
  30. package/esm/dsl/operation/OperationBase.d.ts +3 -3
  31. package/esm/dsl/operation/OperationBase.d.ts.map +1 -1
  32. package/esm/dsl/operation/OperationDriver.d.ts +48 -0
  33. package/esm/dsl/operation/OperationDriver.d.ts.map +1 -1
  34. package/esm/dsl/operation/OperationDriver.js +49 -1
  35. package/esm/dsl/operation/types.d.ts +61 -3
  36. package/esm/dsl/operation/types.d.ts.map +1 -1
  37. package/esm/helpers/isEmpty.d.ts +1 -1
  38. package/esm/helpers/isEmpty.d.ts.map +1 -1
  39. package/esm/helpers/tracer.d.ts +1 -1
  40. package/esm/helpers/tracer.d.ts.map +1 -1
  41. package/esm/helpers/tracer.js +1 -1
  42. package/esm/mod.d.ts +51 -0
  43. package/esm/mod.d.ts.map +1 -1
  44. package/esm/mod.js +51 -0
  45. package/esm/oas/array/array-types.d.ts +20 -11
  46. package/esm/oas/array/array-types.d.ts.map +1 -1
  47. package/esm/oas/array/array-types.js +10 -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-types.d.ts +1 -7
  52. package/esm/oas/boolean/boolean-types.d.ts.map +1 -1
  53. package/esm/oas/components/components-types.d.ts +19 -0
  54. package/esm/oas/components/components-types.d.ts.map +1 -0
  55. package/esm/oas/components/components-types.js +21 -0
  56. package/esm/oas/contact/contact-types.d.ts +9 -0
  57. package/esm/oas/contact/contact-types.d.ts.map +1 -0
  58. package/esm/oas/contact/contact-types.js +7 -0
  59. package/esm/oas/discriminator/discriminator-types.d.ts +1 -5
  60. package/esm/oas/discriminator/discriminator-types.d.ts.map +1 -1
  61. package/esm/oas/document/document-types.d.ts +16 -0
  62. package/esm/oas/document/document-types.d.ts.map +1 -0
  63. package/esm/oas/document/document-types.js +18 -0
  64. package/esm/oas/example/example-types.d.ts +1 -6
  65. package/esm/oas/example/example-types.d.ts.map +1 -1
  66. package/esm/oas/header/header-types.d.ts +50 -0
  67. package/esm/oas/header/header-types.d.ts.map +1 -0
  68. package/esm/oas/header/header-types.js +30 -0
  69. package/esm/oas/info/info-types.d.ts +14 -0
  70. package/esm/oas/info/info-types.d.ts.map +1 -0
  71. package/esm/oas/info/info-types.js +13 -0
  72. package/esm/oas/integer/integer-types.d.ts +3 -17
  73. package/esm/oas/integer/integer-types.d.ts.map +1 -1
  74. package/esm/oas/license/license-types.d.ts +9 -0
  75. package/esm/oas/license/license-types.d.ts.map +1 -0
  76. package/esm/oas/license/license-types.js +7 -0
  77. package/esm/oas/mediaType/mediaType-types.d.ts +1 -11
  78. package/esm/oas/mediaType/mediaType-types.d.ts.map +1 -1
  79. package/esm/oas/number/number-types.d.ts +2 -16
  80. package/esm/oas/number/number-types.d.ts.map +1 -1
  81. package/esm/oas/operation/Operation.d.ts +47 -2
  82. package/esm/oas/operation/Operation.d.ts.map +1 -1
  83. package/esm/oas/operation/Operation.js +43 -0
  84. package/esm/oas/operation/operation-types.d.ts +22 -0
  85. package/esm/oas/operation/operation-types.d.ts.map +1 -0
  86. package/esm/oas/operation/operation-types.js +35 -0
  87. package/esm/oas/parameter/parameter-types.d.ts +3 -58
  88. package/esm/oas/parameter/parameter-types.d.ts.map +1 -1
  89. package/esm/oas/pathItem/pathItem-types.d.ts +12 -0
  90. package/esm/oas/pathItem/pathItem-types.d.ts.map +1 -0
  91. package/esm/oas/pathItem/pathItem-types.js +12 -0
  92. package/esm/oas/ref/Ref.d.ts +49 -2
  93. package/esm/oas/ref/Ref.d.ts.map +1 -1
  94. package/esm/oas/ref/Ref.js +28 -0
  95. package/esm/oas/requestBody/requestBody-types.d.ts +10 -0
  96. package/esm/oas/requestBody/requestBody-types.d.ts.map +1 -0
  97. package/esm/oas/requestBody/requestBody-types.js +9 -0
  98. package/esm/oas/response/response-types.d.ts +12 -0
  99. package/esm/oas/response/response-types.d.ts.map +1 -0
  100. package/esm/oas/response/response-types.js +11 -0
  101. package/esm/oas/schema/toSchemasV3.js +2 -2
  102. package/esm/oas/server/toServerV3.d.ts.map +1 -1
  103. package/esm/oas/string/string-types.d.ts +2 -29
  104. package/esm/oas/string/string-types.d.ts.map +1 -1
  105. package/esm/oas/string/toString.d.ts +125 -1
  106. package/esm/oas/string/toString.d.ts.map +1 -1
  107. package/esm/oas/string/toString.js +119 -0
  108. package/esm/oas/tag/tag-types.d.ts +8 -0
  109. package/esm/oas/tag/tag-types.d.ts.map +1 -0
  110. package/esm/oas/tag/tag-types.js +8 -0
  111. package/esm/oas/union/union-types.d.ts +1 -12
  112. package/esm/oas/union/union-types.d.ts.map +1 -1
  113. package/esm/oas/unknown/unknown-types.d.ts +1 -7
  114. package/esm/oas/unknown/unknown-types.d.ts.map +1 -1
  115. package/esm/types/Preview.d.ts +37 -0
  116. package/esm/types/Preview.d.ts.map +1 -1
  117. package/esm/types/Preview.js +37 -0
  118. package/esm/types/Settings.d.ts +35 -0
  119. package/esm/types/Settings.d.ts.map +1 -1
  120. package/esm/types/Settings.js +27 -0
  121. package/esm/typescript/FunctionParameter.d.ts +4 -4
  122. package/esm/typescript/FunctionParameter.d.ts.map +1 -1
  123. package/esm/typescript/List.d.ts +104 -5
  124. package/esm/typescript/List.d.ts.map +1 -1
  125. package/esm/typescript/List.js +75 -0
  126. package/package.json +1 -1
  127. package/script/context/CoreContext.d.ts +0 -3
  128. package/script/context/CoreContext.d.ts.map +1 -1
  129. package/script/context/CoreContext.js +12 -17
  130. package/script/context/GenerateContext.d.ts +35 -3
  131. package/script/context/GenerateContext.d.ts.map +1 -1
  132. package/script/context/GenerateContext.js +21 -1
  133. package/script/context/ParseContext.d.ts +64 -3
  134. package/script/context/ParseContext.d.ts.map +1 -1
  135. package/script/context/ParseContext.js +61 -0
  136. package/script/context/RenderContext.d.ts +151 -2
  137. package/script/context/RenderContext.d.ts.map +1 -1
  138. package/script/context/RenderContext.js +185 -11
  139. package/script/context/ResultsHandler.d.ts +10 -3
  140. package/script/context/ResultsHandler.d.ts.map +1 -1
  141. package/script/context/types.d.ts +30 -0
  142. package/script/context/types.d.ts.map +1 -1
  143. package/script/dsl/model/ModelBase.d.ts +1 -1
  144. package/script/dsl/model/ModelBase.d.ts.map +1 -1
  145. package/script/dsl/model/ModelDriver.d.ts +62 -0
  146. package/script/dsl/model/ModelDriver.d.ts.map +1 -1
  147. package/script/dsl/model/ModelDriver.js +63 -1
  148. package/script/dsl/model/toModelBase.d.ts +66 -0
  149. package/script/dsl/model/toModelBase.d.ts.map +1 -1
  150. package/script/dsl/model/toModelBase.js +46 -0
  151. package/script/dsl/model/toModelEntry.d.ts +63 -0
  152. package/script/dsl/model/toModelEntry.d.ts.map +1 -1
  153. package/script/dsl/model/toModelEntry.js +63 -0
  154. package/script/dsl/model/types.d.ts +51 -4
  155. package/script/dsl/model/types.d.ts.map +1 -1
  156. package/script/dsl/operation/OperationBase.d.ts +3 -3
  157. package/script/dsl/operation/OperationBase.d.ts.map +1 -1
  158. package/script/dsl/operation/OperationDriver.d.ts +48 -0
  159. package/script/dsl/operation/OperationDriver.d.ts.map +1 -1
  160. package/script/dsl/operation/OperationDriver.js +49 -1
  161. package/script/dsl/operation/types.d.ts +61 -3
  162. package/script/dsl/operation/types.d.ts.map +1 -1
  163. package/script/helpers/isEmpty.d.ts +1 -1
  164. package/script/helpers/isEmpty.d.ts.map +1 -1
  165. package/script/helpers/tracer.d.ts +1 -1
  166. package/script/helpers/tracer.d.ts.map +1 -1
  167. package/script/helpers/tracer.js +1 -1
  168. package/script/mod.d.ts +51 -0
  169. package/script/mod.d.ts.map +1 -1
  170. package/script/mod.js +51 -0
  171. package/script/oas/array/array-types.d.ts +20 -11
  172. package/script/oas/array/array-types.d.ts.map +1 -1
  173. package/script/oas/array/array-types.js +11 -1
  174. package/script/oas/array/toArray.d.ts +111 -0
  175. package/script/oas/array/toArray.d.ts.map +1 -1
  176. package/script/oas/array/toArray.js +114 -2
  177. package/script/oas/boolean/boolean-types.d.ts +1 -7
  178. package/script/oas/boolean/boolean-types.d.ts.map +1 -1
  179. package/script/oas/components/components-types.d.ts +19 -0
  180. package/script/oas/components/components-types.d.ts.map +1 -0
  181. package/script/oas/components/components-types.js +57 -0
  182. package/script/oas/contact/contact-types.d.ts +9 -0
  183. package/script/oas/contact/contact-types.d.ts.map +1 -0
  184. package/script/oas/contact/contact-types.js +43 -0
  185. package/script/oas/discriminator/discriminator-types.d.ts +1 -5
  186. package/script/oas/discriminator/discriminator-types.d.ts.map +1 -1
  187. package/script/oas/document/document-types.d.ts +16 -0
  188. package/script/oas/document/document-types.d.ts.map +1 -0
  189. package/script/oas/document/document-types.js +54 -0
  190. package/script/oas/example/example-types.d.ts +1 -6
  191. package/script/oas/example/example-types.d.ts.map +1 -1
  192. package/script/oas/header/header-types.d.ts +50 -0
  193. package/script/oas/header/header-types.d.ts.map +1 -0
  194. package/script/oas/header/header-types.js +66 -0
  195. package/script/oas/info/info-types.d.ts +14 -0
  196. package/script/oas/info/info-types.d.ts.map +1 -0
  197. package/script/oas/info/info-types.js +49 -0
  198. package/script/oas/integer/integer-types.d.ts +3 -17
  199. package/script/oas/integer/integer-types.d.ts.map +1 -1
  200. package/script/oas/license/license-types.d.ts +9 -0
  201. package/script/oas/license/license-types.d.ts.map +1 -0
  202. package/script/oas/license/license-types.js +43 -0
  203. package/script/oas/mediaType/mediaType-types.d.ts +1 -11
  204. package/script/oas/mediaType/mediaType-types.d.ts.map +1 -1
  205. package/script/oas/number/number-types.d.ts +2 -16
  206. package/script/oas/number/number-types.d.ts.map +1 -1
  207. package/script/oas/operation/Operation.d.ts +47 -2
  208. package/script/oas/operation/Operation.d.ts.map +1 -1
  209. package/script/oas/operation/Operation.js +43 -0
  210. package/script/oas/operation/operation-types.d.ts +22 -0
  211. package/script/oas/operation/operation-types.d.ts.map +1 -0
  212. package/script/oas/operation/operation-types.js +71 -0
  213. package/script/oas/parameter/parameter-types.d.ts +3 -58
  214. package/script/oas/parameter/parameter-types.d.ts.map +1 -1
  215. package/script/oas/pathItem/pathItem-types.d.ts +12 -0
  216. package/script/oas/pathItem/pathItem-types.d.ts.map +1 -0
  217. package/script/oas/pathItem/pathItem-types.js +48 -0
  218. package/script/oas/ref/Ref.d.ts +49 -2
  219. package/script/oas/ref/Ref.d.ts.map +1 -1
  220. package/script/oas/ref/Ref.js +28 -0
  221. package/script/oas/requestBody/requestBody-types.d.ts +10 -0
  222. package/script/oas/requestBody/requestBody-types.d.ts.map +1 -0
  223. package/script/oas/requestBody/requestBody-types.js +45 -0
  224. package/script/oas/response/response-types.d.ts +12 -0
  225. package/script/oas/response/response-types.d.ts.map +1 -0
  226. package/script/oas/response/response-types.js +47 -0
  227. package/script/oas/schema/toSchemasV3.js +2 -2
  228. package/script/oas/server/toServerV3.d.ts.map +1 -1
  229. package/script/oas/string/string-types.d.ts +2 -29
  230. package/script/oas/string/string-types.d.ts.map +1 -1
  231. package/script/oas/string/toString.d.ts +125 -1
  232. package/script/oas/string/toString.d.ts.map +1 -1
  233. package/script/oas/string/toString.js +119 -0
  234. package/script/oas/tag/tag-types.d.ts +8 -0
  235. package/script/oas/tag/tag-types.d.ts.map +1 -0
  236. package/script/oas/tag/tag-types.js +44 -0
  237. package/script/oas/union/union-types.d.ts +1 -12
  238. package/script/oas/union/union-types.d.ts.map +1 -1
  239. package/script/oas/unknown/unknown-types.d.ts +1 -7
  240. package/script/oas/unknown/unknown-types.d.ts.map +1 -1
  241. package/script/types/Preview.d.ts +37 -0
  242. package/script/types/Preview.d.ts.map +1 -1
  243. package/script/types/Preview.js +37 -0
  244. package/script/types/Settings.d.ts +35 -0
  245. package/script/types/Settings.d.ts.map +1 -1
  246. package/script/types/Settings.js +27 -0
  247. package/script/typescript/FunctionParameter.d.ts +4 -4
  248. package/script/typescript/FunctionParameter.d.ts.map +1 -1
  249. package/script/typescript/List.d.ts +104 -5
  250. package/script/typescript/List.d.ts.map +1 -1
  251. package/script/typescript/List.js +75 -0
@@ -46,7 +46,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
46
46
  var __importDefault = (this && this.__importDefault) || function (mod) {
47
47
  return (mod && mod.__esModule) ? mod : { "default": mod };
48
48
  };
49
- var _RenderContext_prettierConfig, _RenderContext_stackTrail;
49
+ var _RenderContext_prettierConfig, _RenderContext_logger, _RenderContext_stackTrail;
50
50
  Object.defineProperty(exports, "__esModule", { value: true });
51
51
  exports.RenderContext = void 0;
52
52
  const Sentry = __importStar(require("@sentry/node"));
@@ -177,7 +177,7 @@ const prettier = __importStar(require("prettier"));
177
177
  * prettierConfig: this.prettierConfig,
178
178
  * basePath: this.settings?.basePath,
179
179
  * stackTrail: this.stackTrail,
180
- * logger: this.logger,
180
+ * logger: this.#logger,
181
181
  * captureCurrentResult: this.captureCurrentResult.bind(this)
182
182
  * });
183
183
  *
@@ -236,39 +236,50 @@ const prettier = __importStar(require("prettier"));
236
236
  * ```
237
237
  */
238
238
  class RenderContext {
239
+ /**
240
+ * Creates a new RenderContext instance with the specified configuration.
241
+ *
242
+ * Initializes the rendering context with files to render, preview data,
243
+ * formatting configuration, and logging/tracing infrastructure.
244
+ *
245
+ * @param args - Constructor arguments containing all required configuration
246
+ */
239
247
  constructor({ files, previews, mappings, prettierConfig, basePath, logger, stackTrail, captureCurrentResult }) {
248
+ /** Map of generated files to render */
240
249
  Object.defineProperty(this, "files", {
241
250
  enumerable: true,
242
251
  configurable: true,
243
252
  writable: true,
244
253
  value: void 0
245
254
  });
255
+ /** Preview data for generated content */
246
256
  Object.defineProperty(this, "previews", {
247
257
  enumerable: true,
248
258
  configurable: true,
249
259
  writable: true,
250
260
  value: void 0
251
261
  });
262
+ /** Mapping data for file relationships */
252
263
  Object.defineProperty(this, "mappings", {
253
264
  enumerable: true,
254
265
  configurable: true,
255
266
  writable: true,
256
267
  value: void 0
257
268
  });
269
+ /** Optional Prettier configuration for code formatting */
258
270
  _RenderContext_prettierConfig.set(this, void 0);
271
+ /** Base path for resolving file paths */
259
272
  Object.defineProperty(this, "basePath", {
260
273
  enumerable: true,
261
274
  configurable: true,
262
275
  writable: true,
263
276
  value: void 0
264
277
  });
265
- Object.defineProperty(this, "logger", {
266
- enumerable: true,
267
- configurable: true,
268
- writable: true,
269
- value: void 0
270
- });
278
+ /** Logger instance for debug information */
279
+ _RenderContext_logger.set(this, void 0);
280
+ /** Stack trail for distributed tracing */
271
281
  _RenderContext_stackTrail.set(this, void 0);
282
+ /** Function to capture result status */
272
283
  Object.defineProperty(this, "captureCurrentResult", {
273
284
  enumerable: true,
274
285
  configurable: true,
@@ -280,10 +291,44 @@ class RenderContext {
280
291
  this.mappings = mappings;
281
292
  __classPrivateFieldSet(this, _RenderContext_prettierConfig, prettierConfig, "f");
282
293
  this.basePath = basePath;
283
- this.logger = logger;
294
+ __classPrivateFieldSet(this, _RenderContext_logger, logger, "f");
284
295
  __classPrivateFieldSet(this, _RenderContext_stackTrail, stackTrail, "f");
285
296
  this.captureCurrentResult = captureCurrentResult;
286
297
  }
298
+ /**
299
+ * Renders all files in the context to their final formatted form.
300
+ *
301
+ * This is the main rendering method that orchestrates the collation and
302
+ * formatting of all generated files. It processes files through Prettier
303
+ * formatting (if configured), resolves paths, and produces the final
304
+ * artifacts ready for writing to the filesystem.
305
+ *
306
+ * The method is wrapped in Sentry tracing spans for performance monitoring
307
+ * and includes both collation and artifact preparation phases.
308
+ *
309
+ * @returns Promise resolving to render result containing artifacts, file metadata, previews, and mappings
310
+ *
311
+ * @example
312
+ * ```typescript
313
+ * const renderContext = new RenderContext({
314
+ * files: generatedFiles,
315
+ * previews: previewData,
316
+ * mappings: mappingData,
317
+ * prettierConfig: { semi: false, singleQuote: true },
318
+ * basePath: './src/generated',
319
+ * stackTrail: traceStack,
320
+ * logger: logger,
321
+ * captureCurrentResult: resultHandler
322
+ * });
323
+ *
324
+ * const result = await renderContext.render();
325
+ *
326
+ * // Access rendered files
327
+ * Object.entries(result.artifacts).forEach(([path, content]) => {
328
+ * console.log(`Rendered ${path}: ${result.files[path].lines} lines`);
329
+ * });
330
+ * ```
331
+ */
287
332
  async render() {
288
333
  return await Sentry.startSpan({ name: 'Render artifacts' }, async () => {
289
334
  const result = await Sentry.startSpan({ name: 'Collate content' }, async () => {
@@ -298,6 +343,33 @@ class RenderContext {
298
343
  return rendered;
299
344
  });
300
345
  }
346
+ /**
347
+ * Collates all files in the context into a unified render result.
348
+ *
349
+ * This method processes each file in the context through the rendering pipeline,
350
+ * applying Prettier formatting and path resolution. It coordinates the parallel
351
+ * processing of all files and aggregates the results into a single output structure.
352
+ *
353
+ * The collation process includes:
354
+ * - File content rendering with optional Prettier formatting
355
+ * - Path resolution using base path configuration
356
+ * - Metadata calculation (line count, character count)
357
+ * - Result aggregation into artifacts and file metadata maps
358
+ *
359
+ * @returns Promise resolving to collated files with artifacts and metadata
360
+ *
361
+ * @example
362
+ * ```typescript
363
+ * const collated = await renderContext.collate();
364
+ *
365
+ * // Access rendered file content
366
+ * console.log(collated.artifacts['/path/to/file.ts']);
367
+ *
368
+ * // Access file metadata
369
+ * console.log(collated.files['/path/to/file.ts'].lines);
370
+ * console.log(collated.files['/path/to/file.ts'].characters);
371
+ * ```
372
+ */
301
373
  async collate() {
302
374
  const fileEntries = Array.from(this.files.entries());
303
375
  const fileObjectPromises = fileEntries
@@ -329,15 +401,91 @@ class RenderContext {
329
401
  }
330
402
  return output;
331
403
  }
404
+ /**
405
+ * Executes a function within a tracing context for performance monitoring.
406
+ *
407
+ * This method wraps function execution with distributed tracing capabilities,
408
+ * allowing performance monitoring and debugging of the rendering pipeline.
409
+ * It integrates with the stack trail to provide hierarchical tracing.
410
+ *
411
+ * @template T - The return type of the traced function
412
+ * @param token - Trace identifier (string or array of strings)
413
+ * @param fn - Function to execute within the trace context
414
+ * @returns The result of executing the traced function
415
+ *
416
+ * @example
417
+ * ```typescript
418
+ * const result = renderContext.trace('format-file', () => {
419
+ * return prettier.format(content, prettierConfig);
420
+ * });
421
+ *
422
+ * // With hierarchical tracing
423
+ * const result = renderContext.trace(['render', 'format'], () => {
424
+ * return complexFormattingOperation();
425
+ * });
426
+ * ```
427
+ */
332
428
  trace(token, fn) {
333
- return (0, tracer_js_1.tracer)(__classPrivateFieldGet(this, _RenderContext_stackTrail, "f"), token, fn, this.logger);
429
+ return (0, tracer_js_1.tracer)(__classPrivateFieldGet(this, _RenderContext_stackTrail, "f"), token, fn, __classPrivateFieldGet(this, _RenderContext_logger, "f"));
334
430
  }
431
+ /**
432
+ * Retrieves a file from the context by its normalized path.
433
+ *
434
+ * This method looks up a file in the context's file map using path normalization
435
+ * to ensure consistent path resolution. It validates that the requested file
436
+ * exists and throws an error if not found.
437
+ *
438
+ * @param filePath - The file path to retrieve (will be normalized)
439
+ * @returns The File or JsonFile instance
440
+ * @throws {Error} When the file is not found in the context
441
+ *
442
+ * @example
443
+ * ```typescript
444
+ * const file = renderContext.getFile('./src/models/User.ts');
445
+ * console.log(file.toString()); // Access file content
446
+ *
447
+ * // Works with various path formats
448
+ * const sameFile = renderContext.getFile('src/models/User.ts');
449
+ * const alsoSameFile = renderContext.getFile('/absolute/path/src/models/User.ts');
450
+ * ```
451
+ */
335
452
  getFile(filePath) {
336
453
  const normalisedPath = (0, normalize_js_1.normalize)(filePath);
337
454
  const currentFile = this.files.get(normalisedPath);
338
455
  (0, tiny_invariant_1.default)(currentFile, `File not found during render phase: ${normalisedPath}`);
339
456
  return currentFile;
340
457
  }
458
+ /**
459
+ * Picks a specific definition from a file in the context.
460
+ *
461
+ * This method retrieves a named definition (type, interface, etc.) from
462
+ * a specific file in the context. It validates that the target file is
463
+ * a File type (not JsonFile) and returns the requested definition if found.
464
+ *
465
+ * @param args - Object containing the definition name and export path
466
+ * @param args.name - The name of the definition to retrieve
467
+ * @param args.exportPath - The path to the file containing the definition
468
+ * @returns The Definition instance if found, undefined otherwise
469
+ * @throws {Error} When the file is not found or is not a File type
470
+ *
471
+ * @example
472
+ * ```typescript
473
+ * const userDefinition = renderContext.pick({
474
+ * name: 'User',
475
+ * exportPath: './src/models/User.ts'
476
+ * });
477
+ *
478
+ * if (userDefinition) {
479
+ * console.log(userDefinition.identifier); // Access definition details
480
+ * }
481
+ *
482
+ * // Pick interface definition
483
+ * const apiInterface = renderContext.pick({
484
+ * name: 'ApiResponse',
485
+ * exportPath: './src/types/api.ts'
486
+ * });
487
+ * ```
488
+ */
341
489
  pick({ name, exportPath }) {
342
490
  const file = this.getFile(exportPath);
343
491
  (0, tiny_invariant_1.default)(file instanceof File_js_1.File, `File at "${exportPath}" is not a "File" type`);
@@ -345,7 +493,33 @@ class RenderContext {
345
493
  }
346
494
  }
347
495
  exports.RenderContext = RenderContext;
348
- _RenderContext_prettierConfig = new WeakMap(), _RenderContext_stackTrail = new WeakMap();
496
+ _RenderContext_prettierConfig = new WeakMap(), _RenderContext_logger = new WeakMap(), _RenderContext_stackTrail = new WeakMap();
497
+ /**
498
+ * Renders a single file with formatting and metadata calculation.
499
+ *
500
+ * This function processes a single file through the rendering pipeline,
501
+ * applying Prettier formatting if configured and calculating file metadata
502
+ * such as line count and character count. It resolves the final path using
503
+ * the base path configuration.
504
+ *
505
+ * @param args - File rendering arguments
506
+ * @returns Promise resolving to a FileObject with content and metadata
507
+ *
508
+ * @example
509
+ * ```typescript
510
+ * const fileObject = await renderFile({
511
+ * content: 'const x = 1;',
512
+ * destinationPath: 'utils.ts',
513
+ * basePath: './src',
514
+ * prettierConfig: { semi: false }
515
+ * });
516
+ *
517
+ * console.log(fileObject.path); // './src/utils.ts'
518
+ * console.log(fileObject.content); // 'const x = 1' (formatted)
519
+ * console.log(fileObject.lines); // 1
520
+ * console.log(fileObject.characters); // 11
521
+ * ```
522
+ */
349
523
  const renderFile = async ({ content, destinationPath, basePath, prettierConfig }) => {
350
524
  const path = (0, toResolvedArtifactPath_js_1.toResolvedArtifactPath)({ basePath, destinationPath });
351
525
  const formatted = prettierConfig
@@ -1,14 +1,21 @@
1
1
  import { type LevelName } from '../deps/jsr.io/@std/log/0.224.14/levels.js';
2
2
  import type { LogRecord } from '../deps/jsr.io/@std/log/0.224.14/logger.js';
3
3
  import { BaseHandler } from '../deps/jsr.io/@std/log/0.224.14/base_handler.js';
4
- import type { BaseHandlerOptions } from '../deps/jsr.io/@std/log/0.224.14/base_handler.js';
5
4
  import type { CoreContext } from './CoreContext.js';
5
+ /**
6
+ * Base log handler interface for extending Deno standard library handlers.
7
+ */
8
+ export interface LogHandlerBase {
9
+ handle(logRecord: LogRecord): void;
10
+ }
6
11
  /**
7
12
  * Configuration options for the {@link ResultsHandler}.
8
13
  */
9
- export interface ResultsHandlerOptions extends BaseHandlerOptions {
14
+ export interface ResultsHandlerOptions {
10
15
  /** The CoreContext instance to capture results to */
11
16
  context: CoreContext;
17
+ /** Formatter function for log messages */
18
+ formatter?: (logRecord: LogRecord) => string;
12
19
  }
13
20
  /**
14
21
  * Custom log handler that captures warning and error results for SKMTC processing.
@@ -77,7 +84,7 @@ export interface ResultsHandlerOptions extends BaseHandlerOptions {
77
84
  * }
78
85
  * ```
79
86
  */
80
- export declare class ResultsHandler extends BaseHandler {
87
+ export declare class ResultsHandler extends BaseHandler implements LogHandlerBase {
81
88
  #private;
82
89
  /** The CoreContext instance for capturing results */
83
90
  context: CoreContext;
@@ -1 +1 @@
1
- {"version":3,"file":"ResultsHandler.d.ts","sourceRoot":"","sources":["../../src/context/ResultsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,4CAA4C,CAAA;AACtF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAA;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAA;AAC1F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D,qDAAqD;IACrD,OAAO,EAAE,WAAW,CAAA;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,qBAAa,cAAe,SAAQ,WAAW;;IAC7C,qDAAqD;IACrD,OAAO,EAAE,WAAW,CAAA;IAOpB;;;;;;;;;;;;;;OAcG;gBAC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;OAgBG;IACH,GAAG,CAAC,SAAS,EAAE,MAAM;IAWrB;;;;;;;OAOG;IACH,KAAK;IAWL;;;;;;;;;;;;;;;;;;;;;OAqBG;IACM,OAAO;CAKjB"}
@@ -3,24 +3,54 @@ import type { ManifestEntry } from '../types/Manifest.js';
3
3
  import type { Mapping, Preview } from '../types/Preview.js';
4
4
  import type { ResultsItem } from '../types/Results.js';
5
5
  import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
6
+ /**
7
+ * Type representing the three phases of the SKMTC pipeline.
8
+ */
6
9
  export type PhaseType = 'parse' | 'generate' | 'render';
10
+ /**
11
+ * Options for retrieving files from the context.
12
+ */
7
13
  export type GetFileOptions = {
14
+ /** Whether to throw an error if the file is not found */
8
15
  throwIfNotFound?: boolean;
9
16
  };
17
+ /**
18
+ * Arguments for adding a generator key to the context.
19
+ */
10
20
  export type AddGeneratorKeyArgs = {
21
+ /** The generator key to add */
11
22
  generatorKey: GeneratorKey;
12
23
  };
24
+ /**
25
+ * Result of rendering files in the context.
26
+ */
13
27
  export type FilesRenderResult = {
28
+ /** Map of file paths to rendered content */
14
29
  artifacts: Record<string, string>;
30
+ /** Map of file paths to metadata */
15
31
  files: Record<string, ManifestEntry>;
16
32
  };
33
+ /**
34
+ * Complete result of the rendering phase including all generated content and metadata.
35
+ */
17
36
  export type RenderResult = {
37
+ /** Map of file paths to rendered content */
18
38
  artifacts: Record<string, string>;
39
+ /** Map of file paths to metadata */
19
40
  files: Record<string, ManifestEntry>;
41
+ /** Preview data for generated content */
20
42
  previews: Record<string, Record<string, Preview>>;
43
+ /** Mapping data for file relationships */
21
44
  mappings: Record<string, Record<string, Mapping>>;
45
+ /** Hierarchical results tracking */
22
46
  results: ResultsItem;
23
47
  };
48
+ /**
49
+ * Union type representing any supported OpenAPI document version.
50
+ */
24
51
  export type AnyOasDocument = OpenAPIV2.Document | OpenAPIV3.Document | OpenAPIV3_1.Document;
52
+ /**
53
+ * Types of issues that can be encountered during OpenAPI schema parsing.
54
+ */
25
55
  export type IssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISSING_STRING_TYPE' | 'MISSING_ARRAY_TYPE' | 'MISSING_BOOLEAN_TYPE' | 'INVALID_EXAMPLE' | 'INVALID_ENUM' | 'INVALID_DEFAULT' | 'INVALID_NULLABLE' | 'UNEXPECTED_FORMAT' | 'INVALID_RESPONSE' | 'INVALID_FORMAT' | 'INVALID_OPERATION' | 'INVALID_SCHEMA' | 'INVALID_PARAMETER' | 'INVALID_DEPENDENCY_REF';
26
56
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/context/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEtE,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAA;AAEvD,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CA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8
8
  import type { Inserted } from '../Inserted.js';
9
9
  import type { OasSchema } from '../../oas/schema/Schema.js';
10
10
  import type { OasRef } from '../../oas/ref/Ref.js';
11
- import { OasVoid } from '../../oas/void/Void.js';
11
+ import type { OasVoid } from '../../oas/void/Void.js';
12
12
  /**
13
13
  * Constructor arguments for {@link ModelBase}.
14
14
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ModelBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAGlD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAEhD;;;;GAIG;AACH,MAAM,MAAM,aAAa,CAAC,cAAc,GAAG,SAAS,IAAI;IACtD,yEAAyE;IACzE,OAAO,EAAE,eAAe,CAAA;IACxB,0EAA0E;IAC1E,QAAQ,EAAE,eAAe,CAAC,cAAc,CAAC,CAAA;IACzC,gDAAgD;IAChD,YAAY,EAAE,YAAY,CAAA;IAC1B,mDAAmD;IACnD,OA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UAAU,CAAM,GAC1D,2BAA2B,CAAC,CAAC,EAAE,MAAM,CAAC;IAYzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACM,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;CAMhD"}
@@ -13,18 +13,80 @@ type CreateModelArgs<V extends GeneratedValue, T extends GenerationType, Enrichm
13
13
  rootRef?: RefName;
14
14
  noExport?: boolean;
15
15
  };
16
+ /**
17
+ * Driver class responsible for managing model generation lifecycle.
18
+ *
19
+ * @template V - The generated value type
20
+ * @template T - The generation type
21
+ * @template EnrichmentType - Optional enrichment type
22
+ */
16
23
  export declare class ModelDriver<V extends GeneratedValue, T extends GenerationType, EnrichmentType> {
24
+ /** The generation context */
17
25
  context: GenerateContext;
26
+ /** The insertable model configuration */
18
27
  insertable: ModelInsertable<V, EnrichmentType>;
28
+ /** Reference name for the model */
19
29
  refName: RefName;
30
+ /** Content settings for the model */
20
31
  settings: ContentSettings<EnrichmentType>;
32
+ /** Optional destination path for the generated file */
21
33
  destinationPath?: string;
34
+ /** The generated definition */
22
35
  definition: GeneratedDefinition<V, T>;
36
+ /** Optional root reference name */
23
37
  rootRef?: RefName;
38
+ /** Whether to skip export declaration */
24
39
  noExport?: boolean;
40
+ /**
41
+ * Creates a new ModelDriver instance.
42
+ *
43
+ * @param args - Constructor arguments
44
+ * @param args.context - Generation context
45
+ * @param args.insertable - Model insertable configuration
46
+ * @param args.refName - Reference name for the model
47
+ * @param args.generation - Optional generation type
48
+ * @param args.destinationPath - Optional destination path
49
+ * @param args.rootRef - Optional root reference name
50
+ * @param args.noExport - Whether to skip export declaration
51
+ */
25
52
  constructor({ context, insertable, refName, generation, destinationPath, rootRef, noExport }: CreateModelArgs<V, T, EnrichmentType>);
53
+ /**
54
+ * Applies generation configuration to create the model definition.
55
+ *
56
+ * This method handles the core generation logic, including identifier resolution,
57
+ * export path management, and import registration for cross-file dependencies.
58
+ *
59
+ * @template T - The generation type
60
+ * @param args - Apply configuration arguments
61
+ * @param args.generation - Optional generation type (unused currently)
62
+ * @param args.destinationPath - Optional destination path for imports
63
+ * @returns Generated definition for the model
64
+ */
26
65
  private apply;
66
+ /**
67
+ * Retrieves or creates a definition for the model.
68
+ *
69
+ * This method first checks for cached definitions to avoid duplicate generation,
70
+ * then creates a new definition if none exists. It handles the complete model
71
+ * transformation process including schema resolution and value generation.
72
+ *
73
+ * @param args - Definition retrieval arguments
74
+ * @param args.identifier - The identifier for the definition
75
+ * @param args.exportPath - The export path for the definition
76
+ * @returns Model definition instance
77
+ */
27
78
  private getDefinition;
79
+ /**
80
+ * Type guard to verify a definition matches the expected generated value type.
81
+ *
82
+ * This method performs type narrowing to ensure a cached definition is compatible
83
+ * with the current generation requirements, including export path validation.
84
+ *
85
+ * @template V - The expected generated value type
86
+ * @param definition - The definition to verify (may be undefined)
87
+ * @param exportPath - Expected export path for validation
88
+ * @returns True if definition matches expected type and constraints
89
+ */
28
90
  private affirmDefinition;
29
91
  }
30
92
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ModelDriver.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAI5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAGrD,KAAK,eAAe,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,cAAc,EAAE,cAAc,IAAI;IACzF,OAAO,EAAE,eAAe,CAAA;IACxB,UAAU,EAAE,eAAe,CAAC,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;;;OAWG;IACH,OAAO,CAAC,aAAa;IA2CrB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,gBAAgB;CAqBzB"}
@@ -4,50 +4,77 @@ exports.ModelDriver = 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 responsible for managing model generation lifecycle.
9
+ *
10
+ * @template V - The generated value type
11
+ * @template T - The generation type
12
+ * @template EnrichmentType - Optional enrichment type
13
+ */
7
14
  class ModelDriver {
15
+ /**
16
+ * Creates a new ModelDriver instance.
17
+ *
18
+ * @param args - Constructor arguments
19
+ * @param args.context - Generation context
20
+ * @param args.insertable - Model insertable configuration
21
+ * @param args.refName - Reference name for the model
22
+ * @param args.generation - Optional generation type
23
+ * @param args.destinationPath - Optional destination path
24
+ * @param args.rootRef - Optional root reference name
25
+ * @param args.noExport - Whether to skip export declaration
26
+ */
8
27
  constructor({ context, insertable, refName, generation, destinationPath, rootRef, noExport }) {
28
+ /** The generation context */
9
29
  Object.defineProperty(this, "context", {
10
30
  enumerable: true,
11
31
  configurable: true,
12
32
  writable: true,
13
33
  value: void 0
14
34
  });
35
+ /** The insertable model configuration */
15
36
  Object.defineProperty(this, "insertable", {
16
37
  enumerable: true,
17
38
  configurable: true,
18
39
  writable: true,
19
40
  value: void 0
20
41
  });
42
+ /** Reference name for the model */
21
43
  Object.defineProperty(this, "refName", {
22
44
  enumerable: true,
23
45
  configurable: true,
24
46
  writable: true,
25
47
  value: void 0
26
48
  });
49
+ /** Content settings for the model */
27
50
  Object.defineProperty(this, "settings", {
28
51
  enumerable: true,
29
52
  configurable: true,
30
53
  writable: true,
31
54
  value: void 0
32
55
  });
56
+ /** Optional destination path for the generated file */
33
57
  Object.defineProperty(this, "destinationPath", {
34
58
  enumerable: true,
35
59
  configurable: true,
36
60
  writable: true,
37
61
  value: void 0
38
62
  });
63
+ /** The generated definition */
39
64
  Object.defineProperty(this, "definition", {
40
65
  enumerable: true,
41
66
  configurable: true,
42
67
  writable: true,
43
68
  value: void 0
44
69
  });
70
+ /** Optional root reference name */
45
71
  Object.defineProperty(this, "rootRef", {
46
72
  enumerable: true,
47
73
  configurable: true,
48
74
  writable: true,
49
75
  value: void 0
50
76
  });
77
+ /** Whether to skip export declaration */
51
78
  Object.defineProperty(this, "noExport", {
52
79
  enumerable: true,
53
80
  configurable: true,
@@ -65,7 +92,19 @@ class ModelDriver {
65
92
  this.definition = this.apply({ generation, destinationPath });
66
93
  this.context.modelDepth[`${insertable.id}:${refName}`] = 0;
67
94
  }
68
- apply({ generation, destinationPath } = {}) {
95
+ /**
96
+ * Applies generation configuration to create the model definition.
97
+ *
98
+ * This method handles the core generation logic, including identifier resolution,
99
+ * export path management, and import registration for cross-file dependencies.
100
+ *
101
+ * @template T - The generation type
102
+ * @param args - Apply configuration arguments
103
+ * @param args.generation - Optional generation type (unused currently)
104
+ * @param args.destinationPath - Optional destination path for imports
105
+ * @returns Generated definition for the model
106
+ */
107
+ apply({ generation: _generation, destinationPath } = {}) {
69
108
  const { identifier, exportPath } = this.settings;
70
109
  // Everything is selected (for now)
71
110
  // if (/*!selected && */ generation !== 'force') {
@@ -80,6 +119,18 @@ class ModelDriver {
80
119
  }
81
120
  return definition;
82
121
  }
122
+ /**
123
+ * Retrieves or creates a definition for the model.
124
+ *
125
+ * This method first checks for cached definitions to avoid duplicate generation,
126
+ * then creates a new definition if none exists. It handles the complete model
127
+ * transformation process including schema resolution and value generation.
128
+ *
129
+ * @param args - Definition retrieval arguments
130
+ * @param args.identifier - The identifier for the definition
131
+ * @param args.exportPath - The export path for the definition
132
+ * @returns Model definition instance
133
+ */
83
134
  getDefinition({ identifier, exportPath }) {
84
135
  const cachedDefinition = this.context.findDefinition({
85
136
  name: identifier.name,
@@ -115,6 +166,17 @@ class ModelDriver {
115
166
  });
116
167
  return definition;
117
168
  }
169
+ /**
170
+ * Type guard to verify a definition matches the expected generated value type.
171
+ *
172
+ * This method performs type narrowing to ensure a cached definition is compatible
173
+ * with the current generation requirements, including export path validation.
174
+ *
175
+ * @template V - The expected generated value type
176
+ * @param definition - The definition to verify (may be undefined)
177
+ * @param exportPath - Expected export path for validation
178
+ * @returns True if definition matches expected type and constraints
179
+ */
118
180
  affirmDefinition(definition, exportPath) {
119
181
  if (!definition) {
120
182
  return false;