@firebase/firestore 3.4.3-202202014332 → 3.4.3-canary.2d04af91d
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/api/database.d.ts +14 -9
- package/dist/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/firestore/src/api.d.ts +1 -0
- package/dist/firestore/src/model/field_index.d.ts +76 -0
- package/dist/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/index.d.ts +15 -9
- package/dist/index.esm2017.js +70 -13
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +85 -28
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +91 -11
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +91 -12
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +112 -13
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +118 -9
- package/dist/lite/firestore/src/api/database.d.ts +14 -9
- package/dist/lite/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/lite/firestore/src/api.d.ts +1 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +76 -0
- package/dist/lite/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +42 -42
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/src/api/database.d.ts +14 -9
- package/dist/lite/packages/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/lite/packages/firestore/src/api.d.ts +1 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +76 -0
- package/dist/lite/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/packages/firestore/dist/index.esm2017.d.ts +31 -10
- package/dist/packages/firestore/src/api/database.d.ts +14 -9
- package/dist/packages/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/packages/firestore/src/api.d.ts +1 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +76 -0
- package/dist/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/private.d.ts +22 -9
- package/package.json +9 -9
package/dist/index.node.cjs.js
CHANGED
|
@@ -12,7 +12,7 @@ var grpcJs = require('@grpc/grpc-js');
|
|
|
12
12
|
var protoLoader = require('@grpc/proto-loader');
|
|
13
13
|
|
|
14
14
|
const name = "@firebase/firestore";
|
|
15
|
-
const version$1 = "3.4.3-
|
|
15
|
+
const version$1 = "3.4.3-canary.2d04af91d";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @license
|
|
@@ -65,7 +65,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
65
65
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
66
66
|
User.MOCK_USER = new User('mock-user');
|
|
67
67
|
|
|
68
|
-
const version = "9.6.4-
|
|
68
|
+
const version = "9.6.4-canary.2d04af91d";
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* @license
|
|
@@ -23517,13 +23517,13 @@ function terminate(firestore) {
|
|
|
23517
23517
|
/**
|
|
23518
23518
|
* Loads a Firestore bundle into the local cache.
|
|
23519
23519
|
*
|
|
23520
|
-
* @param firestore - The {@link Firestore} instance to load bundles for
|
|
23521
|
-
* @param bundleData - An object representing the bundle to be loaded. Valid
|
|
23522
|
-
*
|
|
23520
|
+
* @param firestore - The {@link Firestore} instance to load bundles for.
|
|
23521
|
+
* @param bundleData - An object representing the bundle to be loaded. Valid
|
|
23522
|
+
* objects are `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`.
|
|
23523
23523
|
*
|
|
23524
|
-
* @returns
|
|
23525
|
-
*
|
|
23526
|
-
*
|
|
23524
|
+
* @returns A `LoadBundleTask` object, which notifies callers with progress
|
|
23525
|
+
* updates, and completion or error events. It can be used as a
|
|
23526
|
+
* `Promise<LoadBundleTaskProgress>`.
|
|
23527
23527
|
*/
|
|
23528
23528
|
function loadBundle(firestore, bundleData) {
|
|
23529
23529
|
firestore = cast(firestore, Firestore);
|
|
@@ -23533,11 +23533,16 @@ function loadBundle(firestore, bundleData) {
|
|
|
23533
23533
|
return resultTask;
|
|
23534
23534
|
}
|
|
23535
23535
|
/**
|
|
23536
|
-
* Reads a Firestore {@link Query} from local cache, identified by the given
|
|
23536
|
+
* Reads a Firestore {@link Query} from local cache, identified by the given
|
|
23537
|
+
* name.
|
|
23537
23538
|
*
|
|
23538
23539
|
* The named queries are packaged into bundles on the server side (along
|
|
23539
|
-
* with resulting documents), and loaded to local cache using `loadBundle`. Once
|
|
23540
|
-
* cache, use this method to extract a {@link Query} by name.
|
|
23540
|
+
* with resulting documents), and loaded to local cache using `loadBundle`. Once
|
|
23541
|
+
* in local cache, use this method to extract a {@link Query} by name.
|
|
23542
|
+
*
|
|
23543
|
+
* @param firestore - The {@link Firestore} instance to read the query from.
|
|
23544
|
+
* @param name - The name of the query.
|
|
23545
|
+
* @returns A `Promise` that is resolved with the Query or `null`.
|
|
23541
23546
|
*/
|
|
23542
23547
|
function namedQuery(firestore, name) {
|
|
23543
23548
|
firestore = cast(firestore, Firestore);
|
|
@@ -26226,6 +26231,80 @@ function writeBatch(firestore) {
|
|
|
26226
26231
|
ensureFirestoreConfigured(firestore);
|
|
26227
26232
|
return new WriteBatch(firestore, mutations => executeWrite(firestore, mutations));
|
|
26228
26233
|
}
|
|
26234
|
+
/** An index component consisting of field path and index type. */
|
|
26235
|
+
class Segment {
|
|
26236
|
+
constructor(
|
|
26237
|
+
/** The field path of the component. */
|
|
26238
|
+
fieldPath,
|
|
26239
|
+
/** The fields sorting order. */
|
|
26240
|
+
kind) {
|
|
26241
|
+
this.fieldPath = fieldPath;
|
|
26242
|
+
this.kind = kind;
|
|
26243
|
+
}
|
|
26244
|
+
}
|
|
26245
|
+
|
|
26246
|
+
/**
|
|
26247
|
+
* @license
|
|
26248
|
+
* Copyright 2021 Google LLC
|
|
26249
|
+
*
|
|
26250
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
26251
|
+
* you may not use this file except in compliance with the License.
|
|
26252
|
+
* You may obtain a copy of the License at
|
|
26253
|
+
*
|
|
26254
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
26255
|
+
*
|
|
26256
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
26257
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
26258
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26259
|
+
* See the License for the specific language governing permissions and
|
|
26260
|
+
* limitations under the License.
|
|
26261
|
+
*/
|
|
26262
|
+
function setIndexConfiguration(firestore, jsonOrConfiguration) {
|
|
26263
|
+
firestore = cast(firestore, Firestore);
|
|
26264
|
+
ensureFirestoreConfigured(firestore);
|
|
26265
|
+
const indexConfiguration = typeof jsonOrConfiguration === 'string'
|
|
26266
|
+
? tryParseJson(jsonOrConfiguration)
|
|
26267
|
+
: jsonOrConfiguration;
|
|
26268
|
+
// PORTING NOTE: We don't return an error if the user has not enabled
|
|
26269
|
+
// persistence since `enableIndexeddbPersistence()` can fail on the Web.
|
|
26270
|
+
if (Array.isArray(indexConfiguration.indexes)) {
|
|
26271
|
+
for (const index of indexConfiguration.indexes) {
|
|
26272
|
+
tryGetString(index, 'collectionGroup');
|
|
26273
|
+
const segments = [];
|
|
26274
|
+
if (Array.isArray(index.fields)) {
|
|
26275
|
+
for (const field of index.fields) {
|
|
26276
|
+
const fieldPathString = tryGetString(field, 'fieldPath');
|
|
26277
|
+
const fieldPath = fieldPathFromDotSeparatedString('setIndexConfiguration', fieldPathString);
|
|
26278
|
+
if (field.arrayConfig === 'CONTAINS') {
|
|
26279
|
+
segments.push(new Segment(fieldPath, 2 /* CONTAINS */));
|
|
26280
|
+
}
|
|
26281
|
+
else if (field.order === 'ASCENDING') {
|
|
26282
|
+
segments.push(new Segment(fieldPath, 0 /* ASCENDING */));
|
|
26283
|
+
}
|
|
26284
|
+
else if (field.order === 'DESCENDING') {
|
|
26285
|
+
segments.push(new Segment(fieldPath, 1 /* DESCENDING */));
|
|
26286
|
+
}
|
|
26287
|
+
}
|
|
26288
|
+
}
|
|
26289
|
+
}
|
|
26290
|
+
}
|
|
26291
|
+
// TODO(indexing): Configure indexes
|
|
26292
|
+
return Promise.resolve();
|
|
26293
|
+
}
|
|
26294
|
+
function tryParseJson(json) {
|
|
26295
|
+
try {
|
|
26296
|
+
return JSON.parse(json);
|
|
26297
|
+
}
|
|
26298
|
+
catch (e) {
|
|
26299
|
+
throw new FirestoreError(Code.INVALID_ARGUMENT, 'Failed to parse JSON:' + e.message);
|
|
26300
|
+
}
|
|
26301
|
+
}
|
|
26302
|
+
function tryGetString(data, property) {
|
|
26303
|
+
if (typeof data[property] !== 'string') {
|
|
26304
|
+
throw new FirestoreError(Code.INVALID_ARGUMENT, 'Missing string value for: ' + property);
|
|
26305
|
+
}
|
|
26306
|
+
return data[property];
|
|
26307
|
+
}
|
|
26229
26308
|
|
|
26230
26309
|
/**
|
|
26231
26310
|
* @license
|
|
@@ -26274,6 +26353,7 @@ exports._cast = cast;
|
|
|
26274
26353
|
exports._debugAssert = debugAssert;
|
|
26275
26354
|
exports._isBase64Available = isBase64Available;
|
|
26276
26355
|
exports._logWarn = logWarn;
|
|
26356
|
+
exports._setIndexConfiguration = setIndexConfiguration;
|
|
26277
26357
|
exports._validateIsNotUsedTogether = validateIsNotUsedTogether;
|
|
26278
26358
|
exports.addDoc = addDoc;
|
|
26279
26359
|
exports.arrayRemove = arrayRemove;
|