@dereekb/firebase 13.10.1 → 13.10.3
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/index.cjs.js +4 -4
- package/index.esm.js +4 -4
- package/package.json +5 -5
- package/src/lib/common/firestore/collection/collection.d.ts +10 -0
- package/src/lib/common/firestore/collection/collection.single.d.ts +18 -7
- package/src/lib/common/firestore/collection/subcollection.d.ts +11 -0
- package/src/lib/common/firestore/collection/subcollection.single.d.ts +7 -0
- package/test/index.cjs.js +238 -213
- package/test/index.esm.js +239 -214
- package/test/package.json +6 -6
- package/test/src/lib/common/firestore/firestore.d.ts +1 -0
- package/test/src/lib/common/firestore/test.driver.accessor.d.ts +18 -6
- package/test/src/lib/common/mock/mock.item.collection.fixture.d.ts +1 -1
- package/test/src/lib/common/mock/mock.item.storage.fixture.d.ts +1 -1
package/index.cjs.js
CHANGED
|
@@ -7835,10 +7835,10 @@ var FIRESTORE_DUMMY_MODEL_KEY = 'dummymodel/dummykey';
|
|
|
7835
7835
|
/**
|
|
7836
7836
|
* Creates a root-level Firestore collection focused on a single document.
|
|
7837
7837
|
*
|
|
7838
|
-
*
|
|
7839
|
-
* functionality with convenient accessors for working
|
|
7840
|
-
*
|
|
7841
|
-
* that are stored in Firestore.
|
|
7838
|
+
* Backing factory for the `'root-singleton'` collection kind. Combines
|
|
7839
|
+
* standard collection functionality with convenient accessors for working
|
|
7840
|
+
* with a single document. Useful for application settings, configuration,
|
|
7841
|
+
* or any singleton-like data structures that are stored in Firestore.
|
|
7842
7842
|
*
|
|
7843
7843
|
* @template T - The data type of the document
|
|
7844
7844
|
* @template D - The FirestoreDocument type, defaults to FirestoreDocument<T>
|
package/index.esm.js
CHANGED
|
@@ -7833,10 +7833,10 @@ var FIRESTORE_DUMMY_MODEL_KEY = 'dummymodel/dummykey';
|
|
|
7833
7833
|
/**
|
|
7834
7834
|
* Creates a root-level Firestore collection focused on a single document.
|
|
7835
7835
|
*
|
|
7836
|
-
*
|
|
7837
|
-
* functionality with convenient accessors for working
|
|
7838
|
-
*
|
|
7839
|
-
* that are stored in Firestore.
|
|
7836
|
+
* Backing factory for the `'root-singleton'` collection kind. Combines
|
|
7837
|
+
* standard collection functionality with convenient accessors for working
|
|
7838
|
+
* with a single document. Useful for application settings, configuration,
|
|
7839
|
+
* or any singleton-like data structures that are stored in Firestore.
|
|
7840
7840
|
*
|
|
7841
7841
|
* @template T - The data type of the document
|
|
7842
7842
|
* @template D - The FirestoreDocument type, defaults to FirestoreDocument<T>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase",
|
|
3
|
-
"version": "13.10.
|
|
3
|
+
"version": "13.10.3",
|
|
4
4
|
"exports": {
|
|
5
5
|
"./test": {
|
|
6
6
|
"module": "./test/index.esm.js",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@dereekb/util": "13.10.
|
|
21
|
-
"@dereekb/date": "13.10.
|
|
22
|
-
"@dereekb/model": "13.10.
|
|
23
|
-
"@dereekb/rxjs": "13.10.
|
|
20
|
+
"@dereekb/util": "13.10.3",
|
|
21
|
+
"@dereekb/date": "13.10.3",
|
|
22
|
+
"@dereekb/model": "13.10.3",
|
|
23
|
+
"@dereekb/rxjs": "13.10.3",
|
|
24
24
|
"@firebase/rules-unit-testing": "5.0.0",
|
|
25
25
|
"arktype": "^2.2.0",
|
|
26
26
|
"date-fns": "^4.1.0",
|
|
@@ -596,6 +596,16 @@ export interface FirestoreCollectionConfig<T, D extends FirestoreDocument<T> = F
|
|
|
596
596
|
/**
|
|
597
597
|
* Full Firestore collection interface with document CRUD, querying, iteration, and context support.
|
|
598
598
|
*
|
|
599
|
+
* Backs the `'root'` collection kind: a standard Firestore root collection.
|
|
600
|
+
* Created at runtime via `firestoreContext.firestoreCollection({...})` and
|
|
601
|
+
* typed at the model layer as
|
|
602
|
+
* `<Model>FirestoreCollection = FirestoreCollection<T, D>`.
|
|
603
|
+
*
|
|
604
|
+
* For other collection kinds, see:
|
|
605
|
+
* - `'root-singleton'` ({@link RootSingleItemFirestoreCollection} in `./collection.single`) — single doc in a root collection.
|
|
606
|
+
* - `'sub-collection'` ({@link FirestoreCollectionWithParent} in `./subcollection`) — multi-item subcollection under a parent.
|
|
607
|
+
* - `'singleton-sub'` ({@link SingleItemFirestoreCollection} in `./subcollection.single`) — one document per parent.
|
|
608
|
+
*
|
|
599
609
|
* This is the primary interface used to interact with a Firestore collection. It provides:
|
|
600
610
|
* - **Document access**: Create, load, and manage documents via {@link FirestoreDocumentAccessor}
|
|
601
611
|
* - **Querying**: Build typed queries via the query factory
|
|
@@ -3,9 +3,11 @@ import { type FirestoreCollection, type FirestoreCollectionConfig } from './coll
|
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for creating a root-level collection that focuses on a single document.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Backs the `'root-singleton'` collection kind. This configuration extends
|
|
7
|
+
* the standard FirestoreCollectionConfig with optional settings for
|
|
8
|
+
* specifying a single document identifier — used when you need to work with
|
|
9
|
+
* a specific document in a root collection, such as application
|
|
10
|
+
* configuration or per-deploy settings.
|
|
9
11
|
*
|
|
10
12
|
* @template T - The data type of the document
|
|
11
13
|
* @template D - The FirestoreDocument type, defaults to FirestoreDocument<T>
|
|
@@ -15,6 +17,15 @@ export interface RootSingleItemFirestoreCollectionConfig<T, D extends FirestoreD
|
|
|
15
17
|
/**
|
|
16
18
|
* A Firestore collection that provides specialized accessors for working with a single document.
|
|
17
19
|
*
|
|
20
|
+
* Backs the `'root-singleton'` collection kind: a single document in a root
|
|
21
|
+
* collection, identified up-front by a fixed `singleItemIdentifier`. Created
|
|
22
|
+
* at runtime via `firestoreContext.rootSingleItemFirestoreCollection({...})`
|
|
23
|
+
* and typed at the model layer as
|
|
24
|
+
* `<Model>FirestoreCollection = RootSingleItemFirestoreCollection<T, D>`.
|
|
25
|
+
*
|
|
26
|
+
* For the parent-bound counterpart (one document per parent), see
|
|
27
|
+
* {@link SingleItemFirestoreCollection} (kind `'singleton-sub'`).
|
|
28
|
+
*
|
|
18
29
|
* This interface combines the capabilities of a standard FirestoreCollection with
|
|
19
30
|
* FirestoreSingleDocumentAccessor, providing convenient methods for working directly
|
|
20
31
|
* with a single document without needing to specify its ID in each call.
|
|
@@ -27,10 +38,10 @@ export interface RootSingleItemFirestoreCollection<T, D extends FirestoreDocumen
|
|
|
27
38
|
/**
|
|
28
39
|
* Creates a root-level Firestore collection focused on a single document.
|
|
29
40
|
*
|
|
30
|
-
*
|
|
31
|
-
* functionality with convenient accessors for working
|
|
32
|
-
*
|
|
33
|
-
* that are stored in Firestore.
|
|
41
|
+
* Backing factory for the `'root-singleton'` collection kind. Combines
|
|
42
|
+
* standard collection functionality with convenient accessors for working
|
|
43
|
+
* with a single document. Useful for application settings, configuration,
|
|
44
|
+
* or any singleton-like data structures that are stored in Firestore.
|
|
34
45
|
*
|
|
35
46
|
* @template T - The data type of the document
|
|
36
47
|
* @template D - The FirestoreDocument type, defaults to FirestoreDocument<T>
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
* within a specific document rather than at the root level. Subcollections enable hierarchical
|
|
6
6
|
* data modeling in Firestore by allowing documents to contain their own collections.
|
|
7
7
|
*
|
|
8
|
+
* Collection kind: `'sub-collection'` (multi-item subcollection under a parent).
|
|
9
|
+
* For the one-document-per-parent variant, see `'singleton-sub'`
|
|
10
|
+
* ({@link SingleItemFirestoreCollection} in `./subcollection.single`).
|
|
11
|
+
*
|
|
8
12
|
* Key features of subcollections:
|
|
9
13
|
* - They provide a natural way to model hierarchical relationships
|
|
10
14
|
* - They establish clear ownership boundaries (parent document owns child documents)
|
|
@@ -42,6 +46,13 @@ export interface FirestoreCollectionWithParentConfig<T, PT, D extends FirestoreD
|
|
|
42
46
|
/**
|
|
43
47
|
* A FirestoreCollection that represents a subcollection with a reference to its parent document.
|
|
44
48
|
*
|
|
49
|
+
* Backs the `'sub-collection'` collection kind: a multi-item subcollection
|
|
50
|
+
* under a parent. Created at runtime via `firestoreContext.firestoreCollectionWithParent({...})`
|
|
51
|
+
* and typed at the model layer as `<Model>FirestoreCollection = FirestoreCollectionWithParent<T, PT, D, PD>`.
|
|
52
|
+
*
|
|
53
|
+
* For one-document-per-parent subcollections, use {@link SingleItemFirestoreCollection}
|
|
54
|
+
* (kind `'singleton-sub'`) instead.
|
|
55
|
+
*
|
|
45
56
|
* This interface extends FirestoreCollection to maintain the parent-child relationship
|
|
46
57
|
* between documents. It allows access to documents within the context of their parent,
|
|
47
58
|
* enabling proper path construction and maintaining the document hierarchy.
|
|
@@ -18,6 +18,13 @@ export interface SingleItemFirestoreCollectionConfig<T, PT, D extends FirestoreD
|
|
|
18
18
|
* A subcollection that provides specialized accessors for working with a single document
|
|
19
19
|
* within a parent document context.
|
|
20
20
|
*
|
|
21
|
+
* Backs the `'singleton-sub'` collection kind: one document per parent.
|
|
22
|
+
* Created at runtime via `firestoreContext.singleItemFirestoreCollection({...})`
|
|
23
|
+
* and typed at the model layer as `<Model>FirestoreCollection = SingleItemFirestoreCollection<T, PT, D, PD>`.
|
|
24
|
+
*
|
|
25
|
+
* For multi-item subcollections under the same parent, use
|
|
26
|
+
* {@link FirestoreCollectionWithParent} (kind `'sub-collection'`) instead.
|
|
27
|
+
*
|
|
21
28
|
* This interface combines the capabilities of FirestoreCollectionWithParent (which maintains
|
|
22
29
|
* the parent-child relationship) with FirestoreSingleDocumentAccessor (which provides
|
|
23
30
|
* convenient methods for working with a specific document). This allows for direct access
|