@skmtc/core 0.0.793 → 0.0.795

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