@hyper-fetch/firebase-admin 10.0.0 → 10.1.1
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/README.md +111 -63
- package/__tests__/features/constraints/constraints.base.spec.ts +44 -0
- package/__tests__/features/constraints/listener-extra.types.spec.ts +14 -0
- package/__tests__/features/constraints/query-params.types.spec.ts +83 -0
- package/__tests__/features/firestore/admin/constraints.admin.spec.ts +1 -0
- package/__tests__/features/firestore/admin/sockets.base.spec.ts +4 -1
- package/__tests__/features/firestore/shared/constraints.shared.tests.ts +87 -6
- package/__tests__/features/firestore/shared/methods/get-doc.test.suite.ts +15 -0
- package/__tests__/features/firestore/shared/methods/get-docs.test.suite.ts +1 -1
- package/__tests__/features/firestore/shared/methods/on-snapshot.test.suite.ts +79 -5
- package/__tests__/features/firestore/shared/methods/update-doc.test.suite.ts +1 -0
- package/__tests__/features/firestore/shared/methods.shared.tests.ts +2 -2
- package/__tests__/features/realtime/shared/constraints.shared.tests.ts +58 -8
- package/__tests__/features/realtime/shared/methods/get.test.suite.ts +23 -0
- package/__tests__/features/realtime/shared/methods/on-value.test.suite.ts +108 -5
- package/__tests__/features/realtime/shared/methods/push.test.suite.ts +3 -3
- package/__tests__/features/realtime/shared/methods/remove.test.suite.ts +3 -3
- package/__tests__/features/realtime/shared/methods/update.test.suite.ts +3 -3
- package/__tests__/shared/request-events.shared.ts +1 -4
- package/dist/adapter/adapter.d.ts +19 -0
- package/dist/adapter/adapter.d.ts.map +1 -1
- package/dist/adapter/adapter.sockets.d.ts +17 -0
- package/dist/adapter/adapter.sockets.d.ts.map +1 -1
- package/dist/adapter/types/adapter.firestore.types.d.ts +28 -6
- package/dist/adapter/types/adapter.firestore.types.d.ts.map +1 -1
- package/dist/adapter/types/adapter.realtime.types.d.ts +26 -6
- package/dist/adapter/types/adapter.realtime.types.d.ts.map +1 -1
- package/dist/adapter/types/firestore.socket.types.d.ts +6 -4
- package/dist/adapter/types/firestore.socket.types.d.ts.map +1 -1
- package/dist/adapter/types/realtime.socket.types.d.ts +2 -4
- package/dist/adapter/types/realtime.socket.types.d.ts.map +1 -1
- package/dist/constraints/constraints.builder.d.ts +98 -0
- package/dist/constraints/constraints.builder.d.ts.map +1 -0
- package/dist/constraints/firebase.constraints.d.ts +109 -1
- package/dist/constraints/firebase.constraints.d.ts.map +1 -1
- package/dist/constraints/index.d.ts +1 -0
- package/dist/constraints/index.d.ts.map +1 -1
- package/dist/firestore/firestore.sockets.d.ts.map +1 -1
- package/dist/index.mjs +277 -94
- package/dist/index.mjs.map +1 -1
- package/dist/realtime/realtime.methods.d.ts +7 -5
- package/dist/realtime/realtime.methods.d.ts.map +1 -1
- package/dist/realtime/realtime.sockets.d.ts.map +1 -1
- package/dist/utils/misc.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/adapter/adapter.sockets.ts +17 -0
- package/src/adapter/adapter.ts +77 -46
- package/src/adapter/types/adapter.firestore.types.ts +40 -7
- package/src/adapter/types/adapter.realtime.types.ts +39 -7
- package/src/adapter/types/firestore.socket.types.ts +10 -2
- package/src/adapter/types/realtime.socket.types.ts +6 -3
- package/src/constraints/constraints.builder.ts +214 -0
- package/src/constraints/firebase.constraints.ts +111 -3
- package/src/constraints/index.ts +1 -0
- package/src/firestore/firestore.methods.ts +8 -8
- package/src/firestore/firestore.sockets.ts +65 -56
- package/src/firestore/utils/constraints.utils.ts +4 -4
- package/src/realtime/realtime.methods.ts +19 -20
- package/src/realtime/realtime.sockets.ts +57 -52
- package/src/realtime/utils/constraints.utils.ts +10 -10
- package/src/utils/misc.ts +1 -1
- package/vite.config.ts +2 -0
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Adapter } from '@hyper-fetch/core';
|
|
2
2
|
import { SocketAdapter } from '@hyper-fetch/sockets';
|
|
3
|
-
import { PermittedConstraints, RealtimeConstraintsUnion, RealtimePermittedMethods, SharedQueryConstraints } from '../../constraints';
|
|
3
|
+
import { OrderedRealtimeConstraints, PermittedConstraints, RealtimeConstraints, RealtimeConstraintsUnion, RealtimePermittedMethods, SharedQueryConstraints } from '../../constraints';
|
|
4
4
|
import { DatabaseReference, DataSnapshot } from 'firebase/database';
|
|
5
|
-
export type RealtimeSocketAdapterType = SocketAdapter<never, RealtimeDbOnValueMethodExtra,
|
|
6
|
-
onlyOnce?: boolean;
|
|
7
|
-
} & RealtimeDBQueryParams>;
|
|
5
|
+
export type RealtimeSocketAdapterType = SocketAdapter<never, RealtimeDbOnValueMethodExtra, RealtimeDBListenerOptions>;
|
|
8
6
|
export type RealtimeDbAdapterType = Adapter<DefaultRealtimeDBAdapterOptions, "get", RealtimeDBStatuses, RealtimeDbGetMethodExtra, RealtimeDBQueryParams, RealtimeDBQueryParams> | Adapter<DefaultRealtimeDBAdapterOptions, "push", RealtimeDBStatuses, RealtimeDbPushMethodExtra, Record<string, never>, undefined> | Adapter<DefaultRealtimeDBAdapterOptions, "set" | "update" | "remove", RealtimeDBStatuses, RealtimeDbDefaultExtra, Record<string, never>, undefined>;
|
|
9
7
|
export type DefaultRealtimeDBAdapterOptions = {
|
|
10
8
|
priority?: number;
|
|
@@ -33,7 +31,29 @@ export type RealtimeDbPushMethodExtra = {
|
|
|
33
31
|
ref: DatabaseReference;
|
|
34
32
|
key: string;
|
|
35
33
|
};
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
/** One Realtime Database query constraint, built with `$orderByChild`, `$limitToFirst`, `$equalTo` or a cursor helper. */
|
|
35
|
+
export type RealtimeDBConstraint = PermittedConstraints<RealtimePermittedMethods, RealtimeConstraintsUnion | SharedQueryConstraints>;
|
|
36
|
+
/**
|
|
37
|
+
* Query params of a Realtime Database request: a callback that builds typed constraints, or the constraints array it
|
|
38
|
+
* resolves to. Pass the type of the list's children to check paths and values:
|
|
39
|
+
* `queryParams?: RealtimeDBQueryParams<Message>`.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* getMessages.send({ queryParams: (c) => c.orderByChild("sentAt").limitToLast(50) });
|
|
43
|
+
*/
|
|
44
|
+
export type RealtimeDBQueryParams<Doc = any> = RealtimeDBConstraint[] | ((constraints: RealtimeConstraints<Doc>) => RealtimeConstraints<Doc> | OrderedRealtimeConstraints<Doc, any>) | RealtimeDBDeprecatedQueryParams;
|
|
45
|
+
/** @deprecated Pass the constraints directly: `queryParams: (c) => c.orderByChild(...)` or an array. */
|
|
46
|
+
export type RealtimeDBDeprecatedQueryParams = {
|
|
47
|
+
/** @deprecated Pass the constraints directly: `queryParams: (c) => c.orderByChild(...)` or an array. */
|
|
48
|
+
constraints?: RealtimeDBConstraint[];
|
|
49
|
+
};
|
|
50
|
+
/** Query params of a Realtime Database listener: a callback that builds typed constraints, or the array. */
|
|
51
|
+
export type RealtimeDBListenerQueryParams<Doc = any> = RealtimeDBConstraint[] | ((constraints: RealtimeConstraints<Doc>) => RealtimeConstraints<Doc> | OrderedRealtimeConstraints<Doc, any>);
|
|
52
|
+
/** Options of a Realtime Database `onValue` listener. Constraints go in the listener's `queryParams`. */
|
|
53
|
+
export type RealtimeDBListenerOptions = {
|
|
54
|
+
/** @deprecated Use the listener's query params: `setQueryParams((c) => c.orderByChild(...))`. */
|
|
55
|
+
constraints?: RealtimeDBConstraint[];
|
|
56
|
+
/** Receive only the first value, then stop listening. */
|
|
57
|
+
onlyOnce?: boolean;
|
|
38
58
|
};
|
|
39
59
|
//# sourceMappingURL=adapter.realtime.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.realtime.types.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/adapter.realtime.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEzE,MAAM,MAAM,yBAAyB,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"adapter.realtime.types.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/adapter.realtime.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EACV,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEzE,MAAM,MAAM,yBAAyB,GAAG,aAAa,CAAC,KAAK,EAAE,4BAA4B,EAAE,yBAAyB,CAAC,CAAC;AAEtH,MAAM,MAAM,qBAAqB,GAC7B,OAAO,CACL,+BAA+B,EAC/B,KAAK,EACL,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,CACtB,GACD,OAAO,CACL,+BAA+B,EAC/B,MAAM,EACN,kBAAkB,EAClB,yBAAyB,EACzB,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EACrB,SAAS,CACV,GACD,OAAO,CACL,+BAA+B,EAC/B,KAAK,GAAG,QAAQ,GAAG,QAAQ,EAC3B,kBAAkB,EAClB,sBAAsB,EACtB,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EACrB,SAAS,CACV,CAAC;AAEN,MAAM,MAAM,+BAA+B,GAAG;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,oBAAY,iBAAiB;IAC3B,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,MAAM,WAAW;CAClB;AAED,MAAM,M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AAC,GAAG,CAAC,KAAK,mBAAmB,CAAC,GAAG,CAAC,GAAG,0BAA0B,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAEjH,yGAAyG;AACzG,MAAM,MAAM,yBAAyB,GAAG;IACtC,iGAAiG;IACjG,WAAW,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACrC,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC"}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
+
import { DefaultMapperType } from '@hyper-fetch/core';
|
|
1
2
|
import { SocketAdapter } from '@hyper-fetch/sockets';
|
|
2
|
-
import {
|
|
3
|
+
import { FirestoreListenerOptions, FirestoreListenerQueryParams, FirestoreStatuses } from '..';
|
|
3
4
|
import { DocumentReference, DocumentSnapshot, DocumentData, Query, QuerySnapshot } from 'firebase-admin/firestore';
|
|
4
|
-
export type FirestoreAdminSocketAdapterType = SocketAdapter<FirestoreAdminOnSnapshotExtra, undefined,
|
|
5
|
-
groupByChangeType?: boolean;
|
|
6
|
-
} & FirestoreQueryParams>;
|
|
5
|
+
export type FirestoreAdminSocketAdapterType = SocketAdapter<FirestoreAdminOnSnapshotExtra, undefined, FirestoreListenerOptions, undefined, undefined, DefaultMapperType, FirestoreListenerQueryParams>;
|
|
7
6
|
export type FirestoreAdminOnSnapshotExtra = {
|
|
8
7
|
ref?: DocumentReference | Query;
|
|
9
8
|
snapshot?: DocumentSnapshot | QuerySnapshot;
|
|
10
9
|
unsubscribe?: () => void;
|
|
10
|
+
/** Grouped document changes when the listener has `groupByChangeType`, otherwise `null`. Collection listeners only. */
|
|
11
11
|
groupedResult: {
|
|
12
12
|
added: DocumentData[];
|
|
13
13
|
modified: DocumentData[];
|
|
14
14
|
removed: DocumentData[];
|
|
15
15
|
} | null;
|
|
16
|
+
/** `"emptyResource"` when the document is missing or the result list is empty. */
|
|
17
|
+
status: FirestoreStatuses;
|
|
16
18
|
};
|
|
17
19
|
//# sourceMappingURL=firestore.socket.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firestore.socket.types.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/firestore.socket.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"firestore.socket.types.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/firestore.socket.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACzG,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAExH,MAAM,MAAM,+BAA+B,GAAG,aAAa,CACzD,6BAA6B,EAC7B,SAAS,EACT,wBAAwB,EACxB,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,4BAA4B,CAC7B,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,GAAG,CAAC,EAAE,iBAAiB,GAAG,KAAK,CAAC;IAChC,QAAQ,CAAC,EAAE,gBAAgB,GAAG,aAAa,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,uHAAuH;IACvH,aAAa,EAAE;QAAE,KAAK,EAAE,YAAY,EAAE,CAAC;QAAC,QAAQ,EAAE,YAAY,EAAE,CAAC;QAAC,OAAO,EAAE,YAAY,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;IACnG,kFAAkF;IAClF,MAAM,EAAE,iBAAiB,CAAC;CAC3B,CAAC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { SocketAdapter } from '@hyper-fetch/sockets';
|
|
2
|
-
import {
|
|
2
|
+
import { RealtimeDBListenerOptions, RealtimeDBListenerQueryParams, RealtimeDBStatuses } from '../index';
|
|
3
3
|
import { Reference, DataSnapshot } from 'firebase-admin/database';
|
|
4
|
-
export type RealtimeAdminSocketAdapterType = SocketAdapter<any, RealtimeAdminOnValueMethodExtra,
|
|
5
|
-
onlyOnce?: boolean;
|
|
6
|
-
} & RealtimeDBQueryParams, any>;
|
|
4
|
+
export type RealtimeAdminSocketAdapterType = SocketAdapter<any, RealtimeAdminOnValueMethodExtra, RealtimeDBListenerOptions, any, any, any, RealtimeDBListenerQueryParams>;
|
|
7
5
|
export type RealtimeAdminOnValueMethodExtra = {
|
|
8
6
|
ref: Reference;
|
|
9
7
|
snapshot: DataSnapshot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime.socket.types.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/realtime.socket.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"realtime.socket.types.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/realtime.socket.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAClH,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvE,MAAM,MAAM,8BAA8B,GAAG,aAAa,CACxD,GAAG,EACH,+BAA+B,EAC/B,yBAAyB,EACzB,GAAG,EACH,GAAG,EACH,GAAG,EACH,6BAA6B,CAC9B,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,GAAG,EAAE,SAAS,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,kBAAkB,CAAC;CAC5B,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { OrderByDirection, WhereFilterOp } from 'firebase-admin/firestore';
|
|
2
|
+
import { FirestorePermittedMethods, RealtimePermittedMethods } from './constraints.types';
|
|
3
|
+
type Primitive = string | number | boolean | bigint | symbol | null | undefined | Date;
|
|
4
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
5
|
+
type PreviousDepth = [never, 0, 1, 2, 3, 4];
|
|
6
|
+
/**
|
|
7
|
+
* Paths to the fields of a document, nested objects included (up to 4 levels), joined with `Separator`: `.` for
|
|
8
|
+
* Firestore field paths, `/` for Realtime Database child paths. The `__key` id added by the adapter is not a field.
|
|
9
|
+
*/
|
|
10
|
+
export type FieldPath<Doc, Separator extends string = ".", Depth extends number = 4> = IsAny<Doc> extends true ? string : [Depth] extends [never] ? never : Doc extends Primitive | readonly any[] ? never : {
|
|
11
|
+
[Key in Exclude<keyof Doc, "__key"> & string]: NonNullable<Doc[Key]> extends Primitive | readonly any[] ? Key : Key | `${Key}${Separator}${FieldPath<NonNullable<Doc[Key]>, Separator, PreviousDepth[Depth]>}`;
|
|
12
|
+
}[Exclude<keyof Doc, "__key"> & string];
|
|
13
|
+
/** Value type of the field at `Path`. */
|
|
14
|
+
export type FieldValue<Doc, Path extends string, Separator extends string = "."> = IsAny<Doc> extends true ? any : Path extends `${infer Key}${Separator}${infer Rest}` ? Key extends keyof Doc ? FieldValue<NonNullable<Doc[Key]>, Rest, Separator> : never : Path extends keyof Doc ? Doc[Path] : never;
|
|
15
|
+
/** Value a Firestore `where` takes for an operator: arrays for `in` / `not-in`, an element for `array-contains`. */
|
|
16
|
+
export type WhereValue<Value, Operator extends WhereFilterOp> = Operator extends "in" | "not-in" ? Value[] : Operator extends "array-contains" ? NonNullable<Value> extends readonly (infer Element)[] ? Element : never : Operator extends "array-contains-any" ? NonNullable<Value> extends readonly (infer Element)[] ? Element[] : never : Value;
|
|
17
|
+
type CursorPrefixes<Values extends unknown[]> = Values extends [...infer Init, any] ? Values | (Init extends [] ? never : CursorPrefixes<Init>) : never;
|
|
18
|
+
/** Cursor values: one per `orderBy`, in order (a prefix is allowed), or a document id without `orderBy`. */
|
|
19
|
+
export type FirestoreCursorValues<Ordered extends unknown[]> = Ordered extends [] ? [documentId: string] : CursorPrefixes<Ordered>;
|
|
20
|
+
/**
|
|
21
|
+
* Typed Firestore constraints for a document type, built as a chain. Received by the `queryParams` callback of
|
|
22
|
+
* Firestore requests and listeners; the adapter stores the constraints it collected.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* getTeas.send({ queryParams: (c) => c.where("type", "==", "Green").orderBy("year", "desc").limit(20) });
|
|
26
|
+
*/
|
|
27
|
+
export interface FirestoreConstraints<Doc = any, Ordered extends unknown[] = []> {
|
|
28
|
+
/** Filter by a field, like Firestore's `where()`. The value type follows the field and the operator. */
|
|
29
|
+
where<Path extends FieldPath<Doc>, Operator extends WhereFilterOp>(field: Path, operator: Operator, value: WhereValue<FieldValue<Doc, Path>, Operator>): FirestoreConstraints<Doc, Ordered>;
|
|
30
|
+
/** Order by a field, like Firestore's `orderBy()`. Each `orderBy` adds one value the cursors take. */
|
|
31
|
+
orderBy<Path extends FieldPath<Doc>>(field: Path, direction?: OrderByDirection): FirestoreConstraints<Doc, [...Ordered, FieldValue<Doc, Path>]>;
|
|
32
|
+
/** Limit the number of documents, like Firestore's `limit()`. */
|
|
33
|
+
limit(limit: number): FirestoreConstraints<Doc, Ordered>;
|
|
34
|
+
/** Start at these values, inclusive: one per `orderBy`, in order. */
|
|
35
|
+
startAt(...values: FirestoreCursorValues<Ordered>): FirestoreConstraints<Doc, Ordered>;
|
|
36
|
+
/** Start after these values, exclusive. Pass the values of the last document to load the next page. */
|
|
37
|
+
startAfter(...values: FirestoreCursorValues<Ordered>): FirestoreConstraints<Doc, Ordered>;
|
|
38
|
+
/** End at these values, inclusive: one per `orderBy`, in order. */
|
|
39
|
+
endAt(...values: FirestoreCursorValues<Ordered>): FirestoreConstraints<Doc, Ordered>;
|
|
40
|
+
/** End before these values, exclusive: one per `orderBy`, in order. */
|
|
41
|
+
endBefore(...values: FirestoreCursorValues<Ordered>): FirestoreConstraints<Doc, Ordered>;
|
|
42
|
+
/** The collected constraints, the data a request or listener stores. */
|
|
43
|
+
toJSON(): FirestorePermittedMethods[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Typed Realtime Database constraints for the type of a list's children, built as a chain. A query can have one
|
|
47
|
+
* `orderBy*`; cursors and `equalTo` become available after it and take the ordered value.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* getMessages.send({ queryParams: (c) => c.orderByChild("sentAt").limitToLast(50) });
|
|
51
|
+
*/
|
|
52
|
+
export interface RealtimeConstraints<Doc = any> {
|
|
53
|
+
/** Order by a child value, like `orderByChild()`. Nested children use `/`: `"author/name"`. */
|
|
54
|
+
orderByChild<Path extends FieldPath<Doc, "/">>(path: Path): OrderedRealtimeConstraints<Doc, FieldValue<Doc, Path, "/">>;
|
|
55
|
+
/** Order by key, like `orderByKey()`. */
|
|
56
|
+
orderByKey(): OrderedRealtimeConstraints<Doc, string>;
|
|
57
|
+
/** Order by the children's own values, like `orderByValue()`. */
|
|
58
|
+
orderByValue(): OrderedRealtimeConstraints<Doc, Doc>;
|
|
59
|
+
/** Limit to the first children, like `limitToFirst()`. */
|
|
60
|
+
limitToFirst(limit: number): RealtimeConstraints<Doc>;
|
|
61
|
+
/** Limit to the last children, like `limitToLast()`. */
|
|
62
|
+
limitToLast(limit: number): RealtimeConstraints<Doc>;
|
|
63
|
+
/** The collected constraints, the data a request or listener stores. */
|
|
64
|
+
toJSON(): RealtimePermittedMethods[];
|
|
65
|
+
}
|
|
66
|
+
/** Realtime Database constraints after an `orderBy*`. Cursors and `equalTo` take the ordered value and a tie key. */
|
|
67
|
+
export interface OrderedRealtimeConstraints<Doc = any, Value = any> {
|
|
68
|
+
/** Limit to the first children, like `limitToFirst()`. */
|
|
69
|
+
limitToFirst(limit: number): OrderedRealtimeConstraints<Doc, Value>;
|
|
70
|
+
/** Limit to the last children, like `limitToLast()`. */
|
|
71
|
+
limitToLast(limit: number): OrderedRealtimeConstraints<Doc, Value>;
|
|
72
|
+
/** Keep children whose ordered value equals `value`, like `equalTo()`. */
|
|
73
|
+
equalTo(value: Value, key?: string): OrderedRealtimeConstraints<Doc, Value>;
|
|
74
|
+
/** Start at `value`, inclusive. `key` breaks ties between equal values. */
|
|
75
|
+
startAt(value: Value, key?: string): OrderedRealtimeConstraints<Doc, Value>;
|
|
76
|
+
/** Start after `value`, exclusive. `key` breaks ties between equal values. */
|
|
77
|
+
startAfter(value: Value, key?: string): OrderedRealtimeConstraints<Doc, Value>;
|
|
78
|
+
/** End at `value`, inclusive. `key` breaks ties between equal values. */
|
|
79
|
+
endAt(value: Value, key?: string): OrderedRealtimeConstraints<Doc, Value>;
|
|
80
|
+
/** End before `value`, exclusive. `key` breaks ties between equal values. */
|
|
81
|
+
endBefore(value: Value, key?: string): OrderedRealtimeConstraints<Doc, Value>;
|
|
82
|
+
/** The collected constraints, the data a request or listener stores. */
|
|
83
|
+
toJSON(): RealtimePermittedMethods[];
|
|
84
|
+
}
|
|
85
|
+
/** Start an empty Firestore constraints chain. The adapter passes one to every `queryParams` callback. */
|
|
86
|
+
export declare const createFirestoreConstraints: <Doc = any>() => FirestoreConstraints<Doc>;
|
|
87
|
+
/** Start an empty Realtime Database constraints chain. The adapter passes one to every `queryParams` callback. */
|
|
88
|
+
export declare const createRealtimeConstraints: <Doc = any>() => RealtimeConstraints<Doc>;
|
|
89
|
+
/** Resolve a `queryParams` callback with a fresh chain into the constraints it collected. */
|
|
90
|
+
export declare const resolveConstraints: (createChain: () => {
|
|
91
|
+
toJSON(): unknown[];
|
|
92
|
+
}) => (callback: (...args: any[]) => unknown) => unknown[];
|
|
93
|
+
/**
|
|
94
|
+
* The constraints of `queryParams` or listener options: an array, or the deprecated `{ constraints }` object.
|
|
95
|
+
*/
|
|
96
|
+
export declare const getConstraints: <Constraint>(queryParams: unknown) => Constraint[];
|
|
97
|
+
export {};
|
|
98
|
+
//# sourceMappingURL=constraints.builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraints.builder.d.ts","sourceRoot":"","sources":["../../src/constraints/constraints.builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEhF,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAiB/F,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;AACvF,KAAK,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;AAC/C,KAAK,aAAa,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAE5C;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,GAAG,EAAE,SAAS,SAAS,MAAM,GAAG,GAAG,EAAE,KAAK,SAAS,MAAM,GAAG,CAAC,IACjF,KAAK,CAAC,GAAG,CAAC,SAAS,IAAI,GACnB,MAAM,GACN,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,GACrB,KAAK,GACL,GAAG,SAAS,SAAS,GAAG,SAAS,GAAG,EAAE,GACpC,KAAK,GACL;KACG,GAAG,IAAI,OAAO,CAAC,MAAM,GAAG,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,GAAG,EAAE,GACnG,GAAG,GACH,GAAG,GAAG,GAAG,G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enum FirestoreQueryConstraints {
|
|
|
18
18
|
ORDER_BY = "orderBy",
|
|
19
19
|
LIMIT = "limit"
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Firestore filter, the HyperFetch form of Firestore's `where()`.
|
|
23
|
+
*
|
|
24
|
+
* @param fieldPath - Field to compare, dot notation reaches nested fields (`"address.city"`)
|
|
25
|
+
* @param opStr - Firestore operator such as `"=="`, `">="`, `"in"` or `"array-contains"`
|
|
26
|
+
* @param value - Value to compare the field with
|
|
27
|
+
* @example
|
|
28
|
+
* getTeas.send({ queryParams: [$where("type", "==", "Green"), $where("year", ">=", 2020)] });
|
|
29
|
+
*/
|
|
21
30
|
export declare const $where: (fieldPath: string, opStr: WhereFilterOp, value: any) => {
|
|
22
31
|
toString: () => string;
|
|
23
32
|
type: FirestoreQueryConstraints.WHERE;
|
|
24
33
|
values: any[];
|
|
25
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Firestore ordering, the HyperFetch form of Firestore's `orderBy()`. Cursors take one value per `$orderBy`, in the same
|
|
37
|
+
* order.
|
|
38
|
+
*
|
|
39
|
+
* @param fieldPath - Field to order by
|
|
40
|
+
* @param directionStr - `"asc"` (default) or `"desc"`
|
|
41
|
+
* @example
|
|
42
|
+
* getTeas.send({ queryParams: [$orderBy("year", "desc"), $orderBy("name")] });
|
|
43
|
+
*/
|
|
26
44
|
export declare const $orderBy: (fieldPath: string, directionStr?: OrderByDirection) => {
|
|
27
45
|
toString: () => string;
|
|
28
46
|
type: FirestoreQueryConstraints.ORDER_BY;
|
|
29
47
|
values: (string | undefined)[];
|
|
30
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Firestore limit, the HyperFetch form of Firestore's `limit()`.
|
|
51
|
+
*
|
|
52
|
+
* @param num - Maximum number of documents to return
|
|
53
|
+
* @example
|
|
54
|
+
* getTeas.send({ queryParams: [$orderBy("year"), $limit(20)] });
|
|
55
|
+
*/
|
|
31
56
|
export declare const $limit: (num: number) => {
|
|
32
57
|
toString: () => string;
|
|
33
58
|
type: FirestoreQueryConstraints.LIMIT;
|
|
34
59
|
values: number[];
|
|
35
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* Cursor that starts the ordered query at the given values, inclusive.
|
|
63
|
+
*
|
|
64
|
+
* In Firestore pass one value per `$orderBy`, in the same order. In Realtime Database pass the value of the
|
|
65
|
+
* `$orderBy*` field and, optionally, a key that breaks ties between equal values.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* // Firestore
|
|
69
|
+
* getTeas.send({ queryParams: [$orderBy("year"), $orderBy("name"), $startAt(2022, "Bi Luo Chun")] });
|
|
70
|
+
* // Realtime Database
|
|
71
|
+
* getTeas.send({ queryParams: [$orderByChild("year"), $startAt(2022)] });
|
|
72
|
+
*/
|
|
36
73
|
export declare const $startAt: (...docOrFields: any[]) => {
|
|
37
74
|
toString: () => string;
|
|
38
75
|
type: SharedQueryConstraints;
|
|
39
76
|
values: any[][];
|
|
40
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* Cursor that starts the ordered query after the given values, exclusive. Use it to load the next page.
|
|
80
|
+
*
|
|
81
|
+
* In Firestore pass one value per `$orderBy`, in the same order. In Realtime Database pass the value of the
|
|
82
|
+
* `$orderBy*` field and, optionally, a key that breaks ties between equal values.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* const last = page.data?.at(-1);
|
|
86
|
+
* getTeas.send({ queryParams: [$orderBy("year"), $startAfter(last?.year), $limit(20)] });
|
|
87
|
+
*/
|
|
41
88
|
export declare const $startAfter: (...docOrFields: any[]) => {
|
|
42
89
|
toString: () => string;
|
|
43
90
|
type: SharedQueryConstraints;
|
|
44
91
|
values: any[][];
|
|
45
92
|
};
|
|
93
|
+
/**
|
|
94
|
+
* Cursor that ends the ordered query at the given values, inclusive.
|
|
95
|
+
*
|
|
96
|
+
* In Firestore pass one value per `$orderBy`, in the same order. In Realtime Database pass the value of the
|
|
97
|
+
* `$orderBy*` field and, optionally, a key that breaks ties between equal values.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* getTeas.send({ queryParams: [$orderBy("year"), $endAt(2011)] });
|
|
101
|
+
*/
|
|
46
102
|
export declare const $endAt: (...docOrFields: any[]) => {
|
|
47
103
|
toString: () => string;
|
|
48
104
|
type: SharedQueryConstraints;
|
|
49
105
|
values: any[][];
|
|
50
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Cursor that ends the ordered query before the given values, exclusive.
|
|
109
|
+
*
|
|
110
|
+
* In Firestore pass one value per `$orderBy`, in the same order. In Realtime Database pass the value of the
|
|
111
|
+
* `$orderBy*` field and, optionally, a key that breaks ties between equal values.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* getTeas.send({ queryParams: [$orderBy("year"), $endBefore(2011)] });
|
|
115
|
+
*/
|
|
51
116
|
export declare const $endBefore: (...docOrFields: any[]) => {
|
|
52
117
|
toString: () => string;
|
|
53
118
|
type: SharedQueryConstraints;
|
|
54
119
|
values: any[][];
|
|
55
120
|
};
|
|
121
|
+
/**
|
|
122
|
+
* Realtime Database ordering by a child value, the HyperFetch form of `orderByChild()`. A query can have one `$orderBy*`.
|
|
123
|
+
*
|
|
124
|
+
* @param path - Child path to order by, for example `"year"` or `"author/name"`
|
|
125
|
+
* @example
|
|
126
|
+
* getTeas.send({ queryParams: [$orderByChild("year"), $limitToFirst(10)] });
|
|
127
|
+
*/
|
|
56
128
|
export declare const $orderByChild: (path: string) => {
|
|
57
129
|
toString: () => string;
|
|
58
130
|
type: RealtimeQueryConstraints.ORDER_BY_CHILD;
|
|
59
131
|
values: string[];
|
|
60
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* Realtime Database ordering by key, the HyperFetch form of `orderByKey()`. A query can have one `$orderBy*`.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* getTeas.send({ queryParams: [$orderByKey(), $limitToLast(10)] });
|
|
138
|
+
*/
|
|
61
139
|
export declare const $orderByKey: () => {
|
|
62
140
|
toString: () => string;
|
|
63
141
|
type: RealtimeQueryConstraints.ORDER_BY_KEY;
|
|
64
142
|
values: never[];
|
|
65
143
|
};
|
|
144
|
+
/**
|
|
145
|
+
* Realtime Database ordering by the child values themselves, the HyperFetch form of `orderByValue()`. A query can have
|
|
146
|
+
* one `$orderBy*`.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* getScores.send({ queryParams: [$orderByValue(), $limitToLast(3)] });
|
|
150
|
+
*/
|
|
66
151
|
export declare const $orderByValue: () => {
|
|
67
152
|
toString: () => string;
|
|
68
153
|
type: RealtimeQueryConstraints.ORDER_BY_VALUE;
|
|
69
154
|
values: never[];
|
|
70
155
|
};
|
|
156
|
+
/**
|
|
157
|
+
* Realtime Database limit from the start of the ordered list, the HyperFetch form of `limitToFirst()`.
|
|
158
|
+
*
|
|
159
|
+
* @param num - Maximum number of children to return
|
|
160
|
+
* @example
|
|
161
|
+
* getTeas.send({ queryParams: [$orderByChild("year"), $limitToFirst(5)] });
|
|
162
|
+
*/
|
|
71
163
|
export declare const $limitToFirst: (num: number) => {
|
|
72
164
|
toString: () => string;
|
|
73
165
|
type: RealtimeQueryConstraints.LIMIT_TO_FIRST;
|
|
74
166
|
values: number[];
|
|
75
167
|
};
|
|
168
|
+
/**
|
|
169
|
+
* Realtime Database limit from the end of the ordered list, the HyperFetch form of `limitToLast()`.
|
|
170
|
+
*
|
|
171
|
+
* @param num - Maximum number of children to return
|
|
172
|
+
* @example
|
|
173
|
+
* getMessages.send({ queryParams: [$orderByChild("sentAt"), $limitToLast(50)] });
|
|
174
|
+
*/
|
|
76
175
|
export declare const $limitToLast: (num: number) => {
|
|
77
176
|
toString: () => string;
|
|
78
177
|
type: RealtimeQueryConstraints.LIMIT_TO_LAST;
|
|
79
178
|
values: number[];
|
|
80
179
|
};
|
|
81
|
-
|
|
180
|
+
/**
|
|
181
|
+
* Realtime Database filter for children equal to a value, the HyperFetch form of `equalTo()`. Combine it with an
|
|
182
|
+
* `$orderBy*` that picks the compared value.
|
|
183
|
+
*
|
|
184
|
+
* @param value - Value the ordered field must equal
|
|
185
|
+
* @param key - Optional key that breaks ties between children with the same value
|
|
186
|
+
* @example
|
|
187
|
+
* getTeas.send({ queryParams: [$orderByChild("type"), $equalTo("Green")] });
|
|
188
|
+
*/
|
|
189
|
+
export declare const $equalTo: (value: any, key?: string) => {
|
|
82
190
|
toString: () => string;
|
|
83
191
|
type: RealtimeQueryConstraints.EQUAL_TO;
|
|
84
192
|
values: any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.constraints.d.ts","sourceRoot":"","sources":["../../src/constraints/firebase.constraints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEhF,oBAAY,sBAAsB;IAChC,QAAQ,YAAY;IACpB,WAAW,eAAe;IAC1B,MAAM,UAAU;IAChB,UAAU,cAAc;CACzB;AACD,oBAAY,wBAAwB;IAClC,cAAc,iBAAiB;IAC/B,YAAY,eAAe;IAC3B,cAAc,iBAAiB;IAC/B,cAAc,iBAAiB;IAC/B,aAAa,gBAAgB;IAC7B,QAAQ,YAAY;CACrB;AAED,oBAAY,yBAAyB;IACnC,KAAK,UAAU;IACf,QAAQ,YAAY;IACpB,KAAK,UAAU;CAChB;AAED,eAAO,MAAM,MAAM,GAAI,WAAW,MAAM,EAAE,OAAO,aAAa,EAAE,OAAO,GAAG;;;;CAMzE,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,WAAW,MAAM,EAAE,eAAe,gBAAgB;;;;CAM1E,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM;;;;CAMjC,CAAC;AAmBF,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"firebase.constraints.d.ts","sourceRoot":"","sources":["../../src/constraints/firebase.constraints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,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AAI,KAAK,MAAM;;;;CAMxC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM;;;;CAMvC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,GAAG,EAAE,MAAM,MAAM;;;;CAMhD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constraints/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constraints/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firestore.sockets.d.ts","sourceRoot":"","sources":["../../src/firestore/firestore.sockets.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,KAAK,EAAqB,SAAS,EAAwB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"firestore.sockets.d.ts","sourceRoot":"","sources":["../../src/firestore/firestore.sockets.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,KAAK,EAAqB,SAAS,EAAwB,MAAM,0BAA0B,CAAC;AAQnG,eAAO,MAAM,qBAAqB,GAAI,UAAU,SAAS,oCA4ExD,CAAC"}
|