Skip to content

v3.0.0

Choose a tag to compare

@dr-dimitru dr-dimitru released this 24 Sep 14:46
a00c648

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

Contributors

Special thanks to: @bratelefant @harryadel @jankapunkt @StorytellerCZ @make-github-pseudonymous-again an other contributors who helped to build and pushed v3 release forward

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!
  • ✨ New FileUpload#remainingTime {ReactiveVar} with upload remaining time in human-readable format

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()

FileUpload:

  • ✨ New FileUpload#remainingTime {ReactiveVar} with upload remaining time in human-readable format

FileCursor:

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

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

  • 🐞 Bug: Fixed #885 β€” Upload empty file now end upload with error
  • 🐞 Bug: Fixed #901 β€” Caused by #894
  • πŸ”§ Security: Fixed #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:

  • eventemitter3@5.0.1, was 4.0.7
  • removed: abort-controller, now using native AbortController
  • removed: fs-extra, now using native fs

dev:

  • added: chai@4.5.0
  • added: sinon@7.5.0