Skip to content

Commit 2ab3fd3

Browse files
committed
change nova-lib folder structure
1 parent dfd01fd commit 2ab3fd3

26 files changed

+30
-56
lines changed

packages/nova-lib/lib/client.js

-2
This file was deleted.

packages/nova-lib/lib/client/main.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from '../modules/index.js';
2+
export * from './apollo.js';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/nova-lib/lib/redux.js packages/nova-lib/lib/modules/redux.js

-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
2-
3-
export const configureStore = (reducers, initialState = {}, middlewares) => createStore(
4-
// reducers
5-
combineReducers(reducers),
6-
// initial state
7-
initialState,
8-
// middlewares
9-
compose(
10-
applyMiddleware(...middlewares),
11-
typeof window !== "undefined" && window.devToolsExtension ? window.devToolsExtension() : f => f
12-
)
13-
);
14-
151
let actions = {};
162
export const addAction = addedAction => {
173
actions = {...actions, ...addedAction};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/nova-lib/lib/server.js

-3
This file was deleted.

packages/nova-lib/lib/server/main.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export * from '../modules/index.js';
2+
export * from './apollo.js';
3+
export * from './store.js';
4+
export * from './mutations.js';

packages/nova-lib/lib/mutations.js packages/nova-lib/lib/server/mutations.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Mutations have four steps:
44
55
1. Validation
66
7-
If the mutation call is not trusted (i.e. it comes from a GraphQL mutation),
7+
If the mutation call is not trusted (i.e. it comes from a GraphQL mutation),
88
we'll run all validate steps:
99
1010
- Check that the current user has permission to insert/edit each field.
@@ -13,29 +13,28 @@ we'll run all validate steps:
1313
1414
2. Sync Callbacks
1515
16-
The second step is to run the mutation argument through all the sync callbacks.
16+
The second step is to run the mutation argument through all the sync callbacks.
1717
1818
3. Operation
1919
2020
We then perform the insert/update/remove operation.
2121
2222
4. Async Callbacks
2323
24-
Finally, *after* the operation is performed, we execute any async callbacks.
24+
Finally, *after* the operation is performed, we execute any async callbacks.
2525
Being async, they won't hold up the mutation and slow down its response time
26-
to the client.
26+
to the client.
2727
2828
*/
2929

30-
import { Utils } from './utils';
31-
import { runCallbacks, runCallbacksAsync } from './callbacks.js';
30+
import { Utils, runCallbacks, runCallbacksAsync } from '../modules/index.js';
3231

3332
export const newMutation = ({ collection, document, currentUser, validate, context }) => {
34-
33+
3534
// console.log("// newMutation")
3635
// console.log(collection._name)
3736
// console.log(document)
38-
37+
3938
// we don't want to modify the original document
4039
let newDocument = Object.assign({}, document);
4140

@@ -79,10 +78,10 @@ export const newMutation = ({ collection, document, currentUser, validate, conte
7978
// run async callbacks
8079
// note: query for document to get fresh document with collection-hooks effects applied
8180
runCallbacksAsync(`${collectionName}.new.async`, insertedDocument, currentUser, collection);
82-
81+
8382
// console.log("// new mutation finished:")
8483
// console.log(newDocument)
85-
84+
8685
return newDocument;
8786
}
8887

@@ -93,7 +92,7 @@ export const editMutation = ({ collection, documentId, set, unset, currentUser,
9392
// console.log(documentId)
9493
// console.log(set)
9594
// console.log(unset)
96-
95+
9796
const collectionName = collection._name;
9897
const schema = collection.simpleSchema()._schema;
9998

packages/nova-lib/lib/server/store.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
2+
3+
export const configureStore = (reducers, initialState = {}, middlewares) => createStore(
4+
// reducers
5+
combineReducers(reducers),
6+
// initial state
7+
initialState,
8+
// middlewares
9+
compose(
10+
applyMiddleware(...middlewares),
11+
),
12+
);

packages/nova-lib/lib/update.js

-24
This file was deleted.

packages/nova-lib/package.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Package.onUse(function (api) {
5454
// 'Telescope'
5555
// ]);
5656

57-
api.mainModule("lib/server.js", "server");
58-
api.mainModule("lib/client.js", "client");
57+
api.mainModule('lib/server/main.js', 'server');
58+
api.mainModule('lib/client/main.js', 'client');
5959

6060
});

0 commit comments

Comments
 (0)