Skip to content

Commit d88fbba

Browse files
Update to non-compat
1 parent 4f34045 commit d88fbba

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

packages/firestore/src/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,4 @@ export type { ByteString as _ByteString } from './util/byte_string';
158158
export { logWarn as _logWarn } from './util/log';
159159
export { EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider } from './api/credentials';
160160
export { EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider } from './api/credentials';
161+
export { setIndexConfiguration as _setIndexConfiguration } from './api/index_configuration';

packages/firestore/src/api/index_configuration.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ export {
2727
EmulatorMockTokenOptions
2828
} from '../lite-api/database';
2929

30-
/** A single field element in an index configuration. */
30+
// TODO(indexing): Remove "@internal" from the API.
31+
32+
/**
33+
* A single field element in an index configuration.
34+
*
35+
* @internal
36+
*/
3137
export interface IndexField {
3238
/** The field path to index. */
3339
readonly fieldPath: string;
@@ -49,7 +55,11 @@ export interface IndexField {
4955
[key: string]: unknown;
5056
}
5157

52-
/** The SDK definition of a Firestore index. */
58+
/**
59+
* The SDK definition of a Firestore index.
60+
*
61+
* @internal
62+
*/
5363
export interface Index {
5464
/** The ID of the collection to index. */
5565
readonly collectionGroup: string;
@@ -64,6 +74,8 @@ export interface Index {
6474
*
6575
* See {@link https://firebase.google.com/docs/reference/firestore/indexes/#json_format | JSON Format}
6676
* for a description of the format of the index definition.
77+
*
78+
* @internal
6779
*/
6880
export interface IndexConfiguration {
6981
/** A list of all Firestore indexes. */
@@ -87,6 +99,7 @@ export interface IndexConfiguration {
8799
* before setting an index configuration. If IndexedDb is not enabled, any
88100
* index configuration is ignored.
89101
*
102+
* @internal
90103
* @param firestore - The {@link Firestore} instance to configure indexes for.
91104
* @param configuration -The index definition.
92105
* @throws FirestoreError if the JSON format is invalid.
@@ -116,6 +129,7 @@ export function setIndexConfiguration(
116129
* firestore:indexes`). If the JSON format is invalid, this method throws an
117130
* error.
118131
*
132+
* @internal
119133
* @param firestore - The {@link Firestore} instance to configure indexes for.
120134
* @param json -The JSON format exported by the Firebase CLI.
121135
* @throws FirestoreError if the JSON format is invalid.

packages/firestore/test/integration/api_internal/index_configuration.test.ts renamed to packages/firestore/test/integration/api/index_configuration.test.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,16 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { Compat } from '@firebase/util';
1918
import { expect } from 'chai';
2019

21-
import { Firestore } from '../../../src';
22-
import { setIndexConfiguration } from '../../../src/api/index_configuration';
20+
import { _setIndexConfiguration as setIndexConfiguration } from '../util/firebase_export';
2321
import { apiDescribe, withTestDb } from '../util/helpers';
2422

2523
apiDescribe('Index Configuration:', (persistence: boolean) => {
2624
it('supports JSON', () => {
2725
return withTestDb(persistence, db => {
2826
return setIndexConfiguration(
29-
unwrap(db),
27+
db,
3028
'{\n' +
3129
' "indexes": [\n' +
3230
' {\n' +
@@ -62,7 +60,7 @@ apiDescribe('Index Configuration:', (persistence: boolean) => {
6260

6361
it('supports schema', () => {
6462
return withTestDb(persistence, db => {
65-
return setIndexConfiguration(unwrap(db), {
63+
return setIndexConfiguration(db, {
6664
indexes: [
6765
{
6866
collectionGroup: 'restaurants',
@@ -81,7 +79,7 @@ apiDescribe('Index Configuration:', (persistence: boolean) => {
8179

8280
it('bad JSON does not crash client', () => {
8381
return withTestDb(persistence, async db => {
84-
expect(() => setIndexConfiguration(unwrap(db), '{,}')).to.throw(
82+
expect(() => setIndexConfiguration(db, '{,}')).to.throw(
8583
'Failed to parse JSON'
8684
);
8785
});
@@ -90,7 +88,7 @@ apiDescribe('Index Configuration:', (persistence: boolean) => {
9088
it('bad index does not crash client', () => {
9189
return withTestDb(persistence, db => {
9290
return setIndexConfiguration(
93-
unwrap(db),
91+
db,
9492
'{\n' +
9593
' "indexes": [\n' +
9694
' {\n' +
@@ -110,7 +108,3 @@ apiDescribe('Index Configuration:', (persistence: boolean) => {
110108
});
111109
});
112110
});
113-
114-
function unwrap(db: unknown): Firestore {
115-
return (db as Compat<Firestore>)._delegate;
116-
}

0 commit comments

Comments
 (0)