@power-plant/core 0.0.2

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 (51) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +45 -0
  3. package/dist/config.cjs +0 -0
  4. package/dist/config.d.cts +10 -0
  5. package/dist/config.d.cts.map +1 -0
  6. package/dist/config.d.mts +10 -0
  7. package/dist/config.d.mts.map +1 -0
  8. package/dist/config.mjs +2 -0
  9. package/dist/config.mjs.map +1 -0
  10. package/dist/extract-BzZLelb2.mjs +2 -0
  11. package/dist/extract-BzZLelb2.mjs.map +1 -0
  12. package/dist/extract-DUwG1ZUO.cjs +1 -0
  13. package/dist/extract-FkKA9g1K.cjs +1 -0
  14. package/dist/extract-ZIpZAKsq.mjs +2 -0
  15. package/dist/extract-ZIpZAKsq.mjs.map +1 -0
  16. package/dist/generator/index.cjs +1 -0
  17. package/dist/generator/index.d.cts +20 -0
  18. package/dist/generator/index.d.cts.map +1 -0
  19. package/dist/generator/index.d.mts +20 -0
  20. package/dist/generator/index.d.mts.map +1 -0
  21. package/dist/generator/index.mjs +2 -0
  22. package/dist/generator/index.mjs.map +1 -0
  23. package/dist/generator-C5O_C4RV.d.cts +57 -0
  24. package/dist/generator-C5O_C4RV.d.cts.map +1 -0
  25. package/dist/generator-DZI01B4_.d.mts +57 -0
  26. package/dist/generator-DZI01B4_.d.mts.map +1 -0
  27. package/dist/index.cjs +1 -0
  28. package/dist/index.d.cts +8 -0
  29. package/dist/index.d.mts +8 -0
  30. package/dist/index.mjs +1 -0
  31. package/dist/sink/index.cjs +1 -0
  32. package/dist/sink/index.d.cts +15 -0
  33. package/dist/sink/index.d.cts.map +1 -0
  34. package/dist/sink/index.d.mts +15 -0
  35. package/dist/sink/index.d.mts.map +1 -0
  36. package/dist/sink/index.mjs +1 -0
  37. package/dist/source/index.cjs +1 -0
  38. package/dist/source/index.d.cts +16 -0
  39. package/dist/source/index.d.cts.map +1 -0
  40. package/dist/source/index.d.mts +16 -0
  41. package/dist/source/index.d.mts.map +1 -0
  42. package/dist/source/index.mjs +1 -0
  43. package/dist/types-B2MtSxCp.d.cts +47 -0
  44. package/dist/types-B2MtSxCp.d.cts.map +1 -0
  45. package/dist/types-B2MtSxCp.d.mts +47 -0
  46. package/dist/types-B2MtSxCp.d.mts.map +1 -0
  47. package/dist/types-DJo-IRmS.d.cts +47 -0
  48. package/dist/types-DJo-IRmS.d.cts.map +1 -0
  49. package/dist/types-DJo-IRmS.d.mts +47 -0
  50. package/dist/types-DJo-IRmS.d.mts.map +1 -0
  51. package/package.json +150 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ <!-- START header -->
2
+
3
+ <!-- END header -->
4
+
5
+ # Power Plant
6
+
7
+ **Power Plant** allows you to generate anything from a spec.
8
+
9
+ ## Installing
10
+
11
+ Using [pnpm](http://pnpm.io):
12
+
13
+ ```bash
14
+ pnpm add -D @power-plant/core
15
+ ```
16
+
17
+ <details>
18
+ <summary>Using npm</summary>
19
+
20
+ ```bash
21
+ npm install -D @power-plant/core
22
+ ```
23
+
24
+ </details>
25
+
26
+ <details>
27
+ <summary>Using yarn</summary>
28
+
29
+ ```bash
30
+ yarn add -D @power-plant/core
31
+ ```
32
+
33
+ </details>
34
+
35
+ ## Building
36
+
37
+ Run `nx build core` to build the library.
38
+
39
+ ## Running unit tests
40
+
41
+ Run `nx test core` to execute the unit tests via [Vitest](https://vitest.dev/).
42
+
43
+ <!-- START footer -->
44
+
45
+ <!-- END footer -->
File without changes
@@ -0,0 +1,10 @@
1
+ import { t as Generator } from "./generator-C5O_C4RV.cjs";
2
+
3
+ //#region src/types/config.d.ts
4
+ interface UserConfig<TSpec extends object> {
5
+ spec: TSpec;
6
+ generate: Generator<TSpec> | Generator<TSpec>[] | { [key in keyof TSpec]: Generator<TSpec[key]> | Generator<TSpec[key]>[] };
7
+ }
8
+ //#endregion
9
+ export type { UserConfig };
10
+ //# sourceMappingURL=config.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.cts","names":[],"sources":["../src/types/config.ts"],"mappings":";;;UAoBiB,UAAA;EACf,IAAA,EAAM,KAAA;EACN,QAAA,EACI,SAAA,CAAU,KAAA,IACV,SAAA,CAAU,KAAA,sBAEM,KAAA,GAAQ,SAAA,CAAU,KAAA,CAAM,GAAA,KAAQ,SAAA,CAAU,KAAA,CAAM,GAAA;AAAA"}
@@ -0,0 +1,10 @@
1
+ import { t as Generator } from "./generator-DZI01B4_.mjs";
2
+
3
+ //#region src/types/config.d.ts
4
+ interface UserConfig<TSpec extends object> {
5
+ spec: TSpec;
6
+ generate: Generator<TSpec> | Generator<TSpec>[] | { [key in keyof TSpec]: Generator<TSpec[key]> | Generator<TSpec[key]>[] };
7
+ }
8
+ //#endregion
9
+ export type { UserConfig };
10
+ //# sourceMappingURL=config.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.mts","names":[],"sources":["../src/types/config.ts"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export{};
2
+ //# sourceMappingURL=config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{extractFileReference as e}from"@stryke/convert/extract-file-reference";import{findFileExtensionSafe as t}from"@stryke/path/find";import{existsSync as n}from"node:fs";import{resolveSafe as r}from"@power-plant/schema/resolve";import{createJiti as i}from"jiti";const a=[`ts`,`cts`,`mts`,`tsx`,`js`,`cjs`,`mjs`,`jsx`,`json`,`jsonc`,`json5`,`yaml`,`yml`,`toml`];function o(e){return typeof e==`object`&&!!e&&`file`in e&&typeof e.file==`string`}function s(e){if(typeof e==`string`){if(e.includes(`:`)||e.includes(`#`)||e.includes(`;`))return!0;let r=t(e);return!r||!a.includes(r)?!1:n(e)}return o(e)}function c(e){return typeof e==`object`&&!!e&&!o(e)&&`source`in e}async function l(n,o,l={}){let u=c(o)?o:{source:o,meta:void 0},d=u.source;if(s(d)){let o=e(d);if(!o)throw Error(`Failed to extract a file reference from the provided source input ${JSON.stringify(d)}.`);let s=t(o.file);if(s&&!a.includes(s))throw Error(`The provided source file input "${o.file}" has an invalid file extension (.${s}). Please ensure that the file has one of the following extensions: ${a.join(`, `)}.`);let c=await r(o,l);if(c===void 0){let e=await i(l.cwd??process.cwd()).import(o.file),t=o.export;t||=`default`,c=e[t]??e[`__Ω${t}`]??(t==="default"?e.default:void 0)}if(c===void 0)throw Error(`Failed to resolve source input from file reference "${o.file}".`);if(c instanceof Promise&&(c=await c),!c)throw Error(`Resolved source input from file reference "${o.file}" is invalid: ${JSON.stringify(c)}.`);return{schema:n,source:c,meta:u.meta}}return d instanceof Promise?{schema:n,source:await d,meta:u.meta}:{schema:n,source:d,meta:u.meta}}export{a as n,l as t};
2
+ //# sourceMappingURL=extract-BzZLelb2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-BzZLelb2.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1 @@
1
+ let e=require("@stryke/type-checks/is-function"),t=require("@power-plant/schema"),n=require("@stryke/convert/extract-file-reference"),r=require("@stryke/path/find"),i=require("node:fs");const a=[`ts`,`cts`,`mts`,`tsx`,`js`,`cjs`,`mjs`,`jsx`];function o(e){return typeof e==`object`&&!!e&&`file`in e&&typeof e.file==`string`}function s(e){if(typeof e==`string`){if(e.includes(`:`)||e.includes(`#`)||e.includes(`;`))return!0;let t=(0,r.findFileExtensionSafe)(e);return!t||!a.includes(t)?!1:(0,i.existsSync)(e)}return o(e)}function c(e){return typeof e==`object`&&!!e&&`sink`in e}async function l(i,o,l={}){let u=c(o)?o:{sink:o,meta:void 0},d=u.sink;if(s(d)){let o=(0,n.extractFileReference)(d);if(!o)throw Error(`Failed to extract a file reference from the provided sink input ${JSON.stringify(d)}.`);let s=(0,r.findFileExtensionSafe)(o.file);if(s&&!a.includes(s))throw Error(`The provided sink file input "${o.file}" has an invalid file extension (.${s}). Please ensure that the file has one of the following extensions: ${a.join(`, `)}.`);let c=await(0,t.resolve)(o,l);if(!(0,e.isFunction)(c))throw TypeError(`Resolved sink input from file reference "${o.file}" is invalid: ${JSON.stringify(c)}.`);return{schema:i,sink:c,meta:u.meta}}return{schema:i,sink:d,meta:u.meta}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
@@ -0,0 +1 @@
1
+ let e=require("@stryke/convert/extract-file-reference"),t=require("@stryke/path/find"),n=require("node:fs"),r=require("@power-plant/schema/resolve"),i=require("jiti");const a=[`ts`,`cts`,`mts`,`tsx`,`js`,`cjs`,`mjs`,`jsx`,`json`,`jsonc`,`json5`,`yaml`,`yml`,`toml`];function o(e){return typeof e==`object`&&!!e&&`file`in e&&typeof e.file==`string`}function s(e){if(typeof e==`string`){if(e.includes(`:`)||e.includes(`#`)||e.includes(`;`))return!0;let r=(0,t.findFileExtensionSafe)(e);return!r||!a.includes(r)?!1:(0,n.existsSync)(e)}return o(e)}function c(e){return typeof e==`object`&&!!e&&!o(e)&&`source`in e}async function l(n,o,l={}){let u=c(o)?o:{source:o,meta:void 0},d=u.source;if(s(d)){let o=(0,e.extractFileReference)(d);if(!o)throw Error(`Failed to extract a file reference from the provided source input ${JSON.stringify(d)}.`);let s=(0,t.findFileExtensionSafe)(o.file);if(s&&!a.includes(s))throw Error(`The provided source file input "${o.file}" has an invalid file extension (.${s}). Please ensure that the file has one of the following extensions: ${a.join(`, `)}.`);let c=await(0,r.resolveSafe)(o,l);if(c===void 0){let e=await(0,i.createJiti)(l.cwd??process.cwd()).import(o.file),t=o.export;t||=`default`,c=e[t]??e[`__Ω${t}`]??(t==="default"?e.default:void 0)}if(c===void 0)throw Error(`Failed to resolve source input from file reference "${o.file}".`);if(c instanceof Promise&&(c=await c),!c)throw Error(`Resolved source input from file reference "${o.file}" is invalid: ${JSON.stringify(c)}.`);return{schema:n,source:c,meta:u.meta}}return d instanceof Promise?{schema:n,source:await d,meta:u.meta}:{schema:n,source:d,meta:u.meta}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
@@ -0,0 +1,2 @@
1
+ import{isFunction as e}from"@stryke/type-checks/is-function";import{resolve as t}from"@power-plant/schema";import{extractFileReference as n}from"@stryke/convert/extract-file-reference";import{findFileExtensionSafe as r}from"@stryke/path/find";import{existsSync as i}from"node:fs";const a=[`ts`,`cts`,`mts`,`tsx`,`js`,`cjs`,`mjs`,`jsx`];function o(e){return typeof e==`object`&&!!e&&`file`in e&&typeof e.file==`string`}function s(e){if(typeof e==`string`){if(e.includes(`:`)||e.includes(`#`)||e.includes(`;`))return!0;let t=r(e);return!t||!a.includes(t)?!1:i(e)}return o(e)}function c(e){return typeof e==`object`&&!!e&&`sink`in e}async function l(i,o,l={}){let u=c(o)?o:{sink:o,meta:void 0},d=u.sink;if(s(d)){let o=n(d);if(!o)throw Error(`Failed to extract a file reference from the provided sink input ${JSON.stringify(d)}.`);let s=r(o.file);if(s&&!a.includes(s))throw Error(`The provided sink file input "${o.file}" has an invalid file extension (.${s}). Please ensure that the file has one of the following extensions: ${a.join(`, `)}.`);let c=await t(o,l);if(!e(c))throw TypeError(`Resolved sink input from file reference "${o.file}" is invalid: ${JSON.stringify(c)}.`);return{schema:i,sink:c,meta:u.meta}}return{schema:i,sink:d,meta:u.meta}}export{a as n,l as t};
2
+ //# sourceMappingURL=extract-ZIpZAKsq.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-ZIpZAKsq.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +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;
@@ -0,0 +1,20 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/generator/generator.ts"],"mappings":";;;;;;AAqCA;;;;;;;;;;iBAAsB,eAAA,wBACpB,KAAA,EAAO,cAAA,CAAe,KAAA,EAAO,QAAA,GAC7B,OAAA,GAAU,cAAA,GACT,OAAA,CAAQ,SAAA,CAAU,KAAA,EAAO,QAAA"}
@@ -0,0 +1,20 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/generator/generator.ts"],"mappings":""}
@@ -0,0 +1,2 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1,57 @@
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";
4
+
5
+ //#region src/types/generator.d.ts
6
+ interface GeneratorMeta<TSpec> {
7
+ /**
8
+ * A string description (or a function that returns a string) outlining the purpose or behavior of the generator.
9
+ */
10
+ description?: string | ((spec: TSpec) => string);
11
+ }
12
+ interface GeneratorInput<TSpec, TOptions = never> {
13
+ /**
14
+ * Optional metadata about the generator, such as a description of the output it produces.
15
+ */
16
+ meta?: GeneratorMeta<TSpec>;
17
+ /**
18
+ * The schema input that defines the structure of the specification object for this generator.
19
+ */
20
+ schema: SchemaInput<TSpec>;
21
+ /**
22
+ * The source input for the generator specification.
23
+ */
24
+ source: SourceInput<TSpec, TOptions>;
25
+ /**
26
+ * The sink input that consumes generated output.
27
+ */
28
+ sink: SinkInput<TSpec, TOptions>;
29
+ }
30
+ interface Generator<TSpec, TOptions = never> {
31
+ /**
32
+ * Optional metadata about the generator, such as a description of the output it produces.
33
+ */
34
+ meta?: GeneratorMeta<TSpec>;
35
+ /**
36
+ * The schema input that defines the structure of the specification object for this generator.
37
+ */
38
+ schema: SchemaOf<TSpec>;
39
+ /**
40
+ * 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
+ */
42
+ source: Source<TSpec, TOptions>;
43
+ /**
44
+ * 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
+ */
46
+ sink: Sink<TSpec, TOptions>;
47
+ /**
48
+ * The generate function that executes the generator logic, taking in options and producing output based on the source and sink definitions.
49
+ *
50
+ * @param options - The options to be passed to the generator, which can be used to influence the generation process.
51
+ * @returns A promise that resolves when the generation process is complete.
52
+ */
53
+ generate: (options: TOptions) => Promise<void>;
54
+ }
55
+ //#endregion
56
+ export { GeneratorInput as n, GeneratorMeta as r, Generator as t };
57
+ //# sourceMappingURL=generator-C5O_C4RV.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator-C5O_C4RV.d.cts","names":[],"sources":["../src/types/generator.ts"],"mappings":";;;;;UAsBiB,aAAA;;AAAjB;;EAIE,WAAA,cAAyB,IAAA,EAAM,KAAK;AAAA;AAAA,UAGrB,cAAA;EAHf;;;EAOA,IAAA,GAAO,aAAA,CAAc,KAAA;EAPe;AAGtC;;EASE,MAAA,EAAQ,WAAA,CAAY,KAAA;EALC;;;EAUrB,MAAA,EAAQ,WAAA,CAAY,KAAA,EAAO,QAAA;EAAP;;;EAKpB,IAAA,EAAM,SAAA,CAAU,KAAA,EAAO,QAAA;AAAA;AAAA,UAGR,SAAA;EAHA;;;EAOf,IAAA,GAAO,aAAA,CAAc,KAAA;EAtBrB;;;EA2BA,MAAA,EAAQ,QAAA,CAAS,KAAA;EAtBT;;;EA2BR,MAAA,EAAQ,MAAA,CAAO,KAAA,EAAO,QAAA;EAtBF;;;EA2BpB,IAAA,EAAM,IAAA,CAAK,KAAA,EAAO,QAAA;EAtBF;;;AAAe;AAGjC;;EA2BE,QAAA,GAAW,OAAA,EAAS,QAAA,KAAa,OAAA;AAAA"}
@@ -0,0 +1,57 @@
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";
4
+
5
+ //#region src/types/generator.d.ts
6
+ interface GeneratorMeta<TSpec> {
7
+ /**
8
+ * A string description (or a function that returns a string) outlining the purpose or behavior of the generator.
9
+ */
10
+ description?: string | ((spec: TSpec) => string);
11
+ }
12
+ interface GeneratorInput<TSpec, TOptions = never> {
13
+ /**
14
+ * Optional metadata about the generator, such as a description of the output it produces.
15
+ */
16
+ meta?: GeneratorMeta<TSpec>;
17
+ /**
18
+ * The schema input that defines the structure of the specification object for this generator.
19
+ */
20
+ schema: SchemaInput<TSpec>;
21
+ /**
22
+ * The source input for the generator specification.
23
+ */
24
+ source: SourceInput<TSpec, TOptions>;
25
+ /**
26
+ * The sink input that consumes generated output.
27
+ */
28
+ sink: SinkInput<TSpec, TOptions>;
29
+ }
30
+ interface Generator<TSpec, TOptions = never> {
31
+ /**
32
+ * Optional metadata about the generator, such as a description of the output it produces.
33
+ */
34
+ meta?: GeneratorMeta<TSpec>;
35
+ /**
36
+ * The schema input that defines the structure of the specification object for this generator.
37
+ */
38
+ schema: SchemaOf<TSpec>;
39
+ /**
40
+ * 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
+ */
42
+ source: Source<TSpec, TOptions>;
43
+ /**
44
+ * 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
+ */
46
+ sink: Sink<TSpec, TOptions>;
47
+ /**
48
+ * The generate function that executes the generator logic, taking in options and producing output based on the source and sink definitions.
49
+ *
50
+ * @param options - The options to be passed to the generator, which can be used to influence the generation process.
51
+ * @returns A promise that resolves when the generation process is complete.
52
+ */
53
+ generate: (options: TOptions) => Promise<void>;
54
+ }
55
+ //#endregion
56
+ export { GeneratorInput as n, GeneratorMeta as r, Generator as t };
57
+ //# sourceMappingURL=generator-DZI01B4_.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator-DZI01B4_.d.mts","names":[],"sources":["../src/types/generator.ts"],"mappings":""}
package/dist/index.cjs ADDED
@@ -0,0 +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;
@@ -0,0 +1,8 @@
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 };
@@ -0,0 +1,8 @@
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 };
package/dist/index.mjs ADDED
@@ -0,0 +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};
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../extract-DUwG1ZUO.cjs");exports.VALID_SINK_FILE_EXTENSIONS=e.n,exports.extractSink=e.t;
@@ -0,0 +1,15 @@
1
+ import { a as SinkMeta, i as SinkInputWithMeta, n as SinkFunction, r as SinkInput, t as Sink } from "../types-B2MtSxCp.cjs";
2
+ import { SchemaOf } from "@power-plant/schema/types";
3
+ import { ResolveOptions } from "@power-plant/schema/resolve";
4
+
5
+ //#region src/sink/constants.d.ts
6
+ declare const VALID_SINK_FILE_EXTENSIONS: string[];
7
+ //#endregion
8
+ //#region src/sink/extract.d.ts
9
+ /**
10
+ * Normalizes any accepted sink input into a concrete sink descriptor.
11
+ */
12
+ declare function extractSink<TSpec, TOptions = never>(schema: SchemaOf<TSpec>, input: SinkInput<TSpec, TOptions>, options?: ResolveOptions): Promise<Sink<TSpec, TOptions>>;
13
+ //#endregion
14
+ export { type Sink, type SinkFunction, type SinkInput, type SinkInputWithMeta, type SinkMeta, VALID_SINK_FILE_EXTENSIONS, extractSink };
15
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/sink/constants.ts","../../src/sink/extract.ts"],"mappings":";;;;;cAkBa,0BAAA;;;;;AAAb;iBC8CsB,WAAA,0BACpB,MAAA,EAAQ,QAAA,CAAS,KAAA,GACjB,KAAA,EAAO,SAAA,CAAU,KAAA,EAAO,QAAA,GACxB,OAAA,GAAS,cAAA,GACR,OAAA,CAAQ,IAAA,CAAK,KAAA,EAAO,QAAA"}
@@ -0,0 +1,15 @@
1
+ import { a as SinkMeta, i as SinkInputWithMeta, n as SinkFunction, r as SinkInput, t as Sink } from "../types-B2MtSxCp.mjs";
2
+ import { ResolveOptions } from "@power-plant/schema/resolve";
3
+ import { SchemaOf } from "@power-plant/schema/types";
4
+
5
+ //#region src/sink/constants.d.ts
6
+ declare const VALID_SINK_FILE_EXTENSIONS: string[];
7
+ //#endregion
8
+ //#region src/sink/extract.d.ts
9
+ /**
10
+ * Normalizes any accepted sink input into a concrete sink descriptor.
11
+ */
12
+ declare function extractSink<TSpec, TOptions = never>(schema: SchemaOf<TSpec>, input: SinkInput<TSpec, TOptions>, options?: ResolveOptions): Promise<Sink<TSpec, TOptions>>;
13
+ //#endregion
14
+ export { type Sink, type SinkFunction, type SinkInput, type SinkInputWithMeta, type SinkMeta, VALID_SINK_FILE_EXTENSIONS, extractSink };
15
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/sink/constants.ts","../../src/sink/extract.ts"],"mappings":""}
@@ -0,0 +1 @@
1
+ import{n as e,t}from"../extract-ZIpZAKsq.mjs";export{e as VALID_SINK_FILE_EXTENSIONS,t as extractSink};
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../extract-FkKA9g1K.cjs");exports.VALID_SOURCE_FILE_EXTENSIONS=e.n,exports.extractSource=e.t;
@@ -0,0 +1,16 @@
1
+ import { a as SourceMeta, i as SourceInputWithMeta, n as SourceFunction, o as SourceValue, r as SourceInput, t as Source } from "../types-DJo-IRmS.cjs";
2
+ import { SchemaOf } from "@power-plant/schema/types";
3
+ import { ResolveOptions } from "@power-plant/schema/resolve";
4
+
5
+ //#region src/source/constants.d.ts
6
+ declare const VALID_SOURCE_FILE_EXTENSIONS: string[];
7
+ //#endregion
8
+ //#region src/source/extract.d.ts
9
+ type SourceResolvedInput<TSpec, TOptions = never> = TSpec | Promise<TSpec> | SourceFunction<TSpec, TOptions>;
10
+ /**
11
+ * Normalizes any accepted source input into a concrete source descriptor.
12
+ */
13
+ declare function extractSource<TSpec, TOptions = never>(schema: SchemaOf<TSpec>, input: SourceInput<TSpec, TOptions>, options?: ResolveOptions): Promise<Source<TSpec, TOptions>>;
14
+ //#endregion
15
+ export { type Source, type SourceFunction, type SourceInput, type SourceInputWithMeta, type SourceMeta, SourceResolvedInput, type SourceValue, VALID_SOURCE_FILE_EXTENSIONS, extractSource };
16
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/source/constants.ts","../../src/source/extract.ts"],"mappings":";;;;;cAkBa,4BAAA;;;KCgBD,mBAAA,4BACR,KAAA,GACA,OAAA,CAAQ,KAAA,IACR,cAAA,CAAe,KAAA,EAAO,QAAA;;ADnB1B;;iBC6DsB,aAAA,0BACpB,MAAA,EAAQ,QAAA,CAAS,KAAA,GACjB,KAAA,EAAO,WAAA,CAAY,KAAA,EAAO,QAAA,GAC1B,OAAA,GAAS,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,KAAA,EAAO,QAAA"}
@@ -0,0 +1,16 @@
1
+ import { a as SourceMeta, i as SourceInputWithMeta, n as SourceFunction, o as SourceValue, r as SourceInput, t as Source } from "../types-DJo-IRmS.mjs";
2
+ import { ResolveOptions } from "@power-plant/schema/resolve";
3
+ import { SchemaOf } from "@power-plant/schema/types";
4
+
5
+ //#region src/source/constants.d.ts
6
+ declare const VALID_SOURCE_FILE_EXTENSIONS: string[];
7
+ //#endregion
8
+ //#region src/source/extract.d.ts
9
+ type SourceResolvedInput<TSpec, TOptions = never> = TSpec | Promise<TSpec> | SourceFunction<TSpec, TOptions>;
10
+ /**
11
+ * Normalizes any accepted source input into a concrete source descriptor.
12
+ */
13
+ declare function extractSource<TSpec, TOptions = never>(schema: SchemaOf<TSpec>, input: SourceInput<TSpec, TOptions>, options?: ResolveOptions): Promise<Source<TSpec, TOptions>>;
14
+ //#endregion
15
+ export { type Source, type SourceFunction, type SourceInput, type SourceInputWithMeta, type SourceMeta, SourceResolvedInput, type SourceValue, VALID_SOURCE_FILE_EXTENSIONS, extractSource };
16
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/source/constants.ts","../../src/source/extract.ts"],"mappings":""}
@@ -0,0 +1 @@
1
+ import{n as e,t}from"../extract-BzZLelb2.mjs";export{e as VALID_SOURCE_FILE_EXTENSIONS,t as extractSource};
@@ -0,0 +1,47 @@
1
+ import { SchemaOf } from "@power-plant/schema/types";
2
+ import { MaybePromise } from "@stryke/types/base";
3
+ import { FileReferenceInput } from "@stryke/types/configuration";
4
+
5
+ //#region src/sink/types.d.ts
6
+ type SinkFunction<TSpec, TOptions = never> = TOptions extends never ? (spec: TSpec) => MaybePromise<TSpec> : (spec: TSpec, options: TOptions) => MaybePromise<void>;
7
+ interface SinkMeta<TSpec, TOptions = never> {
8
+ /**
9
+ * A string description (or a function that returns a string) of the eventual output of the sink.
10
+ */
11
+ description?: string | (TOptions extends never ? (spec: TSpec) => string : (spec: TSpec, options: TOptions) => string);
12
+ }
13
+ interface SinkInputWithMeta<TSpec, TOptions = never> {
14
+ /**
15
+ * The sink implementation, either as a callable function or a file reference.
16
+ */
17
+ sink: SinkFunction<TSpec, TOptions> | FileReferenceInput;
18
+ /**
19
+ * Optional metadata that provides contextual information for the schema.
20
+ */
21
+ meta?: SinkMeta<TSpec, TOptions>;
22
+ }
23
+ type SinkInput<TSpec, TOptions = never> = FileReferenceInput | SinkFunction<TSpec, TOptions> | SinkInputWithMeta<TSpec, TOptions>;
24
+ interface Sink<TSpec, TOptions = never> {
25
+ /**
26
+ * 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.
27
+ */
28
+ schema: SchemaOf<TSpec>;
29
+ /**
30
+ * Optional metadata that provides contextual information for the schema.
31
+ */
32
+ meta?: SinkMeta<TSpec, TOptions>;
33
+ /**
34
+ * 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.
35
+ *
36
+ * @remarks
37
+ * The `sink` 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.
38
+ *
39
+ * @param spec - The specification object that conforms to the defined schema input.
40
+ * @param params - Additional parameters that may be needed for the sink function to process the output data.
41
+ * @returns A value or a promise that resolves to a value, which will be used as the output data for the generator.
42
+ */
43
+ sink: SinkFunction<TSpec, TOptions>;
44
+ }
45
+ //#endregion
46
+ export { SinkMeta as a, SinkInputWithMeta as i, SinkFunction as n, SinkInput as r, Sink as t };
47
+ //# sourceMappingURL=types-B2MtSxCp.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-B2MtSxCp.d.cts","names":[],"sources":["../src/sink/types.ts"],"mappings":";;;;;KAsBY,YAAA,4BAAwC,QAAA,kBAC/C,IAAA,EAAM,KAAA,KAAU,YAAA,CAAa,KAAA,KAC7B,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,QAAA,KAAa,YAAA;AAAA,UAEvB,QAAA;EAJL;;;EAQV,WAAA,aAEK,QAAA,kBACI,IAAA,EAAM,KAAA,eACN,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,QAAA;AAAA;AAAA,UAGhB,iBAAA;EAdI;;;EAkBnB,IAAA,EAAM,YAAA,CAAa,KAAA,EAAO,QAAA,IAAY,kBAAA;EAjBY;;;EAsBlD,IAAA,GAAO,QAAA,CAAS,KAAA,EAAO,QAAA;AAAA;AAAA,KAGb,SAAA,4BACR,kBAAA,GACA,YAAA,CAAa,KAAA,EAAO,QAAA,IACpB,iBAAA,CAAkB,KAAA,EAAO,QAAA;AAAA,UAEZ,IAAA;EA/BI;;;EAmCnB,MAAA,EAAQ,QAAA,CAAS,KAAA;EAlCQ;;;EAuCzB,IAAA,GAAO,QAAA,CAAS,KAAA,EAAO,QAAA;EAvC2B;AAEpD;;;;;;;;;EAiDE,IAAA,EAAM,YAAA,CAAa,KAAA,EAAO,QAAA;AAAA"}
@@ -0,0 +1,47 @@
1
+ import { SchemaOf } from "@power-plant/schema/types";
2
+ import { MaybePromise } from "@stryke/types/base";
3
+ import { FileReferenceInput } from "@stryke/types/configuration";
4
+
5
+ //#region src/sink/types.d.ts
6
+ type SinkFunction<TSpec, TOptions = never> = TOptions extends never ? (spec: TSpec) => MaybePromise<TSpec> : (spec: TSpec, options: TOptions) => MaybePromise<void>;
7
+ interface SinkMeta<TSpec, TOptions = never> {
8
+ /**
9
+ * A string description (or a function that returns a string) of the eventual output of the sink.
10
+ */
11
+ description?: string | (TOptions extends never ? (spec: TSpec) => string : (spec: TSpec, options: TOptions) => string);
12
+ }
13
+ interface SinkInputWithMeta<TSpec, TOptions = never> {
14
+ /**
15
+ * The sink implementation, either as a callable function or a file reference.
16
+ */
17
+ sink: SinkFunction<TSpec, TOptions> | FileReferenceInput;
18
+ /**
19
+ * Optional metadata that provides contextual information for the schema.
20
+ */
21
+ meta?: SinkMeta<TSpec, TOptions>;
22
+ }
23
+ type SinkInput<TSpec, TOptions = never> = FileReferenceInput | SinkFunction<TSpec, TOptions> | SinkInputWithMeta<TSpec, TOptions>;
24
+ interface Sink<TSpec, TOptions = never> {
25
+ /**
26
+ * 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.
27
+ */
28
+ schema: SchemaOf<TSpec>;
29
+ /**
30
+ * Optional metadata that provides contextual information for the schema.
31
+ */
32
+ meta?: SinkMeta<TSpec, TOptions>;
33
+ /**
34
+ * 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.
35
+ *
36
+ * @remarks
37
+ * The `sink` 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.
38
+ *
39
+ * @param spec - The specification object that conforms to the defined schema input.
40
+ * @param params - Additional parameters that may be needed for the sink function to process the output data.
41
+ * @returns A value or a promise that resolves to a value, which will be used as the output data for the generator.
42
+ */
43
+ sink: SinkFunction<TSpec, TOptions>;
44
+ }
45
+ //#endregion
46
+ export { SinkMeta as a, SinkInputWithMeta as i, SinkFunction as n, SinkInput as r, Sink as t };
47
+ //# sourceMappingURL=types-B2MtSxCp.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-B2MtSxCp.d.mts","names":[],"sources":["../src/sink/types.ts"],"mappings":""}
@@ -0,0 +1,47 @@
1
+ import { SchemaOf } from "@power-plant/schema/types";
2
+ import { MaybePromise } from "@stryke/types/base";
3
+ import { FileReferenceInput } from "@stryke/types/configuration";
4
+
5
+ //#region src/source/types.d.ts
6
+ interface SourceMeta<TSpec, TOptions = never> {
7
+ /**
8
+ * A string description (or a function that returns a string) of the expected method of gathering input for the source.
9
+ */
10
+ description?: string | (TOptions extends never ? (spec: TSpec) => string : (spec: TSpec, options: TOptions) => string);
11
+ }
12
+ type SourceFunction<TSpec, TOptions = never> = TOptions extends never ? (spec: TSpec) => MaybePromise<TSpec> : (spec: TSpec, options: TOptions) => MaybePromise<TSpec>;
13
+ type SourceValue<TSpec, TOptions = never> = TSpec | SourceFunction<TSpec, TOptions> | Promise<TSpec> | FileReferenceInput;
14
+ interface SourceInputWithMeta<TSpec, TOptions = never> {
15
+ /**
16
+ * The source implementation, which can be a static value, function, promise, or file reference.
17
+ */
18
+ source: SourceValue<TSpec, TOptions>;
19
+ /**
20
+ * Optional metadata that provides contextual information for the source.
21
+ */
22
+ meta?: SourceMeta<TSpec, TOptions>;
23
+ }
24
+ type SourceInput<TSpec, TOptions = never> = SourceValue<TSpec, TOptions> | SourceInputWithMeta<TSpec, TOptions>;
25
+ interface Source<TSpec, TOptions = never> {
26
+ /**
27
+ * 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.
28
+ */
29
+ schema: SchemaOf<TSpec>;
30
+ /**
31
+ * Optional metadata that provides contextual information for the source.
32
+ */
33
+ meta?: SourceMeta<TSpec, TOptions>;
34
+ /**
35
+ * 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.
36
+ *
37
+ * @remarks
38
+ * The `source` 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.
39
+ *
40
+ * @param options - The options object that can be used to influence the generation process.
41
+ * @returns A value or a promise that resolves to a value, which will be used as the input data for the generator.
42
+ */
43
+ source: TSpec | SourceFunction<TSpec, TOptions>;
44
+ }
45
+ //#endregion
46
+ export { SourceMeta as a, SourceInputWithMeta as i, SourceFunction as n, SourceValue as o, SourceInput as r, Source as t };
47
+ //# sourceMappingURL=types-DJo-IRmS.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DJo-IRmS.d.cts","names":[],"sources":["../src/source/types.ts"],"mappings":";;;;;UAsBiB,UAAA;;AAAjB;;EAIE,WAAA,aAEK,QAAA,kBACI,IAAA,EAAM,KAAA,eACN,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,QAAA;AAAA;AAAA,KAGrB,cAAA,4BAA0C,QAAA,kBACjD,IAAA,EAAM,KAAA,KAAU,YAAA,CAAa,KAAA,KAC7B,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,QAAA,KAAa,YAAA,CAAa,KAAA;AAAA,KAEzC,WAAA,4BACR,KAAA,GACA,cAAA,CAAe,KAAA,EAAO,QAAA,IACtB,OAAA,CAAQ,KAAA,IACR,kBAAA;AAAA,UAEa,mBAAA;EAbwB;;;EAiBvC,MAAA,EAAQ,WAAA,CAAY,KAAA,EAAO,QAAA;EArB3B;;;EA0BA,IAAA,GAAO,UAAA,CAAW,KAAA,EAAO,QAAA;AAAA;AAAA,KAGf,WAAA,4BACR,WAAA,CAAY,KAAA,EAAO,QAAA,IACnB,mBAAA,CAAoB,KAAA,EAAO,QAAA;AAAA,UAEd,MAAA;EA7BO;;AAAiB;EAiCvC,MAAA,EAAQ,QAAA,CAAS,KAAA;EA9BO;;;EAmCxB,IAAA,GAAO,UAAA,CAAW,KAAA,EAAO,QAAA;EAlCO;;;;;;;;;EA6ChC,MAAA,EAAQ,KAAA,GAAQ,cAAA,CAAe,KAAA,EAAO,QAAA;AAAA"}
@@ -0,0 +1,47 @@
1
+ import { SchemaOf } from "@power-plant/schema/types";
2
+ import { MaybePromise } from "@stryke/types/base";
3
+ import { FileReferenceInput } from "@stryke/types/configuration";
4
+
5
+ //#region src/source/types.d.ts
6
+ interface SourceMeta<TSpec, TOptions = never> {
7
+ /**
8
+ * A string description (or a function that returns a string) of the expected method of gathering input for the source.
9
+ */
10
+ description?: string | (TOptions extends never ? (spec: TSpec) => string : (spec: TSpec, options: TOptions) => string);
11
+ }
12
+ type SourceFunction<TSpec, TOptions = never> = TOptions extends never ? (spec: TSpec) => MaybePromise<TSpec> : (spec: TSpec, options: TOptions) => MaybePromise<TSpec>;
13
+ type SourceValue<TSpec, TOptions = never> = TSpec | SourceFunction<TSpec, TOptions> | Promise<TSpec> | FileReferenceInput;
14
+ interface SourceInputWithMeta<TSpec, TOptions = never> {
15
+ /**
16
+ * The source implementation, which can be a static value, function, promise, or file reference.
17
+ */
18
+ source: SourceValue<TSpec, TOptions>;
19
+ /**
20
+ * Optional metadata that provides contextual information for the source.
21
+ */
22
+ meta?: SourceMeta<TSpec, TOptions>;
23
+ }
24
+ type SourceInput<TSpec, TOptions = never> = SourceValue<TSpec, TOptions> | SourceInputWithMeta<TSpec, TOptions>;
25
+ interface Source<TSpec, TOptions = never> {
26
+ /**
27
+ * 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.
28
+ */
29
+ schema: SchemaOf<TSpec>;
30
+ /**
31
+ * Optional metadata that provides contextual information for the source.
32
+ */
33
+ meta?: SourceMeta<TSpec, TOptions>;
34
+ /**
35
+ * 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.
36
+ *
37
+ * @remarks
38
+ * The `source` 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.
39
+ *
40
+ * @param options - The options object that can be used to influence the generation process.
41
+ * @returns A value or a promise that resolves to a value, which will be used as the input data for the generator.
42
+ */
43
+ source: TSpec | SourceFunction<TSpec, TOptions>;
44
+ }
45
+ //#endregion
46
+ export { SourceMeta as a, SourceInputWithMeta as i, SourceFunction as n, SourceValue as o, SourceInput as r, Source as t };
47
+ //# sourceMappingURL=types-DJo-IRmS.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DJo-IRmS.d.mts","names":[],"sources":["../src/source/types.ts"],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,150 @@
1
+ {
2
+ "name": "@power-plant/core",
3
+ "version": "0.0.2",
4
+ "private": false,
5
+ "description": "Core package for Power Plant",
6
+ "keywords": ["power-plant", "powerlines", "storm-software"],
7
+ "homepage": "https://stormsoftware.com",
8
+ "bugs": {
9
+ "url": "https://stormsoftware.com/support",
10
+ "email": "support@stormsoftware.com"
11
+ },
12
+ "repository": {
13
+ "type": "github",
14
+ "url": "https://github.com/storm-software/power-plant.git",
15
+ "directory": "packages/core"
16
+ },
17
+ "funding": {
18
+ "type": "github",
19
+ "url": "https://github.com/sponsors/storm-software"
20
+ },
21
+ "license": "Apache-2.0",
22
+ "author": {
23
+ "name": "Storm Software",
24
+ "email": "contact@stormsoftware.com",
25
+ "url": "https://stormsoftware.com"
26
+ },
27
+ "maintainers": [
28
+ {
29
+ "name": "Storm Software",
30
+ "email": "contact@stormsoftware.com",
31
+ "url": "https://stormsoftware.com"
32
+ }
33
+ ],
34
+ "contributors": [
35
+ {
36
+ "name": "Storm Software",
37
+ "email": "contact@stormsoftware.com",
38
+ "url": "https://stormsoftware.com"
39
+ }
40
+ ],
41
+ "type": "module",
42
+ "exports": {
43
+ ".": {
44
+ "require": {
45
+ "types": "./dist/index.d.cts",
46
+ "default": "./dist/index.cjs"
47
+ },
48
+ "import": {
49
+ "types": "./dist/index.d.mts",
50
+ "default": "./dist/index.mjs"
51
+ },
52
+ "default": {
53
+ "types": "./dist/index.d.mts",
54
+ "default": "./dist/index.mjs"
55
+ }
56
+ },
57
+ "./config": {
58
+ "require": {
59
+ "types": "./dist/config.d.cts",
60
+ "default": "./dist/config.cjs"
61
+ },
62
+ "import": {
63
+ "types": "./dist/config.d.mts",
64
+ "default": "./dist/config.mjs"
65
+ },
66
+ "default": {
67
+ "types": "./dist/config.d.mts",
68
+ "default": "./dist/config.mjs"
69
+ }
70
+ },
71
+ "./generator": {
72
+ "require": {
73
+ "types": "./dist/generator/index.d.cts",
74
+ "default": "./dist/generator/index.cjs"
75
+ },
76
+ "import": {
77
+ "types": "./dist/generator/index.d.mts",
78
+ "default": "./dist/generator/index.mjs"
79
+ },
80
+ "default": {
81
+ "types": "./dist/generator/index.d.mts",
82
+ "default": "./dist/generator/index.mjs"
83
+ }
84
+ },
85
+ "./package.json": "./package.json",
86
+ "./sink": {
87
+ "require": {
88
+ "types": "./dist/sink/index.d.cts",
89
+ "default": "./dist/sink/index.cjs"
90
+ },
91
+ "import": {
92
+ "types": "./dist/sink/index.d.mts",
93
+ "default": "./dist/sink/index.mjs"
94
+ },
95
+ "default": {
96
+ "types": "./dist/sink/index.d.mts",
97
+ "default": "./dist/sink/index.mjs"
98
+ }
99
+ },
100
+ "./source": {
101
+ "require": {
102
+ "types": "./dist/source/index.d.cts",
103
+ "default": "./dist/source/index.cjs"
104
+ },
105
+ "import": {
106
+ "types": "./dist/source/index.d.mts",
107
+ "default": "./dist/source/index.mjs"
108
+ },
109
+ "default": {
110
+ "types": "./dist/source/index.d.mts",
111
+ "default": "./dist/source/index.mjs"
112
+ }
113
+ }
114
+ },
115
+ "main": "./dist/index.cjs",
116
+ "module": "./dist/index.mjs",
117
+ "types": "./dist/index.d.cts",
118
+ "typings": "dist/index.d.mts",
119
+ "files": ["dist"],
120
+ "dependencies": {
121
+ "@alloy-js/core": "^0.23.1",
122
+ "@alloy-js/markdown": "^0.23.0",
123
+ "@alloy-js/typescript": "^0.23.0",
124
+ "@power-plant/schema": "^0.0.2",
125
+ "@powerlines/core": "^0.48.60",
126
+ "@powerlines/engine": "^0.49.62",
127
+ "@powerlines/plugin-alloy": "^0.26.232",
128
+ "@powerlines/plugin-automd": "^0.1.600",
129
+ "@stryke/convert": "^0.7.16",
130
+ "@stryke/fs": "^0.33.86",
131
+ "@stryke/helpers": "^0.10.25",
132
+ "@stryke/json": "^0.15.9",
133
+ "@stryke/path": "^0.29.12",
134
+ "@stryke/string-format": "^0.17.27",
135
+ "@stryke/type-checks": "^0.6.18",
136
+ "@stryke/types": "^0.12.13",
137
+ "automd": "^0.4.3",
138
+ "defu": "^6.1.7",
139
+ "jiti": "^2.7.0",
140
+ "powerlines": "^0.47.139",
141
+ "tsdown": "^0.22.3"
142
+ },
143
+ "devDependencies": {
144
+ "@powerlines/plugin-tsdown": "^0.1.540",
145
+ "@types/node": "^25.9.4",
146
+ "typescript": "^6.0.3"
147
+ },
148
+ "publishConfig": { "access": "public" },
149
+ "gitHead": "fed188fe5551ef432c38014dcc714161e4cb812d"
150
+ }