@skmtc/core 0.0.805 → 0.0.807
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/helpers/strings.d.ts +44 -0
- package/esm/helpers/strings.d.ts.map +1 -1
- package/esm/helpers/strings.js +44 -0
- package/esm/helpers/toResolvedArtifactPath.d.ts +64 -0
- package/esm/helpers/toResolvedArtifactPath.d.ts.map +1 -1
- package/esm/helpers/toResolvedArtifactPath.js +61 -0
- package/esm/run/toV3JsonDocument.d.ts +54 -0
- package/esm/run/toV3JsonDocument.d.ts.map +1 -1
- package/esm/run/toV3JsonDocument.js +54 -0
- package/esm/types/EnrichmentRequest.d.ts +62 -0
- package/esm/types/EnrichmentRequest.d.ts.map +1 -1
- package/esm/types/EnrichmentRequest.js +53 -0
- package/esm/types/Enrichments.d.ts +58 -0
- package/esm/types/Enrichments.d.ts.map +1 -1
- package/esm/types/Enrichments.js +58 -0
- package/esm/types/GeneratorKeys.d.ts +64 -0
- package/esm/types/GeneratorKeys.d.ts.map +1 -1
- package/esm/types/GeneratorKeys.js +64 -0
- package/esm/types/Manifest.d.ts +72 -0
- package/esm/types/Manifest.d.ts.map +1 -1
- package/esm/types/Manifest.js +72 -0
- package/esm/types/Method.d.ts +68 -0
- package/esm/types/Method.d.ts.map +1 -1
- package/esm/types/Method.js +68 -0
- package/esm/types/Preview.d.ts +75 -0
- package/esm/types/Preview.d.ts.map +1 -1
- package/esm/types/Preview.js +75 -0
- package/esm/types/RefName.d.ts +70 -0
- package/esm/types/RefName.d.ts.map +1 -1
- package/esm/types/RefName.js +70 -0
- package/esm/types/Settings.d.ts +50 -0
- package/esm/types/Settings.d.ts.map +1 -1
- package/esm/types/Settings.js +50 -0
- package/package.json +1 -1
- package/script/helpers/strings.d.ts +44 -0
- package/script/helpers/strings.d.ts.map +1 -1
- package/script/helpers/strings.js +44 -0
- package/script/helpers/toResolvedArtifactPath.d.ts +64 -0
- package/script/helpers/toResolvedArtifactPath.d.ts.map +1 -1
- package/script/helpers/toResolvedArtifactPath.js +61 -0
- package/script/run/toV3JsonDocument.d.ts +54 -0
- package/script/run/toV3JsonDocument.d.ts.map +1 -1
- package/script/run/toV3JsonDocument.js +54 -0
- package/script/types/EnrichmentRequest.d.ts +62 -0
- package/script/types/EnrichmentRequest.d.ts.map +1 -1
- package/script/types/EnrichmentRequest.js +53 -0
- package/script/types/Enrichments.d.ts +58 -0
- package/script/types/Enrichments.d.ts.map +1 -1
- package/script/types/Enrichments.js +58 -0
- package/script/types/GeneratorKeys.d.ts +64 -0
- package/script/types/GeneratorKeys.d.ts.map +1 -1
- package/script/types/GeneratorKeys.js +64 -0
- package/script/types/Manifest.d.ts +72 -0
- package/script/types/Manifest.d.ts.map +1 -1
- package/script/types/Manifest.js +72 -0
- package/script/types/Method.d.ts +68 -0
- package/script/types/Method.d.ts.map +1 -1
- package/script/types/Method.js +68 -0
- package/script/types/Preview.d.ts +75 -0
- package/script/types/Preview.d.ts.map +1 -1
- package/script/types/Preview.js +75 -0
- package/script/types/RefName.d.ts +70 -0
- package/script/types/RefName.d.ts.map +1 -1
- package/script/types/RefName.js +70 -0
- package/script/types/Settings.d.ts +50 -0
- package/script/types/Settings.d.ts.map +1 -1
- package/script/types/Settings.js +50 -0
package/esm/types/RefName.d.ts
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Reference Name System for SKMTC Core
|
|
3
|
+
*
|
|
4
|
+
* This module provides a type-safe reference name system for identifying
|
|
5
|
+
* OpenAPI schema components throughout the SKMTC pipeline. Reference names
|
|
6
|
+
* are branded types that ensure schema identifiers are handled safely and
|
|
7
|
+
* prevent accidental mixing with regular strings.
|
|
8
|
+
*
|
|
9
|
+
* The reference name system is crucial for maintaining type safety when
|
|
10
|
+
* working with OpenAPI component references, schema lookups, and cross-references
|
|
11
|
+
* between different parts of the generated code.
|
|
12
|
+
*
|
|
13
|
+
* ## Key Features
|
|
14
|
+
*
|
|
15
|
+
* - **Type Safety**: Branded types prevent string confusion and improve code reliability
|
|
16
|
+
* - **Schema Integration**: Direct mapping to OpenAPI components.schemas keys
|
|
17
|
+
* - **Reference Tracking**: Safe handling of schema references throughout generation
|
|
18
|
+
* - **IDE Support**: Enhanced IntelliSense and error detection in development
|
|
19
|
+
* - **Validation**: Compile-time validation of schema reference usage
|
|
20
|
+
*
|
|
21
|
+
* @example Basic reference name usage
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import type { RefName } from '@skmtc/core/RefName';
|
|
24
|
+
*
|
|
25
|
+
* // Create a reference name (typically done by the parser)
|
|
26
|
+
* const userRef: RefName = 'User' as RefName;
|
|
27
|
+
* const productRef: RefName = 'Product' as RefName;
|
|
28
|
+
*
|
|
29
|
+
* // TypeScript prevents mixing with regular strings
|
|
30
|
+
* const regularString = 'User';
|
|
31
|
+
* // const invalid: RefName = regularString; // Type error!
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example Using reference names in generators
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import type { RefName } from '@skmtc/core/RefName';
|
|
37
|
+
*
|
|
38
|
+
* function generateModelImport(refName: RefName): string {
|
|
39
|
+
* return `import type { ${refName} } from './models/${refName}';`;
|
|
40
|
+
* }
|
|
41
|
+
*
|
|
42
|
+
* function generateModelReference(refName: RefName): string {
|
|
43
|
+
* return `#/components/schemas/${refName}`;
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* // Usage with type safety
|
|
47
|
+
* const userRef: RefName = 'User' as RefName;
|
|
48
|
+
* const importStatement = generateModelImport(userRef);
|
|
49
|
+
* const schemaRef = generateModelReference(userRef);
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example Reference name validation
|
|
53
|
+
* ```typescript
|
|
54
|
+
* import type { RefName } from '@skmtc/core/RefName';
|
|
55
|
+
*
|
|
56
|
+
* function isValidRefName(value: string): value is RefName {
|
|
57
|
+
* // Validate that the string is a valid schema reference name
|
|
58
|
+
* return /^[A-Za-z][A-Za-z0-9_]*$/.test(value) && value.length > 0;
|
|
59
|
+
* }
|
|
60
|
+
*
|
|
61
|
+
* function safeCreateRefName(value: string): RefName | null {
|
|
62
|
+
* if (isValidRefName(value)) {
|
|
63
|
+
* return value as RefName;
|
|
64
|
+
* }
|
|
65
|
+
* return null;
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @module RefName
|
|
70
|
+
*/
|
|
1
71
|
import "../_dnt.polyfills.js";
|
|
2
72
|
import type { Brand } from './Brand.js';
|
|
3
73
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefName.d.ts","sourceRoot":"","sources":["../../src/types/RefName.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"RefName.d.ts","sourceRoot":"","sources":["../../src/types/RefName.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,OAAO,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA"}
|
package/esm/types/RefName.js
CHANGED
|
@@ -1 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Reference Name System for SKMTC Core
|
|
3
|
+
*
|
|
4
|
+
* This module provides a type-safe reference name system for identifying
|
|
5
|
+
* OpenAPI schema components throughout the SKMTC pipeline. Reference names
|
|
6
|
+
* are branded types that ensure schema identifiers are handled safely and
|
|
7
|
+
* prevent accidental mixing with regular strings.
|
|
8
|
+
*
|
|
9
|
+
* The reference name system is crucial for maintaining type safety when
|
|
10
|
+
* working with OpenAPI component references, schema lookups, and cross-references
|
|
11
|
+
* between different parts of the generated code.
|
|
12
|
+
*
|
|
13
|
+
* ## Key Features
|
|
14
|
+
*
|
|
15
|
+
* - **Type Safety**: Branded types prevent string confusion and improve code reliability
|
|
16
|
+
* - **Schema Integration**: Direct mapping to OpenAPI components.schemas keys
|
|
17
|
+
* - **Reference Tracking**: Safe handling of schema references throughout generation
|
|
18
|
+
* - **IDE Support**: Enhanced IntelliSense and error detection in development
|
|
19
|
+
* - **Validation**: Compile-time validation of schema reference usage
|
|
20
|
+
*
|
|
21
|
+
* @example Basic reference name usage
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import type { RefName } from '@skmtc/core/RefName';
|
|
24
|
+
*
|
|
25
|
+
* // Create a reference name (typically done by the parser)
|
|
26
|
+
* const userRef: RefName = 'User' as RefName;
|
|
27
|
+
* const productRef: RefName = 'Product' as RefName;
|
|
28
|
+
*
|
|
29
|
+
* // TypeScript prevents mixing with regular strings
|
|
30
|
+
* const regularString = 'User';
|
|
31
|
+
* // const invalid: RefName = regularString; // Type error!
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example Using reference names in generators
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import type { RefName } from '@skmtc/core/RefName';
|
|
37
|
+
*
|
|
38
|
+
* function generateModelImport(refName: RefName): string {
|
|
39
|
+
* return `import type { ${refName} } from './models/${refName}';`;
|
|
40
|
+
* }
|
|
41
|
+
*
|
|
42
|
+
* function generateModelReference(refName: RefName): string {
|
|
43
|
+
* return `#/components/schemas/${refName}`;
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* // Usage with type safety
|
|
47
|
+
* const userRef: RefName = 'User' as RefName;
|
|
48
|
+
* const importStatement = generateModelImport(userRef);
|
|
49
|
+
* const schemaRef = generateModelReference(userRef);
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example Reference name validation
|
|
53
|
+
* ```typescript
|
|
54
|
+
* import type { RefName } from '@skmtc/core/RefName';
|
|
55
|
+
*
|
|
56
|
+
* function isValidRefName(value: string): value is RefName {
|
|
57
|
+
* // Validate that the string is a valid schema reference name
|
|
58
|
+
* return /^[A-Za-z][A-Za-z0-9_]*$/.test(value) && value.length > 0;
|
|
59
|
+
* }
|
|
60
|
+
*
|
|
61
|
+
* function safeCreateRefName(value: string): RefName | null {
|
|
62
|
+
* if (isValidRefName(value)) {
|
|
63
|
+
* return value as RefName;
|
|
64
|
+
* }
|
|
65
|
+
* return null;
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @module RefName
|
|
70
|
+
*/
|
|
1
71
|
import "../_dnt.polyfills.js";
|
package/esm/types/Settings.d.ts
CHANGED
|
@@ -1,3 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview SKMTC Core Settings and Configuration
|
|
3
|
+
*
|
|
4
|
+
* This module provides comprehensive configuration types and schemas for the SKMTC
|
|
5
|
+
* code generation pipeline. It defines settings for generators, modules, packages,
|
|
6
|
+
* and runtime behavior that control how OpenAPI documents are processed and what
|
|
7
|
+
* artifacts are generated.
|
|
8
|
+
*
|
|
9
|
+
* ## Key Features
|
|
10
|
+
*
|
|
11
|
+
* - **Generator Configuration**: Settings for individual code generators
|
|
12
|
+
* - **Module Management**: Package and module resolution configuration
|
|
13
|
+
* - **Runtime Settings**: Control generation behavior and output preferences
|
|
14
|
+
* - **Enrichment Integration**: Support for UI enrichment metadata
|
|
15
|
+
* - **Type Safety**: Comprehensive Valibot validation for all configuration
|
|
16
|
+
*
|
|
17
|
+
* @example Basic generator settings
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import type { Settings } from '@skmtc/core/Settings';
|
|
20
|
+
*
|
|
21
|
+
* const settings: Settings = {
|
|
22
|
+
* generators: {
|
|
23
|
+
* 'my-generator': {
|
|
24
|
+
* enabled: true,
|
|
25
|
+
* config: {
|
|
26
|
+
* outputPath: './generated',
|
|
27
|
+
* typescript: true
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
* },
|
|
31
|
+
* enrichments: {},
|
|
32
|
+
* filters: {
|
|
33
|
+
* includePaths: ['/api/v1/*'],
|
|
34
|
+
* excludeMethods: ['OPTIONS']
|
|
35
|
+
* }
|
|
36
|
+
* };
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example Module package configuration
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import type { ModulePackage } from '@skmtc/core/Settings';
|
|
42
|
+
*
|
|
43
|
+
* const moduleConfig: ModulePackage = {
|
|
44
|
+
* rootPath: './src/generated',
|
|
45
|
+
* moduleName: '@my-org/api-client'
|
|
46
|
+
* };
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @module Settings
|
|
50
|
+
*/
|
|
1
51
|
import "../_dnt.polyfills.js";
|
|
2
52
|
import { type GeneratorEnrichments } from './Enrichments.js';
|
|
3
53
|
import * as v from 'valibot';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../src/types/Settings.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../src/types/Settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,OAAO,sBAAsB,CAAC;AAG9B,OAAO,EAAwB,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAClF,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,aAAa,CAAA;AAEjD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,aAAa,CAAC,aAAa,CAGvD,CAAA;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAA;IAChB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,CAAC,CAAC,aAAa,CAAC,SAAS,CAAyC,CAAA;AAE1F;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,cAAc,CAAmC,CAAA;AAE9F;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,aAAa,CAAC,UAAU,CAA6C,CAAA;AAIhG;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,cAAc,CAKzD,CAAA;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;AAEhD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;AAEjD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAEtD;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG,cAAc,GAAG,UAAU,GAAG,MAAM,CAAA;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAA;IAC1B,kDAAkD;IAClD,WAAW,CAAC,EAAE,oBAAoB,CAAA;IAClC,sDAAsD;IACtD,IAAI,CAAC,EAAE,IAAI,EAAE,CAAA;CACd,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,0DAA0D;IAC1D,QAAQ,EAAE,cAAc,CAAA;CACzB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,aAAa,CAAC,iBAAiB,CAG/D,CAAA"}
|
package/esm/types/Settings.js
CHANGED
|
@@ -1,3 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview SKMTC Core Settings and Configuration
|
|
3
|
+
*
|
|
4
|
+
* This module provides comprehensive configuration types and schemas for the SKMTC
|
|
5
|
+
* code generation pipeline. It defines settings for generators, modules, packages,
|
|
6
|
+
* and runtime behavior that control how OpenAPI documents are processed and what
|
|
7
|
+
* artifacts are generated.
|
|
8
|
+
*
|
|
9
|
+
* ## Key Features
|
|
10
|
+
*
|
|
11
|
+
* - **Generator Configuration**: Settings for individual code generators
|
|
12
|
+
* - **Module Management**: Package and module resolution configuration
|
|
13
|
+
* - **Runtime Settings**: Control generation behavior and output preferences
|
|
14
|
+
* - **Enrichment Integration**: Support for UI enrichment metadata
|
|
15
|
+
* - **Type Safety**: Comprehensive Valibot validation for all configuration
|
|
16
|
+
*
|
|
17
|
+
* @example Basic generator settings
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import type { Settings } from '@skmtc/core/Settings';
|
|
20
|
+
*
|
|
21
|
+
* const settings: Settings = {
|
|
22
|
+
* generators: {
|
|
23
|
+
* 'my-generator': {
|
|
24
|
+
* enabled: true,
|
|
25
|
+
* config: {
|
|
26
|
+
* outputPath: './generated',
|
|
27
|
+
* typescript: true
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
* },
|
|
31
|
+
* enrichments: {},
|
|
32
|
+
* filters: {
|
|
33
|
+
* includePaths: ['/api/v1/*'],
|
|
34
|
+
* excludeMethods: ['OPTIONS']
|
|
35
|
+
* }
|
|
36
|
+
* };
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example Module package configuration
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import type { ModulePackage } from '@skmtc/core/Settings';
|
|
42
|
+
*
|
|
43
|
+
* const moduleConfig: ModulePackage = {
|
|
44
|
+
* rootPath: './src/generated',
|
|
45
|
+
* moduleName: '@my-org/api-client'
|
|
46
|
+
* };
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @module Settings
|
|
50
|
+
*/
|
|
1
51
|
import "../_dnt.polyfills.js";
|
|
2
52
|
import { generatorEnrichments } from './Enrichments.js';
|
|
3
53
|
import * as v from 'valibot';
|
package/package.json
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview String Manipulation Utilities for SKMTC Core
|
|
3
|
+
*
|
|
4
|
+
* This module provides a comprehensive collection of string manipulation utilities
|
|
5
|
+
* commonly needed for code generation, identifier transformation, and text processing
|
|
6
|
+
* within the SKMTC pipeline. These utilities handle case conversions, pluralization,
|
|
7
|
+
* sanitization, and various text transformations.
|
|
8
|
+
*
|
|
9
|
+
* ## Key Features
|
|
10
|
+
*
|
|
11
|
+
* - **Case Conversion**: camelCase, PascalCase, snake_case, kebab-case, and more
|
|
12
|
+
* - **Pluralization**: Smart singular/plural transformations with irregular forms
|
|
13
|
+
* - **Sanitization**: Clean strings for use as identifiers and file names
|
|
14
|
+
* - **Text Processing**: Trimming, padding, wrapping, and formatting utilities
|
|
15
|
+
* - **Unicode Support**: Proper handling of international characters
|
|
16
|
+
*
|
|
17
|
+
* @example Case conversions
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { capitalize, camelCase, pascalCase } from '@skmtc/core/strings';
|
|
20
|
+
*
|
|
21
|
+
* capitalize('hello world'); // 'Hello world'
|
|
22
|
+
* camelCase('user_profile_data'); // 'userProfileData'
|
|
23
|
+
* pascalCase('api-response-type'); // 'ApiResponseType'
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example Pluralization
|
|
27
|
+
* ```typescript
|
|
28
|
+
* import { pluralize, singularize } from '@skmtc/core/strings';
|
|
29
|
+
*
|
|
30
|
+
* pluralize('user'); // 'users'
|
|
31
|
+
* pluralize('child'); // 'children'
|
|
32
|
+
* singularize('categories'); // 'category'
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Identifier sanitization
|
|
36
|
+
* ```typescript
|
|
37
|
+
* import { sanitizeIdentifier, toFileName } from '@skmtc/core/strings';
|
|
38
|
+
*
|
|
39
|
+
* sanitizeIdentifier('123-invalid name!'); // 'invalid_name'
|
|
40
|
+
* toFileName('My API Response'); // 'my-api-response'
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @module strings
|
|
44
|
+
*/
|
|
1
45
|
/**
|
|
2
46
|
* Capitalizes the first character of a string.
|
|
3
47
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/helpers/strings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,sBAAsB,CAAC;AAE9B,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,KAAG,MAExC,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,KAAG,MAE1C,CAAA;AAED;;GAEG;AACH,KAAK,gBAAgB,GAAG;IACtB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,EAAE,iBAAgB,gBAAqB,KAAG,MAgB9E,CAAA"}
|
|
1
|
+
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/helpers/strings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH;;;;;;;;;;;;GAYG;AACH,OAAO,sBAAsB,CAAC;AAE9B,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,KAAG,MAExC,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,KAAG,MAE1C,CAAA;AAED;;GAEG;AACH,KAAK,gBAAgB,GAAG;IACtB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,EAAE,iBAAgB,gBAAqB,KAAG,MAgB9E,CAAA"}
|
|
@@ -1,4 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview String Manipulation Utilities for SKMTC Core
|
|
4
|
+
*
|
|
5
|
+
* This module provides a comprehensive collection of string manipulation utilities
|
|
6
|
+
* commonly needed for code generation, identifier transformation, and text processing
|
|
7
|
+
* within the SKMTC pipeline. These utilities handle case conversions, pluralization,
|
|
8
|
+
* sanitization, and various text transformations.
|
|
9
|
+
*
|
|
10
|
+
* ## Key Features
|
|
11
|
+
*
|
|
12
|
+
* - **Case Conversion**: camelCase, PascalCase, snake_case, kebab-case, and more
|
|
13
|
+
* - **Pluralization**: Smart singular/plural transformations with irregular forms
|
|
14
|
+
* - **Sanitization**: Clean strings for use as identifiers and file names
|
|
15
|
+
* - **Text Processing**: Trimming, padding, wrapping, and formatting utilities
|
|
16
|
+
* - **Unicode Support**: Proper handling of international characters
|
|
17
|
+
*
|
|
18
|
+
* @example Case conversions
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import { capitalize, camelCase, pascalCase } from '@skmtc/core/strings';
|
|
21
|
+
*
|
|
22
|
+
* capitalize('hello world'); // 'Hello world'
|
|
23
|
+
* camelCase('user_profile_data'); // 'userProfileData'
|
|
24
|
+
* pascalCase('api-response-type'); // 'ApiResponseType'
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example Pluralization
|
|
28
|
+
* ```typescript
|
|
29
|
+
* import { pluralize, singularize } from '@skmtc/core/strings';
|
|
30
|
+
*
|
|
31
|
+
* pluralize('user'); // 'users'
|
|
32
|
+
* pluralize('child'); // 'children'
|
|
33
|
+
* singularize('categories'); // 'category'
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example Identifier sanitization
|
|
37
|
+
* ```typescript
|
|
38
|
+
* import { sanitizeIdentifier, toFileName } from '@skmtc/core/strings';
|
|
39
|
+
*
|
|
40
|
+
* sanitizeIdentifier('123-invalid name!'); // 'invalid_name'
|
|
41
|
+
* toFileName('My API Response'); // 'my-api-response'
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @module strings
|
|
45
|
+
*/
|
|
2
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
47
|
exports.camelCase = exports.decapitalize = exports.capitalize = void 0;
|
|
4
48
|
/**
|
|
@@ -1,6 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Artifact Path Resolution Utilities for SKMTC Core
|
|
3
|
+
*
|
|
4
|
+
* This module provides utilities for resolving file paths for generated artifacts
|
|
5
|
+
* within the SKMTC code generation pipeline. It handles the complexities of path
|
|
6
|
+
* resolution, ensuring that generated files are placed in the correct locations
|
|
7
|
+
* relative to base directories and project structures.
|
|
8
|
+
*
|
|
9
|
+
* The path resolution system supports both absolute and relative paths,
|
|
10
|
+
* cross-platform compatibility, and proper handling of nested directory
|
|
11
|
+
* structures for organized code generation output.
|
|
12
|
+
*
|
|
13
|
+
* ## Key Features
|
|
14
|
+
*
|
|
15
|
+
* - **Cross-Platform Compatibility**: Works correctly on Windows, macOS, and Linux
|
|
16
|
+
* - **Relative Path Resolution**: Proper handling of relative paths with base directories
|
|
17
|
+
* - **Absolute Path Support**: Direct support for absolute destination paths
|
|
18
|
+
* - **Directory Creation**: Safe directory creation for nested path structures
|
|
19
|
+
* - **Path Normalization**: Consistent path formatting across different systems
|
|
20
|
+
*
|
|
21
|
+
* @example Basic path resolution
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import { toResolvedArtifactPath } from '@skmtc/core/toResolvedArtifactPath';
|
|
24
|
+
*
|
|
25
|
+
* // Resolve relative path with base directory
|
|
26
|
+
* const resolvedPath = toResolvedArtifactPath({
|
|
27
|
+
* basePath: '/project/src',
|
|
28
|
+
* destinationPath: './generated/UserApi.ts'
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* console.log(resolvedPath); // '/project/src/generated/UserApi.ts'
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example Absolute path handling
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { toResolvedArtifactPath } from '@skmtc/core/toResolvedArtifactPath';
|
|
37
|
+
*
|
|
38
|
+
* // Absolute paths are returned as-is
|
|
39
|
+
* const absolutePath = toResolvedArtifactPath({
|
|
40
|
+
* basePath: '/project/src',
|
|
41
|
+
* destinationPath: '/absolute/path/to/UserApi.ts'
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* console.log(absolutePath); // '/absolute/path/to/UserApi.ts'
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example Working without base path
|
|
48
|
+
* ```typescript
|
|
49
|
+
* import { toResolvedArtifactPath } from '@skmtc/core/toResolvedArtifactPath';
|
|
50
|
+
*
|
|
51
|
+
* // When basePath is undefined, returns the destination path
|
|
52
|
+
* const path = toResolvedArtifactPath({
|
|
53
|
+
* basePath: undefined,
|
|
54
|
+
* destinationPath: './UserApi.ts'
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* console.log(path); // './UserApi.ts'
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @module toResolvedArtifactPath
|
|
61
|
+
*/
|
|
1
62
|
import "../_dnt.polyfills.js";
|
|
2
63
|
/**
|
|
3
64
|
* Arguments for resolving artifact file paths.
|
|
65
|
+
*
|
|
66
|
+
* Defines the input parameters needed to resolve a destination path
|
|
67
|
+
* relative to an optional base directory.
|
|
4
68
|
*/
|
|
5
69
|
type ToResolvedArtifactPathArgs = {
|
|
6
70
|
/** The base directory path for resolving relative paths */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toResolvedArtifactPath.d.ts","sourceRoot":"","sources":["../../src/helpers/toResolvedArtifactPath.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"toResolvedArtifactPath.d.ts","sourceRoot":"","sources":["../../src/helpers/toResolvedArtifactPath.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,OAAO,sBAAsB,CAAC;AAK9B;;;;;GAKG;AACH,KAAK,0BAA0B,GAAG;IAChC,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,iDAAiD;IACjD,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2IG;AACH,eAAO,MAAM,sBAAsB,GAAI,+BAGpC,0BAA0B,KAAG,MAE/B,CAAA"}
|
|
@@ -1,6 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toResolvedArtifactPath = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @fileoverview Artifact Path Resolution Utilities for SKMTC Core
|
|
6
|
+
*
|
|
7
|
+
* This module provides utilities for resolving file paths for generated artifacts
|
|
8
|
+
* within the SKMTC code generation pipeline. It handles the complexities of path
|
|
9
|
+
* resolution, ensuring that generated files are placed in the correct locations
|
|
10
|
+
* relative to base directories and project structures.
|
|
11
|
+
*
|
|
12
|
+
* The path resolution system supports both absolute and relative paths,
|
|
13
|
+
* cross-platform compatibility, and proper handling of nested directory
|
|
14
|
+
* structures for organized code generation output.
|
|
15
|
+
*
|
|
16
|
+
* ## Key Features
|
|
17
|
+
*
|
|
18
|
+
* - **Cross-Platform Compatibility**: Works correctly on Windows, macOS, and Linux
|
|
19
|
+
* - **Relative Path Resolution**: Proper handling of relative paths with base directories
|
|
20
|
+
* - **Absolute Path Support**: Direct support for absolute destination paths
|
|
21
|
+
* - **Directory Creation**: Safe directory creation for nested path structures
|
|
22
|
+
* - **Path Normalization**: Consistent path formatting across different systems
|
|
23
|
+
*
|
|
24
|
+
* @example Basic path resolution
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import { toResolvedArtifactPath } from '@skmtc/core/toResolvedArtifactPath';
|
|
27
|
+
*
|
|
28
|
+
* // Resolve relative path with base directory
|
|
29
|
+
* const resolvedPath = toResolvedArtifactPath({
|
|
30
|
+
* basePath: '/project/src',
|
|
31
|
+
* destinationPath: './generated/UserApi.ts'
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* console.log(resolvedPath); // '/project/src/generated/UserApi.ts'
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example Absolute path handling
|
|
38
|
+
* ```typescript
|
|
39
|
+
* import { toResolvedArtifactPath } from '@skmtc/core/toResolvedArtifactPath';
|
|
40
|
+
*
|
|
41
|
+
* // Absolute paths are returned as-is
|
|
42
|
+
* const absolutePath = toResolvedArtifactPath({
|
|
43
|
+
* basePath: '/project/src',
|
|
44
|
+
* destinationPath: '/absolute/path/to/UserApi.ts'
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* console.log(absolutePath); // '/absolute/path/to/UserApi.ts'
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example Working without base path
|
|
51
|
+
* ```typescript
|
|
52
|
+
* import { toResolvedArtifactPath } from '@skmtc/core/toResolvedArtifactPath';
|
|
53
|
+
*
|
|
54
|
+
* // When basePath is undefined, returns the destination path
|
|
55
|
+
* const path = toResolvedArtifactPath({
|
|
56
|
+
* basePath: undefined,
|
|
57
|
+
* destinationPath: './UserApi.ts'
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* console.log(path); // './UserApi.ts'
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @module toResolvedArtifactPath
|
|
64
|
+
*/
|
|
4
65
|
require("../_dnt.polyfills.js");
|
|
5
66
|
const join_js_1 = require("../deps/jsr.io/@std/path/1.1.2/join.js");
|
|
6
67
|
/**
|
|
@@ -1,3 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview OpenAPI Document Conversion Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides robust utilities for converting OpenAPI documents between
|
|
5
|
+
* different versions (v2/Swagger, v3.0, v3.1) and formats (JSON, YAML). It handles
|
|
6
|
+
* the complexities of version migration, format detection, and schema validation
|
|
7
|
+
* to ensure seamless OpenAPI document processing within the SKMTC pipeline.
|
|
8
|
+
*
|
|
9
|
+
* ## Key Features
|
|
10
|
+
*
|
|
11
|
+
* - **Multi-Version Support**: Convert between Swagger v2, OpenAPI v3.0, and v3.1
|
|
12
|
+
* - **Format Detection**: Automatic detection of JSON vs YAML input formats
|
|
13
|
+
* - **Version Migration**: Safe migration with schema validation and error handling
|
|
14
|
+
* - **Type Safety**: Full TypeScript support with proper type guards
|
|
15
|
+
* - **Error Recovery**: Comprehensive error handling for malformed documents
|
|
16
|
+
*
|
|
17
|
+
* @example Converting Swagger v2 to OpenAPI v3
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { toV3JsonDocument } from '@skmtc/core/toV3JsonDocument';
|
|
20
|
+
*
|
|
21
|
+
* const swaggerV2 = {
|
|
22
|
+
* swagger: '2.0',
|
|
23
|
+
* info: { title: 'My API', version: '1.0.0' },
|
|
24
|
+
* paths: { '/users': { get: { responses: { '200': { description: 'Success' } } } } }
|
|
25
|
+
* };
|
|
26
|
+
*
|
|
27
|
+
* const openApiV3 = await toV3JsonDocument(swaggerV2);
|
|
28
|
+
* console.log(openApiV3.openapi); // '3.0.0'
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example Converting from YAML string
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const yamlContent = `
|
|
34
|
+
* openapi: 3.1.0
|
|
35
|
+
* info:
|
|
36
|
+
* title: My API
|
|
37
|
+
* version: 1.0.0
|
|
38
|
+
* paths: {}
|
|
39
|
+
* `;
|
|
40
|
+
*
|
|
41
|
+
* const openApiV3 = await toV3JsonDocument(yamlContent);
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example Handling conversion errors
|
|
45
|
+
* ```typescript
|
|
46
|
+
* try {
|
|
47
|
+
* const result = await toV3JsonDocument(malformedDocument);
|
|
48
|
+
* } catch (error) {
|
|
49
|
+
* console.error('Conversion failed:', error.message);
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @module toV3JsonDocument
|
|
54
|
+
*/
|
|
1
55
|
import "../_dnt.polyfills.js";
|
|
2
56
|
import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
|
|
3
57
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toV3JsonDocument.d.ts","sourceRoot":"","sources":["../../src/run/toV3JsonDocument.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"toV3JsonDocument.d.ts","sourceRoot":"","sources":["../../src/run/toV3JsonDocument.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,OAAO,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAUtE;;;;;GAKG;AACH,KAAK,cAAc,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAA;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,cAM/C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,eAAO,MAAM,YAAY,GAAU,QAAQ,cAAc,KAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CA0BrF,CAAA"}
|
|
@@ -4,6 +4,60 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.toV3Document = exports.stringToSchema = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview OpenAPI Document Conversion Utilities
|
|
9
|
+
*
|
|
10
|
+
* This module provides robust utilities for converting OpenAPI documents between
|
|
11
|
+
* different versions (v2/Swagger, v3.0, v3.1) and formats (JSON, YAML). It handles
|
|
12
|
+
* the complexities of version migration, format detection, and schema validation
|
|
13
|
+
* to ensure seamless OpenAPI document processing within the SKMTC pipeline.
|
|
14
|
+
*
|
|
15
|
+
* ## Key Features
|
|
16
|
+
*
|
|
17
|
+
* - **Multi-Version Support**: Convert between Swagger v2, OpenAPI v3.0, and v3.1
|
|
18
|
+
* - **Format Detection**: Automatic detection of JSON vs YAML input formats
|
|
19
|
+
* - **Version Migration**: Safe migration with schema validation and error handling
|
|
20
|
+
* - **Type Safety**: Full TypeScript support with proper type guards
|
|
21
|
+
* - **Error Recovery**: Comprehensive error handling for malformed documents
|
|
22
|
+
*
|
|
23
|
+
* @example Converting Swagger v2 to OpenAPI v3
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { toV3JsonDocument } from '@skmtc/core/toV3JsonDocument';
|
|
26
|
+
*
|
|
27
|
+
* const swaggerV2 = {
|
|
28
|
+
* swagger: '2.0',
|
|
29
|
+
* info: { title: 'My API', version: '1.0.0' },
|
|
30
|
+
* paths: { '/users': { get: { responses: { '200': { description: 'Success' } } } } }
|
|
31
|
+
* };
|
|
32
|
+
*
|
|
33
|
+
* const openApiV3 = await toV3JsonDocument(swaggerV2);
|
|
34
|
+
* console.log(openApiV3.openapi); // '3.0.0'
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example Converting from YAML string
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const yamlContent = `
|
|
40
|
+
* openapi: 3.1.0
|
|
41
|
+
* info:
|
|
42
|
+
* title: My API
|
|
43
|
+
* version: 1.0.0
|
|
44
|
+
* paths: {}
|
|
45
|
+
* `;
|
|
46
|
+
*
|
|
47
|
+
* const openApiV3 = await toV3JsonDocument(yamlContent);
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example Handling conversion errors
|
|
51
|
+
* ```typescript
|
|
52
|
+
* try {
|
|
53
|
+
* const result = await toV3JsonDocument(malformedDocument);
|
|
54
|
+
* } catch (error) {
|
|
55
|
+
* console.error('Conversion failed:', error.message);
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @module toV3JsonDocument
|
|
60
|
+
*/
|
|
7
61
|
require("../_dnt.polyfills.js");
|
|
8
62
|
const parse_js_1 = require("../deps/jsr.io/@std/yaml/1.0.9/parse.js");
|
|
9
63
|
const openapi_down_convert_1 = require("@apiture/openapi-down-convert");
|