@skmtc/core 0.0.798 → 0.0.800
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.
- package/esm/context/GenerateContext.d.ts +26 -1
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +26 -1
- package/esm/context/ParseContext.d.ts +64 -3
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +61 -0
- package/esm/context/ResultsHandler.d.ts +10 -3
- package/esm/context/ResultsHandler.d.ts.map +1 -1
- package/esm/dsl/model/types.d.ts +51 -4
- package/esm/dsl/model/types.d.ts.map +1 -1
- package/esm/dsl/operation/types.d.ts +61 -3
- package/esm/dsl/operation/types.d.ts.map +1 -1
- package/esm/oas/array/array-types.d.ts +23 -0
- package/esm/oas/array/array-types.d.ts.map +1 -1
- package/esm/oas/array/array-types.js +7 -0
- package/esm/oas/boolean/boolean-types.d.ts +25 -1
- package/esm/oas/boolean/boolean-types.d.ts.map +1 -1
- package/esm/oas/boolean/boolean-types.js +6 -0
- package/esm/oas/discriminator/discriminator-types.d.ts +17 -0
- package/esm/oas/discriminator/discriminator-types.d.ts.map +1 -1
- package/esm/oas/discriminator/discriminator-types.js +7 -0
- package/esm/oas/integer/integer-types.d.ts +18 -0
- package/esm/oas/integer/integer-types.d.ts.map +1 -1
- package/esm/oas/integer/integer-types.js +18 -0
- package/esm/oas/mediaType/mediaType-types.d.ts +17 -0
- package/esm/oas/mediaType/mediaType-types.d.ts.map +1 -1
- package/esm/oas/mediaType/mediaType-types.js +6 -0
- package/esm/oas/number/number-types.d.ts +12 -0
- package/esm/oas/number/number-types.d.ts.map +1 -1
- package/esm/oas/number/number-types.js +12 -0
- package/esm/oas/operation/Operation.d.ts +47 -2
- package/esm/oas/operation/Operation.d.ts.map +1 -1
- package/esm/oas/operation/Operation.js +43 -0
- package/esm/oas/ref/Ref.d.ts +49 -2
- package/esm/oas/ref/Ref.d.ts.map +1 -1
- package/esm/oas/ref/Ref.js +28 -0
- package/esm/oas/serverVariable/ServerVariable.d.ts +34 -0
- package/esm/oas/serverVariable/ServerVariable.d.ts.map +1 -1
- package/esm/oas/serverVariable/ServerVariable.js +24 -0
- package/esm/oas/string/string-types.d.ts +38 -1
- package/esm/oas/string/string-types.d.ts.map +1 -1
- package/esm/oas/string/string-types.js +12 -0
- package/esm/oas/union/union-types.d.ts +20 -0
- package/esm/oas/union/union-types.d.ts.map +1 -1
- package/esm/oas/union/union-types.js +7 -0
- package/esm/oas/unknown/unknown-types.d.ts +18 -0
- package/esm/oas/unknown/unknown-types.d.ts.map +1 -1
- package/esm/oas/unknown/unknown-types.js +6 -0
- package/esm/typescript/List.d.ts +64 -3
- package/esm/typescript/List.d.ts.map +1 -1
- package/esm/typescript/List.js +43 -0
- package/package.json +1 -1
- package/script/context/GenerateContext.d.ts +26 -1
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +26 -1
- package/script/context/ParseContext.d.ts +64 -3
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +61 -0
- package/script/context/ResultsHandler.d.ts +10 -3
- package/script/context/ResultsHandler.d.ts.map +1 -1
- package/script/dsl/model/types.d.ts +51 -4
- package/script/dsl/model/types.d.ts.map +1 -1
- package/script/dsl/operation/types.d.ts +61 -3
- package/script/dsl/operation/types.d.ts.map +1 -1
- package/script/oas/array/array-types.d.ts +23 -0
- package/script/oas/array/array-types.d.ts.map +1 -1
- package/script/oas/array/array-types.js +7 -0
- package/script/oas/boolean/boolean-types.d.ts +25 -1
- package/script/oas/boolean/boolean-types.d.ts.map +1 -1
- package/script/oas/boolean/boolean-types.js +6 -0
- package/script/oas/discriminator/discriminator-types.d.ts +17 -0
- package/script/oas/discriminator/discriminator-types.d.ts.map +1 -1
- package/script/oas/discriminator/discriminator-types.js +7 -0
- package/script/oas/integer/integer-types.d.ts +18 -0
- package/script/oas/integer/integer-types.d.ts.map +1 -1
- package/script/oas/integer/integer-types.js +18 -0
- package/script/oas/mediaType/mediaType-types.d.ts +17 -0
- package/script/oas/mediaType/mediaType-types.d.ts.map +1 -1
- package/script/oas/mediaType/mediaType-types.js +6 -0
- package/script/oas/number/number-types.d.ts +12 -0
- package/script/oas/number/number-types.d.ts.map +1 -1
- package/script/oas/number/number-types.js +12 -0
- package/script/oas/operation/Operation.d.ts +47 -2
- package/script/oas/operation/Operation.d.ts.map +1 -1
- package/script/oas/operation/Operation.js +43 -0
- package/script/oas/ref/Ref.d.ts +49 -2
- package/script/oas/ref/Ref.d.ts.map +1 -1
- package/script/oas/ref/Ref.js +28 -0
- package/script/oas/serverVariable/ServerVariable.d.ts +34 -0
- package/script/oas/serverVariable/ServerVariable.d.ts.map +1 -1
- package/script/oas/serverVariable/ServerVariable.js +24 -0
- package/script/oas/string/string-types.d.ts +38 -1
- package/script/oas/string/string-types.d.ts.map +1 -1
- package/script/oas/string/string-types.js +12 -0
- package/script/oas/union/union-types.d.ts +20 -0
- package/script/oas/union/union-types.d.ts.map +1 -1
- package/script/oas/union/union-types.js +7 -0
- package/script/oas/unknown/unknown-types.d.ts +18 -0
- package/script/oas/unknown/unknown-types.d.ts.map +1 -1
- package/script/oas/unknown/unknown-types.js +6 -0
- package/script/typescript/List.d.ts +64 -3
- package/script/typescript/List.d.ts.map +1 -1
- package/script/typescript/List.js +43 -0
|
@@ -139,6 +139,14 @@ class List {
|
|
|
139
139
|
this.bookends = bookends ?? 'none';
|
|
140
140
|
this.skipEmpty = skipEmpty ?? false;
|
|
141
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Converts the list to its string representation.
|
|
144
|
+
*
|
|
145
|
+
* Joins all values with the configured separator and wraps with bookends.
|
|
146
|
+
* Returns empty string if skipEmpty is enabled and list is empty.
|
|
147
|
+
*
|
|
148
|
+
* @returns Formatted string representation of the list
|
|
149
|
+
*/
|
|
142
150
|
toString() {
|
|
143
151
|
if (this.skipEmpty && this.values.length === 0) {
|
|
144
152
|
return '';
|
|
@@ -381,8 +389,20 @@ Object.defineProperty(List, "hasValue", {
|
|
|
381
389
|
return true;
|
|
382
390
|
}
|
|
383
391
|
});
|
|
392
|
+
/**
|
|
393
|
+
* Utility class for working with arrays of string keys.
|
|
394
|
+
*
|
|
395
|
+
* Provides methods for transforming key arrays into objects and lists
|
|
396
|
+
* with custom mapping functions.
|
|
397
|
+
*/
|
|
384
398
|
class KeyList {
|
|
399
|
+
/**
|
|
400
|
+
* Creates a new KeyList instance.
|
|
401
|
+
*
|
|
402
|
+
* @param keys - Array of string keys to work with
|
|
403
|
+
*/
|
|
385
404
|
constructor(keys) {
|
|
405
|
+
/** Array of string keys */
|
|
386
406
|
Object.defineProperty(this, "keys", {
|
|
387
407
|
enumerable: true,
|
|
388
408
|
configurable: true,
|
|
@@ -391,15 +411,38 @@ class KeyList {
|
|
|
391
411
|
});
|
|
392
412
|
this.keys = keys;
|
|
393
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* Transforms keys into an object using a mapping function.
|
|
416
|
+
*
|
|
417
|
+
* @param mapFn - Function to transform each key into a value
|
|
418
|
+
* @param options - Options for handling empty values
|
|
419
|
+
* @returns Object with keys mapped to transformed values
|
|
420
|
+
*/
|
|
394
421
|
toObject(mapFn, { skipEmpty } = {}) {
|
|
395
422
|
return List.toObject(this.keys.map((key, index) => mapFn(key, index)), { skipEmpty });
|
|
396
423
|
}
|
|
424
|
+
/**
|
|
425
|
+
* Creates a plain object with keys as both keys and values.
|
|
426
|
+
*
|
|
427
|
+
* @returns Object where each key maps to itself
|
|
428
|
+
*/
|
|
397
429
|
toObjectPlain() {
|
|
398
430
|
return List.toObject(this.keys);
|
|
399
431
|
}
|
|
432
|
+
/**
|
|
433
|
+
* Transforms keys into a List using a mapping function.
|
|
434
|
+
*
|
|
435
|
+
* @param mapFn - Function to transform each key into a value
|
|
436
|
+
* @returns List containing the transformed values
|
|
437
|
+
*/
|
|
400
438
|
toLines(mapFn) {
|
|
401
439
|
return List.toLines(this.keys.map((key, index) => mapFn(key, index)));
|
|
402
440
|
}
|
|
441
|
+
/**
|
|
442
|
+
* Creates a List with keys as the values.
|
|
443
|
+
*
|
|
444
|
+
* @returns List containing the original keys
|
|
445
|
+
*/
|
|
403
446
|
toLinesPlain() {
|
|
404
447
|
return List.toLines(this.keys);
|
|
405
448
|
}
|