Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http & Salesforce improvements #478

Merged
merged 6 commits into from
Mar 19, 2024
Merged

Http & Salesforce improvements #478

merged 6 commits into from
Mar 19, 2024

Conversation

mtuchi
Copy link
Collaborator

@mtuchi mtuchi commented Feb 27, 2024

Summary

Add callback support for parseXML in http and add options and callback support for query in salesforce

Details

Callback is very useful especially when it's used in each() function. The callback support in parseXML will make it easier to pluck out data from state.data.body. See example below

each(
  "$.response[*]",
  parseXML(
    (s) => s.data,
    ($) => $,
    (next) => ({ ...next, results: next.data.body })
  )
);

For salesforce i made some improvement for the query function to use query(qs, options, callback). This will allow me to specify options like { autoFetch: true } which will make it easy to query more records using only the query() instead of bulkQuery()
Eg:

query('SELECT Id, Name from Account, { autoFetch: true });

With the given example above ⬆️ , If the results is more 2000 records. Then the function will auto-fetch the remaining records until we have all records

Closes #394, #447

Review Checklist

Before merging, the reviewer should check the following items:

  • Does the PR do what it claims to do?
  • Are there any unit tests? Should there be?
  • Is there a changeset associated with this PR? Should there be? Note that
    dev only changes don't need a changeset.

@mtuchi mtuchi requested a review from josephjclark February 27, 2024 11:49
@mtuchi mtuchi marked this pull request as ready for review February 27, 2024 11:49
@mtuchi
Copy link
Collaborator Author

mtuchi commented Feb 27, 2024

The failing tests are related to mailgun, See #477 for more information

@josephjclark
Copy link
Collaborator

@mtuchi this looks great. Can you please rebase (or merge) against main and run pnpm changeset version to push version changes? Then we can merge this in.

@mtuchi mtuchi force-pushed the sf-http-improvements branch from 77ed2ac to 27fc232 Compare March 19, 2024 13:02
@mtuchi mtuchi requested a review from josephjclark March 19, 2024 13:07
@josephjclark josephjclark merged commit 240da59 into main Mar 19, 2024
1 check passed
@josephjclark josephjclark deleted the sf-http-improvements branch March 19, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

salesforce Expose request function from state.connection.request
2 participants