@dereekb/firebase-server 13.6.9 → 13.6.11

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.esm.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { DBX_FIREBASE_SERVER_NO_AUTH_ERROR_CODE, FIREBASE_AUTH_USER_NOT_FOUND_ERROR, FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY, FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY, FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR, FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR, FIREBASE_AUTH_INVALID_PHONE_NUMBER_ERROR, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_LAST_COM_DATE_KEY, FirestoreDocumentContextType, streamFromOnSnapshot, makeFirestoreQueryConstraintFunctionsDriver, FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE, FIRESTORE_LIMIT_TO_LAST_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_OFFSET_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AFTER_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_BEFORE_QUERY_CONSTRAINT_TYPE, firestoreContextFactory, firestoreField, optionalFirestoreField, setIdAndKeyFromKeyIdRefOnDocumentData, MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT, ScheduledFunctionDevelopmentFunctionTypeEnum, SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER, storageListFilesResultFactory, assertStorageUploadOptionsStringFormat, firebaseStorageContextFactory, inContextFirebaseModelsServiceFactory, useFirebaseModelsService } from '@dereekb/firebase';
2
- import { partialServerError, isServerError, randomNumberFactory, cachedGetter, filterNullAndUndefinedValues, asSet, AUTH_ADMIN_ROLE, AUTH_TOS_SIGNED_ROLE, forEachKeyValue, KeyValueTypleValueFilter, filterUndefinedValues, isThrottled, mapObjectMap, batch, objectToMap, serverError, asArray, containsAllValues, websiteUrlDetails, mergeObjects, cronExpressionRepeatingEveryNMinutes, mapIdentityFunction, slashPathName, toRelativeSlashPathStartType, fixMultiSlashesInSlashPath, SLASH_PATH_SEPARATOR, objectHasNoKeys, websiteUrlFromPaths, pushItemOrArrayItemsIntoArray, makeGetter, asGetter, build } from '@dereekb/util';
2
+ import { partialServerError, isServerError, randomNumberFactory, cachedGetter, filterNullAndUndefinedValues, asSet, AUTH_ADMIN_ROLE, AUTH_TOS_SIGNED_ROLE, forEachKeyValue, KeyValueTypleValueFilter, filterUndefinedValues, isThrottled, mapObjectMap, batch, objectToMap, serverError, asArray, containsAllValues, websiteUrlDetails, mergeObjects, cronExpressionRepeatingEveryNMinutes, mapIdentityFunction, slashPathName, toRelativeSlashPathStartType, fixMultiSlashesInSlashPath, SLASH_PATH_SEPARATOR, objectHasNoKeys, websiteUrlFromPaths, pushItemOrArrayItemsIntoArray, makeGetter, asGetter, build, performAsyncTasks } from '@dereekb/util';
3
3
  import { HttpsError } from 'firebase-functions/https';
4
4
  import { hoursToMs, toISODateString } from '@dereekb/date';
5
5
  import { BaseError } from 'make-error';
6
- import { SERVER_ENV_TOKEN, resolveEncryptionKey, encryptValue, decryptValue, mergeModuleMetadata, ServerEnvironmentService, DEFAULT_BASE_WEBHOOK_PATH, DEFAULT_WEBHOOK_MIDDLEWARE_ROUTE_INFO, isTestNodeEnv, injectionTokensFromProviders } from '@dereekb/nestjs';
6
+ import { SERVER_ENV_TOKEN, resolveEncryptionKey, encryptValue, decryptValue, mergeModuleMetadata, ServerEnvironmentService, DEFAULT_BASE_WEBHOOK_PATH, DEFAULT_WEBHOOK_MIDDLEWARE_ROUTE_INFO, isTestNodeEnv, injectionTokensFromProviders, nodeJsLocalAssetLoader } from '@dereekb/nestjs';
7
7
  import { from } from 'rxjs';
8
8
  import { FieldValue, FieldPath } from '@google-cloud/firestore';
9
9
  import { Injectable, Optional, Inject, Module, Logger, ForbiddenException, createParamDecorator } from '@nestjs/common';
@@ -16,6 +16,7 @@ import admin from 'firebase-admin';
16
16
  import { ApiError } from '@google-cloud/storage';
17
17
  import { addMilliseconds, addHours } from 'date-fns';
18
18
  import { isUint8Array, isArrayBuffer } from 'util/types';
19
+ import { fetchAssetLoader, delegatedAssetLoader, AssetLoader } from '@dereekb/rxjs';
19
20
  import { ExpressAdapter } from '@nestjs/platform-express';
20
21
  import express from 'express';
21
22
 
@@ -800,16 +801,16 @@ function _is_native_reflect_construct$5() {
800
801
  }
801
802
  (BaseError);
802
803
 
803
- function _array_like_to_array$a(arr, len) {
804
+ function _array_like_to_array$b(arr, len) {
804
805
  if (len == null || len > arr.length) len = arr.length;
805
806
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
806
807
  return arr2;
807
808
  }
808
- function _array_with_holes$3(arr) {
809
+ function _array_with_holes$4(arr) {
809
810
  if (Array.isArray(arr)) return arr;
810
811
  }
811
812
  function _array_without_holes$7(arr) {
812
- if (Array.isArray(arr)) return _array_like_to_array$a(arr);
813
+ if (Array.isArray(arr)) return _array_like_to_array$b(arr);
813
814
  }
814
815
  function _assert_this_initialized$4(self) {
815
816
  if (self === void 0) {
@@ -903,7 +904,7 @@ function _inherits$4(subClass, superClass) {
903
904
  function _iterable_to_array$7(iter) {
904
905
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
905
906
  }
906
- function _iterable_to_array_limit$3(arr, i) {
907
+ function _iterable_to_array_limit$4(arr, i) {
907
908
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
908
909
  if (_i == null) return;
909
910
  var _arr = [];
@@ -927,7 +928,7 @@ function _iterable_to_array_limit$3(arr, i) {
927
928
  }
928
929
  return _arr;
929
930
  }
930
- function _non_iterable_rest$3() {
931
+ function _non_iterable_rest$4() {
931
932
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
932
933
  }
933
934
  function _non_iterable_spread$7() {
@@ -961,23 +962,23 @@ function _set_prototype_of$4(o, p) {
961
962
  };
962
963
  return _set_prototype_of$4(o, p);
963
964
  }
964
- function _sliced_to_array$3(arr, i) {
965
- return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$3();
965
+ function _sliced_to_array$4(arr, i) {
966
+ return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$b(arr, i) || _non_iterable_rest$4();
966
967
  }
967
968
  function _to_consumable_array$7(arr) {
968
- return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$7();
969
+ return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$b(arr) || _non_iterable_spread$7();
969
970
  }
970
971
  function _type_of$5(obj) {
971
972
  "@swc/helpers - typeof";
972
973
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
973
974
  }
974
- function _unsupported_iterable_to_array$a(o, minLen) {
975
+ function _unsupported_iterable_to_array$b(o, minLen) {
975
976
  if (!o) return;
976
- if (typeof o === "string") return _array_like_to_array$a(o, minLen);
977
+ if (typeof o === "string") return _array_like_to_array$b(o, minLen);
977
978
  var n = Object.prototype.toString.call(o).slice(8, -1);
978
979
  if (n === "Object" && o.constructor) n = o.constructor.name;
979
980
  if (n === "Map" || n === "Set") return Array.from(n);
980
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
981
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
981
982
  }
982
983
  function _is_native_reflect_construct$4() {
983
984
  try {
@@ -1333,7 +1334,7 @@ function _ts_generator$b(thisArg, body) {
1333
1334
  claims = {};
1334
1335
  forEachKeyValue(baseClaims, {
1335
1336
  forEach: function forEach(param) {
1336
- var _param = _sliced_to_array$3(param, 1), key = _param[0];
1337
+ var _param = _sliced_to_array$4(param, 1), key = _param[0];
1337
1338
  claims[key] = null; // set null on every key
1338
1339
  },
1339
1340
  filter: KeyValueTypleValueFilter.NONE // don't skip any key/value
@@ -2284,13 +2285,13 @@ function _class_call_check$m(instance, Constructor) {
2284
2285
  });
2285
2286
  }
2286
2287
 
2287
- function _array_like_to_array$9(arr, len) {
2288
+ function _array_like_to_array$a(arr, len) {
2288
2289
  if (len == null || len > arr.length) len = arr.length;
2289
2290
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2290
2291
  return arr2;
2291
2292
  }
2292
2293
  function _array_without_holes$6(arr) {
2293
- if (Array.isArray(arr)) return _array_like_to_array$9(arr);
2294
+ if (Array.isArray(arr)) return _array_like_to_array$a(arr);
2294
2295
  }
2295
2296
  function _define_property$r(obj, key, value) {
2296
2297
  if (key in obj) {
@@ -2327,15 +2328,15 @@ function _object_spread$f(target) {
2327
2328
  return target;
2328
2329
  }
2329
2330
  function _to_consumable_array$6(arr) {
2330
- return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$6();
2331
+ return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$6();
2331
2332
  }
2332
- function _unsupported_iterable_to_array$9(o, minLen) {
2333
+ function _unsupported_iterable_to_array$a(o, minLen) {
2333
2334
  if (!o) return;
2334
- if (typeof o === "string") return _array_like_to_array$9(o, minLen);
2335
+ if (typeof o === "string") return _array_like_to_array$a(o, minLen);
2335
2336
  var n = Object.prototype.toString.call(o).slice(8, -1);
2336
2337
  if (n === "Object" && o.constructor) n = o.constructor.name;
2337
2338
  if (n === "Map" || n === "Set") return Array.from(n);
2338
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
2339
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
2339
2340
  }
2340
2341
  /**
2341
2342
  * Converts a {@link FirestoreAccessorArrayUpdate} into Firestore {@link UpdateData} using
@@ -2894,12 +2895,12 @@ function _define_property$o(obj, key, value) {
2894
2895
  return new TransactionFirestoreDocumentContext(transaction);
2895
2896
  }
2896
2897
 
2897
- function _array_like_to_array$8(arr, len) {
2898
+ function _array_like_to_array$9(arr, len) {
2898
2899
  if (len == null || len > arr.length) len = arr.length;
2899
2900
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2900
2901
  return arr2;
2901
2902
  }
2902
- function _array_with_holes$2(arr) {
2903
+ function _array_with_holes$3(arr) {
2903
2904
  if (Array.isArray(arr)) return arr;
2904
2905
  }
2905
2906
  function asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, key, arg) {
@@ -2931,7 +2932,7 @@ function _async_to_generator$a(fn) {
2931
2932
  });
2932
2933
  };
2933
2934
  }
2934
- function _iterable_to_array_limit$2(arr, i) {
2935
+ function _iterable_to_array_limit$3(arr, i) {
2935
2936
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2936
2937
  if (_i == null) return;
2937
2938
  var _arr = [];
@@ -2955,19 +2956,19 @@ function _iterable_to_array_limit$2(arr, i) {
2955
2956
  }
2956
2957
  return _arr;
2957
2958
  }
2958
- function _non_iterable_rest$2() {
2959
+ function _non_iterable_rest$3() {
2959
2960
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2960
2961
  }
2961
- function _sliced_to_array$2(arr, i) {
2962
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$8(arr, i) || _non_iterable_rest$2();
2962
+ function _sliced_to_array$3(arr, i) {
2963
+ return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$9(arr, i) || _non_iterable_rest$3();
2963
2964
  }
2964
- function _unsupported_iterable_to_array$8(o, minLen) {
2965
+ function _unsupported_iterable_to_array$9(o, minLen) {
2965
2966
  if (!o) return;
2966
- if (typeof o === "string") return _array_like_to_array$8(o, minLen);
2967
+ if (typeof o === "string") return _array_like_to_array$9(o, minLen);
2967
2968
  var n = Object.prototype.toString.call(o).slice(8, -1);
2968
2969
  if (n === "Object" && o.constructor) n = o.constructor.name;
2969
2970
  if (n === "Map" || n === "Set") return Array.from(n);
2970
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
2971
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
2971
2972
  }
2972
2973
  function _ts_generator$a(thisArg, body) {
2973
2974
  var f, y, t, _ = {
@@ -3092,7 +3093,7 @@ function _ts_generator$a(thisArg, body) {
3092
3093
  }
3093
3094
  var batches = batch(pathSegments, 2); // batch to tuple [string, string]
3094
3095
  batches.forEach(function(x) {
3095
- var _x = _sliced_to_array$2(x, 2), first = _x[0], second = _x[1];
3096
+ var _x = _sliced_to_array$3(x, 2), first = _x[0], second = _x[1];
3096
3097
  ref = ref.doc(first).collection(second);
3097
3098
  });
3098
3099
  }
@@ -3119,7 +3120,7 @@ function _ts_generator$a(thisArg, body) {
3119
3120
  if (pathSegments === null || pathSegments === void 0 ? void 0 : pathSegments.length) {
3120
3121
  var batches = batch(pathSegments, 2); // batch to tuple [string, string]
3121
3122
  batches.forEach(function(x) {
3122
- var _x = _sliced_to_array$2(x, 2), first = _x[0], second = _x[1];
3123
+ var _x = _sliced_to_array$3(x, 2), first = _x[0], second = _x[1];
3123
3124
  var collection = doc.collection(first);
3124
3125
  doc = second ? collection.doc(second) : collection.doc();
3125
3126
  });
@@ -3187,13 +3188,13 @@ function _ts_generator$a(thisArg, body) {
3187
3188
  };
3188
3189
  }
3189
3190
 
3190
- function _array_like_to_array$7(arr, len) {
3191
+ function _array_like_to_array$8(arr, len) {
3191
3192
  if (len == null || len > arr.length) len = arr.length;
3192
3193
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3193
3194
  return arr2;
3194
3195
  }
3195
3196
  function _array_without_holes$5(arr) {
3196
- if (Array.isArray(arr)) return _array_like_to_array$7(arr);
3197
+ if (Array.isArray(arr)) return _array_like_to_array$8(arr);
3197
3198
  }
3198
3199
  function _define_property$n(obj, key, value) {
3199
3200
  if (key in obj) {
@@ -3249,15 +3250,15 @@ function _object_spread_props$c(target, source) {
3249
3250
  return target;
3250
3251
  }
3251
3252
  function _to_consumable_array$5(arr) {
3252
- return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$5();
3253
+ return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$5();
3253
3254
  }
3254
- function _unsupported_iterable_to_array$7(o, minLen) {
3255
+ function _unsupported_iterable_to_array$8(o, minLen) {
3255
3256
  if (!o) return;
3256
- if (typeof o === "string") return _array_like_to_array$7(o, minLen);
3257
+ if (typeof o === "string") return _array_like_to_array$8(o, minLen);
3257
3258
  var n = Object.prototype.toString.call(o).slice(8, -1);
3258
3259
  if (n === "Object" && o.constructor) n = o.constructor.name;
3259
3260
  if (n === "Map" || n === "Set") return Array.from(n);
3260
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
3261
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
3261
3262
  }
3262
3263
  var _builder, _builder1;
3263
3264
  var _obj;
@@ -4233,15 +4234,15 @@ function _ts_generator$8(thisArg, body) {
4233
4234
  })();
4234
4235
  }
4235
4236
 
4236
- function _array_like_to_array$6(arr, len) {
4237
+ function _array_like_to_array$7(arr, len) {
4237
4238
  if (len == null || len > arr.length) len = arr.length;
4238
4239
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4239
4240
  return arr2;
4240
4241
  }
4241
- function _array_with_holes$1(arr) {
4242
+ function _array_with_holes$2(arr) {
4242
4243
  if (Array.isArray(arr)) return arr;
4243
4244
  }
4244
- function _iterable_to_array_limit$1(arr, i) {
4245
+ function _iterable_to_array_limit$2(arr, i) {
4245
4246
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
4246
4247
  if (_i == null) return;
4247
4248
  var _arr = [];
@@ -4265,7 +4266,7 @@ function _iterable_to_array_limit$1(arr, i) {
4265
4266
  }
4266
4267
  return _arr;
4267
4268
  }
4268
- function _non_iterable_rest$1() {
4269
+ function _non_iterable_rest$2() {
4269
4270
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4270
4271
  }
4271
4272
  function _object_without_properties(source, excluded) {
@@ -4304,16 +4305,16 @@ function _object_without_properties_loose(source, excluded) {
4304
4305
  }
4305
4306
  return target;
4306
4307
  }
4307
- function _sliced_to_array$1(arr, i) {
4308
- return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$1();
4308
+ function _sliced_to_array$2(arr, i) {
4309
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$2();
4309
4310
  }
4310
- function _unsupported_iterable_to_array$6(o, minLen) {
4311
+ function _unsupported_iterable_to_array$7(o, minLen) {
4311
4312
  if (!o) return;
4312
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
4313
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
4313
4314
  var n = Object.prototype.toString.call(o).slice(8, -1);
4314
4315
  if (n === "Object" && o.constructor) n = o.constructor.name;
4315
4316
  if (n === "Map" || n === "Set") return Array.from(n);
4316
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
4317
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
4317
4318
  }
4318
4319
  // MARK: Type Guards
4319
4320
  /**
@@ -4414,7 +4415,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4414
4415
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4415
4416
  try {
4416
4417
  for(var _iterator = Object.entries(config)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4417
- var _step_value = _sliced_to_array$1(_step.value, 2), key = _step_value[0], handler = _step_value[1];
4418
+ var _step_value = _sliced_to_array$2(_step.value, 2), key = _step_value[0], handler = _step_value[1];
4418
4419
  var details = readApiDetails(handler);
4419
4420
  if (details != null) {
4420
4421
  // At the specifier level, details should be handler-level (OnCallModelFunctionApiDetails)
@@ -4454,7 +4455,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4454
4455
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4455
4456
  try {
4456
4457
  for(var _iterator = Object.entries(map)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4457
- var _step_value = _sliced_to_array$1(_step.value, 2), key = _step_value[0], handler = _step_value[1];
4458
+ var _step_value = _sliced_to_array$2(_step.value, 2), key = _step_value[0], handler = _step_value[1];
4458
4459
  var details = readApiDetails(handler);
4459
4460
  if (details != null) {
4460
4461
  if (isOnCallModelTypeApiDetails(details)) {
@@ -4503,7 +4504,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4503
4504
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4504
4505
  try {
4505
4506
  for(var _iterator = Object.entries(map)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4506
- var _step_value = _sliced_to_array$1(_step.value, 2), call = _step_value[0], handler = _step_value[1];
4507
+ var _step_value = _sliced_to_array$2(_step.value, 2), call = _step_value[0], handler = _step_value[1];
4507
4508
  var details = readApiDetails(handler);
4508
4509
  if (details != null) {
4509
4510
  result[call] = details;
@@ -4552,14 +4553,14 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4552
4553
  try {
4553
4554
  // Pivot: iterate CRUD types, then model types within each
4554
4555
  for(var _iterator = Object.entries(topDetails)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4555
- var _step_value = _sliced_to_array$1(_step.value, 2), callType = _step_value[0], crudDetails = _step_value[1];
4556
+ var _step_value = _sliced_to_array$2(_step.value, 2), callType = _step_value[0], crudDetails = _step_value[1];
4556
4557
  if (crudDetails == null) {
4557
4558
  continue;
4558
4559
  }
4559
4560
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
4560
4561
  try {
4561
4562
  for(var _iterator1 = Object.entries(crudDetails.modelTypes)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
4562
- var _step_value1 = _sliced_to_array$1(_step1.value, 2), modelType = _step_value1[0], modelDetails = _step_value1[1];
4563
+ var _step_value1 = _sliced_to_array$2(_step1.value, 2), modelType = _step_value1[0], modelDetails = _step_value1[1];
4563
4564
  if (modelDetails == null) {
4564
4565
  continue;
4565
4566
  }
@@ -5177,13 +5178,13 @@ function _object_spread_props$b(target, source) {
5177
5178
  }));
5178
5179
  }
5179
5180
 
5180
- function _array_like_to_array$5(arr, len) {
5181
+ function _array_like_to_array$6(arr, len) {
5181
5182
  if (len == null || len > arr.length) len = arr.length;
5182
5183
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5183
5184
  return arr2;
5184
5185
  }
5185
5186
  function _array_without_holes$4(arr) {
5186
- if (Array.isArray(arr)) return _array_like_to_array$5(arr);
5187
+ if (Array.isArray(arr)) return _array_like_to_array$6(arr);
5187
5188
  }
5188
5189
  function _iterable_to_array$4(iter) {
5189
5190
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
@@ -5192,15 +5193,15 @@ function _non_iterable_spread$4() {
5192
5193
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5193
5194
  }
5194
5195
  function _to_consumable_array$4(arr) {
5195
- return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$4();
5196
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$4();
5196
5197
  }
5197
- function _unsupported_iterable_to_array$5(o, minLen) {
5198
+ function _unsupported_iterable_to_array$6(o, minLen) {
5198
5199
  if (!o) return;
5199
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
5200
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
5200
5201
  var n = Object.prototype.toString.call(o).slice(8, -1);
5201
5202
  if (n === "Object" && o.constructor) n = o.constructor.name;
5202
5203
  if (n === "Map" || n === "Set") return Array.from(n);
5203
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
5204
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
5204
5205
  }
5205
5206
  /**
5206
5207
  * Generates NestJS {@link ModuleMetadata} for an app's analytics module.
@@ -5890,12 +5891,12 @@ function _object_spread_props$8(target, source) {
5890
5891
  });
5891
5892
  }
5892
5893
 
5893
- function _array_like_to_array$4(arr, len) {
5894
+ function _array_like_to_array$5(arr, len) {
5894
5895
  if (len == null || len > arr.length) len = arr.length;
5895
5896
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5896
5897
  return arr2;
5897
5898
  }
5898
- function _array_with_holes(arr) {
5899
+ function _array_with_holes$1(arr) {
5899
5900
  if (Array.isArray(arr)) return arr;
5900
5901
  }
5901
5902
  function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
@@ -5927,7 +5928,7 @@ function _async_to_generator$7(fn) {
5927
5928
  });
5928
5929
  };
5929
5930
  }
5930
- function _iterable_to_array_limit(arr, i) {
5931
+ function _iterable_to_array_limit$1(arr, i) {
5931
5932
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
5932
5933
  if (_i == null) return;
5933
5934
  var _arr = [];
@@ -5951,19 +5952,19 @@ function _iterable_to_array_limit(arr, i) {
5951
5952
  }
5952
5953
  return _arr;
5953
5954
  }
5954
- function _non_iterable_rest() {
5955
+ function _non_iterable_rest$1() {
5955
5956
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5956
5957
  }
5957
- function _sliced_to_array(arr, i) {
5958
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest();
5958
+ function _sliced_to_array$1(arr, i) {
5959
+ return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$1();
5959
5960
  }
5960
- function _unsupported_iterable_to_array$4(o, minLen) {
5961
+ function _unsupported_iterable_to_array$5(o, minLen) {
5961
5962
  if (!o) return;
5962
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
5963
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
5963
5964
  var n = Object.prototype.toString.call(o).slice(8, -1);
5964
5965
  if (n === "Object" && o.constructor) n = o.constructor.name;
5965
5966
  if (n === "Map" || n === "Set") return Array.from(n);
5966
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
5967
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
5967
5968
  }
5968
5969
  function _ts_generator$7(thisArg, body) {
5969
5970
  var f, y, t, _ = {
@@ -6094,7 +6095,7 @@ function _ts_generator$7(thisArg, body) {
6094
6095
  var result = [];
6095
6096
  forEachKeyValue(allScheduledFunctions, {
6096
6097
  forEach: function forEach(x) {
6097
- var _x = _sliced_to_array(x, 1), functionName = _x[0];
6098
+ var _x = _sliced_to_array$1(x, 1), functionName = _x[0];
6098
6099
  result.push({
6099
6100
  name: functionName.toString()
6100
6101
  });
@@ -6570,13 +6571,13 @@ DefaultFirebaseServerEnvService = __decorate([
6570
6571
  };
6571
6572
  }
6572
6573
 
6573
- function _array_like_to_array$3(arr, len) {
6574
+ function _array_like_to_array$4(arr, len) {
6574
6575
  if (len == null || len > arr.length) len = arr.length;
6575
6576
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6576
6577
  return arr2;
6577
6578
  }
6578
6579
  function _array_without_holes$3(arr) {
6579
- if (Array.isArray(arr)) return _array_like_to_array$3(arr);
6580
+ if (Array.isArray(arr)) return _array_like_to_array$4(arr);
6580
6581
  }
6581
6582
  function _class_call_check$b(instance, Constructor) {
6582
6583
  if (!(instance instanceof Constructor)) {
@@ -6590,15 +6591,15 @@ function _non_iterable_spread$3() {
6590
6591
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6591
6592
  }
6592
6593
  function _to_consumable_array$3(arr) {
6593
- return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$3();
6594
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$3();
6594
6595
  }
6595
- function _unsupported_iterable_to_array$3(o, minLen) {
6596
+ function _unsupported_iterable_to_array$4(o, minLen) {
6596
6597
  if (!o) return;
6597
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
6598
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
6598
6599
  var n = Object.prototype.toString.call(o).slice(8, -1);
6599
6600
  if (n === "Object" && o.constructor) n = o.constructor.name;
6600
6601
  if (n === "Map" || n === "Set") return Array.from(n);
6601
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
6602
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
6602
6603
  }
6603
6604
  // MARK: Tokens
6604
6605
  /**
@@ -7928,13 +7929,13 @@ FirebaseAppCheckMiddleware = __decorate([
7928
7929
  })();
7929
7930
  }
7930
7931
 
7931
- function _array_like_to_array$2(arr, len) {
7932
+ function _array_like_to_array$3(arr, len) {
7932
7933
  if (len == null || len > arr.length) len = arr.length;
7933
7934
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
7934
7935
  return arr2;
7935
7936
  }
7936
7937
  function _array_without_holes$2(arr) {
7937
- if (Array.isArray(arr)) return _array_like_to_array$2(arr);
7938
+ if (Array.isArray(arr)) return _array_like_to_array$3(arr);
7938
7939
  }
7939
7940
  function _class_call_check$7(instance, Constructor) {
7940
7941
  if (!(instance instanceof Constructor)) {
@@ -7974,15 +7975,15 @@ function _non_iterable_spread$2() {
7974
7975
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7975
7976
  }
7976
7977
  function _to_consumable_array$2(arr) {
7977
- return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$2();
7978
+ return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$2();
7978
7979
  }
7979
- function _unsupported_iterable_to_array$2(o, minLen) {
7980
+ function _unsupported_iterable_to_array$3(o, minLen) {
7980
7981
  if (!o) return;
7981
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
7982
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
7982
7983
  var n = Object.prototype.toString.call(o).slice(8, -1);
7983
7984
  if (n === "Object" && o.constructor) n = o.constructor.name;
7984
7985
  if (n === "Map" || n === "Set") return Array.from(n);
7985
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
7986
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
7986
7987
  }
7987
7988
  /**
7988
7989
  * Middleware module that configures `FirebaseAppCheckMiddleware` route coverage
@@ -9102,13 +9103,13 @@ function _define_property$4(obj, key, value) {
9102
9103
  return storage.storageClient;
9103
9104
  }
9104
9105
 
9105
- function _array_like_to_array$1(arr, len) {
9106
+ function _array_like_to_array$2(arr, len) {
9106
9107
  if (len == null || len > arr.length) len = arr.length;
9107
9108
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
9108
9109
  return arr2;
9109
9110
  }
9110
9111
  function _array_without_holes$1(arr) {
9111
- if (Array.isArray(arr)) return _array_like_to_array$1(arr);
9112
+ if (Array.isArray(arr)) return _array_like_to_array$2(arr);
9112
9113
  }
9113
9114
  function _class_call_check$3(instance, Constructor) {
9114
9115
  if (!(instance instanceof Constructor)) {
@@ -9169,15 +9170,15 @@ function _object_spread_props$1(target, source) {
9169
9170
  return target;
9170
9171
  }
9171
9172
  function _to_consumable_array$1(arr) {
9172
- return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread$1();
9173
+ return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$1();
9173
9174
  }
9174
- function _unsupported_iterable_to_array$1(o, minLen) {
9175
+ function _unsupported_iterable_to_array$2(o, minLen) {
9175
9176
  if (!o) return;
9176
- if (typeof o === "string") return _array_like_to_array$1(o, minLen);
9177
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
9177
9178
  var n = Object.prototype.toString.call(o).slice(8, -1);
9178
9179
  if (n === "Object" && o.constructor) n = o.constructor.name;
9179
9180
  if (n === "Map" || n === "Set") return Array.from(n);
9180
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
9181
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
9181
9182
  }
9182
9183
  // MARK: Tokens
9183
9184
  /**
@@ -9327,13 +9328,13 @@ FirebaseServerStorageContextModule = __decorate([
9327
9328
  }, config);
9328
9329
  }
9329
9330
 
9330
- function _array_like_to_array(arr, len) {
9331
+ function _array_like_to_array$1(arr, len) {
9331
9332
  if (len == null || len > arr.length) len = arr.length;
9332
9333
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
9333
9334
  return arr2;
9334
9335
  }
9335
9336
  function _array_without_holes(arr) {
9336
- if (Array.isArray(arr)) return _array_like_to_array(arr);
9337
+ if (Array.isArray(arr)) return _array_like_to_array$1(arr);
9337
9338
  }
9338
9339
  function _class_call_check$2(instance, Constructor) {
9339
9340
  if (!(instance instanceof Constructor)) {
@@ -9394,16 +9395,20 @@ function _object_spread_props(target, source) {
9394
9395
  return target;
9395
9396
  }
9396
9397
  function _to_consumable_array(arr) {
9397
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
9398
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread();
9398
9399
  }
9399
- function _unsupported_iterable_to_array(o, minLen) {
9400
+ function _unsupported_iterable_to_array$1(o, minLen) {
9400
9401
  if (!o) return;
9401
- if (typeof o === "string") return _array_like_to_array(o, minLen);
9402
+ if (typeof o === "string") return _array_like_to_array$1(o, minLen);
9402
9403
  var n = Object.prototype.toString.call(o).slice(8, -1);
9403
9404
  if (n === "Object" && o.constructor) n = o.constructor.name;
9404
9405
  if (n === "Map" || n === "Set") return Array.from(n);
9405
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
9406
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
9406
9407
  }
9408
+ // MARK: Assets
9409
+ /**
9410
+ * Default base path for local assets on the server filesystem.
9411
+ */ var DEFAULT_SERVER_ASSETS_BASE_PATH = './assets';
9407
9412
  // MARK: Root Module
9408
9413
  var FirebaseNestServerRootModule = function FirebaseNestServerRootModule() {
9409
9414
  _class_call_check$2(this, FirebaseNestServerRootModule);
@@ -9423,6 +9428,7 @@ var FirebaseNestServerRootModule = function FirebaseNestServerRootModule() {
9423
9428
  * @param config - Shared configuration
9424
9429
  * @returns The root module and resolved prefix config
9425
9430
  */ function buildNestServerRootModule(config) {
9431
+ var _ref, _ref1;
9426
9432
  var providers = [];
9427
9433
  var imports = _to_consumable_array(asArray(config.modules));
9428
9434
  // Firebase app token
@@ -9491,6 +9497,20 @@ var FirebaseNestServerRootModule = function FirebaseNestServerRootModule() {
9491
9497
  provide: GlobalRoutePrefixConfig,
9492
9498
  useValue: globalApiRoutePrefixConfig !== null && globalApiRoutePrefixConfig !== void 0 ? globalApiRoutePrefixConfig : {}
9493
9499
  });
9500
+ // Assets — always provide AssetLoader globally
9501
+ var assetConfig = config.assets;
9502
+ var local = (_ref = assetConfig === null || assetConfig === void 0 ? void 0 : assetConfig.local) !== null && _ref !== void 0 ? _ref : nodeJsLocalAssetLoader({
9503
+ basePath: DEFAULT_SERVER_ASSETS_BASE_PATH
9504
+ });
9505
+ var remote = (_ref1 = assetConfig === null || assetConfig === void 0 ? void 0 : assetConfig.remote) !== null && _ref1 !== void 0 ? _ref1 : fetchAssetLoader();
9506
+ var loader = delegatedAssetLoader({
9507
+ local: local,
9508
+ remote: remote
9509
+ });
9510
+ providers.push({
9511
+ provide: AssetLoader,
9512
+ useValue: loader
9513
+ });
9494
9514
  var rootModule = {
9495
9515
  module: FirebaseNestServerRootModule,
9496
9516
  imports: imports,
@@ -9671,7 +9691,8 @@ function _ts_generator$1(thisArg, body) {
9671
9691
  forceStorageBucket: config.forceStorageBucket,
9672
9692
  globalApiRoutePrefix: config.globalApiRoutePrefix,
9673
9693
  configureWebhooks: config.configureWebhooks,
9674
- appCheckEnabled: config.appCheckEnabled !== false // defaults to true in production
9694
+ appCheckEnabled: config.appCheckEnabled !== false,
9695
+ assets: config.assets
9675
9696
  }), rootModule = _buildNestServerRootModule.rootModule, globalApiRoutePrefixConfig = _buildNestServerRootModule.globalApiRoutePrefixConfig;
9676
9697
  // NOTE: https://cloud.google.com/functions/docs/writing/http#parsing_http_requests
9677
9698
  options = {
@@ -9742,6 +9763,14 @@ function _ts_generator$1(thisArg, body) {
9742
9763
  };
9743
9764
  }
9744
9765
 
9766
+ function _array_like_to_array(arr, len) {
9767
+ if (len == null || len > arr.length) len = arr.length;
9768
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
9769
+ return arr2;
9770
+ }
9771
+ function _array_with_holes(arr) {
9772
+ if (Array.isArray(arr)) return arr;
9773
+ }
9745
9774
  function _assert_this_initialized(self) {
9746
9775
  if (self === void 0) {
9747
9776
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -9831,6 +9860,33 @@ function _inherits(subClass, superClass) {
9831
9860
  });
9832
9861
  if (superClass) _set_prototype_of(subClass, superClass);
9833
9862
  }
9863
+ function _iterable_to_array_limit(arr, i) {
9864
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
9865
+ if (_i == null) return;
9866
+ var _arr = [];
9867
+ var _n = true;
9868
+ var _d = false;
9869
+ var _s, _e;
9870
+ try {
9871
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
9872
+ _arr.push(_s.value);
9873
+ if (i && _arr.length === i) break;
9874
+ }
9875
+ } catch (err) {
9876
+ _d = true;
9877
+ _e = err;
9878
+ } finally{
9879
+ try {
9880
+ if (!_n && _i["return"] != null) _i["return"]();
9881
+ } finally{
9882
+ if (_d) throw _e;
9883
+ }
9884
+ }
9885
+ return _arr;
9886
+ }
9887
+ function _non_iterable_rest() {
9888
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
9889
+ }
9834
9890
  function _possible_constructor_return(self, call) {
9835
9891
  if (call && (_type_of(call) === "object" || typeof call === "function")) {
9836
9892
  return call;
@@ -9844,10 +9900,21 @@ function _set_prototype_of(o, p) {
9844
9900
  };
9845
9901
  return _set_prototype_of(o, p);
9846
9902
  }
9903
+ function _sliced_to_array(arr, i) {
9904
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
9905
+ }
9847
9906
  function _type_of(obj) {
9848
9907
  "@swc/helpers - typeof";
9849
9908
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
9850
9909
  }
9910
+ function _unsupported_iterable_to_array(o, minLen) {
9911
+ if (!o) return;
9912
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
9913
+ var n = Object.prototype.toString.call(o).slice(8, -1);
9914
+ if (n === "Object" && o.constructor) n = o.constructor.name;
9915
+ if (n === "Map" || n === "Set") return Array.from(n);
9916
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
9917
+ }
9851
9918
  function _is_native_reflect_construct() {
9852
9919
  try {
9853
9920
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
@@ -10084,6 +10151,104 @@ function _ts_generator(thisArg, body) {
10084
10151
  });
10085
10152
  }).call(this);
10086
10153
  }
10154
+ },
10155
+ {
10156
+ key: "useMultipleModels",
10157
+ value: /**
10158
+ * Loads and checks permissions for multiple models of the same type in parallel.
10159
+ *
10160
+ * Uses {@link performAsyncTasks} internally. The `use` function receives the array of
10161
+ * successful {@link ContextGrantedModelRolesReader} values and an array of failed items.
10162
+ *
10163
+ * @param type - the model type to load
10164
+ * @param select - selection params including keys array, roles, and use function
10165
+ * @returns the result of the use function
10166
+ *
10167
+ * @example
10168
+ * ```ts
10169
+ * const result = await nest.useMultipleModels('storageFile', {
10170
+ * request,
10171
+ * keys: ['storageFile/abc', 'storageFile/def'],
10172
+ * roles: 'download',
10173
+ * throwOnFirstError: false,
10174
+ * use: (successful, failed) => ({
10175
+ * documents: successful.map((r) => r.document),
10176
+ * errors: failed
10177
+ * })
10178
+ * });
10179
+ * ```
10180
+ */ function useMultipleModels(type, select) {
10181
+ return _async_to_generator(function() {
10182
+ var _this, context, keys, use, throwOnFirstError, useOnFirstError, taskResult, successful, errors, hasErrors;
10183
+ return _ts_generator(this, function(_state) {
10184
+ switch(_state.label){
10185
+ case 0:
10186
+ _this = this;
10187
+ context = this.makeModelContext(select.request, select.buildFn);
10188
+ keys = select.keys, use = select.use, throwOnFirstError = select.throwOnFirstError, useOnFirstError = select.useOnFirstError;
10189
+ return [
10190
+ 4,
10191
+ performAsyncTasks(keys, function(key) {
10192
+ return _async_to_generator(function() {
10193
+ var usePromise;
10194
+ return _ts_generator(this, function(_state) {
10195
+ usePromise = useFirebaseModelsService(this.firebaseModelsService, type, {
10196
+ context: context,
10197
+ key: key,
10198
+ roles: select.roles,
10199
+ rolesSetIncludes: select.rolesSetIncludes
10200
+ });
10201
+ return [
10202
+ 2,
10203
+ usePromise(function(x) {
10204
+ return x;
10205
+ })
10206
+ ];
10207
+ });
10208
+ }).call(_this);
10209
+ }, {
10210
+ throwError: false
10211
+ })
10212
+ ];
10213
+ case 1:
10214
+ taskResult = _state.sent();
10215
+ successful = taskResult.results.map(function(param) {
10216
+ var _param = _sliced_to_array(param, 2), reader = _param[1];
10217
+ return reader;
10218
+ });
10219
+ errors = taskResult.errors.map(function(param) {
10220
+ var _param = _sliced_to_array(param, 2), key = _param[0], error = _param[1];
10221
+ return {
10222
+ key: key,
10223
+ error: error
10224
+ };
10225
+ });
10226
+ hasErrors = errors.length > 0;
10227
+ // throwOnFirstError (default when useOnFirstError is not set): throw the first error directly
10228
+ if (hasErrors && (throwOnFirstError !== null && throwOnFirstError !== void 0 ? throwOnFirstError : !useOnFirstError)) {
10229
+ throw errors[0].error;
10230
+ }
10231
+ // useOnFirstError: call use() with empty successes and abortedEarly: true on first error
10232
+ if (hasErrors && useOnFirstError) {
10233
+ return [
10234
+ 2,
10235
+ use([], {
10236
+ errors: errors,
10237
+ abortedEarly: true
10238
+ })
10239
+ ];
10240
+ }
10241
+ return [
10242
+ 2,
10243
+ use(successful, {
10244
+ errors: errors,
10245
+ abortedEarly: false
10246
+ })
10247
+ ];
10248
+ }
10249
+ });
10250
+ }).call(this);
10251
+ }
10087
10252
  }
10088
10253
  ]);
10089
10254
  return AbstractFirebaseNestContext;
@@ -10149,4 +10314,4 @@ function _define_property(obj, key, value) {
10149
10314
  }
10150
10315
  ();
10151
10316
 
10152
- export { ALREADY_EXISTS_ERROR_CODE, AbstractFirebaseNestContext, AbstractFirebaseServerActionsContext, AbstractFirebaseServerAuthContext, AbstractFirebaseServerAuthService, AbstractFirebaseServerAuthUserContext, AbstractFirebaseServerNewUserService, AbstractNestContext, AbstractServerFirebaseNestContext, BAD_REQUEST_ERROR_CODE, CONFLICT_ERROR_CODE, ConfigureFirebaseAppCheckMiddlewareModule, ConfigureFirebaseWebhookMiddlewareModule, DEFAULT_FIREBASE_PASSWORD_NUMBER_GENERATOR, DEFAULT_SETUP_COM_THROTTLE_TIME, DefaultFirebaseServerEnvService, FIREBASE_APP_TOKEN, FIREBASE_AUTH_TOKEN, FIREBASE_FIRESTORE_CONTEXT_TOKEN, FIREBASE_FIRESTORE_TOKEN, FIREBASE_SERVER_ENV_TOKEN, FIREBASE_SERVER_VALIDATION_ERROR_CODE, FIREBASE_STORAGE_CONTEXT_FACTORY_CONFIG_TOKEN, FIREBASE_STORAGE_CONTEXT_TOKEN, FIREBASE_STORAGE_TOKEN, FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING, FORBIDDEN_ERROR_CODE, FirebaseAppCheckMiddleware, FirebaseAppCheckMiddlewareConfig, FirebaseNestServerRootModule, FirebaseRawBodyMiddleware, FirebaseServerAnalyticsSegmentListenerService, FirebaseServerAnalyticsSegmentModule, FirebaseServerAnalyticsService, FirebaseServerAnalyticsServiceListener, FirebaseServerAuthModule, FirebaseServerAuthNewUserSendSetupDetailsNoSetupConfigError, FirebaseServerAuthNewUserSendSetupDetailsSendOnceError, FirebaseServerAuthNewUserSendSetupDetailsThrottleError, FirebaseServerAuthService, FirebaseServerAuthUserBadInputError, FirebaseServerAuthUserExistsError, FirebaseServerEnvService, FirebaseServerFirestoreContextModule, FirebaseServerFirestoreModule, FirebaseServerStorageContextModule, FirebaseServerStorageModule, FirebaseServerStorageService, GlobalRoutePrefixConfig, INTERNAL_SERVER_ERROR_CODE, MODEL_NOT_AVAILABLE_ERROR_CODE, NOT_FOUND_ERROR_CODE, NO_RUN_NAME_SPECIFIED_FOR_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_CODE, NoSetupContentFirebaseServerNewUserService, ON_CALL_MODEL_ANALYTICS_HANDLER, ON_CALL_MODEL_ANALYTICS_SERVICE, OnCallModelAnalyticsService, PERMISSION_DENIED_ERROR_CODE, PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE, SkipAppCheck, UNAUTHENTICATED_ERROR_CODE, UNAVAILABLE_ERROR_CODE, UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE, UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_NAME_CODE, UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_TYPE_CODE, _onCallWithCallTypeFunction, aggregateCrudModelApiDetails, aggregateModelApiDetails, aggregateSpecifierApiDetails, alreadyExistsError, appAnalyticsModuleMetadata, appFirestoreModuleMetadata, assertContextHasAuth, assertDocumentExists, assertHasRolesInRequest, assertHasSignedTosInRequest, assertIsAdminInRequest, assertIsAdminOrTargetUserInRequestData, assertIsContextWithAuthData, assertRequestRequiresAuthForFunction, assertSnapshotData, assertSnapshotDataWithKey, badRequestError, blockingFunctionHandlerWithNestContextFactory, buildNestServerRootModule, callWithAnalytics, cloudEventHandlerWithNestContextFactory, collectionRefForPath, createModelUnknownModelTypeError, defaultFirebaseServerActionsTransformFactoryLogErrorFunction, defaultProvideFirebaseServerStorageServiceSimple, deleteModelUnknownModelTypeError, developmentUnknownSpecifierError, docRefForPath, documentModelNotAvailableError, firebaseAuthTokenFromDecodedIdToken, firebaseServerActionsContext, firebaseServerActionsTransformContext, firebaseServerActionsTransformFactory, firebaseServerAppTokenProvider, firebaseServerAuthModuleMetadata, firebaseServerDevFunctions, firebaseServerEnvTokenProvider, firebaseServerEnvTokenProviders, firebaseServerErrorInfo, firebaseServerErrorInfoCodePair, firebaseServerErrorInfoServerErrorCodePair, firebaseServerErrorInfoServerErrorPair, firebaseServerFirestoreContextModuleMetadata, firebaseServerStorageDefaultBucketIdTokenProvider, firebaseServerStorageModuleMetadata, firebaseServerValidationError, firebaseServerValidationServerError, firestoreClientQueryConstraintFunctionsDriver, firestoreEncryptedField, firestoreServerIncrementUpdateToUpdateData, forbiddenError, getAuthUserOrUndefined, getModelApiDetails, googleCloudFileMetadataToStorageMetadata, googleCloudFirebaseStorageContextFactory, googleCloudFirebaseStorageDrivers, googleCloudFirestoreAccessorDriver, googleCloudFirestoreContextFactory, googleCloudFirestoreDrivers, googleCloudFirestoreQueryDriver, googleCloudStorageAccessorFile, googleCloudStorageAccessorFolder, googleCloudStorageBucketForStorageFilePath, googleCloudStorageFileForStorageFilePath, googleCloudStorageFirebaseStorageAccessorDriver, googleCloudStorageFromFirebaseAdminStorage, googleCloudStorageListFilesResultFactory, handleFirebaseAuthError, handleFirebaseError, hasAuthRolesInRequest, hasNewUserSetupPasswordInRequest, hasSignedTosInRequest, inAuthContext, injectNestApplicationContextIntoRequest, injectNestIntoRequest, internalServerError, isActualSpecifier, isAdminInRequest, isAdminOrTargetUserInRequestData, isContextWithAuthData, isFirebaseError, isFirebaseHttpsError, isOnCallCrudModelApiDetails, isOnCallHandlerApiDetails, isOnCallModelTypeApiDetails, isOnCallSpecifierApiDetails, makeBlockingFunctionWithHandler, makeOnScheduleHandlerWithNestApplicationRequest, makeScheduledFunctionDevelopmentFunction, modelNotAvailableError, nestAppHasDevelopmentSchedulerEnabled, nestAppIsProductionEnvironment, nestFirebaseDoesNotExistError, nestFirebaseForbiddenPermissionError, nestServerInstance, noRunNameSpecifiedForScheduledFunctionDevelopmentFunction, noopFirebaseServerAnalyticsServiceListener, noopOnCallModelAnalyticsService, notFoundError, onCallAnalyticsEmitterInstance, onCallCreateModel, onCallDeleteModel, onCallDevelopmentFunction, onCallHandlerWithNestApplicationFactory, onCallHandlerWithNestContextFactory, onCallModel, onCallModelMissingCallTypeError, onCallModelUnknownCallTypeError, onCallReadModel, onCallSpecifierHandler, onCallUpdateModel, onScheduleHandlerWithNestApplicationFactory, onScheduleHandlerWithNestContextFactory, optionalAuthContext, optionalFirestoreEncryptedField, permissionDeniedError, phoneNumberAlreadyExistsError, preconditionConflictError, provideAppFirestoreCollections, provideFirebaseServerAuthService, provideFirebaseServerStorageService, readApiDetails, readModelUnknownModelTypeError, resolveAnalyticsFromApiDetails, setNestContextOnRequest, setNestContextOnScheduleRequest, taskQueueFunctionHandlerWithNestContextFactory, unauthenticatedContextHasNoAuthData, unauthenticatedContextHasNoUidError, unauthenticatedError, unavailableError, unavailableOrDeactivatedFunctionError, unknownModelCrudFunctionSpecifierError, unknownScheduledFunctionDevelopmentFunctionName, unknownScheduledFunctionDevelopmentFunctionType, updateModelUnknownModelTypeError, userContextFromUid, verifyAppCheckInRequest, withApiDetails };
10317
+ export { ALREADY_EXISTS_ERROR_CODE, AbstractFirebaseNestContext, AbstractFirebaseServerActionsContext, AbstractFirebaseServerAuthContext, AbstractFirebaseServerAuthService, AbstractFirebaseServerAuthUserContext, AbstractFirebaseServerNewUserService, AbstractNestContext, AbstractServerFirebaseNestContext, BAD_REQUEST_ERROR_CODE, CONFLICT_ERROR_CODE, ConfigureFirebaseAppCheckMiddlewareModule, ConfigureFirebaseWebhookMiddlewareModule, DEFAULT_FIREBASE_PASSWORD_NUMBER_GENERATOR, DEFAULT_SERVER_ASSETS_BASE_PATH, DEFAULT_SETUP_COM_THROTTLE_TIME, DefaultFirebaseServerEnvService, FIREBASE_APP_TOKEN, FIREBASE_AUTH_TOKEN, FIREBASE_FIRESTORE_CONTEXT_TOKEN, FIREBASE_FIRESTORE_TOKEN, FIREBASE_SERVER_ENV_TOKEN, FIREBASE_SERVER_VALIDATION_ERROR_CODE, FIREBASE_STORAGE_CONTEXT_FACTORY_CONFIG_TOKEN, FIREBASE_STORAGE_CONTEXT_TOKEN, FIREBASE_STORAGE_TOKEN, FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING, FORBIDDEN_ERROR_CODE, FirebaseAppCheckMiddleware, FirebaseAppCheckMiddlewareConfig, FirebaseNestServerRootModule, FirebaseRawBodyMiddleware, FirebaseServerAnalyticsSegmentListenerService, FirebaseServerAnalyticsSegmentModule, FirebaseServerAnalyticsService, FirebaseServerAnalyticsServiceListener, FirebaseServerAuthModule, FirebaseServerAuthNewUserSendSetupDetailsNoSetupConfigError, FirebaseServerAuthNewUserSendSetupDetailsSendOnceError, FirebaseServerAuthNewUserSendSetupDetailsThrottleError, FirebaseServerAuthService, FirebaseServerAuthUserBadInputError, FirebaseServerAuthUserExistsError, FirebaseServerEnvService, FirebaseServerFirestoreContextModule, FirebaseServerFirestoreModule, FirebaseServerStorageContextModule, FirebaseServerStorageModule, FirebaseServerStorageService, GlobalRoutePrefixConfig, INTERNAL_SERVER_ERROR_CODE, MODEL_NOT_AVAILABLE_ERROR_CODE, NOT_FOUND_ERROR_CODE, NO_RUN_NAME_SPECIFIED_FOR_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_CODE, NoSetupContentFirebaseServerNewUserService, ON_CALL_MODEL_ANALYTICS_HANDLER, ON_CALL_MODEL_ANALYTICS_SERVICE, OnCallModelAnalyticsService, PERMISSION_DENIED_ERROR_CODE, PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE, SkipAppCheck, UNAUTHENTICATED_ERROR_CODE, UNAVAILABLE_ERROR_CODE, UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE, UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_NAME_CODE, UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_TYPE_CODE, _onCallWithCallTypeFunction, aggregateCrudModelApiDetails, aggregateModelApiDetails, aggregateSpecifierApiDetails, alreadyExistsError, appAnalyticsModuleMetadata, appFirestoreModuleMetadata, assertContextHasAuth, assertDocumentExists, assertHasRolesInRequest, assertHasSignedTosInRequest, assertIsAdminInRequest, assertIsAdminOrTargetUserInRequestData, assertIsContextWithAuthData, assertRequestRequiresAuthForFunction, assertSnapshotData, assertSnapshotDataWithKey, badRequestError, blockingFunctionHandlerWithNestContextFactory, buildNestServerRootModule, callWithAnalytics, cloudEventHandlerWithNestContextFactory, collectionRefForPath, createModelUnknownModelTypeError, defaultFirebaseServerActionsTransformFactoryLogErrorFunction, defaultProvideFirebaseServerStorageServiceSimple, deleteModelUnknownModelTypeError, developmentUnknownSpecifierError, docRefForPath, documentModelNotAvailableError, firebaseAuthTokenFromDecodedIdToken, firebaseServerActionsContext, firebaseServerActionsTransformContext, firebaseServerActionsTransformFactory, firebaseServerAppTokenProvider, firebaseServerAuthModuleMetadata, firebaseServerDevFunctions, firebaseServerEnvTokenProvider, firebaseServerEnvTokenProviders, firebaseServerErrorInfo, firebaseServerErrorInfoCodePair, firebaseServerErrorInfoServerErrorCodePair, firebaseServerErrorInfoServerErrorPair, firebaseServerFirestoreContextModuleMetadata, firebaseServerStorageDefaultBucketIdTokenProvider, firebaseServerStorageModuleMetadata, firebaseServerValidationError, firebaseServerValidationServerError, firestoreClientQueryConstraintFunctionsDriver, firestoreEncryptedField, firestoreServerIncrementUpdateToUpdateData, forbiddenError, getAuthUserOrUndefined, getModelApiDetails, googleCloudFileMetadataToStorageMetadata, googleCloudFirebaseStorageContextFactory, googleCloudFirebaseStorageDrivers, googleCloudFirestoreAccessorDriver, googleCloudFirestoreContextFactory, googleCloudFirestoreDrivers, googleCloudFirestoreQueryDriver, googleCloudStorageAccessorFile, googleCloudStorageAccessorFolder, googleCloudStorageBucketForStorageFilePath, googleCloudStorageFileForStorageFilePath, googleCloudStorageFirebaseStorageAccessorDriver, googleCloudStorageFromFirebaseAdminStorage, googleCloudStorageListFilesResultFactory, handleFirebaseAuthError, handleFirebaseError, hasAuthRolesInRequest, hasNewUserSetupPasswordInRequest, hasSignedTosInRequest, inAuthContext, injectNestApplicationContextIntoRequest, injectNestIntoRequest, internalServerError, isActualSpecifier, isAdminInRequest, isAdminOrTargetUserInRequestData, isContextWithAuthData, isFirebaseError, isFirebaseHttpsError, isOnCallCrudModelApiDetails, isOnCallHandlerApiDetails, isOnCallModelTypeApiDetails, isOnCallSpecifierApiDetails, makeBlockingFunctionWithHandler, makeOnScheduleHandlerWithNestApplicationRequest, makeScheduledFunctionDevelopmentFunction, modelNotAvailableError, nestAppHasDevelopmentSchedulerEnabled, nestAppIsProductionEnvironment, nestFirebaseDoesNotExistError, nestFirebaseForbiddenPermissionError, nestServerInstance, noRunNameSpecifiedForScheduledFunctionDevelopmentFunction, noopFirebaseServerAnalyticsServiceListener, noopOnCallModelAnalyticsService, notFoundError, onCallAnalyticsEmitterInstance, onCallCreateModel, onCallDeleteModel, onCallDevelopmentFunction, onCallHandlerWithNestApplicationFactory, onCallHandlerWithNestContextFactory, onCallModel, onCallModelMissingCallTypeError, onCallModelUnknownCallTypeError, onCallReadModel, onCallSpecifierHandler, onCallUpdateModel, onScheduleHandlerWithNestApplicationFactory, onScheduleHandlerWithNestContextFactory, optionalAuthContext, optionalFirestoreEncryptedField, permissionDeniedError, phoneNumberAlreadyExistsError, preconditionConflictError, provideAppFirestoreCollections, provideFirebaseServerAuthService, provideFirebaseServerStorageService, readApiDetails, readModelUnknownModelTypeError, resolveAnalyticsFromApiDetails, setNestContextOnRequest, setNestContextOnScheduleRequest, taskQueueFunctionHandlerWithNestContextFactory, unauthenticatedContextHasNoAuthData, unauthenticatedContextHasNoUidError, unauthenticatedError, unavailableError, unavailableOrDeactivatedFunctionError, unknownModelCrudFunctionSpecifierError, unknownScheduledFunctionDevelopmentFunctionName, unknownScheduledFunctionDevelopmentFunctionType, updateModelUnknownModelTypeError, userContextFromUid, verifyAppCheckInRequest, withApiDetails };