@ttt-productions/query-core 0.5.0 → 0.6.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/dist/firestore/types.d.ts +1 -1
- package/dist/keys.d.ts +1 -1
- package/dist/keys.js +5 -5
- package/dist/react/firestore/use-firestore-collection.d.ts +5 -5
- package/dist/react/firestore/use-firestore-collection.js +5 -5
- package/dist/react/firestore/use-firestore-doc.d.ts +3 -3
- package/dist/react/firestore/use-firestore-doc.js +3 -3
- package/dist/react/firestore/useBatchFirestoreDocs.d.ts +1 -1
- package/package.json +1 -1
|
@@ -39,7 +39,7 @@ export interface FirestoreDocOptions<T> extends FirestoreBaseOptions {
|
|
|
39
39
|
* Options for collection queries.
|
|
40
40
|
*/
|
|
41
41
|
export interface FirestoreCollectionOptions<T> extends FirestoreBaseOptions {
|
|
42
|
-
/** Collection path (e.g., 'users' or '
|
|
42
|
+
/** Collection path (e.g., 'users' or 'entities/abc/members') */
|
|
43
43
|
collectionPath: string;
|
|
44
44
|
/** Firestore query constraints (where, orderBy, etc.) */
|
|
45
45
|
constraints?: QueryConstraint[];
|
package/dist/keys.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare const keys: {
|
|
|
37
37
|
readonly list: (param?: SerializedKeyPart) => QueryKey;
|
|
38
38
|
readonly custom: (...parts: SerializedKeyPart[]) => QueryKey;
|
|
39
39
|
};
|
|
40
|
-
readonly
|
|
40
|
+
readonly entities: {
|
|
41
41
|
readonly all: QueryKey;
|
|
42
42
|
readonly detail: (id: string) => QueryKey;
|
|
43
43
|
readonly list: (param?: SerializedKeyPart) => QueryKey;
|
package/dist/keys.js
CHANGED
|
@@ -21,11 +21,11 @@ export const keys = {
|
|
|
21
21
|
list: (param) => withScope('skills', 'list', param),
|
|
22
22
|
custom: (...parts) => withScope('skills', ...parts),
|
|
23
23
|
},
|
|
24
|
-
|
|
25
|
-
all: withScope('
|
|
26
|
-
detail: (id) => withScope('
|
|
27
|
-
list: (param) => withScope('
|
|
28
|
-
custom: (...parts) => withScope('
|
|
24
|
+
entities: {
|
|
25
|
+
all: withScope('entities'),
|
|
26
|
+
detail: (id) => withScope('entities', 'detail', id),
|
|
27
|
+
list: (param) => withScope('entities', 'list', param),
|
|
28
|
+
custom: (...parts) => withScope('entities', ...parts),
|
|
29
29
|
},
|
|
30
30
|
messages: {
|
|
31
31
|
all: withScope('messages'),
|
|
@@ -7,16 +7,16 @@ import type { FirestoreCollectionOptions, WithId } from '../../firestore/types.j
|
|
|
7
7
|
* For large collections, use useFirestoreInfinite or useFirestorePaginated.
|
|
8
8
|
* * @example
|
|
9
9
|
* ```tsx
|
|
10
|
-
* // Fetch all channels in
|
|
10
|
+
* // Fetch all channels in an entity
|
|
11
11
|
* const { data: channels } = useFirestoreCollection<Channel>({
|
|
12
|
-
* collectionPath: `
|
|
13
|
-
* queryKey: ['channels',
|
|
12
|
+
* collectionPath: `entities/${entityId}/channels`,
|
|
13
|
+
* queryKey: ['channels', entityId],
|
|
14
14
|
* constraints: [orderBy('createdAt', 'asc')],
|
|
15
15
|
* });
|
|
16
16
|
* * // With realtime updates
|
|
17
17
|
* const { data: members } = useFirestoreCollection<Member>({
|
|
18
|
-
* collectionPath: `
|
|
19
|
-
* queryKey: ['members',
|
|
18
|
+
* collectionPath: `entities/${entityId}/members`,
|
|
19
|
+
* queryKey: ['members', entityId],
|
|
20
20
|
* subscribe: true,
|
|
21
21
|
* });
|
|
22
22
|
* ```
|
|
@@ -9,16 +9,16 @@ import { useFirestoreDb } from './context.js';
|
|
|
9
9
|
* For large collections, use useFirestoreInfinite or useFirestorePaginated.
|
|
10
10
|
* * @example
|
|
11
11
|
* ```tsx
|
|
12
|
-
* // Fetch all channels in
|
|
12
|
+
* // Fetch all channels in an entity
|
|
13
13
|
* const { data: channels } = useFirestoreCollection<Channel>({
|
|
14
|
-
* collectionPath: `
|
|
15
|
-
* queryKey: ['channels',
|
|
14
|
+
* collectionPath: `entities/${entityId}/channels`,
|
|
15
|
+
* queryKey: ['channels', entityId],
|
|
16
16
|
* constraints: [orderBy('createdAt', 'asc')],
|
|
17
17
|
* });
|
|
18
18
|
* * // With realtime updates
|
|
19
19
|
* const { data: members } = useFirestoreCollection<Member>({
|
|
20
|
-
* collectionPath: `
|
|
21
|
-
* queryKey: ['members',
|
|
20
|
+
* collectionPath: `entities/${entityId}/members`,
|
|
21
|
+
* queryKey: ['members', entityId],
|
|
22
22
|
* subscribe: true,
|
|
23
23
|
* });
|
|
24
24
|
* ```
|
|
@@ -11,9 +11,9 @@ import type { FirestoreDocOptions, WithId } from '../../firestore/types.js';
|
|
|
11
11
|
* queryKey: ['user', userId],
|
|
12
12
|
* });
|
|
13
13
|
* * // With realtime updates
|
|
14
|
-
* const { data:
|
|
15
|
-
* docPath: `
|
|
16
|
-
* queryKey: ['
|
|
14
|
+
* const { data: entity } = useFirestoreDoc<Entity>({
|
|
15
|
+
* docPath: `entities/${entityId}`,
|
|
16
|
+
* queryKey: ['entity', entityId],
|
|
17
17
|
* subscribe: true,
|
|
18
18
|
* });
|
|
19
19
|
* * // Conditional fetch
|
|
@@ -13,9 +13,9 @@ import { useFirestoreDb } from './context.js';
|
|
|
13
13
|
* queryKey: ['user', userId],
|
|
14
14
|
* });
|
|
15
15
|
* * // With realtime updates
|
|
16
|
-
* const { data:
|
|
17
|
-
* docPath: `
|
|
18
|
-
* queryKey: ['
|
|
16
|
+
* const { data: entity } = useFirestoreDoc<Entity>({
|
|
17
|
+
* docPath: `entities/${entityId}`,
|
|
18
|
+
* queryKey: ['entity', entityId],
|
|
19
19
|
* subscribe: true,
|
|
20
20
|
* });
|
|
21
21
|
* * // Conditional fetch
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttt-productions/query-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Shared TanStack Query (React Query) client defaults, query key helpers, and Firestore integration hooks for TTT Productions apps",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|