Skip to content

async/await support and other changes for meteor@3 #895

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

Open
wants to merge 131 commits into
base: dev
Choose a base branch
from

Conversation

dr-dimitru
Copy link
Member

No description provided.

dr-dimitru and others added 30 commits June 29, 2022 16:08
📦 v2.2.0

__Breaking Changes__

- ⚠️ Changes in `namingFunction`, — now naming function acts the same on the Client and Server, upon insert, load, and write. Test your implementation with changed logic. Output of Server function supersedes Client's function output

__Changes__

- 📔 Merge #843 and fix #820, thanks to @Prinzhorn
- 📔 Documentation refactoring focused on examples and its simplifications
- 👨‍💻 Support nested custom path returned from `namingFunction`
- 👨‍💻 Fix `namingFunction` behavior on Client and Server in upload, load, and write methods, closing #842; Thanks to @chrschae
- 👷‍♂️ Now library exports its helpers `import { FilesCollection, helpers };`
- 👷‍♂️ Add `.meteorignore` to minimize package's footprint
📦 v2.2.1

-  👨‍💻 Fix #842, a newly detected bug by @chrschae; Fixing case when `namingFunction` returns new nested path cause exception in `.write()` and `.load()` methods
📦 v2.3.0

__New features:__

- ✨ `opts.sanitize` method, read more in [*Constructor* docs](https://github.com/veliovgroup/Meteor-Files/blob/master/docs/constructor.md); Thanks to @xet7 and @mfilser

__Other Changes:__

- 👷‍♂️ Minor codebase enhancements and cleanups
v2.3.1

__Changes:__

- 👨‍💻 Improve `createIndex` helper
- 👨‍💻 Improve error output when FileSystem destination not writable; Related to #857, thanks to @Leekao
- 🐞 Fix custom `allowedOrigins` option for CORS; Closing #850, thanks to @djlogan2;

__Notes:__

- 👨‍🔬 Tested with latest release of `[email protected]`
📔 Improve AWS S3 documentation
📦 v2.3.2

- 👨‍💻 Potential fix for #857 (windows)
👷‍♂️ Update .eslintrc
📦 v2.3.3

__Major changes:__

- no

__Changes:__

- 👨‍🔧 Fixed #870, thanks to @Gobliins
- 🤝 Compatibility with `[email protected]`
@dr-dimitru
Copy link
Member Author

@Friction-less-development thanks a lot for reporting this one, ostrio:[email protected] is out with fix for removeAsync included, please give it a try

@dr-dimitru
Copy link
Member Author

@jankapunkt @bratelefant @harryadel @StorytellerCZ here's draft changelog for ostrio:[email protected], going to refactor and update docs now, please report issues if any.

Summary

  • ✨ Refactor: Hook options: protected, onBeforeRemove, onAfterRemove, onInitiateUpload, onAfterUpload, namingFunction are now async
  • 🤝 Refactor: Compatibility with meteor@3 and other modern packages
  • ☄️ Refactor: Match FilesCollection APIs with new *Async methods of Mongo.Collection; Deprecate callback APIs on the Server
  • 👨‍💻 Refactor: Utilize node's async APIs where suitable
  • 👨‍💻 Refactor: Improve pause/resume logic on connection interruption/reconnect
  • 📔 Docs: Updated and refactored docs with better examples
  • 📔 Docs: Refactored JSDoc matching definitions in TypeScript
  • 🤓 Dev: Improved TypeScript support
  • 👷‍♂️ Dev: Improved debugging logs
  • 👨‍🔬 Tests: Improved test-suite
  • 👷‍♂️ Git: CI GitHub Action Workflows for lint and build tests

Major changes

FilesCollection:

  • ⚠️ FilesCollection#remove() — deprecated on server, use FilesCollection#removeAsync instead
  • ⚠️ FilesCollection#findOne() — deprecated on server, use FilesCollection#findOneAsync instead
  • ⚠️ FilesCollection#unlink() — deprecated on server, use FilesCollection#unlinkAsync instead
  • ⚠️ FilesCollection#write() — deprecated on server, use FilesCollection#writeAsync instead
  • ⚠️ FilesCollection#load() — deprecated on server, use FilesCollection#loadAsync instead

FileCursor:

  • ⚠️ FileCursor#remove() — deprecated on server, use FileCursor#removeAsync instead

FilesCursor:

  • ⚠️ FilesCursor#remove() — deprecated on server, use FilesCursor#removeAsync instead
  • ⚠️ FilesCursor#hasNext() - deprecated, use FilesCursor#hasNextAsync instead
  • ⚠️ FilesCursor#count() - deprecated, use FilesCursor#countDocuments instead
  • ⚠️ FilesCursor#countAsync() - deprecated, use FilesCursor#countDocuments instead

FileUpload:

  • ⚠️ FileUpload#start() is now async!

Callbacks and hooks:

  • ⚠️ Anywhere: this.user() is deprecated, use this.userAsync() instead
  • ⚠️ Client: FileUpload now always triggers end even in the case of successful and failed uploads; Before: end event wasn't called under certain conditions
  • ⚠️ Client: All errors appeared during upload in all hooks and events of FileUpload are now instance of Meteor.Error; Before: Errors had mixed type or were simply text
  • ⚠️ Client: Errors are the same now (type, code, text, reason, details) within DDP and HTTP protocols; Before: DDP and HTTP protocols had different errors
  • ⚠️ Client: The next private events were removed from UploadInstance Class: upload, sendEOF, prepare, sendChunk, proceedChunk

New methods

FilesCollection:

  • ✨ Client: FilesCollection#insertAsync()
  • ✨ Anywhere: FilesCollection#updateAsync()
  • ✨ Anywhere: FilesCollection#removeAsync()
  • ✨ Anywhere: FilesCollection#findOneAsync()
  • ✨ Anywhere: FilesCollection#countDocuments()
  • ✨ Anywhere: FilesCollection#estimatedDocumentCount()
  • ✨ Server: FilesCollection#unlinkAsync()
  • ✨ Server: FilesCollection#writeAsync()
  • ✨ Server: FilesCollection#loadAsync()

FileCursor:

  • ✨ Anywhere: FileCursor#removeAsync()
  • ✨ Anywhere: FileCursor#fetchAsync()

FilesCursor:

  • ✨ Anywhere: FilesCursor#getAsync()
  • ✨ Anywhere: FilesCursor#hasNextAsync()
  • ✨ Anywhere: FilesCursor#nextAsync()
  • ✨ Anywhere: FilesCursor#hasPreviousAsync()
  • ✨ Anywhere: FilesCursor#previousAsync()
  • ✨ Anywhere: FilesCursor#removeAsync()
  • ✨ Anywhere: FilesCursor#fetchAsync()
  • ✨ Anywhere: FilesCursor#firstAsync()
  • ✨ Anywhere: FilesCursor#lastAsync()
  • ✨ Anywhere: FilesCursor#countDocuments()
  • ✨ Anywhere: FilesCursor#forEachAsync()
  • ✨ Anywhere: FilesCursor#eachAsync()
  • ✨ Anywhere: FilesCursor#mapAsync()
  • ✨ Anywhere: FilesCursor#currentAsync()
  • ✨ Anywhere: FilesCursor#observeAsync()
  • ✨ Anywhere: FilesCursor#observeChangesAsync()

New features

  • ✨ Client: FileUpload#remainingTime ReactiveVar — returns remaining upload time in hh:mm:ss format;

Other changes

  • 🔧 Security: Fixed TLS cookie without secure flag set - x_mtok #894 — now x_mtok cookie is set with secure and httpOnly flags
  • 🔧 Refactor: Fixed FileCursor#with implementation
  • ✨ Refactor: FileUpload#abort is now async
  • ✨ Server: FilesCollection#addFile is now async
  • ✨ Server: FilesCollection#download is now async
  • ✨ Server: WriteStream Class is now available for import
  • ⚙️ Client: disableUpload option processed on the client and returns error in the end/error events, and onError hooks. Before — throws an error upon calling .insert() method

Dependencies

release:

  • [email protected], was 4.0.7
  • removed: abort-controller, now using native AbortController
  • removed: fs-extra, now using native fs

dev:

@harryadel
Copy link
Contributor

I've just used the latest RC in our project. The only thing we had to change really was unlink to unlinkAsync which was about 3 calls. So far so good, I'll report back if I find any issues in the upcoming days. Thank you all for pushing this through.

@dr-dimitru
Copy link
Member Author

@harryadel awesome, thank you for feedback. Do you use protected other this.user() in any callback's contexts? Have some reports that this one is broken

@harryadel
Copy link
Contributor

@harryadel awesome, thank you for feedback. Do you use protected other this.user() in any callback's contexts? Have some reports that this one is broken

No, I don't think we really do.

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.

5 participants