Upgraded to 1.0.6

This commit is contained in:
Theodor Diaconu 2016-09-19 12:22:20 +03:00
parent 7450b70e1a
commit 15dcf8b98e
6 changed files with 30 additions and 6 deletions

View file

@ -1,3 +1,7 @@
## 1.0.6
- Fixed exposure bug for static fetching
- Exporting useful components that allow you to customly build your data graph
## 1.0.4
- Index for meta will now only index _id
- You can now perform actions from the inversed links

View file

@ -148,6 +148,9 @@ query.setParams({limit: 200});
```
// server side
const data = query.fetch();
const data = query.fetch({
userId: 'Id of the user you want to impersonate, for exposure, null can be used'
})
// client side
query.fetch((error, response) => {...});

View file

@ -19,7 +19,7 @@ export default function fetch(node, parentObject, userId) {
results = accessor.fetch(filters, options, userId);
} else {
if (node.collection.findSecure) {
results = node.collection.find(filters, options, userId).fetch();
results = node.collection.findSecure(filters, options, userId).fetch();
} else {
results = node.collection.find(filters, options).fetch();
}

View file

@ -56,7 +56,7 @@ export default class Query {
throw new Meteor.Error('not-allowed', 'You are on client so you must either provide a callback to get the data or subscribe first.');
}
if (Meteor.isServer && callback) {
if (Meteor.isServer && callback && _.isFunction(callback)) {
throw new Meteor.Error('not-allowed', 'You are on server, fetching is done directly so no need for callback.');
}
@ -74,12 +74,13 @@ export default class Query {
}
} else {
// fetch directly, he is from server
const options = _.isObject(callback) ? callback : {};
const node = createGraph(
this.collection,
applyFilterFunction(this.body, this.params)
);
return recursiveFetch(node);
return recursiveFetch(node, null, options.userId);
}
}

View file

@ -4,3 +4,19 @@ import './lib/query/extension.js';
export {
default as createQuery
} from './lib/query/createQuery.js';
export {
default as createGraph
} from './lib/query/lib/createGraph.js';
export {
default as recursiveFetch
} from './lib/query/lib/recursiveFetch.js';
export {
default as recursiveCompose
} from './lib/query/lib/recursiveCompose.js';
export {
default as applyFilterFunction
} from './lib/query/lib/applyFilterFunction.js';

View file

@ -1,6 +1,6 @@
Package.describe({
name: 'cultofcoders:grapher',
version: '1.0.4',
version: '1.0.6',
// Brief, one-line summary of the package.
summary: 'Grapher is a way of linking/joining collections. And fetching data in a GraphQL style.',
// URL to the Git repository containing the source code for this package.
@ -27,9 +27,9 @@ Package.onUse(function (api) {
api.use(packages);
api.imply(packages);
api.mainModule('main.both.js');
api.mainModule('main.client.js', 'client');
api.mainModule('main.server.js', 'server');
api.mainModule('main.both.js');
});
Package.onTest(function (api) {