@skmtc/core 0.0.806 → 0.0.808
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/PrettierConfig.d.ts +74 -0
- package/esm/types/PrettierConfig.d.ts.map +1 -1
- package/esm/types/PrettierConfig.js +74 -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/Results.d.ts +97 -0
- package/esm/types/Results.d.ts.map +1 -1
- package/esm/types/Results.js +97 -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/PrettierConfig.d.ts +74 -0
- package/script/types/PrettierConfig.d.ts.map +1 -1
- package/script/types/PrettierConfig.js +74 -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/Results.d.ts +97 -0
- package/script/types/Results.d.ts.map +1 -1
- package/script/types/Results.js +97 -0
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,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Results and Status Tracking System for SKMTC Core
|
|
3
|
+
*
|
|
4
|
+
* This module provides comprehensive result tracking and status management for
|
|
5
|
+
* the SKMTC code generation pipeline. It includes hierarchical result structures,
|
|
6
|
+
* type-safe status definitions, and validation schemas for tracking the outcomes
|
|
7
|
+
* of parsing, generation, and rendering operations.
|
|
8
|
+
*
|
|
9
|
+
* The results system enables detailed reporting and error handling throughout
|
|
10
|
+
* the pipeline, supporting nested result structures for complex operations
|
|
11
|
+
* and comprehensive status categorization.
|
|
12
|
+
*
|
|
13
|
+
* ## Key Features
|
|
14
|
+
*
|
|
15
|
+
* - **Hierarchical Results**: Nested result structures for complex operations
|
|
16
|
+
* - **Status Categories**: Complete coverage of operation outcomes (success, warning, error, etc.)
|
|
17
|
+
* - **Type Safety**: Full TypeScript typing with Valibot validation
|
|
18
|
+
* - **Recursive Support**: Lazy evaluation for deeply nested result structures
|
|
19
|
+
* - **Pipeline Integration**: Direct integration with SKMTC processing contexts
|
|
20
|
+
*
|
|
21
|
+
* @example Basic result tracking
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import type { ResultType, ResultsItem } from '@skmtc/core/Results';
|
|
24
|
+
*
|
|
25
|
+
* const operationResult: ResultType = 'success';
|
|
26
|
+
* const errorResult: ResultType = 'error';
|
|
27
|
+
*
|
|
28
|
+
* const results: ResultsItem = {
|
|
29
|
+
* parsing: 'success',
|
|
30
|
+
* generation: 'warning',
|
|
31
|
+
* rendering: 'success'
|
|
32
|
+
* };
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Hierarchical result structures
|
|
36
|
+
* ```typescript
|
|
37
|
+
* import type { ResultsItem } from '@skmtc/core/Results';
|
|
38
|
+
*
|
|
39
|
+
* const complexResults: ResultsItem = {
|
|
40
|
+
* parsing: {
|
|
41
|
+
* schemas: 'success',
|
|
42
|
+
* operations: {
|
|
43
|
+
* userApi: 'success',
|
|
44
|
+
* productApi: 'warning',
|
|
45
|
+
* orderApi: 'error'
|
|
46
|
+
* }
|
|
47
|
+
* },
|
|
48
|
+
* generation: [
|
|
49
|
+
* { models: 'success' },
|
|
50
|
+
* { services: 'warning' },
|
|
51
|
+
* null // Skipped operation
|
|
52
|
+
* ]
|
|
53
|
+
* };
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @example Result validation
|
|
57
|
+
* ```typescript
|
|
58
|
+
* import { resultsItem, resultType, ResultsItem } from '@skmtc/core/Results';
|
|
59
|
+
* import * as v from 'valibot';
|
|
60
|
+
*
|
|
61
|
+
* function validateResults(data: unknown): ResultsItem {
|
|
62
|
+
* return v.parse(resultsItem, data);
|
|
63
|
+
* }
|
|
64
|
+
*
|
|
65
|
+
* function validateResultType(status: unknown): ResultType {
|
|
66
|
+
* return v.parse(resultType, status);
|
|
67
|
+
* }
|
|
68
|
+
*
|
|
69
|
+
* // Usage
|
|
70
|
+
* const results = validateResults({
|
|
71
|
+
* operation: 'success',
|
|
72
|
+
* nested: {
|
|
73
|
+
* subOperation: 'warning'
|
|
74
|
+
* }
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @example Error filtering
|
|
79
|
+
* ```typescript
|
|
80
|
+
* import type { ResultType, WarningError } from '@skmtc/core/Results';
|
|
81
|
+
*
|
|
82
|
+
* function hasIssues(result: ResultType): result is WarningError {
|
|
83
|
+
* return result === 'warning' || result === 'error';
|
|
84
|
+
* }
|
|
85
|
+
*
|
|
86
|
+
* function processResults(results: Record<string, ResultType>) {
|
|
87
|
+
* const issues = Object.entries(results)
|
|
88
|
+
* .filter(([, status]) => hasIssues(status));
|
|
89
|
+
*
|
|
90
|
+
* if (issues.length > 0) {
|
|
91
|
+
* console.log('Operations with issues:', issues);
|
|
92
|
+
* }
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @module Results
|
|
97
|
+
*/
|
|
1
98
|
import "../_dnt.polyfills.js";
|
|
2
99
|
import * as v from 'valibot';
|
|
3
100
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Results.d.ts","sourceRoot":"","sources":["../../src/types/Results.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Results.d.ts","sourceRoot":"","sources":["../../src/types/Results.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgGG;AACH,OAAO,sBAAsB,CAAC;AAG9B,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,cAAc,CAAA;AAErF;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,CAAA;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,aAAa,CAAC,UAAU,CAMjD,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,+DAA+D;IAC/D,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CACpE;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,aAAa,CAAC,WAAW,CAGpD,CAAA"}
|
package/script/types/Results.js
CHANGED
|
@@ -34,6 +34,103 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.resultsItem = exports.resultType = void 0;
|
|
37
|
+
/**
|
|
38
|
+
* @fileoverview Results and Status Tracking System for SKMTC Core
|
|
39
|
+
*
|
|
40
|
+
* This module provides comprehensive result tracking and status management for
|
|
41
|
+
* the SKMTC code generation pipeline. It includes hierarchical result structures,
|
|
42
|
+
* type-safe status definitions, and validation schemas for tracking the outcomes
|
|
43
|
+
* of parsing, generation, and rendering operations.
|
|
44
|
+
*
|
|
45
|
+
* The results system enables detailed reporting and error handling throughout
|
|
46
|
+
* the pipeline, supporting nested result structures for complex operations
|
|
47
|
+
* and comprehensive status categorization.
|
|
48
|
+
*
|
|
49
|
+
* ## Key Features
|
|
50
|
+
*
|
|
51
|
+
* - **Hierarchical Results**: Nested result structures for complex operations
|
|
52
|
+
* - **Status Categories**: Complete coverage of operation outcomes (success, warning, error, etc.)
|
|
53
|
+
* - **Type Safety**: Full TypeScript typing with Valibot validation
|
|
54
|
+
* - **Recursive Support**: Lazy evaluation for deeply nested result structures
|
|
55
|
+
* - **Pipeline Integration**: Direct integration with SKMTC processing contexts
|
|
56
|
+
*
|
|
57
|
+
* @example Basic result tracking
|
|
58
|
+
* ```typescript
|
|
59
|
+
* import type { ResultType, ResultsItem } from '@skmtc/core/Results';
|
|
60
|
+
*
|
|
61
|
+
* const operationResult: ResultType = 'success';
|
|
62
|
+
* const errorResult: ResultType = 'error';
|
|
63
|
+
*
|
|
64
|
+
* const results: ResultsItem = {
|
|
65
|
+
* parsing: 'success',
|
|
66
|
+
* generation: 'warning',
|
|
67
|
+
* rendering: 'success'
|
|
68
|
+
* };
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @example Hierarchical result structures
|
|
72
|
+
* ```typescript
|
|
73
|
+
* import type { ResultsItem } from '@skmtc/core/Results';
|
|
74
|
+
*
|
|
75
|
+
* const complexResults: ResultsItem = {
|
|
76
|
+
* parsing: {
|
|
77
|
+
* schemas: 'success',
|
|
78
|
+
* operations: {
|
|
79
|
+
* userApi: 'success',
|
|
80
|
+
* productApi: 'warning',
|
|
81
|
+
* orderApi: 'error'
|
|
82
|
+
* }
|
|
83
|
+
* },
|
|
84
|
+
* generation: [
|
|
85
|
+
* { models: 'success' },
|
|
86
|
+
* { services: 'warning' },
|
|
87
|
+
* null // Skipped operation
|
|
88
|
+
* ]
|
|
89
|
+
* };
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @example Result validation
|
|
93
|
+
* ```typescript
|
|
94
|
+
* import { resultsItem, resultType, ResultsItem } from '@skmtc/core/Results';
|
|
95
|
+
* import * as v from 'valibot';
|
|
96
|
+
*
|
|
97
|
+
* function validateResults(data: unknown): ResultsItem {
|
|
98
|
+
* return v.parse(resultsItem, data);
|
|
99
|
+
* }
|
|
100
|
+
*
|
|
101
|
+
* function validateResultType(status: unknown): ResultType {
|
|
102
|
+
* return v.parse(resultType, status);
|
|
103
|
+
* }
|
|
104
|
+
*
|
|
105
|
+
* // Usage
|
|
106
|
+
* const results = validateResults({
|
|
107
|
+
* operation: 'success',
|
|
108
|
+
* nested: {
|
|
109
|
+
* subOperation: 'warning'
|
|
110
|
+
* }
|
|
111
|
+
* });
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @example Error filtering
|
|
115
|
+
* ```typescript
|
|
116
|
+
* import type { ResultType, WarningError } from '@skmtc/core/Results';
|
|
117
|
+
*
|
|
118
|
+
* function hasIssues(result: ResultType): result is WarningError {
|
|
119
|
+
* return result === 'warning' || result === 'error';
|
|
120
|
+
* }
|
|
121
|
+
*
|
|
122
|
+
* function processResults(results: Record<string, ResultType>) {
|
|
123
|
+
* const issues = Object.entries(results)
|
|
124
|
+
* .filter(([, status]) => hasIssues(status));
|
|
125
|
+
*
|
|
126
|
+
* if (issues.length > 0) {
|
|
127
|
+
* console.log('Operations with issues:', issues);
|
|
128
|
+
* }
|
|
129
|
+
* }
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @module Results
|
|
133
|
+
*/
|
|
37
134
|
require("../_dnt.polyfills.js");
|
|
38
135
|
const v = __importStar(require("valibot"));
|
|
39
136
|
/**
|