@firebase/firestore 4.7.11-firebase-studio-sdk-integration.226be0bb1 → 4.7.11-firebase-studio-sdk-integration.9de25069c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/firestore/src/platform/browser/webchannel_connection.d.ts +1 -1
- package/dist/firestore/src/platform/browser_lite/fetch_connection.d.ts +1 -1
- package/dist/firestore/src/remote/rest_connection.d.ts +1 -1
- package/dist/index.cjs.js +6 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +7 -5
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +3 -3
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +4 -4
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +6 -4
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/firestore/src/platform/browser/webchannel_connection.d.ts +1 -1
- package/dist/lite/firestore/src/platform/browser_lite/fetch_connection.d.ts +1 -1
- package/dist/lite/firestore/src/remote/rest_connection.d.ts +1 -1
- package/dist/lite/index.browser.esm2017.js +31 -29
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.cjs.js +31 -29
- package/dist/lite/index.cjs.js.map +1 -1
- package/dist/lite/index.node.cjs.js +8 -6
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +9 -7
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +25 -23
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/package.json +9 -9
package/dist/lite/index.cjs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { _registerComponent, registerVersion, _isFirebaseServerApp, _getProvider, getApp, _removeServiceInstance, SDK_VERSION } from '@firebase/app';
|
|
2
2
|
import { Component } from '@firebase/component';
|
|
3
3
|
import { Logger, LogLevel } from '@firebase/logger';
|
|
4
|
-
import { FirebaseError, getDefaultEmulatorHostnameAndPort, isCloudWorkstation,
|
|
4
|
+
import { FirebaseError, getDefaultEmulatorHostnameAndPort, isCloudWorkstation, pingServer, deepEqual, createMockUserToken, getModularInstance } from '@firebase/util';
|
|
5
5
|
import { Integer } from '@firebase/webchannel-wrapper/bloom-blob';
|
|
6
6
|
|
|
7
|
-
const T = "4.7.11-firebase-studio-sdk-integration.
|
|
7
|
+
const T = "4.7.11-firebase-studio-sdk-integration.9de25069c";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @license
|
|
@@ -65,7 +65,7 @@ User.MOCK_USER = new User("mock-user");
|
|
|
65
65
|
* See the License for the specific language governing permissions and
|
|
66
66
|
* limitations under the License.
|
|
67
67
|
*/
|
|
68
|
-
let A = "11.6.1-firebase-studio-sdk-integration.
|
|
68
|
+
let A = "11.6.1-firebase-studio-sdk-integration.9de25069c";
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* @license
|
|
@@ -219,7 +219,7 @@ e) {
|
|
|
219
219
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
220
220
|
* See the License for the specific language governing permissions and
|
|
221
221
|
* limitations under the License.
|
|
222
|
-
*/ const R = "ok", I = "cancelled", V = "unknown", p = "invalid-argument", y = "deadline-exceeded", g = "not-found", w = "already-exists", F = "permission-denied", v = "unauthenticated",
|
|
222
|
+
*/ const R = "ok", I = "cancelled", V = "unknown", p = "invalid-argument", y = "deadline-exceeded", g = "not-found", w = "already-exists", F = "permission-denied", v = "unauthenticated", D = "resource-exhausted", b = "failed-precondition", C = "aborted", S = "out-of-range", N = "unimplemented", O = "internal", q = "unavailable", B = "data-loss";
|
|
223
223
|
|
|
224
224
|
/** An error returned by a Firestore operation. */ class FirestoreError extends FirebaseError {
|
|
225
225
|
/** @hideconstructor */
|
|
@@ -1139,7 +1139,9 @@ class __PRIVATE_RestConnection {
|
|
|
1139
1139
|
"google-cloud-resource-prefix": this.R,
|
|
1140
1140
|
"x-goog-request-params": this.I
|
|
1141
1141
|
};
|
|
1142
|
-
|
|
1142
|
+
this.F(a, n, i);
|
|
1143
|
+
const {host: u} = new URL(o), _ = isCloudWorkstation(u);
|
|
1144
|
+
return this.v(t, o, a, r, _).then((e => (__PRIVATE_logDebug(M, `Received RPC '${t}' ${s}: `, e),
|
|
1143
1145
|
e)), (e => {
|
|
1144
1146
|
throw __PRIVATE_logWarn(M, `RPC '${t}' ${s} failed with error: `, e, "url: ", o, "request:", r),
|
|
1145
1147
|
e;
|
|
@@ -1230,7 +1232,7 @@ function __PRIVATE_mapCodeFromHttpStatus(t) {
|
|
|
1230
1232
|
|
|
1231
1233
|
case 400:
|
|
1232
1234
|
// Bad Request
|
|
1233
|
-
return
|
|
1235
|
+
return b;
|
|
1234
1236
|
|
|
1235
1237
|
// Other possibilities based on the forward mapping
|
|
1236
1238
|
// return Code.INVALID_ARGUMENT;
|
|
@@ -1259,7 +1261,7 @@ function __PRIVATE_mapCodeFromHttpStatus(t) {
|
|
|
1259
1261
|
|
|
1260
1262
|
case 429:
|
|
1261
1263
|
// Too Many Requests
|
|
1262
|
-
return
|
|
1264
|
+
return D;
|
|
1263
1265
|
|
|
1264
1266
|
case 499:
|
|
1265
1267
|
// Client Closed Request
|
|
@@ -1285,7 +1287,7 @@ function __PRIVATE_mapCodeFromHttpStatus(t) {
|
|
|
1285
1287
|
return y;
|
|
1286
1288
|
|
|
1287
1289
|
default:
|
|
1288
|
-
return t >= 200 && t < 300 ? R : t >= 400 && t < 500 ?
|
|
1290
|
+
return t >= 200 && t < 300 ? R : t >= 400 && t < 500 ? b : t >= 500 && t < 600 ? O : V;
|
|
1289
1291
|
}
|
|
1290
1292
|
}
|
|
1291
1293
|
|
|
@@ -1330,7 +1332,7 @@ class __PRIVATE_FetchConnection extends __PRIVATE_RestConnection {
|
|
|
1330
1332
|
headers: r,
|
|
1331
1333
|
body: o
|
|
1332
1334
|
};
|
|
1333
|
-
|
|
1335
|
+
i && (t.credentials = "include"), a = await fetch(e, t);
|
|
1334
1336
|
} catch (t) {
|
|
1335
1337
|
const e = t;
|
|
1336
1338
|
throw new FirestoreError(__PRIVATE_mapCodeFromHttpStatus(e.status), "Request failed with error: " + e.statusText);
|
|
@@ -4085,7 +4087,7 @@ class __PRIVATE_ExponentialBackoff {
|
|
|
4085
4087
|
this.serializer = n, this.et = !1;
|
|
4086
4088
|
}
|
|
4087
4089
|
rt() {
|
|
4088
|
-
if (this.et) throw new FirestoreError(
|
|
4090
|
+
if (this.et) throw new FirestoreError(b, "The client has already been terminated.");
|
|
4089
4091
|
}
|
|
4090
4092
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ V(t, e, r, n) {
|
|
4091
4093
|
return this.rt(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, s]) => this.connection.V(t, __PRIVATE_toResourcePath(e, r), n, i, s))).catch((t => {
|
|
@@ -4224,7 +4226,7 @@ async function __PRIVATE_invokeRunAggregationQueryRpc(t, e, r) {
|
|
|
4224
4226
|
* instance is terminated.
|
|
4225
4227
|
*/
|
|
4226
4228
|
function __PRIVATE_getDatastore(t) {
|
|
4227
|
-
if (t._terminated) throw new FirestoreError(
|
|
4229
|
+
if (t._terminated) throw new FirestoreError(b, "The client has already been terminated.");
|
|
4228
4230
|
if (!nt.has(t)) {
|
|
4229
4231
|
__PRIVATE_logDebug(rt, "Initializing Datastore");
|
|
4230
4232
|
const e = function __PRIVATE_newConnection(t) {
|
|
@@ -4377,7 +4379,7 @@ class Firestore {
|
|
|
4377
4379
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
4378
4380
|
* instance.
|
|
4379
4381
|
*/ get app() {
|
|
4380
|
-
if (!this._app) throw new FirestoreError(
|
|
4382
|
+
if (!this._app) throw new FirestoreError(b, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
4381
4383
|
return this._app;
|
|
4382
4384
|
}
|
|
4383
4385
|
get _initialized() {
|
|
@@ -4387,7 +4389,7 @@ class Firestore {
|
|
|
4387
4389
|
return "notTerminated" !== this._terminateTask;
|
|
4388
4390
|
}
|
|
4389
4391
|
_setSettings(t) {
|
|
4390
|
-
if (this._settingsFrozen) throw new FirestoreError(
|
|
4392
|
+
if (this._settingsFrozen) throw new FirestoreError(b, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
|
|
4391
4393
|
this._settings = new FirestoreSettingsImpl(t), this._emulatorOptions = t.emulatorOptions || {},
|
|
4392
4394
|
void 0 !== t.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(t) {
|
|
4393
4395
|
if (!t) return new __PRIVATE_EmptyAuthCredentialsProvider;
|
|
@@ -4448,7 +4450,7 @@ class Firestore {
|
|
|
4448
4450
|
function initializeFirestore(t, e, r) {
|
|
4449
4451
|
r || (r = $);
|
|
4450
4452
|
const n = _getProvider(t, "firestore/lite");
|
|
4451
|
-
if (n.isInitialized(r)) throw new FirestoreError(
|
|
4453
|
+
if (n.isInitialized(r)) throw new FirestoreError(b, "Firestore can only be initialized once per app.");
|
|
4452
4454
|
return n.initialize({
|
|
4453
4455
|
options: e,
|
|
4454
4456
|
instanceIdentifier: r
|
|
@@ -4484,7 +4486,7 @@ function getFirestore(t, r) {
|
|
|
4484
4486
|
const s = isCloudWorkstation(e), o = t._getSettings(), a = Object.assign(Object.assign({}, o), {
|
|
4485
4487
|
emulatorOptions: t._getEmulatorOptions()
|
|
4486
4488
|
}), u = `${e}:${r}`;
|
|
4487
|
-
s &&
|
|
4489
|
+
s && pingServer(`https://${u}`), o.host !== st && o.host !== u && __PRIVATE_logWarn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");
|
|
4488
4490
|
const _ = Object.assign(Object.assign({}, o), {
|
|
4489
4491
|
host: u,
|
|
4490
4492
|
ssl: s,
|
|
@@ -6794,7 +6796,7 @@ function sum(t) {
|
|
|
6794
6796
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
6795
6797
|
}
|
|
6796
6798
|
_verifyNotCommitted() {
|
|
6797
|
-
if (this._committed) throw new FirestoreError(
|
|
6799
|
+
if (this._committed) throw new FirestoreError(b, "A write batch can no longer be used after commit() has been called.");
|
|
6798
6800
|
}
|
|
6799
6801
|
}
|
|
6800
6802
|
|
|
@@ -7040,7 +7042,7 @@ class __PRIVATE_TransactionRunner {
|
|
|
7040
7042
|
case I:
|
|
7041
7043
|
case V:
|
|
7042
7044
|
case y:
|
|
7043
|
-
case
|
|
7045
|
+
case D:
|
|
7044
7046
|
case O:
|
|
7045
7047
|
case q:
|
|
7046
7048
|
// Unauthenticated means something went wrong with our token and we need
|
|
@@ -7052,7 +7054,7 @@ class __PRIVATE_TransactionRunner {
|
|
|
7052
7054
|
case g:
|
|
7053
7055
|
case w:
|
|
7054
7056
|
case F:
|
|
7055
|
-
case
|
|
7057
|
+
case b:
|
|
7056
7058
|
// Aborted might be retried in some scenarios, but that is dependent on
|
|
7057
7059
|
// the context and should handled individually by the calling code.
|
|
7058
7060
|
// See https://cloud.google.com/apis/design/errors.
|
|
@@ -7202,10 +7204,10 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7202
7204
|
constructor(t = Promise.resolve()) {
|
|
7203
7205
|
// A list of retryable operations. Retryable operations are run in order and
|
|
7204
7206
|
// retried with backoff.
|
|
7205
|
-
this.
|
|
7207
|
+
this.Dt = [],
|
|
7206
7208
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
7207
7209
|
// be changed again.
|
|
7208
|
-
this.
|
|
7210
|
+
this.bt = !1,
|
|
7209
7211
|
// Operations scheduled to be queued in the future. Operations are
|
|
7210
7212
|
// automatically removed after they are run or canceled.
|
|
7211
7213
|
this.Ct = [],
|
|
@@ -7232,7 +7234,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7232
7234
|
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.Bt);
|
|
7233
7235
|
}
|
|
7234
7236
|
get isShuttingDown() {
|
|
7235
|
-
return this.
|
|
7237
|
+
return this.bt;
|
|
7236
7238
|
}
|
|
7237
7239
|
/**
|
|
7238
7240
|
* Adds a new operation to the queue without waiting for it to complete (i.e.
|
|
@@ -7247,33 +7249,33 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7247
7249
|
this.Lt(t);
|
|
7248
7250
|
}
|
|
7249
7251
|
enterRestrictedMode(t) {
|
|
7250
|
-
if (!this.
|
|
7251
|
-
this.
|
|
7252
|
+
if (!this.bt) {
|
|
7253
|
+
this.bt = !0, this.Ot = t || !1;
|
|
7252
7254
|
const e = getDocument();
|
|
7253
7255
|
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Bt);
|
|
7254
7256
|
}
|
|
7255
7257
|
}
|
|
7256
7258
|
enqueue(t) {
|
|
7257
|
-
if (this.Qt(), this.
|
|
7259
|
+
if (this.Qt(), this.bt)
|
|
7258
7260
|
// Return a Promise which never resolves.
|
|
7259
7261
|
return new Promise((() => {}));
|
|
7260
7262
|
// Create a deferred Promise that we can return to the callee. This
|
|
7261
7263
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
7262
7264
|
// advance the queue even when the operation is not run.
|
|
7263
7265
|
const e = new __PRIVATE_Deferred;
|
|
7264
|
-
return this.Lt((() => this.
|
|
7266
|
+
return this.Lt((() => this.bt && this.Ot ? Promise.resolve() : (t().then(e.resolve, e.reject),
|
|
7265
7267
|
e.promise))).then((() => e.promise));
|
|
7266
7268
|
}
|
|
7267
7269
|
enqueueRetryable(t) {
|
|
7268
|
-
this.enqueueAndForget((() => (this.
|
|
7270
|
+
this.enqueueAndForget((() => (this.Dt.push(t), this.kt())));
|
|
7269
7271
|
}
|
|
7270
7272
|
/**
|
|
7271
7273
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
7272
7274
|
* reschedules with backoff.
|
|
7273
7275
|
*/ async kt() {
|
|
7274
|
-
if (0 !== this.
|
|
7276
|
+
if (0 !== this.Dt.length) {
|
|
7275
7277
|
try {
|
|
7276
|
-
await this.
|
|
7278
|
+
await this.Dt[0](), this.Dt.shift(), this.Vt.reset();
|
|
7277
7279
|
} catch (t) {
|
|
7278
7280
|
if (!
|
|
7279
7281
|
/**
|
|
@@ -7301,7 +7303,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7301
7303
|
// Failure will be handled by AsyncQueue
|
|
7302
7304
|
__PRIVATE_logDebug(ct, "Operation failed with retryable error: " + t);
|
|
7303
7305
|
}
|
|
7304
|
-
this.
|
|
7306
|
+
this.Dt.length > 0 &&
|
|
7305
7307
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
7306
7308
|
// This is necessary to run retryable operations that failed during
|
|
7307
7309
|
// their initial attempt since we don't know whether they are already
|