OpenFn / OpenFn/adaptors

Salesforce: don't stringify output

Open
#688 2 comments 0 reactions 1 assignee View on GitHub

@mtuchi is already working on this.

Since Jan 10, 2025.

Dominant language
JavaScript
Stars
24
Forks
41
Avg merge
3d 13h
Merged PRs (30d)
12

Description

the salesforce adaptor will console.log LOADS of stuff. Half the adaptor functions log their results to stdout.

I am generally not a fan of doing this and I don't think it's inline with out best practice? We're normally a lot more cautious with data. So that's open for debate.

But as a minimum, we should not also stringify that output, as we do now:

 return connection.update(sObject, finalAttrs).then(function (recordResult) {
      console.log('Result : ' + JSON.stringify(recordResult));
      return {
        ...state,
        references: [recordResult, ...state.references],
      };
    });

We should trust the runtime to log an object and find a good way to render it. In Lightning's case, this (eventually) means making the object a collapsible line in the log viewer. In The CLI, it means (probably) using CLI options to control whether the output is prettified, or ignored, or written to disk, or whatever.

By stringifying the output though, the adaptor is taking a lot of control away from downstream services.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.