@dereekb/firebase 13.4.1 → 13.4.2
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 +892 -385
- package/index.esm.js +892 -385
- package/package.json +5 -5
- package/src/lib/client/error/error.d.ts +1 -1
- package/src/lib/client/firestore/driver.accessor.batch.d.ts +2 -0
- package/src/lib/client/firestore/driver.accessor.create.d.ts +1 -0
- package/src/lib/client/firestore/driver.accessor.d.ts +2 -0
- package/src/lib/client/firestore/driver.accessor.default.d.ts +4 -0
- package/src/lib/client/firestore/driver.accessor.transaction.d.ts +2 -0
- package/src/lib/client/firestore/driver.d.ts +2 -0
- package/src/lib/client/firestore/driver.query.d.ts +5 -0
- package/src/lib/client/function/development.function.factory.d.ts +1 -0
- package/src/lib/client/function/error.d.ts +1 -0
- package/src/lib/client/function/function.callable.d.ts +9 -2
- package/src/lib/client/function/function.factory.d.ts +2 -0
- package/src/lib/client/function/model.function.factory.d.ts +11 -4
- package/src/lib/client/storage/driver.accessor.d.ts +7 -0
- package/src/lib/client/storage/driver.d.ts +2 -0
- package/src/lib/common/auth/auth.error.d.ts +22 -7
- package/src/lib/common/development/function.d.ts +1 -0
- package/src/lib/common/development/function.schedule.d.ts +3 -1
- package/src/lib/common/firestore/accessor/accessor.wrap.modify.d.ts +9 -0
- package/src/lib/common/firestore/accessor/context.d.ts +9 -3
- package/src/lib/common/firestore/accessor/document.d.ts +49 -7
- package/src/lib/common/firestore/accessor/document.utility.d.ts +18 -6
- package/src/lib/common/firestore/collection/collection.d.ts +76 -11
- package/src/lib/common/firestore/driver/query.handler.d.ts +9 -3
- package/src/lib/common/firestore/snapshot/snapshot.field.d.ts +32 -1
- package/src/lib/common/model/function.d.ts +8 -3
- package/src/lib/common/model/model/model.loader.d.ts +1 -0
- package/src/lib/common/model/model.service.d.ts +9 -2
- package/src/lib/common/model/permission/permission.d.ts +12 -4
- package/src/lib/common/model/permission/permission.service.d.ts +1 -0
- package/src/lib/common/model/permission/permission.service.grant.d.ts +10 -0
- package/src/lib/common/model/permission/permission.service.role.d.ts +9 -7
- package/src/lib/common/storage/accessor/path.model.d.ts +1 -0
- package/src/lib/common/storage/context.d.ts +1 -0
- package/src/lib/common/storage/driver/accessor.iterate.d.ts +7 -0
- package/src/lib/common/storage/driver/accessor.util.d.ts +1 -0
- package/src/lib/common/storage/driver/error.d.ts +3 -0
- package/src/lib/common/storage/driver/list.d.ts +18 -3
- package/src/lib/common/storage/storage.d.ts +4 -0
- package/src/lib/common/storage/types.d.ts +3 -0
- package/src/lib/model/notification/notification.api.error.d.ts +27 -9
- package/src/lib/model/notification/notification.api.util.d.ts +12 -0
- package/src/lib/model/notification/notification.config.d.ts +28 -0
- package/src/lib/model/notification/notification.create.d.ts +24 -0
- package/src/lib/model/notification/notification.create.task.d.ts +2 -0
- package/src/lib/model/notification/notification.d.ts +42 -0
- package/src/lib/model/notification/notification.details.d.ts +3 -0
- package/src/lib/model/notification/notification.id.d.ts +4 -3
- package/src/lib/model/notification/notification.item.d.ts +2 -1
- package/src/lib/model/notification/notification.message.d.ts +6 -3
- package/src/lib/model/notification/notification.query.d.ts +12 -0
- package/src/lib/model/notification/notification.send.d.ts +4 -0
- package/src/lib/model/notification/notification.task.d.ts +7 -0
- package/src/lib/model/notification/notification.task.subtask.d.ts +5 -0
- package/src/lib/model/notification/notification.util.d.ts +38 -0
- package/src/lib/model/oidcmodel/oidcmodel.d.ts +6 -0
- package/src/lib/model/oidcmodel/oidcmodel.query.d.ts +18 -0
- package/src/lib/model/storagefile/storagefile.create.d.ts +4 -0
- package/src/lib/model/storagefile/storagefile.d.ts +16 -0
- package/src/lib/model/storagefile/storagefile.file.d.ts +2 -0
- package/src/lib/model/storagefile/storagefile.group.d.ts +4 -0
- package/src/lib/model/storagefile/storagefile.permission.d.ts +1 -0
- package/src/lib/model/storagefile/storagefile.query.d.ts +19 -0
- package/src/lib/model/storagefile/storagefile.task.d.ts +1 -0
- package/src/lib/model/storagefile/storagefile.upload.d.ts +6 -0
- package/src/lib/model/storagefile/storagefile.upload.determiner.d.ts +9 -0
- package/src/lib/model/storagefile/storagefile.util.d.ts +4 -0
- package/src/lib/model/system/system.d.ts +4 -0
- package/test/package.json +6 -6
package/index.esm.js
CHANGED
|
@@ -439,13 +439,15 @@ function _is_native_reflect_construct$9() {
|
|
|
439
439
|
*/ function copyDocumentIdToFieldModifierFunction(fieldName) {
|
|
440
440
|
return function(param) {
|
|
441
441
|
var data = param.data, documentRef = param.documentRef;
|
|
442
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
443
442
|
data[fieldName] = documentRef.id; // copy the id to the target field
|
|
444
443
|
};
|
|
445
444
|
}
|
|
446
445
|
/**
|
|
447
446
|
* Creates an {@link InterceptAccessorFactoryFunction} that wraps all created accessors with
|
|
448
447
|
* {@link ModifyBeforeSetFirestoreDocumentDataAccessorWrapper} using the provided config.
|
|
448
|
+
*
|
|
449
|
+
* @param config - The ModifyBeforeSetConfig defining when and how to modify documents
|
|
450
|
+
* @returns An InterceptAccessorFactoryFunction that wraps accessors with the modify-before-set behavior
|
|
449
451
|
*/ function modifyBeforeSetInterceptAccessorFactoryFunction(config) {
|
|
450
452
|
return interceptAccessorFactoryFunction(function(accessor) {
|
|
451
453
|
return new ModifyBeforeSetFirestoreDocumentDataAccessorWrapper(accessor, config);
|
|
@@ -454,12 +456,16 @@ function _is_native_reflect_construct$9() {
|
|
|
454
456
|
// MARK: Templates
|
|
455
457
|
/**
|
|
456
458
|
* Creates a modifier that copies the document ID to the `uid` field for {@link UserRelated} models.
|
|
459
|
+
*
|
|
460
|
+
* @returns A ModifyBeforeSetModifierFunction that sets the `uid` field to the document's ID
|
|
457
461
|
*/ function copyDocumentIdForUserRelatedModifierFunction() {
|
|
458
462
|
return copyDocumentIdToFieldModifierFunction('uid');
|
|
459
463
|
}
|
|
460
464
|
/**
|
|
461
465
|
* Returns a pre-configured {@link ModifyBeforeSetConfig} for {@link UserRelated} models
|
|
462
466
|
* that copies the document ID to the `uid` field on set operations (new document creation).
|
|
467
|
+
*
|
|
468
|
+
* @returns A ModifyBeforeSetConfig configured to copy the document ID to the `uid` field on set
|
|
463
469
|
*/ function copyUserRelatedDataModifierConfig() {
|
|
464
470
|
return {
|
|
465
471
|
when: 'set',
|
|
@@ -474,6 +480,8 @@ function _is_native_reflect_construct$9() {
|
|
|
474
480
|
/**
|
|
475
481
|
* Returns a typed {@link InterceptAccessorFactoryFunction} that applies the UserRelated
|
|
476
482
|
* document ID copy modifier to all accessors created by the factory.
|
|
483
|
+
*
|
|
484
|
+
* @returns A typed InterceptAccessorFactoryFunction with the UserRelated document ID copy modifier applied
|
|
477
485
|
*/ function copyUserRelatedDataAccessorFactoryFunction() {
|
|
478
486
|
return COPY_USER_RELATED_DATA_ACCESSOR_FACTORY_FUNCTION();
|
|
479
487
|
}
|
|
@@ -711,9 +719,15 @@ function _ts_generator$k(thisArg, body) {
|
|
|
711
719
|
* - BATCH: Operations within a Firestore write batch (atomic writes only, no reads)
|
|
712
720
|
*/ var FirestoreDocumentContextType;
|
|
713
721
|
(function(FirestoreDocumentContextType) {
|
|
714
|
-
/**
|
|
715
|
-
|
|
716
|
-
|
|
722
|
+
/**
|
|
723
|
+
* Standard context with no special transactional semantics
|
|
724
|
+
*/ FirestoreDocumentContextType["NONE"] = "none";
|
|
725
|
+
/**
|
|
726
|
+
* Operations within a Firestore transaction (atomic reads and writes)
|
|
727
|
+
*/ FirestoreDocumentContextType["TRANSACTION"] = "transaction";
|
|
728
|
+
/**
|
|
729
|
+
* Operations within a Firestore write batch (atomic writes only)
|
|
730
|
+
*/ FirestoreDocumentContextType["BATCH"] = "batch";
|
|
717
731
|
})(FirestoreDocumentContextType || (FirestoreDocumentContextType = {}));
|
|
718
732
|
|
|
719
733
|
function asyncGeneratorStep$j(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -1210,7 +1224,8 @@ function _is_native_reflect_construct$8() {
|
|
|
1210
1224
|
/**
|
|
1211
1225
|
* Retrieves a DocumentSnapshot of the document as an Observable. Streams based on the input mode.
|
|
1212
1226
|
*
|
|
1213
|
-
* @
|
|
1227
|
+
* @param mode - The stream mode controlling how the Observable emits snapshot updates
|
|
1228
|
+
* @returns An Observable that emits DocumentSnapshot values based on the given mode
|
|
1214
1229
|
*/ key: "snapshotStream",
|
|
1215
1230
|
value: function snapshotStream(mode) {
|
|
1216
1231
|
return snapshotStreamForAccessor(this.accessor, mode);
|
|
@@ -1220,8 +1235,9 @@ function _is_native_reflect_construct$8() {
|
|
|
1220
1235
|
/**
|
|
1221
1236
|
* Retrieves the data of the DocumentSnapshot of the document as an Observable. Streams based on the input mode.
|
|
1222
1237
|
*
|
|
1223
|
-
* @param
|
|
1224
|
-
* @
|
|
1238
|
+
* @param mode - The stream mode controlling how the Observable emits snapshot data updates
|
|
1239
|
+
* @param options - Optional SnapshotOptions for reading the document data
|
|
1240
|
+
* @returns An Observable that emits the document data or undefined based on the given mode
|
|
1225
1241
|
*/ key: "snapshotDataStream",
|
|
1226
1242
|
value: function snapshotDataStream(mode, options) {
|
|
1227
1243
|
return snapshotStreamDataForAccessor(this.accessor, mode, options);
|
|
@@ -1230,6 +1246,7 @@ function _is_native_reflect_construct$8() {
|
|
|
1230
1246
|
{
|
|
1231
1247
|
/**
|
|
1232
1248
|
* Retrieves a DocumentSnapshot of the document.
|
|
1249
|
+
*
|
|
1233
1250
|
* @returns
|
|
1234
1251
|
*/ key: "snapshot",
|
|
1235
1252
|
value: function snapshot() {
|
|
@@ -1239,6 +1256,7 @@ function _is_native_reflect_construct$8() {
|
|
|
1239
1256
|
{
|
|
1240
1257
|
/**
|
|
1241
1258
|
* Retrieves the data of the DocumentSnapshot of the document.
|
|
1259
|
+
*
|
|
1242
1260
|
* @param options
|
|
1243
1261
|
* @returns
|
|
1244
1262
|
*/ key: "snapshotData",
|
|
@@ -1278,8 +1296,9 @@ function _is_native_reflect_construct$8() {
|
|
|
1278
1296
|
*
|
|
1279
1297
|
* Throws an exception when it does not exist.
|
|
1280
1298
|
*
|
|
1281
|
-
* @param data
|
|
1282
|
-
* @
|
|
1299
|
+
* @param data - Partial document data to update
|
|
1300
|
+
* @param params - Optional update parameters
|
|
1301
|
+
* @returns A Promise that resolves when the update completes
|
|
1283
1302
|
*/ key: "update",
|
|
1284
1303
|
value: function update(data, params) {
|
|
1285
1304
|
return updateWithAccessorUpdateAndConverterFunction(this.accessor, this.converter)(data, params);
|
|
@@ -1289,7 +1308,8 @@ function _is_native_reflect_construct$8() {
|
|
|
1289
1308
|
/**
|
|
1290
1309
|
* Updates the document using the accessor's increment functionality.
|
|
1291
1310
|
*
|
|
1292
|
-
* @param data
|
|
1311
|
+
* @param data - The increment update to apply to numeric fields
|
|
1312
|
+
* @returns A Promise that resolves when the increment update completes
|
|
1293
1313
|
*/ key: "increment",
|
|
1294
1314
|
value: function increment(data) {
|
|
1295
1315
|
return incrementUpdateWithAccessorFunction(this.accessor)(data);
|
|
@@ -1299,7 +1319,8 @@ function _is_native_reflect_construct$8() {
|
|
|
1299
1319
|
/**
|
|
1300
1320
|
* Updates the document using the accessor's array field update functionality.
|
|
1301
1321
|
*
|
|
1302
|
-
* @param data
|
|
1322
|
+
* @param data - The array field update to apply (union or remove elements)
|
|
1323
|
+
* @returns A Promise that resolves when the array update completes
|
|
1303
1324
|
*/ key: "arrayUpdate",
|
|
1304
1325
|
value: function arrayUpdate(data) {
|
|
1305
1326
|
return arrayUpdateWithAccessorFunction(this.accessor)(data);
|
|
@@ -1308,7 +1329,12 @@ function _is_native_reflect_construct$8() {
|
|
|
1308
1329
|
]);
|
|
1309
1330
|
return AbstractFirestoreDocument;
|
|
1310
1331
|
}();
|
|
1311
|
-
|
|
1332
|
+
/**
|
|
1333
|
+
* Creates a {@link LimitedFirestoreDocumentAccessorFactoryFunction} from the provided configuration.
|
|
1334
|
+
*
|
|
1335
|
+
* @param config - Configuration including converter, accessor factory, and document factory
|
|
1336
|
+
* @returns A factory function for creating LimitedFirestoreDocumentAccessor instances
|
|
1337
|
+
*/ function limitedFirestoreDocumentAccessorFactory(config) {
|
|
1312
1338
|
var firestoreContext = config.firestoreContext, firestoreAccessorDriver = config.firestoreAccessorDriver, makeDocument = config.makeDocument, interceptAccessorFactory = config.accessorFactory, inputDefaultConverter = config.converter, inputConverterFactory = config.converterFactory, modelIdentity = config.modelIdentity;
|
|
1313
1339
|
var expectedCollectionName = firestoreAccessorDriver.fuzzedPathForPath ? firestoreAccessorDriver.fuzzedPathForPath(modelIdentity.collectionName) : modelIdentity.collectionName;
|
|
1314
1340
|
var converterFactory = inputConverterFactory ? function(ref) {
|
|
@@ -1319,9 +1345,6 @@ function limitedFirestoreDocumentAccessorFactory(config) {
|
|
|
1319
1345
|
};
|
|
1320
1346
|
var result = function result(context) {
|
|
1321
1347
|
var loadDocument = function loadDocument(ref) {
|
|
1322
|
-
if (!ref) {
|
|
1323
|
-
throw new Error('ref must be defined.');
|
|
1324
|
-
}
|
|
1325
1348
|
var converter = converterFactory(ref);
|
|
1326
1349
|
var accessor = dataAccessorFactory.accessorFor(ref.withConverter(converter));
|
|
1327
1350
|
return makeDocument(accessor, documentAccessor);
|
|
@@ -1359,7 +1382,15 @@ function limitedFirestoreDocumentAccessorFactory(config) {
|
|
|
1359
1382
|
result.converterFactory = converterFactory;
|
|
1360
1383
|
return result;
|
|
1361
1384
|
}
|
|
1362
|
-
|
|
1385
|
+
/**
|
|
1386
|
+
* Creates a {@link FirestoreDocumentAccessorFactoryFunction} from the provided configuration.
|
|
1387
|
+
*
|
|
1388
|
+
* Extends the limited accessor factory with collection-level operations such as creating new documents
|
|
1389
|
+
* and loading documents by ID.
|
|
1390
|
+
*
|
|
1391
|
+
* @param config - Configuration including the collection reference and document factory
|
|
1392
|
+
* @returns A factory function for creating FirestoreDocumentAccessor instances
|
|
1393
|
+
*/ function firestoreDocumentAccessorFactory(config) {
|
|
1363
1394
|
var firestoreAccessorDriver = config.firestoreAccessorDriver, collection = config.collection;
|
|
1364
1395
|
var limitedFirestoreDocumentAccessor = limitedFirestoreDocumentAccessorFactory(config);
|
|
1365
1396
|
function documentRefForId(path) {
|
|
@@ -1423,7 +1454,12 @@ var AbstractFirestoreDocumentWithParent = /*#__PURE__*/ function(AbstractFiresto
|
|
|
1423
1454
|
]);
|
|
1424
1455
|
return AbstractFirestoreDocumentWithParent;
|
|
1425
1456
|
}(AbstractFirestoreDocument);
|
|
1426
|
-
|
|
1457
|
+
/**
|
|
1458
|
+
* Creates a {@link FirestoreSingleDocumentAccessor} for a collection that contains a single known document.
|
|
1459
|
+
*
|
|
1460
|
+
* @param config - Configuration specifying the single item identifier and the document accessor context extension
|
|
1461
|
+
* @returns A FirestoreSingleDocumentAccessor providing convenient access to the single document
|
|
1462
|
+
*/ function firestoreSingleDocumentAccessor(config) {
|
|
1427
1463
|
var singleItemIdentifier = config.singleItemIdentifier, accessors = config.accessors;
|
|
1428
1464
|
var defaultAccessor = accessors.documentAccessor();
|
|
1429
1465
|
return {
|
|
@@ -1445,10 +1481,15 @@ function firestoreSingleDocumentAccessor(config) {
|
|
|
1445
1481
|
/**
|
|
1446
1482
|
* Default document ID used for single-document collections. The document is stored at path `<collection>/0`.
|
|
1447
1483
|
*/ var DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER = '0';
|
|
1448
|
-
|
|
1484
|
+
/**
|
|
1485
|
+
* Extends a Firestore collection object in-place with single-document accessor methods.
|
|
1486
|
+
*
|
|
1487
|
+
* @param x - The collection object to extend with single-document accessor methods
|
|
1488
|
+
* @param singleItemIdentifier - Optional identifier for the single document; defaults to {@link DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER}
|
|
1489
|
+
*/ function extendFirestoreCollectionWithSingleDocumentAccessor(x, singleItemIdentifier) {
|
|
1449
1490
|
var singleAccessor = firestoreSingleDocumentAccessor({
|
|
1450
1491
|
accessors: x,
|
|
1451
|
-
singleItemIdentifier: singleItemIdentifier
|
|
1492
|
+
singleItemIdentifier: singleItemIdentifier !== null && singleItemIdentifier !== void 0 ? singleItemIdentifier : DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER
|
|
1452
1493
|
});
|
|
1453
1494
|
x.singleItemIdentifier = singleAccessor.singleItemIdentifier;
|
|
1454
1495
|
x.documentRef = singleAccessor.documentRef;
|
|
@@ -1927,8 +1968,7 @@ function getDataFromDocumentSnapshots(snapshots) {
|
|
|
1927
1968
|
*/ var firestoreQueryDocumentSnapshotPairsLoader = firestoreDocumentSnapshotPairsLoader;
|
|
1928
1969
|
function documentData(snapshot) {
|
|
1929
1970
|
var withId = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
1930
|
-
|
|
1931
|
-
return result;
|
|
1971
|
+
return withId ? documentDataWithIdAndKey(snapshot) : snapshot.data();
|
|
1932
1972
|
}
|
|
1933
1973
|
function documentDataFunction(withId) {
|
|
1934
1974
|
return withId ? documentDataWithIdAndKey : function(snapshot) {
|
|
@@ -2445,12 +2485,20 @@ function _object_spread_props$j(target, source) {
|
|
|
2445
2485
|
/**
|
|
2446
2486
|
* Implementation of FirestoreDataConverter.fromFirestore
|
|
2447
2487
|
* Converts Firestore data to the application model type
|
|
2488
|
+
*
|
|
2489
|
+
* @param snapshot - The DocumentSnapshot containing raw Firestore data
|
|
2490
|
+
* @param options - Optional SnapshotOptions for reading data
|
|
2491
|
+
* @returns The converted application model instance
|
|
2448
2492
|
*/ fromFirestore: function fromFirestore(snapshot, options) {
|
|
2449
2493
|
return from(snapshot, undefined);
|
|
2450
2494
|
},
|
|
2451
2495
|
/**
|
|
2452
2496
|
* Implementation of FirestoreDataConverter.toFirestore
|
|
2453
2497
|
* Converts the application model to Firestore data format
|
|
2498
|
+
*
|
|
2499
|
+
* @param modelObject - The model object to convert to Firestore data
|
|
2500
|
+
* @param options - Optional SetOptions controlling how data is written
|
|
2501
|
+
* @returns The converted Firestore data object
|
|
2454
2502
|
*/ toFirestore: function toFirestore(modelObject, options) {
|
|
2455
2503
|
return to(modelObject, undefined, options);
|
|
2456
2504
|
}
|
|
@@ -2576,7 +2624,7 @@ function _object_spread_props$i(target, source) {
|
|
|
2576
2624
|
function optionalFirestoreField(config) {
|
|
2577
2625
|
// NOTE: Typings for this function internally is weird due to the support for both the one and two type transforms.
|
|
2578
2626
|
if (config) {
|
|
2579
|
-
var inputConfig = config
|
|
2627
|
+
var inputConfig = config;
|
|
2580
2628
|
var dontStoreDefaultReadValue = inputConfig.dontStoreDefaultReadValue, inputDontStoreValueIf = inputConfig.dontStoreValueIf, inputTransformData = inputConfig.transformData; // might be defined.
|
|
2581
2629
|
var inputDefaultReadValue = inputConfig.defaultReadValue, inputDontStoreIf = inputConfig.dontStoreIf, transformFromData = inputConfig.transformFromData, transformToData = inputConfig.transformToData;
|
|
2582
2630
|
var transformData = inputTransformData !== null && inputTransformData !== void 0 ? inputTransformData : passThrough;
|
|
@@ -2624,8 +2672,7 @@ function optionalFirestoreField(config) {
|
|
|
2624
2672
|
toData = function toData(x) {
|
|
2625
2673
|
if (x != null) {
|
|
2626
2674
|
var transformedValue = transformTo(x);
|
|
2627
|
-
|
|
2628
|
-
return finalValue;
|
|
2675
|
+
return transformedValue != null && !dontStoreValue(transformedValue) ? transformedValue : null;
|
|
2629
2676
|
} else {
|
|
2630
2677
|
return x;
|
|
2631
2678
|
}
|
|
@@ -2957,8 +3004,7 @@ function optionalFirestoreField(config) {
|
|
|
2957
3004
|
}
|
|
2958
3005
|
var inputFilterUnique = (config === null || config === void 0 ? void 0 : config.filterUnique) === true ? unique : config === null || config === void 0 ? void 0 : config.filterUnique;
|
|
2959
3006
|
var filterUniqueValuesFn = inputFilterUnique != null ? function(x) {
|
|
2960
|
-
|
|
2961
|
-
return result;
|
|
3007
|
+
return inputFilterUnique(x);
|
|
2962
3008
|
} : undefined;
|
|
2963
3009
|
var inputTransformData = config === null || config === void 0 ? void 0 : config.transformData;
|
|
2964
3010
|
var sortArrayFn = isMapIdentityFunction(sortFn) ? undefined : function(x) {
|
|
@@ -3048,7 +3094,8 @@ function optionalFirestoreField(config) {
|
|
|
3048
3094
|
* @template S - Number type (defaults to number)
|
|
3049
3095
|
* @param config - Configuration for the unique number array field
|
|
3050
3096
|
* @returns A field mapping configuration for unique number array values
|
|
3051
|
-
*/
|
|
3097
|
+
*/ // eslint-disable-next-line sonarjs/no-identical-functions -- intentionally separate for distinct type constraints (number vs string|number)
|
|
3098
|
+
function firestoreUniqueNumberArray(config) {
|
|
3052
3099
|
return firestoreUniqueArray(_object_spread_props$i(_object_spread$m({}, config), {
|
|
3053
3100
|
filterUnique: unique
|
|
3054
3101
|
}));
|
|
@@ -3166,6 +3213,8 @@ function optionalFirestoreField(config) {
|
|
|
3166
3213
|
* FirestoreField configuration for a map of granted roles, keyed by model keys.
|
|
3167
3214
|
*
|
|
3168
3215
|
* Filters out models with no/null roles by default.
|
|
3216
|
+
*
|
|
3217
|
+
* @returns A field mapping configuration for a map of granted roles keyed by FirestoreModelKey
|
|
3169
3218
|
*/ function firestoreModelKeyGrantedRoleMap() {
|
|
3170
3219
|
return firestoreMap({
|
|
3171
3220
|
mapFilter: KeyValueTypleValueFilter.EMPTY
|
|
@@ -3200,13 +3249,11 @@ function optionalFirestoreField(config) {
|
|
|
3200
3249
|
},
|
|
3201
3250
|
fromData: function fromData(input) {
|
|
3202
3251
|
var copy = copyObject(input);
|
|
3203
|
-
|
|
3204
|
-
return result;
|
|
3252
|
+
return mapObjectMap(copy, decoder);
|
|
3205
3253
|
},
|
|
3206
3254
|
toData: function toData(input) {
|
|
3207
3255
|
var encodedMap = mapObjectMap(input, encoder);
|
|
3208
|
-
|
|
3209
|
-
return result;
|
|
3256
|
+
return filterFinalMapValuesFn(encodedMap);
|
|
3210
3257
|
}
|
|
3211
3258
|
});
|
|
3212
3259
|
}
|
|
@@ -3232,6 +3279,9 @@ function optionalFirestoreField(config) {
|
|
|
3232
3279
|
* FirestoreField configuration for a map of encoded granted roles, keyed by model keys.
|
|
3233
3280
|
*
|
|
3234
3281
|
* Filters out models with empty/no roles by default.
|
|
3282
|
+
*
|
|
3283
|
+
* @param dencoder - The dencoder function used to encode and decode the role values
|
|
3284
|
+
* @returns A field mapping configuration for an encoded granted role map keyed by FirestoreModelKey
|
|
3235
3285
|
*/ function firestoreModelKeyEncodedGrantedRoleMap(dencoder) {
|
|
3236
3286
|
return firestoreDencoderMap({
|
|
3237
3287
|
dencoder: dencoder
|
|
@@ -3257,6 +3307,8 @@ function optionalFirestoreField(config) {
|
|
|
3257
3307
|
* FirestoreField configuration for a map of granted roles, keyed by models keys.
|
|
3258
3308
|
*
|
|
3259
3309
|
* Filters empty roles/arrays by default.
|
|
3310
|
+
*
|
|
3311
|
+
* @returns A field mapping configuration for a map of granted role arrays keyed by FirestoreModelKey
|
|
3260
3312
|
*/ function firestoreModelKeyGrantedRoleArrayMap() {
|
|
3261
3313
|
return firestoreArrayMap({
|
|
3262
3314
|
mapFieldValues: filterEmptyArrayValues
|
|
@@ -3272,6 +3324,9 @@ function optionalFirestoreField(config) {
|
|
|
3272
3324
|
*
|
|
3273
3325
|
* Used internally by {@link firestoreObjectArray} to adapt field configs into the map functions
|
|
3274
3326
|
* format needed for array element conversion.
|
|
3327
|
+
*
|
|
3328
|
+
* @param config - The FirestoreModelFieldMapFunctionsConfig to convert
|
|
3329
|
+
* @returns A ModelMapFunctionsRef wrapping the derived map functions
|
|
3275
3330
|
*/ function firestoreFieldConfigToModelMapFunctionsRef(config) {
|
|
3276
3331
|
var mapFunctions = modelFieldMapFunctions(config);
|
|
3277
3332
|
return {
|
|
@@ -3322,8 +3377,7 @@ function optionalFirestoreField(config) {
|
|
|
3322
3377
|
var to = function to(x) {
|
|
3323
3378
|
// remove null/undefined values from each field when converting to in order to mirror firestore usage (undefined is treated like null)
|
|
3324
3379
|
var base = baseTo(x);
|
|
3325
|
-
|
|
3326
|
-
return nullishfilteredOut;
|
|
3380
|
+
return filterNullAndUndefinedValues(base);
|
|
3327
3381
|
};
|
|
3328
3382
|
return firestoreField({
|
|
3329
3383
|
default: (_config_default = config.default) !== null && _config_default !== void 0 ? _config_default : function() {
|
|
@@ -3376,7 +3430,7 @@ function optionalFirestoreField(config) {
|
|
|
3376
3430
|
var defaultBeforeSave = (_config_defaultBeforeSave = config.defaultBeforeSave) !== null && _config_defaultBeforeSave !== void 0 ? _config_defaultBeforeSave : config.saveDefaultObject ? function() {
|
|
3377
3431
|
return toData({});
|
|
3378
3432
|
} : null;
|
|
3379
|
-
|
|
3433
|
+
return build({
|
|
3380
3434
|
base: firestoreField({
|
|
3381
3435
|
default: (_config_default = config.default) !== null && _config_default !== void 0 ? _config_default : defaultWithFields,
|
|
3382
3436
|
defaultBeforeSave: defaultBeforeSave,
|
|
@@ -3387,7 +3441,6 @@ function optionalFirestoreField(config) {
|
|
|
3387
3441
|
x.mapFunctions = mapFunctions;
|
|
3388
3442
|
}
|
|
3389
3443
|
});
|
|
3390
|
-
return mapFunctionsConfig;
|
|
3391
3444
|
}
|
|
3392
3445
|
/**
|
|
3393
3446
|
* Creates a field mapping configuration for Firestore latitude/longitude string fields.
|
|
@@ -3417,7 +3470,10 @@ function optionalFirestoreField(config) {
|
|
|
3417
3470
|
/**
|
|
3418
3471
|
* Default configuration for a TimezoneString.
|
|
3419
3472
|
*
|
|
3420
|
-
* The value defaults to UTC
|
|
3473
|
+
* The value defaults to UTC.
|
|
3474
|
+
*
|
|
3475
|
+
* @param config - Optional configuration for the timezone string field, including default value and pre-save default.
|
|
3476
|
+
* @returns A configured Firestore field that stores a TimezoneString value.
|
|
3421
3477
|
*/ function firestoreTimezoneString(config) {
|
|
3422
3478
|
var _ref = config !== null && config !== void 0 ? config : {}, defaultValue = _ref.default, defaultBeforeSave = _ref.defaultBeforeSave;
|
|
3423
3479
|
return firestoreString({
|
|
@@ -3438,8 +3494,7 @@ var assignWebsiteLinkFunction = assignValuesToPOJOFunction({
|
|
|
3438
3494
|
valueFilter: KeyValueTypleValueFilter.EMPTY
|
|
3439
3495
|
});
|
|
3440
3496
|
var firestoreWebsiteLinkAssignFn = function firestoreWebsiteLinkAssignFn(input) {
|
|
3441
|
-
|
|
3442
|
-
return behavior;
|
|
3497
|
+
return assignWebsiteLinkFunction(DEFAULT_WEBSITE_LINK, input);
|
|
3443
3498
|
};
|
|
3444
3499
|
/**
|
|
3445
3500
|
* Creates a field mapping configuration for Firestore website link fields.
|
|
@@ -3455,7 +3510,11 @@ var firestoreWebsiteLinkAssignFn = function firestoreWebsiteLinkAssignFn(input)
|
|
|
3455
3510
|
});
|
|
3456
3511
|
}
|
|
3457
3512
|
// MARK: WebsiteLink Array
|
|
3458
|
-
|
|
3513
|
+
/**
|
|
3514
|
+
* Creates a field mapping configuration for Firestore arrays of WebsiteLink values.
|
|
3515
|
+
*
|
|
3516
|
+
* @returns A field mapping configuration for WebsiteLink array values
|
|
3517
|
+
*/ function firestoreWebsiteLinkArray() {
|
|
3459
3518
|
return firestoreObjectArray({
|
|
3460
3519
|
firestoreField: firestoreWebsiteLink()
|
|
3461
3520
|
});
|
|
@@ -3473,8 +3532,7 @@ var assignWebsiteFileLinkFunction = assignValuesToPOJOFunction({
|
|
|
3473
3532
|
valueFilter: KeyValueTypleValueFilter.EMPTY
|
|
3474
3533
|
});
|
|
3475
3534
|
var firestoreWebsiteFileLinkAssignFn = function firestoreWebsiteFileLinkAssignFn(input) {
|
|
3476
|
-
|
|
3477
|
-
return behavior;
|
|
3535
|
+
return assignWebsiteFileLinkFunction(DEFAULT_FIRESTORE_WEBSITE_FILE_LINK_VALUE, input);
|
|
3478
3536
|
};
|
|
3479
3537
|
/**
|
|
3480
3538
|
* Creates a field mapping configuration for Firestore website file link fields.
|
|
@@ -3492,6 +3550,8 @@ var firestoreWebsiteFileLinkAssignFn = function firestoreWebsiteFileLinkAssignFn
|
|
|
3492
3550
|
// MARK: WebsiteFileLink Array
|
|
3493
3551
|
/**
|
|
3494
3552
|
* Stores the array of WebsiteFileLink values as an array of objects.
|
|
3553
|
+
*
|
|
3554
|
+
* @returns A field mapping configuration for WebsiteFileLink array values stored as objects
|
|
3495
3555
|
*/ function firestoreWebsiteFileLinkObjectArray() {
|
|
3496
3556
|
return firestoreObjectArray({
|
|
3497
3557
|
firestoreField: firestoreWebsiteFileLink()
|
|
@@ -3499,6 +3559,8 @@ var firestoreWebsiteFileLinkAssignFn = function firestoreWebsiteFileLinkAssignFn
|
|
|
3499
3559
|
}
|
|
3500
3560
|
/**
|
|
3501
3561
|
* Stores the array of WebsiteFileLink values as an array of EncodedWebsiteFileLink values.
|
|
3562
|
+
*
|
|
3563
|
+
* @returns A field mapping configuration for WebsiteFileLink array values stored in encoded form
|
|
3502
3564
|
*/ function firestoreWebsiteFileLinkEncodedArray() {
|
|
3503
3565
|
return firestoreEncodedArray({
|
|
3504
3566
|
convert: {
|
|
@@ -3537,7 +3599,12 @@ var firestoreDateCellRangeAssignFn = function firestoreDateCellRangeAssignFn(inp
|
|
|
3537
3599
|
});
|
|
3538
3600
|
}
|
|
3539
3601
|
// MARK: DateCellRange Array
|
|
3540
|
-
|
|
3602
|
+
/**
|
|
3603
|
+
* Creates a field mapping configuration for Firestore arrays of DateCellRange values.
|
|
3604
|
+
*
|
|
3605
|
+
* @param sort - Whether to sort the array by index number; defaults to true
|
|
3606
|
+
* @returns A field mapping configuration for DateCellRange array values
|
|
3607
|
+
*/ function firestoreDateCellRangeArray() {
|
|
3541
3608
|
var sort = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
3542
3609
|
return firestoreObjectArray({
|
|
3543
3610
|
sortWith: sort ? sortAscendingIndexNumberRefFunction() : undefined,
|
|
@@ -3557,8 +3624,7 @@ var assignDateCellScheduleFunction = assignValuesToPOJOFunction({
|
|
|
3557
3624
|
valueFilter: KeyValueTypleValueFilter.NULL
|
|
3558
3625
|
});
|
|
3559
3626
|
var firestoreDateCellScheduleAssignFn = function firestoreDateCellScheduleAssignFn(input) {
|
|
3560
|
-
|
|
3561
|
-
return block;
|
|
3627
|
+
return assignDateCellScheduleFunction(DEFAULT_FIRESTORE_DATE_CELL_SCHEDULE_VALUE, input);
|
|
3562
3628
|
};
|
|
3563
3629
|
/**
|
|
3564
3630
|
* Creates a field mapping configuration for Firestore date cell schedule fields.
|
|
@@ -3592,6 +3658,9 @@ var DEFAULT_FIRESTORE_UNITED_STATES_ADDRESS_VALUE = {
|
|
|
3592
3658
|
});
|
|
3593
3659
|
/**
|
|
3594
3660
|
* Function to assign values from an input UnitedStatesAddress to a default UnitedStatesAddress.
|
|
3661
|
+
*
|
|
3662
|
+
* @param input - The source UnitedStatesAddress to copy values from
|
|
3663
|
+
* @returns A new UnitedStatesAddress with values assigned from the input
|
|
3595
3664
|
*/ var firestoreUnitedStatesAddressAssignFn = function firestoreUnitedStatesAddressAssignFn(input) {
|
|
3596
3665
|
return assignUnitedStatesAddressFunction(DEFAULT_FIRESTORE_UNITED_STATES_ADDRESS_VALUE, input);
|
|
3597
3666
|
};
|
|
@@ -3729,37 +3798,37 @@ function firebaseQueryItemAccumulator(iteration, mapItem) {
|
|
|
3729
3798
|
var mapFn = function mapFn(x) {
|
|
3730
3799
|
var result = filterMaybeArrayValues(x.map(function(y) {
|
|
3731
3800
|
var data = snapshotData(y);
|
|
3732
|
-
return
|
|
3801
|
+
return mapItem(data);
|
|
3733
3802
|
}));
|
|
3734
3803
|
return result;
|
|
3735
3804
|
};
|
|
3736
3805
|
return firebaseQuerySnapshotAccumulator(iteration, mapFn);
|
|
3737
3806
|
}
|
|
3738
3807
|
|
|
3739
|
-
function _array_like_to_array$
|
|
3808
|
+
function _array_like_to_array$g(arr, len) {
|
|
3740
3809
|
if (len == null || len > arr.length) len = arr.length;
|
|
3741
3810
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
3742
3811
|
return arr2;
|
|
3743
3812
|
}
|
|
3744
|
-
function _array_without_holes$
|
|
3745
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
3813
|
+
function _array_without_holes$d(arr) {
|
|
3814
|
+
if (Array.isArray(arr)) return _array_like_to_array$g(arr);
|
|
3746
3815
|
}
|
|
3747
|
-
function _iterable_to_array$
|
|
3816
|
+
function _iterable_to_array$d(iter) {
|
|
3748
3817
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
3749
3818
|
}
|
|
3750
|
-
function _non_iterable_spread$
|
|
3819
|
+
function _non_iterable_spread$d() {
|
|
3751
3820
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3752
3821
|
}
|
|
3753
|
-
function _to_consumable_array$
|
|
3754
|
-
return _array_without_holes$
|
|
3822
|
+
function _to_consumable_array$d(arr) {
|
|
3823
|
+
return _array_without_holes$d(arr) || _iterable_to_array$d(arr) || _unsupported_iterable_to_array$g(arr) || _non_iterable_spread$d();
|
|
3755
3824
|
}
|
|
3756
|
-
function _unsupported_iterable_to_array$
|
|
3825
|
+
function _unsupported_iterable_to_array$g(o, minLen) {
|
|
3757
3826
|
if (!o) return;
|
|
3758
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
3827
|
+
if (typeof o === "string") return _array_like_to_array$g(o, minLen);
|
|
3759
3828
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3760
3829
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3761
3830
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
3762
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
3831
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$g(o, minLen);
|
|
3763
3832
|
}
|
|
3764
3833
|
/**
|
|
3765
3834
|
* Creates a {@link FirestoreQueryConstraint} with the given type identifier and data.
|
|
@@ -4058,7 +4127,7 @@ function orderBy(fieldPath, directionStr) {
|
|
|
4058
4127
|
* const newConstraints = withLastLimit10(existingConstraints);
|
|
4059
4128
|
*/ function addOrReplaceLimitInConstraints(limit) {
|
|
4060
4129
|
var addedLimitType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE;
|
|
4061
|
-
|
|
4130
|
+
return replaceConstraints(function(constraints) {
|
|
4062
4131
|
var type;
|
|
4063
4132
|
if (constraints.length) {
|
|
4064
4133
|
type = constraints[0].type;
|
|
@@ -4075,7 +4144,6 @@ function orderBy(fieldPath, directionStr) {
|
|
|
4075
4144
|
FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE,
|
|
4076
4145
|
FIRESTORE_LIMIT_TO_LAST_QUERY_CONSTRAINT_TYPE
|
|
4077
4146
|
]);
|
|
4078
|
-
return replace;
|
|
4079
4147
|
}
|
|
4080
4148
|
/**
|
|
4081
4149
|
* Creates a function that filters out constraints of specific types.
|
|
@@ -4120,11 +4188,11 @@ function orderBy(fieldPath, directionStr) {
|
|
|
4120
4188
|
* );
|
|
4121
4189
|
* const newConstraints = replaceLimit(existingConstraints);
|
|
4122
4190
|
*/ function replaceConstraints(replaceFn, types) {
|
|
4123
|
-
var separateFn = separateConstraints.apply(void 0, _to_consumable_array$
|
|
4191
|
+
var separateFn = separateConstraints.apply(void 0, _to_consumable_array$d(types));
|
|
4124
4192
|
return function(constraints) {
|
|
4125
4193
|
var separated = separateFn(constraints);
|
|
4126
4194
|
var replacements = asArray(replaceFn(separated.excluded));
|
|
4127
|
-
return
|
|
4195
|
+
return pushItemOrArrayItemsIntoArray(separated.included, replacements);
|
|
4128
4196
|
};
|
|
4129
4197
|
}
|
|
4130
4198
|
/**
|
|
@@ -4149,10 +4217,9 @@ function orderBy(fieldPath, directionStr) {
|
|
|
4149
4217
|
}
|
|
4150
4218
|
return function(constraints) {
|
|
4151
4219
|
var typesToFilterOut = new Set(types);
|
|
4152
|
-
|
|
4220
|
+
return separateValues(constraints, function(x) {
|
|
4153
4221
|
return !typesToFilterOut.has(x.type);
|
|
4154
4222
|
});
|
|
4155
|
-
return separated;
|
|
4156
4223
|
};
|
|
4157
4224
|
}
|
|
4158
4225
|
|
|
@@ -4307,13 +4374,13 @@ function whereDateIsBeforeWithSort(fieldPath) {
|
|
|
4307
4374
|
];
|
|
4308
4375
|
}
|
|
4309
4376
|
|
|
4310
|
-
function _array_like_to_array$
|
|
4377
|
+
function _array_like_to_array$f(arr, len) {
|
|
4311
4378
|
if (len == null || len > arr.length) len = arr.length;
|
|
4312
4379
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4313
4380
|
return arr2;
|
|
4314
4381
|
}
|
|
4315
|
-
function _array_without_holes$
|
|
4316
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
4382
|
+
function _array_without_holes$c(arr) {
|
|
4383
|
+
if (Array.isArray(arr)) return _array_like_to_array$f(arr);
|
|
4317
4384
|
}
|
|
4318
4385
|
function _define_property$r(obj, key, value) {
|
|
4319
4386
|
if (key in obj) {
|
|
@@ -4328,10 +4395,10 @@ function _define_property$r(obj, key, value) {
|
|
|
4328
4395
|
}
|
|
4329
4396
|
return obj;
|
|
4330
4397
|
}
|
|
4331
|
-
function _iterable_to_array$
|
|
4398
|
+
function _iterable_to_array$c(iter) {
|
|
4332
4399
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
4333
4400
|
}
|
|
4334
|
-
function _non_iterable_spread$
|
|
4401
|
+
function _non_iterable_spread$c() {
|
|
4335
4402
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4336
4403
|
}
|
|
4337
4404
|
function _object_spread$l(target) {
|
|
@@ -4368,16 +4435,16 @@ function _object_spread_props$h(target, source) {
|
|
|
4368
4435
|
}
|
|
4369
4436
|
return target;
|
|
4370
4437
|
}
|
|
4371
|
-
function _to_consumable_array$
|
|
4372
|
-
return _array_without_holes$
|
|
4438
|
+
function _to_consumable_array$c(arr) {
|
|
4439
|
+
return _array_without_holes$c(arr) || _iterable_to_array$c(arr) || _unsupported_iterable_to_array$f(arr) || _non_iterable_spread$c();
|
|
4373
4440
|
}
|
|
4374
|
-
function _unsupported_iterable_to_array$
|
|
4441
|
+
function _unsupported_iterable_to_array$f(o, minLen) {
|
|
4375
4442
|
if (!o) return;
|
|
4376
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
4443
|
+
if (typeof o === "string") return _array_like_to_array$f(o, minLen);
|
|
4377
4444
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
4378
4445
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
4379
4446
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
4380
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
4447
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$f(o, minLen);
|
|
4381
4448
|
}
|
|
4382
4449
|
/**
|
|
4383
4450
|
* Filters out constraints that should not be directly specified in pagination queries.
|
|
@@ -4440,13 +4507,13 @@ function _unsupported_iterable_to_array$e(o, minLen) {
|
|
|
4440
4507
|
// Add Limit
|
|
4441
4508
|
var limitCount = filterLimit !== null && filterLimit !== void 0 ? filterLimit : itemsPerPage + (startAfterFilter ? 1 : 0); // todo: may not be needed.
|
|
4442
4509
|
var limitConstraint = limit(limitCount);
|
|
4443
|
-
var constraintsWithLimit = _to_consumable_array$
|
|
4510
|
+
var constraintsWithLimit = _to_consumable_array$c(constraints).concat([
|
|
4444
4511
|
limitConstraint
|
|
4445
4512
|
]);
|
|
4446
4513
|
// make query
|
|
4447
4514
|
var batchQuery = (_driver = driver).query.apply(_driver, [
|
|
4448
4515
|
queryLike
|
|
4449
|
-
].concat(_to_consumable_array$
|
|
4516
|
+
].concat(_to_consumable_array$c(constraintsWithLimit)));
|
|
4450
4517
|
var resultPromise = driver.getDocs(batchQuery).then(function(snapshot) {
|
|
4451
4518
|
var time = new Date();
|
|
4452
4519
|
var docs = snapshot.docs;
|
|
@@ -4675,7 +4742,7 @@ function _firestoreItemPageIterationWithSnapshotIteration(snapshotIteration) {
|
|
|
4675
4742
|
return snapshot;
|
|
4676
4743
|
});
|
|
4677
4744
|
};
|
|
4678
|
-
|
|
4745
|
+
return _loadFakeQuerySnapshot().then(function(snapshot) {
|
|
4679
4746
|
var result = {
|
|
4680
4747
|
value: {
|
|
4681
4748
|
time: time,
|
|
@@ -4684,7 +4751,7 @@ function _firestoreItemPageIterationWithSnapshotIteration(snapshotIteration) {
|
|
|
4684
4751
|
reload: function reload() {
|
|
4685
4752
|
return _loadFakeQuerySnapshot();
|
|
4686
4753
|
},
|
|
4687
|
-
stream: function stream(
|
|
4754
|
+
stream: function stream(_options) {
|
|
4688
4755
|
// TODO: Count potentially stream to fully implement, but might not be used anyways.
|
|
4689
4756
|
return of(snapshot);
|
|
4690
4757
|
}
|
|
@@ -4693,7 +4760,6 @@ function _firestoreItemPageIterationWithSnapshotIteration(snapshotIteration) {
|
|
|
4693
4760
|
};
|
|
4694
4761
|
return result;
|
|
4695
4762
|
});
|
|
4696
|
-
return resultPromise;
|
|
4697
4763
|
}
|
|
4698
4764
|
}));
|
|
4699
4765
|
}
|
|
@@ -4703,13 +4769,13 @@ function _firestoreItemPageIterationWithSnapshotIteration(snapshotIteration) {
|
|
|
4703
4769
|
return _firestoreItemPageIterationWithSnapshotIteration(snapshotIteration);
|
|
4704
4770
|
}
|
|
4705
4771
|
|
|
4706
|
-
function _array_like_to_array$
|
|
4772
|
+
function _array_like_to_array$e(arr, len) {
|
|
4707
4773
|
if (len == null || len > arr.length) len = arr.length;
|
|
4708
4774
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4709
4775
|
return arr2;
|
|
4710
4776
|
}
|
|
4711
|
-
function _array_without_holes$
|
|
4712
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
4777
|
+
function _array_without_holes$b(arr) {
|
|
4778
|
+
if (Array.isArray(arr)) return _array_like_to_array$e(arr);
|
|
4713
4779
|
}
|
|
4714
4780
|
function asyncGeneratorStep$g(gen, resolve, reject, _next, _throw, key, arg) {
|
|
4715
4781
|
try {
|
|
@@ -4740,22 +4806,22 @@ function _async_to_generator$g(fn) {
|
|
|
4740
4806
|
});
|
|
4741
4807
|
};
|
|
4742
4808
|
}
|
|
4743
|
-
function _iterable_to_array$
|
|
4809
|
+
function _iterable_to_array$b(iter) {
|
|
4744
4810
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
4745
4811
|
}
|
|
4746
|
-
function _non_iterable_spread$
|
|
4812
|
+
function _non_iterable_spread$b() {
|
|
4747
4813
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4748
4814
|
}
|
|
4749
|
-
function _to_consumable_array$
|
|
4750
|
-
return _array_without_holes$
|
|
4815
|
+
function _to_consumable_array$b(arr) {
|
|
4816
|
+
return _array_without_holes$b(arr) || _iterable_to_array$b(arr) || _unsupported_iterable_to_array$e(arr) || _non_iterable_spread$b();
|
|
4751
4817
|
}
|
|
4752
|
-
function _unsupported_iterable_to_array$
|
|
4818
|
+
function _unsupported_iterable_to_array$e(o, minLen) {
|
|
4753
4819
|
if (!o) return;
|
|
4754
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
4820
|
+
if (typeof o === "string") return _array_like_to_array$e(o, minLen);
|
|
4755
4821
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
4756
4822
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
4757
4823
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
4758
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
4824
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$e(o, minLen);
|
|
4759
4825
|
}
|
|
4760
4826
|
function _ts_generator$g(thisArg, body) {
|
|
4761
4827
|
var f, y, t, _ = {
|
|
@@ -4893,7 +4959,7 @@ function _ts_generator$g(thisArg, body) {
|
|
|
4893
4959
|
var allConstraints = flattenArrayOrValueArray(queryConstraints);
|
|
4894
4960
|
var query = makeQuery.apply(void 0, [
|
|
4895
4961
|
inputQuery
|
|
4896
|
-
].concat(_to_consumable_array$
|
|
4962
|
+
].concat(_to_consumable_array$b(allConstraints)));
|
|
4897
4963
|
var result = {
|
|
4898
4964
|
query: query,
|
|
4899
4965
|
countDocs: function countDocs1() {
|
|
@@ -4915,7 +4981,7 @@ function _ts_generator$g(thisArg, body) {
|
|
|
4915
4981
|
constraintsForOneDoc = addOrReplaceLimitInConstraints(1)(allConstraints);
|
|
4916
4982
|
query = makeQuery.apply(void 0, [
|
|
4917
4983
|
inputQuery
|
|
4918
|
-
].concat(_to_consumable_array$
|
|
4984
|
+
].concat(_to_consumable_array$b(constraintsForOneDoc)));
|
|
4919
4985
|
return [
|
|
4920
4986
|
4,
|
|
4921
4987
|
getDocs(query, transaction)
|
|
@@ -5019,7 +5085,7 @@ function _ts_generator$g(thisArg, body) {
|
|
|
5019
5085
|
return snapshot.ref.path;
|
|
5020
5086
|
}
|
|
5021
5087
|
|
|
5022
|
-
function _array_like_to_array$
|
|
5088
|
+
function _array_like_to_array$d(arr, len) {
|
|
5023
5089
|
if (len == null || len > arr.length) len = arr.length;
|
|
5024
5090
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5025
5091
|
return arr2;
|
|
@@ -5131,15 +5197,15 @@ function _object_spread_props$g(target, source) {
|
|
|
5131
5197
|
return target;
|
|
5132
5198
|
}
|
|
5133
5199
|
function _sliced_to_array$3(arr, i) {
|
|
5134
|
-
return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$
|
|
5200
|
+
return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$d(arr, i) || _non_iterable_rest$3();
|
|
5135
5201
|
}
|
|
5136
|
-
function _unsupported_iterable_to_array$
|
|
5202
|
+
function _unsupported_iterable_to_array$d(o, minLen) {
|
|
5137
5203
|
if (!o) return;
|
|
5138
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
5204
|
+
if (typeof o === "string") return _array_like_to_array$d(o, minLen);
|
|
5139
5205
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
5140
5206
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
5141
5207
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
5142
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
5208
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$d(o, minLen);
|
|
5143
5209
|
}
|
|
5144
5210
|
function _ts_generator$f(thisArg, body) {
|
|
5145
5211
|
var f, y, t, _ = {
|
|
@@ -5329,27 +5395,17 @@ function _ts_generator$f(thisArg, body) {
|
|
|
5329
5395
|
maxParallelCheckpoints: 1,
|
|
5330
5396
|
iterateSnapshotBatch: function iterateSnapshotBatch(docSnapshots) {
|
|
5331
5397
|
return _async_to_generator$f(function() {
|
|
5332
|
-
var performTasksResult;
|
|
5333
5398
|
return _ts_generator$f(this, function(_state) {
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
))
|
|
5345
|
-
];
|
|
5346
|
-
case 1:
|
|
5347
|
-
performTasksResult = _state.sent();
|
|
5348
|
-
return [
|
|
5349
|
-
2,
|
|
5350
|
-
performTasksResult
|
|
5351
|
-
];
|
|
5352
|
-
}
|
|
5399
|
+
return [
|
|
5400
|
+
2,
|
|
5401
|
+
performAsyncTasks(docSnapshots, iterateSnapshot, _object_spread$k({
|
|
5402
|
+
sequential: true
|
|
5403
|
+
}, snapshotsPerformTasksConfig !== null && snapshotsPerformTasksConfig !== void 0 ? snapshotsPerformTasksConfig : _object_spread_props$g(_object_spread$k({}, performTasksConfig), {
|
|
5404
|
+
nonConcurrentTaskKeyFactory: undefined,
|
|
5405
|
+
beforeRetry: undefined
|
|
5406
|
+
}) // don't pass the nonConcurrentTaskKeyFactory
|
|
5407
|
+
))
|
|
5408
|
+
];
|
|
5353
5409
|
});
|
|
5354
5410
|
})();
|
|
5355
5411
|
}
|
|
@@ -5464,14 +5520,9 @@ function _ts_generator$f(thisArg, body) {
|
|
|
5464
5520
|
case 0:
|
|
5465
5521
|
if (!(docSnapshots.length > 0)) return [
|
|
5466
5522
|
3,
|
|
5467
|
-
|
|
5468
|
-
];
|
|
5469
|
-
return [
|
|
5470
|
-
4,
|
|
5471
|
-
batchSizeForSnapshots(docSnapshots)
|
|
5523
|
+
2
|
|
5472
5524
|
];
|
|
5473
|
-
|
|
5474
|
-
batchSizeForSnapshotsResult = _state.sent();
|
|
5525
|
+
batchSizeForSnapshotsResult = batchSizeForSnapshots(docSnapshots);
|
|
5475
5526
|
batches = batchSizeForSnapshotsResult === null ? [
|
|
5476
5527
|
docSnapshots
|
|
5477
5528
|
] : batch(docSnapshots, batchSizeForSnapshotsResult);
|
|
@@ -5484,7 +5535,7 @@ function _ts_generator$f(thisArg, body) {
|
|
|
5484
5535
|
sequential: true
|
|
5485
5536
|
}, performTasksConfig))
|
|
5486
5537
|
];
|
|
5487
|
-
case
|
|
5538
|
+
case 1:
|
|
5488
5539
|
performTasksResult = _state.sent();
|
|
5489
5540
|
return [
|
|
5490
5541
|
2,
|
|
@@ -5497,12 +5548,12 @@ function _ts_generator$f(thisArg, body) {
|
|
|
5497
5548
|
};
|
|
5498
5549
|
})
|
|
5499
5550
|
];
|
|
5500
|
-
case
|
|
5551
|
+
case 2:
|
|
5501
5552
|
return [
|
|
5502
5553
|
2,
|
|
5503
5554
|
[]
|
|
5504
5555
|
];
|
|
5505
|
-
case
|
|
5556
|
+
case 3:
|
|
5506
5557
|
return [
|
|
5507
5558
|
2
|
|
5508
5559
|
];
|
|
@@ -5599,6 +5650,7 @@ function _ts_generator$f(thisArg, body) {
|
|
|
5599
5650
|
*/ function iterateFirestoreDocumentSnapshotCheckpoints(config) {
|
|
5600
5651
|
return _async_to_generator$f(function() {
|
|
5601
5652
|
var iterateCheckpoint, inputFilterCheckpointSnapshot, inputHandleRepeatCursor, waitBetweenCheckpoints, useCheckpointResult, inputConstraintsFactory, inputDynamicConstraints, queryFactory, _config_maxParallelCheckpoints, maxParallelCheckpoints, inputLimitPerCheckpoint, inputTotalSnapshotsLimit, constraintsInputIsFactory, constraintsFactory, limitPerCheckpoint, totalSnapshotsLimit, currentIndex, hasReachedEnd, totalSnapshotsLimitReached, totalSnapshotsVisited, cursorDocument, visitedCursorPaths, handleRepeatCursor, filterCheckpointSnapshot, performTaskFn, result;
|
|
5653
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity -- cursor-based pagination logic with repeat detection is inherently complex
|
|
5602
5654
|
function taskInputFactory() {
|
|
5603
5655
|
return _async_to_generator$f(function() {
|
|
5604
5656
|
var result, constraints, startAfterFilter, shouldContinue, totalPossibleNumberOfItemsLeftToLoad, nextLimit, query, docQuerySnapshot, docSnapshots, nextCursorDocument, cursorPath, repeatResult, newSnapshotsVisited, i;
|
|
@@ -6164,7 +6216,7 @@ function _ts_generator$e(thisArg, body) {
|
|
|
6164
6216
|
}), shareReplay(1));
|
|
6165
6217
|
var event$ = stream$.pipe(map(function(event) {
|
|
6166
6218
|
var changes = event.docChanges();
|
|
6167
|
-
|
|
6219
|
+
return build({
|
|
6168
6220
|
base: groupValues(changes, function(x) {
|
|
6169
6221
|
return x.type;
|
|
6170
6222
|
}),
|
|
@@ -6178,7 +6230,6 @@ function _ts_generator$e(thisArg, body) {
|
|
|
6178
6230
|
x.type = iterationQueryDocChangeWatcherChangeTypeForGroup(x);
|
|
6179
6231
|
}
|
|
6180
6232
|
});
|
|
6181
|
-
return results;
|
|
6182
6233
|
}), shareReplay(1));
|
|
6183
6234
|
return {
|
|
6184
6235
|
stream$: stream$,
|
|
@@ -6217,13 +6268,13 @@ function _ts_generator$e(thisArg, body) {
|
|
|
6217
6268
|
return type;
|
|
6218
6269
|
}
|
|
6219
6270
|
|
|
6220
|
-
function _array_like_to_array$
|
|
6271
|
+
function _array_like_to_array$c(arr, len) {
|
|
6221
6272
|
if (len == null || len > arr.length) len = arr.length;
|
|
6222
6273
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
6223
6274
|
return arr2;
|
|
6224
6275
|
}
|
|
6225
|
-
function _array_without_holes$
|
|
6226
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
6276
|
+
function _array_without_holes$a(arr) {
|
|
6277
|
+
if (Array.isArray(arr)) return _array_like_to_array$c(arr);
|
|
6227
6278
|
}
|
|
6228
6279
|
function asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, key, arg) {
|
|
6229
6280
|
try {
|
|
@@ -6254,22 +6305,22 @@ function _async_to_generator$d(fn) {
|
|
|
6254
6305
|
});
|
|
6255
6306
|
};
|
|
6256
6307
|
}
|
|
6257
|
-
function _iterable_to_array$
|
|
6308
|
+
function _iterable_to_array$a(iter) {
|
|
6258
6309
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
6259
6310
|
}
|
|
6260
|
-
function _non_iterable_spread$
|
|
6311
|
+
function _non_iterable_spread$a() {
|
|
6261
6312
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6262
6313
|
}
|
|
6263
|
-
function _to_consumable_array$
|
|
6264
|
-
return _array_without_holes$
|
|
6314
|
+
function _to_consumable_array$a(arr) {
|
|
6315
|
+
return _array_without_holes$a(arr) || _iterable_to_array$a(arr) || _unsupported_iterable_to_array$c(arr) || _non_iterable_spread$a();
|
|
6265
6316
|
}
|
|
6266
|
-
function _unsupported_iterable_to_array$
|
|
6317
|
+
function _unsupported_iterable_to_array$c(o, minLen) {
|
|
6267
6318
|
if (!o) return;
|
|
6268
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
6319
|
+
if (typeof o === "string") return _array_like_to_array$c(o, minLen);
|
|
6269
6320
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
6270
6321
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
6271
6322
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
6272
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
6323
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
|
|
6273
6324
|
}
|
|
6274
6325
|
function _ts_generator$d(thisArg, body) {
|
|
6275
6326
|
var f, y, t, _ = {
|
|
@@ -6487,7 +6538,7 @@ function _ts_generator$d(thisArg, body) {
|
|
|
6487
6538
|
for(var _len = arguments.length, queryConstraints = new Array(_len), _key = 0; _key < _len; _key++){
|
|
6488
6539
|
queryConstraints[_key] = arguments[_key];
|
|
6489
6540
|
}
|
|
6490
|
-
return wrapQuery((_baseQuery = baseQuery).filter.apply(_baseQuery, _to_consumable_array$
|
|
6541
|
+
return wrapQuery((_baseQuery = baseQuery).filter.apply(_baseQuery, _to_consumable_array$a(queryConstraints)));
|
|
6491
6542
|
}
|
|
6492
6543
|
};
|
|
6493
6544
|
};
|
|
@@ -6497,18 +6548,18 @@ function _ts_generator$d(thisArg, body) {
|
|
|
6497
6548
|
for(var _len = arguments.length, queryConstraints = new Array(_len), _key = 0; _key < _len; _key++){
|
|
6498
6549
|
queryConstraints[_key] = arguments[_key];
|
|
6499
6550
|
}
|
|
6500
|
-
return wrapQuery((_queryFactory = queryFactory).query.apply(_queryFactory, _to_consumable_array$
|
|
6551
|
+
return wrapQuery((_queryFactory = queryFactory).query.apply(_queryFactory, _to_consumable_array$a(queryConstraints)));
|
|
6501
6552
|
}
|
|
6502
6553
|
};
|
|
6503
6554
|
}
|
|
6504
6555
|
|
|
6505
|
-
function _array_like_to_array$
|
|
6556
|
+
function _array_like_to_array$b(arr, len) {
|
|
6506
6557
|
if (len == null || len > arr.length) len = arr.length;
|
|
6507
6558
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
6508
6559
|
return arr2;
|
|
6509
6560
|
}
|
|
6510
|
-
function _array_without_holes$
|
|
6511
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
6561
|
+
function _array_without_holes$9(arr) {
|
|
6562
|
+
if (Array.isArray(arr)) return _array_like_to_array$b(arr);
|
|
6512
6563
|
}
|
|
6513
6564
|
function _define_property$p(obj, key, value) {
|
|
6514
6565
|
if (key in obj) {
|
|
@@ -6523,10 +6574,10 @@ function _define_property$p(obj, key, value) {
|
|
|
6523
6574
|
}
|
|
6524
6575
|
return obj;
|
|
6525
6576
|
}
|
|
6526
|
-
function _iterable_to_array$
|
|
6577
|
+
function _iterable_to_array$9(iter) {
|
|
6527
6578
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
6528
6579
|
}
|
|
6529
|
-
function _non_iterable_spread$
|
|
6580
|
+
function _non_iterable_spread$9() {
|
|
6530
6581
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6531
6582
|
}
|
|
6532
6583
|
function _object_spread$j(target) {
|
|
@@ -6563,20 +6614,20 @@ function _object_spread_props$f(target, source) {
|
|
|
6563
6614
|
}
|
|
6564
6615
|
return target;
|
|
6565
6616
|
}
|
|
6566
|
-
function _to_consumable_array$
|
|
6567
|
-
return _array_without_holes$
|
|
6617
|
+
function _to_consumable_array$9(arr) {
|
|
6618
|
+
return _array_without_holes$9(arr) || _iterable_to_array$9(arr) || _unsupported_iterable_to_array$b(arr) || _non_iterable_spread$9();
|
|
6568
6619
|
}
|
|
6569
6620
|
function _type_of$9(obj) {
|
|
6570
6621
|
"@swc/helpers - typeof";
|
|
6571
6622
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
6572
6623
|
}
|
|
6573
|
-
function _unsupported_iterable_to_array$
|
|
6624
|
+
function _unsupported_iterable_to_array$b(o, minLen) {
|
|
6574
6625
|
if (!o) return;
|
|
6575
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
6626
|
+
if (typeof o === "string") return _array_like_to_array$b(o, minLen);
|
|
6576
6627
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
6577
6628
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
6578
6629
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
6579
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
6630
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
|
|
6580
6631
|
}
|
|
6581
6632
|
/**
|
|
6582
6633
|
* Separator used in Firestore paths to separate collection and document IDs.
|
|
@@ -6606,6 +6657,7 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
|
|
|
6606
6657
|
}
|
|
6607
6658
|
/**
|
|
6608
6659
|
* Creates a FirestoreModelIdentityTypeMap from the input identities.
|
|
6660
|
+
*
|
|
6609
6661
|
* @param identities
|
|
6610
6662
|
* @returns
|
|
6611
6663
|
*/ function firestoreModelIdentityTypeMap(identities) {
|
|
@@ -6649,8 +6701,7 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
|
|
|
6649
6701
|
} else {
|
|
6650
6702
|
key = input;
|
|
6651
6703
|
}
|
|
6652
|
-
|
|
6653
|
-
return result;
|
|
6704
|
+
return id !== null && id !== void 0 ? id : lastValue(key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR));
|
|
6654
6705
|
}
|
|
6655
6706
|
/**
|
|
6656
6707
|
* Returns the array of ids within a FirestoreModelKey.
|
|
@@ -6686,7 +6737,7 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
|
|
|
6686
6737
|
* @param key
|
|
6687
6738
|
* @returns
|
|
6688
6739
|
*/ function inferKeyFromTwoWayFlatFirestoreModelKey(key) {
|
|
6689
|
-
return key.replace(
|
|
6740
|
+
return key.replace(/_/g, FIRESTORE_COLLECTION_NAME_SEPARATOR);
|
|
6690
6741
|
}
|
|
6691
6742
|
/**
|
|
6692
6743
|
* Firestore Model Id Regex
|
|
@@ -6696,7 +6747,8 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
|
|
|
6696
6747
|
/**
|
|
6697
6748
|
* Returns true if the input string is a FirestoreModelId.
|
|
6698
6749
|
*
|
|
6699
|
-
* @param input
|
|
6750
|
+
* @param input - The string to test
|
|
6751
|
+
* @returns True if the input is a valid FirestoreModelId
|
|
6700
6752
|
*/ function isFirestoreModelId(input) {
|
|
6701
6753
|
return FIRESTORE_MODEL_ID_REGEX.test(input);
|
|
6702
6754
|
}
|
|
@@ -6720,14 +6772,16 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
|
|
|
6720
6772
|
/**
|
|
6721
6773
|
* Returns true if the input string is a FirestoreModelKey.
|
|
6722
6774
|
*
|
|
6723
|
-
* @param input
|
|
6775
|
+
* @param input - The string to test
|
|
6776
|
+
* @returns True if the input is a valid FirestoreModelKey
|
|
6724
6777
|
*/ function isFirestoreModelKey(input) {
|
|
6725
6778
|
return FIRESTORE_MODEL_KEY_REGEX.test(input);
|
|
6726
6779
|
}
|
|
6727
6780
|
/**
|
|
6728
|
-
* Returns true if the input string is a FirestoreModelId.
|
|
6781
|
+
* Returns true if the input string is a FirestoreModelId or a FirestoreModelKey.
|
|
6729
6782
|
*
|
|
6730
|
-
* @param input
|
|
6783
|
+
* @param input - The string to test
|
|
6784
|
+
* @returns True if the input is a valid FirestoreModelId or FirestoreModelKey
|
|
6731
6785
|
*/ function isFirestoreModelIdOrKey(input) {
|
|
6732
6786
|
return stringContains(input, '/') ? FIRESTORE_MODEL_KEY_REGEX.test(input) : FIRESTORE_MODEL_ID_REGEX.test(input);
|
|
6733
6787
|
}
|
|
@@ -6749,6 +6803,9 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
|
|
|
6749
6803
|
*/ var firestoreModelKey = firestoreModelKeyPart;
|
|
6750
6804
|
/**
|
|
6751
6805
|
* Creates a FirestoreModelKeyFactory for the input root identity.
|
|
6806
|
+
*
|
|
6807
|
+
* @param identity - The root FirestoreModelIdentity to bind the factory to
|
|
6808
|
+
* @returns A factory function that creates FirestoreModelKey values for the given identity and a provided id
|
|
6752
6809
|
*/ function firestoreModelKeyFactory(identity) {
|
|
6753
6810
|
return function(id) {
|
|
6754
6811
|
return firestoreModelKey(identity, id);
|
|
@@ -6812,7 +6869,12 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
|
|
|
6812
6869
|
return "".concat(parent).concat(FIRESTORE_COLLECTION_NAME_SEPARATOR).concat(childPath);
|
|
6813
6870
|
});
|
|
6814
6871
|
}
|
|
6815
|
-
|
|
6872
|
+
/**
|
|
6873
|
+
* Converts a FirestoreModelKey or reference into a record mapping each collection name to its document id.
|
|
6874
|
+
*
|
|
6875
|
+
* @param input - The FirestoreModelKey, DocumentReferenceRef, or FirestoreModelKeyRef to convert
|
|
6876
|
+
* @returns An object mapping collection names to document ids, or undefined if the key is unavailable
|
|
6877
|
+
*/ function firestoreModelKeyPairObject(input) {
|
|
6816
6878
|
var pairs = firestoreModelKeyPartPairs(input);
|
|
6817
6879
|
var object;
|
|
6818
6880
|
if (pairs) {
|
|
@@ -6824,22 +6886,44 @@ function firestoreModelKeyPairObject(input) {
|
|
|
6824
6886
|
}
|
|
6825
6887
|
return object;
|
|
6826
6888
|
}
|
|
6827
|
-
|
|
6889
|
+
/**
|
|
6890
|
+
* Returns the FirestoreCollectionType derived from the input FirestoreModelKey.
|
|
6891
|
+
*
|
|
6892
|
+
* @param input - The key or reference to extract the collection type from
|
|
6893
|
+
* @returns The FirestoreCollectionType string, or undefined if the key is unavailable
|
|
6894
|
+
*/ function firestoreModelKeyCollectionType(input) {
|
|
6828
6895
|
return firestoreModelKeyCollectionTypeArrayName(input, FIRESTORE_COLLECTION_NAME_SEPARATOR);
|
|
6829
6896
|
}
|
|
6830
|
-
|
|
6897
|
+
/**
|
|
6898
|
+
* Returns the collection type array name string derived from the input key, joined by the given separator.
|
|
6899
|
+
*
|
|
6900
|
+
* @param input - The key or reference to extract collection names from
|
|
6901
|
+
* @param separator - The separator to join collection names with; defaults to the Firestore collection name separator
|
|
6902
|
+
* @returns The joined collection type array name string, or undefined if the key is unavailable
|
|
6903
|
+
*/ function firestoreModelKeyCollectionTypeArrayName(input) {
|
|
6831
6904
|
var separator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : FIRESTORE_COLLECTION_NAME_SEPARATOR;
|
|
6832
6905
|
var _firestoreModelKeyCollectionTypeArray;
|
|
6833
6906
|
return (_firestoreModelKeyCollectionTypeArray = firestoreModelKeyCollectionTypeArray(input)) === null || _firestoreModelKeyCollectionTypeArray === void 0 ? void 0 : _firestoreModelKeyCollectionTypeArray.join(separator);
|
|
6834
6907
|
}
|
|
6835
|
-
|
|
6908
|
+
/**
|
|
6909
|
+
* Returns the collection type array name string derived from a FirestoreModelIdentity, joined by the given separator.
|
|
6910
|
+
*
|
|
6911
|
+
* @param input - The FirestoreModelIdentity to derive collection names from
|
|
6912
|
+
* @param separator - The separator to join collection names with; defaults to the Firestore collection name separator
|
|
6913
|
+
* @returns The joined collection type array name string
|
|
6914
|
+
*/ function firestoreIdentityTypeArrayName(input) {
|
|
6836
6915
|
var separator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : FIRESTORE_COLLECTION_NAME_SEPARATOR;
|
|
6837
6916
|
return firestoreIdentityTypeArray(input).join(separator);
|
|
6838
6917
|
}
|
|
6839
|
-
|
|
6918
|
+
/**
|
|
6919
|
+
* Returns an ordered array of collection names derived from a FirestoreModelIdentity, from root to leaf.
|
|
6920
|
+
*
|
|
6921
|
+
* @param input - The FirestoreModelIdentity to traverse
|
|
6922
|
+
* @returns An array of FirestoreCollectionName values ordered from root to leaf
|
|
6923
|
+
*/ function firestoreIdentityTypeArray(input) {
|
|
6840
6924
|
var array = [];
|
|
6841
6925
|
var current = input;
|
|
6842
|
-
|
|
6926
|
+
for(;;){
|
|
6843
6927
|
array.push(current.collectionName);
|
|
6844
6928
|
if (current.type === 'nested') {
|
|
6845
6929
|
current = current.parent;
|
|
@@ -6849,11 +6933,16 @@ function firestoreIdentityTypeArray(input) {
|
|
|
6849
6933
|
}
|
|
6850
6934
|
return array.reverse();
|
|
6851
6935
|
}
|
|
6852
|
-
|
|
6936
|
+
/**
|
|
6937
|
+
* Returns an ordered array of collection names derived from the input FirestoreModelKey.
|
|
6938
|
+
*
|
|
6939
|
+
* @param input - The key or reference to extract collection names from
|
|
6940
|
+
* @returns An array of FirestoreCollectionName values, or undefined if the key is unavailable
|
|
6941
|
+
*/ function firestoreModelKeyCollectionTypeArray(input) {
|
|
6853
6942
|
var key = readFirestoreModelKey(input);
|
|
6854
6943
|
var array;
|
|
6855
6944
|
if (key) {
|
|
6856
|
-
var pieces = key
|
|
6945
|
+
var pieces = key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR);
|
|
6857
6946
|
if (isOddNumber(pieces.length)) {
|
|
6858
6947
|
throw new Error('input key source was a collection ref or unavailable.');
|
|
6859
6948
|
}
|
|
@@ -6868,8 +6957,8 @@ function firestoreModelKeyCollectionTypeArray(input) {
|
|
|
6868
6957
|
/**
|
|
6869
6958
|
* Returns the collection name of the input key.
|
|
6870
6959
|
*
|
|
6871
|
-
* @param input
|
|
6872
|
-
* @returns
|
|
6960
|
+
* @param input - The key or reference to extract the collection name from
|
|
6961
|
+
* @returns The FirestoreCollectionName from the deepest key pair, or undefined if unavailable
|
|
6873
6962
|
*/ function firestoreModelKeyCollectionName(input) {
|
|
6874
6963
|
var _firestoreModelKeyTypePair;
|
|
6875
6964
|
return (_firestoreModelKeyTypePair = firestoreModelKeyTypePair(input)) === null || _firestoreModelKeyTypePair === void 0 ? void 0 : _firestoreModelKeyTypePair.collectionName;
|
|
@@ -6877,8 +6966,9 @@ function firestoreModelKeyCollectionTypeArray(input) {
|
|
|
6877
6966
|
/**
|
|
6878
6967
|
* Returns the parent model key from up the specified amount of levels.
|
|
6879
6968
|
*
|
|
6880
|
-
* @param input
|
|
6881
|
-
* @param maxLevelsUp
|
|
6969
|
+
* @param input - The key or reference to extract the parent key from
|
|
6970
|
+
* @param maxLevelsUp - The number of levels to traverse up the key hierarchy; defaults to 1
|
|
6971
|
+
* @returns The parent FirestoreModelKey, or undefined if no parent exists
|
|
6882
6972
|
*/ function firestoreModelKeyParentKey(input) {
|
|
6883
6973
|
var maxLevelsUp = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
6884
6974
|
var keyParts = firestoreModelKeyParentKeyPartPairs(input, maxLevelsUp);
|
|
@@ -6888,7 +6978,13 @@ function firestoreModelKeyCollectionTypeArray(input) {
|
|
|
6888
6978
|
}
|
|
6889
6979
|
return result;
|
|
6890
6980
|
}
|
|
6891
|
-
|
|
6981
|
+
/**
|
|
6982
|
+
* Returns the collection/id pair array truncated by the specified number of levels from the end.
|
|
6983
|
+
*
|
|
6984
|
+
* @param input - The key or reference to extract pairs from
|
|
6985
|
+
* @param maxLevelsUp - The number of levels to remove from the end; defaults to 1
|
|
6986
|
+
* @returns An array of FirestoreModelCollectionAndIdPair values up to the parent level, or undefined if unavailable
|
|
6987
|
+
*/ function firestoreModelKeyParentKeyPartPairs(input) {
|
|
6892
6988
|
var maxLevelsUp = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
6893
6989
|
var allParts = firestoreModelKeyPartPairs(input);
|
|
6894
6990
|
var parentParts = undefined;
|
|
@@ -6906,11 +7002,16 @@ function firestoreModelKeyParentKeyPartPairs(input) {
|
|
|
6906
7002
|
*/ function firestoreModelKeyTypePair(input) {
|
|
6907
7003
|
return lastValue(firestoreModelKeyPartPairs(input));
|
|
6908
7004
|
}
|
|
6909
|
-
|
|
7005
|
+
/**
|
|
7006
|
+
* Parses a FirestoreModelKey into an ordered array of collection/id pair objects.
|
|
7007
|
+
*
|
|
7008
|
+
* @param input - The key or reference to parse
|
|
7009
|
+
* @returns An array of FirestoreModelCollectionAndIdPair values, or undefined if the key is unavailable
|
|
7010
|
+
*/ function firestoreModelKeyPartPairs(input) {
|
|
6910
7011
|
var key = readFirestoreModelKey(input);
|
|
6911
7012
|
var pairs;
|
|
6912
7013
|
if (key) {
|
|
6913
|
-
var pieces = key
|
|
7014
|
+
var pieces = key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR);
|
|
6914
7015
|
if (isOddNumber(pieces.length)) {
|
|
6915
7016
|
throw new Error('input key source was a collection ref or unavailable.');
|
|
6916
7017
|
}
|
|
@@ -6932,7 +7033,7 @@ function firestoreModelKeyPartPairs(input) {
|
|
|
6932
7033
|
* @param input
|
|
6933
7034
|
* @returns
|
|
6934
7035
|
*/ function firestoreModelKeyPartPairsKeyPath(input) {
|
|
6935
|
-
return firestoreModelKeyPath.apply(void 0, _to_consumable_array$
|
|
7036
|
+
return firestoreModelKeyPath.apply(void 0, _to_consumable_array$9(firestoreModelKeyPartPairsPaths(input)));
|
|
6936
7037
|
}
|
|
6937
7038
|
/**
|
|
6938
7039
|
* Maps the input FirestoreModelCollectionAndIdPair[] values to FirestoreModelKeyPart[] values.
|
|
@@ -6987,7 +7088,7 @@ var FIRESTORE_DUMMY_MODEL_KEY = 'dummymodel/dummykey';
|
|
|
6987
7088
|
*
|
|
6988
7089
|
* @template T - The data type of documents in the collection
|
|
6989
7090
|
* @template D - The FirestoreDocument type that wraps the data
|
|
6990
|
-
* @param
|
|
7091
|
+
* @param inputConfig - Configuration for the collection
|
|
6991
7092
|
* @returns A fully configured FirestoreCollection instance
|
|
6992
7093
|
*/ function makeFirestoreCollection(inputConfig) {
|
|
6993
7094
|
var config = inputConfig;
|
|
@@ -7030,13 +7131,12 @@ var FIRESTORE_DUMMY_MODEL_KEY = 'dummymodel/dummykey';
|
|
|
7030
7131
|
* @param config - Configuration for the single document collection
|
|
7031
7132
|
* @returns A RootSingleItemFirestoreCollection instance configured for the specified document
|
|
7032
7133
|
*/ function makeRootSingleItemFirestoreCollection(config) {
|
|
7033
|
-
|
|
7134
|
+
return build({
|
|
7034
7135
|
base: makeFirestoreCollection(config),
|
|
7035
7136
|
build: function build(x) {
|
|
7036
7137
|
extendFirestoreCollectionWithSingleDocumentAccessor(x, config.singleItemIdentifier);
|
|
7037
7138
|
}
|
|
7038
7139
|
});
|
|
7039
|
-
return collection;
|
|
7040
7140
|
}
|
|
7041
7141
|
|
|
7042
7142
|
function _define_property$o(obj, key, value) {
|
|
@@ -7187,23 +7287,22 @@ function _object_spread_props$e(target, source) {
|
|
|
7187
7287
|
* @param config - Configuration for the single document subcollection
|
|
7188
7288
|
* @returns A subcollection instance with specialized accessors for the single document
|
|
7189
7289
|
*/ function makeSingleItemFirestoreCollection(config) {
|
|
7190
|
-
|
|
7290
|
+
return build({
|
|
7191
7291
|
base: makeFirestoreCollectionWithParent(config),
|
|
7192
7292
|
build: function build(x) {
|
|
7193
7293
|
// Extend the collection with single document accessor capabilities
|
|
7194
7294
|
extendFirestoreCollectionWithSingleDocumentAccessor(x, config.singleItemIdentifier);
|
|
7195
7295
|
}
|
|
7196
7296
|
});
|
|
7197
|
-
return collection;
|
|
7198
7297
|
}
|
|
7199
7298
|
|
|
7200
|
-
function _array_like_to_array$
|
|
7299
|
+
function _array_like_to_array$a(arr, len) {
|
|
7201
7300
|
if (len == null || len > arr.length) len = arr.length;
|
|
7202
7301
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
7203
7302
|
return arr2;
|
|
7204
7303
|
}
|
|
7205
|
-
function _array_without_holes$
|
|
7206
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
7304
|
+
function _array_without_holes$8(arr) {
|
|
7305
|
+
if (Array.isArray(arr)) return _array_like_to_array$a(arr);
|
|
7207
7306
|
}
|
|
7208
7307
|
function _define_property$n(obj, key, value) {
|
|
7209
7308
|
if (key in obj) {
|
|
@@ -7218,10 +7317,10 @@ function _define_property$n(obj, key, value) {
|
|
|
7218
7317
|
}
|
|
7219
7318
|
return obj;
|
|
7220
7319
|
}
|
|
7221
|
-
function _iterable_to_array$
|
|
7320
|
+
function _iterable_to_array$8(iter) {
|
|
7222
7321
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
7223
7322
|
}
|
|
7224
|
-
function _non_iterable_spread$
|
|
7323
|
+
function _non_iterable_spread$8() {
|
|
7225
7324
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7226
7325
|
}
|
|
7227
7326
|
function _object_spread$h(target) {
|
|
@@ -7258,16 +7357,16 @@ function _object_spread_props$d(target, source) {
|
|
|
7258
7357
|
}
|
|
7259
7358
|
return target;
|
|
7260
7359
|
}
|
|
7261
|
-
function _to_consumable_array$
|
|
7262
|
-
return _array_without_holes$
|
|
7360
|
+
function _to_consumable_array$8(arr) {
|
|
7361
|
+
return _array_without_holes$8(arr) || _iterable_to_array$8(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$8();
|
|
7263
7362
|
}
|
|
7264
|
-
function _unsupported_iterable_to_array$
|
|
7363
|
+
function _unsupported_iterable_to_array$a(o, minLen) {
|
|
7265
7364
|
if (!o) return;
|
|
7266
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
7365
|
+
if (typeof o === "string") return _array_like_to_array$a(o, minLen);
|
|
7267
7366
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7268
7367
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7269
7368
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7270
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
7369
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
|
|
7271
7370
|
}
|
|
7272
7371
|
/**
|
|
7273
7372
|
* Creates a factory function for generating FirestoreContext instances.
|
|
@@ -7283,11 +7382,10 @@ function _unsupported_iterable_to_array$9(o, minLen) {
|
|
|
7283
7382
|
return function(firestore) {
|
|
7284
7383
|
var _drivers_firestoreAccessorDriver;
|
|
7285
7384
|
var makeFirestoreCollectionConfig = function makeFirestoreCollectionConfig(config) {
|
|
7286
|
-
var
|
|
7287
|
-
var
|
|
7288
|
-
var queryLike = (_config_collection = config.collection) !== null && _config_collection !== void 0 ? _config_collection : config.queryLike;
|
|
7385
|
+
var collection = config.collection;
|
|
7386
|
+
var queryLike = collection !== null && collection !== void 0 ? collection : config.queryLike;
|
|
7289
7387
|
return _object_spread_props$d(_object_spread$h({}, config), {
|
|
7290
|
-
collection: config.converter ?
|
|
7388
|
+
collection: config.converter ? collection === null || collection === void 0 ? void 0 : collection.withConverter(config.converter) : collection,
|
|
7291
7389
|
queryLike: config.converter ? queryLike.withConverter(config.converter) : queryLike,
|
|
7292
7390
|
firestoreContext: context,
|
|
7293
7391
|
firestoreDriverIdentifier: drivers.firestoreDriverIdentifier,
|
|
@@ -7315,7 +7413,7 @@ function _unsupported_iterable_to_array$9(o, minLen) {
|
|
|
7315
7413
|
return (_drivers_firestoreAccessorDriver = drivers.firestoreAccessorDriver).collection.apply(_drivers_firestoreAccessorDriver, [
|
|
7316
7414
|
firestore,
|
|
7317
7415
|
path
|
|
7318
|
-
].concat(_to_consumable_array$
|
|
7416
|
+
].concat(_to_consumable_array$8(pathSegments)));
|
|
7319
7417
|
},
|
|
7320
7418
|
subcollection: drivers.firestoreAccessorDriver.subcollection,
|
|
7321
7419
|
runTransaction: drivers.firestoreAccessorDriver.transactionFactoryForFirestore(firestore),
|
|
@@ -7527,9 +7625,10 @@ function _ts_generator$c(thisArg, body) {
|
|
|
7527
7625
|
* // verifier can now check batches of IDs for uniqueness
|
|
7528
7626
|
* ```
|
|
7529
7627
|
*/ function firestoreIdBatchVerifierFactory(config) {
|
|
7628
|
+
var _config_makeQueryConstraints;
|
|
7530
7629
|
var readKeys = config.readKeys;
|
|
7531
7630
|
var fieldToQuery = config.fieldToQuery;
|
|
7532
|
-
var makeQueryConstraints = config.makeQueryConstraints ?
|
|
7631
|
+
var makeQueryConstraints = (_config_makeQueryConstraints = config.makeQueryConstraints) !== null && _config_makeQueryConstraints !== void 0 ? _config_makeQueryConstraints : fieldToQuery === '_id' ? function(ids) {
|
|
7533
7632
|
return whereDocumentId('in', ids);
|
|
7534
7633
|
} : function(ids) {
|
|
7535
7634
|
return where(fieldToQuery, 'in', ids);
|
|
@@ -7537,7 +7636,7 @@ function _ts_generator$c(thisArg, body) {
|
|
|
7537
7636
|
return function(collection) {
|
|
7538
7637
|
var verify = function verify(keys) {
|
|
7539
7638
|
return _async_to_generator$c(function() {
|
|
7540
|
-
var constraints, results, keysInResults
|
|
7639
|
+
var constraints, results, keysInResults;
|
|
7541
7640
|
return _ts_generator$c(this, function(_state) {
|
|
7542
7641
|
switch(_state.label){
|
|
7543
7642
|
case 0:
|
|
@@ -7548,13 +7647,12 @@ function _ts_generator$c(thisArg, body) {
|
|
|
7548
7647
|
];
|
|
7549
7648
|
case 1:
|
|
7550
7649
|
results = _state.sent();
|
|
7551
|
-
keysInResults = results.docs.
|
|
7650
|
+
keysInResults = results.docs.flatMap(function(x) {
|
|
7552
7651
|
return readKeys(x);
|
|
7553
|
-
})
|
|
7554
|
-
unusedKeys = unique(keys, keysInResults);
|
|
7652
|
+
});
|
|
7555
7653
|
return [
|
|
7556
7654
|
2,
|
|
7557
|
-
|
|
7655
|
+
unique(keys, keysInResults)
|
|
7558
7656
|
];
|
|
7559
7657
|
}
|
|
7560
7658
|
});
|
|
@@ -7576,6 +7674,7 @@ function _ts_generator$c(thisArg, body) {
|
|
|
7576
7674
|
* Checks for document existence first, then calls `set()` if the document is absent.
|
|
7577
7675
|
*
|
|
7578
7676
|
* @param accessor - the accessor to perform the existence check and set operation on
|
|
7677
|
+
* @returns a function that creates the document if it does not exist, or throws if it does
|
|
7579
7678
|
* @throws {Error} When the document already exists at the reference path
|
|
7580
7679
|
*
|
|
7581
7680
|
* @example
|
|
@@ -7615,13 +7714,13 @@ function _ts_generator$c(thisArg, body) {
|
|
|
7615
7714
|
});
|
|
7616
7715
|
}
|
|
7617
7716
|
|
|
7618
|
-
function _array_like_to_array$
|
|
7717
|
+
function _array_like_to_array$9(arr, len) {
|
|
7619
7718
|
if (len == null || len > arr.length) len = arr.length;
|
|
7620
7719
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
7621
7720
|
return arr2;
|
|
7622
7721
|
}
|
|
7623
|
-
function _array_without_holes$
|
|
7624
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
7722
|
+
function _array_without_holes$7(arr) {
|
|
7723
|
+
if (Array.isArray(arr)) return _array_like_to_array$9(arr);
|
|
7625
7724
|
}
|
|
7626
7725
|
function _define_property$m(obj, key, value) {
|
|
7627
7726
|
if (key in obj) {
|
|
@@ -7636,10 +7735,10 @@ function _define_property$m(obj, key, value) {
|
|
|
7636
7735
|
}
|
|
7637
7736
|
return obj;
|
|
7638
7737
|
}
|
|
7639
|
-
function _iterable_to_array$
|
|
7738
|
+
function _iterable_to_array$7(iter) {
|
|
7640
7739
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
7641
7740
|
}
|
|
7642
|
-
function _non_iterable_spread$
|
|
7741
|
+
function _non_iterable_spread$7() {
|
|
7643
7742
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7644
7743
|
}
|
|
7645
7744
|
function _object_spread$g(target) {
|
|
@@ -7657,16 +7756,16 @@ function _object_spread$g(target) {
|
|
|
7657
7756
|
}
|
|
7658
7757
|
return target;
|
|
7659
7758
|
}
|
|
7660
|
-
function _to_consumable_array$
|
|
7661
|
-
return _array_without_holes$
|
|
7759
|
+
function _to_consumable_array$7(arr) {
|
|
7760
|
+
return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$7();
|
|
7662
7761
|
}
|
|
7663
|
-
function _unsupported_iterable_to_array$
|
|
7762
|
+
function _unsupported_iterable_to_array$9(o, minLen) {
|
|
7664
7763
|
if (!o) return;
|
|
7665
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
7764
|
+
if (typeof o === "string") return _array_like_to_array$9(o, minLen);
|
|
7666
7765
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7667
7766
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7668
7767
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7669
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
7768
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
|
|
7670
7769
|
}
|
|
7671
7770
|
/**
|
|
7672
7771
|
* Converts a {@link FirestoreAccessorArrayUpdate} into Firestore `UpdateData` using the
|
|
@@ -7687,15 +7786,15 @@ function _unsupported_iterable_to_array$8(o, minLen) {
|
|
|
7687
7786
|
* await updateDoc(docRef, updateData);
|
|
7688
7787
|
* ```
|
|
7689
7788
|
*/ function firestoreClientArrayUpdateToUpdateData(input) {
|
|
7690
|
-
var union = input
|
|
7691
|
-
var remove = input
|
|
7789
|
+
var union = input.union;
|
|
7790
|
+
var remove = input.remove;
|
|
7692
7791
|
function createUpdatesWithArrayFunction(fieldUpdate, arrayUpdateFunction) {
|
|
7693
7792
|
var result;
|
|
7694
7793
|
if (fieldUpdate) {
|
|
7695
7794
|
result = mapObjectMap(fieldUpdate, function(arrayUpdate) {
|
|
7696
7795
|
var result;
|
|
7697
7796
|
if (arrayUpdate) {
|
|
7698
|
-
result = arrayUpdateFunction.apply(void 0, _to_consumable_array$
|
|
7797
|
+
result = arrayUpdateFunction.apply(void 0, _to_consumable_array$7(arrayUpdate)); // use spread operator to insert each value as an argument, as "nested arrays" are not allowed in the Firestore
|
|
7699
7798
|
}
|
|
7700
7799
|
return result;
|
|
7701
7800
|
});
|
|
@@ -7834,6 +7933,8 @@ function _define_property$l(obj, key, value) {
|
|
|
7834
7933
|
* Creates a {@link FirestoreDocumentDataAccessorFactory} that produces {@link DefaultFirestoreDocumentDataAccessor} instances
|
|
7835
7934
|
* for direct (non-batched, non-transactional) Firestore operations.
|
|
7836
7935
|
*
|
|
7936
|
+
* @returns a factory that creates default (non-transactional) document data accessors
|
|
7937
|
+
*
|
|
7837
7938
|
* @example
|
|
7838
7939
|
* ```ts
|
|
7839
7940
|
* const factory = defaultFirestoreAccessorFactory<MyModel>();
|
|
@@ -7854,6 +7955,8 @@ function _define_property$l(obj, key, value) {
|
|
|
7854
7955
|
* The context type is {@link FirestoreDocumentContextType.NONE}, meaning operations execute immediately
|
|
7855
7956
|
* against Firestore without transaction or batch grouping.
|
|
7856
7957
|
*
|
|
7958
|
+
* @returns a default {@link FirestoreDocumentContext} with no transaction or batch semantics
|
|
7959
|
+
*
|
|
7857
7960
|
* @example
|
|
7858
7961
|
* ```ts
|
|
7859
7962
|
* const context = defaultFirestoreDocumentContext<MyModel>();
|
|
@@ -8007,6 +8110,7 @@ function _is_native_reflect_construct$7() {
|
|
|
8007
8110
|
* into the same batch.
|
|
8008
8111
|
*
|
|
8009
8112
|
* @param writeBatch - the Firestore `WriteBatch` to queue operations into
|
|
8113
|
+
* @returns a factory that creates write-batch-backed document data accessors for any document reference
|
|
8010
8114
|
*
|
|
8011
8115
|
* @example
|
|
8012
8116
|
* ```ts
|
|
@@ -8052,6 +8156,7 @@ function _is_native_reflect_construct$7() {
|
|
|
8052
8156
|
* Factory function that creates a {@link WriteBatchFirestoreDocumentContext} for the given batch.
|
|
8053
8157
|
*
|
|
8054
8158
|
* @param batch - the Firestore `WriteBatch` to use for all document operations
|
|
8159
|
+
* @returns a new {@link WriteBatchFirestoreDocumentContext} bound to the given batch
|
|
8055
8160
|
*
|
|
8056
8161
|
* @example
|
|
8057
8162
|
* ```ts
|
|
@@ -8196,6 +8301,7 @@ function _define_property$j(obj, key, value) {
|
|
|
8196
8301
|
* instances bound to the given transaction. All operations from these accessors participate in the same transaction.
|
|
8197
8302
|
*
|
|
8198
8303
|
* @param transaction - the Firestore `Transaction` to bind operations to
|
|
8304
|
+
* @returns a factory that creates transaction-backed document data accessors for any document reference
|
|
8199
8305
|
*
|
|
8200
8306
|
* @example
|
|
8201
8307
|
* ```ts
|
|
@@ -8242,6 +8348,7 @@ function _define_property$j(obj, key, value) {
|
|
|
8242
8348
|
* Factory function that creates a {@link TransactionFirestoreDocumentContext} for the given transaction.
|
|
8243
8349
|
*
|
|
8244
8350
|
* @param transaction - the Firestore `Transaction` to use for all document operations
|
|
8351
|
+
* @returns a new {@link TransactionFirestoreDocumentContext} bound to the given transaction
|
|
8245
8352
|
*
|
|
8246
8353
|
* @example
|
|
8247
8354
|
* ```ts
|
|
@@ -8389,6 +8496,8 @@ function _ts_generator$b(thisArg, body) {
|
|
|
8389
8496
|
* - Transaction and write batch context factories for atomic operations
|
|
8390
8497
|
* - A default (non-transactional) document context
|
|
8391
8498
|
*
|
|
8499
|
+
* @returns a {@link FirestoreAccessorDriver} backed by the `firebase/firestore` client SDK
|
|
8500
|
+
*
|
|
8392
8501
|
* @example
|
|
8393
8502
|
* ```ts
|
|
8394
8503
|
* const driver = firestoreClientAccessorDriver();
|
|
@@ -8405,18 +8514,10 @@ function _ts_generator$b(thisArg, body) {
|
|
|
8405
8514
|
return function(fn) {
|
|
8406
8515
|
return _async_to_generator$b(function() {
|
|
8407
8516
|
return _ts_generator$b(this, function(_state) {
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
runTransaction(firestore, fn)
|
|
8413
|
-
];
|
|
8414
|
-
case 1:
|
|
8415
|
-
return [
|
|
8416
|
-
2,
|
|
8417
|
-
_state.sent()
|
|
8418
|
-
];
|
|
8419
|
-
}
|
|
8517
|
+
return [
|
|
8518
|
+
2,
|
|
8519
|
+
runTransaction(firestore, fn)
|
|
8520
|
+
];
|
|
8420
8521
|
});
|
|
8421
8522
|
})();
|
|
8422
8523
|
};
|
|
@@ -8432,13 +8533,13 @@ function _ts_generator$b(thisArg, body) {
|
|
|
8432
8533
|
};
|
|
8433
8534
|
}
|
|
8434
8535
|
|
|
8435
|
-
function _array_like_to_array$
|
|
8536
|
+
function _array_like_to_array$8(arr, len) {
|
|
8436
8537
|
if (len == null || len > arr.length) len = arr.length;
|
|
8437
8538
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8438
8539
|
return arr2;
|
|
8439
8540
|
}
|
|
8440
|
-
function _array_without_holes$
|
|
8441
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
8541
|
+
function _array_without_holes$6(arr) {
|
|
8542
|
+
if (Array.isArray(arr)) return _array_like_to_array$8(arr);
|
|
8442
8543
|
}
|
|
8443
8544
|
function _define_property$i(obj, key, value) {
|
|
8444
8545
|
if (key in obj) {
|
|
@@ -8453,10 +8554,10 @@ function _define_property$i(obj, key, value) {
|
|
|
8453
8554
|
}
|
|
8454
8555
|
return obj;
|
|
8455
8556
|
}
|
|
8456
|
-
function _iterable_to_array$
|
|
8557
|
+
function _iterable_to_array$6(iter) {
|
|
8457
8558
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
8458
8559
|
}
|
|
8459
|
-
function _non_iterable_spread$
|
|
8560
|
+
function _non_iterable_spread$6() {
|
|
8460
8561
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8461
8562
|
}
|
|
8462
8563
|
function _object_spread$f(target) {
|
|
@@ -8493,26 +8594,29 @@ function _object_spread_props$c(target, source) {
|
|
|
8493
8594
|
}
|
|
8494
8595
|
return target;
|
|
8495
8596
|
}
|
|
8496
|
-
function _to_consumable_array$
|
|
8497
|
-
return _array_without_holes$
|
|
8597
|
+
function _to_consumable_array$6(arr) {
|
|
8598
|
+
return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$6();
|
|
8498
8599
|
}
|
|
8499
|
-
function _unsupported_iterable_to_array$
|
|
8600
|
+
function _unsupported_iterable_to_array$8(o, minLen) {
|
|
8500
8601
|
if (!o) return;
|
|
8501
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
8602
|
+
if (typeof o === "string") return _array_like_to_array$8(o, minLen);
|
|
8502
8603
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8503
8604
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8504
8605
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
8505
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
8606
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
|
|
8506
8607
|
}
|
|
8507
8608
|
/**
|
|
8508
8609
|
* Appends one or more `QueryConstraint` values to the builder, returning a new builder instance.
|
|
8509
8610
|
*
|
|
8510
8611
|
* @param builder - current query builder state
|
|
8511
8612
|
* @param constraint - constraint(s) to append
|
|
8613
|
+
* @returns a new {@link FirebaseFirestoreQueryBuilder} with the added constraint(s)
|
|
8512
8614
|
*/ function addConstraintToBuilder(builder, constraint) {
|
|
8513
8615
|
return {
|
|
8514
8616
|
query: builder.query,
|
|
8515
|
-
constraints: builder.constraints.concat(constraint)
|
|
8617
|
+
constraints: _to_consumable_array$6(builder.constraints).concat(_to_consumable_array$6(Array.isArray(constraint) ? constraint : [
|
|
8618
|
+
constraint
|
|
8619
|
+
]))
|
|
8516
8620
|
};
|
|
8517
8621
|
}
|
|
8518
8622
|
var _obj;
|
|
@@ -8535,13 +8639,13 @@ var _obj;
|
|
|
8535
8639
|
}), _define_property$i(_obj, FIRESTORE_OFFSET_QUERY_CONSTRAINT_TYPE, undefined), _define_property$i(_obj, FIRESTORE_START_AT_QUERY_CONSTRAINT_TYPE, function(builder, data) {
|
|
8536
8640
|
return addConstraintToBuilder(builder, startAt$1(data.snapshot));
|
|
8537
8641
|
}), _define_property$i(_obj, FIRESTORE_START_AT_VALUE_QUERY_CONSTRAINT_TYPE, function(builder, data) {
|
|
8538
|
-
return addConstraintToBuilder(builder, startAt$1.apply(void 0, _to_consumable_array$
|
|
8642
|
+
return addConstraintToBuilder(builder, startAt$1.apply(void 0, _to_consumable_array$6(data.fieldValues)));
|
|
8539
8643
|
}), _define_property$i(_obj, FIRESTORE_START_AFTER_QUERY_CONSTRAINT_TYPE, function(builder, data) {
|
|
8540
8644
|
return addConstraintToBuilder(builder, startAfter$1(data.snapshot));
|
|
8541
8645
|
}), _define_property$i(_obj, FIRESTORE_END_AT_QUERY_CONSTRAINT_TYPE, function(builder, data) {
|
|
8542
8646
|
return addConstraintToBuilder(builder, endAt$1(data.snapshot));
|
|
8543
8647
|
}), _define_property$i(_obj, FIRESTORE_END_AT_VALUE_QUERY_CONSTRAINT_TYPE, function(builder, data) {
|
|
8544
|
-
return addConstraintToBuilder(builder, endAt$1.apply(void 0, _to_consumable_array$
|
|
8648
|
+
return addConstraintToBuilder(builder, endAt$1.apply(void 0, _to_consumable_array$6(data.fieldValues)));
|
|
8545
8649
|
}), _define_property$i(_obj, FIRESTORE_END_BEFORE_QUERY_CONSTRAINT_TYPE, function(builder, data) {
|
|
8546
8650
|
return addConstraintToBuilder(builder, endBefore$1(data.snapshot));
|
|
8547
8651
|
}), _obj);
|
|
@@ -8550,6 +8654,8 @@ var _obj;
|
|
|
8550
8654
|
*
|
|
8551
8655
|
* Converts abstract query constraints into `firebase/firestore` `QueryConstraint` objects
|
|
8552
8656
|
* and composes them into an executable `Query`.
|
|
8657
|
+
*
|
|
8658
|
+
* @returns a {@link FirestoreQueryConstraintFunctionsDriver} backed by the `firebase/firestore` client SDK
|
|
8553
8659
|
*/ function firebaseFirestoreQueryConstraintFunctionsDriver() {
|
|
8554
8660
|
return makeFirestoreQueryConstraintFunctionsDriver({
|
|
8555
8661
|
mapping: FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING,
|
|
@@ -8563,7 +8669,7 @@ var _obj;
|
|
|
8563
8669
|
var initialQuery = param.query, constraints = param.constraints;
|
|
8564
8670
|
return query.apply(void 0, [
|
|
8565
8671
|
initialQuery
|
|
8566
|
-
].concat(_to_consumable_array$
|
|
8672
|
+
].concat(_to_consumable_array$6(constraints)));
|
|
8567
8673
|
},
|
|
8568
8674
|
documentIdFieldPath: function documentIdFieldPath() {
|
|
8569
8675
|
return documentId();
|
|
@@ -8577,6 +8683,8 @@ var _obj;
|
|
|
8577
8683
|
* Note: Transactions are not supported for queries on the client; passing a `transaction` to `getDocs`
|
|
8578
8684
|
* will throw an error.
|
|
8579
8685
|
*
|
|
8686
|
+
* @returns a {@link FirestoreQueryDriver} backed by the `firebase/firestore` client SDK
|
|
8687
|
+
*
|
|
8580
8688
|
* @example
|
|
8581
8689
|
* ```ts
|
|
8582
8690
|
* const queryDriver = firebaseFirestoreQueryDriver();
|
|
@@ -8611,6 +8719,8 @@ var _obj;
|
|
|
8611
8719
|
* Provides accessor drivers (default, batch, transaction) and query drivers for use
|
|
8612
8720
|
* with {@link clientFirebaseFirestoreContextFactory}.
|
|
8613
8721
|
*
|
|
8722
|
+
* @returns the client-side {@link FirebaseFirestoreClientDrivers} for the `firebase/firestore` SDK
|
|
8723
|
+
*
|
|
8614
8724
|
* @example
|
|
8615
8725
|
* ```ts
|
|
8616
8726
|
* const drivers = firebaseFirestoreClientDrivers();
|
|
@@ -8790,6 +8900,7 @@ function _is_native_reflect_construct$6() {
|
|
|
8790
8900
|
* structured error details from the error's `details` property if available.
|
|
8791
8901
|
*
|
|
8792
8902
|
* @param error - the Firebase error from an `HttpsCallable` failure
|
|
8903
|
+
* @returns a new {@link FirebaseServerError} wrapping the given Firebase error with structured server error details
|
|
8793
8904
|
*/ function fromFirebaseError(error) {
|
|
8794
8905
|
var details = error.details;
|
|
8795
8906
|
details = _object_spread$e({
|
|
@@ -9055,6 +9166,7 @@ function mapHttpsCallable(callable, wrap) {
|
|
|
9055
9166
|
* Errors are converted to readable errors via {@link convertHttpsCallableErrorToReadableError}.
|
|
9056
9167
|
*
|
|
9057
9168
|
* @param callable - the `HttpsCallable` to wrap
|
|
9169
|
+
* @returns a {@link DirectDataHttpsCallable} that resolves to the response data directly
|
|
9058
9170
|
*
|
|
9059
9171
|
* @example
|
|
9060
9172
|
* ```ts
|
|
@@ -9077,6 +9189,7 @@ function mapHttpsCallable(callable, wrap) {
|
|
|
9077
9189
|
* to preserve server-side error context. Otherwise, converts it to a generic readable error via `toReadableError`.
|
|
9078
9190
|
*
|
|
9079
9191
|
* @param error - the caught error from an `HttpsCallable` invocation
|
|
9192
|
+
* @returns a {@link FirebaseServerError} if the error has structured details, or a generic readable error otherwise
|
|
9080
9193
|
*/ function convertHttpsCallableErrorToReadableError(error) {
|
|
9081
9194
|
var result;
|
|
9082
9195
|
if ((typeof error === "undefined" ? "undefined" : _type_of$6(error)) === 'object') {
|
|
@@ -9091,7 +9204,7 @@ function mapHttpsCallable(callable, wrap) {
|
|
|
9091
9204
|
return result;
|
|
9092
9205
|
}
|
|
9093
9206
|
|
|
9094
|
-
|
|
9207
|
+
// The use of any here does not degrade the type-safety. The correct type is inferred in most cases.
|
|
9095
9208
|
/**
|
|
9096
9209
|
* Creates a {@link FirebaseFunctionMapFactory} from a configuration map.
|
|
9097
9210
|
*
|
|
@@ -9099,6 +9212,7 @@ function mapHttpsCallable(callable, wrap) {
|
|
|
9099
9212
|
* for direct data access. Per-key options (e.g., timeout) are applied if provided.
|
|
9100
9213
|
*
|
|
9101
9214
|
* @param configMap - maps function keys to their optional configuration
|
|
9215
|
+
* @returns a {@link FirebaseFunctionMapFactory} that creates a typed callable function map for a given `Functions` instance
|
|
9102
9216
|
*
|
|
9103
9217
|
* @example
|
|
9104
9218
|
* ```ts
|
|
@@ -9119,8 +9233,7 @@ function mapHttpsCallable(callable, wrap) {
|
|
|
9119
9233
|
var fn = directDataHttpsCallable(httpsCallable(functionsInstance, key, httpCallableOptions));
|
|
9120
9234
|
return fn;
|
|
9121
9235
|
};
|
|
9122
|
-
|
|
9123
|
-
return result;
|
|
9236
|
+
return mapObjectMap(configMap, mapFn);
|
|
9124
9237
|
};
|
|
9125
9238
|
}
|
|
9126
9239
|
/**
|
|
@@ -9130,6 +9243,7 @@ function mapHttpsCallable(callable, wrap) {
|
|
|
9130
9243
|
* so `httpsCallable` instances are only created when actually needed.
|
|
9131
9244
|
*
|
|
9132
9245
|
* @param configMap - maps each function group key to its `[ClassType, Factory]` tuple
|
|
9246
|
+
* @returns a {@link LazyFirebaseFunctionsFactory} that creates a lazy-loaded function map for a given `Functions` instance
|
|
9133
9247
|
*
|
|
9134
9248
|
* @example
|
|
9135
9249
|
* ```ts
|
|
@@ -9164,6 +9278,7 @@ function mapHttpsCallable(callable, wrap) {
|
|
|
9164
9278
|
* The returned function builds {@link OnCallTypedModelParams} for any model type.
|
|
9165
9279
|
*
|
|
9166
9280
|
* @param call - the CRUD call type to embed in generated params
|
|
9281
|
+
* @returns an {@link OnCallTypeModelParamsFunction} pre-configured with the given call type
|
|
9167
9282
|
* @throws {Error} When `modelType` is not provided or empty.
|
|
9168
9283
|
*
|
|
9169
9284
|
* @example
|
|
@@ -9196,10 +9311,13 @@ function mapHttpsCallable(callable, wrap) {
|
|
|
9196
9311
|
*
|
|
9197
9312
|
* @deprecated Move towards using onCallTypedModelParamsFunction directly with the call type instead of using this function. Will not be removed in the future.
|
|
9198
9313
|
*
|
|
9199
|
-
* @param
|
|
9200
|
-
* @param data
|
|
9201
|
-
* @
|
|
9202
|
-
|
|
9314
|
+
* @param modelTypeInput - the model type string or ref
|
|
9315
|
+
* @param data - the call payload
|
|
9316
|
+
* @param specifier - optional sub-function specifier
|
|
9317
|
+
* @param call - the CRUD call type
|
|
9318
|
+
* @returns the constructed {@link OnCallTypedModelParams}
|
|
9319
|
+
*/ // eslint-disable-next-line @typescript-eslint/max-params -- deprecated function, not worth refactoring
|
|
9320
|
+
function onCallTypedModelParams(modelTypeInput, data, specifier, call) {
|
|
9203
9321
|
return onCallTypedModelParamsFunction(call)(modelTypeInput, data, specifier);
|
|
9204
9322
|
}
|
|
9205
9323
|
/**
|
|
@@ -9221,6 +9339,7 @@ function mapHttpsCallable(callable, wrap) {
|
|
|
9221
9339
|
* Creates an {@link OnCallCreateModelResult} from document references by extracting their paths as model keys.
|
|
9222
9340
|
*
|
|
9223
9341
|
* @param result - document reference(s) from a create operation
|
|
9342
|
+
* @returns an {@link OnCallCreateModelResult} with model keys extracted from document paths
|
|
9224
9343
|
*
|
|
9225
9344
|
* @example
|
|
9226
9345
|
* ```ts
|
|
@@ -9236,13 +9355,14 @@ function mapHttpsCallable(callable, wrap) {
|
|
|
9236
9355
|
* Creates an {@link OnCallCreateModelResult} from model key(s), normalizing to an array.
|
|
9237
9356
|
*
|
|
9238
9357
|
* @param modelKeys - the model key(s) of the created document(s)
|
|
9358
|
+
* @returns an {@link OnCallCreateModelResult} containing the keys as an array
|
|
9239
9359
|
*/ function onCallCreateModelResult(modelKeys) {
|
|
9240
9360
|
return {
|
|
9241
9361
|
modelKeys: asArray(modelKeys)
|
|
9242
9362
|
};
|
|
9243
9363
|
}
|
|
9244
9364
|
|
|
9245
|
-
function _array_like_to_array$
|
|
9365
|
+
function _array_like_to_array$7(arr, len) {
|
|
9246
9366
|
if (len == null || len > arr.length) len = arr.length;
|
|
9247
9367
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
9248
9368
|
return arr2;
|
|
@@ -9278,15 +9398,15 @@ function _non_iterable_rest$2() {
|
|
|
9278
9398
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9279
9399
|
}
|
|
9280
9400
|
function _sliced_to_array$2(arr, i) {
|
|
9281
|
-
return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$
|
|
9401
|
+
return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$2();
|
|
9282
9402
|
}
|
|
9283
|
-
function _unsupported_iterable_to_array$
|
|
9403
|
+
function _unsupported_iterable_to_array$7(o, minLen) {
|
|
9284
9404
|
if (!o) return;
|
|
9285
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
9405
|
+
if (typeof o === "string") return _array_like_to_array$7(o, minLen);
|
|
9286
9406
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9287
9407
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9288
9408
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
9289
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
9409
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
|
|
9290
9410
|
}
|
|
9291
9411
|
/**
|
|
9292
9412
|
* Default specifier string (`'_'`) used when a CRUD operation has specifiers but one
|
|
@@ -9309,6 +9429,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
9309
9429
|
*
|
|
9310
9430
|
* @param configMap - configuration for custom (non-CRUD) functions
|
|
9311
9431
|
* @param crudConfigMap - configuration for model CRUD functions with optional specifiers
|
|
9432
|
+
* @returns a {@link ModelFirebaseFunctionMapFactory} that creates a combined custom and CRUD function map for a given `Functions` instance
|
|
9312
9433
|
*
|
|
9313
9434
|
* @example
|
|
9314
9435
|
* ```ts
|
|
@@ -9323,22 +9444,22 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
9323
9444
|
*/ function callModelFirebaseFunctionMapFactory(configMap, crudConfigMap) {
|
|
9324
9445
|
var functionFactory = firebaseFunctionMapFactory(configMap);
|
|
9325
9446
|
return function(functionsInstance) {
|
|
9326
|
-
var makeCallFunction = function makeCallFunction(
|
|
9327
|
-
return mapHttpsCallable(fn(), {
|
|
9447
|
+
var makeCallFunction = function makeCallFunction(callFn, modelType, specifier) {
|
|
9448
|
+
return mapHttpsCallable(callFn.fn(), {
|
|
9328
9449
|
mapInput: function mapInput(data) {
|
|
9329
|
-
return onCallTypedModelParamsFunction(call)(modelType, data, specifier);
|
|
9450
|
+
return onCallTypedModelParamsFunction(callFn.call)(modelType, data, specifier);
|
|
9330
9451
|
}
|
|
9331
9452
|
}, true);
|
|
9332
9453
|
};
|
|
9333
|
-
var makeCallSpecifiers = function makeCallSpecifiers(
|
|
9454
|
+
var makeCallSpecifiers = function makeCallSpecifiers(callFn, modelType, specifierKeys) {
|
|
9334
9455
|
var modelTypeSuffix = capitalizeFirstLetter(modelType);
|
|
9335
9456
|
var specifiers = {};
|
|
9336
9457
|
specifierKeys.forEach(function(inputSpecifier) {
|
|
9337
9458
|
var specifier = inputSpecifier === MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT ? '' : inputSpecifier;
|
|
9338
|
-
var specifierFn = makeCallFunction(
|
|
9339
|
-
var fullSpecifierName = "".concat(call).concat(modelTypeSuffix).concat(capitalizeFirstLetter(specifier));
|
|
9459
|
+
var specifierFn = makeCallFunction(callFn, modelType, inputSpecifier);
|
|
9460
|
+
var fullSpecifierName = "".concat(callFn.call).concat(modelTypeSuffix).concat(capitalizeFirstLetter(specifier));
|
|
9340
9461
|
specifiers[fullSpecifierName] = specifierFn;
|
|
9341
|
-
var shortSpecifierName = lowercaseFirstLetter(specifier) || call;
|
|
9462
|
+
var shortSpecifierName = lowercaseFirstLetter(specifier) || callFn.call;
|
|
9342
9463
|
specifiers[shortSpecifierName] = specifierFn;
|
|
9343
9464
|
});
|
|
9344
9465
|
return specifiers;
|
|
@@ -9347,7 +9468,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
9347
9468
|
var _callFn = cachedGetter(function() {
|
|
9348
9469
|
return httpsCallable(functionsInstance, CALL_MODEL_APP_FUNCTION_KEY);
|
|
9349
9470
|
});
|
|
9350
|
-
|
|
9471
|
+
return build({
|
|
9351
9472
|
base: functionMap,
|
|
9352
9473
|
build: function build(x) {
|
|
9353
9474
|
Object.entries(crudConfigMap).forEach(function(param) {
|
|
@@ -9361,10 +9482,14 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
9361
9482
|
};
|
|
9362
9483
|
var addCallFunctions = function addCallFunctions(crud, fn, modelType) {
|
|
9363
9484
|
var crudFns;
|
|
9485
|
+
var callFn = {
|
|
9486
|
+
call: crud,
|
|
9487
|
+
fn: fn
|
|
9488
|
+
};
|
|
9364
9489
|
if (crudFunctions.has(crud)) {
|
|
9365
|
-
crudFns = makeCallFunction(
|
|
9490
|
+
crudFns = makeCallFunction(callFn, modelType);
|
|
9366
9491
|
} else if (specifierFunctions.has(crud)) {
|
|
9367
|
-
crudFns = makeCallSpecifiers(
|
|
9492
|
+
crudFns = makeCallSpecifiers(callFn, modelType, specifierFunctions.get(crud));
|
|
9368
9493
|
}
|
|
9369
9494
|
if (crudFns) {
|
|
9370
9495
|
modelTypeCalls["".concat(crud).concat(modelTypeSuffix)] = crudFns;
|
|
@@ -9372,7 +9497,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
9372
9497
|
};
|
|
9373
9498
|
var modelTypeSuffix = capitalizeFirstLetter(modelType);
|
|
9374
9499
|
var _separateValues = separateValues(config, function(x) {
|
|
9375
|
-
return x.
|
|
9500
|
+
return !x.includes(':');
|
|
9376
9501
|
}), crudFunctionKeys = _separateValues.included, specifiedCallFunctionKeys = _separateValues.excluded;
|
|
9377
9502
|
var crudFunctions = new Set(crudFunctionKeys);
|
|
9378
9503
|
var specifiedCallFunctionTuples = specifiedCallFunctionKeys.map(function(x) {
|
|
@@ -9403,7 +9528,6 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
9403
9528
|
});
|
|
9404
9529
|
}
|
|
9405
9530
|
});
|
|
9406
|
-
return result;
|
|
9407
9531
|
};
|
|
9408
9532
|
}
|
|
9409
9533
|
|
|
@@ -9412,6 +9536,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
9412
9536
|
*
|
|
9413
9537
|
* @param specifier - the development function to invoke
|
|
9414
9538
|
* @param data - the call payload
|
|
9539
|
+
* @returns an {@link OnCallDevelopmentParams} envelope ready to send to the dev endpoint
|
|
9415
9540
|
*
|
|
9416
9541
|
* @example
|
|
9417
9542
|
* ```ts
|
|
@@ -9437,6 +9562,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
9437
9562
|
* through a single endpoint. The function specifier and data are wrapped via {@link onCallDevelopmentParams}.
|
|
9438
9563
|
*
|
|
9439
9564
|
* @param configMap - maps each development function key to optional configuration
|
|
9565
|
+
* @returns a factory that creates a {@link DevelopmentFirebaseFunctionMap} for a given `Functions` instance
|
|
9440
9566
|
*
|
|
9441
9567
|
* @example
|
|
9442
9568
|
* ```ts
|
|
@@ -9489,6 +9615,7 @@ function _class_call_check$c(instance, Constructor) {
|
|
|
9489
9615
|
* Useful when you need an independent reference that won't be affected by mutations to the original.
|
|
9490
9616
|
*
|
|
9491
9617
|
* @param path - the storage path to copy
|
|
9618
|
+
* @returns a new {@link StoragePath} with the same `bucketId` and `pathString`
|
|
9492
9619
|
*
|
|
9493
9620
|
* @example
|
|
9494
9621
|
* ```ts
|
|
@@ -9505,6 +9632,7 @@ function _class_call_check$c(instance, Constructor) {
|
|
|
9505
9632
|
* with a consistent bucket assignment.
|
|
9506
9633
|
*
|
|
9507
9634
|
* @param config - bucket and replacement behavior
|
|
9635
|
+
* @returns a {@link StoragePathFactory} that normalizes path inputs with the configured bucket
|
|
9508
9636
|
*
|
|
9509
9637
|
* @example
|
|
9510
9638
|
* ```ts
|
|
@@ -9527,7 +9655,7 @@ function _class_call_check$c(instance, Constructor) {
|
|
|
9527
9655
|
} else {
|
|
9528
9656
|
return {
|
|
9529
9657
|
pathString: pathString,
|
|
9530
|
-
bucketId: inputBucketId
|
|
9658
|
+
bucketId: inputBucketId !== null && inputBucketId !== void 0 ? inputBucketId : bucketId
|
|
9531
9659
|
};
|
|
9532
9660
|
}
|
|
9533
9661
|
};
|
|
@@ -9539,6 +9667,7 @@ function _class_call_check$c(instance, Constructor) {
|
|
|
9539
9667
|
* (implying the default bucket).
|
|
9540
9668
|
*
|
|
9541
9669
|
* @param path - the storage path to convert
|
|
9670
|
+
* @returns a {@link GoogleCloudStorageFilePath} string (`gs://bucket/path` or a relative path)
|
|
9542
9671
|
*
|
|
9543
9672
|
* @example
|
|
9544
9673
|
* ```ts
|
|
@@ -9561,6 +9690,7 @@ function _class_call_check$c(instance, Constructor) {
|
|
|
9561
9690
|
* Returns the `gs://` bucket prefix URI for the given bucket identifier or ref.
|
|
9562
9691
|
*
|
|
9563
9692
|
* @param storage - bucket ID string or a {@link StorageBucketIdRef}
|
|
9693
|
+
* @returns the `gs://bucket` prefix URI as a {@link GoogleCloudStorageBucketPrefix}
|
|
9564
9694
|
*
|
|
9565
9695
|
* @example
|
|
9566
9696
|
* ```ts
|
|
@@ -9604,13 +9734,27 @@ var FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY = 'resetCommunicationAt'
|
|
|
9604
9734
|
return (_x_auth = x.auth) === null || _x_auth === void 0 ? void 0 : _x_auth.uid;
|
|
9605
9735
|
});
|
|
9606
9736
|
|
|
9607
|
-
/**
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
/**
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
/**
|
|
9737
|
+
/**
|
|
9738
|
+
* Error code when the user account is not found.
|
|
9739
|
+
*/ var FIREBASE_AUTH_USER_NOT_FOUND_ERROR = 'auth/user-not-found';
|
|
9740
|
+
/**
|
|
9741
|
+
* Error code when the password is incorrect.
|
|
9742
|
+
*/ var FIREBASE_AUTH_WRONG_PASSWORD = 'auth/wrong-password';
|
|
9743
|
+
/**
|
|
9744
|
+
* Error code for a network request error (client SDK).
|
|
9745
|
+
*/ var FIREBASE_AUTH_NETWORK_REQUEST_ERROR = 'auth/network-request-error';
|
|
9746
|
+
/**
|
|
9747
|
+
* Error code for a failed network request (client SDK).
|
|
9748
|
+
*/ var FIREBASE_AUTH_NETWORK_REQUEST_FAILED = 'auth/network-request-failed';
|
|
9749
|
+
/**
|
|
9750
|
+
* Error code when a phone number is already associated with another account.
|
|
9751
|
+
*/ var FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR = 'auth/phone-number-already-exists';
|
|
9752
|
+
/**
|
|
9753
|
+
* Error code when an email is already associated with another account.
|
|
9754
|
+
*/ var FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR = 'auth/email-already-exists';
|
|
9755
|
+
/**
|
|
9756
|
+
* Error code when the provided phone number is not a valid E.164 string.
|
|
9757
|
+
*/ var FIREBASE_AUTH_INVALID_PHONE_NUMBER_ERROR = 'auth/invalid-phone-number';
|
|
9614
9758
|
/**
|
|
9615
9759
|
* Converts a {@link FirebaseAuthError} into a user-friendly {@link ReadableError} with a human-readable message.
|
|
9616
9760
|
*
|
|
@@ -9618,6 +9762,7 @@ var FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY = 'resetCommunicationAt'
|
|
|
9618
9762
|
* suitable for display in the UI.
|
|
9619
9763
|
*
|
|
9620
9764
|
* @param inputError - the Firebase Auth error to convert
|
|
9765
|
+
* @returns a {@link ReadableError} with a human-readable message suitable for display
|
|
9621
9766
|
*
|
|
9622
9767
|
* @example
|
|
9623
9768
|
* ```ts
|
|
@@ -9721,6 +9866,7 @@ function _define_property$f(obj, key, value) {
|
|
|
9721
9866
|
* Automatically uses a transaction accessor when the context has an active transaction.
|
|
9722
9867
|
*
|
|
9723
9868
|
* @param getFirestoreCollection - function to retrieve the Firestore collection from context
|
|
9869
|
+
* @returns a {@link FirebaseModelLoader} that loads document wrappers for given keys
|
|
9724
9870
|
*
|
|
9725
9871
|
* @example
|
|
9726
9872
|
* ```ts
|
|
@@ -9737,8 +9883,7 @@ function _define_property$f(obj, key, value) {
|
|
|
9737
9883
|
} else {
|
|
9738
9884
|
documentAccessor = firestoreCollection.documentAccessor();
|
|
9739
9885
|
}
|
|
9740
|
-
|
|
9741
|
-
return document;
|
|
9886
|
+
return documentAccessor.loadDocumentForKey(key);
|
|
9742
9887
|
}
|
|
9743
9888
|
};
|
|
9744
9889
|
}
|
|
@@ -9746,17 +9891,17 @@ function _define_property$f(obj, key, value) {
|
|
|
9746
9891
|
/**
|
|
9747
9892
|
* ArkType schema for a FirestoreModelKey (full path like "collection/12345").
|
|
9748
9893
|
*/ var firestoreModelKeyType = type('string > 0').narrow(function(val, ctx) {
|
|
9749
|
-
return
|
|
9894
|
+
return isFirestoreModelKey(val) || ctx.mustBe('a valid FirestoreModelKey');
|
|
9750
9895
|
});
|
|
9751
9896
|
/**
|
|
9752
9897
|
* ArkType schema for a FirestoreModelId (document ID like "12345").
|
|
9753
9898
|
*/ var firestoreModelIdType = type('string > 0').narrow(function(val, ctx) {
|
|
9754
|
-
return
|
|
9899
|
+
return isFirestoreModelId(val) || ctx.mustBe('a valid FirestoreModelId');
|
|
9755
9900
|
});
|
|
9756
9901
|
/**
|
|
9757
9902
|
* ArkType schema for a FirestoreModelId or FirestoreModelKey.
|
|
9758
9903
|
*/ var firestoreModelIdOrKeyType = type('string > 0').narrow(function(val, ctx) {
|
|
9759
|
-
return
|
|
9904
|
+
return isFirestoreModelIdOrKey(val) || ctx.mustBe('a valid FirestoreModelId or FirestoreModelKey');
|
|
9760
9905
|
});
|
|
9761
9906
|
|
|
9762
9907
|
/**
|
|
@@ -10065,6 +10210,7 @@ function _ts_generator$9(thisArg, body) {
|
|
|
10065
10210
|
* Creates a {@link FirebaseModelPermissionServiceInstance} from a delegate.
|
|
10066
10211
|
*
|
|
10067
10212
|
* @param delegate - provides model loading and role computation
|
|
10213
|
+
* @returns a {@link FirebaseModelPermissionServiceInstance} configured with the given delegate
|
|
10068
10214
|
*/ function firebaseModelPermissionService(delegate) {
|
|
10069
10215
|
return new FirebaseModelPermissionServiceInstance(delegate);
|
|
10070
10216
|
}
|
|
@@ -10227,8 +10373,7 @@ function _define_property$d(obj, key, value) {
|
|
|
10227
10373
|
value: function throwDoesNotExistError() {
|
|
10228
10374
|
var _ref;
|
|
10229
10375
|
var _this_contextGrantedModelRoles_context_makeDoesNotExistError, _this_contextGrantedModelRoles_context;
|
|
10230
|
-
|
|
10231
|
-
throw error;
|
|
10376
|
+
throw (_ref = (_this_contextGrantedModelRoles_context_makeDoesNotExistError = (_this_contextGrantedModelRoles_context = this.contextGrantedModelRoles.context).makeDoesNotExistError) === null || _this_contextGrantedModelRoles_context_makeDoesNotExistError === void 0 ? void 0 : _this_contextGrantedModelRoles_context_makeDoesNotExistError.call(_this_contextGrantedModelRoles_context, this.contextGrantedModelRoles)) !== null && _ref !== void 0 ? _ref : new Error(contextGrantedModelRolesReaderDoesNotExistErrorMessage(this.contextGrantedModelRoles));
|
|
10232
10377
|
}
|
|
10233
10378
|
},
|
|
10234
10379
|
{
|
|
@@ -10236,8 +10381,7 @@ function _define_property$d(obj, key, value) {
|
|
|
10236
10381
|
value: function throwPermissionError(role) {
|
|
10237
10382
|
var _ref;
|
|
10238
10383
|
var _this_contextGrantedModelRoles_context_makePermissionError, _this_contextGrantedModelRoles_context;
|
|
10239
|
-
|
|
10240
|
-
throw error;
|
|
10384
|
+
throw (_ref = (_this_contextGrantedModelRoles_context_makePermissionError = (_this_contextGrantedModelRoles_context = this.contextGrantedModelRoles.context).makePermissionError) === null || _this_contextGrantedModelRoles_context_makePermissionError === void 0 ? void 0 : _this_contextGrantedModelRoles_context_makePermissionError.call(_this_contextGrantedModelRoles_context, this.contextGrantedModelRoles, role)) !== null && _ref !== void 0 ? _ref : new Error(contextGrantedModelRolesReaderPermissionErrorMessage(this.contextGrantedModelRoles, role));
|
|
10241
10385
|
}
|
|
10242
10386
|
}
|
|
10243
10387
|
]);
|
|
@@ -10245,6 +10389,9 @@ function _define_property$d(obj, key, value) {
|
|
|
10245
10389
|
}();
|
|
10246
10390
|
/**
|
|
10247
10391
|
* Creates a new ContextGrantedModelRolesReader for the input model.
|
|
10392
|
+
*
|
|
10393
|
+
* @param service - the in-model-context permission service to read roles from
|
|
10394
|
+
* @returns a promise resolving to a {@link ContextGrantedModelRolesReader} for the model
|
|
10248
10395
|
*/ function contextGrantedModelRolesReader(service) {
|
|
10249
10396
|
return service.roleMap().then(function(x) {
|
|
10250
10397
|
return new ContextGrantedModelRolesReaderInstance(x);
|
|
@@ -10253,13 +10400,13 @@ function _define_property$d(obj, key, value) {
|
|
|
10253
10400
|
/**
|
|
10254
10401
|
* Creates the default permission error message.
|
|
10255
10402
|
*
|
|
10256
|
-
* @param contextGrantedModelRoles
|
|
10257
|
-
* @param role
|
|
10258
|
-
* @returns
|
|
10403
|
+
* @param contextGrantedModelRoles - the granted model roles context to generate the message from
|
|
10404
|
+
* @param roles - the required role(s) that were not satisfied
|
|
10405
|
+
* @returns a human-readable permission error message string
|
|
10259
10406
|
*/ function contextGrantedModelRolesReaderPermissionErrorMessage(contextGrantedModelRoles, roles) {
|
|
10260
10407
|
var _contextGrantedModelRoles_data, _contextGrantedModelRoles_data1;
|
|
10261
10408
|
var message = 'Permissions Error ("'.concat((_contextGrantedModelRoles_data = contextGrantedModelRoles.data) === null || _contextGrantedModelRoles_data === void 0 ? void 0 : _contextGrantedModelRoles_data.document.modelType, '":"').concat((_contextGrantedModelRoles_data1 = contextGrantedModelRoles.data) === null || _contextGrantedModelRoles_data1 === void 0 ? void 0 : _contextGrantedModelRoles_data1.document.id, '")');
|
|
10262
|
-
if (roles
|
|
10409
|
+
if (roles === null || roles === void 0 ? void 0 : roles.length) {
|
|
10263
10410
|
message = "".concat(message, ': required role(s) "').concat(roles, '"');
|
|
10264
10411
|
}
|
|
10265
10412
|
return message;
|
|
@@ -10267,13 +10414,11 @@ function _define_property$d(obj, key, value) {
|
|
|
10267
10414
|
/**
|
|
10268
10415
|
* Creates the default does not exist error message.
|
|
10269
10416
|
*
|
|
10270
|
-
* @param contextGrantedModelRoles
|
|
10271
|
-
* @
|
|
10272
|
-
* @returns
|
|
10417
|
+
* @param contextGrantedModelRoles - the granted model roles context to generate the message from
|
|
10418
|
+
* @returns a human-readable does-not-exist error message string
|
|
10273
10419
|
*/ function contextGrantedModelRolesReaderDoesNotExistErrorMessage(contextGrantedModelRoles) {
|
|
10274
10420
|
var _contextGrantedModelRoles_data, _contextGrantedModelRoles_data1;
|
|
10275
|
-
|
|
10276
|
-
return message;
|
|
10421
|
+
return 'Does Not Exist ("'.concat((_contextGrantedModelRoles_data = contextGrantedModelRoles.data) === null || _contextGrantedModelRoles_data === void 0 ? void 0 : _contextGrantedModelRoles_data.document.modelType, '":"').concat((_contextGrantedModelRoles_data1 = contextGrantedModelRoles.data) === null || _contextGrantedModelRoles_data1 === void 0 ? void 0 : _contextGrantedModelRoles_data1.document.id, '")');
|
|
10277
10422
|
}
|
|
10278
10423
|
|
|
10279
10424
|
function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -10409,6 +10554,9 @@ function _ts_generator$8(thisArg, body) {
|
|
|
10409
10554
|
* Decision function that checks if the current user is an admin in the given context.
|
|
10410
10555
|
*
|
|
10411
10556
|
* Returns `false` if no auth is present.
|
|
10557
|
+
*
|
|
10558
|
+
* @param context - the Firebase model context to evaluate
|
|
10559
|
+
* @returns a promise resolving to `true` if the user is an admin, `false` otherwise
|
|
10412
10560
|
*/ var isAdminInFirebaseModelContext = function isAdminInFirebaseModelContext(context) {
|
|
10413
10561
|
var _ref;
|
|
10414
10562
|
var _context_auth;
|
|
@@ -10418,6 +10566,7 @@ function _ts_generator$8(thisArg, body) {
|
|
|
10418
10566
|
* Creates a {@link GrantRolesIfFunction} that grants the specified roles when the user is an admin.
|
|
10419
10567
|
*
|
|
10420
10568
|
* @param rolesToGrantToAdmin - roles to grant if the user is an admin
|
|
10569
|
+
* @returns a {@link GrantRolesIfFunction} that grants the given roles when the user is an admin
|
|
10421
10570
|
*
|
|
10422
10571
|
* @example
|
|
10423
10572
|
* ```ts
|
|
@@ -10436,6 +10585,7 @@ function _ts_generator$8(thisArg, body) {
|
|
|
10436
10585
|
* @param context - the model context to check
|
|
10437
10586
|
* @param rolesToGrantToAdmin - roles to grant if admin
|
|
10438
10587
|
* @param otherwise - fallback role computation when not admin
|
|
10588
|
+
* @returns a promise or value resolving to the granted role map
|
|
10439
10589
|
*/ function grantModelRolesIfAdmin(context, rolesToGrantToAdmin, otherwise) {
|
|
10440
10590
|
return grantModelRolesIfAdminFunction(rolesToGrantToAdmin)(context, otherwise);
|
|
10441
10591
|
}
|
|
@@ -10445,6 +10595,7 @@ function _ts_generator$8(thisArg, body) {
|
|
|
10445
10595
|
*
|
|
10446
10596
|
* @param authRoles - the auth roles the user must have
|
|
10447
10597
|
* @param rolesToGrantToAdmin - the model roles to grant if the auth roles are present
|
|
10598
|
+
* @returns a {@link GrantRolesIfFunction} that grants the given roles when the user has the required auth roles
|
|
10448
10599
|
*/ function grantModelRolesIfHasAuthRolesFunction(authRoles, rolesToGrantToAdmin) {
|
|
10449
10600
|
return grantModelRolesIfFunction(function(context) {
|
|
10450
10601
|
var _context_auth;
|
|
@@ -10460,6 +10611,7 @@ function _ts_generator$8(thisArg, body) {
|
|
|
10460
10611
|
* Creates a reusable factory pre-configured with specific auth roles to check for.
|
|
10461
10612
|
*
|
|
10462
10613
|
* @param authRoles - the auth roles the user must have
|
|
10614
|
+
* @returns a {@link GrantModelRolesIfHasAuthRolesFactory} pre-configured to check the given auth roles
|
|
10463
10615
|
*/ function grantModelRolesIfHasAuthRolesFactory(authRoles) {
|
|
10464
10616
|
var authRolesToHave = iterableToArray(authRoles);
|
|
10465
10617
|
return function(context, rolesToGrantToMatch, otherwise) {
|
|
@@ -10518,6 +10670,7 @@ function _ts_generator$8(thisArg, body) {
|
|
|
10518
10670
|
* Creates a {@link GrantRolesIfFunction} that grants roles when the authenticated user's UID matches the model's `uid` field.
|
|
10519
10671
|
*
|
|
10520
10672
|
* @param rolesToGrant - the roles to grant if the user owns the model
|
|
10673
|
+
* @returns a {@link GrantRolesIfFunction} that grants roles when the authenticated user is the model owner
|
|
10521
10674
|
*
|
|
10522
10675
|
* @example
|
|
10523
10676
|
* ```ts
|
|
@@ -10535,6 +10688,7 @@ function _ts_generator$8(thisArg, body) {
|
|
|
10535
10688
|
*
|
|
10536
10689
|
* @param grantIf - decision function to evaluate
|
|
10537
10690
|
* @param grantedRoles - roles to grant if the decision is `true`
|
|
10691
|
+
* @returns a {@link GrantRolesOnlyIfFunction} that grants roles or returns no-access with no fallback
|
|
10538
10692
|
*/ function grantModelRolesOnlyIfFunction(grantIf, grantedRoles) {
|
|
10539
10693
|
var fn = grantModelRolesIfFunction(grantIf, grantedRoles);
|
|
10540
10694
|
return function(context) {
|
|
@@ -10549,6 +10703,7 @@ function _ts_generator$8(thisArg, body) {
|
|
|
10549
10703
|
*
|
|
10550
10704
|
* @param grantIf - async decision function to evaluate
|
|
10551
10705
|
* @param grantedRoles - roles to grant if the decision is `true`
|
|
10706
|
+
* @returns a {@link GrantRolesIfFunction} that evaluates the condition and grants roles or falls back
|
|
10552
10707
|
* @throws {Error} When `grantIf` is not provided.
|
|
10553
10708
|
*
|
|
10554
10709
|
* @example
|
|
@@ -10560,9 +10715,6 @@ function _ts_generator$8(thisArg, body) {
|
|
|
10560
10715
|
* const roles = await grantIfOwner(context, () => noAccessRoleMap());
|
|
10561
10716
|
* ```
|
|
10562
10717
|
*/ function grantModelRolesIfFunction(grantIf, grantedRoles) {
|
|
10563
|
-
if (!grantIf) {
|
|
10564
|
-
throw new Error('missing grant if');
|
|
10565
|
-
}
|
|
10566
10718
|
return function(context) {
|
|
10567
10719
|
var otherwise = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noAccessRoleMap;
|
|
10568
10720
|
return _async_to_generator$8(function() {
|
|
@@ -10661,6 +10813,7 @@ function _object_spread_props$a(target, source) {
|
|
|
10661
10813
|
* Creates a {@link FirebaseModelService} that wires together model loading and permission evaluation.
|
|
10662
10814
|
*
|
|
10663
10815
|
* @param config - collection loader and role mapping functions
|
|
10816
|
+
* @returns a {@link FirebaseModelService} combining model loading and permission evaluation
|
|
10664
10817
|
*
|
|
10665
10818
|
* @example
|
|
10666
10819
|
* ```ts
|
|
@@ -10693,6 +10846,7 @@ function _object_spread_props$a(target, source) {
|
|
|
10693
10846
|
* Creates a {@link FirebaseModelServiceFactory} that lazily instantiates and caches the service.
|
|
10694
10847
|
*
|
|
10695
10848
|
* @param config - the service configuration
|
|
10849
|
+
* @returns a {@link FirebaseModelServiceFactory} that lazily creates and caches the service
|
|
10696
10850
|
*/ function firebaseModelServiceFactory(config) {
|
|
10697
10851
|
return cachedGetter(function() {
|
|
10698
10852
|
return firebaseModelService(config);
|
|
@@ -10705,6 +10859,7 @@ function _object_spread_props$a(target, source) {
|
|
|
10705
10859
|
* with a model or key to perform permission-checked operations.
|
|
10706
10860
|
*
|
|
10707
10861
|
* @param factory - lazy getter for the underlying model service
|
|
10862
|
+
* @returns an {@link InContextFirebaseModelServiceFactory} that binds contexts to the service
|
|
10708
10863
|
*/ function inContextFirebaseModelServiceFactory(factory) {
|
|
10709
10864
|
return function(context) {
|
|
10710
10865
|
var firebaseModelService = factory();
|
|
@@ -10774,8 +10929,8 @@ function _object_spread_props$a(target, source) {
|
|
|
10774
10929
|
* export const demoFirebaseModelServices = firebaseModelsService<typeof DEMO_FIREBASE_MODEL_SERVICE_FACTORIES, DemoFirebaseBaseContext, DemoFirebaseModelTypes>(DEMO_FIREBASE_MODEL_SERVICE_FACTORIES);
|
|
10775
10930
|
* export type DemoFirebaseContext = DemoFirebaseBaseContext & { service: typeof demoFirebaseModelServices };
|
|
10776
10931
|
*
|
|
10777
|
-
* @param services
|
|
10778
|
-
* @returns
|
|
10932
|
+
* @param services - the map of model service getter factories
|
|
10933
|
+
* @returns a {@link FirebaseModelsService} that dispatches to the appropriate model service by type
|
|
10779
10934
|
*/ function firebaseModelsService(services) {
|
|
10780
10935
|
var firebaseModelsServiceFunction = function firebaseModelsServiceFunction1(type, context) {
|
|
10781
10936
|
var firebaseModelService = services[type];
|
|
@@ -10796,6 +10951,7 @@ function _object_spread_props$a(target, source) {
|
|
|
10796
10951
|
* The returned factory binds a context, so callers can then select individual model services by type.
|
|
10797
10952
|
*
|
|
10798
10953
|
* @param service - the multi-model service to wrap
|
|
10954
|
+
* @returns an {@link InContextFirebaseModelsServiceFactory} that binds a context to the service
|
|
10799
10955
|
*/ function inContextFirebaseModelsServiceFactory(service) {
|
|
10800
10956
|
var newInContextFirebaseModelsServiceFactory = function newInContextFirebaseModelsServiceFactory(context) {
|
|
10801
10957
|
var result = function result(type) {
|
|
@@ -10813,6 +10969,7 @@ function _object_spread_props$a(target, source) {
|
|
|
10813
10969
|
* @param service - the multi-model service
|
|
10814
10970
|
* @param type - the model type to select
|
|
10815
10971
|
* @param select - selection params including context and key
|
|
10972
|
+
* @returns the {@link FirebaseModelsServiceSelectionResult} bound to the specified model
|
|
10816
10973
|
*/ function selectFromFirebaseModelsService(service, type, select) {
|
|
10817
10974
|
var key = readFirestoreModelKey(select.key, true);
|
|
10818
10975
|
return service(type, select.context).forKey(key);
|
|
@@ -10825,10 +10982,12 @@ function _object_spread_props$a(target, source) {
|
|
|
10825
10982
|
* @param service - the multi-model service
|
|
10826
10983
|
* @param type - the model type to select
|
|
10827
10984
|
* @param select - selection params including context, key, and optional role requirements
|
|
10985
|
+
* @returns a {@link UsePromiseFunction} for the resolved roles reader
|
|
10828
10986
|
*/ function useFirebaseModelsService(service, type, select) {
|
|
10987
|
+
var _select_roles;
|
|
10829
10988
|
var inContextModelService = selectFromFirebaseModelsService(service, type, select);
|
|
10830
10989
|
var result;
|
|
10831
|
-
if (select.roles
|
|
10990
|
+
if ((_select_roles = select.roles) === null || _select_roles === void 0 ? void 0 : _select_roles.length) {
|
|
10832
10991
|
result = inContextModelService.requireUse(select.roles, select.rolesSetIncludes);
|
|
10833
10992
|
} else {
|
|
10834
10993
|
result = inContextModelService.use;
|
|
@@ -10842,6 +11001,7 @@ function _object_spread_props$a(target, source) {
|
|
|
10842
11001
|
* Useful for routing incoming requests to the correct model service by collection path.
|
|
10843
11002
|
*
|
|
10844
11003
|
* @param inContextFirebaseModelsService - context-bound multi-model service
|
|
11004
|
+
* @returns a map of collection type strings to their {@link FirestoreModelIdentity} objects
|
|
10845
11005
|
*/ function buildFirebaseCollectionTypeModelTypeMap(inContextFirebaseModelsService) {
|
|
10846
11006
|
var allTypes = inContextFirebaseModelsService.allTypes();
|
|
10847
11007
|
var modelIdentities = allTypes.map(function(type) {
|
|
@@ -10868,6 +11028,7 @@ function _object_spread_props$a(target, source) {
|
|
|
10868
11028
|
* The generated paths follow the convention `/model/[basePath/]<modelKey>/[path]`.
|
|
10869
11029
|
*
|
|
10870
11030
|
* @param config - optional base path to nest under
|
|
11031
|
+
* @returns a {@link ModelStorageSlashPathFactory} that maps Firestore model keys to storage paths
|
|
10871
11032
|
*
|
|
10872
11033
|
* @example
|
|
10873
11034
|
* ```ts
|
|
@@ -11068,6 +11229,7 @@ function _ts_generator$7(thisArg, body) {
|
|
|
11068
11229
|
* Wraps the folder's `list()` API with cursor-based pagination via {@link fetchPageFactory}.
|
|
11069
11230
|
*
|
|
11070
11231
|
* @param config - default listing options (e.g., maxResults)
|
|
11232
|
+
* @returns an {@link IterateStorageListFilesFactory} for paginated file listing
|
|
11071
11233
|
*
|
|
11072
11234
|
* @example
|
|
11073
11235
|
* ```ts
|
|
@@ -11078,25 +11240,16 @@ function _ts_generator$7(thisArg, body) {
|
|
|
11078
11240
|
return fetchPageFactory({
|
|
11079
11241
|
fetch: function fetch(input) {
|
|
11080
11242
|
return _async_to_generator$7(function() {
|
|
11081
|
-
var _input_maxResults, _input_pageToken
|
|
11243
|
+
var _input_maxResults, _input_pageToken;
|
|
11082
11244
|
return _ts_generator$7(this, function(_state) {
|
|
11083
|
-
|
|
11084
|
-
|
|
11085
|
-
|
|
11086
|
-
|
|
11087
|
-
|
|
11088
|
-
|
|
11089
|
-
|
|
11090
|
-
|
|
11091
|
-
})
|
|
11092
|
-
];
|
|
11093
|
-
case 1:
|
|
11094
|
-
list = _state.sent();
|
|
11095
|
-
return [
|
|
11096
|
-
2,
|
|
11097
|
-
list
|
|
11098
|
-
];
|
|
11099
|
-
}
|
|
11245
|
+
return [
|
|
11246
|
+
2,
|
|
11247
|
+
input.folder.list({
|
|
11248
|
+
includeNestedResults: input.includeNestedResults,
|
|
11249
|
+
maxResults: (_input_maxResults = input.maxResults) !== null && _input_maxResults !== void 0 ? _input_maxResults : factoryDefaultMaxResults,
|
|
11250
|
+
pageToken: (_input_pageToken = input.pageToken) !== null && _input_pageToken !== void 0 ? _input_pageToken : undefined
|
|
11251
|
+
})
|
|
11252
|
+
];
|
|
11100
11253
|
});
|
|
11101
11254
|
})();
|
|
11102
11255
|
},
|
|
@@ -11110,7 +11263,7 @@ function _ts_generator$7(thisArg, body) {
|
|
|
11110
11263
|
};
|
|
11111
11264
|
return info;
|
|
11112
11265
|
},
|
|
11113
|
-
buildInputForNextPage: function buildInputForNextPage(pageResult, input,
|
|
11266
|
+
buildInputForNextPage: function buildInputForNextPage(pageResult, input, _options) {
|
|
11114
11267
|
var _pageResult_nextPageCursor;
|
|
11115
11268
|
return _object_spread_props$9(_object_spread$b({}, input), {
|
|
11116
11269
|
pageToken: (_pageResult_nextPageCursor = pageResult.nextPageCursor) !== null && _pageResult_nextPageCursor !== void 0 ? _pageResult_nextPageCursor : undefined
|
|
@@ -11122,6 +11275,9 @@ function _ts_generator$7(thisArg, body) {
|
|
|
11122
11275
|
* Iterates through every file in a storage folder, invoking a callback for each individual file result.
|
|
11123
11276
|
*
|
|
11124
11277
|
* Convenience wrapper around {@link iterateFetchPagesByEachItem} pre-configured for storage listing.
|
|
11278
|
+
*
|
|
11279
|
+
* @param input - iteration configuration including folder, listing options, and per-item callback
|
|
11280
|
+
* @returns the result of the paginated per-item iteration
|
|
11125
11281
|
*/ function iterateStorageListFilesByEachFile(input) {
|
|
11126
11282
|
var folder = input.folder, includeNestedResults = input.includeNestedResults, pageToken = input.pageToken;
|
|
11127
11283
|
return iterateFetchPagesByEachItem(_object_spread_props$9(_object_spread$b({}, input), {
|
|
@@ -11137,6 +11293,9 @@ function _ts_generator$7(thisArg, body) {
|
|
|
11137
11293
|
* Iterates through pages of file results in a storage folder, invoking a callback for each page.
|
|
11138
11294
|
*
|
|
11139
11295
|
* Convenience wrapper around {@link iterateFetchPages} pre-configured for storage listing.
|
|
11296
|
+
*
|
|
11297
|
+
* @param input - iteration configuration including folder, listing options, and per-page callback
|
|
11298
|
+
* @returns the result of the paginated page-level iteration
|
|
11140
11299
|
*/ function iterateStorageListFiles(input) {
|
|
11141
11300
|
var folder = input.folder, includeNestedResults = input.includeNestedResults, pageToken = input.pageToken;
|
|
11142
11301
|
return iterateFetchPages(_object_spread_props$9(_object_spread$b({}, input), {
|
|
@@ -11215,6 +11374,7 @@ function _is_native_reflect_construct$4() {
|
|
|
11215
11374
|
* Required when the upload input is a string, since the format (raw, base64, etc.) must be explicit.
|
|
11216
11375
|
*
|
|
11217
11376
|
* @param options - the upload options to extract from
|
|
11377
|
+
* @returns the {@link StorageDataStringType} extracted from the options
|
|
11218
11378
|
* @throws {Error} When `stringFormat` is not set in the options.
|
|
11219
11379
|
*/ function assertStorageUploadOptionsStringFormat(options) {
|
|
11220
11380
|
var stringFormat = options === null || options === void 0 ? void 0 : options.stringFormat;
|
|
@@ -11225,6 +11385,8 @@ function _is_native_reflect_construct$4() {
|
|
|
11225
11385
|
}
|
|
11226
11386
|
/**
|
|
11227
11387
|
* Creates an error indicating that `stringFormat` was missing from upload options.
|
|
11388
|
+
*
|
|
11389
|
+
* @returns an {@link Error} describing the missing `stringFormat` in upload options
|
|
11228
11390
|
*/ function noStringFormatInStorageUploadOptionsError() {
|
|
11229
11391
|
return new Error('stringFormat was missing a value in the StorageUploadOptions.');
|
|
11230
11392
|
}
|
|
@@ -11381,6 +11543,7 @@ function _ts_generator$6(thisArg, body) {
|
|
|
11381
11543
|
* @param file - the target file accessor to upload to
|
|
11382
11544
|
* @param readableStream - the source stream to pipe
|
|
11383
11545
|
* @param options - optional upload configuration (content type, metadata, etc.)
|
|
11546
|
+
* @returns a promise that resolves when the upload stream has finished
|
|
11384
11547
|
* @throws {StorageFileUploadStreamUnsupportedError} When the file accessor does not support stream uploads.
|
|
11385
11548
|
*
|
|
11386
11549
|
* @example
|
|
@@ -11418,15 +11581,16 @@ function _ts_generator$6(thisArg, body) {
|
|
|
11418
11581
|
* provides cursor-based pagination through the `next()` method.
|
|
11419
11582
|
*
|
|
11420
11583
|
* @param delegate - platform-specific implementation for extracting results
|
|
11584
|
+
* @returns a {@link StorageListFilesResultFactory} that normalizes raw SDK list results
|
|
11421
11585
|
*
|
|
11422
11586
|
* @example
|
|
11423
11587
|
* ```ts
|
|
11424
11588
|
* const factory = storageListFilesResultFactory(myDelegate);
|
|
11425
|
-
* const result = factory(storage, folder, { maxResults: 50 }, rawSdkResult);
|
|
11589
|
+
* const result = factory({ storage, folder, options: { maxResults: 50 } }, rawSdkResult);
|
|
11426
11590
|
* const files = result.files();
|
|
11427
11591
|
* ```
|
|
11428
11592
|
*/ function storageListFilesResultFactory(delegate) {
|
|
11429
|
-
return function(
|
|
11593
|
+
return function(input, result) {
|
|
11430
11594
|
var fileResult = function fileResult(item) {
|
|
11431
11595
|
item.file = function() {
|
|
11432
11596
|
return delegate.file(storage, item);
|
|
@@ -11439,12 +11603,13 @@ function _ts_generator$6(thisArg, body) {
|
|
|
11439
11603
|
};
|
|
11440
11604
|
return item;
|
|
11441
11605
|
};
|
|
11606
|
+
var storage = input.storage, folder = input.folder, options = input.options;
|
|
11442
11607
|
var hasNext = delegate.hasNext(result);
|
|
11443
11608
|
var next = cachedGetter(function() {
|
|
11444
11609
|
if (!hasNext) {
|
|
11445
11610
|
throw storageListFilesResultHasNoNextError();
|
|
11446
11611
|
}
|
|
11447
|
-
return delegate.next(
|
|
11612
|
+
return delegate.next(input, result);
|
|
11448
11613
|
});
|
|
11449
11614
|
var files = cachedGetter(function() {
|
|
11450
11615
|
return delegate.filesFromResult(result, folder).map(fileResult);
|
|
@@ -11472,6 +11637,8 @@ function _ts_generator$6(thisArg, body) {
|
|
|
11472
11637
|
}
|
|
11473
11638
|
/**
|
|
11474
11639
|
* Creates an error thrown when `next()` is called on a list result that has no more pages.
|
|
11640
|
+
*
|
|
11641
|
+
* @returns an {@link Error} indicating there are no more pages to fetch
|
|
11475
11642
|
*/ function storageListFilesResultHasNoNextError() {
|
|
11476
11643
|
return new Error('hasNext is false, there are no more results available.');
|
|
11477
11644
|
}
|
|
@@ -11483,6 +11650,7 @@ function _ts_generator$6(thisArg, body) {
|
|
|
11483
11650
|
* a {@link StoragePathFactory} to normalize all path inputs.
|
|
11484
11651
|
*
|
|
11485
11652
|
* @param drivers - the storage driver implementations to use
|
|
11653
|
+
* @returns a {@link FirebaseStorageContextFactory} that creates storage contexts for a given storage instance
|
|
11486
11654
|
* @throws {Error} When a default bucket ID cannot be resolved from the driver or config.
|
|
11487
11655
|
*
|
|
11488
11656
|
* @example
|
|
@@ -11493,9 +11661,10 @@ function _ts_generator$6(thisArg, body) {
|
|
|
11493
11661
|
* ```
|
|
11494
11662
|
*/ function firebaseStorageContextFactory(drivers) {
|
|
11495
11663
|
return function(firebaseStorage, config) {
|
|
11664
|
+
var _ref;
|
|
11496
11665
|
var _drivers_storageAccessorDriver_getDefaultBucket, _drivers_storageAccessorDriver;
|
|
11497
|
-
var
|
|
11498
|
-
var defaultBucketId = inputDefaultBucketId
|
|
11666
|
+
var _ref1 = config !== null && config !== void 0 ? config : {}, inputDefaultBucketId = _ref1.defaultBucketId, _ref_forceBucket = _ref1.forceBucket, forceBucket = _ref_forceBucket === void 0 ? false : _ref_forceBucket;
|
|
11667
|
+
var defaultBucketId = (_ref = inputDefaultBucketId !== null && inputDefaultBucketId !== void 0 ? inputDefaultBucketId : (_drivers_storageAccessorDriver_getDefaultBucket = (_drivers_storageAccessorDriver = drivers.storageAccessorDriver).getDefaultBucket) === null || _drivers_storageAccessorDriver_getDefaultBucket === void 0 ? void 0 : _drivers_storageAccessorDriver_getDefaultBucket.call(_drivers_storageAccessorDriver, firebaseStorage)) !== null && _ref !== void 0 ? _ref : '';
|
|
11499
11668
|
if (!defaultBucketId) {
|
|
11500
11669
|
throw new Error('Could not resolve a default bucket id for the firebaseStorageContextFactory(). Supply a defaultBucketId.');
|
|
11501
11670
|
}
|
|
@@ -11520,13 +11689,13 @@ function _ts_generator$6(thisArg, body) {
|
|
|
11520
11689
|
};
|
|
11521
11690
|
}
|
|
11522
11691
|
|
|
11523
|
-
function _array_like_to_array$
|
|
11692
|
+
function _array_like_to_array$6(arr, len) {
|
|
11524
11693
|
if (len == null || len > arr.length) len = arr.length;
|
|
11525
11694
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
11526
11695
|
return arr2;
|
|
11527
11696
|
}
|
|
11528
|
-
function _array_without_holes$
|
|
11529
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
11697
|
+
function _array_without_holes$5(arr) {
|
|
11698
|
+
if (Array.isArray(arr)) return _array_like_to_array$6(arr);
|
|
11530
11699
|
}
|
|
11531
11700
|
function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
|
|
11532
11701
|
try {
|
|
@@ -11570,10 +11739,10 @@ function _define_property$a(obj, key, value) {
|
|
|
11570
11739
|
}
|
|
11571
11740
|
return obj;
|
|
11572
11741
|
}
|
|
11573
|
-
function _iterable_to_array$
|
|
11742
|
+
function _iterable_to_array$5(iter) {
|
|
11574
11743
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
11575
11744
|
}
|
|
11576
|
-
function _non_iterable_spread$
|
|
11745
|
+
function _non_iterable_spread$5() {
|
|
11577
11746
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
11578
11747
|
}
|
|
11579
11748
|
function _object_spread$a(target) {
|
|
@@ -11610,16 +11779,16 @@ function _object_spread_props$8(target, source) {
|
|
|
11610
11779
|
}
|
|
11611
11780
|
return target;
|
|
11612
11781
|
}
|
|
11613
|
-
function _to_consumable_array$
|
|
11614
|
-
return _array_without_holes$
|
|
11782
|
+
function _to_consumable_array$5(arr) {
|
|
11783
|
+
return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$5();
|
|
11615
11784
|
}
|
|
11616
|
-
function _unsupported_iterable_to_array$
|
|
11785
|
+
function _unsupported_iterable_to_array$6(o, minLen) {
|
|
11617
11786
|
if (!o) return;
|
|
11618
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
11787
|
+
if (typeof o === "string") return _array_like_to_array$6(o, minLen);
|
|
11619
11788
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
11620
11789
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
11621
11790
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
11622
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
11791
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
|
|
11623
11792
|
}
|
|
11624
11793
|
function _ts_generator$5(thisArg, body) {
|
|
11625
11794
|
var f, y, t, _ = {
|
|
@@ -11727,6 +11896,7 @@ function _ts_generator$5(thisArg, body) {
|
|
|
11727
11896
|
* e.g., to silently handle deletion of already-deleted files.
|
|
11728
11897
|
*
|
|
11729
11898
|
* @param input - the error or error message to check
|
|
11899
|
+
* @returns `true` if the error message contains `'storage/object-not-found'`, `false` otherwise
|
|
11730
11900
|
*
|
|
11731
11901
|
* @example
|
|
11732
11902
|
* ```ts
|
|
@@ -11746,6 +11916,7 @@ function _ts_generator$5(thisArg, body) {
|
|
|
11746
11916
|
*
|
|
11747
11917
|
* @param storage - the client Firebase Storage instance
|
|
11748
11918
|
* @param path - abstract storage path to resolve
|
|
11919
|
+
* @returns a `StorageReference` pointing to the resolved storage path
|
|
11749
11920
|
*/ function firebaseStorageRefForStorageFilePath(storage, path) {
|
|
11750
11921
|
return ref(storage, firebaseStorageFilePathFromStorageFilePath(path));
|
|
11751
11922
|
}
|
|
@@ -11755,6 +11926,7 @@ function _ts_generator$5(thisArg, body) {
|
|
|
11755
11926
|
* Returns `true` if metadata is successfully retrieved, `false` for any error (including permission errors).
|
|
11756
11927
|
*
|
|
11757
11928
|
* @param ref - the storage reference to check
|
|
11929
|
+
* @returns a promise that resolves to `true` if the file exists, `false` otherwise
|
|
11758
11930
|
*/ function firebaseStorageFileExists(ref) {
|
|
11759
11931
|
return getMetadata(ref).then(function(_) {
|
|
11760
11932
|
return true;
|
|
@@ -11770,6 +11942,7 @@ function _ts_generator$5(thisArg, body) {
|
|
|
11770
11942
|
*
|
|
11771
11943
|
* @param storage - the client Firebase Storage instance
|
|
11772
11944
|
* @param storagePath - the abstract storage path for the file
|
|
11945
|
+
* @returns a {@link FirebaseStorageClientAccessorFile} providing CRUD and upload operations for the given path
|
|
11773
11946
|
*
|
|
11774
11947
|
* @example
|
|
11775
11948
|
* ```ts
|
|
@@ -11786,7 +11959,7 @@ function _ts_generator$5(thisArg, body) {
|
|
|
11786
11959
|
contentEncoding: (_options_metadata2 = options.metadata) === null || _options_metadata2 === void 0 ? void 0 : _options_metadata2.contentEncoding,
|
|
11787
11960
|
contentLanguage: (_options_metadata3 = options.metadata) === null || _options_metadata3 === void 0 ? void 0 : _options_metadata3.contentLanguage,
|
|
11788
11961
|
contentType: (_options_metadata4 = options.metadata) === null || _options_metadata4 === void 0 ? void 0 : _options_metadata4.contentType,
|
|
11789
|
-
customMetadata: filterUndefinedValues(_object_spread$a({}, (_options_metadata5 = options.metadata) === null || _options_metadata5 === void 0 ? void 0 : _options_metadata5.customMetadata, options
|
|
11962
|
+
customMetadata: filterUndefinedValues(_object_spread$a({}, (_options_metadata5 = options.metadata) === null || _options_metadata5 === void 0 ? void 0 : _options_metadata5.customMetadata, options.customMetadata))
|
|
11790
11963
|
});
|
|
11791
11964
|
}
|
|
11792
11965
|
function uploadMetadataFromStorageUploadOptions(options) {
|
|
@@ -11915,7 +12088,8 @@ function _ts_generator$5(thisArg, body) {
|
|
|
11915
12088
|
nextPageTokenFromResult: function nextPageTokenFromResult(result) {
|
|
11916
12089
|
return result.listResult.nextPageToken;
|
|
11917
12090
|
},
|
|
11918
|
-
next: function next(
|
|
12091
|
+
next: function next(param, result) {
|
|
12092
|
+
var options = param.options, folder = param.folder;
|
|
11919
12093
|
return folder.list(_object_spread_props$8(_object_spread$a({}, options, result.options), {
|
|
11920
12094
|
pageToken: result.listResult.nextPageToken
|
|
11921
12095
|
}));
|
|
@@ -11957,6 +12131,7 @@ function _ts_generator$5(thisArg, body) {
|
|
|
11957
12131
|
*
|
|
11958
12132
|
* @param storage - the client Firebase Storage instance
|
|
11959
12133
|
* @param storagePath - the abstract storage path for the folder
|
|
12134
|
+
* @returns a {@link FirebaseStorageClientAccessorFolder} providing listing and existence operations for the given path
|
|
11960
12135
|
*
|
|
11961
12136
|
* @example
|
|
11962
12137
|
* ```ts
|
|
@@ -11985,7 +12160,11 @@ function _ts_generator$5(thisArg, body) {
|
|
|
11985
12160
|
return [
|
|
11986
12161
|
4,
|
|
11987
12162
|
list(ref, options).then(function(listResult) {
|
|
11988
|
-
return firebaseStorageClientListFilesResultFactory(
|
|
12163
|
+
return firebaseStorageClientListFilesResultFactory({
|
|
12164
|
+
storage: storage,
|
|
12165
|
+
folder: folder,
|
|
12166
|
+
options: options
|
|
12167
|
+
}, {
|
|
11989
12168
|
options: options,
|
|
11990
12169
|
listResult: listResult
|
|
11991
12170
|
});
|
|
@@ -12012,7 +12191,7 @@ function _ts_generator$5(thisArg, body) {
|
|
|
12012
12191
|
case 2:
|
|
12013
12192
|
allNestedFolderFileResults = _state.sent();
|
|
12014
12193
|
allNestedFiles = allNestedFolderFileResults.flat();
|
|
12015
|
-
allFiles = _to_consumable_array$
|
|
12194
|
+
allFiles = _to_consumable_array$5(allImmediateFiles).concat(_to_consumable_array$5(allNestedFiles));
|
|
12016
12195
|
result = _object_spread_props$8(_object_spread$a({}, rootResults), {
|
|
12017
12196
|
files: function files() {
|
|
12018
12197
|
return allFiles;
|
|
@@ -12048,6 +12227,8 @@ function _ts_generator$5(thisArg, body) {
|
|
|
12048
12227
|
* Provides file and folder accessor factories and default bucket resolution.
|
|
12049
12228
|
* Used internally by {@link firebaseStorageClientDrivers}.
|
|
12050
12229
|
*
|
|
12230
|
+
* @returns a {@link FirebaseStorageAccessorDriver} backed by the `firebase/storage` client SDK
|
|
12231
|
+
*
|
|
12051
12232
|
* @example
|
|
12052
12233
|
* ```ts
|
|
12053
12234
|
* const driver = firebaseStorageClientAccessorDriver();
|
|
@@ -12075,6 +12256,8 @@ function _ts_generator$5(thisArg, body) {
|
|
|
12075
12256
|
*
|
|
12076
12257
|
* Provides file and folder accessor operations for use with {@link clientFirebaseStorageContextFactory}.
|
|
12077
12258
|
*
|
|
12259
|
+
* @returns the client-side {@link FirebaseStorageClientDrivers} for the `firebase/storage` SDK
|
|
12260
|
+
*
|
|
12078
12261
|
* @example
|
|
12079
12262
|
* ```ts
|
|
12080
12263
|
* const drivers = firebaseStorageClientDrivers();
|
|
@@ -12133,6 +12316,7 @@ function _ts_generator$5(thisArg, body) {
|
|
|
12133
12316
|
* by combining the given user model identity with the provided UID.
|
|
12134
12317
|
*
|
|
12135
12318
|
* @param userModelIdentity - the root identity for user models (e.g., `profileIdentity`)
|
|
12319
|
+
* @returns a function that generates a {@link NotificationSummaryId} for a given user UID
|
|
12136
12320
|
*
|
|
12137
12321
|
* @example
|
|
12138
12322
|
* ```ts
|
|
@@ -12156,9 +12340,9 @@ function _ts_generator$5(thisArg, body) {
|
|
|
12156
12340
|
/**
|
|
12157
12341
|
* Creates a NotificationTaskUniqueId from the input model id and task type.
|
|
12158
12342
|
*
|
|
12159
|
-
* @param input model id input
|
|
12160
|
-
* @param taskType task type
|
|
12161
|
-
* @returns
|
|
12343
|
+
* @param input - model id input
|
|
12344
|
+
* @param taskType - task type
|
|
12345
|
+
* @returns the unique notification task id combining the model id and task type
|
|
12162
12346
|
*/ function notificationTaskUniqueId(input, taskType) {
|
|
12163
12347
|
return "".concat(firestoreModelId(input), "_").concat(taskType); // combineation of model id and template type
|
|
12164
12348
|
}
|
|
@@ -12213,6 +12397,10 @@ function _object_spread_props$7(target, source) {
|
|
|
12213
12397
|
/**
|
|
12214
12398
|
* Merges two {@link NotificationBoxRecipientTemplateConfig} objects, preferring values from `a` over `b`.
|
|
12215
12399
|
*
|
|
12400
|
+
* @param a - primary config whose defined values take precedence
|
|
12401
|
+
* @param b - fallback config supplying values when `a` fields are undefined
|
|
12402
|
+
* @returns the merged template config with values from `a` preferred over `b`
|
|
12403
|
+
*
|
|
12216
12404
|
* @example
|
|
12217
12405
|
* ```ts
|
|
12218
12406
|
* const merged = mergeNotificationBoxRecipientTemplateConfigs(
|
|
@@ -12237,6 +12425,9 @@ function _object_spread_props$7(target, source) {
|
|
|
12237
12425
|
*
|
|
12238
12426
|
* This produces the "effective" configuration used at send time, where each channel has a definite boolean.
|
|
12239
12427
|
*
|
|
12428
|
+
* @param a - the template config to resolve
|
|
12429
|
+
* @returns the effective config with each channel flag filled in using the send-default fallback
|
|
12430
|
+
*
|
|
12240
12431
|
* @example
|
|
12241
12432
|
* ```ts
|
|
12242
12433
|
* const effective = effectiveNotificationBoxRecipientTemplateConfig({ sd: true, se: false });
|
|
@@ -12256,6 +12447,10 @@ function _object_spread_props$7(target, source) {
|
|
|
12256
12447
|
* Updates a {@link NotificationRecipient} with partial values, preserving existing fields where the update is undefined.
|
|
12257
12448
|
*
|
|
12258
12449
|
* Automatically clears the summary ID (`s`) when a `uid` is present.
|
|
12450
|
+
*
|
|
12451
|
+
* @param a - existing recipient to update
|
|
12452
|
+
* @param b - partial values to apply on top of the existing recipient
|
|
12453
|
+
* @returns the updated recipient with merged values
|
|
12259
12454
|
*/ function updateNotificationRecipient(a, b) {
|
|
12260
12455
|
var inputUid = b.uid, inputN = b.n, inputE = b.e, inputT = b.t, inputS = b.s;
|
|
12261
12456
|
var uid = updateMaybeValue(a.uid, inputUid);
|
|
@@ -12307,6 +12502,7 @@ function _object_spread_props$7(target, source) {
|
|
|
12307
12502
|
*
|
|
12308
12503
|
* @param uid - the user's Firebase auth UID
|
|
12309
12504
|
* @param i - the recipient's index position in the box's recipient array
|
|
12505
|
+
* @returns a new recipient entry with the given uid and index and an empty template config record
|
|
12310
12506
|
*/ function newNotificationBoxRecipientForUid(uid, i) {
|
|
12311
12507
|
return {
|
|
12312
12508
|
c: {},
|
|
@@ -12316,6 +12512,10 @@ function _object_spread_props$7(target, source) {
|
|
|
12316
12512
|
}
|
|
12317
12513
|
/**
|
|
12318
12514
|
* Merges two {@link NotificationUserDefaultNotificationBoxRecipientConfig} objects, preferring defined values from `a` over `b`.
|
|
12515
|
+
*
|
|
12516
|
+
* @param a - primary config whose defined values take precedence
|
|
12517
|
+
* @param b - fallback config supplying values when `a` fields are undefined
|
|
12518
|
+
* @returns the merged config
|
|
12319
12519
|
*/ function mergeNotificationUserDefaultNotificationBoxRecipientConfig(a, b) {
|
|
12320
12520
|
var c = mergeNotificationBoxRecipientTemplateConfigRecords(a.c, b.c);
|
|
12321
12521
|
var result = _object_spread_props$7(_object_spread$9({}, mergeObjects([
|
|
@@ -12346,6 +12546,10 @@ function _object_spread_props$7(target, source) {
|
|
|
12346
12546
|
})(NotificationBoxRecipientTemplateConfigBoolean || (NotificationBoxRecipientTemplateConfigBoolean = {}));
|
|
12347
12547
|
/**
|
|
12348
12548
|
* Merges two {@link NotificationBoxRecipientTemplateConfigRecord} objects, preferring defined values from `a`.
|
|
12549
|
+
*
|
|
12550
|
+
* @param a - primary record whose defined values take precedence
|
|
12551
|
+
* @param b - fallback record supplying values when `a` entries are undefined
|
|
12552
|
+
* @returns the merged template config record
|
|
12349
12553
|
*/ function mergeNotificationBoxRecipientTemplateConfigRecords(a, b) {
|
|
12350
12554
|
var mergeConfigs = mergeObjectsFunction(KeyValueTypleValueFilter.UNDEFINED);
|
|
12351
12555
|
return mergeConfigs([
|
|
@@ -12407,6 +12611,8 @@ var notificationBoxRecipientTemplateConfigDencoder = bitwiseObjectDencoder({
|
|
|
12407
12611
|
/**
|
|
12408
12612
|
* Creates a Firestore field converter for {@link NotificationBoxRecipientTemplateConfigRecord},
|
|
12409
12613
|
* using bitwise encoding for compact storage.
|
|
12614
|
+
*
|
|
12615
|
+
* @returns a Firestore field converter that encodes and decodes template config records using bitwise encoding
|
|
12410
12616
|
*/ function firestoreNotificationBoxRecipientTemplateConfigRecord() {
|
|
12411
12617
|
return firestoreBitwiseObjectMap({
|
|
12412
12618
|
dencoder: notificationBoxRecipientTemplateConfigDencoder
|
|
@@ -12496,6 +12702,9 @@ var notificationBoxRecipientTemplateConfigDencoder = bitwiseObjectDencoder({
|
|
|
12496
12702
|
/**
|
|
12497
12703
|
* Converts a {@link NotificationBoxRecipientTemplateConfigRecord} to an array of entries with their type keys.
|
|
12498
12704
|
*
|
|
12705
|
+
* @param input - the template config record to convert
|
|
12706
|
+
* @returns an array of entries each containing a type key and the corresponding channel config
|
|
12707
|
+
*
|
|
12499
12708
|
* @example
|
|
12500
12709
|
* ```ts
|
|
12501
12710
|
* const array = notificationBoxRecipientTemplateConfigRecordToArray({ 'comment': { se: true } });
|
|
@@ -12514,6 +12723,9 @@ var notificationBoxRecipientTemplateConfigDencoder = bitwiseObjectDencoder({
|
|
|
12514
12723
|
}
|
|
12515
12724
|
/**
|
|
12516
12725
|
* Converts a {@link NotificationBoxRecipientTemplateConfigArray} back to a {@link NotificationBoxRecipientTemplateConfigRecord}.
|
|
12726
|
+
*
|
|
12727
|
+
* @param input - the array of typed config entries to convert
|
|
12728
|
+
* @returns a record keyed by template type
|
|
12517
12729
|
*/ function notificationBoxRecipientTemplateConfigArrayToRecord(input) {
|
|
12518
12730
|
var map = {};
|
|
12519
12731
|
input.forEach(function(x) {
|
|
@@ -12556,6 +12768,7 @@ var notificationBoxRecipientTemplateConfigDencoder = bitwiseObjectDencoder({
|
|
|
12556
12768
|
*
|
|
12557
12769
|
* @param items - notification items to classify
|
|
12558
12770
|
* @param considerReadIfCreatedBefore - optional cutoff date; items created at or before this date are treated as read
|
|
12771
|
+
* @returns an object containing both the read and unread item arrays along with the input cutoff date
|
|
12559
12772
|
*
|
|
12560
12773
|
* @example
|
|
12561
12774
|
* ```ts
|
|
@@ -12699,11 +12912,17 @@ var NotificationUserDocument = /*#__PURE__*/ function(AbstractFirestoreDocument)
|
|
|
12699
12912
|
});
|
|
12700
12913
|
/**
|
|
12701
12914
|
* Creates a Firestore collection reference for {@link NotificationUser} documents.
|
|
12915
|
+
*
|
|
12916
|
+
* @param context - Firestore context to create the collection reference from
|
|
12917
|
+
* @returns a typed collection reference for NotificationUser documents
|
|
12702
12918
|
*/ function notificationUserCollectionReference(context) {
|
|
12703
12919
|
return context.collection(notificationUserIdentity.collectionName);
|
|
12704
12920
|
}
|
|
12705
12921
|
/**
|
|
12706
12922
|
* Creates a typed {@link NotificationUserFirestoreCollection} bound to the given Firestore context.
|
|
12923
|
+
*
|
|
12924
|
+
* @param firestoreContext - Firestore context to bind the collection to
|
|
12925
|
+
* @returns a typed Firestore collection for NotificationUser documents
|
|
12707
12926
|
*/ function notificationUserFirestoreCollection(firestoreContext) {
|
|
12708
12927
|
return firestoreContext.firestoreCollection({
|
|
12709
12928
|
modelIdentity: notificationUserIdentity,
|
|
@@ -12766,11 +12985,17 @@ var NotificationSummaryDocument = /*#__PURE__*/ function(AbstractFirestoreDocume
|
|
|
12766
12985
|
});
|
|
12767
12986
|
/**
|
|
12768
12987
|
* Creates a Firestore collection reference for {@link NotificationSummary} documents.
|
|
12988
|
+
*
|
|
12989
|
+
* @param context - Firestore context to create the collection reference from
|
|
12990
|
+
* @returns a typed collection reference for NotificationSummary documents
|
|
12769
12991
|
*/ function notificationSummaryCollectionReference(context) {
|
|
12770
12992
|
return context.collection(notificationSummaryIdentity.collectionName);
|
|
12771
12993
|
}
|
|
12772
12994
|
/**
|
|
12773
12995
|
* Creates a typed {@link NotificationSummaryFirestoreCollection} bound to the given Firestore context.
|
|
12996
|
+
*
|
|
12997
|
+
* @param firestoreContext - Firestore context to bind the collection to
|
|
12998
|
+
* @returns a typed Firestore collection for NotificationSummary documents
|
|
12774
12999
|
*/ function notificationSummaryFirestoreCollection(firestoreContext) {
|
|
12775
13000
|
return firestoreContext.firestoreCollection({
|
|
12776
13001
|
modelIdentity: notificationSummaryIdentity,
|
|
@@ -12833,11 +13058,17 @@ var NotificationBoxDocument = /*#__PURE__*/ function(AbstractFirestoreDocument)
|
|
|
12833
13058
|
});
|
|
12834
13059
|
/**
|
|
12835
13060
|
* Creates a Firestore collection reference for {@link NotificationBox} documents.
|
|
13061
|
+
*
|
|
13062
|
+
* @param context - Firestore context to create the collection reference from
|
|
13063
|
+
* @returns a typed collection reference for NotificationBox documents
|
|
12836
13064
|
*/ function notificationBoxCollectionReference(context) {
|
|
12837
13065
|
return context.collection(notificationBoxIdentity.collectionName);
|
|
12838
13066
|
}
|
|
12839
13067
|
/**
|
|
12840
13068
|
* Creates a typed {@link NotificationBoxFirestoreCollection} bound to the given Firestore context.
|
|
13069
|
+
*
|
|
13070
|
+
* @param firestoreContext - Firestore context to bind the collection to
|
|
13071
|
+
* @returns a typed Firestore collection for NotificationBox documents
|
|
12841
13072
|
*/ function notificationBoxFirestoreCollection(firestoreContext) {
|
|
12842
13073
|
return firestoreContext.firestoreCollection({
|
|
12843
13074
|
modelIdentity: notificationBoxIdentity,
|
|
@@ -13005,6 +13236,9 @@ var NotificationDocument = /*#__PURE__*/ function(AbstractFirestoreDocumentWithP
|
|
|
13005
13236
|
});
|
|
13006
13237
|
/**
|
|
13007
13238
|
* Creates a factory that produces {@link Notification} subcollection references for a given {@link NotificationBoxDocument} parent.
|
|
13239
|
+
*
|
|
13240
|
+
* @param context - Firestore context to create subcollection references from
|
|
13241
|
+
* @returns a factory function that creates collection references for a given NotificationBox parent
|
|
13008
13242
|
*/ function notificationCollectionReferenceFactory(context) {
|
|
13009
13243
|
return function(notificationBox) {
|
|
13010
13244
|
return context.subcollection(notificationBox.documentRef, notificationIdentity.collectionName);
|
|
@@ -13012,6 +13246,9 @@ var NotificationDocument = /*#__PURE__*/ function(AbstractFirestoreDocumentWithP
|
|
|
13012
13246
|
}
|
|
13013
13247
|
/**
|
|
13014
13248
|
* Creates a {@link NotificationFirestoreCollectionFactory} bound to the given Firestore context.
|
|
13249
|
+
*
|
|
13250
|
+
* @param firestoreContext - Firestore context to bind the collection factory to
|
|
13251
|
+
* @returns a factory that creates typed Firestore subcollections for Notification documents
|
|
13015
13252
|
*/ function notificationFirestoreCollectionFactory(firestoreContext) {
|
|
13016
13253
|
var factory = notificationCollectionReferenceFactory(firestoreContext);
|
|
13017
13254
|
return function(parent) {
|
|
@@ -13029,11 +13266,17 @@ var NotificationDocument = /*#__PURE__*/ function(AbstractFirestoreDocumentWithP
|
|
|
13029
13266
|
}
|
|
13030
13267
|
/**
|
|
13031
13268
|
* Creates a collection group reference for querying all {@link Notification} documents across all {@link NotificationBox} parents.
|
|
13269
|
+
*
|
|
13270
|
+
* @param context - Firestore context to create the collection group reference from
|
|
13271
|
+
* @returns a typed collection group for querying Notification documents across all parents
|
|
13032
13272
|
*/ function notificationCollectionReference(context) {
|
|
13033
13273
|
return context.collectionGroup(notificationIdentity.collectionName);
|
|
13034
13274
|
}
|
|
13035
13275
|
/**
|
|
13036
13276
|
* Creates a typed {@link NotificationFirestoreCollectionGroup} bound to the given Firestore context.
|
|
13277
|
+
*
|
|
13278
|
+
* @param firestoreContext - Firestore context to bind the collection group to
|
|
13279
|
+
* @returns a typed Firestore collection group for querying Notification documents across all parents
|
|
13037
13280
|
*/ function notificationFirestoreCollectionGroup(firestoreContext) {
|
|
13038
13281
|
return firestoreContext.firestoreCollectionGroup({
|
|
13039
13282
|
modelIdentity: notificationIdentity,
|
|
@@ -13082,6 +13325,9 @@ var NotificationWeekDocument = /*#__PURE__*/ function(AbstractFirestoreDocumentW
|
|
|
13082
13325
|
});
|
|
13083
13326
|
/**
|
|
13084
13327
|
* Creates a factory that produces {@link NotificationWeek} subcollection references for a given {@link NotificationBoxDocument} parent.
|
|
13328
|
+
*
|
|
13329
|
+
* @param context - Firestore context to create subcollection references from
|
|
13330
|
+
* @returns a factory function that creates collection references for a given NotificationBox parent
|
|
13085
13331
|
*/ function notificationWeekCollectionReferenceFactory(context) {
|
|
13086
13332
|
return function(notificationBox) {
|
|
13087
13333
|
return context.subcollection(notificationBox.documentRef, notificationWeekIdentity.collectionName);
|
|
@@ -13089,6 +13335,9 @@ var NotificationWeekDocument = /*#__PURE__*/ function(AbstractFirestoreDocumentW
|
|
|
13089
13335
|
}
|
|
13090
13336
|
/**
|
|
13091
13337
|
* Creates a {@link NotificationWeekFirestoreCollectionFactory} bound to the given Firestore context.
|
|
13338
|
+
*
|
|
13339
|
+
* @param firestoreContext - Firestore context to bind the collection factory to
|
|
13340
|
+
* @returns a factory that creates typed Firestore subcollections for NotificationWeek documents
|
|
13092
13341
|
*/ function notificationWeekFirestoreCollectionFactory(firestoreContext) {
|
|
13093
13342
|
var factory = notificationWeekCollectionReferenceFactory(firestoreContext);
|
|
13094
13343
|
return function(parent) {
|
|
@@ -13106,11 +13355,17 @@ var NotificationWeekDocument = /*#__PURE__*/ function(AbstractFirestoreDocumentW
|
|
|
13106
13355
|
}
|
|
13107
13356
|
/**
|
|
13108
13357
|
* Creates a collection group reference for querying all {@link NotificationWeek} documents across all {@link NotificationBox} parents.
|
|
13358
|
+
*
|
|
13359
|
+
* @param context - Firestore context to create the collection group reference from
|
|
13360
|
+
* @returns a typed collection group for querying NotificationWeek documents across all parents
|
|
13109
13361
|
*/ function notificationWeekCollectionReference(context) {
|
|
13110
13362
|
return context.collectionGroup(notificationWeekIdentity.collectionName);
|
|
13111
13363
|
}
|
|
13112
13364
|
/**
|
|
13113
13365
|
* Creates a typed {@link NotificationWeekFirestoreCollectionGroup} bound to the given Firestore context.
|
|
13366
|
+
*
|
|
13367
|
+
* @param firestoreContext - Firestore context to bind the collection group to
|
|
13368
|
+
* @returns a typed Firestore collection group for querying NotificationWeek documents across all parents
|
|
13114
13369
|
*/ function notificationWeekFirestoreCollectionGroup(firestoreContext) {
|
|
13115
13370
|
return firestoreContext.firestoreCollectionGroup({
|
|
13116
13371
|
modelIdentity: notificationWeekIdentity,
|
|
@@ -13255,16 +13510,42 @@ var notificationBoxModelCrudFunctionsConfig = {
|
|
|
13255
13510
|
*
|
|
13256
13511
|
* Error code constants thrown by the notification server action service.
|
|
13257
13512
|
* These codes are returned in Firebase function error responses for client-side handling.
|
|
13258
|
-
*/ /**
|
|
13259
|
-
|
|
13260
|
-
|
|
13261
|
-
/**
|
|
13262
|
-
|
|
13263
|
-
|
|
13264
|
-
/**
|
|
13265
|
-
|
|
13266
|
-
|
|
13513
|
+
*/ /**
|
|
13514
|
+
* Thrown when a notification creation request is missing a required ID.
|
|
13515
|
+
*/ var CREATE_NOTIFICATION_ID_REQUIRED_ERROR_CODE = 'CREATE_NOTIFICATION_ID_REQUIRED';
|
|
13516
|
+
/**
|
|
13517
|
+
* Thrown when attempting to initialize a NotificationBox or NotificationSummary that is already initialized.
|
|
13518
|
+
*/ var NOTIFICATION_MODEL_ALREADY_INITIALIZED_ERROR_CODE = 'NOTIFICATION_MODEL_ALREADY_INITIALIZED';
|
|
13519
|
+
/**
|
|
13520
|
+
* Thrown when the target NotificationBox does not exist.
|
|
13521
|
+
*/ var NOTIFICATION_BOX_DOES_NOT_EXIST_ERROR_CODE = 'NOTIFICATION_BOX_DOES_NOT_EXIST';
|
|
13522
|
+
/**
|
|
13523
|
+
* Thrown when attempting to create a NotificationBox for a model that already has one.
|
|
13524
|
+
*/ var NOTIFICATION_BOX_EXISTS_FOR_MODEL_ERROR_CODE = 'NOTIFICATION_BOX_EXISTS_FOR_MODEL';
|
|
13525
|
+
/**
|
|
13526
|
+
* Thrown when the target recipient does not exist in the NotificationBox.
|
|
13527
|
+
*/ var NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST_ERROR_CODE = 'NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST';
|
|
13528
|
+
/**
|
|
13529
|
+
* Thrown when an exclusion target is invalid (e.g., user not associated with the box).
|
|
13530
|
+
*/ var NOTIFICATION_BOX_EXCLUSION_TARGET_INVALID_ERROR_CODE = 'NOTIFICATION_BOX_EXCLUSION_TARGET_INVALID';
|
|
13531
|
+
/**
|
|
13532
|
+
* Thrown when the UID provided for NotificationUser creation is invalid.
|
|
13533
|
+
*/ var NOTIFICATION_USER_INVALID_UID_FOR_CREATE_ERROR_CODE = 'NOTIFICATION_USER_INVALID_UID_FOR_CREATE';
|
|
13534
|
+
/**
|
|
13535
|
+
* Thrown when attempting to add a user who has blocked themselves from being added as a recipient.
|
|
13536
|
+
*/ var NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS_ERROR_CODE = 'NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS';
|
|
13537
|
+
/**
|
|
13538
|
+
* Thrown when attempting to update a recipient config that is locked by the user.
|
|
13539
|
+
*/ var NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED_ERROR_CODE = 'NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED';
|
|
13267
13540
|
|
|
13541
|
+
function _array_like_to_array$5(arr, len) {
|
|
13542
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
13543
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
13544
|
+
return arr2;
|
|
13545
|
+
}
|
|
13546
|
+
function _array_without_holes$4(arr) {
|
|
13547
|
+
if (Array.isArray(arr)) return _array_like_to_array$5(arr);
|
|
13548
|
+
}
|
|
13268
13549
|
function _define_property$8(obj, key, value) {
|
|
13269
13550
|
if (key in obj) {
|
|
13270
13551
|
Object.defineProperty(obj, key, {
|
|
@@ -13278,6 +13559,12 @@ function _define_property$8(obj, key, value) {
|
|
|
13278
13559
|
}
|
|
13279
13560
|
return obj;
|
|
13280
13561
|
}
|
|
13562
|
+
function _iterable_to_array$4(iter) {
|
|
13563
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
13564
|
+
}
|
|
13565
|
+
function _non_iterable_spread$4() {
|
|
13566
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
13567
|
+
}
|
|
13281
13568
|
function _object_spread$8(target) {
|
|
13282
13569
|
for(var i = 1; i < arguments.length; i++){
|
|
13283
13570
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -13312,6 +13599,17 @@ function _object_spread_props$6(target, source) {
|
|
|
13312
13599
|
}
|
|
13313
13600
|
return target;
|
|
13314
13601
|
}
|
|
13602
|
+
function _to_consumable_array$4(arr) {
|
|
13603
|
+
return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$4();
|
|
13604
|
+
}
|
|
13605
|
+
function _unsupported_iterable_to_array$5(o, minLen) {
|
|
13606
|
+
if (!o) return;
|
|
13607
|
+
if (typeof o === "string") return _array_like_to_array$5(o, minLen);
|
|
13608
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
13609
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
13610
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
13611
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
|
|
13612
|
+
}
|
|
13315
13613
|
/**
|
|
13316
13614
|
* Applies an array of config entry params to a {@link NotificationBoxRecipientTemplateConfigRecord},
|
|
13317
13615
|
* inserting new entries, merging updates, and removing entries marked with `remove: true`.
|
|
@@ -13319,31 +13617,29 @@ function _object_spread_props$6(target, source) {
|
|
|
13319
13617
|
* @param a - existing config record
|
|
13320
13618
|
* @param b - array of update params to apply
|
|
13321
13619
|
* @param limitToAllowedConfigTypes - when provided, filters the result to only include these template types
|
|
13620
|
+
* @returns the updated config record, or undefined if no changes were made
|
|
13322
13621
|
*/ function updateNotificationBoxRecipientTemplateConfigRecord(a, b, limitToAllowedConfigTypes) {
|
|
13323
|
-
var
|
|
13324
|
-
|
|
13325
|
-
|
|
13326
|
-
var updatedC = ModelRelationUtility.insertCollection(cArray, b, {
|
|
13327
|
-
readKey: function readKey(x) {
|
|
13328
|
-
return x.type;
|
|
13329
|
-
},
|
|
13330
|
-
merge: function merge(x, y) {
|
|
13331
|
-
return _object_spread$8({}, x, y);
|
|
13332
|
-
}
|
|
13333
|
-
});
|
|
13334
|
-
// remove types marked as remove
|
|
13335
|
-
updatedC = ModelRelationUtility.removeKeysFromCollection(updatedC, b.filter(function(x) {
|
|
13336
|
-
return x.remove;
|
|
13337
|
-
}).map(function(x) {
|
|
13338
|
-
return x.type;
|
|
13339
|
-
}), function(x) {
|
|
13622
|
+
var cArray = notificationBoxRecipientTemplateConfigRecordToArray(a);
|
|
13623
|
+
var updatedC = ModelRelationUtility.insertCollection(cArray, b, {
|
|
13624
|
+
readKey: function readKey(x) {
|
|
13340
13625
|
return x.type;
|
|
13341
|
-
}
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
if (limitToAllowedConfigTypes) {
|
|
13345
|
-
c = filterKeysOnPOJOFunction(limitToAllowedConfigTypes)(c);
|
|
13626
|
+
},
|
|
13627
|
+
merge: function merge(x, y) {
|
|
13628
|
+
return _object_spread$8({}, x, y);
|
|
13346
13629
|
}
|
|
13630
|
+
});
|
|
13631
|
+
// remove types marked as remove
|
|
13632
|
+
updatedC = ModelRelationUtility.removeKeysFromCollection(updatedC, b.filter(function(x) {
|
|
13633
|
+
return x.remove;
|
|
13634
|
+
}).map(function(x) {
|
|
13635
|
+
return x.type;
|
|
13636
|
+
}), function(x) {
|
|
13637
|
+
return x.type;
|
|
13638
|
+
});
|
|
13639
|
+
var c = notificationBoxRecipientTemplateConfigArrayToRecord(updatedC);
|
|
13640
|
+
// if the config types are limited to specific types, then filter those only
|
|
13641
|
+
if (limitToAllowedConfigTypes) {
|
|
13642
|
+
c = filterKeysOnPOJOFunction(limitToAllowedConfigTypes)(c);
|
|
13347
13643
|
}
|
|
13348
13644
|
return c;
|
|
13349
13645
|
}
|
|
@@ -13354,6 +13650,7 @@ function _object_spread_props$6(target, source) {
|
|
|
13354
13650
|
* @param a - existing config
|
|
13355
13651
|
* @param b - update params to apply
|
|
13356
13652
|
* @param limitToAllowedConfigTypes - when provided, filters config types to only allowed template types
|
|
13653
|
+
* @returns the updated default recipient config
|
|
13357
13654
|
*/ function updateNotificationUserDefaultNotificationBoxRecipientConfig(a, b, limitToAllowedConfigTypes) {
|
|
13358
13655
|
var _ref;
|
|
13359
13656
|
var inputC = b.configs, inputF = b.f, inputBk = b.bk, inputLk = b.lk;
|
|
@@ -13370,6 +13667,11 @@ function _object_spread_props$6(target, source) {
|
|
|
13370
13667
|
* only if it actually changed. Returns `undefined` if no changes were detected.
|
|
13371
13668
|
*
|
|
13372
13669
|
* Automatically sets `ns = true` (needs sync) when changes are detected and the recipient has been indexed.
|
|
13670
|
+
*
|
|
13671
|
+
* @param a - existing per-box recipient config
|
|
13672
|
+
* @param b - update params to apply
|
|
13673
|
+
* @param limitToAllowedConfigTypes - when provided, filters template config types to only allowed types
|
|
13674
|
+
* @returns the updated config if changes were detected, or undefined if no changes occurred
|
|
13373
13675
|
*/ function updateNotificationUserNotificationBoxRecipientConfigIfChanged(a, b, limitToAllowedConfigTypes) {
|
|
13374
13676
|
var _ref;
|
|
13375
13677
|
var inputC = b.configs, inputRm = b.rm, inputLk = b.lk, inputBk = b.bk;
|
|
@@ -13400,6 +13702,11 @@ function _object_spread_props$6(target, source) {
|
|
|
13400
13702
|
* through the optional {@link AppNotificationTemplateTypeInfoRecordService}.
|
|
13401
13703
|
*
|
|
13402
13704
|
* Returns `undefined` if no changes were made.
|
|
13705
|
+
*
|
|
13706
|
+
* @param a - existing per-box recipient config array
|
|
13707
|
+
* @param b - array of update params to apply to matching boxes
|
|
13708
|
+
* @param filterWithService - optional service used to filter template types to only those valid for each box's model
|
|
13709
|
+
* @returns the updated config array if any changes occurred, or undefined if nothing changed
|
|
13403
13710
|
*/ function updateNotificationUserNotificationBoxRecipientConfigs(a, b, filterWithService) {
|
|
13404
13711
|
var boxesMap = makeModelMap(a, function(x) {
|
|
13405
13712
|
return x.nb;
|
|
@@ -13429,7 +13736,7 @@ function _object_spread_props$6(target, source) {
|
|
|
13429
13736
|
});
|
|
13430
13737
|
var result;
|
|
13431
13738
|
if (hasChanges) {
|
|
13432
|
-
result =
|
|
13739
|
+
result = _to_consumable_array$4(boxesMap.values());
|
|
13433
13740
|
}
|
|
13434
13741
|
return result;
|
|
13435
13742
|
}
|
|
@@ -13568,6 +13875,9 @@ function _ts_generator$4(thisArg, body) {
|
|
|
13568
13875
|
*
|
|
13569
13876
|
* Maps friendly field names (`subject`, `message`, `createdBy`, etc.) to their Firestore abbreviations
|
|
13570
13877
|
* and filters out null/undefined metadata values.
|
|
13878
|
+
*
|
|
13879
|
+
* @param input - friendly input with readable field names
|
|
13880
|
+
* @returns the low-level template using Firestore field abbreviations
|
|
13571
13881
|
*/ function createNotificationTemplate(input) {
|
|
13572
13882
|
var _ref, _ref1;
|
|
13573
13883
|
var inputNotificationModel = input.notificationModel, type = input.type, unique = input.unique, overrideExistingTask = input.overrideExistingTask, // notification
|
|
@@ -13614,6 +13924,9 @@ function _ts_generator$4(thisArg, body) {
|
|
|
13614
13924
|
* Determines whether a notification should be created based on the explicit toggle and throttle settings.
|
|
13615
13925
|
*
|
|
13616
13926
|
* Returns false if `sendNotification` is explicitly false, or if the throttle window hasn't elapsed.
|
|
13927
|
+
*
|
|
13928
|
+
* @param input - the send control parameters including the toggle and throttle configuration
|
|
13929
|
+
* @returns true if the notification should be created and sent
|
|
13617
13930
|
*/ function shouldSendCreatedNotificationInput(input) {
|
|
13618
13931
|
var sendNotification = input.sendNotification, sendNotificationThrottleDate = input.sendNotificationThrottleDate, inputSendNotificationThrottleTime = input.sendNotificationThrottleTime;
|
|
13619
13932
|
var sendNotificationThrottleTime = inputSendNotificationThrottleTime !== null && inputSendNotificationThrottleTime !== void 0 ? inputSendNotificationThrottleTime : MS_IN_HOUR;
|
|
@@ -13627,6 +13940,8 @@ function _ts_generator$4(thisArg, body) {
|
|
|
13627
13940
|
*
|
|
13628
13941
|
* For unique task notifications, generates a deterministic document ID from the target model and task type.
|
|
13629
13942
|
*
|
|
13943
|
+
* @param input - the creation parameters including template, context, and accessor
|
|
13944
|
+
* @returns the document reference and notification data pair, with `notificationCreated` set to false
|
|
13630
13945
|
* @throws {Error} When neither an accessor nor sufficient context is provided
|
|
13631
13946
|
* @throws {Error} When `unique=true` but no target model is specified
|
|
13632
13947
|
*/ function createNotificationDocumentPair(input) {
|
|
@@ -13635,15 +13950,13 @@ function _ts_generator$4(thisArg, body) {
|
|
|
13635
13950
|
var notificationModel = template.notificationModel, inputCat = template.cat, st = template.st, sat = template.sat, r = template.r, rf = template.rf, n = template.n, ts = template.ts, es = template.es, ps = template.ps, ns = template.ns, ois = template.ois, ots = template.ots, tpr = template.tpr, inputUnique = template.unique, inputOverrideExistingTask = template.overrideExistingTask;
|
|
13636
13951
|
/**
|
|
13637
13952
|
* Use the input, or default to true if inputUnique is true.
|
|
13638
|
-
*/ var overrideExistingTask = inputOverrideExistingTask
|
|
13953
|
+
*/ var overrideExistingTask = inputOverrideExistingTask !== null && inputOverrideExistingTask !== void 0 ? inputOverrideExistingTask : inputUnique ? true : undefined;
|
|
13639
13954
|
var accessor = inputAccessor;
|
|
13640
13955
|
var notificationBoxId = notificationBoxIdForModel(notificationModel);
|
|
13641
|
-
if (!accessor && notificationBoxId) {
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
accessor = notificationCollectionFactory(notificationBoxDocument).documentAccessorForTransaction(transaction);
|
|
13646
|
-
}
|
|
13956
|
+
if (!accessor && notificationBoxId && context) {
|
|
13957
|
+
var notificationCollectionFactory = context.notificationCollectionFactory, notificationBoxCollection = context.notificationBoxCollection;
|
|
13958
|
+
var notificationBoxDocument = notificationBoxCollection.documentAccessorForTransaction(transaction).loadDocumentForId(notificationBoxId);
|
|
13959
|
+
accessor = notificationCollectionFactory(notificationBoxDocument).documentAccessorForTransaction(transaction);
|
|
13647
13960
|
}
|
|
13648
13961
|
if (!accessor) {
|
|
13649
13962
|
throw new Error('createNotificationDocument() failed as neither an accessor nor sufficient information was provided about the target.');
|
|
@@ -13724,6 +14037,10 @@ function _ts_generator$4(thisArg, body) {
|
|
|
13724
14037
|
}
|
|
13725
14038
|
/**
|
|
13726
14039
|
* Internal function used by createNotificationDocument().
|
|
14040
|
+
*
|
|
14041
|
+
* @param input - send control parameters (throttle settings, shouldCreateNotification flag)
|
|
14042
|
+
* @param pair - the document pair created by {@link createNotificationDocumentPair}
|
|
14043
|
+
* @returns the pair with `notificationCreated` updated to reflect whether the document was saved
|
|
13727
14044
|
*/ function _createNotificationDocumentFromPair(input, pair) {
|
|
13728
14045
|
return _async_to_generator$4(function() {
|
|
13729
14046
|
var notification, notificationDocument, isNotificationTask, overrideExistingTask;
|
|
@@ -13774,6 +14091,9 @@ function _ts_generator$4(thisArg, body) {
|
|
|
13774
14091
|
*
|
|
13775
14092
|
* For unique tasks with `overrideExistingTask`, uses `set()` to replace existing documents.
|
|
13776
14093
|
* Otherwise uses `create()` which fails if the document already exists.
|
|
14094
|
+
*
|
|
14095
|
+
* @param input - the creation parameters including template, context, send control settings
|
|
14096
|
+
* @returns the document pair with `notificationCreated` reflecting whether the document was saved
|
|
13777
14097
|
*/ function createNotificationDocument(input) {
|
|
13778
14098
|
return _async_to_generator$4(function() {
|
|
13779
14099
|
var pair;
|
|
@@ -13790,6 +14110,9 @@ function _ts_generator$4(thisArg, body) {
|
|
|
13790
14110
|
* Creates and saves a notification only if sending conditions are met (not throttled, not explicitly disabled).
|
|
13791
14111
|
*
|
|
13792
14112
|
* Returns `undefined` if the notification was not created.
|
|
14113
|
+
*
|
|
14114
|
+
* @param input - the creation parameters including template, context, and send control settings
|
|
14115
|
+
* @returns the document pair if the notification was created, or undefined if it was skipped
|
|
13793
14116
|
*/ function createNotificationDocumentIfSending(input) {
|
|
13794
14117
|
return _async_to_generator$4(function() {
|
|
13795
14118
|
var pair;
|
|
@@ -13868,6 +14191,8 @@ function _object_spread_props$5(target, source) {
|
|
|
13868
14191
|
/**
|
|
13869
14192
|
* Creates a {@link CreateNotificationTaskTemplate} with `TASK_NOTIFICATION` send type and no recipients.
|
|
13870
14193
|
*
|
|
14194
|
+
* @param input - task template input parameters
|
|
14195
|
+
* @returns the configured task notification template
|
|
13871
14196
|
* @throws {Error} When `unique=true` but no `notificationModel` or target model is specified.
|
|
13872
14197
|
*
|
|
13873
14198
|
* @example
|
|
@@ -13905,11 +14230,17 @@ function _array_like_to_array$4(arr, len) {
|
|
|
13905
14230
|
function _array_with_holes$1(arr) {
|
|
13906
14231
|
if (Array.isArray(arr)) return arr;
|
|
13907
14232
|
}
|
|
14233
|
+
function _array_without_holes$3(arr) {
|
|
14234
|
+
if (Array.isArray(arr)) return _array_like_to_array$4(arr);
|
|
14235
|
+
}
|
|
13908
14236
|
function _class_call_check$5(instance, Constructor) {
|
|
13909
14237
|
if (!(instance instanceof Constructor)) {
|
|
13910
14238
|
throw new TypeError("Cannot call a class as a function");
|
|
13911
14239
|
}
|
|
13912
14240
|
}
|
|
14241
|
+
function _iterable_to_array$3(iter) {
|
|
14242
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
14243
|
+
}
|
|
13913
14244
|
function _iterable_to_array_limit$1(arr, i) {
|
|
13914
14245
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
13915
14246
|
if (_i == null) return;
|
|
@@ -13937,9 +14268,15 @@ function _iterable_to_array_limit$1(arr, i) {
|
|
|
13937
14268
|
function _non_iterable_rest$1() {
|
|
13938
14269
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
13939
14270
|
}
|
|
14271
|
+
function _non_iterable_spread$3() {
|
|
14272
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
14273
|
+
}
|
|
13940
14274
|
function _sliced_to_array$1(arr, i) {
|
|
13941
14275
|
return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$1();
|
|
13942
14276
|
}
|
|
14277
|
+
function _to_consumable_array$3(arr) {
|
|
14278
|
+
return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$3();
|
|
14279
|
+
}
|
|
13943
14280
|
function _unsupported_iterable_to_array$4(o, minLen) {
|
|
13944
14281
|
if (!o) return;
|
|
13945
14282
|
if (typeof o === "string") return _array_like_to_array$4(o, minLen);
|
|
@@ -13951,6 +14288,8 @@ function _unsupported_iterable_to_array$4(o, minLen) {
|
|
|
13951
14288
|
/**
|
|
13952
14289
|
* Creates a {@link NotificationTemplateTypeInfoRecord} from an array of template type info entries.
|
|
13953
14290
|
*
|
|
14291
|
+
* @param infoArray - array of template type info entries to index
|
|
14292
|
+
* @returns a record keyed by template type
|
|
13954
14293
|
* @throws {Error} When duplicate template types are found in the input array.
|
|
13955
14294
|
*
|
|
13956
14295
|
* @example
|
|
@@ -13987,6 +14326,7 @@ function _unsupported_iterable_to_array$4(o, minLen) {
|
|
|
13987
14326
|
* Handles alternative model identities defined in {@link NotificationTemplateTypeInfoIdentityInfoAlternativeModelIdentityPair}.
|
|
13988
14327
|
*
|
|
13989
14328
|
* @param appNotificationTemplateTypeInfoRecord - the complete template type registry for the application
|
|
14329
|
+
* @returns a fully initialized service with indexed lookups for fast template type discovery
|
|
13990
14330
|
*
|
|
13991
14331
|
* @example
|
|
13992
14332
|
* ```ts
|
|
@@ -14021,10 +14361,10 @@ function _unsupported_iterable_to_array$4(o, minLen) {
|
|
|
14021
14361
|
allKnownTemplateTypeInfo.push(info);
|
|
14022
14362
|
allKnownTemplateTypes.push(info.type);
|
|
14023
14363
|
});
|
|
14024
|
-
var allNotificationModelIdentityValues =
|
|
14364
|
+
var allNotificationModelIdentityValues = _to_consumable_array$3(allNotificationModelIdentityValuesSet);
|
|
14025
14365
|
var notificationModelTemplateInfoMap = notificationModelTypeInfoMapBuilder.map();
|
|
14026
14366
|
var targetModelTemplateInfoMap = targetModelTypeInfoMapBuilder.map();
|
|
14027
|
-
var notificationModelTemplateTypesMap = new Map(
|
|
14367
|
+
var notificationModelTemplateTypesMap = new Map(_to_consumable_array$3(notificationModelTemplateInfoMap.entries()).map(function(param) {
|
|
14028
14368
|
var _param = _sliced_to_array$1(param, 2), k = _param[0], x = _param[1];
|
|
14029
14369
|
return [
|
|
14030
14370
|
k,
|
|
@@ -14033,7 +14373,7 @@ function _unsupported_iterable_to_array$4(o, minLen) {
|
|
|
14033
14373
|
})
|
|
14034
14374
|
];
|
|
14035
14375
|
}));
|
|
14036
|
-
var targetModelTemplateTypesMap = new Map(
|
|
14376
|
+
var targetModelTemplateTypesMap = new Map(_to_consumable_array$3(targetModelTemplateInfoMap.entries()).map(function(param) {
|
|
14037
14377
|
var _param = _sliced_to_array$1(param, 2), k = _param[0], x = _param[1];
|
|
14038
14378
|
return [
|
|
14039
14379
|
k,
|
|
@@ -14237,6 +14577,7 @@ function _ts_generator$3(thisArg, body) {
|
|
|
14237
14577
|
*
|
|
14238
14578
|
* @param fn - base function that generates message content per recipient
|
|
14239
14579
|
* @param extras - optional delivery customization (global recipients, send callbacks)
|
|
14580
|
+
* @returns a {@link NotificationMessageFunction} with the extras attached
|
|
14240
14581
|
*
|
|
14241
14582
|
* @example
|
|
14242
14583
|
* ```ts
|
|
@@ -14264,6 +14605,8 @@ function _ts_generator$3(thisArg, body) {
|
|
|
14264
14605
|
*
|
|
14265
14606
|
* Useful as a placeholder factory for template types that should not produce deliverable content.
|
|
14266
14607
|
*
|
|
14608
|
+
* @returns a factory that produces no-content message functions
|
|
14609
|
+
*
|
|
14267
14610
|
* @example
|
|
14268
14611
|
* ```ts
|
|
14269
14612
|
* const factory = noContentNotificationMessageFunctionFactory();
|
|
@@ -14272,7 +14615,7 @@ function _ts_generator$3(thisArg, body) {
|
|
|
14272
14615
|
* // msg.flag === NotificationMessageFlag.NO_CONTENT
|
|
14273
14616
|
* ```
|
|
14274
14617
|
*/ function noContentNotificationMessageFunctionFactory() {
|
|
14275
|
-
return function(
|
|
14618
|
+
return function(_config) {
|
|
14276
14619
|
return _async_to_generator$3(function() {
|
|
14277
14620
|
return _ts_generator$3(this, function(_state) {
|
|
14278
14621
|
// const { item } = config;
|
|
@@ -14307,6 +14650,8 @@ function _ts_generator$3(thisArg, body) {
|
|
|
14307
14650
|
* Query constraints for finding {@link NotificationUser} documents that have pending config syncs (`ns == true`).
|
|
14308
14651
|
*
|
|
14309
14652
|
* Used by the server to discover users whose configs need to be synced to their NotificationBox recipients.
|
|
14653
|
+
*
|
|
14654
|
+
* @returns array of Firestore query constraints filtering for users needing sync
|
|
14310
14655
|
*/ function notificationUsersFlaggedForNeedsSyncQuery() {
|
|
14311
14656
|
return [
|
|
14312
14657
|
where('ns', '==', true)
|
|
@@ -14316,6 +14661,7 @@ function _ts_generator$3(thisArg, body) {
|
|
|
14316
14661
|
* Query constraints for finding {@link NotificationUser} documents that have any of the given exclusion IDs in their `x` array.
|
|
14317
14662
|
*
|
|
14318
14663
|
* @param exclusionId - one or more box IDs or collection name prefixes to match against
|
|
14664
|
+
* @returns array of Firestore query constraints filtering for users with matching exclusions
|
|
14319
14665
|
*/ function notificationUserHasExclusionQuery(exclusionId) {
|
|
14320
14666
|
return [
|
|
14321
14667
|
where('x', 'array-contains-any', exclusionId)
|
|
@@ -14324,6 +14670,8 @@ function _ts_generator$3(thisArg, body) {
|
|
|
14324
14670
|
// MARK: NotificationSummary
|
|
14325
14671
|
/**
|
|
14326
14672
|
* Query constraints for finding {@link NotificationSummary} documents that need server-side initialization (`s == true`).
|
|
14673
|
+
*
|
|
14674
|
+
* @returns array of Firestore query constraints filtering for summaries needing initialization
|
|
14327
14675
|
*/ function notificationSummariesFlaggedForNeedsInitializationQuery() {
|
|
14328
14676
|
return [
|
|
14329
14677
|
where('s', '==', true)
|
|
@@ -14333,6 +14681,8 @@ function _ts_generator$3(thisArg, body) {
|
|
|
14333
14681
|
// MARK: NotificationBox
|
|
14334
14682
|
/**
|
|
14335
14683
|
* Query constraints for finding {@link NotificationBox} documents that need server-side initialization (`s == true`).
|
|
14684
|
+
*
|
|
14685
|
+
* @returns array of Firestore query constraints filtering for boxes needing initialization
|
|
14336
14686
|
*/ function notificationBoxesFlaggedForNeedsInitializationQuery() {
|
|
14337
14687
|
return [
|
|
14338
14688
|
where('s', '==', true)
|
|
@@ -14342,6 +14692,8 @@ function _ts_generator$3(thisArg, body) {
|
|
|
14342
14692
|
* Query constraints for finding {@link NotificationBox} documents flagged as invalid (`fi == true`).
|
|
14343
14693
|
*
|
|
14344
14694
|
* Used by the server to clean up boxes that could not be initialized.
|
|
14695
|
+
*
|
|
14696
|
+
* @returns array of Firestore query constraints filtering for boxes flagged as invalid
|
|
14345
14697
|
*/ function notificationBoxesFlaggedInvalidQuery() {
|
|
14346
14698
|
return [
|
|
14347
14699
|
where('fi', '==', true)
|
|
@@ -14355,6 +14707,7 @@ function _ts_generator$3(thisArg, body) {
|
|
|
14355
14707
|
* This is the primary query used by the send queue processor.
|
|
14356
14708
|
*
|
|
14357
14709
|
* @param now - reference time for the `sat` comparison (defaults to current time)
|
|
14710
|
+
* @returns array of Firestore query constraints filtering for notifications past their scheduled send time
|
|
14358
14711
|
*/ function notificationsPastSendAtTimeQuery() {
|
|
14359
14712
|
var now = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : new Date();
|
|
14360
14713
|
return [
|
|
@@ -14365,6 +14718,8 @@ function _ts_generator$3(thisArg, body) {
|
|
|
14365
14718
|
/**
|
|
14366
14719
|
* Query constraints for finding {@link Notification} documents marked as done (`d == true`)
|
|
14367
14720
|
* and ready to be archived to {@link NotificationWeek} and then deleted.
|
|
14721
|
+
*
|
|
14722
|
+
* @returns array of Firestore query constraints filtering for completed notifications ready to archive
|
|
14368
14723
|
*/ function notificationsReadyForCleanupQuery() {
|
|
14369
14724
|
return [
|
|
14370
14725
|
where('d', '==', true)
|
|
@@ -14401,6 +14756,10 @@ function _unsupported_iterable_to_array$3(o, minLen) {
|
|
|
14401
14756
|
*
|
|
14402
14757
|
* Used when combining results from multiple send batches within the same channel.
|
|
14403
14758
|
*
|
|
14759
|
+
* @param a - first result to merge
|
|
14760
|
+
* @param b - second result to merge
|
|
14761
|
+
* @returns a new result with all recipient lists concatenated from both inputs
|
|
14762
|
+
*
|
|
14404
14763
|
* @example
|
|
14405
14764
|
* ```ts
|
|
14406
14765
|
* const combined = mergeNotificationSendMessagesResult(firstBatchResult, secondBatchResult);
|
|
@@ -14467,6 +14826,8 @@ function _object_spread_props$4(target, source) {
|
|
|
14467
14826
|
* Use this when the handler needs more time but doesn't want to increment the failure counter.
|
|
14468
14827
|
* The task will be re-queued without counting as an error attempt.
|
|
14469
14828
|
*
|
|
14829
|
+
* @returns an empty checkpoint array signaling in-progress without failure
|
|
14830
|
+
*
|
|
14470
14831
|
* @example
|
|
14471
14832
|
* ```ts
|
|
14472
14833
|
* // Waiting for an external process — delay without failing
|
|
@@ -14482,6 +14843,7 @@ function _object_spread_props$4(target, source) {
|
|
|
14482
14843
|
*
|
|
14483
14844
|
* @param delayUntil - absolute date or relative milliseconds from the task's run start time
|
|
14484
14845
|
* @param updateMetadata - optional metadata updates to merge into the notification item
|
|
14846
|
+
* @returns a task result that re-queues the task after the specified delay without marking it failed
|
|
14485
14847
|
*
|
|
14486
14848
|
* @example
|
|
14487
14849
|
* ```ts
|
|
@@ -14503,6 +14865,7 @@ function _object_spread_props$4(target, source) {
|
|
|
14503
14865
|
*
|
|
14504
14866
|
* @param completedParts - checkpoint string(s) that were just completed
|
|
14505
14867
|
* @param updateMetadata - optional metadata updates to merge into the notification item
|
|
14868
|
+
* @returns a task result marking the given checkpoints complete while keeping the task running
|
|
14506
14869
|
*
|
|
14507
14870
|
* @example
|
|
14508
14871
|
* ```ts
|
|
@@ -14519,6 +14882,7 @@ function _object_spread_props$4(target, source) {
|
|
|
14519
14882
|
* Returns a result indicating the task completed successfully. The notification document will be deleted.
|
|
14520
14883
|
*
|
|
14521
14884
|
* @param updateMetadata - optional final metadata update (applied before deletion if subtasks need it)
|
|
14885
|
+
* @returns a task result signaling successful completion; the notification document will be deleted
|
|
14522
14886
|
*
|
|
14523
14887
|
* @example
|
|
14524
14888
|
* ```ts
|
|
@@ -14538,6 +14902,7 @@ function _object_spread_props$4(target, source) {
|
|
|
14538
14902
|
*
|
|
14539
14903
|
* @param updateMetadata - optional metadata updates
|
|
14540
14904
|
* @param removeFromCompletedCheckpoints - checkpoint(s) to remove from the completed set (e.g., to retry a checkpoint)
|
|
14905
|
+
* @returns a task result signaling failure; the error attempt counter is incremented
|
|
14541
14906
|
*
|
|
14542
14907
|
* @example
|
|
14543
14908
|
* ```ts
|
|
@@ -14559,6 +14924,7 @@ function _object_spread_props$4(target, source) {
|
|
|
14559
14924
|
*
|
|
14560
14925
|
* @param result - the task result to wrap
|
|
14561
14926
|
* @param force - when true, overrides any existing `canRunNextCheckpoint` value
|
|
14927
|
+
* @returns a copy of the result with `canRunNextCheckpoint` set to true
|
|
14562
14928
|
*/ function notificationTaskCanRunNextCheckpoint(result, force) {
|
|
14563
14929
|
if (force || result.canRunNextCheckpoint == null) {
|
|
14564
14930
|
result = _object_spread_props$4(_object_spread$6({}, result), {
|
|
@@ -14632,6 +14998,8 @@ function _object_spread_props$3(target, source) {
|
|
|
14632
14998
|
* Internal helper that marks the `'processing'` checkpoint complete and schedules the `'cleanup'` phase.
|
|
14633
14999
|
*
|
|
14634
15000
|
* Prefer using {@link notificationSubtaskComplete} in subtask handlers instead of calling this directly.
|
|
15001
|
+
*
|
|
15002
|
+
* @returns a partially-complete task result with the processing checkpoint marked done
|
|
14635
15003
|
*/ function completeSubtaskProcessingAndScheduleCleanupTaskResult() {
|
|
14636
15004
|
return notificationTaskPartiallyComplete([
|
|
14637
15005
|
'processing'
|
|
@@ -14643,6 +15011,9 @@ function _object_spread_props$3(target, source) {
|
|
|
14643
15011
|
* Unlike {@link notificationTaskComplete}, this signals that the cleanup checkpoint should still run.
|
|
14644
15012
|
* Use `canRunNextCheckpoint: true` in options to run cleanup immediately in the same execution.
|
|
14645
15013
|
*
|
|
15014
|
+
* @param options - optional metadata updates and flag to run cleanup immediately in the same execution
|
|
15015
|
+
* @returns a task result marking the subtask as complete while allowing cleanup to proceed
|
|
15016
|
+
*
|
|
14646
15017
|
* @example
|
|
14647
15018
|
* ```ts
|
|
14648
15019
|
* // Processing done, schedule cleanup for next run
|
|
@@ -14735,6 +15106,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
|
|
|
14735
15106
|
*
|
|
14736
15107
|
* Filters template configs to only include types applicable to the notification box's model.
|
|
14737
15108
|
* Used during the server-side sync process to update box recipient entries from user configs.
|
|
15109
|
+
*
|
|
15110
|
+
* @param input - the merged config inputs including uid, global config, box config, and optional existing recipient
|
|
15111
|
+
* @returns the computed effective box recipient with merged config, contact info, and flags
|
|
14738
15112
|
*/ function effectiveNotificationBoxRecipientConfig(input) {
|
|
14739
15113
|
var _ref, _ref1, _gc_f, _gc_lk, _gc_e, _gc_t;
|
|
14740
15114
|
var uid = input.uid, inputM = input.m, appNotificationTemplateTypeInfoRecordService = input.appNotificationTemplateTypeInfoRecordService, gc = input.gc, notificationUserNotificationBoxConfig = input.boxConfig, recipient = input.recipient;
|
|
@@ -14766,6 +15140,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
|
|
|
14766
15140
|
* and propagates exclusion flags to the per-box configs.
|
|
14767
15141
|
*
|
|
14768
15142
|
* Exclusions not matching any associated notification box are automatically filtered out.
|
|
15143
|
+
*
|
|
15144
|
+
* @param input - the user, exclusions to add, and exclusions to remove
|
|
15145
|
+
* @returns the updated exclusion list and the partial user update to apply
|
|
14769
15146
|
*/ function updateNotificationUserNotificationSendExclusions(input) {
|
|
14770
15147
|
var notificationUser = input.notificationUser, inputAddExclusions = input.addExclusions, inputRemoveExclusions = input.removeExclusions;
|
|
14771
15148
|
var associatedNotificationBoxes = notificationUser.b, currentExclusions = notificationUser.x, notificationBoxConfigs = notificationUser.bc;
|
|
@@ -14803,6 +15180,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
|
|
|
14803
15180
|
/**
|
|
14804
15181
|
* Applies the current exclusion list to per-box configs, setting/clearing the `x` flag and marking
|
|
14805
15182
|
* changed configs as needing sync (`ns = true`).
|
|
15183
|
+
*
|
|
15184
|
+
* @param params - the exclusion list, per-box configs, and optional flag to recalculate the global ns flag
|
|
15185
|
+
* @returns the updated per-box configs and the recalculated needs-sync flag
|
|
14806
15186
|
*/ function applyExclusionsToNotificationUserNotificationBoxRecipientConfigs(params) {
|
|
14807
15187
|
var _ref, _ref1;
|
|
14808
15188
|
var inputX = params.x, inputBc = params.bc, notificationUser = params.notificationUser, recalculateNs = params.recalculateNs;
|
|
@@ -14830,6 +15210,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
|
|
|
14830
15210
|
}
|
|
14831
15211
|
/**
|
|
14832
15212
|
* Returns true if any of the per-box configs need syncing (`ns == true`).
|
|
15213
|
+
*
|
|
15214
|
+
* @param configs - array of per-box recipient configs to check
|
|
15215
|
+
* @returns true if at least one config has its needs-sync flag set
|
|
14833
15216
|
*/ function calculateNsForNotificationUserNotificationBoxRecipientConfigs(configs) {
|
|
14834
15217
|
return configs.some(function(x) {
|
|
14835
15218
|
return x.ns;
|
|
@@ -14838,11 +15221,14 @@ function _unsupported_iterable_to_array$2(o, minLen) {
|
|
|
14838
15221
|
/**
|
|
14839
15222
|
* Creates a {@link NotificationSendExclusionCanSendFunction} from the given exclusion list.
|
|
14840
15223
|
* Returns true for IDs that don't match any exclusion prefix.
|
|
15224
|
+
*
|
|
15225
|
+
* @param exclusions - the list of box IDs or prefixes that should be excluded from delivery
|
|
15226
|
+
* @returns a predicate function that returns true if the given notification/box ID is not excluded
|
|
14841
15227
|
*/ var notificationSendExclusionCanSendFunction = function notificationSendExclusionCanSendFunction(exclusions) {
|
|
14842
15228
|
var fn = function fn(notification) {
|
|
14843
|
-
return exclusions.
|
|
15229
|
+
return !exclusions.some(function(x) {
|
|
14844
15230
|
return notification.startsWith(x);
|
|
14845
|
-
})
|
|
15231
|
+
});
|
|
14846
15232
|
};
|
|
14847
15233
|
fn._exclusions = exclusions;
|
|
14848
15234
|
return fn;
|
|
@@ -14851,12 +15237,18 @@ function _unsupported_iterable_to_array$2(o, minLen) {
|
|
|
14851
15237
|
/**
|
|
14852
15238
|
* Returns true if all channels on the notification have reached a terminal state
|
|
14853
15239
|
* (NONE, NO_TRY, SENT, or SKIPPED). Used to determine if the notification can be marked done.
|
|
15240
|
+
*
|
|
15241
|
+
* @param input - the per-channel send flags to evaluate
|
|
15242
|
+
* @returns true if all channels are in a terminal send state
|
|
14854
15243
|
*/ function notificationSendFlagsImplyIsComplete(input) {
|
|
14855
15244
|
return isCompleteNotificationSendState(input.es) && isCompleteNotificationSendState(input.ps) && isCompleteNotificationSendState(input.ts) && isCompleteNotificationSendState(input.ns);
|
|
14856
15245
|
}
|
|
14857
15246
|
/**
|
|
14858
15247
|
* Returns true if the given send state is terminal — no further send attempts will be made.
|
|
14859
15248
|
* Terminal states: NONE, NO_TRY, SENT, SKIPPED.
|
|
15249
|
+
*
|
|
15250
|
+
* @param input - the send state to evaluate
|
|
15251
|
+
* @returns true if the state is terminal and no further delivery will be attempted
|
|
14860
15252
|
*/ function isCompleteNotificationSendState(input) {
|
|
14861
15253
|
var isComplete = false;
|
|
14862
15254
|
switch(input){
|
|
@@ -14866,7 +15258,11 @@ function _unsupported_iterable_to_array$2(o, minLen) {
|
|
|
14866
15258
|
case NotificationSendState.SKIPPED:
|
|
14867
15259
|
isComplete = true;
|
|
14868
15260
|
break;
|
|
14869
|
-
|
|
15261
|
+
case NotificationSendState.QUEUED:
|
|
15262
|
+
case NotificationSendState.SENT_PARTIAL:
|
|
15263
|
+
case NotificationSendState.SEND_ERROR:
|
|
15264
|
+
case NotificationSendState.BUILD_ERROR:
|
|
15265
|
+
case NotificationSendState.CONFIG_ERROR:
|
|
14870
15266
|
isComplete = false;
|
|
14871
15267
|
break;
|
|
14872
15268
|
}
|
|
@@ -14874,6 +15270,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
|
|
|
14874
15270
|
}
|
|
14875
15271
|
/**
|
|
14876
15272
|
* Resolves which recipient groups (global, box, explicit) are allowed based on the {@link NotificationRecipientSendFlag}.
|
|
15273
|
+
*
|
|
15274
|
+
* @param flag - the recipient send flag controlling which groups are included
|
|
15275
|
+
* @returns an object indicating which recipient groups are permitted for this notification
|
|
14877
15276
|
*/ function allowedNotificationRecipients(flag) {
|
|
14878
15277
|
var canSendToGlobalRecipients = true;
|
|
14879
15278
|
var canSendToBoxRecipients = true;
|
|
@@ -14907,6 +15306,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
|
|
|
14907
15306
|
*
|
|
14908
15307
|
* Only notifications that can be sent to box recipients are archived (notifications restricted
|
|
14909
15308
|
* to only explicit or only global recipients are not saved to the weekly archive).
|
|
15309
|
+
*
|
|
15310
|
+
* @param notification - the notification to check
|
|
15311
|
+
* @returns true if the notification should be saved to the weekly archive after delivery
|
|
14910
15312
|
*/ function shouldSaveNotificationToNotificationWeek(notification) {
|
|
14911
15313
|
return allowedNotificationRecipients(notification.rf).canSendToBoxRecipients;
|
|
14912
15314
|
}
|
|
@@ -14914,6 +15316,10 @@ function _unsupported_iterable_to_array$2(o, minLen) {
|
|
|
14914
15316
|
/**
|
|
14915
15317
|
* Merges a partial update into a {@link NotificationUserNotificationBoxRecipientConfig},
|
|
14916
15318
|
* preserving user-controlled fields (`nb`, `rm`, `ns`, `lk`, `bk`) and respecting OPT_OUT state.
|
|
15319
|
+
*
|
|
15320
|
+
* @param a - base user box recipient config to merge into
|
|
15321
|
+
* @param b - partial update to apply on top of the base
|
|
15322
|
+
* @returns the merged config with protected fields retained from `a`
|
|
14917
15323
|
*/ function mergeNotificationUserNotificationBoxRecipientConfigs(a, b) {
|
|
14918
15324
|
var _b_f;
|
|
14919
15325
|
return _object_spread_props$2(_object_spread$4({}, mergeNotificationBoxRecipients(a, b)), {
|
|
@@ -14928,6 +15334,10 @@ function _unsupported_iterable_to_array$2(o, minLen) {
|
|
|
14928
15334
|
}
|
|
14929
15335
|
/**
|
|
14930
15336
|
* Merges a partial update into a {@link NotificationBoxRecipient}, deeply merging the `c` (config record) field.
|
|
15337
|
+
*
|
|
15338
|
+
* @param a - base recipient to merge into
|
|
15339
|
+
* @param b - partial recipient update to apply on top of the base
|
|
15340
|
+
* @returns the merged recipient with deeply merged template config records
|
|
14931
15341
|
*/ function mergeNotificationBoxRecipients(a, b) {
|
|
14932
15342
|
return _object_spread_props$2(_object_spread$4({}, a, b), {
|
|
14933
15343
|
// configs should be merged/ovewritten
|
|
@@ -14937,6 +15347,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
|
|
|
14937
15347
|
/**
|
|
14938
15348
|
* Resolves a {@link NotificationBoxDocument} from a reference pair, loading by model key if no document is provided directly.
|
|
14939
15349
|
*
|
|
15350
|
+
* @param input - reference pair containing either a direct document or a model key to load from
|
|
15351
|
+
* @param accessor - Firestore document accessor used to load the document by ID when needed
|
|
15352
|
+
* @returns the resolved NotificationBoxDocument
|
|
14940
15353
|
* @throws {Error} When neither a document nor a model key is provided.
|
|
14941
15354
|
*/ function loadNotificationBoxDocumentForReferencePair(input, accessor) {
|
|
14942
15355
|
var inputNotificationBoxDocument = input.notificationBoxDocument, inputNotificationBoxRelatedModelKey = input.notificationBoxRelatedModelKey;
|
|
@@ -15080,11 +15493,17 @@ function _is_native_reflect_construct$2() {
|
|
|
15080
15493
|
});
|
|
15081
15494
|
/**
|
|
15082
15495
|
* Returns the Firestore {@link CollectionReference} for {@link OidcEntry} documents.
|
|
15496
|
+
*
|
|
15497
|
+
* @param context - the Firestore context to use
|
|
15498
|
+
* @returns the CollectionReference for OidcEntry documents
|
|
15083
15499
|
*/ function oidcEntryCollectionReference(context) {
|
|
15084
15500
|
return context.collection(oidcEntryIdentity.collectionName);
|
|
15085
15501
|
}
|
|
15086
15502
|
/**
|
|
15087
15503
|
* Creates an {@link OidcEntryFirestoreCollection} from the given configuration.
|
|
15504
|
+
*
|
|
15505
|
+
* @param config - the Firestore context and collection configuration
|
|
15506
|
+
* @returns a configured OidcEntryFirestoreCollection
|
|
15088
15507
|
*/ function oidcEntryFirestoreCollection(config) {
|
|
15089
15508
|
var firestoreContext = config.firestoreContext;
|
|
15090
15509
|
return firestoreContext.firestoreCollection({
|
|
@@ -15100,6 +15519,9 @@ function _is_native_reflect_construct$2() {
|
|
|
15100
15519
|
|
|
15101
15520
|
/**
|
|
15102
15521
|
* Query for OidcEntry documents with a specific type.
|
|
15522
|
+
*
|
|
15523
|
+
* @param type - the OIDC entry type to filter by
|
|
15524
|
+
* @returns Firestore query constraints for the given type
|
|
15103
15525
|
*/ function oidcEntriesWithTypeQuery(type) {
|
|
15104
15526
|
return [
|
|
15105
15527
|
where('type', '==', type)
|
|
@@ -15107,6 +15529,10 @@ function _is_native_reflect_construct$2() {
|
|
|
15107
15529
|
}
|
|
15108
15530
|
/**
|
|
15109
15531
|
* Query for OidcEntry documents with a specific type and userCode.
|
|
15532
|
+
*
|
|
15533
|
+
* @param type - the OIDC entry type to filter by
|
|
15534
|
+
* @param userCode - the user code to match
|
|
15535
|
+
* @returns Firestore query constraints for the given type and userCode
|
|
15110
15536
|
*/ function oidcEntriesByUserCodeQuery(type, userCode) {
|
|
15111
15537
|
return [
|
|
15112
15538
|
where('type', '==', type),
|
|
@@ -15115,6 +15541,10 @@ function _is_native_reflect_construct$2() {
|
|
|
15115
15541
|
}
|
|
15116
15542
|
/**
|
|
15117
15543
|
* Query for OidcEntry documents with a specific type and uid.
|
|
15544
|
+
*
|
|
15545
|
+
* @param type - the OIDC entry type to filter by
|
|
15546
|
+
* @param uid - the Firebase user ID to match
|
|
15547
|
+
* @returns Firestore query constraints for the given type and uid
|
|
15118
15548
|
*/ function oidcEntriesByUidQuery(type, uid) {
|
|
15119
15549
|
return [
|
|
15120
15550
|
where('type', '==', type),
|
|
@@ -15123,6 +15553,10 @@ function _is_native_reflect_construct$2() {
|
|
|
15123
15553
|
}
|
|
15124
15554
|
/**
|
|
15125
15555
|
* Query for OidcEntry documents with a specific type and grantId.
|
|
15556
|
+
*
|
|
15557
|
+
* @param type - the OIDC entry type to filter by
|
|
15558
|
+
* @param grantId - the grant ID to match
|
|
15559
|
+
* @returns Firestore query constraints for the given type and grantId
|
|
15126
15560
|
*/ function oidcEntriesByGrantIdQuery(type, grantId) {
|
|
15127
15561
|
return [
|
|
15128
15562
|
where('type', '==', type),
|
|
@@ -15131,6 +15565,9 @@ function _is_native_reflect_construct$2() {
|
|
|
15131
15565
|
}
|
|
15132
15566
|
/**
|
|
15133
15567
|
* Query for OidcEntry Client documents owned by a specific user.
|
|
15568
|
+
*
|
|
15569
|
+
* @param ownershipKey - the ownership key identifying the owner
|
|
15570
|
+
* @returns Firestore query constraints for Client entries matching the ownership key
|
|
15134
15571
|
*/ function oidcClientEntriesByOwnerQuery(ownershipKey) {
|
|
15135
15572
|
return [
|
|
15136
15573
|
where('type', '==', 'Client'),
|
|
@@ -15458,6 +15895,10 @@ function _is_native_reflect_construct$1() {
|
|
|
15458
15895
|
var storageFileIdentity = firestoreModelIdentity('storageFile', 'sf');
|
|
15459
15896
|
/**
|
|
15460
15897
|
* Creates a StorageFileGroupCreatedStorageFileKey from the input StorageFileGroupId and purpose.
|
|
15898
|
+
*
|
|
15899
|
+
* @param purpose - the purpose identifying the type of file within the group
|
|
15900
|
+
* @param storageFileGroupId - the ID of the parent StorageFileGroup
|
|
15901
|
+
* @returns a deterministic FirestoreCollectionModelKey for the storage file
|
|
15461
15902
|
*/ function storageFileGroupCreatedStorageFileKey(purpose, storageFileGroupId) {
|
|
15462
15903
|
return firestoreModelKey(storageFileIdentity, "".concat(purpose, "_").concat(storageFileGroupId));
|
|
15463
15904
|
}
|
|
@@ -15652,6 +16093,9 @@ var storageFileIdentity = firestoreModelIdentity('storageFile', 'sf');
|
|
|
15652
16093
|
* ```ts
|
|
15653
16094
|
* const colRef = storageFileCollectionReference(firestoreContext);
|
|
15654
16095
|
* ```
|
|
16096
|
+
*
|
|
16097
|
+
* @param context - the Firestore context to use
|
|
16098
|
+
* @returns the CollectionReference for StorageFile documents
|
|
15655
16099
|
*/ function storageFileCollectionReference(context) {
|
|
15656
16100
|
return context.collection(storageFileIdentity.collectionName);
|
|
15657
16101
|
}
|
|
@@ -15663,6 +16107,9 @@ var storageFileIdentity = firestoreModelIdentity('storageFile', 'sf');
|
|
|
15663
16107
|
* const collection = storageFileFirestoreCollection(firestoreContext);
|
|
15664
16108
|
* const doc = collection.documentAccessor().newDocument();
|
|
15665
16109
|
* ```
|
|
16110
|
+
*
|
|
16111
|
+
* @param firestoreContext - the Firestore context to use
|
|
16112
|
+
* @returns a configured StorageFileFirestoreCollection
|
|
15666
16113
|
*/ function storageFileFirestoreCollection(firestoreContext) {
|
|
15667
16114
|
return firestoreContext.firestoreCollection({
|
|
15668
16115
|
modelIdentity: storageFileIdentity,
|
|
@@ -15755,6 +16202,9 @@ var storageFileIdentity = firestoreModelIdentity('storageFile', 'sf');
|
|
|
15755
16202
|
* ```ts
|
|
15756
16203
|
* const colRef = storageFileGroupCollectionReference(firestoreContext);
|
|
15757
16204
|
* ```
|
|
16205
|
+
*
|
|
16206
|
+
* @param context - the Firestore context to use
|
|
16207
|
+
* @returns the CollectionReference for StorageFileGroup documents
|
|
15758
16208
|
*/ function storageFileGroupCollectionReference(context) {
|
|
15759
16209
|
return context.collection(storageFileGroupIdentity.collectionName);
|
|
15760
16210
|
}
|
|
@@ -15766,6 +16216,9 @@ var storageFileIdentity = firestoreModelIdentity('storageFile', 'sf');
|
|
|
15766
16216
|
* const collection = storageFileGroupFirestoreCollection(firestoreContext);
|
|
15767
16217
|
* const doc = collection.documentAccessor().loadDocumentForId(groupId);
|
|
15768
16218
|
* ```
|
|
16219
|
+
*
|
|
16220
|
+
* @param firestoreContext - the Firestore context to use
|
|
16221
|
+
* @returns a configured StorageFileGroupFirestoreCollection
|
|
15769
16222
|
*/ function storageFileGroupFirestoreCollection(firestoreContext) {
|
|
15770
16223
|
return firestoreContext.firestoreCollection({
|
|
15771
16224
|
modelIdentity: storageFileGroupIdentity,
|
|
@@ -15961,6 +16414,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
15961
16414
|
* initial state setup.
|
|
15962
16415
|
*
|
|
15963
16416
|
* @param config - optional defaults for creation type, subgroup, and processing state
|
|
16417
|
+
* @returns a factory function that creates StorageFile document pairs
|
|
15964
16418
|
* @throws {Error} When neither accessor nor context is provided
|
|
15965
16419
|
* @throws {Error} When no storage path can be resolved from the input
|
|
15966
16420
|
* @throws {Error} When FOR_STORAGE_FILE_GROUP is used without parentStorageFileGroup or purpose
|
|
@@ -16058,6 +16512,9 @@ function _ts_generator$2(thisArg, body) {
|
|
|
16058
16512
|
* Convenience function for creating a StorageFileDocumentPair.
|
|
16059
16513
|
*
|
|
16060
16514
|
* Calls createStorageFileDocumentPairFactory() with no arguments, then passes the input to the factory and returns the result.
|
|
16515
|
+
*
|
|
16516
|
+
* @param input - the creation input specifying the storage path, purpose, and context
|
|
16517
|
+
* @returns a promise resolving to the created StorageFileDocument and StorageFile data
|
|
16061
16518
|
*/ function createStorageFileDocumentPair(input) {
|
|
16062
16519
|
return _async_to_generator$2(function() {
|
|
16063
16520
|
return _ts_generator$2(this, function(_state) {
|
|
@@ -16104,6 +16561,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
16104
16561
|
*
|
|
16105
16562
|
* @param storageFileGroupId - the group's document ID
|
|
16106
16563
|
* @param subPath - optional sub-paths to append
|
|
16564
|
+
* @returns the folder path as a SlashPathFolder string
|
|
16107
16565
|
*
|
|
16108
16566
|
* @example
|
|
16109
16567
|
* ```ts
|
|
@@ -16129,6 +16587,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
16129
16587
|
/**
|
|
16130
16588
|
* Returns the full storage path for a StorageFileGroup's zip file.
|
|
16131
16589
|
*
|
|
16590
|
+
* @param storageFileGroupId - the group's document ID
|
|
16591
|
+
* @returns the full SlashPath to the group's zip archive
|
|
16592
|
+
*
|
|
16132
16593
|
* @example
|
|
16133
16594
|
* ```ts
|
|
16134
16595
|
* const zipPath = storageFileGroupZipFileStoragePath('abc123');
|
|
@@ -16166,6 +16627,8 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
16166
16627
|
* const constraints = storageFilesQueuedForProcessingQuery();
|
|
16167
16628
|
* const results = await collection.query(constraints);
|
|
16168
16629
|
* ```
|
|
16630
|
+
*
|
|
16631
|
+
* @returns Firestore query constraints for StorageFiles queued for processing
|
|
16169
16632
|
*/ function storageFilesQueuedForProcessingQuery() {
|
|
16170
16633
|
return [
|
|
16171
16634
|
where('ps', '==', StorageFileProcessingState.QUEUED_FOR_PROCESSING)
|
|
@@ -16177,6 +16640,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
16177
16640
|
* Used by the cleanup service to find files ready for permanent deletion.
|
|
16178
16641
|
*
|
|
16179
16642
|
* @param now - reference time for comparison; defaults to current time
|
|
16643
|
+
* @returns Firestore query constraints for StorageFiles whose scheduled delete date has passed
|
|
16180
16644
|
*
|
|
16181
16645
|
* @example
|
|
16182
16646
|
* ```ts
|
|
@@ -16192,6 +16656,10 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
16192
16656
|
* with optional subgroup filtering.
|
|
16193
16657
|
*
|
|
16194
16658
|
* @example
|
|
16659
|
+
* @param input - the user, purpose, and optional subgroup to filter by
|
|
16660
|
+
* @returns Firestore query constraints for the given purpose and user
|
|
16661
|
+
*
|
|
16662
|
+
* @example
|
|
16195
16663
|
* ```ts
|
|
16196
16664
|
* const constraints = storageFilePurposeAndUserQuery({
|
|
16197
16665
|
* user: 'user123',
|
|
@@ -16214,6 +16682,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
16214
16682
|
* Used by the sync service to find files whose group memberships need to be propagated.
|
|
16215
16683
|
*
|
|
16216
16684
|
* @example
|
|
16685
|
+
* @returns Firestore query constraints for StorageFiles flagged for group synchronization
|
|
16686
|
+
*
|
|
16687
|
+
* @example
|
|
16217
16688
|
* ```ts
|
|
16218
16689
|
* const constraints = storageFileFlaggedForSyncWithGroupsQuery();
|
|
16219
16690
|
* ```
|
|
@@ -16229,6 +16700,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
16229
16700
|
* Used by the initialization service to find newly-created groups that haven't been synced yet.
|
|
16230
16701
|
*
|
|
16231
16702
|
* @example
|
|
16703
|
+
* @returns Firestore query constraints for StorageFileGroups needing initialization
|
|
16704
|
+
*
|
|
16705
|
+
* @example
|
|
16232
16706
|
* ```ts
|
|
16233
16707
|
* const constraints = storageFileGroupsFlaggedForNeedsInitializationQuery();
|
|
16234
16708
|
* ```
|
|
@@ -16241,6 +16715,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
16241
16715
|
* Returns query constraints for StorageFileGroups flagged for content regeneration (`re == true`).
|
|
16242
16716
|
*
|
|
16243
16717
|
* @example
|
|
16718
|
+
* @returns Firestore query constraints for StorageFileGroups flagged for content regeneration
|
|
16719
|
+
*
|
|
16720
|
+
* @example
|
|
16244
16721
|
* ```ts
|
|
16245
16722
|
* const constraints = storageFileGroupsFlaggedForContentRegenerationQuery();
|
|
16246
16723
|
* ```
|
|
@@ -16255,6 +16732,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
16255
16732
|
* Invalid groups are typically cleaned up (deleted along with their associated files).
|
|
16256
16733
|
*
|
|
16257
16734
|
* @example
|
|
16735
|
+
* @returns Firestore query constraints for StorageFileGroups flagged as invalid
|
|
16736
|
+
*
|
|
16737
|
+
* @example
|
|
16258
16738
|
* ```ts
|
|
16259
16739
|
* const constraints = storageFileGroupsFlaggedInvalidQuery();
|
|
16260
16740
|
* ```
|
|
@@ -16277,6 +16757,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
16277
16757
|
* The created task is unique per StorageFile (only one processing task at a time).
|
|
16278
16758
|
*
|
|
16279
16759
|
* @param input - the target StorageFileDocument and optional subtask data
|
|
16760
|
+
* @returns a CreateNotificationTaskTemplate for the StorageFile processing task
|
|
16280
16761
|
*
|
|
16281
16762
|
* @example
|
|
16282
16763
|
* ```ts
|
|
@@ -16521,6 +17002,7 @@ function _ts_generator$1(thisArg, body) {
|
|
|
16521
17002
|
* Use this within a permission service to define role-based access for StorageFile operations.
|
|
16522
17003
|
*
|
|
16523
17004
|
* @param config - the permission output, auth context, and target document
|
|
17005
|
+
* @returns a function that accepts role configuration and returns a GrantRolesOtherwiseFunction
|
|
16524
17006
|
*
|
|
16525
17007
|
* @example
|
|
16526
17008
|
* ```ts
|
|
@@ -16531,7 +17013,7 @@ function _ts_generator$1(thisArg, body) {
|
|
|
16531
17013
|
* });
|
|
16532
17014
|
* ```
|
|
16533
17015
|
*/ function grantStorageFileRolesForUserAuthFunction(config) {
|
|
16534
|
-
var output = config.output, context = config.context;
|
|
17016
|
+
var output = config.output, context = config.context;
|
|
16535
17017
|
return function(input) {
|
|
16536
17018
|
var rolesForStorageFileUser = input.rolesForStorageFileUser, rolesForStorageFileOwnershipKey = input.rolesForStorageFileOwnershipKey;
|
|
16537
17019
|
var result = function result() {
|
|
@@ -16610,6 +17092,8 @@ function _object_spread$1(target) {
|
|
|
16610
17092
|
*
|
|
16611
17093
|
* Should only be used server-side, as `copy` may not be available on the client.
|
|
16612
17094
|
*
|
|
17095
|
+
* @returns a factory function that wraps FirebaseStorageAccessorFile instances into StoredFileReader accessors
|
|
17096
|
+
*
|
|
16613
17097
|
* @example
|
|
16614
17098
|
* ```ts
|
|
16615
17099
|
* const factory = storedFileReaderFactory();
|
|
@@ -16637,7 +17121,8 @@ function _object_spread$1(target) {
|
|
|
16637
17121
|
loadFileStream: file.getStream,
|
|
16638
17122
|
loadFileMetadata: loadFileMetadata,
|
|
16639
17123
|
loadCustomMetadata: loadCustomMetadata,
|
|
16640
|
-
|
|
17124
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- copy is always available on the server-side
|
|
17125
|
+
copy: file.copy
|
|
16641
17126
|
};
|
|
16642
17127
|
return accessor;
|
|
16643
17128
|
};
|
|
@@ -16663,6 +17148,7 @@ function _object_spread$1(target) {
|
|
|
16663
17148
|
* Creates a {@link UserUploadsFolderSlashPathFactory} that generates per-user upload folder paths.
|
|
16664
17149
|
*
|
|
16665
17150
|
* @param inputBasePath - optional custom base path; defaults to {@link ALL_USER_UPLOADS_FOLDER_PATH}
|
|
17151
|
+
* @returns a factory function that generates per-user upload folder slash paths
|
|
16666
17152
|
*
|
|
16667
17153
|
* @example
|
|
16668
17154
|
* ```ts
|
|
@@ -16679,6 +17165,11 @@ function _object_spread$1(target) {
|
|
|
16679
17165
|
/**
|
|
16680
17166
|
* Creates a {@link UserUploadsFolderStoragePathFactory} that includes the storage bucket ID.
|
|
16681
17167
|
*
|
|
17168
|
+
* @param root0 - the configuration object
|
|
17169
|
+
* @param root0.bucketId - the storage bucket ID to include in each generated path
|
|
17170
|
+
* @param root0.basePath - optional custom base path; defaults to {@link ALL_USER_UPLOADS_FOLDER_PATH}
|
|
17171
|
+
* @returns a factory function that generates per-user StoragePath values including the bucket ID
|
|
17172
|
+
*
|
|
16682
17173
|
* @example
|
|
16683
17174
|
* ```ts
|
|
16684
17175
|
* const factory = userUploadsFolderStoragePathFactory({ bucketId: 'my-bucket' });
|
|
@@ -16913,6 +17404,7 @@ function _ts_generator(thisArg, body) {
|
|
|
16913
17404
|
* (e.g., `image` matches `image.png`, `image-test.jpg`) at {@link HIGH_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL}.
|
|
16914
17405
|
*
|
|
16915
17406
|
* @param config - file type, match string, and optional determination levels
|
|
17407
|
+
* @returns an UploadedFileTypeDeterminer that classifies by file name
|
|
16916
17408
|
*
|
|
16917
17409
|
* @example
|
|
16918
17410
|
* ```ts
|
|
@@ -16962,6 +17454,7 @@ function _ts_generator(thisArg, body) {
|
|
|
16962
17454
|
* exactly equals the configured match string.
|
|
16963
17455
|
*
|
|
16964
17456
|
* @param config - file type and folder name to match
|
|
17457
|
+
* @returns an UploadedFileTypeDeterminer that classifies by folder name
|
|
16965
17458
|
*
|
|
16966
17459
|
* @example
|
|
16967
17460
|
* ```ts
|
|
@@ -17001,6 +17494,7 @@ function _ts_generator(thisArg, body) {
|
|
|
17001
17494
|
* built-in determiners.
|
|
17002
17495
|
*
|
|
17003
17496
|
* @param config - file type, path match config, optional bucket/file filters
|
|
17497
|
+
* @returns an UploadedFileTypeDeterminer that classifies by storage path
|
|
17004
17498
|
*
|
|
17005
17499
|
* @example
|
|
17006
17500
|
* ```ts
|
|
@@ -17047,6 +17541,7 @@ function _ts_generator(thisArg, body) {
|
|
|
17047
17541
|
* If `requireUser` is true, the determination fails when no user can be detected.
|
|
17048
17542
|
*
|
|
17049
17543
|
* @param config - root folder, user prefix, and matching options
|
|
17544
|
+
* @returns a wrapper function that adds user detection to any UploadedFileTypeDeterminer
|
|
17050
17545
|
*
|
|
17051
17546
|
* @example
|
|
17052
17547
|
* ```ts
|
|
@@ -17058,8 +17553,7 @@ function _ts_generator(thisArg, body) {
|
|
|
17058
17553
|
* ```
|
|
17059
17554
|
*/ function determineUserByFolderWrapperFunction(config) {
|
|
17060
17555
|
var _config_matchSubPath;
|
|
17061
|
-
var rootFolder = config.rootFolder, userFolderPrefix = config.userFolderPrefix, _config_requireUser = config.requireUser, requireUser = _config_requireUser === void 0 ? false : _config_requireUser,
|
|
17062
|
-
var allowSubPaths = inputAllowSubPaths !== null && inputAllowSubPaths !== void 0 ? inputAllowSubPaths : true;
|
|
17556
|
+
var rootFolder = config.rootFolder, userFolderPrefix = config.userFolderPrefix, _config_requireUser = config.requireUser, requireUser = _config_requireUser === void 0 ? false : _config_requireUser, _config_allowSubPaths = config.allowSubPaths, allowSubPaths = _config_allowSubPaths === void 0 ? true : _config_allowSubPaths;
|
|
17063
17557
|
var subPathMatcherConfig = (_config_matchSubPath = config.matchSubPath) !== null && _config_matchSubPath !== void 0 ? _config_matchSubPath : {
|
|
17064
17558
|
basePath: mergeSlashPaths([
|
|
17065
17559
|
rootFolder,
|
|
@@ -17121,6 +17615,9 @@ function _ts_generator(thisArg, body) {
|
|
|
17121
17615
|
/**
|
|
17122
17616
|
* Convenience wrapper pre-configured for the standard uploads folder structure (`uploads/u/{userId}/...`).
|
|
17123
17617
|
*
|
|
17618
|
+
* @param config - optional matching options (rootFolder and userFolderPrefix are pre-configured)
|
|
17619
|
+
* @returns a wrapper function that adds user detection for the standard uploads folder structure
|
|
17620
|
+
*
|
|
17124
17621
|
* @example
|
|
17125
17622
|
* ```ts
|
|
17126
17623
|
* const addUser = determineUserByUserUploadsFolderWrapperFunction();
|
|
@@ -17147,6 +17644,7 @@ function _ts_generator(thisArg, body) {
|
|
|
17147
17644
|
*
|
|
17148
17645
|
* @param determiner - the determiner to filter
|
|
17149
17646
|
* @param types - allowed file type identifier(s)
|
|
17647
|
+
* @returns an UploadedFileTypeDeterminer that only returns results for the specified file types
|
|
17150
17648
|
*
|
|
17151
17649
|
* @example
|
|
17152
17650
|
* ```ts
|
|
@@ -17190,6 +17688,7 @@ function _ts_generator(thisArg, body) {
|
|
|
17190
17688
|
* short-circuited via `completeSearchOnFirstMatch` or `completeSearchAtLevel`.
|
|
17191
17689
|
*
|
|
17192
17690
|
* @param config - determiners to combine and optional early-exit settings
|
|
17691
|
+
* @returns a combined UploadedFileTypeDeterminer that returns the highest-confidence match
|
|
17193
17692
|
*
|
|
17194
17693
|
* @example
|
|
17195
17694
|
* ```ts
|
|
@@ -17204,9 +17703,9 @@ function _ts_generator(thisArg, body) {
|
|
|
17204
17703
|
if (determiners.length === 1) {
|
|
17205
17704
|
result = determiners[0];
|
|
17206
17705
|
} else {
|
|
17207
|
-
var possibleFileTypes = unique(determiners.
|
|
17706
|
+
var possibleFileTypes = unique(determiners.flatMap(function(d) {
|
|
17208
17707
|
return d.getPossibleFileTypes();
|
|
17209
|
-
})
|
|
17708
|
+
}));
|
|
17210
17709
|
var completeSearchOnFirstMatch = Boolean(inputCompleteSearchOnFirstMatch);
|
|
17211
17710
|
var completeSearchAtLevel = completeSearchOnFirstMatch ? LOW_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL : inputCompleteSearchAtLevel !== null && inputCompleteSearchAtLevel !== void 0 ? inputCompleteSearchAtLevel : EXACT_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL;
|
|
17212
17711
|
result = {
|
|
@@ -17306,6 +17805,9 @@ function _ts_generator(thisArg, body) {
|
|
|
17306
17805
|
* If a document is provided directly, it is returned as-is. Otherwise, the related model key
|
|
17307
17806
|
* is converted to a group ID via {@link storageFileGroupIdForModel} and loaded from the accessor.
|
|
17308
17807
|
*
|
|
17808
|
+
* @param input - reference pair containing either a document or a related model key
|
|
17809
|
+
* @param accessor - document accessor used to load the group document by ID
|
|
17810
|
+
* @returns the resolved StorageFileGroupDocument
|
|
17309
17811
|
* @throws {Error} When neither storageFileGroupDocument nor storageFileGroupRelatedModelKey is provided
|
|
17310
17812
|
*
|
|
17311
17813
|
* @example
|
|
@@ -17369,7 +17871,7 @@ function _ts_generator(thisArg, body) {
|
|
|
17369
17871
|
]);
|
|
17370
17872
|
}
|
|
17371
17873
|
});
|
|
17372
|
-
var re = currentRe
|
|
17874
|
+
var re = currentRe !== null && currentRe !== void 0 ? currentRe : oneOrMoreItemsWereRemoved; // flag removed if any items were removed
|
|
17373
17875
|
// recalculate re if it is false or the retain flag is false
|
|
17374
17876
|
if (!re || allowRecalculateRegenerateFlag) {
|
|
17375
17877
|
var flagRegenerate = calculateStorageFileGroupRegeneration({
|
|
@@ -17395,6 +17897,7 @@ function _ts_generator(thisArg, body) {
|
|
|
17395
17897
|
* - Any embedded file has never been included in the zip (`zat` is unset on the entry)
|
|
17396
17898
|
*
|
|
17397
17899
|
* @param input - group state and optional force flag
|
|
17900
|
+
* @returns the regeneration result indicating whether the zip or other derived files need to be regenerated
|
|
17398
17901
|
*
|
|
17399
17902
|
* @example
|
|
17400
17903
|
* ```ts
|
|
@@ -17562,6 +18065,9 @@ function _is_native_reflect_construct() {
|
|
|
17562
18065
|
* ```ts
|
|
17563
18066
|
* const colRef = systemStateCollectionReference(firestoreContext);
|
|
17564
18067
|
* ```
|
|
18068
|
+
*
|
|
18069
|
+
* @param context - the Firestore context to use
|
|
18070
|
+
* @returns the CollectionReference for SystemState documents
|
|
17565
18071
|
*/ function systemStateCollectionReference(context) {
|
|
17566
18072
|
return context.collection(systemStateIdentity.collectionName);
|
|
17567
18073
|
}
|
|
@@ -17574,6 +18080,7 @@ function _is_native_reflect_construct() {
|
|
|
17574
18080
|
*
|
|
17575
18081
|
* @param firestoreContext - the Firestore context
|
|
17576
18082
|
* @param converters - map of type identifiers to their data field converters
|
|
18083
|
+
* @returns a configured SystemStateFirestoreCollection with per-type data converters
|
|
17577
18084
|
*
|
|
17578
18085
|
* @example
|
|
17579
18086
|
* ```ts
|