@skmtc/core 0.0.806 → 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/toResolvedArtifactPath.d.ts +64 -0
- package/esm/helpers/toResolvedArtifactPath.d.ts.map +1 -1
- package/esm/helpers/toResolvedArtifactPath.js +61 -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/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/package.json +1 -1
- 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/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/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/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");
|