@dereekb/firebase 13.2.2 → 13.3.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/index.cjs.js +12893 -4062
- package/index.esm.js +12872 -4065
- package/package.json +5 -5
- package/src/lib/client/error/error.d.ts +18 -3
- package/src/lib/client/firestore/array.d.ts +16 -3
- package/src/lib/client/firestore/driver.accessor.batch.d.ts +35 -4
- package/src/lib/client/firestore/driver.accessor.create.d.ts +15 -0
- package/src/lib/client/firestore/driver.accessor.d.ts +15 -0
- package/src/lib/client/firestore/driver.accessor.default.d.ts +32 -0
- package/src/lib/client/firestore/driver.accessor.transaction.d.ts +35 -4
- package/src/lib/client/firestore/driver.d.ts +16 -0
- package/src/lib/client/firestore/driver.query.d.ts +36 -0
- package/src/lib/client/firestore/firestore.d.ts +11 -1
- package/src/lib/client/firestore/increment.d.ts +12 -3
- package/src/lib/client/function/development.function.factory.d.ts +27 -2
- package/src/lib/client/function/error.d.ts +27 -0
- package/src/lib/client/function/function.callable.d.ts +50 -5
- package/src/lib/client/function/function.factory.d.ts +70 -4
- package/src/lib/client/function/model.function.factory.d.ts +64 -9
- package/src/lib/client/storage/driver.accessor.d.ts +93 -0
- package/src/lib/client/storage/driver.d.ts +15 -0
- package/src/lib/client/storage/storage.d.ts +10 -1
- package/src/lib/common/auth/auth.context.d.ts +17 -2
- package/src/lib/common/auth/auth.d.ts +38 -9
- package/src/lib/common/auth/auth.error.d.ts +25 -0
- package/src/lib/common/auth/auth.server.error.d.ts +6 -2
- package/src/lib/common/development/function.d.ts +17 -6
- package/src/lib/common/development/function.schedule.d.ts +30 -1
- package/src/lib/common/firestore/accessor/accessor.wrap.modify.d.ts +36 -12
- package/src/lib/common/firestore/accessor/array.d.ts +14 -4
- package/src/lib/common/firestore/accessor/document.d.ts +77 -2
- package/src/lib/common/firestore/accessor/increment.d.ts +15 -3
- package/src/lib/common/firestore/collection/collection.d.ts +22 -4
- package/src/lib/common/firestore/collection/collection.util.d.ts +12 -2
- package/src/lib/common/firestore/driver/accessor.d.ts +28 -1
- package/src/lib/common/firestore/driver/batch.d.ts +6 -4
- package/src/lib/common/firestore/driver/driver.d.ts +18 -1
- package/src/lib/common/firestore/driver/query.d.ts +20 -1
- package/src/lib/common/firestore/driver/query.handler.d.ts +23 -0
- package/src/lib/common/firestore/driver/transaction.d.ts +18 -6
- package/src/lib/common/firestore/error.d.ts +16 -4
- package/src/lib/common/firestore/query/iterator.d.ts +11 -0
- package/src/lib/common/firestore/reference.d.ts +11 -6
- package/src/lib/common/firestore/snapshot/snapshot.d.ts +4 -0
- package/src/lib/common/firestore/snapshot/snapshot.field.d.ts +263 -63
- package/src/lib/common/firestore/types.d.ts +39 -1
- package/src/lib/common/firestore/util/id.batch.d.ts +55 -3
- package/src/lib/common/function/action.d.ts +35 -0
- package/src/lib/common/model/context.d.ts +11 -1
- package/src/lib/common/model/function.d.ts +45 -9
- package/src/lib/common/model/model/model.loader.d.ts +37 -0
- package/src/lib/common/model/model/model.param.d.ts +24 -2
- package/src/lib/common/model/model.service.d.ts +126 -4
- package/src/lib/common/model/permission/permission.context.d.ts +15 -0
- package/src/lib/common/model/permission/permission.d.ts +16 -0
- package/src/lib/common/model/permission/permission.service.d.ts +24 -1
- package/src/lib/common/model/permission/permission.service.grant.d.ts +72 -28
- package/src/lib/common/model/permission/permission.service.role.d.ts +15 -0
- package/src/lib/common/storage/accessor/path.model.d.ts +25 -8
- package/src/lib/common/storage/context.d.ts +23 -6
- package/src/lib/common/storage/driver/accessor.d.ts +15 -4
- package/src/lib/common/storage/driver/accessor.iterate.d.ts +31 -8
- package/src/lib/common/storage/driver/accessor.util.d.ts +13 -6
- package/src/lib/common/storage/driver/driver.d.ts +10 -1
- package/src/lib/common/storage/driver/error.d.ts +16 -0
- package/src/lib/common/storage/driver/list.d.ts +30 -0
- package/src/lib/common/storage/storage.d.ts +76 -19
- package/src/lib/common/storage/types.d.ts +23 -5
- package/src/lib/model/index.d.ts +1 -0
- package/src/lib/model/notification/notification.action.d.ts +8 -0
- package/src/lib/model/notification/notification.api.d.ts +26 -0
- package/src/lib/model/notification/notification.api.error.d.ts +15 -0
- package/src/lib/model/notification/notification.api.util.d.ts +27 -12
- package/src/lib/model/notification/notification.config.d.ts +193 -64
- package/src/lib/model/notification/notification.create.d.ts +62 -13
- package/src/lib/model/notification/notification.create.task.d.ts +25 -4
- package/src/lib/model/notification/notification.d.ts +258 -99
- package/src/lib/model/notification/notification.details.d.ts +66 -18
- package/src/lib/model/notification/notification.id.d.ts +90 -12
- package/src/lib/model/notification/notification.item.d.ts +57 -16
- package/src/lib/model/notification/notification.message.d.ts +84 -18
- package/src/lib/model/notification/notification.query.d.ts +21 -24
- package/src/lib/model/notification/notification.send.d.ts +38 -5
- package/src/lib/model/notification/notification.task.d.ts +87 -16
- package/src/lib/model/notification/notification.task.subtask.d.ts +42 -13
- package/src/lib/model/notification/notification.util.d.ts +68 -18
- package/src/lib/model/oidcmodel/index.d.ts +8 -0
- package/src/lib/model/oidcmodel/oidcmodel.action.d.ts +37 -0
- package/src/lib/model/oidcmodel/oidcmodel.api.d.ts +131 -0
- package/src/lib/model/oidcmodel/oidcmodel.d.ts +114 -0
- package/src/lib/model/oidcmodel/oidcmodel.data.d.ts +17 -0
- package/src/lib/model/oidcmodel/oidcmodel.id.d.ts +18 -0
- package/src/lib/model/oidcmodel/oidcmodel.interaction.d.ts +40 -0
- package/src/lib/model/oidcmodel/oidcmodel.interaction.oauth.d.ts +73 -0
- package/src/lib/model/oidcmodel/oidcmodel.query.d.ts +21 -0
- package/src/lib/model/storagefile/storagefile.action.d.ts +47 -0
- package/src/lib/model/storagefile/storagefile.api.d.ts +54 -4
- package/src/lib/model/storagefile/storagefile.create.d.ts +40 -3
- package/src/lib/model/storagefile/storagefile.d.ts +153 -16
- package/src/lib/model/storagefile/storagefile.file.d.ts +22 -7
- package/src/lib/model/storagefile/storagefile.group.d.ts +30 -1
- package/src/lib/model/storagefile/storagefile.group.processing.d.ts +20 -2
- package/src/lib/model/storagefile/storagefile.id.d.ts +44 -5
- package/src/lib/model/storagefile/storagefile.permission.d.ts +23 -4
- package/src/lib/model/storagefile/storagefile.query.d.ts +63 -11
- package/src/lib/model/storagefile/storagefile.task.d.ts +47 -4
- package/src/lib/model/storagefile/storagefile.upload.claims.d.ts +21 -4
- package/src/lib/model/storagefile/storagefile.upload.d.ts +41 -9
- package/src/lib/model/storagefile/storagefile.upload.determiner.d.ts +112 -20
- package/src/lib/model/storagefile/storagefile.util.d.ts +66 -3
- package/src/lib/model/system/system.action.d.ts +25 -0
- package/src/lib/model/system/system.d.ts +80 -4
- package/src/lib/model/user.d.ts +8 -2
- package/test/index.cjs.js +11168 -3295
- package/test/index.esm.js +11176 -3303
- package/test/package.json +6 -6
- package/test/src/lib/client/firebase.authorized.d.ts +18 -0
- package/test/src/lib/client/firebase.d.ts +60 -0
- package/test/src/lib/common/firebase.instance.d.ts +21 -0
- package/test/src/lib/common/firestore/firestore.d.ts +40 -0
- package/test/src/lib/common/firestore/firestore.instance.d.ts +16 -0
- package/test/src/lib/common/firestore/test.driver.accessor.d.ts +39 -2
- package/test/src/lib/common/firestore/test.driver.utility.d.ts +8 -2
- package/test/src/lib/common/firestore/test.iterator.d.ts +7 -2
- package/test/src/lib/common/mock/mock.item.collection.fixture.d.ts +29 -1
- package/test/src/lib/common/mock/mock.item.d.ts +219 -5
- package/test/src/lib/common/mock/mock.item.id.d.ts +6 -0
- package/test/src/lib/common/mock/mock.item.query.d.ts +12 -0
- package/test/src/lib/common/mock/mock.item.service.d.ts +60 -0
- package/test/src/lib/common/mock/mock.item.storage.fixture.d.ts +28 -1
- package/test/src/lib/common/storage/storage.d.ts +30 -0
- package/test/src/lib/common/storage/storage.instance.d.ts +22 -0
- package/test/src/lib/common/storage/test.driver.accessor.d.ts +7 -2
- package/index.cjs.js.map +0 -1
- package/index.esm.js.map +0 -1
|
@@ -4,10 +4,33 @@ import { type FirestoreCollection } from '../../common/firestore/collection/coll
|
|
|
4
4
|
import { type FirestoreContext } from '../../common/firestore/context';
|
|
5
5
|
import { type CollectionReference } from '../../common/firestore/types';
|
|
6
6
|
import { type ModelFieldMapFunctionsConfig } from '@dereekb/util';
|
|
7
|
+
/**
|
|
8
|
+
* @module system
|
|
9
|
+
*
|
|
10
|
+
* Defines the SystemState Firestore model for storing system-wide singleton state and settings.
|
|
11
|
+
*
|
|
12
|
+
* Each {@link SystemState} document is identified by a {@link SystemStateTypeIdentifier} and acts
|
|
13
|
+
* as a singleton for that type — storing arbitrary key-value data about the state of a system
|
|
14
|
+
* subcomponent (e.g., last migration timestamp, feature flags, processing checkpoints).
|
|
15
|
+
*
|
|
16
|
+
* Supports per-type data conversion via the `converterFactory` pattern in
|
|
17
|
+
* {@link systemStateFirestoreCollection}.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Abstract base providing access to the SystemState Firestore collection.
|
|
21
|
+
*
|
|
22
|
+
* Implement this in your app module to wire up dependency injection.
|
|
23
|
+
*/
|
|
7
24
|
export declare abstract class SystemStateFirestoreCollections {
|
|
8
25
|
abstract readonly systemStateCollection: SystemStateFirestoreCollection;
|
|
9
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Union of all SystemState-related model identity types.
|
|
29
|
+
*/
|
|
10
30
|
export type SystemStateTypes = typeof systemStateIdentity;
|
|
31
|
+
/**
|
|
32
|
+
* Model identity for the SystemState collection (collection name: `systemState`, prefix: `sys`).
|
|
33
|
+
*/
|
|
11
34
|
export declare const systemStateIdentity: import("../..").RootFirestoreModelIdentity<"systemState", "sys">;
|
|
12
35
|
/**
|
|
13
36
|
* Used to identify a SystemStateId.
|
|
@@ -22,28 +45,81 @@ export type SystemStateId = SystemStateTypeIdentifier;
|
|
|
22
45
|
*/
|
|
23
46
|
export type SystemStateStoredData = Record<string, any>;
|
|
24
47
|
/**
|
|
25
|
-
* A
|
|
48
|
+
* A singleton Firestore document storing the current state of a system subcomponent.
|
|
49
|
+
*
|
|
50
|
+
* Each document is identified by a {@link SystemStateTypeIdentifier} and stores arbitrary
|
|
51
|
+
* key-value data. Used for tracking migration progress, feature flags, processing checkpoints,
|
|
52
|
+
* or any system-wide state that needs persistence.
|
|
26
53
|
*
|
|
27
|
-
*
|
|
54
|
+
* @template T - shape of the stored data record
|
|
28
55
|
*/
|
|
29
56
|
export interface SystemState<T extends SystemStateStoredData = SystemStateStoredData> {
|
|
30
57
|
data: T;
|
|
31
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Permission roles for SystemState operations. Restricted to system administrators.
|
|
61
|
+
*/
|
|
32
62
|
export type SystemStateRoles = GrantedSysAdminRole;
|
|
33
63
|
/**
|
|
34
|
-
*
|
|
64
|
+
* Firestore document wrapper for a {@link SystemState} singleton.
|
|
65
|
+
*
|
|
66
|
+
* The document ID serves as the {@link SystemStateTypeIdentifier}, making each
|
|
67
|
+
* SystemState a singleton keyed by its type.
|
|
68
|
+
*
|
|
69
|
+
* @template T - shape of the stored data record
|
|
35
70
|
*/
|
|
36
71
|
export declare class SystemStateDocument<T extends SystemStateStoredData = SystemStateStoredData> extends AbstractFirestoreDocument<SystemState<T>, SystemStateDocument<T>, typeof systemStateIdentity> {
|
|
37
72
|
get modelIdentity(): import("../..").RootFirestoreModelIdentity<"systemState", "sys">;
|
|
38
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Default snapshot converter for {@link SystemState} documents.
|
|
76
|
+
*
|
|
77
|
+
* Uses pass-through conversion for the `data` field. Per-type converters can be
|
|
78
|
+
* supplied via the `converterFactory` in {@link systemStateFirestoreCollection}.
|
|
79
|
+
*/
|
|
39
80
|
export declare const systemStateConverter: import("../..").SnapshotConverterFunctions<SystemState<SystemStateStoredData>, Partial<import("@dereekb/util").ReplaceType<SystemState<SystemStateStoredData>, import("@dereekb/util").MaybeMap<object>, any>>>;
|
|
81
|
+
/**
|
|
82
|
+
* Returns the raw Firestore CollectionReference for the SystemState collection.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* const colRef = systemStateCollectionReference(firestoreContext);
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
40
89
|
export declare function systemStateCollectionReference(context: FirestoreContext): CollectionReference<SystemState>;
|
|
41
90
|
export type SystemStateFirestoreCollection<T extends SystemStateStoredData = SystemStateStoredData> = FirestoreCollection<SystemState<T>, SystemStateDocument<T>>;
|
|
42
91
|
/**
|
|
43
|
-
*
|
|
92
|
+
* Field conversion config for a specific SystemState data type.
|
|
93
|
+
*
|
|
94
|
+
* Maps the typed `data` field to/from Firestore using {@link ModelFieldMapFunctionsConfig}.
|
|
95
|
+
*
|
|
96
|
+
* @template T - shape of the stored data
|
|
44
97
|
*/
|
|
45
98
|
export type SystemStateStoredDataFieldConverterConfig<T extends SystemStateStoredData = SystemStateStoredData> = ModelFieldMapFunctionsConfig<T, any>;
|
|
99
|
+
/**
|
|
100
|
+
* Map of {@link SystemStateTypeIdentifier} to their data field converters.
|
|
101
|
+
*
|
|
102
|
+
* Each entry defines how a specific SystemState type's `data` field is serialized/deserialized.
|
|
103
|
+
*/
|
|
46
104
|
export type SystemStateStoredDataConverterMap = {
|
|
47
105
|
[key: string]: SystemStateStoredDataFieldConverterConfig<any>;
|
|
48
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Creates a {@link SystemStateFirestoreCollection} with per-type data converters.
|
|
109
|
+
*
|
|
110
|
+
* The `converters` map is used via a `converterFactory` that selects the appropriate
|
|
111
|
+
* converter based on the document ID (which is the {@link SystemStateTypeIdentifier}).
|
|
112
|
+
* Documents with no matching converter use the default pass-through converter.
|
|
113
|
+
*
|
|
114
|
+
* @param firestoreContext - the Firestore context
|
|
115
|
+
* @param converters - map of type identifiers to their data field converters
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* const collection = systemStateFirestoreCollection(firestoreContext, {
|
|
120
|
+
* 'migration_v2': { fields: { lastRun: firestoreDate() } }
|
|
121
|
+
* });
|
|
122
|
+
* const doc = collection.documentAccessor().loadDocumentForId('migration_v2');
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
49
125
|
export declare function systemStateFirestoreCollection(firestoreContext: FirestoreContext, converters: SystemStateStoredDataConverterMap): SystemStateFirestoreCollection;
|
package/src/lib/model/user.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { type FirebaseAuthUserIdRef } from '../common/auth/auth';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Marker interface for models that are related to a user via a `uid` field.
|
|
4
|
+
*
|
|
5
|
+
* Extends {@link FirebaseAuthUserIdRef} to carry the Firebase Auth user ID.
|
|
6
|
+
* Use this when the model stores the user ID explicitly as a field.
|
|
4
7
|
*/
|
|
5
8
|
export type UserRelated = FirebaseAuthUserIdRef;
|
|
6
9
|
/**
|
|
7
|
-
*
|
|
10
|
+
* Marker interface for models related to a user by the model's own document ID.
|
|
11
|
+
*
|
|
12
|
+
* The document ID itself is the user's Firebase Auth UID, so no separate `uid` field is needed.
|
|
13
|
+
* Use this for user-profile-style documents where the document key equals the user ID.
|
|
8
14
|
*/
|
|
9
15
|
export type UserRelatedById = object;
|