@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.
Files changed (43) hide show
  1. package/esm/helpers/toResolvedArtifactPath.d.ts +64 -0
  2. package/esm/helpers/toResolvedArtifactPath.d.ts.map +1 -1
  3. package/esm/helpers/toResolvedArtifactPath.js +61 -0
  4. package/esm/types/EnrichmentRequest.d.ts +62 -0
  5. package/esm/types/EnrichmentRequest.d.ts.map +1 -1
  6. package/esm/types/EnrichmentRequest.js +53 -0
  7. package/esm/types/GeneratorKeys.d.ts +64 -0
  8. package/esm/types/GeneratorKeys.d.ts.map +1 -1
  9. package/esm/types/GeneratorKeys.js +64 -0
  10. package/esm/types/Manifest.d.ts +72 -0
  11. package/esm/types/Manifest.d.ts.map +1 -1
  12. package/esm/types/Manifest.js +72 -0
  13. package/esm/types/Method.d.ts +68 -0
  14. package/esm/types/Method.d.ts.map +1 -1
  15. package/esm/types/Method.js +68 -0
  16. package/esm/types/Preview.d.ts +75 -0
  17. package/esm/types/Preview.d.ts.map +1 -1
  18. package/esm/types/Preview.js +75 -0
  19. package/esm/types/RefName.d.ts +70 -0
  20. package/esm/types/RefName.d.ts.map +1 -1
  21. package/esm/types/RefName.js +70 -0
  22. package/package.json +1 -1
  23. package/script/helpers/toResolvedArtifactPath.d.ts +64 -0
  24. package/script/helpers/toResolvedArtifactPath.d.ts.map +1 -1
  25. package/script/helpers/toResolvedArtifactPath.js +61 -0
  26. package/script/types/EnrichmentRequest.d.ts +62 -0
  27. package/script/types/EnrichmentRequest.d.ts.map +1 -1
  28. package/script/types/EnrichmentRequest.js +53 -0
  29. package/script/types/GeneratorKeys.d.ts +64 -0
  30. package/script/types/GeneratorKeys.d.ts.map +1 -1
  31. package/script/types/GeneratorKeys.js +64 -0
  32. package/script/types/Manifest.d.ts +72 -0
  33. package/script/types/Manifest.d.ts.map +1 -1
  34. package/script/types/Manifest.js +72 -0
  35. package/script/types/Method.d.ts +68 -0
  36. package/script/types/Method.d.ts.map +1 -1
  37. package/script/types/Method.js +68 -0
  38. package/script/types/Preview.d.ts +75 -0
  39. package/script/types/Preview.d.ts.map +1 -1
  40. package/script/types/Preview.js +75 -0
  41. package/script/types/RefName.d.ts +70 -0
  42. package/script/types/RefName.d.ts.map +1 -1
  43. package/script/types/RefName.js +70 -0
@@ -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 const methodValues = [
10
78
  'get',
@@ -1,3 +1,78 @@
1
+ /**
2
+ * @fileoverview Preview and Mapping System for SKMTC Core
3
+ *
4
+ * This module provides comprehensive types and utilities for creating preview
5
+ * interfaces and mapping configurations for generated code. The preview system
6
+ * enables interactive demonstrations of generated APIs, forms, tables, and
7
+ * other UI components within development tools and documentation.
8
+ *
9
+ * The mapping system provides metadata about how OpenAPI operations and models
10
+ * translate to generated code, enabling rich tooling experiences and
11
+ * reverse-engineering capabilities.
12
+ *
13
+ * ## Key Features
14
+ *
15
+ * - **Interactive Previews**: Rich preview interfaces for generated components
16
+ * - **Source Mapping**: Traceability from generated code back to OpenAPI sources
17
+ * - **UI Grouping**: Organized grouping of related UI components (forms, tables, inputs)
18
+ * - **Generator Integration**: Deep integration with the generator pipeline
19
+ * - **Type Safety**: Comprehensive validation and type safety throughout
20
+ *
21
+ * @example Creating operation previews
22
+ * ```typescript
23
+ * import type { PreviewModule, OperationSource } from '@skmtc/core/Preview';
24
+ *
25
+ * const operationSource: OperationSource = {
26
+ * type: 'operation',
27
+ * generatorId: 'react-forms',
28
+ * operationPath: '/users',
29
+ * operationMethod: 'POST'
30
+ * };
31
+ *
32
+ * const preview: PreviewModule = {
33
+ * title: 'Create User Form',
34
+ * description: 'Interactive form for creating new users',
35
+ * group: 'forms',
36
+ * source: operationSource,
37
+ * moduleName: 'CreateUserForm',
38
+ * exportName: 'default'
39
+ * };
40
+ * ```
41
+ *
42
+ * @example Creating model previews
43
+ * ```typescript
44
+ * import type { PreviewModule, ModelSource } from '@skmtc/core/Preview';
45
+ *
46
+ * const modelSource: ModelSource = {
47
+ * type: 'model',
48
+ * generatorId: 'typescript-types',
49
+ * refName: 'User'
50
+ * };
51
+ *
52
+ * const preview: PreviewModule = {
53
+ * title: 'User Type Definition',
54
+ * description: 'TypeScript interface for User model',
55
+ * group: 'tables',
56
+ * source: modelSource,
57
+ * moduleName: 'UserTypes',
58
+ * exportName: 'User'
59
+ * };
60
+ * ```
61
+ *
62
+ * @example Working with mappings
63
+ * ```typescript
64
+ * import type { MappingModule } from '@skmtc/core/Preview';
65
+ *
66
+ * const mapping: MappingModule = {
67
+ * source: operationSource,
68
+ * moduleName: 'UserApi',
69
+ * exportName: 'createUser',
70
+ * generatedPath: './src/generated/UserApi.ts'
71
+ * };
72
+ * ```
73
+ *
74
+ * @module Preview
75
+ */
1
76
  import "../_dnt.polyfills.js";
2
77
  import { type Method } from './Method.js';
3
78
  import * as v from 'valibot';
@@ -1 +1 @@
1
- {"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../src/types/Preview.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,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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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"}
@@ -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';
@@ -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;AAC9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA"}
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"}
@@ -1 +1,71 @@
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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.0.806",
3
+ "version": "0.0.807",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/skmtc/skmtc.git"
@@ -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;AAG9B;;GAEG;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
+ {"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;AAC9B,OAAO,KAAK,KAAK,CAAC,MAAM,SAAS,CAAA;AAEjC,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
+ {"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"}