@hyper-fetch/firebase-admin 7.5.3 → 8.0.0
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/.eslintrc.cjs +12 -0
- package/__tests__/features/firestore/admin/constraints.admin.spec.ts +1 -1
- package/__tests__/features/firestore/admin/methods.admin.spec.ts +1 -1
- package/__tests__/features/firestore/admin/sockets.base.spec.ts +1 -1
- package/__tests__/features/firestore/shared/constraints.shared.tests.ts +3 -3
- package/__tests__/features/firestore/shared/methods/add-doc.test.suite.ts +3 -3
- package/__tests__/features/firestore/shared/methods/delete-doc.test.suite.ts +2 -2
- package/__tests__/features/firestore/shared/methods/get-doc.test.suite.ts +2 -2
- package/__tests__/features/firestore/shared/methods/get-docs.test.suite.ts +2 -2
- package/__tests__/features/firestore/shared/methods/on-snapshot.test.suite.ts +9 -9
- package/__tests__/features/firestore/shared/methods/set-doc.test.suite.ts +2 -2
- package/__tests__/features/firestore/shared/methods/update-doc.test.suite.ts +2 -2
- package/__tests__/features/firestore/shared/methods.shared.tests.ts +1 -1
- package/__tests__/features/realtime/admin/methods.admin.spec.ts +1 -1
- package/__tests__/features/realtime/admin/sockets.base.spec.ts +1 -1
- package/__tests__/features/realtime/shared/constraints.shared.tests.ts +3 -5
- package/__tests__/features/realtime/shared/methods/get.test.suite.ts +3 -3
- package/__tests__/features/realtime/shared/methods/on-value.test.suite.ts +9 -9
- package/__tests__/features/realtime/shared/methods/push.test.suite.ts +2 -2
- package/__tests__/features/realtime/shared/methods/remove.test.suite.ts +2 -2
- package/__tests__/features/realtime/shared/methods/set.test.suite.ts +9 -7
- package/__tests__/features/realtime/shared/methods/update.test.suite.ts +2 -2
- package/__tests__/features/realtime/shared/methods.shared.tests.ts +1 -1
- package/__tests__/shared/request-events.shared.ts +10 -10
- package/__tests__/tsconfig.json +15 -2
- package/__tests__/utils/seed.admin.ts +2 -2
- package/__tests__/vitest.setup.ts +9 -0
- package/dist/adapter/adapter.d.ts +3 -0
- package/dist/adapter/adapter.d.ts.map +1 -0
- package/dist/adapter/adapter.sockets.d.ts +3 -0
- package/dist/adapter/adapter.sockets.d.ts.map +1 -0
- package/dist/adapter/index.d.ts +4 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter/types/adapter.base.types.d.ts +11 -0
- package/dist/adapter/types/adapter.base.types.d.ts.map +1 -0
- package/dist/adapter/types/adapter.firestore.types.d.ts +45 -0
- package/dist/adapter/types/adapter.firestore.types.d.ts.map +1 -0
- package/dist/adapter/types/adapter.realtime.types.d.ts +39 -0
- package/dist/adapter/types/adapter.realtime.types.d.ts.map +1 -0
- package/dist/adapter/types/firestore.socket.types.d.ts +17 -0
- package/dist/adapter/types/firestore.socket.types.d.ts.map +1 -0
- package/dist/adapter/types/index.d.ts +6 -0
- package/dist/adapter/types/index.d.ts.map +1 -0
- package/dist/adapter/types/realtime.socket.types.d.ts +12 -0
- package/dist/adapter/types/realtime.socket.types.d.ts.map +1 -0
- package/dist/constraints/constraints.types.d.ts +13 -0
- package/dist/constraints/constraints.types.d.ts.map +1 -0
- package/dist/constraints/firebase.constraints.d.ts +86 -0
- package/dist/constraints/firebase.constraints.d.ts.map +1 -0
- package/dist/constraints/index.d.ts +3 -0
- package/dist/constraints/index.d.ts.map +1 -0
- package/dist/firestore/firestore.methods.d.ts +21 -0
- package/dist/firestore/firestore.methods.d.ts.map +1 -0
- package/dist/firestore/firestore.sockets.d.ts +4 -0
- package/dist/firestore/firestore.sockets.d.ts.map +1 -0
- package/dist/firestore/index.d.ts +4 -0
- package/dist/firestore/index.d.ts.map +1 -0
- package/dist/firestore/utils/constraints.utils.d.ts +5 -0
- package/dist/firestore/utils/constraints.utils.d.ts.map +1 -0
- package/dist/firestore/utils/index.d.ts +4 -0
- package/dist/firestore/utils/index.d.ts.map +1 -0
- package/dist/firestore/utils/ref.utils.d.ts +3 -0
- package/dist/firestore/utils/ref.utils.d.ts.map +1 -0
- package/dist/firestore/utils/result.utils.d.ts +10 -0
- package/dist/firestore/utils/result.utils.d.ts.map +1 -0
- package/dist/index.d.ts +5 -271
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +670 -0
- package/dist/index.mjs.map +1 -0
- package/dist/realtime/index.d.ts +4 -0
- package/dist/realtime/index.d.ts.map +1 -0
- package/dist/realtime/realtime.methods.d.ts +19 -0
- package/dist/realtime/realtime.methods.d.ts.map +1 -0
- package/dist/realtime/realtime.sockets.d.ts +4 -0
- package/dist/realtime/realtime.sockets.d.ts.map +1 -0
- package/dist/realtime/utils/constraints.utils.d.ts +5 -0
- package/dist/realtime/utils/constraints.utils.d.ts.map +1 -0
- package/dist/realtime/utils/index.d.ts +3 -0
- package/dist/realtime/utils/index.d.ts.map +1 -0
- package/dist/realtime/utils/result.utils.d.ts +3 -0
- package/dist/realtime/utils/result.utils.d.ts.map +1 -0
- package/dist/utils/cache.utils.d.ts +11 -0
- package/dist/utils/cache.utils.d.ts.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/misc.d.ts +3 -0
- package/dist/utils/misc.d.ts.map +1 -0
- package/package.json +8 -11
- package/src/adapter/adapter.sockets.ts +1 -1
- package/src/adapter/adapter.ts +13 -14
- package/src/adapter/types/adapter.base.types.ts +4 -4
- package/src/adapter/types/adapter.firestore.types.ts +4 -4
- package/src/adapter/types/adapter.realtime.types.ts +4 -4
- package/src/adapter/types/firestore.socket.types.ts +3 -3
- package/src/adapter/types/realtime.socket.types.ts +3 -3
- package/src/constraints/constraints.types.ts +1 -1
- package/src/constraints/firebase.constraints.ts +1 -1
- package/src/firestore/firestore.methods.ts +4 -4
- package/src/firestore/firestore.sockets.ts +3 -9
- package/src/firestore/utils/constraints.utils.ts +4 -3
- package/src/firestore/utils/ref.utils.ts +1 -1
- package/src/firestore/utils/result.utils.ts +1 -1
- package/src/realtime/realtime.methods.ts +4 -4
- package/src/realtime/realtime.sockets.ts +2 -2
- package/src/realtime/utils/constraints.utils.ts +3 -2
- package/src/realtime/utils/result.utils.ts +1 -1
- package/src/utils/cache.utils.ts +4 -2
- package/tsconfig.json +1 -1
- package/vite.config.ts +45 -0
- package/.eslintrc.json +0 -11
- package/__tests__/global.d.ts +0 -1
- package/__tests__/jest.setup.ts +0 -8
- package/dist/index.js +0 -686
- package/dist/index.js.map +0 -7
- package/jest.config.ts +0 -9
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Adapter } from '@hyper-fetch/core';
|
|
2
|
+
import { DatabaseReference, DataSnapshot } from 'firebase/database';
|
|
3
|
+
import { SocketAdapter } from '@hyper-fetch/sockets';
|
|
4
|
+
import { PermittedConstraints, RealtimeConstraintsUnion, RealtimePermittedMethods, SharedQueryConstraints } from '../../constraints';
|
|
5
|
+
export type RealtimeSocketAdapterType = SocketAdapter<never, RealtimeDbOnValueMethodExtra, {
|
|
6
|
+
onlyOnce?: boolean;
|
|
7
|
+
} & RealtimeDBQueryParams>;
|
|
8
|
+
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
|
+
export type DefaultRealtimeDBAdapterOptions = {
|
|
10
|
+
priority?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare enum RealtimeDBMethods {
|
|
13
|
+
set = "set",
|
|
14
|
+
push = "push",
|
|
15
|
+
update = "update",
|
|
16
|
+
get = "get",
|
|
17
|
+
remove = "remove"
|
|
18
|
+
}
|
|
19
|
+
export type RealtimeDBMethodsUnion = RealtimeDBMethods.set | RealtimeDBMethods.push | RealtimeDBMethods.update | RealtimeDBMethods.get | RealtimeDBMethods.remove;
|
|
20
|
+
export type RealtimeDBStatuses = "success" | "error" | "emptyResource";
|
|
21
|
+
export type RealtimeDbOnValueMethodExtra = {
|
|
22
|
+
ref: DatabaseReference;
|
|
23
|
+
snapshot: DataSnapshot;
|
|
24
|
+
};
|
|
25
|
+
export type RealtimeDbGetMethodExtra = {
|
|
26
|
+
ref: DatabaseReference;
|
|
27
|
+
snapshot: DataSnapshot;
|
|
28
|
+
};
|
|
29
|
+
export type RealtimeDbDefaultExtra = {
|
|
30
|
+
ref: DatabaseReference;
|
|
31
|
+
};
|
|
32
|
+
export type RealtimeDbPushMethodExtra = {
|
|
33
|
+
ref: DatabaseReference;
|
|
34
|
+
key: string;
|
|
35
|
+
};
|
|
36
|
+
export type RealtimeDBQueryParams = {
|
|
37
|
+
constraints?: PermittedConstraints<RealtimePermittedMethods, RealtimeConstraintsUnion | SharedQueryConstraints>[];
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=adapter.realtime.types.d.ts.map
|
|
@@ -0,0 +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,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,yBAAyB,GAAG,aAAa,CACnD,KAAK,EACL,4BAA4B,EAC5B;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,qBAAqB,CAC/C,CAAC;AAEF,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,MAAM,sBAAsB,GAC9B,iBAAiB,CAAC,GAAG,GACrB,iBAAiB,CAAC,IAAI,GACtB,iBAAiB,CAAC,MAAM,GACxB,iBAAiB,CAAC,GAAG,GACrB,iBAAiB,CAAC,MAAM,CAAC;AAE7B,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,OAAO,GAAG,eAAe,CAAC;AACvE,MAAM,MAAM,4BAA4B,GAAG;IACzC,GAAG,EAAE,iBAAiB,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,GAAG,EAAE,iBAAiB,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,GAAG,EAAE,iBAAiB,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,EAAE,iBAAiB,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,CAAC,EAAE,oBAAoB,CAAC,wBAAwB,EAAE,wBAAwB,GAAG,sBAAsB,CAAC,EAAE,CAAC;CACnH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DocumentReference, DocumentSnapshot, DocumentData, Query, QuerySnapshot } from 'firebase-admin/firestore';
|
|
2
|
+
import { SocketAdapter } from '@hyper-fetch/sockets';
|
|
3
|
+
import { FirestoreQueryParams } from '..';
|
|
4
|
+
export type FirestoreAdminSocketAdapterType = SocketAdapter<FirestoreAdminOnSnapshotExtra, undefined, {
|
|
5
|
+
groupByChangeType?: boolean;
|
|
6
|
+
} & FirestoreQueryParams>;
|
|
7
|
+
export type FirestoreAdminOnSnapshotExtra = {
|
|
8
|
+
ref?: DocumentReference | Query;
|
|
9
|
+
snapshot?: DocumentSnapshot | QuerySnapshot;
|
|
10
|
+
unsubscribe?: () => void;
|
|
11
|
+
groupedResult: {
|
|
12
|
+
added: DocumentData[];
|
|
13
|
+
modified: DocumentData[];
|
|
14
|
+
removed: DocumentData[];
|
|
15
|
+
} | null;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=firestore.socket.types.d.ts.map
|
|
@@ -0,0 +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,iBAAiB,EAAE,gBAAgB,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACxH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,MAAM,MAAM,+BAA+B,GAAG,aAAa,CACzD,6BAA6B,EAC7B,SAAS,EACT;IAAE,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,oBAAoB,CACvD,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,aAAa,EAAE;QAAE,KAAK,EAAE,YAAY,EAAE,CAAC;QAAC,QAAQ,EAAE,YAAY,EAAE,CAAC;QAAC,OAAO,EAAE,YAAY,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;CACpG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SocketAdapter } from '@hyper-fetch/sockets';
|
|
2
|
+
import { Reference, DataSnapshot } from 'firebase-admin/database';
|
|
3
|
+
import { RealtimeDBQueryParams, RealtimeDBStatuses } from '../index';
|
|
4
|
+
export type RealtimeAdminSocketAdapterType = SocketAdapter<any, RealtimeAdminOnValueMethodExtra, {
|
|
5
|
+
onlyOnce?: boolean;
|
|
6
|
+
} & RealtimeDBQueryParams, any>;
|
|
7
|
+
export type RealtimeAdminOnValueMethodExtra = {
|
|
8
|
+
ref: Reference;
|
|
9
|
+
snapshot: DataSnapshot;
|
|
10
|
+
status: RealtimeDBStatuses;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=realtime.socket.types.d.ts.map
|
|
@@ -0,0 +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,SAAS,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE/E,MAAM,MAAM,8BAA8B,GAAG,aAAa,CACxD,GAAG,EACH,+BAA+B,EAC/B;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,qBAAqB,EAC9C,GAAG,CACJ,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,13 @@
|
|
|
1
|
+
import { $endAt, $endBefore, $equalTo, $limit, $limitToFirst, $limitToLast, $orderBy, $orderByChild, $orderByKey, $orderByValue, $startAfter, $startAt, $where, FirestoreQueryConstraints, RealtimeQueryConstraints } from './firebase.constraints';
|
|
2
|
+
export type RealtimeConstraintsUnion = `${RealtimeQueryConstraints}`;
|
|
3
|
+
export type FirestoreConstraintsUnion = `${FirestoreQueryConstraints}`;
|
|
4
|
+
export type RealtimePermittedMethods = ReturnType<typeof $startAt> | ReturnType<typeof $startAfter> | ReturnType<typeof $endAt> | ReturnType<typeof $endBefore> | ReturnType<typeof $orderByChild> | ReturnType<typeof $orderByValue> | ReturnType<typeof $orderByKey> | ReturnType<typeof $limitToFirst> | ReturnType<typeof $limitToLast> | ReturnType<typeof $equalTo>;
|
|
5
|
+
export type FirestorePermittedMethods = ReturnType<typeof $where> | ReturnType<typeof $orderBy> | ReturnType<typeof $limit> | ReturnType<typeof $startAt> | ReturnType<typeof $startAfter> | ReturnType<typeof $endAt> | ReturnType<typeof $endBefore>;
|
|
6
|
+
type ExtractConstraintType<T> = T extends {
|
|
7
|
+
toString: () => string;
|
|
8
|
+
type: infer ThisType;
|
|
9
|
+
values: any;
|
|
10
|
+
} ? ThisType : never;
|
|
11
|
+
export type PermittedConstraints<T, U> = ExtractConstraintType<T> extends U ? T : never;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=constraints.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraints.types.d.ts","sourceRoot":"","sources":["../../src/constraints/constraints.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,QAAQ,EACR,MAAM,EACN,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,QAAQ,EACR,MAAM,EACN,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,wBAAwB,GAAG,GAAG,wBAAwB,EAAE,CAAC;AACrE,MAAM,MAAM,yBAAyB,GAAG,GAAG,yBAAyB,EAAE,CAAC;AAEvE,MAAM,MAAM,wBAAwB,GAChC,UAAU,CAAC,OAAO,QAAQ,CAAC,GAC3B,UAAU,CAAC,OAAO,WAAW,CAAC,GAC9B,UAAU,CAAC,OAAO,MAAM,CAAC,GACzB,UAAU,CAAC,OAAO,UAAU,CAAC,GAC7B,UAAU,CAAC,OAAO,aAAa,CAAC,GAChC,UAAU,CAAC,OAAO,aAAa,CAAC,GAChC,UAAU,CAAC,OAAO,WAAW,CAAC,GAC9B,UAAU,CAAC,OAAO,aAAa,CAAC,GAChC,UAAU,CAAC,OAAO,YAAY,CAAC,GAC/B,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhC,MAAM,MAAM,yBAAyB,GACjC,UAAU,CAAC,OAAO,MAAM,CAAC,GACzB,UAAU,CAAC,OAAO,QAAQ,CAAC,GAC3B,UAAU,CAAC,OAAO,MAAM,CAAC,GACzB,UAAU,CAAC,OAAO,QAAQ,CAAC,GAC3B,UAAU,CAAC,OAAO,WAAW,CAAC,GAC9B,UAAU,CAAC,OAAO,MAAM,CAAC,GACzB,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAElC,KAAK,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,QAAQ,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,GACnG,QAAQ,GACR,KAAK,CAAC;AAEV,MAAM,MAAM,oBAAoB,CAAC,CAAC,EAAE,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { OrderByDirection, WhereFilterOp } from 'firebase-admin/firestore';
|
|
2
|
+
export declare enum SharedQueryConstraints {
|
|
3
|
+
START_AT = "startAt",
|
|
4
|
+
START_AFTER = "startAfter",
|
|
5
|
+
END_AT = "endAt",
|
|
6
|
+
END_BEFORE = "endBefore"
|
|
7
|
+
}
|
|
8
|
+
export declare enum RealtimeQueryConstraints {
|
|
9
|
+
ORDER_BY_CHILD = "orderByChild",
|
|
10
|
+
ORDER_BY_KEY = "orderByKey",
|
|
11
|
+
ORDER_BY_VALUE = "orderByValue",
|
|
12
|
+
LIMIT_TO_FIRST = "limitToFirst",
|
|
13
|
+
LIMIT_TO_LAST = "limitToLast",
|
|
14
|
+
EQUAL_TO = "equalTo"
|
|
15
|
+
}
|
|
16
|
+
export declare enum FirestoreQueryConstraints {
|
|
17
|
+
WHERE = "where",
|
|
18
|
+
ORDER_BY = "orderBy",
|
|
19
|
+
LIMIT = "limit"
|
|
20
|
+
}
|
|
21
|
+
export declare const $where: (fieldPath: string, opStr: WhereFilterOp, value: any) => {
|
|
22
|
+
toString: () => string;
|
|
23
|
+
type: FirestoreQueryConstraints.WHERE;
|
|
24
|
+
values: any[];
|
|
25
|
+
};
|
|
26
|
+
export declare const $orderBy: (fieldPath: string, directionStr?: OrderByDirection) => {
|
|
27
|
+
toString: () => string;
|
|
28
|
+
type: FirestoreQueryConstraints.ORDER_BY;
|
|
29
|
+
values: (string | undefined)[];
|
|
30
|
+
};
|
|
31
|
+
export declare const $limit: (num: number) => {
|
|
32
|
+
toString: () => string;
|
|
33
|
+
type: FirestoreQueryConstraints.LIMIT;
|
|
34
|
+
values: number[];
|
|
35
|
+
};
|
|
36
|
+
export declare const $startAt: (...docOrFields: any[]) => {
|
|
37
|
+
toString: () => string;
|
|
38
|
+
type: SharedQueryConstraints;
|
|
39
|
+
values: any[][];
|
|
40
|
+
};
|
|
41
|
+
export declare const $startAfter: (...docOrFields: any[]) => {
|
|
42
|
+
toString: () => string;
|
|
43
|
+
type: SharedQueryConstraints;
|
|
44
|
+
values: any[][];
|
|
45
|
+
};
|
|
46
|
+
export declare const $endAt: (...docOrFields: any[]) => {
|
|
47
|
+
toString: () => string;
|
|
48
|
+
type: SharedQueryConstraints;
|
|
49
|
+
values: any[][];
|
|
50
|
+
};
|
|
51
|
+
export declare const $endBefore: (...docOrFields: any[]) => {
|
|
52
|
+
toString: () => string;
|
|
53
|
+
type: SharedQueryConstraints;
|
|
54
|
+
values: any[][];
|
|
55
|
+
};
|
|
56
|
+
export declare const $orderByChild: (path: string) => {
|
|
57
|
+
toString: () => string;
|
|
58
|
+
type: RealtimeQueryConstraints.ORDER_BY_CHILD;
|
|
59
|
+
values: string[];
|
|
60
|
+
};
|
|
61
|
+
export declare const $orderByKey: () => {
|
|
62
|
+
toString: () => string;
|
|
63
|
+
type: RealtimeQueryConstraints.ORDER_BY_KEY;
|
|
64
|
+
values: never[];
|
|
65
|
+
};
|
|
66
|
+
export declare const $orderByValue: () => {
|
|
67
|
+
toString: () => string;
|
|
68
|
+
type: RealtimeQueryConstraints.ORDER_BY_VALUE;
|
|
69
|
+
values: never[];
|
|
70
|
+
};
|
|
71
|
+
export declare const $limitToFirst: (num: number) => {
|
|
72
|
+
toString: () => string;
|
|
73
|
+
type: RealtimeQueryConstraints.LIMIT_TO_FIRST;
|
|
74
|
+
values: number[];
|
|
75
|
+
};
|
|
76
|
+
export declare const $limitToLast: (num: number) => {
|
|
77
|
+
toString: () => string;
|
|
78
|
+
type: RealtimeQueryConstraints.LIMIT_TO_LAST;
|
|
79
|
+
values: number[];
|
|
80
|
+
};
|
|
81
|
+
export declare const $equalTo: (value: any) => {
|
|
82
|
+
toString: () => string;
|
|
83
|
+
type: RealtimeQueryConstraints.EQUAL_TO;
|
|
84
|
+
values: any[];
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=firebase.constraints.d.ts.map
|
|
@@ -0,0 +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,mBAhBK,GAAG,EAAE;;;;CAgB0D,CAAC;AAC1F,eAAO,MAAM,WAAW,mBAjBE,GAAG,EAAE;;;;CAiBgE,CAAC;AAEhG,eAAO,MAAM,MAAM,mBAnBO,GAAG,EAAE;;;;CAmBsD,CAAC;AACtF,eAAO,MAAM,UAAU,mBApBG,GAAG,EAAE;;;;CAoB8D,CAAC;AAE9F,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM;;;;CAMzC,CAAC;AAEF,eAAO,MAAM,WAAW;;;;CAMvB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;CAMzB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM;;;;CAMxC,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM;;;;CAMvC,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,OAAO,GAAG;;;;CAMlC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constraints/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Firestore } from 'firebase-admin/firestore';
|
|
2
|
+
import { getAdapterBindings } from '@hyper-fetch/core';
|
|
3
|
+
import { FirestoreMethodsUnion } from '../adapter';
|
|
4
|
+
import { FirestoreConstraintsUnion, FirestorePermittedMethods, PermittedConstraints, SharedQueryConstraints } from '../constraints';
|
|
5
|
+
type DataType = {
|
|
6
|
+
constraints?: PermittedConstraints<FirestorePermittedMethods, FirestoreConstraintsUnion | SharedQueryConstraints>[];
|
|
7
|
+
payload?: any;
|
|
8
|
+
options?: Record<string, any>;
|
|
9
|
+
};
|
|
10
|
+
export declare const getFirestoreAdminMethods: ({ database, url, onSuccess, onError, onResponseStart, onRequestStart, onRequestEnd, onResponseEnd, }: {
|
|
11
|
+
database: Firestore;
|
|
12
|
+
url: string;
|
|
13
|
+
onSuccess: Awaited<ReturnType<typeof getAdapterBindings>>["onSuccess"];
|
|
14
|
+
onError: Awaited<ReturnType<typeof getAdapterBindings>>["onError"];
|
|
15
|
+
onResponseStart: Awaited<ReturnType<typeof getAdapterBindings>>["onResponseStart"];
|
|
16
|
+
onRequestStart: Awaited<ReturnType<typeof getAdapterBindings>>["onRequestStart"];
|
|
17
|
+
onRequestEnd: Awaited<ReturnType<typeof getAdapterBindings>>["onRequestEnd"];
|
|
18
|
+
onResponseEnd: Awaited<ReturnType<typeof getAdapterBindings>>["onResponseEnd"];
|
|
19
|
+
}) => ((methodName: FirestoreMethodsUnion, data: DataType) => Promise<void>);
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=firestore.methods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firestore.methods.d.ts","sourceRoot":"","sources":["../../src/firestore/firestore.methods.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA4D,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACpH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAGrD,OAAO,KAAK,EACV,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAErB,KAAK,QAAQ,GAAG;IACd,WAAW,CAAC,EAAE,oBAAoB,CAAC,yBAAyB,EAAE,yBAAyB,GAAG,sBAAsB,CAAC,EAAE,CAAC;IACpH,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,sGAStC;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACvE,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACnE,eAAe,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACnF,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACjF,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IAC7E,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;CAChF,KAAG,CAAC,CAAC,UAAU,EAAE,qBAAqB,EAAE,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAgExE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firestore.sockets.d.ts","sourceRoot":"","sources":["../../src/firestore/firestore.sockets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,SAAS,EAAwB,MAAM,0BAA0B,CAAC;AAKnG,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAG/D,eAAO,MAAM,qBAAqB,GAAI,UAAU,SAAS,oCAqExD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/firestore/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Query } from 'firebase-admin/firestore';
|
|
2
|
+
import { FirestorePermittedMethods } from '../../constraints';
|
|
3
|
+
export declare const applyFireStoreAdminConstraint: (collectionRef: Query, { type, values }: FirestorePermittedMethods) => Query<FirebaseFirestore.DocumentData>;
|
|
4
|
+
export declare const applyFireStoreAdminConstraints: (collectionRef: Query, constraints: FirestorePermittedMethods[]) => Query<FirebaseFirestore.DocumentData>;
|
|
5
|
+
//# sourceMappingURL=constraints.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraints.utils.d.ts","sourceRoot":"","sources":["../../../src/firestore/utils/constraints.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAGnE,eAAO,MAAM,6BAA6B,GAAI,eAAe,KAAK,EAAE,kBAAkB,yBAAyB,0CAiC9G,CAAC;AAEF,eAAO,MAAM,8BAA8B,GAAI,eAAe,KAAK,EAAE,aAAa,yBAAyB,EAAE,0CAI5G,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/firestore/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ref.utils.d.ts","sourceRoot":"","sources":["../../../src/firestore/utils/ref.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAElG,eAAO,MAAM,MAAM,GAAI,IAAI,SAAS,EAAE,SAAS,MAAM,KAkB9C,mBAAmB,GAAG,iBAC5B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { QuerySnapshot, DocumentData } from 'firebase-admin/firestore';
|
|
2
|
+
export declare const getOrderedResultFirestore: (snapshot: QuerySnapshot) => (DocumentData & {
|
|
3
|
+
__key: string;
|
|
4
|
+
})[];
|
|
5
|
+
export declare const getGroupedResultFirestore: (snapshot: QuerySnapshot) => {
|
|
6
|
+
added: DocumentData[];
|
|
7
|
+
modified: DocumentData[];
|
|
8
|
+
removed: DocumentData[];
|
|
9
|
+
} | null;
|
|
10
|
+
//# sourceMappingURL=result.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.utils.d.ts","sourceRoot":"","sources":["../../../src/firestore/utils/result.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE5E,eAAO,MAAM,yBAAyB,GAAI,UAAU,aAAa;WACxB,MAAM;IAK9C,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,UAAU,aAAa;WACjC,YAAY,EAAE;cAAY,YAAY,EAAE;aAAW,YAAY,EAAE;QAWhG,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,271 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { DatabaseReference, DataSnapshot } from 'firebase/database';
|
|
7
|
-
import { Reference, DataSnapshot as DataSnapshot$1, Database, Query as Query$1 } from 'firebase-admin/database';
|
|
8
|
-
|
|
9
|
-
declare enum SharedQueryConstraints {
|
|
10
|
-
START_AT = "startAt",
|
|
11
|
-
START_AFTER = "startAfter",
|
|
12
|
-
END_AT = "endAt",
|
|
13
|
-
END_BEFORE = "endBefore"
|
|
14
|
-
}
|
|
15
|
-
declare enum RealtimeQueryConstraints {
|
|
16
|
-
ORDER_BY_CHILD = "orderByChild",
|
|
17
|
-
ORDER_BY_KEY = "orderByKey",
|
|
18
|
-
ORDER_BY_VALUE = "orderByValue",
|
|
19
|
-
LIMIT_TO_FIRST = "limitToFirst",
|
|
20
|
-
LIMIT_TO_LAST = "limitToLast",
|
|
21
|
-
EQUAL_TO = "equalTo"
|
|
22
|
-
}
|
|
23
|
-
declare enum FirestoreQueryConstraints {
|
|
24
|
-
WHERE = "where",
|
|
25
|
-
ORDER_BY = "orderBy",
|
|
26
|
-
LIMIT = "limit"
|
|
27
|
-
}
|
|
28
|
-
declare const $where: (fieldPath: string, opStr: WhereFilterOp, value: any) => {
|
|
29
|
-
toString: () => string;
|
|
30
|
-
type: FirestoreQueryConstraints.WHERE;
|
|
31
|
-
values: any[];
|
|
32
|
-
};
|
|
33
|
-
declare const $orderBy: (fieldPath: string, directionStr?: OrderByDirection) => {
|
|
34
|
-
toString: () => string;
|
|
35
|
-
type: FirestoreQueryConstraints.ORDER_BY;
|
|
36
|
-
values: (string | undefined)[];
|
|
37
|
-
};
|
|
38
|
-
declare const $limit: (num: number) => {
|
|
39
|
-
toString: () => string;
|
|
40
|
-
type: FirestoreQueryConstraints.LIMIT;
|
|
41
|
-
values: number[];
|
|
42
|
-
};
|
|
43
|
-
declare const $startAt: (...docOrFields: any[]) => {
|
|
44
|
-
toString: () => string;
|
|
45
|
-
type: SharedQueryConstraints;
|
|
46
|
-
values: any[][];
|
|
47
|
-
};
|
|
48
|
-
declare const $startAfter: (...docOrFields: any[]) => {
|
|
49
|
-
toString: () => string;
|
|
50
|
-
type: SharedQueryConstraints;
|
|
51
|
-
values: any[][];
|
|
52
|
-
};
|
|
53
|
-
declare const $endAt: (...docOrFields: any[]) => {
|
|
54
|
-
toString: () => string;
|
|
55
|
-
type: SharedQueryConstraints;
|
|
56
|
-
values: any[][];
|
|
57
|
-
};
|
|
58
|
-
declare const $endBefore: (...docOrFields: any[]) => {
|
|
59
|
-
toString: () => string;
|
|
60
|
-
type: SharedQueryConstraints;
|
|
61
|
-
values: any[][];
|
|
62
|
-
};
|
|
63
|
-
declare const $orderByChild: (path: string) => {
|
|
64
|
-
toString: () => string;
|
|
65
|
-
type: RealtimeQueryConstraints.ORDER_BY_CHILD;
|
|
66
|
-
values: string[];
|
|
67
|
-
};
|
|
68
|
-
declare const $orderByKey: () => {
|
|
69
|
-
toString: () => string;
|
|
70
|
-
type: RealtimeQueryConstraints.ORDER_BY_KEY;
|
|
71
|
-
values: never[];
|
|
72
|
-
};
|
|
73
|
-
declare const $orderByValue: () => {
|
|
74
|
-
toString: () => string;
|
|
75
|
-
type: RealtimeQueryConstraints.ORDER_BY_VALUE;
|
|
76
|
-
values: never[];
|
|
77
|
-
};
|
|
78
|
-
declare const $limitToFirst: (num: number) => {
|
|
79
|
-
toString: () => string;
|
|
80
|
-
type: RealtimeQueryConstraints.LIMIT_TO_FIRST;
|
|
81
|
-
values: number[];
|
|
82
|
-
};
|
|
83
|
-
declare const $limitToLast: (num: number) => {
|
|
84
|
-
toString: () => string;
|
|
85
|
-
type: RealtimeQueryConstraints.LIMIT_TO_LAST;
|
|
86
|
-
values: number[];
|
|
87
|
-
};
|
|
88
|
-
declare const $equalTo: (value: any) => {
|
|
89
|
-
toString: () => string;
|
|
90
|
-
type: RealtimeQueryConstraints.EQUAL_TO;
|
|
91
|
-
values: any[];
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
type RealtimeConstraintsUnion = `${RealtimeQueryConstraints}`;
|
|
95
|
-
type FirestoreConstraintsUnion = `${FirestoreQueryConstraints}`;
|
|
96
|
-
type RealtimePermittedMethods = ReturnType<typeof $startAt> | ReturnType<typeof $startAfter> | ReturnType<typeof $endAt> | ReturnType<typeof $endBefore> | ReturnType<typeof $orderByChild> | ReturnType<typeof $orderByValue> | ReturnType<typeof $orderByKey> | ReturnType<typeof $limitToFirst> | ReturnType<typeof $limitToLast> | ReturnType<typeof $equalTo>;
|
|
97
|
-
type FirestorePermittedMethods = ReturnType<typeof $where> | ReturnType<typeof $orderBy> | ReturnType<typeof $limit> | ReturnType<typeof $startAt> | ReturnType<typeof $startAfter> | ReturnType<typeof $endAt> | ReturnType<typeof $endBefore>;
|
|
98
|
-
type ExtractConstraintType<T> = T extends {
|
|
99
|
-
toString: () => string;
|
|
100
|
-
type: infer ThisType;
|
|
101
|
-
values: any;
|
|
102
|
-
} ? ThisType : never;
|
|
103
|
-
type PermittedConstraints<T, U> = ExtractConstraintType<T> extends U ? T : never;
|
|
104
|
-
|
|
105
|
-
type FirestoreSocketAdapterType = SocketAdapter<never, FirestoreOnSnapshotExtra, {
|
|
106
|
-
groupByChangeType?: boolean;
|
|
107
|
-
} & FirestoreQueryParams>;
|
|
108
|
-
type FirestoreAdapterType = Adapter<Record<string, never>, "getDoc", FirestoreStatuses, FirestoreExtra, FirestoreQueryParams, FirestoreQueryParams> | Adapter<Record<string, never>, "getDocs", FirestoreStatuses, FirestoreGetDocsExtra, FirestoreQueryParams, FirestoreQueryParams> | Adapter<{
|
|
109
|
-
merge: boolean;
|
|
110
|
-
}, "setDoc", FirestoreStatuses, FirestoreRefOnlyExtra, Record<string, never>, undefined> | Adapter<Record<string, never>, "updateDoc" | "addDoc" | "deleteDoc" | "setDoc", FirestoreStatuses, FirestoreRefOnlyExtra, Record<string, never>, undefined>;
|
|
111
|
-
type FirestoreQueryParams = {
|
|
112
|
-
constraints?: PermittedConstraints<FirestorePermittedMethods, FirestoreConstraintsUnion | SharedQueryConstraints>[];
|
|
113
|
-
};
|
|
114
|
-
declare enum FirestoreMethods {
|
|
115
|
-
addDoc = "addDoc",
|
|
116
|
-
getDoc = "getDoc",
|
|
117
|
-
getDocs = "getDocs",
|
|
118
|
-
setDoc = "setDoc",
|
|
119
|
-
updateDoc = "updateDoc",
|
|
120
|
-
deleteDoc = "deleteDoc"
|
|
121
|
-
}
|
|
122
|
-
type FirestoreMethodsUnion = FirestoreMethods.addDoc | FirestoreMethods.getDoc | FirestoreMethods.getDocs | FirestoreMethods.setDoc | FirestoreMethods.updateDoc | FirestoreMethods.deleteDoc;
|
|
123
|
-
type FirestoreExtra = {
|
|
124
|
-
ref?: DocumentReference;
|
|
125
|
-
snapshot?: DocumentSnapshot;
|
|
126
|
-
};
|
|
127
|
-
type FirestoreOnSnapshotExtra = {
|
|
128
|
-
ref?: DocumentReference | CollectionReference;
|
|
129
|
-
snapshot?: DocumentSnapshot;
|
|
130
|
-
unsubscribe?: Unsubscribe;
|
|
131
|
-
groupedResult?: {
|
|
132
|
-
added: DocumentSnapshot[];
|
|
133
|
-
modified: DocumentSnapshot[];
|
|
134
|
-
removed: DocumentSnapshot[];
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
type FirestoreGetDocsExtra = {
|
|
138
|
-
ref?: CollectionReference;
|
|
139
|
-
snapshot?: QuerySnapshot;
|
|
140
|
-
};
|
|
141
|
-
type FirestoreRefOnlyExtra = {
|
|
142
|
-
ref?: DocumentReference;
|
|
143
|
-
};
|
|
144
|
-
type FirestoreStatuses = "success" | "error" | "emptyResource";
|
|
145
|
-
|
|
146
|
-
type RealtimeSocketAdapterType = SocketAdapter<never, RealtimeDbOnValueMethodExtra, {
|
|
147
|
-
onlyOnce?: boolean;
|
|
148
|
-
} & RealtimeDBQueryParams>;
|
|
149
|
-
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>;
|
|
150
|
-
type DefaultRealtimeDBAdapterOptions = {
|
|
151
|
-
priority?: number;
|
|
152
|
-
};
|
|
153
|
-
declare enum RealtimeDBMethods {
|
|
154
|
-
set = "set",
|
|
155
|
-
push = "push",
|
|
156
|
-
update = "update",
|
|
157
|
-
get = "get",
|
|
158
|
-
remove = "remove"
|
|
159
|
-
}
|
|
160
|
-
type RealtimeDBMethodsUnion = RealtimeDBMethods.set | RealtimeDBMethods.push | RealtimeDBMethods.update | RealtimeDBMethods.get | RealtimeDBMethods.remove;
|
|
161
|
-
type RealtimeDBStatuses = "success" | "error" | "emptyResource";
|
|
162
|
-
type RealtimeDbOnValueMethodExtra = {
|
|
163
|
-
ref: DatabaseReference;
|
|
164
|
-
snapshot: DataSnapshot;
|
|
165
|
-
};
|
|
166
|
-
type RealtimeDbGetMethodExtra = {
|
|
167
|
-
ref: DatabaseReference;
|
|
168
|
-
snapshot: DataSnapshot;
|
|
169
|
-
};
|
|
170
|
-
type RealtimeDbDefaultExtra = {
|
|
171
|
-
ref: DatabaseReference;
|
|
172
|
-
};
|
|
173
|
-
type RealtimeDbPushMethodExtra = {
|
|
174
|
-
ref: DatabaseReference;
|
|
175
|
-
key: string;
|
|
176
|
-
};
|
|
177
|
-
type RealtimeDBQueryParams = {
|
|
178
|
-
constraints?: PermittedConstraints<RealtimePermittedMethods, RealtimeConstraintsUnion | SharedQueryConstraints>[];
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
type RealtimeAdminSocketAdapterType = SocketAdapter<any, RealtimeAdminOnValueMethodExtra, {
|
|
182
|
-
onlyOnce?: boolean;
|
|
183
|
-
} & RealtimeDBQueryParams, any>;
|
|
184
|
-
type RealtimeAdminOnValueMethodExtra = {
|
|
185
|
-
ref: Reference;
|
|
186
|
-
snapshot: DataSnapshot$1;
|
|
187
|
-
status: RealtimeDBStatuses;
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
type FirestoreAdminSocketAdapterType = SocketAdapter<FirestoreAdminOnSnapshotExtra, undefined, {
|
|
191
|
-
groupByChangeType?: boolean;
|
|
192
|
-
} & FirestoreQueryParams>;
|
|
193
|
-
type FirestoreAdminOnSnapshotExtra = {
|
|
194
|
-
ref?: DocumentReference$1 | Query;
|
|
195
|
-
snapshot?: DocumentSnapshot$1 | QuerySnapshot$1;
|
|
196
|
-
unsubscribe?: () => void;
|
|
197
|
-
groupedResult: {
|
|
198
|
-
added: DocumentData[];
|
|
199
|
-
modified: DocumentData[];
|
|
200
|
-
removed: DocumentData[];
|
|
201
|
-
} | null;
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
type FirebaseAdminDBTypes = Database | Firestore;
|
|
205
|
-
type FirebaseAdminAdapterTypes<T> = T extends Database ? RealtimeDbAdapterType : FirestoreAdapterType;
|
|
206
|
-
type FirebaseAdminSocketAdapterTypes<T> = T extends Firestore ? FirestoreAdminSocketAdapterType : RealtimeAdminSocketAdapterType;
|
|
207
|
-
type RealtimeDBRequestType = Request<any, any, RealtimeDBQueryParams, any, any, Client<any, Adapter<any, RealtimeDBMethodsUnion, any, any, any, any>>, any, any, any>;
|
|
208
|
-
type FirestoreRequestType = Request<any, any, FirestoreQueryParams, any, any, Client<any, Adapter<any, FirestoreMethodsUnion, any, any, any, any>>, any, any, any>;
|
|
209
|
-
type RequestType<T> = T extends Firestore ? FirestoreRequestType : RealtimeDBRequestType;
|
|
210
|
-
|
|
211
|
-
declare const FirebaseSocketsAdminAdapter: <T extends FirebaseAdminDBTypes>(database: T) => FirebaseAdminSocketAdapterTypes<T>;
|
|
212
|
-
|
|
213
|
-
declare const FirebaseAdminAdapter: <T extends FirebaseAdminDBTypes>(database: T) => Adapter<Record<string, never>, "getDoc", FirestoreStatuses, FirestoreExtra, FirestoreQueryParams, FirestoreQueryParams, string, _hyper_fetch_core.DefaultMapperType, _hyper_fetch_core.DefaultMapperType, _hyper_fetch_core.DefaultMapperType, _hyper_fetch_core.DefaultMapperType> | Adapter<Record<string, never>, "getDocs", FirestoreStatuses, FirestoreGetDocsExtra, FirestoreQueryParams, FirestoreQueryParams, string, _hyper_fetch_core.DefaultMapperType, _hyper_fetch_core.DefaultMapperType, _hyper_fetch_core.DefaultMapperType, _hyper_fetch_core.DefaultMapperType> | Adapter<{
|
|
214
|
-
merge: boolean;
|
|
215
|
-
}, "setDoc", FirestoreStatuses, FirestoreRefOnlyExtra, Record<string, never>, undefined, string, _hyper_fetch_core.DefaultMapperType, _hyper_fetch_core.DefaultMapperType, _hyper_fetch_core.DefaultMapperType, _hyper_fetch_core.DefaultMapperType> | Adapter<Record<string, never>, "setDoc" | "updateDoc" | "addDoc" | "deleteDoc", FirestoreStatuses, FirestoreRefOnlyExtra, Record<string, never>, undefined, string, _hyper_fetch_core.DefaultMapperType, _hyper_fetch_core.DefaultMapperType, _hyper_fetch_core.DefaultMapperType, _hyper_fetch_core.DefaultMapperType>;
|
|
216
|
-
|
|
217
|
-
declare const firestoreAdminSockets: (database: Firestore) => FirestoreAdminSocketAdapterType;
|
|
218
|
-
|
|
219
|
-
type DataType = {
|
|
220
|
-
constraints?: PermittedConstraints<FirestorePermittedMethods, FirestoreConstraintsUnion | SharedQueryConstraints>[];
|
|
221
|
-
payload?: any;
|
|
222
|
-
options?: Record<string, any>;
|
|
223
|
-
};
|
|
224
|
-
declare const getFirestoreAdminMethods: ({ database, url, onSuccess, onError, onResponseStart, onRequestStart, onRequestEnd, onResponseEnd, }: {
|
|
225
|
-
database: Firestore;
|
|
226
|
-
url: string;
|
|
227
|
-
onSuccess: Awaited<ReturnType<typeof getAdapterBindings>>["onSuccess"];
|
|
228
|
-
onError: Awaited<ReturnType<typeof getAdapterBindings>>["onError"];
|
|
229
|
-
onResponseStart: Awaited<ReturnType<typeof getAdapterBindings>>["onResponseStart"];
|
|
230
|
-
onRequestStart: Awaited<ReturnType<typeof getAdapterBindings>>["onRequestStart"];
|
|
231
|
-
onRequestEnd: Awaited<ReturnType<typeof getAdapterBindings>>["onRequestEnd"];
|
|
232
|
-
onResponseEnd: Awaited<ReturnType<typeof getAdapterBindings>>["onResponseEnd"];
|
|
233
|
-
}) => ((methodName: FirestoreMethodsUnion, data: DataType) => Promise<void>);
|
|
234
|
-
|
|
235
|
-
declare const getOrderedResultFirestore: (snapshot: QuerySnapshot$1) => (DocumentData & {
|
|
236
|
-
__key: string;
|
|
237
|
-
})[];
|
|
238
|
-
declare const getGroupedResultFirestore: (snapshot: QuerySnapshot$1) => {
|
|
239
|
-
added: DocumentData[];
|
|
240
|
-
modified: DocumentData[];
|
|
241
|
-
removed: DocumentData[];
|
|
242
|
-
} | null;
|
|
243
|
-
|
|
244
|
-
declare const getRef: (db: Firestore, fullUrl: string) => CollectionReference$1 | DocumentReference$1;
|
|
245
|
-
|
|
246
|
-
declare const applyFireStoreAdminConstraint: (collectionRef: Query, { type, values }: FirestorePermittedMethods) => Query<FirebaseFirestore.DocumentData>;
|
|
247
|
-
declare const applyFireStoreAdminConstraints: (collectionRef: Query, constraints: FirestorePermittedMethods[]) => Query<FirebaseFirestore.DocumentData>;
|
|
248
|
-
|
|
249
|
-
declare const getOrderedResultRealtime: (snapshot: DataSnapshot$1) => any;
|
|
250
|
-
|
|
251
|
-
declare const applyRealtimeAdminConstraint: (ref: Query$1, { type, values }: RealtimePermittedMethods) => Query$1;
|
|
252
|
-
declare const applyRealtimeAdminConstraints: (ref: Query$1, constraints: RealtimePermittedMethods[]) => Query$1;
|
|
253
|
-
|
|
254
|
-
declare const getRealtimeDbAdminMethods: ({ database, url, onSuccess, onError, onResponseStart, onRequestStart, onRequestEnd, onResponseEnd, }: {
|
|
255
|
-
database: Database;
|
|
256
|
-
url: string;
|
|
257
|
-
onSuccess: Awaited<ReturnType<typeof getAdapterBindings>>["onSuccess"];
|
|
258
|
-
onError: Awaited<ReturnType<typeof getAdapterBindings>>["onError"];
|
|
259
|
-
onResponseStart: Awaited<ReturnType<typeof getAdapterBindings>>["onResponseStart"];
|
|
260
|
-
onRequestStart: Awaited<ReturnType<typeof getAdapterBindings>>["onRequestStart"];
|
|
261
|
-
onRequestEnd: Awaited<ReturnType<typeof getAdapterBindings>>["onRequestEnd"];
|
|
262
|
-
onResponseEnd: Awaited<ReturnType<typeof getAdapterBindings>>["onResponseEnd"];
|
|
263
|
-
}) => ((methodName: RealtimeDBMethodsUnion, data: {
|
|
264
|
-
constraints: PermittedConstraints<RealtimePermittedMethods, RealtimeConstraintsUnion | SharedQueryConstraints>[];
|
|
265
|
-
payload: any;
|
|
266
|
-
options: Record<string, any>;
|
|
267
|
-
}) => Promise<void>);
|
|
268
|
-
|
|
269
|
-
declare const realtimeSocketsAdmin: (database: Database) => RealtimeAdminSocketAdapterType;
|
|
270
|
-
|
|
271
|
-
export { $endAt, $endBefore, $equalTo, $limit, $limitToFirst, $limitToLast, $orderBy, $orderByChild, $orderByKey, $orderByValue, $startAfter, $startAt, $where, type DefaultRealtimeDBAdapterOptions, FirebaseAdminAdapter, type FirebaseAdminAdapterTypes, type FirebaseAdminDBTypes, type FirebaseAdminSocketAdapterTypes, FirebaseSocketsAdminAdapter, type FirestoreAdapterType, type FirestoreAdminOnSnapshotExtra, type FirestoreAdminSocketAdapterType, type FirestoreConstraintsUnion, type FirestoreExtra, type FirestoreGetDocsExtra, FirestoreMethods, type FirestoreMethodsUnion, type FirestoreOnSnapshotExtra, type FirestorePermittedMethods, FirestoreQueryConstraints, type FirestoreQueryParams, type FirestoreRefOnlyExtra, type FirestoreRequestType, type FirestoreSocketAdapterType, type FirestoreStatuses, type PermittedConstraints, type RealtimeAdminOnValueMethodExtra, type RealtimeAdminSocketAdapterType, type RealtimeConstraintsUnion, RealtimeDBMethods, type RealtimeDBMethodsUnion, type RealtimeDBQueryParams, type RealtimeDBRequestType, type RealtimeDBStatuses, type RealtimeDbAdapterType, type RealtimeDbDefaultExtra, type RealtimeDbGetMethodExtra, type RealtimeDbOnValueMethodExtra, type RealtimeDbPushMethodExtra, type RealtimePermittedMethods, RealtimeQueryConstraints, type RealtimeSocketAdapterType, type RequestType, SharedQueryConstraints, applyFireStoreAdminConstraint, applyFireStoreAdminConstraints, applyRealtimeAdminConstraint, applyRealtimeAdminConstraints, firestoreAdminSockets, getFirestoreAdminMethods, getGroupedResultFirestore, getOrderedResultFirestore, getOrderedResultRealtime, getRealtimeDbAdminMethods, getRef, realtimeSocketsAdmin };
|
|
1
|
+
export * from './adapter';
|
|
2
|
+
export * from './constraints';
|
|
3
|
+
export * from './firestore';
|
|
4
|
+
export * from './realtime';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|