initial commit
This commit is contained in:
54
server/node_modules/firebase-admin/lib/firestore/firestore-internal.d.ts
generated
vendored
Normal file
54
server/node_modules/firebase-admin/lib/firestore/firestore-internal.d.ts
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/*! firebase-admin v13.5.0 */
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2017 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Firestore, Settings } from '@google-cloud/firestore';
|
||||
import { App } from '../app';
|
||||
/**
|
||||
* Settings to pass to the Firestore constructor.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface FirestoreSettings {
|
||||
/**
|
||||
* Use HTTP/1.1 REST transport where possible.
|
||||
*
|
||||
* `preferRest` will force the use of HTTP/1.1 REST transport until a method
|
||||
* that requires gRPC is called. When a method requires gRPC, this Firestore
|
||||
* client will load dependent gRPC libraries and then use gRPC transport for
|
||||
* all communication from that point forward. Currently the only operation
|
||||
* that requires gRPC is creating a snapshot listener using `onSnapshot()`.
|
||||
*
|
||||
* @defaultValue `undefined`
|
||||
*/
|
||||
preferRest?: boolean;
|
||||
}
|
||||
export declare class FirestoreService {
|
||||
private readonly appInternal;
|
||||
private readonly databases;
|
||||
private readonly firestoreSettings;
|
||||
constructor(app: App);
|
||||
initializeDatabase(databaseId: string, settings: FirestoreSettings): Firestore;
|
||||
getDatabase(databaseId: string): Firestore;
|
||||
private checkIfSameSettings;
|
||||
/**
|
||||
* Returns the app associated with this Storage instance.
|
||||
*
|
||||
* @returns The app associated with this Storage instance.
|
||||
*/
|
||||
get app(): App;
|
||||
}
|
||||
export declare function getFirestoreOptions(app: App, firestoreSettings?: FirestoreSettings): Settings;
|
||||
145
server/node_modules/firebase-admin/lib/firestore/firestore-internal.js
generated
vendored
Normal file
145
server/node_modules/firebase-admin/lib/firestore/firestore-internal.js
generated
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
/*! firebase-admin v13.5.0 */
|
||||
"use strict";
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2017 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FirestoreService = void 0;
|
||||
exports.getFirestoreOptions = getFirestoreOptions;
|
||||
const error_1 = require("../utils/error");
|
||||
const credential_internal_1 = require("../app/credential-internal");
|
||||
const validator = require("../utils/validator");
|
||||
const utils = require("../utils/index");
|
||||
class FirestoreService {
|
||||
constructor(app) {
|
||||
this.databases = new Map();
|
||||
this.firestoreSettings = new Map();
|
||||
this.appInternal = app;
|
||||
}
|
||||
initializeDatabase(databaseId, settings) {
|
||||
const existingInstance = this.databases.get(databaseId);
|
||||
if (existingInstance) {
|
||||
const initialSettings = this.firestoreSettings.get(databaseId) ?? {};
|
||||
if (this.checkIfSameSettings(settings, initialSettings)) {
|
||||
return existingInstance;
|
||||
}
|
||||
throw new error_1.FirebaseFirestoreError({
|
||||
code: 'failed-precondition',
|
||||
message: 'initializeFirestore() has already been called with ' +
|
||||
'different options. To avoid this error, call initializeFirestore() with the ' +
|
||||
'same options as when it was originally called, or call getFirestore() to return the' +
|
||||
' already initialized instance.'
|
||||
});
|
||||
}
|
||||
const newInstance = initFirestore(this.app, databaseId, settings);
|
||||
this.databases.set(databaseId, newInstance);
|
||||
this.firestoreSettings.set(databaseId, settings);
|
||||
return newInstance;
|
||||
}
|
||||
getDatabase(databaseId) {
|
||||
let database = this.databases.get(databaseId);
|
||||
if (database === undefined) {
|
||||
database = initFirestore(this.app, databaseId, {});
|
||||
this.databases.set(databaseId, database);
|
||||
this.firestoreSettings.set(databaseId, {});
|
||||
}
|
||||
return database;
|
||||
}
|
||||
checkIfSameSettings(settingsA, settingsB) {
|
||||
const a = settingsA ?? {};
|
||||
const b = settingsB ?? {};
|
||||
// If we start passing more settings to Firestore constructor,
|
||||
// replace this with deep equality check.
|
||||
return (a.preferRest === b.preferRest);
|
||||
}
|
||||
/**
|
||||
* Returns the app associated with this Storage instance.
|
||||
*
|
||||
* @returns The app associated with this Storage instance.
|
||||
*/
|
||||
get app() {
|
||||
return this.appInternal;
|
||||
}
|
||||
}
|
||||
exports.FirestoreService = FirestoreService;
|
||||
function getFirestoreOptions(app, firestoreSettings) {
|
||||
if (!validator.isNonNullObject(app) || !('options' in app)) {
|
||||
throw new error_1.FirebaseFirestoreError({
|
||||
code: 'invalid-argument',
|
||||
message: 'First argument passed to admin.firestore() must be a valid Firebase app instance.',
|
||||
});
|
||||
}
|
||||
const projectId = utils.getExplicitProjectId(app);
|
||||
const credential = app.options.credential;
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const sdkVersion = utils.getSdkVersion();
|
||||
const preferRest = firestoreSettings?.preferRest;
|
||||
if (credential instanceof credential_internal_1.ServiceAccountCredential) {
|
||||
return {
|
||||
credentials: {
|
||||
private_key: credential.privateKey,
|
||||
client_email: credential.clientEmail,
|
||||
},
|
||||
// When the SDK is initialized with ServiceAccountCredentials an explicit projectId is
|
||||
// guaranteed to be available.
|
||||
projectId: projectId,
|
||||
firebaseVersion: sdkVersion,
|
||||
firebaseAdminVersion: sdkVersion,
|
||||
preferRest,
|
||||
};
|
||||
}
|
||||
else if ((0, credential_internal_1.isApplicationDefault)(app.options.credential)) {
|
||||
// Try to use the Google application default credentials.
|
||||
// If an explicit project ID is not available, let Firestore client discover one from the
|
||||
// environment. This prevents the users from having to set GOOGLE_CLOUD_PROJECT in GCP runtimes.
|
||||
return validator.isNonEmptyString(projectId)
|
||||
? {
|
||||
projectId,
|
||||
firebaseVersion: sdkVersion,
|
||||
firebaseAdminVersion: sdkVersion,
|
||||
preferRest
|
||||
}
|
||||
: {
|
||||
firebaseVersion: sdkVersion,
|
||||
firebaseAdminVersion: sdkVersion,
|
||||
preferRest
|
||||
};
|
||||
}
|
||||
throw new error_1.FirebaseFirestoreError({
|
||||
code: 'invalid-credential',
|
||||
message: 'Failed to initialize Google Cloud Firestore client with the available credentials. ' +
|
||||
'Must initialize the SDK with a certificate credential or application default credentials ' +
|
||||
'to use Cloud Firestore API.',
|
||||
});
|
||||
}
|
||||
function initFirestore(app, databaseId, firestoreSettings) {
|
||||
const options = getFirestoreOptions(app, firestoreSettings);
|
||||
options.databaseId = databaseId;
|
||||
let firestoreDatabase;
|
||||
try {
|
||||
// Lazy-load the Firestore implementation here, which in turns loads gRPC.
|
||||
firestoreDatabase = require('@google-cloud/firestore').Firestore;
|
||||
}
|
||||
catch (err) {
|
||||
throw new error_1.FirebaseFirestoreError({
|
||||
code: 'missing-dependencies',
|
||||
message: 'Failed to import the Cloud Firestore client library for Node.js. '
|
||||
+ 'Make sure to install the "@google-cloud/firestore" npm package. '
|
||||
+ `Original error: ${err}`,
|
||||
});
|
||||
}
|
||||
return new firestoreDatabase(options);
|
||||
}
|
||||
71
server/node_modules/firebase-admin/lib/firestore/firestore-namespace.d.ts
generated
vendored
Normal file
71
server/node_modules/firebase-admin/lib/firestore/firestore-namespace.d.ts
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/*! firebase-admin v13.5.0 */
|
||||
/*!
|
||||
* Copyright 2021 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import * as _firestore from '@google-cloud/firestore';
|
||||
import { App } from '../app';
|
||||
export declare function firestore(app?: App): _firestore.Firestore;
|
||||
export declare namespace firestore {
|
||||
export import v1beta1 = _firestore.v1beta1;
|
||||
export import v1 = _firestore.v1;
|
||||
export import AggregateField = _firestore.AggregateField;
|
||||
export import AggregateFieldType = _firestore.AggregateFieldType;
|
||||
export import AggregateQuery = _firestore.AggregateQuery;
|
||||
export import AggregateQuerySnapshot = _firestore.AggregateQuerySnapshot;
|
||||
export import AggregateSpecData = _firestore.AggregateSpecData;
|
||||
export import AggregateSpec = _firestore.AggregateSpec;
|
||||
export import AggregateType = _firestore.AggregateType;
|
||||
export import BulkWriter = _firestore.BulkWriter;
|
||||
export import BulkWriterOptions = _firestore.BulkWriterOptions;
|
||||
export import BundleBuilder = _firestore.BundleBuilder;
|
||||
export import CollectionGroup = _firestore.CollectionGroup;
|
||||
export import CollectionReference = _firestore.CollectionReference;
|
||||
export import DocumentChange = _firestore.DocumentChange;
|
||||
export import DocumentChangeType = _firestore.DocumentChangeType;
|
||||
export import DocumentData = _firestore.DocumentData;
|
||||
export import DocumentReference = _firestore.DocumentReference;
|
||||
export import DocumentSnapshot = _firestore.DocumentSnapshot;
|
||||
export import FieldPath = _firestore.FieldPath;
|
||||
export import FieldValue = _firestore.FieldValue;
|
||||
export import Filter = _firestore.Filter;
|
||||
export import Firestore = _firestore.Firestore;
|
||||
export import FirestoreDataConverter = _firestore.FirestoreDataConverter;
|
||||
export import GeoPoint = _firestore.GeoPoint;
|
||||
export import GrpcStatus = _firestore.GrpcStatus;
|
||||
export import OrderByDirection = _firestore.OrderByDirection;
|
||||
export import Precondition = _firestore.Precondition;
|
||||
export import Query = _firestore.Query;
|
||||
export import QueryDocumentSnapshot = _firestore.QueryDocumentSnapshot;
|
||||
export import QueryPartition = _firestore.QueryPartition;
|
||||
export import QuerySnapshot = _firestore.QuerySnapshot;
|
||||
export import ReadOptions = _firestore.ReadOptions;
|
||||
export import Settings = _firestore.Settings;
|
||||
export import SetOptions = _firestore.SetOptions;
|
||||
export import Timestamp = _firestore.Timestamp;
|
||||
export import Transaction = _firestore.Transaction;
|
||||
export import UpdateData = _firestore.UpdateData;
|
||||
export import WhereFilterOp = _firestore.WhereFilterOp;
|
||||
export import WriteBatch = _firestore.WriteBatch;
|
||||
export import WriteResult = _firestore.WriteResult;
|
||||
export import PartialWithFieldValue = _firestore.PartialWithFieldValue;
|
||||
export import WithFieldValue = _firestore.WithFieldValue;
|
||||
export import Primitive = _firestore.Primitive;
|
||||
export import NestedUpdateFields = _firestore.NestedUpdateFields;
|
||||
export import ChildUpdateFields = _firestore.ChildUpdateFields;
|
||||
export import AddPrefixToKeys = _firestore.AddPrefixToKeys;
|
||||
export import UnionToIntersection = _firestore.UnionToIntersection;
|
||||
export import ReadOnlyTransactionOptions = _firestore.ReadOnlyTransactionOptions;
|
||||
export import setLogFunction = _firestore.setLogFunction;
|
||||
}
|
||||
52
server/node_modules/firebase-admin/lib/firestore/firestore-namespace.js
generated
vendored
Normal file
52
server/node_modules/firebase-admin/lib/firestore/firestore-namespace.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*! firebase-admin v13.5.0 */
|
||||
"use strict";
|
||||
/*!
|
||||
* Copyright 2021 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.firestore = void 0;
|
||||
const _firestore = require("@google-cloud/firestore");
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
var firestore;
|
||||
(function (firestore) {
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
// See https://github.com/typescript-eslint/typescript-eslint/issues/363
|
||||
firestore.v1beta1 = _firestore.v1beta1;
|
||||
firestore.v1 = _firestore.v1;
|
||||
firestore.AggregateField = _firestore.AggregateField;
|
||||
firestore.AggregateQuery = _firestore.AggregateQuery;
|
||||
firestore.AggregateQuerySnapshot = _firestore.AggregateQuerySnapshot;
|
||||
firestore.BulkWriter = _firestore.BulkWriter;
|
||||
firestore.BundleBuilder = _firestore.BundleBuilder;
|
||||
firestore.CollectionGroup = _firestore.CollectionGroup;
|
||||
firestore.CollectionReference = _firestore.CollectionReference;
|
||||
firestore.DocumentReference = _firestore.DocumentReference;
|
||||
firestore.DocumentSnapshot = _firestore.DocumentSnapshot;
|
||||
firestore.FieldPath = _firestore.FieldPath;
|
||||
firestore.FieldValue = _firestore.FieldValue;
|
||||
firestore.Filter = _firestore.Filter;
|
||||
firestore.Firestore = _firestore.Firestore;
|
||||
firestore.GeoPoint = _firestore.GeoPoint;
|
||||
firestore.GrpcStatus = _firestore.GrpcStatus;
|
||||
firestore.Query = _firestore.Query;
|
||||
firestore.QueryDocumentSnapshot = _firestore.QueryDocumentSnapshot;
|
||||
firestore.QueryPartition = _firestore.QueryPartition;
|
||||
firestore.QuerySnapshot = _firestore.QuerySnapshot;
|
||||
firestore.Timestamp = _firestore.Timestamp;
|
||||
firestore.Transaction = _firestore.Transaction;
|
||||
firestore.WriteBatch = _firestore.WriteBatch;
|
||||
firestore.WriteResult = _firestore.WriteResult;
|
||||
firestore.setLogFunction = _firestore.setLogFunction;
|
||||
})(firestore || (exports.firestore = firestore = {}));
|
||||
130
server/node_modules/firebase-admin/lib/firestore/index.d.ts
generated
vendored
Normal file
130
server/node_modules/firebase-admin/lib/firestore/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
/*! firebase-admin v13.5.0 */
|
||||
/*!
|
||||
* Copyright 2020 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Cloud Firestore.
|
||||
*
|
||||
* @packageDocumentation
|
||||
*/
|
||||
import { Firestore } from '@google-cloud/firestore';
|
||||
import { App } from '../app';
|
||||
import { FirestoreSettings } from './firestore-internal';
|
||||
export { AddPrefixToKeys, AggregateField, AggregateFieldType, AggregateQuery, AggregateQuerySnapshot, AggregateSpecData, AggregateSpec, AggregateType, BulkWriter, BulkWriterOptions, BundleBuilder, ChildUpdateFields, CollectionGroup, CollectionReference, DocumentChange, DocumentChangeType, DocumentData, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Filter, Firestore, FirestoreDataConverter, GeoPoint, GrpcStatus, NestedUpdateFields, OrderByDirection, PartialWithFieldValue, Precondition, Primitive, Query, QueryDocumentSnapshot, QueryPartition, QuerySnapshot, ReadOptions, ReadOnlyTransactionOptions, ReadWriteTransactionOptions, Settings, SetOptions, Timestamp, Transaction, UpdateData, UnionToIntersection, WhereFilterOp, WithFieldValue, WriteBatch, WriteResult, v1, setLogFunction, } from '@google-cloud/firestore';
|
||||
export { FirestoreSettings };
|
||||
/**
|
||||
* Gets the default {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
|
||||
* service for the default app.
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* // Get the default Firestore service for the default app
|
||||
* const defaultFirestore = getFirestore();
|
||||
* ```
|
||||
|
||||
* @returns The default {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
|
||||
* service for the default app.
|
||||
*/
|
||||
export declare function getFirestore(): Firestore;
|
||||
/**
|
||||
* Gets the default {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
|
||||
* service for the given app.
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* // Get the default Firestore service for a specific app
|
||||
* const otherFirestore = getFirestore(app);
|
||||
* ```
|
||||
*
|
||||
* @param app - which `Firestore` service to return.
|
||||
*
|
||||
* @returns The default {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
|
||||
* service associated with the provided app.
|
||||
*/
|
||||
export declare function getFirestore(app: App): Firestore;
|
||||
/**
|
||||
* Gets the named {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
|
||||
* service for the default app.
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* // Get the Firestore service for a named database and default app
|
||||
* const otherFirestore = getFirestore('otherDb');
|
||||
* ```
|
||||
*
|
||||
* @param databaseId - name of database to return.
|
||||
*
|
||||
* @returns The named {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
|
||||
* service for the default app.
|
||||
* @beta
|
||||
*/
|
||||
export declare function getFirestore(databaseId: string): Firestore;
|
||||
/**
|
||||
* Gets the named {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
|
||||
* service for the given app.
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* // Get the Firestore service for a named database and specific app.
|
||||
* const otherFirestore = getFirestore('otherDb');
|
||||
* ```
|
||||
*
|
||||
* @param app - which `Firestore` service to return.
|
||||
*
|
||||
* @param databaseId - name of database to return.
|
||||
*
|
||||
* @returns The named {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
|
||||
* service associated with the provided app.
|
||||
* @beta
|
||||
*/
|
||||
export declare function getFirestore(app: App, databaseId: string): Firestore;
|
||||
/**
|
||||
* Gets the default {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
|
||||
* service for the given app, passing extra parameters to its constructor.
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* // Get the Firestore service for a specific app, require HTTP/1.1 REST transport
|
||||
* const otherFirestore = initializeFirestore(app, {preferRest: true});
|
||||
* ```
|
||||
*
|
||||
* @param app - which `Firestore` service to return.
|
||||
*
|
||||
* @param settings - Settings object to be passed to the constructor.
|
||||
*
|
||||
* @returns The default `Firestore` service associated with the provided app and settings.
|
||||
*/
|
||||
export declare function initializeFirestore(app: App, settings?: FirestoreSettings): Firestore;
|
||||
/**
|
||||
* Gets the named {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
|
||||
* service for the given app, passing extra parameters to its constructor.
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* // Get the Firestore service for a specific app, require HTTP/1.1 REST transport
|
||||
* const otherFirestore = initializeFirestore(app, {preferRest: true}, 'otherDb');
|
||||
* ```
|
||||
*
|
||||
* @param app - which `Firestore` service to return.
|
||||
*
|
||||
* @param settings - Settings object to be passed to the constructor.
|
||||
*
|
||||
* @param databaseId - name of database to return.
|
||||
*
|
||||
* @returns The named `Firestore` service associated with the provided app and settings.
|
||||
* @beta
|
||||
*/
|
||||
export declare function initializeFirestore(app: App, settings: FirestoreSettings, databaseId: string): Firestore;
|
||||
export { FirebaseFirestoreError } from '../utils/error';
|
||||
66
server/node_modules/firebase-admin/lib/firestore/index.js
generated
vendored
Normal file
66
server/node_modules/firebase-admin/lib/firestore/index.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/*! firebase-admin v13.5.0 */
|
||||
"use strict";
|
||||
/*!
|
||||
* Copyright 2020 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FirebaseFirestoreError = exports.setLogFunction = exports.v1 = exports.WriteResult = exports.WriteBatch = exports.Transaction = exports.Timestamp = exports.QuerySnapshot = exports.QueryPartition = exports.QueryDocumentSnapshot = exports.Query = exports.GrpcStatus = exports.GeoPoint = exports.Firestore = exports.Filter = exports.FieldValue = exports.FieldPath = exports.DocumentSnapshot = exports.DocumentReference = exports.CollectionReference = exports.CollectionGroup = exports.BundleBuilder = exports.BulkWriter = exports.AggregateQuerySnapshot = exports.AggregateQuery = exports.AggregateField = void 0;
|
||||
exports.getFirestore = getFirestore;
|
||||
exports.initializeFirestore = initializeFirestore;
|
||||
const app_1 = require("../app");
|
||||
const firestore_internal_1 = require("./firestore-internal");
|
||||
const path_1 = require("@google-cloud/firestore/build/src/path");
|
||||
var firestore_1 = require("@google-cloud/firestore");
|
||||
Object.defineProperty(exports, "AggregateField", { enumerable: true, get: function () { return firestore_1.AggregateField; } });
|
||||
Object.defineProperty(exports, "AggregateQuery", { enumerable: true, get: function () { return firestore_1.AggregateQuery; } });
|
||||
Object.defineProperty(exports, "AggregateQuerySnapshot", { enumerable: true, get: function () { return firestore_1.AggregateQuerySnapshot; } });
|
||||
Object.defineProperty(exports, "BulkWriter", { enumerable: true, get: function () { return firestore_1.BulkWriter; } });
|
||||
Object.defineProperty(exports, "BundleBuilder", { enumerable: true, get: function () { return firestore_1.BundleBuilder; } });
|
||||
Object.defineProperty(exports, "CollectionGroup", { enumerable: true, get: function () { return firestore_1.CollectionGroup; } });
|
||||
Object.defineProperty(exports, "CollectionReference", { enumerable: true, get: function () { return firestore_1.CollectionReference; } });
|
||||
Object.defineProperty(exports, "DocumentReference", { enumerable: true, get: function () { return firestore_1.DocumentReference; } });
|
||||
Object.defineProperty(exports, "DocumentSnapshot", { enumerable: true, get: function () { return firestore_1.DocumentSnapshot; } });
|
||||
Object.defineProperty(exports, "FieldPath", { enumerable: true, get: function () { return firestore_1.FieldPath; } });
|
||||
Object.defineProperty(exports, "FieldValue", { enumerable: true, get: function () { return firestore_1.FieldValue; } });
|
||||
Object.defineProperty(exports, "Filter", { enumerable: true, get: function () { return firestore_1.Filter; } });
|
||||
Object.defineProperty(exports, "Firestore", { enumerable: true, get: function () { return firestore_1.Firestore; } });
|
||||
Object.defineProperty(exports, "GeoPoint", { enumerable: true, get: function () { return firestore_1.GeoPoint; } });
|
||||
Object.defineProperty(exports, "GrpcStatus", { enumerable: true, get: function () { return firestore_1.GrpcStatus; } });
|
||||
Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return firestore_1.Query; } });
|
||||
Object.defineProperty(exports, "QueryDocumentSnapshot", { enumerable: true, get: function () { return firestore_1.QueryDocumentSnapshot; } });
|
||||
Object.defineProperty(exports, "QueryPartition", { enumerable: true, get: function () { return firestore_1.QueryPartition; } });
|
||||
Object.defineProperty(exports, "QuerySnapshot", { enumerable: true, get: function () { return firestore_1.QuerySnapshot; } });
|
||||
Object.defineProperty(exports, "Timestamp", { enumerable: true, get: function () { return firestore_1.Timestamp; } });
|
||||
Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return firestore_1.Transaction; } });
|
||||
Object.defineProperty(exports, "WriteBatch", { enumerable: true, get: function () { return firestore_1.WriteBatch; } });
|
||||
Object.defineProperty(exports, "WriteResult", { enumerable: true, get: function () { return firestore_1.WriteResult; } });
|
||||
Object.defineProperty(exports, "v1", { enumerable: true, get: function () { return firestore_1.v1; } });
|
||||
Object.defineProperty(exports, "setLogFunction", { enumerable: true, get: function () { return firestore_1.setLogFunction; } });
|
||||
function getFirestore(appOrDatabaseId, optionalDatabaseId) {
|
||||
const app = typeof appOrDatabaseId === 'object' ? appOrDatabaseId : (0, app_1.getApp)();
|
||||
const databaseId = (typeof appOrDatabaseId === 'string' ? appOrDatabaseId : optionalDatabaseId) || path_1.DEFAULT_DATABASE_ID;
|
||||
const firebaseApp = app;
|
||||
const firestoreService = firebaseApp.getOrInitService('firestore', (app) => new firestore_internal_1.FirestoreService(app));
|
||||
return firestoreService.getDatabase(databaseId);
|
||||
}
|
||||
function initializeFirestore(app, settings, databaseId) {
|
||||
settings ?? (settings = {});
|
||||
databaseId ?? (databaseId = path_1.DEFAULT_DATABASE_ID);
|
||||
const firebaseApp = app;
|
||||
const firestoreService = firebaseApp.getOrInitService('firestore', (app) => new firestore_internal_1.FirestoreService(app));
|
||||
return firestoreService.initializeDatabase(databaseId, settings);
|
||||
}
|
||||
var error_1 = require("../utils/error");
|
||||
Object.defineProperty(exports, "FirebaseFirestoreError", { enumerable: true, get: function () { return error_1.FirebaseFirestoreError; } });
|
||||
Reference in New Issue
Block a user