@skmtc/core 0.0.793 → 0.0.794

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 (43) hide show
  1. package/esm/helpers/ResultsLog.d.ts +193 -0
  2. package/esm/helpers/ResultsLog.d.ts.map +1 -1
  3. package/esm/helpers/ResultsLog.js +213 -0
  4. package/esm/helpers/tracer.d.ts +124 -0
  5. package/esm/helpers/tracer.d.ts.map +1 -1
  6. package/esm/helpers/tracer.js +124 -0
  7. package/esm/typescript/PathParams.d.ts +198 -0
  8. package/esm/typescript/PathParams.d.ts.map +1 -1
  9. package/esm/typescript/PathParams.js +190 -0
  10. package/esm/typescript/ReactRouterPathParams.d.ts +190 -0
  11. package/esm/typescript/ReactRouterPathParams.d.ts.map +1 -1
  12. package/esm/typescript/ReactRouterPathParams.js +183 -0
  13. package/esm/typescript/keyValues.d.ts +125 -0
  14. package/esm/typescript/keyValues.d.ts.map +1 -1
  15. package/esm/typescript/keyValues.js +125 -1
  16. package/esm/typescript/toPathParams.d.ts +179 -0
  17. package/esm/typescript/toPathParams.d.ts.map +1 -1
  18. package/esm/typescript/toPathParams.js +179 -0
  19. package/esm/typescript/toPathTemplate.d.ts +114 -0
  20. package/esm/typescript/toPathTemplate.d.ts.map +1 -1
  21. package/esm/typescript/toPathTemplate.js +114 -0
  22. package/package.json +1 -1
  23. package/script/helpers/ResultsLog.d.ts +193 -0
  24. package/script/helpers/ResultsLog.d.ts.map +1 -1
  25. package/script/helpers/ResultsLog.js +213 -0
  26. package/script/helpers/tracer.d.ts +124 -0
  27. package/script/helpers/tracer.d.ts.map +1 -1
  28. package/script/helpers/tracer.js +124 -0
  29. package/script/typescript/PathParams.d.ts +198 -0
  30. package/script/typescript/PathParams.d.ts.map +1 -1
  31. package/script/typescript/PathParams.js +190 -0
  32. package/script/typescript/ReactRouterPathParams.d.ts +190 -0
  33. package/script/typescript/ReactRouterPathParams.d.ts.map +1 -1
  34. package/script/typescript/ReactRouterPathParams.js +183 -0
  35. package/script/typescript/keyValues.d.ts +125 -0
  36. package/script/typescript/keyValues.d.ts.map +1 -1
  37. package/script/typescript/keyValues.js +125 -1
  38. package/script/typescript/toPathParams.d.ts +179 -0
  39. package/script/typescript/toPathParams.d.ts.map +1 -1
  40. package/script/typescript/toPathParams.js +179 -0
  41. package/script/typescript/toPathTemplate.d.ts +114 -0
  42. package/script/typescript/toPathTemplate.d.ts.map +1 -1
  43. package/script/typescript/toPathTemplate.js +114 -0
@@ -1,8 +1,201 @@
1
1
  import type { ResultsItem, ResultType } from '../types/Results.js';
2
+ /**
3
+ * Manages and organizes generation results with intelligent prioritization.
4
+ *
5
+ * `ResultsLog` tracks the outcomes of code generation operations, maintaining
6
+ * a hierarchical structure of results organized by stack trail paths. It implements
7
+ * intelligent result prioritization, ensuring that more severe results (errors)
8
+ * take precedence over less severe ones (success, warnings) when multiple results
9
+ * exist for the same path.
10
+ *
11
+ * The class is designed to work with the SKMTC tracing system, using stack trail
12
+ * identifiers to organize results in a meaningful hierarchical structure that
13
+ * reflects the execution flow of the generation process.
14
+ *
15
+ * ## Key Features
16
+ *
17
+ * - **Result Prioritization**: Automatically prioritizes more severe results
18
+ * - **Hierarchical Organization**: Organizes results by stack trail paths
19
+ * - **Tree Structure**: Converts flat result logs into nested tree structures
20
+ * - **Duplicate Handling**: Prevents less severe results from overwriting more severe ones
21
+ *
22
+ * @example Basic usage
23
+ * ```typescript
24
+ * import { ResultsLog } from '@skmtc/core';
25
+ *
26
+ * const resultsLog = new ResultsLog();
27
+ *
28
+ * // Capture results from different parts of generation
29
+ * resultsLog.capture('models:User', 'success');
30
+ * resultsLog.capture('models:Product', 'error');
31
+ * resultsLog.capture('types:Status', 'success');
32
+ *
33
+ * // Convert to hierarchical structure
34
+ * const tree = resultsLog.toTree();
35
+ * console.log(tree);
36
+ * // {
37
+ * // models: {
38
+ * // User: 'success',
39
+ * // Product: 'error'
40
+ * // },
41
+ * // types: {
42
+ * // Status: 'success'
43
+ * // }
44
+ * // }
45
+ * ```
46
+ *
47
+ * @example Result prioritization
48
+ * ```typescript
49
+ * const resultsLog = new ResultsLog();
50
+ *
51
+ * // First capture a success
52
+ * resultsLog.capture('api:createUser', 'success');
53
+ *
54
+ * // Later encounter an error at the same path
55
+ * resultsLog.capture('api:createUser', 'error');
56
+ *
57
+ * // Error takes precedence
58
+ * const tree = resultsLog.toTree();
59
+ * console.log(tree.api.createUser); // 'error'
60
+ *
61
+ * // But success won't overwrite error
62
+ * resultsLog.capture('api:createUser', 'success');
63
+ * console.log(resultsLog.toTree().api.createUser); // Still 'error'
64
+ * ```
65
+ *
66
+ * @example Complex nested paths
67
+ * ```typescript
68
+ * const resultsLog = new ResultsLog();
69
+ *
70
+ * resultsLog.capture('generation:models:User:properties:name', 'success');
71
+ * resultsLog.capture('generation:models:User:properties:email', 'warning');
72
+ * resultsLog.capture('generation:models:Product:validation', 'error');
73
+ * resultsLog.capture('generation:operations:createUser', 'success');
74
+ *
75
+ * const tree = resultsLog.toTree();
76
+ * console.log(tree);
77
+ * // {
78
+ * // generation: {
79
+ * // models: {
80
+ * // User: {
81
+ * // properties: {
82
+ * // name: 'success',
83
+ * // email: 'warning'
84
+ * // }
85
+ * // },
86
+ * // Product: {
87
+ * // validation: 'error'
88
+ * // }
89
+ * // },
90
+ * // operations: {
91
+ * // createUser: 'success'
92
+ * // }
93
+ * // }
94
+ * // }
95
+ * ```
96
+ *
97
+ * @example Integration with tracing
98
+ * ```typescript
99
+ * class TrackedGenerator {
100
+ * private resultsLog = new ResultsLog();
101
+ *
102
+ * generateModel(name: string, schema: OasSchema) {
103
+ * const stackPath = `models:${name}`;
104
+ *
105
+ * try {
106
+ * const model = this.processSchema(schema);
107
+ * this.resultsLog.capture(stackPath, 'success');
108
+ * return model;
109
+ * } catch (error) {
110
+ * this.resultsLog.capture(stackPath, 'error');
111
+ * throw error;
112
+ * }
113
+ * }
114
+ *
115
+ * generateOperation(operationId: string, operation: OasOperation) {
116
+ * const stackPath = `operations:${operationId}`;
117
+ *
118
+ * if (!this.supportsOperation(operation)) {
119
+ * this.resultsLog.capture(stackPath, 'notSupported');
120
+ * return null;
121
+ * }
122
+ *
123
+ * const result = this.processOperation(operation);
124
+ * this.resultsLog.capture(stackPath, 'success');
125
+ * return result;
126
+ * }
127
+ *
128
+ * getResults(): ResultsItem {
129
+ * return this.resultsLog.toTree();
130
+ * }
131
+ * }
132
+ * ```
133
+ */
2
134
  export declare class ResultsLog {
3
135
  #private;
136
+ /**
137
+ * Creates a new ResultsLog instance.
138
+ *
139
+ * Initializes an empty results tracking system ready to capture
140
+ * generation outcomes from various parts of the pipeline.
141
+ */
4
142
  constructor();
143
+ /**
144
+ * Captures a generation result for a specific stack trail path.
145
+ *
146
+ * This method records the outcome of a generation operation, using intelligent
147
+ * prioritization to ensure that more severe results take precedence over less
148
+ * severe ones. For example, an error result will not be overwritten by a
149
+ * success result, but a success can be overwritten by an error.
150
+ *
151
+ * @param stackTrail - Colon-separated path identifying the operation location
152
+ * @param result - The result type to capture (error, warning, success, etc.)
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * const resultsLog = new ResultsLog();
157
+ *
158
+ * // Capture various results
159
+ * resultsLog.capture('models:User:properties:email', 'success');
160
+ * resultsLog.capture('models:User:validation', 'warning');
161
+ * resultsLog.capture('operations:createUser', 'error');
162
+ * ```
163
+ */
5
164
  capture(stackTrail: string, result: ResultType): void;
165
+ /**
166
+ * Converts the flat results structure into a hierarchical tree.
167
+ *
168
+ * This method transforms the internal flat storage (using colon-separated paths)
169
+ * into a nested object structure that reflects the hierarchy of generation
170
+ * operations. This makes it easier to understand and process results in
171
+ * a structured way.
172
+ *
173
+ * @returns Nested object structure representing the results hierarchy
174
+ *
175
+ * @example
176
+ * ```typescript
177
+ * const resultsLog = new ResultsLog();
178
+ * resultsLog.capture('api:models:User', 'success');
179
+ * resultsLog.capture('api:operations:getUser', 'error');
180
+ * resultsLog.capture('types:Status', 'success');
181
+ *
182
+ * const tree = resultsLog.toTree();
183
+ * console.log(tree);
184
+ * // {
185
+ * // api: {
186
+ * // models: {
187
+ * // User: 'success'
188
+ * // },
189
+ * // operations: {
190
+ * // getUser: 'error'
191
+ * // }
192
+ * // },
193
+ * // types: {
194
+ * // Status: 'success'
195
+ * // }
196
+ * // }
197
+ * ```
198
+ */
6
199
  toTree(): ResultsItem;
7
200
  }
8
201
  //# sourceMappingURL=ResultsLog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResultsLog.d.ts","sourceRoot":"","sources":["../../src/helpers/ResultsLog.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAElE,qBAAa,UAAU;;;IAOrB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU;IAc9C,MAAM,IAAI,WAAW;CAWtB"}
1
+ {"version":3,"file":"ResultsLog.d.ts","sourceRoot":"","sources":["../../src/helpers/ResultsLog.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmIG;AACH,qBAAa,UAAU;;IAGrB;;;;;OAKG;;IAKH;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU;IA8B9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,MAAM,IAAI,WAAW;CAWtB"}
@@ -11,17 +11,210 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
11
  };
12
12
  var _ResultsLog_instances, _ResultsLog_results, _ResultsLog_incomingResultIsWorse;
13
13
  import { set } from 'lodash-es';
14
+ /**
15
+ * Manages and organizes generation results with intelligent prioritization.
16
+ *
17
+ * `ResultsLog` tracks the outcomes of code generation operations, maintaining
18
+ * a hierarchical structure of results organized by stack trail paths. It implements
19
+ * intelligent result prioritization, ensuring that more severe results (errors)
20
+ * take precedence over less severe ones (success, warnings) when multiple results
21
+ * exist for the same path.
22
+ *
23
+ * The class is designed to work with the SKMTC tracing system, using stack trail
24
+ * identifiers to organize results in a meaningful hierarchical structure that
25
+ * reflects the execution flow of the generation process.
26
+ *
27
+ * ## Key Features
28
+ *
29
+ * - **Result Prioritization**: Automatically prioritizes more severe results
30
+ * - **Hierarchical Organization**: Organizes results by stack trail paths
31
+ * - **Tree Structure**: Converts flat result logs into nested tree structures
32
+ * - **Duplicate Handling**: Prevents less severe results from overwriting more severe ones
33
+ *
34
+ * @example Basic usage
35
+ * ```typescript
36
+ * import { ResultsLog } from '@skmtc/core';
37
+ *
38
+ * const resultsLog = new ResultsLog();
39
+ *
40
+ * // Capture results from different parts of generation
41
+ * resultsLog.capture('models:User', 'success');
42
+ * resultsLog.capture('models:Product', 'error');
43
+ * resultsLog.capture('types:Status', 'success');
44
+ *
45
+ * // Convert to hierarchical structure
46
+ * const tree = resultsLog.toTree();
47
+ * console.log(tree);
48
+ * // {
49
+ * // models: {
50
+ * // User: 'success',
51
+ * // Product: 'error'
52
+ * // },
53
+ * // types: {
54
+ * // Status: 'success'
55
+ * // }
56
+ * // }
57
+ * ```
58
+ *
59
+ * @example Result prioritization
60
+ * ```typescript
61
+ * const resultsLog = new ResultsLog();
62
+ *
63
+ * // First capture a success
64
+ * resultsLog.capture('api:createUser', 'success');
65
+ *
66
+ * // Later encounter an error at the same path
67
+ * resultsLog.capture('api:createUser', 'error');
68
+ *
69
+ * // Error takes precedence
70
+ * const tree = resultsLog.toTree();
71
+ * console.log(tree.api.createUser); // 'error'
72
+ *
73
+ * // But success won't overwrite error
74
+ * resultsLog.capture('api:createUser', 'success');
75
+ * console.log(resultsLog.toTree().api.createUser); // Still 'error'
76
+ * ```
77
+ *
78
+ * @example Complex nested paths
79
+ * ```typescript
80
+ * const resultsLog = new ResultsLog();
81
+ *
82
+ * resultsLog.capture('generation:models:User:properties:name', 'success');
83
+ * resultsLog.capture('generation:models:User:properties:email', 'warning');
84
+ * resultsLog.capture('generation:models:Product:validation', 'error');
85
+ * resultsLog.capture('generation:operations:createUser', 'success');
86
+ *
87
+ * const tree = resultsLog.toTree();
88
+ * console.log(tree);
89
+ * // {
90
+ * // generation: {
91
+ * // models: {
92
+ * // User: {
93
+ * // properties: {
94
+ * // name: 'success',
95
+ * // email: 'warning'
96
+ * // }
97
+ * // },
98
+ * // Product: {
99
+ * // validation: 'error'
100
+ * // }
101
+ * // },
102
+ * // operations: {
103
+ * // createUser: 'success'
104
+ * // }
105
+ * // }
106
+ * // }
107
+ * ```
108
+ *
109
+ * @example Integration with tracing
110
+ * ```typescript
111
+ * class TrackedGenerator {
112
+ * private resultsLog = new ResultsLog();
113
+ *
114
+ * generateModel(name: string, schema: OasSchema) {
115
+ * const stackPath = `models:${name}`;
116
+ *
117
+ * try {
118
+ * const model = this.processSchema(schema);
119
+ * this.resultsLog.capture(stackPath, 'success');
120
+ * return model;
121
+ * } catch (error) {
122
+ * this.resultsLog.capture(stackPath, 'error');
123
+ * throw error;
124
+ * }
125
+ * }
126
+ *
127
+ * generateOperation(operationId: string, operation: OasOperation) {
128
+ * const stackPath = `operations:${operationId}`;
129
+ *
130
+ * if (!this.supportsOperation(operation)) {
131
+ * this.resultsLog.capture(stackPath, 'notSupported');
132
+ * return null;
133
+ * }
134
+ *
135
+ * const result = this.processOperation(operation);
136
+ * this.resultsLog.capture(stackPath, 'success');
137
+ * return result;
138
+ * }
139
+ *
140
+ * getResults(): ResultsItem {
141
+ * return this.resultsLog.toTree();
142
+ * }
143
+ * }
144
+ * ```
145
+ */
14
146
  export class ResultsLog {
147
+ /**
148
+ * Creates a new ResultsLog instance.
149
+ *
150
+ * Initializes an empty results tracking system ready to capture
151
+ * generation outcomes from various parts of the pipeline.
152
+ */
15
153
  constructor() {
16
154
  _ResultsLog_instances.add(this);
17
155
  _ResultsLog_results.set(this, void 0);
18
156
  __classPrivateFieldSet(this, _ResultsLog_results, {}, "f");
19
157
  }
158
+ /**
159
+ * Captures a generation result for a specific stack trail path.
160
+ *
161
+ * This method records the outcome of a generation operation, using intelligent
162
+ * prioritization to ensure that more severe results take precedence over less
163
+ * severe ones. For example, an error result will not be overwritten by a
164
+ * success result, but a success can be overwritten by an error.
165
+ *
166
+ * @param stackTrail - Colon-separated path identifying the operation location
167
+ * @param result - The result type to capture (error, warning, success, etc.)
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * const resultsLog = new ResultsLog();
172
+ *
173
+ * // Capture various results
174
+ * resultsLog.capture('models:User:properties:email', 'success');
175
+ * resultsLog.capture('models:User:validation', 'warning');
176
+ * resultsLog.capture('operations:createUser', 'error');
177
+ * ```
178
+ */
20
179
  capture(stackTrail, result) {
21
180
  if (__classPrivateFieldGet(this, _ResultsLog_instances, "m", _ResultsLog_incomingResultIsWorse).call(this, __classPrivateFieldGet(this, _ResultsLog_results, "f")[stackTrail], result)) {
22
181
  __classPrivateFieldGet(this, _ResultsLog_results, "f")[stackTrail] = result;
23
182
  }
24
183
  }
184
+ /**
185
+ * Converts the flat results structure into a hierarchical tree.
186
+ *
187
+ * This method transforms the internal flat storage (using colon-separated paths)
188
+ * into a nested object structure that reflects the hierarchy of generation
189
+ * operations. This makes it easier to understand and process results in
190
+ * a structured way.
191
+ *
192
+ * @returns Nested object structure representing the results hierarchy
193
+ *
194
+ * @example
195
+ * ```typescript
196
+ * const resultsLog = new ResultsLog();
197
+ * resultsLog.capture('api:models:User', 'success');
198
+ * resultsLog.capture('api:operations:getUser', 'error');
199
+ * resultsLog.capture('types:Status', 'success');
200
+ *
201
+ * const tree = resultsLog.toTree();
202
+ * console.log(tree);
203
+ * // {
204
+ * // api: {
205
+ * // models: {
206
+ * // User: 'success'
207
+ * // },
208
+ * // operations: {
209
+ * // getUser: 'error'
210
+ * // }
211
+ * // },
212
+ * // types: {
213
+ * // Status: 'success'
214
+ * // }
215
+ * // }
216
+ * ```
217
+ */
25
218
  toTree() {
26
219
  const tree = {};
27
220
  Object.entries(__classPrivateFieldGet(this, _ResultsLog_results, "f")).forEach(([key, value]) => {
@@ -37,6 +230,26 @@ _ResultsLog_results = new WeakMap(), _ResultsLog_instances = new WeakSet(), _Res
37
230
  }
38
231
  return resultRankings[current] < resultRankings[incoming];
39
232
  };
233
+ /**
234
+ * Priority rankings for different result types.
235
+ *
236
+ * This mapping defines the severity hierarchy used by the ResultsLog to determine
237
+ * which results should take precedence when multiple results are captured for the
238
+ * same path. Higher numbers indicate higher severity/priority.
239
+ *
240
+ * The ranking system ensures that critical issues (errors) are never masked by
241
+ * less important results (success), while still allowing for proper escalation
242
+ * when more severe conditions are encountered.
243
+ *
244
+ * @example Ranking hierarchy (high to low priority)
245
+ * ```
246
+ * error (50) - Critical failures that prevent generation
247
+ * warning (40) - Issues that allow generation but need attention
248
+ * success (30) - Normal successful completion
249
+ * skipped (20) - Operations that were intentionally bypassed
250
+ * notSupported (10) - Features not yet implemented
251
+ * ```
252
+ */
40
253
  const resultRankings = {
41
254
  error: 50,
42
255
  warning: 40,
@@ -1,4 +1,128 @@
1
1
  import type { Logger } from '../deps/jsr.io/@std/log/0.224.14/logger.js';
2
2
  import type { StackTrail } from '../context/StackTrail.js';
3
+ /**
4
+ * Executes a function with distributed tracing support and stack trail management.
5
+ *
6
+ * This utility function provides distributed tracing capabilities for the SKMTC
7
+ * generation pipeline. It manages stack trail tokens that help track execution
8
+ * context across complex nested operations, making debugging and performance
9
+ * analysis much easier.
10
+ *
11
+ * The tracer ensures proper cleanup of stack trail tokens even if the wrapped
12
+ * function throws an error, maintaining the integrity of the tracing system.
13
+ * This is essential for accurate debugging and performance monitoring in
14
+ * complex code generation scenarios.
15
+ *
16
+ * @template T - The return type of the traced function
17
+ * @param stackTrail - The stack trail instance for tracking execution context
18
+ * @param token - Token(s) to identify this execution step in traces
19
+ * @param fn - The function to execute with tracing
20
+ * @param log - Logger instance for error reporting
21
+ * @returns The result of the wrapped function execution
22
+ *
23
+ * @throws Re-throws any error from the wrapped function after cleanup
24
+ *
25
+ * @example Basic tracing usage
26
+ * ```typescript
27
+ * import { tracer } from '@skmtc/core';
28
+ *
29
+ * class ModelGenerator {
30
+ * generateModel(stackTrail: StackTrail, logger: Logger) {
31
+ * return tracer(stackTrail, 'generate-model', () => {
32
+ * // Complex model generation logic here
33
+ * return this.createModelDefinition();
34
+ * }, logger);
35
+ * }
36
+ * }
37
+ * ```
38
+ *
39
+ * @example Nested tracing
40
+ * ```typescript
41
+ * class ComplexProcessor {
42
+ * processSchema(stackTrail: StackTrail, logger: Logger) {
43
+ * return tracer(stackTrail, 'process-schema', () => {
44
+ * const parsed = tracer(stackTrail, 'parse', () => {
45
+ * return this.parseSchema();
46
+ * }, logger);
47
+ *
48
+ * const validated = tracer(stackTrail, 'validate', () => {
49
+ * return this.validateSchema(parsed);
50
+ * }, logger);
51
+ *
52
+ * return tracer(stackTrail, 'transform', () => {
53
+ * return this.transformSchema(validated);
54
+ * }, logger);
55
+ * }, logger);
56
+ * }
57
+ * }
58
+ *
59
+ * // Stack trail will show: ['process-schema', 'parse'] -> ['process-schema', 'validate'] -> ['process-schema', 'transform']
60
+ * ```
61
+ *
62
+ * @example Multiple token tracing
63
+ * ```typescript
64
+ * const result = tracer(
65
+ * stackTrail,
66
+ * ['file-generation', 'models.ts'], // Multiple tokens for detailed context
67
+ * () => {
68
+ * return generateModelsFile();
69
+ * },
70
+ * logger
71
+ * );
72
+ * ```
73
+ *
74
+ * @example Error handling with tracing
75
+ * ```typescript
76
+ * class SafeGenerator {
77
+ * generateWithTracing(stackTrail: StackTrail, logger: Logger) {
78
+ * try {
79
+ * return tracer(stackTrail, 'risky-operation', () => {
80
+ * // This might throw an error
81
+ * return this.complexGeneration();
82
+ * }, logger);
83
+ * } catch (error) {
84
+ * // Stack trail is automatically cleaned up
85
+ * logger.error(`Generation failed: ${error.message}`);
86
+ * return this.fallbackGeneration();
87
+ * }
88
+ * }
89
+ * }
90
+ * ```
91
+ *
92
+ * @example Performance monitoring
93
+ * ```typescript
94
+ * class PerformanceAwareGenerator {
95
+ * timedGeneration(stackTrail: StackTrail, logger: Logger) {
96
+ * const startTime = Date.now();
97
+ *
98
+ * const result = tracer(stackTrail, 'timed-generation', () => {
99
+ * return this.heavyComputation();
100
+ * }, logger);
101
+ *
102
+ * const duration = Date.now() - startTime;
103
+ * logger.info(`Generation completed in ${duration}ms`);
104
+ *
105
+ * return result;
106
+ * }
107
+ * }
108
+ * ```
109
+ *
110
+ * @example Integration with context classes
111
+ * ```typescript
112
+ * // Typically used within context classes like this:
113
+ * class GenerateContext {
114
+ * trace<T>(token: string | string[], fn: () => T): T {
115
+ * return tracer(this.stackTrail, token, fn, this.logger);
116
+ * }
117
+ *
118
+ * processModel(schema: OasSchema) {
119
+ * return this.trace(['model', schema.type], () => {
120
+ * // Model processing logic
121
+ * return this.createModel(schema);
122
+ * });
123
+ * }
124
+ * }
125
+ * ```
126
+ */
3
127
  export declare const tracer: <T>(stackTrail: StackTrail, token: string | string[], fn: () => T, log: Logger) => T;
4
128
  //# sourceMappingURL=tracer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tracer.d.ts","sourceRoot":"","sources":["../../src/helpers/tracer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4CAA4C,CAAA;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,eAAO,MAAM,MAAM,GAAI,CAAC,EACtB,YAAY,UAAU,EACtB,OAAO,MAAM,GAAG,MAAM,EAAE,EACxB,IAAI,MAAM,CAAC,EACX,KAAK,MAAM,MAgBZ,CAAA"}
1
+ {"version":3,"file":"tracer.d.ts","sourceRoot":"","sources":["../../src/helpers/tracer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4CAA4C,CAAA;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2HG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,EACtB,YAAY,UAAU,EACtB,OAAO,MAAM,GAAG,MAAM,EAAE,EACxB,IAAI,MAAM,CAAC,EACX,KAAK,MAAM,MAgBZ,CAAA"}