@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,3 +1,127 @@
1
+ /**
2
+ * Executes a function with distributed tracing support and stack trail management.
3
+ *
4
+ * This utility function provides distributed tracing capabilities for the SKMTC
5
+ * generation pipeline. It manages stack trail tokens that help track execution
6
+ * context across complex nested operations, making debugging and performance
7
+ * analysis much easier.
8
+ *
9
+ * The tracer ensures proper cleanup of stack trail tokens even if the wrapped
10
+ * function throws an error, maintaining the integrity of the tracing system.
11
+ * This is essential for accurate debugging and performance monitoring in
12
+ * complex code generation scenarios.
13
+ *
14
+ * @template T - The return type of the traced function
15
+ * @param stackTrail - The stack trail instance for tracking execution context
16
+ * @param token - Token(s) to identify this execution step in traces
17
+ * @param fn - The function to execute with tracing
18
+ * @param log - Logger instance for error reporting
19
+ * @returns The result of the wrapped function execution
20
+ *
21
+ * @throws Re-throws any error from the wrapped function after cleanup
22
+ *
23
+ * @example Basic tracing usage
24
+ * ```typescript
25
+ * import { tracer } from '@skmtc/core';
26
+ *
27
+ * class ModelGenerator {
28
+ * generateModel(stackTrail: StackTrail, logger: Logger) {
29
+ * return tracer(stackTrail, 'generate-model', () => {
30
+ * // Complex model generation logic here
31
+ * return this.createModelDefinition();
32
+ * }, logger);
33
+ * }
34
+ * }
35
+ * ```
36
+ *
37
+ * @example Nested tracing
38
+ * ```typescript
39
+ * class ComplexProcessor {
40
+ * processSchema(stackTrail: StackTrail, logger: Logger) {
41
+ * return tracer(stackTrail, 'process-schema', () => {
42
+ * const parsed = tracer(stackTrail, 'parse', () => {
43
+ * return this.parseSchema();
44
+ * }, logger);
45
+ *
46
+ * const validated = tracer(stackTrail, 'validate', () => {
47
+ * return this.validateSchema(parsed);
48
+ * }, logger);
49
+ *
50
+ * return tracer(stackTrail, 'transform', () => {
51
+ * return this.transformSchema(validated);
52
+ * }, logger);
53
+ * }, logger);
54
+ * }
55
+ * }
56
+ *
57
+ * // Stack trail will show: ['process-schema', 'parse'] -> ['process-schema', 'validate'] -> ['process-schema', 'transform']
58
+ * ```
59
+ *
60
+ * @example Multiple token tracing
61
+ * ```typescript
62
+ * const result = tracer(
63
+ * stackTrail,
64
+ * ['file-generation', 'models.ts'], // Multiple tokens for detailed context
65
+ * () => {
66
+ * return generateModelsFile();
67
+ * },
68
+ * logger
69
+ * );
70
+ * ```
71
+ *
72
+ * @example Error handling with tracing
73
+ * ```typescript
74
+ * class SafeGenerator {
75
+ * generateWithTracing(stackTrail: StackTrail, logger: Logger) {
76
+ * try {
77
+ * return tracer(stackTrail, 'risky-operation', () => {
78
+ * // This might throw an error
79
+ * return this.complexGeneration();
80
+ * }, logger);
81
+ * } catch (error) {
82
+ * // Stack trail is automatically cleaned up
83
+ * logger.error(`Generation failed: ${error.message}`);
84
+ * return this.fallbackGeneration();
85
+ * }
86
+ * }
87
+ * }
88
+ * ```
89
+ *
90
+ * @example Performance monitoring
91
+ * ```typescript
92
+ * class PerformanceAwareGenerator {
93
+ * timedGeneration(stackTrail: StackTrail, logger: Logger) {
94
+ * const startTime = Date.now();
95
+ *
96
+ * const result = tracer(stackTrail, 'timed-generation', () => {
97
+ * return this.heavyComputation();
98
+ * }, logger);
99
+ *
100
+ * const duration = Date.now() - startTime;
101
+ * logger.info(`Generation completed in ${duration}ms`);
102
+ *
103
+ * return result;
104
+ * }
105
+ * }
106
+ * ```
107
+ *
108
+ * @example Integration with context classes
109
+ * ```typescript
110
+ * // Typically used within context classes like this:
111
+ * class GenerateContext {
112
+ * trace<T>(token: string | string[], fn: () => T): T {
113
+ * return tracer(this.stackTrail, token, fn, this.logger);
114
+ * }
115
+ *
116
+ * processModel(schema: OasSchema) {
117
+ * return this.trace(['model', schema.type], () => {
118
+ * // Model processing logic
119
+ * return this.createModel(schema);
120
+ * });
121
+ * }
122
+ * }
123
+ * ```
124
+ */
1
125
  export const tracer = (stackTrail, token, fn, log) => {
2
126
  stackTrail.append(token);
3
127
  try {
@@ -2,18 +2,216 @@ import type { GenerateContext } from '../context/GenerateContext.js';
2
2
  import { Definition } from '../dsl/Definition.js';
3
3
  import type { TypeSystemObject } from '../types/TypeSystem.js';
4
4
  import { FunctionParameter } from './FunctionParameter.js';
5
+ /**
6
+ * Constructor arguments for {@link PathParams}.
7
+ */
5
8
  type ConstructorArgs = {
9
+ /** The generation context for registering types and handling imports */
6
10
  context: GenerateContext;
11
+ /** Optional argument name for the parameter (if undefined, uses destructuring) */
7
12
  argName?: string;
13
+ /** Name of the TypeScript type to generate */
8
14
  typeName: string;
15
+ /** The type system object defining the parameter structure */
9
16
  typeValue: TypeSystemObject;
17
+ /** OpenAPI path template with parameter placeholders */
10
18
  pathTemplate: string;
11
19
  };
20
+ /**
21
+ * Manages path parameter type definitions and function parameters for API endpoints.
22
+ *
23
+ * `PathParams` is a utility class that combines type generation, function parameter
24
+ * handling, and path templating for OpenAPI path parameters. It creates TypeScript
25
+ * type definitions for path parameters and generates the corresponding function
26
+ * parameters that can be used in API client methods.
27
+ *
28
+ * This class is essential for generating type-safe API clients where path parameters
29
+ * are properly typed and validated at compile time. It handles both destructured
30
+ * parameters (when no argument name is provided) and named parameters.
31
+ *
32
+ * ## Key Features
33
+ *
34
+ * - **Type Definition Generation**: Creates TypeScript types for path parameters
35
+ * - **Function Parameter Integration**: Generates properly typed function parameters
36
+ * - **Path Template Processing**: Converts OpenAPI paths to template literals
37
+ * - **Destructuring Support**: Handles both named and destructured parameter patterns
38
+ * - **Context Integration**: Fully integrated with the SKMTC generation pipeline
39
+ *
40
+ * @example Basic path parameters with destructuring
41
+ * ```typescript
42
+ * import { PathParams } from '@skmtc/core';
43
+ *
44
+ * const pathParams = new PathParams({
45
+ * context: generateContext,
46
+ * typeName: 'GetUserParams',
47
+ * typeValue: {
48
+ * type: 'object',
49
+ * objectProperties: {
50
+ * properties: {
51
+ * id: { type: 'string' },
52
+ * format: { type: 'string' }
53
+ * }
54
+ * }
55
+ * },
56
+ * pathTemplate: '/users/{id}'
57
+ * });
58
+ *
59
+ * console.log(pathParams.path); // '/users/${id}'
60
+ * ```
61
+ *
62
+ * @example Named parameter usage
63
+ * ```typescript
64
+ * const namedPathParams = new PathParams({
65
+ * context: generateContext,
66
+ * argName: 'params',
67
+ * typeName: 'UserPathParams',
68
+ * typeValue: {
69
+ * type: 'object',
70
+ * objectProperties: {
71
+ * properties: {
72
+ * userId: { type: 'string' },
73
+ * projectId: { type: 'string' }
74
+ * }
75
+ * }
76
+ * },
77
+ * pathTemplate: '/users/{userId}/projects/{projectId}'
78
+ * });
79
+ *
80
+ * console.log(pathParams.path); // '/users/${params.userId}/projects/${params.projectId}'
81
+ * ```
82
+ *
83
+ * @example API client method generation
84
+ * ```typescript
85
+ * class ApiMethodGenerator {
86
+ * generateGetMethod(operationPath: string, parameters: any) {
87
+ * const pathParams = new PathParams({
88
+ * context: this.context,
89
+ * argName: 'pathParams',
90
+ * typeName: 'PathParameters',
91
+ * typeValue: parameters,
92
+ * pathTemplate: operationPath
93
+ * });
94
+ *
95
+ * return `
96
+ * async getData(${pathParams.parameter.toString()}) {
97
+ * const url = \`${pathParams.path}\`;
98
+ * return this.client.get(url);
99
+ * }`;
100
+ * }
101
+ * }
102
+ *
103
+ * // Generates:
104
+ * // async getData(pathParams: PathParameters) {
105
+ * // const url = `/users/${pathParams.userId}/projects/${pathParams.projectId}`;
106
+ * // return this.client.get(url);
107
+ * // }
108
+ * ```
109
+ *
110
+ * @example With destructured parameters
111
+ * ```typescript
112
+ * const destructuredParams = new PathParams({
113
+ * context: generateContext,
114
+ * // No argName provided, so uses destructuring
115
+ * typeName: 'OrderParams',
116
+ * typeValue: {
117
+ * type: 'object',
118
+ * objectProperties: {
119
+ * properties: {
120
+ * orderId: { type: 'string' },
121
+ * customerId: { type: 'string' }
122
+ * }
123
+ * }
124
+ * },
125
+ * pathTemplate: '/customers/{customerId}/orders/{orderId}'
126
+ * });
127
+ *
128
+ * // Function parameter will be: { orderId, customerId }: OrderParams
129
+ * // Path template will be: '/customers/${customerId}/orders/${orderId}'
130
+ * ```
131
+ *
132
+ * @example Complex nested path parameters
133
+ * ```typescript
134
+ * const complexPathParams = new PathParams({
135
+ * context: generateContext,
136
+ * argName: 'pathData',
137
+ * typeName: 'ComplexPathParams',
138
+ * typeValue: {
139
+ * type: 'object',
140
+ * objectProperties: {
141
+ * properties: {
142
+ * orgId: { type: 'string' },
143
+ * projectId: { type: 'string' },
144
+ * issueId: { type: 'number' },
145
+ * commentId: { type: 'string' }
146
+ * }
147
+ * }
148
+ * },
149
+ * pathTemplate: '/orgs/{orgId}/projects/{projectId}/issues/{issueId}/comments/{commentId}'
150
+ * });
151
+ *
152
+ * // Generates path: '/orgs/${pathData.orgId}/projects/${pathData.projectId}/issues/${pathData.issueId}/comments/${pathData.commentId}'
153
+ * ```
154
+ *
155
+ * @example Integration with operation generation
156
+ * ```typescript
157
+ * class OperationGenerator {
158
+ * generateOperation(operation: OasOperation) {
159
+ * const pathParameters = this.extractPathParameters(operation);
160
+ *
161
+ * if (pathParameters.length > 0) {
162
+ * const pathParams = new PathParams({
163
+ * context: this.context,
164
+ * typeName: `${operation.operationId}PathParams`,
165
+ * typeValue: this.buildParametersType(pathParameters),
166
+ * pathTemplate: operation.path
167
+ * });
168
+ *
169
+ * return this.generateMethodWithPathParams(operation, pathParams);
170
+ * }
171
+ *
172
+ * return this.generateSimpleMethod(operation);
173
+ * }
174
+ * }
175
+ * ```
176
+ */
12
177
  export declare class PathParams {
178
+ /** The generation context used for type registration and imports */
13
179
  context: GenerateContext;
180
+ /** The TypeScript type definition for the path parameters */
14
181
  typeDefinition: Definition<TypeSystemObject>;
182
+ /** The function parameter representation for method signatures */
15
183
  parameter: FunctionParameter;
184
+ /** The processed path template with parameter substitutions */
16
185
  path: string;
186
+ /**
187
+ * Creates a new PathParams instance with type definitions and path processing.
188
+ *
189
+ * The constructor sets up the complete parameter handling pipeline:
190
+ * 1. Creates a TypeScript type definition for the parameters
191
+ * 2. Generates a function parameter (either named or destructured)
192
+ * 3. Processes the path template for runtime interpolation
193
+ *
194
+ * @param args - Configuration for path parameter generation
195
+ *
196
+ * @example
197
+ * ```typescript
198
+ * const pathParams = new PathParams({
199
+ * context: generateContext,
200
+ * argName: 'params',
201
+ * typeName: 'UserPathParams',
202
+ * typeValue: {
203
+ * type: 'object',
204
+ * objectProperties: {
205
+ * properties: {
206
+ * id: { type: 'string' },
207
+ * format: { type: 'string' }
208
+ * }
209
+ * }
210
+ * },
211
+ * pathTemplate: '/users/{id}/profile'
212
+ * });
213
+ * ```
214
+ */
17
215
  constructor({ context, argName, typeName, typeValue, pathTemplate }: ConstructorArgs);
18
216
  }
19
217
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"PathParams.d.ts","sourceRoot":"","sources":["../../src/typescript/PathParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG1D,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,eAAe,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,gBAAgB,CAAA;IAC3B,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,qBAAa,UAAU;IACrB,OAAO,EAAE,eAAe,CAAA;IACxB,cAAc,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAA;IAC5C,SAAS,EAAE,iBAAiB,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;gBAEA,EACV,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,YAAY,EACb,EAAE,eAAe;CAwBnB"}
1
+ {"version":3,"file":"PathParams.d.ts","sourceRoot":"","sources":["../../src/typescript/PathParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG1D;;GAEG;AACH,KAAK,eAAe,GAAG;IACrB,wEAAwE;IACxE,OAAO,EAAE,eAAe,CAAA;IACxB,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAA;IAChB,8DAA8D;IAC9D,SAAS,EAAE,gBAAgB,CAAA;IAC3B,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4JG;AACH,qBAAa,UAAU;IACrB,oEAAoE;IACpE,OAAO,EAAE,eAAe,CAAA;IAExB,6DAA6D;IAC7D,cAAc,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAA;IAE5C,kEAAkE;IAClE,SAAS,EAAE,iBAAiB,CAAA;IAE5B,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAA;IAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;gBACS,EACV,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,YAAY,EACb,EAAE,eAAe;CAwBnB"}
@@ -2,26 +2,216 @@ import { Definition } from '../dsl/Definition.js';
2
2
  import { Identifier } from '../dsl/Identifier.js';
3
3
  import { FunctionParameter } from './FunctionParameter.js';
4
4
  import { toPathTemplate } from './toPathTemplate.js';
5
+ /**
6
+ * Manages path parameter type definitions and function parameters for API endpoints.
7
+ *
8
+ * `PathParams` is a utility class that combines type generation, function parameter
9
+ * handling, and path templating for OpenAPI path parameters. It creates TypeScript
10
+ * type definitions for path parameters and generates the corresponding function
11
+ * parameters that can be used in API client methods.
12
+ *
13
+ * This class is essential for generating type-safe API clients where path parameters
14
+ * are properly typed and validated at compile time. It handles both destructured
15
+ * parameters (when no argument name is provided) and named parameters.
16
+ *
17
+ * ## Key Features
18
+ *
19
+ * - **Type Definition Generation**: Creates TypeScript types for path parameters
20
+ * - **Function Parameter Integration**: Generates properly typed function parameters
21
+ * - **Path Template Processing**: Converts OpenAPI paths to template literals
22
+ * - **Destructuring Support**: Handles both named and destructured parameter patterns
23
+ * - **Context Integration**: Fully integrated with the SKMTC generation pipeline
24
+ *
25
+ * @example Basic path parameters with destructuring
26
+ * ```typescript
27
+ * import { PathParams } from '@skmtc/core';
28
+ *
29
+ * const pathParams = new PathParams({
30
+ * context: generateContext,
31
+ * typeName: 'GetUserParams',
32
+ * typeValue: {
33
+ * type: 'object',
34
+ * objectProperties: {
35
+ * properties: {
36
+ * id: { type: 'string' },
37
+ * format: { type: 'string' }
38
+ * }
39
+ * }
40
+ * },
41
+ * pathTemplate: '/users/{id}'
42
+ * });
43
+ *
44
+ * console.log(pathParams.path); // '/users/${id}'
45
+ * ```
46
+ *
47
+ * @example Named parameter usage
48
+ * ```typescript
49
+ * const namedPathParams = new PathParams({
50
+ * context: generateContext,
51
+ * argName: 'params',
52
+ * typeName: 'UserPathParams',
53
+ * typeValue: {
54
+ * type: 'object',
55
+ * objectProperties: {
56
+ * properties: {
57
+ * userId: { type: 'string' },
58
+ * projectId: { type: 'string' }
59
+ * }
60
+ * }
61
+ * },
62
+ * pathTemplate: '/users/{userId}/projects/{projectId}'
63
+ * });
64
+ *
65
+ * console.log(pathParams.path); // '/users/${params.userId}/projects/${params.projectId}'
66
+ * ```
67
+ *
68
+ * @example API client method generation
69
+ * ```typescript
70
+ * class ApiMethodGenerator {
71
+ * generateGetMethod(operationPath: string, parameters: any) {
72
+ * const pathParams = new PathParams({
73
+ * context: this.context,
74
+ * argName: 'pathParams',
75
+ * typeName: 'PathParameters',
76
+ * typeValue: parameters,
77
+ * pathTemplate: operationPath
78
+ * });
79
+ *
80
+ * return `
81
+ * async getData(${pathParams.parameter.toString()}) {
82
+ * const url = \`${pathParams.path}\`;
83
+ * return this.client.get(url);
84
+ * }`;
85
+ * }
86
+ * }
87
+ *
88
+ * // Generates:
89
+ * // async getData(pathParams: PathParameters) {
90
+ * // const url = `/users/${pathParams.userId}/projects/${pathParams.projectId}`;
91
+ * // return this.client.get(url);
92
+ * // }
93
+ * ```
94
+ *
95
+ * @example With destructured parameters
96
+ * ```typescript
97
+ * const destructuredParams = new PathParams({
98
+ * context: generateContext,
99
+ * // No argName provided, so uses destructuring
100
+ * typeName: 'OrderParams',
101
+ * typeValue: {
102
+ * type: 'object',
103
+ * objectProperties: {
104
+ * properties: {
105
+ * orderId: { type: 'string' },
106
+ * customerId: { type: 'string' }
107
+ * }
108
+ * }
109
+ * },
110
+ * pathTemplate: '/customers/{customerId}/orders/{orderId}'
111
+ * });
112
+ *
113
+ * // Function parameter will be: { orderId, customerId }: OrderParams
114
+ * // Path template will be: '/customers/${customerId}/orders/${orderId}'
115
+ * ```
116
+ *
117
+ * @example Complex nested path parameters
118
+ * ```typescript
119
+ * const complexPathParams = new PathParams({
120
+ * context: generateContext,
121
+ * argName: 'pathData',
122
+ * typeName: 'ComplexPathParams',
123
+ * typeValue: {
124
+ * type: 'object',
125
+ * objectProperties: {
126
+ * properties: {
127
+ * orgId: { type: 'string' },
128
+ * projectId: { type: 'string' },
129
+ * issueId: { type: 'number' },
130
+ * commentId: { type: 'string' }
131
+ * }
132
+ * }
133
+ * },
134
+ * pathTemplate: '/orgs/{orgId}/projects/{projectId}/issues/{issueId}/comments/{commentId}'
135
+ * });
136
+ *
137
+ * // Generates path: '/orgs/${pathData.orgId}/projects/${pathData.projectId}/issues/${pathData.issueId}/comments/${pathData.commentId}'
138
+ * ```
139
+ *
140
+ * @example Integration with operation generation
141
+ * ```typescript
142
+ * class OperationGenerator {
143
+ * generateOperation(operation: OasOperation) {
144
+ * const pathParameters = this.extractPathParameters(operation);
145
+ *
146
+ * if (pathParameters.length > 0) {
147
+ * const pathParams = new PathParams({
148
+ * context: this.context,
149
+ * typeName: `${operation.operationId}PathParams`,
150
+ * typeValue: this.buildParametersType(pathParameters),
151
+ * pathTemplate: operation.path
152
+ * });
153
+ *
154
+ * return this.generateMethodWithPathParams(operation, pathParams);
155
+ * }
156
+ *
157
+ * return this.generateSimpleMethod(operation);
158
+ * }
159
+ * }
160
+ * ```
161
+ */
5
162
  export class PathParams {
163
+ /**
164
+ * Creates a new PathParams instance with type definitions and path processing.
165
+ *
166
+ * The constructor sets up the complete parameter handling pipeline:
167
+ * 1. Creates a TypeScript type definition for the parameters
168
+ * 2. Generates a function parameter (either named or destructured)
169
+ * 3. Processes the path template for runtime interpolation
170
+ *
171
+ * @param args - Configuration for path parameter generation
172
+ *
173
+ * @example
174
+ * ```typescript
175
+ * const pathParams = new PathParams({
176
+ * context: generateContext,
177
+ * argName: 'params',
178
+ * typeName: 'UserPathParams',
179
+ * typeValue: {
180
+ * type: 'object',
181
+ * objectProperties: {
182
+ * properties: {
183
+ * id: { type: 'string' },
184
+ * format: { type: 'string' }
185
+ * }
186
+ * }
187
+ * },
188
+ * pathTemplate: '/users/{id}/profile'
189
+ * });
190
+ * ```
191
+ */
6
192
  constructor({ context, argName, typeName, typeValue, pathTemplate }) {
193
+ /** The generation context used for type registration and imports */
7
194
  Object.defineProperty(this, "context", {
8
195
  enumerable: true,
9
196
  configurable: true,
10
197
  writable: true,
11
198
  value: void 0
12
199
  });
200
+ /** The TypeScript type definition for the path parameters */
13
201
  Object.defineProperty(this, "typeDefinition", {
14
202
  enumerable: true,
15
203
  configurable: true,
16
204
  writable: true,
17
205
  value: void 0
18
206
  });
207
+ /** The function parameter representation for method signatures */
19
208
  Object.defineProperty(this, "parameter", {
20
209
  enumerable: true,
21
210
  configurable: true,
22
211
  writable: true,
23
212
  value: void 0
24
213
  });
214
+ /** The processed path template with parameter substitutions */
25
215
  Object.defineProperty(this, "path", {
26
216
  enumerable: true,
27
217
  configurable: true,