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

#35: create webapisync option in cert utils #36

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

mohit-s96
Copy link
Member

@mohit-s96 mohit-s96 commented Feb 9, 2023

closes #35

Example CLI command:

node index.js syncWebApiResults -p <path to results> -u http://localhost -r M00000533,M00000797 -i 50007 -o

Also fixes the lookup metadata issue.
cc: @darnjo

@mohit-s96 mohit-s96 self-assigned this Feb 9, 2023
@mohit-s96 mohit-s96 marked this pull request as ready for review March 14, 2023 11:40
@darnjo
Copy link
Member

darnjo commented Mar 21, 2023

@mohit-s96 This needs to be updated with the changes from #34 - which no longer deletes reports but overwrites/archives them instead.

Since this package would be used in AWS/Cert API, we don't want to exit the node process. Thus we could just return in case of an error.
try {
const { id: reportId = null } =
(
await axios.post(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: We should be using the Fetch API for everything at this point.

Copy link
Member

@darnjo darnjo Oct 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can write the Auth part as a one-liner

const getBearerTokenAuthHeader = (token = '') => (token?.length ? { Authorization: `Bearer ${token}` } : {});

headers = {
  ...headers,
  ...getOAuth2BearerTokenHeader(authInfo)
};

Then call Fetch API like so:

const response = await fetch(requestUri, { headers });

@darnjo
Copy link
Member

darnjo commented Oct 2, 2023

Waiting on @darnjo to make a new PR with directories for data-dictionary and web-api-core under the restore-utils, with their own index.js and README.md files, and one at the root of the restore-utils which exports relevant items as libs.

See: #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create WebApiSync Option in Cert Utils
2 participants