@firebase/firestore 3.4.13-canary.f5426a512 → 3.4.14-canary.79df09b11

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 (41) 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 +0 -8
  4. package/dist/firestore/src/api.d.ts +1 -1
  5. package/dist/index.d.ts +91 -1
  6. package/dist/index.esm2017.js +1650 -1640
  7. package/dist/index.esm2017.js.map +1 -1
  8. package/dist/index.esm5.js +2295 -2279
  9. package/dist/index.esm5.js.map +1 -1
  10. package/dist/index.node.cjs.js +37 -19
  11. package/dist/index.node.cjs.js.map +1 -1
  12. package/dist/index.node.mjs +37 -19
  13. package/dist/index.node.mjs.map +1 -1
  14. package/dist/index.rn.js +1650 -1640
  15. package/dist/index.rn.js.map +1 -1
  16. package/dist/internal.d.ts +8 -13
  17. package/dist/lite/firestore/src/api/credentials.d.ts +13 -3
  18. package/dist/lite/firestore/src/api/index_configuration.d.ts +0 -8
  19. package/dist/lite/firestore/src/api.d.ts +1 -1
  20. package/dist/lite/index.browser.esm2017.js +232 -222
  21. package/dist/lite/index.browser.esm2017.js.map +1 -1
  22. package/dist/lite/index.browser.esm5.js +485 -469
  23. package/dist/lite/index.browser.esm5.js.map +1 -1
  24. package/dist/lite/index.node.cjs.js +36 -18
  25. package/dist/lite/index.node.cjs.js.map +1 -1
  26. package/dist/lite/index.node.mjs +36 -18
  27. package/dist/lite/index.node.mjs.map +1 -1
  28. package/dist/lite/index.rn.esm2017.js +232 -222
  29. package/dist/lite/index.rn.esm2017.js.map +1 -1
  30. package/dist/lite/internal.d.ts +3 -0
  31. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +23 -23
  32. package/dist/lite/packages/firestore/src/api/credentials.d.ts +13 -3
  33. package/dist/lite/packages/firestore/src/api/index_configuration.d.ts +0 -8
  34. package/dist/lite/packages/firestore/src/api.d.ts +1 -1
  35. package/dist/lite/private.d.ts +3 -0
  36. package/dist/packages/firestore/dist/index.esm2017.d.ts +67 -67
  37. package/dist/packages/firestore/src/api/credentials.d.ts +13 -3
  38. package/dist/packages/firestore/src/api/index_configuration.d.ts +0 -8
  39. package/dist/packages/firestore/src/api.d.ts +1 -1
  40. package/dist/private.d.ts +95 -4
  41. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @firebase/firestore
2
2
 
3
+ ## 3.4.14
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f5426a512`](https://github.com/firebase/firebase-js-sdk/commit/f5426a51275bb611a5d9a6df3200d0fe5095afa2) [#6403](https://github.com/firebase/firebase-js-sdk/pull/6403) - Add internal implementation of setIndexConfiguration
8
+
9
+ * [`10765511f`](https://github.com/firebase/firebase-js-sdk/commit/10765511f7ba33293f7a15af1f98d69a261c019d) [#6496](https://github.com/firebase/firebase-js-sdk/pull/6496) - Expose client side indexing feature with `setIndexConfiguration`.
10
+
3
11
  ## 3.4.13
4
12
 
5
13
  ### Patch Changes
@@ -19,11 +19,13 @@ import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
19
19
  import { Provider } from '@firebase/component';
20
20
  import { User } from '../auth/user';
21
21
  import { AsyncQueue } from '../util/async_queue';
22
+ export declare type AuthTokenFactory = () => string;
22
23
  export interface FirstPartyCredentialsSettings {
23
24
  ['type']: 'gapi';
24
25
  ['client']: unknown;
25
26
  ['sessionIndex']: string;
26
27
  ['iamToken']: string | null;
28
+ ['authTokenFactory']: AuthTokenFactory | null;
27
29
  }
28
30
  export interface ProviderCredentialsSettings {
29
31
  ['type']: 'provider';
@@ -146,16 +148,24 @@ interface Gapi {
146
148
  };
147
149
  }
148
150
  export declare class FirstPartyToken implements Token {
151
+ private readonly gapi;
152
+ private readonly sessionIndex;
153
+ private readonly iamToken;
154
+ private readonly authTokenFactory;
149
155
  type: TokenType;
150
156
  user: User;
151
- headers: Map<any, any>;
152
- constructor(gapi: Gapi, sessionIndex: string, iamToken: string | null);
157
+ private _headers;
158
+ constructor(gapi: Gapi | null, sessionIndex: string, iamToken: string | null, authTokenFactory: AuthTokenFactory | null);
159
+ /** Gets an authorization token, using a provided factory function, or falling back to First Party GAPI. */
160
+ private getAuthToken;
161
+ get headers(): Map<string, string>;
153
162
  }
154
163
  export declare class FirstPartyAuthCredentialsProvider implements CredentialsProvider<User> {
155
164
  private gapi;
156
165
  private sessionIndex;
157
166
  private iamToken;
158
- constructor(gapi: Gapi, sessionIndex: string, iamToken: string | null);
167
+ private authTokenFactory;
168
+ constructor(gapi: Gapi | null, sessionIndex: string, iamToken: string | null, authTokenFactory: AuthTokenFactory | null);
159
169
  getToken(): Promise<Token | null>;
160
170
  start(asyncQueue: AsyncQueue, changeListener: CredentialChangeListener<User>): void;
161
171
  shutdown(): void;
@@ -19,8 +19,6 @@ import { Firestore } from './database';
19
19
  export { connectFirestoreEmulator, EmulatorMockTokenOptions } from '../lite-api/database';
20
20
  /**
21
21
  * A single field element in an index configuration.
22
- *
23
- * @internal
24
22
  */
25
23
  export interface IndexField {
26
24
  /** The field path to index. */
@@ -43,8 +41,6 @@ export interface IndexField {
43
41
  }
44
42
  /**
45
43
  * The SDK definition of a Firestore index.
46
- *
47
- * @internal
48
44
  */
49
45
  export interface Index {
50
46
  /** The ID of the collection to index. */
@@ -58,8 +54,6 @@ export interface Index {
58
54
  *
59
55
  * See {@link https://firebase.google.com/docs/reference/firestore/indexes/#json_format | JSON Format}
60
56
  * for a description of the format of the index definition.
61
- *
62
- * @internal
63
57
  */
64
58
  export interface IndexConfiguration {
65
59
  /** A list of all Firestore indexes. */
@@ -81,7 +75,6 @@ export interface IndexConfiguration {
81
75
  * before setting an index configuration. If IndexedDb is not enabled, any
82
76
  * index configuration is ignored.
83
77
  *
84
- * @internal
85
78
  * @param firestore - The {@link Firestore} instance to configure indexes for.
86
79
  * @param configuration -The index definition.
87
80
  * @throws FirestoreError if the JSON format is invalid.
@@ -108,7 +101,6 @@ export declare function setIndexConfiguration(firestore: Firestore, configuratio
108
101
  * firestore:indexes`). If the JSON format is invalid, this method throws an
109
102
  * error.
110
103
  *
111
- * @internal
112
104
  * @param firestore - The {@link Firestore} instance to configure indexes for.
113
105
  * @param json -The JSON format exported by the Firebase CLI.
114
106
  * @throws FirestoreError if the JSON format is invalid.
@@ -36,6 +36,7 @@ export { CACHE_SIZE_UNLIMITED } from './api/database';
36
36
  export { FirestoreErrorCode, FirestoreError } from './util/error';
37
37
  export { AbstractUserDataWriter } from './lite-api/user_data_writer';
38
38
  export { Primitive, NestedUpdateFields, ChildUpdateFields, AddPrefixToKeys, UnionToIntersection } from '../src/lite-api/types';
39
+ export { setIndexConfiguration, Index, IndexConfiguration, IndexField } from './api/index_configuration';
39
40
  /**
40
41
  * Internal exports
41
42
  */
@@ -50,4 +51,3 @@ export type { ByteString as _ByteString } from './util/byte_string';
50
51
  export { logWarn as _logWarn } from './util/log';
51
52
  export { EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider } from './api/credentials';
52
53
  export { EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider } from './api/credentials';
53
- export { setIndexConfiguration as _setIndexConfiguration } from './api/index_configuration';
package/dist/index.d.ts CHANGED
@@ -929,6 +929,49 @@ export declare function getFirestore(app?: FirebaseApp): Firestore;
929
929
  * `updateDoc()`
930
930
  */
931
931
  export declare function increment(n: number): FieldValue;
932
+ /**
933
+ * The SDK definition of a Firestore index.
934
+ */
935
+ export declare interface Index {
936
+ /** The ID of the collection to index. */
937
+ readonly collectionGroup: string;
938
+ /** A list of fields to index. */
939
+ readonly fields?: IndexField[];
940
+ [key: string]: unknown;
941
+ }
942
+ /**
943
+ * A list of Firestore indexes to speed up local query execution.
944
+ *
945
+ * See {@link https://firebase.google.com/docs/reference/firestore/indexes/#json_format | JSON Format}
946
+ * for a description of the format of the index definition.
947
+ */
948
+ export declare interface IndexConfiguration {
949
+ /** A list of all Firestore indexes. */
950
+ readonly indexes?: Index[];
951
+ [key: string]: unknown;
952
+ }
953
+ /**
954
+ * A single field element in an index configuration.
955
+ */
956
+ export declare interface IndexField {
957
+ /** The field path to index. */
958
+ readonly fieldPath: string;
959
+ /**
960
+ * What type of array index to create. Set to `CONTAINS` for `array-contains`
961
+ * and `array-contains-any` indexes.
962
+ *
963
+ * Only one of `arrayConfig` or `order` should be set;
964
+ */
965
+ readonly arrayConfig?: 'CONTAINS';
966
+ /**
967
+ * What type of array index to create. Set to `ASCENDING` or 'DESCENDING` for
968
+ * `==`, `!=`, `<=`, `<=`, `in` and `not-in` filters.
969
+ *
970
+ * Only one of `arrayConfig` or `order` should be set.
971
+ */
972
+ readonly order?: 'ASCENDING' | 'DESCENDING';
973
+ [key: string]: unknown;
974
+ }
932
975
  /**
933
976
  * Initializes a new instance of {@link Firestore} with the provided settings.
934
977
  * Can only be called before any other function, including
@@ -1471,7 +1514,54 @@ export declare function setDoc<T>(reference: DocumentReference<T>, data: WithFie
1471
1514
  * to the backend (note that it won't resolve while you're offline).
1472
1515
  */
1473
1516
  export declare function setDoc<T>(reference: DocumentReference<T>, data: PartialWithFieldValue<T>, options: SetOptions): Promise<void>;
1474
- /* Excluded from this release type: _setIndexConfiguration */
1517
+ /**
1518
+ * Configures indexing for local query execution. Any previous index
1519
+ * configuration is overridden. The `Promise` resolves once the index
1520
+ * configuration has been persisted.
1521
+ *
1522
+ * The index entries themselves are created asynchronously. You can continue to
1523
+ * use queries that require indexing even if the indices are not yet available.
1524
+ * Query execution will automatically start using the index once the index
1525
+ * entries have been written.
1526
+ *
1527
+ * Indexes are only supported with IndexedDb persistence. Invoke either
1528
+ * `enableIndexedDbPersistence()` or `enableMultiTabIndexedDbPersistence()`
1529
+ * before setting an index configuration. If IndexedDb is not enabled, any
1530
+ * index configuration is ignored.
1531
+ *
1532
+ * @param firestore - The {@link Firestore} instance to configure indexes for.
1533
+ * @param configuration -The index definition.
1534
+ * @throws FirestoreError if the JSON format is invalid.
1535
+ * @returns A `Promise` that resolves once all indices are successfully
1536
+ * configured.
1537
+ */
1538
+ export declare function setIndexConfiguration(firestore: Firestore, configuration: IndexConfiguration): Promise<void>;
1539
+ /**
1540
+ * Configures indexing for local query execution. Any previous index
1541
+ * configuration is overridden. The `Promise` resolves once the index
1542
+ * configuration has been persisted.
1543
+ *
1544
+ * The index entries themselves are created asynchronously. You can continue to
1545
+ * use queries that require indexing even if the indices are not yet available.
1546
+ * Query execution will automatically start using the index once the index
1547
+ * entries have been written.
1548
+ *
1549
+ * Indexes are only supported with IndexedDb persistence. Invoke either
1550
+ * `enableIndexedDbPersistence()` or `enableMultiTabIndexedDbPersistence()`
1551
+ * before setting an index configuration. If IndexedDb is not enabled, any
1552
+ * index configuration is ignored.
1553
+ *
1554
+ * The method accepts the JSON format exported by the Firebase CLI (`firebase
1555
+ * firestore:indexes`). If the JSON format is invalid, this method throws an
1556
+ * error.
1557
+ *
1558
+ * @param firestore - The {@link Firestore} instance to configure indexes for.
1559
+ * @param json -The JSON format exported by the Firebase CLI.
1560
+ * @throws FirestoreError if the JSON format is invalid.
1561
+ * @returns A `Promise` that resolves once all indices are successfully
1562
+ * configured.
1563
+ */
1564
+ export declare function setIndexConfiguration(firestore: Firestore, json: string): Promise<void>;
1475
1565
  /**
1476
1566
  * Sets the verbosity of Cloud Firestore logs (debug, error, or silent).
1477
1567
  *