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

Meteor 3.0: Adding Async Methods to server #884

Open
wants to merge 58 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
f5a335e
Merge pull request #844 from veliovgroup/dev
dr-dimitru Jun 29, 2022
313e842
Merge pull request #845 from veliovgroup/dev
dr-dimitru Jun 29, 2022
00ab6f7
Merge pull request #848 from veliovgroup/dev
dr-dimitru Aug 17, 2022
7d4796e
Merge pull request #858 from veliovgroup/dev
dr-dimitru Nov 3, 2022
df7a6c9
Merge pull request #859 from veliovgroup/dev
dr-dimitru Nov 3, 2022
4f58852
Merge pull request #860 from veliovgroup/dev
dr-dimitru Nov 3, 2022
b312ef9
Merge pull request #864 from veliovgroup/dev
dr-dimitru Feb 5, 2023
49f3bed
Merge pull request #871 from veliovgroup/dev
dr-dimitru Apr 28, 2023
93b7a73
implement async methods
bratelefant Dec 21, 2023
a6c6da3
getLink async
bratelefant Dec 21, 2023
926e8e2
lint fix
bratelefant Dec 21, 2023
c811a75
fix Match.OneOf etc lint rule
bratelefant Dec 21, 2023
b37aba8
tiny tests npm script
bratelefant Dec 21, 2023
f7bbba1
added some mocha testing
bratelefant Dec 21, 2023
4af4af6
script for mocha
bratelefant Dec 21, 2023
aac6555
Merge remote-tracking branch 'original-meteor-files/dev'
bratelefant Dec 21, 2023
e502124
tests
bratelefant Dec 21, 2023
91fbf48
few more tests
bratelefant Dec 21, 2023
c7fe2a3
link() is not async
bratelefant Dec 22, 2023
5c31934
more tests, remove tests fails
bratelefant Dec 22, 2023
743c12f
fixed tests
bratelefant Dec 22, 2023
ff30780
rest of cursor tests
bratelefant Dec 22, 2023
1ea4e38
few more tests
bratelefant Dec 22, 2023
bf63873
Add devDependencies and update removeAsync method
bratelefant Dec 27, 2023
e727ae8
addFileAsync
bratelefant Dec 27, 2023
3edc652
test for download
bratelefant Dec 28, 2023
f97b4a9
downloadAsync tests
bratelefant Dec 28, 2023
497e8c2
prepareUploadAsync
bratelefant Dec 28, 2023
2dfa4de
_finishUploadAsync and tests
bratelefant Dec 28, 2023
03e9ac7
removed style changes
bratelefant Jan 5, 2024
c9c00c1
revert non-functional changes
bratelefant Jan 6, 2024
3322531
first take on writeAsync
bratelefant Jan 6, 2024
f75d9f0
more tests
bratelefant Jan 6, 2024
64ea577
loadAsync with basic tests for load and loadAsync. More tests are nee…
bratelefant Jan 6, 2024
6da1c60
serve test
bratelefant Jan 6, 2024
03f145f
add ci
bratelefant Jan 6, 2024
3ec2b73
fixed test
bratelefant Jan 6, 2024
74286df
code review
bratelefant Jan 7, 2024
011fbbf
more code reviewed
bratelefant Jan 7, 2024
7b8d809
return something from previous
bratelefant Jan 9, 2024
0275b16
fixed test for `cursor.previous`
bratelefant Jan 9, 2024
b29cc0a
remove async
bratelefant Jan 10, 2024
a6754e3
onBeforeUpdate resolve or Boolean or return Boolean
bratelefant Jan 10, 2024
0c570ef
check if sync always works
bratelefant Jan 10, 2024
e0c3d9c
Internal methods and hooks async, added userAsync to `getUser`
bratelefant Jan 12, 2024
a91f3cc
upload methods
bratelefant Jan 12, 2024
d0fb24c
made _finishUpload async
bratelefant Jan 12, 2024
b90c8f6
updated tests
bratelefant Jan 12, 2024
1df0083
removed fiber db ops from `removeAsync`
bratelefant Jan 12, 2024
fac13c3
drop all fiber methods in core and cursor
bratelefant Jan 16, 2024
55259c0
threw out all fiber methods, renamed new methods
bratelefant Jan 17, 2024
e3b241d
only userId and userAsync in functions contexts
bratelefant Jan 17, 2024
9739d69
add beta version
bratelefant Jan 20, 2024
69cddf9
looks like `observe` returns a Promise under meteor-3.0-beta
bratelefant Jan 25, 2024
d573741
return fileObj in `uploaded` and `end` event
bratelefant Aug 7, 2024
22969a0
Initial commit
harryadel Sep 25, 2024
ed9e253
Merge branch 'master' of github.com:harryadel/Meteor-Files into onBef…
harryadel Sep 25, 2024
0d6707e
Merge pull request #2 from harryadel/onBeforeUpload
bratelefant Oct 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@
"afterColon": true
}],
"new-cap": [2, {
"newIsCap": true
"newIsCap": true,
"capIsNewExceptionPattern": "^Match\\.."
}],
"no-multiple-empty-lines": [2, {
"max": 2
Expand Down
166 changes: 151 additions & 15 deletions .npm/package/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 43 additions & 1 deletion core.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ export default class FilesCollectionCore extends EventEmitter {
*/
_debug() {
if (this.debug) {
(console.info || console.log || function () { }).apply(void 0, arguments);
// eslint-disable-next-line no-console
(console.info || console.log || function () {}).apply(void 0, arguments);
}
}

Expand Down Expand Up @@ -221,6 +222,34 @@ export default class FilesCollectionCore extends EventEmitter {
return doc;
}

/*
* @locus Anywhere
* @memberOf FilesCollectionCore
* @name findOneAsync
* @param {String|Object} selector - Mongo-Style selector (http://docs.meteor.com/api/collections.html#selectors)
* @param {Object} options - Mongo-Style selector Options (http://docs.meteor.com/api/collections.html#sortspecifiers)
* @summary Find and return Cursor for matching document Object
* @returns {Promise<FileCursor>} Instance
*/
async findOneAsync(selector = {}, options) {
this._debug(
`[FilesCollection] [findOneAsync(${JSON.stringify(
selector
)}, ${JSON.stringify(options)})]`
);
check(
selector,
Match.Optional(Match.OneOf(Object, String, Boolean, Number, null))
);
bratelefant marked this conversation as resolved.
Show resolved Hide resolved
check(options, Match.Optional(Object));

const doc = await this.collection.findOneAsync(selector, options);
if (doc) {
return new FileCursor(doc, this);
}
return doc;
}

/*
* @locus Anywhere
* @memberOf FilesCollectionCore
Expand Down Expand Up @@ -251,6 +280,19 @@ export default class FilesCollectionCore extends EventEmitter {
return this.collection;
}

/*
* @locus Anywhere
* @memberOf FilesCollectionCore
* @name updateAsync
* @see http://docs.meteor.com/#/full/update
* @summary link Mongo.Collection update method
* @returns {Promise<Mongo.Collection>} Instance
*/
async updateAsync() {
bratelefant marked this conversation as resolved.
Show resolved Hide resolved
await this.collection.updateAsync.apply(this.collection, arguments);
return this.collection;
}

/*
* @locus Anywhere
* @memberOf FilesCollectionCore
Expand Down
Loading