@sipgate/integration-bridge 0.1.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 (99) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +82 -0
  3. package/dist/cache/index.d.ts +1 -0
  4. package/dist/cache/index.js +18 -0
  5. package/dist/cache/index.js.map +1 -0
  6. package/dist/cache/storage/index.d.ts +2 -0
  7. package/dist/cache/storage/index.js +19 -0
  8. package/dist/cache/storage/index.js.map +1 -0
  9. package/dist/cache/storage/memory-storage-adapter.d.ts +8 -0
  10. package/dist/cache/storage/memory-storage-adapter.js +48 -0
  11. package/dist/cache/storage/memory-storage-adapter.js.map +1 -0
  12. package/dist/cache/storage/redis-storage-adapter.d.ts +8 -0
  13. package/dist/cache/storage/redis-storage-adapter.js +61 -0
  14. package/dist/cache/storage/redis-storage-adapter.js.map +1 -0
  15. package/dist/cache/storage-cache.d.ts +12 -0
  16. package/dist/cache/storage-cache.js +114 -0
  17. package/dist/cache/storage-cache.js.map +1 -0
  18. package/dist/index.d.ts +5 -0
  19. package/dist/index.js +58 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/middlewares/error-handler.middleware.d.ts +3 -0
  22. package/dist/middlewares/error-handler.middleware.js +13 -0
  23. package/dist/middlewares/error-handler.middleware.js.map +1 -0
  24. package/dist/middlewares/extract-header.middleware.d.ts +3 -0
  25. package/dist/middlewares/extract-header.middleware.js +17 -0
  26. package/dist/middlewares/extract-header.middleware.js.map +1 -0
  27. package/dist/middlewares/index.d.ts +2 -0
  28. package/dist/middlewares/index.js +19 -0
  29. package/dist/middlewares/index.js.map +1 -0
  30. package/dist/models/adapter.model.d.ts +23 -0
  31. package/dist/models/adapter.model.js +3 -0
  32. package/dist/models/adapter.model.js.map +1 -0
  33. package/dist/models/bridge-request.model.d.ts +5 -0
  34. package/dist/models/bridge-request.model.js +3 -0
  35. package/dist/models/bridge-request.model.js.map +1 -0
  36. package/dist/models/calendar-event.model.d.ts +10 -0
  37. package/dist/models/calendar-event.model.js +3 -0
  38. package/dist/models/calendar-event.model.js.map +1 -0
  39. package/dist/models/calendar-filter-options.model.d.ts +4 -0
  40. package/dist/models/calendar-filter-options.model.js +3 -0
  41. package/dist/models/calendar-filter-options.model.js.map +1 -0
  42. package/dist/models/call-direction.enum.d.ts +4 -0
  43. package/dist/models/call-direction.enum.js +9 -0
  44. package/dist/models/call-direction.enum.js.map +1 -0
  45. package/dist/models/call-event.model.d.ts +11 -0
  46. package/dist/models/call-event.model.js +3 -0
  47. package/dist/models/call-event.model.js.map +1 -0
  48. package/dist/models/channel.model.d.ts +4 -0
  49. package/dist/models/channel.model.js +3 -0
  50. package/dist/models/channel.model.js.map +1 -0
  51. package/dist/models/config.model.d.ts +11 -0
  52. package/dist/models/config.model.js +3 -0
  53. package/dist/models/config.model.js.map +1 -0
  54. package/dist/models/contact-cache.model.d.ts +8 -0
  55. package/dist/models/contact-cache.model.js +3 -0
  56. package/dist/models/contact-cache.model.js.map +1 -0
  57. package/dist/models/contact.model.d.ts +40 -0
  58. package/dist/models/contact.model.js +20 -0
  59. package/dist/models/contact.model.js.map +1 -0
  60. package/dist/models/controller.model.d.ts +21 -0
  61. package/dist/models/controller.model.js +397 -0
  62. package/dist/models/controller.model.js.map +1 -0
  63. package/dist/models/index.d.ts +13 -0
  64. package/dist/models/index.js +30 -0
  65. package/dist/models/index.js.map +1 -0
  66. package/dist/models/server-error.model.d.ts +4 -0
  67. package/dist/models/server-error.model.js +11 -0
  68. package/dist/models/server-error.model.js.map +1 -0
  69. package/dist/models/storage-adapter.model.d.ts +5 -0
  70. package/dist/models/storage-adapter.model.js +3 -0
  71. package/dist/models/storage-adapter.model.js.map +1 -0
  72. package/dist/models/user.model.d.ts +6 -0
  73. package/dist/models/user.model.js +3 -0
  74. package/dist/models/user.model.js.map +1 -0
  75. package/dist/schemas/calendar-events.d.ts +29 -0
  76. package/dist/schemas/calendar-events.js +33 -0
  77. package/dist/schemas/calendar-events.js.map +1 -0
  78. package/dist/schemas/contacts.d.ts +54 -0
  79. package/dist/schemas/contacts.js +68 -0
  80. package/dist/schemas/contacts.js.map +1 -0
  81. package/dist/schemas/index.d.ts +2 -0
  82. package/dist/schemas/index.js +19 -0
  83. package/dist/schemas/index.js.map +1 -0
  84. package/dist/util/anonymize-key.d.ts +1 -0
  85. package/dist/util/anonymize-key.js +9 -0
  86. package/dist/util/anonymize-key.js.map +1 -0
  87. package/dist/util/get-contact-cache.d.ts +2 -0
  88. package/dist/util/get-contact-cache.js +20 -0
  89. package/dist/util/get-contact-cache.js.map +1 -0
  90. package/dist/util/phone-number-utils.d.ts +1 -0
  91. package/dist/util/phone-number-utils.js +17 -0
  92. package/dist/util/phone-number-utils.js.map +1 -0
  93. package/dist/util/size-of.d.ts +1 -0
  94. package/dist/util/size-of.js +46 -0
  95. package/dist/util/size-of.js.map +1 -0
  96. package/dist/util/validate.d.ts +2 -0
  97. package/dist/util/validate.js +20 -0
  98. package/dist/util/validate.js.map +1 -0
  99. package/package.json +89 -0
@@ -0,0 +1,397 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.Controller = void 0;
16
+ const ajv_1 = __importDefault(require("ajv"));
17
+ const querystring_1 = require("querystring");
18
+ const _1 = require(".");
19
+ const schemas_1 = require("../schemas");
20
+ const anonymize_key_1 = require("../util/anonymize-key");
21
+ const phone_number_utils_1 = require("../util/phone-number-utils");
22
+ const validate_1 = require("../util/validate");
23
+ const contact_model_1 = require("./contact.model");
24
+ const CONTACT_FETCH_TIMEOUT = 3000;
25
+ function sanitizeContact(contact, locale) {
26
+ const result = Object.assign(Object.assign({}, contact), { phoneNumbers: contact.phoneNumbers.map((phoneNumber) => (Object.assign(Object.assign({}, phoneNumber), { phoneNumber: phoneNumber.label === contact_model_1.PhoneNumberLabel.DIRECTDIAL
27
+ ? phoneNumber.phoneNumber
28
+ : (0, phone_number_utils_1.convertPhoneNumberToE164)(phoneNumber.phoneNumber, locale) }))) });
29
+ return result;
30
+ }
31
+ class Controller {
32
+ constructor(adapter, contactCache) {
33
+ this.adapter = adapter;
34
+ this.contactCache = contactCache;
35
+ this.ajv = new ajv_1.default();
36
+ this.getContacts = this.getContacts.bind(this);
37
+ this.createContact = this.createContact.bind(this);
38
+ this.updateContact = this.updateContact.bind(this);
39
+ this.deleteContact = this.deleteContact.bind(this);
40
+ this.getCalendarEvents = this.getCalendarEvents.bind(this);
41
+ this.createCalendarEvent = this.createCalendarEvent.bind(this);
42
+ this.updateCalendarEvent = this.updateCalendarEvent.bind(this);
43
+ this.deleteCalendarEvent = this.deleteCalendarEvent.bind(this);
44
+ this.handleCallEvent = this.handleCallEvent.bind(this);
45
+ this.handleConnectedEvent = this.handleConnectedEvent.bind(this);
46
+ this.getHealth = this.getHealth.bind(this);
47
+ this.oAuth2Redirect = this.oAuth2Redirect.bind(this);
48
+ this.oAuth2Callback = this.oAuth2Callback.bind(this);
49
+ }
50
+ getContacts(req, res, next) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const { providerConfig: { apiKey = "", locale = "" } = {} } = req;
53
+ try {
54
+ const fetchContacts = () => __awaiter(this, void 0, void 0, function* () {
55
+ if (!this.adapter.getContacts) {
56
+ throw new _1.ServerError(501, "Fetching contacts is not implemented");
57
+ }
58
+ if (!req.providerConfig) {
59
+ console.error("Missing config parameters");
60
+ return null;
61
+ }
62
+ console.log(`Fetching contacts for key "${(0, anonymize_key_1.anonymizeKey)(apiKey)}"`);
63
+ const fetchedContacts = yield this.adapter.getContacts(req.providerConfig);
64
+ return (0, validate_1.validate)(this.ajv, schemas_1.contactsSchema, fetchedContacts)
65
+ ? fetchedContacts.map((contact) => sanitizeContact(contact, locale))
66
+ : null;
67
+ });
68
+ const fetcherPromise = this.contactCache
69
+ ? this.contactCache.get(apiKey, fetchContacts)
70
+ : fetchContacts();
71
+ const timeoutPromise = new Promise((resolve) => setTimeout(() => resolve({ status: 408, description: "Request is still fetching" }), CONTACT_FETCH_TIMEOUT));
72
+ const result = yield Promise.race([fetcherPromise, timeoutPromise]);
73
+ if (result && "status" in result) {
74
+ res.status(result.status);
75
+ res.send(result);
76
+ return;
77
+ }
78
+ const responseContacts = result || [];
79
+ console.log(`Found ${responseContacts.length} cached contacts for key "${(0, anonymize_key_1.anonymizeKey)(apiKey)}"`);
80
+ if (this.adapter.getToken && req.providerConfig) {
81
+ const { apiKey } = yield this.adapter.getToken(req.providerConfig);
82
+ res.header("X-Provider-Key", apiKey);
83
+ }
84
+ res.send(responseContacts);
85
+ }
86
+ catch (error) {
87
+ console.error("Could not get contacts:", error || "Unknown");
88
+ next(error);
89
+ }
90
+ });
91
+ }
92
+ createContact(req, res, next) {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ const { providerConfig: { apiKey = "", locale = "" } = {} } = req;
95
+ try {
96
+ if (!this.adapter.createContact) {
97
+ throw new _1.ServerError(501, "Creating contacts is not implemented");
98
+ }
99
+ if (!req.providerConfig) {
100
+ throw new _1.ServerError(400, "Missing config parameters");
101
+ }
102
+ console.log(`Creating contact for key "${(0, anonymize_key_1.anonymizeKey)(apiKey)}"`);
103
+ const contact = yield this.adapter.createContact(req.providerConfig, req.body);
104
+ const valid = (0, validate_1.validate)(this.ajv, schemas_1.contactsSchema, [contact]);
105
+ if (!valid) {
106
+ console.error("Invalid contact provided by adapter", this.ajv.errorsText());
107
+ throw new _1.ServerError(400, "Invalid contact provided by adapter");
108
+ }
109
+ const sanitizedContact = sanitizeContact(contact, locale);
110
+ if (this.adapter.getToken && req.providerConfig) {
111
+ const { apiKey } = yield this.adapter.getToken(req.providerConfig);
112
+ res.header("X-Provider-Key", apiKey);
113
+ }
114
+ res.send(sanitizedContact);
115
+ if (this.contactCache) {
116
+ const cached = yield this.contactCache.get(apiKey);
117
+ if (cached) {
118
+ yield this.contactCache.set(apiKey, [...cached, sanitizedContact]);
119
+ }
120
+ }
121
+ }
122
+ catch (error) {
123
+ console.error("Could not create contact:", error || "Unknown");
124
+ next(error);
125
+ }
126
+ });
127
+ }
128
+ updateContact(req, res, next) {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ const { providerConfig: { apiKey = "", locale = "" } = {} } = req;
131
+ try {
132
+ if (!this.adapter.updateContact) {
133
+ throw new _1.ServerError(501, "Updating contacts is not implemented");
134
+ }
135
+ if (!req.providerConfig) {
136
+ throw new _1.ServerError(400, "Missing config parameters");
137
+ }
138
+ console.log(`Updating contact for key "${(0, anonymize_key_1.anonymizeKey)(apiKey)}"`);
139
+ const contact = yield this.adapter.updateContact(req.providerConfig, req.params.id, req.body);
140
+ const valid = (0, validate_1.validate)(this.ajv, schemas_1.contactsSchema, [contact]);
141
+ if (!valid) {
142
+ console.error("Invalid contact provided by adapter", this.ajv.errorsText());
143
+ throw new _1.ServerError(400, "Invalid contact provided by adapter");
144
+ }
145
+ const sanitizedContact = sanitizeContact(contact, locale);
146
+ if (this.adapter.getToken && req.providerConfig) {
147
+ const { apiKey } = yield this.adapter.getToken(req.providerConfig);
148
+ res.header("X-Provider-Key", apiKey);
149
+ }
150
+ res.send(sanitizedContact);
151
+ if (this.contactCache) {
152
+ const cachedContacts = yield this.contactCache.get(apiKey);
153
+ if (cachedContacts) {
154
+ const updatedCache = cachedContacts.map((entry) => entry.id === sanitizedContact.id ? sanitizedContact : entry);
155
+ yield this.contactCache.set(apiKey, updatedCache);
156
+ }
157
+ }
158
+ }
159
+ catch (error) {
160
+ console.error("Could not update contact:", error || "Unknown");
161
+ next(error);
162
+ }
163
+ });
164
+ }
165
+ deleteContact(req, res, next) {
166
+ return __awaiter(this, void 0, void 0, function* () {
167
+ const { providerConfig: { apiKey = "" } = {} } = req;
168
+ try {
169
+ if (!this.adapter.deleteContact) {
170
+ throw new _1.ServerError(501, "Deleting contacts is not implemented");
171
+ }
172
+ if (!req.providerConfig) {
173
+ throw new _1.ServerError(400, "Missing config parameters");
174
+ }
175
+ console.log(`Deleting contact for key "${(0, anonymize_key_1.anonymizeKey)(apiKey)}"`);
176
+ const contactId = req.params.id;
177
+ yield this.adapter.deleteContact(req.providerConfig, contactId);
178
+ if (this.adapter.getToken && req.providerConfig) {
179
+ const { apiKey } = yield this.adapter.getToken(req.providerConfig);
180
+ res.header("X-Provider-Key", apiKey);
181
+ }
182
+ res.status(200).send();
183
+ if (this.contactCache) {
184
+ const cached = yield this.contactCache.get(apiKey);
185
+ if (cached) {
186
+ const updatedCache = cached.filter((entry) => entry.id !== contactId);
187
+ yield this.contactCache.set(apiKey, updatedCache);
188
+ }
189
+ }
190
+ }
191
+ catch (error) {
192
+ console.error("Could not delete contact:", error || "Unknown");
193
+ next(error);
194
+ }
195
+ });
196
+ }
197
+ getCalendarEvents(req, res, next) {
198
+ return __awaiter(this, void 0, void 0, function* () {
199
+ const { providerConfig: { apiKey = "" } = {}, query: { start, end }, } = req;
200
+ try {
201
+ if (!this.adapter.getCalendarEvents) {
202
+ throw new _1.ServerError(501, "Fetching calendar events is not implemented");
203
+ }
204
+ if (!req.providerConfig) {
205
+ console.error("Missing config parameters");
206
+ throw new _1.ServerError(400, "Missing config parameters");
207
+ }
208
+ console.log(`Fetching calendar events for key "${(0, anonymize_key_1.anonymizeKey)(apiKey)}"`);
209
+ const filter = typeof start === "string" && typeof end === "string"
210
+ ? {
211
+ start: Number(start),
212
+ end: Number(end),
213
+ }
214
+ : null;
215
+ const calendarEvents = yield this.adapter.getCalendarEvents(req.providerConfig, filter);
216
+ const valid = (0, validate_1.validate)(this.ajv, schemas_1.calendarEventsSchema, calendarEvents);
217
+ if (!valid) {
218
+ console.error("Invalid calendar events provided by adapter", this.ajv.errorsText());
219
+ throw new _1.ServerError(400, "Invalid calendar events provided by adapter");
220
+ }
221
+ console.log(`Found ${calendarEvents.length} events for key "${(0, anonymize_key_1.anonymizeKey)(apiKey)}"`);
222
+ res.send(calendarEvents);
223
+ }
224
+ catch (error) {
225
+ console.error("Could not get calendar events:", error || "Unknown");
226
+ next(error);
227
+ }
228
+ });
229
+ }
230
+ createCalendarEvent(req, res, next) {
231
+ return __awaiter(this, void 0, void 0, function* () {
232
+ const { providerConfig: { apiKey = "" } = {} } = req;
233
+ try {
234
+ if (!this.adapter.createCalendarEvent) {
235
+ throw new _1.ServerError(501, "Creating calendar events is not implemented");
236
+ }
237
+ if (!req.providerConfig) {
238
+ throw new _1.ServerError(400, "Missing config parameters");
239
+ }
240
+ console.log(`Creating calendar event for key "${(0, anonymize_key_1.anonymizeKey)(apiKey)}"`);
241
+ const calendarEvent = yield this.adapter.createCalendarEvent(req.providerConfig, req.body);
242
+ const valid = (0, validate_1.validate)(this.ajv, schemas_1.calendarEventsSchema, [calendarEvent]);
243
+ if (!valid) {
244
+ console.error("Invalid calendar event provided by adapter", this.ajv.errorsText());
245
+ throw new _1.ServerError(400, "Invalid calendar event provided by adapter");
246
+ }
247
+ res.send(calendarEvent);
248
+ }
249
+ catch (error) {
250
+ console.error("Could not create calendar event:", error || "Unknown");
251
+ next(error);
252
+ }
253
+ });
254
+ }
255
+ updateCalendarEvent(req, res, next) {
256
+ return __awaiter(this, void 0, void 0, function* () {
257
+ const { providerConfig: { apiKey = "" } = {} } = req;
258
+ try {
259
+ if (!this.adapter.updateCalendarEvent) {
260
+ throw new _1.ServerError(501, "Updating calendar events is not implemented");
261
+ }
262
+ if (!req.providerConfig) {
263
+ throw new _1.ServerError(400, "Missing config parameters");
264
+ }
265
+ console.log(`Updating calendar event for key "${(0, anonymize_key_1.anonymizeKey)(apiKey)}"`);
266
+ const calendarEvent = yield this.adapter.updateCalendarEvent(req.providerConfig, req.params.id, req.body);
267
+ const valid = (0, validate_1.validate)(this.ajv, schemas_1.calendarEventsSchema, [calendarEvent]);
268
+ if (!valid) {
269
+ console.error("Invalid calendar event provided by adapter", this.ajv.errorsText());
270
+ throw new _1.ServerError(400, "Invalid calendar event provided by adapter");
271
+ }
272
+ res.send(calendarEvent);
273
+ }
274
+ catch (error) {
275
+ console.error("Could not update calendar event:", error || "Unknown");
276
+ next(error);
277
+ }
278
+ });
279
+ }
280
+ deleteCalendarEvent(req, res, next) {
281
+ return __awaiter(this, void 0, void 0, function* () {
282
+ const { providerConfig: { apiKey = "" } = {} } = req;
283
+ try {
284
+ if (!this.adapter.deleteCalendarEvent) {
285
+ throw new _1.ServerError(501, "Deleting calendar events is not implemented");
286
+ }
287
+ if (!req.providerConfig) {
288
+ throw new _1.ServerError(400, "Missing config parameters");
289
+ }
290
+ console.log(`Deleting calendar event for key "${(0, anonymize_key_1.anonymizeKey)(apiKey)}"`);
291
+ yield this.adapter.deleteCalendarEvent(req.providerConfig, req.params.id);
292
+ res.status(200).send();
293
+ }
294
+ catch (error) {
295
+ console.error("Could not delete calendar event:", error || "Unknown");
296
+ next(error);
297
+ }
298
+ });
299
+ }
300
+ handleCallEvent(req, res, next) {
301
+ return __awaiter(this, void 0, void 0, function* () {
302
+ const { providerConfig: { apiKey = "" } = {} } = req;
303
+ try {
304
+ if (!this.adapter.handleCallEvent) {
305
+ throw new _1.ServerError(501, "Handling call event is not implemented");
306
+ }
307
+ if (!req.providerConfig) {
308
+ throw new _1.ServerError(400, "Missing config parameters");
309
+ }
310
+ console.log(`Handling call event for key "${(0, anonymize_key_1.anonymizeKey)(apiKey)}"`);
311
+ yield this.adapter.handleCallEvent(req.providerConfig, req.body);
312
+ res.status(200).send();
313
+ }
314
+ catch (error) {
315
+ console.error("Could not handle call event:", error || "Unknown");
316
+ next(error);
317
+ }
318
+ });
319
+ }
320
+ handleConnectedEvent(req, res, next) {
321
+ return __awaiter(this, void 0, void 0, function* () {
322
+ const { providerConfig: { apiKey = "" } = {} } = req;
323
+ try {
324
+ if (!this.adapter.handleConnectedEvent) {
325
+ throw new _1.ServerError(501, "Handling connected event is not implemented");
326
+ }
327
+ if (!req.providerConfig) {
328
+ throw new _1.ServerError(400, "Missing config parameters");
329
+ }
330
+ console.log(`Handling connected event for key "${(0, anonymize_key_1.anonymizeKey)(apiKey)}"`);
331
+ yield this.adapter.handleConnectedEvent(req.providerConfig);
332
+ res.status(200).send();
333
+ }
334
+ catch (error) {
335
+ console.error("Could not handle connected event:", error || "Unknown");
336
+ next(error);
337
+ }
338
+ });
339
+ }
340
+ getHealth(req, res, next) {
341
+ return __awaiter(this, void 0, void 0, function* () {
342
+ try {
343
+ if (this.adapter.getHealth) {
344
+ yield this.adapter.getHealth();
345
+ }
346
+ res.sendStatus(200);
347
+ }
348
+ catch (error) {
349
+ console.error("Health check failed:", error || "Unknown");
350
+ next(error || "Internal Server Error");
351
+ }
352
+ });
353
+ }
354
+ oAuth2Redirect(req, res, next) {
355
+ return __awaiter(this, void 0, void 0, function* () {
356
+ try {
357
+ if (!this.adapter.getOAuth2RedirectUrl) {
358
+ throw new _1.ServerError(501, "OAuth2 flow not implemented");
359
+ }
360
+ const redirectUrl = yield this.adapter.getOAuth2RedirectUrl();
361
+ res.send({ redirectUrl });
362
+ }
363
+ catch (error) {
364
+ console.error("Could not get OAuth2 redirect URL:", error || "Unknown");
365
+ next(error);
366
+ }
367
+ });
368
+ }
369
+ oAuth2Callback(req, res) {
370
+ return __awaiter(this, void 0, void 0, function* () {
371
+ let { OAUTH2_REDIRECT_URL: redirectUrl, OAUTH2_IDENTIFIER: oAuth2Identifier = "UNKNOWN", } = process.env;
372
+ if (!redirectUrl) {
373
+ console.error("OAuth2 Redirect URL not configured!");
374
+ res.status(500).send("OAuth2 Redirect URL not configured!");
375
+ return;
376
+ }
377
+ try {
378
+ if (!this.adapter.handleOAuth2Callback) {
379
+ throw new _1.ServerError(501, "OAuth2 flow not implemented");
380
+ }
381
+ const { apiKey, apiUrl } = yield this.adapter.handleOAuth2Callback(req);
382
+ const params = (0, querystring_1.stringify)({
383
+ name: oAuth2Identifier,
384
+ key: apiKey,
385
+ url: apiUrl,
386
+ });
387
+ res.redirect(`${redirectUrl}?${params}`);
388
+ }
389
+ catch (error) {
390
+ console.error("Unable to save OAuth2 token:", error || "Unknown");
391
+ res.redirect(redirectUrl);
392
+ }
393
+ });
394
+ }
395
+ }
396
+ exports.Controller = Controller;
397
+ //# sourceMappingURL=controller.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.model.js","sourceRoot":"","sources":["../../src/models/controller.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8CAAsB;AAEtB,6CAAwC;AACxC,wBAYW;AACX,wCAAkE;AAClE,yDAAqD;AACrD,mEAAsE;AACtE,+CAA4C;AAE5C,mDAAmD;AAEnD,MAAM,qBAAqB,GAAW,IAAI,CAAC;AAE3C,SAAS,eAAe,CAAC,OAAgB,EAAE,MAAc;IACvD,MAAM,MAAM,mCACP,OAAO,KACV,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,iCACnD,WAAW,KACd,WAAW,EACT,WAAW,CAAC,KAAK,KAAK,gCAAgB,CAAC,UAAU;gBAC/C,CAAC,CAAC,WAAW,CAAC,WAAW;gBACzB,CAAC,CAAC,IAAA,6CAAwB,EAAC,WAAW,CAAC,WAAW,EAAE,MAAM,CAAC,IAC/D,CAAC,GACJ,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAa,UAAU;IAKrB,YAAY,OAAgB,EAAE,YAAiC;QAC7D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,YAAY,CA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AC,qCAAqC,CAAC,CAAC;gBACrD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;gBAC5D,OAAO;aACR;YAED,IAAI;gBACF,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE;oBACtC,MAAM,IAAI,cAAW,CAAC,GAAG,EAAE,6BAA6B,CAAC,CAAC;iBAC3D;gBAED,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC;gBAExE,MAAM,MAAM,GAAG,IAAA,uBAAS,EAAC;oBACvB,IAAI,EAAE,gBAAgB;oBACtB,GAAG,EAAE,MAAM;oBACX,GAAG,EAAE,MAAM;iBACZ,CAAC,CAAC;gBAEH,GAAG,CAAC,QAAQ,CAAC,GAAG,WAAW,IAAI,MAAM,EAAE,CAAC,CAAC;aAC1C;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,IAAI,SAAS,CAAC,CAAC;gBAClE,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;aAC3B;QACH,CAAC;KAAA;CACF;AA7hBD,gCA6hBC"}
@@ -0,0 +1,13 @@
1
+ export * from "./adapter.model";
2
+ export * from "./bridge-request.model";
3
+ export * from "./calendar-event.model";
4
+ export * from "./calendar-filter-options.model";
5
+ export * from "./call-direction.enum";
6
+ export * from "./call-event.model";
7
+ export * from "./channel.model";
8
+ export * from "./config.model";
9
+ export * from "./contact-cache.model";
10
+ export * from "./contact.model";
11
+ export * from "./controller.model";
12
+ export * from "./server-error.model";
13
+ export * from "./user.model";
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./adapter.model"), exports);
18
+ __exportStar(require("./bridge-request.model"), exports);
19
+ __exportStar(require("./calendar-event.model"), exports);
20
+ __exportStar(require("./calendar-filter-options.model"), exports);
21
+ __exportStar(require("./call-direction.enum"), exports);
22
+ __exportStar(require("./call-event.model"), exports);
23
+ __exportStar(require("./channel.model"), exports);
24
+ __exportStar(require("./config.model"), exports);
25
+ __exportStar(require("./contact-cache.model"), exports);
26
+ __exportStar(require("./contact.model"), exports);
27
+ __exportStar(require("./controller.model"), exports);
28
+ __exportStar(require("./server-error.model"), exports);
29
+ __exportStar(require("./user.model"), exports);
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,yDAAuC;AACvC,yDAAuC;AACvC,kEAAgD;AAChD,wDAAsC;AACtC,qDAAmC;AACnC,kDAAgC;AAChC,iDAA+B;AAC/B,wDAAsC;AACtC,kDAAgC;AAChC,qDAAmC;AACnC,uDAAqC;AACrC,+CAA6B"}
@@ -0,0 +1,4 @@
1
+ export declare class ServerError extends Error {
2
+ status: number;
3
+ constructor(status: number, message: string);
4
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ServerError = void 0;
4
+ class ServerError extends Error {
5
+ constructor(status, message) {
6
+ super(message || "Unknown Error");
7
+ this.status = status || 500;
8
+ }
9
+ }
10
+ exports.ServerError = ServerError;
11
+ //# sourceMappingURL=server-error.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-error.model.js","sourceRoot":"","sources":["../../src/models/server-error.model.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAY,SAAQ,KAAK;IAGpC,YAAY,MAAc,EAAE,OAAe;QACzC,KAAK,CAAC,OAAO,IAAI,eAAe,CAAC,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,GAAG,CAAC;IAC9B,CAAC;CACF;AAPD,kCAOC"}
@@ -0,0 +1,5 @@
1
+ export interface StorageAdapter<T> {
2
+ get: (key: string) => Promise<T | null>;
3
+ set: (key: string, value: T) => Promise<void>;
4
+ delete: (key: string) => Promise<void>;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=storage-adapter.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-adapter.model.js","sourceRoot":"","sources":["../../src/models/storage-adapter.model.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export interface User {
2
+ id: string;
3
+ firstName: string;
4
+ lastName: string;
5
+ email: string;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=user.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.model.js","sourceRoot":"","sources":["../../src/models/user.model.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ export declare const calendarEventsSchema: {
2
+ title: string;
3
+ type: string;
4
+ items: {
5
+ type: string;
6
+ properties: {
7
+ fillDefaults: boolean;
8
+ id: {
9
+ type: string;
10
+ };
11
+ title: {
12
+ type: string[];
13
+ };
14
+ description: {
15
+ type: string[];
16
+ };
17
+ eventUrl: {
18
+ type: string[];
19
+ };
20
+ start: {
21
+ type: string[];
22
+ };
23
+ end: {
24
+ type: string[];
25
+ };
26
+ };
27
+ required: string[];
28
+ };
29
+ };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calendarEventsSchema = void 0;
4
+ exports.calendarEventsSchema = {
5
+ title: "CalendarEvents",
6
+ type: "array",
7
+ items: {
8
+ type: "object",
9
+ properties: {
10
+ fillDefaults: true,
11
+ id: {
12
+ type: "string",
13
+ },
14
+ title: {
15
+ type: ["string", "null"],
16
+ },
17
+ description: {
18
+ type: ["string", "null"],
19
+ },
20
+ eventUrl: {
21
+ type: ["string", "null"],
22
+ },
23
+ start: {
24
+ type: ["number", "null"],
25
+ },
26
+ end: {
27
+ type: ["number", "null"],
28
+ },
29
+ },
30
+ required: ["id", "title", "description", "eventUrl", "start", "end"],
31
+ },
32
+ };
33
+ //# sourceMappingURL=calendar-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar-events.js","sourceRoot":"","sources":["../../src/schemas/calendar-events.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG;IAClC,KAAK,EAAE,gBAAgB;IACvB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,YAAY,EAAE,IAAI;YAClB,EAAE,EAAE;gBACF,IAAI,EAAE,QAAQ;aACf;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;aACzB;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;aACzB;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;aACzB;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;aACzB;YACD,GAAG,EAAE;gBACH,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;aACzB;SACF;QACD,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC;KACrE;CACF,CAAC"}
@@ -0,0 +1,54 @@
1
+ export declare const contactsSchema: {
2
+ title: string;
3
+ type: string;
4
+ items: {
5
+ type: string;
6
+ properties: {
7
+ fillDefaults: boolean;
8
+ id: {
9
+ type: string;
10
+ };
11
+ email: {
12
+ type: string[];
13
+ };
14
+ organization: {
15
+ type: string[];
16
+ };
17
+ contactUrl: {
18
+ type: string[];
19
+ };
20
+ avatarUrl: {
21
+ type: string[];
22
+ };
23
+ name: {
24
+ type: string[];
25
+ };
26
+ firstName: {
27
+ type: string[];
28
+ };
29
+ lastName: {
30
+ type: string[];
31
+ };
32
+ readonly: {
33
+ type: string[];
34
+ };
35
+ phoneNumbers: {
36
+ type: string;
37
+ items: {
38
+ type: string;
39
+ properties: {
40
+ fillDefaults: boolean;
41
+ label: {
42
+ type: string;
43
+ };
44
+ phoneNumber: {
45
+ type: string;
46
+ };
47
+ };
48
+ required: string[];
49
+ };
50
+ };
51
+ };
52
+ required: string[];
53
+ };
54
+ };