Skip to content

Commit d795ff6

Browse files
committed
changeset
1 parent b483790 commit d795ff6

File tree

3 files changed

+340
-1
lines changed

3 files changed

+340
-1
lines changed

.changeset/rotten-wombats-shop.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'@firebase/database': patch
33
---
44

5-
Index server data retrieved by get()
5+
Fix `index not defined` errors for orderByChild get requests

common/api-review/firestore.api.md

Lines changed: 338 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,338 @@
1+
## API Report File for "@firebase/firestore"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
import { FirebaseApp } from '@firebase/app-exp';
8+
import { LogLevelString as LogLevel } from '@firebase/logger';
9+
10+
// @public
11+
export function addDoc<T>(reference: CollectionReference<T>, data: T): Promise<DocumentReference<T>>;
12+
13+
// @public
14+
export function arrayRemove(...elements: unknown[]): FieldValue;
15+
16+
// @public
17+
export function arrayUnion(...elements: unknown[]): FieldValue;
18+
19+
// @public
20+
export class Bytes {
21+
static fromBase64String(base64: string): Bytes;
22+
static fromUint8Array(array: Uint8Array): Bytes;
23+
isEqual(other: Bytes): boolean;
24+
toBase64(): string;
25+
toString(): string;
26+
toUint8Array(): Uint8Array;
27+
}
28+
29+
// @public
30+
export function collection(firestore: FirebaseFirestore, path: string, ...pathSegments: string[]): CollectionReference<DocumentData>;
31+
32+
// @public
33+
export function collection(reference: CollectionReference<unknown>, path: string, ...pathSegments: string[]): CollectionReference<DocumentData>;
34+
35+
// @public
36+
export function collection(reference: DocumentReference, path: string, ...pathSegments: string[]): CollectionReference<DocumentData>;
37+
38+
// @public
39+
export function collectionGroup(firestore: FirebaseFirestore, collectionId: string): Query<DocumentData>;
40+
41+
// @public
42+
export class CollectionReference<T = DocumentData> extends Query<T> {
43+
get id(): string;
44+
get parent(): DocumentReference<DocumentData> | null;
45+
get path(): string;
46+
readonly type = "collection";
47+
withConverter<U>(converter: FirestoreDataConverter<U>): CollectionReference<U>;
48+
withConverter(converter: null): CollectionReference<DocumentData>;
49+
}
50+
51+
// @public
52+
export function deleteDoc(reference: DocumentReference<unknown>): Promise<void>;
53+
54+
// @public
55+
export function deleteField(): FieldValue;
56+
57+
// @public
58+
export function doc(firestore: FirebaseFirestore, path: string, ...pathSegments: string[]): DocumentReference<DocumentData>;
59+
60+
// @public
61+
export function doc<T>(reference: CollectionReference<T>, path?: string, ...pathSegments: string[]): DocumentReference<T>;
62+
63+
// @public
64+
export function doc(reference: DocumentReference<unknown>, path: string, ...pathSegments: string[]): DocumentReference<DocumentData>;
65+
66+
// @public
67+
export interface DocumentData {
68+
[field: string]: any;
69+
}
70+
71+
// @public
72+
export function documentId(): FieldPath;
73+
74+
// @public
75+
export class DocumentReference<T = DocumentData> {
76+
readonly firestore: FirebaseFirestore;
77+
get id(): string;
78+
get parent(): CollectionReference<T>;
79+
get path(): string;
80+
readonly type = "document";
81+
withConverter<U>(converter: FirestoreDataConverter<U>): DocumentReference<U>;
82+
withConverter(converter: null): DocumentReference<DocumentData>;
83+
}
84+
85+
// @public
86+
export class DocumentSnapshot<T = DocumentData> {
87+
protected constructor();
88+
data(): T | undefined;
89+
exists(): this is QueryDocumentSnapshot<T>;
90+
get(fieldPath: string | FieldPath): any;
91+
get id(): string;
92+
get ref(): DocumentReference<T>;
93+
}
94+
95+
// @public
96+
export function endAt(snapshot: DocumentSnapshot<unknown>): QueryConstraint;
97+
98+
// @public
99+
export function endAt(...fieldValues: unknown[]): QueryConstraint;
100+
101+
// @public
102+
export function endBefore(snapshot: DocumentSnapshot<unknown>): QueryConstraint;
103+
104+
// @public
105+
export function endBefore(...fieldValues: unknown[]): QueryConstraint;
106+
107+
// @public
108+
export class FieldPath {
109+
constructor(...fieldNames: string[]);
110+
isEqual(other: FieldPath): boolean;
111+
}
112+
113+
// @public
114+
export abstract class FieldValue {
115+
abstract isEqual(other: FieldValue): boolean;
116+
}
117+
118+
// @public
119+
export class FirebaseFirestore {
120+
get app(): FirebaseApp;
121+
toJSON(): object;
122+
}
123+
124+
// @public
125+
export interface FirestoreDataConverter<T> {
126+
fromFirestore(snapshot: QueryDocumentSnapshot<DocumentData>): T;
127+
toFirestore(modelObject: T): DocumentData;
128+
toFirestore(modelObject: Partial<T>, options: SetOptions): DocumentData;
129+
}
130+
131+
// @public
132+
export class FirestoreError extends Error {
133+
readonly code: FirestoreErrorCode;
134+
readonly message: string;
135+
readonly name: string;
136+
readonly stack?: string;
137+
}
138+
139+
// @public
140+
export type FirestoreErrorCode = 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated';
141+
142+
// @public
143+
export class GeoPoint {
144+
constructor(latitude: number, longitude: number);
145+
isEqual(other: GeoPoint): boolean;
146+
get latitude(): number;
147+
get longitude(): number;
148+
toJSON(): {
149+
latitude: number;
150+
longitude: number;
151+
};
152+
}
153+
154+
// @public
155+
export function getDoc<T>(reference: DocumentReference<T>): Promise<DocumentSnapshot<T>>;
156+
157+
// @public
158+
export function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
159+
160+
// @public
161+
export function getFirestore(app?: FirebaseApp): FirebaseFirestore;
162+
163+
// @public
164+
export function increment(n: number): FieldValue;
165+
166+
// @public
167+
export function initializeFirestore(app: FirebaseApp, settings: Settings): FirebaseFirestore;
168+
169+
// @public
170+
export function limit(limit: number): QueryConstraint;
171+
172+
// @public
173+
export function limitToLast(limit: number): QueryConstraint;
174+
175+
export { LogLevel }
176+
177+
// @public
178+
export function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryConstraint;
179+
180+
// @public
181+
export type OrderByDirection = 'desc' | 'asc';
182+
183+
// @public
184+
export class Query<T = DocumentData> {
185+
protected constructor();
186+
readonly firestore: FirebaseFirestore;
187+
readonly type: 'query' | 'collection';
188+
withConverter(converter: null): Query<DocumentData>;
189+
withConverter<U>(converter: FirestoreDataConverter<U>): Query<U>;
190+
}
191+
192+
// @public
193+
export function query<T>(query: Query<T>, ...queryConstraints: QueryConstraint[]): Query<T>;
194+
195+
// @public
196+
export abstract class QueryConstraint {
197+
abstract readonly type: QueryConstraintType;
198+
}
199+
200+
// @public
201+
export type QueryConstraintType = 'where' | 'orderBy' | 'limit' | 'limitToLast' | 'startAt' | 'startAfter' | 'endAt' | 'endBefore';
202+
203+
// @public
204+
export class QueryDocumentSnapshot<T = DocumentData> extends DocumentSnapshot<T> {
205+
// @override
206+
data(): T;
207+
}
208+
209+
// @public
210+
export function queryEqual<T>(left: Query<T>, right: Query<T>): boolean;
211+
212+
// @public
213+
export class QuerySnapshot<T = DocumentData> {
214+
get docs(): Array<QueryDocumentSnapshot<T>>;
215+
get empty(): boolean;
216+
forEach(callback: (result: QueryDocumentSnapshot<T>) => void, thisArg?: unknown): void;
217+
readonly query: Query<T>;
218+
get size(): number;
219+
}
220+
221+
// @public
222+
export function refEqual<T>(left: DocumentReference<T> | CollectionReference<T>, right: DocumentReference<T> | CollectionReference<T>): boolean;
223+
224+
// @public
225+
export function runTransaction<T>(firestore: FirebaseFirestore, updateFunction: (transaction: Transaction) => Promise<T>): Promise<T>;
226+
227+
// @public
228+
export function serverTimestamp(): FieldValue;
229+
230+
// @public
231+
export function setDoc<T>(reference: DocumentReference<T>, data: T): Promise<void>;
232+
233+
// @public
234+
export function setDoc<T>(reference: DocumentReference<T>, data: Partial<T>, options: SetOptions): Promise<void>;
235+
236+
// @public
237+
export function setLogLevel(logLevel: LogLevel): void;
238+
239+
// @public
240+
export type SetOptions = {
241+
readonly merge?: boolean;
242+
} | {
243+
readonly mergeFields?: Array<string | FieldPath>;
244+
};
245+
246+
// @public
247+
export interface Settings {
248+
host?: string;
249+
ignoreUndefinedProperties?: boolean;
250+
ssl?: boolean;
251+
}
252+
253+
// @public
254+
export function snapshotEqual<T>(left: DocumentSnapshot<T> | QuerySnapshot<T>, right: DocumentSnapshot<T> | QuerySnapshot<T>): boolean;
255+
256+
// @public
257+
export function startAfter(snapshot: DocumentSnapshot<unknown>): QueryConstraint;
258+
259+
// @public
260+
export function startAfter(...fieldValues: unknown[]): QueryConstraint;
261+
262+
// @public
263+
export function startAt(snapshot: DocumentSnapshot<unknown>): QueryConstraint;
264+
265+
// @public
266+
export function startAt(...fieldValues: unknown[]): QueryConstraint;
267+
268+
// @public
269+
export function terminate(firestore: FirebaseFirestore): Promise<void>;
270+
271+
// @public
272+
export class Timestamp {
273+
constructor(
274+
seconds: number,
275+
nanoseconds: number);
276+
static fromDate(date: Date): Timestamp;
277+
static fromMillis(milliseconds: number): Timestamp;
278+
isEqual(other: Timestamp): boolean;
279+
readonly nanoseconds: number;
280+
static now(): Timestamp;
281+
readonly seconds: number;
282+
toDate(): Date;
283+
toJSON(): {
284+
seconds: number;
285+
nanoseconds: number;
286+
};
287+
toMillis(): number;
288+
toString(): string;
289+
valueOf(): string;
290+
}
291+
292+
// @public
293+
export class Transaction {
294+
delete(documentRef: DocumentReference<unknown>): this;
295+
get<T>(documentRef: DocumentReference<T>): Promise<DocumentSnapshot<T>>;
296+
set<T>(documentRef: DocumentReference<T>, data: T): this;
297+
set<T>(documentRef: DocumentReference<T>, data: Partial<T>, options: SetOptions): this;
298+
update(documentRef: DocumentReference<unknown>, data: UpdateData): this;
299+
update(documentRef: DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): this;
300+
}
301+
302+
// @public
303+
export interface UpdateData {
304+
[fieldPath: string]: any;
305+
}
306+
307+
// @public
308+
export function updateDoc(reference: DocumentReference<unknown>, data: UpdateData): Promise<void>;
309+
310+
// @public
311+
export function updateDoc(reference: DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): Promise<void>;
312+
313+
// @public
314+
export function useFirestoreEmulator(firestore: FirebaseFirestore, host: string, port: number): void;
315+
316+
// @public
317+
export function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryConstraint;
318+
319+
// @public
320+
export type WhereFilterOp = '<' | '<=' | '==' | '!=' | '>=' | '>' | 'array-contains' | 'in' | 'array-contains-any' | 'not-in';
321+
322+
// @public
323+
export class WriteBatch {
324+
commit(): Promise<void>;
325+
delete(documentRef: DocumentReference<unknown>): WriteBatch;
326+
set<T>(documentRef: DocumentReference<T>, data: T): WriteBatch;
327+
set<T>(documentRef: DocumentReference<T>, data: Partial<T>, options: SetOptions): WriteBatch;
328+
update(documentRef: DocumentReference<unknown>, data: UpdateData): WriteBatch;
329+
update(documentRef: DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): WriteBatch;
330+
}
331+
332+
// @public
333+
export function writeBatch(firestore: FirebaseFirestore): WriteBatch;
334+
335+
336+
// (No @packageDocumentation comment for this package)
337+
338+
```

packages/database/rules.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rules": {"$path": {".read": true, ".write": true, ".indexOn": "data"}}

0 commit comments

Comments
 (0)