@firebase/firestore 3.4.13 → 3.4.14-canary.6f4ba2525

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.
Files changed (77) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/firestore/src/api/credentials.d.ts +13 -3
  3. package/dist/firestore/src/api/index_configuration.d.ts +7 -8
  4. package/dist/firestore/src/api.d.ts +1 -1
  5. package/dist/firestore/src/local/indexeddb_schema.d.ts +1 -3
  6. package/dist/firestore/src/local/local_store_impl.d.ts +2 -0
  7. package/dist/firestore/src/util/array.d.ts +18 -0
  8. package/dist/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
  9. package/dist/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
  10. package/dist/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
  11. package/dist/firestore/test/unit/specs/spec_builder.d.ts +5 -0
  12. package/dist/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
  13. package/dist/firestore/test/unit/util/array.test.d.ts +17 -0
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.esm2017.js +3737 -3589
  16. package/dist/index.esm2017.js.map +1 -1
  17. package/dist/index.esm5.js +3721 -3604
  18. package/dist/index.esm5.js.map +1 -1
  19. package/dist/index.node.cjs.js +250 -53
  20. package/dist/index.node.cjs.js.map +1 -1
  21. package/dist/index.node.mjs +250 -53
  22. package/dist/index.node.mjs.map +1 -1
  23. package/dist/index.rn.js +3676 -3529
  24. package/dist/index.rn.js.map +1 -1
  25. package/dist/internal.d.ts +13 -13
  26. package/dist/lite/firestore/src/api/credentials.d.ts +13 -3
  27. package/dist/lite/firestore/src/api/index_configuration.d.ts +7 -8
  28. package/dist/lite/firestore/src/api.d.ts +1 -1
  29. package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +1 -3
  30. package/dist/lite/firestore/src/local/local_store_impl.d.ts +2 -0
  31. package/dist/lite/firestore/src/util/array.d.ts +18 -0
  32. package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
  33. package/dist/lite/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
  34. package/dist/lite/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
  35. package/dist/lite/firestore/test/unit/specs/spec_builder.d.ts +5 -0
  36. package/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
  37. package/dist/lite/firestore/test/unit/util/array.test.d.ts +17 -0
  38. package/dist/lite/index.browser.esm2017.js +232 -222
  39. package/dist/lite/index.browser.esm2017.js.map +1 -1
  40. package/dist/lite/index.browser.esm5.js +485 -469
  41. package/dist/lite/index.browser.esm5.js.map +1 -1
  42. package/dist/lite/index.node.cjs.js +36 -18
  43. package/dist/lite/index.node.cjs.js.map +1 -1
  44. package/dist/lite/index.node.mjs +36 -18
  45. package/dist/lite/index.node.mjs.map +1 -1
  46. package/dist/lite/index.rn.esm2017.js +232 -222
  47. package/dist/lite/index.rn.esm2017.js.map +1 -1
  48. package/dist/lite/internal.d.ts +3 -0
  49. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +23 -23
  50. package/dist/lite/packages/firestore/src/api/credentials.d.ts +13 -3
  51. package/dist/lite/packages/firestore/src/api/index_configuration.d.ts +7 -8
  52. package/dist/lite/packages/firestore/src/api.d.ts +1 -1
  53. package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +1 -3
  54. package/dist/lite/packages/firestore/src/local/local_store_impl.d.ts +2 -0
  55. package/dist/lite/packages/firestore/src/util/array.d.ts +18 -0
  56. package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
  57. package/dist/lite/packages/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
  58. package/dist/lite/packages/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
  59. package/dist/lite/packages/firestore/test/unit/specs/spec_builder.d.ts +5 -0
  60. package/dist/lite/packages/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
  61. package/dist/lite/packages/firestore/test/unit/util/array.test.d.ts +17 -0
  62. package/dist/lite/private.d.ts +3 -0
  63. package/dist/packages/firestore/dist/index.esm2017.d.ts +193 -193
  64. package/dist/packages/firestore/src/api/credentials.d.ts +13 -3
  65. package/dist/packages/firestore/src/api/index_configuration.d.ts +7 -8
  66. package/dist/packages/firestore/src/api.d.ts +1 -1
  67. package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +1 -3
  68. package/dist/packages/firestore/src/local/local_store_impl.d.ts +2 -0
  69. package/dist/packages/firestore/src/util/array.d.ts +18 -0
  70. package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
  71. package/dist/packages/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
  72. package/dist/packages/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
  73. package/dist/packages/firestore/test/unit/specs/spec_builder.d.ts +5 -0
  74. package/dist/packages/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
  75. package/dist/packages/firestore/test/unit/util/array.test.d.ts +17 -0
  76. package/dist/private.d.ts +4 -1
  77. package/package.json +10 -9
@@ -6,7 +6,7 @@ import { FirebaseError, createMockUserToken, getModularInstance } from '@firebas
6
6
  import nodeFetch from 'node-fetch';
7
7
  import { randomBytes as randomBytes$1 } from 'crypto';
8
8
 
9
- const version$1 = "3.4.13";
9
+ const version$1 = "3.4.14-canary.6f4ba2525";
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.9.1";
62
+ const version = "9.9.2-canary.6f4ba2525";
63
63
 
64
64
  /**
65
65
  * @license
@@ -506,19 +506,41 @@ class LiteAuthCredentialsProvider {
506
506
  * safer to keep the implementation as-is.
507
507
  */
508
508
  class FirstPartyToken {
509
- constructor(gapi, sessionIndex, iamToken) {
509
+ constructor(gapi, sessionIndex, iamToken, authTokenFactory) {
510
+ this.gapi = gapi;
511
+ this.sessionIndex = sessionIndex;
512
+ this.iamToken = iamToken;
513
+ this.authTokenFactory = authTokenFactory;
510
514
  this.type = 'FirstParty';
511
515
  this.user = User.FIRST_PARTY;
512
- this.headers = new Map();
513
- this.headers.set('X-Goog-AuthUser', sessionIndex);
514
- const authHeader = gapi['auth']['getAuthHeaderValueForFirstParty']([]);
515
- if (authHeader) {
516
- this.headers.set('Authorization', authHeader);
516
+ this._headers = new Map();
517
+ }
518
+ /** Gets an authorization token, using a provided factory function, or falling back to First Party GAPI. */
519
+ getAuthToken() {
520
+ if (this.authTokenFactory) {
521
+ return this.authTokenFactory();
517
522
  }
518
- if (iamToken) {
519
- this.headers.set('X-Goog-Iam-Authorization-Token', iamToken);
523
+ else {
524
+ // Make sure this really is a Gapi client.
525
+ hardAssert(!!(typeof this.gapi === 'object' &&
526
+ this.gapi !== null &&
527
+ this.gapi['auth'] &&
528
+ this.gapi['auth']['getAuthHeaderValueForFirstParty']));
529
+ return this.gapi['auth']['getAuthHeaderValueForFirstParty']([]);
520
530
  }
521
531
  }
532
+ get headers() {
533
+ this._headers.set('X-Goog-AuthUser', this.sessionIndex);
534
+ // Use array notation to prevent minification
535
+ const authHeaderTokenValue = this.getAuthToken();
536
+ if (authHeaderTokenValue) {
537
+ this._headers.set('Authorization', authHeaderTokenValue);
538
+ }
539
+ if (this.iamToken) {
540
+ this._headers.set('X-Goog-Iam-Authorization-Token', this.iamToken);
541
+ }
542
+ return this._headers;
543
+ }
522
544
  }
523
545
  /*
524
546
  * Provides user credentials required for the Firestore JavaScript SDK
@@ -526,13 +548,14 @@ class FirstPartyToken {
526
548
  * to applications hosted by Google.
527
549
  */
528
550
  class FirstPartyAuthCredentialsProvider {
529
- constructor(gapi, sessionIndex, iamToken) {
551
+ constructor(gapi, sessionIndex, iamToken, authTokenFactory) {
530
552
  this.gapi = gapi;
531
553
  this.sessionIndex = sessionIndex;
532
554
  this.iamToken = iamToken;
555
+ this.authTokenFactory = authTokenFactory;
533
556
  }
534
557
  getToken() {
535
- return Promise.resolve(new FirstPartyToken(this.gapi, this.sessionIndex, this.iamToken));
558
+ return Promise.resolve(new FirstPartyToken(this.gapi, this.sessionIndex, this.iamToken, this.authTokenFactory));
536
559
  }
537
560
  start(asyncQueue, changeListener) {
538
561
  // Fire with initial uid.
@@ -589,12 +612,7 @@ function makeAuthCredentialsProvider(credentials) {
589
612
  switch (credentials['type']) {
590
613
  case 'gapi':
591
614
  const client = credentials['client'];
592
- // Make sure this really is a Gapi client.
593
- hardAssert(!!(typeof client === 'object' &&
594
- client !== null &&
595
- client['auth'] &&
596
- client['auth']['getAuthHeaderValueForFirstParty']));
597
- return new FirstPartyAuthCredentialsProvider(client, credentials['sessionIndex'] || '0', credentials['iamToken'] || null);
615
+ return new FirstPartyAuthCredentialsProvider(client, credentials['sessionIndex'] || '0', credentials['iamToken'] || null, credentials['authTokenFactory'] || null);
598
616
  case 'provider':
599
617
  return credentials['client'];
600
618
  default: