@power-plant/core 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/README.md +2 -2
  2. package/dist/config-B6Gr29ZK.d.cts +566 -0
  3. package/dist/config-B6Gr29ZK.d.cts.map +1 -0
  4. package/dist/config-B6Gr29ZK.d.mts +566 -0
  5. package/dist/config-B6Gr29ZK.d.mts.map +1 -0
  6. package/dist/config.cjs +1 -0
  7. package/dist/config.d.cts +34 -0
  8. package/dist/config.d.cts.map +1 -0
  9. package/dist/config.d.mts +34 -0
  10. package/dist/config.d.mts.map +1 -0
  11. package/dist/config.mjs +2 -0
  12. package/dist/config.mjs.map +1 -0
  13. package/dist/context-QCvV8cA9.d.cts +129 -0
  14. package/dist/context-QCvV8cA9.d.cts.map +1 -0
  15. package/dist/context-neyaFruu.d.mts +129 -0
  16. package/dist/context-neyaFruu.d.mts.map +1 -0
  17. package/dist/context.cjs +1 -0
  18. package/dist/context.d.cts +91 -0
  19. package/dist/context.d.cts.map +1 -0
  20. package/dist/context.d.mts +91 -0
  21. package/dist/context.d.mts.map +1 -0
  22. package/dist/context.mjs +2 -0
  23. package/dist/context.mjs.map +1 -0
  24. package/dist/define.cjs +1 -0
  25. package/dist/define.d.cts +82 -0
  26. package/dist/define.d.cts.map +1 -0
  27. package/dist/define.d.mts +82 -0
  28. package/dist/define.d.mts.map +1 -0
  29. package/dist/define.mjs +2 -0
  30. package/dist/define.mjs.map +1 -0
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.d.cts +7 -101
  33. package/dist/index.d.mts +7 -101
  34. package/dist/index.mjs +1 -1
  35. package/dist/type-checks-C3obf_M5.d.cts +53 -0
  36. package/dist/type-checks-C3obf_M5.d.cts.map +1 -0
  37. package/dist/type-checks-Cj1slvLD.d.mts +53 -0
  38. package/dist/type-checks-Cj1slvLD.d.mts.map +1 -0
  39. package/dist/type-checks.cjs +1 -0
  40. package/dist/type-checks.d.cts +2 -0
  41. package/dist/type-checks.d.mts +2 -0
  42. package/dist/type-checks.mjs +2 -0
  43. package/dist/type-checks.mjs.map +1 -0
  44. package/dist/types/__internal.cjs +0 -0
  45. package/dist/types/__internal.d.cts +14 -0
  46. package/dist/types/__internal.d.cts.map +1 -0
  47. package/dist/types/__internal.d.mts +14 -0
  48. package/dist/types/__internal.d.mts.map +1 -0
  49. package/dist/types/__internal.mjs +1 -0
  50. package/package.json +52 -53
  51. package/dist/context-BGSa-2fY.mjs +0 -2
  52. package/dist/context-BGSa-2fY.mjs.map +0 -1
  53. package/dist/context-Bcrz4kGb.cjs +0 -1
  54. package/dist/create-0IEoomGw.cjs +0 -1
  55. package/dist/create-CYRTmdJO.mjs +0 -2
  56. package/dist/create-CYRTmdJO.mjs.map +0 -1
  57. package/dist/create-D_u2Zj81.cjs +0 -1
  58. package/dist/create-DcfhZUHw.mjs +0 -2
  59. package/dist/create-DcfhZUHw.mjs.map +0 -1
  60. package/dist/create-MFKW4s0V.cjs +0 -1
  61. package/dist/create-cqJljXdZ.mjs +0 -2
  62. package/dist/create-cqJljXdZ.mjs.map +0 -1
  63. package/dist/define-B5baoppv.d.cts +0 -14
  64. package/dist/define-B5baoppv.d.cts.map +0 -1
  65. package/dist/define-BNsSORkE.d.cts +0 -13
  66. package/dist/define-BNsSORkE.d.cts.map +0 -1
  67. package/dist/define-B__DotaM.cjs +0 -1
  68. package/dist/define-BpCv3wD0.d.mts +0 -38
  69. package/dist/define-BpCv3wD0.d.mts.map +0 -1
  70. package/dist/define-Bviec8Ry.d.cts +0 -38
  71. package/dist/define-Bviec8Ry.d.cts.map +0 -1
  72. package/dist/define-C5_Sx-Eg.mjs +0 -2
  73. package/dist/define-C5_Sx-Eg.mjs.map +0 -1
  74. package/dist/define-C_GLY1-q.cjs +0 -1
  75. package/dist/define-Cjl-0yK0.d.mts +0 -13
  76. package/dist/define-Cjl-0yK0.d.mts.map +0 -1
  77. package/dist/define-DE0RBdIR.mjs +0 -2
  78. package/dist/define-DE0RBdIR.mjs.map +0 -1
  79. package/dist/define-DQQxZK9L.d.mts +0 -14
  80. package/dist/define-DQQxZK9L.d.mts.map +0 -1
  81. package/dist/define-DVggP_03.cjs +0 -1
  82. package/dist/define-DY1s6sGY.mjs +0 -2
  83. package/dist/define-DY1s6sGY.mjs.map +0 -1
  84. package/dist/define-OeGEPyv1.d.cts +0 -45
  85. package/dist/define-OeGEPyv1.d.cts.map +0 -1
  86. package/dist/define-hhs2D0Hq.d.mts +0 -45
  87. package/dist/define-hhs2D0Hq.d.mts.map +0 -1
  88. package/dist/generator/index.cjs +0 -1
  89. package/dist/generator/index.d.cts +0 -29
  90. package/dist/generator/index.d.cts.map +0 -1
  91. package/dist/generator/index.d.mts +0 -29
  92. package/dist/generator/index.d.mts.map +0 -1
  93. package/dist/generator/index.mjs +0 -2
  94. package/dist/generator/index.mjs.map +0 -1
  95. package/dist/generator-9GSAWmOj.d.mts +0 -126
  96. package/dist/generator-9GSAWmOj.d.mts.map +0 -1
  97. package/dist/generator-D9KikId4.d.cts +0 -126
  98. package/dist/generator-D9KikId4.d.cts.map +0 -1
  99. package/dist/helpers-8tc33xyp.mjs +0 -2
  100. package/dist/helpers-8tc33xyp.mjs.map +0 -1
  101. package/dist/helpers-BWqqSR02.cjs +0 -1
  102. package/dist/helpers-BcTg0l_X.cjs +0 -1
  103. package/dist/helpers-Botqc1jf.cjs +0 -1
  104. package/dist/helpers-Cfl4NsE5.mjs +0 -2
  105. package/dist/helpers-Cfl4NsE5.mjs.map +0 -1
  106. package/dist/helpers-DwNCh4F3.mjs +0 -2
  107. package/dist/helpers-DwNCh4F3.mjs.map +0 -1
  108. package/dist/index.d.cts.map +0 -1
  109. package/dist/index.d.mts.map +0 -1
  110. package/dist/input/index.cjs +0 -1
  111. package/dist/input/index.d.cts +0 -35
  112. package/dist/input/index.d.cts.map +0 -1
  113. package/dist/input/index.d.mts +0 -35
  114. package/dist/input/index.d.mts.map +0 -1
  115. package/dist/input/index.mjs +0 -1
  116. package/dist/input-C3yGEfI-.d.mts +0 -58
  117. package/dist/input-C3yGEfI-.d.mts.map +0 -1
  118. package/dist/input-Osyk3YIo.d.cts +0 -58
  119. package/dist/input-Osyk3YIo.d.cts.map +0 -1
  120. package/dist/output/index.cjs +0 -1
  121. package/dist/output/index.d.cts +0 -35
  122. package/dist/output/index.d.cts.map +0 -1
  123. package/dist/output/index.d.mts +0 -35
  124. package/dist/output/index.d.mts.map +0 -1
  125. package/dist/output/index.mjs +0 -1
  126. package/dist/schema/index.cjs +0 -1
  127. package/dist/schema/index.d.cts +0 -33
  128. package/dist/schema/index.d.cts.map +0 -1
  129. package/dist/schema/index.d.mts +0 -33
  130. package/dist/schema/index.d.mts.map +0 -1
  131. package/dist/schema/index.mjs +0 -1
  132. package/dist/schema-DvnNqFd4.d.cts +0 -180
  133. package/dist/schema-DvnNqFd4.d.cts.map +0 -1
  134. package/dist/schema-DvnNqFd4.d.mts +0 -180
  135. package/dist/schema-DvnNqFd4.d.mts.map +0 -1
@@ -1,126 +0,0 @@
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
@@ -1 +0,0 @@
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,IACj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,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"}
@@ -1,2 +0,0 @@
1
- import{isSetObject as e}from"@stryke/type-checks/is-set-object";function t(t){return e(t)&&`output`in t&&t.output!==void 0}export{t};
2
- //# sourceMappingURL=helpers-8tc33xyp.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers-8tc33xyp.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +0,0 @@
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}});
@@ -1 +0,0 @@
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}});
@@ -1 +0,0 @@
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}});
@@ -1,2 +0,0 @@
1
- import{isSetObject as e}from"@stryke/type-checks/is-set-object";function t(t){return e(t)&&`input`in t&&t.input!==void 0}export{t};
2
- //# sourceMappingURL=helpers-Cfl4NsE5.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers-Cfl4NsE5.mjs","names":[],"sources":[],"mappings":""}
@@ -1,2 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers-DwNCh4F3.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +0,0 @@
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,i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../src/helpers/meta.ts"],"mappings":""}
@@ -1 +0,0 @@
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;
@@ -1,35 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,35 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/input/create.ts","../../src/input/helpers.ts"],"mappings":""}
@@ -1 +0,0 @@
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};
@@ -1,58 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"input-C3yGEfI-.d.mts","names":[],"sources":["../src/types/input.ts"],"mappings":""}
@@ -1,58 +0,0 @@
1
- import { c as Meta, l as MetaConfig, r as SchemaConfigObject, s as SchemaOf } from "./schema-DvnNqFd4.cjs";
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-Osyk3YIo.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"input-Osyk3YIo.d.cts","names":[],"sources":["../src/types/input.ts"],"mappings":";;;;;;KAwBY,aAAA,oCACV,OAAA,EAAS,QAAA,KACN,YAAA,CAAa,KAAA;AAAA,UAED,eAAA,yCAGP,UAAA,CAAW,KAAA,EAAO,QAAA;EAPH;;;EAWvB,KAAA;AAAA;AAAA,UAGe,SAAA,yCAAkD,IAAA,CACjE,KAAA,EACA,QAAA;EAde;;;EAmBf,KAAA;AAAA;AAAA,UAGe,iBAAA;EAtBC;;AAAK;EA0BrB,MAAA,GACI,kBAAA,CAAmB,KAAA,IACnB,gBAAA,CAAiB,KAAA,IACjB,kBAAA,CAAmB,KAAA,EAAO,QAAA;EA3BA;;;EAgC9B,KAAA,EAAO,KAAA,GAAQ,aAAA,CAAc,KAAA,EAAO,QAAA,IAAY,aAAA;EA7BxC;;;EAkCR,IAAA,GAAO,eAAA,CAAgB,KAAA,EAAO,QAAA;AAAA;AAAA,KAGpB,WAAA,mCACR,aAAA,GACA,KAAA,GACA,aAAA,CAAc,KAAA,EAAO,QAAA,IACrB,iBAAA,CAAkB,KAAA,EAAO,QAAA;AAAA,KAEjB,uBAAA,WAAkC,WAAA,cAC5C,CAAA,SAAU,aAAA,GACN,gBAAA,CAAiB,CAAA;AAAA,UAIN,KAAA;EA7Cf;;AAAK;EAiDL,MAAA,EAAQ,QAAA,CAAS,KAAA,EAAO,QAAA;EA9CA;;;EAmDxB,IAAA,GAAO,SAAA,CAAU,KAAA,EAAO,QAAA;EAnDyC;;;;;;;;;EA8DjE,KAAA,EAAO,KAAA,GAAQ,aAAA,CAAc,KAAA,EAAO,QAAA;AAAA"}
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../helpers-BWqqSR02.cjs"),t=require("../define-C_GLY1-q.cjs"),n=require("../create-MFKW4s0V.cjs");exports.createOutput=n.t,exports.defineOutput=t.t,exports.extractOutputMeta=n.n,exports.isOutputConfigObject=e.t;
@@ -1,35 +0,0 @@
1
- import { c as OutputConfig, d as OutputMeta, f as OutputMetaConfig, l as OutputConfigObject, o as InferCreateOutputOptions, s as Output } from "../generator-D9KikId4.cjs";
2
- import { s as SchemaOf } from "../schema-DvnNqFd4.cjs";
3
- import { t as defineOutput } from "../define-OeGEPyv1.cjs";
4
- import { ExtractedSchemaEnvelope } from "@power-plant/schema";
5
-
6
- //#region src/output/create.d.ts
7
- /**
8
- * Extracts and normalizes {@link OutputMeta | output metadata} from a given {@link OutputMetaConfig}. 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 specification is expected to conform to.
11
- * @param config - The output metadata config to extract and normalize.
12
- * @returns The normalized output metadata.
13
- */
14
- declare function extractOutputMeta<TSpec, TOptions extends object>(schema: ExtractedSchemaEnvelope<TSpec> | SchemaOf<TSpec, TOptions>, config?: OutputMetaConfig<TSpec, TOptions>): OutputMeta<TSpec, TOptions>;
15
- /**
16
- * Normalizes any accepted output config into a concrete output descriptor.
17
- *
18
- * @param schema - The schema that the output config is expected to conform to.
19
- * @param config - The output config to normalize.
20
- * @param options - Optional options for resolving the output config.
21
- * @returns A promise that resolves to a normalized output descriptor.
22
- */
23
- declare function createOutput<TSpec, TOptions extends object, TReturns = void>(schema: SchemaOf<TSpec, TOptions>, config: OutputConfig<TSpec, TOptions, TReturns>, options?: InferCreateOutputOptions<typeof config>): Promise<Output<TSpec, TOptions, TReturns>>;
24
- //#endregion
25
- //#region src/output/helpers.d.ts
26
- /**
27
- * Checks if the provided input is a {@link OutputConfigObject}.
28
- *
29
- * @param config - The input to check.
30
- * @returns True if the input is a {@link OutputConfigObject}, false otherwise.
31
- */
32
- declare function isOutputConfigObject<TSpec, TOptions extends object, TReturns = void>(config: unknown): config is OutputConfigObject<TSpec, TOptions, TReturns>;
33
- //#endregion
34
- export { createOutput, defineOutput, extractOutputMeta, isOutputConfigObject };
35
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/output/create.ts","../../src/output/helpers.ts"],"mappings":";;;;;;;;;AA2CA;;;;iBAAgB,iBAAA,iCACd,MAAA,EAAQ,uBAAA,CAAwB,KAAA,IAAS,QAAA,CAAS,KAAA,EAAO,QAAA,GACzD,MAAA,GAAS,gBAAA,CAAiB,KAAA,EAAO,QAAA,IAChC,UAAA,CAAW,KAAA,EAAO,QAAA;;;;;;;;;iBAoCC,YAAA,kDAKpB,MAAA,EAAQ,QAAA,CAAS,KAAA,EAAO,QAAA,GACxB,MAAA,EAAQ,YAAA,CAAa,KAAA,EAAO,QAAA,EAAU,QAAA,GACtC,OAAA,GAAS,wBAAA,QAAgC,MAAA,IACxC,OAAA,CAAQ,MAAA,CAAO,KAAA,EAAO,QAAA,EAAU,QAAA;;;;;;;;AA/CnC;iBChBgB,oBAAA,kDAId,MAAA,YAAkB,MAAA,IAAU,kBAAA,CAAmB,KAAA,EAAO,QAAA,EAAU,QAAA"}
@@ -1,35 +0,0 @@
1
- import { c as OutputConfig, d as OutputMeta, f as OutputMetaConfig, l as OutputConfigObject, o as InferCreateOutputOptions, s as Output } from "../generator-9GSAWmOj.mjs";
2
- import { s as SchemaOf } from "../schema-DvnNqFd4.mjs";
3
- import { t as defineOutput } from "../define-hhs2D0Hq.mjs";
4
- import { ExtractedSchemaEnvelope } from "@power-plant/schema";
5
-
6
- //#region src/output/create.d.ts
7
- /**
8
- * Extracts and normalizes {@link OutputMeta | output metadata} from a given {@link OutputMetaConfig}. 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 specification is expected to conform to.
11
- * @param config - The output metadata config to extract and normalize.
12
- * @returns The normalized output metadata.
13
- */
14
- declare function extractOutputMeta<TSpec, TOptions extends object>(schema: ExtractedSchemaEnvelope<TSpec> | SchemaOf<TSpec, TOptions>, config?: OutputMetaConfig<TSpec, TOptions>): OutputMeta<TSpec, TOptions>;
15
- /**
16
- * Normalizes any accepted output config into a concrete output descriptor.
17
- *
18
- * @param schema - The schema that the output config is expected to conform to.
19
- * @param config - The output config to normalize.
20
- * @param options - Optional options for resolving the output config.
21
- * @returns A promise that resolves to a normalized output descriptor.
22
- */
23
- declare function createOutput<TSpec, TOptions extends object, TReturns = void>(schema: SchemaOf<TSpec, TOptions>, config: OutputConfig<TSpec, TOptions, TReturns>, options?: InferCreateOutputOptions<typeof config>): Promise<Output<TSpec, TOptions, TReturns>>;
24
- //#endregion
25
- //#region src/output/helpers.d.ts
26
- /**
27
- * Checks if the provided input is a {@link OutputConfigObject}.
28
- *
29
- * @param config - The input to check.
30
- * @returns True if the input is a {@link OutputConfigObject}, false otherwise.
31
- */
32
- declare function isOutputConfigObject<TSpec, TOptions extends object, TReturns = void>(config: unknown): config is OutputConfigObject<TSpec, TOptions, TReturns>;
33
- //#endregion
34
- export { createOutput, defineOutput, extractOutputMeta, isOutputConfigObject };
35
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/output/create.ts","../../src/output/helpers.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- import{t as e}from"../helpers-8tc33xyp.mjs";import{t}from"../define-C5_Sx-Eg.mjs";import{n,t as r}from"../create-cqJljXdZ.mjs";export{r as createOutput,t as defineOutput,n as extractOutputMeta,e as isOutputConfigObject};
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../helpers-Botqc1jf.cjs"),t=require("../define-B__DotaM.cjs"),n=require("../create-D_u2Zj81.cjs");exports.createSchema=n.t,exports.defineSchema=t.t,exports.extractSchemaMeta=n.n,exports.isSchemaConfigObject=e.t;
@@ -1,33 +0,0 @@
1
- import { a as SchemaMetaConfig, i as SchemaMeta, r as SchemaConfigObject, s as SchemaOf, t as InferCreateSchemaOptions } from "../schema-DvnNqFd4.cjs";
2
- import { t as defineSchema } from "../define-B5baoppv.cjs";
3
- import { ExtractedSchemaEnvelope, SchemaEnvelopeOf, SchemaSourceConfig } from "@power-plant/schema";
4
-
5
- //#region src/schema/create.d.ts
6
- /**
7
- * Extracts and normalizes {@link SchemaMeta | schema metadata} from a given {@link SchemaMetaConfig}. This function ensures that the metadata is in a consistent format, converting version numbers to strings and filtering out any invalid or empty tags.
8
- *
9
- * @param schema - The schema from which to extract metadata.
10
- * @param input - The schema metadata input to extract and normalize.
11
- * @returns The normalized schema metadata.
12
- */
13
- declare function extractSchemaMeta<TSpec, TOptions extends object>(schema: ExtractedSchemaEnvelope<TSpec>, input?: SchemaMetaConfig<TSpec, TOptions>): SchemaMeta<TSpec, TOptions>;
14
- /**
15
- * Normalizes any accepted schema input into a concrete schema descriptor.
16
- *
17
- * @param input - The schema input to normalize.
18
- * @param options - Optional options for resolving the schema input.
19
- * @returns A promise that resolves to a normalized schema descriptor.
20
- */
21
- declare function createSchema<TSpec, TOptions extends object>(input: SchemaSourceConfig<TSpec> | SchemaEnvelopeOf<TSpec> | SchemaConfigObject<TSpec, TOptions>, options?: InferCreateSchemaOptions<typeof input>): Promise<SchemaOf<TSpec, TOptions>>;
22
- //#endregion
23
- //#region src/schema/helpers.d.ts
24
- /**
25
- * Checks if the provided configuration is a {@link SchemaConfigObject}.
26
- *
27
- * @param config - The configuration to check.
28
- * @returns True if the configuration is a {@link SchemaConfigObject}, false otherwise.
29
- */
30
- declare function isSchemaConfigObject<TSpec, TOptions extends object>(config: unknown): config is SchemaConfigObject<TSpec, TOptions>;
31
- //#endregion
32
- export { createSchema, defineSchema, extractSchemaMeta, isSchemaConfigObject };
33
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/schema/create.ts","../../src/schema/helpers.ts"],"mappings":";;;;;;;;AA8CA;;;;iBAAgB,iBAAA,iCACd,MAAA,EAAQ,uBAAA,CAAwB,KAAA,GAChC,KAAA,GAAQ,gBAAA,CAAiB,KAAA,EAAO,QAAA,IAC/B,UAAA,CAAW,KAAA,EAAO,QAAA;;;;;;;;iBAoCC,YAAA,iCACpB,KAAA,EACI,kBAAA,CAAmB,KAAA,IACnB,gBAAA,CAAiB,KAAA,IACjB,kBAAA,CAAmB,KAAA,EAAO,QAAA,GAC9B,OAAA,GAAS,wBAAA,QAAgC,KAAA,IACxC,OAAA,CAAQ,QAAA,CAAS,KAAA,EAAO,QAAA;;;;;;;AA7C3B;;iBCnBgB,oBAAA,iCACd,MAAA,YACC,MAAA,IAAU,kBAAA,CAAmB,KAAA,EAAO,QAAA"}
@@ -1,33 +0,0 @@
1
- import { a as SchemaMetaConfig, i as SchemaMeta, r as SchemaConfigObject, s as SchemaOf, t as InferCreateSchemaOptions } from "../schema-DvnNqFd4.mjs";
2
- import { t as defineSchema } from "../define-DQQxZK9L.mjs";
3
- import { ExtractedSchemaEnvelope, SchemaEnvelopeOf, SchemaSourceConfig } from "@power-plant/schema";
4
-
5
- //#region src/schema/create.d.ts
6
- /**
7
- * Extracts and normalizes {@link SchemaMeta | schema metadata} from a given {@link SchemaMetaConfig}. This function ensures that the metadata is in a consistent format, converting version numbers to strings and filtering out any invalid or empty tags.
8
- *
9
- * @param schema - The schema from which to extract metadata.
10
- * @param input - The schema metadata input to extract and normalize.
11
- * @returns The normalized schema metadata.
12
- */
13
- declare function extractSchemaMeta<TSpec, TOptions extends object>(schema: ExtractedSchemaEnvelope<TSpec>, input?: SchemaMetaConfig<TSpec, TOptions>): SchemaMeta<TSpec, TOptions>;
14
- /**
15
- * Normalizes any accepted schema input into a concrete schema descriptor.
16
- *
17
- * @param input - The schema input to normalize.
18
- * @param options - Optional options for resolving the schema input.
19
- * @returns A promise that resolves to a normalized schema descriptor.
20
- */
21
- declare function createSchema<TSpec, TOptions extends object>(input: SchemaSourceConfig<TSpec> | SchemaEnvelopeOf<TSpec> | SchemaConfigObject<TSpec, TOptions>, options?: InferCreateSchemaOptions<typeof input>): Promise<SchemaOf<TSpec, TOptions>>;
22
- //#endregion
23
- //#region src/schema/helpers.d.ts
24
- /**
25
- * Checks if the provided configuration is a {@link SchemaConfigObject}.
26
- *
27
- * @param config - The configuration to check.
28
- * @returns True if the configuration is a {@link SchemaConfigObject}, false otherwise.
29
- */
30
- declare function isSchemaConfigObject<TSpec, TOptions extends object>(config: unknown): config is SchemaConfigObject<TSpec, TOptions>;
31
- //#endregion
32
- export { createSchema, defineSchema, extractSchemaMeta, isSchemaConfigObject };
33
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/schema/create.ts","../../src/schema/helpers.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- import{t as e}from"../helpers-DwNCh4F3.mjs";import{t}from"../define-DE0RBdIR.mjs";import{n,t as r}from"../create-DcfhZUHw.mjs";export{r as createSchema,t as defineSchema,n as extractSchemaMeta,e as isSchemaConfigObject};