cape-firebase
Advanced tools
Comparing version 0.6.0 to 1.0.1
@@ -16,2 +16,6 @@ 'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
exports.updateEntityFields = updateEntityFields; | ||
var _capeRedux = require('cape-redux'); | ||
@@ -26,2 +30,4 @@ | ||
// @TODO Switch to using cape-graph actions for entities and triples. | ||
var DELETE_ENTITY = exports.DELETE_ENTITY = 'fire/DELETE_ENTITY'; | ||
@@ -41,2 +47,5 @@ var deleteEntity = exports.deleteEntity = (0, _capeRedux.createSimpleAction)(DELETE_ENTITY, _reduxGraph.requireIdType, (0, _nthArg3.default)(1)); | ||
var updateEntity = exports.updateEntity = (0, _capeRedux.createSimpleAction)(UPDATE_ENTITY, _identity3.default, (0, _nthArg3.default)(1)); | ||
function updateEntityFields(entity, fields) { | ||
return updateEntity(_extends({}, (0, _reduxGraph.requireIdType)(entity), fields)); | ||
} | ||
@@ -43,0 +52,0 @@ var SAVE_TRIPLE = exports.SAVE_TRIPLE = 'fire/SAVE_TRIPLE'; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.reduxFirebase = exports.fireMiddleware = exports.fireInit = undefined; | ||
exports.reduxFirebase = exports.reducer = exports.middleware = exports.fireInit = undefined; | ||
@@ -45,23 +45,44 @@ var _actionHandlers = require('./actionHandlers'); | ||
var _init = require('./init'); | ||
var _initUtils = require('./initUtils'); | ||
var _init2 = _interopRequireDefault(_init); | ||
Object.defineProperty(exports, 'fireInit', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_initUtils).default; | ||
} | ||
}); | ||
var _middleware = require('./middleware'); | ||
var _middleware2 = _interopRequireDefault(_middleware); | ||
Object.defineProperty(exports, 'middleware', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_middleware).default; | ||
} | ||
}); | ||
var _reducer = require('./reducer'); | ||
Object.defineProperty(exports, 'reducer', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_reducer).default; | ||
} | ||
}); | ||
var _storeListener = require('./storeListener'); | ||
var _storeListener2 = _interopRequireDefault(_storeListener); | ||
Object.defineProperty(exports, 'reduxFirebase', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_storeListener).default; | ||
} | ||
}); | ||
var _initUtils = require('./initUtils'); | ||
var _init = require('./init'); | ||
var _initUtils2 = _interopRequireDefault(_initUtils); | ||
var _init2 = _interopRequireDefault(_init); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var fireInit = exports.fireInit = _initUtils2.default; | ||
var fireMiddleware = exports.fireMiddleware = _middleware2.default; | ||
var reduxFirebase = exports.reduxFirebase = _storeListener2.default; | ||
exports.default = _init2.default; |
@@ -26,2 +26,4 @@ 'use strict'; | ||
var _select = require('./select'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -33,4 +35,4 @@ | ||
function fireMiddleware(firebase, entities) { | ||
var handlers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
function fireMiddleware(firebase) { | ||
var handlers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
@@ -43,3 +45,3 @@ var actions = _extends({}, dispatcher, handlers); | ||
if ((0, _isFunction3.default)(actions[action.type])) { | ||
var entityIds = (0, _util.arrayTrueObj)(entities); | ||
var entityIds = (0, _select.getEntityTypes)(store.getState()); | ||
return actions[action.type]({ action: action, entityIds: entityIds, firebase: firebase, next: next, store: store }); | ||
@@ -46,0 +48,0 @@ } |
@@ -19,13 +19,13 @@ 'use strict'; | ||
var _select = require('./select'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// @TODO Move firebase to parent func. | ||
function storeListener(types) { | ||
return function (firebase, store) { | ||
firebase.auth.onAuthStateChanged((0, _partial3.default)(_handler.handleAuth, firebase, store)); | ||
var loadWatchType = (0, _handler.typeLoadWatch)(firebase, store); | ||
(0, _handler.dbChanges)(firebase, store); | ||
(0, _forEach3.default)(types, loadWatchType); | ||
return store; | ||
}; | ||
function storeListener(firebase, store) { | ||
firebase.auth.onAuthStateChanged((0, _partial3.default)(_handler.handleAuth, firebase, store)); | ||
var loadWatchType = (0, _handler.typeLoadWatch)(firebase, store); | ||
(0, _handler.dbChanges)(firebase, store); | ||
(0, _forEach3.default)((0, _select.getEntityTypes)(store.getState()), loadWatchType); | ||
return store; | ||
} |
@@ -20,6 +20,2 @@ 'use strict'; | ||
var _zipObject2 = require('lodash/zipObject'); | ||
var _zipObject3 = _interopRequireDefault(_zipObject2); | ||
var _partial2 = require('lodash/partial'); | ||
@@ -37,6 +33,2 @@ | ||
var _fill2 = require('lodash/fill'); | ||
var _fill3 = _interopRequireDefault(_fill2); | ||
var _curry2 = require('lodash/curry'); | ||
@@ -58,3 +50,2 @@ | ||
exports.triplePut = triplePut; | ||
exports.arrayTrueObj = arrayTrueObj; | ||
@@ -128,2 +119,3 @@ var _capeLodash = require('cape-lodash'); | ||
} | ||
// Same as entitySet but does not create dateCreated field. | ||
function entityUpdate(firebase, node) { | ||
@@ -179,7 +171,2 @@ var entity = firebase.entity, | ||
}); | ||
} | ||
function arrayTrueObj(arr) { | ||
if (!arr || !arr.length) return {}; | ||
return (0, _zipObject3.default)(arr, (0, _fill3.default)(Array(arr.length), true)); | ||
} |
{ | ||
"name": "cape-firebase", | ||
"version": "0.6.0", | ||
"version": "1.0.1", | ||
"description": "Help integrate CAPE redux projects with Firebase.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
222201
17
514
1