@power-plant/core 0.0.5 → 0.0.6
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
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { InferExtractOptions, SchemaEnvelopeOf, SchemaSourceConfig } from "@power-plant/schema";
|
|
2
|
-
import { MaybePromise } from "@stryke/types/base";
|
|
3
|
-
|
|
4
|
-
//#region src/types/meta.d.ts
|
|
5
|
-
type MetaValue<TSpec, TOptions extends object, TValue = any> = TValue | ((spec: TSpec, options: TOptions) => MaybePromise<TValue>);
|
|
6
|
-
type MetaDeprecated = true | string | {
|
|
7
|
-
message?: string;
|
|
8
|
-
since?: string;
|
|
9
|
-
alternative?: string;
|
|
10
|
-
};
|
|
11
|
-
type MetaLink = string | {
|
|
12
|
-
href: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
};
|
|
15
|
-
interface MetaConfig<TSpec, TOptions extends object> {
|
|
16
|
-
/**
|
|
17
|
-
* A name for the schema, which can be used to identify or reference the schema 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.
|
|
18
|
-
*
|
|
19
|
-
* @remarks
|
|
20
|
-
* The `name` property is a string that can be used to give the schema 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 schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
21
|
-
*/
|
|
22
|
-
name?: MetaValue<TSpec, TOptions, string>;
|
|
23
|
-
/**
|
|
24
|
-
* A version string that indicates the version of the schema. This property can be used to track changes or updates to the schema over time, allowing consumers of the schema to determine which version they are working with. 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.
|
|
25
|
-
*
|
|
26
|
-
* @remarks
|
|
27
|
-
* 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 schema. It is recommended to use a consistent versioning scheme across all schemas to facilitate easier tracking and management of schema versions.
|
|
28
|
-
*
|
|
29
|
-
* @defaultValue "1.0"
|
|
30
|
-
*/
|
|
31
|
-
version?: MetaValue<TSpec, TOptions, string | Date | number>;
|
|
32
|
-
/**
|
|
33
|
-
* A string that describes the schema in some way.
|
|
34
|
-
*/
|
|
35
|
-
description?: MetaValue<TSpec, TOptions, string>;
|
|
36
|
-
/**
|
|
37
|
-
* A string that provides a human-readable name for the schema, which can be used in documentation, tooling, or other contexts to identify or reference the schema. 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.
|
|
38
|
-
*
|
|
39
|
-
* @remarks
|
|
40
|
-
* The `title` property is a string that can be used to give the schema 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 schema. 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.
|
|
41
|
-
*/
|
|
42
|
-
title?: MetaValue<TSpec, TOptions, string>;
|
|
43
|
-
/**
|
|
44
|
-
* A string that describes when the schema is used.
|
|
45
|
-
*/
|
|
46
|
-
usage?: MetaValue<TSpec, TOptions, string>;
|
|
47
|
-
/**
|
|
48
|
-
* Indicates whether the schema is deprecated, and optionally provides additional information about the deprecation, such as a message, the version since which it is deprecated, and an alternative schema to use instead.
|
|
49
|
-
*
|
|
50
|
-
* @remarks
|
|
51
|
-
* The `deprecated` property can be a boolean value, where `true` indicates that the schema 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 schema to use instead. 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.
|
|
52
|
-
*/
|
|
53
|
-
deprecated?: MetaValue<TSpec, TOptions, MetaDeprecated>;
|
|
54
|
-
/**
|
|
55
|
-
* An array of tags associated with the schema. Tags can be used to categorize or label schemas for organizational purposes, making it easier to search, filter, or group related schemas together. 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.
|
|
56
|
-
*
|
|
57
|
-
* @remarks
|
|
58
|
-
* Each tag in the array should be a string that represents a meaningful label or category for the schema. It is recommended to use consistent and descriptive tags across schemas to facilitate easier management and discovery of related schemas.
|
|
59
|
-
*/
|
|
60
|
-
tags?: MetaValue<TSpec, TOptions, string[]>;
|
|
61
|
-
/**
|
|
62
|
-
* An array of links associated with the schema. Each link can be a string representing a URL or an object containing a `href` property and an optional `description` property.
|
|
63
|
-
*/
|
|
64
|
-
links?: MetaValue<TSpec, TOptions, MetaLink[]>;
|
|
65
|
-
}
|
|
66
|
-
interface Meta<TSpec, TOptions extends object> {
|
|
67
|
-
/**
|
|
68
|
-
* A unique identifier for the schema, which can be used to reference or identify the schema 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.
|
|
69
|
-
*
|
|
70
|
-
* @remarks
|
|
71
|
-
* The `id` property is a string that can be used to give the schema a unique identifier. It can be used in documentation, error messages, or other contexts where it is helpful to have an identifier associated with the schema. 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.
|
|
72
|
-
*/
|
|
73
|
-
id: MetaValue<TSpec, TOptions, string>;
|
|
74
|
-
/**
|
|
75
|
-
* A name for the schema, which can be used to identify or reference the schema 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.
|
|
76
|
-
*
|
|
77
|
-
* @remarks
|
|
78
|
-
* The `name` property is a string that can be used to give the schema 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 schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
79
|
-
*/
|
|
80
|
-
name: MetaValue<TSpec, TOptions, string>;
|
|
81
|
-
/**
|
|
82
|
-
* A version string that indicates the version of the schema. This property can be used to track changes or updates to the schema over time, allowing consumers of the schema to determine which version they are working with. 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.
|
|
83
|
-
*
|
|
84
|
-
* @remarks
|
|
85
|
-
* 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 schema. It is recommended to use a consistent versioning scheme across all schemas to facilitate easier tracking and management of schema versions.
|
|
86
|
-
*
|
|
87
|
-
* @defaultValue "1.0"
|
|
88
|
-
*/
|
|
89
|
-
version: MetaValue<TSpec, TOptions, string | Date | number>;
|
|
90
|
-
/**
|
|
91
|
-
* A string that describes the schema in some way.
|
|
92
|
-
*/
|
|
93
|
-
description: MetaValue<TSpec, TOptions, string>;
|
|
94
|
-
/**
|
|
95
|
-
* A string that provides a human-readable name for the schema, which can be used in documentation, tooling, or other contexts to identify or reference the schema. 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.
|
|
96
|
-
*
|
|
97
|
-
* @remarks
|
|
98
|
-
* The `title` property is a string that can be used to give the schema 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 schema. 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.
|
|
99
|
-
*/
|
|
100
|
-
title: MetaValue<TSpec, TOptions, string>;
|
|
101
|
-
/**
|
|
102
|
-
* A string that describes when the schema is used.
|
|
103
|
-
*/
|
|
104
|
-
usage?: MetaValue<TSpec, TOptions, string>;
|
|
105
|
-
/**
|
|
106
|
-
* Indicates whether the schema is deprecated, and optionally provides additional information about the deprecation, such as a message, the version since which it is deprecated, and an alternative schema to use instead.
|
|
107
|
-
*
|
|
108
|
-
* @remarks
|
|
109
|
-
* The `deprecated` property can be a boolean value, where `true` indicates that the schema 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 schema to use instead. 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.
|
|
110
|
-
*/
|
|
111
|
-
deprecated?: MetaValue<TSpec, TOptions, MetaDeprecated>;
|
|
112
|
-
/**
|
|
113
|
-
* An array of tags associated with the schema. Tags can be used to categorize or label schemas for organizational purposes, making it easier to search, filter, or group related schemas together. 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.
|
|
114
|
-
*
|
|
115
|
-
* @remarks
|
|
116
|
-
* Each tag in the array should be a string that represents a meaningful label or category for the schema. It is recommended to use consistent and descriptive tags across schemas to facilitate easier management and discovery of related schemas.
|
|
117
|
-
*/
|
|
118
|
-
tags?: MetaValue<TSpec, TOptions, string[]>;
|
|
119
|
-
/**
|
|
120
|
-
* An array of links associated with the schema. Each link can be a string representing a URL or an object containing a `href` property and an optional `description` property.
|
|
121
|
-
*/
|
|
122
|
-
links: MetaValue<TSpec, TOptions, MetaLink[]>;
|
|
123
|
-
}
|
|
124
|
-
//#endregion
|
|
125
|
-
//#region src/types/schema.d.ts
|
|
126
|
-
type SchemaMetaExample<TSpec> = TSpec | {
|
|
127
|
-
name?: string;
|
|
128
|
-
description?: string;
|
|
129
|
-
value: TSpec;
|
|
130
|
-
};
|
|
131
|
-
interface SchemaMetaConfig<TSpec, TOptions extends object = any> extends MetaConfig<TSpec, TOptions> {
|
|
132
|
-
/**
|
|
133
|
-
* Examples of valid data for the schema. This can be a single example or an array of examples.
|
|
134
|
-
*/
|
|
135
|
-
examples?: SchemaMetaExample<TSpec> | MetaValue<TSpec, TOptions, SchemaMetaExample<TSpec>[]>;
|
|
136
|
-
/**
|
|
137
|
-
* A description of the specification that is described by this schema.
|
|
138
|
-
*/
|
|
139
|
-
spec?: MetaValue<TSpec, TOptions, string>;
|
|
140
|
-
}
|
|
141
|
-
interface SchemaMeta<TSpec, TOptions extends object = any> extends Meta<TSpec, TOptions> {
|
|
142
|
-
/**
|
|
143
|
-
* Examples of valid data for the schema.
|
|
144
|
-
*/
|
|
145
|
-
examples: MetaValue<TSpec, TOptions, SchemaMetaExample<TSpec>[]>;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Schema input wrapper that attaches optional contextual metadata.
|
|
149
|
-
*/
|
|
150
|
-
interface SchemaConfigObject<TSpec, TOptions extends object = any> {
|
|
151
|
-
/**
|
|
152
|
-
* 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.
|
|
153
|
-
*/
|
|
154
|
-
schema: SchemaSourceConfig<TSpec> | SchemaEnvelopeOf<TSpec>;
|
|
155
|
-
/**
|
|
156
|
-
* Optional metadata that provides contextual information for the schema.
|
|
157
|
-
*/
|
|
158
|
-
meta?: SchemaMetaConfig<TSpec, TOptions>;
|
|
159
|
-
}
|
|
160
|
-
type InferCreateSchemaOptions<T extends SchemaSourceConfig<any> | SchemaEnvelopeOf<any> | SchemaConfigObject<any, any>> = T extends SchemaSourceConfig<any> | SchemaEnvelopeOf<any> ? InferExtractOptions<T> : {};
|
|
161
|
-
/**
|
|
162
|
-
* A schema extracted from a source input, normalized to JSON Schema.
|
|
163
|
-
*/
|
|
164
|
-
interface Schema<TSpec, TOptions extends object = any> extends SchemaEnvelopeOf<TSpec> {
|
|
165
|
-
/**
|
|
166
|
-
* Optional contextual metadata associated with the schema.
|
|
167
|
-
*/
|
|
168
|
-
meta: SchemaMeta<TSpec, TOptions>;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* 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.
|
|
172
|
-
*
|
|
173
|
-
* @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`.
|
|
174
|
-
*
|
|
175
|
-
* @see {@link Schema}
|
|
176
|
-
*/
|
|
177
|
-
type SchemaOf<TSpec, TOptions extends object = any> = Schema<TSpec, TOptions>;
|
|
178
|
-
//#endregion
|
|
179
|
-
export { SchemaMetaConfig as a, Meta as c, MetaLink as d, MetaValue as f, SchemaMeta as i, MetaConfig as l, Schema as n, SchemaMetaExample as o, SchemaConfigObject as r, SchemaOf as s, InferCreateSchemaOptions as t, MetaDeprecated as u };
|
|
180
|
-
//# sourceMappingURL=schema-DvnNqFd4.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema-DvnNqFd4.d.cts","names":[],"sources":["../src/types/meta.ts","../src/types/schema.ts"],"mappings":";;;;KAoBY,SAAA,iDACV,MAAA,KAAW,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,QAAA,KAAa,YAAA,CAAa,MAAA;AAAA,KAEjD,cAAA;EACQ,OAAA;EAAkB,KAAA;EAAgB,WAAA;AAAA;AAAA,KAE1C,QAAA;EAAsB,IAAA;EAAc,WAAW;AAAA;AAAA,UAE1C,UAAA;EAP2C;;;;;;EAc1D,IAAA,GAAO,SAAA,CAAU,KAAA,EAAO,QAAA;EAdb;;;;;;AAAsD;AAEnE;EAsBE,OAAA,GAAU,SAAA,CAAU,KAAA,EAAO,QAAA,WAAmB,IAAA;;;;EAK9C,WAAA,GAAc,SAAA,CAAU,KAAA,EAAO,QAAA;EA1BqB;;AAAW;AAEjE;;;EAgCE,KAAA,GAAQ,SAAA,CAAU,KAAA,EAAO,QAAA;EAhCgC;AAE3D;;EAmCE,KAAA,GAAQ,SAAA,CAAU,KAAA,EAAO,QAAA;EA5BR;;;;;;EAoCjB,UAAA,GAAa,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,cAAA;EArBhB;;;;;;EA6BxB,IAAA,GAAO,SAAA,CAAU,KAAA,EAAO,QAAA;EAhBC;;;EAqBzB,KAAA,GAAQ,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,QAAA;AAAA;AAAA,UAGpB,IAAA;EARE;;;;;;EAejB,EAAA,EAAI,SAAA,CAAU,KAAA,EAAO,QAAA;EAVJ;;;;;;EAkBjB,IAAA,EAAM,SAAA,CAAU,KAAA,EAAO,QAAA;EAnEC;;;;;;;;EA6ExB,OAAA,EAAS,SAAA,CAAU,KAAA,EAAO,QAAA,WAAmB,IAAA;EA9Dd;;;EAmE/B,WAAA,EAAa,SAAA,CAAU,KAAA,EAAO,QAAA;EA3DL;;;;;;EAmEzB,KAAA,EAAO,SAAA,CAAU,KAAA,EAAO,QAAA;EAtDD;;;EA2DvB,KAAA,GAAQ,SAAA,CAAU,KAAA,EAAO,QAAA;EAnDlB;;;;;;EA2DP,UAAA,GAAa,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,cAAA;EAtDL;;AAAQ;AAG7C;;;EA2DE,IAAA,GAAO,SAAA,CAAU,KAAA,EAAO,QAAA;EApDH;;;EAyDrB,KAAA,EAAO,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,QAAA;AAAA;;;KC9HxB,iBAAA,UACV,KAAA;EAAU,IAAA;EAAe,WAAA;EAAsB,KAAA,EAAO,KAAK;AAAA;AAAA,UAE5C,gBAAA,+CAGP,UAAA,CAAW,KAAA,EAAO,QAAA;EDVT;;;ECcjB,QAAA,GACI,iBAAA,CAAkB,KAAA,IAClB,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,iBAAA,CAAkB,KAAA;EDhBS;;;ECqB1D,IAAA,GAAO,SAAA,CAAU,KAAA,EAAO,QAAA;AAAA;AAAA,UAGT,UAAA,+CAAyD,IAAA,CACxE,KAAA,EACA,QAAA;ED1BiB;;;EC+BjB,QAAA,EAAU,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,iBAAA,CAAkB,KAAA;AAAA;;;AD/BU;UCqClD,kBAAA;EDnCS;;;ECuCxB,MAAA,EAAQ,kBAAA,CAAmB,KAAA,IAAS,gBAAA,CAAiB,KAAA;EDtCjB;;;EC2CpC,IAAA,GAAO,gBAAA,CAAiB,KAAA,EAAO,QAAA;AAAA;AAAA,KAGrB,wBAAA,WAEN,kBAAA,QACA,gBAAA,QACA,kBAAA,cACF,CAAA,SAAU,kBAAA,QAA0B,gBAAA,QACpC,mBAAA,CAAoB,CAAA;;;ADlDmC;UCyD1C,MAAA,+CAGP,gBAAA,CAAiB,KAAA;ED1DA;;;EC8DzB,IAAA,EAAM,UAAA,CAAW,KAAA,EAAO,QAAA;AAAA;;;;;;;;KAUd,QAAA,yCAAiD,MAAA,CAC3D,KAAA,EACA,QAAA"}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { InferExtractOptions, SchemaEnvelopeOf, SchemaSourceConfig } from "@power-plant/schema";
|
|
2
|
-
import { MaybePromise } from "@stryke/types/base";
|
|
3
|
-
|
|
4
|
-
//#region src/types/meta.d.ts
|
|
5
|
-
type MetaValue<TSpec, TOptions extends object, TValue = any> = TValue | ((spec: TSpec, options: TOptions) => MaybePromise<TValue>);
|
|
6
|
-
type MetaDeprecated = true | string | {
|
|
7
|
-
message?: string;
|
|
8
|
-
since?: string;
|
|
9
|
-
alternative?: string;
|
|
10
|
-
};
|
|
11
|
-
type MetaLink = string | {
|
|
12
|
-
href: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
};
|
|
15
|
-
interface MetaConfig<TSpec, TOptions extends object> {
|
|
16
|
-
/**
|
|
17
|
-
* A name for the schema, which can be used to identify or reference the schema 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.
|
|
18
|
-
*
|
|
19
|
-
* @remarks
|
|
20
|
-
* The `name` property is a string that can be used to give the schema 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 schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
21
|
-
*/
|
|
22
|
-
name?: MetaValue<TSpec, TOptions, string>;
|
|
23
|
-
/**
|
|
24
|
-
* A version string that indicates the version of the schema. This property can be used to track changes or updates to the schema over time, allowing consumers of the schema to determine which version they are working with. 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.
|
|
25
|
-
*
|
|
26
|
-
* @remarks
|
|
27
|
-
* 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 schema. It is recommended to use a consistent versioning scheme across all schemas to facilitate easier tracking and management of schema versions.
|
|
28
|
-
*
|
|
29
|
-
* @defaultValue "1.0"
|
|
30
|
-
*/
|
|
31
|
-
version?: MetaValue<TSpec, TOptions, string | Date | number>;
|
|
32
|
-
/**
|
|
33
|
-
* A string that describes the schema in some way.
|
|
34
|
-
*/
|
|
35
|
-
description?: MetaValue<TSpec, TOptions, string>;
|
|
36
|
-
/**
|
|
37
|
-
* A string that provides a human-readable name for the schema, which can be used in documentation, tooling, or other contexts to identify or reference the schema. 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.
|
|
38
|
-
*
|
|
39
|
-
* @remarks
|
|
40
|
-
* The `title` property is a string that can be used to give the schema 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 schema. 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.
|
|
41
|
-
*/
|
|
42
|
-
title?: MetaValue<TSpec, TOptions, string>;
|
|
43
|
-
/**
|
|
44
|
-
* A string that describes when the schema is used.
|
|
45
|
-
*/
|
|
46
|
-
usage?: MetaValue<TSpec, TOptions, string>;
|
|
47
|
-
/**
|
|
48
|
-
* Indicates whether the schema is deprecated, and optionally provides additional information about the deprecation, such as a message, the version since which it is deprecated, and an alternative schema to use instead.
|
|
49
|
-
*
|
|
50
|
-
* @remarks
|
|
51
|
-
* The `deprecated` property can be a boolean value, where `true` indicates that the schema 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 schema to use instead. 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.
|
|
52
|
-
*/
|
|
53
|
-
deprecated?: MetaValue<TSpec, TOptions, MetaDeprecated>;
|
|
54
|
-
/**
|
|
55
|
-
* An array of tags associated with the schema. Tags can be used to categorize or label schemas for organizational purposes, making it easier to search, filter, or group related schemas together. 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.
|
|
56
|
-
*
|
|
57
|
-
* @remarks
|
|
58
|
-
* Each tag in the array should be a string that represents a meaningful label or category for the schema. It is recommended to use consistent and descriptive tags across schemas to facilitate easier management and discovery of related schemas.
|
|
59
|
-
*/
|
|
60
|
-
tags?: MetaValue<TSpec, TOptions, string[]>;
|
|
61
|
-
/**
|
|
62
|
-
* An array of links associated with the schema. Each link can be a string representing a URL or an object containing a `href` property and an optional `description` property.
|
|
63
|
-
*/
|
|
64
|
-
links?: MetaValue<TSpec, TOptions, MetaLink[]>;
|
|
65
|
-
}
|
|
66
|
-
interface Meta<TSpec, TOptions extends object> {
|
|
67
|
-
/**
|
|
68
|
-
* A unique identifier for the schema, which can be used to reference or identify the schema 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.
|
|
69
|
-
*
|
|
70
|
-
* @remarks
|
|
71
|
-
* The `id` property is a string that can be used to give the schema a unique identifier. It can be used in documentation, error messages, or other contexts where it is helpful to have an identifier associated with the schema. 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.
|
|
72
|
-
*/
|
|
73
|
-
id: MetaValue<TSpec, TOptions, string>;
|
|
74
|
-
/**
|
|
75
|
-
* A name for the schema, which can be used to identify or reference the schema 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.
|
|
76
|
-
*
|
|
77
|
-
* @remarks
|
|
78
|
-
* The `name` property is a string that can be used to give the schema 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 schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
79
|
-
*/
|
|
80
|
-
name: MetaValue<TSpec, TOptions, string>;
|
|
81
|
-
/**
|
|
82
|
-
* A version string that indicates the version of the schema. This property can be used to track changes or updates to the schema over time, allowing consumers of the schema to determine which version they are working with. 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.
|
|
83
|
-
*
|
|
84
|
-
* @remarks
|
|
85
|
-
* 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 schema. It is recommended to use a consistent versioning scheme across all schemas to facilitate easier tracking and management of schema versions.
|
|
86
|
-
*
|
|
87
|
-
* @defaultValue "1.0"
|
|
88
|
-
*/
|
|
89
|
-
version: MetaValue<TSpec, TOptions, string | Date | number>;
|
|
90
|
-
/**
|
|
91
|
-
* A string that describes the schema in some way.
|
|
92
|
-
*/
|
|
93
|
-
description: MetaValue<TSpec, TOptions, string>;
|
|
94
|
-
/**
|
|
95
|
-
* A string that provides a human-readable name for the schema, which can be used in documentation, tooling, or other contexts to identify or reference the schema. 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.
|
|
96
|
-
*
|
|
97
|
-
* @remarks
|
|
98
|
-
* The `title` property is a string that can be used to give the schema 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 schema. 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.
|
|
99
|
-
*/
|
|
100
|
-
title: MetaValue<TSpec, TOptions, string>;
|
|
101
|
-
/**
|
|
102
|
-
* A string that describes when the schema is used.
|
|
103
|
-
*/
|
|
104
|
-
usage?: MetaValue<TSpec, TOptions, string>;
|
|
105
|
-
/**
|
|
106
|
-
* Indicates whether the schema is deprecated, and optionally provides additional information about the deprecation, such as a message, the version since which it is deprecated, and an alternative schema to use instead.
|
|
107
|
-
*
|
|
108
|
-
* @remarks
|
|
109
|
-
* The `deprecated` property can be a boolean value, where `true` indicates that the schema 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 schema to use instead. 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.
|
|
110
|
-
*/
|
|
111
|
-
deprecated?: MetaValue<TSpec, TOptions, MetaDeprecated>;
|
|
112
|
-
/**
|
|
113
|
-
* An array of tags associated with the schema. Tags can be used to categorize or label schemas for organizational purposes, making it easier to search, filter, or group related schemas together. 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.
|
|
114
|
-
*
|
|
115
|
-
* @remarks
|
|
116
|
-
* Each tag in the array should be a string that represents a meaningful label or category for the schema. It is recommended to use consistent and descriptive tags across schemas to facilitate easier management and discovery of related schemas.
|
|
117
|
-
*/
|
|
118
|
-
tags?: MetaValue<TSpec, TOptions, string[]>;
|
|
119
|
-
/**
|
|
120
|
-
* An array of links associated with the schema. Each link can be a string representing a URL or an object containing a `href` property and an optional `description` property.
|
|
121
|
-
*/
|
|
122
|
-
links: MetaValue<TSpec, TOptions, MetaLink[]>;
|
|
123
|
-
}
|
|
124
|
-
//#endregion
|
|
125
|
-
//#region src/types/schema.d.ts
|
|
126
|
-
type SchemaMetaExample<TSpec> = TSpec | {
|
|
127
|
-
name?: string;
|
|
128
|
-
description?: string;
|
|
129
|
-
value: TSpec;
|
|
130
|
-
};
|
|
131
|
-
interface SchemaMetaConfig<TSpec, TOptions extends object = any> extends MetaConfig<TSpec, TOptions> {
|
|
132
|
-
/**
|
|
133
|
-
* Examples of valid data for the schema. This can be a single example or an array of examples.
|
|
134
|
-
*/
|
|
135
|
-
examples?: SchemaMetaExample<TSpec> | MetaValue<TSpec, TOptions, SchemaMetaExample<TSpec>[]>;
|
|
136
|
-
/**
|
|
137
|
-
* A description of the specification that is described by this schema.
|
|
138
|
-
*/
|
|
139
|
-
spec?: MetaValue<TSpec, TOptions, string>;
|
|
140
|
-
}
|
|
141
|
-
interface SchemaMeta<TSpec, TOptions extends object = any> extends Meta<TSpec, TOptions> {
|
|
142
|
-
/**
|
|
143
|
-
* Examples of valid data for the schema.
|
|
144
|
-
*/
|
|
145
|
-
examples: MetaValue<TSpec, TOptions, SchemaMetaExample<TSpec>[]>;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Schema input wrapper that attaches optional contextual metadata.
|
|
149
|
-
*/
|
|
150
|
-
interface SchemaConfigObject<TSpec, TOptions extends object = any> {
|
|
151
|
-
/**
|
|
152
|
-
* 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.
|
|
153
|
-
*/
|
|
154
|
-
schema: SchemaSourceConfig<TSpec> | SchemaEnvelopeOf<TSpec>;
|
|
155
|
-
/**
|
|
156
|
-
* Optional metadata that provides contextual information for the schema.
|
|
157
|
-
*/
|
|
158
|
-
meta?: SchemaMetaConfig<TSpec, TOptions>;
|
|
159
|
-
}
|
|
160
|
-
type InferCreateSchemaOptions<T extends SchemaSourceConfig<any> | SchemaEnvelopeOf<any> | SchemaConfigObject<any, any>> = T extends SchemaSourceConfig<any> | SchemaEnvelopeOf<any> ? InferExtractOptions<T> : {};
|
|
161
|
-
/**
|
|
162
|
-
* A schema extracted from a source input, normalized to JSON Schema.
|
|
163
|
-
*/
|
|
164
|
-
interface Schema<TSpec, TOptions extends object = any> extends SchemaEnvelopeOf<TSpec> {
|
|
165
|
-
/**
|
|
166
|
-
* Optional contextual metadata associated with the schema.
|
|
167
|
-
*/
|
|
168
|
-
meta: SchemaMeta<TSpec, TOptions>;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* 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.
|
|
172
|
-
*
|
|
173
|
-
* @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`.
|
|
174
|
-
*
|
|
175
|
-
* @see {@link Schema}
|
|
176
|
-
*/
|
|
177
|
-
type SchemaOf<TSpec, TOptions extends object = any> = Schema<TSpec, TOptions>;
|
|
178
|
-
//#endregion
|
|
179
|
-
export { SchemaMetaConfig as a, Meta as c, MetaLink as d, MetaValue as f, SchemaMeta as i, MetaConfig as l, Schema as n, SchemaMetaExample as o, SchemaConfigObject as r, SchemaOf as s, InferCreateSchemaOptions as t, MetaDeprecated as u };
|
|
180
|
-
//# sourceMappingURL=schema-DvnNqFd4.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema-DvnNqFd4.d.mts","names":[],"sources":["../src/types/meta.ts","../src/types/schema.ts"],"mappings":""}
|