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

Add support for GraphQL API, starting with createEtchPacket #16

Merged
merged 18 commits into from
Sep 9, 2020

Conversation

newhouse
Copy link
Contributor

@newhouse newhouse commented Aug 20, 2020

Description of the change

In concert with the big changes to the createEtchPacket mutation, we'll want to add robust support for that mutation in this, our Node API client. This client previously did not have any support for GraphQL whatsoever, so it had to also be added in this PR.

Here are the big things going on:

  • Adds ability to do basic GraphQL queries and mutations
  • Adds ability to create graphql-upload-compliant structures, allowing for files to be uploaded in a GraphQL mutation
  • Adds some helpers to make it easier for users to deal with uploading Streams, Buffers, or even Base64-encoded data/files to us
  • Performs some light schema validation...at least when it comes to file uploads (since they require an oddly specific format).
  • Add a relevant example
  • Update the README/docs to let 'em know about this stuff
  • A number of private, undocumented helpers and such that we can show people in a pinch, or perhaps guide some towards using.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Related issues

Checklists

Development

  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development
  • No previous tests unrelated to the changed code fail in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached.
  • At least one reviewer has been requested
  • Changes have been reviewed by at least one other engineer
  • The relevant project board has been selected in Projects to auto-link to this pull request

@newhouse newhouse changed the title Add support for GraphQL API, starting with createEtchPacket [WIP] Add support for GraphQL API, starting with createEtchPacket Aug 20, 2020
@newhouse newhouse added the WIP Work In Progress label Aug 20, 2020
@@ -49,7 +49,10 @@
"yargs": "^15.1.0"
},
"dependencies": {
"extract-files": "^6",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This module is currently on v9.0.0 but have to drop to 6.0.0 to get it to work on Node 8

@newhouse newhouse force-pushed the newhouse/createEtchPacket branch from f328520 to 3b567a9 Compare August 20, 2020 22:29
Copy link
Contributor

@benogle benogle left a comment

Choose a reason for hiding this comment

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

Looking good

src/index.js Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/index.js Outdated
Comment on lines 121 to 122
// QUESTION: maybe we want to keeep responseQuery to ourselves while we figure out how we want it to
// feel to the Users?
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the idea of having a default response, then letting them override it

return path.basename(thing.client._httpMessage.path || '')
}

throw new Error('Unable to determine file name for this upload. Please pass it via options.filename.')
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Mime.lookup(options.filepath || options.filename)
}

throw new Error('Unable to determine mime type for this upload. Please pass it via options.mimetype.')
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@newhouse newhouse removed the WIP Work In Progress label Aug 27, 2020
@newhouse newhouse changed the title [WIP] Add support for GraphQL API, starting with createEtchPacket Add support for GraphQL API, starting with createEtchPacket Aug 27, 2020
@newhouse newhouse marked this pull request as ready for review August 27, 2020 19:06
@Winggo Winggo mentioned this pull request Sep 5, 2020
10 tasks
@newhouse newhouse merged commit 051a78b into master Sep 9, 2020
@newhouse newhouse deleted the newhouse/createEtchPacket branch September 9, 2020 13:06
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.

2 participants