typesense / typesense-js

JavaScript / TypeScript client for Typesense
https://typesense.org/docs/api
Apache License 2.0
414 stars 75 forks source link

Create exportStream method #89

Closed joshmossas closed 2 years ago

joshmossas commented 2 years ago

Change Summary

This pull request closes #87

Changes to ApiCall.ts

Changes to Documents.ts

Additional Notes

Axios doesn't support returning a stream in the browser. So if this is called in the browser it'll just return a string like normal. Not sure if this needs to be documented or not. We could add a note to the JSDoc comment although I imagine most people wouldn't be using the export methods in the browser anyway since they require admin keys.

All tests are passing. I also did some basic tests in NodeJS and the Browser.

PR Checklist

joshmossas commented 2 years ago

Also I'm not sure if I need to include the changes in ./lib and ./dist. Is this handled by a build system? Or should I included the newly outputted files in this PR?

jasonbosco commented 2 years ago

Thank you @joshmossas! 🙏

The lib and dist directories get built as part of the build/publishing process, so we can skip that as part of this PR.

Could you also add a test for this new method similar to the one here: https://github.com/typesense/typesense-js/blob/b1d7ca1c930d09b95e55b44e4350d2b178d3aaf1/test/Typesense/Documents.spec.js#L376-L401

joshmossas commented 2 years ago

Hey @jasonbosco

I've added a test for .exportStream as requested.

Some Notes

jasonbosco commented 2 years ago

LGTM

jasonbosco commented 2 years ago

Published this in v1.0.3-3

joshmossas commented 2 years ago

@jasonbosco Just so you know, the exportStream method is still not present in v1.0.3-3. Perhaps there was an error in the build/publishing process?

jasonbosco commented 2 years ago

My bad. I just published 1.0.3-4 with the latest build.

joshmossas commented 2 years ago

No worries. Thanks my dude.