@power-plant/core 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +0,0 @@
1
- const e=require("./helpers-Botqc1jf.cjs");let t=require("@power-plant/schema"),n=require("@stryke/type-checks/is-function");function r(t,r){let i=t?.schema??{},a=e.n(t,r);return a.description=e.i((0,n.isFunction)(a.title)?async(e,t)=>`Accepts a ${await Promise.resolve(a.title(e,t))??``} specification and processes it with a {title} sink.`:`Accepts a ${a.title??``} specification and processes it with a {title} sink.`,i,a,r?.description),a.examples=e.a(i,a,r?.examples),a}async function i(n,i={}){let{meta:a,schema:o}=e.t(n)?n:{schema:n,meta:{}},s=await(0,t.extractSchemaWithSource)(o,i);return{...s,meta:r(s,a)}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
@@ -1,2 +0,0 @@
1
- import{a as e,i as t,n,t as r}from"./helpers-DwNCh4F3.mjs";import{extractSchemaWithSource as i}from"@power-plant/schema";import{isFunction as a}from"@stryke/type-checks/is-function";function o(r,i){let o=r?.schema??{},s=n(r,i);return s.description=t(a(s.title)?async(e,t)=>`Accepts a ${await Promise.resolve(s.title(e,t))??``} specification and processes it with a {title} sink.`:`Accepts a ${s.title??``} specification and processes it with a {title} sink.`,o,s,i?.description),s.examples=e(o,s,i?.examples),s}async function s(e,t={}){let{meta:n,schema:a}=r(e)?e:{schema:e,meta:{}},s=await i(a,t);return{...s,meta:o(s,n)}}export{o as n,s as t};
2
- //# sourceMappingURL=create-DcfhZUHw.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-DcfhZUHw.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +0,0 @@
1
- const e=require("./helpers-Botqc1jf.cjs"),t=require("./helpers-BWqqSR02.cjs"),n=require("./create-D_u2Zj81.cjs");let r=require("@power-plant/schema"),i=require("@stryke/type-checks/is-function"),a=require("@stryke/resolve/load"),o=require("@stryke/resolve/type-checks");function s(t,n){let r=t?.schema??{},a=e.n(t,n);return a.description=e.i((0,i.isFunction)(a.title)?async(e,t)=>`Accepts a ${await Promise.resolve(a.title(e,t))??``} specification and processes it with a {title} output.`:`Accepts a ${a.title??``} specification and processes it with a {title} output.`,r,a,n?.description),a}async function c(e,i,l={}){let{output:u,meta:d,schema:f}=t.t(i)?i:{output:i,meta:{}},p=e;f&&(p=await n.t(f,l),p.schema=(0,r.mergeMetadata)(p.schema,e.schema));let m;if((0,o.isLoadReference)(u))try{let e=await(0,a.load)(u,l);m=t.t(e)?await c(p,e.output,l).then(e=>e.output):e}catch{}return m||=u,{schema:p,output:m,meta:s(p,d)}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
@@ -1,2 +0,0 @@
1
- import{i as e,n as t}from"./helpers-DwNCh4F3.mjs";import{t as n}from"./helpers-8tc33xyp.mjs";import{t as r}from"./create-DcfhZUHw.mjs";import{mergeMetadata as i}from"@power-plant/schema";import{isFunction as a}from"@stryke/type-checks/is-function";import{load as o}from"@stryke/resolve/load";import{isLoadReference as s}from"@stryke/resolve/type-checks";function c(n,r){let i=n?.schema??{},o=t(n,r);return o.description=e(a(o.title)?async(e,t)=>`Accepts a ${await Promise.resolve(o.title(e,t))??``} specification and processes it with a {title} output.`:`Accepts a ${o.title??``} specification and processes it with a {title} output.`,i,o,r?.description),o}async function l(e,t,a={}){let{output:u,meta:d,schema:f}=n(t)?t:{output:t,meta:{}},p=e;f&&(p=await r(f,a),p.schema=i(p.schema,e.schema));let m;if(s(u))try{let e=await o(u,a);m=n(e)?await l(p,e.output,a).then(e=>e.output):e}catch{}return m||=u,{schema:p,output:m,meta:c(p,d)}}export{c as n,l as t};
2
- //# sourceMappingURL=create-cqJljXdZ.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-cqJljXdZ.mjs","names":[],"sources":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- import { r as SchemaConfigObject } from "./schema-DvnNqFd4.cjs";
2
- import { SchemaEnvelopeOf, SchemaSourceConfig } from "@power-plant/schema";
3
-
4
- //#region src/schema/define.d.ts
5
- /**
6
- * Defines a schema configuration object. If the provided schema is already a schema configuration object, it will be returned as-is. Otherwise, it will be wrapped in an object with a `schema` property.
7
- *
8
- * @param schema - The schema configuration to define. This can be either a schema source configuration, a schema envelope, or a schema configuration object.
9
- * @returns A schema configuration object that contains the provided schema. If the input was already a schema configuration object, it will be returned unchanged.
10
- */
11
- declare function defineSchema<TSpec, TOptions extends object>(schema: SchemaSourceConfig<TSpec> | SchemaEnvelopeOf<TSpec> | SchemaConfigObject<TSpec, TOptions>): SchemaConfigObject<TSpec, TOptions>;
12
- //#endregion
13
- export { defineSchema as t };
14
- //# sourceMappingURL=define-B5baoppv.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-B5baoppv.d.cts","names":[],"sources":["../src/schema/define.ts"],"mappings":";;;;;;AA4BA;;;;iBAAgB,YAAA,iCACd,MAAA,EACI,kBAAA,CAAmB,KAAA,IACnB,gBAAA,CAAiB,KAAA,IACjB,kBAAA,CAAmB,KAAA,EAAO,QAAA,IAC7B,kBAAA,CAAmB,KAAA,EAAO,QAAA"}
@@ -1,13 +0,0 @@
1
- import { r as GeneratorConfigObject } from "./generator-D9KikId4.cjs";
2
-
3
- //#region src/generator/define.d.ts
4
- /**
5
- * Defines a schema configuration object. If the provided schema is already a schema configuration object, it will be returned as-is. Otherwise, it will be wrapped in an object with a `schema` property.
6
- *
7
- * @param generator - The schema configuration to define. This can be either a schema source configuration, a schema envelope, or a schema configuration object.
8
- * @returns A schema configuration object that contains the provided schema. If the input was already a schema configuration object, it will be returned unchanged.
9
- */
10
- declare function defineGenerator<TSpec, TOptions extends object, TReturns = void>(generator: GeneratorConfigObject<TSpec, TOptions, TReturns>): GeneratorConfigObject<TSpec, TOptions, TReturns>;
11
- //#endregion
12
- export { defineGenerator as t };
13
- //# sourceMappingURL=define-BNsSORkE.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-BNsSORkE.d.cts","names":[],"sources":["../src/generator/define.ts"],"mappings":";;;;;AA2BA;;;;iBAAgB,eAAA,kDAKd,SAAA,EAAW,qBAAA,CAAsB,KAAA,EAAO,QAAA,EAAU,QAAA,IACjD,qBAAA,CAAsB,KAAA,EAAO,QAAA,EAAU,QAAA"}
@@ -1 +0,0 @@
1
- const e=require("./helpers-Botqc1jf.cjs");function t(t){return e.t(t)?t:{schema:t}}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
@@ -1,38 +0,0 @@
1
- import { i as InputConfigObject, r as InputConfig } from "./input-C3yGEfI-.mjs";
2
-
3
- //#region src/input/define.d.ts
4
- /**
5
- * Defines a input configuration object. If the provided input is already a input configuration object, it will be returned as-is. Otherwise, it will be wrapped in an object with a `input` property.
6
- *
7
- * @example
8
- * ```ts
9
- * import { defineInput } from "@power-plant/core";
10
- *
11
- * // Define a input from a input function
12
- * export default defineInput((options) => {
13
- * // Your input logic here
14
- * });
15
- *
16
- * // Define a input from an existing input input object
17
- * export default defineInput({
18
- * meta: {
19
- * name: "My Input",
20
- * version: "1.0.0",
21
- * description: "A input that does something.",
22
- * },
23
- * schema: z.object({
24
- * // Your schema definition here
25
- * }),
26
- * input: (options) => {
27
- * // Your input logic here
28
- * },
29
- * });
30
- * ```
31
- *
32
- * @param input - The input input to define. This can be either a input input object or a input function.
33
- * @returns A input input object that contains the provided input. If the input was already a input input object, it will be returned unchanged.
34
- */
35
- declare function defineInput<TSpec, TOptions extends object>(input: InputConfig<TSpec, TOptions>): InputConfigObject<TSpec, TOptions>;
36
- //#endregion
37
- export { defineInput as t };
38
- //# sourceMappingURL=define-BpCv3wD0.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-BpCv3wD0.d.mts","names":[],"sources":["../src/input/define.ts"],"mappings":""}
@@ -1,38 +0,0 @@
1
- import { i as InputConfigObject, r as InputConfig } from "./input-Osyk3YIo.cjs";
2
-
3
- //#region src/input/define.d.ts
4
- /**
5
- * Defines a input configuration object. If the provided input is already a input configuration object, it will be returned as-is. Otherwise, it will be wrapped in an object with a `input` property.
6
- *
7
- * @example
8
- * ```ts
9
- * import { defineInput } from "@power-plant/core";
10
- *
11
- * // Define a input from a input function
12
- * export default defineInput((options) => {
13
- * // Your input logic here
14
- * });
15
- *
16
- * // Define a input from an existing input input object
17
- * export default defineInput({
18
- * meta: {
19
- * name: "My Input",
20
- * version: "1.0.0",
21
- * description: "A input that does something.",
22
- * },
23
- * schema: z.object({
24
- * // Your schema definition here
25
- * }),
26
- * input: (options) => {
27
- * // Your input logic here
28
- * },
29
- * });
30
- * ```
31
- *
32
- * @param input - The input input to define. This can be either a input input object or a input function.
33
- * @returns A input input object that contains the provided input. If the input was already a input input object, it will be returned unchanged.
34
- */
35
- declare function defineInput<TSpec, TOptions extends object>(input: InputConfig<TSpec, TOptions>): InputConfigObject<TSpec, TOptions>;
36
- //#endregion
37
- export { defineInput as t };
38
- //# sourceMappingURL=define-Bviec8Ry.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-Bviec8Ry.d.cts","names":[],"sources":["../src/input/define.ts"],"mappings":";;;;;AAoDA;;;;;;;;;;;;;;;;;;;;;AAEoC;;;;;;;;iBAFpB,WAAA,iCACd,KAAA,EAAO,WAAA,CAAY,KAAA,EAAO,QAAA,IACzB,iBAAA,CAAkB,KAAA,EAAO,QAAA"}
@@ -1,2 +0,0 @@
1
- import{t as e}from"./helpers-8tc33xyp.mjs";function t(t){return e(t)?t:{output:t}}export{t};
2
- //# sourceMappingURL=define-C5_Sx-Eg.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-C5_Sx-Eg.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +0,0 @@
1
- const e=require("./helpers-BWqqSR02.cjs");function t(t){return e.t(t)?t:{output:t}}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
@@ -1,13 +0,0 @@
1
- import { r as GeneratorConfigObject } from "./generator-9GSAWmOj.mjs";
2
-
3
- //#region src/generator/define.d.ts
4
- /**
5
- * Defines a schema configuration object. If the provided schema is already a schema configuration object, it will be returned as-is. Otherwise, it will be wrapped in an object with a `schema` property.
6
- *
7
- * @param generator - The schema configuration to define. This can be either a schema source configuration, a schema envelope, or a schema configuration object.
8
- * @returns A schema configuration object that contains the provided schema. If the input was already a schema configuration object, it will be returned unchanged.
9
- */
10
- declare function defineGenerator<TSpec, TOptions extends object, TReturns = void>(generator: GeneratorConfigObject<TSpec, TOptions, TReturns>): GeneratorConfigObject<TSpec, TOptions, TReturns>;
11
- //#endregion
12
- export { defineGenerator as t };
13
- //# sourceMappingURL=define-Cjl-0yK0.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-Cjl-0yK0.d.mts","names":[],"sources":["../src/generator/define.ts"],"mappings":""}
@@ -1,2 +0,0 @@
1
- import{t as e}from"./helpers-DwNCh4F3.mjs";function t(t){return e(t)?t:{schema:t}}export{t};
2
- //# sourceMappingURL=define-DE0RBdIR.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-DE0RBdIR.mjs","names":[],"sources":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- import { r as SchemaConfigObject } from "./schema-DvnNqFd4.mjs";
2
- import { SchemaEnvelopeOf, SchemaSourceConfig } from "@power-plant/schema";
3
-
4
- //#region src/schema/define.d.ts
5
- /**
6
- * Defines a schema configuration object. If the provided schema is already a schema configuration object, it will be returned as-is. Otherwise, it will be wrapped in an object with a `schema` property.
7
- *
8
- * @param schema - The schema configuration to define. This can be either a schema source configuration, a schema envelope, or a schema configuration object.
9
- * @returns A schema configuration object that contains the provided schema. If the input was already a schema configuration object, it will be returned unchanged.
10
- */
11
- declare function defineSchema<TSpec, TOptions extends object>(schema: SchemaSourceConfig<TSpec> | SchemaEnvelopeOf<TSpec> | SchemaConfigObject<TSpec, TOptions>): SchemaConfigObject<TSpec, TOptions>;
12
- //#endregion
13
- export { defineSchema as t };
14
- //# sourceMappingURL=define-DQQxZK9L.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-DQQxZK9L.d.mts","names":[],"sources":["../src/schema/define.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- const e=require("./helpers-BcTg0l_X.cjs");function t(t){return e.t(t)?t:{input:t}}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
@@ -1,2 +0,0 @@
1
- import{t as e}from"./helpers-Cfl4NsE5.mjs";function t(t){return e(t)?t:{input:t}}export{t};
2
- //# sourceMappingURL=define-DY1s6sGY.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-DY1s6sGY.mjs","names":[],"sources":[],"mappings":""}
@@ -1,45 +0,0 @@
1
- import { c as OutputConfig, l as OutputConfigObject, p as Logger } from "./generator-D9KikId4.cjs";
2
- import { FileSystemInterface } from "@stryke/types/fs";
3
-
4
- //#region src/types/context.d.ts
5
- interface Context {
6
- fs: FileSystemInterface;
7
- logger: Logger;
8
- }
9
- //#endregion
10
- //#region src/output/define.d.ts
11
- /**
12
- * Defines a output configuration object. If the provided output is already a output configuration object, it will be returned as-is. Otherwise, it will be wrapped in an object with a `output` property.
13
- *
14
- * @example
15
- * ```ts
16
- * import { defineOutput } from "@power-plant/core";
17
- *
18
- * // Define a output from a output function
19
- * export default defineOutput((spec, options) => {
20
- * // Your output logic here
21
- * });
22
- *
23
- * // Define a output from an existing output configuration object
24
- * export default defineOutput({
25
- * meta: {
26
- * name: "My Output",
27
- * version: "1.0.0",
28
- * description: "A output that does something.",
29
- * },
30
- * schema: z.object({
31
- * // Your schema definition here
32
- * }),
33
- * output: (spec, options) => {
34
- * // Your output logic here
35
- * },
36
- * });
37
- * ```
38
- *
39
- * @param output - The output configuration to define. This can be either a output configuration object or a output function.
40
- * @returns A output configuration object that contains the provided output. If the input was already a output configuration object, it will be returned unchanged.
41
- */
42
- declare function defineOutput<TSpec, TOptions extends object, TReturns = void>(output: OutputConfig<TSpec, TOptions, TReturns>): OutputConfigObject<TSpec, TOptions, TReturns>;
43
- //#endregion
44
- export { Context as n, defineOutput as t };
45
- //# sourceMappingURL=define-OeGEPyv1.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-OeGEPyv1.d.cts","names":[],"sources":["../src/types/context.ts","../src/output/define.ts"],"mappings":";;;;UAqBiB,OAAA;EACf,EAAA,EAAI,mBAAA;EACJ,MAAA,EAAQ,MAAM;AAAA;;;;;;;;AAFhB;;;;;;;;;AAEgB;;;;AC6BhB;;;;;;;;;;;;;iBAAgB,YAAA,kDACd,MAAA,EAAQ,YAAA,CAAa,KAAA,EAAO,QAAA,EAAU,QAAA,IACrC,kBAAA,CAAmB,KAAA,EAAO,QAAA,EAAU,QAAA"}
@@ -1,45 +0,0 @@
1
- import { c as OutputConfig, l as OutputConfigObject, p as Logger } from "./generator-9GSAWmOj.mjs";
2
- import { FileSystemInterface } from "@stryke/types/fs";
3
-
4
- //#region src/types/context.d.ts
5
- interface Context {
6
- fs: FileSystemInterface;
7
- logger: Logger;
8
- }
9
- //#endregion
10
- //#region src/output/define.d.ts
11
- /**
12
- * Defines a output configuration object. If the provided output is already a output configuration object, it will be returned as-is. Otherwise, it will be wrapped in an object with a `output` property.
13
- *
14
- * @example
15
- * ```ts
16
- * import { defineOutput } from "@power-plant/core";
17
- *
18
- * // Define a output from a output function
19
- * export default defineOutput((spec, options) => {
20
- * // Your output logic here
21
- * });
22
- *
23
- * // Define a output from an existing output configuration object
24
- * export default defineOutput({
25
- * meta: {
26
- * name: "My Output",
27
- * version: "1.0.0",
28
- * description: "A output that does something.",
29
- * },
30
- * schema: z.object({
31
- * // Your schema definition here
32
- * }),
33
- * output: (spec, options) => {
34
- * // Your output logic here
35
- * },
36
- * });
37
- * ```
38
- *
39
- * @param output - The output configuration to define. This can be either a output configuration object or a output function.
40
- * @returns A output configuration object that contains the provided output. If the input was already a output configuration object, it will be returned unchanged.
41
- */
42
- declare function defineOutput<TSpec, TOptions extends object, TReturns = void>(output: OutputConfig<TSpec, TOptions, TReturns>): OutputConfigObject<TSpec, TOptions, TReturns>;
43
- //#endregion
44
- export { Context as n, defineOutput as t };
45
- //# sourceMappingURL=define-hhs2D0Hq.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-hhs2D0Hq.d.mts","names":[],"sources":["../src/types/context.ts","../src/output/define.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../context-Bcrz4kGb.cjs"),t=require("../create-D_u2Zj81.cjs"),n=require("../create-0IEoomGw.cjs"),r=require("../create-MFKW4s0V.cjs");let i=require("@stryke/type-checks/is-function"),a=require("@stryke/resolve/load");async function o(o,s={}){let c;c=e.l(o)?o:await(0,a.load)(o,s);let l=await t.t(c.schema,s),[u,d]=await Promise.all([n.t(l,c.input,s),r.t(l,c.output,s)]);return{meta:c.meta,schema:l,input:u,output:d,generate:async t=>{let n=e.a(t);return e.n(n,async()=>{let e=(0,i.isFunction)(u.input)?await u.input(t):u.input,r=typeof c.meta?.description==`function`?c.meta.description(e):c.meta?.description;return r&&n.logger.info(`Generating ${r}...`),d.output(e,t)})}}}exports.createGenerator=o,exports.defineGenerator=e.c,exports.isGeneratorConfigObject=e.l;
@@ -1,29 +0,0 @@
1
- import { a as InferCreateGeneratorOptions, n as GeneratorConfig, r as GeneratorConfigObject, t as Generator } from "../generator-D9KikId4.cjs";
2
- import { t as defineGenerator } from "../define-BNsSORkE.cjs";
3
-
4
- //#region src/generator/create.d.ts
5
- /**
6
- * Creates a generator from raw schema/input/output configurations and resolves all descriptors.
7
- *
8
- * @remarks
9
- * This function is used to create a generator from raw schema, input, and output configurations. 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 config - The generator configuration containing schema, input, output, and optional meta information.
14
- * @param options - Optional extraction options for schema, input, and output.
15
- * @returns A promise that resolves to a fully constructed generator.
16
- */
17
- declare function createGenerator<TSpec, TOptions extends object, TReturns = void>(config: GeneratorConfig<TSpec, TOptions, TReturns>, options?: InferCreateGeneratorOptions<typeof config>): Promise<Generator<TSpec, TOptions, TReturns>>;
18
- //#endregion
19
- //#region src/generator/helpers.d.ts
20
- /**
21
- * Checks if the provided configuration is a {@link GeneratorConfigObject}.
22
- *
23
- * @param config - The configuration to check.
24
- * @returns True if the configuration is a {@link GeneratorConfigObject}, false otherwise.
25
- */
26
- declare function isGeneratorConfigObject<TSpec, TOptions extends object, TReturns = void>(config: unknown): config is GeneratorConfigObject<TSpec, TOptions, TReturns>;
27
- //#endregion
28
- export { createGenerator, defineGenerator, isGeneratorConfigObject };
29
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/generator/create.ts","../../src/generator/helpers.ts"],"mappings":";;;;;;;AA+CA;;;;;;;;;iBAAsB,eAAA,kDAKpB,MAAA,EAAQ,eAAA,CAAgB,KAAA,EAAO,QAAA,EAAU,QAAA,GACzC,OAAA,GAAS,2BAAA,QAAmC,MAAA,IAC3C,OAAA,CAAQ,SAAA,CAAU,KAAA,EAAO,QAAA,EAAU,QAAA;;;;;;AAPtC;;;iBCpBgB,uBAAA,kDAId,MAAA,YAAkB,MAAA,IAAU,qBAAA,CAAsB,KAAA,EAAO,QAAA,EAAU,QAAA"}
@@ -1,29 +0,0 @@
1
- import { a as InferCreateGeneratorOptions, n as GeneratorConfig, r as GeneratorConfigObject, t as Generator } from "../generator-9GSAWmOj.mjs";
2
- import { t as defineGenerator } from "../define-Cjl-0yK0.mjs";
3
-
4
- //#region src/generator/create.d.ts
5
- /**
6
- * Creates a generator from raw schema/input/output configurations and resolves all descriptors.
7
- *
8
- * @remarks
9
- * This function is used to create a generator from raw schema, input, and output configurations. 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 config - The generator configuration containing schema, input, output, and optional meta information.
14
- * @param options - Optional extraction options for schema, input, and output.
15
- * @returns A promise that resolves to a fully constructed generator.
16
- */
17
- declare function createGenerator<TSpec, TOptions extends object, TReturns = void>(config: GeneratorConfig<TSpec, TOptions, TReturns>, options?: InferCreateGeneratorOptions<typeof config>): Promise<Generator<TSpec, TOptions, TReturns>>;
18
- //#endregion
19
- //#region src/generator/helpers.d.ts
20
- /**
21
- * Checks if the provided configuration is a {@link GeneratorConfigObject}.
22
- *
23
- * @param config - The configuration to check.
24
- * @returns True if the configuration is a {@link GeneratorConfigObject}, false otherwise.
25
- */
26
- declare function isGeneratorConfigObject<TSpec, TOptions extends object, TReturns = void>(config: unknown): config is GeneratorConfigObject<TSpec, TOptions, TReturns>;
27
- //#endregion
28
- export { createGenerator, defineGenerator, isGeneratorConfigObject };
29
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/generator/create.ts","../../src/generator/helpers.ts"],"mappings":""}
@@ -1,2 +0,0 @@
1
- import{a as e,c as t,l as n,n as r}from"../context-BGSa-2fY.mjs";import{t as i}from"../create-DcfhZUHw.mjs";import{t as a}from"../create-CYRTmdJO.mjs";import{t as o}from"../create-cqJljXdZ.mjs";import{isFunction as s}from"@stryke/type-checks/is-function";import{load as c}from"@stryke/resolve/load";async function l(t,l={}){let u;u=n(t)?t:await c(t,l);let d=await i(u.schema,l),[f,p]=await Promise.all([a(d,u.input,l),o(d,u.output,l)]);return{meta:u.meta,schema:d,input:f,output:p,generate:async t=>{let n=e(t);return r(n,async()=>{let e=s(f.input)?await f.input(t):f.input,r=typeof u.meta?.description==`function`?u.meta.description(e):u.meta?.description;return r&&n.logger.info(`Generating ${r}...`),p.output(e,t)})}}}export{l as createGenerator,t as defineGenerator,n as isGeneratorConfigObject};
2
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":[],"mappings":""}
@@ -1,126 +0,0 @@
1
- import { c as Meta, l as MetaConfig, r as SchemaConfigObject, s as SchemaOf } from "./schema-DvnNqFd4.mjs";
2
- import { n as Input, r as InputConfig } from "./input-C3yGEfI-.mjs";
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-9GSAWmOj.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator-9GSAWmOj.d.mts","names":[],"sources":["../src/types/config.ts","../src/types/output.ts","../src/types/generator.ts"],"mappings":""}