@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/helpers/meta.cjs
CHANGED
|
@@ -1 +1,142 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
3
|
+
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
4
|
+
let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
|
|
5
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
6
|
+
let _power_plant_schema = require("@power-plant/schema");
|
|
7
|
+
let _power_plant_schema_codegen = require("@power-plant/schema/codegen");
|
|
8
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
9
|
+
let _stryke_date_format = require("@stryke/date/format");
|
|
10
|
+
let _stryke_date_validate = require("@stryke/date/validate");
|
|
11
|
+
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
12
|
+
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
13
|
+
let _stryke_type_checks_is_date = require("@stryke/type-checks/is-date");
|
|
14
|
+
let _stryke_type_checks_is_number = require("@stryke/type-checks/is-number");
|
|
15
|
+
|
|
16
|
+
//#region src/helpers/meta.ts
|
|
17
|
+
function formatMetaVersion(value) {
|
|
18
|
+
return (0, _stryke_type_checks_is_date.isDate)(value) ? (0, _stryke_date_format.formatYYYYMMDD)(value) : (0, _stryke_type_checks_is_number.isNumber)(value) ? (0, _stryke_date_validate.isValidTimestamp)(value) && value > 1e9 ? (0, _stryke_date_format.formatYYYYMMDD)(new Date(value)) : value.toString() : (0, _stryke_type_checks_is_set_string.isSetString)(value) ? value : "1.0";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Extracts the version information from a given input, which can be a string, number, or Date object. The function returns a string representation of the version in the format "YYYYMMDD" for Date inputs, or as a string for valid timestamp numbers. If the input is a string, it is returned as-is. If the input is invalid or not provided, a default version of "1.0" is returned.
|
|
22
|
+
*
|
|
23
|
+
* @param input - The input from which to extract the version. It can be a string, number, undefined, or Date object.
|
|
24
|
+
* @returns A string representing the extracted version information.
|
|
25
|
+
*/
|
|
26
|
+
function resolveMetaVersion(schema, meta, input) {
|
|
27
|
+
return formatMetaVersion(input ?? meta?.version ?? schema?.version);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolves a metadata name using explicit input, metadata, or schema fallbacks.
|
|
31
|
+
*
|
|
32
|
+
* @param schema - The JSON Schema fragment to read fallback values from.
|
|
33
|
+
* @param meta - Metadata values that may already include a name.
|
|
34
|
+
* @param input - An explicit name value to prioritize when provided.
|
|
35
|
+
* @returns The resolved metadata name.
|
|
36
|
+
*/
|
|
37
|
+
function resolveMetaName(schema, meta, input) {
|
|
38
|
+
return input ?? meta.name ?? ((0, _stryke_type_checks_is_set_string.isSetString)(schema?.name) ? schema.name : (0, _stryke_type_checks_is_set_string.isSetString)(schema?.title) ? schema.title : schema.$id ? (0, _stryke_string_format_kebab_case.kebabCase)(schema.$id) : (0, _power_plant_schema_codegen.stringifyType)(schema));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolves a stable metadata identifier in the format `<name>@<version>`.
|
|
42
|
+
*
|
|
43
|
+
* @param schema - The JSON Schema fragment used to infer fallback values.
|
|
44
|
+
* @param meta - Metadata values used to resolve name and version.
|
|
45
|
+
* @returns The resolved metadata identifier, or a generated id when no name is available.
|
|
46
|
+
*/
|
|
47
|
+
function resolveMetaId(schema, meta) {
|
|
48
|
+
const name = resolveMetaName(schema, meta);
|
|
49
|
+
const version = resolveMetaVersion(schema, meta);
|
|
50
|
+
return name ? `${(0, _stryke_string_format_kebab_case.kebabCase)(name)}@${version}` : (0, _stryke_unique_id_uuid.uuid)();
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolves a human-readable display name for metadata.
|
|
54
|
+
*
|
|
55
|
+
* @param schema - The JSON Schema fragment to read fallback display values from.
|
|
56
|
+
* @param meta - Metadata values that may already include a display name.
|
|
57
|
+
* @param input - An explicit display name value to prioritize when provided.
|
|
58
|
+
* @returns The resolved metadata display name.
|
|
59
|
+
*/
|
|
60
|
+
function resolveMetaTitle(schema, meta, input) {
|
|
61
|
+
const value = input ?? meta.title ?? schema?.title;
|
|
62
|
+
if (value !== void 0) return value;
|
|
63
|
+
return (0, _stryke_string_format_title_case.titleCase)(meta.name ?? (0, _power_plant_schema_codegen.stringifyType)(schema));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Resolves a metadata description from explicit input, metadata, or schema values.
|
|
67
|
+
*
|
|
68
|
+
* @param template - A template string used to generate a default description when no explicit description is provided.
|
|
69
|
+
* @param schema - The JSON Schema fragment to read fallback description values from.
|
|
70
|
+
* @param meta - Metadata values that may already include a description.
|
|
71
|
+
* @param input - An explicit description value to prioritize when provided.
|
|
72
|
+
* @returns The resolved description, if available.
|
|
73
|
+
*/
|
|
74
|
+
function resolveMetaDescription(template, schema, meta, input) {
|
|
75
|
+
meta.title ??= resolveMetaTitle(schema, meta);
|
|
76
|
+
const title = meta.title ?? "";
|
|
77
|
+
const defaultDescription = template.replaceAll(/\{\s*title\s*\}/g, title);
|
|
78
|
+
const resolved = input ?? meta.description ?? schema?.description;
|
|
79
|
+
return (0, _stryke_type_checks_is_set_string.isSetString)(resolved) ? resolved : defaultDescription;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Resolves and normalizes metadata examples into a consistent object format.
|
|
83
|
+
*
|
|
84
|
+
* @typeParam TSpec - The schema specification type associated with example values.
|
|
85
|
+
* @param schema - The JSON Schema fragment to read fallback examples from.
|
|
86
|
+
* @param meta - Metadata values that may already include examples.
|
|
87
|
+
* @param input - Explicit examples to prioritize when provided.
|
|
88
|
+
* @returns A normalized list of examples with generated descriptions when needed.
|
|
89
|
+
*/
|
|
90
|
+
function resolveMetaExample(schema, meta, input) {
|
|
91
|
+
const normalizeExamples = (examples) => examples.map((example, i) => (0, _stryke_type_checks_is_set_string.isSetString)(example) ? {
|
|
92
|
+
name: `example-${i + 1}`,
|
|
93
|
+
description: `Example Specification #${i + 1}`,
|
|
94
|
+
value: example
|
|
95
|
+
} : (0, _stryke_type_checks_is_set_object.isSetObject)(example) && "value" in example && (0, _stryke_type_checks_is_set_string.isSetString)(example.value) ? {
|
|
96
|
+
name: `example-${i + 1}`,
|
|
97
|
+
description: example.description || `Example Specification #${i + 1}`,
|
|
98
|
+
value: example.value
|
|
99
|
+
} : void 0).filter(Boolean);
|
|
100
|
+
return normalizeExamples((0, _stryke_convert_to_array.toArray)(input ?? meta.examples ?? schema?.examples ?? []));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Resolves and de-duplicates metadata links from input, metadata, and schema docs.
|
|
104
|
+
*
|
|
105
|
+
* @param schema - The JSON Schema fragment to read fallback documentation links from.
|
|
106
|
+
* @param meta - Metadata values that may already include links.
|
|
107
|
+
* @param input - Explicit links to prioritize when provided.
|
|
108
|
+
* @returns A unique list of metadata links.
|
|
109
|
+
*/
|
|
110
|
+
function resolveMetaLinks(schema, meta, input) {
|
|
111
|
+
return (0, _stryke_helpers_get_unique.getUnique)((0, _stryke_convert_to_array.toArray)(input).concat(meta.links ?? []).concat(schema?.docs ?? []));
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Extracts and normalizes metadata for a specification based on the provided schema and optional configuration.
|
|
115
|
+
*
|
|
116
|
+
* @param schema - The schema that the specification is expected to conform to.
|
|
117
|
+
* @param config - Optional metadata configuration to extract and normalize.
|
|
118
|
+
* @returns The normalized specification metadata.
|
|
119
|
+
*/
|
|
120
|
+
function resolveMeta(schema, config) {
|
|
121
|
+
const extractedSchema = (0, _power_plant_schema.isSchemaOf)(schema) ? schema : schema ?? { schema: {} };
|
|
122
|
+
const meta = {};
|
|
123
|
+
meta.name = resolveMetaName(extractedSchema.schema, meta, config?.name);
|
|
124
|
+
meta.version = resolveMetaVersion(extractedSchema?.schema, meta, config?.version);
|
|
125
|
+
meta.title = resolveMetaTitle(extractedSchema?.schema, meta, config?.title);
|
|
126
|
+
meta.links = resolveMetaLinks(extractedSchema?.schema, meta, config?.links);
|
|
127
|
+
if (config?.deprecated) meta.deprecated = config?.deprecated;
|
|
128
|
+
if (config?.usage) meta.usage = config?.usage;
|
|
129
|
+
if (config?.tags) meta.tags = config?.tags;
|
|
130
|
+
return meta;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
//#endregion
|
|
134
|
+
exports.formatMetaVersion = formatMetaVersion;
|
|
135
|
+
exports.resolveMeta = resolveMeta;
|
|
136
|
+
exports.resolveMetaDescription = resolveMetaDescription;
|
|
137
|
+
exports.resolveMetaExample = resolveMetaExample;
|
|
138
|
+
exports.resolveMetaId = resolveMetaId;
|
|
139
|
+
exports.resolveMetaLinks = resolveMetaLinks;
|
|
140
|
+
exports.resolveMetaName = resolveMetaName;
|
|
141
|
+
exports.resolveMetaTitle = resolveMetaTitle;
|
|
142
|
+
exports.resolveMetaVersion = resolveMetaVersion;
|
package/dist/helpers/meta.mjs
CHANGED
|
@@ -1,2 +1,134 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
2
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
3
|
+
import { uuid } from "@stryke/unique-id/uuid";
|
|
4
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
5
|
+
import { isSchemaOf } from "@power-plant/schema";
|
|
6
|
+
import { stringifyType } from "@power-plant/schema/codegen";
|
|
7
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
8
|
+
import { formatYYYYMMDD } from "@stryke/date/format";
|
|
9
|
+
import { isValidTimestamp } from "@stryke/date/validate";
|
|
10
|
+
import { getUnique } from "@stryke/helpers/get-unique";
|
|
11
|
+
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
12
|
+
import { isDate } from "@stryke/type-checks/is-date";
|
|
13
|
+
import { isNumber } from "@stryke/type-checks/is-number";
|
|
14
|
+
|
|
15
|
+
//#region src/helpers/meta.ts
|
|
16
|
+
function formatMetaVersion(value) {
|
|
17
|
+
return isDate(value) ? formatYYYYMMDD(value) : isNumber(value) ? isValidTimestamp(value) && value > 1e9 ? formatYYYYMMDD(new Date(value)) : value.toString() : isSetString(value) ? value : "1.0";
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Extracts the version information from a given input, which can be a string, number, or Date object. The function returns a string representation of the version in the format "YYYYMMDD" for Date inputs, or as a string for valid timestamp numbers. If the input is a string, it is returned as-is. If the input is invalid or not provided, a default version of "1.0" is returned.
|
|
21
|
+
*
|
|
22
|
+
* @param input - The input from which to extract the version. It can be a string, number, undefined, or Date object.
|
|
23
|
+
* @returns A string representing the extracted version information.
|
|
24
|
+
*/
|
|
25
|
+
function resolveMetaVersion(schema, meta, input) {
|
|
26
|
+
return formatMetaVersion(input ?? meta?.version ?? schema?.version);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolves a metadata name using explicit input, metadata, or schema fallbacks.
|
|
30
|
+
*
|
|
31
|
+
* @param schema - The JSON Schema fragment to read fallback values from.
|
|
32
|
+
* @param meta - Metadata values that may already include a name.
|
|
33
|
+
* @param input - An explicit name value to prioritize when provided.
|
|
34
|
+
* @returns The resolved metadata name.
|
|
35
|
+
*/
|
|
36
|
+
function resolveMetaName(schema, meta, input) {
|
|
37
|
+
return input ?? meta.name ?? (isSetString(schema?.name) ? schema.name : isSetString(schema?.title) ? schema.title : schema.$id ? kebabCase(schema.$id) : stringifyType(schema));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolves a stable metadata identifier in the format `<name>@<version>`.
|
|
41
|
+
*
|
|
42
|
+
* @param schema - The JSON Schema fragment used to infer fallback values.
|
|
43
|
+
* @param meta - Metadata values used to resolve name and version.
|
|
44
|
+
* @returns The resolved metadata identifier, or a generated id when no name is available.
|
|
45
|
+
*/
|
|
46
|
+
function resolveMetaId(schema, meta) {
|
|
47
|
+
const name = resolveMetaName(schema, meta);
|
|
48
|
+
const version = resolveMetaVersion(schema, meta);
|
|
49
|
+
return name ? `${kebabCase(name)}@${version}` : uuid();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Resolves a human-readable display name for metadata.
|
|
53
|
+
*
|
|
54
|
+
* @param schema - The JSON Schema fragment to read fallback display values from.
|
|
55
|
+
* @param meta - Metadata values that may already include a display name.
|
|
56
|
+
* @param input - An explicit display name value to prioritize when provided.
|
|
57
|
+
* @returns The resolved metadata display name.
|
|
58
|
+
*/
|
|
59
|
+
function resolveMetaTitle(schema, meta, input) {
|
|
60
|
+
const value = input ?? meta.title ?? schema?.title;
|
|
61
|
+
if (value !== void 0) return value;
|
|
62
|
+
return titleCase(meta.name ?? stringifyType(schema));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Resolves a metadata description from explicit input, metadata, or schema values.
|
|
66
|
+
*
|
|
67
|
+
* @param template - A template string used to generate a default description when no explicit description is provided.
|
|
68
|
+
* @param schema - The JSON Schema fragment to read fallback description values from.
|
|
69
|
+
* @param meta - Metadata values that may already include a description.
|
|
70
|
+
* @param input - An explicit description value to prioritize when provided.
|
|
71
|
+
* @returns The resolved description, if available.
|
|
72
|
+
*/
|
|
73
|
+
function resolveMetaDescription(template, schema, meta, input) {
|
|
74
|
+
meta.title ??= resolveMetaTitle(schema, meta);
|
|
75
|
+
const title = meta.title ?? "";
|
|
76
|
+
const defaultDescription = template.replaceAll(/\{\s*title\s*\}/g, title);
|
|
77
|
+
const resolved = input ?? meta.description ?? schema?.description;
|
|
78
|
+
return isSetString(resolved) ? resolved : defaultDescription;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Resolves and normalizes metadata examples into a consistent object format.
|
|
82
|
+
*
|
|
83
|
+
* @typeParam TSpec - The schema specification type associated with example values.
|
|
84
|
+
* @param schema - The JSON Schema fragment to read fallback examples from.
|
|
85
|
+
* @param meta - Metadata values that may already include examples.
|
|
86
|
+
* @param input - Explicit examples to prioritize when provided.
|
|
87
|
+
* @returns A normalized list of examples with generated descriptions when needed.
|
|
88
|
+
*/
|
|
89
|
+
function resolveMetaExample(schema, meta, input) {
|
|
90
|
+
const normalizeExamples = (examples) => examples.map((example, i) => isSetString(example) ? {
|
|
91
|
+
name: `example-${i + 1}`,
|
|
92
|
+
description: `Example Specification #${i + 1}`,
|
|
93
|
+
value: example
|
|
94
|
+
} : isSetObject(example) && "value" in example && isSetString(example.value) ? {
|
|
95
|
+
name: `example-${i + 1}`,
|
|
96
|
+
description: example.description || `Example Specification #${i + 1}`,
|
|
97
|
+
value: example.value
|
|
98
|
+
} : void 0).filter(Boolean);
|
|
99
|
+
return normalizeExamples(toArray(input ?? meta.examples ?? schema?.examples ?? []));
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Resolves and de-duplicates metadata links from input, metadata, and schema docs.
|
|
103
|
+
*
|
|
104
|
+
* @param schema - The JSON Schema fragment to read fallback documentation links from.
|
|
105
|
+
* @param meta - Metadata values that may already include links.
|
|
106
|
+
* @param input - Explicit links to prioritize when provided.
|
|
107
|
+
* @returns A unique list of metadata links.
|
|
108
|
+
*/
|
|
109
|
+
function resolveMetaLinks(schema, meta, input) {
|
|
110
|
+
return getUnique(toArray(input).concat(meta.links ?? []).concat(schema?.docs ?? []));
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Extracts and normalizes metadata for a specification based on the provided schema and optional configuration.
|
|
114
|
+
*
|
|
115
|
+
* @param schema - The schema that the specification is expected to conform to.
|
|
116
|
+
* @param config - Optional metadata configuration to extract and normalize.
|
|
117
|
+
* @returns The normalized specification metadata.
|
|
118
|
+
*/
|
|
119
|
+
function resolveMeta(schema, config) {
|
|
120
|
+
const extractedSchema = isSchemaOf(schema) ? schema : schema ?? { schema: {} };
|
|
121
|
+
const meta = {};
|
|
122
|
+
meta.name = resolveMetaName(extractedSchema.schema, meta, config?.name);
|
|
123
|
+
meta.version = resolveMetaVersion(extractedSchema?.schema, meta, config?.version);
|
|
124
|
+
meta.title = resolveMetaTitle(extractedSchema?.schema, meta, config?.title);
|
|
125
|
+
meta.links = resolveMetaLinks(extractedSchema?.schema, meta, config?.links);
|
|
126
|
+
if (config?.deprecated) meta.deprecated = config?.deprecated;
|
|
127
|
+
if (config?.usage) meta.usage = config?.usage;
|
|
128
|
+
if (config?.tags) meta.tags = config?.tags;
|
|
129
|
+
return meta;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
//#endregion
|
|
133
|
+
export { formatMetaVersion, resolveMeta, resolveMetaDescription, resolveMetaExample, resolveMetaId, resolveMetaLinks, resolveMetaName, resolveMetaTitle, resolveMetaVersion };
|
|
2
134
|
//# sourceMappingURL=meta.mjs.map
|
|
@@ -1 +1,46 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/type-checks.ts
|
|
5
|
+
/**
|
|
6
|
+
* Checks if the provided configuration is a {@link GeneratorConfigObject}.
|
|
7
|
+
*
|
|
8
|
+
* @param config - The configuration to check.
|
|
9
|
+
* @returns True if the configuration is a {@link GeneratorConfigObject}, false otherwise.
|
|
10
|
+
*/
|
|
11
|
+
function isGeneratorConfigObject(config) {
|
|
12
|
+
return (0, _stryke_type_checks_is_set_object.isSetObject)(config) && "generator" in config && config.generator !== void 0;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Checks if the provided input is a {@link InputConfigObject}.
|
|
16
|
+
*
|
|
17
|
+
* @param input - The input to check.
|
|
18
|
+
* @returns True if the input is a {@link InputConfigObject}, false otherwise.
|
|
19
|
+
*/
|
|
20
|
+
function isInputConfigObject(input) {
|
|
21
|
+
return (0, _stryke_type_checks_is_set_object.isSetObject)(input) && "input" in input && input.input !== void 0;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Checks if the provided input is a {@link OutputConfigObject}.
|
|
25
|
+
*
|
|
26
|
+
* @param config - The input to check.
|
|
27
|
+
* @returns True if the input is a {@link OutputConfigObject}, false otherwise.
|
|
28
|
+
*/
|
|
29
|
+
function isOutputConfigObject(config) {
|
|
30
|
+
return (0, _stryke_type_checks_is_set_object.isSetObject)(config) && "output" in config && config.output !== void 0;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Checks if the provided configuration is a {@link SchemaConfigObject}.
|
|
34
|
+
*
|
|
35
|
+
* @param config - The configuration to check.
|
|
36
|
+
* @returns True if the configuration is a {@link SchemaConfigObject}, false otherwise.
|
|
37
|
+
*/
|
|
38
|
+
function isSchemaConfigObject(config) {
|
|
39
|
+
return (0, _stryke_type_checks_is_set_object.isSetObject)(config) && "schema" in config && config.schema !== void 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
exports.isGeneratorConfigObject = isGeneratorConfigObject;
|
|
44
|
+
exports.isInputConfigObject = isInputConfigObject;
|
|
45
|
+
exports.isOutputConfigObject = isOutputConfigObject;
|
|
46
|
+
exports.isSchemaConfigObject = isSchemaConfigObject;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as InputConfigObject, R as SchemaConfigObject, f as OutputConfigObject, v as GeneratorConfigObject } from "../config-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { N as InputConfigObject, R as SchemaConfigObject, f as OutputConfigObject, v as GeneratorConfigObject } from "../config-DS1cj7j6.cjs";
|
|
2
|
+
import "../index-DWiKtHVE.cjs";
|
|
3
3
|
//#region src/helpers/type-checks.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Checks if the provided configuration is a {@link GeneratorConfigObject}.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as InputConfigObject, R as SchemaConfigObject, f as OutputConfigObject, v as GeneratorConfigObject } from "../config-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { N as InputConfigObject, R as SchemaConfigObject, f as OutputConfigObject, v as GeneratorConfigObject } from "../config-ZvnnxGt9.mjs";
|
|
2
|
+
import "../index-CWjICo_s.mjs";
|
|
3
3
|
//#region src/helpers/type-checks.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Checks if the provided configuration is a {@link GeneratorConfigObject}.
|
|
@@ -1,2 +1,43 @@
|
|
|
1
|
-
import{isSetObject
|
|
1
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/type-checks.ts
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the provided configuration is a {@link GeneratorConfigObject}.
|
|
6
|
+
*
|
|
7
|
+
* @param config - The configuration to check.
|
|
8
|
+
* @returns True if the configuration is a {@link GeneratorConfigObject}, false otherwise.
|
|
9
|
+
*/
|
|
10
|
+
function isGeneratorConfigObject(config) {
|
|
11
|
+
return isSetObject(config) && "generator" in config && config.generator !== void 0;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Checks if the provided input is a {@link InputConfigObject}.
|
|
15
|
+
*
|
|
16
|
+
* @param input - The input to check.
|
|
17
|
+
* @returns True if the input is a {@link InputConfigObject}, false otherwise.
|
|
18
|
+
*/
|
|
19
|
+
function isInputConfigObject(input) {
|
|
20
|
+
return isSetObject(input) && "input" in input && input.input !== void 0;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Checks if the provided input is a {@link OutputConfigObject}.
|
|
24
|
+
*
|
|
25
|
+
* @param config - The input to check.
|
|
26
|
+
* @returns True if the input is a {@link OutputConfigObject}, false otherwise.
|
|
27
|
+
*/
|
|
28
|
+
function isOutputConfigObject(config) {
|
|
29
|
+
return isSetObject(config) && "output" in config && config.output !== void 0;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Checks if the provided configuration is a {@link SchemaConfigObject}.
|
|
33
|
+
*
|
|
34
|
+
* @param config - The configuration to check.
|
|
35
|
+
* @returns True if the configuration is a {@link SchemaConfigObject}, false otherwise.
|
|
36
|
+
*/
|
|
37
|
+
function isSchemaConfigObject(config) {
|
|
38
|
+
return isSetObject(config) && "schema" in config && config.schema !== void 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { isGeneratorConfigObject, isInputConfigObject, isOutputConfigObject, isSchemaConfigObject };
|
|
2
43
|
//# sourceMappingURL=type-checks.mjs.map
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,34 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_execute = require('./execute-3oK9lgh3.cjs');
|
|
3
|
+
const require_config = require('./config.cjs');
|
|
4
|
+
const require_context = require('./context.cjs');
|
|
5
|
+
const require_define = require('./define.cjs');
|
|
6
|
+
|
|
7
|
+
exports.callAsyncExecution = require_context.callAsyncExecution;
|
|
8
|
+
exports.callAsyncExecutionContext = require_context.callAsyncExecutionContext;
|
|
9
|
+
exports.callAsyncSession = require_context.callAsyncSession;
|
|
10
|
+
exports.callAsyncSessionContext = require_context.callAsyncSessionContext;
|
|
11
|
+
exports.callExecution = require_context.callExecution;
|
|
12
|
+
exports.callExecutionContext = require_context.callExecutionContext;
|
|
13
|
+
exports.callSession = require_context.callSession;
|
|
14
|
+
exports.callSessionContext = require_context.callSessionContext;
|
|
15
|
+
exports.createExecute = require_execute.createExecute;
|
|
16
|
+
exports.defineConfig = require_config.defineConfig;
|
|
17
|
+
exports.defineGenerator = require_define.defineGenerator;
|
|
18
|
+
exports.defineInput = require_define.defineInput;
|
|
19
|
+
exports.defineOutput = require_define.defineOutput;
|
|
20
|
+
exports.defineSchema = require_define.defineSchema;
|
|
21
|
+
exports.execute = require_execute.execute;
|
|
22
|
+
exports.executionAsyncLocalStorage = require_context.executionAsyncLocalStorage;
|
|
23
|
+
exports.executionContext = require_context.executionContext;
|
|
24
|
+
exports.sessionAsyncLocalStorage = require_context.sessionAsyncLocalStorage;
|
|
25
|
+
exports.sessionContext = require_context.sessionContext;
|
|
26
|
+
exports.tryUseExecution = require_context.tryUseExecution;
|
|
27
|
+
exports.tryUseExecutionContext = require_context.tryUseExecutionContext;
|
|
28
|
+
exports.tryUseSession = require_context.tryUseSession;
|
|
29
|
+
exports.tryUseSessionContext = require_context.tryUseSessionContext;
|
|
30
|
+
exports.useContext = require_context.useContext;
|
|
31
|
+
exports.useExecution = require_context.useExecution;
|
|
32
|
+
exports.useExecutionContext = require_context.useExecutionContext;
|
|
33
|
+
exports.useSession = require_context.useSession;
|
|
34
|
+
exports.useSessionContext = require_context.useSessionContext;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as InferCreateInputOptions, B as SchemaMetaExample, C as InferGenerator, D as InferMeta, E as InferInputConfig, F as InputMetaConfig, G as MetaLink, H as BaseMetaConfig, I as InferCreateSchemaOptions, L as Schema, M as InputConfig, N as InputConfigObject, O as InferOutputConfig, P as InputFunction, R as SchemaConfigObject, S as InferCreateGeneratorOptions, T as InferGeneratorResult, U as MetaConfig, V as SchemaOf, W as MetaDeprecated, _ as GeneratorConfig, a as UserConfigFnPromise, b as GeneratorFunctionResult, c as Settings, d as OutputConfig, f as OutputConfigObject, g as Generator, h as GeneratedDocumentChunk, i as UserConfigFnObject, j as Input, k as InferSchemaConfig, l as InferCreateOutputOptions, m as GeneratedDocument, n as UserConfigExport, o as UserConfigParams, p as OutputFunction, r as UserConfigFn, s as Logger, t as UserConfig, u as Output, v as GeneratorConfigObject, w as InferGeneratorFunction, x as GeneratorResult, y as GeneratorFunction, z as SchemaMetaConfig } from "./config-
|
|
1
|
+
import { A as InferCreateInputOptions, B as SchemaMetaExample, C as InferGenerator, D as InferMeta, E as InferInputConfig, F as InputMetaConfig, G as MetaLink, H as BaseMetaConfig, I as InferCreateSchemaOptions, L as Schema, M as InputConfig, N as InputConfigObject, O as InferOutputConfig, P as InputFunction, R as SchemaConfigObject, S as InferCreateGeneratorOptions, T as InferGeneratorResult, U as MetaConfig, V as SchemaOf, W as MetaDeprecated, _ as GeneratorConfig, a as UserConfigFnPromise, b as GeneratorFunctionResult, c as Settings, d as OutputConfig, f as OutputConfigObject, g as Generator, h as GeneratedDocumentChunk, i as UserConfigFnObject, j as Input, k as InferSchemaConfig, l as InferCreateOutputOptions, m as GeneratedDocument, n as UserConfigExport, o as UserConfigParams, p as OutputFunction, r as UserConfigFn, s as Logger, t as UserConfig, u as Output, v as GeneratorConfigObject, w as InferGeneratorFunction, x as GeneratorResult, y as GeneratorFunction, z as SchemaMetaConfig } from "./config-DS1cj7j6.cjs";
|
|
2
2
|
import { defineConfig } from "./config.cjs";
|
|
3
|
-
import { a as InferExecuteOptions, i as ExecutionResult, n as Execution, r as ExecutionMeta, t as ExecuteFunction } from "./execution-
|
|
4
|
-
import { a as Base, i as Session, n as LocalStore, r as SessionContext, t as ExecutionContext } from "./context-
|
|
3
|
+
import { a as InferExecuteOptions, i as ExecutionResult, n as Execution, r as ExecutionMeta, t as ExecuteFunction } from "./execution-vXX_IEkO.cjs";
|
|
4
|
+
import { a as Base, i as Session, n as LocalStore, r as SessionContext, t as ExecutionContext } from "./context-DSkOqDWy.cjs";
|
|
5
5
|
import { ContextStore, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useContext, useExecution, useExecutionContext, useSession, useSessionContext } from "./context.cjs";
|
|
6
6
|
import { defineGenerator, defineInput, defineOutput, defineSchema } from "./define.cjs";
|
|
7
7
|
import { createExecute, execute } from "./execute.cjs";
|
|
8
|
-
import "./index-
|
|
8
|
+
import "./index-DWiKtHVE.cjs";
|
|
9
9
|
export { type Base, type BaseMetaConfig, ContextStore, type ExecuteFunction, type Execution, type ExecutionContext, type ExecutionMeta, type ExecutionResult, type GeneratedDocument, type GeneratedDocumentChunk, type Generator, type GeneratorConfig, type GeneratorConfigObject, type GeneratorFunction, type GeneratorFunctionResult, type GeneratorResult, type InferCreateGeneratorOptions, type InferCreateInputOptions, type InferCreateOutputOptions, type InferCreateSchemaOptions, type InferExecuteOptions, type InferGenerator, type InferGeneratorFunction, type InferGeneratorResult, type InferInputConfig, type InferMeta, type InferOutputConfig, type InferSchemaConfig, type Input, type InputConfig, type InputConfigObject, type InputFunction, type InputMetaConfig, type LocalStore, type Logger, type MetaConfig, type MetaDeprecated, type MetaLink, type Output, type OutputConfig, type OutputConfigObject, type OutputFunction, type Schema, type SchemaConfigObject, type SchemaMetaConfig, type SchemaMetaExample, type SchemaOf, type Session, type SessionContext, type Settings, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, createExecute, defineConfig, defineGenerator, defineInput, defineOutput, defineSchema, execute, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useContext, useExecution, useExecutionContext, useSession, useSessionContext };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as InferCreateInputOptions, B as SchemaMetaExample, C as InferGenerator, D as InferMeta, E as InferInputConfig, F as InputMetaConfig, G as MetaLink, H as BaseMetaConfig, I as InferCreateSchemaOptions, L as Schema, M as InputConfig, N as InputConfigObject, O as InferOutputConfig, P as InputFunction, R as SchemaConfigObject, S as InferCreateGeneratorOptions, T as InferGeneratorResult, U as MetaConfig, V as SchemaOf, W as MetaDeprecated, _ as GeneratorConfig, a as UserConfigFnPromise, b as GeneratorFunctionResult, c as Settings, d as OutputConfig, f as OutputConfigObject, g as Generator, h as GeneratedDocumentChunk, i as UserConfigFnObject, j as Input, k as InferSchemaConfig, l as InferCreateOutputOptions, m as GeneratedDocument, n as UserConfigExport, o as UserConfigParams, p as OutputFunction, r as UserConfigFn, s as Logger, t as UserConfig, u as Output, v as GeneratorConfigObject, w as InferGeneratorFunction, x as GeneratorResult, y as GeneratorFunction, z as SchemaMetaConfig } from "./config-
|
|
1
|
+
import { A as InferCreateInputOptions, B as SchemaMetaExample, C as InferGenerator, D as InferMeta, E as InferInputConfig, F as InputMetaConfig, G as MetaLink, H as BaseMetaConfig, I as InferCreateSchemaOptions, L as Schema, M as InputConfig, N as InputConfigObject, O as InferOutputConfig, P as InputFunction, R as SchemaConfigObject, S as InferCreateGeneratorOptions, T as InferGeneratorResult, U as MetaConfig, V as SchemaOf, W as MetaDeprecated, _ as GeneratorConfig, a as UserConfigFnPromise, b as GeneratorFunctionResult, c as Settings, d as OutputConfig, f as OutputConfigObject, g as Generator, h as GeneratedDocumentChunk, i as UserConfigFnObject, j as Input, k as InferSchemaConfig, l as InferCreateOutputOptions, m as GeneratedDocument, n as UserConfigExport, o as UserConfigParams, p as OutputFunction, r as UserConfigFn, s as Logger, t as UserConfig, u as Output, v as GeneratorConfigObject, w as InferGeneratorFunction, x as GeneratorResult, y as GeneratorFunction, z as SchemaMetaConfig } from "./config-ZvnnxGt9.mjs";
|
|
2
2
|
import { defineConfig } from "./config.mjs";
|
|
3
|
-
import { a as InferExecuteOptions, i as ExecutionResult, n as Execution, r as ExecutionMeta, t as ExecuteFunction } from "./execution-
|
|
4
|
-
import { a as Base, i as Session, n as LocalStore, r as SessionContext, t as ExecutionContext } from "./context-
|
|
3
|
+
import { a as InferExecuteOptions, i as ExecutionResult, n as Execution, r as ExecutionMeta, t as ExecuteFunction } from "./execution-BaOcMIgV.mjs";
|
|
4
|
+
import { a as Base, i as Session, n as LocalStore, r as SessionContext, t as ExecutionContext } from "./context-DMA3S81W.mjs";
|
|
5
5
|
import { ContextStore, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useContext, useExecution, useExecutionContext, useSession, useSessionContext } from "./context.mjs";
|
|
6
6
|
import { defineGenerator, defineInput, defineOutput, defineSchema } from "./define.mjs";
|
|
7
7
|
import { createExecute, execute } from "./execute.mjs";
|
|
8
|
-
import "./index-
|
|
8
|
+
import "./index-CWjICo_s.mjs";
|
|
9
9
|
export { type Base, type BaseMetaConfig, ContextStore, type ExecuteFunction, type Execution, type ExecutionContext, type ExecutionMeta, type ExecutionResult, type GeneratedDocument, type GeneratedDocumentChunk, type Generator, type GeneratorConfig, type GeneratorConfigObject, type GeneratorFunction, type GeneratorFunctionResult, type GeneratorResult, type InferCreateGeneratorOptions, type InferCreateInputOptions, type InferCreateOutputOptions, type InferCreateSchemaOptions, type InferExecuteOptions, type InferGenerator, type InferGeneratorFunction, type InferGeneratorResult, type InferInputConfig, type InferMeta, type InferOutputConfig, type InferSchemaConfig, type Input, type InputConfig, type InputConfigObject, type InputFunction, type InputMetaConfig, type LocalStore, type Logger, type MetaConfig, type MetaDeprecated, type MetaLink, type Output, type OutputConfig, type OutputConfigObject, type OutputFunction, type Schema, type SchemaConfigObject, type SchemaMetaConfig, type SchemaMetaExample, type SchemaOf, type Session, type SessionContext, type Settings, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, createExecute, defineConfig, defineGenerator, defineInput, defineOutput, defineSchema, execute, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useContext, useExecution, useExecutionContext, useSession, useSessionContext };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineConfig } from "./config.mjs";
|
|
2
|
+
import { callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useContext, useExecution, useExecutionContext, useSession, useSessionContext } from "./context.mjs";
|
|
3
|
+
import { defineGenerator, defineInput, defineOutput, defineSchema } from "./define.mjs";
|
|
4
|
+
import { n as execute, t as createExecute } from "./execute-C6kyFG8N.mjs";
|
|
5
|
+
|
|
6
|
+
export { callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, createExecute, defineConfig, defineGenerator, defineInput, defineOutput, defineSchema, execute, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useContext, useExecution, useExecutionContext, useSession, useSessionContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta-DAeqzHmR.d.cts","names":[],"sources":["config-
|
|
1
|
+
{"version":3,"file":"meta-DAeqzHmR.d.cts","names":[],"sources":["config-DS1cj7j6.d.cts","config.d.cts","execution-vXX_IEkO.d.cts","context-DSkOqDWy.d.cts","context.d.cts","define.d.cts","execute.d.cts","index-DWiKtHVE.d.cts","index.d.cts","../src/helpers/meta.ts"],"mappings":";;;;;;;;iBSwCgB,kBAAkB,yBAAyB;;;;;;;iBAkB3C,mBACd,QAAQ,YACR,MAAM,QAAQ,aACd,0BAA0B;;;;;;;;;iBAeZ,gBACd,QAAQ,YACR,MAAM,QAAQ,aACd;;;;;;;;iBAsBc,cACd,QAAQ,YACR,MAAM,QAAQ;;;;;;;;;iBAgBA,iBACd,QAAQ,YACR,MAAM,QAAQ,aACd;;;;;;;;;;iBAmBc,uBACd,kBACA,QAAQ,YACR,MAAM,QAAQ,aACd;;;;;;;;;;iBAoBc,mBAAmB,OACjC,QAAQ,YACR,MAAM,QAAQ,iBAAiB,SAC/B,QAAQ,kBAAkB,SAAS,kBAAkB,WACpD,kBAAkB;;;;;;;;;iBAsCL,iBACd,QAAQ,YACR,MAAM,QAAQ,aACd,QAAQ,aACP;;;;;;;;iBAea,YAAY,OAC1B,QAAQ,wBAAwB,SAAS,SAAS,QAClD,SAAS,aACR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@power-plant/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "☢️ Generate anything from a specification",
|
|
6
6
|
"keywords": ["power-plant", "storm-software"],
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"typings": "dist/index.d.mts",
|
|
161
161
|
"files": ["dist"],
|
|
162
162
|
"dependencies": {
|
|
163
|
-
"@power-plant/schema": "^0.0.
|
|
163
|
+
"@power-plant/schema": "^0.0.28",
|
|
164
164
|
"@stryke/string-format": "^0.17.38",
|
|
165
165
|
"@stryke/type-checks": "^0.6.29",
|
|
166
166
|
"@stryke/types": "^0.12.24",
|
|
@@ -179,10 +179,10 @@
|
|
|
179
179
|
"unstorage": "^1.17.5"
|
|
180
180
|
},
|
|
181
181
|
"devDependencies": {
|
|
182
|
-
"@powerlines/plugin-tsdown": "^0.1.
|
|
182
|
+
"@powerlines/plugin-tsdown": "^0.1.552",
|
|
183
183
|
"@types/node": "^25.9.5",
|
|
184
184
|
"typescript": "^6.0.3"
|
|
185
185
|
},
|
|
186
186
|
"publishConfig": { "access": "public" },
|
|
187
|
-
"gitHead": "
|
|
187
|
+
"gitHead": "ac566f959bb90c0ea2812e4996e24e6173de52a1"
|
|
188
188
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-DjOTmKJ-.d.cts","names":[],"sources":["../src/types/meta.ts","../src/types/schema.ts","../src/types/input.ts","../src/types/generator.ts","../src/types/output.ts","../src/types/settings.ts","../src/types/config.ts"],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-BWBu3ZGQ.d.mts","names":[],"sources":["../src/types/base.ts","../src/types/session.ts","../src/types/context.ts"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require("./context.cjs"),l=require("./helpers/type-checks.cjs"),u=require("./helpers/meta.cjs");let d=require("@stryke/unique-id/uuid"),f=require("@stryke/env/get-env-paths"),p=require("@stryke/fs/read-file"),m=require("@stryke/fs/write-file"),h=require("@stryke/path/join-paths"),g=require("@stryke/type-checks/is-set-string"),_=require("defu");_=s(_,1);let v=require("node:os");v=s(v,1);let y=require("unstorage"),b=require("unstorage/drivers/fs-lite");b=s(b,1);let x=require("@power-plant/schema/storage"),S=require("@stryke/resolve/load"),C=require("@stryke/type-checks/is-function"),w=require("@power-plant/schema"),T=require("@stryke/resolve/type-checks");const E={debug:console.debug,info:console.info,warn:console.warn,error:console.error},D=(0,f.getEnvPaths)({appId:`power-plant`,orgId:`storm-software`});async function O(e={}){let t=e.cwd||process.cwd(),n=new Date,r=(0,y.createStorage)({driver:(0,b.default)({base:t})}),i=JSON.parse(await(0,p.readFileIfExisting)((0,h.joinPaths)(D.data,`.local-store.json`))||`{}`),a=i.device||v.default.hostname()||(0,d.uuid)(),o=i.user||v.default.userInfo().username||(0,d.uuid)();return(!(0,g.isSetString)(i.device)||!(0,g.isSetString)(i.user))&&await(0,m.writeFile)((0,h.joinPaths)(D.data,`.local-store.json`),JSON.stringify({device:a,user:o},null,2)),(0,_.default)({cwd:t,session:{id:(0,d.uuid)(),createdAt:n,updatedAt:n,device:a,user:o,executions:[]}},e,{storage:r,settings:{},logger:E})}async function k(e,t,n,r,i,a){let o={},s=(e,t)=>{(0,g.isSetString)(e)?o[e]=(0,_.default)({path:e},t,{chunks:[],meta:{}}):o[e.path]=(0,_.default)(e,t)},c,l={...t,id:e,createdAt:new Date,updatedAt:new Date,options:n,schema:r,input:i,output:a,documents:o,spec(){if(!c)throw Error(`The specification was accessed prior to the input processing.`);return c},addDocument:s,meta:{id:e,executedAt:new Date,executedBy:``}};return Object.defineProperty(l,"~spec",{get(){return c},set(e){c=e},enumerable:!1}),l}async function A(e,t,n){return e}function j(e,t){let n=e?.schema??{},r=u.resolveMeta(e,t);return r.description=u.resolveMetaDescription(`Accepts a ${r.title??``} specification and processes it with a {title} sink.`,n,r,t?.description),r.examples=u.resolveMetaExample(n,r,t?.examples),r}async function M(e,t={}){let{meta:n,schema:r}=l.isSchemaConfigObject(e)?e:{schema:e,meta:{}},i=await(0,w.extractSchemaWithSource)(r,t);return{...i,meta:j(i,n)}}function N(e,t,n){t&&t.schema!==e&&(0,w.assertSchemasDoNotContradict)(e.schema,t.schema.schema,`input`),n&&n.schema!==e&&(0,w.assertSchemasDoNotContradict)(e.schema,n.schema.schema,`output`)}function P(e,t){let n=e?.schema??{},r=u.resolveMeta(e,t);return r.description=u.resolveMetaDescription(`Determines the ${r.title??``} specification from a {title} input.`,n,r,t?.description),r}async function F(e,t,n={}){let{input:r,meta:i,schema:a}=l.isInputConfigObject(t)?t:{input:t,meta:{}},o=e;if(a){let t;if((0,T.isLoadReference)(a))try{t=await(0,S.load)(a,n)}catch{}else t=a;t&&(o=await M(t,n),o.schema=(0,w.mergeMetadata)(o.schema,e.schema))}let s;if((0,T.isLoadReference)(r))try{let e=await(0,S.load)(r,n);s=l.isInputConfigObject(e)?await F(o,e.input,n).then(e=>e.input):e}catch{}return s||=r,{schema:o,input:s,meta:P(o,i)}}function I(e,t){let n=e?.schema??{},r=u.resolveMeta(e,t);return r.description=u.resolveMetaDescription(`Accepts a ${r.title??``} specification and processes it with a {title} output.`,n,r,t?.description),r}async function L(e,t,n={}){let{output:r,meta:i,schema:a}=l.isOutputConfigObject(t)?t:{output:t,meta:{}},o=e;if(a){let t;if((0,T.isLoadReference)(a))try{t=await(0,S.load)(a,n)}catch{}else t=a;t&&(o=await M(t,n),o.schema=(0,w.mergeMetadata)(o.schema,e.schema))}let s;if((0,T.isLoadReference)(r))try{let e=await(0,S.load)(r,n);s=l.isOutputConfigObject(e)?await L(o,e.output,n).then(e=>e.output):e}catch{}return s||=r,{schema:o,output:s,meta:I(o,i)}}async function R(e,t,n,r={}){let i;i=l.isGeneratorConfigObject(n)?n:await(0,S.load)(n,{fs:(0,x.mapStorageToFileSystem)(t.storage),...r}),i.schema||={type:`any`};let a=await M(i.schema,{storage:t.storage,tsconfig:r.tsconfig,...r}),o=i.input;if(!o)if(r.inputPath)o=`@power-plant/unstorage-input`;else throw Error("No input configuration provided. Please provide an input configuration, a valid specification, or a `inputPath` option that points to a valid input file.");let s=i.output;s||=`@power-plant/unstorage-output`;let[u,d]=await Promise.all([F(a,o,{storage:t.storage,...r}),L(a,s,{storage:t.storage,...r})]);return N(a,u,d),{meta:i.meta,schema:a,input:u,output:d,generator:async n=>{let r=await k(e,t,n,a,u,d);return c.callAsyncExecutionContext(r,async()=>{let e=(0,C.isFunction)(u.input)?await u.input({storage:r.storage,...n}):u.input;r[`~spec`]=e;let t;t=(0,C.isFunction)(i.generator)?i.generator:await(0,S.load)(i.generator,{storage:r.storage,...n});let a=await t(e,n);return{spec:e,options:n,documents:a,returns:await d.output(e,n,a)}})}}}async function z(e={}){let t=await O(e);return async(e,n={})=>c.callAsyncSessionContext(t,async()=>{let r=(0,d.uuid)(),{generator:i}=await R(r,t,e,n),{documents:a,returns:o,spec:s,options:c}=await i(n),l=await A({documents:Object.fromEntries(Object.entries(a).map(([e,t])=>[e,{...t,path:e,meta:{executionId:r}}])),meta:{executionId:r,executedAt:new Date,executedBy:t.session.user}},s,c);return t.session.executions.push(l),o})}async function B(e,t={}){return(await z(t))(e,t)}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return z}});
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{callAsyncExecutionContext as e,callAsyncSessionContext as t}from"./context.mjs";import{isGeneratorConfigObject as n,isInputConfigObject as r,isOutputConfigObject as i,isSchemaConfigObject as a}from"./helpers/type-checks.mjs";import{resolveMeta as o,resolveMetaDescription as s,resolveMetaExample as c}from"./helpers/meta.mjs";import{uuid as l}from"@stryke/unique-id/uuid";import{getEnvPaths as u}from"@stryke/env/get-env-paths";import{readFileIfExisting as d}from"@stryke/fs/read-file";import{writeFile as f}from"@stryke/fs/write-file";import{joinPaths as p}from"@stryke/path/join-paths";import{isSetString as m}from"@stryke/type-checks/is-set-string";import h from"defu";import g from"node:os";import{createStorage as _}from"unstorage";import v from"unstorage/drivers/fs-lite";import{mapStorageToFileSystem as y}from"@power-plant/schema/storage";import{load as b}from"@stryke/resolve/load";import{isFunction as x}from"@stryke/type-checks/is-function";import{assertSchemasDoNotContradict as S,extractSchemaWithSource as C,mergeMetadata as w}from"@power-plant/schema";import{isLoadReference as T}from"@stryke/resolve/type-checks";const E={debug:console.debug,info:console.info,warn:console.warn,error:console.error},D=u({appId:`power-plant`,orgId:`storm-software`});async function O(e={}){let t=e.cwd||process.cwd(),n=new Date,r=_({driver:v({base:t})}),i=JSON.parse(await d(p(D.data,`.local-store.json`))||`{}`),a=i.device||g.hostname()||l(),o=i.user||g.userInfo().username||l();return(!m(i.device)||!m(i.user))&&await f(p(D.data,`.local-store.json`),JSON.stringify({device:a,user:o},null,2)),h({cwd:t,session:{id:l(),createdAt:n,updatedAt:n,device:a,user:o,executions:[]}},e,{storage:r,settings:{},logger:E})}async function k(e,t,n,r,i,a){let o={},s=(e,t)=>{m(e)?o[e]=h({path:e},t,{chunks:[],meta:{}}):o[e.path]=h(e,t)},c,l={...t,id:e,createdAt:new Date,updatedAt:new Date,options:n,schema:r,input:i,output:a,documents:o,spec(){if(!c)throw Error(`The specification was accessed prior to the input processing.`);return c},addDocument:s,meta:{id:e,executedAt:new Date,executedBy:``}};return Object.defineProperty(l,"~spec",{get(){return c},set(e){c=e},enumerable:!1}),l}async function A(e,t,n){return e}function j(e,t){let n=e?.schema??{},r=o(e,t);return r.description=s(`Accepts a ${r.title??``} specification and processes it with a {title} sink.`,n,r,t?.description),r.examples=c(n,r,t?.examples),r}async function M(e,t={}){let{meta:n,schema:r}=a(e)?e:{schema:e,meta:{}},i=await C(r,t);return{...i,meta:j(i,n)}}function N(e,t,n){t&&t.schema!==e&&S(e.schema,t.schema.schema,`input`),n&&n.schema!==e&&S(e.schema,n.schema.schema,`output`)}function P(e,t){let n=e?.schema??{},r=o(e,t);return r.description=s(`Determines the ${r.title??``} specification from a {title} input.`,n,r,t?.description),r}async function F(e,t,n={}){let{input:i,meta:a,schema:o}=r(t)?t:{input:t,meta:{}},s=e;if(o){let t;if(T(o))try{t=await b(o,n)}catch{}else t=o;t&&(s=await M(t,n),s.schema=w(s.schema,e.schema))}let c;if(T(i))try{let e=await b(i,n);c=r(e)?await F(s,e.input,n).then(e=>e.input):e}catch{}return c||=i,{schema:s,input:c,meta:P(s,a)}}function I(e,t){let n=e?.schema??{},r=o(e,t);return r.description=s(`Accepts a ${r.title??``} specification and processes it with a {title} output.`,n,r,t?.description),r}async function L(e,t,n={}){let{output:r,meta:a,schema:o}=i(t)?t:{output:t,meta:{}},s=e;if(o){let t;if(T(o))try{t=await b(o,n)}catch{}else t=o;t&&(s=await M(t,n),s.schema=w(s.schema,e.schema))}let c;if(T(r))try{let e=await b(r,n);c=i(e)?await L(s,e.output,n).then(e=>e.output):e}catch{}return c||=r,{schema:s,output:c,meta:I(s,a)}}async function R(t,r,i,a={}){let o;o=n(i)?i:await b(i,{fs:y(r.storage),...a}),o.schema||={type:`any`};let s=await M(o.schema,{storage:r.storage,tsconfig:a.tsconfig,...a}),c=o.input;if(!c)if(a.inputPath)c=`@power-plant/unstorage-input`;else throw Error("No input configuration provided. Please provide an input configuration, a valid specification, or a `inputPath` option that points to a valid input file.");let l=o.output;l||=`@power-plant/unstorage-output`;let[u,d]=await Promise.all([F(s,c,{storage:r.storage,...a}),L(s,l,{storage:r.storage,...a})]);return N(s,u,d),{meta:o.meta,schema:s,input:u,output:d,generator:async n=>{let i=await k(t,r,n,s,u,d);return e(i,async()=>{let e=x(u.input)?await u.input({storage:i.storage,...n}):u.input;i[`~spec`]=e;let t;t=x(o.generator)?o.generator:await b(o.generator,{storage:i.storage,...n});let r=await t(e,n);return{spec:e,options:n,documents:r,returns:await d.output(e,n,r)}})}}}async function z(e={}){let n=await O(e);return async(e,r={})=>t(n,async()=>{let t=l(),{generator:i}=await R(t,n,e,r),{documents:a,returns:o,spec:s,options:c}=await i(r),u=await A({documents:Object.fromEntries(Object.entries(a).map(([e,n])=>[e,{...n,path:e,meta:{executionId:t}}])),meta:{executionId:t,executedAt:new Date,executedBy:n.session.user}},s,c);return n.session.executions.push(u),o})}async function B(e,t={}){return(await z(t))(e,t)}export{B as n,z as t};
|
|
2
|
-
//# sourceMappingURL=execute-ByonuMsd.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"execute-ByonuMsd.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"execution-Bb3uSrmc.d.mts","names":[],"sources":["../src/types/execution.ts"],"mappings":""}
|