@power-plant/core 0.0.26 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{config-Beq7WF_l.d.mts → config-DS1cj7j6.d.cts} +7 -9
- package/dist/config-DS1cj7j6.d.cts.map +1 -0
- package/dist/{config-DjOTmKJ-.d.cts → config-ZvnnxGt9.d.mts} +7 -9
- package/dist/{config-Beq7WF_l.d.mts.map → config-ZvnnxGt9.d.mts.map} +1 -1
- package/dist/config.cjs +9 -1
- package/dist/config.d.cts +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +7 -1
- package/dist/{context-BWBu3ZGQ.d.mts → context-DMA3S81W.d.mts} +3 -3
- package/dist/context-DMA3S81W.d.mts.map +1 -0
- package/dist/{context-Dv5inNBb.d.cts → context-DSkOqDWy.d.cts} +3 -3
- package/dist/{context-Dv5inNBb.d.cts.map → context-DSkOqDWy.d.cts.map} +1 -1
- package/dist/context.cjs +189 -1
- package/dist/context.d.cts +1 -1
- package/dist/context.d.mts +1 -1
- package/dist/context.mjs +168 -1
- package/dist/define.cjs +97 -1
- package/dist/define.d.cts +1 -1
- package/dist/define.d.mts +1 -1
- package/dist/define.mjs +93 -1
- package/dist/execute-3oK9lgh3.cjs +501 -0
- package/dist/execute-C6kyFG8N.mjs +461 -0
- package/dist/execute-C6kyFG8N.mjs.map +1 -0
- package/dist/execute.cjs +6 -1
- package/dist/execute.d.cts +2 -2
- package/dist/execute.d.mts +2 -2
- package/dist/execute.mjs +4 -1
- package/dist/{execution-Bb3uSrmc.d.mts → execution-BaOcMIgV.d.mts} +2 -2
- package/dist/execution-BaOcMIgV.d.mts.map +1 -0
- package/dist/{execution-CRrga32N.d.cts → execution-vXX_IEkO.d.cts} +2 -2
- package/dist/{execution-CRrga32N.d.cts.map → execution-vXX_IEkO.d.cts.map} +1 -1
- package/dist/helpers/index.cjs +17 -1
- package/dist/helpers/index.mjs +4 -1
- package/dist/helpers/meta.cjs +142 -1
- package/dist/helpers/meta.mjs +133 -1
- package/dist/helpers/type-checks.cjs +46 -1
- package/dist/helpers/type-checks.d.cts +2 -2
- package/dist/helpers/type-checks.d.mts +2 -2
- package/dist/helpers/type-checks.mjs +42 -1
- package/dist/index-CWjICo_s.d.mts +3 -0
- package/dist/index-DWiKtHVE.d.cts +3 -0
- package/dist/index.cjs +34 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +6 -1
- package/dist/meta-DAeqzHmR.d.cts.map +1 -1
- package/package.json +4 -4
- package/dist/config-DjOTmKJ-.d.cts.map +0 -1
- package/dist/context-BWBu3ZGQ.d.mts.map +0 -1
- package/dist/execute-4whFNgY3.cjs +0 -1
- package/dist/execute-ByonuMsd.mjs +0 -2
- package/dist/execute-ByonuMsd.mjs.map +0 -1
- package/dist/execution-Bb3uSrmc.d.mts.map +0 -1
- package/dist/index-CGJ5KOdN.d.mts +0 -3
- package/dist/index-DdHt416f.d.cts +0 -3
package/dist/define.cjs
CHANGED
|
@@ -1 +1,97 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_helpers_type_checks = require('./helpers/type-checks.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/define.ts
|
|
5
|
+
/**
|
|
6
|
+
* 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.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { defineInput } from "@power-plant/core";
|
|
11
|
+
*
|
|
12
|
+
* // Define a input from a input function
|
|
13
|
+
* export default defineInput((options) => {
|
|
14
|
+
* // Your input logic here
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // Define a input from an existing input input object
|
|
18
|
+
* export default defineInput({
|
|
19
|
+
* meta: {
|
|
20
|
+
* name: "My Input",
|
|
21
|
+
* version: "1.0.0",
|
|
22
|
+
* description: "A input that does something.",
|
|
23
|
+
* },
|
|
24
|
+
* schema: z.object({
|
|
25
|
+
* // Your schema definition here
|
|
26
|
+
* }),
|
|
27
|
+
* input: (options) => {
|
|
28
|
+
* // Your input logic here
|
|
29
|
+
* },
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param input - The input input to define. This can be either a input input object or a input function.
|
|
34
|
+
* @returns A input input object that contains the provided input. If the input was already a input input object, it will be returned unchanged.
|
|
35
|
+
*/
|
|
36
|
+
function defineInput(input) {
|
|
37
|
+
if (require_helpers_type_checks.isInputConfigObject(input)) return input;
|
|
38
|
+
return { input };
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 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.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* import { defineOutput } from "@power-plant/core";
|
|
46
|
+
*
|
|
47
|
+
* // Define a output from a output function
|
|
48
|
+
* export default defineOutput((result, spec, options) => {
|
|
49
|
+
* // Your output logic here
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* // Define a output from an existing output configuration object
|
|
53
|
+
* export default defineOutput({
|
|
54
|
+
* meta: {
|
|
55
|
+
* name: "My Output",
|
|
56
|
+
* version: "1.0.0",
|
|
57
|
+
* description: "A output that does something.",
|
|
58
|
+
* },
|
|
59
|
+
* output: (result, spec, options) => {
|
|
60
|
+
* // Your output logic here
|
|
61
|
+
* },
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @param output - The output configuration to define. This can be either a output configuration object or a output function.
|
|
66
|
+
* @returns A output configuration object that contains the provided output. If the input was already a output configuration object, it will be returned unchanged.
|
|
67
|
+
*/
|
|
68
|
+
function defineOutput(output) {
|
|
69
|
+
if (require_helpers_type_checks.isOutputConfigObject(output)) return output;
|
|
70
|
+
return { output };
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 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.
|
|
74
|
+
*
|
|
75
|
+
* @param schema - The schema configuration to define. This can be either a schema source configuration, a schema envelope, or a schema configuration object.
|
|
76
|
+
* @returns A schema configuration object that contains the provided schema. If the input was already a schema configuration object, it will be returned unchanged.
|
|
77
|
+
*/
|
|
78
|
+
function defineSchema(schema) {
|
|
79
|
+
if (require_helpers_type_checks.isSchemaConfigObject(schema)) return schema;
|
|
80
|
+
return { schema };
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 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.
|
|
84
|
+
*
|
|
85
|
+
* @param generator - The schema configuration to define. This can be either a schema source configuration, a schema envelope, or a schema configuration object.
|
|
86
|
+
* @returns A schema configuration object that contains the provided schema. If the input was already a schema configuration object, it will be returned unchanged.
|
|
87
|
+
*/
|
|
88
|
+
function defineGenerator(generator) {
|
|
89
|
+
if (!require_helpers_type_checks.isGeneratorConfigObject(generator)) throw new TypeError("An invalid generator configuration was provided - at minimum, a generator function is required.");
|
|
90
|
+
return generator;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
exports.defineGenerator = defineGenerator;
|
|
95
|
+
exports.defineInput = defineInput;
|
|
96
|
+
exports.defineOutput = defineOutput;
|
|
97
|
+
exports.defineSchema = defineSchema;
|
package/dist/define.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as InputConfig, N as InputConfigObject, R as SchemaConfigObject, d as OutputConfig, f as OutputConfigObject, v as GeneratorConfigObject } from "./config-
|
|
1
|
+
import { M as InputConfig, N as InputConfigObject, R as SchemaConfigObject, d as OutputConfig, f as OutputConfigObject, v as GeneratorConfigObject } from "./config-DS1cj7j6.cjs";
|
|
2
2
|
import { SchemaEnvelopeOf, SchemaSourceConfig } from "@power-plant/schema";
|
|
3
3
|
//#region src/define.d.ts
|
|
4
4
|
/**
|
package/dist/define.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as InputConfig, N as InputConfigObject, R as SchemaConfigObject, d as OutputConfig, f as OutputConfigObject, v as GeneratorConfigObject } from "./config-
|
|
1
|
+
import { M as InputConfig, N as InputConfigObject, R as SchemaConfigObject, d as OutputConfig, f as OutputConfigObject, v as GeneratorConfigObject } from "./config-ZvnnxGt9.mjs";
|
|
2
2
|
import { SchemaEnvelopeOf, SchemaSourceConfig } from "@power-plant/schema";
|
|
3
3
|
//#region src/define.d.ts
|
|
4
4
|
/**
|
package/dist/define.mjs
CHANGED
|
@@ -1,2 +1,94 @@
|
|
|
1
|
-
import{isGeneratorConfigObject
|
|
1
|
+
import { isGeneratorConfigObject, isInputConfigObject, isOutputConfigObject, isSchemaConfigObject } from "./helpers/type-checks.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/define.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
|
+
function defineInput(input) {
|
|
36
|
+
if (isInputConfigObject(input)) return input;
|
|
37
|
+
return { input };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 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.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { defineOutput } from "@power-plant/core";
|
|
45
|
+
*
|
|
46
|
+
* // Define a output from a output function
|
|
47
|
+
* export default defineOutput((result, spec, options) => {
|
|
48
|
+
* // Your output logic here
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* // Define a output from an existing output configuration object
|
|
52
|
+
* export default defineOutput({
|
|
53
|
+
* meta: {
|
|
54
|
+
* name: "My Output",
|
|
55
|
+
* version: "1.0.0",
|
|
56
|
+
* description: "A output that does something.",
|
|
57
|
+
* },
|
|
58
|
+
* output: (result, spec, options) => {
|
|
59
|
+
* // Your output logic here
|
|
60
|
+
* },
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @param output - The output configuration to define. This can be either a output configuration object or a output function.
|
|
65
|
+
* @returns A output configuration object that contains the provided output. If the input was already a output configuration object, it will be returned unchanged.
|
|
66
|
+
*/
|
|
67
|
+
function defineOutput(output) {
|
|
68
|
+
if (isOutputConfigObject(output)) return output;
|
|
69
|
+
return { output };
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 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.
|
|
73
|
+
*
|
|
74
|
+
* @param schema - The schema configuration to define. This can be either a schema source configuration, a schema envelope, or a schema configuration object.
|
|
75
|
+
* @returns A schema configuration object that contains the provided schema. If the input was already a schema configuration object, it will be returned unchanged.
|
|
76
|
+
*/
|
|
77
|
+
function defineSchema(schema) {
|
|
78
|
+
if (isSchemaConfigObject(schema)) return schema;
|
|
79
|
+
return { schema };
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 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.
|
|
83
|
+
*
|
|
84
|
+
* @param generator - The schema configuration to define. This can be either a schema source configuration, a schema envelope, or a schema configuration object.
|
|
85
|
+
* @returns A schema configuration object that contains the provided schema. If the input was already a schema configuration object, it will be returned unchanged.
|
|
86
|
+
*/
|
|
87
|
+
function defineGenerator(generator) {
|
|
88
|
+
if (!isGeneratorConfigObject(generator)) throw new TypeError("An invalid generator configuration was provided - at minimum, a generator function is required.");
|
|
89
|
+
return generator;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
export { defineGenerator, defineInput, defineOutput, defineSchema };
|
|
2
94
|
//# sourceMappingURL=define.mjs.map
|