@skmtc/core 0.0.945 → 0.0.947
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/context/GenerateContext.d.ts +4 -4
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +2 -5
- package/esm/context/generateTypes.d.ts +5 -10
- package/esm/context/generateTypes.d.ts.map +1 -1
- package/esm/dsl/GeneratedValue.d.ts +2 -18
- package/esm/dsl/GeneratedValue.d.ts.map +1 -1
- package/esm/dsl/Inserted.d.ts +13 -33
- package/esm/dsl/Inserted.d.ts.map +1 -1
- package/esm/dsl/Inserted.js +7 -26
- package/esm/dsl/model/ModelBase.d.ts +2 -2
- package/esm/dsl/model/ModelBase.d.ts.map +1 -1
- package/esm/dsl/model/ModelBase.js +0 -1
- package/esm/dsl/model/ModelDriver.d.ts +5 -9
- package/esm/dsl/model/ModelDriver.d.ts.map +1 -1
- package/esm/dsl/model/ModelDriver.js +3 -10
- package/esm/dsl/model/toModelBase.d.ts +2 -2
- package/esm/dsl/operation/OperationBase.d.ts +3 -3
- package/esm/dsl/operation/OperationBase.d.ts.map +1 -1
- package/esm/dsl/operation/OperationBase.js +0 -2
- package/esm/dsl/operation/OperationDriver.d.ts +5 -7
- package/esm/dsl/operation/OperationDriver.d.ts.map +1 -1
- package/esm/dsl/operation/OperationDriver.js +3 -8
- package/esm/dsl/operation/toOperationBase.d.ts +3 -3
- package/package.json +1 -1
- package/script/context/GenerateContext.d.ts +4 -4
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +2 -5
- package/script/context/generateTypes.d.ts +5 -10
- package/script/context/generateTypes.d.ts.map +1 -1
- package/script/dsl/GeneratedValue.d.ts +2 -18
- package/script/dsl/GeneratedValue.d.ts.map +1 -1
- package/script/dsl/Inserted.d.ts +13 -33
- package/script/dsl/Inserted.d.ts.map +1 -1
- package/script/dsl/Inserted.js +7 -26
- package/script/dsl/model/ModelBase.d.ts +2 -2
- package/script/dsl/model/ModelBase.d.ts.map +1 -1
- package/script/dsl/model/ModelBase.js +0 -1
- package/script/dsl/model/ModelDriver.d.ts +5 -9
- package/script/dsl/model/ModelDriver.d.ts.map +1 -1
- package/script/dsl/model/ModelDriver.js +3 -10
- package/script/dsl/model/toModelBase.d.ts +2 -2
- package/script/dsl/operation/OperationBase.d.ts +3 -3
- package/script/dsl/operation/OperationBase.d.ts.map +1 -1
- package/script/dsl/operation/OperationBase.js +0 -2
- package/script/dsl/operation/OperationDriver.d.ts +5 -7
- package/script/dsl/operation/OperationDriver.d.ts.map +1 -1
- package/script/dsl/operation/OperationDriver.js +3 -8
- package/script/dsl/operation/toOperationBase.d.ts +3 -3
|
@@ -8,7 +8,7 @@ import type { Method } from '../types/Method.js';
|
|
|
8
8
|
import type { OperationInsertable } from '../dsl/operation/types.js';
|
|
9
9
|
import type { OasOperation } from '../oas/operation/Operation.js';
|
|
10
10
|
import type { ModelInsertable } from '../dsl/model/types.js';
|
|
11
|
-
import type {
|
|
11
|
+
import type { GeneratedValue } from '../dsl/GeneratedValue.js';
|
|
12
12
|
import { ContentSettings } from '../dsl/ContentSettings.js';
|
|
13
13
|
import type { RefName } from '../types/RefName.js';
|
|
14
14
|
import type * as log from '../deps/jsr.io/@std/log/0.224.14/mod.js';
|
|
@@ -112,7 +112,7 @@ export type ToModelSettingsArgs = {
|
|
|
112
112
|
* @template T - The generation type
|
|
113
113
|
* @template EnrichmentType - The enrichment data type
|
|
114
114
|
*/
|
|
115
|
-
export type InsertReturn<V extends GeneratedValue,
|
|
115
|
+
export type InsertReturn<V extends GeneratedValue, EnrichmentType> = Inserted<V, EnrichmentType>;
|
|
116
116
|
/**
|
|
117
117
|
* The generation context for the second phase of the SKMTC transformation pipeline.
|
|
118
118
|
*
|
|
@@ -219,7 +219,7 @@ export declare class GenerateContext implements GenerateContextType {
|
|
|
219
219
|
* insertable's driver
|
|
220
220
|
* @mutates this.files
|
|
221
221
|
*/
|
|
222
|
-
insertOperation<V extends GeneratedValue,
|
|
222
|
+
insertOperation<V extends GeneratedValue, EnrichmentType = undefined>(insertable: OperationInsertable<V, EnrichmentType>, operation: OasOperation, { destinationPath, noExport }?: InsertOperationOptions): Inserted<V, EnrichmentType>;
|
|
223
223
|
/**
|
|
224
224
|
* Inserts a normalized model definition into the generation context.
|
|
225
225
|
*
|
|
@@ -243,7 +243,7 @@ export declare class GenerateContext implements GenerateContextType {
|
|
|
243
243
|
* insertable's driver
|
|
244
244
|
* @mutates this.files
|
|
245
245
|
*/
|
|
246
|
-
insertModel<V extends GeneratedValue,
|
|
246
|
+
insertModel<V extends GeneratedValue, EnrichmentType>(insertable: ModelInsertable<V, EnrichmentType>, refName: RefName, { destinationPath, noExport }?: InsertModelOptions): Inserted<V, EnrichmentType>;
|
|
247
247
|
/**
|
|
248
248
|
* Generate and return content settings for operation insertable and
|
|
249
249
|
* operation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateContext.d.ts","sourceRoot":"","sources":["../../src/context/GenerateContext.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EAEd,kBAAkB,EAClB,yBAAyB,EACzB,4BAA4B,EAC5B,2BAA2B,EAC3B,sBAAsB,EACtB,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,sBAAsB,CAAA;AACjG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAA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|
|
@@ -253,12 +253,11 @@ export class GenerateContext {
|
|
|
253
253
|
* insertable's driver
|
|
254
254
|
* @mutates this.files
|
|
255
255
|
*/
|
|
256
|
-
insertOperation(insertable, operation, {
|
|
256
|
+
insertOperation(insertable, operation, { destinationPath, noExport = false } = {}) {
|
|
257
257
|
const { settings, definition } = new OperationDriver({
|
|
258
258
|
context: this,
|
|
259
259
|
insertable,
|
|
260
260
|
operation,
|
|
261
|
-
generation,
|
|
262
261
|
destinationPath,
|
|
263
262
|
noExport
|
|
264
263
|
});
|
|
@@ -275,7 +274,6 @@ export class GenerateContext {
|
|
|
275
274
|
insertNormalisedModel(insertable, { schema, fallbackName, destinationPath }, { noExport = false } = {}) {
|
|
276
275
|
if (schema.isRef()) {
|
|
277
276
|
const { definition } = this.insertModel(insertable, schema.toRefName(), {
|
|
278
|
-
generation: 'force',
|
|
279
277
|
destinationPath,
|
|
280
278
|
noExport
|
|
281
279
|
});
|
|
@@ -320,12 +318,11 @@ export class GenerateContext {
|
|
|
320
318
|
* insertable's driver
|
|
321
319
|
* @mutates this.files
|
|
322
320
|
*/
|
|
323
|
-
insertModel(insertable, refName, {
|
|
321
|
+
insertModel(insertable, refName, { destinationPath, noExport = false } = {}) {
|
|
324
322
|
const { settings, definition } = new ModelDriver({
|
|
325
323
|
context: this,
|
|
326
324
|
insertable,
|
|
327
325
|
refName,
|
|
328
|
-
generation,
|
|
329
326
|
destinationPath,
|
|
330
327
|
rootRef: refName,
|
|
331
328
|
noExport
|
|
@@ -3,7 +3,7 @@ import type { Mapping, Preview } from '../types/Preview.js';
|
|
|
3
3
|
import type { ResultsItem } from '../types/Results.js';
|
|
4
4
|
import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
|
|
5
5
|
import type { JsonFile } from '../dsl/JsonFile.js';
|
|
6
|
-
import type { GeneratedValue
|
|
6
|
+
import type { GeneratedValue } from '../dsl/GeneratedValue.js';
|
|
7
7
|
import type { Definition } from '../dsl/Definition.js';
|
|
8
8
|
import type { OasOperation } from '../oas/operation/Operation.js';
|
|
9
9
|
import type { OperationInsertable } from '../dsl/operation/types.js';
|
|
@@ -28,11 +28,9 @@ import type { StackTrail } from './StackTrail.js';
|
|
|
28
28
|
*
|
|
29
29
|
* @template T - The generation type extending GenerationType
|
|
30
30
|
*/
|
|
31
|
-
export type InsertOperationOptions
|
|
31
|
+
export type InsertOperationOptions = {
|
|
32
32
|
/** Whether to exclude this operation from exports */
|
|
33
33
|
noExport?: boolean;
|
|
34
|
-
/** The type of generation to apply */
|
|
35
|
-
generation?: T;
|
|
36
34
|
/** Custom destination path for the operation */
|
|
37
35
|
destinationPath?: string;
|
|
38
36
|
};
|
|
@@ -166,13 +164,10 @@ export type InsertNormalisedModelArgs<Schema extends OasSchema | OasRef<'schema'
|
|
|
166
164
|
* Configures how a model should be processed and included in
|
|
167
165
|
* the generated code output.
|
|
168
166
|
*
|
|
169
|
-
* @template T - The generation type extending GenerationType
|
|
170
167
|
*/
|
|
171
|
-
export type InsertModelOptions
|
|
168
|
+
export type InsertModelOptions = {
|
|
172
169
|
/** Whether to exclude this model from exports */
|
|
173
170
|
noExport?: boolean;
|
|
174
|
-
/** The type of generation to apply */
|
|
175
|
-
generation?: T;
|
|
176
171
|
/** Custom destination path for the model */
|
|
177
172
|
destinationPath?: string;
|
|
178
173
|
};
|
|
@@ -233,9 +228,9 @@ export type GenerateContextType = {
|
|
|
233
228
|
defineAndRegister: <V extends GeneratedValue>({ identifier, value, destinationPath, noExport }: DefineAndRegisterArgs<V>) => Definition<V>;
|
|
234
229
|
registerJson: ({ destinationPath, json }: RegisterJsonArgs) => void;
|
|
235
230
|
register: ({ imports, definitions, destinationPath, reExports }: RegisterArgs) => void;
|
|
236
|
-
insertOperation: <V extends GeneratedValue,
|
|
231
|
+
insertOperation: <V extends GeneratedValue, EnrichmentType = undefined>(insertable: OperationInsertable<V, EnrichmentType>, operation: OasOperation, { destinationPath, noExport }: InsertOperationOptions) => Inserted<V, EnrichmentType>;
|
|
237
232
|
insertNormalisedModel: <V extends GeneratedValue, Schema extends OasSchema | OasRef<'schema'> | OasVoid, EnrichmentType>(insertable: ModelInsertable<V, EnrichmentType>, { schema, fallbackName, destinationPath }: InsertNormalisedModelArgs<Schema>, { noExport }: InsertNormalisedModelOptions) => InsertNormalisedModelReturn<V, Schema>;
|
|
238
|
-
insertModel: <V extends GeneratedValue,
|
|
233
|
+
insertModel: <V extends GeneratedValue, EnrichmentType>(insertable: ModelInsertable<V, EnrichmentType>, refName: RefName, { destinationPath, noExport }: InsertModelOptions) => Inserted<V, EnrichmentType>;
|
|
239
234
|
toOperationContentSettings: <V, EnrichmentType>({ operation, insertable }: ToOperationSettingsArgs<V, EnrichmentType>) => ContentSettings<EnrichmentType>;
|
|
240
235
|
toModelContentSettings: <V, EnrichmentType>({ refName, insertable }: BuildModelSettingsArgs<V, EnrichmentType>) => ContentSettings<EnrichmentType>;
|
|
241
236
|
resolveSchemaRefOnce: (refName: RefName, generatorId: string) => OasSchema | OasRef<'schema'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateTypes.d.ts","sourceRoot":"","sources":["../../src/context/generateTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"generateTypes.d.ts","sourceRoot":"","sources":["../../src/context/generateTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBA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G,SAAS,CAAA;CAC3E,CAAA"}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import type { Definition } from './Definition.js';
|
|
2
2
|
import type { Stringable } from './Stringable.js';
|
|
3
3
|
import type { GeneratorKey } from './GeneratorKeys.js';
|
|
4
|
-
/**
|
|
5
|
-
* 'force' - will generate content even it is not selected.
|
|
6
|
-
* Use this option when generating code via a dependency.
|
|
7
|
-
* For example, when you are generating a form and it needs
|
|
8
|
-
* an accompanying API client as well. You should use 'force'
|
|
9
|
-
* when generating the API client to ensure it is generated
|
|
10
|
-
* event the API client itself is not selected.
|
|
11
|
-
*
|
|
12
|
-
* 'regular' - will generate content only if it is selected.
|
|
13
|
-
*/
|
|
14
|
-
export type GenerationType = 'force' | 'regular';
|
|
15
4
|
/**
|
|
16
5
|
* Represents a value that can be generated by the SKMTC pipeline.
|
|
17
6
|
*
|
|
@@ -23,14 +12,9 @@ export type GeneratedValue = Stringable & {
|
|
|
23
12
|
generatorKey?: GeneratorKey;
|
|
24
13
|
};
|
|
25
14
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* When generation type is 'force', always returns a Definition.
|
|
29
|
-
* When generation type is 'regular', returns Definition or undefined
|
|
30
|
-
* based on whether the content is selected for generation.
|
|
15
|
+
* Type for generated definitions.
|
|
31
16
|
*
|
|
32
17
|
* @template V - The generated value type extending GeneratedValue
|
|
33
|
-
* @template T - The generation type ('force' or 'regular')
|
|
34
18
|
*/
|
|
35
|
-
export type GeneratedDefinition<V extends GeneratedValue
|
|
19
|
+
export type GeneratedDefinition<V extends GeneratedValue> = Definition<V>;
|
|
36
20
|
//# sourceMappingURL=GeneratedValue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeneratedValue.d.ts","sourceRoot":"","sources":["../../src/dsl/GeneratedValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD
|
|
1
|
+
{"version":3,"file":"GeneratedValue.d.ts","sourceRoot":"","sources":["../../src/dsl/GeneratedValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG;IACxC,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,cAAc,IAAI,UAAU,CAAC,CAAC,CAAC,CAAA"}
|
package/esm/dsl/Inserted.d.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import type { GeneratedDefinition, GeneratedValue
|
|
1
|
+
import type { GeneratedDefinition, GeneratedValue } from './GeneratedValue.js';
|
|
2
2
|
import type { ContentSettings } from './ContentSettings.js';
|
|
3
3
|
import type { Identifier } from './Identifier.js';
|
|
4
4
|
/**
|
|
5
5
|
* Constructor arguments for {@link Inserted}.
|
|
6
6
|
*
|
|
7
7
|
* @template V - The type of generated value
|
|
8
|
-
* @template T - The generation type ('force' or 'lazy')
|
|
9
8
|
* @template EnrichmentType - Optional enrichment data type
|
|
10
9
|
*/
|
|
11
|
-
type ConstructorArgs<V extends GeneratedValue,
|
|
10
|
+
type ConstructorArgs<V extends GeneratedValue, EnrichmentType> = {
|
|
12
11
|
/** Content settings including identifier and export path */
|
|
13
12
|
settings: ContentSettings<EnrichmentType>;
|
|
14
13
|
/** The generated definition with its value */
|
|
15
|
-
definition: GeneratedDefinition<V
|
|
14
|
+
definition: GeneratedDefinition<V>;
|
|
16
15
|
};
|
|
17
16
|
/**
|
|
18
17
|
* Represents a successfully inserted generator artifact in the SKMTC DSL system.
|
|
@@ -29,13 +28,11 @@ type ConstructorArgs<V extends GeneratedValue, T extends GenerationType, Enrichm
|
|
|
29
28
|
* ## Key Features
|
|
30
29
|
*
|
|
31
30
|
* - **Type Safety**: Generic parameters preserve exact types from generators
|
|
32
|
-
* - **Generation Modes**: Handles both 'force' and 'lazy' generation strategies
|
|
33
31
|
* - **Metadata Access**: Provides access to identifiers, export paths, and settings
|
|
34
32
|
* - **Value Extraction**: Type-safe value extraction with proper optionality
|
|
35
33
|
* - **Enrichment Support**: Full support for custom enrichment data types
|
|
36
34
|
*
|
|
37
35
|
* @template V - The type of generated value (preserves generator output type)
|
|
38
|
-
* @template T - The generation type ('force' ensures non-null, 'lazy' allows undefined)
|
|
39
36
|
* @template EnrichmentType - Optional type for custom enrichment data
|
|
40
37
|
*
|
|
41
38
|
* @example Basic usage with forced generation
|
|
@@ -48,7 +45,7 @@ type ConstructorArgs<V extends GeneratedValue, T extends GenerationType, Enrichm
|
|
|
48
45
|
* const userModel = this.insertModel(
|
|
49
46
|
* new UserModelGenerator({ ... }),
|
|
50
47
|
* 'User'
|
|
51
|
-
* ); // Returns Inserted<UserModelValue,
|
|
48
|
+
* ); // Returns Inserted<UserModelValue, EnrichmentType>
|
|
52
49
|
*
|
|
53
50
|
* // Access the generated value (guaranteed to be present)
|
|
54
51
|
* const userTypeName = userModel.toValue(); // UserModelValue (not undefined)
|
|
@@ -66,11 +63,11 @@ type ConstructorArgs<V extends GeneratedValue, T extends GenerationType, Enrichm
|
|
|
66
63
|
* }
|
|
67
64
|
* ```
|
|
68
65
|
*/
|
|
69
|
-
export declare class Inserted<V extends GeneratedValue,
|
|
66
|
+
export declare class Inserted<V extends GeneratedValue, EnrichmentType> {
|
|
70
67
|
/** Content settings including identifier and export path */
|
|
71
68
|
settings: ContentSettings<EnrichmentType>;
|
|
72
69
|
/** The generated definition with its value */
|
|
73
|
-
definition: GeneratedDefinition<V
|
|
70
|
+
definition: GeneratedDefinition<V>;
|
|
74
71
|
/**
|
|
75
72
|
* Creates a new Inserted instance.
|
|
76
73
|
*
|
|
@@ -78,7 +75,7 @@ export declare class Inserted<V extends GeneratedValue, T extends GenerationType
|
|
|
78
75
|
* @param args.settings - Content settings with identifier and export path
|
|
79
76
|
* @param args.definition - The generated definition containing the value
|
|
80
77
|
*/
|
|
81
|
-
constructor({ settings, definition }: ConstructorArgs<V,
|
|
78
|
+
constructor({ settings, definition }: ConstructorArgs<V, EnrichmentType>);
|
|
82
79
|
/**
|
|
83
80
|
* Gets the name of the inserted artifact.
|
|
84
81
|
*
|
|
@@ -140,36 +137,19 @@ export declare class Inserted<V extends GeneratedValue, T extends GenerationType
|
|
|
140
137
|
* Gets the generated value from the inserted artifact.
|
|
141
138
|
*
|
|
142
139
|
* This method returns the actual generated content with proper type safety
|
|
143
|
-
* based on the generation mode. For 'force' generation, the value is guaranteed
|
|
144
|
-
* to be present. For 'lazy' generation, the value might be undefined if
|
|
145
|
-
* generation was skipped.
|
|
146
140
|
*
|
|
147
|
-
* @returns The generated value
|
|
141
|
+
* @returns The generated value
|
|
148
142
|
*
|
|
149
|
-
* @example
|
|
143
|
+
* @example
|
|
150
144
|
* ```typescript
|
|
151
|
-
* const userModel = this.insertModel(generator, 'User');
|
|
152
|
-
* const value = userModel.toValue(); // UserModelValue
|
|
145
|
+
* const userModel = this.insertModel(generator, 'User');
|
|
146
|
+
* const value = userModel.toValue(); // UserModelValue
|
|
153
147
|
*
|
|
154
|
-
* //
|
|
148
|
+
* // Use the generated value
|
|
155
149
|
* const code = `type OrderUser = ${value};`;
|
|
156
150
|
* ```
|
|
157
|
-
*
|
|
158
|
-
* @example Lazy generation (optional value)
|
|
159
|
-
* ```typescript
|
|
160
|
-
* const optionalModel = this.insertModel(generator, 'Optional', { generation: 'lazy' });
|
|
161
|
-
* const value = optionalModel.toValue(); // OptionalValue | undefined
|
|
162
|
-
*
|
|
163
|
-
* if (value) {
|
|
164
|
-
* // Use the generated value
|
|
165
|
-
* const code = `type Optional = ${value};`;
|
|
166
|
-
* } else {
|
|
167
|
-
* // Handle missing value (generation was skipped)
|
|
168
|
-
* const code = 'type Optional = any; // Fallback';
|
|
169
|
-
* }
|
|
170
|
-
* ```
|
|
171
151
|
*/
|
|
172
|
-
toValue():
|
|
152
|
+
toValue(): V;
|
|
173
153
|
}
|
|
174
154
|
export {};
|
|
175
155
|
//# sourceMappingURL=Inserted.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Inserted.d.ts","sourceRoot":"","sources":["../../src/dsl/Inserted.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"Inserted.d.ts","sourceRoot":"","sources":["../../src/dsl/Inserted.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD;;;;;GAKG;AACH,KAAK,eAAe,CAAC,CAAC,SAAS,cAAc,EAAE,cAAc,IAAI;IAC/D,4DAA4D;IAC5D,QAAQ,EAAE,eAAe,CAAC,cAAc,CAAC,CAAA;IACzC,8CAA8C;IAC9C,UAAU,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAA;CACnC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,cAAc,EAAE,cAAc;IAC5D,4DAA4D;IAC5D,QAAQ,EAAE,eAAe,CAAC,cAAc,CAAC,CAAA;IAEzC,8CAA8C;IAC9C,UAAU,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAA;IAElC;;;;;;OAMG;gBACS,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,eAAe,CAAC,CAAC,EAAE,cAAc,CAAC;IAKxE;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,IAAI,MAAM;IAIhB;;;;;;;;;;;;;;;;;;OAkBG;IACH,YAAY,IAAI,UAAU;IAI1B;;;;;;;;;;;;;;;;;OAiBG;IACH,YAAY,IAAI,MAAM;IAItB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,IAAI,CAAC;CAGb"}
|
package/esm/dsl/Inserted.js
CHANGED
|
@@ -13,13 +13,11 @@
|
|
|
13
13
|
* ## Key Features
|
|
14
14
|
*
|
|
15
15
|
* - **Type Safety**: Generic parameters preserve exact types from generators
|
|
16
|
-
* - **Generation Modes**: Handles both 'force' and 'lazy' generation strategies
|
|
17
16
|
* - **Metadata Access**: Provides access to identifiers, export paths, and settings
|
|
18
17
|
* - **Value Extraction**: Type-safe value extraction with proper optionality
|
|
19
18
|
* - **Enrichment Support**: Full support for custom enrichment data types
|
|
20
19
|
*
|
|
21
20
|
* @template V - The type of generated value (preserves generator output type)
|
|
22
|
-
* @template T - The generation type ('force' ensures non-null, 'lazy' allows undefined)
|
|
23
21
|
* @template EnrichmentType - Optional type for custom enrichment data
|
|
24
22
|
*
|
|
25
23
|
* @example Basic usage with forced generation
|
|
@@ -32,7 +30,7 @@
|
|
|
32
30
|
* const userModel = this.insertModel(
|
|
33
31
|
* new UserModelGenerator({ ... }),
|
|
34
32
|
* 'User'
|
|
35
|
-
* ); // Returns Inserted<UserModelValue,
|
|
33
|
+
* ); // Returns Inserted<UserModelValue, EnrichmentType>
|
|
36
34
|
*
|
|
37
35
|
* // Access the generated value (guaranteed to be present)
|
|
38
36
|
* const userTypeName = userModel.toValue(); // UserModelValue (not undefined)
|
|
@@ -143,36 +141,19 @@ export class Inserted {
|
|
|
143
141
|
* Gets the generated value from the inserted artifact.
|
|
144
142
|
*
|
|
145
143
|
* This method returns the actual generated content with proper type safety
|
|
146
|
-
* based on the generation mode. For 'force' generation, the value is guaranteed
|
|
147
|
-
* to be present. For 'lazy' generation, the value might be undefined if
|
|
148
|
-
* generation was skipped.
|
|
149
144
|
*
|
|
150
|
-
* @returns The generated value
|
|
145
|
+
* @returns The generated value
|
|
151
146
|
*
|
|
152
|
-
* @example
|
|
147
|
+
* @example
|
|
153
148
|
* ```typescript
|
|
154
|
-
* const userModel = this.insertModel(generator, 'User');
|
|
155
|
-
* const value = userModel.toValue(); // UserModelValue
|
|
149
|
+
* const userModel = this.insertModel(generator, 'User');
|
|
150
|
+
* const value = userModel.toValue(); // UserModelValue
|
|
156
151
|
*
|
|
157
|
-
* //
|
|
152
|
+
* // Use the generated value
|
|
158
153
|
* const code = `type OrderUser = ${value};`;
|
|
159
154
|
* ```
|
|
160
|
-
*
|
|
161
|
-
* @example Lazy generation (optional value)
|
|
162
|
-
* ```typescript
|
|
163
|
-
* const optionalModel = this.insertModel(generator, 'Optional', { generation: 'lazy' });
|
|
164
|
-
* const value = optionalModel.toValue(); // OptionalValue | undefined
|
|
165
|
-
*
|
|
166
|
-
* if (value) {
|
|
167
|
-
* // Use the generated value
|
|
168
|
-
* const code = `type Optional = ${value};`;
|
|
169
|
-
* } else {
|
|
170
|
-
* // Handle missing value (generation was skipped)
|
|
171
|
-
* const code = 'type Optional = any; // Fallback';
|
|
172
|
-
* }
|
|
173
|
-
* ```
|
|
174
155
|
*/
|
|
175
156
|
toValue() {
|
|
176
|
-
return this.definition
|
|
157
|
+
return this.definition.value;
|
|
177
158
|
}
|
|
178
159
|
}
|
|
@@ -180,7 +180,7 @@ export declare class ModelBase<EnrichmentType = undefined> extends ContentBase {
|
|
|
180
180
|
* }
|
|
181
181
|
* ```
|
|
182
182
|
*/
|
|
183
|
-
insertModel<V extends GeneratedValue, EnrichmentType = undefined>(insertable: ModelInsertable<V, EnrichmentType>, refName: RefName, options?: Pick<InsertModelOptions
|
|
183
|
+
insertModel<V extends GeneratedValue, EnrichmentType = undefined>(insertable: ModelInsertable<V, EnrichmentType>, refName: RefName, options?: Pick<InsertModelOptions, 'noExport'>): Inserted<V, EnrichmentType>;
|
|
184
184
|
/**
|
|
185
185
|
* Inserts a related model with automatic schema normalization and reference resolution.
|
|
186
186
|
*
|
|
@@ -238,7 +238,7 @@ export declare class ModelBase<EnrichmentType = undefined> extends ContentBase {
|
|
|
238
238
|
* );
|
|
239
239
|
* ```
|
|
240
240
|
*/
|
|
241
|
-
insertNormalizedModel<V extends GeneratedValue, Schema extends OasSchema | OasRef<'schema'> | OasVoid, EnrichmentType = undefined>(insertable: ModelInsertable<V, EnrichmentType>, { schema, fallbackName }: Omit<InsertNormalisedModelArgs<Schema>, 'destinationPath'>, options?: Pick<InsertModelOptions
|
|
241
|
+
insertNormalizedModel<V extends GeneratedValue, Schema extends OasSchema | OasRef<'schema'> | OasVoid, EnrichmentType = undefined>(insertable: ModelInsertable<V, EnrichmentType>, { schema, fallbackName }: Omit<InsertNormalisedModelArgs<Schema>, 'destinationPath'>, options?: Pick<InsertModelOptions, 'noExport'>): InsertNormalisedModelReturn<V, Schema>;
|
|
242
242
|
/**
|
|
243
243
|
* Registers a file-level artifact with the generation context.
|
|
244
244
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AAC3F,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;A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;;;;;;;OAwCG;IACM,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;CAMhD"}
|
|
@@ -176,7 +176,6 @@ export class ModelBase extends ContentBase {
|
|
|
176
176
|
*/
|
|
177
177
|
insertModel(insertable, refName, options = {}) {
|
|
178
178
|
return this.context.insertModel(insertable, refName, {
|
|
179
|
-
generation: 'force',
|
|
180
179
|
destinationPath: this.settings.exportPath,
|
|
181
180
|
noExport: options.noExport
|
|
182
181
|
});
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { ModelInsertable } from './types.js';
|
|
2
2
|
import type { GenerateContextType } from '../../context/generateTypes.js';
|
|
3
3
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
4
|
-
import type { GeneratedDefinition
|
|
4
|
+
import type { GeneratedDefinition } from '../GeneratedValue.js';
|
|
5
5
|
import type { GeneratedValue } from '../GeneratedValue.js';
|
|
6
6
|
import type { RefName } from '../../types/RefName.js';
|
|
7
|
-
type CreateModelArgs<V extends GeneratedValue,
|
|
7
|
+
type CreateModelArgs<V extends GeneratedValue, EnrichmentType> = {
|
|
8
8
|
context: GenerateContextType;
|
|
9
9
|
insertable: ModelInsertable<V, EnrichmentType>;
|
|
10
10
|
refName: RefName;
|
|
11
|
-
generation?: T;
|
|
12
11
|
destinationPath?: string;
|
|
13
12
|
rootRef?: RefName;
|
|
14
13
|
noExport?: boolean;
|
|
@@ -20,7 +19,7 @@ type CreateModelArgs<V extends GeneratedValue, T extends GenerationType, Enrichm
|
|
|
20
19
|
* @template T - The generation type
|
|
21
20
|
* @template EnrichmentType - Optional enrichment type
|
|
22
21
|
*/
|
|
23
|
-
export declare class ModelDriver<V extends GeneratedValue,
|
|
22
|
+
export declare class ModelDriver<V extends GeneratedValue, EnrichmentType> {
|
|
24
23
|
/** The generation context */
|
|
25
24
|
context: GenerateContextType;
|
|
26
25
|
/** The insertable model configuration */
|
|
@@ -32,7 +31,7 @@ export declare class ModelDriver<V extends GeneratedValue, T extends GenerationT
|
|
|
32
31
|
/** Optional destination path for the generated file */
|
|
33
32
|
destinationPath?: string;
|
|
34
33
|
/** The generated definition */
|
|
35
|
-
definition: GeneratedDefinition<V
|
|
34
|
+
definition: GeneratedDefinition<V>;
|
|
36
35
|
/** Optional root reference name */
|
|
37
36
|
rootRef?: RefName;
|
|
38
37
|
/** Whether to skip export declaration */
|
|
@@ -44,21 +43,18 @@ export declare class ModelDriver<V extends GeneratedValue, T extends GenerationT
|
|
|
44
43
|
* @param args.context - Generation context
|
|
45
44
|
* @param args.insertable - Model insertable configuration
|
|
46
45
|
* @param args.refName - Reference name for the model
|
|
47
|
-
* @param args.generation - Optional generation type
|
|
48
46
|
* @param args.destinationPath - Optional destination path
|
|
49
47
|
* @param args.rootRef - Optional root reference name
|
|
50
48
|
* @param args.noExport - Whether to skip export declaration
|
|
51
49
|
*/
|
|
52
|
-
constructor({ context, insertable, refName,
|
|
50
|
+
constructor({ context, insertable, refName, destinationPath, rootRef, noExport }: CreateModelArgs<V, EnrichmentType>);
|
|
53
51
|
/**
|
|
54
52
|
* Applies generation configuration to create the model definition.
|
|
55
53
|
*
|
|
56
54
|
* This method handles the core generation logic, including identifier resolution,
|
|
57
55
|
* export path management, and import registration for cross-file dependencies.
|
|
58
56
|
*
|
|
59
|
-
* @template T - The generation type
|
|
60
57
|
* @param args - Apply configuration arguments
|
|
61
|
-
* @param args.generation - Optional generation type (unused currently)
|
|
62
58
|
* @param args.destinationPath - Optional destination path for imports
|
|
63
59
|
* @returns Generated definition for the model
|
|
64
60
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelDriver.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB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C;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;;;;;;;;OAUG;gBACS,EACV,OAAO,EACP,UAAU,EACV,OAAO,EACP,eAAe,EACf,OAAO,EACP,QAAQ,EACT,EAAE,eAAe,CAAC,CAAC,EAAE,cAAc,CAAC;IAgBrC;;;;;;;;;OASG;IACH,OAAO,CAAC,KAAK;IAeb;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,aAAa;IA2CrB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,gBAAgB;CAqBzB"}
|
|
@@ -16,12 +16,11 @@ export class ModelDriver {
|
|
|
16
16
|
* @param args.context - Generation context
|
|
17
17
|
* @param args.insertable - Model insertable configuration
|
|
18
18
|
* @param args.refName - Reference name for the model
|
|
19
|
-
* @param args.generation - Optional generation type
|
|
20
19
|
* @param args.destinationPath - Optional destination path
|
|
21
20
|
* @param args.rootRef - Optional root reference name
|
|
22
21
|
* @param args.noExport - Whether to skip export declaration
|
|
23
22
|
*/
|
|
24
|
-
constructor({ context, insertable, refName,
|
|
23
|
+
constructor({ context, insertable, refName, destinationPath, rootRef, noExport }) {
|
|
25
24
|
/** The generation context */
|
|
26
25
|
Object.defineProperty(this, "context", {
|
|
27
26
|
enumerable: true,
|
|
@@ -86,7 +85,7 @@ export class ModelDriver {
|
|
|
86
85
|
this.noExport = noExport;
|
|
87
86
|
this.context.modelDepth[`${insertable.id}:${refName}`] = 0;
|
|
88
87
|
this.settings = this.context.toModelContentSettings({ refName, insertable });
|
|
89
|
-
this.definition = this.apply({
|
|
88
|
+
this.definition = this.apply({ destinationPath });
|
|
90
89
|
this.context.modelDepth[`${insertable.id}:${refName}`] = 0;
|
|
91
90
|
}
|
|
92
91
|
/**
|
|
@@ -95,18 +94,12 @@ export class ModelDriver {
|
|
|
95
94
|
* This method handles the core generation logic, including identifier resolution,
|
|
96
95
|
* export path management, and import registration for cross-file dependencies.
|
|
97
96
|
*
|
|
98
|
-
* @template T - The generation type
|
|
99
97
|
* @param args - Apply configuration arguments
|
|
100
|
-
* @param args.generation - Optional generation type (unused currently)
|
|
101
98
|
* @param args.destinationPath - Optional destination path for imports
|
|
102
99
|
* @returns Generated definition for the model
|
|
103
100
|
*/
|
|
104
|
-
apply({
|
|
101
|
+
apply({ destinationPath } = {}) {
|
|
105
102
|
const { identifier, exportPath } = this.settings;
|
|
106
|
-
// Everything is selected (for now)
|
|
107
|
-
// if (/*!selected && */ generation !== 'force') {
|
|
108
|
-
// return undefined as GeneratedDefinition<V, T>
|
|
109
|
-
// }
|
|
110
103
|
const definition = this.getDefinition({ identifier, exportPath });
|
|
111
104
|
if (destinationPath && normalize(exportPath) !== normalize(destinationPath)) {
|
|
112
105
|
this.context.register({
|
|
@@ -89,8 +89,8 @@ export declare const toModelBase: <EnrichmentType = undefined>(config: BaseModel
|
|
|
89
89
|
settings: ContentSettings<EnrichmentType>;
|
|
90
90
|
refName: RefName;
|
|
91
91
|
generatorKey: import("../GeneratorKeys.js").GeneratorKey;
|
|
92
|
-
insertModel<V extends import("../GeneratedValue.js").GeneratedValue, EnrichmentType_1 = undefined>(insertable: import("./types.js").ModelInsertable<V, EnrichmentType_1>, refName: RefName, options?: Pick<import("../../mod.js").InsertModelOptions
|
|
93
|
-
insertNormalizedModel<V extends import("../GeneratedValue.js").GeneratedValue, Schema extends import("../../mod.js").OasSchema | import("../../mod.js").OasRef<"schema"> | import("../../mod.js").OasVoid, EnrichmentType_2 = undefined>(insertable: import("./types.js").ModelInsertable<V, EnrichmentType_2>, { schema, fallbackName }: Omit<import("../../mod.js").InsertNormalisedModelArgs<Schema>, "destinationPath">, options?: Pick<import("../../mod.js").InsertModelOptions
|
|
92
|
+
insertModel<V extends import("../GeneratedValue.js").GeneratedValue, EnrichmentType_1 = undefined>(insertable: import("./types.js").ModelInsertable<V, EnrichmentType_1>, refName: RefName, options?: Pick<import("../../mod.js").InsertModelOptions, "noExport">): import("../Inserted.js").Inserted<V, EnrichmentType_1>;
|
|
93
|
+
insertNormalizedModel<V extends import("../GeneratedValue.js").GeneratedValue, Schema extends import("../../mod.js").OasSchema | import("../../mod.js").OasRef<"schema"> | import("../../mod.js").OasVoid, EnrichmentType_2 = undefined>(insertable: import("./types.js").ModelInsertable<V, EnrichmentType_2>, { schema, fallbackName }: Omit<import("../../mod.js").InsertNormalisedModelArgs<Schema>, "destinationPath">, options?: Pick<import("../../mod.js").InsertModelOptions, "noExport">): import("../../mod.js").InsertNormalisedModelReturn<V, Schema>;
|
|
94
94
|
register(args: import("../../mod.js").BaseRegisterArgs): void;
|
|
95
95
|
context: GenerateContextType;
|
|
96
96
|
skipped: boolean;
|
|
@@ -198,7 +198,7 @@ export declare class OperationBase<EnrichmentType = undefined> extends ContentBa
|
|
|
198
198
|
* }
|
|
199
199
|
* ```
|
|
200
200
|
*/
|
|
201
|
-
insertOperation<V extends GeneratedValue, EnrichmentType = undefined>(insertable: OperationInsertable<V, EnrichmentType>, operation: OasOperation, options?: Pick<InsertOperationOptions
|
|
201
|
+
insertOperation<V extends GeneratedValue, EnrichmentType = undefined>(insertable: OperationInsertable<V, EnrichmentType>, operation: OasOperation, options?: Pick<InsertOperationOptions, 'noExport'>): Inserted<V, EnrichmentType>;
|
|
202
202
|
/**
|
|
203
203
|
* Inserts a related model with forced generation.
|
|
204
204
|
*
|
|
@@ -240,7 +240,7 @@ export declare class OperationBase<EnrichmentType = undefined> extends ContentBa
|
|
|
240
240
|
* }
|
|
241
241
|
* ```
|
|
242
242
|
*/
|
|
243
|
-
insertModel<V extends GeneratedValue, EnrichmentType = undefined>(insertable: ModelInsertable<V, EnrichmentType>, refName: RefName, options?: Pick<InsertModelOptions
|
|
243
|
+
insertModel<V extends GeneratedValue, EnrichmentType = undefined>(insertable: ModelInsertable<V, EnrichmentType>, refName: RefName, options?: Pick<InsertModelOptions, 'noExport'>): Inserted<V, EnrichmentType>;
|
|
244
244
|
/**
|
|
245
245
|
* Inserts a related model with automatic schema normalization and reference resolution.
|
|
246
246
|
*
|
|
@@ -297,7 +297,7 @@ export declare class OperationBase<EnrichmentType = undefined> extends ContentBa
|
|
|
297
297
|
* }
|
|
298
298
|
* ```
|
|
299
299
|
*/
|
|
300
|
-
insertNormalizedModel<V extends GeneratedValue, Schema extends OasSchema | OasRef<'schema'> | OasVoid, EnrichmentType = undefined>(insertable: ModelInsertable<V, EnrichmentType>, { schema, fallbackName }: Omit<InsertNormalisedModelArgs<Schema>, 'destinationPath'>, options?: Pick<InsertModelOptions
|
|
300
|
+
insertNormalizedModel<V extends GeneratedValue, Schema extends OasSchema | OasRef<'schema'> | OasVoid, EnrichmentType = undefined>(insertable: ModelInsertable<V, EnrichmentType>, { schema, fallbackName }: Omit<InsertNormalisedModelArgs<Schema>, 'destinationPath'>, options?: Pick<InsertModelOptions, 'noExport'>): InsertNormalisedModelReturn<V, Schema>;
|
|
301
301
|
/**
|
|
302
302
|
* Defines and registers a new definition in the generation context.
|
|
303
303
|
*
|