@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 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
- const value = resolved[key];
835
+ let value = resolved[key];
816
836
  const format = getSchemaFormat(propSchema);
817
- if (!format)
818
- continue;
819
- let resolver = resolvers.get(format);
820
- if (!resolver) {
821
- const prefix = getFormatPrefix(format);
822
- resolver = resolvers.get(prefix);
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 (!resolver)
825
- continue;
826
- if (typeof value === "string") {
827
- resolved[key] = await resolver(value, format, config.registry);
828
- } else if (Array.isArray(value) && value.every((item) => typeof item === "string")) {
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 === true) {
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 === true) {
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=2417CE87582BE09664756E2164756E21
6197
+ //# debugId=37803F0FAA4C120464756E2164756E21