@workglow/task-graph 0.2.8 → 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/node.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
  }
@@ -7603,4 +7605,4 @@ export {
7603
7605
  BROWSER_GRANTS
7604
7606
  };
7605
7607
 
7606
- //# debugId=5E7B16046C23DEEF64756E2164756E21
7608
+ //# debugId=6A4EF9DF50D86DE564756E2164756E21