@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
|
@@ -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;AAE1D;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CACvC,0BAA0B,EAC1B,uBAAuB,CACxB,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CACnC,sB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;;;;;;;GAuBG;AACH,eAAO,MAAM,uBAAuB,GAClC,KAAK,OAAO,KACX,GAAG,IAAI,qBA0BT,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,mBAAmB,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,iBAsBzD,CAAA;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,kBAAkB,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,gBAMxD,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,aAAa,GAAI,cAAc,YAAY,KAAG,MAU1D,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IACE,iDAAiD;IACjD,IAAI,EAAE,WAAW,CAAA;IACjB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,kBAAkB;IAClB,MAAM,EAAE,MAAM,CAAA;CACf,GACD;IACE,6CAA6C;IAC7C,IAAI,EAAE,OAAO,CAAA;IACb,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAA;IACnB,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAA;CAChB,GACD;IACE,4CAA4C;IAC5C,IAAI,EAAE,gBAAgB,CAAA;IACtB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,gBAAgB,GAC3B,cAAc,YAAY,KACzB,kBAYF,CAAA"}
|
|
@@ -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 { isMethod } from './Method.js';
|
|
3
67
|
/**
|
package/esm/types/Manifest.d.ts
CHANGED
|
@@ -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,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,aAAa,CAAC,WAAW,CAGnD,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IACpC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IAClD,OAAO,EAAE,WAAW,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,aAAa,CAAC,eAAe,CAW3D,CAAA"}
|
package/esm/types/Manifest.js
CHANGED
|
@@ -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 { resultsItem } from './Results.js';
|
|
3
75
|
import { preview, mapping } from './Preview.js';
|
package/esm/types/Method.d.ts
CHANGED
|
@@ -1,3 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview HTTP Method System for SKMTC Core
|
|
3
|
+
*
|
|
4
|
+
* This module provides comprehensive HTTP method definitions and utilities for
|
|
5
|
+
* handling OpenAPI operations. It includes type-safe method definitions,
|
|
6
|
+
* validation utilities, and constants for all HTTP methods supported by
|
|
7
|
+
* the OpenAPI v3 specification.
|
|
8
|
+
*
|
|
9
|
+
* The module ensures type safety when working with HTTP methods throughout
|
|
10
|
+
* the SKMTC pipeline and provides utilities for method validation and processing.
|
|
11
|
+
*
|
|
12
|
+
* ## Key Features
|
|
13
|
+
*
|
|
14
|
+
* - **Complete Method Support**: All HTTP methods from OpenAPI v3 specification
|
|
15
|
+
* - **Type Safety**: Branded types and type guards for method handling
|
|
16
|
+
* - **Validation**: Runtime validation with Valibot integration
|
|
17
|
+
* - **Case Handling**: Proper case normalization for method strings
|
|
18
|
+
* - **Specification Compliance**: Full adherence to OpenAPI v3 method definitions
|
|
19
|
+
*
|
|
20
|
+
* @example Working with HTTP methods
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { Method, isMethod, methodValues } from '@skmtc/core/Method';
|
|
23
|
+
*
|
|
24
|
+
* // Type-safe method handling
|
|
25
|
+
* const method: Method = 'GET';
|
|
26
|
+
*
|
|
27
|
+
* // Validate unknown method strings
|
|
28
|
+
* const userInput = 'post';
|
|
29
|
+
* if (isMethod(userInput)) {
|
|
30
|
+
* console.log(`Valid method: ${userInput}`); // TypeScript knows it's a Method
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* // List all supported methods
|
|
34
|
+
* console.log('Supported methods:', methodValues);
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example Method validation in generators
|
|
38
|
+
* ```typescript
|
|
39
|
+
* import { isMethod, Method } from '@skmtc/core/Method';
|
|
40
|
+
*
|
|
41
|
+
* function processOperation(path: string, method: string, operation: any) {
|
|
42
|
+
* if (!isMethod(method)) {
|
|
43
|
+
* throw new Error(`Unsupported HTTP method: ${method}`);
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* // TypeScript now knows method is of type Method
|
|
47
|
+
* return generateOperationCode(path, method, operation);
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @example Case-insensitive method handling
|
|
52
|
+
* ```typescript
|
|
53
|
+
* import { normalizeMethod, isMethod } from '@skmtc/core/Method';
|
|
54
|
+
*
|
|
55
|
+
* function handleMethodString(methodStr: string) {
|
|
56
|
+
* const normalized = methodStr.toLowerCase();
|
|
57
|
+
*
|
|
58
|
+
* if (isMethod(normalized)) {
|
|
59
|
+
* return processValidMethod(normalized);
|
|
60
|
+
* } else {
|
|
61
|
+
* throw new Error(`Invalid method: ${methodStr}`);
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @module Method
|
|
67
|
+
*/
|
|
1
68
|
import "../_dnt.polyfills.js";
|
|
2
69
|
import * as v from 'valibot';
|
|
3
70
|
/**
|
|
@@ -5,6 +72,7 @@ import * as v from 'valibot';
|
|
|
5
72
|
*
|
|
6
73
|
* This constant array includes all HTTP methods that can be used
|
|
7
74
|
* in OpenAPI path operations, as defined by the OpenAPI specification.
|
|
75
|
+
* All methods are in lowercase to match OpenAPI conventions.
|
|
8
76
|
*/
|
|
9
77
|
export declare const methodValues: readonly ["get", "put", "post", "delete", "options", "head", "patch", "trace"];
|
|
10
78
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Method.d.ts","sourceRoot":"","sources":["../../src/types/Method.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Method.d.ts","sourceRoot":"","sources":["../../src/types/Method.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,OAAO,sBAAsB,CAAC;AAG9B,OAAO,K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4
|
+
* This module provides comprehensive HTTP method definitions and utilities for
|
|
5
|
+
* handling OpenAPI operations. It includes type-safe method definitions,
|
|
6
|
+
* validation utilities, and constants for all HTTP methods supported by
|
|
7
|
+
* the OpenAPI v3 specification.
|
|
8
|
+
*
|
|
9
|
+
* The module ensures type safety when working with HTTP methods throughout
|
|
10
|
+
* the SKMTC pipeline and provides utilities for method validation and processing.
|
|
11
|
+
*
|
|
12
|
+
* ## Key Features
|
|
13
|
+
*
|
|
14
|
+
* - **Complete Method Support**: All HTTP methods from OpenAPI v3 specification
|
|
15
|
+
* - **Type Safety**: Branded types and type guards for method handling
|
|
16
|
+
* - **Validation**: Runtime validation with Valibot integration
|
|
17
|
+
* - **Case Handling**: Proper case normalization for method strings
|
|
18
|
+
* - **Specification Compliance**: Full adherence to OpenAPI v3 method definitions
|
|
19
|
+
*
|
|
20
|
+
* @example Working with HTTP methods
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { Method, isMethod, methodValues } from '@skmtc/core/Method';
|
|
23
|
+
*
|
|
24
|
+
* // Type-safe method handling
|
|
25
|
+
* const method: Method = 'GET';
|
|
26
|
+
*
|
|
27
|
+
* // Validate unknown method strings
|
|
28
|
+
* const userInput = 'post';
|
|
29
|
+
* if (isMethod(userInput)) {
|
|
30
|
+
* console.log(`Valid method: ${userInput}`); // TypeScript knows it's a Method
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* // List all supported methods
|
|
34
|
+
* console.log('Supported methods:', methodValues);
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example Method validation in generators
|
|
38
|
+
* ```typescript
|
|
39
|
+
* import { isMethod, Method } from '@skmtc/core/Method';
|
|
40
|
+
*
|
|
41
|
+
* function processOperation(path: string, method: string, operation: any) {
|
|
42
|
+
* if (!isMethod(method)) {
|
|
43
|
+
* throw new Error(`Unsupported HTTP method: ${method}`);
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* // TypeScript now knows method is of type Method
|
|
47
|
+
* return generateOperationCode(path, method, operation);
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @example Case-insensitive method handling
|
|
52
|
+
* ```typescript
|
|
53
|
+
* import { normalizeMethod, isMethod } from '@skmtc/core/Method';
|
|
54
|
+
*
|
|
55
|
+
* function handleMethodString(methodStr: string) {
|
|
56
|
+
* const normalized = methodStr.toLowerCase();
|
|
57
|
+
*
|
|
58
|
+
* if (isMethod(normalized)) {
|
|
59
|
+
* return processValidMethod(normalized);
|
|
60
|
+
* } else {
|
|
61
|
+
* throw new Error(`Invalid method: ${methodStr}`);
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @module Method
|
|
67
|
+
*/
|
|
1
68
|
import "../_dnt.polyfills.js";
|
|
2
69
|
import * as v from 'valibot';
|
|
3
70
|
/**
|
|
@@ -5,6 +72,7 @@ import * as v from 'valibot';
|
|
|
5
72
|
*
|
|
6
73
|
* This constant array includes all HTTP methods that can be used
|
|
7
74
|
* in OpenAPI path operations, as defined by the OpenAPI specification.
|
|
75
|
+
* All methods are in lowercase to match OpenAPI conventions.
|
|
8
76
|
*/
|
|
9
77
|
export const methodValues = [
|
|
10
78
|
'get',
|
package/esm/types/Preview.d.ts
CHANGED
|
@@ -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,M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S,CAAC;QAClC,CAAC,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,CAAC;QACrC,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,SAAS,CAAC;KACpC,EACD,SAAS,CACV,CAAA;CACF,EACD,SAAS,CAMT,CAAA;AAEF;;;;;GAKG;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/esm/types/Preview.js
CHANGED
|
@@ -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 { method } from './Method.js';
|
|
3
78
|
import * as v from 'valibot';
|