@dereekb/firebase-server 13.38.0 → 13.40.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 (41) hide show
  1. package/calcom/package.json +15 -15
  2. package/discord/package.json +15 -15
  3. package/mailgun/package.json +14 -14
  4. package/mcp/package.json +16 -16
  5. package/model/package.json +14 -14
  6. package/model/src/lib/notification/notification.module.d.ts +1 -1
  7. package/oidc/package.json +15 -15
  8. package/package.json +36 -45
  9. package/test/package.json +16 -16
  10. package/twilio/package.json +13 -13
  11. package/zoho/package.json +15 -15
  12. package/calcom/index.cjs.default.js +0 -1
  13. package/calcom/index.cjs.js +0 -1451
  14. package/calcom/index.cjs.mjs +0 -2
  15. package/discord/index.cjs.default.js +0 -1
  16. package/discord/index.cjs.js +0 -761
  17. package/discord/index.cjs.mjs +0 -2
  18. package/index.cjs.default.js +0 -1
  19. package/index.cjs.js +0 -14713
  20. package/index.cjs.mjs +0 -2
  21. package/mailgun/index.cjs.default.js +0 -1
  22. package/mailgun/index.cjs.js +0 -436
  23. package/mailgun/index.cjs.mjs +0 -2
  24. package/mcp/index.cjs.default.js +0 -1
  25. package/mcp/index.cjs.js +0 -8781
  26. package/mcp/index.cjs.mjs +0 -2
  27. package/model/index.cjs.default.js +0 -1
  28. package/model/index.cjs.js +0 -19965
  29. package/model/index.cjs.mjs +0 -2
  30. package/oidc/index.cjs.default.js +0 -1
  31. package/oidc/index.cjs.js +0 -8085
  32. package/oidc/index.cjs.mjs +0 -2
  33. package/test/index.cjs.default.js +0 -1
  34. package/test/index.cjs.js +0 -5728
  35. package/test/index.cjs.mjs +0 -2
  36. package/twilio/index.cjs.default.js +0 -1
  37. package/twilio/index.cjs.js +0 -404
  38. package/twilio/index.cjs.mjs +0 -2
  39. package/zoho/index.cjs.default.js +0 -1
  40. package/zoho/index.cjs.js +0 -1810
  41. package/zoho/index.cjs.mjs +0 -2
@@ -1,2 +0,0 @@
1
- export * from './index.cjs.js';
2
- export { _default as default } from './index.cjs.default.js';
@@ -1 +0,0 @@
1
- exports._default = require('./index.cjs.js').default;
@@ -1,404 +0,0 @@
1
- 'use strict';
2
-
3
- var util = require('@dereekb/util');
4
-
5
- function _array_like_to_array(arr, len) {
6
- if (len == null || len > arr.length) len = arr.length;
7
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
8
- return arr2;
9
- }
10
- function _array_with_holes(arr) {
11
- if (Array.isArray(arr)) return arr;
12
- }
13
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
14
- try {
15
- var info = gen[key](arg);
16
- var value = info.value;
17
- } catch (error) {
18
- reject(error);
19
- return;
20
- }
21
- if (info.done) {
22
- resolve(value);
23
- } else {
24
- Promise.resolve(value).then(_next, _throw);
25
- }
26
- }
27
- function _async_to_generator(fn) {
28
- return function() {
29
- var self = this, args = arguments;
30
- return new Promise(function(resolve, reject) {
31
- var gen = fn.apply(self, args);
32
- function _next(value) {
33
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
34
- }
35
- function _throw(err) {
36
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
37
- }
38
- _next(undefined);
39
- });
40
- };
41
- }
42
- function _iterable_to_array_limit(arr, i) {
43
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
44
- if (_i == null) return;
45
- var _arr = [];
46
- var _n = true;
47
- var _d = false;
48
- var _s, _e;
49
- try {
50
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
51
- _arr.push(_s.value);
52
- if (i && _arr.length === i) break;
53
- }
54
- } catch (err) {
55
- _d = true;
56
- _e = err;
57
- } finally{
58
- try {
59
- if (!_n && _i["return"] != null) _i["return"]();
60
- } finally{
61
- if (_d) throw _e;
62
- }
63
- }
64
- return _arr;
65
- }
66
- function _non_iterable_rest() {
67
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
68
- }
69
- function _sliced_to_array(arr, i) {
70
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
71
- }
72
- function _unsupported_iterable_to_array(o, minLen) {
73
- if (!o) return;
74
- if (typeof o === "string") return _array_like_to_array(o, minLen);
75
- var n = Object.prototype.toString.call(o).slice(8, -1);
76
- if (n === "Object" && o.constructor) n = o.constructor.name;
77
- if (n === "Map" || n === "Set") return Array.from(n);
78
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
79
- }
80
- function _ts_generator(thisArg, body) {
81
- var f, y, t, _ = {
82
- label: 0,
83
- sent: function() {
84
- if (t[0] & 1) throw t[1];
85
- return t[1];
86
- },
87
- trys: [],
88
- ops: []
89
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
90
- return d(g, "next", {
91
- value: verb(0)
92
- }), d(g, "throw", {
93
- value: verb(1)
94
- }), d(g, "return", {
95
- value: verb(2)
96
- }), typeof Symbol === "function" && d(g, Symbol.iterator, {
97
- value: function() {
98
- return this;
99
- }
100
- }), g;
101
- function verb(n) {
102
- return function(v) {
103
- return step([
104
- n,
105
- v
106
- ]);
107
- };
108
- }
109
- function step(op) {
110
- if (f) throw new TypeError("Generator is already executing.");
111
- while(g && (g = 0, op[0] && (_ = 0)), _)try {
112
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
113
- if (y = 0, t) op = [
114
- op[0] & 2,
115
- t.value
116
- ];
117
- switch(op[0]){
118
- case 0:
119
- case 1:
120
- t = op;
121
- break;
122
- case 4:
123
- _.label++;
124
- return {
125
- value: op[1],
126
- done: false
127
- };
128
- case 5:
129
- _.label++;
130
- y = op[1];
131
- op = [
132
- 0
133
- ];
134
- continue;
135
- case 7:
136
- op = _.ops.pop();
137
- _.trys.pop();
138
- continue;
139
- default:
140
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
141
- _ = 0;
142
- continue;
143
- }
144
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
145
- _.label = op[1];
146
- break;
147
- }
148
- if (op[0] === 6 && _.label < t[1]) {
149
- _.label = t[1];
150
- t = op;
151
- break;
152
- }
153
- if (t && _.label < t[2]) {
154
- _.label = t[2];
155
- _.ops.push(op);
156
- break;
157
- }
158
- if (t[2]) _.ops.pop();
159
- _.trys.pop();
160
- continue;
161
- }
162
- op = body.call(thisArg, _);
163
- } catch (e) {
164
- op = [
165
- 6,
166
- e
167
- ];
168
- y = 0;
169
- } finally{
170
- f = t = 0;
171
- }
172
- if (op[0] & 5) throw op[1];
173
- return {
174
- value: op[0] ? op[1] : void 0,
175
- done: true
176
- };
177
- }
178
- }
179
- /**
180
- * Default max-batch-size used by {@link twilioNotificationTextSendService}.
181
- */ var DEFAULT_TWILIO_NOTIFICATION_TEXT_SEND_SERVICE_MAX_BATCH_SIZE_PER_REQUEST = 50;
182
- /**
183
- * Sentinel template name used when a message has no `sendTemplateName`. Routed to the
184
- * built-in default builder unless the consumer overrides it.
185
- */ var DEFAULT_TWILIO_NOTIFICATION_TEMPLATE_NAME = '_twilio_default';
186
- /**
187
- * Maximum SMS body length we send to Twilio. Twilio itself can accept up to 1600 characters
188
- * per request and will segment as needed; bodies are truncated past this length.
189
- */ var TWILIO_NOTIFICATION_BODY_MAX_LENGTH = 1600;
190
- /**
191
- * Default {@link TwilioNotificationTextSendServiceTemplateBuilder} that builds one SMS per
192
- * recipient using the message's `textContent.openingMessage` (falling back to `content.title`)
193
- * as the body.
194
- *
195
- * Messages without a recipient phone number are skipped here; the calling service routes them
196
- * to `ignored` in the final result.
197
- *
198
- * @param input - Builder input containing the messages and shared defaults.
199
- * @param input.messages - Notification messages to convert to SMS inputs.
200
- * @param input.defaults - Shared sender/callback defaults applied to each built SMS.
201
- * @returns Array of {@link TwilioSendSmsInput} ready for dispatch.
202
- */ var defaultTwilioNotificationTextSendServiceTemplateBuilder = function defaultTwilioNotificationTextSendServiceTemplateBuilder(param) {
203
- var messages = param.messages, defaults = param.defaults;
204
- var inputs = [];
205
- messages.forEach(function(message) {
206
- var phone = message.inputContext.recipient.t;
207
- if (phone) {
208
- var _message_textContent;
209
- var body = bodyFromNotificationMessageContent((_message_textContent = message.textContent) !== null && _message_textContent !== void 0 ? _message_textContent : message.content);
210
- if (body) {
211
- inputs.push({
212
- to: phone,
213
- body: body,
214
- from: defaults.defaultFrom,
215
- messagingServiceSid: defaults.messagingServiceSid,
216
- statusCallback: defaults.statusCallback
217
- });
218
- }
219
- }
220
- });
221
- return inputs;
222
- };
223
- /**
224
- * Creates a {@link NotificationTextSendService} that dispatches notification SMS through Twilio.
225
- *
226
- * Groups messages by their `sendTemplateName`, batches them (up to `maxBatchSizePerRequest`),
227
- * converts each batch to {@link TwilioSendSmsInput}s via the matching template builder
228
- * (or the built-in default), and dispatches them through {@link TwilioService.sendBulkSms}.
229
- *
230
- * Messages missing a recipient phone are routed to `ignored` in the result.
231
- *
232
- * @param config - Service configuration including the Twilio service, template builders, and batch size.
233
- * @returns A {@link NotificationTextSendService} that batches and sends SMS through Twilio.
234
- *
235
- * @example
236
- * ```ts
237
- * const textService = twilioNotificationTextSendService({ twilioService });
238
- *
239
- * const sendInstance = await textService.buildSendInstanceForTextNotificationMessages(messages);
240
- * const result = await sendInstance();
241
- * // result.success/failed/ignored are E164PhoneNumber arrays
242
- * ```
243
- */ function twilioNotificationTextSendService(config) {
244
- var twilioService = config.twilioService, defaultFrom = config.defaultFrom, messagingServiceSid = config.messagingServiceSid, statusCallbackUrl = config.statusCallbackUrl, inputMaxBatchSizePerRequest = config.maxBatchSizePerRequest, inputMessageBuilders = config.messageBuilders, inputDefaultMessageBuilder = config.defaultMessageBuilder;
245
- var defaultBuilder = inputDefaultMessageBuilder !== null && inputDefaultMessageBuilder !== void 0 ? inputDefaultMessageBuilder : defaultTwilioNotificationTextSendServiceTemplateBuilder;
246
- var lowercaseKeysMessageBuilders = inputMessageBuilders ? util.mapObjectKeysToLowercase(inputMessageBuilders) : undefined;
247
- var maxBatchSizePerRequest = inputMaxBatchSizePerRequest !== null && inputMaxBatchSizePerRequest !== void 0 ? inputMaxBatchSizePerRequest : DEFAULT_TWILIO_NOTIFICATION_TEXT_SEND_SERVICE_MAX_BATCH_SIZE_PER_REQUEST;
248
- var defaults = {
249
- defaultFrom: defaultFrom,
250
- messagingServiceSid: messagingServiceSid,
251
- statusCallback: statusCallbackUrl
252
- };
253
- var sendService = {
254
- buildSendInstanceForTextNotificationMessages: function buildSendInstanceForTextNotificationMessages(notificationMessages) {
255
- return _async_to_generator(function() {
256
- var groupedMessages, messageSendBatches, buildInputArrays, sendInputs, sendFn;
257
- return _ts_generator(this, function(_state) {
258
- switch(_state.label){
259
- case 0:
260
- groupedMessages = util.multiValueMapBuilder();
261
- // Messages without a recipient phone number are dropped here — there is nothing for
262
- // Twilio to do with them, and the result is keyed by E164 phone so we cannot record
263
- // them in `ignored` either.
264
- notificationMessages.forEach(function(message) {
265
- var phone = message.inputContext.recipient.t;
266
- if (phone) {
267
- var _ref, _ref1;
268
- var _message_textContent;
269
- var sendTemplateName = (_ref = (_ref1 = (_message_textContent = message.textContent) === null || _message_textContent === void 0 ? void 0 : _message_textContent.sendTemplateName) !== null && _ref1 !== void 0 ? _ref1 : message.content.sendTemplateName) !== null && _ref !== void 0 ? _ref : DEFAULT_TWILIO_NOTIFICATION_TEMPLATE_NAME;
270
- groupedMessages.add(sendTemplateName, message);
271
- }
272
- });
273
- messageSendBatches = groupedMessages.entries().flatMap(function(param) {
274
- var _param = _sliced_to_array(param, 2), templateType = _param[0], messages = _param[1];
275
- return util.batch(messages, maxBatchSizePerRequest).map(function(x) {
276
- return [
277
- templateType,
278
- x
279
- ];
280
- });
281
- });
282
- return [
283
- 4,
284
- Promise.all(messageSendBatches.map(function(param) {
285
- var _param = _sliced_to_array(param, 2), sendTemplateName = _param[0], messages = _param[1];
286
- return _async_to_generator(function() {
287
- var _ref, builder;
288
- return _ts_generator(this, function(_state) {
289
- builder = (_ref = lowercaseKeysMessageBuilders === null || lowercaseKeysMessageBuilders === void 0 ? void 0 : lowercaseKeysMessageBuilders[sendTemplateName.toLowerCase()]) !== null && _ref !== void 0 ? _ref : defaultBuilder;
290
- return [
291
- 2,
292
- builder({
293
- twilioService: twilioService,
294
- sendTemplateName: sendTemplateName,
295
- messages: messages,
296
- defaults: defaults
297
- })
298
- ];
299
- });
300
- })();
301
- }))
302
- ];
303
- case 1:
304
- buildInputArrays = _state.sent();
305
- sendInputs = buildInputArrays.flatMap(function(x) {
306
- return util.asArray(x);
307
- });
308
- sendFn = function sendFn() {
309
- return _async_to_generator(function() {
310
- var success, failed, ignored, result;
311
- return _ts_generator(this, function(_state) {
312
- switch(_state.label){
313
- case 0:
314
- success = [];
315
- failed = [];
316
- ignored = [];
317
- return [
318
- 4,
319
- util.runAsyncTasksForValues(util.batch(sendInputs, maxBatchSizePerRequest), function(inputBatch) {
320
- return _async_to_generator(function() {
321
- var results;
322
- return _ts_generator(this, function(_state) {
323
- switch(_state.label){
324
- case 0:
325
- return [
326
- 4,
327
- twilioService.sendBulkSms(inputBatch)
328
- ];
329
- case 1:
330
- results = _state.sent();
331
- results.forEach(function(result) {
332
- if (result.error || result.status === 'failed' || result.status === 'undelivered') {
333
- util.pushArrayItemsIntoArray(failed, [
334
- result.to
335
- ]);
336
- } else if (result.sandboxed) {
337
- util.pushArrayItemsIntoArray(ignored, [
338
- result.to
339
- ]);
340
- } else {
341
- util.pushArrayItemsIntoArray(success, [
342
- result.to
343
- ]);
344
- }
345
- });
346
- return [
347
- 2
348
- ];
349
- }
350
- });
351
- })();
352
- }, {
353
- maxParallelTasks: 3
354
- })
355
- ];
356
- case 1:
357
- _state.sent();
358
- result = {
359
- success: success,
360
- failed: failed,
361
- ignored: ignored
362
- };
363
- return [
364
- 2,
365
- result
366
- ];
367
- }
368
- });
369
- })();
370
- };
371
- return [
372
- 2,
373
- sendFn
374
- ];
375
- }
376
- });
377
- })();
378
- }
379
- };
380
- return sendService;
381
- }
382
- function bodyFromNotificationMessageContent(content) {
383
- var parts = [];
384
- if (content.title) {
385
- parts.push(content.title);
386
- }
387
- if (content.openingMessage) {
388
- parts.push(content.openingMessage);
389
- }
390
- if (content.closingMessage) {
391
- parts.push(content.closingMessage);
392
- }
393
- if (content.actionUrl) {
394
- parts.push(content.actionUrl);
395
- }
396
- var joined = parts.join('\n').trim();
397
- return joined.length > TWILIO_NOTIFICATION_BODY_MAX_LENGTH ? joined.slice(0, TWILIO_NOTIFICATION_BODY_MAX_LENGTH) : joined;
398
- }
399
-
400
- exports.DEFAULT_TWILIO_NOTIFICATION_TEMPLATE_NAME = DEFAULT_TWILIO_NOTIFICATION_TEMPLATE_NAME;
401
- exports.DEFAULT_TWILIO_NOTIFICATION_TEXT_SEND_SERVICE_MAX_BATCH_SIZE_PER_REQUEST = DEFAULT_TWILIO_NOTIFICATION_TEXT_SEND_SERVICE_MAX_BATCH_SIZE_PER_REQUEST;
402
- exports.TWILIO_NOTIFICATION_BODY_MAX_LENGTH = TWILIO_NOTIFICATION_BODY_MAX_LENGTH;
403
- exports.defaultTwilioNotificationTextSendServiceTemplateBuilder = defaultTwilioNotificationTextSendServiceTemplateBuilder;
404
- exports.twilioNotificationTextSendService = twilioNotificationTextSendService;
@@ -1,2 +0,0 @@
1
- export * from './index.cjs.js';
2
- export { _default as default } from './index.cjs.default.js';
@@ -1 +0,0 @@
1
- exports._default = require('./index.cjs.js').default;