@skmtc/core 0.0.782 → 0.0.783

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/context/CoreContext.d.ts +175 -0
  2. package/esm/context/CoreContext.d.ts.map +1 -1
  3. package/esm/context/CoreContext.js +178 -0
  4. package/esm/dsl/ContentBase.d.ts +115 -0
  5. package/esm/dsl/ContentBase.d.ts.map +1 -1
  6. package/esm/dsl/ContentBase.js +110 -0
  7. package/esm/helpers/strings.d.ts +63 -0
  8. package/esm/helpers/strings.d.ts.map +1 -1
  9. package/esm/helpers/strings.js +59 -0
  10. package/esm/mod.d.ts +66 -0
  11. package/esm/mod.d.ts.map +1 -1
  12. package/esm/mod.js +66 -0
  13. package/esm/run/toArtifacts.d.ts +114 -0
  14. package/esm/run/toArtifacts.d.ts.map +1 -1
  15. package/esm/run/toArtifacts.js +86 -0
  16. package/esm/types/Settings.d.ts +129 -0
  17. package/esm/types/Settings.d.ts.map +1 -1
  18. package/esm/types/Settings.js +3 -0
  19. package/esm/typescript/List.d.ts +111 -0
  20. package/esm/typescript/List.d.ts.map +1 -1
  21. package/esm/typescript/List.js +106 -0
  22. package/package.json +1 -1
  23. package/script/context/CoreContext.d.ts +175 -0
  24. package/script/context/CoreContext.d.ts.map +1 -1
  25. package/script/context/CoreContext.js +178 -0
  26. package/script/dsl/ContentBase.d.ts +115 -0
  27. package/script/dsl/ContentBase.d.ts.map +1 -1
  28. package/script/dsl/ContentBase.js +110 -0
  29. package/script/helpers/strings.d.ts +63 -0
  30. package/script/helpers/strings.d.ts.map +1 -1
  31. package/script/helpers/strings.js +59 -0
  32. package/script/mod.d.ts +66 -0
  33. package/script/mod.d.ts.map +1 -1
  34. package/script/mod.js +66 -0
  35. package/script/run/toArtifacts.d.ts +114 -0
  36. package/script/run/toArtifacts.d.ts.map +1 -1
  37. package/script/run/toArtifacts.js +86 -0
  38. package/script/types/Settings.d.ts +129 -0
  39. package/script/types/Settings.d.ts.map +1 -1
  40. package/script/types/Settings.js +3 -0
  41. package/script/typescript/List.d.ts +111 -0
  42. package/script/typescript/List.d.ts.map +1 -1
  43. package/script/typescript/List.js +106 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../src/types/Settings.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAwB,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAClF,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,aAAa,CAAA;AAEjD,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,aAAa,CAAC,aAAa,CAGvD,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,CAAC,CAAC,aAAa,CAAC,SAAS,CAAyC,CAAA;AAE1F,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,cAAc,CAAmC,CAAA;AAE9F,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,aAAa,CAAC,UAAU,CAA6C,CAAA;AAIhG,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,cAAc,CAKzD,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;AAEhD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;AAEjD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAEtD,MAAM,MAAM,IAAI,GAAG,cAAc,GAAG,UAAU,GAAG,MAAM,CAAA;AAEvD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,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,EAAE,MAAM,EAAE,CAAC,CAAA;AAEhD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;AAEjD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAEtD;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG,cAAc,GAAG,UAAU,GAAG,MAAM,CAAA;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAA;IAC1B,kDAAkD;IAClD,WAAW,CAAC,EAAE,oBAAoB,CAAA;IAClC,sDAAsD;IACtD,IAAI,CAAC,EAAE,IAAI,EAAE,CAAA;CACd,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,cAAc,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,aAAa,CAAC,iBAAiB,CAG/D,CAAA"}
@@ -2,6 +2,9 @@ import "../_dnt.polyfills.js";
2
2
  import { generatorEnrichments } from './Enrichments.js';
3
3
  import * as v from 'valibot';
4
4
  import { method } from './Method.js';
5
+ /**
6
+ * Valibot schema for {@link ModulePackage}.
7
+ */
5
8
  export const modulePackage = v.object({
6
9
  rootPath: v.string(),
7
10
  moduleName: v.optional(v.string())
@@ -1,8 +1,13 @@
1
1
  import type { Stringable } from '../dsl/Stringable.js';
2
+ /** Type alias for object-style lists with curly braces: `{item1, item2}` */
2
3
  export type ListObject<V extends Stringable> = List<V[], ', ', '{}'>;
4
+ /** Type alias for line-separated lists without bookends */
3
5
  export type ListLines<V extends Stringable> = List<V[], '\n', 'none'>;
6
+ /** Type alias for array-style lists with square brackets: `[item1, item2]` */
4
7
  export type ListArray<V extends Stringable> = List<V[], ', ', '[]'>;
8
+ /** Type alias for parameter-style lists with parentheses: `(param1, param2)` */
5
9
  export type ListParams<V extends Stringable> = List<V[], ', ', '()'>;
10
+ /** Options for controlling empty list behavior */
6
11
  export type SkipEmptyOption = {
7
12
  skipEmpty?: boolean;
8
13
  };
@@ -19,11 +24,117 @@ type ConstructorOptions<Separator extends string = ', ', Bookends extends Booken
19
24
  type ExtractArrayItem<ArrayOf> = ArrayOf extends Array<infer Item> ? Item : never;
20
25
  type ToFilteredKeyValueReturn<Value extends undefined | Stringable | Stringable[] | List> = Value extends undefined ? undefined : List<[string, Stringable | Stringable[] | List], ': ', 'none'>;
21
26
  type ToConditionalReturn<Value extends Stringable, Condition extends boolean> = Condition extends true ? List<[Value], ', ', 'none'> : List<never[], ', ', 'none'>;
27
+ /**
28
+ * A powerful utility class for building formatted lists of stringable items.
29
+ *
30
+ * The `List` class is a core component of the SKMTC DSL system, providing type-safe
31
+ * construction of formatted lists with customizable separators and bookends. It's
32
+ * extensively used throughout the codebase for generating code constructs like
33
+ * function parameters, object properties, array literals, and more.
34
+ *
35
+ * ## Type Safety
36
+ *
37
+ * The class uses TypeScript's generic system to provide compile-time guarantees
38
+ * about the list structure, separator, and bookend styles. This enables rich
39
+ * type inference and helps prevent formatting errors.
40
+ *
41
+ * ## Common Patterns
42
+ *
43
+ * - **Objects**: `List.toObject()` creates `{key: value, ...}` structures
44
+ * - **Arrays**: `List.toArray()` creates `[item, item, ...]` structures
45
+ * - **Parameters**: `List.toParams()` creates `(param, param, ...)` structures
46
+ * - **Lines**: `List.toLines()` creates newline-separated content
47
+ *
48
+ * @template Values - Array of stringable values
49
+ * @template Separator - String used to separate items
50
+ * @template Bookends - Style of bookends ('[]', '{}', '()', '<>', 'none')
51
+ *
52
+ * @example Basic usage
53
+ * ```typescript
54
+ * import { List } from '@skmtc/core';
55
+ *
56
+ * // Create a comma-separated list
57
+ * const items = new List(['apple', 'banana', 'cherry']);
58
+ * console.log(items.toString()); // "apple, banana, cherry"
59
+ *
60
+ * // Create an array-style list
61
+ * const array = new List(['a', 'b', 'c'], { bookends: '[]' });
62
+ * console.log(array.toString()); // "[a, b, c]"
63
+ *
64
+ * // Create an object-style list
65
+ * const obj = new List(['x: 1', 'y: 2'], { bookends: '{}' });
66
+ * console.log(obj.toString()); // "{x: 1, y: 2}"
67
+ * ```
68
+ *
69
+ * @example Using type aliases
70
+ * ```typescript
71
+ * // Type-safe array construction
72
+ * const params: ListParams<string> = List.toParams(['id', 'name', 'email']);
73
+ * console.log(params.toString()); // "(id, name, email)"
74
+ *
75
+ * // Object properties with filtering
76
+ * const props = List.toObject(['title', undefined, 'author'], { skipEmpty: true });
77
+ * console.log(props.toString()); // "{title, author}"
78
+ *
79
+ * // Line-separated content
80
+ * const lines = List.toLines(['import React from "react"', 'import { useState } from "react"']);
81
+ * console.log(lines.toString());
82
+ * // import React from "react"
83
+ * // import { useState } from "react"
84
+ * ```
85
+ *
86
+ * @example Advanced usage with builders
87
+ * ```typescript
88
+ * // Function signature generation
89
+ * const signature = List.toParams([
90
+ * 'id: string',
91
+ * 'options?: RequestOptions',
92
+ * 'callback?: (result: T) => void'
93
+ * ]);
94
+ *
95
+ * // Interface properties
96
+ * const interfaceProps = List.toObject([
97
+ * 'readonly id: string',
98
+ * 'name: string',
99
+ * 'createdAt: Date',
100
+ * 'updatedAt?: Date'
101
+ * ]);
102
+ *
103
+ * console.log(`interface User ${interfaceProps}`);
104
+ * // interface User {readonly id: string, name: string, createdAt: Date, updatedAt?: Date}
105
+ * ```
106
+ */
22
107
  export declare class List<Values extends Stringable[] = Stringable[], Separator extends string = string, Bookends extends BookendsType = BookendsType> {
108
+ /** The array of values in this list */
23
109
  values: ExtractArrayItem<Values>[];
110
+ /** The separator string used between items */
24
111
  separator: Separator;
112
+ /** The bookend style for wrapping the list */
25
113
  bookends: Bookends;
114
+ /** Whether to skip rendering when the list is empty */
26
115
  skipEmpty: boolean;
116
+ /**
117
+ * Creates a new List instance.
118
+ *
119
+ * @param values - Array of values (undefined values are automatically filtered out)
120
+ * @param options - Configuration options
121
+ * @param options.separator - String to use between items (default: ', ')
122
+ * @param options.bookends - Style of bookends to wrap the list (default: 'none')
123
+ * @param options.skipEmpty - Whether to return empty string for empty lists (default: false)
124
+ *
125
+ * @example
126
+ * ```typescript
127
+ * // Basic list with default comma separator
128
+ * const basic = new List(['a', 'b', 'c']);
129
+ *
130
+ * // Custom separator and bookends
131
+ * const custom = new List(['x', 'y', 'z'], {
132
+ * separator: ' | ',
133
+ * bookends: '[]',
134
+ * skipEmpty: true
135
+ * });
136
+ * ```
137
+ */
27
138
  constructor(values: (ExtractArrayItem<Values> | undefined)[], { separator, bookends, skipEmpty }?: ConstructorOptions<Separator, Bookends>);
28
139
  toString(): string;
29
140
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/typescript/List.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAGtD,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACpE,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,UAAU,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AACrE,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,UAAU,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACnE,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAEpE,MAAM,MAAM,eAAe,GAAG;IAAE,SAAS,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C5D,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,KAAK,EAAE,MAAM,KACV,CAAC,GAAG,SAAS,CAAA;AAElB,qBAAa,SAAS,CAAC,CAAC,SAAS,UAAU;IACzC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;gBAEP,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE;IAI/B,QAAQ,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAItE,OAAO,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IAIpE,OAAO,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;CAGrE"}
@@ -1,24 +1,130 @@
1
1
  import { match } from 'ts-pattern';
2
+ /**
3
+ * A powerful utility class for building formatted lists of stringable items.
4
+ *
5
+ * The `List` class is a core component of the SKMTC DSL system, providing type-safe
6
+ * construction of formatted lists with customizable separators and bookends. It's
7
+ * extensively used throughout the codebase for generating code constructs like
8
+ * function parameters, object properties, array literals, and more.
9
+ *
10
+ * ## Type Safety
11
+ *
12
+ * The class uses TypeScript's generic system to provide compile-time guarantees
13
+ * about the list structure, separator, and bookend styles. This enables rich
14
+ * type inference and helps prevent formatting errors.
15
+ *
16
+ * ## Common Patterns
17
+ *
18
+ * - **Objects**: `List.toObject()` creates `{key: value, ...}` structures
19
+ * - **Arrays**: `List.toArray()` creates `[item, item, ...]` structures
20
+ * - **Parameters**: `List.toParams()` creates `(param, param, ...)` structures
21
+ * - **Lines**: `List.toLines()` creates newline-separated content
22
+ *
23
+ * @template Values - Array of stringable values
24
+ * @template Separator - String used to separate items
25
+ * @template Bookends - Style of bookends ('[]', '{}', '()', '<>', 'none')
26
+ *
27
+ * @example Basic usage
28
+ * ```typescript
29
+ * import { List } from '@skmtc/core';
30
+ *
31
+ * // Create a comma-separated list
32
+ * const items = new List(['apple', 'banana', 'cherry']);
33
+ * console.log(items.toString()); // "apple, banana, cherry"
34
+ *
35
+ * // Create an array-style list
36
+ * const array = new List(['a', 'b', 'c'], { bookends: '[]' });
37
+ * console.log(array.toString()); // "[a, b, c]"
38
+ *
39
+ * // Create an object-style list
40
+ * const obj = new List(['x: 1', 'y: 2'], { bookends: '{}' });
41
+ * console.log(obj.toString()); // "{x: 1, y: 2}"
42
+ * ```
43
+ *
44
+ * @example Using type aliases
45
+ * ```typescript
46
+ * // Type-safe array construction
47
+ * const params: ListParams<string> = List.toParams(['id', 'name', 'email']);
48
+ * console.log(params.toString()); // "(id, name, email)"
49
+ *
50
+ * // Object properties with filtering
51
+ * const props = List.toObject(['title', undefined, 'author'], { skipEmpty: true });
52
+ * console.log(props.toString()); // "{title, author}"
53
+ *
54
+ * // Line-separated content
55
+ * const lines = List.toLines(['import React from "react"', 'import { useState } from "react"']);
56
+ * console.log(lines.toString());
57
+ * // import React from "react"
58
+ * // import { useState } from "react"
59
+ * ```
60
+ *
61
+ * @example Advanced usage with builders
62
+ * ```typescript
63
+ * // Function signature generation
64
+ * const signature = List.toParams([
65
+ * 'id: string',
66
+ * 'options?: RequestOptions',
67
+ * 'callback?: (result: T) => void'
68
+ * ]);
69
+ *
70
+ * // Interface properties
71
+ * const interfaceProps = List.toObject([
72
+ * 'readonly id: string',
73
+ * 'name: string',
74
+ * 'createdAt: Date',
75
+ * 'updatedAt?: Date'
76
+ * ]);
77
+ *
78
+ * console.log(`interface User ${interfaceProps}`);
79
+ * // interface User {readonly id: string, name: string, createdAt: Date, updatedAt?: Date}
80
+ * ```
81
+ */
2
82
  export class List {
83
+ /**
84
+ * Creates a new List instance.
85
+ *
86
+ * @param values - Array of values (undefined values are automatically filtered out)
87
+ * @param options - Configuration options
88
+ * @param options.separator - String to use between items (default: ', ')
89
+ * @param options.bookends - Style of bookends to wrap the list (default: 'none')
90
+ * @param options.skipEmpty - Whether to return empty string for empty lists (default: false)
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * // Basic list with default comma separator
95
+ * const basic = new List(['a', 'b', 'c']);
96
+ *
97
+ * // Custom separator and bookends
98
+ * const custom = new List(['x', 'y', 'z'], {
99
+ * separator: ' | ',
100
+ * bookends: '[]',
101
+ * skipEmpty: true
102
+ * });
103
+ * ```
104
+ */
3
105
  constructor(values, { separator, bookends, skipEmpty } = {}) {
106
+ /** The array of values in this list */
4
107
  Object.defineProperty(this, "values", {
5
108
  enumerable: true,
6
109
  configurable: true,
7
110
  writable: true,
8
111
  value: void 0
9
112
  });
113
+ /** The separator string used between items */
10
114
  Object.defineProperty(this, "separator", {
11
115
  enumerable: true,
12
116
  configurable: true,
13
117
  writable: true,
14
118
  value: void 0
15
119
  });
120
+ /** The bookend style for wrapping the list */
16
121
  Object.defineProperty(this, "bookends", {
17
122
  enumerable: true,
18
123
  configurable: true,
19
124
  writable: true,
20
125
  value: void 0
21
126
  });
127
+ /** Whether to skip rendering when the list is empty */
22
128
  Object.defineProperty(this, "skipEmpty", {
23
129
  enumerable: true,
24
130
  configurable: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.0.782",
3
+ "version": "0.0.783",
4
4
  "main": "./script/mod.js",
5
5
  "module": "./esm/mod.js",
6
6
  "exports": {
@@ -34,14 +34,189 @@ type ToArtifactsArgs = {
34
34
  prettier?: PrettierConfigType;
35
35
  silent: boolean;
36
36
  };
37
+ /**
38
+ * The main orchestration class for the SKMTC transformation pipeline.
39
+ *
40
+ * `CoreContext` manages the three-phase process of transforming OpenAPI v3 documents
41
+ * into code artifacts. It coordinates parsing, generation, and rendering phases while
42
+ * providing logging, tracing, and error handling capabilities.
43
+ *
44
+ * ## Pipeline Phases
45
+ *
46
+ * 1. **Parse Phase**: Uses {@link ParseContext} to convert OpenAPI JSON into OAS objects
47
+ * 2. **Generate Phase**: Uses {@link GenerateContext} to transform OAS objects with generators
48
+ * 3. **Render Phase**: Uses {@link RenderContext} to format and prepare final artifacts
49
+ *
50
+ * @example Basic usage
51
+ * ```typescript
52
+ * import { CoreContext } from '@skmtc/core';
53
+ *
54
+ * const context = new CoreContext({
55
+ * spanId: 'user-api-generation',
56
+ * logsPath: './logs',
57
+ * silent: false
58
+ * });
59
+ *
60
+ * const result = await context.toArtifacts({
61
+ * documentObject: openApiDoc,
62
+ * settings: clientSettings,
63
+ * toGeneratorConfigMap: () => generators,
64
+ * prettier: prettierConfig,
65
+ * silent: false
66
+ * });
67
+ * ```
68
+ *
69
+ * @example Using individual phases
70
+ * ```typescript
71
+ * const context = new CoreContext({
72
+ * spanId: 'custom-pipeline',
73
+ * silent: true
74
+ * });
75
+ *
76
+ * // Parse phase only
77
+ * const { oasDocument } = context.parse(openApiDoc);
78
+ *
79
+ * // Then use document for custom processing
80
+ * console.log('Parsed schemas:', Object.keys(oasDocument.components.schemas));
81
+ * ```
82
+ */
37
83
  export declare class CoreContext {
38
84
  #private;
85
+ /** Logger instance for the context */
39
86
  logger: log.Logger;
87
+ /** Whether to suppress console output */
40
88
  silent: boolean;
89
+ /**
90
+ * Creates a new CoreContext instance.
91
+ *
92
+ * @param args - Configuration for the context
93
+ * @param args.spanId - Unique identifier for this transformation span
94
+ * @param args.logsPath - Optional directory path for log files
95
+ * @param args.silent - Whether to suppress console output
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * // Basic context with console logging
100
+ * const context = new CoreContext({
101
+ * spanId: 'my-generation',
102
+ * silent: false
103
+ * });
104
+ *
105
+ * // Context with file logging
106
+ * const context = new CoreContext({
107
+ * spanId: 'batch-job-123',
108
+ * logsPath: './logs/generation',
109
+ * silent: true
110
+ * });
111
+ * ```
112
+ */
41
113
  constructor({ spanId, logsPath, silent }: CoreContextArgs);
114
+ /**
115
+ * Parses an OpenAPI v3 document into internal OAS objects.
116
+ *
117
+ * This method executes only the parse phase of the pipeline, converting
118
+ * the raw OpenAPI JSON into structured OAS objects that can be used for
119
+ * generation or custom processing.
120
+ *
121
+ * @param documentObject - The OpenAPI v3 document to parse
122
+ * @returns An object containing the parsed OAS document
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * import { CoreContext } from '@skmtc/core';
127
+ *
128
+ * const context = new CoreContext({
129
+ * spanId: 'parse-only',
130
+ * silent: true
131
+ * });
132
+ *
133
+ * const { oasDocument } = context.parse(openApiDoc);
134
+ *
135
+ * // Access parsed components
136
+ * console.log('Models:', Object.keys(oasDocument.components.schemas));
137
+ * console.log('Paths:', Object.keys(oasDocument.paths));
138
+ *
139
+ * // Use for custom processing
140
+ * const userModel = oasDocument.components.schemas['User'];
141
+ * if (userModel && !userModel.isRef()) {
142
+ * console.log('User properties:', Object.keys(userModel.properties));
143
+ * }
144
+ * ```
145
+ */
42
146
  parse(documentObject: OpenAPIV3.Document): {
43
147
  oasDocument: OasDocument;
44
148
  };
149
+ /**
150
+ * Executes the complete transformation pipeline to generate code artifacts.
151
+ *
152
+ * This method orchestrates all three phases:
153
+ * 1. **Parse**: Convert OpenAPI document to OAS objects
154
+ * 2. **Generate**: Transform OAS objects using generators
155
+ * 3. **Render**: Format and prepare final artifacts
156
+ *
157
+ * The result includes both the generated code files and comprehensive metadata
158
+ * about the generation process, including file mappings, previews, and results.
159
+ *
160
+ * @param args - Configuration for the artifact generation
161
+ * @param args.documentObject - The OpenAPI v3 document to process
162
+ * @param args.settings - Client settings for customization
163
+ * @param args.toGeneratorConfigMap - Function returning generator configuration
164
+ * @param args.prettier - Optional Prettier configuration for code formatting
165
+ * @param args.silent - Whether to suppress console output during generation
166
+ * @returns Promise resolving to rendered artifacts and metadata
167
+ *
168
+ * @example Complete pipeline
169
+ * ```typescript
170
+ * const context = new CoreContext({
171
+ * spanId: 'api-client-gen',
172
+ * silent: false
173
+ * });
174
+ *
175
+ * const result = await context.toArtifacts({
176
+ * documentObject: openApiDoc,
177
+ * settings: {
178
+ * basePath: './src/api',
179
+ * skip: {
180
+ * models: ['Internal*'],
181
+ * operations: {
182
+ * '/health': ['get'],
183
+ * '/debug/**': ['*']
184
+ * }
185
+ * }
186
+ * },
187
+ * toGeneratorConfigMap: () => ({
188
+ * models: {
189
+ * generator: MyModelGenerator,
190
+ * settings: { includeValidation: true }
191
+ * },
192
+ * operations: {
193
+ * generator: MyOperationGenerator,
194
+ * settings: { generateTypes: true }
195
+ * }
196
+ * }),
197
+ * prettier: {
198
+ * semi: false,
199
+ * singleQuote: true,
200
+ * trailingComma: 'all'
201
+ * },
202
+ * silent: false
203
+ * });
204
+ *
205
+ * // Access generated artifacts
206
+ * console.log('Generated files:', Object.keys(result.artifacts));
207
+ *
208
+ * // Write to filesystem
209
+ * for (const [path, content] of Object.entries(result.artifacts)) {
210
+ * await Deno.writeTextFile(path, content);
211
+ * }
212
+ *
213
+ * // Access metadata
214
+ * console.log('Generation results:', result.results);
215
+ * console.log('File mappings:', result.files);
216
+ * ```
217
+ *
218
+ * @throws Will throw an error if any phase of the pipeline fails
219
+ */
45
220
  toArtifacts({ documentObject, settings, toGeneratorConfigMap, prettier }: ToArtifactsArgs): Promise<RenderResult>;
46
221
  trace<T>(token: string | string[], fn: () => T): T;
47
222
  captureCurrentResult(result: ResultType): void;
@@ -1 +1 @@
1
- {"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAs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