@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
|
@@ -14,7 +14,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
14
|
|
|
15
15
|
var nodeFetch__default = /*#__PURE__*/_interopDefaultLegacy(nodeFetch);
|
|
16
16
|
|
|
17
|
-
const version$1 = "3.
|
|
17
|
+
const version$1 = "3.4.0-canary.774b2fc19";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @license
|
|
@@ -67,7 +67,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
67
67
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
68
68
|
User.MOCK_USER = new User('mock-user');
|
|
69
69
|
|
|
70
|
-
const version = "9.
|
|
70
|
+
const version = "9.6.0-canary.774b2fc19";
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @license
|
|
@@ -436,16 +436,15 @@ class OAuthToken {
|
|
|
436
436
|
constructor(value, user) {
|
|
437
437
|
this.user = user;
|
|
438
438
|
this.type = 'OAuth';
|
|
439
|
-
this.
|
|
440
|
-
|
|
441
|
-
this.authHeaders['Authorization'] = `Bearer ${value}`;
|
|
439
|
+
this.headers = new Map();
|
|
440
|
+
this.headers.set('Authorization', `Bearer ${value}`);
|
|
442
441
|
}
|
|
443
442
|
}
|
|
444
443
|
/**
|
|
445
444
|
* A CredentialsProvider that always yields an empty token.
|
|
446
445
|
* @internal
|
|
447
446
|
*/
|
|
448
|
-
class
|
|
447
|
+
class EmptyAuthCredentialsProvider {
|
|
449
448
|
getToken() {
|
|
450
449
|
return Promise.resolve(null);
|
|
451
450
|
}
|
|
@@ -460,7 +459,7 @@ class EmptyCredentialsProvider {
|
|
|
460
459
|
* A CredentialsProvider that always returns a constant token. Used for
|
|
461
460
|
* emulator token mocking.
|
|
462
461
|
*/
|
|
463
|
-
class
|
|
462
|
+
class EmulatorAuthCredentialsProvider {
|
|
464
463
|
constructor(token) {
|
|
465
464
|
this.token = token;
|
|
466
465
|
/**
|
|
@@ -484,7 +483,7 @@ class EmulatorCredentialsProvider {
|
|
|
484
483
|
}
|
|
485
484
|
}
|
|
486
485
|
/** Credential provider for the Lite SDK. */
|
|
487
|
-
class
|
|
486
|
+
class LiteAuthCredentialsProvider {
|
|
488
487
|
constructor(authProvider) {
|
|
489
488
|
this.auth = null;
|
|
490
489
|
authProvider.onInit(auth => {
|
|
@@ -518,25 +517,17 @@ class LiteCredentialsProvider {
|
|
|
518
517
|
*/
|
|
519
518
|
class FirstPartyToken {
|
|
520
519
|
constructor(gapi, sessionIndex, iamToken) {
|
|
521
|
-
this.gapi = gapi;
|
|
522
|
-
this.sessionIndex = sessionIndex;
|
|
523
|
-
this.iamToken = iamToken;
|
|
524
520
|
this.type = 'FirstParty';
|
|
525
521
|
this.user = User.FIRST_PARTY;
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
const
|
|
529
|
-
'X-Goog-AuthUser': this.sessionIndex
|
|
530
|
-
};
|
|
531
|
-
// Use array notation to prevent minification
|
|
532
|
-
const authHeader = this.gapi['auth']['getAuthHeaderValueForFirstParty']([]);
|
|
522
|
+
this.headers = new Map();
|
|
523
|
+
this.headers.set('X-Goog-AuthUser', sessionIndex);
|
|
524
|
+
const authHeader = gapi['auth']['getAuthHeaderValueForFirstParty']([]);
|
|
533
525
|
if (authHeader) {
|
|
534
|
-
headers
|
|
526
|
+
this.headers.set('Authorization', authHeader);
|
|
535
527
|
}
|
|
536
|
-
if (
|
|
537
|
-
headers
|
|
528
|
+
if (iamToken) {
|
|
529
|
+
this.headers.set('X-Goog-Iam-Authorization-Token', iamToken);
|
|
538
530
|
}
|
|
539
|
-
return headers;
|
|
540
531
|
}
|
|
541
532
|
}
|
|
542
533
|
/*
|
|
@@ -544,7 +535,7 @@ class FirstPartyToken {
|
|
|
544
535
|
* to authenticate the user, using technique that is only available
|
|
545
536
|
* to applications hosted by Google.
|
|
546
537
|
*/
|
|
547
|
-
class
|
|
538
|
+
class FirstPartyAuthCredentialsProvider {
|
|
548
539
|
constructor(gapi, sessionIndex, iamToken) {
|
|
549
540
|
this.gapi = gapi;
|
|
550
541
|
this.sessionIndex = sessionIndex;
|
|
@@ -560,13 +551,50 @@ class FirstPartyCredentialsProvider {
|
|
|
560
551
|
shutdown() { }
|
|
561
552
|
invalidateToken() { }
|
|
562
553
|
}
|
|
554
|
+
class AppCheckToken {
|
|
555
|
+
constructor(value) {
|
|
556
|
+
this.value = value;
|
|
557
|
+
this.type = 'AppCheck';
|
|
558
|
+
this.headers = new Map();
|
|
559
|
+
if (value && value.length > 0) {
|
|
560
|
+
this.headers.set('x-firebase-appcheck', this.value);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
/** AppCheck token provider for the Lite SDK. */
|
|
565
|
+
class LiteAppCheckTokenProvider {
|
|
566
|
+
constructor(appCheckProvider) {
|
|
567
|
+
this.appCheckProvider = appCheckProvider;
|
|
568
|
+
this.appCheck = null;
|
|
569
|
+
appCheckProvider.onInit(appCheck => {
|
|
570
|
+
this.appCheck = appCheck;
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
getToken() {
|
|
574
|
+
if (!this.appCheck) {
|
|
575
|
+
return Promise.resolve(null);
|
|
576
|
+
}
|
|
577
|
+
return this.appCheck.getToken().then(tokenResult => {
|
|
578
|
+
if (tokenResult) {
|
|
579
|
+
hardAssert(typeof tokenResult.token === 'string');
|
|
580
|
+
return new AppCheckToken(tokenResult.token);
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
return null;
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
invalidateToken() { }
|
|
588
|
+
start(asyncQueue, changeListener) { }
|
|
589
|
+
shutdown() { }
|
|
590
|
+
}
|
|
563
591
|
/**
|
|
564
592
|
* Builds a CredentialsProvider depending on the type of
|
|
565
593
|
* the credentials passed in.
|
|
566
594
|
*/
|
|
567
|
-
function
|
|
595
|
+
function makeAuthCredentialsProvider(credentials) {
|
|
568
596
|
if (!credentials) {
|
|
569
|
-
return new
|
|
597
|
+
return new EmptyAuthCredentialsProvider();
|
|
570
598
|
}
|
|
571
599
|
switch (credentials['type']) {
|
|
572
600
|
case 'gapi':
|
|
@@ -576,11 +604,11 @@ function makeCredentialsProvider(credentials) {
|
|
|
576
604
|
client !== null &&
|
|
577
605
|
client['auth'] &&
|
|
578
606
|
client['auth']['getAuthHeaderValueForFirstParty']));
|
|
579
|
-
return new
|
|
607
|
+
return new FirstPartyAuthCredentialsProvider(client, credentials['sessionIndex'] || '0', credentials['iamToken'] || null);
|
|
580
608
|
case 'provider':
|
|
581
609
|
return credentials['client'];
|
|
582
610
|
default:
|
|
583
|
-
throw new FirestoreError(Code.INVALID_ARGUMENT, '
|
|
611
|
+
throw new FirestoreError(Code.INVALID_ARGUMENT, 'makeAuthCredentialsProvider failed due to invalid credential type');
|
|
584
612
|
}
|
|
585
613
|
}
|
|
586
614
|
|
|
@@ -1167,11 +1195,11 @@ class RestConnection {
|
|
|
1167
1195
|
this.databaseId.database +
|
|
1168
1196
|
'/documents';
|
|
1169
1197
|
}
|
|
1170
|
-
invokeRPC(rpcName, path, req,
|
|
1198
|
+
invokeRPC(rpcName, path, req, authToken, appCheckToken) {
|
|
1171
1199
|
const url = this.makeUrl(rpcName, path);
|
|
1172
1200
|
logDebug(LOG_TAG$3, 'Sending: ', url, req);
|
|
1173
1201
|
const headers = {};
|
|
1174
|
-
this.modifyHeadersForRequest(headers,
|
|
1202
|
+
this.modifyHeadersForRequest(headers, authToken, appCheckToken);
|
|
1175
1203
|
return this.performRPCRequest(rpcName, url, headers, req).then(response => {
|
|
1176
1204
|
logDebug(LOG_TAG$3, 'Received: ', response);
|
|
1177
1205
|
return response;
|
|
@@ -1180,16 +1208,16 @@ class RestConnection {
|
|
|
1180
1208
|
throw err;
|
|
1181
1209
|
});
|
|
1182
1210
|
}
|
|
1183
|
-
invokeStreamingRPC(rpcName, path, request,
|
|
1211
|
+
invokeStreamingRPC(rpcName, path, request, authToken, appCheckToken) {
|
|
1184
1212
|
// The REST API automatically aggregates all of the streamed results, so we
|
|
1185
1213
|
// can just use the normal invoke() method.
|
|
1186
|
-
return this.invokeRPC(rpcName, path, request,
|
|
1214
|
+
return this.invokeRPC(rpcName, path, request, authToken, appCheckToken);
|
|
1187
1215
|
}
|
|
1188
1216
|
/**
|
|
1189
1217
|
* Modifies the headers for a request, adding any authorization token if
|
|
1190
1218
|
* present and any additional headers for the request.
|
|
1191
1219
|
*/
|
|
1192
|
-
modifyHeadersForRequest(headers,
|
|
1220
|
+
modifyHeadersForRequest(headers, authToken, appCheckToken) {
|
|
1193
1221
|
headers['X-Goog-Api-Client'] = getGoogApiClientValue();
|
|
1194
1222
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
1195
1223
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
@@ -1199,12 +1227,11 @@ class RestConnection {
|
|
|
1199
1227
|
if (this.databaseInfo.appId) {
|
|
1200
1228
|
headers['X-Firebase-GMPID'] = this.databaseInfo.appId;
|
|
1201
1229
|
}
|
|
1202
|
-
if (
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
}
|
|
1230
|
+
if (authToken) {
|
|
1231
|
+
authToken.headers.forEach((value, key) => (headers[key] = value));
|
|
1232
|
+
}
|
|
1233
|
+
if (appCheckToken) {
|
|
1234
|
+
appCheckToken.headers.forEach((value, key) => (headers[key] = value));
|
|
1208
1235
|
}
|
|
1209
1236
|
}
|
|
1210
1237
|
makeUrl(rpcName, path) {
|
|
@@ -4092,9 +4119,10 @@ class Datastore {
|
|
|
4092
4119
|
* consumption.
|
|
4093
4120
|
*/
|
|
4094
4121
|
class DatastoreImpl extends Datastore {
|
|
4095
|
-
constructor(
|
|
4122
|
+
constructor(authCredentials, appCheckCredentials, connection, serializer) {
|
|
4096
4123
|
super();
|
|
4097
|
-
this.
|
|
4124
|
+
this.authCredentials = authCredentials;
|
|
4125
|
+
this.appCheckCredentials = appCheckCredentials;
|
|
4098
4126
|
this.connection = connection;
|
|
4099
4127
|
this.serializer = serializer;
|
|
4100
4128
|
this.terminated = false;
|
|
@@ -4104,18 +4132,21 @@ class DatastoreImpl extends Datastore {
|
|
|
4104
4132
|
throw new FirestoreError(Code.FAILED_PRECONDITION, 'The client has already been terminated.');
|
|
4105
4133
|
}
|
|
4106
4134
|
}
|
|
4107
|
-
/**
|
|
4135
|
+
/** Invokes the provided RPC with auth and AppCheck tokens. */
|
|
4108
4136
|
invokeRPC(rpcName, path, request) {
|
|
4109
4137
|
this.verifyInitialized();
|
|
4110
|
-
return
|
|
4111
|
-
.getToken()
|
|
4112
|
-
.
|
|
4113
|
-
|
|
4138
|
+
return Promise.all([
|
|
4139
|
+
this.authCredentials.getToken(),
|
|
4140
|
+
this.appCheckCredentials.getToken()
|
|
4141
|
+
])
|
|
4142
|
+
.then(([authToken, appCheckToken]) => {
|
|
4143
|
+
return this.connection.invokeRPC(rpcName, path, request, authToken, appCheckToken);
|
|
4114
4144
|
})
|
|
4115
4145
|
.catch((error) => {
|
|
4116
4146
|
if (error.name === 'FirebaseError') {
|
|
4117
4147
|
if (error.code === Code.UNAUTHENTICATED) {
|
|
4118
|
-
this.
|
|
4148
|
+
this.authCredentials.invalidateToken();
|
|
4149
|
+
this.appCheckCredentials.invalidateToken();
|
|
4119
4150
|
}
|
|
4120
4151
|
throw error;
|
|
4121
4152
|
}
|
|
@@ -4124,18 +4155,21 @@ class DatastoreImpl extends Datastore {
|
|
|
4124
4155
|
}
|
|
4125
4156
|
});
|
|
4126
4157
|
}
|
|
4127
|
-
/**
|
|
4158
|
+
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */
|
|
4128
4159
|
invokeStreamingRPC(rpcName, path, request) {
|
|
4129
4160
|
this.verifyInitialized();
|
|
4130
|
-
return
|
|
4131
|
-
.getToken()
|
|
4132
|
-
.
|
|
4133
|
-
|
|
4161
|
+
return Promise.all([
|
|
4162
|
+
this.authCredentials.getToken(),
|
|
4163
|
+
this.appCheckCredentials.getToken()
|
|
4164
|
+
])
|
|
4165
|
+
.then(([authToken, appCheckToken]) => {
|
|
4166
|
+
return this.connection.invokeStreamingRPC(rpcName, path, request, authToken, appCheckToken);
|
|
4134
4167
|
})
|
|
4135
4168
|
.catch((error) => {
|
|
4136
4169
|
if (error.name === 'FirebaseError') {
|
|
4137
4170
|
if (error.code === Code.UNAUTHENTICATED) {
|
|
4138
|
-
this.
|
|
4171
|
+
this.authCredentials.invalidateToken();
|
|
4172
|
+
this.appCheckCredentials.invalidateToken();
|
|
4139
4173
|
}
|
|
4140
4174
|
throw error;
|
|
4141
4175
|
}
|
|
@@ -4150,8 +4184,8 @@ class DatastoreImpl extends Datastore {
|
|
|
4150
4184
|
}
|
|
4151
4185
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
4152
4186
|
// firestore-exp client.
|
|
4153
|
-
function newDatastore(
|
|
4154
|
-
return new DatastoreImpl(
|
|
4187
|
+
function newDatastore(authCredentials, appCheckCredentials, connection, serializer) {
|
|
4188
|
+
return new DatastoreImpl(authCredentials, appCheckCredentials, connection, serializer);
|
|
4155
4189
|
}
|
|
4156
4190
|
async function invokeCommitRpc(datastore, mutations) {
|
|
4157
4191
|
const datastoreImpl = debugCast(datastore);
|
|
@@ -4227,7 +4261,7 @@ function getDatastore(firestore) {
|
|
|
4227
4261
|
const databaseInfo = makeDatabaseInfo(firestore._databaseId, firestore.app.options.appId || '', firestore._persistenceKey, firestore._freezeSettings());
|
|
4228
4262
|
const connection = newConnection(databaseInfo);
|
|
4229
4263
|
const serializer = newSerializer(firestore._databaseId);
|
|
4230
|
-
const datastore = newDatastore(firestore.
|
|
4264
|
+
const datastore = newDatastore(firestore._authCredentials, firestore._appCheckCredentials, connection, serializer);
|
|
4231
4265
|
datastoreInstances.set(firestore, datastore);
|
|
4232
4266
|
}
|
|
4233
4267
|
return datastoreInstances.get(firestore);
|
|
@@ -4403,8 +4437,9 @@ class FirestoreSettingsImpl {
|
|
|
4403
4437
|
*/
|
|
4404
4438
|
class Firestore {
|
|
4405
4439
|
/** @hideconstructor */
|
|
4406
|
-
constructor(databaseIdOrApp,
|
|
4407
|
-
this.
|
|
4440
|
+
constructor(databaseIdOrApp, _authCredentials, _appCheckCredentials) {
|
|
4441
|
+
this._authCredentials = _authCredentials;
|
|
4442
|
+
this._appCheckCredentials = _appCheckCredentials;
|
|
4408
4443
|
/**
|
|
4409
4444
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
4410
4445
|
*/
|
|
@@ -4445,7 +4480,7 @@ class Firestore {
|
|
|
4445
4480
|
}
|
|
4446
4481
|
this._settings = new FirestoreSettingsImpl(settings);
|
|
4447
4482
|
if (settings.credentials !== undefined) {
|
|
4448
|
-
this.
|
|
4483
|
+
this._authCredentials = makeAuthCredentialsProvider(settings.credentials);
|
|
4449
4484
|
}
|
|
4450
4485
|
}
|
|
4451
4486
|
_getSettings() {
|
|
@@ -4556,7 +4591,7 @@ function connectFirestoreEmulator(firestore, host, port, options = {}) {
|
|
|
4556
4591
|
}
|
|
4557
4592
|
user = new User(uid);
|
|
4558
4593
|
}
|
|
4559
|
-
firestore.
|
|
4594
|
+
firestore._authCredentials = new EmulatorAuthCredentialsProvider(new OAuthToken(token, user));
|
|
4560
4595
|
}
|
|
4561
4596
|
}
|
|
4562
4597
|
/**
|
|
@@ -4605,12 +4640,12 @@ function registerFirestore() {
|
|
|
4605
4640
|
setSDKVersion(`${app.SDK_VERSION}_lite`);
|
|
4606
4641
|
app._registerComponent(new component.Component('firestore/lite', (container, { options: settings }) => {
|
|
4607
4642
|
const app = container.getProvider('app').getImmediate();
|
|
4608
|
-
const firestoreInstance = new Firestore(app, new
|
|
4643
|
+
const firestoreInstance = new Firestore(app, new LiteAuthCredentialsProvider(container.getProvider('auth-internal')), new LiteAppCheckTokenProvider(container.getProvider('app-check-internal')));
|
|
4609
4644
|
if (settings) {
|
|
4610
4645
|
firestoreInstance._setSettings(settings);
|
|
4611
4646
|
}
|
|
4612
4647
|
return firestoreInstance;
|
|
4613
|
-
},
|
|
4648
|
+
}, 'PUBLIC'));
|
|
4614
4649
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
4615
4650
|
app.registerVersion('firestore-lite', version$1, 'node');
|
|
4616
4651
|
app.registerVersion('firestore-lite', version$1, 'cjs5');
|