@power-plant/core 0.0.5 → 0.0.7
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 +2 -2
- package/dist/config-B6Gr29ZK.d.cts +566 -0
- package/dist/config-B6Gr29ZK.d.cts.map +1 -0
- package/dist/config-B6Gr29ZK.d.mts +566 -0
- package/dist/config-B6Gr29ZK.d.mts.map +1 -0
- package/dist/config.cjs +1 -0
- package/dist/config.d.cts +34 -0
- package/dist/config.d.cts.map +1 -0
- package/dist/config.d.mts +34 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +2 -0
- package/dist/config.mjs.map +1 -0
- package/dist/context-QCvV8cA9.d.cts +129 -0
- package/dist/context-QCvV8cA9.d.cts.map +1 -0
- package/dist/context-neyaFruu.d.mts +129 -0
- package/dist/context-neyaFruu.d.mts.map +1 -0
- package/dist/context.cjs +1 -0
- package/dist/context.d.cts +91 -0
- package/dist/context.d.cts.map +1 -0
- package/dist/context.d.mts +91 -0
- package/dist/context.d.mts.map +1 -0
- package/dist/context.mjs +2 -0
- package/dist/context.mjs.map +1 -0
- package/dist/define.cjs +1 -0
- package/dist/define.d.cts +82 -0
- package/dist/define.d.cts.map +1 -0
- package/dist/define.d.mts +82 -0
- package/dist/define.d.mts.map +1 -0
- package/dist/define.mjs +2 -0
- package/dist/define.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +7 -101
- package/dist/index.d.mts +7 -101
- package/dist/index.mjs +1 -1
- package/dist/type-checks-C3obf_M5.d.cts +53 -0
- package/dist/type-checks-C3obf_M5.d.cts.map +1 -0
- package/dist/type-checks-Cj1slvLD.d.mts +53 -0
- package/dist/type-checks-Cj1slvLD.d.mts.map +1 -0
- package/dist/type-checks.cjs +1 -0
- package/dist/type-checks.d.cts +2 -0
- package/dist/type-checks.d.mts +2 -0
- package/dist/type-checks.mjs +2 -0
- package/dist/type-checks.mjs.map +1 -0
- package/dist/types/__internal.cjs +0 -0
- package/dist/types/__internal.d.cts +14 -0
- package/dist/types/__internal.d.cts.map +1 -0
- package/dist/types/__internal.d.mts +14 -0
- package/dist/types/__internal.d.mts.map +1 -0
- package/dist/types/__internal.mjs +1 -0
- package/package.json +52 -53
- package/dist/context-BGSa-2fY.mjs +0 -2
- package/dist/context-BGSa-2fY.mjs.map +0 -1
- package/dist/context-Bcrz4kGb.cjs +0 -1
- package/dist/create-0IEoomGw.cjs +0 -1
- package/dist/create-CYRTmdJO.mjs +0 -2
- package/dist/create-CYRTmdJO.mjs.map +0 -1
- package/dist/create-D_u2Zj81.cjs +0 -1
- package/dist/create-DcfhZUHw.mjs +0 -2
- package/dist/create-DcfhZUHw.mjs.map +0 -1
- package/dist/create-MFKW4s0V.cjs +0 -1
- package/dist/create-cqJljXdZ.mjs +0 -2
- package/dist/create-cqJljXdZ.mjs.map +0 -1
- package/dist/define-B5baoppv.d.cts +0 -14
- package/dist/define-B5baoppv.d.cts.map +0 -1
- package/dist/define-BNsSORkE.d.cts +0 -13
- package/dist/define-BNsSORkE.d.cts.map +0 -1
- package/dist/define-B__DotaM.cjs +0 -1
- package/dist/define-BpCv3wD0.d.mts +0 -38
- package/dist/define-BpCv3wD0.d.mts.map +0 -1
- package/dist/define-Bviec8Ry.d.cts +0 -38
- package/dist/define-Bviec8Ry.d.cts.map +0 -1
- package/dist/define-C5_Sx-Eg.mjs +0 -2
- package/dist/define-C5_Sx-Eg.mjs.map +0 -1
- package/dist/define-C_GLY1-q.cjs +0 -1
- package/dist/define-Cjl-0yK0.d.mts +0 -13
- package/dist/define-Cjl-0yK0.d.mts.map +0 -1
- package/dist/define-DE0RBdIR.mjs +0 -2
- package/dist/define-DE0RBdIR.mjs.map +0 -1
- package/dist/define-DQQxZK9L.d.mts +0 -14
- package/dist/define-DQQxZK9L.d.mts.map +0 -1
- package/dist/define-DVggP_03.cjs +0 -1
- package/dist/define-DY1s6sGY.mjs +0 -2
- package/dist/define-DY1s6sGY.mjs.map +0 -1
- package/dist/define-OeGEPyv1.d.cts +0 -45
- package/dist/define-OeGEPyv1.d.cts.map +0 -1
- package/dist/define-hhs2D0Hq.d.mts +0 -45
- package/dist/define-hhs2D0Hq.d.mts.map +0 -1
- package/dist/generator/index.cjs +0 -1
- package/dist/generator/index.d.cts +0 -29
- package/dist/generator/index.d.cts.map +0 -1
- package/dist/generator/index.d.mts +0 -29
- package/dist/generator/index.d.mts.map +0 -1
- package/dist/generator/index.mjs +0 -2
- package/dist/generator/index.mjs.map +0 -1
- package/dist/generator-9GSAWmOj.d.mts +0 -126
- package/dist/generator-9GSAWmOj.d.mts.map +0 -1
- package/dist/generator-D9KikId4.d.cts +0 -126
- package/dist/generator-D9KikId4.d.cts.map +0 -1
- package/dist/helpers-8tc33xyp.mjs +0 -2
- package/dist/helpers-8tc33xyp.mjs.map +0 -1
- package/dist/helpers-BWqqSR02.cjs +0 -1
- package/dist/helpers-BcTg0l_X.cjs +0 -1
- package/dist/helpers-Botqc1jf.cjs +0 -1
- package/dist/helpers-Cfl4NsE5.mjs +0 -2
- package/dist/helpers-Cfl4NsE5.mjs.map +0 -1
- package/dist/helpers-DwNCh4F3.mjs +0 -2
- package/dist/helpers-DwNCh4F3.mjs.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/input/index.cjs +0 -1
- package/dist/input/index.d.cts +0 -35
- package/dist/input/index.d.cts.map +0 -1
- package/dist/input/index.d.mts +0 -35
- package/dist/input/index.d.mts.map +0 -1
- package/dist/input/index.mjs +0 -1
- package/dist/input-C3yGEfI-.d.mts +0 -58
- package/dist/input-C3yGEfI-.d.mts.map +0 -1
- package/dist/input-Osyk3YIo.d.cts +0 -58
- package/dist/input-Osyk3YIo.d.cts.map +0 -1
- package/dist/output/index.cjs +0 -1
- package/dist/output/index.d.cts +0 -35
- package/dist/output/index.d.cts.map +0 -1
- package/dist/output/index.d.mts +0 -35
- package/dist/output/index.d.mts.map +0 -1
- package/dist/output/index.mjs +0 -1
- package/dist/schema/index.cjs +0 -1
- package/dist/schema/index.d.cts +0 -33
- package/dist/schema/index.d.cts.map +0 -1
- package/dist/schema/index.d.mts +0 -33
- package/dist/schema/index.d.mts.map +0 -1
- package/dist/schema/index.mjs +0 -1
- package/dist/schema-DvnNqFd4.d.cts +0 -180
- package/dist/schema-DvnNqFd4.d.cts.map +0 -1
- package/dist/schema-DvnNqFd4.d.mts +0 -180
- package/dist/schema-DvnNqFd4.d.mts.map +0 -1
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
import { DeepPartial, MaybePromise } from "@stryke/types/base";
|
|
2
|
+
import { Storage } from "unstorage";
|
|
3
|
+
import { InferExtractOptions, SchemaConfig, SchemaEnvelopeOf, SchemaSourceConfig } from "@power-plant/schema";
|
|
4
|
+
import { InferLoadOptions, LoadReference } from "@stryke/resolve/types";
|
|
5
|
+
import { EnvPaths } from "@stryke/env/get-env-paths";
|
|
6
|
+
|
|
7
|
+
//#region src/types/meta.d.ts
|
|
8
|
+
type MetaValue<TSpec, TOptions extends object, TValue = any> = TValue | ((spec: TSpec, options: TOptions) => MaybePromise<TValue>);
|
|
9
|
+
type MetaDeprecated = true | string | {
|
|
10
|
+
message?: string;
|
|
11
|
+
since?: string;
|
|
12
|
+
alternative?: string;
|
|
13
|
+
};
|
|
14
|
+
type MetaLink = string | {
|
|
15
|
+
href: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A metadata primitive value.
|
|
20
|
+
*/
|
|
21
|
+
type MetaDataPrimitive = string | number | boolean | null | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* A record of metadata primitive values.
|
|
24
|
+
*/
|
|
25
|
+
type MetaDataRecord<TSpec, TOptions extends object> = Record<string, MetaValue<TSpec, TOptions, MetaDataPrimitive | MetaDataPrimitive[]>>;
|
|
26
|
+
/**
|
|
27
|
+
* A record of metadata values.
|
|
28
|
+
*/
|
|
29
|
+
type MetaData<TSpec, TOptions extends object> = Record<string, MetaValue<TSpec, TOptions, MetaDataPrimitive | MetaDataPrimitive[] | MetaDataRecord<TSpec, TOptions>>>;
|
|
30
|
+
interface BaseMeta<TSpec, TOptions extends object> {
|
|
31
|
+
/**
|
|
32
|
+
* Additional data associated with the object.
|
|
33
|
+
*/
|
|
34
|
+
data?: MetaData<TSpec, TOptions>;
|
|
35
|
+
}
|
|
36
|
+
interface MetaConfig<TSpec, TOptions extends object> extends BaseMeta<TSpec, TOptions> {
|
|
37
|
+
/**
|
|
38
|
+
* 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.
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* 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 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.
|
|
42
|
+
*/
|
|
43
|
+
name?: string;
|
|
44
|
+
/**
|
|
45
|
+
* 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.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* 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.
|
|
49
|
+
*
|
|
50
|
+
* @defaultValue "1.0"
|
|
51
|
+
*/
|
|
52
|
+
version?: string | Date | number;
|
|
53
|
+
/**
|
|
54
|
+
* A string that describes the object in some way.
|
|
55
|
+
*/
|
|
56
|
+
description?: string;
|
|
57
|
+
/**
|
|
58
|
+
* 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.
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* 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.
|
|
62
|
+
*/
|
|
63
|
+
title?: MetaValue<TSpec, TOptions, string>;
|
|
64
|
+
/**
|
|
65
|
+
* A string that describes when the object is used.
|
|
66
|
+
*/
|
|
67
|
+
usage?: MetaValue<TSpec, TOptions, string>;
|
|
68
|
+
/**
|
|
69
|
+
* 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.
|
|
70
|
+
*
|
|
71
|
+
* @remarks
|
|
72
|
+
* 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.
|
|
73
|
+
*/
|
|
74
|
+
deprecated?: MetaValue<TSpec, TOptions, MetaDeprecated>;
|
|
75
|
+
/**
|
|
76
|
+
* 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.
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* 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.
|
|
80
|
+
*/
|
|
81
|
+
tags?: MetaValue<TSpec, TOptions, string[]>;
|
|
82
|
+
/**
|
|
83
|
+
* 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.
|
|
84
|
+
*/
|
|
85
|
+
links?: MetaValue<TSpec, TOptions, MetaLink[]>;
|
|
86
|
+
}
|
|
87
|
+
interface Meta<TSpec, TOptions extends object> extends BaseMeta<TSpec, TOptions> {
|
|
88
|
+
/**
|
|
89
|
+
* 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.
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* 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.
|
|
93
|
+
*/
|
|
94
|
+
name?: MetaValue<TSpec, TOptions, string>;
|
|
95
|
+
/**
|
|
96
|
+
* 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.
|
|
97
|
+
*
|
|
98
|
+
* @remarks
|
|
99
|
+
* 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.
|
|
100
|
+
*
|
|
101
|
+
* @defaultValue "1.0"
|
|
102
|
+
*/
|
|
103
|
+
version?: MetaValue<TSpec, TOptions, string | Date | number>;
|
|
104
|
+
/**
|
|
105
|
+
* A string that describes the object in some way.
|
|
106
|
+
*/
|
|
107
|
+
description?: MetaValue<TSpec, TOptions, string>;
|
|
108
|
+
/**
|
|
109
|
+
* 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.
|
|
110
|
+
*
|
|
111
|
+
* @remarks
|
|
112
|
+
* 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.
|
|
113
|
+
*/
|
|
114
|
+
title?: MetaValue<TSpec, TOptions, string>;
|
|
115
|
+
/**
|
|
116
|
+
* A string that describes when the object is used.
|
|
117
|
+
*/
|
|
118
|
+
usage?: MetaValue<TSpec, TOptions, string>;
|
|
119
|
+
/**
|
|
120
|
+
* 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.
|
|
121
|
+
*
|
|
122
|
+
* @remarks
|
|
123
|
+
* 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.
|
|
124
|
+
*/
|
|
125
|
+
deprecated?: MetaValue<TSpec, TOptions, MetaDeprecated>;
|
|
126
|
+
/**
|
|
127
|
+
* 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.
|
|
128
|
+
*
|
|
129
|
+
* @remarks
|
|
130
|
+
* 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.
|
|
131
|
+
*/
|
|
132
|
+
tags?: MetaValue<TSpec, TOptions, string[]>;
|
|
133
|
+
/**
|
|
134
|
+
* 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.
|
|
135
|
+
*/
|
|
136
|
+
links?: MetaValue<TSpec, TOptions, MetaLink[]>;
|
|
137
|
+
}
|
|
138
|
+
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] };
|
|
139
|
+
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] };
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/types/schema.d.ts
|
|
142
|
+
type SchemaMetaExample<TSpec> = TSpec | {
|
|
143
|
+
name?: string;
|
|
144
|
+
description?: string;
|
|
145
|
+
value: TSpec;
|
|
146
|
+
};
|
|
147
|
+
interface SchemaMetaConfig<TSpec, TOptions extends object = any> extends MetaConfig<TSpec, TOptions> {
|
|
148
|
+
/**
|
|
149
|
+
* Examples of valid data for the schema. This can be a single example or an array of examples.
|
|
150
|
+
*/
|
|
151
|
+
examples?: SchemaMetaExample<TSpec> | MetaValue<TSpec, TOptions, SchemaMetaExample<TSpec>[]>;
|
|
152
|
+
/**
|
|
153
|
+
* A description of the specification that is described by this schema.
|
|
154
|
+
*/
|
|
155
|
+
spec?: MetaValue<TSpec, TOptions, string>;
|
|
156
|
+
}
|
|
157
|
+
interface SchemaMeta<TSpec, TOptions extends object = any> extends Meta<TSpec, TOptions> {
|
|
158
|
+
/**
|
|
159
|
+
* Examples of valid data for the schema.
|
|
160
|
+
*/
|
|
161
|
+
examples: MetaValue<TSpec, TOptions, SchemaMetaExample<TSpec>[]>;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Schema input wrapper that attaches optional contextual metadata.
|
|
165
|
+
*/
|
|
166
|
+
interface SchemaConfigObject<TSpec, TOptions extends object = any> {
|
|
167
|
+
/**
|
|
168
|
+
* 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.
|
|
169
|
+
*/
|
|
170
|
+
schema: SchemaSourceConfig<TSpec> | SchemaEnvelopeOf<TSpec>;
|
|
171
|
+
/**
|
|
172
|
+
* Optional metadata that provides contextual information for the schema.
|
|
173
|
+
*/
|
|
174
|
+
meta?: SchemaMetaConfig<TSpec, TOptions>;
|
|
175
|
+
}
|
|
176
|
+
type InferCreateSchemaOptions<T extends SchemaSourceConfig<any> | SchemaEnvelopeOf<any> | SchemaConfigObject<any, any>> = T extends SchemaSourceConfig<any> | SchemaEnvelopeOf<any> ? InferExtractOptions<T> : {};
|
|
177
|
+
/**
|
|
178
|
+
* A schema extracted from a source input, normalized to JSON Schema.
|
|
179
|
+
*/
|
|
180
|
+
interface Schema<TSpec, TOptions extends object = any> extends SchemaEnvelopeOf<TSpec> {
|
|
181
|
+
/**
|
|
182
|
+
* Optional contextual metadata associated with the schema.
|
|
183
|
+
*/
|
|
184
|
+
meta: SchemaMeta<TSpec, TOptions>;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* 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.
|
|
188
|
+
*
|
|
189
|
+
* @template TSpec - The original TypeScript type for which the schema is being extracted. This type parameter is used to derive the appropriate JSON Schema representation based on the structure and constraints of `T`.
|
|
190
|
+
*
|
|
191
|
+
* @see {@link Schema}
|
|
192
|
+
*/
|
|
193
|
+
type SchemaOf<TSpec, TOptions extends object = any> = Schema<TSpec, TOptions>;
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/types/input.d.ts
|
|
196
|
+
type InputFunction<TSpec, TOptions extends object> = (options: TOptions) => MaybePromise<TSpec>;
|
|
197
|
+
interface InputMetaConfig<TSpec, TOptions extends object> extends MetaConfig<TSpec, TOptions> {
|
|
198
|
+
/**
|
|
199
|
+
* 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.
|
|
200
|
+
*/
|
|
201
|
+
readFrom?: MetaValue<TSpec, TOptions, string>;
|
|
202
|
+
}
|
|
203
|
+
interface InputMeta<TSpec, TOptions extends object> extends Meta<TSpec, TOptions> {
|
|
204
|
+
/**
|
|
205
|
+
* 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.
|
|
206
|
+
*/
|
|
207
|
+
readFrom?: string;
|
|
208
|
+
}
|
|
209
|
+
interface InputConfigObject<TSpec, TOptions extends object> {
|
|
210
|
+
/**
|
|
211
|
+
* 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.
|
|
212
|
+
*/
|
|
213
|
+
schema?: SchemaConfig<TSpec> | SchemaConfigObject<TSpec, TOptions>;
|
|
214
|
+
/**
|
|
215
|
+
* The input implementation, either as a callable function, a static value, or a file reference.
|
|
216
|
+
*/
|
|
217
|
+
input: TSpec | InputFunction<TSpec, TOptions> | LoadReference;
|
|
218
|
+
/**
|
|
219
|
+
* Optional metadata that provides contextual information for the input.
|
|
220
|
+
*/
|
|
221
|
+
meta?: InputMetaConfig<TSpec, TOptions>;
|
|
222
|
+
}
|
|
223
|
+
type InputConfig<TSpec, TOptions extends object> = LoadReference | TSpec | InputFunction<TSpec, TOptions> | InputConfigObject<TSpec, TOptions>;
|
|
224
|
+
type InferCreateInputOptions<T extends InputConfig<any, any>> = T extends LoadReference ? InferLoadOptions<T> : {};
|
|
225
|
+
interface Input<TSpec, TOptions extends object> {
|
|
226
|
+
/**
|
|
227
|
+
* 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.
|
|
228
|
+
*/
|
|
229
|
+
schema: SchemaOf<TSpec, TOptions>;
|
|
230
|
+
/**
|
|
231
|
+
* Optional metadata that provides contextual information for the input.
|
|
232
|
+
*/
|
|
233
|
+
meta?: InputMeta<TSpec, TOptions>;
|
|
234
|
+
/**
|
|
235
|
+
* 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.
|
|
236
|
+
*
|
|
237
|
+
* @remarks
|
|
238
|
+
* The `input` property can be either a static value of type `TSpec` or a function that takes the specification object and returns a value of type `TSpec` or a promise that resolves to `TSpec`. This allows for flexibility in how the generator retrieves its input data, enabling both synchronous and asynchronous data retrieval based on the specification.
|
|
239
|
+
*
|
|
240
|
+
* @param options - The options object that can be used to influence the generation process.
|
|
241
|
+
* @returns A value or a promise that resolves to a value, which will be used as the input data for the generator.
|
|
242
|
+
*/
|
|
243
|
+
input: TSpec | InputFunction<TSpec, TOptions>;
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/types/execution.d.ts
|
|
247
|
+
interface ExecutionSource<TSpec, TOptions extends object> {
|
|
248
|
+
/**
|
|
249
|
+
* The language of the document.
|
|
250
|
+
*/
|
|
251
|
+
language?: string;
|
|
252
|
+
/**
|
|
253
|
+
* The content of the source code.
|
|
254
|
+
*/
|
|
255
|
+
content: string;
|
|
256
|
+
/**
|
|
257
|
+
* The metadata of the source code.
|
|
258
|
+
*/
|
|
259
|
+
meta: Meta<TSpec, TOptions>;
|
|
260
|
+
}
|
|
261
|
+
interface ExecutionDocument<TSpec, TOptions extends object> {
|
|
262
|
+
/**
|
|
263
|
+
* The path of the document.
|
|
264
|
+
*/
|
|
265
|
+
path: string;
|
|
266
|
+
/**
|
|
267
|
+
* The source of the document.
|
|
268
|
+
*/
|
|
269
|
+
source: ExecutionSource<TSpec, TOptions>[];
|
|
270
|
+
/**
|
|
271
|
+
* The metadata of the document.
|
|
272
|
+
*/
|
|
273
|
+
meta: Meta<TSpec, TOptions>;
|
|
274
|
+
}
|
|
275
|
+
interface ExecutionMeta<TSpec, TOptions extends object> extends Meta<TSpec, TOptions> {
|
|
276
|
+
/**
|
|
277
|
+
* A unique identifier for the execution, typically used by the backend systems.
|
|
278
|
+
*
|
|
279
|
+
* @remarks
|
|
280
|
+
* 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.
|
|
281
|
+
*/
|
|
282
|
+
executionId: string;
|
|
283
|
+
/**
|
|
284
|
+
* The date and time when the execution was performed.
|
|
285
|
+
*/
|
|
286
|
+
executedAt: Date;
|
|
287
|
+
/**
|
|
288
|
+
* The user who performed the execution.
|
|
289
|
+
*/
|
|
290
|
+
executedBy: string;
|
|
291
|
+
/**
|
|
292
|
+
* The specification used to generate the source code during the execution.
|
|
293
|
+
*/
|
|
294
|
+
spec: TSpec;
|
|
295
|
+
/**
|
|
296
|
+
* The metadata of the generator used to execute the source code during the execution.
|
|
297
|
+
*/
|
|
298
|
+
generator: GeneratorMeta<TSpec, TOptions>;
|
|
299
|
+
/**
|
|
300
|
+
* The metadata of the schema used to generate the source code during the execution.
|
|
301
|
+
*/
|
|
302
|
+
schema: SchemaMeta<TSpec, TOptions>;
|
|
303
|
+
/**
|
|
304
|
+
* The metadata of the input used to generate the source code during the execution.
|
|
305
|
+
*/
|
|
306
|
+
input: InputMeta<TSpec, TOptions>;
|
|
307
|
+
/**
|
|
308
|
+
* The metadata of the output used to generate the source code during the execution.
|
|
309
|
+
*/
|
|
310
|
+
output: OutputMeta<TSpec, TOptions>;
|
|
311
|
+
}
|
|
312
|
+
interface Execution<TSpec, TOptions extends object> {
|
|
313
|
+
/**
|
|
314
|
+
* The documents of the execution, indexed by the document path.
|
|
315
|
+
*/
|
|
316
|
+
documents: Record<string, ExecutionDocument<TSpec, TOptions>>;
|
|
317
|
+
/**
|
|
318
|
+
* The metadata of the execution.
|
|
319
|
+
*/
|
|
320
|
+
meta: ExecutionMeta<TSpec, TOptions>;
|
|
321
|
+
}
|
|
322
|
+
type ExecutionResult<TSpec, TOptions extends object, TReturns = void> = GeneratedDocument<TSpec, TOptions> & {
|
|
323
|
+
/**
|
|
324
|
+
* The returned value of the generator function.
|
|
325
|
+
*/
|
|
326
|
+
returns?: TReturns;
|
|
327
|
+
};
|
|
328
|
+
type ExtractedExecutionSource<TSpec, TOptions extends object> = Omit<ExecutionSource<TSpec, TOptions>, "meta"> & {
|
|
329
|
+
/**
|
|
330
|
+
* The extracted metadata of the execution.
|
|
331
|
+
*/
|
|
332
|
+
meta: InferExtractedMeta<ExecutionSource<TSpec, TOptions>["meta"]>;
|
|
333
|
+
};
|
|
334
|
+
type ExtractedExecutionDocument<TSpec, TOptions extends object> = Omit<ExecutionDocument<TSpec, TOptions>, "source" | "meta"> & {
|
|
335
|
+
/**
|
|
336
|
+
* The source of the document.
|
|
337
|
+
*/
|
|
338
|
+
source: ExtractedExecutionSource<TSpec, TOptions>[];
|
|
339
|
+
/**
|
|
340
|
+
* The extracted metadata of the execution.
|
|
341
|
+
*/
|
|
342
|
+
meta: InferExtractedMeta<ExecutionDocument<TSpec, TOptions>["meta"]>;
|
|
343
|
+
};
|
|
344
|
+
type ExtractedExecution<TSpec, TOptions extends object> = Omit<Execution<TSpec, TOptions>, "documents" | "meta"> & {
|
|
345
|
+
/**
|
|
346
|
+
* The documents of the execution, indexed by the document path.
|
|
347
|
+
*/
|
|
348
|
+
documents: Record<string, ExtractedExecutionDocument<TSpec, TOptions>>;
|
|
349
|
+
/**
|
|
350
|
+
* The extracted metadata of the execution.
|
|
351
|
+
*/
|
|
352
|
+
meta: InferExtractedMeta<ExecutionMeta<TSpec, TOptions>>;
|
|
353
|
+
};
|
|
354
|
+
//#endregion
|
|
355
|
+
//#region src/types/generator.d.ts
|
|
356
|
+
interface GeneratorMeta<TSpec, TOptions extends object> extends MetaConfig<TSpec, TOptions> {
|
|
357
|
+
/**
|
|
358
|
+
* A string description (or a function that returns a string) outlining the purpose or behavior of the generator.
|
|
359
|
+
*/
|
|
360
|
+
description?: string;
|
|
361
|
+
}
|
|
362
|
+
type GeneratedDocument<TSpec, TOptions extends object> = Partial<Omit<ExecutionDocument<TSpec, TOptions>, "source">> & Pick<ExecutionDocument<TSpec, TOptions>, "path"> & {
|
|
363
|
+
/**
|
|
364
|
+
* The sources of the document.
|
|
365
|
+
*/
|
|
366
|
+
source?: DeepPartial<ExecutionSource<TSpec, TOptions>>[];
|
|
367
|
+
};
|
|
368
|
+
type GeneratorFunction<TSpec, TOptions extends object> = (spec: TSpec, options: TOptions) => MaybePromise<Record<string, GeneratedDocument<TSpec, TOptions>>>;
|
|
369
|
+
type GeneratorFunctionResult<TSpec, TOptions extends object> = Awaited<ReturnType<GeneratorFunction<TSpec, TOptions>>>;
|
|
370
|
+
interface GeneratorResult<TSpec, TOptions extends object, TReturns = void> {
|
|
371
|
+
spec: TSpec;
|
|
372
|
+
options: TOptions;
|
|
373
|
+
/**
|
|
374
|
+
* The documents generated by the generator.
|
|
375
|
+
*/
|
|
376
|
+
documents: GeneratorFunctionResult<TSpec, TOptions>;
|
|
377
|
+
/**
|
|
378
|
+
* The return value from the output function.
|
|
379
|
+
*/
|
|
380
|
+
returns: TReturns;
|
|
381
|
+
}
|
|
382
|
+
interface GeneratorConfigObject<TSpec, TOptions extends object, TReturns = void> {
|
|
383
|
+
/**
|
|
384
|
+
* Optional metadata about the generator, such as a description of the output it produces.
|
|
385
|
+
*/
|
|
386
|
+
meta?: GeneratorMeta<TSpec, TOptions>;
|
|
387
|
+
/**
|
|
388
|
+
* The schema config that defines the structure of the specification object for this generator.
|
|
389
|
+
*/
|
|
390
|
+
schema?: SchemaConfig<TSpec> | SchemaConfigObject<TSpec, TOptions>;
|
|
391
|
+
/**
|
|
392
|
+
* The input config for the generator specification.
|
|
393
|
+
*/
|
|
394
|
+
input?: InputConfig<TSpec, TOptions>;
|
|
395
|
+
/**
|
|
396
|
+
* The output config that consumes generated output.
|
|
397
|
+
*/
|
|
398
|
+
output?: OutputConfig<TSpec, TOptions, TReturns>;
|
|
399
|
+
/**
|
|
400
|
+
* The generate implementation, either as a callable function or a file reference.
|
|
401
|
+
*/
|
|
402
|
+
generator: GeneratorFunction<TSpec, TOptions> | LoadReference;
|
|
403
|
+
}
|
|
404
|
+
type GeneratorConfig<TSpec, TOptions extends object, TReturns = void> = LoadReference | GeneratorConfigObject<TSpec, TOptions, TReturns>;
|
|
405
|
+
type InferCreateGeneratorOptions<T extends GeneratorConfig<any, any, any>> = T extends LoadReference ? InferLoadOptions<T> : {};
|
|
406
|
+
interface Generator<TSpec, TOptions extends object, TReturns = void> {
|
|
407
|
+
/**
|
|
408
|
+
* Optional metadata about the generator, such as a description of the output it produces.
|
|
409
|
+
*/
|
|
410
|
+
meta?: GeneratorMeta<TSpec, TOptions>;
|
|
411
|
+
/**
|
|
412
|
+
* The schema config that defines the structure of the specification object for this generator.
|
|
413
|
+
*/
|
|
414
|
+
schema: SchemaOf<TSpec, TOptions>;
|
|
415
|
+
/**
|
|
416
|
+
* 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.
|
|
417
|
+
*/
|
|
418
|
+
input: Input<TSpec, TOptions>;
|
|
419
|
+
/**
|
|
420
|
+
* 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.
|
|
421
|
+
*/
|
|
422
|
+
output: Output<TSpec, TOptions, TReturns>;
|
|
423
|
+
/**
|
|
424
|
+
* The generator function that executes the generator logic, taking in options and producing output based on the input and output definitions.
|
|
425
|
+
*
|
|
426
|
+
* @remarks
|
|
427
|
+
* The generator function is responsible for orchestrating the generation process. It takes in options that can influence the generation behavior and returns a promise that resolves to the result of the generator execution, which includes the generated output and any additional metadata.
|
|
428
|
+
*
|
|
429
|
+
* @param options - The options to be passed to the generator, which can be used to influence the generation process.
|
|
430
|
+
* @returns A promise that resolves to the result of the generator execution, which includes the generated output and any additional metadata.
|
|
431
|
+
*/
|
|
432
|
+
generator: (options: TOptions & UserConfig) => Promise<GeneratorResult<TSpec, TOptions, TReturns>>;
|
|
433
|
+
}
|
|
434
|
+
//#endregion
|
|
435
|
+
//#region src/types/output.d.ts
|
|
436
|
+
type OutputFunction<TSpec, TOptions extends object, TReturns = void> = (spec: TSpec, options: TOptions, documents: Record<string, GeneratedDocument<TSpec, TOptions>>) => MaybePromise<TReturns>;
|
|
437
|
+
interface OutputMetaConfig<TSpec, TOptions extends object> extends MetaConfig<TSpec, TOptions> {
|
|
438
|
+
/**
|
|
439
|
+
* 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.
|
|
440
|
+
*/
|
|
441
|
+
produces?: string;
|
|
442
|
+
}
|
|
443
|
+
interface OutputMeta<TSpec, TOptions extends object> extends Meta<TSpec, TOptions> {
|
|
444
|
+
/**
|
|
445
|
+
* 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.
|
|
446
|
+
*/
|
|
447
|
+
produces?: string;
|
|
448
|
+
}
|
|
449
|
+
interface OutputConfigObject<TSpec, TOptions extends object, TReturns = void> {
|
|
450
|
+
/**
|
|
451
|
+
* 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.
|
|
452
|
+
*/
|
|
453
|
+
schema?: SchemaConfig<TSpec> | SchemaConfigObject<TSpec, TOptions>;
|
|
454
|
+
/**
|
|
455
|
+
* Optional metadata that provides contextual information for the output.
|
|
456
|
+
*/
|
|
457
|
+
meta?: OutputMetaConfig<TSpec, TOptions>;
|
|
458
|
+
/**
|
|
459
|
+
* The output implementation, either as a callable function or a file reference.
|
|
460
|
+
*/
|
|
461
|
+
output: OutputFunction<TSpec, TOptions, TReturns> | LoadReference;
|
|
462
|
+
}
|
|
463
|
+
type OutputConfig<TSpec, TOptions extends object, TReturns = void> = LoadReference | OutputFunction<TSpec, TOptions, TReturns> | OutputConfigObject<TSpec, TOptions, TReturns>;
|
|
464
|
+
type InferCreateOutputOptions<T extends OutputConfig<any, any, any>> = T extends LoadReference ? InferLoadOptions<T> : {};
|
|
465
|
+
interface Output<TSpec, TOptions extends object, TReturns = void> {
|
|
466
|
+
/**
|
|
467
|
+
* 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.
|
|
468
|
+
*/
|
|
469
|
+
schema: SchemaOf<TSpec, TOptions>;
|
|
470
|
+
/**
|
|
471
|
+
* Optional metadata that provides contextual information for the output.
|
|
472
|
+
*/
|
|
473
|
+
meta?: OutputMeta<TSpec, TOptions>;
|
|
474
|
+
/**
|
|
475
|
+
* 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.
|
|
476
|
+
*
|
|
477
|
+
* @remarks
|
|
478
|
+
* The `output` property is defined as a function that takes the specification object and any additional parameters, and returns a value or a promise that resolves to a value. This allows for flexibility in how the generator sends its output data, enabling both synchronous and asynchronous data handling based on the specification.
|
|
479
|
+
*
|
|
480
|
+
* @param spec - The specification object that conforms to the defined schema output.
|
|
481
|
+
* @param options - Additional parameters that may be needed for the output function to process the output data.
|
|
482
|
+
* @param documents - An array of generated documents that are produced by the generator. This can be used to provide context or additional information to the output function when processing the output data.
|
|
483
|
+
* @returns A promise that resolves when the output function is complete.
|
|
484
|
+
*/
|
|
485
|
+
output: OutputFunction<TSpec, TOptions, TReturns>;
|
|
486
|
+
}
|
|
487
|
+
//#endregion
|
|
488
|
+
//#region src/types/settings.d.ts
|
|
489
|
+
interface Settings {
|
|
490
|
+
/**
|
|
491
|
+
* The mode to use for the application.
|
|
492
|
+
*
|
|
493
|
+
* @defaultValue "production"
|
|
494
|
+
*/
|
|
495
|
+
mode: "development" | "production" | "test";
|
|
496
|
+
/**
|
|
497
|
+
* The log level to use for the application.
|
|
498
|
+
*
|
|
499
|
+
* @defaultValue "warn"
|
|
500
|
+
*/
|
|
501
|
+
logLevel: "debug" | "info" | "warn" | "error" | "silent";
|
|
502
|
+
/**
|
|
503
|
+
* The paths to use for the application.
|
|
504
|
+
*/
|
|
505
|
+
paths: EnvPaths;
|
|
506
|
+
/**
|
|
507
|
+
* Whether to skip {@link Execution | execution metadata} storage after completing generation.
|
|
508
|
+
*
|
|
509
|
+
* @defaultValue false
|
|
510
|
+
*/
|
|
511
|
+
skipStorage: boolean;
|
|
512
|
+
}
|
|
513
|
+
interface Logger {
|
|
514
|
+
debug: (message: string) => void;
|
|
515
|
+
info: (message: string) => void;
|
|
516
|
+
warn: (message: string) => void;
|
|
517
|
+
error: (message: string) => void;
|
|
518
|
+
}
|
|
519
|
+
//#endregion
|
|
520
|
+
//#region src/types/config.d.ts
|
|
521
|
+
interface UserConfig<TSpec = any, TOptions extends object = any, TReturns = any> {
|
|
522
|
+
/**
|
|
523
|
+
* The current working directory.
|
|
524
|
+
*
|
|
525
|
+
* @defaultValue process.cwd()
|
|
526
|
+
*/
|
|
527
|
+
cwd?: string;
|
|
528
|
+
/**
|
|
529
|
+
* Whether to enable debug mode.
|
|
530
|
+
*/
|
|
531
|
+
debug?: true;
|
|
532
|
+
/**
|
|
533
|
+
* The settings to use for the application.
|
|
534
|
+
*/
|
|
535
|
+
settings?: DeepPartial<Settings>;
|
|
536
|
+
/**
|
|
537
|
+
* The default [Unstorage](https://unstorage.unjs.io) storage instance to use for the application.
|
|
538
|
+
*
|
|
539
|
+
* @remarks
|
|
540
|
+
* If not provided, a default storage instance will be created. If provided, it will be used for all input and output operations. This allows for a single storage instance to be used across the entire application. If you want to use different storage instances for different inputs and outputs, you can provide them in the input and output configurations instead of here.
|
|
541
|
+
*/
|
|
542
|
+
storage?: Storage;
|
|
543
|
+
/**
|
|
544
|
+
* The logger to use for the application.
|
|
545
|
+
*/
|
|
546
|
+
logger?: Partial<Logger>;
|
|
547
|
+
/**
|
|
548
|
+
* The input config that will override the generator's input.
|
|
549
|
+
*/
|
|
550
|
+
input?: InputConfig<TSpec, TOptions>;
|
|
551
|
+
/**
|
|
552
|
+
* The output config that will override the generator's output.
|
|
553
|
+
*/
|
|
554
|
+
output?: OutputConfig<TSpec, TOptions, TReturns>;
|
|
555
|
+
}
|
|
556
|
+
interface UserConfigParams {
|
|
557
|
+
cwd: string;
|
|
558
|
+
mode: string;
|
|
559
|
+
}
|
|
560
|
+
type UserConfigFnObject<TSpec = any, TOptions extends object = any, TReturns = any> = (config: UserConfig<TSpec, TOptions, TReturns>) => UserConfig<TSpec, TOptions, TReturns>;
|
|
561
|
+
type UserConfigFnPromise<TSpec = any, TOptions extends object = any, TReturns = any> = (params: UserConfigParams) => Promise<UserConfig<TSpec, TOptions, TReturns> | UserConfig<TSpec, TOptions, TReturns>[]>;
|
|
562
|
+
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>[]>;
|
|
563
|
+
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>;
|
|
564
|
+
//#endregion
|
|
565
|
+
export { MetaDataPrimitive as $, ExtractedExecution as A, InferCreateSchemaOptions as B, GeneratorResult as C, ExecutionMeta as D, ExecutionDocument as E, InputConfig as F, SchemaMetaExample as G, SchemaConfigObject as H, InputConfigObject as I, InferExtractedMeta as J, SchemaOf as K, InputFunction as L, ExtractedExecutionSource as M, InferCreateInputOptions as N, ExecutionResult as O, Input as P, MetaData as Q, InputMeta as R, GeneratorMeta as S, Execution as T, SchemaMeta as U, Schema as V, SchemaMetaConfig as W, Meta as X, InferExtractedMetaDataRecord as Y, MetaConfig as Z, Generator as _, UserConfigFnPromise as a, GeneratorFunction as b, Settings as c, OutputConfig as d, MetaDataRecord as et, OutputConfigObject as f, GeneratedDocument as g, OutputMetaConfig as h, UserConfigFnObject as i, ExtractedExecutionDocument as j, ExecutionSource as k, InferCreateOutputOptions as l, OutputMeta as m, UserConfigExport as n, MetaLink as nt, UserConfigParams as o, OutputFunction as p, BaseMeta as q, UserConfigFn as r, MetaValue as rt, Logger as s, UserConfig as t, MetaDeprecated as tt, Output as u, GeneratorConfig as v, InferCreateGeneratorOptions as w, GeneratorFunctionResult as x, GeneratorConfigObject as y, InputMetaConfig as z };
|
|
566
|
+
//# sourceMappingURL=config-B6Gr29ZK.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-B6Gr29ZK.d.mts","names":[],"sources":["../src/types/meta.ts","../src/types/schema.ts","../src/types/input.ts","../src/types/execution.ts","../src/types/generator.ts","../src/types/output.ts","../src/types/settings.ts","../src/types/config.ts"],"mappings":""}
|
package/dist/config.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e){return e}exports.defineConfig=e;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { a as UserConfigFnPromise, i as UserConfigFnObject, n as UserConfigExport, o as UserConfigParams, r as UserConfigFn, t as UserConfig } from "./config-B6Gr29ZK.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/config.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Type helper to make it easier to use `power-plant.config.ts` files. Accepts a direct {@link UserConfig} object, or a function that returns it. The function receives a {@link ConfigParams} object.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { defineConfig } from '@power-plant/core';
|
|
10
|
+
*
|
|
11
|
+
* export default defineConfig({
|
|
12
|
+
* // Your configuration here
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* // Or with a function
|
|
16
|
+
* export default defineConfig((env) => {
|
|
17
|
+
* console.log(`Running command: ${env.command} in mode: ${env.mode}`);
|
|
18
|
+
* return {
|
|
19
|
+
* // Your configuration here
|
|
20
|
+
* };
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare function defineConfig(config: UserConfig): UserConfig;
|
|
25
|
+
declare function defineConfig(config: UserConfig[]): UserConfig[];
|
|
26
|
+
declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
|
|
27
|
+
declare function defineConfig(config: Promise<UserConfig[]>): Promise<UserConfig[]>;
|
|
28
|
+
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
29
|
+
declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
|
|
30
|
+
declare function defineConfig(config: UserConfigFn): UserConfigFn;
|
|
31
|
+
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, defineConfig };
|
|
34
|
+
//# sourceMappingURL=config.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.cts","names":[],"sources":["../src/config.ts"],"mappings":";;;;AAgDA;;;;;;;;AAA4D;AAC5D;;;;;;;;AAA8D;AAC9D;iBAFgB,YAAA,CAAa,MAAA,EAAQ,UAAA,GAAa,UAAU;AAAA,iBAC5C,YAAA,CAAa,MAAA,EAAQ,UAAA,KAAe,UAAU;AAAA,iBAC9C,YAAA,CAAa,MAAA,EAAQ,OAAA,CAAQ,UAAA,IAAc,OAAA,CAAQ,UAAA;AAAA,iBACnD,YAAA,CACd,MAAA,EAAQ,OAAA,CAAQ,UAAA,MACf,OAAA,CAAQ,UAAA;AAAA,iBACK,YAAA,CAAa,MAAA,EAAQ,kBAAA,GAAqB,kBAAkB;AAAA,iBAC5D,YAAA,CAAa,MAAA,EAAQ,mBAAA,GAAsB,mBAAmB;AAAA,iBAC9D,YAAA,CAAa,MAAA,EAAQ,YAAA,GAAe,YAAY;AAAA,iBAChD,YAAA,CAAa,MAAA,EAAQ,gBAAA,GAAmB,gBAAgB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { a as UserConfigFnPromise, i as UserConfigFnObject, n as UserConfigExport, o as UserConfigParams, r as UserConfigFn, t as UserConfig } from "./config-B6Gr29ZK.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/config.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Type helper to make it easier to use `power-plant.config.ts` files. Accepts a direct {@link UserConfig} object, or a function that returns it. The function receives a {@link ConfigParams} object.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { defineConfig } from '@power-plant/core';
|
|
10
|
+
*
|
|
11
|
+
* export default defineConfig({
|
|
12
|
+
* // Your configuration here
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* // Or with a function
|
|
16
|
+
* export default defineConfig((env) => {
|
|
17
|
+
* console.log(`Running command: ${env.command} in mode: ${env.mode}`);
|
|
18
|
+
* return {
|
|
19
|
+
* // Your configuration here
|
|
20
|
+
* };
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare function defineConfig(config: UserConfig): UserConfig;
|
|
25
|
+
declare function defineConfig(config: UserConfig[]): UserConfig[];
|
|
26
|
+
declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
|
|
27
|
+
declare function defineConfig(config: Promise<UserConfig[]>): Promise<UserConfig[]>;
|
|
28
|
+
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
29
|
+
declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
|
|
30
|
+
declare function defineConfig(config: UserConfigFn): UserConfigFn;
|
|
31
|
+
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, defineConfig };
|
|
34
|
+
//# sourceMappingURL=config.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../src/config.ts"],"mappings":""}
|
package/dist/config.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.mjs","names":[],"sources":[],"mappings":""}
|