@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
@@ -1,2 +1,116 @@
1
+ /**
2
+ * Converts OpenAPI path parameters into JavaScript template literal syntax.
3
+ *
4
+ * This utility function transforms OpenAPI path syntax (using curly braces) into
5
+ * JavaScript template literal syntax (using ${} expressions). It's essential for
6
+ * generating URL builders, API client methods, and other dynamic path construction
7
+ * code where OpenAPI path parameters need to be interpolated at runtime.
8
+ *
9
+ * The function supports both simple parameter substitution and qualified parameter
10
+ * access (when parameters come from an object property).
11
+ *
12
+ * @param path - OpenAPI path string with {parameter} syntax
13
+ * @param queryArg - Optional object name to qualify parameter access
14
+ * @returns Template literal string with ${} parameter syntax
15
+ *
16
+ * @example Basic path parameter conversion
17
+ * ```typescript
18
+ * import { toPathTemplate } from '@skmtc/core';
19
+ *
20
+ * const template = toPathTemplate('/users/{id}/posts/{postId}');
21
+ * console.log(template); // '/users/${id}/posts/${postId}'
22
+ *
23
+ * // Usage in generated code:
24
+ * // const url = `/users/${id}/posts/${postId}`;
25
+ * ```
26
+ *
27
+ * @example With query argument qualification
28
+ * ```typescript
29
+ * const template = toPathTemplate('/users/{id}/posts/{postId}', 'params');
30
+ * console.log(template); // '/users/${params.id}/posts/${params.postId}'
31
+ *
32
+ * // Usage in generated code:
33
+ * // function buildUrl(params: {id: string, postId: string}) {
34
+ * // return `/users/${params.id}/posts/${params.postId}`;
35
+ * // }
36
+ * ```
37
+ *
38
+ * @example API client method generation
39
+ * ```typescript
40
+ * class ApiClientGenerator {
41
+ * generateMethod(path: string, method: string) {
42
+ * const template = toPathTemplate(path, 'args');
43
+ *
44
+ * return `
45
+ * async ${method}(args: PathParams) {
46
+ * const url = \`${template}\`;
47
+ * return this.request('${method.toUpperCase()}', url);
48
+ * }`;
49
+ * }
50
+ * }
51
+ *
52
+ * const generator = new ApiClientGenerator();
53
+ * const method = generator.generateMethod('/users/{userId}/profile', 'getProfile');
54
+ *
55
+ * console.log(method);
56
+ * // async getProfile(args: PathParams) {
57
+ * // const url = `/users/${args.userId}/profile`;
58
+ * // return this.request('GET', url);
59
+ * // }
60
+ * ```
61
+ *
62
+ * @example URL builder generation
63
+ * ```typescript
64
+ * function generateUrlBuilder(endpoints: Array<{name: string, path: string}>) {
65
+ * const builders = endpoints.map(endpoint => {
66
+ * const template = toPathTemplate(endpoint.path);
67
+ *
68
+ * return `${endpoint.name}: (${extractParams(endpoint.path)}) => \`${template}\``;
69
+ * });
70
+ *
71
+ * return `export const urls = {\n ${builders.join(',\n ')}\n};`;
72
+ * }
73
+ *
74
+ * const urlBuilder = generateUrlBuilder([
75
+ * { name: 'user', path: '/users/{id}' },
76
+ * { name: 'userPosts', path: '/users/{id}/posts/{postId}' }
77
+ * ]);
78
+ *
79
+ * // Generates:
80
+ * // export const urls = {
81
+ * // user: (id) => `/users/${id}`,
82
+ * // userPosts: (id, postId) => `/users/${id}/posts/${postId}`
83
+ * // };
84
+ * ```
85
+ *
86
+ * @example React Router integration
87
+ * ```typescript
88
+ * function generateRouteComponent(path: string, componentName: string) {
89
+ * const template = toPathTemplate(path, 'params');
90
+ *
91
+ * return `
92
+ * function ${componentName}() {
93
+ * const params = useParams();
94
+ * const apiUrl = \`/api${template}\`;
95
+ *
96
+ * // Use apiUrl for data fetching
97
+ * return <div>Content for {apiUrl}</div>;
98
+ * }`;
99
+ * }
100
+ * ```
101
+ *
102
+ * @example Complex nested parameters
103
+ * ```typescript
104
+ * const complexPath = '/organizations/{orgId}/projects/{projectId}/issues/{issueId}/comments/{commentId}';
105
+ *
106
+ * const simple = toPathTemplate(complexPath);
107
+ * console.log(simple);
108
+ * // '/organizations/${orgId}/projects/${projectId}/issues/${issueId}/comments/${commentId}'
109
+ *
110
+ * const qualified = toPathTemplate(complexPath, 'pathParams');
111
+ * console.log(qualified);
112
+ * // '/organizations/${pathParams.orgId}/projects/${pathParams.projectId}/issues/${pathParams.issueId}/comments/${pathParams.commentId}'
113
+ * ```
114
+ */
1
115
  export declare const toPathTemplate: (path: string, queryArg?: string) => string;
2
116
  //# sourceMappingURL=toPathTemplate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toPathTemplate.d.ts","sourceRoot":"","sources":["../../src/typescript/toPathTemplate.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,KAAG,MAKhE,CAAA"}
1
+ {"version":3,"file":"toPathTemplate.d.ts","sourceRoot":"","sources":["../../src/typescript/toPathTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiHG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,KAAG,MAKhE,CAAA"}
@@ -1,3 +1,117 @@
1
+ /**
2
+ * Converts OpenAPI path parameters into JavaScript template literal syntax.
3
+ *
4
+ * This utility function transforms OpenAPI path syntax (using curly braces) into
5
+ * JavaScript template literal syntax (using ${} expressions). It's essential for
6
+ * generating URL builders, API client methods, and other dynamic path construction
7
+ * code where OpenAPI path parameters need to be interpolated at runtime.
8
+ *
9
+ * The function supports both simple parameter substitution and qualified parameter
10
+ * access (when parameters come from an object property).
11
+ *
12
+ * @param path - OpenAPI path string with {parameter} syntax
13
+ * @param queryArg - Optional object name to qualify parameter access
14
+ * @returns Template literal string with ${} parameter syntax
15
+ *
16
+ * @example Basic path parameter conversion
17
+ * ```typescript
18
+ * import { toPathTemplate } from '@skmtc/core';
19
+ *
20
+ * const template = toPathTemplate('/users/{id}/posts/{postId}');
21
+ * console.log(template); // '/users/${id}/posts/${postId}'
22
+ *
23
+ * // Usage in generated code:
24
+ * // const url = `/users/${id}/posts/${postId}`;
25
+ * ```
26
+ *
27
+ * @example With query argument qualification
28
+ * ```typescript
29
+ * const template = toPathTemplate('/users/{id}/posts/{postId}', 'params');
30
+ * console.log(template); // '/users/${params.id}/posts/${params.postId}'
31
+ *
32
+ * // Usage in generated code:
33
+ * // function buildUrl(params: {id: string, postId: string}) {
34
+ * // return `/users/${params.id}/posts/${params.postId}`;
35
+ * // }
36
+ * ```
37
+ *
38
+ * @example API client method generation
39
+ * ```typescript
40
+ * class ApiClientGenerator {
41
+ * generateMethod(path: string, method: string) {
42
+ * const template = toPathTemplate(path, 'args');
43
+ *
44
+ * return `
45
+ * async ${method}(args: PathParams) {
46
+ * const url = \`${template}\`;
47
+ * return this.request('${method.toUpperCase()}', url);
48
+ * }`;
49
+ * }
50
+ * }
51
+ *
52
+ * const generator = new ApiClientGenerator();
53
+ * const method = generator.generateMethod('/users/{userId}/profile', 'getProfile');
54
+ *
55
+ * console.log(method);
56
+ * // async getProfile(args: PathParams) {
57
+ * // const url = `/users/${args.userId}/profile`;
58
+ * // return this.request('GET', url);
59
+ * // }
60
+ * ```
61
+ *
62
+ * @example URL builder generation
63
+ * ```typescript
64
+ * function generateUrlBuilder(endpoints: Array<{name: string, path: string}>) {
65
+ * const builders = endpoints.map(endpoint => {
66
+ * const template = toPathTemplate(endpoint.path);
67
+ *
68
+ * return `${endpoint.name}: (${extractParams(endpoint.path)}) => \`${template}\``;
69
+ * });
70
+ *
71
+ * return `export const urls = {\n ${builders.join(',\n ')}\n};`;
72
+ * }
73
+ *
74
+ * const urlBuilder = generateUrlBuilder([
75
+ * { name: 'user', path: '/users/{id}' },
76
+ * { name: 'userPosts', path: '/users/{id}/posts/{postId}' }
77
+ * ]);
78
+ *
79
+ * // Generates:
80
+ * // export const urls = {
81
+ * // user: (id) => `/users/${id}`,
82
+ * // userPosts: (id, postId) => `/users/${id}/posts/${postId}`
83
+ * // };
84
+ * ```
85
+ *
86
+ * @example React Router integration
87
+ * ```typescript
88
+ * function generateRouteComponent(path: string, componentName: string) {
89
+ * const template = toPathTemplate(path, 'params');
90
+ *
91
+ * return `
92
+ * function ${componentName}() {
93
+ * const params = useParams();
94
+ * const apiUrl = \`/api${template}\`;
95
+ *
96
+ * // Use apiUrl for data fetching
97
+ * return <div>Content for {apiUrl}</div>;
98
+ * }`;
99
+ * }
100
+ * ```
101
+ *
102
+ * @example Complex nested parameters
103
+ * ```typescript
104
+ * const complexPath = '/organizations/{orgId}/projects/{projectId}/issues/{issueId}/comments/{commentId}';
105
+ *
106
+ * const simple = toPathTemplate(complexPath);
107
+ * console.log(simple);
108
+ * // '/organizations/${orgId}/projects/${projectId}/issues/${issueId}/comments/${commentId}'
109
+ *
110
+ * const qualified = toPathTemplate(complexPath, 'pathParams');
111
+ * console.log(qualified);
112
+ * // '/organizations/${pathParams.orgId}/projects/${pathParams.projectId}/issues/${pathParams.issueId}/comments/${pathParams.commentId}'
113
+ * ```
114
+ */
1
115
  export const toPathTemplate = (path, queryArg) => {
2
116
  return `${path.replaceAll(/{([^}]*)}/g, queryArg ? '${' + queryArg + '.$1}' : '${$1}')}`;
3
117
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.0.793",
3
+ "version": "0.0.795",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/skmtc/skmtc.git"
@@ -1,18 +1,311 @@
1
1
  import "../_dnt.polyfills.js";
2
+ /**
3
+ * Represents a stack-based trail for tracking document traversal in OpenAPI processing.
4
+ *
5
+ * The `StackTrail` class maintains a stack of string frames that represent the current
6
+ * path through an OpenAPI document structure. It's used throughout the SKMTC pipeline
7
+ * for tracking context during parsing, generating, and debugging schema processing.
8
+ *
9
+ * This class is essential for error reporting, debugging, and maintaining context
10
+ * when processing nested OpenAPI structures like schemas, operations, and components.
11
+ *
12
+ * ## Key Features
13
+ *
14
+ * - **Path Tracking**: Maintains a trail of traversed document elements
15
+ * - **Context Preservation**: Preserves parsing context for error reporting
16
+ * - **Stack Operations**: Supports push, pop, clone, and manipulation operations
17
+ * - **Reference Resolution**: Can generate OpenAPI reference strings from trails
18
+ * - **Serialization**: Supports string serialization and parsing for persistence
19
+ *
20
+ * @example Basic usage
21
+ * ```typescript
22
+ * import { StackTrail } from '@skmtc/core';
23
+ *
24
+ * // Start with empty trail
25
+ * const trail = new StackTrail();
26
+ *
27
+ * // Build a path through document structure
28
+ * trail.append('components')
29
+ * .append('schemas')
30
+ * .append('User')
31
+ * .append('properties')
32
+ * .append('name');
33
+ *
34
+ * console.log(trail.toString()); // 'components:schemas:User:properties:name'
35
+ * ```
36
+ *
37
+ * @example Schema reference generation
38
+ * ```typescript
39
+ * const schemaTrail = new StackTrail(['components', 'schemas', 'User']);
40
+ * const ref = schemaTrail.toStackRef();
41
+ * console.log(ref); // '#/components/schemas/User'
42
+ * ```
43
+ *
44
+ * @example Error context tracking
45
+ * ```typescript
46
+ * class SchemaProcessor {
47
+ * processSchema(schema: OasSchema, trail: StackTrail) {
48
+ * try {
49
+ * // Process schema logic
50
+ * return this.transformSchema(schema);
51
+ * } catch (error) {
52
+ * throw new Error(`Error at ${trail.toString()}: ${error.message}`);
53
+ * // Error at components:schemas:User:properties:email: Invalid format
54
+ * }
55
+ * }
56
+ * }
57
+ * ```
58
+ *
59
+ * @example Cloning and manipulation
60
+ * ```typescript
61
+ * const baseTrail = new StackTrail(['components', 'schemas']);
62
+ *
63
+ * // Clone for processing different schemas
64
+ * const userTrail = baseTrail.clone().append('User');
65
+ * const productTrail = baseTrail.clone().append('Product');
66
+ *
67
+ * console.log(userTrail.toString()); // 'components:schemas:User'
68
+ * console.log(productTrail.toString()); // 'components:schemas:Product'
69
+ * console.log(baseTrail.toString()); // 'components:schemas' (unchanged)
70
+ * ```
71
+ */
2
72
  export declare class StackTrail {
3
73
  #private;
74
+ /**
75
+ * Creates a new StackTrail instance.
76
+ *
77
+ * @param stack - Initial stack frames (defaults to empty array)
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * // Empty trail
82
+ * const trail1 = new StackTrail();
83
+ *
84
+ * // Pre-populated trail
85
+ * const trail2 = new StackTrail(['components', 'schemas', 'User']);
86
+ * ```
87
+ */
4
88
  constructor(stack?: string[]);
89
+ /**
90
+ * Creates a shallow copy of the stack trail.
91
+ *
92
+ * @returns A new StackTrail instance with copied frames
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * const original = new StackTrail(['components', 'schemas']);
97
+ * const copy = original.clone();
98
+ *
99
+ * copy.append('User');
100
+ * console.log(original.toString()); // 'components:schemas'
101
+ * console.log(copy.toString()); // 'components:schemas:User'
102
+ * ```
103
+ */
5
104
  clone(): StackTrail;
105
+ /**
106
+ * Creates a new trail from a slice of the current trail.
107
+ *
108
+ * @param start - Starting index (inclusive)
109
+ * @param end - Ending index (exclusive, optional)
110
+ * @returns A new StackTrail with sliced frames
111
+ *
112
+ * @example
113
+ * ```typescript
114
+ * const trail = new StackTrail(['a', 'b', 'c', 'd', 'e']);
115
+ *
116
+ * const slice1 = trail.slice(1, 3);
117
+ * console.log(slice1.toString()); // 'b:c'
118
+ *
119
+ * const slice2 = trail.slice(2);
120
+ * console.log(slice2.toString()); // 'c:d:e'
121
+ * ```
122
+ */
6
123
  slice(start: number, end?: number): StackTrail;
124
+ /**
125
+ * Checks if all specified frames exist in the trail.
126
+ *
127
+ * @param frames - Array of frames to check for
128
+ * @returns True if all frames are present in the trail
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * const trail = new StackTrail(['components', 'schemas', 'User', 'properties']);
133
+ *
134
+ * console.log(trail.includes(['schemas', 'User'])); // true
135
+ * console.log(trail.includes(['schemas', 'Product'])); // false
136
+ * console.log(trail.includes(['components'])); // true
137
+ * ```
138
+ */
7
139
  includes(frames: string[]): boolean;
140
+ /**
141
+ * Gets a copy of the current stack frames.
142
+ *
143
+ * @returns Array of stack frames in order
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * const trail = new StackTrail(['components', 'schemas', 'User']);
148
+ * const frames = trail.stackTrail;
149
+ * console.log(frames); // ['components', 'schemas', 'User']
150
+ * ```
151
+ */
8
152
  get stackTrail(): string[];
153
+ /**
154
+ * Appends frame(s) to the end of the trail.
155
+ *
156
+ * @param frame - Single frame string or array of frames to append
157
+ * @returns This StackTrail instance for chaining
158
+ *
159
+ * @throws {Error} When frame is not a string or string array
160
+ *
161
+ * @example Single frame
162
+ * ```typescript
163
+ * const trail = new StackTrail(['components']);
164
+ * trail.append('schemas').append('User');
165
+ * console.log(trail.toString()); // 'components:schemas:User'
166
+ * ```
167
+ *
168
+ * @example Multiple frames
169
+ * ```typescript
170
+ * const trail = new StackTrail();
171
+ * trail.append(['components', 'schemas', 'User']);
172
+ * console.log(trail.toString()); // 'components:schemas:User'
173
+ * ```
174
+ */
9
175
  append(frame: string | string[]): StackTrail;
176
+ /**
177
+ * Gets the parent name of a property frame.
178
+ *
179
+ * This method is specifically designed to find parent object names
180
+ * for property trails in schema processing.
181
+ *
182
+ * @param frame - The frame name to find the parent of
183
+ * @returns Parent name if found, undefined otherwise
184
+ *
185
+ * @example
186
+ * ```typescript
187
+ * const trail = new StackTrail(['components', 'schemas', 'User', 'properties', 'email']);
188
+ * const parent = trail.getParentOf('email');
189
+ * console.log(parent); // 'User'
190
+ * ```
191
+ */
10
192
  getParentOf(frame: string): string | undefined;
193
+ /**
194
+ * Converts the trail to an OpenAPI reference string if applicable.
195
+ *
196
+ * Only trails that represent valid OpenAPI component references
197
+ * (starting with 'components') can be converted to reference strings.
198
+ *
199
+ * @returns OpenAPI reference string or undefined if not a valid reference trail
200
+ *
201
+ * @example Valid reference trail
202
+ * ```typescript
203
+ * const trail = new StackTrail(['components', 'schemas', 'User']);
204
+ * const ref = trail.toStackRef();
205
+ * console.log(ref); // '#/components/schemas/User'
206
+ * ```
207
+ *
208
+ * @example Invalid trail
209
+ * ```typescript
210
+ * const trail = new StackTrail(['paths', '/users', 'get']);
211
+ * const ref = trail.toStackRef();
212
+ * console.log(ref); // undefined
213
+ * ```
214
+ */
11
215
  toStackRef(): string | undefined;
216
+ /**
217
+ * Removes frame(s) from the end of the trail.
218
+ *
219
+ * @param frame - Single frame string or array of frames to remove
220
+ * @returns This StackTrail instance for chaining
221
+ *
222
+ * @throws {Error} When trying to remove a frame that doesn't match the last frame
223
+ * @throws {Error} When frame is not a string or string array
224
+ *
225
+ * @example Single frame removal
226
+ * ```typescript
227
+ * const trail = new StackTrail(['components', 'schemas', 'User', 'properties']);
228
+ * trail.remove('properties');
229
+ * console.log(trail.toString()); // 'components:schemas:User'
230
+ * ```
231
+ *
232
+ * @example Multiple frame removal
233
+ * ```typescript
234
+ * const trail = new StackTrail(['components', 'schemas', 'User', 'properties', 'name']);
235
+ * trail.remove(['name', 'properties']);
236
+ * console.log(trail.toString()); // 'components:schemas:User'
237
+ * ```
238
+ */
12
239
  remove(frame: string | string[]): StackTrail;
240
+ /**
241
+ * Joins multiple stacks or strings into a single colon-separated string.
242
+ *
243
+ * @param stacks - Array of StackTrail instances or strings to join
244
+ * @returns Joined string with colon separators
245
+ *
246
+ * @example
247
+ * ```typescript
248
+ * const trail1 = new StackTrail(['components', 'schemas']);
249
+ * const trail2 = new StackTrail(['User', 'properties']);
250
+ *
251
+ * const joined = StackTrail.join(trail1, 'separator', trail2);
252
+ * console.log(joined); // 'components:schemas:separator:User:properties'
253
+ * ```
254
+ */
13
255
  static join(...stacks: (StackTrail | string)[]): string;
256
+ /**
257
+ * Parses a colon-separated string into a StackTrail instance.
258
+ *
259
+ * @param value - Colon-separated string to parse
260
+ * @returns New StackTrail instance
261
+ *
262
+ * @throws {Error} When the string contains empty tokens
263
+ *
264
+ * @example
265
+ * ```typescript
266
+ * const trail = StackTrail.parse('components:schemas:User:properties:name');
267
+ * console.log(trail.stackTrail); // ['components', 'schemas', 'User', 'properties', 'name']
268
+ *
269
+ * // Handles escaped colons
270
+ * const escapedTrail = StackTrail.parse('components:schemas:User%3AType');
271
+ * console.log(escapedTrail.stackTrail); // ['components', 'schemas', 'User:Type']
272
+ * ```
273
+ */
14
274
  static parse(value: string): StackTrail;
275
+ /**
276
+ * Converts the trail to JSON representation.
277
+ *
278
+ * Used for serialization in JSON contexts. Returns the same
279
+ * as toString() method.
280
+ *
281
+ * @returns String representation of the trail
282
+ *
283
+ * @example
284
+ * ```typescript
285
+ * const trail = new StackTrail(['components', 'schemas', 'User']);
286
+ * const json = JSON.stringify({ path: trail });
287
+ * console.log(json); // '{"path":"components:schemas:User"}'
288
+ * ```
289
+ */
15
290
  toJSON(): string;
291
+ /**
292
+ * Converts the trail to a colon-separated string representation.
293
+ *
294
+ * Colons within frame names are escaped as '%3A' to avoid conflicts
295
+ * with the separator character.
296
+ *
297
+ * @returns String representation of the trail
298
+ *
299
+ * @example
300
+ * ```typescript
301
+ * const trail = new StackTrail(['components', 'schemas', 'User']);
302
+ * console.log(trail.toString()); // 'components:schemas:User'
303
+ *
304
+ * // With colon in frame name
305
+ * const trailWithColon = new StackTrail(['components', 'schemas', 'User:Type']);
306
+ * console.log(trailWithColon.toString()); // 'components:schemas:User%3AType'
307
+ * ```
308
+ */
16
309
  toString(): string;
17
310
  }
18
311
  //# sourceMappingURL=StackTrail.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StackTrail.d.ts","sourceRoot":"","sources":["../../src/context/StackTrail.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAG9B,qBAAa,UAAU;;gBAGT,KAAK,GAAE,MAAM,EAAO;IAIhC,KAAK,IAAI,UAAU;IAInB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,UAAU;IAI9C,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO;IAInC,IAAI,UAAU,IAAI,MAAM,EAAE,CAEzB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAgB5C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAW9C,UAAU,IAAI,MAAM,GAAG,SAAS;IAkBhC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAsB5C,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM;IAIvD,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAYvC,MAAM,IAAI,MAAM;IAIhB,QAAQ,IAAI,MAAM;CAOnB"}
1
+ {"version":3,"file":"StackTrail.d.ts","sourceRoot":"","sources":["../../src/context/StackTrail.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAG9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,qBAAa,UAAU;;IAIrB;;;;;;;;;;;;;OAaG;gBACS,KAAK,GAAE,MAAM,EAAO;IAIhC;;;;;;;;;;;;;;OAcG;IACH,KAAK,IAAI,UAAU;IAInB;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,UAAU;IAI9C;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO;IAInC;;;;;;;;;;;OAWG;IACH,IAAI,UAAU,IAAI,MAAM,EAAE,CAEzB;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAgB5C;;;;;;;;;;;;;;;OAeG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAW9C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,UAAU,IAAI,MAAM,GAAG,SAAS;IAkBhC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAsB5C;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM;IAIvD;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAYvC;;;;;;;;;;;;;;OAcG;IACH,MAAM,IAAI,MAAM;IAIhB;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,IAAI,MAAM;CAOnB"}