Comparing version 0.17.5 to 0.17.6
import { IDictionary } from "common-types"; | ||
import { rtdb } from "firebase-api-surface"; | ||
import { IListener } from "./query"; | ||
import { SnapShot } from "./index"; | ||
import { SnapShot } from "."; | ||
export declare let db: IDictionary; | ||
@@ -6,0 +6,0 @@ export declare function clearDatabase(): void; |
import { set, get } from "lodash"; | ||
import { key as fbKey } from "firebase-key"; | ||
import { join, pathDiff, getParent, getKey, keyAndParent } from "./util"; | ||
import { SnapShot } from "./index"; | ||
import { SnapShot } from "."; | ||
export let db = []; | ||
@@ -6,0 +6,0 @@ let _listeners = []; |
@@ -10,2 +10,3 @@ export { default as Mock, SchemaCallback } from "./mock"; | ||
export { reset as resetDatabase } from "./database"; | ||
export { MockHelper } from "./MockHelper"; | ||
export { GenericEventHandler, HandleValueEvent, HandleChangeEvent, HandleMoveEvent, HandleNewEvent, HandleRemoveEvent } from "./query"; |
@@ -10,1 +10,2 @@ export { default as Mock } from "./mock"; | ||
export { reset as resetDatabase } from "./database"; | ||
export { MockHelper } from "./MockHelper"; |
@@ -70,3 +70,10 @@ import { rtdb } from "firebase-api-surface"; | ||
orderByPriority(): rtdb.IQuery<T>; | ||
toJSON(): string; | ||
toJSON(): { | ||
identity: string; | ||
delay: DelayType; | ||
ordering: IOrdering; | ||
numListeners: any; | ||
queryFilters: string | IQueryFilter<T>[]; | ||
limitFilters: string | IQueryFilter<T>[]; | ||
}; | ||
toString(): string; | ||
@@ -73,0 +80,0 @@ /** |
@@ -141,6 +141,13 @@ import { db, addListener } from "./database"; | ||
toJSON() { | ||
return JSON.stringify(this); | ||
return { | ||
identity: this.toString(), | ||
delay: this._delay, | ||
ordering: this._order, | ||
numListeners: this._listeners.length, | ||
queryFilters: this._queryFilters.length > 0 ? this._queryFilters : "none", | ||
limitFilters: this._limitFilters.length > 0 ? this._limitFilters : "none" | ||
}; | ||
} | ||
toString() { | ||
return `${process.env.FIREBASE_DATA_ROOT_URL}/${this.path}`; | ||
return `FireMock::Query@${process.env.FIREBASE_DATA_ROOT_URL}/${this.path}`; | ||
} | ||
@@ -147,0 +154,0 @@ /** |
@@ -87,4 +87,6 @@ import Query from "./query"; | ||
toString() { | ||
return slashNotation(join("https://mockdb.local", this.path, this.key)); | ||
return this.path | ||
? slashNotation(join("FireMock::Reference@", this.path, this.key)) | ||
: "FireMock::Reference@uninitialized (aka, no path) mock Reference object"; | ||
} | ||
} |
@@ -7,2 +7,3 @@ 'use strict'; | ||
var fbKey = require('firebase-key'); | ||
var _ = require('.'); | ||
var convert = require('typed-conversions'); | ||
@@ -219,3 +220,3 @@ | ||
} | ||
return l.callback(new SnapShot(join(l.path), result)); | ||
return l.callback(new _.SnapShot(join(l.path), result)); | ||
}); | ||
@@ -225,3 +226,3 @@ if (newValue === undefined) { | ||
findChildListeners(parent, "child_removed", "child_changed").forEach(l => { | ||
return l.callback(new SnapShot(key, newValue)); | ||
return l.callback(new _.SnapShot(key, newValue)); | ||
}); | ||
@@ -232,3 +233,3 @@ } | ||
findChildListeners(parent, "child_added", "child_changed").forEach(l => { | ||
return l.callback(new SnapShot(key, newValue)); | ||
return l.callback(new _.SnapShot(key, newValue)); | ||
}); | ||
@@ -262,3 +263,3 @@ } | ||
/** Clears the DB and removes all listeners */ | ||
function reset$$1() { | ||
function reset() { | ||
removeAllListeners(); | ||
@@ -688,6 +689,13 @@ clearDatabase(); | ||
toJSON() { | ||
return JSON.stringify(this); | ||
return { | ||
identity: this.toString(), | ||
delay: this._delay, | ||
ordering: this._order, | ||
numListeners: this._listeners.length, | ||
queryFilters: this._queryFilters.length > 0 ? this._queryFilters : "none", | ||
limitFilters: this._limitFilters.length > 0 ? this._limitFilters : "none" | ||
}; | ||
} | ||
toString() { | ||
return `${process.env.FIREBASE_DATA_ROOT_URL}/${this.path}`; | ||
return `FireMock::Query@${process.env.FIREBASE_DATA_ROOT_URL}/${this.path}`; | ||
} | ||
@@ -860,3 +868,5 @@ /** | ||
toString() { | ||
return slashNotation(join("https://mockdb.local", this.path, this.key)); | ||
return this.path | ||
? slashNotation(join("FireMock::Reference@", this.path, this.key)) | ||
: "FireMock::Reference@uninitialized (aka, no path) mock Reference object"; | ||
} | ||
@@ -1149,2 +1159,16 @@ } | ||
class MockHelper { | ||
constructor(context) { | ||
this.context = context; | ||
} | ||
get faker() { | ||
const faker = require("faker"); | ||
return faker; | ||
} | ||
get chance() { | ||
const chance = require("chance"); | ||
return chance(); | ||
} | ||
} | ||
exports.Mock = Mock$$1; | ||
@@ -1158,3 +1182,4 @@ exports.SchemaHelper = SchemaHelper; | ||
exports.Deployment = Deployment; | ||
exports.resetDatabase = reset$$1; | ||
exports.resetDatabase = reset; | ||
exports.MockHelper = MockHelper; | ||
//# sourceMappingURL=firemock.cjs.js.map |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('firebase-key'), require('typed-conversions')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'lodash', 'firebase-key', 'typed-conversions'], factory) : | ||
(factory((global.FireMock = {}),global.lodash,global.fbKey,global.convert)); | ||
}(this, (function (exports,lodash,fbKey,convert) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('firebase-key'), require('.'), require('typed-conversions')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'lodash', 'firebase-key', '.', 'typed-conversions'], factory) : | ||
(factory((global.FireMock = {}),global.lodash,global.fbKey,null,global.convert)); | ||
}(this, (function (exports,lodash,fbKey,_,convert) { 'use strict'; | ||
@@ -216,3 +216,3 @@ function normalizeRef(r) { | ||
} | ||
return l.callback(new SnapShot(join(l.path), result)); | ||
return l.callback(new _.SnapShot(join(l.path), result)); | ||
}); | ||
@@ -222,3 +222,3 @@ if (newValue === undefined) { | ||
findChildListeners(parent, "child_removed", "child_changed").forEach(l => { | ||
return l.callback(new SnapShot(key, newValue)); | ||
return l.callback(new _.SnapShot(key, newValue)); | ||
}); | ||
@@ -229,3 +229,3 @@ } | ||
findChildListeners(parent, "child_added", "child_changed").forEach(l => { | ||
return l.callback(new SnapShot(key, newValue)); | ||
return l.callback(new _.SnapShot(key, newValue)); | ||
}); | ||
@@ -259,3 +259,3 @@ } | ||
/** Clears the DB and removes all listeners */ | ||
function reset$$1() { | ||
function reset() { | ||
removeAllListeners(); | ||
@@ -685,6 +685,13 @@ clearDatabase(); | ||
toJSON() { | ||
return JSON.stringify(this); | ||
return { | ||
identity: this.toString(), | ||
delay: this._delay, | ||
ordering: this._order, | ||
numListeners: this._listeners.length, | ||
queryFilters: this._queryFilters.length > 0 ? this._queryFilters : "none", | ||
limitFilters: this._limitFilters.length > 0 ? this._limitFilters : "none" | ||
}; | ||
} | ||
toString() { | ||
return `${process.env.FIREBASE_DATA_ROOT_URL}/${this.path}`; | ||
return `FireMock::Query@${process.env.FIREBASE_DATA_ROOT_URL}/${this.path}`; | ||
} | ||
@@ -857,3 +864,5 @@ /** | ||
toString() { | ||
return slashNotation(join("https://mockdb.local", this.path, this.key)); | ||
return this.path | ||
? slashNotation(join("FireMock::Reference@", this.path, this.key)) | ||
: "FireMock::Reference@uninitialized (aka, no path) mock Reference object"; | ||
} | ||
@@ -1146,2 +1155,16 @@ } | ||
class MockHelper { | ||
constructor(context) { | ||
this.context = context; | ||
} | ||
get faker() { | ||
const faker = require("faker"); | ||
return faker; | ||
} | ||
get chance() { | ||
const chance = require("chance"); | ||
return chance(); | ||
} | ||
} | ||
exports.Mock = Mock$$1; | ||
@@ -1155,3 +1178,4 @@ exports.SchemaHelper = SchemaHelper; | ||
exports.Deployment = Deployment; | ||
exports.resetDatabase = reset$$1; | ||
exports.resetDatabase = reset; | ||
exports.MockHelper = MockHelper; | ||
@@ -1158,0 +1182,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
{ | ||
"name": "firemock", | ||
"version": "0.17.5", | ||
"version": "0.17.6", | ||
"description": "firemock", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
306001
35
4084