@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/esm/types/Results.js
CHANGED
|
@@ -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
|
/**
|
package/package.json
CHANGED
|
@@ -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,5 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Enrichment Request System for SKMTC Core
|
|
3
|
+
*
|
|
4
|
+
* This module provides types for handling enrichment requests within the SKMTC
|
|
5
|
+
* code generation pipeline. Enrichment requests allow generators to request
|
|
6
|
+
* additional metadata and context about operations, schemas, and other OpenAPI
|
|
7
|
+
* elements to enhance code generation with richer functionality.
|
|
8
|
+
*
|
|
9
|
+
* The enrichment system enables generators to ask for specific data transformations,
|
|
10
|
+
* UI component configurations, validation rules, and other metadata that can be
|
|
11
|
+
* applied during the generation process to create more sophisticated output.
|
|
12
|
+
*
|
|
13
|
+
* ## Key Features
|
|
14
|
+
*
|
|
15
|
+
* - **Type-Safe Requests**: Generic typing ensures enrichment data matches expected schema
|
|
16
|
+
* - **Flexible Content**: Support for any content type that needs enrichment
|
|
17
|
+
* - **Schema Validation**: Valibot integration for runtime validation of enrichment data
|
|
18
|
+
* - **Generator Integration**: Seamless integration with the generator pipeline
|
|
19
|
+
*
|
|
20
|
+
* @example Creating an enrichment request
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { EnrichmentRequest } from '@skmtc/core/EnrichmentRequest';
|
|
23
|
+
* import * as v from 'valibot';
|
|
24
|
+
*
|
|
25
|
+
* const formEnrichmentSchema = v.object({
|
|
26
|
+
* title: v.string(),
|
|
27
|
+
* fields: v.array(v.object({
|
|
28
|
+
* name: v.string(),
|
|
29
|
+
* type: v.string(),
|
|
30
|
+
* required: v.boolean()
|
|
31
|
+
* }))
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* const request: EnrichmentRequest<typeof formEnrichmentSchema> = {
|
|
35
|
+
* prompt: 'Generate form metadata for user registration',
|
|
36
|
+
* enrichmentSchema: formEnrichmentSchema,
|
|
37
|
+
* content: JSON.stringify({ operationId: 'createUser', method: 'POST' })
|
|
38
|
+
* };
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example Processing enrichment in generators
|
|
42
|
+
* ```typescript
|
|
43
|
+
* function processEnrichment<T>(request: EnrichmentRequest<T>) {
|
|
44
|
+
* // Validate the enrichment data against the schema
|
|
45
|
+
* const enrichmentData = v.parse(request.enrichmentSchema, someData);
|
|
46
|
+
*
|
|
47
|
+
* // Use the enrichment data to enhance generation
|
|
48
|
+
* return generateEnhancedContent(request.content, enrichmentData);
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @module EnrichmentRequest
|
|
53
|
+
*/
|
|
1
54
|
import "../_dnt.polyfills.js";
|
|
2
55
|
import type * as v from 'valibot';
|
|
56
|
+
/**
|
|
57
|
+
* Represents a request for enrichment data during code generation.
|
|
58
|
+
*
|
|
59
|
+
* Enrichment requests allow generators to specify what additional metadata
|
|
60
|
+
* they need for generating enhanced code artifacts. The request includes
|
|
61
|
+
* a schema for validation and the content that needs enrichment.
|
|
62
|
+
*
|
|
63
|
+
* @template EnrichmentType - The type of enrichment data being requested
|
|
64
|
+
*/
|
|
3
65
|
export type EnrichmentRequest<EnrichmentType = undefined> = {
|
|
4
66
|
prompt: string;
|
|
5
67
|
enrichmentSchema: v.BaseSchema<EnrichmentType, EnrichmentType, v.BaseIssue<unknown>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnrichmentRequest.d.ts","sourceRoot":"","sources":["../../src/types/EnrichmentRequest.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"EnrichmentRequest.d.ts","sourceRoot":"","sources":["../../src/types/EnrichmentRequest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,OAAO,sBAAsB,CAAC;AAG9B,OAAO,KAAK,KAAK,CAAC,MAAM,SAAS,CAAA;AAEjC;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,CAAC,cAAc,GAAG,SAAS,IAAI;IAC1D,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,EAAE,CAAC,CAAC,UAAU,CAAC,cAAc,EAAE,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACpF,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA"}
|
|
@@ -1,3 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Enrichment Request System for SKMTC Core
|
|
5
|
+
*
|
|
6
|
+
* This module provides types for handling enrichment requests within the SKMTC
|
|
7
|
+
* code generation pipeline. Enrichment requests allow generators to request
|
|
8
|
+
* additional metadata and context about operations, schemas, and other OpenAPI
|
|
9
|
+
* elements to enhance code generation with richer functionality.
|
|
10
|
+
*
|
|
11
|
+
* The enrichment system enables generators to ask for specific data transformations,
|
|
12
|
+
* UI component configurations, validation rules, and other metadata that can be
|
|
13
|
+
* applied during the generation process to create more sophisticated output.
|
|
14
|
+
*
|
|
15
|
+
* ## Key Features
|
|
16
|
+
*
|
|
17
|
+
* - **Type-Safe Requests**: Generic typing ensures enrichment data matches expected schema
|
|
18
|
+
* - **Flexible Content**: Support for any content type that needs enrichment
|
|
19
|
+
* - **Schema Validation**: Valibot integration for runtime validation of enrichment data
|
|
20
|
+
* - **Generator Integration**: Seamless integration with the generator pipeline
|
|
21
|
+
*
|
|
22
|
+
* @example Creating an enrichment request
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { EnrichmentRequest } from '@skmtc/core/EnrichmentRequest';
|
|
25
|
+
* import * as v from 'valibot';
|
|
26
|
+
*
|
|
27
|
+
* const formEnrichmentSchema = v.object({
|
|
28
|
+
* title: v.string(),
|
|
29
|
+
* fields: v.array(v.object({
|
|
30
|
+
* name: v.string(),
|
|
31
|
+
* type: v.string(),
|
|
32
|
+
* required: v.boolean()
|
|
33
|
+
* }))
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* const request: EnrichmentRequest<typeof formEnrichmentSchema> = {
|
|
37
|
+
* prompt: 'Generate form metadata for user registration',
|
|
38
|
+
* enrichmentSchema: formEnrichmentSchema,
|
|
39
|
+
* content: JSON.stringify({ operationId: 'createUser', method: 'POST' })
|
|
40
|
+
* };
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example Processing enrichment in generators
|
|
44
|
+
* ```typescript
|
|
45
|
+
* function processEnrichment<T>(request: EnrichmentRequest<T>) {
|
|
46
|
+
* // Validate the enrichment data against the schema
|
|
47
|
+
* const enrichmentData = v.parse(request.enrichmentSchema, someData);
|
|
48
|
+
*
|
|
49
|
+
* // Use the enrichment data to enhance generation
|
|
50
|
+
* return generateEnhancedContent(request.content, enrichmentData);
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @module EnrichmentRequest
|
|
55
|
+
*/
|
|
3
56
|
require("../_dnt.polyfills.js");
|
|
@@ -1,3 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Generator Key System for SKMTC Core
|
|
3
|
+
*
|
|
4
|
+
* This module provides a comprehensive type-safe key system for identifying and
|
|
5
|
+
* organizing generated content within the SKMTC pipeline. Generator keys provide
|
|
6
|
+
* unique identification for operations, models, and other generated artifacts,
|
|
7
|
+
* ensuring proper organization and preventing collisions.
|
|
8
|
+
*
|
|
9
|
+
* The key system uses branded types to ensure type safety and provides utilities
|
|
10
|
+
* for creating, parsing, and manipulating keys throughout the generation process.
|
|
11
|
+
*
|
|
12
|
+
* ## Key Features
|
|
13
|
+
*
|
|
14
|
+
* - **Type Safety**: Branded types prevent mixing different kinds of keys
|
|
15
|
+
* - **Unique Identification**: Composite keys ensure global uniqueness
|
|
16
|
+
* - **Parsing Utilities**: Safe extraction of components from composite keys
|
|
17
|
+
* - **Generator Organization**: Clear mapping between generators and their artifacts
|
|
18
|
+
* - **Reference Integration**: Seamless integration with OpenAPI reference system
|
|
19
|
+
*
|
|
20
|
+
* @example Creating operation generator keys
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { toOperationGeneratorKey, parseOperationGeneratorKey } from '@skmtc/core/GeneratorKeys';
|
|
23
|
+
*
|
|
24
|
+
* // Create a key for a GET /users operation in api-client generator
|
|
25
|
+
* const key = toOperationGeneratorKey({
|
|
26
|
+
* generatorId: 'api-client',
|
|
27
|
+
* path: '/users',
|
|
28
|
+
* method: 'GET'
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* // Parse the key back into components
|
|
32
|
+
* const parsed = parseOperationGeneratorKey(key);
|
|
33
|
+
* console.log(parsed); // { generatorId: 'api-client', path: '/users', method: 'GET' }
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example Working with model keys
|
|
37
|
+
* ```typescript
|
|
38
|
+
* import { toModelGeneratorKey } from '@skmtc/core/GeneratorKeys';
|
|
39
|
+
*
|
|
40
|
+
* const modelKey = toModelGeneratorKey({
|
|
41
|
+
* generatorId: 'typescript-models',
|
|
42
|
+
* refName: 'User' as RefName
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example Type-safe key handling
|
|
47
|
+
* ```typescript
|
|
48
|
+
* import type { OperationGeneratorKey, ModelGeneratorKey } from '@skmtc/core/GeneratorKeys';
|
|
49
|
+
*
|
|
50
|
+
* function handleOperationKey(key: OperationGeneratorKey) {
|
|
51
|
+
* // TypeScript ensures this is specifically an operation key
|
|
52
|
+
* const parsed = parseOperationGeneratorKey(key);
|
|
53
|
+
* return `Processing ${parsed.method} ${parsed.path}`;
|
|
54
|
+
* }
|
|
55
|
+
*
|
|
56
|
+
* function handleModelKey(key: ModelGeneratorKey) {
|
|
57
|
+
* // TypeScript ensures this is specifically a model key
|
|
58
|
+
* const parsed = parseModelGeneratorKey(key);
|
|
59
|
+
* return `Processing model ${parsed.refName}`;
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @module GeneratorKeys
|
|
64
|
+
*/
|
|
1
65
|
import "../_dnt.polyfills.js";
|
|
2
66
|
import type { OasOperation } from '../oas/operation/Operation.js';
|
|
3
67
|
import type { Brand } from './Brand.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeneratorKeys.d.ts","sourceRoot":"","sources":["../../src/types/GeneratorKeys.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"GeneratorKeys.d.ts","sourceRoot":"","sources":["../../src/types/GeneratorKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,OAAO,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,aAAa,CAAA;AAEnD;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAA;AAExE;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAA;AAE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use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fromGeneratorKey = exports.toGeneratorId = exports.isGeneratorOnlyKey = exports.isModelGeneratorKey = exports.isOperationGeneratorKey = exports.isGeneratorKey = exports.toGeneratorOnlyKey = exports.toModelGeneratorKey = exports.toOperationGeneratorKey = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @fileoverview Generator Key System for SKMTC Core
|
|
6
|
+
*
|
|
7
|
+
* This module provides a comprehensive type-safe key system for identifying and
|
|
8
|
+
* organizing generated content within the SKMTC pipeline. Generator keys provide
|
|
9
|
+
* unique identification for operations, models, and other generated artifacts,
|
|
10
|
+
* ensuring proper organization and preventing collisions.
|
|
11
|
+
*
|
|
12
|
+
* The key system uses branded types to ensure type safety and provides utilities
|
|
13
|
+
* for creating, parsing, and manipulating keys throughout the generation process.
|
|
14
|
+
*
|
|
15
|
+
* ## Key Features
|
|
16
|
+
*
|
|
17
|
+
* - **Type Safety**: Branded types prevent mixing different kinds of keys
|
|
18
|
+
* - **Unique Identification**: Composite keys ensure global uniqueness
|
|
19
|
+
* - **Parsing Utilities**: Safe extraction of components from composite keys
|
|
20
|
+
* - **Generator Organization**: Clear mapping between generators and their artifacts
|
|
21
|
+
* - **Reference Integration**: Seamless integration with OpenAPI reference system
|
|
22
|
+
*
|
|
23
|
+
* @example Creating operation generator keys
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { toOperationGeneratorKey, parseOperationGeneratorKey } from '@skmtc/core/GeneratorKeys';
|
|
26
|
+
*
|
|
27
|
+
* // Create a key for a GET /users operation in api-client generator
|
|
28
|
+
* const key = toOperationGeneratorKey({
|
|
29
|
+
* generatorId: 'api-client',
|
|
30
|
+
* path: '/users',
|
|
31
|
+
* method: 'GET'
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* // Parse the key back into components
|
|
35
|
+
* const parsed = parseOperationGeneratorKey(key);
|
|
36
|
+
* console.log(parsed); // { generatorId: 'api-client', path: '/users', method: 'GET' }
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example Working with model keys
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { toModelGeneratorKey } from '@skmtc/core/GeneratorKeys';
|
|
42
|
+
*
|
|
43
|
+
* const modelKey = toModelGeneratorKey({
|
|
44
|
+
* generatorId: 'typescript-models',
|
|
45
|
+
* refName: 'User' as RefName
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example Type-safe key handling
|
|
50
|
+
* ```typescript
|
|
51
|
+
* import type { OperationGeneratorKey, ModelGeneratorKey } from '@skmtc/core/GeneratorKeys';
|
|
52
|
+
*
|
|
53
|
+
* function handleOperationKey(key: OperationGeneratorKey) {
|
|
54
|
+
* // TypeScript ensures this is specifically an operation key
|
|
55
|
+
* const parsed = parseOperationGeneratorKey(key);
|
|
56
|
+
* return `Processing ${parsed.method} ${parsed.path}`;
|
|
57
|
+
* }
|
|
58
|
+
*
|
|
59
|
+
* function handleModelKey(key: ModelGeneratorKey) {
|
|
60
|
+
* // TypeScript ensures this is specifically a model key
|
|
61
|
+
* const parsed = parseModelGeneratorKey(key);
|
|
62
|
+
* return `Processing model ${parsed.refName}`;
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @module GeneratorKeys
|
|
67
|
+
*/
|
|
4
68
|
require("../_dnt.polyfills.js");
|
|
5
69
|
const Method_js_1 = require("./Method.js");
|
|
6
70
|
/**
|
|
@@ -1,3 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Generation Manifest System for SKMTC Core
|
|
3
|
+
*
|
|
4
|
+
* This module provides comprehensive manifest generation for tracking and organizing
|
|
5
|
+
* all artifacts produced during the SKMTC code generation process. The manifest
|
|
6
|
+
* system captures metadata about generated files, including size metrics, locations,
|
|
7
|
+
* preview information, and generation statistics.
|
|
8
|
+
*
|
|
9
|
+
* Manifests serve as a complete inventory of generated content, enabling tools,
|
|
10
|
+
* IDEs, and other systems to understand what was generated and how to interact
|
|
11
|
+
* with the generated code.
|
|
12
|
+
*
|
|
13
|
+
* ## Key Features
|
|
14
|
+
*
|
|
15
|
+
* - **File Tracking**: Complete inventory of all generated files with metrics
|
|
16
|
+
* - **Size Analytics**: Line counts, character counts, and size statistics
|
|
17
|
+
* - **Preview Integration**: Rich preview metadata for UI generation
|
|
18
|
+
* - **Generation Stats**: Detailed metrics about the generation process
|
|
19
|
+
* - **Type Safety**: Comprehensive validation with Valibot schemas
|
|
20
|
+
*
|
|
21
|
+
* @example Creating a manifest entry
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import type { ManifestEntry } from '@skmtc/core/Manifest';
|
|
24
|
+
*
|
|
25
|
+
* const entry: ManifestEntry = {
|
|
26
|
+
* lines: 150,
|
|
27
|
+
* characters: 4200,
|
|
28
|
+
* destinationPath: './src/generated/UserApi.ts'
|
|
29
|
+
* };
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example Processing manifest content
|
|
33
|
+
* ```typescript
|
|
34
|
+
* import type { ManifestContent } from '@skmtc/core/Manifest';
|
|
35
|
+
*
|
|
36
|
+
* const manifest: ManifestContent = {
|
|
37
|
+
* files: {
|
|
38
|
+
* 'UserApi.ts': {
|
|
39
|
+
* lines: 150,
|
|
40
|
+
* characters: 4200,
|
|
41
|
+
* destinationPath: './src/generated/UserApi.ts'
|
|
42
|
+
* }
|
|
43
|
+
* },
|
|
44
|
+
* stats: {
|
|
45
|
+
* totalFiles: 1,
|
|
46
|
+
* totalLines: 150,
|
|
47
|
+
* totalCharacters: 4200,
|
|
48
|
+
* generatedAt: new Date().toISOString()
|
|
49
|
+
* },
|
|
50
|
+
* previews: [],
|
|
51
|
+
* mappings: []
|
|
52
|
+
* };
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @example Using manifest for tooling
|
|
56
|
+
* ```typescript
|
|
57
|
+
* function analyzeGeneration(manifest: ManifestContent) {
|
|
58
|
+
* const fileCount = Object.keys(manifest.files).length;
|
|
59
|
+
* const totalSize = Object.values(manifest.files)
|
|
60
|
+
* .reduce((sum, file) => sum + file.characters, 0);
|
|
61
|
+
*
|
|
62
|
+
* console.log(`Generated ${fileCount} files with ${totalSize} characters`);
|
|
63
|
+
*
|
|
64
|
+
* // Process previews for UI generation
|
|
65
|
+
* manifest.previews.forEach(preview => {
|
|
66
|
+
* console.log(`Preview available: ${preview.title}`);
|
|
67
|
+
* });
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @module Manifest
|
|
72
|
+
*/
|
|
1
73
|
import "../_dnt.polyfills.js";
|
|
2
74
|
import { type ResultsItem } from './Results.js';
|
|
3
75
|
import { type Preview, type Mapping } from './Preview.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Manifest.d.ts","sourceRoot":"","sources":["../../src/types/Manifest.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Manifest.d.ts","sourceRoot":"","sources":["../../src/types/Manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,OAAO,sBAAsB,CAAC;AAG9B,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,EAAW,KAAK,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,cAAc,CAAA;AAC3E,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,aAAa,CAAC,aAAa,CAIvD,CAAA;AAEF,MAAM,MAAM,WAAW,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