@workglow/task-graph 0.0.103 → 0.0.104
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/browser.js +45 -17
- package/dist/browser.js.map +4 -4
- package/dist/bun.js +45 -17
- package/dist/bun.js.map +4 -4
- package/dist/node.js +45 -17
- package/dist/node.js.map +4 -4
- package/dist/task/InputResolver.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/node.js
CHANGED
|
@@ -799,6 +799,26 @@ function getSchemaFormat(schema) {
|
|
|
799
799
|
}
|
|
800
800
|
return;
|
|
801
801
|
}
|
|
802
|
+
function getObjectSchema(schema) {
|
|
803
|
+
if (typeof schema !== "object" || schema === null)
|
|
804
|
+
return;
|
|
805
|
+
const s = schema;
|
|
806
|
+
if (s.type === "object" && s.properties && typeof s.properties === "object") {
|
|
807
|
+
return s;
|
|
808
|
+
}
|
|
809
|
+
const variants = s.oneOf ?? s.anyOf;
|
|
810
|
+
if (Array.isArray(variants)) {
|
|
811
|
+
for (const variant of variants) {
|
|
812
|
+
if (typeof variant === "object" && variant !== null) {
|
|
813
|
+
const v = variant;
|
|
814
|
+
if (v.type === "object" && v.properties && typeof v.properties === "object") {
|
|
815
|
+
return v;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
802
822
|
function getFormatPrefix(format) {
|
|
803
823
|
const colonIndex = format.indexOf(":");
|
|
804
824
|
return colonIndex >= 0 ? format.substring(0, colonIndex) : format;
|
|
@@ -812,22 +832,30 @@ async function resolveSchemaInputs(input, schema, config) {
|
|
|
812
832
|
const resolvers = getInputResolvers();
|
|
813
833
|
const resolved = { ...input };
|
|
814
834
|
for (const [key, propSchema] of Object.entries(properties)) {
|
|
815
|
-
|
|
835
|
+
let value = resolved[key];
|
|
816
836
|
const format = getSchemaFormat(propSchema);
|
|
817
|
-
if (
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
837
|
+
if (format) {
|
|
838
|
+
let resolver = resolvers.get(format);
|
|
839
|
+
if (!resolver) {
|
|
840
|
+
const prefix = getFormatPrefix(format);
|
|
841
|
+
resolver = resolvers.get(prefix);
|
|
842
|
+
}
|
|
843
|
+
if (resolver) {
|
|
844
|
+
if (typeof value === "string") {
|
|
845
|
+
value = await resolver(value, format, config.registry);
|
|
846
|
+
resolved[key] = value;
|
|
847
|
+
} else if (Array.isArray(value) && value.every((item) => typeof item === "string")) {
|
|
848
|
+
const results = await Promise.all(value.map((item) => resolver(item, format, config.registry)));
|
|
849
|
+
value = results.filter((result) => result !== undefined);
|
|
850
|
+
resolved[key] = value;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
823
853
|
}
|
|
824
|
-
if (!
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
const results = await Promise.all(value.map((item) => resolver(item, format, config.registry)));
|
|
830
|
-
resolved[key] = results.filter((result) => result !== undefined);
|
|
854
|
+
if (value !== null && value !== undefined && typeof value === "object" && !Array.isArray(value)) {
|
|
855
|
+
const objectSchema = getObjectSchema(propSchema);
|
|
856
|
+
if (objectSchema) {
|
|
857
|
+
resolved[key] = await resolveSchemaInputs(value, objectSchema, config);
|
|
858
|
+
}
|
|
831
859
|
}
|
|
832
860
|
}
|
|
833
861
|
return resolved;
|
|
@@ -1475,7 +1503,7 @@ class Task {
|
|
|
1475
1503
|
this.runInputData[inputId] = prop.default;
|
|
1476
1504
|
}
|
|
1477
1505
|
}
|
|
1478
|
-
if (schema.additionalProperties
|
|
1506
|
+
if (schema.additionalProperties) {
|
|
1479
1507
|
for (const [inputId, value] of Object.entries(input)) {
|
|
1480
1508
|
if (!(inputId in properties)) {
|
|
1481
1509
|
this.runInputData[inputId] = value;
|
|
@@ -1528,7 +1556,7 @@ class Task {
|
|
|
1528
1556
|
}
|
|
1529
1557
|
}
|
|
1530
1558
|
}
|
|
1531
|
-
if (inputSchema.additionalProperties
|
|
1559
|
+
if (inputSchema.additionalProperties) {
|
|
1532
1560
|
for (const [inputId, value] of Object.entries(overrides)) {
|
|
1533
1561
|
if (!(inputId in properties)) {
|
|
1534
1562
|
if (!deepEqual(this.runInputData[inputId], value)) {
|
|
@@ -6166,4 +6194,4 @@ export {
|
|
|
6166
6194
|
ConditionalTask
|
|
6167
6195
|
};
|
|
6168
6196
|
|
|
6169
|
-
//# debugId=
|
|
6197
|
+
//# debugId=CAEDE44FEB7E806964756E2164756E21
|