@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/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)) {
@@ -6167,4 +6195,4 @@ export {
6167
6195
  ConditionalTask
6168
6196
  };
6169
6197
 
6170
- //# debugId=8E9465F7037F297B64756E2164756E21
6198
+ //# debugId=AA716C41A75EE12C64756E2164756E21