react-query-firebase 2.1.0 → 2.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/package.json CHANGED
@@ -57,6 +57,7 @@
57
57
  "files": [
58
58
  "./web/",
59
59
  "./react-native/",
60
+ "./types",
60
61
  "package.json",
61
62
  "package-lock.json",
62
63
  "README.md",
@@ -73,5 +74,5 @@
73
74
  "docs:build": "vitepress build docs",
74
75
  "docs:preview": "vitepress preview docs"
75
76
  },
76
- "version": "2.1.0"
77
+ "version": "2.1.1"
77
78
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Generic definition for a data model
3
+ * @group Models
4
+ */
5
+ export type AppModel = {
6
+ [key: string]: unknown;
7
+ };
@@ -0,0 +1,58 @@
1
+ import { AppModel } from "./AppModel";
2
+
3
+ /**
4
+ * Order by constraint
5
+ * @group Query Constraints
6
+ */
7
+ export type OrderByConstraint<AppModelType extends AppModel = AppModel> = {
8
+ /**
9
+ * Type of a constraint
10
+ */
11
+ type: "orderBy";
12
+ /**
13
+ * Field path to use for ordering
14
+ */
15
+ fieldPath: keyof AppModelType;
16
+ /**
17
+ * Direction of ordering: asc or desc
18
+ */
19
+ directionStr: "asc" | "desc";
20
+ };
21
+
22
+ /**
23
+ * Start from value constraint
24
+ * @group Query Constraints
25
+ */
26
+ export type StartConstraint = {
27
+ type: "startAt" | "startAfter";
28
+ arguments: unknown[];
29
+ };
30
+
31
+ /**
32
+ * End by value constraint
33
+ * @group Query Constraints
34
+ */
35
+ export type EndConstraint = {
36
+ type: "endAt" | "endBefore";
37
+ value: number | string | boolean | null;
38
+ key?: string;
39
+ };
40
+
41
+ /**
42
+ * Limit constraint
43
+ * @group Query Constraints
44
+ */
45
+ export type LimitConstraint = {
46
+ type: "limitToLast" | "limit";
47
+ limit: number;
48
+ };
49
+
50
+ /**
51
+ * Non filtering query constaints
52
+ * @group Query Constraints
53
+ */
54
+ export type NonFilterQueryConstraint<AppModelType extends AppModel = AppModel> =
55
+ | OrderByConstraint<AppModelType>
56
+ | StartConstraint
57
+ | EndConstraint
58
+ | LimitConstraint;
package/types/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./AppModel";
2
+ export * from "./QueryConstraints";