@power-plant/core 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/README.md +220 -0
  2. package/dist/create-23iLtMb_.cjs +1 -0
  3. package/dist/create-BR4IeVl4.mjs +2 -0
  4. package/dist/create-BR4IeVl4.mjs.map +1 -0
  5. package/dist/create-BqRl9d7m.d.cts +19 -0
  6. package/dist/create-BqRl9d7m.d.cts.map +1 -0
  7. package/dist/create-C-rR8nuY.d.mts +23 -0
  8. package/dist/create-C-rR8nuY.d.mts.map +1 -0
  9. package/dist/create-Cz9qVT4m.d.cts +23 -0
  10. package/dist/create-Cz9qVT4m.d.cts.map +1 -0
  11. package/dist/create-DAGPeYVI.d.cts +25 -0
  12. package/dist/create-DAGPeYVI.d.cts.map +1 -0
  13. package/dist/create-DEe398aQ.d.mts +25 -0
  14. package/dist/create-DEe398aQ.d.mts.map +1 -0
  15. package/dist/create-DUt-efk7.d.cts +25 -0
  16. package/dist/create-DUt-efk7.d.cts.map +1 -0
  17. package/dist/create-DcCu_zM3.d.mts +19 -0
  18. package/dist/create-DcCu_zM3.d.mts.map +1 -0
  19. package/dist/create-Qxy2mq7r.d.mts +25 -0
  20. package/dist/create-Qxy2mq7r.d.mts.map +1 -0
  21. package/dist/define-BPfeEA9Z.d.cts +14 -0
  22. package/dist/define-BPfeEA9Z.d.cts.map +1 -0
  23. package/dist/define-CQZ042K5.d.mts +14 -0
  24. package/dist/define-CQZ042K5.d.mts.map +1 -0
  25. package/dist/define-Dw8JgVQ1.d.mts +38 -0
  26. package/dist/define-Dw8JgVQ1.d.mts.map +1 -0
  27. package/dist/define-aWeW6VVo.d.cts +38 -0
  28. package/dist/define-aWeW6VVo.d.cts.map +1 -0
  29. package/dist/generator/create.cjs +1 -0
  30. package/dist/generator/create.d.cts +2 -0
  31. package/dist/generator/create.d.mts +2 -0
  32. package/dist/generator/create.mjs +2 -0
  33. package/dist/generator/create.mjs.map +1 -0
  34. package/dist/generator/helpers.cjs +1 -0
  35. package/dist/generator/helpers.d.cts +6 -0
  36. package/dist/generator/helpers.d.cts.map +1 -0
  37. package/dist/generator/helpers.d.mts +6 -0
  38. package/dist/generator/helpers.d.mts.map +1 -0
  39. package/dist/generator/helpers.mjs +2 -0
  40. package/dist/generator/helpers.mjs.map +1 -0
  41. package/dist/generator/index.cjs +1 -1
  42. package/dist/generator/index.d.cts +2 -20
  43. package/dist/generator/index.d.mts +2 -20
  44. package/dist/generator/index.mjs +1 -2
  45. package/dist/{generator-C5O_C4RV.d.cts → generator-BGkKE8HQ.d.mts} +18 -14
  46. package/dist/generator-BGkKE8HQ.d.mts.map +1 -0
  47. package/dist/{generator-DZI01B4_.d.mts → generator-Dq0PL5w6.d.cts} +18 -14
  48. package/dist/generator-Dq0PL5w6.d.cts.map +1 -0
  49. package/dist/helpers-BqnQPaP5.d.cts +13 -0
  50. package/dist/helpers-BqnQPaP5.d.cts.map +1 -0
  51. package/dist/helpers-CgXgqnVu.d.mts +13 -0
  52. package/dist/helpers-CgXgqnVu.d.mts.map +1 -0
  53. package/dist/index-BVVgDSdq.d.cts +1 -0
  54. package/dist/index-BVVgDSdq.d.mts +1 -0
  55. package/dist/index.cjs +1 -1
  56. package/dist/index.d.cts +12 -8
  57. package/dist/index.d.mts +12 -8
  58. package/dist/index.mjs +1 -1
  59. package/dist/schema/create.cjs +1 -0
  60. package/dist/schema/create.d.cts +2 -0
  61. package/dist/schema/create.d.mts +2 -0
  62. package/dist/schema/create.mjs +1 -0
  63. package/dist/schema/define.cjs +1 -0
  64. package/dist/schema/define.d.cts +2 -0
  65. package/dist/schema/define.d.mts +2 -0
  66. package/dist/schema/define.mjs +2 -0
  67. package/dist/schema/define.mjs.map +1 -0
  68. package/dist/schema/helpers.cjs +1 -0
  69. package/dist/schema/helpers.d.cts +2 -0
  70. package/dist/schema/helpers.d.mts +2 -0
  71. package/dist/schema/helpers.mjs +2 -0
  72. package/dist/schema/helpers.mjs.map +1 -0
  73. package/dist/schema/index.cjs +1 -0
  74. package/dist/schema/index.d.cts +4 -0
  75. package/dist/schema/index.d.mts +4 -0
  76. package/dist/schema/index.mjs +1 -0
  77. package/dist/schema-xFkmOyE6.d.cts +205 -0
  78. package/dist/schema-xFkmOyE6.d.cts.map +1 -0
  79. package/dist/schema-xFkmOyE6.d.mts +205 -0
  80. package/dist/schema-xFkmOyE6.d.mts.map +1 -0
  81. package/dist/sink/create.cjs +1 -0
  82. package/dist/sink/create.d.cts +2 -0
  83. package/dist/sink/create.d.mts +2 -0
  84. package/dist/sink/create.mjs +2 -0
  85. package/dist/sink/create.mjs.map +1 -0
  86. package/dist/sink/define.cjs +1 -0
  87. package/dist/sink/define.d.cts +37 -0
  88. package/dist/sink/define.d.cts.map +1 -0
  89. package/dist/sink/define.d.mts +37 -0
  90. package/dist/sink/define.d.mts.map +1 -0
  91. package/dist/sink/define.mjs +2 -0
  92. package/dist/sink/define.mjs.map +1 -0
  93. package/dist/sink/helpers.cjs +1 -0
  94. package/dist/sink/helpers.d.cts +13 -0
  95. package/dist/sink/helpers.d.cts.map +1 -0
  96. package/dist/sink/helpers.d.mts +13 -0
  97. package/dist/sink/helpers.d.mts.map +1 -0
  98. package/dist/sink/helpers.mjs +2 -0
  99. package/dist/sink/helpers.mjs.map +1 -0
  100. package/dist/sink/index.cjs +1 -1
  101. package/dist/sink/index.d.cts +2 -15
  102. package/dist/sink/index.d.mts +2 -15
  103. package/dist/sink/index.mjs +1 -1
  104. package/dist/sink-CHQncb8H.d.mts +58 -0
  105. package/dist/sink-CHQncb8H.d.mts.map +1 -0
  106. package/dist/sink-DHpx94GM.d.cts +58 -0
  107. package/dist/sink-DHpx94GM.d.cts.map +1 -0
  108. package/dist/source/create.cjs +1 -0
  109. package/dist/source/create.d.cts +2 -0
  110. package/dist/source/create.d.mts +2 -0
  111. package/dist/source/create.mjs +2 -0
  112. package/dist/source/create.mjs.map +1 -0
  113. package/dist/source/define.cjs +1 -0
  114. package/dist/source/define.d.cts +2 -0
  115. package/dist/source/define.d.mts +2 -0
  116. package/dist/source/define.mjs +2 -0
  117. package/dist/source/define.mjs.map +1 -0
  118. package/dist/source/helpers.cjs +1 -0
  119. package/dist/source/helpers.d.cts +13 -0
  120. package/dist/source/helpers.d.cts.map +1 -0
  121. package/dist/source/helpers.d.mts +13 -0
  122. package/dist/source/helpers.d.mts.map +1 -0
  123. package/dist/source/helpers.mjs +2 -0
  124. package/dist/source/helpers.mjs.map +1 -0
  125. package/dist/source/index.cjs +1 -1
  126. package/dist/source/index.d.cts +3 -16
  127. package/dist/source/index.d.mts +3 -16
  128. package/dist/source/index.mjs +1 -1
  129. package/dist/source-BiOs3_-8.d.mts +57 -0
  130. package/dist/source-BiOs3_-8.d.mts.map +1 -0
  131. package/dist/source-txi0ZuzR.d.cts +57 -0
  132. package/dist/source-txi0ZuzR.d.cts.map +1 -0
  133. package/package.json +187 -27
  134. package/dist/config.cjs +0 -0
  135. package/dist/config.d.cts +0 -10
  136. package/dist/config.d.cts.map +0 -1
  137. package/dist/config.d.mts +0 -10
  138. package/dist/config.d.mts.map +0 -1
  139. package/dist/config.mjs +0 -2
  140. package/dist/config.mjs.map +0 -1
  141. package/dist/extract-BzZLelb2.mjs +0 -2
  142. package/dist/extract-BzZLelb2.mjs.map +0 -1
  143. package/dist/extract-DUwG1ZUO.cjs +0 -1
  144. package/dist/extract-FkKA9g1K.cjs +0 -1
  145. package/dist/extract-ZIpZAKsq.mjs +0 -2
  146. package/dist/extract-ZIpZAKsq.mjs.map +0 -1
  147. package/dist/generator/index.d.cts.map +0 -1
  148. package/dist/generator/index.d.mts.map +0 -1
  149. package/dist/generator/index.mjs.map +0 -1
  150. package/dist/generator-C5O_C4RV.d.cts.map +0 -1
  151. package/dist/generator-DZI01B4_.d.mts.map +0 -1
  152. package/dist/sink/index.d.cts.map +0 -1
  153. package/dist/sink/index.d.mts.map +0 -1
  154. package/dist/source/index.d.cts.map +0 -1
  155. package/dist/source/index.d.mts.map +0 -1
  156. package/dist/types-B2MtSxCp.d.cts +0 -47
  157. package/dist/types-B2MtSxCp.d.cts.map +0 -1
  158. package/dist/types-B2MtSxCp.d.mts +0 -47
  159. package/dist/types-B2MtSxCp.d.mts.map +0 -1
  160. package/dist/types-DJo-IRmS.d.cts +0 -47
  161. package/dist/types-DJo-IRmS.d.cts.map +0 -1
  162. package/dist/types-DJo-IRmS.d.mts +0 -47
  163. package/dist/types-DJo-IRmS.d.mts.map +0 -1
@@ -0,0 +1,2 @@
1
+ import{t as e}from"../create-BR4IeVl4.mjs";import{createSink as t}from"../sink/create.mjs";import{createSource as n}from"../source/create.mjs";import{isGeneratorInputObject as r}from"./helpers.mjs";import{load as i}from"@stryke/resolve/load";import{isFunction as a}from"@stryke/type-checks/is-function";async function o(o,s={}){let c;c=r(o)?o:await i(o,s);let l=await e(c.schema,s),[u,d]=await Promise.all([n(l,c.source,s),t(l,c.sink,s)]);return{meta:c.meta,schema:l,source:u,sink:d,generate:async e=>{let t=a(u.source)?await u.source(e):u.source,n=typeof c.meta?.description==`function`?c.meta.description(t):c.meta?.description;return n&&console.log(`Generating ${n}...`),d.sink(t,e)}}}export{o as createGenerator};
2
+ //# sourceMappingURL=create.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@stryke/type-checks/is-set-object");function t(t){return(0,e.isSetObject)(t)&&`schema`in t&&`source`in t&&`sink`in t}exports.isGeneratorInputObject=t;
@@ -0,0 +1,6 @@
1
+ import { r as GeneratorInputObject } from "../generator-Dq0PL5w6.cjs";
2
+ //#region src/generator/helpers.d.ts
3
+ declare function isGeneratorInputObject<TSpec, TOptions extends object, TReturns = void>(input: unknown): input is GeneratorInputObject<TSpec, TOptions, TReturns>;
4
+ //#endregion
5
+ export { isGeneratorInputObject };
6
+ //# sourceMappingURL=helpers.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.cts","names":[],"sources":["../../src/generator/helpers.ts"],"mappings":";;iBAqBgB,sBAAA,kDAId,KAAA,YAAiB,KAAA,IAAS,oBAAA,CAAqB,KAAA,EAAO,QAAA,EAAU,QAAA"}
@@ -0,0 +1,6 @@
1
+ import { r as GeneratorInputObject } from "../generator-BGkKE8HQ.mjs";
2
+ //#region src/generator/helpers.d.ts
3
+ declare function isGeneratorInputObject<TSpec, TOptions extends object, TReturns = void>(input: unknown): input is GeneratorInputObject<TSpec, TOptions, TReturns>;
4
+ //#endregion
5
+ export { isGeneratorInputObject };
6
+ //# sourceMappingURL=helpers.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/generator/helpers.ts"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{isSetObject as e}from"@stryke/type-checks/is-set-object";function t(t){return e(t)&&`schema`in t&&`source`in t&&`sink`in t}export{t as isGeneratorInputObject};
2
+ //# sourceMappingURL=helpers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../extract-DUwG1ZUO.cjs"),t=require("../extract-FkKA9g1K.cjs");let n=require("@power-plant/schema/extract"),r=require("@stryke/type-checks/is-function");async function i(i,a){let o=await(0,n.extract)(i.schema,a),[s,c]=await Promise.all([t.t(o,i.source,a),e.t(o,i.sink,a)]);return{meta:i.meta,schema:o,source:s,sink:c,generate:async e=>{let t=(0,r.isFunction)(s.source)?await s.source(e):s.source,n=typeof i.meta?.description==`function`?i.meta.description(t):i.meta?.description;n&&console.log(`Generating ${n}...`),await c.sink(t,e)}}}exports.createGenerator=i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./create.cjs");exports.createGenerator=e.createGenerator;
@@ -1,20 +1,2 @@
1
- import { n as GeneratorInput, t as Generator } from "../generator-C5O_C4RV.cjs";
2
- import { ExtractOptions } from "@power-plant/schema/extract";
3
-
4
- //#region src/generator/generator.d.ts
5
- /**
6
- * Creates a generator from raw schema/source/sink inputs and resolves all descriptors.
7
- *
8
- * @remarks
9
- * This function is used to create a generator from raw schema, source, and sink inputs. It resolves all descriptors and returns a fully constructed generator that can be used to generate output based on the provided schema and options.
10
- *
11
- * @template TSpec - The type of the specification that the generator will produce.
12
- * @template TOptions - The type of the options that will be passed to the generator during generation.
13
- * @param input - The generator input containing schema, source, sink, and optional meta information.
14
- * @param options - Optional extraction options for schema, source, and sink.
15
- * @returns A promise that resolves to a fully constructed generator.
16
- */
17
- declare function createGenerator<TSpec, TOptions = any>(input: GeneratorInput<TSpec, TOptions>, options?: ExtractOptions): Promise<Generator<TSpec, TOptions>>;
18
- //#endregion
19
- export { createGenerator };
20
- //# sourceMappingURL=index.d.cts.map
1
+ import { t as createGenerator } from "../create-BqRl9d7m.cjs";
2
+ export { createGenerator };
@@ -1,20 +1,2 @@
1
- import { n as GeneratorInput, t as Generator } from "../generator-DZI01B4_.mjs";
2
- import { ExtractOptions } from "@power-plant/schema/extract";
3
-
4
- //#region src/generator/generator.d.ts
5
- /**
6
- * Creates a generator from raw schema/source/sink inputs and resolves all descriptors.
7
- *
8
- * @remarks
9
- * This function is used to create a generator from raw schema, source, and sink inputs. It resolves all descriptors and returns a fully constructed generator that can be used to generate output based on the provided schema and options.
10
- *
11
- * @template TSpec - The type of the specification that the generator will produce.
12
- * @template TOptions - The type of the options that will be passed to the generator during generation.
13
- * @param input - The generator input containing schema, source, sink, and optional meta information.
14
- * @param options - Optional extraction options for schema, source, and sink.
15
- * @returns A promise that resolves to a fully constructed generator.
16
- */
17
- declare function createGenerator<TSpec, TOptions = any>(input: GeneratorInput<TSpec, TOptions>, options?: ExtractOptions): Promise<Generator<TSpec, TOptions>>;
18
- //#endregion
19
- export { createGenerator };
20
- //# sourceMappingURL=index.d.mts.map
1
+ import { t as createGenerator } from "../create-DcCu_zM3.mjs";
2
+ export { createGenerator };
@@ -1,2 +1 @@
1
- import{t as e}from"../extract-ZIpZAKsq.mjs";import{t}from"../extract-BzZLelb2.mjs";import{extract as n}from"@power-plant/schema/extract";import{isFunction as r}from"@stryke/type-checks/is-function";async function i(i,a){let o=await n(i.schema,a),[s,c]=await Promise.all([t(o,i.source,a),e(o,i.sink,a)]);return{meta:i.meta,schema:o,source:s,sink:c,generate:async e=>{let t=r(s.source)?await s.source(e):s.source,n=typeof i.meta?.description==`function`?i.meta.description(t):i.meta?.description;n&&console.log(`Generating ${n}...`),await c.sink(t,e)}}}export{i as createGenerator};
2
- //# sourceMappingURL=index.mjs.map
1
+ import{createGenerator as e}from"./create.mjs";export{e as createGenerator};
@@ -1,19 +1,21 @@
1
- import { r as SinkInput, t as Sink } from "./types-B2MtSxCp.cjs";
2
- import { r as SourceInput, t as Source } from "./types-DJo-IRmS.cjs";
3
- import { SchemaInput, SchemaOf } from "@power-plant/schema";
1
+ import { s as SchemaOf } from "./schema-xFkmOyE6.mjs";
2
+ import { i as SinkInput, n as Sink } from "./sink-CHQncb8H.mjs";
3
+ import { i as SourceInput, n as Source } from "./source-BiOs3_-8.mjs";
4
+ import { SchemaInput } from "@power-plant/schema";
5
+ import { InferLoadOptions, LoadInput } from "@stryke/resolve/types";
4
6
 
5
7
  //#region src/types/generator.d.ts
6
- interface GeneratorMeta<TSpec> {
8
+ interface GeneratorMeta<TSpec, TOptions extends object> {
7
9
  /**
8
10
  * A string description (or a function that returns a string) outlining the purpose or behavior of the generator.
9
11
  */
10
12
  description?: string | ((spec: TSpec) => string);
11
13
  }
12
- interface GeneratorInput<TSpec, TOptions = never> {
14
+ interface GeneratorInputObject<TSpec, TOptions extends object, TReturns = void> {
13
15
  /**
14
16
  * Optional metadata about the generator, such as a description of the output it produces.
15
17
  */
16
- meta?: GeneratorMeta<TSpec>;
18
+ meta?: GeneratorMeta<TSpec, TOptions>;
17
19
  /**
18
20
  * The schema input that defines the structure of the specification object for this generator.
19
21
  */
@@ -25,17 +27,19 @@ interface GeneratorInput<TSpec, TOptions = never> {
25
27
  /**
26
28
  * The sink input that consumes generated output.
27
29
  */
28
- sink: SinkInput<TSpec, TOptions>;
30
+ sink: SinkInput<TSpec, TOptions, TReturns>;
29
31
  }
30
- interface Generator<TSpec, TOptions = never> {
32
+ type GeneratorInput<TSpec, TOptions extends object, TReturns = void> = LoadInput | GeneratorInputObject<TSpec, TOptions, TReturns>;
33
+ type InferCreateGeneratorOptions<T extends GeneratorInput<any, any, any>> = T extends LoadInput ? InferLoadOptions<T> : {};
34
+ interface Generator<TSpec, TOptions extends object, TReturns = void> {
31
35
  /**
32
36
  * Optional metadata about the generator, such as a description of the output it produces.
33
37
  */
34
- meta?: GeneratorMeta<TSpec>;
38
+ meta?: GeneratorMeta<TSpec, TOptions>;
35
39
  /**
36
40
  * The schema input that defines the structure of the specification object for this generator.
37
41
  */
38
- schema: SchemaOf<TSpec>;
42
+ schema: SchemaOf<TSpec, TOptions>;
39
43
  /**
40
44
  * The source 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.
41
45
  */
@@ -43,15 +47,15 @@ interface Generator<TSpec, TOptions = never> {
43
47
  /**
44
48
  * The sink 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.
45
49
  */
46
- sink: Sink<TSpec, TOptions>;
50
+ sink: Sink<TSpec, TOptions, TReturns>;
47
51
  /**
48
52
  * The generate function that executes the generator logic, taking in options and producing output based on the source and sink definitions.
49
53
  *
50
54
  * @param options - The options to be passed to the generator, which can be used to influence the generation process.
51
55
  * @returns A promise that resolves when the generation process is complete.
52
56
  */
53
- generate: (options: TOptions) => Promise<void>;
57
+ generate: (options: TOptions) => Promise<TReturns>;
54
58
  }
55
59
  //#endregion
56
- export { GeneratorInput as n, GeneratorMeta as r, Generator as t };
57
- //# sourceMappingURL=generator-C5O_C4RV.d.cts.map
60
+ export { InferCreateGeneratorOptions as a, GeneratorMeta as i, GeneratorInput as n, GeneratorInputObject as r, Generator as t };
61
+ //# sourceMappingURL=generator-BGkKE8HQ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator-BGkKE8HQ.d.mts","names":[],"sources":["../src/types/generator.ts"],"mappings":""}
@@ -1,19 +1,21 @@
1
- import { r as SinkInput, t as Sink } from "./types-B2MtSxCp.mjs";
2
- import { r as SourceInput, t as Source } from "./types-DJo-IRmS.mjs";
3
- import { SchemaInput, SchemaOf } from "@power-plant/schema";
1
+ import { s as SchemaOf } from "./schema-xFkmOyE6.cjs";
2
+ import { i as SinkInput, n as Sink } from "./sink-DHpx94GM.cjs";
3
+ import { i as SourceInput, n as Source } from "./source-txi0ZuzR.cjs";
4
+ import { SchemaInput } from "@power-plant/schema";
5
+ import { InferLoadOptions, LoadInput } from "@stryke/resolve/types";
4
6
 
5
7
  //#region src/types/generator.d.ts
6
- interface GeneratorMeta<TSpec> {
8
+ interface GeneratorMeta<TSpec, TOptions extends object> {
7
9
  /**
8
10
  * A string description (or a function that returns a string) outlining the purpose or behavior of the generator.
9
11
  */
10
12
  description?: string | ((spec: TSpec) => string);
11
13
  }
12
- interface GeneratorInput<TSpec, TOptions = never> {
14
+ interface GeneratorInputObject<TSpec, TOptions extends object, TReturns = void> {
13
15
  /**
14
16
  * Optional metadata about the generator, such as a description of the output it produces.
15
17
  */
16
- meta?: GeneratorMeta<TSpec>;
18
+ meta?: GeneratorMeta<TSpec, TOptions>;
17
19
  /**
18
20
  * The schema input that defines the structure of the specification object for this generator.
19
21
  */
@@ -25,17 +27,19 @@ interface GeneratorInput<TSpec, TOptions = never> {
25
27
  /**
26
28
  * The sink input that consumes generated output.
27
29
  */
28
- sink: SinkInput<TSpec, TOptions>;
30
+ sink: SinkInput<TSpec, TOptions, TReturns>;
29
31
  }
30
- interface Generator<TSpec, TOptions = never> {
32
+ type GeneratorInput<TSpec, TOptions extends object, TReturns = void> = LoadInput | GeneratorInputObject<TSpec, TOptions, TReturns>;
33
+ type InferCreateGeneratorOptions<T extends GeneratorInput<any, any, any>> = T extends LoadInput ? InferLoadOptions<T> : {};
34
+ interface Generator<TSpec, TOptions extends object, TReturns = void> {
31
35
  /**
32
36
  * Optional metadata about the generator, such as a description of the output it produces.
33
37
  */
34
- meta?: GeneratorMeta<TSpec>;
38
+ meta?: GeneratorMeta<TSpec, TOptions>;
35
39
  /**
36
40
  * The schema input that defines the structure of the specification object for this generator.
37
41
  */
38
- schema: SchemaOf<TSpec>;
42
+ schema: SchemaOf<TSpec, TOptions>;
39
43
  /**
40
44
  * The source 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.
41
45
  */
@@ -43,15 +47,15 @@ interface Generator<TSpec, TOptions = never> {
43
47
  /**
44
48
  * The sink 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.
45
49
  */
46
- sink: Sink<TSpec, TOptions>;
50
+ sink: Sink<TSpec, TOptions, TReturns>;
47
51
  /**
48
52
  * The generate function that executes the generator logic, taking in options and producing output based on the source and sink definitions.
49
53
  *
50
54
  * @param options - The options to be passed to the generator, which can be used to influence the generation process.
51
55
  * @returns A promise that resolves when the generation process is complete.
52
56
  */
53
- generate: (options: TOptions) => Promise<void>;
57
+ generate: (options: TOptions) => Promise<TReturns>;
54
58
  }
55
59
  //#endregion
56
- export { GeneratorInput as n, GeneratorMeta as r, Generator as t };
57
- //# sourceMappingURL=generator-DZI01B4_.d.mts.map
60
+ export { InferCreateGeneratorOptions as a, GeneratorMeta as i, GeneratorInput as n, GeneratorInputObject as r, Generator as t };
61
+ //# sourceMappingURL=generator-Dq0PL5w6.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator-Dq0PL5w6.d.cts","names":[],"sources":["../src/types/generator.ts"],"mappings":";;;;;;;UAyBiB,aAAA;;AAAjB;;EAIE,WAAA,cAAyB,IAAA,EAAM,KAAK;AAAA;AAAA,UAGrB,oBAAA;EAPqB;;;EAepC,IAAA,GAAO,aAAA,CAAc,KAAA,EAAO,QAAA;EAXQ;AAAA;AAGtC;EAaE,MAAA,EAAQ,WAAA,CAAY,KAAA;EAbe;;;EAkBnC,MAAA,EAAQ,WAAA,CAAY,KAAA,EAAO,QAAA;EALP;;;EAUpB,IAAA,EAAM,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,QAAA;AAAA;AAAA,KAGvB,cAAA,oDACR,SAAA,GACA,oBAAA,CAAqB,KAAA,EAAO,QAAA,EAAU,QAAA;AAAA,KAE9B,2BAAA,WACA,cAAA,mBACR,CAAA,SAAU,SAAA,GACV,gBAAA,CAAiB,CAAA;AAAA,UAIJ,SAAA;EAdT;;;EAkBN,IAAA,GAAO,aAAA,CAAc,KAAA,EAAO,QAAA;EAvC5B;;;EA4CA,MAAA,EAAQ,QAAA,CAAS,KAAA,EAAO,QAAA;EAtCH;;;EA2CrB,MAAA,EAAQ,MAAA,CAAO,KAAA,EAAO,QAAA;EAtCF;;;EA2CpB,IAAA,EAAM,IAAA,CAAK,KAAA,EAAO,QAAA,EAAU,QAAA;EAtCD;;;;;;EA8C3B,QAAA,GAAW,OAAA,EAAS,QAAA,KAAa,OAAA,CAAQ,QAAA;AAAA"}
@@ -0,0 +1,13 @@
1
+ import { r as SchemaInputObject } from "./schema-xFkmOyE6.cjs";
2
+
3
+ //#region src/schema/helpers.d.ts
4
+ /**
5
+ * Checks if the provided input is a {@link SchemaInputObject}.
6
+ *
7
+ * @param input - The input to check.
8
+ * @returns True if the input is a {@link SchemaInputObject}, false otherwise.
9
+ */
10
+ declare function isSchemaInputObject<TSpec, TOptions extends object>(input: unknown): input is SchemaInputObject<TSpec, TOptions>;
11
+ //#endregion
12
+ export { isSchemaInputObject as t };
13
+ //# sourceMappingURL=helpers-BqnQPaP5.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers-BqnQPaP5.d.cts","names":[],"sources":["../src/schema/helpers.ts"],"mappings":";;;;;AA2BA;;;;iBAAgB,mBAAA,iCACd,KAAA,YACC,KAAA,IAAS,iBAAA,CAAkB,KAAA,EAAO,QAAA"}
@@ -0,0 +1,13 @@
1
+ import { r as SchemaInputObject } from "./schema-xFkmOyE6.mjs";
2
+
3
+ //#region src/schema/helpers.d.ts
4
+ /**
5
+ * Checks if the provided input is a {@link SchemaInputObject}.
6
+ *
7
+ * @param input - The input to check.
8
+ * @returns True if the input is a {@link SchemaInputObject}, false otherwise.
9
+ */
10
+ declare function isSchemaInputObject<TSpec, TOptions extends object>(input: unknown): input is SchemaInputObject<TSpec, TOptions>;
11
+ //#endregion
12
+ export { isSchemaInputObject as t };
13
+ //# sourceMappingURL=helpers-CgXgqnVu.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers-CgXgqnVu.d.mts","names":[],"sources":["../src/schema/helpers.ts"],"mappings":""}
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("./config.cjs");const e=require("./extract-DUwG1ZUO.cjs"),t=require("./extract-FkKA9g1K.cjs"),n=require("./generator/index.cjs");require("./sink/index.cjs"),require("./source/index.cjs"),exports.VALID_SINK_FILE_EXTENSIONS=e.n,exports.VALID_SOURCE_FILE_EXTENSIONS=t.n,exports.createGenerator=n.createGenerator,exports.extractSink=e.t,exports.extractSource=t.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./create-23iLtMb_.cjs"),t=require("./schema/helpers.cjs"),n=require("./sink/create.cjs"),r=require("./source/create.cjs"),i=require("./generator/create.cjs");require("./generator/index.cjs");const a=require("./schema/define.cjs");require("./schema/index.cjs"),require("./sink/index.cjs");const o=require("./source/define.cjs");require("./source/index.cjs"),exports.createGenerator=i.createGenerator,exports.createSchema=e.t,exports.createSink=n.createSink,exports.createSource=r.createSource,exports.defineSchema=a.defineSchema,exports.defineSource=o.defineSource,exports.extractSchemaMeta=e.n,exports.extractSinkMeta=n.extractSinkMeta,exports.extractSourceMeta=r.extractSourceMeta,exports.isSchemaInputObject=t.isSchemaInputObject;
package/dist/index.d.cts CHANGED
@@ -1,8 +1,12 @@
1
- import { a as SinkMeta, i as SinkInputWithMeta, n as SinkFunction, r as SinkInput, t as Sink } from "./types-B2MtSxCp.cjs";
2
- import { a as SourceMeta, i as SourceInputWithMeta, n as SourceFunction, o as SourceValue, r as SourceInput, t as Source } from "./types-DJo-IRmS.cjs";
3
- import { n as GeneratorInput, r as GeneratorMeta, t as Generator } from "./generator-C5O_C4RV.cjs";
4
- import { UserConfig } from "./config.cjs";
5
- import { createGenerator } from "./generator/index.cjs";
6
- import { VALID_SINK_FILE_EXTENSIONS, extractSink } from "./sink/index.cjs";
7
- import { SourceResolvedInput, VALID_SOURCE_FILE_EXTENSIONS, extractSource } from "./source/index.cjs";
8
- export { type Generator, type GeneratorInput, type GeneratorMeta, type Sink, type SinkFunction, type SinkInput, type SinkInputWithMeta, type SinkMeta, type Source, type SourceFunction, type SourceInput, type SourceInputWithMeta, type SourceMeta, SourceResolvedInput, type SourceValue, type UserConfig, VALID_SINK_FILE_EXTENSIONS, VALID_SOURCE_FILE_EXTENSIONS, createGenerator, extractSink, extractSource };
1
+ import { a as SchemaMetaExample, c as Meta, d as MetaLink, f as MetaValue, i as SchemaMeta, l as MetaDeprecated, n as Schema, o as SchemaMetaInput, r as SchemaInputObject, s as SchemaOf, t as InferCreateSchemaOptions, u as MetaInput } from "./schema-xFkmOyE6.cjs";
2
+ import { a as SinkInputObject, i as SinkInput, n as Sink, o as SinkMeta, r as SinkFunction, s as SinkMetaInput, t as InferCreateSinkOptions } from "./sink-DHpx94GM.cjs";
3
+ import { a as SourceInputObject, i as SourceInput, n as Source, o as SourceMeta, r as SourceFunction, s as SourceMetaInput, t as InferCreateSourceOptions } from "./source-txi0ZuzR.cjs";
4
+ import { a as InferCreateGeneratorOptions, i as GeneratorMeta, n as GeneratorInput, r as GeneratorInputObject, t as Generator } from "./generator-Dq0PL5w6.cjs";
5
+ import { t as createGenerator } from "./create-BqRl9d7m.cjs";
6
+ import { n as extractSchemaMeta, t as createSchema } from "./create-Cz9qVT4m.cjs";
7
+ import { t as defineSchema } from "./define-BPfeEA9Z.cjs";
8
+ import { t as isSchemaInputObject } from "./helpers-BqnQPaP5.cjs";
9
+ import { n as extractSinkMeta, t as createSink } from "./create-DAGPeYVI.cjs";
10
+ import { n as extractSourceMeta, t as createSource } from "./create-DUt-efk7.cjs";
11
+ import { t as defineSource } from "./define-aWeW6VVo.cjs";
12
+ export { type Generator, type GeneratorInput, type GeneratorInputObject, type GeneratorMeta, type InferCreateGeneratorOptions, type InferCreateSchemaOptions, type InferCreateSinkOptions, type InferCreateSourceOptions, type Meta, type MetaDeprecated, type MetaInput, type MetaLink, type MetaValue, type Schema, type SchemaInputObject, type SchemaMeta, type SchemaMetaExample, type SchemaMetaInput, type SchemaOf, type Sink, type SinkFunction, type SinkInput, type SinkInputObject, type SinkMeta, type SinkMetaInput, type Source, type SourceFunction, type SourceInput, type SourceInputObject, type SourceMeta, type SourceMetaInput, createGenerator, createSchema, createSink, createSource, defineSchema, defineSource, extractSchemaMeta, extractSinkMeta, extractSourceMeta, isSchemaInputObject };
package/dist/index.d.mts CHANGED
@@ -1,8 +1,12 @@
1
- import { a as SinkMeta, i as SinkInputWithMeta, n as SinkFunction, r as SinkInput, t as Sink } from "./types-B2MtSxCp.mjs";
2
- import { a as SourceMeta, i as SourceInputWithMeta, n as SourceFunction, o as SourceValue, r as SourceInput, t as Source } from "./types-DJo-IRmS.mjs";
3
- import { n as GeneratorInput, r as GeneratorMeta, t as Generator } from "./generator-DZI01B4_.mjs";
4
- import { UserConfig } from "./config.mjs";
5
- import { createGenerator } from "./generator/index.mjs";
6
- import { VALID_SINK_FILE_EXTENSIONS, extractSink } from "./sink/index.mjs";
7
- import { SourceResolvedInput, VALID_SOURCE_FILE_EXTENSIONS, extractSource } from "./source/index.mjs";
8
- export { type Generator, type GeneratorInput, type GeneratorMeta, type Sink, type SinkFunction, type SinkInput, type SinkInputWithMeta, type SinkMeta, type Source, type SourceFunction, type SourceInput, type SourceInputWithMeta, type SourceMeta, SourceResolvedInput, type SourceValue, type UserConfig, VALID_SINK_FILE_EXTENSIONS, VALID_SOURCE_FILE_EXTENSIONS, createGenerator, extractSink, extractSource };
1
+ import { a as SchemaMetaExample, c as Meta, d as MetaLink, f as MetaValue, i as SchemaMeta, l as MetaDeprecated, n as Schema, o as SchemaMetaInput, r as SchemaInputObject, s as SchemaOf, t as InferCreateSchemaOptions, u as MetaInput } from "./schema-xFkmOyE6.mjs";
2
+ import { a as SinkInputObject, i as SinkInput, n as Sink, o as SinkMeta, r as SinkFunction, s as SinkMetaInput, t as InferCreateSinkOptions } from "./sink-CHQncb8H.mjs";
3
+ import { a as SourceInputObject, i as SourceInput, n as Source, o as SourceMeta, r as SourceFunction, s as SourceMetaInput, t as InferCreateSourceOptions } from "./source-BiOs3_-8.mjs";
4
+ import { a as InferCreateGeneratorOptions, i as GeneratorMeta, n as GeneratorInput, r as GeneratorInputObject, t as Generator } from "./generator-BGkKE8HQ.mjs";
5
+ import { t as createGenerator } from "./create-DcCu_zM3.mjs";
6
+ import { n as extractSchemaMeta, t as createSchema } from "./create-C-rR8nuY.mjs";
7
+ import { t as defineSchema } from "./define-CQZ042K5.mjs";
8
+ import { t as isSchemaInputObject } from "./helpers-CgXgqnVu.mjs";
9
+ import { n as extractSinkMeta, t as createSink } from "./create-DEe398aQ.mjs";
10
+ import { n as extractSourceMeta, t as createSource } from "./create-Qxy2mq7r.mjs";
11
+ import { t as defineSource } from "./define-Dw8JgVQ1.mjs";
12
+ export { type Generator, type GeneratorInput, type GeneratorInputObject, type GeneratorMeta, type InferCreateGeneratorOptions, type InferCreateSchemaOptions, type InferCreateSinkOptions, type InferCreateSourceOptions, type Meta, type MetaDeprecated, type MetaInput, type MetaLink, type MetaValue, type Schema, type SchemaInputObject, type SchemaMeta, type SchemaMetaExample, type SchemaMetaInput, type SchemaOf, type Sink, type SinkFunction, type SinkInput, type SinkInputObject, type SinkMeta, type SinkMetaInput, type Source, type SourceFunction, type SourceInput, type SourceInputObject, type SourceMeta, type SourceMetaInput, createGenerator, createSchema, createSink, createSource, defineSchema, defineSource, extractSchemaMeta, extractSinkMeta, extractSourceMeta, isSchemaInputObject };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import"./config.mjs";import{n as e,t}from"./extract-ZIpZAKsq.mjs";import{n,t as r}from"./extract-BzZLelb2.mjs";import{createGenerator as i}from"./generator/index.mjs";import"./sink/index.mjs";import"./source/index.mjs";export{e as VALID_SINK_FILE_EXTENSIONS,n as VALID_SOURCE_FILE_EXTENSIONS,i as createGenerator,t as extractSink,r as extractSource};
1
+ import{n as e,t}from"./create-BR4IeVl4.mjs";import{isSchemaInputObject as n}from"./schema/helpers.mjs";import{createSink as r,extractSinkMeta as i}from"./sink/create.mjs";import{createSource as a,extractSourceMeta as o}from"./source/create.mjs";import{createGenerator as s}from"./generator/create.mjs";import"./generator/index.mjs";import{defineSchema as c}from"./schema/define.mjs";import"./schema/index.mjs";import"./sink/index.mjs";import{defineSource as l}from"./source/define.mjs";import"./source/index.mjs";export{s as createGenerator,t as createSchema,r as createSink,a as createSource,c as defineSchema,l as defineSource,e as extractSchemaMeta,i as extractSinkMeta,o as extractSourceMeta,n as isSchemaInputObject};
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../create-23iLtMb_.cjs");exports.createSchema=e.t,exports.extractSchemaMeta=e.n;
@@ -0,0 +1,2 @@
1
+ import { n as extractSchemaMeta, t as createSchema } from "../create-Cz9qVT4m.cjs";
2
+ export { createSchema, extractSchemaMeta };
@@ -0,0 +1,2 @@
1
+ import { n as extractSchemaMeta, t as createSchema } from "../create-C-rR8nuY.mjs";
2
+ export { createSchema, extractSchemaMeta };
@@ -0,0 +1 @@
1
+ import{n as e,t}from"../create-BR4IeVl4.mjs";export{t as createSchema,e as extractSchemaMeta};
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers.cjs");function t(t){return e.isSchemaInputObject(t)?t:{schema:t}}exports.defineSchema=t;
@@ -0,0 +1,2 @@
1
+ import { t as defineSchema } from "../define-BPfeEA9Z.cjs";
2
+ export { defineSchema };
@@ -0,0 +1,2 @@
1
+ import { t as defineSchema } from "../define-CQZ042K5.mjs";
2
+ export { defineSchema };
@@ -0,0 +1,2 @@
1
+ import{isSchemaInputObject as e}from"./helpers.mjs";function t(t){return e(t)?t:{schema:t}}export{t as defineSchema};
2
+ //# sourceMappingURL=define.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@stryke/type-checks/is-set-object");function t(t){return(0,e.isSetObject)(t)&&`schema`in t&&t.schema!==void 0}exports.isSchemaInputObject=t;
@@ -0,0 +1,2 @@
1
+ import { t as isSchemaInputObject } from "../helpers-BqnQPaP5.cjs";
2
+ export { isSchemaInputObject };
@@ -0,0 +1,2 @@
1
+ import { t as isSchemaInputObject } from "../helpers-CgXgqnVu.mjs";
2
+ export { isSchemaInputObject };
@@ -0,0 +1,2 @@
1
+ import{isSetObject as e}from"@stryke/type-checks/is-set-object";function t(t){return e(t)&&`schema`in t&&t.schema!==void 0}export{t as isSchemaInputObject};
2
+ //# sourceMappingURL=helpers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../create-23iLtMb_.cjs"),t=require("./helpers.cjs"),n=require("./define.cjs");exports.createSchema=e.t,exports.defineSchema=n.defineSchema,exports.extractSchemaMeta=e.n,exports.isSchemaInputObject=t.isSchemaInputObject;
@@ -0,0 +1,4 @@
1
+ import { n as extractSchemaMeta, t as createSchema } from "../create-Cz9qVT4m.cjs";
2
+ import { t as defineSchema } from "../define-BPfeEA9Z.cjs";
3
+ import { t as isSchemaInputObject } from "../helpers-BqnQPaP5.cjs";
4
+ export { createSchema, defineSchema, extractSchemaMeta, isSchemaInputObject };
@@ -0,0 +1,4 @@
1
+ import { n as extractSchemaMeta, t as createSchema } from "../create-C-rR8nuY.mjs";
2
+ import { t as defineSchema } from "../define-CQZ042K5.mjs";
3
+ import { t as isSchemaInputObject } from "../helpers-CgXgqnVu.mjs";
4
+ export { createSchema, defineSchema, extractSchemaMeta, isSchemaInputObject };
@@ -0,0 +1 @@
1
+ import{n as e,t}from"../create-BR4IeVl4.mjs";import{isSchemaInputObject as n}from"./helpers.mjs";import{defineSchema as r}from"./define.mjs";export{t as createSchema,r as defineSchema,e as extractSchemaMeta,n as isSchemaInputObject};