@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/script/types/Method.js
CHANGED
|
@@ -34,6 +34,73 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.isMethod = exports.methods = exports.method = exports.methodValuesNoTrace = exports.methodValues = void 0;
|
|
37
|
+
/**
|
|
38
|
+
* @fileoverview HTTP Method System for SKMTC Core
|
|
39
|
+
*
|
|
40
|
+
* This module provides comprehensive HTTP method definitions and utilities for
|
|
41
|
+
* handling OpenAPI operations. It includes type-safe method definitions,
|
|
42
|
+
* validation utilities, and constants for all HTTP methods supported by
|
|
43
|
+
* the OpenAPI v3 specification.
|
|
44
|
+
*
|
|
45
|
+
* The module ensures type safety when working with HTTP methods throughout
|
|
46
|
+
* the SKMTC pipeline and provides utilities for method validation and processing.
|
|
47
|
+
*
|
|
48
|
+
* ## Key Features
|
|
49
|
+
*
|
|
50
|
+
* - **Complete Method Support**: All HTTP methods from OpenAPI v3 specification
|
|
51
|
+
* - **Type Safety**: Branded types and type guards for method handling
|
|
52
|
+
* - **Validation**: Runtime validation with Valibot integration
|
|
53
|
+
* - **Case Handling**: Proper case normalization for method strings
|
|
54
|
+
* - **Specification Compliance**: Full adherence to OpenAPI v3 method definitions
|
|
55
|
+
*
|
|
56
|
+
* @example Working with HTTP methods
|
|
57
|
+
* ```typescript
|
|
58
|
+
* import { Method, isMethod, methodValues } from '@skmtc/core/Method';
|
|
59
|
+
*
|
|
60
|
+
* // Type-safe method handling
|
|
61
|
+
* const method: Method = 'GET';
|
|
62
|
+
*
|
|
63
|
+
* // Validate unknown method strings
|
|
64
|
+
* const userInput = 'post';
|
|
65
|
+
* if (isMethod(userInput)) {
|
|
66
|
+
* console.log(`Valid method: ${userInput}`); // TypeScript knows it's a Method
|
|
67
|
+
* }
|
|
68
|
+
*
|
|
69
|
+
* // List all supported methods
|
|
70
|
+
* console.log('Supported methods:', methodValues);
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @example Method validation in generators
|
|
74
|
+
* ```typescript
|
|
75
|
+
* import { isMethod, Method } from '@skmtc/core/Method';
|
|
76
|
+
*
|
|
77
|
+
* function processOperation(path: string, method: string, operation: any) {
|
|
78
|
+
* if (!isMethod(method)) {
|
|
79
|
+
* throw new Error(`Unsupported HTTP method: ${method}`);
|
|
80
|
+
* }
|
|
81
|
+
*
|
|
82
|
+
* // TypeScript now knows method is of type Method
|
|
83
|
+
* return generateOperationCode(path, method, operation);
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @example Case-insensitive method handling
|
|
88
|
+
* ```typescript
|
|
89
|
+
* import { normalizeMethod, isMethod } from '@skmtc/core/Method';
|
|
90
|
+
*
|
|
91
|
+
* function handleMethodString(methodStr: string) {
|
|
92
|
+
* const normalized = methodStr.toLowerCase();
|
|
93
|
+
*
|
|
94
|
+
* if (isMethod(normalized)) {
|
|
95
|
+
* return processValidMethod(normalized);
|
|
96
|
+
* } else {
|
|
97
|
+
* throw new Error(`Invalid method: ${methodStr}`);
|
|
98
|
+
* }
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @module Method
|
|
103
|
+
*/
|
|
37
104
|
require("../_dnt.polyfills.js");
|
|
38
105
|
const v = __importStar(require("valibot"));
|
|
39
106
|
/**
|
|
@@ -41,6 +108,7 @@ const v = __importStar(require("valibot"));
|
|
|
41
108
|
*
|
|
42
109
|
* This constant array includes all HTTP methods that can be used
|
|
43
110
|
* in OpenAPI path operations, as defined by the OpenAPI specification.
|
|
111
|
+
* All methods are in lowercase to match OpenAPI conventions.
|
|
44
112
|
*/
|
|
45
113
|
exports.methodValues = [
|
|
46
114
|
'get',
|
|
@@ -1,3 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Preview and Mapping System for SKMTC Core
|
|
3
|
+
*
|
|
4
|
+
* This module provides comprehensive types and utilities for creating preview
|
|
5
|
+
* interfaces and mapping configurations for generated code. The preview system
|
|
6
|
+
* enables interactive demonstrations of generated APIs, forms, tables, and
|
|
7
|
+
* other UI components within development tools and documentation.
|
|
8
|
+
*
|
|
9
|
+
* The mapping system provides metadata about how OpenAPI operations and models
|
|
10
|
+
* translate to generated code, enabling rich tooling experiences and
|
|
11
|
+
* reverse-engineering capabilities.
|
|
12
|
+
*
|
|
13
|
+
* ## Key Features
|
|
14
|
+
*
|
|
15
|
+
* - **Interactive Previews**: Rich preview interfaces for generated components
|
|
16
|
+
* - **Source Mapping**: Traceability from generated code back to OpenAPI sources
|
|
17
|
+
* - **UI Grouping**: Organized grouping of related UI components (forms, tables, inputs)
|
|
18
|
+
* - **Generator Integration**: Deep integration with the generator pipeline
|
|
19
|
+
* - **Type Safety**: Comprehensive validation and type safety throughout
|
|
20
|
+
*
|
|
21
|
+
* @example Creating operation previews
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import type { PreviewModule, OperationSource } from '@skmtc/core/Preview';
|
|
24
|
+
*
|
|
25
|
+
* const operationSource: OperationSource = {
|
|
26
|
+
* type: 'operation',
|
|
27
|
+
* generatorId: 'react-forms',
|
|
28
|
+
* operationPath: '/users',
|
|
29
|
+
* operationMethod: 'POST'
|
|
30
|
+
* };
|
|
31
|
+
*
|
|
32
|
+
* const preview: PreviewModule = {
|
|
33
|
+
* title: 'Create User Form',
|
|
34
|
+
* description: 'Interactive form for creating new users',
|
|
35
|
+
* group: 'forms',
|
|
36
|
+
* source: operationSource,
|
|
37
|
+
* moduleName: 'CreateUserForm',
|
|
38
|
+
* exportName: 'default'
|
|
39
|
+
* };
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example Creating model previews
|
|
43
|
+
* ```typescript
|
|
44
|
+
* import type { PreviewModule, ModelSource } from '@skmtc/core/Preview';
|
|
45
|
+
*
|
|
46
|
+
* const modelSource: ModelSource = {
|
|
47
|
+
* type: 'model',
|
|
48
|
+
* generatorId: 'typescript-types',
|
|
49
|
+
* refName: 'User'
|
|
50
|
+
* };
|
|
51
|
+
*
|
|
52
|
+
* const preview: PreviewModule = {
|
|
53
|
+
* title: 'User Type Definition',
|
|
54
|
+
* description: 'TypeScript interface for User model',
|
|
55
|
+
* group: 'tables',
|
|
56
|
+
* source: modelSource,
|
|
57
|
+
* moduleName: 'UserTypes',
|
|
58
|
+
* exportName: 'User'
|
|
59
|
+
* };
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @example Working with mappings
|
|
63
|
+
* ```typescript
|
|
64
|
+
* import type { MappingModule } from '@skmtc/core/Preview';
|
|
65
|
+
*
|
|
66
|
+
* const mapping: MappingModule = {
|
|
67
|
+
* source: operationSource,
|
|
68
|
+
* moduleName: 'UserApi',
|
|
69
|
+
* exportName: 'createUser',
|
|
70
|
+
* generatedPath: './src/generated/UserApi.ts'
|
|
71
|
+
* };
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @module Preview
|
|
75
|
+
*/
|
|
1
76
|
import "../_dnt.polyfills.js";
|
|
2
77
|
import { type Method } from './Method.js';
|
|
3
78
|
import * as v from 'valibot';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../src/types/Preview.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../src/types/Preview.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AACH,OAAO,sBAAsB,CAAC;AAG9B,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,WAAW,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAExD,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,YAAY,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAA;IAC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AACH,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,YAAY,CACtC;IACE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IAClD,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAA;IAC/C,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAA;CAC5C,EACD,SAAS,CAKT,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,aAAa,CAAC,YAAY,CAA6C,CAAA;AAEpG;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,aAAa,CAAC,aAAa,CAIvD,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,aAAa,CAAC,aAAa,CAMvD,CAAA;AAKF;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,CAAC,CAAC,aAAa,CAAC,OAAO,CAG3C,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,CAAC,CAAC,aAAa,CAAC,OAAO,CAG3C,CAAA"}
|
package/script/types/Preview.js
CHANGED
|
@@ -34,6 +34,81 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.mapping = exports.preview = exports.mappingModule = exports.previewModule = exports.previewGroup = exports.modelSource = exports.operationSource = void 0;
|
|
37
|
+
/**
|
|
38
|
+
* @fileoverview Preview and Mapping System for SKMTC Core
|
|
39
|
+
*
|
|
40
|
+
* This module provides comprehensive types and utilities for creating preview
|
|
41
|
+
* interfaces and mapping configurations for generated code. The preview system
|
|
42
|
+
* enables interactive demonstrations of generated APIs, forms, tables, and
|
|
43
|
+
* other UI components within development tools and documentation.
|
|
44
|
+
*
|
|
45
|
+
* The mapping system provides metadata about how OpenAPI operations and models
|
|
46
|
+
* translate to generated code, enabling rich tooling experiences and
|
|
47
|
+
* reverse-engineering capabilities.
|
|
48
|
+
*
|
|
49
|
+
* ## Key Features
|
|
50
|
+
*
|
|
51
|
+
* - **Interactive Previews**: Rich preview interfaces for generated components
|
|
52
|
+
* - **Source Mapping**: Traceability from generated code back to OpenAPI sources
|
|
53
|
+
* - **UI Grouping**: Organized grouping of related UI components (forms, tables, inputs)
|
|
54
|
+
* - **Generator Integration**: Deep integration with the generator pipeline
|
|
55
|
+
* - **Type Safety**: Comprehensive validation and type safety throughout
|
|
56
|
+
*
|
|
57
|
+
* @example Creating operation previews
|
|
58
|
+
* ```typescript
|
|
59
|
+
* import type { PreviewModule, OperationSource } from '@skmtc/core/Preview';
|
|
60
|
+
*
|
|
61
|
+
* const operationSource: OperationSource = {
|
|
62
|
+
* type: 'operation',
|
|
63
|
+
* generatorId: 'react-forms',
|
|
64
|
+
* operationPath: '/users',
|
|
65
|
+
* operationMethod: 'POST'
|
|
66
|
+
* };
|
|
67
|
+
*
|
|
68
|
+
* const preview: PreviewModule = {
|
|
69
|
+
* title: 'Create User Form',
|
|
70
|
+
* description: 'Interactive form for creating new users',
|
|
71
|
+
* group: 'forms',
|
|
72
|
+
* source: operationSource,
|
|
73
|
+
* moduleName: 'CreateUserForm',
|
|
74
|
+
* exportName: 'default'
|
|
75
|
+
* };
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @example Creating model previews
|
|
79
|
+
* ```typescript
|
|
80
|
+
* import type { PreviewModule, ModelSource } from '@skmtc/core/Preview';
|
|
81
|
+
*
|
|
82
|
+
* const modelSource: ModelSource = {
|
|
83
|
+
* type: 'model',
|
|
84
|
+
* generatorId: 'typescript-types',
|
|
85
|
+
* refName: 'User'
|
|
86
|
+
* };
|
|
87
|
+
*
|
|
88
|
+
* const preview: PreviewModule = {
|
|
89
|
+
* title: 'User Type Definition',
|
|
90
|
+
* description: 'TypeScript interface for User model',
|
|
91
|
+
* group: 'tables',
|
|
92
|
+
* source: modelSource,
|
|
93
|
+
* moduleName: 'UserTypes',
|
|
94
|
+
* exportName: 'User'
|
|
95
|
+
* };
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @example Working with mappings
|
|
99
|
+
* ```typescript
|
|
100
|
+
* import type { MappingModule } from '@skmtc/core/Preview';
|
|
101
|
+
*
|
|
102
|
+
* const mapping: MappingModule = {
|
|
103
|
+
* source: operationSource,
|
|
104
|
+
* moduleName: 'UserApi',
|
|
105
|
+
* exportName: 'createUser',
|
|
106
|
+
* generatedPath: './src/generated/UserApi.ts'
|
|
107
|
+
* };
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @module Preview
|
|
111
|
+
*/
|
|
37
112
|
require("../_dnt.polyfills.js");
|
|
38
113
|
const Method_js_1 = require("./Method.js");
|
|
39
114
|
const v = __importStar(require("valibot"));
|
|
@@ -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/script/types/RefName.js
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Reference Name System for SKMTC Core
|
|
5
|
+
*
|
|
6
|
+
* This module provides a type-safe reference name system for identifying
|
|
7
|
+
* OpenAPI schema components throughout the SKMTC pipeline. Reference names
|
|
8
|
+
* are branded types that ensure schema identifiers are handled safely and
|
|
9
|
+
* prevent accidental mixing with regular strings.
|
|
10
|
+
*
|
|
11
|
+
* The reference name system is crucial for maintaining type safety when
|
|
12
|
+
* working with OpenAPI component references, schema lookups, and cross-references
|
|
13
|
+
* between different parts of the generated code.
|
|
14
|
+
*
|
|
15
|
+
* ## Key Features
|
|
16
|
+
*
|
|
17
|
+
* - **Type Safety**: Branded types prevent string confusion and improve code reliability
|
|
18
|
+
* - **Schema Integration**: Direct mapping to OpenAPI components.schemas keys
|
|
19
|
+
* - **Reference Tracking**: Safe handling of schema references throughout generation
|
|
20
|
+
* - **IDE Support**: Enhanced IntelliSense and error detection in development
|
|
21
|
+
* - **Validation**: Compile-time validation of schema reference usage
|
|
22
|
+
*
|
|
23
|
+
* @example Basic reference name usage
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import type { RefName } from '@skmtc/core/RefName';
|
|
26
|
+
*
|
|
27
|
+
* // Create a reference name (typically done by the parser)
|
|
28
|
+
* const userRef: RefName = 'User' as RefName;
|
|
29
|
+
* const productRef: RefName = 'Product' as RefName;
|
|
30
|
+
*
|
|
31
|
+
* // TypeScript prevents mixing with regular strings
|
|
32
|
+
* const regularString = 'User';
|
|
33
|
+
* // const invalid: RefName = regularString; // Type error!
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example Using reference names in generators
|
|
37
|
+
* ```typescript
|
|
38
|
+
* import type { RefName } from '@skmtc/core/RefName';
|
|
39
|
+
*
|
|
40
|
+
* function generateModelImport(refName: RefName): string {
|
|
41
|
+
* return `import type { ${refName} } from './models/${refName}';`;
|
|
42
|
+
* }
|
|
43
|
+
*
|
|
44
|
+
* function generateModelReference(refName: RefName): string {
|
|
45
|
+
* return `#/components/schemas/${refName}`;
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* // Usage with type safety
|
|
49
|
+
* const userRef: RefName = 'User' as RefName;
|
|
50
|
+
* const importStatement = generateModelImport(userRef);
|
|
51
|
+
* const schemaRef = generateModelReference(userRef);
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example Reference name validation
|
|
55
|
+
* ```typescript
|
|
56
|
+
* import type { RefName } from '@skmtc/core/RefName';
|
|
57
|
+
*
|
|
58
|
+
* function isValidRefName(value: string): value is RefName {
|
|
59
|
+
* // Validate that the string is a valid schema reference name
|
|
60
|
+
* return /^[A-Za-z][A-Za-z0-9_]*$/.test(value) && value.length > 0;
|
|
61
|
+
* }
|
|
62
|
+
*
|
|
63
|
+
* function safeCreateRefName(value: string): RefName | null {
|
|
64
|
+
* if (isValidRefName(value)) {
|
|
65
|
+
* return value as RefName;
|
|
66
|
+
* }
|
|
67
|
+
* return null;
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @module RefName
|
|
72
|
+
*/
|
|
3
73
|
require("../_dnt.polyfills.js");
|
|
@@ -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;AAC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
package/script/types/Settings.js
CHANGED
|
@@ -34,6 +34,56 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.skmtcClientConfig = exports.clientSettings = exports.skipModels = exports.skipOperations = exports.skipPaths = exports.modulePackage = void 0;
|
|
37
|
+
/**
|
|
38
|
+
* @fileoverview SKMTC Core Settings and Configuration
|
|
39
|
+
*
|
|
40
|
+
* This module provides comprehensive configuration types and schemas for the SKMTC
|
|
41
|
+
* code generation pipeline. It defines settings for generators, modules, packages,
|
|
42
|
+
* and runtime behavior that control how OpenAPI documents are processed and what
|
|
43
|
+
* artifacts are generated.
|
|
44
|
+
*
|
|
45
|
+
* ## Key Features
|
|
46
|
+
*
|
|
47
|
+
* - **Generator Configuration**: Settings for individual code generators
|
|
48
|
+
* - **Module Management**: Package and module resolution configuration
|
|
49
|
+
* - **Runtime Settings**: Control generation behavior and output preferences
|
|
50
|
+
* - **Enrichment Integration**: Support for UI enrichment metadata
|
|
51
|
+
* - **Type Safety**: Comprehensive Valibot validation for all configuration
|
|
52
|
+
*
|
|
53
|
+
* @example Basic generator settings
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import type { Settings } from '@skmtc/core/Settings';
|
|
56
|
+
*
|
|
57
|
+
* const settings: Settings = {
|
|
58
|
+
* generators: {
|
|
59
|
+
* 'my-generator': {
|
|
60
|
+
* enabled: true,
|
|
61
|
+
* config: {
|
|
62
|
+
* outputPath: './generated',
|
|
63
|
+
* typescript: true
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
* },
|
|
67
|
+
* enrichments: {},
|
|
68
|
+
* filters: {
|
|
69
|
+
* includePaths: ['/api/v1/*'],
|
|
70
|
+
* excludeMethods: ['OPTIONS']
|
|
71
|
+
* }
|
|
72
|
+
* };
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @example Module package configuration
|
|
76
|
+
* ```typescript
|
|
77
|
+
* import type { ModulePackage } from '@skmtc/core/Settings';
|
|
78
|
+
*
|
|
79
|
+
* const moduleConfig: ModulePackage = {
|
|
80
|
+
* rootPath: './src/generated',
|
|
81
|
+
* moduleName: '@my-org/api-client'
|
|
82
|
+
* };
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @module Settings
|
|
86
|
+
*/
|
|
37
87
|
require("../_dnt.polyfills.js");
|
|
38
88
|
const Enrichments_js_1 = require("./Enrichments.js");
|
|
39
89
|
const v = __importStar(require("valibot"));
|