@power-plant/core 0.0.2 → 0.0.4
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 +220 -0
- package/dist/create-23iLtMb_.cjs +1 -0
- package/dist/create-BR4IeVl4.mjs +2 -0
- package/dist/create-BR4IeVl4.mjs.map +1 -0
- package/dist/create-BqRl9d7m.d.cts +19 -0
- package/dist/create-BqRl9d7m.d.cts.map +1 -0
- package/dist/create-C-rR8nuY.d.mts +23 -0
- package/dist/create-C-rR8nuY.d.mts.map +1 -0
- package/dist/create-Cz9qVT4m.d.cts +23 -0
- package/dist/create-Cz9qVT4m.d.cts.map +1 -0
- package/dist/create-DAGPeYVI.d.cts +25 -0
- package/dist/create-DAGPeYVI.d.cts.map +1 -0
- package/dist/create-DEe398aQ.d.mts +25 -0
- package/dist/create-DEe398aQ.d.mts.map +1 -0
- package/dist/create-DUt-efk7.d.cts +25 -0
- package/dist/create-DUt-efk7.d.cts.map +1 -0
- package/dist/create-DcCu_zM3.d.mts +19 -0
- package/dist/create-DcCu_zM3.d.mts.map +1 -0
- package/dist/create-Qxy2mq7r.d.mts +25 -0
- package/dist/create-Qxy2mq7r.d.mts.map +1 -0
- package/dist/define-BPfeEA9Z.d.cts +14 -0
- package/dist/define-BPfeEA9Z.d.cts.map +1 -0
- package/dist/define-CQZ042K5.d.mts +14 -0
- package/dist/define-CQZ042K5.d.mts.map +1 -0
- package/dist/define-Dw8JgVQ1.d.mts +38 -0
- package/dist/define-Dw8JgVQ1.d.mts.map +1 -0
- package/dist/define-aWeW6VVo.d.cts +38 -0
- package/dist/define-aWeW6VVo.d.cts.map +1 -0
- package/dist/generator/create.cjs +1 -0
- package/dist/generator/create.d.cts +2 -0
- package/dist/generator/create.d.mts +2 -0
- package/dist/generator/create.mjs +2 -0
- package/dist/generator/create.mjs.map +1 -0
- package/dist/generator/helpers.cjs +1 -0
- package/dist/generator/helpers.d.cts +6 -0
- package/dist/generator/helpers.d.cts.map +1 -0
- package/dist/generator/helpers.d.mts +6 -0
- package/dist/generator/helpers.d.mts.map +1 -0
- package/dist/generator/helpers.mjs +2 -0
- package/dist/generator/helpers.mjs.map +1 -0
- package/dist/generator/index.cjs +1 -1
- package/dist/generator/index.d.cts +2 -20
- package/dist/generator/index.d.mts +2 -20
- package/dist/generator/index.mjs +1 -2
- package/dist/{generator-C5O_C4RV.d.cts → generator-BGkKE8HQ.d.mts} +18 -14
- package/dist/generator-BGkKE8HQ.d.mts.map +1 -0
- package/dist/{generator-DZI01B4_.d.mts → generator-Dq0PL5w6.d.cts} +18 -14
- package/dist/generator-Dq0PL5w6.d.cts.map +1 -0
- package/dist/helpers-BqnQPaP5.d.cts +13 -0
- package/dist/helpers-BqnQPaP5.d.cts.map +1 -0
- package/dist/helpers-CgXgqnVu.d.mts +13 -0
- package/dist/helpers-CgXgqnVu.d.mts.map +1 -0
- package/dist/index-BVVgDSdq.d.cts +1 -0
- package/dist/index-BVVgDSdq.d.mts +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +12 -8
- package/dist/index.d.mts +12 -8
- package/dist/index.mjs +1 -1
- package/dist/schema/create.cjs +1 -0
- package/dist/schema/create.d.cts +2 -0
- package/dist/schema/create.d.mts +2 -0
- package/dist/schema/create.mjs +1 -0
- package/dist/schema/define.cjs +1 -0
- package/dist/schema/define.d.cts +2 -0
- package/dist/schema/define.d.mts +2 -0
- package/dist/schema/define.mjs +2 -0
- package/dist/schema/define.mjs.map +1 -0
- package/dist/schema/helpers.cjs +1 -0
- package/dist/schema/helpers.d.cts +2 -0
- package/dist/schema/helpers.d.mts +2 -0
- package/dist/schema/helpers.mjs +2 -0
- package/dist/schema/helpers.mjs.map +1 -0
- package/dist/schema/index.cjs +1 -0
- package/dist/schema/index.d.cts +4 -0
- package/dist/schema/index.d.mts +4 -0
- package/dist/schema/index.mjs +1 -0
- package/dist/schema-xFkmOyE6.d.cts +205 -0
- package/dist/schema-xFkmOyE6.d.cts.map +1 -0
- package/dist/schema-xFkmOyE6.d.mts +205 -0
- package/dist/schema-xFkmOyE6.d.mts.map +1 -0
- package/dist/sink/create.cjs +1 -0
- package/dist/sink/create.d.cts +2 -0
- package/dist/sink/create.d.mts +2 -0
- package/dist/sink/create.mjs +2 -0
- package/dist/sink/create.mjs.map +1 -0
- package/dist/sink/define.cjs +1 -0
- package/dist/sink/define.d.cts +37 -0
- package/dist/sink/define.d.cts.map +1 -0
- package/dist/sink/define.d.mts +37 -0
- package/dist/sink/define.d.mts.map +1 -0
- package/dist/sink/define.mjs +2 -0
- package/dist/sink/define.mjs.map +1 -0
- package/dist/sink/helpers.cjs +1 -0
- package/dist/sink/helpers.d.cts +13 -0
- package/dist/sink/helpers.d.cts.map +1 -0
- package/dist/sink/helpers.d.mts +13 -0
- package/dist/sink/helpers.d.mts.map +1 -0
- package/dist/sink/helpers.mjs +2 -0
- package/dist/sink/helpers.mjs.map +1 -0
- package/dist/sink/index.cjs +1 -1
- package/dist/sink/index.d.cts +2 -15
- package/dist/sink/index.d.mts +2 -15
- package/dist/sink/index.mjs +1 -1
- package/dist/sink-CHQncb8H.d.mts +58 -0
- package/dist/sink-CHQncb8H.d.mts.map +1 -0
- package/dist/sink-DHpx94GM.d.cts +58 -0
- package/dist/sink-DHpx94GM.d.cts.map +1 -0
- package/dist/source/create.cjs +1 -0
- package/dist/source/create.d.cts +2 -0
- package/dist/source/create.d.mts +2 -0
- package/dist/source/create.mjs +2 -0
- package/dist/source/create.mjs.map +1 -0
- package/dist/source/define.cjs +1 -0
- package/dist/source/define.d.cts +2 -0
- package/dist/source/define.d.mts +2 -0
- package/dist/source/define.mjs +2 -0
- package/dist/source/define.mjs.map +1 -0
- package/dist/source/helpers.cjs +1 -0
- package/dist/source/helpers.d.cts +13 -0
- package/dist/source/helpers.d.cts.map +1 -0
- package/dist/source/helpers.d.mts +13 -0
- package/dist/source/helpers.d.mts.map +1 -0
- package/dist/source/helpers.mjs +2 -0
- package/dist/source/helpers.mjs.map +1 -0
- package/dist/source/index.cjs +1 -1
- package/dist/source/index.d.cts +3 -16
- package/dist/source/index.d.mts +3 -16
- package/dist/source/index.mjs +1 -1
- package/dist/source-BiOs3_-8.d.mts +57 -0
- package/dist/source-BiOs3_-8.d.mts.map +1 -0
- package/dist/source-txi0ZuzR.d.cts +57 -0
- package/dist/source-txi0ZuzR.d.cts.map +1 -0
- package/package.json +187 -27
- package/dist/config.cjs +0 -0
- package/dist/config.d.cts +0 -10
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts +0 -10
- package/dist/config.d.mts.map +0 -1
- package/dist/config.mjs +0 -2
- package/dist/config.mjs.map +0 -1
- package/dist/extract-BzZLelb2.mjs +0 -2
- package/dist/extract-BzZLelb2.mjs.map +0 -1
- package/dist/extract-DUwG1ZUO.cjs +0 -1
- package/dist/extract-FkKA9g1K.cjs +0 -1
- package/dist/extract-ZIpZAKsq.mjs +0 -2
- package/dist/extract-ZIpZAKsq.mjs.map +0 -1
- package/dist/generator/index.d.cts.map +0 -1
- package/dist/generator/index.d.mts.map +0 -1
- package/dist/generator/index.mjs.map +0 -1
- package/dist/generator-C5O_C4RV.d.cts.map +0 -1
- package/dist/generator-DZI01B4_.d.mts.map +0 -1
- package/dist/sink/index.d.cts.map +0 -1
- package/dist/sink/index.d.mts.map +0 -1
- package/dist/source/index.d.cts.map +0 -1
- package/dist/source/index.d.mts.map +0 -1
- package/dist/types-B2MtSxCp.d.cts +0 -47
- package/dist/types-B2MtSxCp.d.cts.map +0 -1
- package/dist/types-B2MtSxCp.d.mts +0 -47
- package/dist/types-B2MtSxCp.d.mts.map +0 -1
- package/dist/types-DJo-IRmS.d.cts +0 -47
- package/dist/types-DJo-IRmS.d.cts.map +0 -1
- package/dist/types-DJo-IRmS.d.mts +0 -47
- package/dist/types-DJo-IRmS.d.mts.map +0 -1
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { InferExtractOptions, SchemaEnvelopeOf, SchemaSourceInput } from "@power-plant/schema";
|
|
2
|
+
|
|
3
|
+
//#region ../../../node_modules/.pnpm/@stryke+types@0.12.21/node_modules/@stryke/types/dist/base.d.mts
|
|
4
|
+
/**
|
|
5
|
+
* Matches a value that is either of type `T` or a promise that resolves to `T`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* type Result = MaybePromise<string>;
|
|
10
|
+
* // string | Promise<string>
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
14
|
+
/**
|
|
15
|
+
* Matches a reducer function that takes the current state and an action, returning the next state.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* This is the function signature used in state management libraries like Redux.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* type CounterReducer = ReducerFunction<number, { type: 'increment' | 'decrement' }>;
|
|
23
|
+
* const reducer: CounterReducer = (state, action) => {
|
|
24
|
+
* return action.type === 'increment' ? state + 1 : state - 1;
|
|
25
|
+
* };
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/types/meta.d.ts
|
|
30
|
+
type MetaValue<TSpec, TOptions extends object, TValue = any> = TValue | ((spec: TSpec, options: TOptions) => MaybePromise<TValue>);
|
|
31
|
+
type MetaDeprecated = true | string | {
|
|
32
|
+
message?: string;
|
|
33
|
+
since?: string;
|
|
34
|
+
alternative?: string;
|
|
35
|
+
};
|
|
36
|
+
type MetaLink = string | {
|
|
37
|
+
href: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
};
|
|
40
|
+
interface MetaInput<TSpec, TOptions extends object> {
|
|
41
|
+
/**
|
|
42
|
+
* 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.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* 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.
|
|
46
|
+
*/
|
|
47
|
+
name?: MetaValue<TSpec, TOptions, string>;
|
|
48
|
+
/**
|
|
49
|
+
* 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.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* 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.
|
|
53
|
+
*
|
|
54
|
+
* @defaultValue "1.0"
|
|
55
|
+
*/
|
|
56
|
+
version?: MetaValue<TSpec, TOptions, string | Date | number>;
|
|
57
|
+
/**
|
|
58
|
+
* A string that describes the schema in some way.
|
|
59
|
+
*/
|
|
60
|
+
description?: MetaValue<TSpec, TOptions, string>;
|
|
61
|
+
/**
|
|
62
|
+
* 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.
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* 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.
|
|
66
|
+
*/
|
|
67
|
+
title?: MetaValue<TSpec, TOptions, string>;
|
|
68
|
+
/**
|
|
69
|
+
* A string that describes when the schema is used.
|
|
70
|
+
*/
|
|
71
|
+
usage?: MetaValue<TSpec, TOptions, string>;
|
|
72
|
+
/**
|
|
73
|
+
* 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.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* 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.
|
|
77
|
+
*/
|
|
78
|
+
deprecated?: MetaValue<TSpec, TOptions, MetaDeprecated>;
|
|
79
|
+
/**
|
|
80
|
+
* 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.
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* 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.
|
|
84
|
+
*/
|
|
85
|
+
tags?: MetaValue<TSpec, TOptions, string[]>;
|
|
86
|
+
/**
|
|
87
|
+
* 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.
|
|
88
|
+
*/
|
|
89
|
+
links?: MetaValue<TSpec, TOptions, MetaLink[]>;
|
|
90
|
+
}
|
|
91
|
+
interface Meta<TSpec, TOptions extends object> {
|
|
92
|
+
/**
|
|
93
|
+
* 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.
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* 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.
|
|
97
|
+
*/
|
|
98
|
+
id: MetaValue<TSpec, TOptions, string>;
|
|
99
|
+
/**
|
|
100
|
+
* 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.
|
|
101
|
+
*
|
|
102
|
+
* @remarks
|
|
103
|
+
* 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.
|
|
104
|
+
*/
|
|
105
|
+
name: MetaValue<TSpec, TOptions, string>;
|
|
106
|
+
/**
|
|
107
|
+
* 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.
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* 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.
|
|
111
|
+
*
|
|
112
|
+
* @defaultValue "1.0"
|
|
113
|
+
*/
|
|
114
|
+
version: MetaValue<TSpec, TOptions, string | Date | number>;
|
|
115
|
+
/**
|
|
116
|
+
* A string that describes the schema in some way.
|
|
117
|
+
*/
|
|
118
|
+
description: MetaValue<TSpec, TOptions, string>;
|
|
119
|
+
/**
|
|
120
|
+
* 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.
|
|
121
|
+
*
|
|
122
|
+
* @remarks
|
|
123
|
+
* 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.
|
|
124
|
+
*/
|
|
125
|
+
title: MetaValue<TSpec, TOptions, string>;
|
|
126
|
+
/**
|
|
127
|
+
* A string that describes when the schema is used.
|
|
128
|
+
*/
|
|
129
|
+
usage?: MetaValue<TSpec, TOptions, string>;
|
|
130
|
+
/**
|
|
131
|
+
* 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.
|
|
132
|
+
*
|
|
133
|
+
* @remarks
|
|
134
|
+
* 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.
|
|
135
|
+
*/
|
|
136
|
+
deprecated?: MetaValue<TSpec, TOptions, MetaDeprecated>;
|
|
137
|
+
/**
|
|
138
|
+
* 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.
|
|
139
|
+
*
|
|
140
|
+
* @remarks
|
|
141
|
+
* 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.
|
|
142
|
+
*/
|
|
143
|
+
tags?: MetaValue<TSpec, TOptions, string[]>;
|
|
144
|
+
/**
|
|
145
|
+
* 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.
|
|
146
|
+
*/
|
|
147
|
+
links: MetaValue<TSpec, TOptions, MetaLink[]>;
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/types/schema.d.ts
|
|
151
|
+
type SchemaMetaExample<TSpec> = TSpec | {
|
|
152
|
+
name?: string;
|
|
153
|
+
description?: string;
|
|
154
|
+
value: TSpec;
|
|
155
|
+
};
|
|
156
|
+
interface SchemaMetaInput<TSpec, TOptions extends object = any> extends MetaInput<TSpec, TOptions> {
|
|
157
|
+
/**
|
|
158
|
+
* Examples of valid data for the schema. This can be a single example or an array of examples.
|
|
159
|
+
*/
|
|
160
|
+
examples?: SchemaMetaExample<TSpec> | MetaValue<TSpec, TOptions, SchemaMetaExample<TSpec>[]>;
|
|
161
|
+
/**
|
|
162
|
+
* A description of the specification that is described by this schema.
|
|
163
|
+
*/
|
|
164
|
+
spec?: MetaValue<TSpec, TOptions, string>;
|
|
165
|
+
}
|
|
166
|
+
interface SchemaMeta<TSpec, TOptions extends object = any> extends Meta<TSpec, TOptions> {
|
|
167
|
+
/**
|
|
168
|
+
* Examples of valid data for the schema.
|
|
169
|
+
*/
|
|
170
|
+
examples: MetaValue<TSpec, TOptions, SchemaMetaExample<TSpec>[]>;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Schema input wrapper that attaches optional contextual metadata.
|
|
174
|
+
*/
|
|
175
|
+
interface SchemaInputObject<TSpec, TOptions extends object = any> {
|
|
176
|
+
/**
|
|
177
|
+
* 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.
|
|
178
|
+
*/
|
|
179
|
+
schema: SchemaSourceInput<TSpec> | SchemaEnvelopeOf<TSpec>;
|
|
180
|
+
/**
|
|
181
|
+
* Optional metadata that provides contextual information for the schema.
|
|
182
|
+
*/
|
|
183
|
+
meta?: SchemaMetaInput<TSpec, TOptions>;
|
|
184
|
+
}
|
|
185
|
+
type InferCreateSchemaOptions<T extends SchemaSourceInput<any> | SchemaEnvelopeOf<any> | SchemaInputObject<any, any>> = T extends SchemaSourceInput<any> | SchemaEnvelopeOf<any> ? InferExtractOptions<T> : {};
|
|
186
|
+
/**
|
|
187
|
+
* A schema extracted from a source input, normalized to JSON Schema.
|
|
188
|
+
*/
|
|
189
|
+
interface Schema<TSpec, TOptions extends object = any> extends SchemaEnvelopeOf<TSpec> {
|
|
190
|
+
/**
|
|
191
|
+
* Optional contextual metadata associated with the schema.
|
|
192
|
+
*/
|
|
193
|
+
meta: SchemaMeta<TSpec, TOptions>;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* 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.
|
|
197
|
+
*
|
|
198
|
+
* @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`.
|
|
199
|
+
*
|
|
200
|
+
* @see {@link Schema}
|
|
201
|
+
*/
|
|
202
|
+
type SchemaOf<TSpec, TOptions extends object = any> = Schema<TSpec, TOptions>;
|
|
203
|
+
//#endregion
|
|
204
|
+
export { SchemaMetaExample as a, Meta as c, MetaLink as d, MetaValue as f, SchemaMeta as i, MetaDeprecated as l, Schema as n, SchemaMetaInput as o, MaybePromise as p, SchemaInputObject as r, SchemaOf as s, InferCreateSchemaOptions as t, MetaInput as u };
|
|
205
|
+
//# sourceMappingURL=schema-xFkmOyE6.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-xFkmOyE6.d.cts","names":["SerializablePrimitive","Primitive","Date","RegExp","Function","Promise","value","Record","TypeTester","Value","X","A","ReadonlyArray","P","List","R","args","FunctionLike","T","Nullish","Map","WeakMap","WeakKey","emptyObjectSymbol","PlainObject","AnyArray","AnyMap","AnyWeakMap","IndexType","TypedIndexable","F1","F2","Uppercase","Lowercase","AnyCase","F","EMPTY_STRING","_args","prototype","clone","TState","TAction","state","action","IArguments","Set","K","Omit","Required","Pick","Narrowable","NarrowRaw","Try","A1","A2","Catch","N","Result","ComputeRange","TValue","TName","name","File","D","BrowserNativeObject","NestedValue","DeepPartial","Depth","DeepRequired","DeepNonNullable","NonNullable","DeepReadonly","Array","U","DeepReadonlyNonNullable","DeepReadonlyNullable","initialValue","currentValue","BaseType","Exclude","Key","B","G","KeyType","ExcludeType","IsEqual","requireExactProps","ObjectType","KeysType","Options","ExceptOptions","Filter","Partial","Keys","$NestedValue","current","id","version","sequence","__type","Typed","isTypeOf","BuiltIns","arguments_","IsNull","IsUndefined","AnyFunction","globalThis","Arguments","AbstractConstructor","L","Fill","BuildTuple","ArrayBuffer","DataView","Error","TypedArray","Blob","StructuredCloneable","key","ReadonlyMap","ReadonlySet","StructuredCloneablePrimitive","StructuredCloneableData","StructuredCloneableCollection"],"sources":["../../../../node_modules/.pnpm/@stryke+types@0.12.21/node_modules/@stryke/types/dist/base.d.mts","../src/types/meta.ts","../src/types/schema.ts"],"x_google_ignoreList":[0],"mappings":";;;;AE2BuD;AAEvD;;;;;;;KFsMK,YAAA,MAAkB,CAAA,GAAI,OAAA,CAAQ,CAAA;;;;;;;;;;;;;;;;;KC/MvB,SAAA,iDACR,MAAA,KACE,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,QAAA,KAAa,YAAA,CAAa,MAAA;AAAA,KAE1C,cAAA;EAGN,OAAA;EAAkB,KAAA;EAAgB,WAAA;AAAA;AAAA,KAE5B,QAAA;EAAsB,IAAA;EAAc,WAAW;AAAA;AAAA,UAE1C,SAAA;EDoMMkB;;;;AAAa;;EC7LlC,IAAA,GAAO,SAAA,CAAU,KAAA,EAAO,QAAA;;AAlB1B;;;;;;;EA4BE,OAAA,GAAU,SAAA,CAAU,KAAA,EAAO,QAAA,WAAmB,IAAA;EA1BK;;;EA+BnD,WAAA,GAAc,SAAA,CAAU,KAAA,EAAO,QAAA;EAjCqB;;;;;;EAyCpD,KAAA,GAAQ,SAAA,CAAU,KAAA,EAAO,QAAA;EAvC2B;;AAAM;EA4C1D,KAAA,GAAQ,SAAA,CAAU,KAAA,EAAO,QAAA;EA1CD;;;;;;EAkDxB,UAAA,GAAa,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,cAAA;EA/CS;AAEnD;;;;AAA2D;EAqDzD,IAAA,GAAO,SAAA,CAAU,KAAA,EAAO,QAAA;EAnDA;;;EAwDxB,KAAA,GAAQ,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,QAAA;AAAA;AAAA,UAGpB,IAAA;EA1CY;;;;;;EAiD3B,EAAA,EAAI,SAAA,CAAU,KAAA,EAAO,QAAA;EApCI;;;;;;EA4CzB,IAAA,EAAM,SAAA,CAAU,KAAA,EAAO,QAAA;EA/BiB;;;;;;;;EAyCxC,OAAA,EAAS,SAAA,CAAU,KAAA,EAAO,QAAA,WAAmB,IAAA;EA5B5B;;;EAiCjB,WAAA,EAAa,SAAA,CAAU,KAAA,EAAO,QAAA;EAlF9B;;;;;;EA0FA,KAAA,EAAO,SAAA,CAAU,KAAA,EAAO,QAAA;EAhFG;;;EAqF3B,KAAA,GAAQ,SAAA,CAAU,KAAA,EAAO,QAAA;EAhFD;;;;;;EAwFxB,UAAA,GAAa,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,cAAA;EA3EhC;;;;;;EAmFR,IAAA,GAAO,SAAA,CAAU,KAAA,EAAO,QAAA;EA3EgB;;;EAgFxC,KAAA,EAAO,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,QAAA;AAAA;;;KCjIxB,iBAAA,UACR,KAAA;EACE,IAAA;EAAe,WAAA;EAAsB,KAAA,EAAO,KAAK;AAAA;AAAA,UAEtC,eAAA,+CAGP,SAAA,CAAU,KAAA,EAAO,QAAA;EFmMA;;;EE/LzB,QAAA,GACI,iBAAA,CAAkB,KAAA,IAClB,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,iBAAA,CAAkB,KAAA;EF6L5BA;;;EExLrB,IAAA,GAAO,SAAA,CAAU,KAAA,EAAO,QAAA;AAAA;AAAA,UAGT,UAAA,+CAAyD,IAAA,CACxE,KAAA,EACA,QAAA;;;AD5BF;ECiCE,QAAA,EAAU,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,iBAAA,CAAkB,KAAA;AAAA;;;;UAMxC,iBAAA;EDrCwB;;;ECyCvC,MAAA,EAAQ,iBAAA,CAAkB,KAAA,IAAS,gBAAA,CAAiB,KAAA;ED3CzB;;;ECgD3B,IAAA,GAAO,eAAA,CAAgB,KAAA,EAAO,QAAA;AAAA;AAAA,KAGpB,wBAAA,WAEN,iBAAA,QACA,gBAAA,QACA,iBAAA,cACF,CAAA,SAAU,iBAAA,QAAyB,gBAAA,QACnC,mBAAA,CAAoB,CAAA;;;;UAOP,MAAA,+CAGP,gBAAA,CAAiB,KAAA;EDjEiC;AAE5D;;ECmEE,IAAA,EAAM,UAAA,CAAW,KAAA,EAAO,QAAA;AAAA;;;;;ADhEyB;AAEnD;;KCwEY,QAAA,yCAAiD,MAAA,CAC3D,KAAA,EACA,QAAA"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { InferExtractOptions, SchemaEnvelopeOf, SchemaSourceInput } from "@power-plant/schema";
|
|
2
|
+
|
|
3
|
+
//#region ../../../node_modules/.pnpm/@stryke+types@0.12.21/node_modules/@stryke/types/dist/base.d.mts
|
|
4
|
+
/**
|
|
5
|
+
* Matches a value that is either of type `T` or a promise that resolves to `T`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* type Result = MaybePromise<string>;
|
|
10
|
+
* // string | Promise<string>
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
14
|
+
/**
|
|
15
|
+
* Matches a reducer function that takes the current state and an action, returning the next state.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* This is the function signature used in state management libraries like Redux.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* type CounterReducer = ReducerFunction<number, { type: 'increment' | 'decrement' }>;
|
|
23
|
+
* const reducer: CounterReducer = (state, action) => {
|
|
24
|
+
* return action.type === 'increment' ? state + 1 : state - 1;
|
|
25
|
+
* };
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/types/meta.d.ts
|
|
30
|
+
type MetaValue<TSpec, TOptions extends object, TValue = any> = TValue | ((spec: TSpec, options: TOptions) => MaybePromise<TValue>);
|
|
31
|
+
type MetaDeprecated = true | string | {
|
|
32
|
+
message?: string;
|
|
33
|
+
since?: string;
|
|
34
|
+
alternative?: string;
|
|
35
|
+
};
|
|
36
|
+
type MetaLink = string | {
|
|
37
|
+
href: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
};
|
|
40
|
+
interface MetaInput<TSpec, TOptions extends object> {
|
|
41
|
+
/**
|
|
42
|
+
* 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.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* 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.
|
|
46
|
+
*/
|
|
47
|
+
name?: MetaValue<TSpec, TOptions, string>;
|
|
48
|
+
/**
|
|
49
|
+
* 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.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* 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.
|
|
53
|
+
*
|
|
54
|
+
* @defaultValue "1.0"
|
|
55
|
+
*/
|
|
56
|
+
version?: MetaValue<TSpec, TOptions, string | Date | number>;
|
|
57
|
+
/**
|
|
58
|
+
* A string that describes the schema in some way.
|
|
59
|
+
*/
|
|
60
|
+
description?: MetaValue<TSpec, TOptions, string>;
|
|
61
|
+
/**
|
|
62
|
+
* 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.
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* 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.
|
|
66
|
+
*/
|
|
67
|
+
title?: MetaValue<TSpec, TOptions, string>;
|
|
68
|
+
/**
|
|
69
|
+
* A string that describes when the schema is used.
|
|
70
|
+
*/
|
|
71
|
+
usage?: MetaValue<TSpec, TOptions, string>;
|
|
72
|
+
/**
|
|
73
|
+
* 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.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* 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.
|
|
77
|
+
*/
|
|
78
|
+
deprecated?: MetaValue<TSpec, TOptions, MetaDeprecated>;
|
|
79
|
+
/**
|
|
80
|
+
* 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.
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* 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.
|
|
84
|
+
*/
|
|
85
|
+
tags?: MetaValue<TSpec, TOptions, string[]>;
|
|
86
|
+
/**
|
|
87
|
+
* 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.
|
|
88
|
+
*/
|
|
89
|
+
links?: MetaValue<TSpec, TOptions, MetaLink[]>;
|
|
90
|
+
}
|
|
91
|
+
interface Meta<TSpec, TOptions extends object> {
|
|
92
|
+
/**
|
|
93
|
+
* 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.
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* 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.
|
|
97
|
+
*/
|
|
98
|
+
id: MetaValue<TSpec, TOptions, string>;
|
|
99
|
+
/**
|
|
100
|
+
* 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.
|
|
101
|
+
*
|
|
102
|
+
* @remarks
|
|
103
|
+
* 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.
|
|
104
|
+
*/
|
|
105
|
+
name: MetaValue<TSpec, TOptions, string>;
|
|
106
|
+
/**
|
|
107
|
+
* 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.
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* 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.
|
|
111
|
+
*
|
|
112
|
+
* @defaultValue "1.0"
|
|
113
|
+
*/
|
|
114
|
+
version: MetaValue<TSpec, TOptions, string | Date | number>;
|
|
115
|
+
/**
|
|
116
|
+
* A string that describes the schema in some way.
|
|
117
|
+
*/
|
|
118
|
+
description: MetaValue<TSpec, TOptions, string>;
|
|
119
|
+
/**
|
|
120
|
+
* 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.
|
|
121
|
+
*
|
|
122
|
+
* @remarks
|
|
123
|
+
* 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.
|
|
124
|
+
*/
|
|
125
|
+
title: MetaValue<TSpec, TOptions, string>;
|
|
126
|
+
/**
|
|
127
|
+
* A string that describes when the schema is used.
|
|
128
|
+
*/
|
|
129
|
+
usage?: MetaValue<TSpec, TOptions, string>;
|
|
130
|
+
/**
|
|
131
|
+
* 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.
|
|
132
|
+
*
|
|
133
|
+
* @remarks
|
|
134
|
+
* 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.
|
|
135
|
+
*/
|
|
136
|
+
deprecated?: MetaValue<TSpec, TOptions, MetaDeprecated>;
|
|
137
|
+
/**
|
|
138
|
+
* 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.
|
|
139
|
+
*
|
|
140
|
+
* @remarks
|
|
141
|
+
* 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.
|
|
142
|
+
*/
|
|
143
|
+
tags?: MetaValue<TSpec, TOptions, string[]>;
|
|
144
|
+
/**
|
|
145
|
+
* 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.
|
|
146
|
+
*/
|
|
147
|
+
links: MetaValue<TSpec, TOptions, MetaLink[]>;
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/types/schema.d.ts
|
|
151
|
+
type SchemaMetaExample<TSpec> = TSpec | {
|
|
152
|
+
name?: string;
|
|
153
|
+
description?: string;
|
|
154
|
+
value: TSpec;
|
|
155
|
+
};
|
|
156
|
+
interface SchemaMetaInput<TSpec, TOptions extends object = any> extends MetaInput<TSpec, TOptions> {
|
|
157
|
+
/**
|
|
158
|
+
* Examples of valid data for the schema. This can be a single example or an array of examples.
|
|
159
|
+
*/
|
|
160
|
+
examples?: SchemaMetaExample<TSpec> | MetaValue<TSpec, TOptions, SchemaMetaExample<TSpec>[]>;
|
|
161
|
+
/**
|
|
162
|
+
* A description of the specification that is described by this schema.
|
|
163
|
+
*/
|
|
164
|
+
spec?: MetaValue<TSpec, TOptions, string>;
|
|
165
|
+
}
|
|
166
|
+
interface SchemaMeta<TSpec, TOptions extends object = any> extends Meta<TSpec, TOptions> {
|
|
167
|
+
/**
|
|
168
|
+
* Examples of valid data for the schema.
|
|
169
|
+
*/
|
|
170
|
+
examples: MetaValue<TSpec, TOptions, SchemaMetaExample<TSpec>[]>;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Schema input wrapper that attaches optional contextual metadata.
|
|
174
|
+
*/
|
|
175
|
+
interface SchemaInputObject<TSpec, TOptions extends object = any> {
|
|
176
|
+
/**
|
|
177
|
+
* 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.
|
|
178
|
+
*/
|
|
179
|
+
schema: SchemaSourceInput<TSpec> | SchemaEnvelopeOf<TSpec>;
|
|
180
|
+
/**
|
|
181
|
+
* Optional metadata that provides contextual information for the schema.
|
|
182
|
+
*/
|
|
183
|
+
meta?: SchemaMetaInput<TSpec, TOptions>;
|
|
184
|
+
}
|
|
185
|
+
type InferCreateSchemaOptions<T extends SchemaSourceInput<any> | SchemaEnvelopeOf<any> | SchemaInputObject<any, any>> = T extends SchemaSourceInput<any> | SchemaEnvelopeOf<any> ? InferExtractOptions<T> : {};
|
|
186
|
+
/**
|
|
187
|
+
* A schema extracted from a source input, normalized to JSON Schema.
|
|
188
|
+
*/
|
|
189
|
+
interface Schema<TSpec, TOptions extends object = any> extends SchemaEnvelopeOf<TSpec> {
|
|
190
|
+
/**
|
|
191
|
+
* Optional contextual metadata associated with the schema.
|
|
192
|
+
*/
|
|
193
|
+
meta: SchemaMeta<TSpec, TOptions>;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* 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.
|
|
197
|
+
*
|
|
198
|
+
* @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`.
|
|
199
|
+
*
|
|
200
|
+
* @see {@link Schema}
|
|
201
|
+
*/
|
|
202
|
+
type SchemaOf<TSpec, TOptions extends object = any> = Schema<TSpec, TOptions>;
|
|
203
|
+
//#endregion
|
|
204
|
+
export { SchemaMetaExample as a, Meta as c, MetaLink as d, MetaValue as f, SchemaMeta as i, MetaDeprecated as l, Schema as n, SchemaMetaInput as o, MaybePromise as p, SchemaInputObject as r, SchemaOf as s, InferCreateSchemaOptions as t, MetaInput as u };
|
|
205
|
+
//# sourceMappingURL=schema-xFkmOyE6.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-xFkmOyE6.d.mts","names":["SerializablePrimitive","Primitive","Date","RegExp","Function","Promise","value","Record","TypeTester","Value","X","A","ReadonlyArray","P","List","R","args","FunctionLike","T","Nullish","Map","WeakMap","WeakKey","emptyObjectSymbol","PlainObject","AnyArray","AnyMap","AnyWeakMap","IndexType","TypedIndexable","F1","F2","Uppercase","Lowercase","AnyCase","F","EMPTY_STRING","_args","prototype","clone","TState","TAction","state","action","IArguments","Set","K","Omit","Required","Pick","Narrowable","NarrowRaw","Try","A1","A2","Catch","N","Result","ComputeRange","TValue","TName","name","File","D","BrowserNativeObject","NestedValue","DeepPartial","Depth","DeepRequired","DeepNonNullable","NonNullable","DeepReadonly","Array","U","DeepReadonlyNonNullable","DeepReadonlyNullable","initialValue","currentValue","BaseType","Exclude","Key","B","G","KeyType","ExcludeType","IsEqual","requireExactProps","ObjectType","KeysType","Options","ExceptOptions","Filter","Partial","Keys","$NestedValue","current","id","version","sequence","__type","Typed","isTypeOf","BuiltIns","arguments_","IsNull","IsUndefined","AnyFunction","globalThis","Arguments","AbstractConstructor","L","Fill","BuildTuple","ArrayBuffer","DataView","Error","TypedArray","Blob","StructuredCloneable","key","ReadonlyMap","ReadonlySet","StructuredCloneablePrimitive","StructuredCloneableData","StructuredCloneableCollection"],"sources":["../../../../node_modules/.pnpm/@stryke+types@0.12.21/node_modules/@stryke/types/dist/base.d.mts","../src/types/meta.ts","../src/types/schema.ts"],"x_google_ignoreList":[0],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../create-23iLtMb_.cjs"),t=require("./helpers.cjs");let n=require("@stryke/resolve/load"),r=require("@stryke/type-checks/is-function"),i=require("@power-plant/schema/helpers"),a=require("@stryke/resolve/type-checks");function o(t,n){let i=t?.schema??{},a=e.r(t,n);return a.description=e.i((0,r.isFunction)(a.title)?async(e,t)=>`Accepts a ${await Promise.resolve(a.title(e,t))??``} specification and processes it with a {title} sink.`:`Accepts a ${a.title??``} specification and processes it with a {title} sink.`,i,a,n?.description),a}async function s(r,c,l={}){let{sink:u,meta:d,schema:f}=t.isSinkInputObject(c)?c:{sink:c,meta:{}},p=r;f&&(p=await e.t(f,l),p.schema=(0,i.mergeMetadata)(p.schema,r.schema));let m;if((0,a.isLoadInput)(u))try{let e=await(0,n.load)(u,l);m=t.isSinkInputObject(e)?await s(p,e.sink,l).then(e=>e.sink):e}catch{}return m||=u,{schema:p,sink:m,meta:o(p,d)}}exports.createSink=s,exports.extractSinkMeta=o;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e,r as t,t as n}from"../create-BR4IeVl4.mjs";import{isSinkInputObject as r}from"./helpers.mjs";import{load as i}from"@stryke/resolve/load";import{isFunction as a}from"@stryke/type-checks/is-function";import{mergeMetadata as o}from"@power-plant/schema/helpers";import{isLoadInput as s}from"@stryke/resolve/type-checks";function c(n,r){let i=n?.schema??{},o=t(n,r);return o.description=e(a(o.title)?async(e,t)=>`Accepts a ${await Promise.resolve(o.title(e,t))??``} specification and processes it with a {title} sink.`:`Accepts a ${o.title??``} specification and processes it with a {title} sink.`,i,o,r?.description),o}async function l(e,t,a={}){let{sink:u,meta:d,schema:f}=r(t)?t:{sink:t,meta:{}},p=e;f&&(p=await n(f,a),p.schema=o(p.schema,e.schema));let m;if(s(u))try{let e=await i(u,a);m=r(e)?await l(p,e.sink,a).then(e=>e.sink):e}catch{}return m||=u,{schema:p,sink:m,meta:c(p,d)}}export{l as createSink,c as extractSinkMeta};
|
|
2
|
+
//# sourceMappingURL=create.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers.cjs");function t(t){return e.isSinkInputObject(t)?t:{sink:t}}exports.defineSink=t;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { a as SinkInputObject, i as SinkInput } from "../sink-DHpx94GM.cjs";
|
|
2
|
+
//#region src/sink/define.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Defines a sink input object. If the provided sink is already a sink input object, it will be returned as-is. Otherwise, it will be wrapped in an object with a `sink` property.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { defineSink } from "@power-plant/core";
|
|
9
|
+
*
|
|
10
|
+
* // Define a sink from a sink function
|
|
11
|
+
* export default defineSink((spec, options) => {
|
|
12
|
+
* // Your sink logic here
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* // Define a sink from an existing sink input object
|
|
16
|
+
* export default defineSink({
|
|
17
|
+
* meta: {
|
|
18
|
+
* name: "My Sink",
|
|
19
|
+
* version: "1.0.0",
|
|
20
|
+
* description: "A sink that does something.",
|
|
21
|
+
* },
|
|
22
|
+
* schema: z.object({
|
|
23
|
+
* // Your schema definition here
|
|
24
|
+
* }),
|
|
25
|
+
* sink: (spec, options) => {
|
|
26
|
+
* // Your sink logic here
|
|
27
|
+
* },
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param sink - The sink input to define. This can be either a sink input object or a sink function.
|
|
32
|
+
* @returns A sink input object that contains the provided sink. If the input was already a sink input object, it will be returned unchanged.
|
|
33
|
+
*/
|
|
34
|
+
declare function defineSink<TSpec, TOptions extends object, TReturns = void>(sink: SinkInput<TSpec, TOptions, TReturns>): SinkInputObject<TSpec, TOptions, TReturns>;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { defineSink };
|
|
37
|
+
//# sourceMappingURL=define.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.cts","names":[],"sources":["../../src/sink/define.ts"],"mappings":";;;;;AAoDA;;;;;;;;;;;;;;;;;;;;;;;;;;AAE4C;;iBAF5B,UAAA,kDACd,IAAA,EAAM,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,QAAA,IAChC,eAAA,CAAgB,KAAA,EAAO,QAAA,EAAU,QAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { a as SinkInputObject, i as SinkInput } from "../sink-CHQncb8H.mjs";
|
|
2
|
+
//#region src/sink/define.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Defines a sink input object. If the provided sink is already a sink input object, it will be returned as-is. Otherwise, it will be wrapped in an object with a `sink` property.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { defineSink } from "@power-plant/core";
|
|
9
|
+
*
|
|
10
|
+
* // Define a sink from a sink function
|
|
11
|
+
* export default defineSink((spec, options) => {
|
|
12
|
+
* // Your sink logic here
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* // Define a sink from an existing sink input object
|
|
16
|
+
* export default defineSink({
|
|
17
|
+
* meta: {
|
|
18
|
+
* name: "My Sink",
|
|
19
|
+
* version: "1.0.0",
|
|
20
|
+
* description: "A sink that does something.",
|
|
21
|
+
* },
|
|
22
|
+
* schema: z.object({
|
|
23
|
+
* // Your schema definition here
|
|
24
|
+
* }),
|
|
25
|
+
* sink: (spec, options) => {
|
|
26
|
+
* // Your sink logic here
|
|
27
|
+
* },
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param sink - The sink input to define. This can be either a sink input object or a sink function.
|
|
32
|
+
* @returns A sink input object that contains the provided sink. If the input was already a sink input object, it will be returned unchanged.
|
|
33
|
+
*/
|
|
34
|
+
declare function defineSink<TSpec, TOptions extends object, TReturns = void>(sink: SinkInput<TSpec, TOptions, TReturns>): SinkInputObject<TSpec, TOptions, TReturns>;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { defineSink };
|
|
37
|
+
//# sourceMappingURL=define.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.mts","names":[],"sources":["../../src/sink/define.ts"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@stryke/type-checks/is-set-object");function t(t){return(0,e.isSetObject)(t)&&`sink`in t&&t.sink!==void 0}exports.isSinkInputObject=t;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { a as SinkInputObject } from "../sink-DHpx94GM.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/sink/helpers.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the provided input is a {@link SinkInputObject}.
|
|
6
|
+
*
|
|
7
|
+
* @param input - The input to check.
|
|
8
|
+
* @returns True if the input is a {@link SinkInputObject}, false otherwise.
|
|
9
|
+
*/
|
|
10
|
+
declare function isSinkInputObject<TSpec, TOptions extends object, TReturns = void>(input: unknown): input is SinkInputObject<TSpec, TOptions, TReturns>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { isSinkInputObject };
|
|
13
|
+
//# sourceMappingURL=helpers.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.cts","names":[],"sources":["../../src/sink/helpers.ts"],"mappings":";;;;;AA2BA;;;;iBAAgB,iBAAA,kDAId,KAAA,YAAiB,KAAA,IAAS,eAAA,CAAgB,KAAA,EAAO,QAAA,EAAU,QAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { a as SinkInputObject } from "../sink-CHQncb8H.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/sink/helpers.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the provided input is a {@link SinkInputObject}.
|
|
6
|
+
*
|
|
7
|
+
* @param input - The input to check.
|
|
8
|
+
* @returns True if the input is a {@link SinkInputObject}, false otherwise.
|
|
9
|
+
*/
|
|
10
|
+
declare function isSinkInputObject<TSpec, TOptions extends object, TReturns = void>(input: unknown): input is SinkInputObject<TSpec, TOptions, TReturns>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { isSinkInputObject };
|
|
13
|
+
//# sourceMappingURL=helpers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/sink/helpers.ts"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.mjs","names":[],"sources":[],"mappings":""}
|
package/dist/sink/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./create.cjs");exports.createSink=e.createSink,exports.extractSinkMeta=e.extractSinkMeta;
|
package/dist/sink/index.d.cts
CHANGED
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { ResolveOptions } from "@power-plant/schema/resolve";
|
|
4
|
-
|
|
5
|
-
//#region src/sink/constants.d.ts
|
|
6
|
-
declare const VALID_SINK_FILE_EXTENSIONS: string[];
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/sink/extract.d.ts
|
|
9
|
-
/**
|
|
10
|
-
* Normalizes any accepted sink input into a concrete sink descriptor.
|
|
11
|
-
*/
|
|
12
|
-
declare function extractSink<TSpec, TOptions = never>(schema: SchemaOf<TSpec>, input: SinkInput<TSpec, TOptions>, options?: ResolveOptions): Promise<Sink<TSpec, TOptions>>;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { type Sink, type SinkFunction, type SinkInput, type SinkInputWithMeta, type SinkMeta, VALID_SINK_FILE_EXTENSIONS, extractSink };
|
|
15
|
-
//# sourceMappingURL=index.d.cts.map
|
|
1
|
+
import { n as extractSinkMeta, t as createSink } from "../create-DAGPeYVI.cjs";
|
|
2
|
+
export { createSink, extractSinkMeta };
|