@power-plant/core 0.0.3 → 0.0.5
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/dist/context-BGSa-2fY.mjs +2 -0
- package/dist/context-BGSa-2fY.mjs.map +1 -0
- package/dist/context-Bcrz4kGb.cjs +1 -0
- package/dist/create-0IEoomGw.cjs +1 -0
- package/dist/create-CYRTmdJO.mjs +2 -0
- package/dist/create-CYRTmdJO.mjs.map +1 -0
- package/dist/create-D_u2Zj81.cjs +1 -0
- package/dist/create-DcfhZUHw.mjs +2 -0
- package/dist/create-DcfhZUHw.mjs.map +1 -0
- package/dist/create-MFKW4s0V.cjs +1 -0
- package/dist/create-cqJljXdZ.mjs +2 -0
- package/dist/create-cqJljXdZ.mjs.map +1 -0
- package/dist/define-B5baoppv.d.cts +14 -0
- package/dist/define-B5baoppv.d.cts.map +1 -0
- package/dist/define-BNsSORkE.d.cts +13 -0
- package/dist/define-BNsSORkE.d.cts.map +1 -0
- package/dist/define-B__DotaM.cjs +1 -0
- package/dist/define-BpCv3wD0.d.mts +38 -0
- package/dist/define-BpCv3wD0.d.mts.map +1 -0
- package/dist/define-Bviec8Ry.d.cts +38 -0
- package/dist/define-Bviec8Ry.d.cts.map +1 -0
- package/dist/define-C5_Sx-Eg.mjs +2 -0
- package/dist/define-C5_Sx-Eg.mjs.map +1 -0
- package/dist/define-C_GLY1-q.cjs +1 -0
- package/dist/define-Cjl-0yK0.d.mts +13 -0
- package/dist/define-Cjl-0yK0.d.mts.map +1 -0
- package/dist/define-DE0RBdIR.mjs +2 -0
- package/dist/define-DE0RBdIR.mjs.map +1 -0
- package/dist/define-DQQxZK9L.d.mts +14 -0
- package/dist/define-DQQxZK9L.d.mts.map +1 -0
- package/dist/define-DVggP_03.cjs +1 -0
- package/dist/define-DY1s6sGY.mjs +2 -0
- package/dist/define-DY1s6sGY.mjs.map +1 -0
- package/dist/define-OeGEPyv1.d.cts +45 -0
- package/dist/define-OeGEPyv1.d.cts.map +1 -0
- package/dist/define-hhs2D0Hq.d.mts +45 -0
- package/dist/define-hhs2D0Hq.d.mts.map +1 -0
- package/dist/generator/index.cjs +1 -1
- package/dist/generator/index.d.cts +29 -2
- package/dist/generator/index.d.cts.map +1 -0
- package/dist/generator/index.d.mts +29 -2
- package/dist/generator/index.d.mts.map +1 -0
- package/dist/generator/index.mjs +2 -1
- package/dist/generator/index.mjs.map +1 -0
- package/dist/generator-9GSAWmOj.d.mts +126 -0
- package/dist/generator-9GSAWmOj.d.mts.map +1 -0
- package/dist/generator-D9KikId4.d.cts +126 -0
- package/dist/generator-D9KikId4.d.cts.map +1 -0
- package/dist/helpers-8tc33xyp.mjs +2 -0
- package/dist/helpers-8tc33xyp.mjs.map +1 -0
- package/dist/helpers-BWqqSR02.cjs +1 -0
- package/dist/helpers-BcTg0l_X.cjs +1 -0
- package/dist/helpers-Botqc1jf.cjs +1 -0
- package/dist/helpers-Cfl4NsE5.mjs +2 -0
- package/dist/helpers-Cfl4NsE5.mjs.map +1 -0
- package/dist/helpers-DwNCh4F3.mjs +2 -0
- package/dist/helpers-DwNCh4F3.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +101 -8
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +101 -8
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1 -1
- package/dist/input/index.cjs +1 -0
- package/dist/input/index.d.cts +35 -0
- package/dist/input/index.d.cts.map +1 -0
- package/dist/input/index.d.mts +35 -0
- package/dist/input/index.d.mts.map +1 -0
- package/dist/input/index.mjs +1 -0
- package/dist/input-C3yGEfI-.d.mts +58 -0
- package/dist/input-C3yGEfI-.d.mts.map +1 -0
- package/dist/input-Osyk3YIo.d.cts +58 -0
- package/dist/input-Osyk3YIo.d.cts.map +1 -0
- package/dist/output/index.cjs +1 -0
- package/dist/output/index.d.cts +35 -0
- package/dist/output/index.d.cts.map +1 -0
- package/dist/output/index.d.mts +35 -0
- package/dist/output/index.d.mts.map +1 -0
- package/dist/output/index.mjs +1 -0
- package/dist/schema/index.cjs +1 -0
- package/dist/schema/index.d.cts +33 -0
- package/dist/schema/index.d.cts.map +1 -0
- package/dist/schema/index.d.mts +33 -0
- package/dist/schema/index.d.mts.map +1 -0
- package/dist/schema/index.mjs +1 -0
- package/dist/schema-DvnNqFd4.d.cts +180 -0
- package/dist/schema-DvnNqFd4.d.cts.map +1 -0
- package/dist/schema-DvnNqFd4.d.mts +180 -0
- package/dist/schema-DvnNqFd4.d.mts.map +1 -0
- package/package.json +35 -135
- package/dist/base-BKbfgxno.d.cts +0 -28
- package/dist/base-BKbfgxno.d.cts.map +0 -1
- package/dist/base-BKbfgxno.d.mts +0 -28
- package/dist/base-BKbfgxno.d.mts.map +0 -1
- package/dist/create-B14Jt6Iu.d.mts +0 -17
- package/dist/create-B14Jt6Iu.d.mts.map +0 -1
- package/dist/create-Cfgth9sz.d.cts +0 -19
- package/dist/create-Cfgth9sz.d.cts.map +0 -1
- package/dist/create-D32Jusq_.d.cts +0 -17
- package/dist/create-D32Jusq_.d.cts.map +0 -1
- package/dist/create-DVpg-3po.d.mts +0 -19
- package/dist/create-DVpg-3po.d.mts.map +0 -1
- package/dist/create-DoyLue8r.d.cts +0 -17
- package/dist/create-DoyLue8r.d.cts.map +0 -1
- package/dist/create-vgEDsShD.d.mts +0 -17
- package/dist/create-vgEDsShD.d.mts.map +0 -1
- package/dist/define-DEe-HPar.d.cts +0 -38
- package/dist/define-DEe-HPar.d.cts.map +0 -1
- package/dist/define-RneysDu1.d.mts +0 -38
- package/dist/define-RneysDu1.d.mts.map +0 -1
- package/dist/generator/create.cjs +0 -1
- package/dist/generator/create.d.cts +0 -2
- package/dist/generator/create.d.mts +0 -2
- package/dist/generator/create.mjs +0 -2
- package/dist/generator/create.mjs.map +0 -1
- package/dist/generator/helpers.cjs +0 -1
- package/dist/generator/helpers.d.cts +0 -6
- package/dist/generator/helpers.d.cts.map +0 -1
- package/dist/generator/helpers.d.mts +0 -6
- package/dist/generator/helpers.d.mts.map +0 -1
- package/dist/generator/helpers.mjs +0 -2
- package/dist/generator/helpers.mjs.map +0 -1
- package/dist/generator-C1_Q-QAb.d.cts +0 -60
- package/dist/generator-C1_Q-QAb.d.cts.map +0 -1
- package/dist/generator-MC25UERM.d.mts +0 -60
- package/dist/generator-MC25UERM.d.mts.map +0 -1
- package/dist/index-BVVgDSdq.d.cts +0 -1
- package/dist/index-BVVgDSdq.d.mts +0 -1
- package/dist/metadata-Cb6iMZqW.cjs +0 -1
- package/dist/metadata-Dmhrb3Kv.mjs +0 -2
- package/dist/metadata-Dmhrb3Kv.mjs.map +0 -1
- package/dist/sink/create.cjs +0 -1
- package/dist/sink/create.d.cts +0 -2
- package/dist/sink/create.d.mts +0 -2
- package/dist/sink/create.mjs +0 -2
- package/dist/sink/create.mjs.map +0 -1
- package/dist/sink/define.cjs +0 -1
- package/dist/sink/define.d.cts +0 -37
- package/dist/sink/define.d.cts.map +0 -1
- package/dist/sink/define.d.mts +0 -37
- package/dist/sink/define.d.mts.map +0 -1
- package/dist/sink/define.mjs +0 -2
- package/dist/sink/define.mjs.map +0 -1
- package/dist/sink/helpers.cjs +0 -1
- package/dist/sink/helpers.d.cts +0 -13
- package/dist/sink/helpers.d.cts.map +0 -1
- package/dist/sink/helpers.d.mts +0 -13
- package/dist/sink/helpers.d.mts.map +0 -1
- package/dist/sink/helpers.mjs +0 -2
- package/dist/sink/helpers.mjs.map +0 -1
- package/dist/sink/index.cjs +0 -1
- package/dist/sink/index.d.cts +0 -2
- package/dist/sink/index.d.mts +0 -2
- package/dist/sink/index.mjs +0 -1
- package/dist/sink-CAWlC7am.d.mts +0 -58
- package/dist/sink-CAWlC7am.d.mts.map +0 -1
- package/dist/sink-CTx7UtqU.d.cts +0 -58
- package/dist/sink-CTx7UtqU.d.cts.map +0 -1
- package/dist/source/create.cjs +0 -1
- package/dist/source/create.d.cts +0 -2
- package/dist/source/create.d.mts +0 -2
- package/dist/source/create.mjs +0 -2
- package/dist/source/create.mjs.map +0 -1
- package/dist/source/define.cjs +0 -1
- package/dist/source/define.d.cts +0 -2
- package/dist/source/define.d.mts +0 -2
- package/dist/source/define.mjs +0 -2
- package/dist/source/define.mjs.map +0 -1
- package/dist/source/helpers.cjs +0 -1
- package/dist/source/helpers.d.cts +0 -13
- package/dist/source/helpers.d.cts.map +0 -1
- package/dist/source/helpers.d.mts +0 -13
- package/dist/source/helpers.d.mts.map +0 -1
- package/dist/source/helpers.mjs +0 -2
- package/dist/source/helpers.mjs.map +0 -1
- package/dist/source/index.cjs +0 -1
- package/dist/source/index.d.cts +0 -3
- package/dist/source/index.d.mts +0 -3
- package/dist/source/index.mjs +0 -1
- package/dist/source-B3tctCZE.d.cts +0 -57
- package/dist/source-B3tctCZE.d.cts.map +0 -1
- package/dist/source-DjKhYXZ6.d.mts +0 -57
- package/dist/source-DjKhYXZ6.d.mts.map +0 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { c as Meta, l as MetaConfig, r as SchemaConfigObject, s as SchemaOf } from "./schema-DvnNqFd4.cjs";
|
|
2
|
+
import { n as Input, r as InputConfig } from "./input-Osyk3YIo.cjs";
|
|
3
|
+
import { SchemaConfig, SchemaEnvelopeOf, SchemaSourceConfig } from "@power-plant/schema";
|
|
4
|
+
import { InferLoadOptions, LoadReference } from "@stryke/resolve/types";
|
|
5
|
+
import { FileSystemInterface } from "@stryke/types/fs";
|
|
6
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
7
|
+
|
|
8
|
+
//#region src/types/config.d.ts
|
|
9
|
+
interface Logger {
|
|
10
|
+
debug: (message: string) => void;
|
|
11
|
+
info: (message: string) => void;
|
|
12
|
+
warn: (message: string) => void;
|
|
13
|
+
error: (message: string) => void;
|
|
14
|
+
}
|
|
15
|
+
interface UserConfig {
|
|
16
|
+
fs?: Partial<FileSystemInterface>;
|
|
17
|
+
logger?: Partial<Logger>;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/types/output.d.ts
|
|
21
|
+
type OutputFunction<TSpec, TOptions extends object, TReturns = void> = (spec: TSpec, context: TOptions) => MaybePromise<TReturns>;
|
|
22
|
+
interface OutputMetaConfig<TSpec, TOptions extends object> extends MetaConfig<TSpec, TOptions> {
|
|
23
|
+
/**
|
|
24
|
+
* A string that describes how the specification will be extracted or generated. This property can provide context about the source of the specification, such as whether it is derived from a file, a database, an API, or any other source. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
25
|
+
*/
|
|
26
|
+
produces?: string;
|
|
27
|
+
}
|
|
28
|
+
interface OutputMeta<TSpec, TOptions extends object> extends Meta<TSpec, TOptions> {
|
|
29
|
+
/**
|
|
30
|
+
* A string that describes how the specification will be extracted or generated. This property can provide context about the source of the specification, such as whether it is derived from a file, a database, an API, or any other source. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
31
|
+
*/
|
|
32
|
+
produces?: string;
|
|
33
|
+
}
|
|
34
|
+
interface OutputConfigObject<TSpec, TOptions extends object, TReturns = void> {
|
|
35
|
+
/**
|
|
36
|
+
* 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.
|
|
37
|
+
*/
|
|
38
|
+
schema?: SchemaSourceConfig<TSpec> | SchemaEnvelopeOf<TSpec> | SchemaConfigObject<TSpec, TOptions>;
|
|
39
|
+
/**
|
|
40
|
+
* Optional metadata that provides contextual information for the output.
|
|
41
|
+
*/
|
|
42
|
+
meta?: OutputMetaConfig<TSpec, TOptions>;
|
|
43
|
+
/**
|
|
44
|
+
* The output implementation, either as a callable function or a file reference.
|
|
45
|
+
*/
|
|
46
|
+
output: OutputFunction<TSpec, TOptions, TReturns> | LoadReference;
|
|
47
|
+
}
|
|
48
|
+
type OutputConfig<TSpec, TOptions extends object, TReturns = void> = LoadReference | OutputFunction<TSpec, TOptions, TReturns> | OutputConfigObject<TSpec, TOptions, TReturns>;
|
|
49
|
+
type InferCreateOutputOptions<T extends OutputConfig<any, any, any>> = T extends LoadReference ? InferLoadOptions<T> : {};
|
|
50
|
+
interface Output<TSpec, TOptions extends object, TReturns = void> {
|
|
51
|
+
/**
|
|
52
|
+
* 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.
|
|
53
|
+
*/
|
|
54
|
+
schema: SchemaOf<TSpec, TOptions>;
|
|
55
|
+
/**
|
|
56
|
+
* Optional metadata that provides contextual information for the output.
|
|
57
|
+
*/
|
|
58
|
+
meta?: OutputMeta<TSpec, TOptions>;
|
|
59
|
+
/**
|
|
60
|
+
* The output of the generator, which can be used to specify where the generator sends its output data. This can be defined as a function that takes the specification and returns a value, or it can be a static value.
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* The `output` property is defined as a function that takes the specification object and any additional parameters, and returns a value or a promise that resolves to a value. This allows for flexibility in how the generator sends its output data, enabling both synchronous and asynchronous data handling based on the specification.
|
|
64
|
+
*
|
|
65
|
+
* @param spec - The specification object that conforms to the defined schema input.
|
|
66
|
+
* @param params - Additional parameters that may be needed for the output function to process the output data.
|
|
67
|
+
* @returns A value or a promise that resolves to a value, which will be used as the output data for the generator.
|
|
68
|
+
*/
|
|
69
|
+
output: OutputFunction<TSpec, TOptions, TReturns>;
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/types/generator.d.ts
|
|
73
|
+
interface GeneratorMeta<TSpec, TOptions extends object> {
|
|
74
|
+
/**
|
|
75
|
+
* A string description (or a function that returns a string) outlining the purpose or behavior of the generator.
|
|
76
|
+
*/
|
|
77
|
+
description?: string | ((spec: TSpec) => string);
|
|
78
|
+
}
|
|
79
|
+
interface GeneratorConfigObject<TSpec, TOptions extends object, TReturns = void> {
|
|
80
|
+
/**
|
|
81
|
+
* Optional metadata about the generator, such as a description of the output it produces.
|
|
82
|
+
*/
|
|
83
|
+
meta?: GeneratorMeta<TSpec, TOptions>;
|
|
84
|
+
/**
|
|
85
|
+
* The schema config that defines the structure of the specification object for this generator.
|
|
86
|
+
*/
|
|
87
|
+
schema: SchemaConfig<TSpec>;
|
|
88
|
+
/**
|
|
89
|
+
* The input config for the generator specification.
|
|
90
|
+
*/
|
|
91
|
+
input: InputConfig<TSpec, TOptions>;
|
|
92
|
+
/**
|
|
93
|
+
* The output config that consumes generated output.
|
|
94
|
+
*/
|
|
95
|
+
output: OutputConfig<TSpec, TOptions, TReturns>;
|
|
96
|
+
}
|
|
97
|
+
type GeneratorConfig<TSpec, TOptions extends object, TReturns = void> = LoadReference | GeneratorConfigObject<TSpec, TOptions, TReturns>;
|
|
98
|
+
type InferCreateGeneratorOptions<T extends GeneratorConfig<any, any, any>> = T extends LoadReference ? InferLoadOptions<T> : {};
|
|
99
|
+
interface Generator<TSpec, TOptions extends object, TReturns = void> {
|
|
100
|
+
/**
|
|
101
|
+
* Optional metadata about the generator, such as a description of the output it produces.
|
|
102
|
+
*/
|
|
103
|
+
meta?: GeneratorMeta<TSpec, TOptions>;
|
|
104
|
+
/**
|
|
105
|
+
* The schema config that defines the structure of the specification object for this generator.
|
|
106
|
+
*/
|
|
107
|
+
schema: SchemaOf<TSpec, TOptions>;
|
|
108
|
+
/**
|
|
109
|
+
* The input of the generator, which can be used to specify where the generator retrieves its input data from. This can be defined as a function that takes the specification and returns a value, or it can be a static value.
|
|
110
|
+
*/
|
|
111
|
+
input: Input<TSpec, TOptions>;
|
|
112
|
+
/**
|
|
113
|
+
* The output of the generator, which can be used to specify where the generator sends its output data. This can be defined as a function that takes the specification and returns a value, or it can be a static value.
|
|
114
|
+
*/
|
|
115
|
+
output: Output<TSpec, TOptions, TReturns>;
|
|
116
|
+
/**
|
|
117
|
+
* The generate function that executes the generator logic, taking in options and producing output based on the input and output definitions.
|
|
118
|
+
*
|
|
119
|
+
* @param options - The options to be passed to the generator, which can be used to influence the generation process.
|
|
120
|
+
* @returns A promise that resolves when the generation process is complete.
|
|
121
|
+
*/
|
|
122
|
+
generate: (options: TOptions & UserConfig) => Promise<TReturns>;
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
export { InferCreateGeneratorOptions as a, OutputConfig as c, OutputMeta as d, OutputMetaConfig as f, GeneratorMeta as i, OutputConfigObject as l, UserConfig as m, GeneratorConfig as n, InferCreateOutputOptions as o, Logger as p, GeneratorConfigObject as r, Output as s, Generator as t, OutputFunction as u };
|
|
126
|
+
//# sourceMappingURL=generator-D9KikId4.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator-D9KikId4.d.cts","names":[],"sources":["../src/types/config.ts","../src/types/output.ts","../src/types/generator.ts"],"mappings":";;;;;;;;UAoBiB,MAAA;EACf,KAAA,GAAQ,OAAA;EACR,IAAA,GAAO,OAAA;EACP,IAAA,GAAO,OAAA;EACP,KAAA,GAAQ,OAAA;AAAA;AAAA,UAGO,UAAA;EACf,EAAA,GAAK,OAAA,CAAQ,mBAAA;EACb,MAAA,GAAS,OAAA,CAAQ,MAAA;AAAA;;;KCLP,cAAA,qDACV,IAAA,EAAM,KAAA,EACN,OAAA,EAAS,QAAA,KACN,YAAA,CAAa,QAAA;AAAA,UAED,gBAAA,yCAGP,UAAA,CAAW,KAAA,EAAO,QAAA;;ADZ5B;;ECgBE,QAAA;AAAA;AAAA,UAGe,UAAA,yCAAmD,IAAA,CAClE,KAAA,EACA,QAAA;EDpBQ;;;ECyBR,QAAA;AAAA;AAAA,UAGe,kBAAA;EDzBP;;AAAe;ECiCvB,MAAA,GACI,kBAAA,CAAmB,KAAA,IACnB,gBAAA,CAAiB,KAAA,IACjB,kBAAA,CAAmB,KAAA,EAAO,QAAA;EDjCL;;;ECsCzB,IAAA,GAAO,gBAAA,CAAiB,KAAA,EAAO,QAAA;EDpCd;;;ECyCjB,MAAA,EAAQ,cAAA,CAAe,KAAA,EAAO,QAAA,EAAU,QAAA,IAAY,aAAA;AAAA;AAAA,KAG1C,YAAA,oDACR,aAAA,GACA,cAAA,CAAe,KAAA,EAAO,QAAA,EAAU,QAAA,IAChC,kBAAA,CAAmB,KAAA,EAAO,QAAA,EAAU,QAAA;AAAA,KAE5B,wBAAA,WAAmC,YAAA,mBAC7C,CAAA,SAAU,aAAA,GACN,gBAAA,CAAiB,CAAA;AAAA,UAIN,MAAA;EDvDN;;;EC2DT,MAAA,EAAQ,QAAA,CAAS,KAAA,EAAO,QAAA;;;;EAKxB,IAAA,GAAO,UAAA,CAAW,KAAA,EAAO,QAAA;EArED;;;;;;;;;;EAiFxB,MAAA,EAAQ,cAAA,CAAe,KAAA,EAAO,QAAA,EAAU,QAAA;AAAA;;;UC/EzB,aAAA;;AFNjB;;EEUE,WAAA,cAAyB,IAAA,EAAM,KAAK;AAAA;AAAA,UAGrB,qBAAA;EFZP;;;EEoBR,IAAA,GAAO,aAAA,CAAc,KAAA,EAAO,QAAA;EFlBrB;;;EEuBP,MAAA,EAAQ,YAAA,CAAa,KAAA;EFtBE;AAGzB;;EEwBE,KAAA,EAAO,WAAA,CAAY,KAAA,EAAO,QAAA;EFvBb;;;EE4Bb,MAAA,EAAQ,YAAA,CAAa,KAAA,EAAO,QAAA,EAAU,QAAA;AAAA;AAAA,KAG5B,eAAA,oDACV,aAAA,GAAgB,qBAAA,CAAsB,KAAA,EAAO,QAAA,EAAU,QAAA;AAAA,KAE7C,2BAAA,WACA,eAAA,mBACR,CAAA,SAAU,aAAA,GACV,gBAAA,CAAiB,CAAA;AAAA,UAIJ,SAAA;EFzCF;;;EE6Cb,IAAA,GAAO,aAAA,CAAc,KAAA,EAAO,QAAA;EF5CL;AAAA;;EEiDvB,MAAA,EAAQ,QAAA,CAAS,KAAA,EAAO,QAAA;;ADtD1B;;EC2DE,KAAA,EAAO,KAAA,CAAM,KAAA,EAAO,QAAA;ED1Dd;;;EC+DN,MAAA,EAAQ,MAAA,CAAO,KAAA,EAAO,QAAA,EAAU,QAAA;ED7DjB;;;;;;ECqEf,QAAA,GAAW,OAAA,EAAS,QAAA,GAAW,UAAA,KAAe,OAAA,CAAQ,QAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers-8tc33xyp.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("@stryke/type-checks/is-set-object");function t(t){return(0,e.isSetObject)(t)&&`output`in t&&t.output!==void 0}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("@stryke/type-checks/is-set-object");function t(t){return(0,e.isSetObject)(t)&&`input`in t&&t.input!==void 0}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("@stryke/type-checks/is-set-object"),t=require("@power-plant/schema"),n=require("@power-plant/schema/codegen"),r=require("@stryke/convert/to-array"),i=require("@stryke/date/format"),a=require("@stryke/date/validate"),o=require("@stryke/helpers/get-unique"),s=require("@stryke/string-format/kebab-case"),c=require("@stryke/string-format/title-case"),l=require("@stryke/type-checks/is-date"),u=require("@stryke/type-checks/is-function"),d=require("@stryke/type-checks/is-number"),f=require("@stryke/type-checks/is-set-string"),p=require("@stryke/unique-id/nanoid");function m(e){return(0,l.isDate)(e)?(0,i.formatYYYYMMDD)(e):(0,d.isNumber)(e)?(0,a.isValidTimestamp)(e)&&e>1e9?(0,i.formatYYYYMMDD)(new Date(e)):e.toString():(0,f.isSetString)(e)?e:`1.0`}function h(e,t,n){let r=n??t?.version??e?.version;return(0,u.isFunction)(r)?async(e,t)=>m(await Promise.resolve(r(e,t))):m(r)}function g(e,t,r){return r??t.name??((0,f.isSetString)(e?.name)?e.name:(0,f.isSetString)(e?.title)?e.title:e.$id?(0,s.kebabCase)(e.$id):(0,n.stringifyType)(e))}function _(e,t){let n=g(e,t),r=h(e,t);return n?(0,u.isFunction)(n)?(0,u.isFunction)(r)?async(e,t)=>`${(0,s.kebabCase)(await Promise.resolve(n(e,t)))}@${await Promise.resolve(r(e,t))}`:async(e,t)=>`${(0,s.kebabCase)(await Promise.resolve(n(e,t)))}@${r}`:(0,u.isFunction)(r)?async(e,t)=>`${(0,s.kebabCase)(n)}@${await Promise.resolve(r(e,t))}`:`${(0,s.kebabCase)(n)}@${r}`:(0,p.nanoid)()}function v(e,t,r){let i=r??t.title??e?.title;if(i!==void 0)return i;let a=t.name;return(0,u.isFunction)(a)?async(e,t)=>(0,c.titleCase)(await Promise.resolve(a(e,t))):(0,c.titleCase)(a??(0,n.stringifyType)(e))}function y(e,t,n,r){n.title??=v(t,n);let i=n.title,a=(0,u.isFunction)(i)?async(t,n)=>(0,u.isFunction)(e)?(await Promise.resolve(e(t,n))).replaceAll(/\{\s*title\s*\}/g,await Promise.resolve(i(t,n))):e.replaceAll(/\{\s*title\s*\}/g,await Promise.resolve(i(t,n))):(0,u.isFunction)(e)?async(t,n)=>(await Promise.resolve(e(t,n))).replaceAll(/\{\s*title\s*\}/g,await Promise.resolve(i)):e.replaceAll(/\{\s*title\s*\}/g,i),o=r??n.description??t?.description;if((0,u.isFunction)(o)){let e=o;return async(t,n)=>{let r=await Promise.resolve(e(t,n));return(0,f.isSetString)(r)?r:(0,u.isFunction)(a)?Promise.resolve(a(t,n)):Promise.resolve(a)}}return(0,f.isSetString)(o)?o:a}function b(t,n,i){let a=t=>t.map((t,n)=>(0,f.isSetString)(t)?{name:`example-${n+1}`,description:`Example Specification #${n+1}`,value:t}:(0,e.isSetObject)(t)&&`value`in t&&(0,f.isSetString)(t.value)?{name:`example-${n+1}`,description:t.description||`Example Specification #${n+1}`,value:t.value}:void 0).filter(Boolean),o=i??n.examples??t?.examples??[];return(0,u.isFunction)(o)?async(e,t)=>a((0,r.toArray)(await Promise.resolve(o(e,t)))):a((0,r.toArray)(o))}function x(e,t,n){return(0,u.isFunction)(n)||(0,u.isFunction)(t.links)?async(i,a)=>(0,o.getUnique)((0,r.toArray)((0,u.isFunction)(n)?await Promise.resolve(n(i,a)):n).concat((0,u.isFunction)(t.links)?await Promise.resolve(t.links(i,a)):t.links??[]).concat(e?.docs??[])):(0,o.getUnique)((0,r.toArray)(n).concat(t.links??[]).concat(e?.docs??[]))}function S(e,n){let r=(0,t.isSchemaOf)(e)?e:e??{schema:{}},i={};return i.name=g(r.schema,i,n?.name),i.version=h(r?.schema,i,n?.version),i.id=_(r?.schema,i),i.title=v(r?.schema,i,n?.title),i.links=x(r?.schema,i,n?.links),n?.deprecated&&(i.deprecated=n?.deprecated),n?.usage&&(i.usage=n?.usage),n?.tags&&(i.tags=n?.tags),i}function C(t){return(0,e.isSetObject)(t)&&`schema`in t&&t.schema!==void 0}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return h}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers-Cfl4NsE5.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{isSetObject as e}from"@stryke/type-checks/is-set-object";import{isSchemaOf as t}from"@power-plant/schema";import{stringifyType as n}from"@power-plant/schema/codegen";import{toArray as r}from"@stryke/convert/to-array";import{formatYYYYMMDD as i}from"@stryke/date/format";import{isValidTimestamp as a}from"@stryke/date/validate";import{getUnique as o}from"@stryke/helpers/get-unique";import{kebabCase as s}from"@stryke/string-format/kebab-case";import{titleCase as c}from"@stryke/string-format/title-case";import{isDate as l}from"@stryke/type-checks/is-date";import{isFunction as u}from"@stryke/type-checks/is-function";import{isNumber as d}from"@stryke/type-checks/is-number";import{isSetString as f}from"@stryke/type-checks/is-set-string";import{nanoid as p}from"@stryke/unique-id/nanoid";function m(e){return l(e)?i(e):d(e)?a(e)&&e>1e9?i(new Date(e)):e.toString():f(e)?e:`1.0`}function h(e,t,n){let r=n??t?.version??e?.version;return u(r)?async(e,t)=>m(await Promise.resolve(r(e,t))):m(r)}function g(e,t,r){return r??t.name??(f(e?.name)?e.name:f(e?.title)?e.title:e.$id?s(e.$id):n(e))}function _(e,t){let n=g(e,t),r=h(e,t);return n?u(n)?u(r)?async(e,t)=>`${s(await Promise.resolve(n(e,t)))}@${await Promise.resolve(r(e,t))}`:async(e,t)=>`${s(await Promise.resolve(n(e,t)))}@${r}`:u(r)?async(e,t)=>`${s(n)}@${await Promise.resolve(r(e,t))}`:`${s(n)}@${r}`:p()}function v(e,t,r){let i=r??t.title??e?.title;if(i!==void 0)return i;let a=t.name;return u(a)?async(e,t)=>c(await Promise.resolve(a(e,t))):c(a??n(e))}function y(e,t,n,r){n.title??=v(t,n);let i=n.title,a=u(i)?async(t,n)=>u(e)?(await Promise.resolve(e(t,n))).replaceAll(/\{\s*title\s*\}/g,await Promise.resolve(i(t,n))):e.replaceAll(/\{\s*title\s*\}/g,await Promise.resolve(i(t,n))):u(e)?async(t,n)=>(await Promise.resolve(e(t,n))).replaceAll(/\{\s*title\s*\}/g,await Promise.resolve(i)):e.replaceAll(/\{\s*title\s*\}/g,i),o=r??n.description??t?.description;if(u(o)){let e=o;return async(t,n)=>{let r=await Promise.resolve(e(t,n));return f(r)?r:u(a)?Promise.resolve(a(t,n)):Promise.resolve(a)}}return f(o)?o:a}function b(t,n,i){let a=t=>t.map((t,n)=>f(t)?{name:`example-${n+1}`,description:`Example Specification #${n+1}`,value:t}:e(t)&&`value`in t&&f(t.value)?{name:`example-${n+1}`,description:t.description||`Example Specification #${n+1}`,value:t.value}:void 0).filter(Boolean),o=i??n.examples??t?.examples??[];return u(o)?async(e,t)=>a(r(await Promise.resolve(o(e,t)))):a(r(o))}function x(e,t,n){return u(n)||u(t.links)?async(i,a)=>o(r(u(n)?await Promise.resolve(n(i,a)):n).concat(u(t.links)?await Promise.resolve(t.links(i,a)):t.links??[]).concat(e?.docs??[])):o(r(n).concat(t.links??[]).concat(e?.docs??[]))}function S(e,n){let r=t(e)?e:e??{schema:{}},i={};return i.name=g(r.schema,i,n?.name),i.version=h(r?.schema,i,n?.version),i.id=_(r?.schema,i),i.title=v(r?.schema,i,n?.title),i.links=x(r?.schema,i,n?.links),n?.deprecated&&(i.deprecated=n?.deprecated),n?.usage&&(i.usage=n?.usage),n?.tags&&(i.tags=n?.tags),i}function C(t){return e(t)&&`schema`in t&&t.schema!==void 0}export{b as a,g as c,y as i,v as l,S as n,_ as o,m as r,x as s,C as t,h as u};
|
|
2
|
+
//# sourceMappingURL=helpers-DwNCh4F3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers-DwNCh4F3.mjs","names":[],"sources":[],"mappings":""}
|
package/dist/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("./context-Bcrz4kGb.cjs"),t=require("./helpers-Botqc1jf.cjs"),n=require("./define-DVggP_03.cjs"),r=require("./define-C_GLY1-q.cjs"),i=require("./define-B__DotaM.cjs");exports.asyncLocalStorage=e.t,exports.callAsyncContext=e.n,exports.callContext=e.r,exports.context=e.i,exports.createContext=e.a,exports.defineGenerator=e.c,exports.defineInput=n.t,exports.defineOutput=r.t,exports.defineSchema=i.t,exports.extractMeta=t.n,exports.formatMetaVersion=t.r,exports.resolveMetaDescription=t.i,exports.resolveMetaExample=t.a,exports.resolveMetaId=t.o,exports.resolveMetaLinks=t.s,exports.resolveMetaName=t.c,exports.resolveMetaTitle=t.l,exports.resolveMetaVersion=t.u,exports.tryUseContext=e.o,exports.useContext=e.s;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,101 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { a as
|
|
3
|
-
import { a as
|
|
4
|
-
import { t as
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
|
|
1
|
+
import { a as InferCreateGeneratorOptions, c as OutputConfig, d as OutputMeta, f as OutputMetaConfig, i as GeneratorMeta, l as OutputConfigObject, m as UserConfig, n as GeneratorConfig, o as InferCreateOutputOptions, r as GeneratorConfigObject, s as Output, t as Generator, u as OutputFunction } from "./generator-D9KikId4.cjs";
|
|
2
|
+
import { a as SchemaMetaConfig, c as Meta, d as MetaLink, f as MetaValue, i as SchemaMeta, l as MetaConfig, n as Schema, o as SchemaMetaExample, r as SchemaConfigObject, s as SchemaOf, t as InferCreateSchemaOptions, u as MetaDeprecated } from "./schema-DvnNqFd4.cjs";
|
|
3
|
+
import { a as InputFunction, i as InputConfigObject, n as Input, o as InputMeta, r as InputConfig, s as InputMetaConfig, t as InferCreateInputOptions } from "./input-Osyk3YIo.cjs";
|
|
4
|
+
import { t as defineGenerator } from "./define-BNsSORkE.cjs";
|
|
5
|
+
import { n as Context, t as defineOutput } from "./define-OeGEPyv1.cjs";
|
|
6
|
+
import { t as defineInput } from "./define-Bviec8Ry.cjs";
|
|
7
|
+
import { t as defineSchema } from "./define-B5baoppv.cjs";
|
|
8
|
+
import { ExtractedSchemaEnvelope, JsonSchema } from "@power-plant/schema";
|
|
9
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10
|
+
|
|
11
|
+
//#region src/helpers/context.d.ts
|
|
12
|
+
declare function createContext(userConfig?: UserConfig): Context;
|
|
13
|
+
interface ContextStore {
|
|
14
|
+
asyncLocalStorage: AsyncLocalStorage<Context>;
|
|
15
|
+
use: () => Context;
|
|
16
|
+
tryUse: () => Context | undefined;
|
|
17
|
+
call: <R>(instance: Context, callback: () => R) => R;
|
|
18
|
+
callAsync: <R>(instance: Context, callback: () => R | Promise<R>) => Promise<R>;
|
|
19
|
+
}
|
|
20
|
+
declare const context: ContextStore;
|
|
21
|
+
declare const asyncLocalStorage: AsyncLocalStorage<Context>;
|
|
22
|
+
declare const useContext: () => Context;
|
|
23
|
+
declare const tryUseContext: () => Context | undefined;
|
|
24
|
+
declare const callContext: <R>(instance: Context, callback: () => R) => R;
|
|
25
|
+
declare const callAsyncContext: <R>(instance: Context, callback: () => R | Promise<R>) => Promise<R>;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/helpers/meta.d.ts
|
|
28
|
+
declare function formatMetaVersion(value: string | number | Date): string;
|
|
29
|
+
/**
|
|
30
|
+
* Extracts the version information from a given input, which can be a string, number, or Date object. The function returns a string representation of the version in the format "YYYYMMDD" for Date inputs, or as a string for valid timestamp numbers. If the input is a string, it is returned as-is. If the input is invalid or not provided, a default version of "1.0" is returned.
|
|
31
|
+
*
|
|
32
|
+
* @param input - The input from which to extract the version. It can be a string, number, undefined, or Date object.
|
|
33
|
+
* @returns A string representing the extracted version information.
|
|
34
|
+
*/
|
|
35
|
+
declare function resolveMetaVersion<TSpec, TOptions extends object>(schema: JsonSchema, meta: Partial<Meta<TSpec, TOptions>>, input?: MetaValue<TSpec, TOptions, string | number | Date>): MetaValue<TSpec, TOptions, string>;
|
|
36
|
+
/**
|
|
37
|
+
* Resolves a metadata name using explicit input, metadata, or schema fallbacks.
|
|
38
|
+
*
|
|
39
|
+
* @param schema - The JSON Schema fragment to read fallback values from.
|
|
40
|
+
* @param meta - Metadata values that may already include a name.
|
|
41
|
+
* @param input - An explicit name value to prioritize when provided.
|
|
42
|
+
* @returns The resolved metadata name.
|
|
43
|
+
*/
|
|
44
|
+
declare function resolveMetaName<TSpec, TOptions extends object>(schema: JsonSchema, meta: Partial<Meta<TSpec, TOptions>>, input?: MetaValue<TSpec, TOptions, string>): MetaValue<TSpec, TOptions, string>;
|
|
45
|
+
/**
|
|
46
|
+
* Resolves a stable metadata identifier in the format `<name>@<version>`.
|
|
47
|
+
*
|
|
48
|
+
* @param schema - The JSON Schema fragment used to infer fallback values.
|
|
49
|
+
* @param meta - Metadata values used to resolve name and version.
|
|
50
|
+
* @returns The resolved metadata identifier, or a generated id when no name is available.
|
|
51
|
+
*/
|
|
52
|
+
declare function resolveMetaId<TSpec, TOptions extends object>(schema: JsonSchema, meta: Partial<Meta<TSpec, TOptions>>): MetaValue<TSpec, TOptions, string>;
|
|
53
|
+
/**
|
|
54
|
+
* Resolves a human-readable display name for metadata.
|
|
55
|
+
*
|
|
56
|
+
* @param schema - The JSON Schema fragment to read fallback display values from.
|
|
57
|
+
* @param meta - Metadata values that may already include a display name.
|
|
58
|
+
* @param input - An explicit display name value to prioritize when provided.
|
|
59
|
+
* @returns The resolved metadata display name.
|
|
60
|
+
*/
|
|
61
|
+
declare function resolveMetaTitle<TSpec, TOptions extends object>(schema: JsonSchema, meta: Partial<Meta<TSpec, TOptions>>, input?: MetaValue<TSpec, TOptions, string>): MetaValue<TSpec, TOptions, string>;
|
|
62
|
+
/**
|
|
63
|
+
* Resolves a metadata description from explicit input, metadata, or schema values.
|
|
64
|
+
*
|
|
65
|
+
* @param template - A template string used to generate a default description when no explicit description is provided.
|
|
66
|
+
* @param schema - The JSON Schema fragment to read fallback description values from.
|
|
67
|
+
* @param meta - Metadata values that may already include a description.
|
|
68
|
+
* @param input - An explicit description value to prioritize when provided.
|
|
69
|
+
* @returns The resolved description, if available.
|
|
70
|
+
*/
|
|
71
|
+
declare function resolveMetaDescription<TSpec, TOptions extends object>(template: MetaValue<TSpec, TOptions, string>, schema: JsonSchema, meta: Partial<Meta<TSpec, TOptions>>, input?: MetaValue<TSpec, TOptions, string>): MetaValue<TSpec, TOptions, string>;
|
|
72
|
+
/**
|
|
73
|
+
* Resolves and normalizes metadata examples into a consistent object format.
|
|
74
|
+
*
|
|
75
|
+
* @typeParam TSpec - The schema specification type associated with example values.
|
|
76
|
+
* @param schema - The JSON Schema fragment to read fallback examples from.
|
|
77
|
+
* @param meta - Metadata values that may already include examples.
|
|
78
|
+
* @param input - Explicit examples to prioritize when provided.
|
|
79
|
+
* @returns A normalized list of examples with generated descriptions when needed.
|
|
80
|
+
*/
|
|
81
|
+
declare function resolveMetaExample<TSpec, TOptions extends object>(schema: JsonSchema, meta: Partial<SchemaMeta<TSpec, TOptions>>, input?: SchemaMetaExample<TSpec> | MetaValue<TSpec, TOptions, SchemaMetaExample<TSpec>[]>): MetaValue<TSpec, TOptions, SchemaMetaExample<TSpec>[]>;
|
|
82
|
+
/**
|
|
83
|
+
* Resolves and de-duplicates metadata links from input, metadata, and schema docs.
|
|
84
|
+
*
|
|
85
|
+
* @param schema - The JSON Schema fragment to read fallback documentation links from.
|
|
86
|
+
* @param meta - Metadata values that may already include links.
|
|
87
|
+
* @param input - Explicit links to prioritize when provided.
|
|
88
|
+
* @returns A unique list of metadata links.
|
|
89
|
+
*/
|
|
90
|
+
declare function resolveMetaLinks<TSpec, TOptions extends object>(schema: JsonSchema, meta: Partial<Meta<TSpec, TOptions>>, input?: MetaValue<TSpec, TOptions, MetaLink[]>): MetaValue<TSpec, TOptions, MetaLink[]>;
|
|
91
|
+
/**
|
|
92
|
+
* Extracts and normalizes metadata for a specification based on the provided schema and optional configuration.
|
|
93
|
+
*
|
|
94
|
+
* @param schema - The schema that the specification is expected to conform to.
|
|
95
|
+
* @param config - Optional metadata configuration to extract and normalize.
|
|
96
|
+
* @returns The normalized specification metadata.
|
|
97
|
+
*/
|
|
98
|
+
declare function extractMeta<TSpec, TOptions extends object>(schema: ExtractedSchemaEnvelope<TSpec> | SchemaOf<TSpec, TOptions>, config?: MetaConfig<TSpec, TOptions>): Meta<TSpec, TOptions>;
|
|
99
|
+
//#endregion
|
|
100
|
+
export { type Context, ContextStore, type Generator, type GeneratorConfig, type GeneratorConfigObject, type GeneratorMeta, type InferCreateGeneratorOptions, type InferCreateInputOptions, type InferCreateOutputOptions, type InferCreateSchemaOptions, type Input, type InputConfig, type InputConfigObject, type InputFunction, type InputMeta, type InputMetaConfig, type Meta, type MetaConfig, type MetaDeprecated, type MetaLink, type MetaValue, type Output, type OutputConfig, type OutputConfigObject, type OutputFunction, type OutputMeta, type OutputMetaConfig, type Schema, type SchemaConfigObject, type SchemaMeta, type SchemaMetaConfig, type SchemaMetaExample, type SchemaOf, asyncLocalStorage, callAsyncContext, callContext, context, createContext, defineGenerator, defineInput, defineOutput, defineSchema, extractMeta, formatMetaVersion, resolveMetaDescription, resolveMetaExample, resolveMetaId, resolveMetaLinks, resolveMetaName, resolveMetaTitle, resolveMetaVersion, tryUseContext, useContext };
|
|
101
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/helpers/context.ts","../src/helpers/meta.ts"],"mappings":";;;;;;;;;;;iBAyBgB,aAAA,CAAc,UAAA,GAAY,UAAA,GAAkB,OAAO;AAAA,UAYlD,YAAA;EACf,iBAAA,EAAmB,iBAAA,CAAkB,OAAA;EACrC,GAAA,QAAW,OAAA;EACX,MAAA,QAAc,OAAA;EACd,IAAA,MAAU,QAAA,EAAU,OAAA,EAAS,QAAA,QAAgB,CAAA,KAAM,CAAA;EACnD,SAAA,MACE,QAAA,EAAU,OAAA,EACV,QAAA,QAAgB,CAAA,GAAI,OAAA,CAAQ,CAAA,MACzB,OAAA,CAAQ,CAAA;AAAA;AAAA,cAMF,OAAA,EAAS,YAuBlB;AAAA,cAES,iBAAA,EAAiB,iBAAA,CAAA,OAAA;AAAA,cAEjB,UAAA,QAvCA,OAuCwB;AAAA,cACxB,aAAA,QAvCG,OAAO;AAAA,cAwCV,WAAA,MAvCH,QAAA,EAAY,OAAA,EAAO,QAAA,QAAkB,CAAA,KAAM,CAAA;AAAA,cAwCxC,gBAAA,MAvCE,QAAA,EACD,OAAA,EAAO,QAAA,QACD,CAAA,GAAI,OAAA,CAAQ,CAAA,MACzB,OAAA,CAAQ,CAAA;;;iBCTC,iBAAA,CAAkB,KAA6B,oBAAJ,IAAI;;;;;;;iBAkB/C,kBAAA,iCACd,MAAA,EAAQ,UAAA,EACR,IAAA,EAAM,OAAA,CAAQ,IAAA,CAAK,KAAA,EAAO,QAAA,IAC1B,KAAA,GAAQ,SAAA,CAAU,KAAA,EAAO,QAAA,oBAA4B,IAAA,IACpD,SAAA,CAAU,KAAA,EAAO,QAAA;ADjCpB;;;;;;;;AAAA,iBCmDgB,eAAA,iCACd,MAAA,EAAQ,UAAA,EACR,IAAA,EAAM,OAAA,CAAQ,IAAA,CAAK,KAAA,EAAO,QAAA,IAC1B,KAAA,GAAQ,SAAA,CAAU,KAAA,EAAO,QAAA,YACxB,SAAA,CAAU,KAAA,EAAO,QAAA;AD3CpB;;;;;;;AAAA,iBCgEgB,aAAA,iCACd,MAAA,EAAQ,UAAA,EACR,IAAA,EAAM,OAAA,CAAQ,IAAA,CAAK,KAAA,EAAO,QAAA,KACzB,SAAA,CAAU,KAAA,EAAO,QAAA;;;;;;;;;iBA0BJ,gBAAA,iCACd,MAAA,EAAQ,UAAA,EACR,IAAA,EAAM,OAAA,CAAQ,IAAA,CAAK,KAAA,EAAO,QAAA,IAC1B,KAAA,GAAQ,SAAA,CAAU,KAAA,EAAO,QAAA,YACxB,SAAA,CAAU,KAAA,EAAO,QAAA;;;;;;;;;;iBAyBJ,sBAAA,iCACd,QAAA,EAAU,SAAA,CAAU,KAAA,EAAO,QAAA,WAC3B,MAAA,EAAQ,UAAA,EACR,IAAA,EAAM,OAAA,CAAQ,IAAA,CAAK,KAAA,EAAO,QAAA,IAC1B,KAAA,GAAQ,SAAA,CAAU,KAAA,EAAO,QAAA,YACxB,SAAA,CAAU,KAAA,EAAO,QAAA;;;;;;;;;;iBAsDJ,kBAAA,iCACd,MAAA,EAAQ,UAAA,EACR,IAAA,EAAM,OAAA,CAAQ,UAAA,CAAW,KAAA,EAAO,QAAA,IAChC,KAAA,GACI,iBAAA,CAAkB,KAAA,IAClB,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,iBAAA,CAAkB,KAAA,OAChD,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,iBAAA,CAAkB,KAAA;;;;;;;ADnLhC;AAMhB;iBCuNgB,gBAAA,iCACd,MAAA,EAAQ,UAAA,EACR,IAAA,EAAM,OAAA,CAAQ,IAAA,CAAK,KAAA,EAAO,QAAA,IAC1B,KAAA,GAAQ,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,QAAA,MAClC,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,QAAA;;;ADpM1B;AAEJ;;;;iBCgOgB,WAAA,iCACd,MAAA,EAAQ,uBAAA,CAAwB,KAAA,IAAS,QAAA,CAAS,KAAA,EAAO,QAAA,GACzD,MAAA,GAAS,UAAA,CAAW,KAAA,EAAO,QAAA,IAC1B,IAAA,CAAK,KAAA,EAAO,QAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,101 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { a as
|
|
3
|
-
import { a as
|
|
4
|
-
import { t as
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
|
|
1
|
+
import { a as InferCreateGeneratorOptions, c as OutputConfig, d as OutputMeta, f as OutputMetaConfig, i as GeneratorMeta, l as OutputConfigObject, m as UserConfig, n as GeneratorConfig, o as InferCreateOutputOptions, r as GeneratorConfigObject, s as Output, t as Generator, u as OutputFunction } from "./generator-9GSAWmOj.mjs";
|
|
2
|
+
import { a as SchemaMetaConfig, c as Meta, d as MetaLink, f as MetaValue, i as SchemaMeta, l as MetaConfig, n as Schema, o as SchemaMetaExample, r as SchemaConfigObject, s as SchemaOf, t as InferCreateSchemaOptions, u as MetaDeprecated } from "./schema-DvnNqFd4.mjs";
|
|
3
|
+
import { a as InputFunction, i as InputConfigObject, n as Input, o as InputMeta, r as InputConfig, s as InputMetaConfig, t as InferCreateInputOptions } from "./input-C3yGEfI-.mjs";
|
|
4
|
+
import { t as defineGenerator } from "./define-Cjl-0yK0.mjs";
|
|
5
|
+
import { n as Context, t as defineOutput } from "./define-hhs2D0Hq.mjs";
|
|
6
|
+
import { t as defineInput } from "./define-BpCv3wD0.mjs";
|
|
7
|
+
import { t as defineSchema } from "./define-DQQxZK9L.mjs";
|
|
8
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
9
|
+
import { ExtractedSchemaEnvelope, JsonSchema } from "@power-plant/schema";
|
|
10
|
+
|
|
11
|
+
//#region src/helpers/context.d.ts
|
|
12
|
+
declare function createContext(userConfig?: UserConfig): Context;
|
|
13
|
+
interface ContextStore {
|
|
14
|
+
asyncLocalStorage: AsyncLocalStorage<Context>;
|
|
15
|
+
use: () => Context;
|
|
16
|
+
tryUse: () => Context | undefined;
|
|
17
|
+
call: <R>(instance: Context, callback: () => R) => R;
|
|
18
|
+
callAsync: <R>(instance: Context, callback: () => R | Promise<R>) => Promise<R>;
|
|
19
|
+
}
|
|
20
|
+
declare const context: ContextStore;
|
|
21
|
+
declare const asyncLocalStorage: AsyncLocalStorage<Context>;
|
|
22
|
+
declare const useContext: () => Context;
|
|
23
|
+
declare const tryUseContext: () => Context | undefined;
|
|
24
|
+
declare const callContext: <R>(instance: Context, callback: () => R) => R;
|
|
25
|
+
declare const callAsyncContext: <R>(instance: Context, callback: () => R | Promise<R>) => Promise<R>;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/helpers/meta.d.ts
|
|
28
|
+
declare function formatMetaVersion(value: string | number | Date): string;
|
|
29
|
+
/**
|
|
30
|
+
* Extracts the version information from a given input, which can be a string, number, or Date object. The function returns a string representation of the version in the format "YYYYMMDD" for Date inputs, or as a string for valid timestamp numbers. If the input is a string, it is returned as-is. If the input is invalid or not provided, a default version of "1.0" is returned.
|
|
31
|
+
*
|
|
32
|
+
* @param input - The input from which to extract the version. It can be a string, number, undefined, or Date object.
|
|
33
|
+
* @returns A string representing the extracted version information.
|
|
34
|
+
*/
|
|
35
|
+
declare function resolveMetaVersion<TSpec, TOptions extends object>(schema: JsonSchema, meta: Partial<Meta<TSpec, TOptions>>, input?: MetaValue<TSpec, TOptions, string | number | Date>): MetaValue<TSpec, TOptions, string>;
|
|
36
|
+
/**
|
|
37
|
+
* Resolves a metadata name using explicit input, metadata, or schema fallbacks.
|
|
38
|
+
*
|
|
39
|
+
* @param schema - The JSON Schema fragment to read fallback values from.
|
|
40
|
+
* @param meta - Metadata values that may already include a name.
|
|
41
|
+
* @param input - An explicit name value to prioritize when provided.
|
|
42
|
+
* @returns The resolved metadata name.
|
|
43
|
+
*/
|
|
44
|
+
declare function resolveMetaName<TSpec, TOptions extends object>(schema: JsonSchema, meta: Partial<Meta<TSpec, TOptions>>, input?: MetaValue<TSpec, TOptions, string>): MetaValue<TSpec, TOptions, string>;
|
|
45
|
+
/**
|
|
46
|
+
* Resolves a stable metadata identifier in the format `<name>@<version>`.
|
|
47
|
+
*
|
|
48
|
+
* @param schema - The JSON Schema fragment used to infer fallback values.
|
|
49
|
+
* @param meta - Metadata values used to resolve name and version.
|
|
50
|
+
* @returns The resolved metadata identifier, or a generated id when no name is available.
|
|
51
|
+
*/
|
|
52
|
+
declare function resolveMetaId<TSpec, TOptions extends object>(schema: JsonSchema, meta: Partial<Meta<TSpec, TOptions>>): MetaValue<TSpec, TOptions, string>;
|
|
53
|
+
/**
|
|
54
|
+
* Resolves a human-readable display name for metadata.
|
|
55
|
+
*
|
|
56
|
+
* @param schema - The JSON Schema fragment to read fallback display values from.
|
|
57
|
+
* @param meta - Metadata values that may already include a display name.
|
|
58
|
+
* @param input - An explicit display name value to prioritize when provided.
|
|
59
|
+
* @returns The resolved metadata display name.
|
|
60
|
+
*/
|
|
61
|
+
declare function resolveMetaTitle<TSpec, TOptions extends object>(schema: JsonSchema, meta: Partial<Meta<TSpec, TOptions>>, input?: MetaValue<TSpec, TOptions, string>): MetaValue<TSpec, TOptions, string>;
|
|
62
|
+
/**
|
|
63
|
+
* Resolves a metadata description from explicit input, metadata, or schema values.
|
|
64
|
+
*
|
|
65
|
+
* @param template - A template string used to generate a default description when no explicit description is provided.
|
|
66
|
+
* @param schema - The JSON Schema fragment to read fallback description values from.
|
|
67
|
+
* @param meta - Metadata values that may already include a description.
|
|
68
|
+
* @param input - An explicit description value to prioritize when provided.
|
|
69
|
+
* @returns The resolved description, if available.
|
|
70
|
+
*/
|
|
71
|
+
declare function resolveMetaDescription<TSpec, TOptions extends object>(template: MetaValue<TSpec, TOptions, string>, schema: JsonSchema, meta: Partial<Meta<TSpec, TOptions>>, input?: MetaValue<TSpec, TOptions, string>): MetaValue<TSpec, TOptions, string>;
|
|
72
|
+
/**
|
|
73
|
+
* Resolves and normalizes metadata examples into a consistent object format.
|
|
74
|
+
*
|
|
75
|
+
* @typeParam TSpec - The schema specification type associated with example values.
|
|
76
|
+
* @param schema - The JSON Schema fragment to read fallback examples from.
|
|
77
|
+
* @param meta - Metadata values that may already include examples.
|
|
78
|
+
* @param input - Explicit examples to prioritize when provided.
|
|
79
|
+
* @returns A normalized list of examples with generated descriptions when needed.
|
|
80
|
+
*/
|
|
81
|
+
declare function resolveMetaExample<TSpec, TOptions extends object>(schema: JsonSchema, meta: Partial<SchemaMeta<TSpec, TOptions>>, input?: SchemaMetaExample<TSpec> | MetaValue<TSpec, TOptions, SchemaMetaExample<TSpec>[]>): MetaValue<TSpec, TOptions, SchemaMetaExample<TSpec>[]>;
|
|
82
|
+
/**
|
|
83
|
+
* Resolves and de-duplicates metadata links from input, metadata, and schema docs.
|
|
84
|
+
*
|
|
85
|
+
* @param schema - The JSON Schema fragment to read fallback documentation links from.
|
|
86
|
+
* @param meta - Metadata values that may already include links.
|
|
87
|
+
* @param input - Explicit links to prioritize when provided.
|
|
88
|
+
* @returns A unique list of metadata links.
|
|
89
|
+
*/
|
|
90
|
+
declare function resolveMetaLinks<TSpec, TOptions extends object>(schema: JsonSchema, meta: Partial<Meta<TSpec, TOptions>>, input?: MetaValue<TSpec, TOptions, MetaLink[]>): MetaValue<TSpec, TOptions, MetaLink[]>;
|
|
91
|
+
/**
|
|
92
|
+
* Extracts and normalizes metadata for a specification based on the provided schema and optional configuration.
|
|
93
|
+
*
|
|
94
|
+
* @param schema - The schema that the specification is expected to conform to.
|
|
95
|
+
* @param config - Optional metadata configuration to extract and normalize.
|
|
96
|
+
* @returns The normalized specification metadata.
|
|
97
|
+
*/
|
|
98
|
+
declare function extractMeta<TSpec, TOptions extends object>(schema: ExtractedSchemaEnvelope<TSpec> | SchemaOf<TSpec, TOptions>, config?: MetaConfig<TSpec, TOptions>): Meta<TSpec, TOptions>;
|
|
99
|
+
//#endregion
|
|
100
|
+
export { type Context, ContextStore, type Generator, type GeneratorConfig, type GeneratorConfigObject, type GeneratorMeta, type InferCreateGeneratorOptions, type InferCreateInputOptions, type InferCreateOutputOptions, type InferCreateSchemaOptions, type Input, type InputConfig, type InputConfigObject, type InputFunction, type InputMeta, type InputMetaConfig, type Meta, type MetaConfig, type MetaDeprecated, type MetaLink, type MetaValue, type Output, type OutputConfig, type OutputConfigObject, type OutputFunction, type OutputMeta, type OutputMetaConfig, type Schema, type SchemaConfigObject, type SchemaMeta, type SchemaMetaConfig, type SchemaMetaExample, type SchemaOf, asyncLocalStorage, callAsyncContext, callContext, context, createContext, defineGenerator, defineInput, defineOutput, defineSchema, extractMeta, formatMetaVersion, resolveMetaDescription, resolveMetaExample, resolveMetaId, resolveMetaLinks, resolveMetaName, resolveMetaTitle, resolveMetaVersion, tryUseContext, useContext };
|
|
101
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/helpers/context.ts","../src/helpers/meta.ts"],"mappings":""}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./context-BGSa-2fY.mjs";import{a as c,c as l,i as u,l as d,n as f,o as p,r as m,s as h,u as g}from"./helpers-DwNCh4F3.mjs";import{t as _}from"./define-DY1s6sGY.mjs";import{t as v}from"./define-C5_Sx-Eg.mjs";import{t as y}from"./define-DE0RBdIR.mjs";export{s as asyncLocalStorage,r as callAsyncContext,a as callContext,n as context,e as createContext,t as defineGenerator,_ as defineInput,v as defineOutput,y as defineSchema,f as extractMeta,m as formatMetaVersion,u as resolveMetaDescription,c as resolveMetaExample,p as resolveMetaId,h as resolveMetaLinks,l as resolveMetaName,d as resolveMetaTitle,g as resolveMetaVersion,i as tryUseContext,o as useContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../helpers-BcTg0l_X.cjs"),t=require("../define-DVggP_03.cjs"),n=require("../create-0IEoomGw.cjs");exports.createInput=n.t,exports.defineInput=t.t,exports.extractInputMeta=n.n,exports.isInputConfigObject=e.t;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { s as SchemaOf } from "../schema-DvnNqFd4.cjs";
|
|
2
|
+
import { i as InputConfigObject, n as Input, o as InputMeta, r as InputConfig, s as InputMetaConfig, t as InferCreateInputOptions } from "../input-Osyk3YIo.cjs";
|
|
3
|
+
import { t as defineInput } from "../define-Bviec8Ry.cjs";
|
|
4
|
+
import { ExtractedSchemaEnvelope } from "@power-plant/schema";
|
|
5
|
+
|
|
6
|
+
//#region src/input/create.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Extracts and normalizes {@link InputMeta | input metadata} from a given {@link InputMetaConfig}. This function ensures that the metadata is in a consistent format, converting version numbers to strings and filtering out any invalid or empty tags.
|
|
9
|
+
*
|
|
10
|
+
* @param schema - The schema that the input input is expected to conform to.
|
|
11
|
+
* @param input - The input metadata input to extract and normalize.
|
|
12
|
+
* @returns The normalized input metadata.
|
|
13
|
+
*/
|
|
14
|
+
declare function extractInputMeta<TSpec, TOptions extends object>(schema: ExtractedSchemaEnvelope<TSpec> | SchemaOf<TSpec, TOptions>, input?: InputMetaConfig<TSpec, TOptions>): InputMeta<TSpec, TOptions>;
|
|
15
|
+
/**
|
|
16
|
+
* Normalizes any accepted input configuration into a concrete input descriptor.
|
|
17
|
+
*
|
|
18
|
+
* @param schema - The schema that the specification is expected to conform to.
|
|
19
|
+
* @param config - The input configuration to normalize.
|
|
20
|
+
* @param options - Optional options for resolving the input configuration.
|
|
21
|
+
* @returns A promise that resolves to a normalized input descriptor.
|
|
22
|
+
*/
|
|
23
|
+
declare function createInput<TSpec, TOptions extends object>(schema: SchemaOf<TSpec, TOptions>, config: InputConfig<TSpec, TOptions>, options?: InferCreateInputOptions<typeof config>): Promise<Input<TSpec, TOptions>>;
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/input/helpers.d.ts
|
|
26
|
+
/**
|
|
27
|
+
* Checks if the provided input is a {@link InputConfigObject}.
|
|
28
|
+
*
|
|
29
|
+
* @param input - The input to check.
|
|
30
|
+
* @returns True if the input is a {@link InputConfigObject}, false otherwise.
|
|
31
|
+
*/
|
|
32
|
+
declare function isInputConfigObject<TSpec, TOptions extends object>(input: unknown): input is InputConfigObject<TSpec, TOptions>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { createInput, defineInput, extractInputMeta, isInputConfigObject };
|
|
35
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/input/create.ts","../../src/input/helpers.ts"],"mappings":";;;;;;;;;AA4CA;;;;iBAAgB,gBAAA,iCACd,MAAA,EAAQ,uBAAA,CAAwB,KAAA,IAAS,QAAA,CAAS,KAAA,EAAO,QAAA,GACzD,KAAA,GAAQ,eAAA,CAAgB,KAAA,EAAO,QAAA,IAC9B,SAAA,CAAU,KAAA,EAAO,QAAA;;;;;;;;;iBAoCE,WAAA,iCACpB,MAAA,EAAQ,QAAA,CAAS,KAAA,EAAO,QAAA,GACxB,MAAA,EAAQ,WAAA,CAAY,KAAA,EAAO,QAAA,GAC3B,OAAA,GAAS,uBAAA,QAA+B,MAAA,IACvC,OAAA,CAAQ,KAAA,CAAM,KAAA,EAAO,QAAA;;;;;;;;AA3CxB;iBCjBgB,mBAAA,iCACd,KAAA,YACC,KAAA,IAAS,iBAAA,CAAkB,KAAA,EAAO,QAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { s as SchemaOf } from "../schema-DvnNqFd4.mjs";
|
|
2
|
+
import { i as InputConfigObject, n as Input, o as InputMeta, r as InputConfig, s as InputMetaConfig, t as InferCreateInputOptions } from "../input-C3yGEfI-.mjs";
|
|
3
|
+
import { t as defineInput } from "../define-BpCv3wD0.mjs";
|
|
4
|
+
import { ExtractedSchemaEnvelope } from "@power-plant/schema";
|
|
5
|
+
|
|
6
|
+
//#region src/input/create.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Extracts and normalizes {@link InputMeta | input metadata} from a given {@link InputMetaConfig}. This function ensures that the metadata is in a consistent format, converting version numbers to strings and filtering out any invalid or empty tags.
|
|
9
|
+
*
|
|
10
|
+
* @param schema - The schema that the input input is expected to conform to.
|
|
11
|
+
* @param input - The input metadata input to extract and normalize.
|
|
12
|
+
* @returns The normalized input metadata.
|
|
13
|
+
*/
|
|
14
|
+
declare function extractInputMeta<TSpec, TOptions extends object>(schema: ExtractedSchemaEnvelope<TSpec> | SchemaOf<TSpec, TOptions>, input?: InputMetaConfig<TSpec, TOptions>): InputMeta<TSpec, TOptions>;
|
|
15
|
+
/**
|
|
16
|
+
* Normalizes any accepted input configuration into a concrete input descriptor.
|
|
17
|
+
*
|
|
18
|
+
* @param schema - The schema that the specification is expected to conform to.
|
|
19
|
+
* @param config - The input configuration to normalize.
|
|
20
|
+
* @param options - Optional options for resolving the input configuration.
|
|
21
|
+
* @returns A promise that resolves to a normalized input descriptor.
|
|
22
|
+
*/
|
|
23
|
+
declare function createInput<TSpec, TOptions extends object>(schema: SchemaOf<TSpec, TOptions>, config: InputConfig<TSpec, TOptions>, options?: InferCreateInputOptions<typeof config>): Promise<Input<TSpec, TOptions>>;
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/input/helpers.d.ts
|
|
26
|
+
/**
|
|
27
|
+
* Checks if the provided input is a {@link InputConfigObject}.
|
|
28
|
+
*
|
|
29
|
+
* @param input - The input to check.
|
|
30
|
+
* @returns True if the input is a {@link InputConfigObject}, false otherwise.
|
|
31
|
+
*/
|
|
32
|
+
declare function isInputConfigObject<TSpec, TOptions extends object>(input: unknown): input is InputConfigObject<TSpec, TOptions>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { createInput, defineInput, extractInputMeta, isInputConfigObject };
|
|
35
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/input/create.ts","../../src/input/helpers.ts"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"../helpers-Cfl4NsE5.mjs";import{t}from"../define-DY1s6sGY.mjs";import{n,t as r}from"../create-CYRTmdJO.mjs";export{r as createInput,t as defineInput,n as extractInputMeta,e as isInputConfigObject};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { c as Meta, l as MetaConfig, r as SchemaConfigObject, s as SchemaOf } from "./schema-DvnNqFd4.mjs";
|
|
2
|
+
import { SchemaEnvelopeOf, SchemaSourceConfig } from "@power-plant/schema";
|
|
3
|
+
import { InferLoadOptions, LoadReference } from "@stryke/resolve/types";
|
|
4
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
5
|
+
|
|
6
|
+
//#region src/types/input.d.ts
|
|
7
|
+
type InputFunction<TSpec, TOptions extends object> = (options: TOptions) => MaybePromise<TSpec>;
|
|
8
|
+
interface InputMetaConfig<TSpec, TOptions extends object> extends MetaConfig<TSpec, TOptions> {
|
|
9
|
+
/**
|
|
10
|
+
* A string that describes how the specification will be extracted/generated. This property can provide context about the input of the specification, such as whether it is derived from a file, a database, an API, or any other input. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
11
|
+
*/
|
|
12
|
+
input?: string;
|
|
13
|
+
}
|
|
14
|
+
interface InputMeta<TSpec, TOptions extends object> extends Meta<TSpec, TOptions> {
|
|
15
|
+
/**
|
|
16
|
+
* A string that describes how the specification will be extracted/generated. This property can provide context about the input of the specification, such as whether it is derived from a file, a database, an API, or any other input. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
17
|
+
*/
|
|
18
|
+
input?: string;
|
|
19
|
+
}
|
|
20
|
+
interface InputConfigObject<TSpec, TOptions extends object> {
|
|
21
|
+
/**
|
|
22
|
+
* 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.
|
|
23
|
+
*/
|
|
24
|
+
schema?: SchemaSourceConfig<TSpec> | SchemaEnvelopeOf<TSpec> | SchemaConfigObject<TSpec, TOptions>;
|
|
25
|
+
/**
|
|
26
|
+
* The input implementation, either as a callable function, a static value, or a file reference.
|
|
27
|
+
*/
|
|
28
|
+
input: TSpec | InputFunction<TSpec, TOptions> | LoadReference;
|
|
29
|
+
/**
|
|
30
|
+
* Optional metadata that provides contextual information for the input.
|
|
31
|
+
*/
|
|
32
|
+
meta?: InputMetaConfig<TSpec, TOptions>;
|
|
33
|
+
}
|
|
34
|
+
type InputConfig<TSpec, TOptions extends object> = LoadReference | TSpec | InputFunction<TSpec, TOptions> | InputConfigObject<TSpec, TOptions>;
|
|
35
|
+
type InferCreateInputOptions<T extends InputConfig<any, any>> = T extends LoadReference ? InferLoadOptions<T> : {};
|
|
36
|
+
interface Input<TSpec, TOptions extends object> {
|
|
37
|
+
/**
|
|
38
|
+
* 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.
|
|
39
|
+
*/
|
|
40
|
+
schema: SchemaOf<TSpec, TOptions>;
|
|
41
|
+
/**
|
|
42
|
+
* Optional metadata that provides contextual information for the input.
|
|
43
|
+
*/
|
|
44
|
+
meta?: InputMeta<TSpec, TOptions>;
|
|
45
|
+
/**
|
|
46
|
+
* The input of the generator, which can be used to specify where the generator retrieves its input data from. This can be defined as a function that takes the specification and returns a value, or it can be a static value.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* The `input` property can be either a static value of type `TSpec` or a function that takes the specification object and returns a value of type `TSpec` or a promise that resolves to `TSpec`. This allows for flexibility in how the generator retrieves its input data, enabling both synchronous and asynchronous data retrieval based on the specification.
|
|
50
|
+
*
|
|
51
|
+
* @param options - The options object that can be used to influence the generation process.
|
|
52
|
+
* @returns A value or a promise that resolves to a value, which will be used as the input data for the generator.
|
|
53
|
+
*/
|
|
54
|
+
input: TSpec | InputFunction<TSpec, TOptions>;
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { InputFunction as a, InputConfigObject as i, Input as n, InputMeta as o, InputConfig as r, InputMetaConfig as s, InferCreateInputOptions as t };
|
|
58
|
+
//# sourceMappingURL=input-C3yGEfI-.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-C3yGEfI-.d.mts","names":[],"sources":["../src/types/input.ts"],"mappings":""}
|