@power-plant/core 0.0.15 → 0.0.16
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/README.md +1 -1
- package/dist/{config-D3-0eTEI.d.cts → config-B_E87BPl.d.cts} +56 -238
- package/dist/config-B_E87BPl.d.cts.map +1 -0
- package/dist/{config-D3-0eTEI.d.mts → config-B_E87BPl.d.mts} +56 -238
- package/dist/config-B_E87BPl.d.mts.map +1 -0
- package/dist/config.d.cts +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/context-BCW5TgL-.d.mts +183 -0
- package/dist/context-BCW5TgL-.d.mts.map +1 -0
- package/dist/context-C0n9Tore.d.cts +183 -0
- package/dist/context-C0n9Tore.d.cts.map +1 -0
- package/dist/context.cjs +1 -1
- package/dist/context.d.cts +34 -2
- package/dist/context.d.cts.map +1 -1
- package/dist/context.d.mts +34 -2
- package/dist/context.mjs +1 -1
- package/dist/define.d.cts +2 -2
- package/dist/define.d.cts.map +1 -1
- package/dist/define.d.mts +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +1 -1
- package/dist/{type-checks-DBObymgE.d.cts → type-checks-BYCnzjxr.d.cts} +4 -4
- package/dist/{type-checks-DBObymgE.d.cts.map → type-checks-BYCnzjxr.d.cts.map} +1 -1
- package/dist/{type-checks-DX_sqZhk.d.mts → type-checks-C-wRp-HW.d.mts} +4 -4
- package/dist/type-checks-C-wRp-HW.d.mts.map +1 -0
- package/dist/type-checks.d.cts +1 -1
- package/dist/type-checks.d.mts +1 -1
- package/dist/types/__internal.d.cts +4 -4
- package/dist/types/__internal.d.cts.map +1 -1
- package/dist/types/__internal.d.mts +4 -4
- package/package.json +5 -5
- package/dist/config-D3-0eTEI.d.cts.map +0 -1
- package/dist/config-D3-0eTEI.d.mts.map +0 -1
- package/dist/context-B4h787Dd.d.mts +0 -185
- package/dist/context-B4h787Dd.d.mts.map +0 -1
- package/dist/context-DYvyeLgC.d.cts +0 -185
- package/dist/context-DYvyeLgC.d.cts.map +0 -1
- package/dist/type-checks-DX_sqZhk.d.mts.map +0 -1
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ The Power Plant monorepo is a collection of packages that are designed to work t
|
|
|
33
33
|
|
|
34
34
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
35
35
|
|
|
36
|
-
[](https://docs.stormsoftware.com/projects/power-plant) [](http://commitizen.github.io/cz-cli/)  
|
|
37
37
|
|
|
38
38
|
<!-- prettier-ignore-start -->
|
|
39
39
|
<!-- markdownlint-disable -->
|
|
@@ -4,7 +4,6 @@ import { InferExtractOptions, SchemaConfig, SchemaEnvelopeOf, SchemaSourceConfig
|
|
|
4
4
|
import { InferLoadOptions, LoadReference } from "@stryke/resolve/types";
|
|
5
5
|
import { EnvPaths } from "@stryke/env/get-env-paths";
|
|
6
6
|
//#region src/types/meta.d.ts
|
|
7
|
-
type MetaValue<TSpec, TOptions extends object, TValue = any> = TValue | ((spec: TSpec, options: TOptions) => MaybePromise<TValue>);
|
|
8
7
|
type MetaDeprecated = true | string | {
|
|
9
8
|
message?: string;
|
|
10
9
|
since?: string;
|
|
@@ -14,25 +13,13 @@ type MetaLink = string | {
|
|
|
14
13
|
href: string;
|
|
15
14
|
description?: string;
|
|
16
15
|
};
|
|
17
|
-
|
|
18
|
-
* A metadata primitive value.
|
|
19
|
-
*/
|
|
20
|
-
type MetaDataPrimitive = string | number | boolean | null | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* A record of metadata primitive values.
|
|
23
|
-
*/
|
|
24
|
-
type MetaDataRecord<TSpec, TOptions extends object> = Record<string, MetaValue<TSpec, TOptions, MetaDataPrimitive | MetaDataPrimitive[]>>;
|
|
25
|
-
/**
|
|
26
|
-
* A record of metadata values.
|
|
27
|
-
*/
|
|
28
|
-
type MetaData<TSpec, TOptions extends object> = Record<string, MetaValue<TSpec, TOptions, MetaDataPrimitive | MetaDataPrimitive[] | MetaDataRecord<TSpec, TOptions>>>;
|
|
29
|
-
interface BaseMeta<TSpec, TOptions extends object> {
|
|
16
|
+
interface BaseMetaConfig {
|
|
30
17
|
/**
|
|
31
18
|
* Additional data associated with the object.
|
|
32
19
|
*/
|
|
33
|
-
data?:
|
|
20
|
+
data?: Record<string, any>;
|
|
34
21
|
}
|
|
35
|
-
interface MetaConfig
|
|
22
|
+
interface MetaConfig extends BaseMetaConfig {
|
|
36
23
|
/**
|
|
37
24
|
* A name for the object, which can be used to identify or reference the object in documentation, tooling, or other contexts. The presence of this property does not affect the validation behavior of the object itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
38
25
|
*
|
|
@@ -59,83 +46,30 @@ interface MetaConfig<TSpec, TOptions extends object> extends BaseMeta<TSpec, TOp
|
|
|
59
46
|
* @remarks
|
|
60
47
|
* The `title` property is a string that can be used to give the object a more user-friendly or descriptive name. It can be used in documentation, error messages, or other contexts where it is helpful to have a display name associated with the object. The presence of this property does not affect the validation behavior of the object itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
61
48
|
*/
|
|
62
|
-
title?:
|
|
63
|
-
/**
|
|
64
|
-
* A string that describes when the object is used.
|
|
65
|
-
*/
|
|
66
|
-
usage?: MetaValue<TSpec, TOptions, string>;
|
|
67
|
-
/**
|
|
68
|
-
* Indicates whether the object is deprecated, and optionally provides additional information about the deprecation, such as a message, the version since which it is deprecated, and an alternative object to use instead.
|
|
69
|
-
*
|
|
70
|
-
* @remarks
|
|
71
|
-
* The `deprecated` property can be a boolean value, where `true` indicates that the object is deprecated and `false` indicates that it is not. It can also be a string that provides a message explaining the deprecation, or an object that includes additional details such as a message, the version since which it is deprecated, and an alternative object to use instead. The presence of this property does not affect the validation behavior of the object itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
72
|
-
*/
|
|
73
|
-
deprecated?: MetaValue<TSpec, TOptions, MetaDeprecated>;
|
|
74
|
-
/**
|
|
75
|
-
* An array of tags associated with the object. Tags can be used to categorize or label objects for organizational purposes, making it easier to search, filter, or group related objects together. The presence of this property does not affect the validation behavior of the object itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
76
|
-
*
|
|
77
|
-
* @remarks
|
|
78
|
-
* Each tag in the array should be a string that represents a meaningful label or category for the object. It is recommended to use consistent and descriptive tags across objects to facilitate easier management and discovery of related objects.
|
|
79
|
-
*/
|
|
80
|
-
tags?: MetaValue<TSpec, TOptions, string[]>;
|
|
81
|
-
/**
|
|
82
|
-
* An array of links associated with the object. Each link can be a string representing a URL or an object containing a `href` property and an optional `description` property.
|
|
83
|
-
*/
|
|
84
|
-
links?: MetaValue<TSpec, TOptions, MetaLink[]>;
|
|
85
|
-
}
|
|
86
|
-
interface Meta<TSpec, TOptions extends object> extends BaseMeta<TSpec, TOptions> {
|
|
87
|
-
/**
|
|
88
|
-
* A name for the object, which can be used to identify or reference the object in documentation, tooling, or other contexts. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
89
|
-
*
|
|
90
|
-
* @remarks
|
|
91
|
-
* The `name` property is a string that can be used to give the object a human-readable identifier. It can be used in documentation, error messages, or other contexts where it is helpful to have a name associated with the schema. The presence of this property does not affect the validation behavior of the object itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
92
|
-
*/
|
|
93
|
-
name?: MetaValue<TSpec, TOptions, string>;
|
|
94
|
-
/**
|
|
95
|
-
* A version string that indicates the version of the object. This property can be used to track changes or updates to the object over time, allowing consumers of the object to determine which version they are working with. The presence of this property does not affect the validation behavior of the object itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
96
|
-
*
|
|
97
|
-
* @remarks
|
|
98
|
-
* The `version` property is a string that can follow any versioning scheme, such as semantic versioning (e.g., "1.0.0", "2.1.3"), date-based versioning (e.g., "2023-06-15"), or any other format that conveys the version of the object. It is recommended to use a consistent versioning scheme across all objects to facilitate easier tracking and management of object versions.
|
|
99
|
-
*
|
|
100
|
-
* @defaultValue "1.0"
|
|
101
|
-
*/
|
|
102
|
-
version?: MetaValue<TSpec, TOptions, string | Date | number>;
|
|
103
|
-
/**
|
|
104
|
-
* A string that describes the object in some way.
|
|
105
|
-
*/
|
|
106
|
-
description?: MetaValue<TSpec, TOptions, string>;
|
|
107
|
-
/**
|
|
108
|
-
* A string that provides a human-readable name for the object, which can be used in documentation, tooling, or other contexts to identify or reference the object. The presence of this property does not affect the validation behavior of the object itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
109
|
-
*
|
|
110
|
-
* @remarks
|
|
111
|
-
* The `title` property is a string that can be used to give the object a more user-friendly or descriptive name. It can be used in documentation, error messages, or other contexts where it is helpful to have a display name associated with the object. The presence of this property does not affect the validation behavior of the object itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
112
|
-
*/
|
|
113
|
-
title?: MetaValue<TSpec, TOptions, string>;
|
|
49
|
+
title?: string;
|
|
114
50
|
/**
|
|
115
51
|
* A string that describes when the object is used.
|
|
116
52
|
*/
|
|
117
|
-
usage?:
|
|
53
|
+
usage?: string;
|
|
118
54
|
/**
|
|
119
55
|
* Indicates whether the object is deprecated, and optionally provides additional information about the deprecation, such as a message, the version since which it is deprecated, and an alternative object to use instead.
|
|
120
56
|
*
|
|
121
57
|
* @remarks
|
|
122
58
|
* The `deprecated` property can be a boolean value, where `true` indicates that the object is deprecated and `false` indicates that it is not. It can also be a string that provides a message explaining the deprecation, or an object that includes additional details such as a message, the version since which it is deprecated, and an alternative object to use instead. The presence of this property does not affect the validation behavior of the object itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
123
59
|
*/
|
|
124
|
-
deprecated?:
|
|
60
|
+
deprecated?: MetaDeprecated;
|
|
125
61
|
/**
|
|
126
62
|
* An array of tags associated with the object. Tags can be used to categorize or label objects for organizational purposes, making it easier to search, filter, or group related objects together. The presence of this property does not affect the validation behavior of the object itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
127
63
|
*
|
|
128
64
|
* @remarks
|
|
129
65
|
* Each tag in the array should be a string that represents a meaningful label or category for the object. It is recommended to use consistent and descriptive tags across objects to facilitate easier management and discovery of related objects.
|
|
130
66
|
*/
|
|
131
|
-
tags?:
|
|
67
|
+
tags?: string[];
|
|
132
68
|
/**
|
|
133
69
|
* An array of links associated with the object. Each link can be a string representing a URL or an object containing a `href` property and an optional `description` property.
|
|
134
70
|
*/
|
|
135
|
-
links?:
|
|
71
|
+
links?: MetaLink[];
|
|
136
72
|
}
|
|
137
|
-
type InferExtractedMetaDataRecord<TMetaValue extends MetaDataRecord<any, any>> = { [K in keyof TMetaValue]: TMetaValue[K] extends MetaValue<any, any, infer U> ? U extends MetaDataRecord<any, any> ? InferExtractedMetaDataRecord<U> : U : TMetaValue[K]; };
|
|
138
|
-
type InferExtractedMeta<TMeta extends Meta<any, any>> = { [K in keyof TMeta]: TMeta[K] extends MetaValue<any, any, infer U> ? U extends MetaDataRecord<any, any> ? InferExtractedMetaDataRecord<U> : U : TMeta[K]; };
|
|
139
73
|
//#endregion
|
|
140
74
|
//#region src/types/schema.d.ts
|
|
141
75
|
type SchemaMetaExample<TSpec> = TSpec | {
|
|
@@ -143,26 +77,20 @@ type SchemaMetaExample<TSpec> = TSpec | {
|
|
|
143
77
|
description?: string;
|
|
144
78
|
value: TSpec;
|
|
145
79
|
};
|
|
146
|
-
interface SchemaMetaConfig<TSpec
|
|
80
|
+
interface SchemaMetaConfig<TSpec> extends MetaConfig {
|
|
147
81
|
/**
|
|
148
82
|
* Examples of valid data for the schema. This can be a single example or an array of examples.
|
|
149
83
|
*/
|
|
150
|
-
examples?: SchemaMetaExample<TSpec> |
|
|
84
|
+
examples?: SchemaMetaExample<TSpec> | SchemaMetaExample<TSpec>[];
|
|
151
85
|
/**
|
|
152
86
|
* A description of the specification that is described by this schema.
|
|
153
87
|
*/
|
|
154
|
-
spec?:
|
|
155
|
-
}
|
|
156
|
-
interface SchemaMeta<TSpec, TOptions extends object = any> extends Meta<TSpec, TOptions> {
|
|
157
|
-
/**
|
|
158
|
-
* Examples of valid data for the schema.
|
|
159
|
-
*/
|
|
160
|
-
examples: MetaValue<TSpec, TOptions, SchemaMetaExample<TSpec>[]>;
|
|
88
|
+
spec?: string;
|
|
161
89
|
}
|
|
162
90
|
/**
|
|
163
91
|
* Schema input wrapper that attaches optional contextual metadata.
|
|
164
92
|
*/
|
|
165
|
-
interface SchemaConfigObject<TSpec
|
|
93
|
+
interface SchemaConfigObject<TSpec> {
|
|
166
94
|
/**
|
|
167
95
|
* The schema that defines the structure of the specification input for the generator. This schema is used to validate the input specification and ensure that it conforms to the expected format before being processed by the generator.
|
|
168
96
|
*/
|
|
@@ -170,17 +98,17 @@ interface SchemaConfigObject<TSpec, TOptions extends object = any> {
|
|
|
170
98
|
/**
|
|
171
99
|
* Optional metadata that provides contextual information for the schema.
|
|
172
100
|
*/
|
|
173
|
-
meta?: SchemaMetaConfig<TSpec
|
|
101
|
+
meta?: SchemaMetaConfig<TSpec>;
|
|
174
102
|
}
|
|
175
|
-
type InferCreateSchemaOptions<T extends SchemaSourceConfig<any> | SchemaEnvelopeOf<any> | SchemaConfigObject<any
|
|
103
|
+
type InferCreateSchemaOptions<T extends SchemaSourceConfig<any> | SchemaEnvelopeOf<any> | SchemaConfigObject<any>> = T extends SchemaSourceConfig<any> | SchemaEnvelopeOf<any> ? InferExtractOptions<T> : {};
|
|
176
104
|
/**
|
|
177
105
|
* A schema extracted from a source input, normalized to JSON Schema.
|
|
178
106
|
*/
|
|
179
|
-
interface Schema<TSpec
|
|
107
|
+
interface Schema<TSpec> extends SchemaEnvelopeOf<TSpec> {
|
|
180
108
|
/**
|
|
181
109
|
* Optional contextual metadata associated with the schema.
|
|
182
110
|
*/
|
|
183
|
-
meta:
|
|
111
|
+
meta: SchemaMetaConfig<TSpec>;
|
|
184
112
|
}
|
|
185
113
|
/**
|
|
186
114
|
* A normalized JSON Schema extracted from a source input of type `T`. This type represents the result of the schema extraction process, where a raw schema input (which could be in various formats such as Zod, Untyped, Valibot, or as a type definition in TypeScript source code) is transformed into a standardized JSON Schema format. The `SchemaOf<T>` type captures the normalized JSON Schema along with metadata about the source variant and a content hash for caching or identification purposes.
|
|
@@ -189,27 +117,21 @@ interface Schema<TSpec, TOptions extends object = any> extends SchemaEnvelopeOf<
|
|
|
189
117
|
*
|
|
190
118
|
* @see {@link Schema}
|
|
191
119
|
*/
|
|
192
|
-
type SchemaOf<TSpec
|
|
120
|
+
type SchemaOf<TSpec> = Schema<TSpec>;
|
|
193
121
|
//#endregion
|
|
194
122
|
//#region src/types/input.d.ts
|
|
195
|
-
|
|
196
|
-
interface InputMetaConfig<TSpec, TOptions extends object> extends MetaConfig<TSpec, TOptions> {
|
|
197
|
-
/**
|
|
198
|
-
* A string that describes how the specification will be read/extracted. This property can provide context about the input of the specification, such as whether it is derived from a file, a database, an API, or any other input. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
199
|
-
*/
|
|
200
|
-
readFrom?: MetaValue<TSpec, TOptions, string>;
|
|
201
|
-
}
|
|
202
|
-
interface InputMeta<TSpec, TOptions extends object> extends Meta<TSpec, TOptions> {
|
|
123
|
+
interface InputMetaConfig extends MetaConfig {
|
|
203
124
|
/**
|
|
204
|
-
* A string that describes how the specification will be read/extracted.
|
|
125
|
+
* A string that describes how the specification will be read/extracted.
|
|
205
126
|
*/
|
|
206
127
|
readFrom?: string;
|
|
207
128
|
}
|
|
129
|
+
type InputFunction<TSpec, TOptions extends object> = (options: TOptions) => MaybePromise<TSpec>;
|
|
208
130
|
interface InputConfigObject<TSpec, TOptions extends object> {
|
|
209
131
|
/**
|
|
210
132
|
* The schema that defines the structure of the specification input for the generator. This schema is used to validate the input specification and ensure that it conforms to the expected format before being processed by the generator.
|
|
211
133
|
*/
|
|
212
|
-
schema?: SchemaConfig<TSpec> | SchemaConfigObject<TSpec
|
|
134
|
+
schema?: SchemaConfig<TSpec> | SchemaConfigObject<TSpec>;
|
|
213
135
|
/**
|
|
214
136
|
* The input implementation, either as a callable function, a static value, or a file reference.
|
|
215
137
|
*/
|
|
@@ -217,7 +139,7 @@ interface InputConfigObject<TSpec, TOptions extends object> {
|
|
|
217
139
|
/**
|
|
218
140
|
* Optional metadata that provides contextual information for the input.
|
|
219
141
|
*/
|
|
220
|
-
meta?: InputMetaConfig
|
|
142
|
+
meta?: InputMetaConfig;
|
|
221
143
|
}
|
|
222
144
|
type InputConfig<TSpec, TOptions extends object> = LoadReference | TSpec | InputFunction<TSpec, TOptions> | InputConfigObject<TSpec, TOptions>;
|
|
223
145
|
type InferCreateInputOptions<T extends InputConfig<any, any>> = T extends LoadReference ? InferLoadOptions<T> : {};
|
|
@@ -225,11 +147,11 @@ interface Input<TSpec, TOptions extends object> {
|
|
|
225
147
|
/**
|
|
226
148
|
* The schema that defines the structure of the specification input for the generator. This schema is used to validate the input specification and ensure that it conforms to the expected format before being processed by the generator.
|
|
227
149
|
*/
|
|
228
|
-
schema: SchemaOf<TSpec
|
|
150
|
+
schema: SchemaOf<TSpec>;
|
|
229
151
|
/**
|
|
230
152
|
* Optional metadata that provides contextual information for the input.
|
|
231
153
|
*/
|
|
232
|
-
meta?:
|
|
154
|
+
meta?: InputMetaConfig;
|
|
233
155
|
/**
|
|
234
156
|
* The input of the generator, which can be used to specify where the generator retrieves its input data from. This can be defined as a function that takes the specification and returns a value, or it can be a static value.
|
|
235
157
|
*
|
|
@@ -242,128 +164,23 @@ interface Input<TSpec, TOptions extends object> {
|
|
|
242
164
|
input: TSpec | InputFunction<TSpec, TOptions>;
|
|
243
165
|
}
|
|
244
166
|
//#endregion
|
|
245
|
-
//#region src/types/
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* The content of the chunk.
|
|
249
|
-
*/
|
|
250
|
-
content: string;
|
|
167
|
+
//#region src/types/generator.d.ts
|
|
168
|
+
type GeneratorMeta<TSpec, TOptions extends object> = MetaConfig & {
|
|
251
169
|
/**
|
|
252
|
-
*
|
|
170
|
+
* A string description outlining the purpose or behavior of the generator.
|
|
253
171
|
*/
|
|
254
|
-
|
|
172
|
+
description?: string;
|
|
173
|
+
};
|
|
174
|
+
interface GeneratedDocumentChunk {
|
|
175
|
+
content?: string;
|
|
176
|
+
meta?: MetaConfig;
|
|
255
177
|
}
|
|
256
|
-
interface
|
|
257
|
-
/**
|
|
258
|
-
* The path of the document.
|
|
259
|
-
*/
|
|
178
|
+
interface GeneratedDocument<TSpec, TOptions extends object> {
|
|
260
179
|
path: string;
|
|
261
|
-
/**
|
|
262
|
-
* The language of the document.
|
|
263
|
-
*/
|
|
264
180
|
language?: string;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
*/
|
|
268
|
-
chunks: ExecutionDocumentChunk<TSpec, TOptions>[];
|
|
269
|
-
/**
|
|
270
|
-
* The metadata of the document.
|
|
271
|
-
*/
|
|
272
|
-
meta: Meta<TSpec, TOptions>;
|
|
273
|
-
}
|
|
274
|
-
interface ExecutionMeta<TSpec, TOptions extends object> extends Meta<TSpec, TOptions> {
|
|
275
|
-
/**
|
|
276
|
-
* A unique identifier for the execution, typically used by the backend systems.
|
|
277
|
-
*
|
|
278
|
-
* @remarks
|
|
279
|
-
* This value will be in the UUID format, which is a 128-bit number represented as a string of hexadecimal digits. It is used to uniquely identify the execution in the backend systems and can be used for tracking and auditing purposes.
|
|
280
|
-
*/
|
|
281
|
-
executionId: string;
|
|
282
|
-
/**
|
|
283
|
-
* The date and time when the execution was performed.
|
|
284
|
-
*/
|
|
285
|
-
executedAt: Date;
|
|
286
|
-
/**
|
|
287
|
-
* The user who performed the execution.
|
|
288
|
-
*/
|
|
289
|
-
executedBy: string;
|
|
290
|
-
/**
|
|
291
|
-
* The specification used to generate the source code during the execution.
|
|
292
|
-
*/
|
|
293
|
-
spec: TSpec;
|
|
294
|
-
/**
|
|
295
|
-
* The metadata of the generator used to execute the source code during the execution.
|
|
296
|
-
*/
|
|
297
|
-
generator: GeneratorMeta<TSpec, TOptions>;
|
|
298
|
-
/**
|
|
299
|
-
* The metadata of the schema used to generate the source code during the execution.
|
|
300
|
-
*/
|
|
301
|
-
schema: SchemaMeta<TSpec, TOptions>;
|
|
302
|
-
/**
|
|
303
|
-
* The metadata of the input used to generate the source code during the execution.
|
|
304
|
-
*/
|
|
305
|
-
input: InputMeta<TSpec, TOptions>;
|
|
306
|
-
/**
|
|
307
|
-
* The metadata of the output used to generate the source code during the execution.
|
|
308
|
-
*/
|
|
309
|
-
output: OutputMeta<TSpec, TOptions>;
|
|
310
|
-
}
|
|
311
|
-
interface Execution<TSpec, TOptions extends object> {
|
|
312
|
-
/**
|
|
313
|
-
* The documents of the execution, indexed by the document path.
|
|
314
|
-
*/
|
|
315
|
-
documents: Record<string, ExecutionDocument<TSpec, TOptions>>;
|
|
316
|
-
/**
|
|
317
|
-
* The metadata of the execution.
|
|
318
|
-
*/
|
|
319
|
-
meta: ExecutionMeta<TSpec, TOptions>;
|
|
320
|
-
}
|
|
321
|
-
type ExecutionResult<TSpec, TOptions extends object, TReturns = void> = GeneratedDocument<TSpec, TOptions> & {
|
|
322
|
-
/**
|
|
323
|
-
* The returned value of the generator function.
|
|
324
|
-
*/
|
|
325
|
-
returns?: TReturns;
|
|
326
|
-
};
|
|
327
|
-
type ExtractedExecutionSource<TSpec, TOptions extends object> = Omit<ExecutionDocumentChunk<TSpec, TOptions>, "meta"> & {
|
|
328
|
-
/**
|
|
329
|
-
* The extracted metadata of the execution.
|
|
330
|
-
*/
|
|
331
|
-
meta: InferExtractedMeta<ExecutionDocumentChunk<TSpec, TOptions>["meta"]>;
|
|
332
|
-
};
|
|
333
|
-
type ExtractedExecutionDocument<TSpec, TOptions extends object> = Omit<ExecutionDocument<TSpec, TOptions>, "source" | "meta"> & {
|
|
334
|
-
/**
|
|
335
|
-
* The source of the document.
|
|
336
|
-
*/
|
|
337
|
-
source: ExtractedExecutionSource<TSpec, TOptions>[];
|
|
338
|
-
/**
|
|
339
|
-
* The extracted metadata of the execution.
|
|
340
|
-
*/
|
|
341
|
-
meta: InferExtractedMeta<ExecutionDocument<TSpec, TOptions>["meta"]>;
|
|
342
|
-
};
|
|
343
|
-
type ExtractedExecution<TSpec, TOptions extends object> = Omit<Execution<TSpec, TOptions>, "documents" | "meta"> & {
|
|
344
|
-
/**
|
|
345
|
-
* The documents of the execution, indexed by the document path.
|
|
346
|
-
*/
|
|
347
|
-
documents: Record<string, ExtractedExecutionDocument<TSpec, TOptions>>;
|
|
348
|
-
/**
|
|
349
|
-
* The extracted metadata of the execution.
|
|
350
|
-
*/
|
|
351
|
-
meta: InferExtractedMeta<ExecutionMeta<TSpec, TOptions>>;
|
|
352
|
-
};
|
|
353
|
-
//#endregion
|
|
354
|
-
//#region src/types/generator.d.ts
|
|
355
|
-
interface GeneratorMeta<TSpec, TOptions extends object> extends MetaConfig<TSpec, TOptions> {
|
|
356
|
-
/**
|
|
357
|
-
* A string description (or a function that returns a string) outlining the purpose or behavior of the generator.
|
|
358
|
-
*/
|
|
359
|
-
description?: string;
|
|
181
|
+
chunks?: DeepPartial<GeneratedDocumentChunk>[];
|
|
182
|
+
meta?: MetaConfig;
|
|
360
183
|
}
|
|
361
|
-
type GeneratedDocument<TSpec, TOptions extends object> = Partial<Omit<ExecutionDocument<TSpec, TOptions>, "source">> & Pick<ExecutionDocument<TSpec, TOptions>, "path"> & {
|
|
362
|
-
/**
|
|
363
|
-
* The sources of the document.
|
|
364
|
-
*/
|
|
365
|
-
chunks?: DeepPartial<ExecutionDocumentChunk<TSpec, TOptions>>[];
|
|
366
|
-
};
|
|
367
184
|
type GeneratorFunction<TSpec, TOptions extends object> = (spec: TSpec, options: TOptions) => MaybePromise<Record<string, GeneratedDocument<TSpec, TOptions>>>;
|
|
368
185
|
type GeneratorFunctionResult<TSpec, TOptions extends object> = Awaited<ReturnType<GeneratorFunction<TSpec, TOptions>>>;
|
|
369
186
|
interface GeneratorResult<TSpec, TOptions extends object, TReturns = void> {
|
|
@@ -392,7 +209,7 @@ interface GeneratorConfigObject<TSpec, TOptions extends object, TReturns = void>
|
|
|
392
209
|
/**
|
|
393
210
|
* The schema config that defines the structure of the specification object for this generator.
|
|
394
211
|
*/
|
|
395
|
-
schema?: SchemaConfig<TSpec> | SchemaConfigObject<TSpec
|
|
212
|
+
schema?: SchemaConfig<TSpec> | SchemaConfigObject<TSpec>;
|
|
396
213
|
/**
|
|
397
214
|
* The input config for the generator specification.
|
|
398
215
|
*/
|
|
@@ -416,7 +233,7 @@ interface Generator<TSpec, TOptions extends object, TReturns = void> {
|
|
|
416
233
|
/**
|
|
417
234
|
* The schema config that defines the structure of the specification object for this generator.
|
|
418
235
|
*/
|
|
419
|
-
schema: SchemaOf<TSpec
|
|
236
|
+
schema: SchemaOf<TSpec>;
|
|
420
237
|
/**
|
|
421
238
|
* The input of the generator, which can be used to specify where the generator retrieves its input data from. This can be defined as a function that takes the specification and returns a value, or it can be a static value.
|
|
422
239
|
*/
|
|
@@ -436,30 +253,31 @@ interface Generator<TSpec, TOptions extends object, TReturns = void> {
|
|
|
436
253
|
*/
|
|
437
254
|
generator: (options: TOptions & UserConfig) => Promise<GeneratorResult<TSpec, TOptions, TReturns>>;
|
|
438
255
|
}
|
|
256
|
+
type InferSchemaConfig<T extends GeneratorConfig<any, any, any>> = T extends LoadReference ? InferLoadOptions<T> : T extends GeneratorConfigObject<any, any, any> ? T["schema"] : never;
|
|
257
|
+
type InferGeneratorMeta<T extends GeneratorConfig<any, any, any>> = T extends LoadReference ? InferLoadOptions<T> : T extends GeneratorConfigObject<any, any, any> ? T["meta"] : never;
|
|
258
|
+
type InferInputConfig<T extends GeneratorConfig<any, any, any>> = T extends LoadReference ? InferLoadOptions<T> : T extends GeneratorConfigObject<any, any, any> ? T["input"] : never;
|
|
259
|
+
type InferOutputConfig<T extends GeneratorConfig<any, any, any>> = T extends LoadReference ? InferLoadOptions<T> : T extends GeneratorConfigObject<any, any, any> ? T["output"] : never;
|
|
260
|
+
type InferGeneratorFunction<T extends GeneratorConfig<any, any, any>> = T extends LoadReference ? InferLoadOptions<T> : T extends GeneratorConfigObject<any, any, any> ? T["generator"] : never;
|
|
261
|
+
type InferGeneratorResult<T extends GeneratorConfig<any, any, any>> = InferGeneratorFunction<T> extends GeneratorFunction<any, any> ? Awaited<ReturnType<InferGeneratorFunction<T>>> : never;
|
|
262
|
+
interface InferGenerator<T extends GeneratorConfig<any, any, any>> {
|
|
263
|
+
meta?: InferGeneratorMeta<T>;
|
|
264
|
+
schema: InferSchemaConfig<T>;
|
|
265
|
+
input: InferInputConfig<T>;
|
|
266
|
+
output: InferOutputConfig<T>;
|
|
267
|
+
generator: InferGeneratorFunction<T>;
|
|
268
|
+
}
|
|
439
269
|
//#endregion
|
|
440
270
|
//#region src/types/output.d.ts
|
|
441
271
|
type OutputFunction<TSpec, TOptions extends object, TReturns = void> = (spec: TSpec, options: TOptions, documents: Record<string, GeneratedDocument<TSpec, TOptions>>) => MaybePromise<TReturns>;
|
|
442
|
-
interface OutputMetaConfig<TSpec, TOptions extends object> extends MetaConfig<TSpec, TOptions> {
|
|
443
|
-
/**
|
|
444
|
-
* A string that describes how the specification will be extracted or generated. This property can provide context about the source of the specification, such as whether it is derived from a file, a database, an API, or any other source. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
445
|
-
*/
|
|
446
|
-
produces?: string;
|
|
447
|
-
}
|
|
448
|
-
interface OutputMeta<TSpec, TOptions extends object> extends Meta<TSpec, TOptions> {
|
|
449
|
-
/**
|
|
450
|
-
* A string that describes how the specification will be extracted or generated. This property can provide context about the source of the specification, such as whether it is derived from a file, a database, an API, or any other source. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
451
|
-
*/
|
|
452
|
-
produces?: string;
|
|
453
|
-
}
|
|
454
272
|
interface OutputConfigObject<TSpec, TOptions extends object, TReturns = void> {
|
|
455
273
|
/**
|
|
456
274
|
* The schema that defines the structure of the specification output for the generator. This schema is used to validate the output specification and ensure that it conforms to the expected format before being processed by the generator.
|
|
457
275
|
*/
|
|
458
|
-
schema?: SchemaConfig<TSpec> | SchemaConfigObject<TSpec
|
|
276
|
+
schema?: SchemaConfig<TSpec> | SchemaConfigObject<TSpec>;
|
|
459
277
|
/**
|
|
460
278
|
* Optional metadata that provides contextual information for the output.
|
|
461
279
|
*/
|
|
462
|
-
meta?:
|
|
280
|
+
meta?: MetaConfig;
|
|
463
281
|
/**
|
|
464
282
|
* The output implementation, either as a callable function or a file reference.
|
|
465
283
|
*/
|
|
@@ -471,11 +289,11 @@ interface Output<TSpec, TOptions extends object, TReturns = void> {
|
|
|
471
289
|
/**
|
|
472
290
|
* The schema that defines the structure of the specification output for the generator. This schema is used to validate the output specification and ensure that it conforms to the expected format before being processed by the generator.
|
|
473
291
|
*/
|
|
474
|
-
schema: SchemaOf<TSpec
|
|
292
|
+
schema: SchemaOf<TSpec>;
|
|
475
293
|
/**
|
|
476
294
|
* Optional metadata that provides contextual information for the output.
|
|
477
295
|
*/
|
|
478
|
-
meta?:
|
|
296
|
+
meta?: MetaConfig;
|
|
479
297
|
/**
|
|
480
298
|
* The output of the generator, which can be used to specify where the generator sends its output data. This can be defined as a function that takes the specification and returns a value, or it can be a static value.
|
|
481
299
|
*
|
|
@@ -567,5 +385,5 @@ type UserConfigFnPromise<TSpec = any, TOptions extends object = any, TReturns =
|
|
|
567
385
|
type UserConfigFn<TSpec = any, TOptions extends object = any, TReturns = any> = (params: UserConfigParams) => UserConfig<TSpec, TOptions, TReturns> | UserConfig<TSpec, TOptions, TReturns>[] | Promise<UserConfig<TSpec, TOptions, TReturns> | UserConfig<TSpec, TOptions, TReturns>[]>;
|
|
568
386
|
type UserConfigExport<TSpec = any, TOptions extends object = any, TReturns = any> = UserConfig<TSpec, TOptions, TReturns> | UserConfig<TSpec, TOptions, TReturns>[] | Promise<UserConfig<TSpec, TOptions, TReturns> | UserConfig<TSpec, TOptions, TReturns>[]> | UserConfigFnObject<TSpec, TOptions, TReturns> | UserConfigFnPromise<TSpec, TOptions, TReturns> | UserConfigFn<TSpec, TOptions, TReturns>;
|
|
569
387
|
//#endregion
|
|
570
|
-
export {
|
|
571
|
-
//# sourceMappingURL=config-
|
|
388
|
+
export { InferSchemaConfig as A, SchemaMetaConfig as B, InferCreateGeneratorOptions as C, InferGeneratorResult as D, InferGeneratorMeta as E, InputFunction as F, MetaDeprecated as G, SchemaOf as H, InputMetaConfig as I, MetaLink as K, InferCreateSchemaOptions as L, Input as M, InputConfig as N, InferInputConfig as O, InputConfigObject as P, Schema as R, GeneratorResult as S, InferGeneratorFunction as T, BaseMetaConfig as U, SchemaMetaExample as V, MetaConfig as W, GeneratorConfig as _, UserConfigFnPromise as a, GeneratorFunctionResult as b, Settings as c, OutputConfig as d, OutputConfigObject as f, Generator as g, GeneratedDocumentChunk as h, UserConfigFnObject as i, InferCreateInputOptions as j, InferOutputConfig as k, InferCreateOutputOptions as l, GeneratedDocument as m, UserConfigExport as n, UserConfigParams as o, OutputFunction as p, UserConfigFn as r, Logger as s, UserConfig as t, Output as u, GeneratorConfigObject as v, InferGenerator as w, GeneratorMeta as x, GeneratorFunction as y, SchemaConfigObject as z };
|
|
389
|
+
//# sourceMappingURL=config-B_E87BPl.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-B_E87BPl.d.cts","names":[],"sources":["../src/types/meta.ts","../src/types/schema.ts","../src/types/input.ts","../src/types/generator.ts","../src/types/output.ts","../src/types/settings.ts","../src/types/config.ts"],"mappings":";;;;;;KAkBY;EACQ;EAAkB;EAAgB;;KAE1C;EAAsB;EAAc;;UAE/B;;;;EAIf,OAAO;;UAGQ,mBAAmB;;;;;;;EAOlC;;;;;;;;;EAUA,mBAAmB;;;;EAKnB;;;;;;;EAQA;;;;EAKA;;;;;;;EAQA,aAAa;;;;;;;EAQb;;;;EA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