@dereekb/firebase-server 13.11.17 → 13.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/index.cjs.js +218 -31
  2. package/index.esm.js +217 -34
  3. package/mailgun/package.json +9 -9
  4. package/mcp/index.cjs.default.js +1 -0
  5. package/mcp/index.cjs.js +3646 -0
  6. package/mcp/index.cjs.mjs +2 -0
  7. package/mcp/index.d.ts +1 -0
  8. package/mcp/index.esm.js +3609 -0
  9. package/mcp/package.json +33 -0
  10. package/mcp/src/index.d.ts +1 -0
  11. package/mcp/src/lib/controller/index.d.ts +2 -0
  12. package/mcp/src/lib/controller/mcp.controller.d.ts +19 -0
  13. package/mcp/src/lib/controller/mcp.wellknown.controller.d.ts +25 -0
  14. package/mcp/src/lib/index.d.ts +5 -0
  15. package/mcp/src/lib/mcp.config.d.ts +100 -0
  16. package/mcp/src/lib/mcp.module.d.ts +49 -0
  17. package/mcp/src/lib/service/index.d.ts +8 -0
  18. package/mcp/src/lib/service/mcp.manifest.d.ts +150 -0
  19. package/mcp/src/lib/service/mcp.response-formatter.d.ts +36 -0
  20. package/mcp/src/lib/service/mcp.server.factory.d.ts +124 -0
  21. package/mcp/src/lib/service/mcp.tool-generator.d.ts +235 -0
  22. package/mcp/src/lib/service/mcp.visibility.d.ts +99 -0
  23. package/mcp/src/lib/service/tools/mcp.tool.model-decode.d.ts +87 -0
  24. package/mcp/src/lib/service/tools/mcp.tool.model-get.d.ts +81 -0
  25. package/mcp/src/lib/service/tools/mcp.tool.model-info.d.ts +84 -0
  26. package/mcp/src/lib/service/tools/mcp.tool.whoami.d.ts +72 -0
  27. package/mcp/src/lib/transport/index.d.ts +1 -0
  28. package/mcp/src/lib/transport/streamable-http.transport.d.ts +21 -0
  29. package/model/index.cjs.js +639 -266
  30. package/model/index.esm.js +640 -270
  31. package/model/package.json +9 -9
  32. package/model/src/lib/storagefile/extension/compress.pdf.d.ts +29 -1
  33. package/model/src/lib/storagefile/index.d.ts +1 -0
  34. package/model/src/lib/storagefile/storagefile.action.server.d.ts +29 -2
  35. package/model/src/lib/storagefile/storagefile.mcp.d.ts +32 -0
  36. package/model/src/lib/storagefile/storagefile.module.d.ts +20 -3
  37. package/oidc/index.cjs.js +322 -147
  38. package/oidc/index.esm.js +321 -148
  39. package/oidc/package.json +10 -10
  40. package/oidc/src/lib/controller/oidc.wellknown.controller.d.ts +6 -15
  41. package/oidc/src/lib/middleware/oauth-auth.middleware.d.ts +22 -2
  42. package/oidc/src/lib/middleware/oauth-auth.module.d.ts +57 -0
  43. package/oidc/src/lib/oidc.config.d.ts +73 -0
  44. package/oidc/src/lib/oidc.module.d.ts +44 -2
  45. package/package.json +16 -10
  46. package/src/lib/auth/auth.service.d.ts +16 -1
  47. package/src/lib/auth/auth.service.error.util.d.ts +24 -5
  48. package/src/lib/env/env.config.d.ts +16 -0
  49. package/src/lib/env/env.service.d.ts +9 -0
  50. package/src/lib/nest/controller/model/model.api.get.service.d.ts +35 -1
  51. package/src/lib/nest/env/env.service.d.ts +1 -0
  52. package/src/lib/nest/model/api.details.d.ts +116 -5
  53. package/src/lib/nest/model/crud.assert.function.d.ts +1 -1
  54. package/src/lib/nest/model/index.d.ts +1 -0
  55. package/src/lib/nest/model/invoke.model.function.d.ts +89 -0
  56. package/test/package.json +11 -11
  57. package/twilio/LICENSE +21 -0
  58. package/twilio/index.cjs.default.js +1 -0
  59. package/twilio/index.cjs.js +404 -0
  60. package/twilio/index.cjs.mjs +2 -0
  61. package/twilio/index.d.ts +1 -0
  62. package/twilio/index.esm.js +398 -0
  63. package/twilio/package.json +25 -0
  64. package/twilio/src/index.d.ts +1 -0
  65. package/twilio/src/lib/index.d.ts +1 -0
  66. package/twilio/src/lib/notification.send.service.twilio.d.ts +148 -0
  67. package/zoho/package.json +9 -9
@@ -12,7 +12,7 @@ var sharp = require('sharp');
12
12
  var pdfLib = require('@cantoo/pdf-lib');
13
13
  var archiver = require('archiver');
14
14
 
15
- function _array_like_to_array$9(arr, len) {
15
+ function _array_like_to_array$a(arr, len) {
16
16
  if (len == null || len > arr.length) len = arr.length;
17
17
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
18
18
  return arr2;
@@ -77,15 +77,15 @@ function _non_iterable_rest$4() {
77
77
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
78
78
  }
79
79
  function _sliced_to_array$4(arr, i) {
80
- return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$9(arr, i) || _non_iterable_rest$4();
80
+ return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$4();
81
81
  }
82
- function _unsupported_iterable_to_array$9(o, minLen) {
82
+ function _unsupported_iterable_to_array$a(o, minLen) {
83
83
  if (!o) return;
84
- if (typeof o === "string") return _array_like_to_array$9(o, minLen);
84
+ if (typeof o === "string") return _array_like_to_array$a(o, minLen);
85
85
  var n = Object.prototype.toString.call(o).slice(8, -1);
86
86
  if (n === "Object" && o.constructor) n = o.constructor.name;
87
87
  if (n === "Map" || n === "Set") return Array.from(n);
88
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
88
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
89
89
  }
90
90
  function _ts_generator$h(thisArg, body) {
91
91
  var f, y, t, _ = {
@@ -466,13 +466,13 @@ var DEFAULT_MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_MAX_BATCH_SIZE_PER_REQUEST =
466
466
  });
467
467
  }
468
468
 
469
- function _array_like_to_array$8(arr, len) {
469
+ function _array_like_to_array$9(arr, len) {
470
470
  if (len == null || len > arr.length) len = arr.length;
471
471
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
472
472
  return arr2;
473
473
  }
474
- function _array_without_holes$6(arr) {
475
- if (Array.isArray(arr)) return _array_like_to_array$8(arr);
474
+ function _array_without_holes$7(arr) {
475
+ if (Array.isArray(arr)) return _array_like_to_array$9(arr);
476
476
  }
477
477
  function asyncGeneratorStep$g(gen, resolve, reject, _next, _throw, key, arg) {
478
478
  try {
@@ -503,7 +503,7 @@ function _async_to_generator$g(fn) {
503
503
  });
504
504
  };
505
505
  }
506
- function _define_property$d(obj, key, value) {
506
+ function _define_property$e(obj, key, value) {
507
507
  if (key in obj) {
508
508
  Object.defineProperty(obj, key, {
509
509
  value: value,
@@ -516,13 +516,13 @@ function _define_property$d(obj, key, value) {
516
516
  }
517
517
  return obj;
518
518
  }
519
- function _iterable_to_array$6(iter) {
519
+ function _iterable_to_array$7(iter) {
520
520
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
521
521
  }
522
- function _non_iterable_spread$6() {
522
+ function _non_iterable_spread$7() {
523
523
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
524
524
  }
525
- function _object_spread$c(target) {
525
+ function _object_spread$d(target) {
526
526
  for(var i = 1; i < arguments.length; i++){
527
527
  var source = arguments[i] != null ? arguments[i] : {};
528
528
  var ownKeys = Object.keys(source);
@@ -532,12 +532,12 @@ function _object_spread$c(target) {
532
532
  }));
533
533
  }
534
534
  ownKeys.forEach(function(key) {
535
- _define_property$d(target, key, source[key]);
535
+ _define_property$e(target, key, source[key]);
536
536
  });
537
537
  }
538
538
  return target;
539
539
  }
540
- function ownKeys$b(object, enumerableOnly) {
540
+ function ownKeys$c(object, enumerableOnly) {
541
541
  var keys = Object.keys(object);
542
542
  if (Object.getOwnPropertySymbols) {
543
543
  var symbols = Object.getOwnPropertySymbols(object);
@@ -545,27 +545,27 @@ function ownKeys$b(object, enumerableOnly) {
545
545
  }
546
546
  return keys;
547
547
  }
548
- function _object_spread_props$b(target, source) {
548
+ function _object_spread_props$c(target, source) {
549
549
  source = source != null ? source : {};
550
550
  if (Object.getOwnPropertyDescriptors) {
551
551
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
552
552
  } else {
553
- ownKeys$b(Object(source)).forEach(function(key) {
553
+ ownKeys$c(Object(source)).forEach(function(key) {
554
554
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
555
555
  });
556
556
  }
557
557
  return target;
558
558
  }
559
- function _to_consumable_array$6(arr) {
560
- return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$6();
559
+ function _to_consumable_array$7(arr) {
560
+ return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$7();
561
561
  }
562
- function _unsupported_iterable_to_array$8(o, minLen) {
562
+ function _unsupported_iterable_to_array$9(o, minLen) {
563
563
  if (!o) return;
564
- if (typeof o === "string") return _array_like_to_array$8(o, minLen);
564
+ if (typeof o === "string") return _array_like_to_array$9(o, minLen);
565
565
  var n = Object.prototype.toString.call(o).slice(8, -1);
566
566
  if (n === "Object" && o.constructor) n = o.constructor.name;
567
567
  if (n === "Map" || n === "Set") return Array.from(n);
568
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
568
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
569
569
  }
570
570
  function _ts_generator$g(thisArg, body) {
571
571
  var f, y, t, _ = {
@@ -730,12 +730,12 @@ function _ts_generator$g(thisArg, body) {
730
730
  initialExplicitRecipients = canSendToExplicitRecipients ? notification.r : [];
731
731
  initialGlobalRecipients = canSendToGlobalRecipients && inputGlobalRecipients ? inputGlobalRecipients : [];
732
732
  explicitRecipients = initialExplicitRecipients.map(function(x) {
733
- return _object_spread$c({}, x, firebase.effectiveNotificationBoxRecipientTemplateConfig(x));
733
+ return _object_spread$d({}, x, firebase.effectiveNotificationBoxRecipientTemplateConfig(x));
734
734
  });
735
735
  globalRecipients = initialGlobalRecipients.map(function(x) {
736
- return _object_spread$c({}, x, firebase.effectiveNotificationBoxRecipientTemplateConfig(x));
736
+ return _object_spread$d({}, x, firebase.effectiveNotificationBoxRecipientTemplateConfig(x));
737
737
  });
738
- explicitAndGlobalRecipients = _to_consumable_array$6(explicitRecipients).concat(_to_consumable_array$6(globalRecipients));
738
+ explicitAndGlobalRecipients = _to_consumable_array$7(explicitRecipients).concat(_to_consumable_array$7(globalRecipients));
739
739
  allBoxRecipientConfigs = canSendToBoxRecipients && notificationBox ? notificationBox.r : [];
740
740
  recipientUids = new Set();
741
741
  relevantBoxRecipientConfigs = [];
@@ -817,7 +817,7 @@ function _ts_generator$g(thisArg, body) {
817
817
  var userTemplateTypeConfig = (_notificationUserRecipientConfig_c_notificationTemplateType = notificationUserRecipientConfig.c[notificationTemplateType]) !== null && _notificationUserRecipientConfig_c_notificationTemplateType !== void 0 ? _notificationUserRecipientConfig_c_notificationTemplateType : {};
818
818
  var templateConfig = firebase.mergeNotificationBoxRecipientTemplateConfigs(firebase.effectiveNotificationBoxRecipientTemplateConfig(userTemplateTypeConfig), x);
819
819
  // replace the input NotificationRecipientWithConfig with the user's config
820
- x = _object_spread_props$b(_object_spread$c({}, notificationUserRecipientConfig, firebase.effectiveNotificationBoxRecipientTemplateConfig(templateConfig)), {
820
+ x = _object_spread_props$c(_object_spread$d({}, notificationUserRecipientConfig, firebase.effectiveNotificationBoxRecipientTemplateConfig(templateConfig)), {
821
821
  uid: uid
822
822
  });
823
823
  }
@@ -836,7 +836,7 @@ function _ts_generator$g(thisArg, body) {
836
836
  });
837
837
  return [
838
838
  4,
839
- Promise.all(_to_consumable_array$6(recipientUids).map(function(uid) {
839
+ Promise.all(_to_consumable_array$7(recipientUids).map(function(uid) {
840
840
  return authService.userContext(uid).loadDetails().then(function(details) {
841
841
  return [
842
842
  uid,
@@ -1121,8 +1121,8 @@ function _ts_generator$g(thisArg, body) {
1121
1121
  // flag as removed in the NotificationUser details if not already flagged as such
1122
1122
  if (currentNotificationUserBoxIndexExists && currentNotificationUserBoxConfig.rm !== true) {
1123
1123
  var _currentNotificationUserBoxConfig_c;
1124
- updatedBc = _to_consumable_array$6(notificationUser.bc);
1125
- updatedBc[currentNotificationUserBoxIndex] = _object_spread_props$b(_object_spread$c({}, currentNotificationUserBoxConfig), {
1124
+ updatedBc = _to_consumable_array$7(notificationUser.bc);
1125
+ updatedBc[currentNotificationUserBoxIndex] = _object_spread_props$c(_object_spread$d({}, currentNotificationUserBoxConfig), {
1126
1126
  nb: notificationBoxId,
1127
1127
  c: (_currentNotificationUserBoxConfig_c = currentNotificationUserBoxConfig.c) !== null && _currentNotificationUserBoxConfig_c !== void 0 ? _currentNotificationUserBoxConfig_c : {},
1128
1128
  i: util.UNSET_INDEX_NUMBER,
@@ -1161,13 +1161,13 @@ function _ts_generator$g(thisArg, body) {
1161
1161
  updateWithNotificationBoxRecipient = notificationBoxRecipient;
1162
1162
  }
1163
1163
  }
1164
- var updatedNotificationUserBoxEntry = firebase.mergeNotificationUserNotificationBoxRecipientConfigs(_object_spread_props$b(_object_spread$c({}, currentNotificationUserBoxConfig), {
1164
+ var updatedNotificationUserBoxEntry = firebase.mergeNotificationUserNotificationBoxRecipientConfigs(_object_spread_props$c(_object_spread$d({}, currentNotificationUserBoxConfig), {
1165
1165
  i: notificationBoxRecipient.i,
1166
1166
  c: (_currentNotificationUserBoxConfig_c1 = currentNotificationUserBoxConfig.c) !== null && _currentNotificationUserBoxConfig_c1 !== void 0 ? _currentNotificationUserBoxConfig_c1 : {},
1167
1167
  nb: notificationBoxId,
1168
1168
  rm: false // remove/clear the removed flag
1169
1169
  }), updateWithNotificationBoxRecipient);
1170
- updatedBc = _to_consumable_array$6(notificationUser.bc);
1170
+ updatedBc = _to_consumable_array$7(notificationUser.bc);
1171
1171
  if (currentNotificationUserBoxIndexExists) {
1172
1172
  updatedBc[currentNotificationUserBoxIndex] = updatedNotificationUserBoxEntry;
1173
1173
  } else {
@@ -1225,7 +1225,7 @@ function _ts_generator$g(thisArg, body) {
1225
1225
  return result;
1226
1226
  }
1227
1227
 
1228
- function _array_like_to_array$7(arr, len) {
1228
+ function _array_like_to_array$8(arr, len) {
1229
1229
  if (len == null || len > arr.length) len = arr.length;
1230
1230
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1231
1231
  return arr2;
@@ -1233,8 +1233,8 @@ function _array_like_to_array$7(arr, len) {
1233
1233
  function _array_with_holes$3(arr) {
1234
1234
  if (Array.isArray(arr)) return arr;
1235
1235
  }
1236
- function _array_without_holes$5(arr) {
1237
- if (Array.isArray(arr)) return _array_like_to_array$7(arr);
1236
+ function _array_without_holes$6(arr) {
1237
+ if (Array.isArray(arr)) return _array_like_to_array$8(arr);
1238
1238
  }
1239
1239
  function asyncGeneratorStep$f(gen, resolve, reject, _next, _throw, key, arg) {
1240
1240
  try {
@@ -1270,7 +1270,7 @@ function _class_call_check$a(instance, Constructor) {
1270
1270
  throw new TypeError("Cannot call a class as a function");
1271
1271
  }
1272
1272
  }
1273
- function _define_property$c(obj, key, value) {
1273
+ function _define_property$d(obj, key, value) {
1274
1274
  if (key in obj) {
1275
1275
  Object.defineProperty(obj, key, {
1276
1276
  value: value,
@@ -1283,7 +1283,7 @@ function _define_property$c(obj, key, value) {
1283
1283
  }
1284
1284
  return obj;
1285
1285
  }
1286
- function _iterable_to_array$5(iter) {
1286
+ function _iterable_to_array$6(iter) {
1287
1287
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1288
1288
  }
1289
1289
  function _iterable_to_array_limit$3(arr, i) {
@@ -1313,10 +1313,10 @@ function _iterable_to_array_limit$3(arr, i) {
1313
1313
  function _non_iterable_rest$3() {
1314
1314
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1315
1315
  }
1316
- function _non_iterable_spread$5() {
1316
+ function _non_iterable_spread$6() {
1317
1317
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1318
1318
  }
1319
- function _object_spread$b(target) {
1319
+ function _object_spread$c(target) {
1320
1320
  for(var i = 1; i < arguments.length; i++){
1321
1321
  var source = arguments[i] != null ? arguments[i] : {};
1322
1322
  var ownKeys = Object.keys(source);
@@ -1326,12 +1326,12 @@ function _object_spread$b(target) {
1326
1326
  }));
1327
1327
  }
1328
1328
  ownKeys.forEach(function(key) {
1329
- _define_property$c(target, key, source[key]);
1329
+ _define_property$d(target, key, source[key]);
1330
1330
  });
1331
1331
  }
1332
1332
  return target;
1333
1333
  }
1334
- function ownKeys$a(object, enumerableOnly) {
1334
+ function ownKeys$b(object, enumerableOnly) {
1335
1335
  var keys = Object.keys(object);
1336
1336
  if (Object.getOwnPropertySymbols) {
1337
1337
  var symbols = Object.getOwnPropertySymbols(object);
@@ -1339,30 +1339,30 @@ function ownKeys$a(object, enumerableOnly) {
1339
1339
  }
1340
1340
  return keys;
1341
1341
  }
1342
- function _object_spread_props$a(target, source) {
1342
+ function _object_spread_props$b(target, source) {
1343
1343
  source = source != null ? source : {};
1344
1344
  if (Object.getOwnPropertyDescriptors) {
1345
1345
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1346
1346
  } else {
1347
- ownKeys$a(Object(source)).forEach(function(key) {
1347
+ ownKeys$b(Object(source)).forEach(function(key) {
1348
1348
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1349
1349
  });
1350
1350
  }
1351
1351
  return target;
1352
1352
  }
1353
1353
  function _sliced_to_array$3(arr, i) {
1354
- return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$3();
1354
+ return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$8(arr, i) || _non_iterable_rest$3();
1355
1355
  }
1356
- function _to_consumable_array$5(arr) {
1357
- return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$5();
1356
+ function _to_consumable_array$6(arr) {
1357
+ return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$6();
1358
1358
  }
1359
- function _unsupported_iterable_to_array$7(o, minLen) {
1359
+ function _unsupported_iterable_to_array$8(o, minLen) {
1360
1360
  if (!o) return;
1361
- if (typeof o === "string") return _array_like_to_array$7(o, minLen);
1361
+ if (typeof o === "string") return _array_like_to_array$8(o, minLen);
1362
1362
  var n = Object.prototype.toString.call(o).slice(8, -1);
1363
1363
  if (n === "Object" && o.constructor) n = o.constructor.name;
1364
1364
  if (n === "Map" || n === "Set") return Array.from(n);
1365
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
1365
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
1366
1366
  }
1367
1367
  function _ts_generator$f(thisArg, body) {
1368
1368
  var f, y, t, _ = {
@@ -1653,7 +1653,7 @@ function _ts_generator$f(thisArg, body) {
1653
1653
  });
1654
1654
  var effectiveConfigChanged = !util.areEqualPOJOValues(currentEffectiveRecipient, nextEffectiveRecipient);
1655
1655
  if (effectiveConfigChanged) {
1656
- updatedConfig = _object_spread_props$a(_object_spread$b({}, currentConfig), {
1656
+ updatedConfig = _object_spread_props$b(_object_spread$c({}, currentConfig), {
1657
1657
  ns: true
1658
1658
  });
1659
1659
  }
@@ -1832,7 +1832,7 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1832
1832
  recipientHasChange = !util.areEqualPOJOValues(nextRecipient, recipient);
1833
1833
  // only update recipients if the next/new recipient is not equal to the existing one
1834
1834
  if (recipientHasChange) {
1835
- r = _to_consumable_array$5(notificationBox.r);
1835
+ r = _to_consumable_array$6(notificationBox.r);
1836
1836
  r[recipientIndex] = nextRecipient;
1837
1837
  nextRecipientsMap.set(nb, nextRecipient);
1838
1838
  } else {
@@ -1876,7 +1876,7 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1876
1876
  var existingConfig = notificationBoxConfigsToSyncInThisBatchMap.get(nb);
1877
1877
  if (notificationUserNotificationBoxConfigsToMarkAsRemoved.has(nb) || existingConfig.rm) {
1878
1878
  // if the recipient was being removed or is marked as removed, then update the config to confirm removal
1879
- nextConfig = _object_spread_props$a(_object_spread$b({}, existingConfig), {
1879
+ nextConfig = _object_spread_props$b(_object_spread$c({}, existingConfig), {
1880
1880
  nb: nb,
1881
1881
  rm: true,
1882
1882
  i: util.UNSET_INDEX_NUMBER
@@ -1884,7 +1884,7 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1884
1884
  } else {
1885
1885
  // else, use the updated recipient and keep/copy the
1886
1886
  var updatedRecipient = nextRecipientsMap.get(nb);
1887
- nextConfig = _object_spread_props$a(_object_spread$b({}, existingConfig), {
1887
+ nextConfig = _object_spread_props$b(_object_spread$c({}, existingConfig), {
1888
1888
  nb: nb,
1889
1889
  rm: false,
1890
1890
  i: updatedRecipient.i
@@ -2452,7 +2452,7 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2452
2452
  targetRecipient = notificationBox.r[targetRecipientIndex];
2453
2453
  if (remove) {
2454
2454
  if (targetRecipientIndex !== -1) {
2455
- r = _to_consumable_array$5(notificationBox.r); // remove if they exist.
2455
+ r = _to_consumable_array$6(notificationBox.r); // remove if they exist.
2456
2456
  delete r[targetRecipientIndex];
2457
2457
  }
2458
2458
  } else {
@@ -2460,12 +2460,12 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2460
2460
  throw notificationBoxRecipientDoesNotExistsError();
2461
2461
  }
2462
2462
  c = (_ref = inputC != null ? firebase.notificationBoxRecipientTemplateConfigArrayToRecord(inputC) : targetRecipient === null || targetRecipient === void 0 ? void 0 : targetRecipient.c) !== null && _ref !== void 0 ? _ref : {};
2463
- nextRecipient = _object_spread$b({
2463
+ nextRecipient = _object_spread$c({
2464
2464
  uid: uid,
2465
2465
  i: (_ref1 = targetRecipient === null || targetRecipient === void 0 ? void 0 : targetRecipient.i) !== null && _ref1 !== void 0 ? _ref1 : util.UNSET_INDEX_NUMBER,
2466
2466
  c: c
2467
2467
  }, firebase.updateNotificationRecipient(targetRecipient !== null && targetRecipient !== void 0 ? targetRecipient : {}, params));
2468
- r = _to_consumable_array$5(notificationBox.r);
2468
+ r = _to_consumable_array$6(notificationBox.r);
2469
2469
  if (targetRecipient) {
2470
2470
  nextRecipient.i = targetRecipient.i;
2471
2471
  nextRecipient = firebase.mergeNotificationBoxRecipients(targetRecipient, nextRecipient);
@@ -2546,7 +2546,7 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2546
2546
  3,
2547
2547
  9
2548
2548
  ];
2549
- newUserTemplate = _object_spread_props$a(_object_spread$b({}, notificationUser), {
2549
+ newUserTemplate = _object_spread_props$b(_object_spread$c({}, notificationUser), {
2550
2550
  bc: updatedBc !== null && updatedBc !== void 0 ? updatedBc : [],
2551
2551
  b: updatedB !== null && updatedB !== void 0 ? updatedB : []
2552
2552
  });
@@ -2582,7 +2582,7 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2582
2582
  }
2583
2583
  _state.label = 12;
2584
2584
  case 12:
2585
- updatedNotificationBox = _object_spread_props$a(_object_spread$b({}, notificationBox), {
2585
+ updatedNotificationBox = _object_spread_props$b(_object_spread$c({}, notificationBox), {
2586
2586
  r: r
2587
2587
  });
2588
2588
  notificationBoxWasCreated = false;
@@ -2820,10 +2820,10 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
2820
2820
  notificationTemplate.at = 0; // reset checkpoint attempt/delay count
2821
2821
  }
2822
2822
  // add the checkpoint to the notification
2823
- notificationTemplate.tpr = _to_consumable_array$5(removeFromCompletionsArrayWithTaskResult(notification.tpr, handleTaskResult)).concat(_to_consumable_array$5(util.asArray(completion)));
2823
+ notificationTemplate.tpr = _to_consumable_array$6(removeFromCompletionsArrayWithTaskResult(notification.tpr, handleTaskResult)).concat(_to_consumable_array$6(util.asArray(completion)));
2824
2824
  // calculate the updated notification item
2825
- notificationTemplate.n = _object_spread_props$a(_object_spread$b({}, notification.n), {
2826
- d: _object_spread$b({}, notification.n.d, updateMetadata ? util.filterOnlyUndefinedValues(updateMetadata) : undefined // ignore any undefined values
2825
+ notificationTemplate.n = _object_spread_props$b(_object_spread$c({}, notification.n), {
2826
+ d: _object_spread$c({}, notification.n.d, updateMetadata ? util.filterOnlyUndefinedValues(updateMetadata) : undefined // ignore any undefined values
2827
2827
  )
2828
2828
  });
2829
2829
  // can only run the next part if the tpr has changed, and the number of checkpoints completed has increased
@@ -3173,7 +3173,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3173
3173
  case 13:
3174
3174
  if (sendEmailsResult != null) {
3175
3175
  success1 = sendEmailsResult.success, failed = sendEmailsResult.failed;
3176
- esr = success1.length ? _to_consumable_array$5(currentEsr).concat(_to_consumable_array$5(success1.map(function(x) {
3176
+ esr = success1.length ? _to_consumable_array$6(currentEsr).concat(_to_consumable_array$6(success1.map(function(x) {
3177
3177
  return x.toLowerCase();
3178
3178
  }))) : undefined;
3179
3179
  if (failed.length > 0) {
@@ -3294,7 +3294,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3294
3294
  case 26:
3295
3295
  if (sendTextsResult != null) {
3296
3296
  success2 = sendTextsResult.success, failed1 = sendTextsResult.failed;
3297
- tsr = success2.length ? _to_consumable_array$5(currentTsr).concat(_to_consumable_array$5(success2)) : undefined;
3297
+ tsr = success2.length ? _to_consumable_array$6(currentTsr).concat(_to_consumable_array$6(success2)) : undefined;
3298
3298
  if (failed1.length > 0) {
3299
3299
  ts = firebase.NotificationSendState.SENT_PARTIAL;
3300
3300
  } else {
@@ -4146,7 +4146,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4146
4146
  ];
4147
4147
  case 1:
4148
4148
  notificationDocuments = _state.sent();
4149
- notificationDocumentsGroupedByNotificationBox = _to_consumable_array$5(util.makeValuesGroupMap(notificationDocuments, function(x) {
4149
+ notificationDocumentsGroupedByNotificationBox = _to_consumable_array$6(util.makeValuesGroupMap(notificationDocuments, function(x) {
4150
4150
  return x.parent.id;
4151
4151
  }).values());
4152
4152
  return [
@@ -4202,7 +4202,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4202
4202
  }
4203
4203
  }
4204
4204
  }
4205
- pairsGroupedByWeek = _to_consumable_array$5(util.makeValuesGroupMap(normalPairsWithDataAndMarkedDeleted, function(x) {
4205
+ pairsGroupedByWeek = _to_consumable_array$6(util.makeValuesGroupMap(normalPairsWithDataAndMarkedDeleted, function(x) {
4206
4206
  return date.yearWeekCode(x.data.sat);
4207
4207
  }).entries());
4208
4208
  // batch incase there are a lot of new notifications to move to week
@@ -4216,7 +4216,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4216
4216
  });
4217
4217
  });
4218
4218
  // group logged events by ISO day string (derived from sat) for archival into NotificationLoggedEventDay.
4219
- pairsGroupedByLoggedEventDay = _to_consumable_array$5(util.makeValuesGroupMap(loggedEventPairsWithDataAndMarkedDeleted, function(x) {
4219
+ pairsGroupedByLoggedEventDay = _to_consumable_array$6(util.makeValuesGroupMap(loggedEventPairsWithDataAndMarkedDeleted, function(x) {
4220
4220
  return firebase.notificationLoggedEventDayId(x.data.sat);
4221
4221
  }).entries());
4222
4222
  // batch incase there are a lot of new logged events to move to a single day
@@ -4259,7 +4259,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4259
4259
  var shouldSaveToNotificationWeek = firebase.shouldSaveNotificationToNotificationWeek(data);
4260
4260
  return shouldSaveToNotificationWeek ? data.n : undefined;
4261
4261
  }));
4262
- n = _to_consumable_array$5((_ref = notificationWeek === null || notificationWeek === void 0 ? void 0 : notificationWeek.n) !== null && _ref !== void 0 ? _ref : []).concat(_to_consumable_array$5(newItems));
4262
+ n = _to_consumable_array$6((_ref = notificationWeek === null || notificationWeek === void 0 ? void 0 : notificationWeek.n) !== null && _ref !== void 0 ? _ref : []).concat(_to_consumable_array$6(newItems));
4263
4263
  if (!!notificationWeek) return [
4264
4264
  3,
4265
4265
  3
@@ -4353,7 +4353,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4353
4353
  });
4354
4354
  return [
4355
4355
  4,
4356
- pagedItems.writeAllItemsInTransaction(transaction, _to_consumable_array$5(existingItems).concat(_to_consumable_array$5(newItems)))
4356
+ pagedItems.writeAllItemsInTransaction(transaction, _to_consumable_array$6(existingItems).concat(_to_consumable_array$6(newItems)))
4357
4357
  ];
4358
4358
  case 2:
4359
4359
  _state.sent();
@@ -4660,7 +4660,7 @@ function _class_call_check$9(instance, Constructor) {
4660
4660
  throw new TypeError("Cannot call a class as a function");
4661
4661
  }
4662
4662
  }
4663
- function _define_property$b(obj, key, value) {
4663
+ function _define_property$c(obj, key, value) {
4664
4664
  if (key in obj) {
4665
4665
  Object.defineProperty(obj, key, {
4666
4666
  value: value,
@@ -4673,7 +4673,7 @@ function _define_property$b(obj, key, value) {
4673
4673
  }
4674
4674
  return obj;
4675
4675
  }
4676
- function _object_spread$a(target) {
4676
+ function _object_spread$b(target) {
4677
4677
  for(var i = 1; i < arguments.length; i++){
4678
4678
  var source = arguments[i] != null ? arguments[i] : {};
4679
4679
  var ownKeys = Object.keys(source);
@@ -4683,12 +4683,12 @@ function _object_spread$a(target) {
4683
4683
  }));
4684
4684
  }
4685
4685
  ownKeys.forEach(function(key) {
4686
- _define_property$b(target, key, source[key]);
4686
+ _define_property$c(target, key, source[key]);
4687
4687
  });
4688
4688
  }
4689
4689
  return target;
4690
4690
  }
4691
- function ownKeys$9(object, enumerableOnly) {
4691
+ function ownKeys$a(object, enumerableOnly) {
4692
4692
  var keys = Object.keys(object);
4693
4693
  if (Object.getOwnPropertySymbols) {
4694
4694
  var symbols = Object.getOwnPropertySymbols(object);
@@ -4696,12 +4696,12 @@ function ownKeys$9(object, enumerableOnly) {
4696
4696
  }
4697
4697
  return keys;
4698
4698
  }
4699
- function _object_spread_props$9(target, source) {
4699
+ function _object_spread_props$a(target, source) {
4700
4700
  source = source != null ? source : {};
4701
4701
  if (Object.getOwnPropertyDescriptors) {
4702
4702
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4703
4703
  } else {
4704
- ownKeys$9(Object(source)).forEach(function(key) {
4704
+ ownKeys$a(Object(source)).forEach(function(key) {
4705
4705
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
4706
4706
  });
4707
4707
  }
@@ -4923,7 +4923,7 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4923
4923
  initialized = true;
4924
4924
  return [
4925
4925
  4,
4926
- documentInTransaction.update(_object_spread_props$9(_object_spread$a({}, template), {
4926
+ documentInTransaction.update(_object_spread_props$a(_object_spread$b({}, template), {
4927
4927
  m: undefined,
4928
4928
  s: null,
4929
4929
  fi: false // set false
@@ -5347,13 +5347,13 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
5347
5347
  });
5348
5348
  }
5349
5349
 
5350
- function _type_of$2(obj) {
5350
+ function _type_of$3(obj) {
5351
5351
  "@swc/helpers - typeof";
5352
5352
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
5353
5353
  }
5354
5354
  function __decorate(decorators, target, key, desc) {
5355
5355
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5356
- if ((typeof Reflect === "undefined" ? "undefined" : _type_of$2(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5356
+ if ((typeof Reflect === "undefined" ? "undefined" : _type_of$3(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5357
5357
  else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5358
5358
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5359
5359
  }
@@ -5430,7 +5430,7 @@ function _create_class$1(Constructor, protoProps, staticProps) {
5430
5430
  if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
5431
5431
  return Constructor;
5432
5432
  }
5433
- function _define_property$a(obj, key, value) {
5433
+ function _define_property$b(obj, key, value) {
5434
5434
  if (key in obj) {
5435
5435
  Object.defineProperty(obj, key, {
5436
5436
  value: value,
@@ -5558,8 +5558,8 @@ function _ts_generator$d(thisArg, body) {
5558
5558
  function NotificationTemplateService(_inputDefaults, _inputConfigs) {
5559
5559
  var _this = this;
5560
5560
  _class_call_check$8(this, NotificationTemplateService);
5561
- _define_property$a(this, "_defaults", void 0);
5562
- _define_property$a(this, "_config", void 0);
5561
+ _define_property$b(this, "_defaults", void 0);
5562
+ _define_property$b(this, "_config", void 0);
5563
5563
  this._defaults = _inputDefaults !== null && _inputDefaults !== void 0 ? _inputDefaults : {};
5564
5564
  this._config = new Map();
5565
5565
  if (_inputConfigs != null) {
@@ -5673,7 +5673,7 @@ function _async_to_generator$c(fn) {
5673
5673
  });
5674
5674
  };
5675
5675
  }
5676
- function _define_property$9(obj, key, value) {
5676
+ function _define_property$a(obj, key, value) {
5677
5677
  if (key in obj) {
5678
5678
  Object.defineProperty(obj, key, {
5679
5679
  value: value,
@@ -5686,7 +5686,7 @@ function _define_property$9(obj, key, value) {
5686
5686
  }
5687
5687
  return obj;
5688
5688
  }
5689
- function _object_spread$9(target) {
5689
+ function _object_spread$a(target) {
5690
5690
  for(var i = 1; i < arguments.length; i++){
5691
5691
  var source = arguments[i] != null ? arguments[i] : {};
5692
5692
  var ownKeys = Object.keys(source);
@@ -5696,12 +5696,12 @@ function _object_spread$9(target) {
5696
5696
  }));
5697
5697
  }
5698
5698
  ownKeys.forEach(function(key) {
5699
- _define_property$9(target, key, source[key]);
5699
+ _define_property$a(target, key, source[key]);
5700
5700
  });
5701
5701
  }
5702
5702
  return target;
5703
5703
  }
5704
- function ownKeys$8(object, enumerableOnly) {
5704
+ function ownKeys$9(object, enumerableOnly) {
5705
5705
  var keys = Object.keys(object);
5706
5706
  if (Object.getOwnPropertySymbols) {
5707
5707
  var symbols = Object.getOwnPropertySymbols(object);
@@ -5709,12 +5709,12 @@ function ownKeys$8(object, enumerableOnly) {
5709
5709
  }
5710
5710
  return keys;
5711
5711
  }
5712
- function _object_spread_props$8(target, source) {
5712
+ function _object_spread_props$9(target, source) {
5713
5713
  source = source != null ? source : {};
5714
5714
  if (Object.getOwnPropertyDescriptors) {
5715
5715
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
5716
5716
  } else {
5717
- ownKeys$8(Object(source)).forEach(function(key) {
5717
+ ownKeys$9(Object(source)).forEach(function(key) {
5718
5718
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
5719
5719
  });
5720
5720
  }
@@ -5913,8 +5913,8 @@ function _ts_generator$c(thisArg, body) {
5913
5913
  if (updateNextRunAtTime != null) {
5914
5914
  sat = updateNextRunAtTime === true ? inputNow !== null && inputNow !== void 0 ? inputNow : new Date() : updateNextRunAtTime;
5915
5915
  }
5916
- pair = firebase.createNotificationDocumentPair(_object_spread_props$8(_object_spread$9({}, input), {
5917
- template: _object_spread_props$8(_object_spread$9({}, input.template), {
5916
+ pair = firebase.createNotificationDocumentPair(_object_spread_props$9(_object_spread$a({}, input), {
5917
+ template: _object_spread_props$9(_object_spread$a({}, input.template), {
5918
5918
  sat: sat
5919
5919
  })
5920
5920
  }));
@@ -5927,7 +5927,7 @@ function _ts_generator$c(thisArg, body) {
5927
5927
  ];
5928
5928
  case 1:
5929
5929
  pairExists = _state.sent();
5930
- result = _object_spread_props$8(_object_spread$9({}, pair), {
5930
+ result = _object_spread_props$9(_object_spread$a({}, pair), {
5931
5931
  notificationCreated: false
5932
5932
  });
5933
5933
  if (!pairExists) return [
@@ -6055,7 +6055,7 @@ function _create_class(Constructor, protoProps, staticProps) {
6055
6055
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
6056
6056
  return Constructor;
6057
6057
  }
6058
- function _define_property$8(obj, key, value) {
6058
+ function _define_property$9(obj, key, value) {
6059
6059
  if (key in obj) {
6060
6060
  Object.defineProperty(obj, key, {
6061
6061
  value: value,
@@ -6068,7 +6068,7 @@ function _define_property$8(obj, key, value) {
6068
6068
  }
6069
6069
  return obj;
6070
6070
  }
6071
- function _object_spread$8(target) {
6071
+ function _object_spread$9(target) {
6072
6072
  for(var i = 1; i < arguments.length; i++){
6073
6073
  var source = arguments[i] != null ? arguments[i] : {};
6074
6074
  var ownKeys = Object.keys(source);
@@ -6078,7 +6078,7 @@ function _object_spread$8(target) {
6078
6078
  }));
6079
6079
  }
6080
6080
  ownKeys.forEach(function(key) {
6081
- _define_property$8(target, key, source[key]);
6081
+ _define_property$9(target, key, source[key]);
6082
6082
  });
6083
6083
  }
6084
6084
  return target;
@@ -6245,7 +6245,7 @@ function _ts_generator$b(thisArg, body) {
6245
6245
  */ exports.MutableNotificationExpediteService = /*#__PURE__*/ function() {
6246
6246
  function MutableNotificationExpediteService() {
6247
6247
  _class_call_check$5(this, MutableNotificationExpediteService);
6248
- _define_property$8(this, "_notificationServerActions", void 0);
6248
+ _define_property$9(this, "_notificationServerActions", void 0);
6249
6249
  }
6250
6250
  _create_class(MutableNotificationExpediteService, [
6251
6251
  {
@@ -6278,7 +6278,7 @@ function _ts_generator$b(thisArg, body) {
6278
6278
  case 0:
6279
6279
  return [
6280
6280
  4,
6281
- this._notificationServerActions.sendNotification(_object_spread$8({
6281
+ this._notificationServerActions.sendNotification(_object_spread$9({
6282
6282
  key: firebase.firestoreDummyKey()
6283
6283
  }, options))
6284
6284
  ];
@@ -6334,20 +6334,20 @@ exports.MutableNotificationExpediteService = __decorate([
6334
6334
  ];
6335
6335
  }
6336
6336
 
6337
- function _array_like_to_array$6(arr, len) {
6337
+ function _array_like_to_array$7(arr, len) {
6338
6338
  if (len == null || len > arr.length) len = arr.length;
6339
6339
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6340
6340
  return arr2;
6341
6341
  }
6342
- function _array_without_holes$4(arr) {
6343
- if (Array.isArray(arr)) return _array_like_to_array$6(arr);
6342
+ function _array_without_holes$5(arr) {
6343
+ if (Array.isArray(arr)) return _array_like_to_array$7(arr);
6344
6344
  }
6345
6345
  function _class_call_check$4(instance, Constructor) {
6346
6346
  if (!(instance instanceof Constructor)) {
6347
6347
  throw new TypeError("Cannot call a class as a function");
6348
6348
  }
6349
6349
  }
6350
- function _define_property$7(obj, key, value) {
6350
+ function _define_property$8(obj, key, value) {
6351
6351
  if (key in obj) {
6352
6352
  Object.defineProperty(obj, key, {
6353
6353
  value: value,
@@ -6360,13 +6360,13 @@ function _define_property$7(obj, key, value) {
6360
6360
  }
6361
6361
  return obj;
6362
6362
  }
6363
- function _iterable_to_array$4(iter) {
6363
+ function _iterable_to_array$5(iter) {
6364
6364
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6365
6365
  }
6366
- function _non_iterable_spread$4() {
6366
+ function _non_iterable_spread$5() {
6367
6367
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6368
6368
  }
6369
- function _object_spread$7(target) {
6369
+ function _object_spread$8(target) {
6370
6370
  for(var i = 1; i < arguments.length; i++){
6371
6371
  var source = arguments[i] != null ? arguments[i] : {};
6372
6372
  var ownKeys = Object.keys(source);
@@ -6376,12 +6376,12 @@ function _object_spread$7(target) {
6376
6376
  }));
6377
6377
  }
6378
6378
  ownKeys.forEach(function(key) {
6379
- _define_property$7(target, key, source[key]);
6379
+ _define_property$8(target, key, source[key]);
6380
6380
  });
6381
6381
  }
6382
6382
  return target;
6383
6383
  }
6384
- function ownKeys$7(object, enumerableOnly) {
6384
+ function ownKeys$8(object, enumerableOnly) {
6385
6385
  var keys = Object.keys(object);
6386
6386
  if (Object.getOwnPropertySymbols) {
6387
6387
  var symbols = Object.getOwnPropertySymbols(object);
@@ -6389,27 +6389,27 @@ function ownKeys$7(object, enumerableOnly) {
6389
6389
  }
6390
6390
  return keys;
6391
6391
  }
6392
- function _object_spread_props$7(target, source) {
6392
+ function _object_spread_props$8(target, source) {
6393
6393
  source = source != null ? source : {};
6394
6394
  if (Object.getOwnPropertyDescriptors) {
6395
6395
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
6396
6396
  } else {
6397
- ownKeys$7(Object(source)).forEach(function(key) {
6397
+ ownKeys$8(Object(source)).forEach(function(key) {
6398
6398
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
6399
6399
  });
6400
6400
  }
6401
6401
  return target;
6402
6402
  }
6403
- function _to_consumable_array$4(arr) {
6404
- return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$4();
6403
+ function _to_consumable_array$5(arr) {
6404
+ return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$5();
6405
6405
  }
6406
- function _unsupported_iterable_to_array$6(o, minLen) {
6406
+ function _unsupported_iterable_to_array$7(o, minLen) {
6407
6407
  if (!o) return;
6408
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
6408
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
6409
6409
  var n = Object.prototype.toString.call(o).slice(8, -1);
6410
6410
  if (n === "Object" && o.constructor) n = o.constructor.name;
6411
6411
  if (n === "Map" || n === "Set") return Array.from(n);
6412
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
6412
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
6413
6413
  }
6414
6414
  // MARK: Provider Factories
6415
6415
  /**
@@ -6424,7 +6424,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
6424
6424
  * @returns The assembled {@link NotificationServerActionsContext}
6425
6425
  */ // eslint-disable-next-line @typescript-eslint/max-params
6426
6426
  function notificationServerActionsContextFactory(context, notificationTemplateService, notificationSendService, notificationTaskService, notificationsExpediteService) {
6427
- return _object_spread_props$7(_object_spread$7({}, context), {
6427
+ return _object_spread_props$8(_object_spread$8({}, context), {
6428
6428
  notificationTemplateService: notificationTemplateService,
6429
6429
  notificationSendService: notificationSendService,
6430
6430
  notificationTaskService: notificationTaskService,
@@ -6447,7 +6447,7 @@ function notificationServerActionsContextFactory(context, notificationTemplateSe
6447
6447
  * @param notificationInitServerActionsContextConfig - Init-specific configuration.
6448
6448
  * @returns A new {@link NotificationInitServerActions} instance.
6449
6449
  */ function notificationInitServerActionsFactory(context, notificationInitServerActionsContextConfig) {
6450
- return notificationInitServerActions(_object_spread$7({}, context, notificationInitServerActionsContextConfig));
6450
+ return notificationInitServerActions(_object_spread$8({}, context, notificationInitServerActionsContextConfig));
6451
6451
  }
6452
6452
  /**
6453
6453
  * Convenience function used to generate ModuleMetadata for an app's NotificationModule.
@@ -6471,14 +6471,14 @@ function notificationServerActionsContextFactory(context, notificationTemplateSe
6471
6471
  return {
6472
6472
  imports: [
6473
6473
  config.ConfigModule
6474
- ].concat(_to_consumable_array$4(dependencyModuleImport), _to_consumable_array$4(imports !== null && imports !== void 0 ? imports : [])),
6474
+ ].concat(_to_consumable_array$5(dependencyModuleImport), _to_consumable_array$5(imports !== null && imports !== void 0 ? imports : [])),
6475
6475
  exports: [
6476
6476
  NOTIFICATION_SERVER_ACTION_CONTEXT_TOKEN,
6477
6477
  NotificationExpediteService,
6478
6478
  exports.NotificationTemplateService,
6479
6479
  NotificationServerActions,
6480
6480
  NotificationInitServerActions
6481
- ].concat(_to_consumable_array$4(exports$1 !== null && exports$1 !== void 0 ? exports$1 : [])),
6481
+ ].concat(_to_consumable_array$5(exports$1 !== null && exports$1 !== void 0 ? exports$1 : [])),
6482
6482
  providers: [
6483
6483
  {
6484
6484
  provide: NotificationExpediteService,
@@ -6514,7 +6514,7 @@ function notificationServerActionsContextFactory(context, notificationTemplateSe
6514
6514
  NOTIFICATION_INIT_SERVER_ACTIONS_CONTEXT_CONFIG_TOKEN
6515
6515
  ]
6516
6516
  }
6517
- ].concat(_to_consumable_array$4(providers !== null && providers !== void 0 ? providers : []))
6517
+ ].concat(_to_consumable_array$5(providers !== null && providers !== void 0 ? providers : []))
6518
6518
  };
6519
6519
  }
6520
6520
  /**
@@ -6541,7 +6541,7 @@ exports.GlobalNotificationModule = __decorate([
6541
6541
  })
6542
6542
  ], exports.GlobalNotificationModule);
6543
6543
 
6544
- function _array_like_to_array$5(arr, len) {
6544
+ function _array_like_to_array$6(arr, len) {
6545
6545
  if (len == null || len > arr.length) len = arr.length;
6546
6546
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6547
6547
  return arr2;
@@ -6549,8 +6549,8 @@ function _array_like_to_array$5(arr, len) {
6549
6549
  function _array_with_holes$2(arr) {
6550
6550
  if (Array.isArray(arr)) return arr;
6551
6551
  }
6552
- function _array_without_holes$3(arr) {
6553
- if (Array.isArray(arr)) return _array_like_to_array$5(arr);
6552
+ function _array_without_holes$4(arr) {
6553
+ if (Array.isArray(arr)) return _array_like_to_array$6(arr);
6554
6554
  }
6555
6555
  function asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, key, arg) {
6556
6556
  try {
@@ -6581,7 +6581,7 @@ function _async_to_generator$a(fn) {
6581
6581
  });
6582
6582
  };
6583
6583
  }
6584
- function _define_property$6(obj, key, value) {
6584
+ function _define_property$7(obj, key, value) {
6585
6585
  if (key in obj) {
6586
6586
  Object.defineProperty(obj, key, {
6587
6587
  value: value,
@@ -6594,7 +6594,7 @@ function _define_property$6(obj, key, value) {
6594
6594
  }
6595
6595
  return obj;
6596
6596
  }
6597
- function _iterable_to_array$3(iter) {
6597
+ function _iterable_to_array$4(iter) {
6598
6598
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6599
6599
  }
6600
6600
  function _iterable_to_array_limit$2(arr, i) {
@@ -6624,10 +6624,10 @@ function _iterable_to_array_limit$2(arr, i) {
6624
6624
  function _non_iterable_rest$2() {
6625
6625
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6626
6626
  }
6627
- function _non_iterable_spread$3() {
6627
+ function _non_iterable_spread$4() {
6628
6628
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6629
6629
  }
6630
- function _object_spread$6(target) {
6630
+ function _object_spread$7(target) {
6631
6631
  for(var i = 1; i < arguments.length; i++){
6632
6632
  var source = arguments[i] != null ? arguments[i] : {};
6633
6633
  var ownKeys = Object.keys(source);
@@ -6637,12 +6637,12 @@ function _object_spread$6(target) {
6637
6637
  }));
6638
6638
  }
6639
6639
  ownKeys.forEach(function(key) {
6640
- _define_property$6(target, key, source[key]);
6640
+ _define_property$7(target, key, source[key]);
6641
6641
  });
6642
6642
  }
6643
6643
  return target;
6644
6644
  }
6645
- function ownKeys$6(object, enumerableOnly) {
6645
+ function ownKeys$7(object, enumerableOnly) {
6646
6646
  var keys = Object.keys(object);
6647
6647
  if (Object.getOwnPropertySymbols) {
6648
6648
  var symbols = Object.getOwnPropertySymbols(object);
@@ -6650,30 +6650,30 @@ function ownKeys$6(object, enumerableOnly) {
6650
6650
  }
6651
6651
  return keys;
6652
6652
  }
6653
- function _object_spread_props$6(target, source) {
6653
+ function _object_spread_props$7(target, source) {
6654
6654
  source = source != null ? source : {};
6655
6655
  if (Object.getOwnPropertyDescriptors) {
6656
6656
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
6657
6657
  } else {
6658
- ownKeys$6(Object(source)).forEach(function(key) {
6658
+ ownKeys$7(Object(source)).forEach(function(key) {
6659
6659
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
6660
6660
  });
6661
6661
  }
6662
6662
  return target;
6663
6663
  }
6664
6664
  function _sliced_to_array$2(arr, i) {
6665
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$2();
6665
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$2();
6666
6666
  }
6667
- function _to_consumable_array$3(arr) {
6668
- return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$3();
6667
+ function _to_consumable_array$4(arr) {
6668
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$4();
6669
6669
  }
6670
- function _unsupported_iterable_to_array$5(o, minLen) {
6670
+ function _unsupported_iterable_to_array$6(o, minLen) {
6671
6671
  if (!o) return;
6672
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
6672
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
6673
6673
  var n = Object.prototype.toString.call(o).slice(8, -1);
6674
6674
  if (n === "Object" && o.constructor) n = o.constructor.name;
6675
6675
  if (n === "Map" || n === "Set") return Array.from(n);
6676
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
6676
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
6677
6677
  }
6678
6678
  function _ts_generator$a(thisArg, body) {
6679
6679
  var f, y, t, _ = {
@@ -6865,7 +6865,7 @@ function _ts_generator$a(thisArg, body) {
6865
6865
  });
6866
6866
  if (messagesToSend.length > 0) {
6867
6867
  // add the new items to existing n, then keep the last 1000
6868
- sortedN = _to_consumable_array$3(existingMessages).concat(_to_consumable_array$3(messagesToSend.map(function(x) {
6868
+ sortedN = _to_consumable_array$4(existingMessages).concat(_to_consumable_array$4(messagesToSend.map(function(x) {
6869
6869
  var message = '';
6870
6870
  if (x.content.openingMessage) {
6871
6871
  message = x.content.openingMessage;
@@ -6873,7 +6873,7 @@ function _ts_generator$a(thisArg, body) {
6873
6873
  if (x.content.closingMessage) {
6874
6874
  message = (message ? message + '\n\n' : message) + x.content.closingMessage;
6875
6875
  }
6876
- var item = _object_spread_props$6(_object_spread$6({}, x.item), {
6876
+ var item = _object_spread_props$7(_object_spread$7({}, x.item), {
6877
6877
  s: cutSubject(x.content.title),
6878
6878
  g: cutMessage(message)
6879
6879
  });
@@ -6910,7 +6910,7 @@ function _ts_generator$a(thisArg, body) {
6910
6910
  5
6911
6911
  ];
6912
6912
  // if it does not exist, and we are allowed to create new summaries, create it and add the new notifications
6913
- createTemplate = _object_spread$6({}, makeNewNotificationSummaryTemplate(firebase.inferKeyFromTwoWayFlatFirestoreModelKey(notificationSummaryId)), updateTemplate);
6913
+ createTemplate = _object_spread$7({}, makeNewNotificationSummaryTemplate(firebase.inferKeyFromTwoWayFlatFirestoreModelKey(notificationSummaryId)), updateTemplate);
6914
6914
  return [
6915
6915
  4,
6916
6916
  notificationSummaryDocument.create(createTemplate)
@@ -7388,13 +7388,13 @@ function _ts_generator$8(thisArg, body) {
7388
7388
  };
7389
7389
  }
7390
7390
 
7391
- function _array_like_to_array$4(arr, len) {
7391
+ function _array_like_to_array$5(arr, len) {
7392
7392
  if (len == null || len > arr.length) len = arr.length;
7393
7393
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
7394
7394
  return arr2;
7395
7395
  }
7396
- function _array_without_holes$2(arr) {
7397
- if (Array.isArray(arr)) return _array_like_to_array$4(arr);
7396
+ function _array_without_holes$3(arr) {
7397
+ if (Array.isArray(arr)) return _array_like_to_array$5(arr);
7398
7398
  }
7399
7399
  function _assert_this_initialized(self) {
7400
7400
  if (self === void 0) {
@@ -7440,7 +7440,7 @@ function _class_call_check$3(instance, Constructor) {
7440
7440
  throw new TypeError("Cannot call a class as a function");
7441
7441
  }
7442
7442
  }
7443
- function _define_property$5(obj, key, value) {
7443
+ function _define_property$6(obj, key, value) {
7444
7444
  if (key in obj) {
7445
7445
  Object.defineProperty(obj, key, {
7446
7446
  value: value,
@@ -7480,13 +7480,13 @@ function _instanceof$2(left, right) {
7480
7480
  return left instanceof right;
7481
7481
  }
7482
7482
  }
7483
- function _iterable_to_array$2(iter) {
7483
+ function _iterable_to_array$3(iter) {
7484
7484
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
7485
7485
  }
7486
- function _non_iterable_spread$2() {
7486
+ function _non_iterable_spread$3() {
7487
7487
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7488
7488
  }
7489
- function _object_spread$5(target) {
7489
+ function _object_spread$6(target) {
7490
7490
  for(var i = 1; i < arguments.length; i++){
7491
7491
  var source = arguments[i] != null ? arguments[i] : {};
7492
7492
  var ownKeys = Object.keys(source);
@@ -7496,12 +7496,12 @@ function _object_spread$5(target) {
7496
7496
  }));
7497
7497
  }
7498
7498
  ownKeys.forEach(function(key) {
7499
- _define_property$5(target, key, source[key]);
7499
+ _define_property$6(target, key, source[key]);
7500
7500
  });
7501
7501
  }
7502
7502
  return target;
7503
7503
  }
7504
- function ownKeys$5(object, enumerableOnly) {
7504
+ function ownKeys$6(object, enumerableOnly) {
7505
7505
  var keys = Object.keys(object);
7506
7506
  if (Object.getOwnPropertySymbols) {
7507
7507
  var symbols = Object.getOwnPropertySymbols(object);
@@ -7509,19 +7509,19 @@ function ownKeys$5(object, enumerableOnly) {
7509
7509
  }
7510
7510
  return keys;
7511
7511
  }
7512
- function _object_spread_props$5(target, source) {
7512
+ function _object_spread_props$6(target, source) {
7513
7513
  source = source != null ? source : {};
7514
7514
  if (Object.getOwnPropertyDescriptors) {
7515
7515
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
7516
7516
  } else {
7517
- ownKeys$5(Object(source)).forEach(function(key) {
7517
+ ownKeys$6(Object(source)).forEach(function(key) {
7518
7518
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
7519
7519
  });
7520
7520
  }
7521
7521
  return target;
7522
7522
  }
7523
7523
  function _possible_constructor_return(self, call) {
7524
- if (call && (_type_of$1(call) === "object" || typeof call === "function")) {
7524
+ if (call && (_type_of$2(call) === "object" || typeof call === "function")) {
7525
7525
  return call;
7526
7526
  }
7527
7527
  return _assert_this_initialized(self);
@@ -7533,20 +7533,20 @@ function _set_prototype_of(o, p) {
7533
7533
  };
7534
7534
  return _set_prototype_of(o, p);
7535
7535
  }
7536
- function _to_consumable_array$2(arr) {
7537
- return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$2();
7536
+ function _to_consumable_array$3(arr) {
7537
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$3();
7538
7538
  }
7539
- function _type_of$1(obj) {
7539
+ function _type_of$2(obj) {
7540
7540
  "@swc/helpers - typeof";
7541
7541
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
7542
7542
  }
7543
- function _unsupported_iterable_to_array$4(o, minLen) {
7543
+ function _unsupported_iterable_to_array$5(o, minLen) {
7544
7544
  if (!o) return;
7545
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
7545
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
7546
7546
  var n = Object.prototype.toString.call(o).slice(8, -1);
7547
7547
  if (n === "Object" && o.constructor) n = o.constructor.name;
7548
7548
  if (n === "Map" || n === "Set") return Array.from(n);
7549
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
7549
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
7550
7550
  }
7551
7551
  function _is_native_reflect_construct() {
7552
7552
  try {
@@ -7759,7 +7759,7 @@ function _ts_generator$7(thisArg, body) {
7759
7759
  break;
7760
7760
  default:
7761
7761
  {
7762
- sfps = util.unique(_to_consumable_array$2(removeFromCompletionsArrayWithTaskResult(sfps, subtaskResult)).concat(_to_consumable_array$2(util.asArray(subtaskCompletion))));
7762
+ sfps = util.unique(_to_consumable_array$3(removeFromCompletionsArrayWithTaskResult(sfps, subtaskResult)).concat(_to_consumable_array$3(util.asArray(subtaskCompletion))));
7763
7763
  completedSubtasksSet1 = new Set(sfps);
7764
7764
  incompleteSubtasks = allKnownSubtasks.filter(function(x) {
7765
7765
  return !completedSubtasksSet1.has(x);
@@ -7769,10 +7769,10 @@ function _ts_generator$7(thisArg, body) {
7769
7769
  }
7770
7770
  }
7771
7771
  // configure the update metadata result
7772
- sd = _object_spread$5({}, subtaskData, subtaskUpdateMetadata);
7772
+ sd = _object_spread$6({}, subtaskData, subtaskUpdateMetadata);
7773
7773
  /**
7774
7774
  * This is updating the metadata for the NotificationTask, which has a nested data
7775
- */ baseUpdateMetadata = _object_spread_props$5(_object_spread$5({}, notificationTask.data), {
7775
+ */ baseUpdateMetadata = _object_spread_props$6(_object_spread$6({}, notificationTask.data), {
7776
7776
  sfps: sfps,
7777
7777
  sd: sd
7778
7778
  });
@@ -7784,7 +7784,7 @@ function _ts_generator$7(thisArg, body) {
7784
7784
  updateMetadata = _state.sent();
7785
7785
  if (updateMetadata) {
7786
7786
  // inject sfps and sd back in
7787
- updateMetadata = _object_spread_props$5(_object_spread$5({}, updateMetadata), {
7787
+ updateMetadata = _object_spread_props$6(_object_spread$6({}, updateMetadata), {
7788
7788
  sfps: sfps,
7789
7789
  sd: sd
7790
7790
  });
@@ -7911,7 +7911,7 @@ function _ts_generator$7(thisArg, body) {
7911
7911
  return _ts_generator$7(this, function(_state) {
7912
7912
  switch(_state.label){
7913
7913
  case 0:
7914
- baseInput = _object_spread_props$5(_object_spread$5({}, inputFunctionResult), {
7914
+ baseInput = _object_spread_props$6(_object_spread$6({}, inputFunctionResult), {
7915
7915
  notificationTask: notificationTask
7916
7916
  });
7917
7917
  target = baseInput.target;
@@ -7925,7 +7925,7 @@ function _ts_generator$7(thisArg, body) {
7925
7925
  2
7926
7926
  ];
7927
7927
  subtaskData = data.sd, completedSubtasks = data.sfps;
7928
- input = _object_spread_props$5(_object_spread$5({}, baseInput), {
7928
+ input = _object_spread_props$6(_object_spread$6({}, baseInput), {
7929
7929
  target: target,
7930
7930
  completedSubtasks: completedSubtasks !== null && completedSubtasks !== void 0 ? completedSubtasks : [],
7931
7931
  subtaskData: subtaskData
@@ -7971,7 +7971,7 @@ function _ts_generator$7(thisArg, body) {
7971
7971
  return _ts_generator$7(this, function(_state) {
7972
7972
  switch(_state.label){
7973
7973
  case 0:
7974
- cleanupFunctionInput = _object_spread_props$5(_object_spread$5({}, inputFunctionResult), {
7974
+ cleanupFunctionInput = _object_spread_props$6(_object_spread$6({}, inputFunctionResult), {
7975
7975
  notificationTask: notificationTask
7976
7976
  });
7977
7977
  target = cleanupFunctionInput.target;
@@ -7985,7 +7985,7 @@ function _ts_generator$7(thisArg, body) {
7985
7985
  5
7986
7986
  ];
7987
7987
  subtaskData = data.sd, completedSubtasks = data.sfps;
7988
- input = _object_spread_props$5(_object_spread$5({}, cleanupFunctionInput), {
7988
+ input = _object_spread_props$6(_object_spread$6({}, cleanupFunctionInput), {
7989
7989
  notificationTask: notificationTask,
7990
7990
  completedSubtasks: completedSubtasks !== null && completedSubtasks !== void 0 ? completedSubtasks : [],
7991
7991
  target: target,
@@ -8491,7 +8491,7 @@ function encodeImage(input) {
8491
8491
  })();
8492
8492
  }
8493
8493
 
8494
- function _array_like_to_array$3(arr, len) {
8494
+ function _array_like_to_array$4(arr, len) {
8495
8495
  if (len == null || len > arr.length) len = arr.length;
8496
8496
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
8497
8497
  return arr2;
@@ -8564,15 +8564,15 @@ function _non_iterable_rest$1() {
8564
8564
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
8565
8565
  }
8566
8566
  function _sliced_to_array$1(arr, i) {
8567
- return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$1();
8567
+ return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$1();
8568
8568
  }
8569
- function _unsupported_iterable_to_array$3(o, minLen) {
8569
+ function _unsupported_iterable_to_array$4(o, minLen) {
8570
8570
  if (!o) return;
8571
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
8571
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
8572
8572
  var n = Object.prototype.toString.call(o).slice(8, -1);
8573
8573
  if (n === "Object" && o.constructor) n = o.constructor.name;
8574
8574
  if (n === "Map" || n === "Set") return Array.from(n);
8575
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
8575
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
8576
8576
  }
8577
8577
  function _ts_generator$5(thisArg, body) {
8578
8578
  var f, y, t, _ = {
@@ -8700,7 +8700,7 @@ var DEFAULT_COMPRESS_PDF_IMAGE_SIZE_THRESHOLD_BYTES = 100 * 1024;
8700
8700
  * ```
8701
8701
  */ function compressPdfImagesToTargetSize(input, config) {
8702
8702
  return _async_to_generator$5(function() {
8703
- var _config_imageMaxDimension, _config_imageQuality, _config_imageSizeThresholdBytes, targetSizeBytes, imageMaxDimension, imageQuality, imageSizeThresholdBytes, originalSizeBytes, pdfDoc, indirectObjects, imagesCompressed, imagesSkipped, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, ref, obj, candidate, compressedImage, err, outputBuffer, compressedSizeBytes, savedBytes, savedBuffer, result;
8703
+ var _config_imageMaxDimension, _config_imageQuality, _config_imageSizeThresholdBytes, targetSizeBytes, imageMaxDimension, imageQuality, imageSizeThresholdBytes, originalSizeBytes, pdfDoc, pageCount, indirectObjects, counters, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, ref, obj, err, outputBuffer, compressedSizeBytes, savedBytes, savedBuffer, result;
8704
8704
  return _ts_generator$5(this, function(_state) {
8705
8705
  switch(_state.label){
8706
8706
  case 0:
@@ -8718,111 +8718,72 @@ var DEFAULT_COMPRESS_PDF_IMAGE_SIZE_THRESHOLD_BYTES = 100 * 1024;
8718
8718
  ];
8719
8719
  case 1:
8720
8720
  pdfDoc = _state.sent();
8721
+ pageCount = pdfDoc.getPageCount();
8721
8722
  indirectObjects = pdfDoc.context.enumerateIndirectObjects();
8722
- imagesCompressed = 0;
8723
- imagesSkipped = 0;
8723
+ counters = {
8724
+ imagesCompressed: 0,
8725
+ imagesSkipped: 0,
8726
+ imageStreamCount: 0,
8727
+ imageStreamsByFilter: {}
8728
+ };
8724
8729
  _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
8725
8730
  _state.label = 2;
8726
8731
  case 2:
8727
8732
  _state.trys.push([
8728
8733
  2,
8729
- 9,
8730
- 10,
8731
- 11
8734
+ 7,
8735
+ 8,
8736
+ 9
8732
8737
  ]);
8733
8738
  _iterator = indirectObjects[Symbol.iterator]();
8734
8739
  _state.label = 3;
8735
8740
  case 3:
8736
8741
  if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
8737
8742
  3,
8738
- 8
8743
+ 6
8739
8744
  ];
8740
8745
  _step_value = _sliced_to_array$1(_step.value, 2), ref = _step_value[0], obj = _step_value[1];
8741
8746
  if (!_instanceof$1(obj, pdfLib.PDFRawStream)) {
8742
8747
  return [
8743
8748
  3,
8744
- 7
8745
- ];
8746
- }
8747
- candidate = isCompressibleImageStream(obj);
8748
- if (!candidate) {
8749
- return [
8750
- 3,
8751
- 7
8752
- ];
8753
- }
8754
- if (obj.contents.byteLength < imageSizeThresholdBytes) {
8755
- // tiny image — not worth recompressing
8756
- return [
8757
- 3,
8758
- 7
8749
+ 5
8759
8750
  ];
8760
8751
  }
8761
- _state.label = 4;
8762
- case 4:
8763
- _state.trys.push([
8764
- 4,
8765
- 6,
8766
- ,
8767
- 7
8768
- ]);
8769
8752
  return [
8770
8753
  4,
8771
- compressImageBufferToTargetSize(Buffer.from(obj.contents), {
8772
- targetSizeBytes: obj.contents.byteLength,
8773
- maxDimension: imageMaxDimension,
8774
- initialQuality: imageQuality,
8775
- format: 'jpeg'
8754
+ processPdfStream({
8755
+ pdfDoc: pdfDoc,
8756
+ ref: ref,
8757
+ obj: obj,
8758
+ counters: counters,
8759
+ imageMaxDimension: imageMaxDimension,
8760
+ imageQuality: imageQuality,
8761
+ imageSizeThresholdBytes: imageSizeThresholdBytes
8776
8762
  })
8777
8763
  ];
8778
- case 5:
8779
- compressedImage = _state.sent();
8780
- if (compressedImage.compressedSizeBytes >= obj.contents.byteLength) {
8781
- // no gain — leave it alone
8782
- return [
8783
- 3,
8784
- 7
8785
- ];
8786
- }
8787
- replaceImageStream({
8788
- pdfDoc: pdfDoc,
8789
- ref: ref,
8790
- newImageBytes: compressedImage.buffer,
8791
- newWidth: compressedImage.finalWidth,
8792
- newHeight: compressedImage.finalHeight
8793
- });
8794
- imagesCompressed += 1;
8795
- return [
8796
- 3,
8797
- 7
8798
- ];
8799
- case 6:
8764
+ case 4:
8800
8765
  _state.sent();
8801
- imagesSkipped += 1;
8802
- return [
8803
- 3,
8804
- 7
8805
- ];
8806
- case 7:
8766
+ _state.label = 5;
8767
+ case 5:
8807
8768
  _iteratorNormalCompletion = true;
8808
8769
  return [
8809
8770
  3,
8810
8771
  3
8811
8772
  ];
8812
- case 8:
8773
+ case 6:
8813
8774
  return [
8814
8775
  3,
8815
- 11
8776
+ 9
8816
8777
  ];
8817
- case 9:
8778
+ case 7:
8818
8779
  err = _state.sent();
8819
8780
  _didIteratorError = true;
8820
8781
  _iteratorError = err;
8821
8782
  return [
8822
8783
  3,
8823
- 11
8784
+ 9
8824
8785
  ];
8825
- case 10:
8786
+ case 8:
8826
8787
  try {
8827
8788
  if (!_iteratorNormalCompletion && _iterator.return != null) {
8828
8789
  _iterator.return();
@@ -8835,12 +8796,12 @@ var DEFAULT_COMPRESS_PDF_IMAGE_SIZE_THRESHOLD_BYTES = 100 * 1024;
8835
8796
  return [
8836
8797
  7
8837
8798
  ];
8838
- case 11:
8799
+ case 9:
8839
8800
  outputBuffer = input;
8840
8801
  compressedSizeBytes = originalSizeBytes;
8841
- if (!(imagesCompressed > 0)) return [
8802
+ if (!(counters.imagesCompressed > 0)) return [
8842
8803
  3,
8843
- 13
8804
+ 11
8844
8805
  ];
8845
8806
  return [
8846
8807
  4,
@@ -8848,22 +8809,25 @@ var DEFAULT_COMPRESS_PDF_IMAGE_SIZE_THRESHOLD_BYTES = 100 * 1024;
8848
8809
  useObjectStreams: true
8849
8810
  })
8850
8811
  ];
8851
- case 12:
8812
+ case 10:
8852
8813
  savedBytes = _state.sent();
8853
8814
  savedBuffer = Buffer.from(savedBytes);
8854
8815
  if (savedBuffer.byteLength < originalSizeBytes) {
8855
8816
  outputBuffer = savedBuffer;
8856
8817
  compressedSizeBytes = savedBuffer.byteLength;
8857
8818
  }
8858
- _state.label = 13;
8859
- case 13:
8819
+ _state.label = 11;
8820
+ case 11:
8860
8821
  result = {
8861
8822
  buffer: outputBuffer,
8862
8823
  originalSizeBytes: originalSizeBytes,
8863
8824
  compressedSizeBytes: compressedSizeBytes,
8864
- imagesCompressed: imagesCompressed,
8865
- imagesSkipped: imagesSkipped,
8866
- hitTarget: compressedSizeBytes <= targetSizeBytes
8825
+ imagesCompressed: counters.imagesCompressed,
8826
+ imagesSkipped: counters.imagesSkipped,
8827
+ hitTarget: compressedSizeBytes <= targetSizeBytes,
8828
+ pageCount: pageCount,
8829
+ imageStreamCount: counters.imageStreamCount,
8830
+ imageStreamsByFilter: counters.imageStreamsByFilter
8867
8831
  };
8868
8832
  return [
8869
8833
  2,
@@ -8873,6 +8837,109 @@ var DEFAULT_COMPRESS_PDF_IMAGE_SIZE_THRESHOLD_BYTES = 100 * 1024;
8873
8837
  });
8874
8838
  })();
8875
8839
  }
8840
+ function processPdfStream(input) {
8841
+ return _async_to_generator$5(function() {
8842
+ var pdfDoc, ref, obj, counters, imageMaxDimension, imageQuality, imageSizeThresholdBytes, _counters_imageStreamsByFilter_filterKey, filterKey, compressedImage;
8843
+ return _ts_generator$5(this, function(_state) {
8844
+ switch(_state.label){
8845
+ case 0:
8846
+ pdfDoc = input.pdfDoc, ref = input.ref, obj = input.obj, counters = input.counters, imageMaxDimension = input.imageMaxDimension, imageQuality = input.imageQuality, imageSizeThresholdBytes = input.imageSizeThresholdBytes;
8847
+ if (isImageStream(obj)) {
8848
+ counters.imageStreamCount += 1;
8849
+ filterKey = imageStreamFilterKey(obj);
8850
+ counters.imageStreamsByFilter[filterKey] = ((_counters_imageStreamsByFilter_filterKey = counters.imageStreamsByFilter[filterKey]) !== null && _counters_imageStreamsByFilter_filterKey !== void 0 ? _counters_imageStreamsByFilter_filterKey : 0) + 1;
8851
+ }
8852
+ if (!isCompressibleImageStream(obj)) {
8853
+ return [
8854
+ 2
8855
+ ];
8856
+ }
8857
+ if (obj.contents.byteLength < imageSizeThresholdBytes) {
8858
+ return [
8859
+ 2
8860
+ ]; // tiny image — not worth recompressing
8861
+ }
8862
+ _state.label = 1;
8863
+ case 1:
8864
+ _state.trys.push([
8865
+ 1,
8866
+ 3,
8867
+ ,
8868
+ 4
8869
+ ]);
8870
+ return [
8871
+ 4,
8872
+ compressImageBufferToTargetSize(Buffer.from(obj.contents), {
8873
+ targetSizeBytes: obj.contents.byteLength,
8874
+ maxDimension: imageMaxDimension,
8875
+ initialQuality: imageQuality,
8876
+ format: 'jpeg'
8877
+ })
8878
+ ];
8879
+ case 2:
8880
+ compressedImage = _state.sent();
8881
+ if (compressedImage.compressedSizeBytes >= obj.contents.byteLength) {
8882
+ return [
8883
+ 2
8884
+ ]; // no gain — leave it alone
8885
+ }
8886
+ replaceImageStream({
8887
+ pdfDoc: pdfDoc,
8888
+ ref: ref,
8889
+ newImageBytes: compressedImage.buffer,
8890
+ newWidth: compressedImage.finalWidth,
8891
+ newHeight: compressedImage.finalHeight
8892
+ });
8893
+ counters.imagesCompressed += 1;
8894
+ return [
8895
+ 3,
8896
+ 4
8897
+ ];
8898
+ case 3:
8899
+ _state.sent();
8900
+ counters.imagesSkipped += 1;
8901
+ return [
8902
+ 3,
8903
+ 4
8904
+ ];
8905
+ case 4:
8906
+ return [
8907
+ 2
8908
+ ];
8909
+ }
8910
+ });
8911
+ })();
8912
+ }
8913
+ function isImageStream(stream) {
8914
+ var dict = stream.dict;
8915
+ var type = dict.get(PDF_NAME_TYPE);
8916
+ var typeOk = type === undefined || pdfNameEquals(type, PDF_NAME_XOBJECT);
8917
+ var result = false;
8918
+ if (typeOk) {
8919
+ var subtype = dict.get(PDF_NAME_SUBTYPE);
8920
+ result = subtype !== undefined && pdfNameEquals(subtype, PDF_NAME_IMAGE);
8921
+ }
8922
+ return result;
8923
+ }
8924
+ function imageStreamFilterKey(stream) {
8925
+ var filter = stream.dict.get(PDF_NAME_FILTER);
8926
+ var result;
8927
+ if (filter === undefined) {
8928
+ result = 'none';
8929
+ } else if (_instanceof$1(filter, pdfLib.PDFArray)) {
8930
+ result = filter.asArray().map(function(entry) {
8931
+ return _instanceof$1(entry, pdfLib.PDFName) ? stripPdfNameSlash(entry.asString()) : 'unknown';
8932
+ }).join('+');
8933
+ } else if (_instanceof$1(filter, pdfLib.PDFName)) {
8934
+ result = stripPdfNameSlash(filter.asString());
8935
+ } else {
8936
+ result = 'unknown';
8937
+ }
8938
+ return result;
8939
+ }
8940
+ function stripPdfNameSlash(name) {
8941
+ return name.startsWith('/') ? name.slice(1) : name;
8942
+ }
8876
8943
  var PDF_NAME_TYPE = pdfLib.PDFName.of('Type');
8877
8944
  var PDF_NAME_XOBJECT = pdfLib.PDFName.of('XObject');
8878
8945
  var PDF_NAME_SUBTYPE = pdfLib.PDFName.of('Subtype');
@@ -9071,7 +9138,7 @@ function replaceImageStream(input) {
9071
9138
  });
9072
9139
  }
9073
9140
 
9074
- function _array_like_to_array$2(arr, len) {
9141
+ function _array_like_to_array$3(arr, len) {
9075
9142
  if (len == null || len > arr.length) len = arr.length;
9076
9143
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
9077
9144
  return arr2;
@@ -9113,7 +9180,7 @@ function _class_call_check$2(instance, Constructor) {
9113
9180
  throw new TypeError("Cannot call a class as a function");
9114
9181
  }
9115
9182
  }
9116
- function _define_property$4(obj, key, value) {
9183
+ function _define_property$5(obj, key, value) {
9117
9184
  if (key in obj) {
9118
9185
  Object.defineProperty(obj, key, {
9119
9186
  value: value,
@@ -9161,7 +9228,7 @@ function _iterable_to_array_limit(arr, i) {
9161
9228
  function _non_iterable_rest() {
9162
9229
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
9163
9230
  }
9164
- function _object_spread$4(target) {
9231
+ function _object_spread$5(target) {
9165
9232
  for(var i = 1; i < arguments.length; i++){
9166
9233
  var source = arguments[i] != null ? arguments[i] : {};
9167
9234
  var ownKeys = Object.keys(source);
@@ -9171,12 +9238,12 @@ function _object_spread$4(target) {
9171
9238
  }));
9172
9239
  }
9173
9240
  ownKeys.forEach(function(key) {
9174
- _define_property$4(target, key, source[key]);
9241
+ _define_property$5(target, key, source[key]);
9175
9242
  });
9176
9243
  }
9177
9244
  return target;
9178
9245
  }
9179
- function ownKeys$4(object, enumerableOnly) {
9246
+ function ownKeys$5(object, enumerableOnly) {
9180
9247
  var keys = Object.keys(object);
9181
9248
  if (Object.getOwnPropertySymbols) {
9182
9249
  var symbols = Object.getOwnPropertySymbols(object);
@@ -9184,27 +9251,27 @@ function ownKeys$4(object, enumerableOnly) {
9184
9251
  }
9185
9252
  return keys;
9186
9253
  }
9187
- function _object_spread_props$4(target, source) {
9254
+ function _object_spread_props$5(target, source) {
9188
9255
  source = source != null ? source : {};
9189
9256
  if (Object.getOwnPropertyDescriptors) {
9190
9257
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
9191
9258
  } else {
9192
- ownKeys$4(Object(source)).forEach(function(key) {
9259
+ ownKeys$5(Object(source)).forEach(function(key) {
9193
9260
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
9194
9261
  });
9195
9262
  }
9196
9263
  return target;
9197
9264
  }
9198
9265
  function _sliced_to_array(arr, i) {
9199
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest();
9266
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest();
9200
9267
  }
9201
- function _unsupported_iterable_to_array$2(o, minLen) {
9268
+ function _unsupported_iterable_to_array$3(o, minLen) {
9202
9269
  if (!o) return;
9203
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
9270
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
9204
9271
  var n = Object.prototype.toString.call(o).slice(8, -1);
9205
9272
  if (n === "Object" && o.constructor) n = o.constructor.name;
9206
9273
  if (n === "Map" || n === "Set") return Array.from(n);
9207
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
9274
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
9208
9275
  }
9209
9276
  function _ts_generator$4(thisArg, body) {
9210
9277
  var f, y, t, _ = {
@@ -9348,6 +9415,7 @@ function _ts_generator$4(thisArg, body) {
9348
9415
  */ function storageFileServerActions(context) {
9349
9416
  return {
9350
9417
  createStorageFile: createStorageFileFactory(context),
9418
+ createStorageFileSignedUploadUrl: createStorageFileSignedUploadUrlFactory(context),
9351
9419
  initializeAllStorageFilesFromUploads: initializeAllStorageFilesFromUploadsFactory(context),
9352
9420
  initializeStorageFileFromUpload: initializeStorageFileFromUploadFactory(context),
9353
9421
  updateStorageFile: updateStorageFileFactory(context),
@@ -9396,6 +9464,152 @@ function _ts_generator$4(thisArg, body) {
9396
9464
  })();
9397
9465
  });
9398
9466
  }
9467
+ // Filenames must not contain slashes, spaces, or `..` parent-path segments.
9468
+ var _SIGNED_UPLOAD_URL_FILENAME_DISALLOWED_PATTERN = /[\\/ ]|\.{2}/;
9469
+ function _sanitizeSignedUploadUrlFilenameOrThrow(filename) {
9470
+ var trimmed = filename.trim();
9471
+ if (trimmed.length === 0 || trimmed.length > firebase.CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MAX_FILENAME_LENGTH) {
9472
+ throw firebaseServer.badRequestError({
9473
+ message: 'filename has invalid length',
9474
+ code: 'INVALID_FILENAME'
9475
+ });
9476
+ }
9477
+ if (_SIGNED_UPLOAD_URL_FILENAME_DISALLOWED_PATTERN.test(trimmed)) {
9478
+ throw firebaseServer.badRequestError({
9479
+ message: 'filename contains disallowed characters',
9480
+ code: 'INVALID_FILENAME'
9481
+ });
9482
+ }
9483
+ return trimmed.normalize('NFC');
9484
+ }
9485
+ function _clampSignedUploadUrlExpiresInMs(input) {
9486
+ var candidate = input !== null && input !== void 0 ? input : firebase.DEFAULT_CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_EXPIRES_IN_MS;
9487
+ return Math.min(Math.max(candidate, firebase.CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MIN_EXPIRES_IN_MS), firebase.CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MAX_EXPIRES_IN_MS);
9488
+ }
9489
+ function _resolveSignedUploadUrlPolicyOrThrow(policies, purpose) {
9490
+ var policy = policies.find(function(p) {
9491
+ return p.purpose === purpose;
9492
+ });
9493
+ if (!policy) {
9494
+ throw firebaseServer.badRequestError({
9495
+ message: 'purpose "'.concat(purpose, '" does not support signed upload URLs'),
9496
+ code: 'UNKNOWN_PURPOSE'
9497
+ });
9498
+ }
9499
+ return policy;
9500
+ }
9501
+ function _assertSignedUploadUrlContentTypeAllowed(policy, contentType) {
9502
+ if (!policy.allowedMimeTypes.includes(contentType)) {
9503
+ throw firebaseServer.badRequestError({
9504
+ message: 'content-type "'.concat(contentType, '" is not allowed for purpose "').concat(policy.purpose, '"'),
9505
+ code: 'INVALID_CONTENT_TYPE'
9506
+ });
9507
+ }
9508
+ }
9509
+ function _assertSignedUploadUrlFileSizeAllowed(policy, fileSizeBytes) {
9510
+ if (fileSizeBytes > policy.maxFileSizeBytes) {
9511
+ throw firebaseServer.badRequestError({
9512
+ message: "fileSizeBytes ".concat(fileSizeBytes, " exceeds policy max ").concat(policy.maxFileSizeBytes, ' for purpose "').concat(policy.purpose, '"'),
9513
+ code: 'FILE_TOO_LARGE'
9514
+ });
9515
+ }
9516
+ }
9517
+ function _resolveSignedUploadUrlFilenameOrThrow(policy, filename) {
9518
+ var resolved;
9519
+ if (policy.requiresFilenameInput) {
9520
+ if (!filename) {
9521
+ throw firebaseServer.badRequestError({
9522
+ message: 'filename is required for purpose "'.concat(policy.purpose, '"'),
9523
+ code: 'MISSING_FILENAME'
9524
+ });
9525
+ }
9526
+ resolved = _sanitizeSignedUploadUrlFilenameOrThrow(filename);
9527
+ }
9528
+ return resolved;
9529
+ }
9530
+ /**
9531
+ * Factory for the `createStorageFileSignedUploadUrl` action.
9532
+ *
9533
+ * Issues a short-lived, content-type-pinned signed PUT URL into the caller's
9534
+ * `/uploads/u/{uid}/...` namespace. The path, content-type, and size cap are
9535
+ * derived from the per-purpose policy resolved from the
9536
+ * `storageFileSignedUploadPolicies` registry on the context, so the URL can
9537
+ * only write to a location that both `storage.rules` and the
9538
+ * `StorageFileInitializeFromUploadService` initializer accept.
9539
+ *
9540
+ * Minting a URL does NOT create a StorageFile document — `result.modelKeys` is
9541
+ * always empty. The document is created later by the upload-complete pipeline.
9542
+ *
9543
+ * @param context - The storage file server actions context. Must carry
9544
+ * `storageFileSignedUploadPolicies` — the list of `StorageFilePurposeUploadPolicy` entries to resolve by purpose.
9545
+ * @returns An async transform-and-validate function whose inner stage takes
9546
+ * `{ uid }` (the authenticated user) and returns the signed-upload-url
9547
+ * payload.
9548
+ */ function createStorageFileSignedUploadUrlFactory(context) {
9549
+ var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, storageService = context.storageService, storageFileSignedUploadPolicies = context.storageFileSignedUploadPolicies;
9550
+ return firebaseServerActionTransformFunctionFactory(firebase.createStorageFileSignedUploadUrlParamsType, function(params) {
9551
+ return _async_to_generator$4(function() {
9552
+ var policy, filename, expiresInMs, contentType;
9553
+ return _ts_generator$4(this, function(_state) {
9554
+ policy = _resolveSignedUploadUrlPolicyOrThrow(storageFileSignedUploadPolicies, params.purpose);
9555
+ _assertSignedUploadUrlContentTypeAllowed(policy, params.contentType);
9556
+ _assertSignedUploadUrlFileSizeAllowed(policy, params.fileSizeBytes);
9557
+ filename = _resolveSignedUploadUrlFilenameOrThrow(policy, params.filename);
9558
+ expiresInMs = _clampSignedUploadUrlExpiresInMs(params.expiresInMs);
9559
+ contentType = params.contentType;
9560
+ return [
9561
+ 2,
9562
+ function(param) {
9563
+ var uid = param.uid;
9564
+ return _async_to_generator$4(function() {
9565
+ var pathString, expiresAtDate, file, uploadUrl;
9566
+ return _ts_generator$4(this, function(_state) {
9567
+ switch(_state.label){
9568
+ case 0:
9569
+ pathString = policy.buildUploadPath({
9570
+ uid: uid,
9571
+ filename: filename
9572
+ });
9573
+ expiresAtDate = util.addMilliseconds(new Date(), expiresInMs);
9574
+ file = storageService.file({
9575
+ pathString: pathString
9576
+ });
9577
+ if (!file.getSignedUrl) {
9578
+ throw firebaseServer.internalServerError('Signed url function appears to not be available.');
9579
+ }
9580
+ return [
9581
+ 4,
9582
+ file.getSignedUrl({
9583
+ action: 'write',
9584
+ expiresIn: expiresInMs,
9585
+ contentType: contentType
9586
+ })
9587
+ ];
9588
+ case 1:
9589
+ uploadUrl = _state.sent();
9590
+ return [
9591
+ 2,
9592
+ {
9593
+ modelKeys: [],
9594
+ uploadUrl: uploadUrl,
9595
+ uploadPath: pathString,
9596
+ expiresAt: expiresAtDate.getTime(),
9597
+ requiredHeaders: {
9598
+ 'content-type': contentType
9599
+ },
9600
+ maxFileSizeBytes: policy.maxFileSizeBytes,
9601
+ purpose: policy.purpose
9602
+ }
9603
+ ];
9604
+ }
9605
+ });
9606
+ })();
9607
+ }
9608
+ ];
9609
+ });
9610
+ })();
9611
+ });
9612
+ }
9399
9613
  /**
9400
9614
  * Factory for the `initializeAllStorageFilesFromUploads` action.
9401
9615
  *
@@ -9896,7 +10110,7 @@ function _ts_generator$4(thisArg, body) {
9896
10110
  },
9897
10111
  merge: function merge(existing, update) {
9898
10112
  var n = update.n === undefined ? existing.n : update.n;
9899
- return _object_spread_props$4(_object_spread$4({}, existing), {
10113
+ return _object_spread_props$5(_object_spread$5({}, existing), {
9900
10114
  n: n
9901
10115
  });
9902
10116
  }
@@ -10833,7 +11047,7 @@ function _ts_generator$4(thisArg, body) {
10833
11047
  inputNow = params.now, skipCreate = params.skipCreate, template = params.template;
10834
11048
  now = inputNow !== null && inputNow !== void 0 ? inputNow : new Date();
10835
11049
  storageFileGroupDocument = firebase.loadStorageFileGroupDocumentForReferencePair(params, storageFileGroupCollection.documentAccessorForTransaction(transaction));
10836
- storageFileGroupTemplate = _object_spread$4({
11050
+ storageFileGroupTemplate = _object_spread$5({
10837
11051
  o: firebase.firestoreDummyKey(),
10838
11052
  cat: now,
10839
11053
  s: true,
@@ -11555,7 +11769,7 @@ function _class_call_check$1(instance, Constructor) {
11555
11769
  throw new TypeError("Cannot call a class as a function");
11556
11770
  }
11557
11771
  }
11558
- function _define_property$3(obj, key, value) {
11772
+ function _define_property$4(obj, key, value) {
11559
11773
  if (key in obj) {
11560
11774
  Object.defineProperty(obj, key, {
11561
11775
  value: value,
@@ -11568,7 +11782,7 @@ function _define_property$3(obj, key, value) {
11568
11782
  }
11569
11783
  return obj;
11570
11784
  }
11571
- function _object_spread$3(target) {
11785
+ function _object_spread$4(target) {
11572
11786
  for(var i = 1; i < arguments.length; i++){
11573
11787
  var source = arguments[i] != null ? arguments[i] : {};
11574
11788
  var ownKeys = Object.keys(source);
@@ -11578,12 +11792,12 @@ function _object_spread$3(target) {
11578
11792
  }));
11579
11793
  }
11580
11794
  ownKeys.forEach(function(key) {
11581
- _define_property$3(target, key, source[key]);
11795
+ _define_property$4(target, key, source[key]);
11582
11796
  });
11583
11797
  }
11584
11798
  return target;
11585
11799
  }
11586
- function ownKeys$3(object, enumerableOnly) {
11800
+ function ownKeys$4(object, enumerableOnly) {
11587
11801
  var keys = Object.keys(object);
11588
11802
  if (Object.getOwnPropertySymbols) {
11589
11803
  var symbols = Object.getOwnPropertySymbols(object);
@@ -11591,12 +11805,12 @@ function ownKeys$3(object, enumerableOnly) {
11591
11805
  }
11592
11806
  return keys;
11593
11807
  }
11594
- function _object_spread_props$3(target, source) {
11808
+ function _object_spread_props$4(target, source) {
11595
11809
  source = source != null ? source : {};
11596
11810
  if (Object.getOwnPropertyDescriptors) {
11597
11811
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
11598
11812
  } else {
11599
- ownKeys$3(Object(source)).forEach(function(key) {
11813
+ ownKeys$4(Object(source)).forEach(function(key) {
11600
11814
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
11601
11815
  });
11602
11816
  }
@@ -11804,7 +12018,7 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
11804
12018
  initialized = true;
11805
12019
  return [
11806
12020
  4,
11807
- documentInTransaction.update(_object_spread_props$3(_object_spread$3({}, template), {
12021
+ documentInTransaction.update(_object_spread_props$4(_object_spread$4({}, template), {
11808
12022
  m: undefined,
11809
12023
  s: null,
11810
12024
  fi: false // set false
@@ -12056,6 +12270,148 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
12056
12270
  });
12057
12271
  }
12058
12272
 
12273
+ function _array_like_to_array$2(arr, len) {
12274
+ if (len == null || len > arr.length) len = arr.length;
12275
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
12276
+ return arr2;
12277
+ }
12278
+ function _array_without_holes$2(arr) {
12279
+ if (Array.isArray(arr)) return _array_like_to_array$2(arr);
12280
+ }
12281
+ function _define_property$3(obj, key, value) {
12282
+ if (key in obj) {
12283
+ Object.defineProperty(obj, key, {
12284
+ value: value,
12285
+ enumerable: true,
12286
+ configurable: true,
12287
+ writable: true
12288
+ });
12289
+ } else {
12290
+ obj[key] = value;
12291
+ }
12292
+ return obj;
12293
+ }
12294
+ function _iterable_to_array$2(iter) {
12295
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
12296
+ }
12297
+ function _non_iterable_spread$2() {
12298
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
12299
+ }
12300
+ function _object_spread$3(target) {
12301
+ for(var i = 1; i < arguments.length; i++){
12302
+ var source = arguments[i] != null ? arguments[i] : {};
12303
+ var ownKeys = Object.keys(source);
12304
+ if (typeof Object.getOwnPropertySymbols === "function") {
12305
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
12306
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
12307
+ }));
12308
+ }
12309
+ ownKeys.forEach(function(key) {
12310
+ _define_property$3(target, key, source[key]);
12311
+ });
12312
+ }
12313
+ return target;
12314
+ }
12315
+ function ownKeys$3(object, enumerableOnly) {
12316
+ var keys = Object.keys(object);
12317
+ if (Object.getOwnPropertySymbols) {
12318
+ var symbols = Object.getOwnPropertySymbols(object);
12319
+ keys.push.apply(keys, symbols);
12320
+ }
12321
+ return keys;
12322
+ }
12323
+ function _object_spread_props$3(target, source) {
12324
+ source = source != null ? source : {};
12325
+ if (Object.getOwnPropertyDescriptors) {
12326
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
12327
+ } else {
12328
+ ownKeys$3(Object(source)).forEach(function(key) {
12329
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
12330
+ });
12331
+ }
12332
+ return target;
12333
+ }
12334
+ function _to_consumable_array$2(arr) {
12335
+ return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$2();
12336
+ }
12337
+ function _type_of$1(obj) {
12338
+ "@swc/helpers - typeof";
12339
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
12340
+ }
12341
+ function _unsupported_iterable_to_array$2(o, minLen) {
12342
+ if (!o) return;
12343
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
12344
+ var n = Object.prototype.toString.call(o).slice(8, -1);
12345
+ if (n === "Object" && o.constructor) n = o.constructor.name;
12346
+ if (n === "Map" || n === "Set") return Array.from(n);
12347
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
12348
+ }
12349
+ /**
12350
+ * Builds the {@link McpToolDetailsBuilder} that customizes the MCP tool description and
12351
+ * input schema for the `storageFileCreateSignedUploadUrl` create-function.
12352
+ *
12353
+ * The factory captures the policy list once at wiring time; the returned builder is a pure
12354
+ * synchronous function called by the framework on every `tools/list` request.
12355
+ *
12356
+ * @param config - Factory config containing the upload policies that drive the description and `purpose` enum.
12357
+ * @returns A builder that emits the policy-aware tool description and an input schema with the `purpose` enum constrained to the configured purposes.
12358
+ *
12359
+ * @example
12360
+ * ```ts
12361
+ * const toolDetails = storageFileCreateSignedUploadUrlToolDetailsFactory({
12362
+ * policies: STORAGE_FILE_PURPOSE_UPLOAD_POLICIES
12363
+ * });
12364
+ * ```
12365
+ *
12366
+ * @__NO_SIDE_EFFECTS__
12367
+ */ function storageFileCreateSignedUploadUrlToolDetailsFactory(config) {
12368
+ var policies = config.policies;
12369
+ var purposeKeys = policies.map(function(policy) {
12370
+ return policy.purpose;
12371
+ });
12372
+ var description = buildUploadPolicyPurposeDescription(policies);
12373
+ return function(param) {
12374
+ var defaultInputSchema = param.defaultInputSchema;
12375
+ return {
12376
+ description: description,
12377
+ inputSchema: enrichSignedUploadUrlInputSchema(defaultInputSchema, purposeKeys)
12378
+ };
12379
+ };
12380
+ }
12381
+ function formatUploadPolicyMaxFileSize(maxFileSizeBytes) {
12382
+ var mib = maxFileSizeBytes / (1024 * 1024);
12383
+ return Number.isInteger(mib) ? "".concat(mib, " MiB") : "".concat(mib.toFixed(1), " MiB");
12384
+ }
12385
+ function buildUploadPolicyPurposeDescription(policies) {
12386
+ var lines = policies.map(function(policy) {
12387
+ var filenameNote = policy.requiresFilenameInput ? 'filename required' : 'filename derived from uid';
12388
+ return ' - "'.concat(policy.purpose, '": content-types ').concat(policy.allowedMimeTypes.join(', '), "; max ").concat(formatUploadPolicyMaxFileSize(policy.maxFileSizeBytes), "; ").concat(filenameNote);
12389
+ });
12390
+ return 'Issues a short-lived, content-type-pinned signed PUT URL for a StorageFile upload. The URL writes to "/uploads/u/{uid}/..." where the path, content-type, and size cap are pinned by the chosen purpose. PUT the bytes with a matching Content-Type header; the existing upload initializer then promotes the file to a StorageFile document.\n\nAllowed purposes:\n'.concat(lines.join('\n'));
12391
+ }
12392
+ function enrichSignedUploadUrlInputSchema(defaultInputSchema, purposeKeys) {
12393
+ var result = defaultInputSchema !== null && defaultInputSchema !== void 0 ? defaultInputSchema : undefined;
12394
+ if (defaultInputSchema != null && (typeof defaultInputSchema === "undefined" ? "undefined" : _type_of$1(defaultInputSchema)) === 'object') {
12395
+ var _base_properties;
12396
+ var base = defaultInputSchema;
12397
+ var purposeProperty = (_base_properties = base.properties) === null || _base_properties === void 0 ? void 0 : _base_properties.purpose;
12398
+ if (purposeProperty != null && (typeof purposeProperty === "undefined" ? "undefined" : _type_of$1(purposeProperty)) === 'object') {
12399
+ var quotedPurposes = purposeKeys.map(function(purpose) {
12400
+ return '"'.concat(purpose, '"');
12401
+ }).join(', ');
12402
+ result = _object_spread_props$3(_object_spread$3({}, base), {
12403
+ properties: _object_spread_props$3(_object_spread$3({}, base.properties), {
12404
+ purpose: _object_spread_props$3(_object_spread$3({}, purposeProperty), {
12405
+ enum: _to_consumable_array$2(purposeKeys),
12406
+ description: "One of: ".concat(quotedPurposes, ".")
12407
+ })
12408
+ })
12409
+ });
12410
+ }
12411
+ }
12412
+ return result;
12413
+ }
12414
+
12059
12415
  function _class_call_check(instance, Constructor) {
12060
12416
  if (!(instance instanceof Constructor)) {
12061
12417
  throw new TypeError("Cannot call a class as a function");
@@ -12145,17 +12501,26 @@ function _unsupported_iterable_to_array$1(o, minLen) {
12145
12501
  if (n === "Map" || n === "Set") return Array.from(n);
12146
12502
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
12147
12503
  }
12504
+ /**
12505
+ * NestJS injection token for the per-purpose `StorageFilePurposeUploadPolicy[]`
12506
+ * registry that the `createStorageFileSignedUploadUrl` factory consults.
12507
+ *
12508
+ * Apps bind this token via {@link appStorageFileModuleMetadata} by passing
12509
+ * `storageFileSignedUploadPolicies` in {@link ProvideAppStorageFileMetadataConfig}.
12510
+ */ var STORAGE_FILE_SIGNED_UPLOAD_POLICIES_TOKEN = 'STORAGE_FILE_SIGNED_UPLOAD_POLICIES';
12148
12511
  // MARK: Provider Factories
12149
12512
  /**
12150
12513
  * Factory that assembles the full {@link StorageFileServerActionsContext} by combining
12151
- * the base context with the upload initialization service.
12514
+ * the base context with the upload initialization service and the signed-upload policy registry.
12152
12515
  *
12153
12516
  * @param context - The base server actions context providing Firebase infrastructure.
12154
12517
  * @param storageFileInitializeFromUploadService - The service for initializing storage files from uploads.
12518
+ * @param storageFileSignedUploadPolicies - The per-purpose upload policy registry consulted by `createStorageFileSignedUploadUrl`.
12155
12519
  * @returns The fully assembled StorageFileServerActionsContext.
12156
- */ function storageFileServerActionsContextFactory(context, storageFileInitializeFromUploadService) {
12520
+ */ function storageFileServerActionsContextFactory(context, storageFileInitializeFromUploadService, storageFileSignedUploadPolicies) {
12157
12521
  return _object_spread_props$2(_object_spread$2({}, context), {
12158
- storageFileInitializeFromUploadService: storageFileInitializeFromUploadService
12522
+ storageFileInitializeFromUploadService: storageFileInitializeFromUploadService,
12523
+ storageFileSignedUploadPolicies: storageFileSignedUploadPolicies
12159
12524
  });
12160
12525
  }
12161
12526
  /**
@@ -12189,7 +12554,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
12189
12554
  * @param config - The module configuration including optional dependency module, imports, exports, and providers.
12190
12555
  * @returns The assembled {@link ModuleMetadata} for the storage file module.
12191
12556
  */ function appStorageFileModuleMetadata(config$1) {
12192
- var dependencyModule = config$1.dependencyModule, imports = config$1.imports, exports = config$1.exports, providers = config$1.providers;
12557
+ var dependencyModule = config$1.dependencyModule, imports = config$1.imports, exports = config$1.exports, providers = config$1.providers, storageFileSignedUploadPolicies = config$1.storageFileSignedUploadPolicies;
12193
12558
  var dependencyModuleImport = dependencyModule ? [
12194
12559
  dependencyModule
12195
12560
  ] : [];
@@ -12203,12 +12568,17 @@ function _unsupported_iterable_to_array$1(o, minLen) {
12203
12568
  StorageFileInitServerActions
12204
12569
  ].concat(_to_consumable_array$1(exports !== null && exports !== void 0 ? exports : [])),
12205
12570
  providers: [
12571
+ {
12572
+ provide: STORAGE_FILE_SIGNED_UPLOAD_POLICIES_TOKEN,
12573
+ useValue: storageFileSignedUploadPolicies
12574
+ },
12206
12575
  {
12207
12576
  provide: STORAGE_FILE_SERVER_ACTION_CONTEXT_TOKEN,
12208
12577
  useFactory: storageFileServerActionsContextFactory,
12209
12578
  inject: [
12210
12579
  BASE_STORAGE_FILE_SERVER_ACTION_CONTEXT_TOKEN,
12211
- StorageFileInitializeFromUploadService
12580
+ StorageFileInitializeFromUploadService,
12581
+ STORAGE_FILE_SIGNED_UPLOAD_POLICIES_TOKEN
12212
12582
  ]
12213
12583
  },
12214
12584
  {
@@ -13703,6 +14073,7 @@ exports.NotificationTaskSubTaskMissingRequiredDataTermination = NotificationTask
13703
14073
  exports.SEND_QUEUE_NOTIFICATIONS_TASK_EXCESS_THRESHOLD = SEND_QUEUE_NOTIFICATIONS_TASK_EXCESS_THRESHOLD;
13704
14074
  exports.STORAGE_FILE_INIT_SERVER_ACTIONS_CONTEXT_CONFIG_TOKEN = STORAGE_FILE_INIT_SERVER_ACTIONS_CONTEXT_CONFIG_TOKEN;
13705
14075
  exports.STORAGE_FILE_SERVER_ACTION_CONTEXT_TOKEN = STORAGE_FILE_SERVER_ACTION_CONTEXT_TOKEN;
14076
+ exports.STORAGE_FILE_SIGNED_UPLOAD_POLICIES_TOKEN = STORAGE_FILE_SIGNED_UPLOAD_POLICIES_TOKEN;
13706
14077
  exports.StorageFileInitServerActions = StorageFileInitServerActions;
13707
14078
  exports.StorageFileInitializeFromUploadService = StorageFileInitializeFromUploadService;
13708
14079
  exports.StorageFileServerActions = StorageFileServerActions;
@@ -13730,6 +14101,7 @@ exports.createStorageFileFactory = createStorageFileFactory;
13730
14101
  exports.createStorageFileGroupFactory = createStorageFileGroupFactory;
13731
14102
  exports.createStorageFileGroupInTransactionFactory = createStorageFileGroupInTransactionFactory;
13732
14103
  exports.createStorageFileGroupInputError = createStorageFileGroupInputError;
14104
+ exports.createStorageFileSignedUploadUrlFactory = createStorageFileSignedUploadUrlFactory;
13733
14105
  exports.deleteAllQueuedStorageFilesFactory = deleteAllQueuedStorageFilesFactory;
13734
14106
  exports.deleteStorageFileFactory = deleteStorageFileFactory;
13735
14107
  exports.downloadMultipleStorageFilesFactory = downloadMultipleStorageFilesFactory;
@@ -13785,6 +14157,7 @@ exports.sendNotificationFactory = sendNotificationFactory;
13785
14157
  exports.sendQueuedNotificationsFactory = sendQueuedNotificationsFactory;
13786
14158
  exports.storageFileAlreadyProcessedError = storageFileAlreadyProcessedError;
13787
14159
  exports.storageFileCannotBeDeletedYetError = storageFileCannotBeDeletedYetError;
14160
+ exports.storageFileCreateSignedUploadUrlToolDetailsFactory = storageFileCreateSignedUploadUrlToolDetailsFactory;
13788
14161
  exports.storageFileGroupQueuedForInitializationError = storageFileGroupQueuedForInitializationError;
13789
14162
  exports.storageFileGroupZipStorageFileProcessingPurposeSubtaskProcessor = storageFileGroupZipStorageFileProcessingPurposeSubtaskProcessor;
13790
14163
  exports.storageFileInitServerActions = storageFileInitServerActions;