Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('exports all types', function() {
// Ordering as per firestore.d.ts
assert.ok(is.defined(Firestore.Firestore));
assert.equal(Firestore.Firestore.name, 'Firestore');
assert.ok(is.defined(Firestore.Timestamp));
assert.equal(Firestore.Timestamp.name, 'Timestamp');
assert.ok(is.defined(Firestore.GeoPoint));
assert.equal(Firestore.GeoPoint.name, 'GeoPoint');
assert.ok(is.defined(Firestore.Transaction));
assert.equal(Firestore.Transaction.name, 'Transaction');
assert.ok(is.defined(Firestore.WriteBatch));
assert.equal(Firestore.WriteBatch.name, 'WriteBatch');
assert.ok(is.defined(Firestore.DocumentReference));
assert.equal(Firestore.DocumentReference.name, 'DocumentReference');
assert.ok(is.defined(Firestore.WriteResult));
assert.equal(Firestore.WriteResult.name, 'WriteResult');
assert.ok(is.defined(Firestore.DocumentSnapshot));
assert.equal(Firestore.DocumentSnapshot.name, 'DocumentSnapshot');
assert.ok(is.defined(Firestore.QueryDocumentSnapshot));
assert.equal(Firestore.QueryDocumentSnapshot.name, 'QueryDocumentSnapshot');
assert.ok(is.defined(Firestore.Query));
assert.equal(Firestore.Query.name, 'Query');
assert.ok(is.defined(Firestore.QuerySnapshot));
assert.equal(Firestore.QuerySnapshot.name, 'QuerySnapshot');
assert.ok(is.defined(Firestore.CollectionReference));
assert.equal(Firestore.CollectionReference.name, 'CollectionReference');
assert.ok(is.defined(Firestore.FieldValue));
it('exports all types', function() {
// Ordering as per firestore.d.ts
assert.ok(is.defined(Firestore.Firestore));
assert.equal(Firestore.Firestore.name, 'Firestore');
assert.ok(is.defined(Firestore.Timestamp));
assert.equal(Firestore.Timestamp.name, 'Timestamp');
assert.ok(is.defined(Firestore.GeoPoint));
assert.equal(Firestore.GeoPoint.name, 'GeoPoint');
assert.ok(is.defined(Firestore.Transaction));
assert.equal(Firestore.Transaction.name, 'Transaction');
assert.ok(is.defined(Firestore.WriteBatch));
assert.equal(Firestore.WriteBatch.name, 'WriteBatch');
assert.ok(is.defined(Firestore.DocumentReference));
assert.equal(Firestore.DocumentReference.name, 'DocumentReference');
assert.ok(is.defined(Firestore.WriteResult));
assert.equal(Firestore.WriteResult.name, 'WriteResult');
assert.ok(is.defined(Firestore.DocumentSnapshot));
assert.equal(Firestore.DocumentSnapshot.name, 'DocumentSnapshot');
assert.ok(is.defined(Firestore.QueryDocumentSnapshot));
it('exports all types', function() {
// Ordering as per firestore.d.ts
assert.ok(is.defined(Firestore.Firestore));
assert.equal(Firestore.Firestore.name, 'Firestore');
assert.ok(is.defined(Firestore.Timestamp));
assert.equal(Firestore.Timestamp.name, 'Timestamp');
assert.ok(is.defined(Firestore.GeoPoint));
assert.equal(Firestore.GeoPoint.name, 'GeoPoint');
assert.ok(is.defined(Firestore.Transaction));
assert.equal(Firestore.Transaction.name, 'Transaction');
assert.ok(is.defined(Firestore.WriteBatch));
assert.equal(Firestore.WriteBatch.name, 'WriteBatch');
assert.ok(is.defined(Firestore.DocumentReference));
assert.equal(Firestore.DocumentReference.name, 'DocumentReference');
assert.ok(is.defined(Firestore.WriteResult));
assert.equal(Firestore.WriteResult.name, 'WriteResult');
assert.ok(is.defined(Firestore.DocumentSnapshot));
assert.equal(Firestore.DocumentSnapshot.name, 'DocumentSnapshot');
assert.ok(is.defined(Firestore.QueryDocumentSnapshot));
assert.equal(Firestore.QueryDocumentSnapshot.name, 'QueryDocumentSnapshot');
assert.ok(is.defined(Firestore.Query));
assert.equal(Firestore.Query.name, 'Query');
assert.ok(is.defined(Firestore.QuerySnapshot));
assert.equal(Firestore.QuerySnapshot.name, 'QuerySnapshot');
assert.ok(is.defined(Firestore.CollectionReference));
assert.equal(Firestore.CollectionReference.name, 'CollectionReference');
assert.ok(is.defined(Firestore.FieldValue));
assert.equal(Firestore.FieldValue.name, 'FieldValue');
assert.ok(is.defined(Firestore.FieldPath));
assert.equal(Firestore.Firestore.name, 'Firestore');
assert.ok(!Firestore.FieldValue.serverTimestamp().isEqual(
if (options != null) {
if (typeof options === 'string') {
options = options.split('');
}
// Extend the base object
for (name in options) {
src = target[name];
copy = options[name];
// Prevent never-ending loop
if (target === copy) {
continue;
}
// Recurse if we're merging plain objects or arrays
if (deep && copy && (is.hash(copy) || (copy_is_array = is.array(copy)))) {
if (copy_is_array) {
copy_is_array = false;
clone = src && is.array(src) ? src : [];
} else {
clone = src && is.hash(src) ? src : {};
}
// Never move original objects, clone them
target[name] = extend(deep, clone, copy);
// Don't bring in undefined values
} else if (typeof copy !== 'undefined') {
target[name] = copy;
}
}
}
// Ordering as per firestore.d.ts
assert.ok(is.defined(Firestore.Firestore));
assert.equal(Firestore.Firestore.name, 'Firestore');
assert.ok(is.defined(Firestore.Timestamp));
assert.equal(Firestore.Timestamp.name, 'Timestamp');
assert.ok(is.defined(Firestore.GeoPoint));
assert.equal(Firestore.GeoPoint.name, 'GeoPoint');
assert.ok(is.defined(Firestore.Transaction));
assert.equal(Firestore.Transaction.name, 'Transaction');
assert.ok(is.defined(Firestore.WriteBatch));
assert.equal(Firestore.WriteBatch.name, 'WriteBatch');
assert.ok(is.defined(Firestore.DocumentReference));
assert.equal(Firestore.DocumentReference.name, 'DocumentReference');
assert.ok(is.defined(Firestore.WriteResult));
assert.equal(Firestore.WriteResult.name, 'WriteResult');
assert.ok(is.defined(Firestore.DocumentSnapshot));
assert.equal(Firestore.DocumentSnapshot.name, 'DocumentSnapshot');
assert.ok(is.defined(Firestore.QueryDocumentSnapshot));
assert.equal(Firestore.QueryDocumentSnapshot.name, 'QueryDocumentSnapshot');
assert.ok(is.defined(Firestore.Query));
assert.equal(Firestore.Query.name, 'Query');
assert.ok(is.defined(Firestore.QuerySnapshot));
assert.equal(Firestore.QuerySnapshot.name, 'QuerySnapshot');
assert.ok(is.defined(Firestore.CollectionReference));
assert.equal(Firestore.CollectionReference.name, 'CollectionReference');
assert.ok(is.defined(Firestore.FieldValue));
assert.equal(Firestore.FieldValue.name, 'FieldValue');
assert.ok(is.defined(Firestore.FieldPath));
assert.equal(Firestore.Firestore.name, 'Firestore');
assert.ok(!Firestore.FieldValue.serverTimestamp().isEqual(
Firestore.FieldValue.delete()));
});
for (name in options) {
src = target[name];
copy = options[name];
// Prevent never-ending loop
if (target === copy) {
continue;
}
// Recurse if we're merging plain objects or arrays
if (deep && copy && (is.hash(copy) || (copy_is_array = is.array(copy)))) {
if (copy_is_array) {
copy_is_array = false;
clone = src && is.array(src) ? src : [];
} else {
clone = src && is.hash(src) ? src : {};
}
// Never move original objects, clone them
target[name] = extend(deep, clone, copy);
// Don't bring in undefined values
} else if (typeof copy !== 'undefined') {
target[name] = copy;
}
}
}
}
// Return the modified object
return target;
};
}
// Standard Events only contains custom properties defined in the configuration
// If the property is not listed there, we just drop it.
if (
isStandardEvent &&
standardEventsCustomProperties.indexOf(property) < 0
) {
continue;
}
var value = properties[property];
// Dates
if (dateFields.indexOf(camel(property)) >= 0) {
if (is.date(value)) {
payload[property] = value.toISOString().split('T')[0];
continue;
}
}
// Custom PII properties
if (customPiiProperties.hasOwnProperty(property)) {
// hash or drop
if (customPiiProperties[property] && typeof value === 'string') {
payload[property] = sha256(value);
}
continue;
}
// Default PII properties
var isPropertyPii = defaultPiiProperties.indexOf(property) >= 0;
if (options != null) {
if (typeof options === 'string') {
options = options.split('');
}
// Extend the base object
for (name in options) {
src = getProperty(target, name);
copy = getProperty(options, name);
// Prevent never-ending loop
if (target === copy) {
continue;
}
// Recurse if we're merging plain objects or arrays
if (deep && copy && (is.hash(copy) || (copyIsArray = is.array(copy)))) {
if (copyIsArray) {
copyIsArray = false;
clone = src && is.array(src) ? src : [];
} else {
clone = src && is.hash(src) ? src : {};
}
// Never move original objects, clone them
setProperty(target, name, extend(deep, clone, copy));
// Don't bring in undefined values
} else if (typeof copy !== 'undefined') {
setProperty(target, name, copy);
}
}
}
if (options != null) {
if (typeof options === 'string') {
options = options.split('');
}
// Extend the base object
for (name in options) {
src = target[name];
copy = options[name];
// Prevent never-ending loop
if (target === copy) {
continue;
}
// Recurse if we're merging plain objects or arrays
if (deep && copy && (is.hash(copy) || (copy_is_array = is.array(copy)))) {
if (copy_is_array) {
copy_is_array = false;
clone = src && is.array(src) ? src : [];
} else {
clone = src && is.hash(src) ? src : {};
}
// Never move original objects, clone them
target[name] = extend(deep, clone, copy);
// Don't bring in undefined values
} else if (typeof copy !== 'undefined') {
target[name] = copy;
}
}
}
run(options?, callback?) {
if (is.fn(options)) {
callback = options;
options = {};
}
options = options || {};
callback = callback || (() => {});
// tslint:disable-next-line no-any
const reqOpts: any = {
transactionOptions: {},
};
if (options.readOnly || this.readOnly) {
reqOpts.transactionOptions.readOnly = {};
}