@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
@@ -3,14 +3,183 @@ import { camelCase } from 'lodash-es';
3
3
  import { match, P } from 'ts-pattern';
4
4
  import { List } from './List.js';
5
5
  import { isEmpty } from '../helpers/isEmpty.js';
6
+ /**
7
+ * Generates TypeScript function parameters with advanced handling for different parameter patterns.
8
+ *
9
+ * `FunctionParameter` is a sophisticated utility for generating TypeScript function parameter
10
+ * syntax that handles multiple parameter patterns including named parameters, destructured
11
+ * object parameters, and void parameters. It provides intelligent type handling and can
12
+ * generate both the parameter declaration and the parameter usage patterns.
13
+ *
14
+ * This class is essential for generating type-safe function signatures in API clients,
15
+ * utility functions, and other generated code where parameters need to be handled
16
+ * consistently and safely.
17
+ *
18
+ * ## Supported Parameter Patterns
19
+ *
20
+ * - **Named Parameters**: Traditional `paramName: Type` syntax
21
+ * - **Destructured Parameters**: `{ prop1, prop2 }: ObjectType` syntax
22
+ * - **Void Parameters**: No parameters when dealing with void types
23
+ * - **Optional Parameters**: Automatic handling of optional parameter markers
24
+ * - **Empty Filtering**: Option to skip empty properties in destructured objects
25
+ *
26
+ * @example Named parameter generation
27
+ * ```typescript
28
+ * import { FunctionParameter, Definition, Identifier } from '@skmtc/core';
29
+ *
30
+ * const userIdParam = new FunctionParameter({
31
+ * name: 'userId',
32
+ * typeDefinition: new Definition({
33
+ * context: generateContext,
34
+ * identifier: Identifier.createType('string'),
35
+ * value: { type: 'string' }
36
+ * }),
37
+ * required: true
38
+ * });
39
+ *
40
+ * console.log(userIdParam.toString()); // 'userId: string'
41
+ * console.log(userIdParam.toInbound()); // 'userId'
42
+ * ```
43
+ *
44
+ * @example Destructured parameter generation
45
+ * ```typescript
46
+ * const destructuredParam = new FunctionParameter({
47
+ * typeDefinition: new Definition({
48
+ * context: generateContext,
49
+ * identifier: Identifier.createType('UserParams'),
50
+ * value: {
51
+ * type: 'object',
52
+ * objectProperties: {
53
+ * properties: {
54
+ * name: { type: 'string' },
55
+ * email: { type: 'string' },
56
+ * age: { type: 'number' }
57
+ * }
58
+ * }
59
+ * }
60
+ * }),
61
+ * destructure: true,
62
+ * required: true
63
+ * });
64
+ *
65
+ * console.log(destructuredParam.toString());
66
+ * // '{ name, email, age }: UserParams'
67
+ *
68
+ * console.log(destructuredParam.toInbound());
69
+ * // '{ name, email, age }'
70
+ * ```
71
+ *
72
+ * @example Optional parameter handling
73
+ * ```typescript
74
+ * const optionalParam = new FunctionParameter({
75
+ * name: 'options',
76
+ * typeDefinition: optionsTypeDefinition,
77
+ * required: false
78
+ * });
79
+ *
80
+ * console.log(optionalParam.toString()); // 'options?: OptionsType'
81
+ * ```
82
+ *
83
+ * @example Void parameter handling
84
+ * ```typescript
85
+ * const voidParam = new FunctionParameter({
86
+ * typeDefinition: new Definition({
87
+ * context: generateContext,
88
+ * identifier: Identifier.createType('void'),
89
+ * value: { type: 'void' }
90
+ * })
91
+ * });
92
+ *
93
+ * console.log(voidParam.toString()); // ''
94
+ * console.log(voidParam.toInbound()); // ''
95
+ * ```
96
+ *
97
+ * @example Property checking
98
+ * ```typescript
99
+ * const objectParam = new FunctionParameter({
100
+ * typeDefinition: userTypeDefinition,
101
+ * destructure: true,
102
+ * required: true
103
+ * });
104
+ *
105
+ * if (objectParam.hasProperty('email')) {
106
+ * // Handle email property access
107
+ * console.log('Parameter includes email property');
108
+ * }
109
+ *
110
+ * const propertyList = objectParam.toPropertyList();
111
+ * console.log(propertyList.toString()); // 'name, email, age'
112
+ * ```
113
+ *
114
+ * @example API method generation with parameters
115
+ * ```typescript
116
+ * class ApiMethodGenerator {
117
+ * generateMethod(
118
+ * methodName: string,
119
+ * pathParams?: FunctionParameter,
120
+ * bodyParam?: FunctionParameter
121
+ * ) {
122
+ * const parameters = [pathParams, bodyParam]
123
+ * .filter(p => p && p.toString())
124
+ * .map(p => p!.toString())
125
+ * .join(', ');
126
+ *
127
+ * const pathInbound = pathParams?.toInbound() || '';
128
+ * const bodyInbound = bodyParam?.toInbound() || '';
129
+ *
130
+ * return `
131
+ * async ${methodName}(${parameters}) {
132
+ * const path = this.buildPath(${pathInbound});
133
+ * return this.request('POST', path, ${bodyInbound});
134
+ * }`;
135
+ * }
136
+ * }
137
+ * ```
138
+ *
139
+ * @example Empty property filtering
140
+ * ```typescript
141
+ * const filteredParam = new FunctionParameter({
142
+ * typeDefinition: sparseObjectDefinition,
143
+ * destructure: true,
144
+ * required: true,
145
+ * skipEmpty: true // Skip properties with empty types
146
+ * });
147
+ *
148
+ * // Only non-empty properties will be included in destructuring
149
+ * console.log(filteredParam.toString());
150
+ * // '{ validProp1, validProp2 }: FilteredType' (empty props omitted)
151
+ * ```
152
+ */
6
153
  export class FunctionParameter {
154
+ /**
155
+ * Creates a new FunctionParameter instance with the specified configuration.
156
+ *
157
+ * The constructor analyzes the provided type definition and configuration options
158
+ * to determine the appropriate parameter pattern (void, regular, or destructured).
159
+ * It handles the complex logic of parameter type determination and validation.
160
+ *
161
+ * @param args - Configuration options for the function parameter
162
+ *
163
+ * @throws {Error} When the parameter configuration is invalid
164
+ *
165
+ * @example
166
+ * ```typescript
167
+ * const param = new FunctionParameter({
168
+ * name: 'userData',
169
+ * typeDefinition: userTypeDefinition,
170
+ * required: true
171
+ * });
172
+ * ```
173
+ */
7
174
  constructor(args) {
175
+ /** The internal parameter configuration determining how the parameter is generated */
8
176
  Object.defineProperty(this, "properties", {
9
177
  enumerable: true,
10
178
  configurable: true,
11
179
  writable: true,
12
180
  value: void 0
13
181
  });
182
+ /** Whether to skip empty properties in destructured parameters */
14
183
  Object.defineProperty(this, "skipEmpty", {
15
184
  enumerable: true,
16
185
  configurable: true,
@@ -39,6 +208,34 @@ export class FunctionParameter {
39
208
  this.properties = { type: 'void' };
40
209
  }
41
210
  }
211
+ /**
212
+ * Checks if the parameter has a specific property (for object-based parameters).
213
+ *
214
+ * This method determines whether a given property name exists within the parameter's
215
+ * type structure. It's useful for conditional code generation based on available
216
+ * properties and only returns true for object-based parameters (regular object
217
+ * parameters or destructured parameters).
218
+ *
219
+ * @param name - The property name to check for
220
+ * @returns True if the property exists in the parameter's type structure
221
+ *
222
+ * @example
223
+ * ```typescript
224
+ * const userParam = new FunctionParameter({
225
+ * typeDefinition: userTypeDefinition, // has properties: name, email, age
226
+ * destructure: true,
227
+ * required: true
228
+ * });
229
+ *
230
+ * if (userParam.hasProperty('email')) {
231
+ * console.log('Parameter includes email property');
232
+ * }
233
+ *
234
+ * if (userParam.hasProperty('nonexistent')) {
235
+ * // This won't execute
236
+ * }
237
+ * ```
238
+ */
42
239
  hasProperty(name) {
43
240
  return match(this.properties)
44
241
  .with({ type: 'void' }, () => false)
@@ -51,6 +248,37 @@ export class FunctionParameter {
51
248
  })
52
249
  .exhaustive();
53
250
  }
251
+ /**
252
+ * Generates a List of property names from the parameter.
253
+ *
254
+ * This method extracts property names from object-based parameters and returns
255
+ * them as a List instance. For regular parameters, it returns the parameter name,
256
+ * for destructured parameters it returns all object properties, and for void
257
+ * parameters it returns an empty list.
258
+ *
259
+ * @returns List containing the relevant property or parameter names
260
+ *
261
+ * @example
262
+ * ```typescript
263
+ * const destructuredParam = new FunctionParameter({
264
+ * typeDefinition: userTypeDefinition, // has properties: name, email, age
265
+ * destructure: true,
266
+ * required: true
267
+ * });
268
+ *
269
+ * const propertyList = destructuredParam.toPropertyList();
270
+ * console.log(propertyList.toString()); // 'name, email, age'
271
+ *
272
+ * const regularParam = new FunctionParameter({
273
+ * name: 'userData',
274
+ * typeDefinition: userTypeDefinition,
275
+ * required: true
276
+ * });
277
+ *
278
+ * const regularList = regularParam.toPropertyList();
279
+ * console.log(regularList.toString()); // 'userData'
280
+ * ```
281
+ */
54
282
  toPropertyList() {
55
283
  return match(this.properties)
56
284
  .with({ type: 'void' }, () => List.toEmpty())
@@ -60,6 +288,35 @@ export class FunctionParameter {
60
288
  })
61
289
  .exhaustive();
62
290
  }
291
+ /**
292
+ * Generates the inbound parameter syntax for function calls.
293
+ *
294
+ * This method produces the syntax used when calling a function with this parameter.
295
+ * For regular parameters, it returns the parameter name. For destructured parameters,
296
+ * it returns the destructured object syntax. For void parameters, it returns an
297
+ * empty string.
298
+ *
299
+ * @returns The inbound parameter syntax string
300
+ *
301
+ * @example
302
+ * ```typescript
303
+ * const regularParam = new FunctionParameter({
304
+ * name: 'userId',
305
+ * typeDefinition: stringTypeDefinition,
306
+ * required: true
307
+ * });
308
+ *
309
+ * console.log(regularParam.toInbound()); // 'userId'
310
+ *
311
+ * const destructuredParam = new FunctionParameter({
312
+ * typeDefinition: userTypeDefinition,
313
+ * destructure: true,
314
+ * required: true
315
+ * });
316
+ *
317
+ * console.log(destructuredParam.toInbound()); // '{ name, email, age }'
318
+ * ```
319
+ */
63
320
  toInbound() {
64
321
  return match(this.properties)
65
322
  .with({ type: 'void' }, () => '')
@@ -69,6 +326,42 @@ export class FunctionParameter {
69
326
  })
70
327
  .exhaustive();
71
328
  }
329
+ /**
330
+ * Generates the complete function parameter declaration syntax.
331
+ *
332
+ * This method produces the full parameter declaration that appears in a function
333
+ * signature, including the parameter name, type annotation, and optional markers.
334
+ * It handles all parameter patterns supported by the class.
335
+ *
336
+ * @returns The complete parameter declaration string
337
+ *
338
+ * @example
339
+ * ```typescript
340
+ * const requiredParam = new FunctionParameter({
341
+ * name: 'userId',
342
+ * typeDefinition: stringTypeDefinition,
343
+ * required: true
344
+ * });
345
+ *
346
+ * console.log(requiredParam.toString()); // 'userId: string'
347
+ *
348
+ * const optionalParam = new FunctionParameter({
349
+ * name: 'options',
350
+ * typeDefinition: optionsTypeDefinition,
351
+ * required: false
352
+ * });
353
+ *
354
+ * console.log(optionalParam.toString()); // 'options?: OptionsType'
355
+ *
356
+ * const destructuredParam = new FunctionParameter({
357
+ * typeDefinition: userTypeDefinition,
358
+ * destructure: true,
359
+ * required: true
360
+ * });
361
+ *
362
+ * console.log(destructuredParam.toString()); // '{ name, email, age }: UserType'
363
+ * ```
364
+ */
72
365
  toString() {
73
366
  return match(this.properties)
74
367
  .with({ type: 'void' }, () => '')
@@ -86,6 +379,41 @@ export class FunctionParameter {
86
379
  .exhaustive();
87
380
  }
88
381
  }
382
+ /**
383
+ * Generates destructured object parameter syntax from a type definition.
384
+ *
385
+ * This helper function creates the destructured parameter syntax for object types,
386
+ * handling property name validation and optional camelCase conversion for invalid
387
+ * JavaScript identifiers. It integrates with the List system to produce properly
388
+ * formatted destructured parameter lists.
389
+ *
390
+ * @param typeDefinition - The object type definition to destructure
391
+ * @param options - Options for controlling the destructuring behavior
392
+ * @param options.skipEmpty - Whether to skip empty properties
393
+ * @returns List instance representing the destructured parameter structure
394
+ *
395
+ * @example
396
+ * ```typescript
397
+ * const objectDef = new Definition({
398
+ * context: generateContext,
399
+ * identifier: Identifier.createType('ApiParams'),
400
+ * value: {
401
+ * type: 'object',
402
+ * objectProperties: {
403
+ * properties: {
404
+ * 'user-id': { type: 'string' },
405
+ * 'valid_name': { type: 'string' },
406
+ * 'api-key': { type: 'string' }
407
+ * }
408
+ * }
409
+ * }
410
+ * });
411
+ *
412
+ * const result = toDestructured(objectDef);
413
+ * console.log(result.toString());
414
+ * // "{ 'user-id': userId, valid_name, 'api-key': apiKey }"
415
+ * ```
416
+ */
89
417
  const toDestructured = (typeDefinition, { skipEmpty } = {}) => {
90
418
  return List.fromKeys(typeDefinition.value.objectProperties?.properties).toObject(key => {
91
419
  return isIdentifierName(key) ? key : List.toKeyValue(key, camelCase(key));
@@ -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,E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