@taraai/read-write
Version:
Synchronous NoSQL/Firestore for React
76 lines (75 loc) • 3.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.methodsToAddFromFirestore = exports.defaultConfig = exports.default = exports.actionsPrefix = exports.actionTypes = void 0;
const actionsPrefix = '::readwrite';
exports.actionsPrefix = actionsPrefix;
const actionTypes = {
START: `${actionsPrefix}/START`,
ERROR: `${actionsPrefix}/ERROR`,
CLEAR_DATA: `${actionsPrefix}/CLEAR_DATA`,
CLEAR_ERROR: `${actionsPrefix}/CLEAR_ERROR`,
CLEAR_ERRORS: `${actionsPrefix}/CLEAR_ERRORS`,
SET_LISTENER: `${actionsPrefix}/SET_LISTENER`,
UNSET_LISTENER: `${actionsPrefix}/UNSET_LISTENER`,
GET_REQUEST: `${actionsPrefix}/GET_REQUEST`,
GET_SUCCESS: `${actionsPrefix}/GET_SUCCESS`,
GET_FAILURE: `${actionsPrefix}/GET_FAILURE`,
SET_REQUEST: `${actionsPrefix}/SET_REQUEST`,
SET_SUCCESS: `${actionsPrefix}/SET_SUCCESS`,
SET_FAILURE: `${actionsPrefix}/SET_FAILURE`,
ADD_REQUEST: `${actionsPrefix}/ADD_REQUEST`,
ADD_SUCCESS: `${actionsPrefix}/ADD_SUCCESS`,
ADD_FAILURE: `${actionsPrefix}/ADD_FAILURE`,
UPDATE_REQUEST: `${actionsPrefix}/UPDATE_REQUEST`,
UPDATE_SUCCESS: `${actionsPrefix}/UPDATE_SUCCESS`,
UPDATE_FAILURE: `${actionsPrefix}/UPDATE_FAILURE`,
DELETE_REQUEST: `${actionsPrefix}/DELETE_REQUEST`,
DELETE_SUCCESS: `${actionsPrefix}/DELETE_SUCCESS`,
DELETE_FAILURE: `${actionsPrefix}/DELETE_FAILURE`,
ATTACH_LISTENER: `${actionsPrefix}/ATTACH_LISTENER`,
LISTENER_RESPONSE: `${actionsPrefix}/LISTENER_RESPONSE`,
LISTENER_ERROR: `${actionsPrefix}/LISTENER_ERROR`,
ON_SNAPSHOT_REQUEST: `${actionsPrefix}/ON_SNAPSHOT_REQUEST`,
ON_SNAPSHOT_SUCCESS: `${actionsPrefix}/ON_SNAPSHOT_SUCCESS`,
ON_SNAPSHOT_FAILURE: `${actionsPrefix}/ON_SNAPSHOT_FAILURE`,
DOCUMENT_ADDED: `${actionsPrefix}/DOCUMENT_ADDED`,
DOCUMENT_MODIFIED: `${actionsPrefix}/DOCUMENT_MODIFIED`,
DOCUMENT_REMOVED: `${actionsPrefix}/DOCUMENT_REMOVED`,
TRANSACTION_START: `${actionsPrefix}/TRANSACTION_START`,
TRANSACTION_SUCCESS: `${actionsPrefix}/TRANSACTION_SUCCESS`,
TRANSACTION_FAILURE: `${actionsPrefix}/TRANSACTION_FAILURE`,
OPTIMISTIC_ADDED: `${actionsPrefix}/OPTIMISTIC_ADDED`,
OPTIMISTIC_MODIFIED: `${actionsPrefix}/OPTIMISTIC_MODIFIED`,
OPTIMISTIC_REMOVED: `${actionsPrefix}/OPTIMISTIC_REMOVED`,
MUTATE_START: `${actionsPrefix}/MUTATE_START`,
MUTATE_SUCCESS: `${actionsPrefix}/MUTATE_SUCCESS`,
MUTATE_FAILURE: `${actionsPrefix}/MUTATE_FAILURE`
};
exports.actionTypes = actionTypes;
const defaultConfig = {
logListenerError: true,
enhancerNamespace: 'firestore',
helpersNamespace: null,
allowMultipleListeners: false,
preserveOnDelete: null,
preserveOnListenerError: null,
preserveCacheAfterUnset: true,
onAttemptCollectionDelete: null,
mergeOrdered: true,
mergeOrderedDocUpdates: true,
mergeOrderedCollectionUpdates: true,
globalDataConverter: null,
userProfile: 'users',
useFirestoreForProfile: true
};
exports.defaultConfig = defaultConfig;
const methodsToAddFromFirestore = ['collection', 'collectionGroup', 'configureClient', 'doc', 'batch', 'disableNetwork', 'enableNetwork', 'enablePersistence', 'ensureClientConfigured', 'setLogLevel', 'settings', 'mutate'];
exports.methodsToAddFromFirestore = methodsToAddFromFirestore;
var _default = {
actionsPrefix,
actionTypes,
defaultConfig
};
exports.default = _default;