@workglow/task-graph 0.0.103 → 0.0.105

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/bun.js CHANGED
@@ -800,6 +800,26 @@ function getSchemaFormat(schema) {
800
800
  }
801
801
  return;
802
802
  }
803
+ function getObjectSchema(schema) {
804
+ if (typeof schema !== "object" || schema === null)
805
+ return;
806
+ const s = schema;
807
+ if (s.type === "object" && s.properties && typeof s.properties === "object") {
808
+ return s;
809
+ }
810
+ const variants = s.oneOf ?? s.anyOf;
811
+ if (Array.isArray(variants)) {
812
+ for (const variant of variants) {
813
+ if (typeof variant === "object" && variant !== null) {
814
+ const v = variant;
815
+ if (v.type === "object" && v.properties && typeof v.properties === "object") {
816
+ return v;
817
+ }
818
+ }
819
+ }
820
+ }
821
+ return;
822
+ }
803
823
  function getFormatPrefix(format) {
804
824
  const colonIndex = format.indexOf(":");
805
825
  return colonIndex >= 0 ? format.substring(0, colonIndex) : format;
@@ -813,22 +833,30 @@ async function resolveSchemaInputs(input, schema, config) {
813
833
  const resolvers = getInputResolvers();
814
834
  const resolved = { ...input };
815
835
  for (const [key, propSchema] of Object.entries(properties)) {
816
- const value = resolved[key];
836
+ let value = resolved[key];
817
837
  const format = getSchemaFormat(propSchema);
818
- if (!format)
819
- continue;
820
- let resolver = resolvers.get(format);
821
- if (!resolver) {
822
- const prefix = getFormatPrefix(format);
823
- resolver = resolvers.get(prefix);
838
+ if (format) {
839
+ let resolver = resolvers.get(format);
840
+ if (!resolver) {
841
+ const prefix = getFormatPrefix(format);
842
+ resolver = resolvers.get(prefix);
843
+ }
844
+ if (resolver) {
845
+ if (typeof value === "string") {
846
+ value = await resolver(value, format, config.registry);
847
+ resolved[key] = value;
848
+ } else if (Array.isArray(value) && value.every((item) => typeof item === "string")) {
849
+ const results = await Promise.all(value.map((item) => resolver(item, format, config.registry)));
850
+ value = results.filter((result) => result !== undefined);
851
+ resolved[key] = value;
852
+ }
853
+ }
824
854
  }
825
- if (!resolver)
826
- continue;
827
- if (typeof value === "string") {
828
- resolved[key] = await resolver(value, format, config.registry);
829
- } else if (Array.isArray(value) && value.every((item) => typeof item === "string")) {
830
- const results = await Promise.all(value.map((item) => resolver(item, format, config.registry)));
831
- resolved[key] = results.filter((result) => result !== undefined);
855
+ if (value !== null && value !== undefined && typeof value === "object" && !Array.isArray(value)) {
856
+ const objectSchema = getObjectSchema(propSchema);
857
+ if (objectSchema) {
858
+ resolved[key] = await resolveSchemaInputs(value, objectSchema, config);
859
+ }
832
860
  }
833
861
  }
834
862
  return resolved;
@@ -1476,7 +1504,7 @@ class Task {
1476
1504
  this.runInputData[inputId] = prop.default;
1477
1505
  }
1478
1506
  }
1479
- if (schema.additionalProperties === true) {
1507
+ if (schema.additionalProperties) {
1480
1508
  for (const [inputId, value] of Object.entries(input)) {
1481
1509
  if (!(inputId in properties)) {
1482
1510
  this.runInputData[inputId] = value;
@@ -1529,7 +1557,7 @@ class Task {
1529
1557
  }
1530
1558
  }
1531
1559
  }
1532
- if (inputSchema.additionalProperties === true) {
1560
+ if (inputSchema.additionalProperties) {
1533
1561
  for (const [inputId, value] of Object.entries(overrides)) {
1534
1562
  if (!(inputId in properties)) {
1535
1563
  if (!deepEqual(this.runInputData[inputId], value)) {
@@ -2251,13 +2279,24 @@ class TaskGraphRunner {
2251
2279
  const dataflows = this.graph.getTargetDataflows(node.id);
2252
2280
  for (const dataflow of dataflows) {
2253
2281
  const compatibility = dataflow.semanticallyCompatible(this.graph, dataflow);
2282
+ getLogger3().debug("pushOutputFromNodeToEdges", {
2283
+ dataflowId: dataflow.id,
2284
+ compatibility,
2285
+ resultsKeys: Object.keys(results)
2286
+ });
2254
2287
  if (compatibility === "static") {
2255
2288
  dataflow.setPortData(results);
2256
2289
  } else if (compatibility === "runtime") {
2257
2290
  const task = this.graph.getTask(dataflow.targetTaskId);
2258
2291
  const narrowed = await task.narrowInput({ ...results }, this.registry);
2259
2292
  dataflow.setPortData(narrowed);
2260
- } else {}
2293
+ } else {
2294
+ getLogger3().warn("pushOutputFromNodeToEdges", {
2295
+ dataflowId: dataflow.id,
2296
+ compatibility,
2297
+ resultsKeys: Object.keys(results)
2298
+ });
2299
+ }
2261
2300
  }
2262
2301
  }
2263
2302
  pushStatusFromNodeToEdges(graph, node, status) {
@@ -6167,4 +6206,4 @@ export {
6167
6206
  ConditionalTask
6168
6207
  };
6169
6208
 
6170
- //# debugId=8E9465F7037F297B64756E2164756E21
6209
+ //# debugId=8EA5D80CC8C0A35064756E2164756E21