@firebase/firestore 3.3.1 → 3.4.0-canary.774b2fc19
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/CHANGELOG.md +6 -0
- package/dist/firestore/compat/index.d.ts +1 -1
- package/dist/firestore/src/api/credentials.d.ts +64 -30
- package/dist/firestore/src/api/database.d.ts +2 -1
- package/dist/firestore/src/api.d.ts +2 -1
- package/dist/firestore/src/core/component_provider.d.ts +2 -1
- package/dist/firestore/src/core/firestore_client.d.ts +4 -3
- package/dist/firestore/src/lite-api/components.d.ts +3 -1
- package/dist/firestore/src/lite-api/database.d.ts +4 -2
- package/dist/firestore/src/platform/browser/webchannel_connection.d.ts +1 -1
- package/dist/firestore/src/platform/node/grpc_connection.d.ts +3 -3
- package/dist/firestore/src/remote/connection.d.ts +3 -3
- package/dist/firestore/src/remote/datastore.d.ts +2 -1
- package/dist/firestore/src/remote/persistent_stream.d.ts +9 -7
- package/dist/firestore/src/remote/rest_connection.d.ts +4 -4
- package/dist/firestore/test/integration/remote/stream.test.d.ts +2 -2
- package/dist/firestore/test/integration/util/internal_helpers.d.ts +5 -5
- package/dist/firestore/test/unit/remote/rest_connection.test.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.esm2017.js +3413 -3359
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3688 -3639
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +195 -109
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +194 -105
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +3391 -3337
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +34 -20
- package/dist/lite/firestore/compat/index.d.ts +1 -1
- package/dist/lite/firestore/src/api/credentials.d.ts +64 -30
- package/dist/lite/firestore/src/api/database.d.ts +2 -1
- package/dist/lite/firestore/src/api.d.ts +2 -1
- package/dist/lite/firestore/src/core/component_provider.d.ts +2 -1
- package/dist/lite/firestore/src/core/firestore_client.d.ts +4 -3
- package/dist/lite/firestore/src/lite-api/components.d.ts +3 -1
- package/dist/lite/firestore/src/lite-api/database.d.ts +4 -2
- package/dist/lite/firestore/src/platform/browser/webchannel_connection.d.ts +1 -1
- package/dist/lite/firestore/src/platform/node/grpc_connection.d.ts +3 -3
- package/dist/lite/firestore/src/remote/connection.d.ts +3 -3
- package/dist/lite/firestore/src/remote/datastore.d.ts +2 -1
- package/dist/lite/firestore/src/remote/persistent_stream.d.ts +9 -7
- package/dist/lite/firestore/src/remote/rest_connection.d.ts +4 -4
- package/dist/lite/firestore/test/integration/remote/stream.test.d.ts +2 -2
- package/dist/lite/firestore/test/integration/util/internal_helpers.d.ts +5 -5
- package/dist/lite/firestore/test/unit/remote/rest_connection.test.d.ts +1 -1
- package/dist/lite/index.browser.esm2017.js +1379 -1365
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +934 -925
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +96 -61
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +96 -61
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +937 -923
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +14 -13
- package/dist/lite/packages/firestore/babel-register.d.ts +1 -0
- package/dist/lite/packages/firestore/compat/index.d.ts +1 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +150 -149
- package/dist/lite/packages/firestore/src/api/credentials.d.ts +64 -30
- package/dist/lite/packages/firestore/src/api/database.d.ts +2 -1
- package/dist/lite/packages/firestore/src/api.d.ts +2 -1
- package/dist/lite/packages/firestore/src/core/component_provider.d.ts +2 -1
- package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +4 -3
- package/dist/lite/packages/firestore/src/lite-api/components.d.ts +3 -1
- package/dist/lite/packages/firestore/src/lite-api/database.d.ts +4 -2
- package/dist/lite/packages/firestore/src/platform/browser/webchannel_connection.d.ts +1 -1
- package/dist/lite/packages/firestore/src/platform/node/grpc_connection.d.ts +3 -3
- package/dist/lite/packages/firestore/src/remote/connection.d.ts +3 -3
- package/dist/lite/packages/firestore/src/remote/datastore.d.ts +2 -1
- package/dist/lite/packages/firestore/src/remote/persistent_stream.d.ts +9 -7
- package/dist/lite/packages/firestore/src/remote/rest_connection.d.ts +4 -4
- package/dist/lite/packages/firestore/test/integration/remote/stream.test.d.ts +2 -2
- package/dist/lite/packages/firestore/test/integration/util/internal_helpers.d.ts +5 -5
- package/dist/lite/packages/firestore/test/unit/remote/rest_connection.test.d.ts +1 -1
- package/dist/lite/private.d.ts +14 -13
- package/dist/packages/firestore/babel-register.d.ts +1 -0
- package/dist/packages/firestore/compat/index.d.ts +1 -1
- package/dist/packages/firestore/dist/index.esm2017.d.ts +211 -195
- package/dist/packages/firestore/src/api/credentials.d.ts +64 -30
- package/dist/packages/firestore/src/api/database.d.ts +2 -1
- package/dist/packages/firestore/src/api.d.ts +2 -1
- package/dist/packages/firestore/src/core/component_provider.d.ts +2 -1
- package/dist/packages/firestore/src/core/firestore_client.d.ts +4 -3
- package/dist/packages/firestore/src/lite-api/components.d.ts +3 -1
- package/dist/packages/firestore/src/lite-api/database.d.ts +4 -2
- package/dist/packages/firestore/src/platform/browser/webchannel_connection.d.ts +1 -1
- package/dist/packages/firestore/src/platform/node/grpc_connection.d.ts +3 -3
- package/dist/packages/firestore/src/remote/connection.d.ts +3 -3
- package/dist/packages/firestore/src/remote/datastore.d.ts +2 -1
- package/dist/packages/firestore/src/remote/persistent_stream.d.ts +9 -7
- package/dist/packages/firestore/src/remote/rest_connection.d.ts +4 -4
- package/dist/packages/firestore/test/integration/remote/stream.test.d.ts +2 -2
- package/dist/packages/firestore/test/integration/util/internal_helpers.d.ts +5 -5
- package/dist/packages/firestore/test/unit/remote/rest_connection.test.d.ts +1 -1
- package/dist/private.d.ts +24 -19
- package/package.json +10 -10
package/dist/lite/index.node.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { createMockUserToken, getModularInstance } from '@firebase/util';
|
|
|
6
6
|
import nodeFetch from 'node-fetch';
|
|
7
7
|
import { randomBytes as randomBytes$1 } from 'crypto';
|
|
8
8
|
|
|
9
|
-
const version$1 = "3.
|
|
9
|
+
const version$1 = "3.4.0-canary.774b2fc19";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @license
|
|
@@ -59,7 +59,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
59
59
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
60
60
|
User.MOCK_USER = new User('mock-user');
|
|
61
61
|
|
|
62
|
-
const version = "9.
|
|
62
|
+
const version = "9.6.0-canary.774b2fc19";
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* @license
|
|
@@ -428,16 +428,15 @@ class OAuthToken {
|
|
|
428
428
|
constructor(value, user) {
|
|
429
429
|
this.user = user;
|
|
430
430
|
this.type = 'OAuth';
|
|
431
|
-
this.
|
|
432
|
-
|
|
433
|
-
this.authHeaders['Authorization'] = `Bearer ${value}`;
|
|
431
|
+
this.headers = new Map();
|
|
432
|
+
this.headers.set('Authorization', `Bearer ${value}`);
|
|
434
433
|
}
|
|
435
434
|
}
|
|
436
435
|
/**
|
|
437
436
|
* A CredentialsProvider that always yields an empty token.
|
|
438
437
|
* @internal
|
|
439
438
|
*/
|
|
440
|
-
class
|
|
439
|
+
class EmptyAuthCredentialsProvider {
|
|
441
440
|
getToken() {
|
|
442
441
|
return Promise.resolve(null);
|
|
443
442
|
}
|
|
@@ -452,7 +451,7 @@ class EmptyCredentialsProvider {
|
|
|
452
451
|
* A CredentialsProvider that always returns a constant token. Used for
|
|
453
452
|
* emulator token mocking.
|
|
454
453
|
*/
|
|
455
|
-
class
|
|
454
|
+
class EmulatorAuthCredentialsProvider {
|
|
456
455
|
constructor(token) {
|
|
457
456
|
this.token = token;
|
|
458
457
|
/**
|
|
@@ -476,7 +475,7 @@ class EmulatorCredentialsProvider {
|
|
|
476
475
|
}
|
|
477
476
|
}
|
|
478
477
|
/** Credential provider for the Lite SDK. */
|
|
479
|
-
class
|
|
478
|
+
class LiteAuthCredentialsProvider {
|
|
480
479
|
constructor(authProvider) {
|
|
481
480
|
this.auth = null;
|
|
482
481
|
authProvider.onInit(auth => {
|
|
@@ -510,25 +509,17 @@ class LiteCredentialsProvider {
|
|
|
510
509
|
*/
|
|
511
510
|
class FirstPartyToken {
|
|
512
511
|
constructor(gapi, sessionIndex, iamToken) {
|
|
513
|
-
this.gapi = gapi;
|
|
514
|
-
this.sessionIndex = sessionIndex;
|
|
515
|
-
this.iamToken = iamToken;
|
|
516
512
|
this.type = 'FirstParty';
|
|
517
513
|
this.user = User.FIRST_PARTY;
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
const
|
|
521
|
-
'X-Goog-AuthUser': this.sessionIndex
|
|
522
|
-
};
|
|
523
|
-
// Use array notation to prevent minification
|
|
524
|
-
const authHeader = this.gapi['auth']['getAuthHeaderValueForFirstParty']([]);
|
|
514
|
+
this.headers = new Map();
|
|
515
|
+
this.headers.set('X-Goog-AuthUser', sessionIndex);
|
|
516
|
+
const authHeader = gapi['auth']['getAuthHeaderValueForFirstParty']([]);
|
|
525
517
|
if (authHeader) {
|
|
526
|
-
headers
|
|
518
|
+
this.headers.set('Authorization', authHeader);
|
|
527
519
|
}
|
|
528
|
-
if (
|
|
529
|
-
headers
|
|
520
|
+
if (iamToken) {
|
|
521
|
+
this.headers.set('X-Goog-Iam-Authorization-Token', iamToken);
|
|
530
522
|
}
|
|
531
|
-
return headers;
|
|
532
523
|
}
|
|
533
524
|
}
|
|
534
525
|
/*
|
|
@@ -536,7 +527,7 @@ class FirstPartyToken {
|
|
|
536
527
|
* to authenticate the user, using technique that is only available
|
|
537
528
|
* to applications hosted by Google.
|
|
538
529
|
*/
|
|
539
|
-
class
|
|
530
|
+
class FirstPartyAuthCredentialsProvider {
|
|
540
531
|
constructor(gapi, sessionIndex, iamToken) {
|
|
541
532
|
this.gapi = gapi;
|
|
542
533
|
this.sessionIndex = sessionIndex;
|
|
@@ -552,13 +543,50 @@ class FirstPartyCredentialsProvider {
|
|
|
552
543
|
shutdown() { }
|
|
553
544
|
invalidateToken() { }
|
|
554
545
|
}
|
|
546
|
+
class AppCheckToken {
|
|
547
|
+
constructor(value) {
|
|
548
|
+
this.value = value;
|
|
549
|
+
this.type = 'AppCheck';
|
|
550
|
+
this.headers = new Map();
|
|
551
|
+
if (value && value.length > 0) {
|
|
552
|
+
this.headers.set('x-firebase-appcheck', this.value);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
/** AppCheck token provider for the Lite SDK. */
|
|
557
|
+
class LiteAppCheckTokenProvider {
|
|
558
|
+
constructor(appCheckProvider) {
|
|
559
|
+
this.appCheckProvider = appCheckProvider;
|
|
560
|
+
this.appCheck = null;
|
|
561
|
+
appCheckProvider.onInit(appCheck => {
|
|
562
|
+
this.appCheck = appCheck;
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
getToken() {
|
|
566
|
+
if (!this.appCheck) {
|
|
567
|
+
return Promise.resolve(null);
|
|
568
|
+
}
|
|
569
|
+
return this.appCheck.getToken().then(tokenResult => {
|
|
570
|
+
if (tokenResult) {
|
|
571
|
+
hardAssert(typeof tokenResult.token === 'string');
|
|
572
|
+
return new AppCheckToken(tokenResult.token);
|
|
573
|
+
}
|
|
574
|
+
else {
|
|
575
|
+
return null;
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
invalidateToken() { }
|
|
580
|
+
start(asyncQueue, changeListener) { }
|
|
581
|
+
shutdown() { }
|
|
582
|
+
}
|
|
555
583
|
/**
|
|
556
584
|
* Builds a CredentialsProvider depending on the type of
|
|
557
585
|
* the credentials passed in.
|
|
558
586
|
*/
|
|
559
|
-
function
|
|
587
|
+
function makeAuthCredentialsProvider(credentials) {
|
|
560
588
|
if (!credentials) {
|
|
561
|
-
return new
|
|
589
|
+
return new EmptyAuthCredentialsProvider();
|
|
562
590
|
}
|
|
563
591
|
switch (credentials['type']) {
|
|
564
592
|
case 'gapi':
|
|
@@ -568,11 +596,11 @@ function makeCredentialsProvider(credentials) {
|
|
|
568
596
|
client !== null &&
|
|
569
597
|
client['auth'] &&
|
|
570
598
|
client['auth']['getAuthHeaderValueForFirstParty']));
|
|
571
|
-
return new
|
|
599
|
+
return new FirstPartyAuthCredentialsProvider(client, credentials['sessionIndex'] || '0', credentials['iamToken'] || null);
|
|
572
600
|
case 'provider':
|
|
573
601
|
return credentials['client'];
|
|
574
602
|
default:
|
|
575
|
-
throw new FirestoreError(Code.INVALID_ARGUMENT, '
|
|
603
|
+
throw new FirestoreError(Code.INVALID_ARGUMENT, 'makeAuthCredentialsProvider failed due to invalid credential type');
|
|
576
604
|
}
|
|
577
605
|
}
|
|
578
606
|
|
|
@@ -1159,11 +1187,11 @@ class RestConnection {
|
|
|
1159
1187
|
this.databaseId.database +
|
|
1160
1188
|
'/documents';
|
|
1161
1189
|
}
|
|
1162
|
-
invokeRPC(rpcName, path, req,
|
|
1190
|
+
invokeRPC(rpcName, path, req, authToken, appCheckToken) {
|
|
1163
1191
|
const url = this.makeUrl(rpcName, path);
|
|
1164
1192
|
logDebug(LOG_TAG$3, 'Sending: ', url, req);
|
|
1165
1193
|
const headers = {};
|
|
1166
|
-
this.modifyHeadersForRequest(headers,
|
|
1194
|
+
this.modifyHeadersForRequest(headers, authToken, appCheckToken);
|
|
1167
1195
|
return this.performRPCRequest(rpcName, url, headers, req).then(response => {
|
|
1168
1196
|
logDebug(LOG_TAG$3, 'Received: ', response);
|
|
1169
1197
|
return response;
|
|
@@ -1172,16 +1200,16 @@ class RestConnection {
|
|
|
1172
1200
|
throw err;
|
|
1173
1201
|
});
|
|
1174
1202
|
}
|
|
1175
|
-
invokeStreamingRPC(rpcName, path, request,
|
|
1203
|
+
invokeStreamingRPC(rpcName, path, request, authToken, appCheckToken) {
|
|
1176
1204
|
// The REST API automatically aggregates all of the streamed results, so we
|
|
1177
1205
|
// can just use the normal invoke() method.
|
|
1178
|
-
return this.invokeRPC(rpcName, path, request,
|
|
1206
|
+
return this.invokeRPC(rpcName, path, request, authToken, appCheckToken);
|
|
1179
1207
|
}
|
|
1180
1208
|
/**
|
|
1181
1209
|
* Modifies the headers for a request, adding any authorization token if
|
|
1182
1210
|
* present and any additional headers for the request.
|
|
1183
1211
|
*/
|
|
1184
|
-
modifyHeadersForRequest(headers,
|
|
1212
|
+
modifyHeadersForRequest(headers, authToken, appCheckToken) {
|
|
1185
1213
|
headers['X-Goog-Api-Client'] = getGoogApiClientValue();
|
|
1186
1214
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
1187
1215
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
@@ -1191,12 +1219,11 @@ class RestConnection {
|
|
|
1191
1219
|
if (this.databaseInfo.appId) {
|
|
1192
1220
|
headers['X-Firebase-GMPID'] = this.databaseInfo.appId;
|
|
1193
1221
|
}
|
|
1194
|
-
if (
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
}
|
|
1222
|
+
if (authToken) {
|
|
1223
|
+
authToken.headers.forEach((value, key) => (headers[key] = value));
|
|
1224
|
+
}
|
|
1225
|
+
if (appCheckToken) {
|
|
1226
|
+
appCheckToken.headers.forEach((value, key) => (headers[key] = value));
|
|
1200
1227
|
}
|
|
1201
1228
|
}
|
|
1202
1229
|
makeUrl(rpcName, path) {
|
|
@@ -4084,9 +4111,10 @@ class Datastore {
|
|
|
4084
4111
|
* consumption.
|
|
4085
4112
|
*/
|
|
4086
4113
|
class DatastoreImpl extends Datastore {
|
|
4087
|
-
constructor(
|
|
4114
|
+
constructor(authCredentials, appCheckCredentials, connection, serializer) {
|
|
4088
4115
|
super();
|
|
4089
|
-
this.
|
|
4116
|
+
this.authCredentials = authCredentials;
|
|
4117
|
+
this.appCheckCredentials = appCheckCredentials;
|
|
4090
4118
|
this.connection = connection;
|
|
4091
4119
|
this.serializer = serializer;
|
|
4092
4120
|
this.terminated = false;
|
|
@@ -4096,18 +4124,21 @@ class DatastoreImpl extends Datastore {
|
|
|
4096
4124
|
throw new FirestoreError(Code.FAILED_PRECONDITION, 'The client has already been terminated.');
|
|
4097
4125
|
}
|
|
4098
4126
|
}
|
|
4099
|
-
/**
|
|
4127
|
+
/** Invokes the provided RPC with auth and AppCheck tokens. */
|
|
4100
4128
|
invokeRPC(rpcName, path, request) {
|
|
4101
4129
|
this.verifyInitialized();
|
|
4102
|
-
return
|
|
4103
|
-
.getToken()
|
|
4104
|
-
.
|
|
4105
|
-
|
|
4130
|
+
return Promise.all([
|
|
4131
|
+
this.authCredentials.getToken(),
|
|
4132
|
+
this.appCheckCredentials.getToken()
|
|
4133
|
+
])
|
|
4134
|
+
.then(([authToken, appCheckToken]) => {
|
|
4135
|
+
return this.connection.invokeRPC(rpcName, path, request, authToken, appCheckToken);
|
|
4106
4136
|
})
|
|
4107
4137
|
.catch((error) => {
|
|
4108
4138
|
if (error.name === 'FirebaseError') {
|
|
4109
4139
|
if (error.code === Code.UNAUTHENTICATED) {
|
|
4110
|
-
this.
|
|
4140
|
+
this.authCredentials.invalidateToken();
|
|
4141
|
+
this.appCheckCredentials.invalidateToken();
|
|
4111
4142
|
}
|
|
4112
4143
|
throw error;
|
|
4113
4144
|
}
|
|
@@ -4116,18 +4147,21 @@ class DatastoreImpl extends Datastore {
|
|
|
4116
4147
|
}
|
|
4117
4148
|
});
|
|
4118
4149
|
}
|
|
4119
|
-
/**
|
|
4150
|
+
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */
|
|
4120
4151
|
invokeStreamingRPC(rpcName, path, request) {
|
|
4121
4152
|
this.verifyInitialized();
|
|
4122
|
-
return
|
|
4123
|
-
.getToken()
|
|
4124
|
-
.
|
|
4125
|
-
|
|
4153
|
+
return Promise.all([
|
|
4154
|
+
this.authCredentials.getToken(),
|
|
4155
|
+
this.appCheckCredentials.getToken()
|
|
4156
|
+
])
|
|
4157
|
+
.then(([authToken, appCheckToken]) => {
|
|
4158
|
+
return this.connection.invokeStreamingRPC(rpcName, path, request, authToken, appCheckToken);
|
|
4126
4159
|
})
|
|
4127
4160
|
.catch((error) => {
|
|
4128
4161
|
if (error.name === 'FirebaseError') {
|
|
4129
4162
|
if (error.code === Code.UNAUTHENTICATED) {
|
|
4130
|
-
this.
|
|
4163
|
+
this.authCredentials.invalidateToken();
|
|
4164
|
+
this.appCheckCredentials.invalidateToken();
|
|
4131
4165
|
}
|
|
4132
4166
|
throw error;
|
|
4133
4167
|
}
|
|
@@ -4142,8 +4176,8 @@ class DatastoreImpl extends Datastore {
|
|
|
4142
4176
|
}
|
|
4143
4177
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
4144
4178
|
// firestore-exp client.
|
|
4145
|
-
function newDatastore(
|
|
4146
|
-
return new DatastoreImpl(
|
|
4179
|
+
function newDatastore(authCredentials, appCheckCredentials, connection, serializer) {
|
|
4180
|
+
return new DatastoreImpl(authCredentials, appCheckCredentials, connection, serializer);
|
|
4147
4181
|
}
|
|
4148
4182
|
async function invokeCommitRpc(datastore, mutations) {
|
|
4149
4183
|
const datastoreImpl = debugCast(datastore);
|
|
@@ -4219,7 +4253,7 @@ function getDatastore(firestore) {
|
|
|
4219
4253
|
const databaseInfo = makeDatabaseInfo(firestore._databaseId, firestore.app.options.appId || '', firestore._persistenceKey, firestore._freezeSettings());
|
|
4220
4254
|
const connection = newConnection(databaseInfo);
|
|
4221
4255
|
const serializer = newSerializer(firestore._databaseId);
|
|
4222
|
-
const datastore = newDatastore(firestore.
|
|
4256
|
+
const datastore = newDatastore(firestore._authCredentials, firestore._appCheckCredentials, connection, serializer);
|
|
4223
4257
|
datastoreInstances.set(firestore, datastore);
|
|
4224
4258
|
}
|
|
4225
4259
|
return datastoreInstances.get(firestore);
|
|
@@ -4395,8 +4429,9 @@ class FirestoreSettingsImpl {
|
|
|
4395
4429
|
*/
|
|
4396
4430
|
class Firestore {
|
|
4397
4431
|
/** @hideconstructor */
|
|
4398
|
-
constructor(databaseIdOrApp,
|
|
4399
|
-
this.
|
|
4432
|
+
constructor(databaseIdOrApp, _authCredentials, _appCheckCredentials) {
|
|
4433
|
+
this._authCredentials = _authCredentials;
|
|
4434
|
+
this._appCheckCredentials = _appCheckCredentials;
|
|
4400
4435
|
/**
|
|
4401
4436
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
4402
4437
|
*/
|
|
@@ -4437,7 +4472,7 @@ class Firestore {
|
|
|
4437
4472
|
}
|
|
4438
4473
|
this._settings = new FirestoreSettingsImpl(settings);
|
|
4439
4474
|
if (settings.credentials !== undefined) {
|
|
4440
|
-
this.
|
|
4475
|
+
this._authCredentials = makeAuthCredentialsProvider(settings.credentials);
|
|
4441
4476
|
}
|
|
4442
4477
|
}
|
|
4443
4478
|
_getSettings() {
|
|
@@ -4548,7 +4583,7 @@ function connectFirestoreEmulator(firestore, host, port, options = {}) {
|
|
|
4548
4583
|
}
|
|
4549
4584
|
user = new User(uid);
|
|
4550
4585
|
}
|
|
4551
|
-
firestore.
|
|
4586
|
+
firestore._authCredentials = new EmulatorAuthCredentialsProvider(new OAuthToken(token, user));
|
|
4552
4587
|
}
|
|
4553
4588
|
}
|
|
4554
4589
|
/**
|
|
@@ -4597,12 +4632,12 @@ function registerFirestore() {
|
|
|
4597
4632
|
setSDKVersion(`${SDK_VERSION$1}_lite`);
|
|
4598
4633
|
_registerComponent(new Component('firestore/lite', (container, { options: settings }) => {
|
|
4599
4634
|
const app = container.getProvider('app').getImmediate();
|
|
4600
|
-
const firestoreInstance = new Firestore(app, new
|
|
4635
|
+
const firestoreInstance = new Firestore(app, new LiteAuthCredentialsProvider(container.getProvider('auth-internal')), new LiteAppCheckTokenProvider(container.getProvider('app-check-internal')));
|
|
4601
4636
|
if (settings) {
|
|
4602
4637
|
firestoreInstance._setSettings(settings);
|
|
4603
4638
|
}
|
|
4604
4639
|
return firestoreInstance;
|
|
4605
|
-
},
|
|
4640
|
+
}, 'PUBLIC'));
|
|
4606
4641
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
4607
4642
|
registerVersion('firestore-lite', version$1, 'node');
|
|
4608
4643
|
registerVersion('firestore-lite', version$1, 'esm2017');
|