@workglow/task-graph 0.2.7 → 0.2.9

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
@@ -567,29 +567,31 @@ function scanGraphForFormat(graph, targetFormat) {
567
567
  function scanGraphForCredentials(graph) {
568
568
  const credentialFormats = new Set;
569
569
  for (const task of graph.getTasks()) {
570
- collectCredentialFormats(task.inputSchema(), credentialFormats);
571
- collectCredentialFormats(task.configSchema(), credentialFormats);
570
+ collectUsedCredentialFormats(task.inputSchema(), task.defaults ?? {}, credentialFormats);
571
+ collectUsedCredentialFormats(task.configSchema(), task.config ?? {}, credentialFormats);
572
572
  }
573
573
  return {
574
574
  needsCredentials: credentialFormats.size > 0,
575
575
  credentialFormats
576
576
  };
577
577
  }
578
- function collectCredentialFormats(schema, formats) {
578
+ function collectUsedCredentialFormats(schema, data, formats) {
579
579
  if (typeof schema === "boolean" || typeof schema !== "object" || schema === null)
580
580
  return;
581
581
  const s = schema;
582
582
  const properties = s.properties;
583
583
  if (!properties || typeof properties !== "object")
584
584
  return;
585
- for (const propSchema of Object.values(properties)) {
585
+ const dataObj = typeof data === "object" && data !== null ? data : {};
586
+ for (const [propName, propSchema] of Object.entries(properties)) {
586
587
  const format = getSchemaFormat(propSchema);
587
- if (format === "credential") {
588
+ const value = dataObj[propName];
589
+ if (format === "credential" && typeof value === "string" && value.length > 0) {
588
590
  formats.add(format);
589
591
  }
590
592
  const objectSchema = getObjectSchema(propSchema);
591
593
  if (objectSchema) {
592
- collectCredentialFormats(objectSchema, formats);
594
+ collectUsedCredentialFormats(objectSchema, value, formats);
593
595
  }
594
596
  }
595
597
  }
@@ -8240,4 +8242,4 @@ export {
8240
8242
  BROWSER_GRANTS
8241
8243
  };
8242
8244
 
8243
- //# debugId=6CFDC763FC3FCCDA64756E2164756E21
8245
+ //# debugId=108A162D578570C764756E2164756E21