firelordjs
Version:
🔥 High Precision Typescript Wrapper for Firestore Web, Providing Unparalleled Type Safe and Dev Experience
32 lines (31 loc) • 1.22 kB
JavaScript
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
import { query as query_ } from 'firebase/firestore';
import { queryBuilder } from './utils';
/**
* Creates a new immutable instance of {@link Query} that is extended to also include
* additional query constraints.
*
* @param query - The {@link Query} instance to use as a base for the new constraints.
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
* @throws if any of the provided query constraints cannot be combined with the
* existing or new constraints.
*/
export var query = function (query) {
var queryConstraints = [];
for (var _i = 1; _i < arguments.length; _i++) {
queryConstraints[_i - 1] = arguments[_i];
}
return query_.apply(void 0, __spreadArray([
// @ts-expect-error
query], queryBuilder(
// @ts-expect-error
queryConstraints), false));
};