@power-plant/core 0.0.15 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +1 -1
  2. package/dist/{config-D3-0eTEI.d.cts → config-BpNybJZY.d.cts} +56 -244
  3. package/dist/config-BpNybJZY.d.cts.map +1 -0
  4. package/dist/{config-D3-0eTEI.d.mts → config-C9Hp8wTC.d.mts} +58 -246
  5. package/dist/config-C9Hp8wTC.d.mts.map +1 -0
  6. package/dist/config.d.cts +1 -1
  7. package/dist/config.d.mts +1 -1
  8. package/dist/context-BU2q1sN5.d.cts +105 -0
  9. package/dist/context-BU2q1sN5.d.cts.map +1 -0
  10. package/dist/context-BUNCX0E-.d.mts +105 -0
  11. package/dist/context-BUNCX0E-.d.mts.map +1 -0
  12. package/dist/context.cjs +1 -1
  13. package/dist/context.d.cts +34 -2
  14. package/dist/context.d.cts.map +1 -1
  15. package/dist/context.d.mts +34 -2
  16. package/dist/context.mjs +1 -1
  17. package/dist/define.cjs +1 -1
  18. package/dist/define.d.cts +2 -2
  19. package/dist/define.d.cts.map +1 -1
  20. package/dist/define.d.mts +2 -2
  21. package/dist/define.mjs +1 -1
  22. package/dist/execute-8tWWCCpu.mjs +2 -0
  23. package/dist/execute-8tWWCCpu.mjs.map +1 -0
  24. package/dist/execute-D7rill1C.cjs +1 -0
  25. package/dist/execute.cjs +1 -0
  26. package/dist/execute.d.cts +87 -0
  27. package/dist/execute.d.cts.map +1 -0
  28. package/dist/execute.d.mts +87 -0
  29. package/dist/execute.d.mts.map +1 -0
  30. package/dist/execute.mjs +1 -0
  31. package/dist/execution-BAm3omij.d.cts +61 -0
  32. package/dist/execution-BAm3omij.d.cts.map +1 -0
  33. package/dist/execution-d10Z7Dih.d.mts +61 -0
  34. package/dist/execution-d10Z7Dih.d.mts.map +1 -0
  35. package/dist/helpers/index.cjs +1 -0
  36. package/dist/helpers/index.d.cts +3 -0
  37. package/dist/helpers/index.d.mts +3 -0
  38. package/dist/helpers/index.mjs +1 -0
  39. package/dist/helpers/meta.cjs +1 -0
  40. package/dist/helpers/meta.d.cts +2 -0
  41. package/dist/helpers/meta.d.cts.map +1 -0
  42. package/dist/helpers/meta.d.mts +77 -0
  43. package/dist/helpers/meta.d.mts.map +1 -0
  44. package/dist/helpers/meta.mjs +2 -0
  45. package/dist/helpers/meta.mjs.map +1 -0
  46. package/dist/{type-checks-DBObymgE.d.cts → helpers/type-checks.d.cts} +6 -6
  47. package/dist/helpers/type-checks.d.cts.map +1 -0
  48. package/dist/{type-checks-DX_sqZhk.d.mts → helpers/type-checks.d.mts} +6 -6
  49. package/dist/helpers/type-checks.d.mts.map +1 -0
  50. package/dist/index-DY4xQ_iJ.d.mts +3 -0
  51. package/dist/index-it9jCi4L.d.cts +3 -0
  52. package/dist/index.cjs +1 -1
  53. package/dist/index.d.cts +7 -5
  54. package/dist/index.d.mts +7 -5
  55. package/dist/index.mjs +1 -1
  56. package/dist/meta-CiPl-8rq.d.cts +82 -0
  57. package/dist/meta-CiPl-8rq.d.cts.map +1 -0
  58. package/package.json +60 -21
  59. package/dist/config-D3-0eTEI.d.cts.map +0 -1
  60. package/dist/config-D3-0eTEI.d.mts.map +0 -1
  61. package/dist/context-B4h787Dd.d.mts +0 -185
  62. package/dist/context-B4h787Dd.d.mts.map +0 -1
  63. package/dist/context-DYvyeLgC.d.cts +0 -185
  64. package/dist/context-DYvyeLgC.d.cts.map +0 -1
  65. package/dist/type-checks-DBObymgE.d.cts.map +0 -1
  66. package/dist/type-checks-DX_sqZhk.d.mts.map +0 -1
  67. package/dist/type-checks.d.cts +0 -2
  68. package/dist/type-checks.d.mts +0 -2
  69. package/dist/types/__internal.cjs +0 -0
  70. package/dist/types/__internal.d.cts +0 -13
  71. package/dist/types/__internal.d.cts.map +0 -1
  72. package/dist/types/__internal.d.mts +0 -13
  73. package/dist/types/__internal.d.mts.map +0 -1
  74. package/dist/types/__internal.mjs +0 -1
  75. /package/dist/{type-checks.cjs → helpers/type-checks.cjs} +0 -0
  76. /package/dist/{type-checks.mjs → helpers/type-checks.mjs} +0 -0
  77. /package/dist/{type-checks.mjs.map → helpers/type-checks.mjs.map} +0 -0
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
- [![Version](https://img.shields.io/badge/version-0.0.12-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://docs.stormsoftware.com/projects/power-plant)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/power-plant/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
36
+ [![Version](https://img.shields.io/badge/version-0.0.16-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://docs.stormsoftware.com/projects/power-plant)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/power-plant/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
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?: MetaData<TSpec, TOptions>;
20
+ data?: Record<string, any>;
34
21
  }
35
- interface MetaConfig<TSpec, TOptions extends object> extends BaseMeta<TSpec, TOptions> {
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?: MetaValue<TSpec, TOptions, string>;
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?: MetaValue<TSpec, TOptions, string>;
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?: MetaValue<TSpec, TOptions, MetaDeprecated>;
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?: MetaValue<TSpec, TOptions, string[]>;
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?: MetaValue<TSpec, TOptions, MetaLink[]>;
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, TOptions extends object = any> extends MetaConfig<TSpec, TOptions> {
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> | MetaValue<TSpec, TOptions, 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?: MetaValue<TSpec, TOptions, string>;
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, TOptions extends object = any> {
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, TOptions>;
101
+ meta?: SchemaMetaConfig<TSpec>;
174
102
  }
175
- type InferCreateSchemaOptions<T extends SchemaSourceConfig<any> | SchemaEnvelopeOf<any> | SchemaConfigObject<any, any>> = T extends SchemaSourceConfig<any> | SchemaEnvelopeOf<any> ? InferExtractOptions<T> : {};
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, TOptions extends object = any> extends SchemaEnvelopeOf<TSpec> {
107
+ interface Schema<TSpec> extends SchemaEnvelopeOf<TSpec> {
180
108
  /**
181
109
  * Optional contextual metadata associated with the schema.
182
110
  */
183
- meta: SchemaMeta<TSpec, TOptions>;
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, TOptions extends object = any> = Schema<TSpec, TOptions>;
120
+ type SchemaOf<TSpec> = Schema<TSpec>;
193
121
  //#endregion
194
122
  //#region src/types/input.d.ts
195
- type InputFunction<TSpec, TOptions extends object> = (options: TOptions) => MaybePromise<TSpec>;
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. 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.
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, TOptions>;
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<TSpec, TOptions>;
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, TOptions>;
150
+ schema: SchemaOf<TSpec>;
229
151
  /**
230
152
  * Optional metadata that provides contextual information for the input.
231
153
  */
232
- meta?: InputMeta<TSpec, TOptions>;
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,129 +164,18 @@ interface Input<TSpec, TOptions extends object> {
242
164
  input: TSpec | InputFunction<TSpec, TOptions>;
243
165
  }
244
166
  //#endregion
245
- //#region src/types/execution.d.ts
246
- interface ExecutionDocumentChunk<TSpec, TOptions extends object> {
247
- /**
248
- * The content of the chunk.
249
- */
250
- content: string;
251
- /**
252
- * The metadata of the chunk.
253
- */
254
- meta: Meta<TSpec, TOptions>;
167
+ //#region src/types/generator.d.ts
168
+ interface GeneratedDocumentChunk {
169
+ content?: string;
170
+ meta?: MetaConfig;
255
171
  }
256
- interface ExecutionDocument<TSpec, TOptions extends object> {
257
- /**
258
- * The path of the document.
259
- */
172
+ interface GeneratedDocument {
260
173
  path: string;
261
- /**
262
- * The language of the document.
263
- */
264
174
  language?: string;
265
- /**
266
- * The chunks of the document.
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;
175
+ chunks?: DeepPartial<GeneratedDocumentChunk>[];
176
+ meta?: MetaConfig;
360
177
  }
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
- type GeneratorFunction<TSpec, TOptions extends object> = (spec: TSpec, options: TOptions) => MaybePromise<Record<string, GeneratedDocument<TSpec, TOptions>>>;
178
+ type GeneratorFunction<TSpec, TOptions extends object> = (spec: TSpec, options: TOptions) => MaybePromise<Record<string, GeneratedDocument>>;
368
179
  type GeneratorFunctionResult<TSpec, TOptions extends object> = Awaited<ReturnType<GeneratorFunction<TSpec, TOptions>>>;
369
180
  interface GeneratorResult<TSpec, TOptions extends object, TReturns = void> {
370
181
  /**
@@ -388,11 +199,11 @@ interface GeneratorConfigObject<TSpec, TOptions extends object, TReturns = void>
388
199
  /**
389
200
  * Optional metadata about the generator, such as a description of the output it produces.
390
201
  */
391
- meta?: GeneratorMeta<TSpec, TOptions>;
202
+ meta?: MetaConfig;
392
203
  /**
393
204
  * The schema config that defines the structure of the specification object for this generator.
394
205
  */
395
- schema?: SchemaConfig<TSpec> | SchemaConfigObject<TSpec, TOptions>;
206
+ schema?: SchemaConfig<TSpec> | SchemaConfigObject<TSpec>;
396
207
  /**
397
208
  * The input config for the generator specification.
398
209
  */
@@ -412,11 +223,11 @@ interface Generator<TSpec, TOptions extends object, TReturns = void> {
412
223
  /**
413
224
  * Optional metadata about the generator, such as a description of the output it produces.
414
225
  */
415
- meta?: GeneratorMeta<TSpec, TOptions>;
226
+ meta?: MetaConfig;
416
227
  /**
417
228
  * The schema config that defines the structure of the specification object for this generator.
418
229
  */
419
- schema: SchemaOf<TSpec, TOptions>;
230
+ schema: SchemaOf<TSpec>;
420
231
  /**
421
232
  * 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
233
  */
@@ -436,30 +247,31 @@ interface Generator<TSpec, TOptions extends object, TReturns = void> {
436
247
  */
437
248
  generator: (options: TOptions & UserConfig) => Promise<GeneratorResult<TSpec, TOptions, TReturns>>;
438
249
  }
250
+ type InferSchemaConfig<T extends GeneratorConfig<any, any, any>> = T extends LoadReference ? InferLoadOptions<T> : T extends GeneratorConfigObject<any, any, any> ? T["schema"] : never;
251
+ type InferMeta<T extends GeneratorConfig<any, any, any>> = T extends LoadReference ? InferLoadOptions<T> : T extends GeneratorConfigObject<any, any, any> ? T["meta"] : never;
252
+ type InferInputConfig<T extends GeneratorConfig<any, any, any>> = T extends LoadReference ? InferLoadOptions<T> : T extends GeneratorConfigObject<any, any, any> ? T["input"] : never;
253
+ type InferOutputConfig<T extends GeneratorConfig<any, any, any>> = T extends LoadReference ? InferLoadOptions<T> : T extends GeneratorConfigObject<any, any, any> ? T["output"] : never;
254
+ type InferGeneratorFunction<T extends GeneratorConfig<any, any, any>> = T extends LoadReference ? InferLoadOptions<T> : T extends GeneratorConfigObject<any, any, any> ? T["generator"] : never;
255
+ type InferGeneratorResult<T extends GeneratorConfig<any, any, any>> = InferGeneratorFunction<T> extends GeneratorFunction<any, any> ? Awaited<ReturnType<InferGeneratorFunction<T>>> : never;
256
+ interface InferGenerator<T extends GeneratorConfig<any, any, any>> {
257
+ meta?: InferMeta<T>;
258
+ schema: InferSchemaConfig<T>;
259
+ input: InferInputConfig<T>;
260
+ output: InferOutputConfig<T>;
261
+ generator: InferGeneratorFunction<T>;
262
+ }
439
263
  //#endregion
440
264
  //#region src/types/output.d.ts
441
- 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
- }
265
+ type OutputFunction<TSpec, TOptions extends object, TReturns = void> = (spec: TSpec, options: TOptions, documents: Record<string, GeneratedDocument>) => MaybePromise<TReturns>;
454
266
  interface OutputConfigObject<TSpec, TOptions extends object, TReturns = void> {
455
267
  /**
456
268
  * 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
269
  */
458
- schema?: SchemaConfig<TSpec> | SchemaConfigObject<TSpec, TOptions>;
270
+ schema?: SchemaConfig<TSpec> | SchemaConfigObject<TSpec>;
459
271
  /**
460
272
  * Optional metadata that provides contextual information for the output.
461
273
  */
462
- meta?: OutputMetaConfig<TSpec, TOptions>;
274
+ meta?: MetaConfig;
463
275
  /**
464
276
  * The output implementation, either as a callable function or a file reference.
465
277
  */
@@ -471,11 +283,11 @@ interface Output<TSpec, TOptions extends object, TReturns = void> {
471
283
  /**
472
284
  * 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
285
  */
474
- schema: SchemaOf<TSpec, TOptions>;
286
+ schema: SchemaOf<TSpec>;
475
287
  /**
476
288
  * Optional metadata that provides contextual information for the output.
477
289
  */
478
- meta?: OutputMeta<TSpec, TOptions>;
290
+ meta?: MetaConfig;
479
291
  /**
480
292
  * 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
293
  *
@@ -567,5 +379,5 @@ type UserConfigFnPromise<TSpec = any, TOptions extends object = any, TReturns =
567
379
  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
380
  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
381
  //#endregion
570
- export { MetaDataPrimitive as $, ExtractedExecution as A, InferCreateSchemaOptions as B, GeneratorResult as C, ExecutionDocumentChunk 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, ExecutionMeta 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, ExecutionResult 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 };
571
- //# sourceMappingURL=config-D3-0eTEI.d.cts.map
382
+ export { InferCreateInputOptions as A, SchemaMetaExample as B, InferGenerator as C, InferMeta as D, InferInputConfig as E, InputMetaConfig as F, MetaLink as G, BaseMetaConfig as H, InferCreateSchemaOptions as I, Schema as L, InputConfig as M, InputConfigObject as N, InferOutputConfig as O, InputFunction as P, SchemaConfigObject as R, InferCreateGeneratorOptions as S, InferGeneratorResult as T, MetaConfig as U, SchemaOf as V, MetaDeprecated 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, Input as j, InferSchemaConfig 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, InferGeneratorFunction as w, GeneratorResult as x, GeneratorFunction as y, SchemaMetaConfig as z };
383
+ //# sourceMappingURL=config-BpNybJZY.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-BpNybJZY.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;;;;EAKA,QAAQ;;;;KC7DE,kBAAkB,SAC5B;EAAU;EAAe;EAAsB,OAAO;;UAEvC,iBAAiB,eAAe;;;;EAI/C,WAAW,kBAAkB,SAAS,kBAAkB;;;;EAKxD;;;;;UAMe,mBAAmB;;;;EAIlC,QAAQ,mBAAmB,SAAS,iBAAiB;;;;EAKrD,OAAO,iBAAiB;;KAGd,yBACV,UACE,0BAA0B,wBAAwB,2BAClD,UAAU,0BAA0B,wBACpC,oBAAoB;;;;UAOP,OAAO,eAAe,iBAAiB;;;;EAItD,MAAM,iBAAiB;;;;;;;;;KAUb,SAAS,SAAS,OAAO;;;UCxDpB,wBAAwB;;;;EAIvC;;KAGU,cAAc,OAAO,4BAC/B,SAAS,aACN,aAAa;UAED,kBAAkB,OAAO;;;;EAIxC,SAAS,aAAa,SAAS,mBAAmB;;;;EAKlD,OAAO,QAAQ,cAAc,OAAO,YAAY;;;;EAKhD,OAAO;;KAGG,YAAY,OAAO,2BAC3B,gBACA,QACA,cAAc,OAAO,YACrB,kBAAkB,OAAO;KAEjB,wBAAwB,UAAU,yBAC5C,UAAU,gBACN,iBAAiB;UAIN,MAAM,OAAO;;;;EAI5B,QAAQ,SAAS;;;;EAKjB,OAAO;;;;;;;;;;EAWP,OAAO,QAAQ,cAAc,OAAO;;;;UCzDrB;EACf;EACA,OAAO;;UAGQ;EACf;EACA;EACA,SAAS,YAAY;EACrB,OAAO;;KAGG,kBAAkB,OAAO,4BACnC,MAAM,OACN,SAAS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