@tech4good/platform-data 0.1.0-alpha.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/BACKENDS.md +161 -0
- package/EXTRACTION-CHANGES.md +1011 -0
- package/FUTURE-WORK.md +328 -0
- package/MIGRATION.md +227 -0
- package/README.md +536 -0
- package/fesm2022/tech4good-platform-data-firestore.mjs +281 -0
- package/fesm2022/tech4good-platform-data-firestore.mjs.map +1 -0
- package/fesm2022/tech4good-platform-data-material.mjs +15 -0
- package/fesm2022/tech4good-platform-data-material.mjs.map +1 -0
- package/fesm2022/tech4good-platform-data-testing.mjs +479 -0
- package/fesm2022/tech4good-platform-data-testing.mjs.map +1 -0
- package/fesm2022/tech4good-platform-data.mjs +2190 -0
- package/fesm2022/tech4good-platform-data.mjs.map +1 -0
- package/package.json +51 -0
- package/types/tech4good-platform-data-firestore.d.ts +83 -0
- package/types/tech4good-platform-data-firestore.d.ts.map +1 -0
- package/types/tech4good-platform-data-material.d.ts +7 -0
- package/types/tech4good-platform-data-material.d.ts.map +1 -0
- package/types/tech4good-platform-data-testing.d.ts +236 -0
- package/types/tech4good-platform-data-testing.d.ts.map +1 -0
- package/types/tech4good-platform-data.d.ts +686 -0
- package/types/tech4good-platform-data.d.ts.map +1 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { Timestamp, where, orderBy, limit, startAt, startAfter, endAt, endBefore, count, sum, average, doc, collection, query, onSnapshot, getDoc, getDocs, getCountFromServer, getAggregateFromServer, serverTimestamp, setDoc, updateDoc, increment, writeBatch } from 'firebase/firestore';
|
|
2
|
+
import { dataTimestamp, isDataTimestamp, DATA_FEEDBACK, processBatchWrite, DATA_ACCESS, BATCH_WRITE_SERVICE } from '@tech4good/platform-data';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { InjectionToken, inject, Injectable, makeEnvironmentProviders } from '@angular/core';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
6
|
+
|
|
7
|
+
/** Preserve the SDK value's precision. Firestore itself persists microsecond precision. */
|
|
8
|
+
function fromFirestoreTimestamp(value) {
|
|
9
|
+
return dataTimestamp(value.seconds, value.nanoseconds);
|
|
10
|
+
}
|
|
11
|
+
/** The SDK validates its narrower supported date range. */
|
|
12
|
+
function toFirestoreTimestamp(value) {
|
|
13
|
+
if (!isDataTimestamp(value))
|
|
14
|
+
throw new TypeError('Invalid DataTimestamp.');
|
|
15
|
+
return new Timestamp(value.seconds, value.nanoseconds);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Translate timestamps recursively in arrays/plain maps only. Rebuilding SDK
|
|
19
|
+
* class instances would destroy references, GeoPoints, bytes or write sentinels,
|
|
20
|
+
* so other objects pass through untouched. The explicit marker prevents ordinary
|
|
21
|
+
* domain objects containing seconds/nanoseconds fields from being misclassified.
|
|
22
|
+
*/
|
|
23
|
+
function mapValue(value, encode) {
|
|
24
|
+
if (value instanceof Timestamp)
|
|
25
|
+
return encode ? value : fromFirestoreTimestamp(value);
|
|
26
|
+
if (value?.__type === 'DataTimestamp') {
|
|
27
|
+
if (!isDataTimestamp(value))
|
|
28
|
+
throw new TypeError('Invalid DataTimestamp.');
|
|
29
|
+
return encode ? toFirestoreTimestamp(value) : dataTimestamp(value.seconds, value.nanoseconds);
|
|
30
|
+
}
|
|
31
|
+
if (Array.isArray(value))
|
|
32
|
+
return value.map(item => mapValue(item, encode));
|
|
33
|
+
if (value && typeof value === 'object' &&
|
|
34
|
+
(Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null)) {
|
|
35
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, mapValue(item, encode)]));
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
/** DataTimestamp values become native SDK values, including query operands and cursor tuples. */
|
|
40
|
+
function encodeFirestoreData(value) { return mapValue(value, true); }
|
|
41
|
+
/** Snapshot timestamp values become shared values, including nested domain fields. */
|
|
42
|
+
function decodeFirestoreData(value) { return mapValue(value, false); }
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Firestore entry point: SDK imports and timestamp conversion stay in this
|
|
46
|
+
* adapter. Applications initialize Firebase and pass their chosen instance in.
|
|
47
|
+
*/
|
|
48
|
+
/** The app chooses the Firestore instance, project, cache, and emulator. */
|
|
49
|
+
const PLATFORM_FIRESTORE = new InjectionToken('PlatformFirestore');
|
|
50
|
+
/**
|
|
51
|
+
* Translate shared query descriptors into SDK constraints, including nested
|
|
52
|
+
* timestamps in operands/cursors. Undefined filters are omitted consistently
|
|
53
|
+
* with local queries. Backend validation and index requirements remain Firestore's.
|
|
54
|
+
*/
|
|
55
|
+
function firestoreQueryConstraints(queryParams = [], queryOptions = {}) {
|
|
56
|
+
// Convert queryParams to queryArray, as in constructQueryListRefMod.
|
|
57
|
+
// Note: Firestore supports setting and querying for null, but not undefined.
|
|
58
|
+
// We filter out cases where the value is undefined to protect against cases
|
|
59
|
+
// when people are doing a nested query and some entity does not have a
|
|
60
|
+
// particular field, e.g. [['__hashtagId', '==', q.__hashtagId]] when
|
|
61
|
+
// __hashtagId is an optional parameter. The other filters still apply.
|
|
62
|
+
const queryArray = queryParams
|
|
63
|
+
.filter((query) => query[2] !== undefined)
|
|
64
|
+
.map((query) => {
|
|
65
|
+
const [prop, comp, val] = query;
|
|
66
|
+
return where(prop, comp, encodeFirestoreData(val));
|
|
67
|
+
});
|
|
68
|
+
// Keep the three orderBy shapes explicit. Always add orderBy before cursors:
|
|
69
|
+
// Firestore rejects a cursor followed by orderBy, even if the options object's
|
|
70
|
+
// properties happen to have been written in that order.
|
|
71
|
+
if (queryOptions?.orderBy) {
|
|
72
|
+
if (Array.isArray(queryOptions.orderBy)) {
|
|
73
|
+
if (Array.isArray(queryOptions.orderBy[0])) {
|
|
74
|
+
for (const order of queryOptions.orderBy) {
|
|
75
|
+
queryArray.push(orderBy(order[0], order[1]));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
queryArray.push(orderBy(queryOptions.orderBy[0], queryOptions.orderBy[1]));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
queryArray.push(orderBy(queryOptions.orderBy));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (queryOptions?.limit !== undefined) {
|
|
87
|
+
queryArray.push(limit(queryOptions.limit));
|
|
88
|
+
}
|
|
89
|
+
// A scalar supplies one cursor value; a tuple supplies one per ordered field.
|
|
90
|
+
// Test for undefined so valid bounds such as 0 and false are retained.
|
|
91
|
+
if (queryOptions?.startAt !== undefined) {
|
|
92
|
+
const values = Array.isArray(queryOptions.startAt) ? queryOptions.startAt : [queryOptions.startAt];
|
|
93
|
+
queryArray.push(startAt(...encodeFirestoreData(values)));
|
|
94
|
+
}
|
|
95
|
+
if (queryOptions?.startAfter !== undefined) {
|
|
96
|
+
const values = Array.isArray(queryOptions.startAfter) ? queryOptions.startAfter : [queryOptions.startAfter];
|
|
97
|
+
queryArray.push(startAfter(...encodeFirestoreData(values)));
|
|
98
|
+
}
|
|
99
|
+
if (queryOptions?.endAt !== undefined) {
|
|
100
|
+
const values = Array.isArray(queryOptions.endAt) ? queryOptions.endAt : [queryOptions.endAt];
|
|
101
|
+
queryArray.push(endAt(...encodeFirestoreData(values)));
|
|
102
|
+
}
|
|
103
|
+
if (queryOptions?.endBefore !== undefined) {
|
|
104
|
+
const values = Array.isArray(queryOptions.endBefore) ? queryOptions.endBefore : [queryOptions.endBefore];
|
|
105
|
+
queryArray.push(endBefore(...encodeFirestoreData(values)));
|
|
106
|
+
}
|
|
107
|
+
return queryArray;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Translate named count/sum/average requests while preserving result aliases.
|
|
111
|
+
* For example, { countOfDocs: ['count'], totalPopulation: ['sum', 'population'],
|
|
112
|
+
* averagePopulation: ['average', 'population'] } describes three calculations;
|
|
113
|
+
* the keys name the output fields, while the tuples choose the operations.
|
|
114
|
+
*/
|
|
115
|
+
function firestoreAggregateSpec(params) {
|
|
116
|
+
const spec = {};
|
|
117
|
+
for (const [alias, [operator, field]] of Object.entries(params)) {
|
|
118
|
+
if (operator === 'count')
|
|
119
|
+
spec[alias] = count();
|
|
120
|
+
else if (operator === 'sum' && field)
|
|
121
|
+
spec[alias] = sum(field);
|
|
122
|
+
else if (operator === 'average' && field)
|
|
123
|
+
spec[alias] = average(field);
|
|
124
|
+
else
|
|
125
|
+
throw new Error(`Invalid aggregate ${alias}: ${operator}`);
|
|
126
|
+
}
|
|
127
|
+
return spec;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* DataAccess implementation using the modular Firestore SDK. Reads attach the
|
|
131
|
+
* document ID and decode timestamps recursively. Pending server timestamps use
|
|
132
|
+
* SDK estimates so local snapshot records retain usable metadata; later snapshots
|
|
133
|
+
* supply committed values. Unsubscribing from a stream detaches its SDK listener.
|
|
134
|
+
* Authentication, profile provisioning and routing remain application concerns.
|
|
135
|
+
*/
|
|
136
|
+
class FirestoreDataService {
|
|
137
|
+
dataFirestore = inject(PLATFORM_FIRESTORE);
|
|
138
|
+
createId() { return doc(collection(this.dataFirestore, '_ids')).id; }
|
|
139
|
+
dataQuery(collectionName, queryParams = [], queryOptions = {}) {
|
|
140
|
+
const collectionRef = collection(this.dataFirestore, collectionName);
|
|
141
|
+
if (queryParams.length === 0 && (!queryOptions || Object.keys(queryOptions).length === 0)) {
|
|
142
|
+
return collectionRef;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
return query(collectionRef, ...firestoreQueryConstraints(queryParams, queryOptions));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
streamEntity(collectionName, id) {
|
|
149
|
+
return new Observable(subscriber => onSnapshot(doc(this.dataFirestore, collectionName, id), {
|
|
150
|
+
next: snapshot => subscriber.next(snapshot.exists() ? { ...decodeFirestoreData(snapshot.data({ serverTimestamps: 'estimate' })), __id: snapshot.id } : null),
|
|
151
|
+
error: error => subscriber.error(error),
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
streamEntities(collectionName, params = [], options) {
|
|
155
|
+
return new Observable(subscriber => onSnapshot(this.dataQuery(collectionName, params, options), {
|
|
156
|
+
next: snapshot => subscriber.next(snapshot.docs.map(doc => ({ ...decodeFirestoreData(doc.data({ serverTimestamps: 'estimate' })), __id: doc.id }))),
|
|
157
|
+
error: error => subscriber.error(error),
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
streamEntitiesChanges(collectionName, params = [], options) {
|
|
161
|
+
return new Observable(subscriber => onSnapshot(this.dataQuery(collectionName, params, options), {
|
|
162
|
+
next: snapshot => subscriber.next(snapshot.docChanges().map(change => ({
|
|
163
|
+
type: change.type, docData: { ...decodeFirestoreData(change.doc.data({ serverTimestamps: 'estimate' })), __id: change.doc.id },
|
|
164
|
+
}))),
|
|
165
|
+
error: error => subscriber.error(error),
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
async getEntity(collectionName, id) {
|
|
169
|
+
const docRef = doc(this.dataFirestore, collectionName, id);
|
|
170
|
+
const docSnap = await getDoc(docRef);
|
|
171
|
+
if (docSnap.exists()) {
|
|
172
|
+
return { ...decodeFirestoreData(docSnap.data({ serverTimestamps: 'estimate' })), __id: docSnap.id };
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
async getEntities(collectionName, params = [], options) {
|
|
179
|
+
const snapshot = await getDocs(this.dataQuery(collectionName, params, options));
|
|
180
|
+
return snapshot.docs.map(doc => ({ ...decodeFirestoreData(doc.data({ serverTimestamps: 'estimate' })), __id: doc.id }));
|
|
181
|
+
}
|
|
182
|
+
async count(collectionName, params = [], options) {
|
|
183
|
+
return (await getCountFromServer(this.dataQuery(collectionName, params, options))).data().count;
|
|
184
|
+
}
|
|
185
|
+
async aggregate(collectionName, params, options, aggregates) {
|
|
186
|
+
return (await getAggregateFromServer(this.dataQuery(collectionName, params, options), firestoreAggregateSpec(aggregates))).data();
|
|
187
|
+
}
|
|
188
|
+
async addEntity(collectionName, entity, batch) {
|
|
189
|
+
const docRef = doc(this.dataFirestore, collectionName, entity.__id);
|
|
190
|
+
const entityFinal = encodeFirestoreData(Object.assign({}, entity, {
|
|
191
|
+
_createdAt: entity._createdAt ?? serverTimestamp(),
|
|
192
|
+
_updatedAt: serverTimestamp(),
|
|
193
|
+
_deleted: false,
|
|
194
|
+
}));
|
|
195
|
+
if (batch) {
|
|
196
|
+
return batch.set(docRef, entityFinal);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
return setDoc(docRef, entityFinal);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
async updateEntity(collectionName, id, changes, batch) {
|
|
203
|
+
const docRef = doc(this.dataFirestore, collectionName, id);
|
|
204
|
+
const changesFinal = encodeFirestoreData(Object.assign({}, changes, {
|
|
205
|
+
_updatedAt: serverTimestamp(),
|
|
206
|
+
}));
|
|
207
|
+
if (batch) {
|
|
208
|
+
return batch.update(docRef, changesFinal);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
return updateDoc(docRef, changesFinal);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
async removeEntity(collectionName, id, batch) {
|
|
215
|
+
const docRef = doc(this.dataFirestore, collectionName, id);
|
|
216
|
+
// Client-side deletion retains the record so later loads can find the marker.
|
|
217
|
+
const changes = {
|
|
218
|
+
_updatedAt: serverTimestamp(),
|
|
219
|
+
_deleted: true,
|
|
220
|
+
};
|
|
221
|
+
if (batch) {
|
|
222
|
+
return batch.update(docRef, changes);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
return updateDoc(docRef, changes);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
async incrementEntityField(collectionName, id, field, delta) {
|
|
229
|
+
return updateDoc(doc(this.dataFirestore, collectionName, id), { [field]: increment(delta), _updatedAt: serverTimestamp() });
|
|
230
|
+
}
|
|
231
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: FirestoreDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
232
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: FirestoreDataService, providedIn: 'root' });
|
|
233
|
+
}
|
|
234
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: FirestoreDataService, decorators: [{
|
|
235
|
+
type: Injectable,
|
|
236
|
+
args: [{ providedIn: 'root' }]
|
|
237
|
+
}] });
|
|
238
|
+
/** Batch callers may also queue domain timestamp values directly. */
|
|
239
|
+
function dataWriteBatch(firestore) {
|
|
240
|
+
const batch = writeBatch(firestore);
|
|
241
|
+
return {
|
|
242
|
+
set(ref, value) { batch.set(ref, encodeFirestoreData(value)); return this; },
|
|
243
|
+
update(ref, changes) { batch.update(ref, encodeFirestoreData(changes)); return this; },
|
|
244
|
+
delete(ref) { batch.delete(ref); return this; },
|
|
245
|
+
commit() { return batch.commit(); },
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
/** Creates separate forward/undo SDK batches and uses the shared write coordinator. */
|
|
249
|
+
class FirestoreBatchWriteService {
|
|
250
|
+
firestore = inject(PLATFORM_FIRESTORE);
|
|
251
|
+
feedback = inject(DATA_FEEDBACK);
|
|
252
|
+
batchWrite(fn, options) {
|
|
253
|
+
return processBatchWrite(fn, options, dataWriteBatch(this.firestore), dataWriteBatch(this.firestore), this.feedback);
|
|
254
|
+
}
|
|
255
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: FirestoreBatchWriteService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
256
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: FirestoreBatchWriteService, providedIn: 'root' });
|
|
257
|
+
}
|
|
258
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: FirestoreBatchWriteService, decorators: [{
|
|
259
|
+
type: Injectable,
|
|
260
|
+
args: [{ providedIn: 'root' }]
|
|
261
|
+
}] });
|
|
262
|
+
/**
|
|
263
|
+
* Bind core data and batch tokens to Firestore. The factory runs in an Angular
|
|
264
|
+
* injection context and must return an already-configured instance; it may inject
|
|
265
|
+
* the app's existing Firestore service. This provider does not initialize Firebase
|
|
266
|
+
* or choose a project, emulator, authentication flow or cache policy.
|
|
267
|
+
*/
|
|
268
|
+
function provideFirestoreData(firestore) {
|
|
269
|
+
return makeEnvironmentProviders([
|
|
270
|
+
{ provide: PLATFORM_FIRESTORE, useFactory: firestore },
|
|
271
|
+
{ provide: DATA_ACCESS, useExisting: FirestoreDataService },
|
|
272
|
+
{ provide: BATCH_WRITE_SERVICE, useExisting: FirestoreBatchWriteService },
|
|
273
|
+
]);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Generated bundle index. Do not edit.
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
export { FirestoreBatchWriteService as BatchWriteDBService, FirestoreBatchWriteService, FirestoreDataService, PLATFORM_FIRESTORE, decodeFirestoreData, encodeFirestoreData, firestoreAggregateSpec, firestoreQueryConstraints, fromFirestoreTimestamp, provideFirestoreData, toFirestoreTimestamp };
|
|
281
|
+
//# sourceMappingURL=tech4good-platform-data-firestore.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tech4good-platform-data-firestore.mjs","sources":["../../firestore/timestamp.ts","../../firestore/public-api.ts","../../firestore/tech4good-platform-data-firestore.ts"],"sourcesContent":["import { Timestamp } from 'firebase/firestore';\nimport { DataTimestamp, dataTimestamp, isDataTimestamp } from '@tech4good/platform-data';\n\n/** Preserve the SDK value's precision. Firestore itself persists microsecond precision. */\nexport function fromFirestoreTimestamp(value: Timestamp): DataTimestamp {\n return dataTimestamp(value.seconds, value.nanoseconds);\n}\n\n/** The SDK validates its narrower supported date range. */\nexport function toFirestoreTimestamp(value: DataTimestamp): Timestamp {\n if (!isDataTimestamp(value)) throw new TypeError('Invalid DataTimestamp.');\n return new Timestamp(value.seconds, value.nanoseconds);\n}\n\n/**\n * Translate timestamps recursively in arrays/plain maps only. Rebuilding SDK\n * class instances would destroy references, GeoPoints, bytes or write sentinels,\n * so other objects pass through untouched. The explicit marker prevents ordinary\n * domain objects containing seconds/nanoseconds fields from being misclassified.\n */\nfunction mapValue(value: any, encode: boolean): any {\n if (value instanceof Timestamp) return encode ? value : fromFirestoreTimestamp(value);\n if (value?.__type === 'DataTimestamp') {\n if (!isDataTimestamp(value)) throw new TypeError('Invalid DataTimestamp.');\n return encode ? toFirestoreTimestamp(value) : dataTimestamp(value.seconds, value.nanoseconds);\n }\n if (Array.isArray(value)) return value.map(item => mapValue(item, encode));\n if (value && typeof value === 'object' &&\n (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null)) {\n return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, mapValue(item, encode)]));\n }\n return value;\n}\n\n/** DataTimestamp values become native SDK values, including query operands and cursor tuples. */\nexport function encodeFirestoreData(value: unknown): any { return mapValue(value, true); }\n/** Snapshot timestamp values become shared values, including nested domain fields. */\nexport function decodeFirestoreData(value: unknown): any { return mapValue(value, false); }\n","/**\n * Firestore entry point: SDK imports and timestamp conversion stay in this\n * adapter. Applications initialize Firebase and pass their chosen instance in.\n */\nimport { encodeFirestoreData, decodeFirestoreData } from './timestamp';\nexport { fromFirestoreTimestamp, toFirestoreTimestamp, encodeFirestoreData, decodeFirestoreData } from './timestamp';\nimport { Injectable, InjectionToken, inject, makeEnvironmentProviders } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport {\n Firestore, QueryConstraint, WhereFilterOp, OrderByDirection, AggregateSpec,\n collection, doc, query, where, orderBy, limit, startAt, startAfter, endAt, endBefore,\n getDoc, getDocs, onSnapshot, getCountFromServer, getAggregateFromServer,\n count, sum, average, serverTimestamp, setDoc, updateDoc, increment, writeBatch,\n} from 'firebase/firestore';\nimport {\n DataAccess, DATA_ACCESS, DataEntity, NewDataEntity, QueryParams, QueryOptions, WriteBatchI,\n BATCH_WRITE_SERVICE, BatchWriteService, BatchConfig, WriteOptions, DATA_FEEDBACK, processBatchWrite,\n} from '@tech4good/platform-data';\n\n/** The app chooses the Firestore instance, project, cache, and emulator. */\nexport const PLATFORM_FIRESTORE = new InjectionToken<Firestore>('PlatformFirestore');\n\n/**\n * Translate shared query descriptors into SDK constraints, including nested\n * timestamps in operands/cursors. Undefined filters are omitted consistently\n * with local queries. Backend validation and index requirements remain Firestore's.\n */\nexport function firestoreQueryConstraints(queryParams: QueryParams = [], queryOptions: QueryOptions = {}): QueryConstraint[] {\n // Convert queryParams to queryArray, as in constructQueryListRefMod.\n // Note: Firestore supports setting and querying for null, but not undefined.\n // We filter out cases where the value is undefined to protect against cases\n // when people are doing a nested query and some entity does not have a\n // particular field, e.g. [['__hashtagId', '==', q.__hashtagId]] when\n // __hashtagId is an optional parameter. The other filters still apply.\n const queryArray: QueryConstraint[] = queryParams\n .filter((query) => query[2] !== undefined)\n .map((query) => {\n const [prop, comp, val] = query;\n return where(prop, comp as WhereFilterOp, encodeFirestoreData(val));\n });\n\n // Keep the three orderBy shapes explicit. Always add orderBy before cursors:\n // Firestore rejects a cursor followed by orderBy, even if the options object's\n // properties happen to have been written in that order.\n if (queryOptions?.orderBy) {\n if (Array.isArray(queryOptions.orderBy)) {\n if (Array.isArray(queryOptions.orderBy[0])) {\n for (const order of queryOptions.orderBy as [string, string][]) {\n queryArray.push(orderBy(order[0], order[1] as OrderByDirection));\n }\n } else {\n queryArray.push(orderBy(\n queryOptions.orderBy[0] as string,\n queryOptions.orderBy[1] as OrderByDirection,\n ));\n }\n } else {\n queryArray.push(orderBy(queryOptions.orderBy));\n }\n }\n if (queryOptions?.limit !== undefined) {\n queryArray.push(limit(queryOptions.limit));\n }\n\n // A scalar supplies one cursor value; a tuple supplies one per ordered field.\n // Test for undefined so valid bounds such as 0 and false are retained.\n if (queryOptions?.startAt !== undefined) {\n const values = Array.isArray(queryOptions.startAt) ? queryOptions.startAt : [queryOptions.startAt];\n queryArray.push(startAt(...encodeFirestoreData(values)));\n }\n if (queryOptions?.startAfter !== undefined) {\n const values = Array.isArray(queryOptions.startAfter) ? queryOptions.startAfter : [queryOptions.startAfter];\n queryArray.push(startAfter(...encodeFirestoreData(values)));\n }\n if (queryOptions?.endAt !== undefined) {\n const values = Array.isArray(queryOptions.endAt) ? queryOptions.endAt : [queryOptions.endAt];\n queryArray.push(endAt(...encodeFirestoreData(values)));\n }\n if (queryOptions?.endBefore !== undefined) {\n const values = Array.isArray(queryOptions.endBefore) ? queryOptions.endBefore : [queryOptions.endBefore];\n queryArray.push(endBefore(...encodeFirestoreData(values)));\n }\n return queryArray;\n}\n/**\n * Translate named count/sum/average requests while preserving result aliases.\n * For example, { countOfDocs: ['count'], totalPopulation: ['sum', 'population'],\n * averagePopulation: ['average', 'population'] } describes three calculations;\n * the keys name the output fields, while the tuples choose the operations.\n */\nexport function firestoreAggregateSpec(params: Record<string, [string] | [string, string]>): AggregateSpec {\n const spec: AggregateSpec = {};\n for (const [alias, [operator, field]] of Object.entries(params)) {\n if (operator === 'count') spec[alias] = count();\n else if (operator === 'sum' && field) spec[alias] = sum(field);\n else if (operator === 'average' && field) spec[alias] = average(field);\n else throw new Error(`Invalid aggregate ${alias}: ${operator}`);\n }\n return spec;\n}\n\n/**\n * DataAccess implementation using the modular Firestore SDK. Reads attach the\n * document ID and decode timestamps recursively. Pending server timestamps use\n * SDK estimates so local snapshot records retain usable metadata; later snapshots\n * supply committed values. Unsubscribing from a stream detaches its SDK listener.\n * Authentication, profile provisioning and routing remain application concerns.\n */\n@Injectable({ providedIn: 'root' })\nexport class FirestoreDataService implements DataAccess {\n protected readonly dataFirestore = inject(PLATFORM_FIRESTORE);\n createId(): string { return doc(collection(this.dataFirestore, '_ids')).id; }\n private dataQuery(collectionName: string, queryParams: QueryParams = [], queryOptions: QueryOptions = {}) {\n const collectionRef = collection(this.dataFirestore, collectionName);\n if (queryParams.length === 0 && (!queryOptions || Object.keys(queryOptions).length === 0)) {\n return collectionRef;\n } else {\n return query(collectionRef, ...firestoreQueryConstraints(queryParams, queryOptions));\n }\n }\n streamEntity<T>(collectionName: string, id: string): Observable<T | null> {\n return new Observable(subscriber => onSnapshot(doc(this.dataFirestore, collectionName, id), {\n next: snapshot => subscriber.next(snapshot.exists() ? { ...decodeFirestoreData(snapshot.data({ serverTimestamps: 'estimate' })), __id: snapshot.id } as T : null),\n error: error => subscriber.error(error),\n }));\n }\n streamEntities<T>(collectionName: string, params: QueryParams = [], options?: QueryOptions): Observable<T[]> {\n return new Observable(subscriber => onSnapshot(this.dataQuery(collectionName, params, options), {\n next: snapshot => subscriber.next(snapshot.docs.map(doc => ({ ...decodeFirestoreData(doc.data({ serverTimestamps: 'estimate' })), __id: doc.id }) as T)),\n error: error => subscriber.error(error),\n }));\n }\n streamEntitiesChanges<T>(collectionName: string, params: QueryParams = [], options?: QueryOptions): Observable<{ type: string; docData: T }[]> {\n return new Observable(subscriber => onSnapshot(this.dataQuery(collectionName, params, options), {\n next: snapshot => subscriber.next(snapshot.docChanges().map(change => ({\n type: change.type, docData: { ...decodeFirestoreData(change.doc.data({ serverTimestamps: 'estimate' })), __id: change.doc.id } as T,\n }))),\n error: error => subscriber.error(error),\n }));\n }\n async getEntity<T>(collectionName: string, id: string): Promise<T | null> {\n const docRef = doc(this.dataFirestore, collectionName, id);\n const docSnap = await getDoc(docRef);\n if (docSnap.exists()) {\n return { ...decodeFirestoreData(docSnap.data({ serverTimestamps: 'estimate' })), __id: docSnap.id } as T;\n } else {\n return null;\n }\n }\n async getEntities<T>(collectionName: string, params: QueryParams = [], options?: QueryOptions): Promise<T[]> {\n const snapshot = await getDocs(this.dataQuery(collectionName, params, options));\n return snapshot.docs.map(doc => ({ ...decodeFirestoreData(doc.data({ serverTimestamps: 'estimate' })), __id: doc.id }) as T);\n }\n async count(collectionName: string, params: QueryParams = [], options?: QueryOptions): Promise<number> {\n return (await getCountFromServer(this.dataQuery(collectionName, params, options))).data().count;\n }\n async aggregate<S extends Record<string, number>>(collectionName: string, params: QueryParams, options: QueryOptions,\n aggregates: { [K in keyof S]: [string] | [string, string] }): Promise<{ [K in keyof S]: number | null }> {\n return (await getAggregateFromServer(this.dataQuery(collectionName, params, options), firestoreAggregateSpec(aggregates))).data() as { [K in keyof S]: number };\n }\n async addEntity<T extends NewDataEntity & { __id: string }>(collectionName: string, entity: T, batch?: WriteBatchI) {\n const docRef = doc(this.dataFirestore, collectionName, entity.__id);\n const entityFinal = encodeFirestoreData(Object.assign({}, entity, {\n _createdAt: entity._createdAt ?? serverTimestamp(),\n _updatedAt: serverTimestamp(),\n _deleted: false,\n }));\n if (batch) {\n return batch.set(docRef, entityFinal);\n } else {\n return setDoc(docRef, entityFinal);\n }\n }\n async updateEntity<T extends object>(collectionName: string, id: string, changes: Partial<T>, batch?: WriteBatchI) {\n const docRef = doc(this.dataFirestore, collectionName, id);\n const changesFinal = encodeFirestoreData(Object.assign({}, changes, {\n _updatedAt: serverTimestamp(),\n }));\n if (batch) {\n return batch.update(docRef, changesFinal);\n } else {\n return updateDoc(docRef, changesFinal);\n }\n }\n async removeEntity(collectionName: string, id: string, batch?: WriteBatchI) {\n const docRef = doc(this.dataFirestore, collectionName, id);\n // Client-side deletion retains the record so later loads can find the marker.\n const changes = {\n _updatedAt: serverTimestamp(),\n _deleted: true,\n };\n if (batch) {\n return batch.update(docRef, changes);\n } else {\n return updateDoc(docRef, changes);\n }\n }\n async incrementEntityField(collectionName: string, id: string, field: string, delta: number): Promise<void> {\n return updateDoc(doc(this.dataFirestore, collectionName, id), { [field]: increment(delta), _updatedAt: serverTimestamp() });\n }\n}\n\n/** Batch callers may also queue domain timestamp values directly. */\nfunction dataWriteBatch(firestore: Firestore): WriteBatchI {\n const batch = writeBatch(firestore);\n return {\n set(ref, value) { batch.set(ref, encodeFirestoreData(value)); return this; },\n update(ref, changes) { batch.update(ref, encodeFirestoreData(changes)); return this; },\n delete(ref) { batch.delete(ref); return this; },\n commit() { return batch.commit(); },\n };\n}\n\n/** Creates separate forward/undo SDK batches and uses the shared write coordinator. */\n@Injectable({ providedIn: 'root' })\nexport class FirestoreBatchWriteService implements BatchWriteService {\n private readonly firestore = inject(PLATFORM_FIRESTORE);\n private readonly feedback = inject(DATA_FEEDBACK);\n batchWrite(fn: (config: BatchConfig) => void | Promise<unknown>, options?: WriteOptions): Promise<void> {\n return processBatchWrite(fn, options, dataWriteBatch(this.firestore), dataWriteBatch(this.firestore), this.feedback);\n }\n}\nexport { FirestoreBatchWriteService as BatchWriteDBService };\n/**\n * Bind core data and batch tokens to Firestore. The factory runs in an Angular\n * injection context and must return an already-configured instance; it may inject\n * the app's existing Firestore service. This provider does not initialize Firebase\n * or choose a project, emulator, authentication flow or cache policy.\n */\nexport function provideFirestoreData(firestore: () => Firestore) {\n return makeEnvironmentProviders([\n { provide: PLATFORM_FIRESTORE, useFactory: firestore },\n { provide: DATA_ACCESS, useExisting: FirestoreDataService },\n { provide: BATCH_WRITE_SERVICE, useExisting: FirestoreBatchWriteService },\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAGA;AACM,SAAU,sBAAsB,CAAC,KAAgB,EAAA;IACrD,OAAO,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC;AACxD;AAEA;AACM,SAAU,oBAAoB,CAAC,KAAoB,EAAA;AACvD,IAAA,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;AAAE,QAAA,MAAM,IAAI,SAAS,CAAC,wBAAwB,CAAC;IAC1E,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK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EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAA1B,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0BAA0B,cADb,MAAM,EAAA,CAAA;;4FACnB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;AASlC;;;;;AAKG;AACG,SAAU,oBAAoB,CAAC,SAA0B,EAAA;AAC7D,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA,EAAE,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,SAAS,EAAE;AACtD,QAAA,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,oBAAoB,EAAE;AAC3D,QAAA,EAAE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,0BAA0B,EAAE;AAC1E,KAAA,CAAC;AACJ;;AC3OA;;AAEG;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { makeEnvironmentProviders } from '@angular/core';
|
|
2
|
+
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
3
|
+
import { DATA_FEEDBACK } from '@tech4good/platform-data';
|
|
4
|
+
|
|
5
|
+
/** Opt in to the application's Material snackbar service for write feedback and undo. */
|
|
6
|
+
function provideMaterialDataFeedback() {
|
|
7
|
+
return makeEnvironmentProviders([{ provide: DATA_FEEDBACK, useExisting: MatSnackBar }]);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Generated bundle index. Do not edit.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export { provideMaterialDataFeedback };
|
|
15
|
+
//# sourceMappingURL=tech4good-platform-data-material.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tech4good-platform-data-material.mjs","sources":["../../material/public-api.ts","../../material/tech4good-platform-data-material.ts"],"sourcesContent":["import { makeEnvironmentProviders } from '@angular/core';\nimport { MatSnackBar } from '@angular/material/snack-bar';\nimport { DATA_FEEDBACK } from '@tech4good/platform-data';\n\n/** Opt in to the application's Material snackbar service for write feedback and undo. */\nexport function provideMaterialDataFeedback() {\n return makeEnvironmentProviders([{ provide: DATA_FEEDBACK, useExisting: MatSnackBar }]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAIA;SACgB,2BAA2B,GAAA;AACzC,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;AACzF;;ACPA;;AAEG;;"}
|