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