@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.
- package/LICENSE +201 -0
- package/README.md +82 -0
- package/dist/cache/index.d.ts +1 -0
- package/dist/cache/index.js +18 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/storage/index.d.ts +2 -0
- package/dist/cache/storage/index.js +19 -0
- package/dist/cache/storage/index.js.map +1 -0
- package/dist/cache/storage/memory-storage-adapter.d.ts +8 -0
- package/dist/cache/storage/memory-storage-adapter.js +48 -0
- package/dist/cache/storage/memory-storage-adapter.js.map +1 -0
- package/dist/cache/storage/redis-storage-adapter.d.ts +8 -0
- package/dist/cache/storage/redis-storage-adapter.js +61 -0
- package/dist/cache/storage/redis-storage-adapter.js.map +1 -0
- package/dist/cache/storage-cache.d.ts +12 -0
- package/dist/cache/storage-cache.js +114 -0
- package/dist/cache/storage-cache.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/middlewares/error-handler.middleware.d.ts +3 -0
- package/dist/middlewares/error-handler.middleware.js +13 -0
- package/dist/middlewares/error-handler.middleware.js.map +1 -0
- package/dist/middlewares/extract-header.middleware.d.ts +3 -0
- package/dist/middlewares/extract-header.middleware.js +17 -0
- package/dist/middlewares/extract-header.middleware.js.map +1 -0
- package/dist/middlewares/index.d.ts +2 -0
- package/dist/middlewares/index.js +19 -0
- package/dist/middlewares/index.js.map +1 -0
- package/dist/models/adapter.model.d.ts +23 -0
- package/dist/models/adapter.model.js +3 -0
- package/dist/models/adapter.model.js.map +1 -0
- package/dist/models/bridge-request.model.d.ts +5 -0
- package/dist/models/bridge-request.model.js +3 -0
- package/dist/models/bridge-request.model.js.map +1 -0
- package/dist/models/calendar-event.model.d.ts +10 -0
- package/dist/models/calendar-event.model.js +3 -0
- package/dist/models/calendar-event.model.js.map +1 -0
- package/dist/models/calendar-filter-options.model.d.ts +4 -0
- package/dist/models/calendar-filter-options.model.js +3 -0
- package/dist/models/calendar-filter-options.model.js.map +1 -0
- package/dist/models/call-direction.enum.d.ts +4 -0
- package/dist/models/call-direction.enum.js +9 -0
- package/dist/models/call-direction.enum.js.map +1 -0
- package/dist/models/call-event.model.d.ts +11 -0
- package/dist/models/call-event.model.js +3 -0
- package/dist/models/call-event.model.js.map +1 -0
- package/dist/models/channel.model.d.ts +4 -0
- package/dist/models/channel.model.js +3 -0
- package/dist/models/channel.model.js.map +1 -0
- package/dist/models/config.model.d.ts +11 -0
- package/dist/models/config.model.js +3 -0
- package/dist/models/config.model.js.map +1 -0
- package/dist/models/contact-cache.model.d.ts +8 -0
- package/dist/models/contact-cache.model.js +3 -0
- package/dist/models/contact-cache.model.js.map +1 -0
- package/dist/models/contact.model.d.ts +40 -0
- package/dist/models/contact.model.js +20 -0
- package/dist/models/contact.model.js.map +1 -0
- package/dist/models/controller.model.d.ts +21 -0
- package/dist/models/controller.model.js +397 -0
- package/dist/models/controller.model.js.map +1 -0
- package/dist/models/index.d.ts +13 -0
- package/dist/models/index.js +30 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/server-error.model.d.ts +4 -0
- package/dist/models/server-error.model.js +11 -0
- package/dist/models/server-error.model.js.map +1 -0
- package/dist/models/storage-adapter.model.d.ts +5 -0
- package/dist/models/storage-adapter.model.js +3 -0
- package/dist/models/storage-adapter.model.js.map +1 -0
- package/dist/models/user.model.d.ts +6 -0
- package/dist/models/user.model.js +3 -0
- package/dist/models/user.model.js.map +1 -0
- package/dist/schemas/calendar-events.d.ts +29 -0
- package/dist/schemas/calendar-events.js +33 -0
- package/dist/schemas/calendar-events.js.map +1 -0
- package/dist/schemas/contacts.d.ts +54 -0
- package/dist/schemas/contacts.js +68 -0
- package/dist/schemas/contacts.js.map +1 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +19 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/util/anonymize-key.d.ts +1 -0
- package/dist/util/anonymize-key.js +9 -0
- package/dist/util/anonymize-key.js.map +1 -0
- package/dist/util/get-contact-cache.d.ts +2 -0
- package/dist/util/get-contact-cache.js +20 -0
- package/dist/util/get-contact-cache.js.map +1 -0
- package/dist/util/phone-number-utils.d.ts +1 -0
- package/dist/util/phone-number-utils.js +17 -0
- package/dist/util/phone-number-utils.js.map +1 -0
- package/dist/util/size-of.d.ts +1 -0
- package/dist/util/size-of.js +46 -0
- package/dist/util/size-of.js.map +1 -0
- package/dist/util/validate.d.ts +2 -0
- package/dist/util/validate.js +20 -0
- package/dist/util/validate.js.map +1 -0
- package/package.json +89 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.start = void 0;
|
|
21
|
+
const body_parser_1 = __importDefault(require("body-parser"));
|
|
22
|
+
const compression_1 = __importDefault(require("compression"));
|
|
23
|
+
const cors_1 = __importDefault(require("cors"));
|
|
24
|
+
const express_1 = __importDefault(require("express"));
|
|
25
|
+
const middlewares_1 = require("./middlewares");
|
|
26
|
+
const models_1 = require("./models");
|
|
27
|
+
const get_contact_cache_1 = require("./util/get-contact-cache");
|
|
28
|
+
const settingsPort = Number(process.env.PORT) || 8080;
|
|
29
|
+
const app = (0, express_1.default)();
|
|
30
|
+
app.use((0, compression_1.default)());
|
|
31
|
+
app.use((0, cors_1.default)({
|
|
32
|
+
credentials: true,
|
|
33
|
+
origin: true,
|
|
34
|
+
}));
|
|
35
|
+
app.use(body_parser_1.default.json());
|
|
36
|
+
app.use(middlewares_1.extractHeaderMiddleware);
|
|
37
|
+
function start(adapter, port = settingsPort) {
|
|
38
|
+
const cache = (0, get_contact_cache_1.getContactCache)();
|
|
39
|
+
const controller = new models_1.Controller(adapter, cache);
|
|
40
|
+
app.get("/contacts", controller.getContacts);
|
|
41
|
+
app.post("/contacts", controller.createContact);
|
|
42
|
+
app.put("/contacts/:id", controller.updateContact);
|
|
43
|
+
app.delete("/contacts/:id", controller.deleteContact);
|
|
44
|
+
app.get("/calendar", controller.getCalendarEvents);
|
|
45
|
+
app.post("/calendar", controller.createCalendarEvent);
|
|
46
|
+
app.put("/calendar/:id", controller.updateCalendarEvent);
|
|
47
|
+
app.delete("/calendar/:id", controller.deleteCalendarEvent);
|
|
48
|
+
app.post("/events/calls", controller.handleCallEvent);
|
|
49
|
+
app.post("/events/connected", controller.handleConnectedEvent);
|
|
50
|
+
app.get("/health", controller.getHealth);
|
|
51
|
+
app.get("/oauth2/redirect", controller.oAuth2Redirect);
|
|
52
|
+
app.get("/oauth2/callback", (req, res) => controller.oAuth2Callback(req, res));
|
|
53
|
+
app.use(middlewares_1.errorHandlerMiddleware);
|
|
54
|
+
return app.listen(port, () => console.log(`Listening on port ${port}`)); // tslint:disable-line
|
|
55
|
+
}
|
|
56
|
+
exports.start = start;
|
|
57
|
+
__exportStar(require("./models"), exports);
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,8DAAqC;AACrC,8DAAsC;AACtC,gDAAwB;AACxB,sDAA8B;AAE9B,+CAAgF;AAChF,qCAA+C;AAC/C,gEAA2D;AAE3D,MAAM,YAAY,GAAW,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAE9D,MAAM,GAAG,GAAwB,IAAA,iBAAO,GAAE,CAAC;AAE3C,GAAG,CAAC,GAAG,CAAC,IAAA,qBAAW,GAAE,CAAC,CAAC;AACvB,GAAG,CAAC,GAAG,CACL,IAAA,cAAI,EAAC;IACH,WAAW,EAAE,IAAI;IACjB,MAAM,EAAE,IAAI;CACb,CAAC,CACH,CAAC;AACF,GAAG,CAAC,GAAG,CAAC,qBAAU,CAAC,IAAI,EAAE,CAAC,CAAC;AAC3B,GAAG,CAAC,GAAG,CAAC,qCAAuB,CAAC,CAAC;AAEjC,SAAgB,KAAK,CAAC,OAAgB,EAAE,OAAe,YAAY;IACjE,MAAM,KAAK,GAAG,IAAA,mCAAe,GAAE,CAAC;IAEhC,MAAM,UAAU,GAAe,IAAI,mBAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAE9D,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAC7C,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;IAChD,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;IACnD,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;IACtD,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACnD,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC;IACtD,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC;IACzD,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAC5D,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;IACtD,GAAG,CAAC,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,oBAAoB,CAAC,CAAC;IAC/D,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACzC,GAAG,CAAC,GAAG,CAAC,kBAAkB,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;IACvD,GAAG,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CACvC,UAAU,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CACpC,CAAC;IAEF,GAAG,CAAC,GAAG,CAAC,oCAAsB,CAAC,CAAC;IAEhC,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,sBAAsB;AACjG,CAAC;AAxBD,sBAwBC;AAED,2CAAyB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.errorHandlerMiddleware = void 0;
|
|
4
|
+
const models_1 = require("../models");
|
|
5
|
+
function errorHandlerMiddleware(error, req, res, next) {
|
|
6
|
+
if (error instanceof models_1.ServerError) {
|
|
7
|
+
res.status(error.status).send(error.message);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
res.status(500).send(error.message);
|
|
11
|
+
}
|
|
12
|
+
exports.errorHandlerMiddleware = errorHandlerMiddleware;
|
|
13
|
+
//# sourceMappingURL=error-handler.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.middleware.js","sourceRoot":"","sources":["../../src/middlewares/error-handler.middleware.ts"],"names":[],"mappings":";;;AACA,sCAAwC;AAExC,SAAgB,sBAAsB,CACpC,KAA0B,EAC1B,GAAY,EACZ,GAAa,EACb,IAAkB;IAElB,IAAI,KAAK,YAAY,oBAAW,EAAE;QAChC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7C,OAAO;KACR;IAED,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC;AAZD,wDAYC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractHeaderMiddleware = void 0;
|
|
4
|
+
const DEFAULT_LOCALE = "de_DE";
|
|
5
|
+
function extractHeaderMiddleware(req, res, next) {
|
|
6
|
+
const apiKey = req.get("x-provider-key") || "";
|
|
7
|
+
const apiUrl = req.get("x-provider-url") || "";
|
|
8
|
+
const locale = req.get("x-provider-locale") || DEFAULT_LOCALE;
|
|
9
|
+
req.providerConfig = {
|
|
10
|
+
apiKey,
|
|
11
|
+
apiUrl,
|
|
12
|
+
locale,
|
|
13
|
+
};
|
|
14
|
+
next();
|
|
15
|
+
}
|
|
16
|
+
exports.extractHeaderMiddleware = extractHeaderMiddleware;
|
|
17
|
+
//# sourceMappingURL=extract-header.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-header.middleware.js","sourceRoot":"","sources":["../../src/middlewares/extract-header.middleware.ts"],"names":[],"mappings":";;;AAGA,MAAM,cAAc,GAAG,OAAO,CAAC;AAE/B,SAAgB,uBAAuB,CACrC,GAAkB,EAClB,GAAa,EACb,IAAkB;IAElB,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;IAC/C,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;IAC/C,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,cAAc,CAAC;IAE9D,GAAG,CAAC,cAAc,GAAG;QACnB,MAAM;QACN,MAAM;QACN,MAAM;KACP,CAAC;IAEF,IAAI,EAAE,CAAC;AACT,CAAC;AAhBD,0DAgBC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./error-handler.middleware"), exports);
|
|
18
|
+
__exportStar(require("./extract-header.middleware"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/middlewares/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,8DAA4C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Request } from "express";
|
|
2
|
+
import { CalendarEvent, CalendarEventTemplate, CalendarFilterOptions, CallEvent, Config, Contact, ContactTemplate, ContactUpdate } from ".";
|
|
3
|
+
export interface Adapter {
|
|
4
|
+
getToken?: (config: Config) => Promise<{
|
|
5
|
+
apiKey: string;
|
|
6
|
+
}>;
|
|
7
|
+
getContacts?: (config: Config) => Promise<Contact[]>;
|
|
8
|
+
createContact?: (config: Config, contact: ContactTemplate) => Promise<Contact>;
|
|
9
|
+
updateContact?: (config: Config, id: string, contact: ContactUpdate) => Promise<Contact>;
|
|
10
|
+
deleteContact?: (config: Config, id: string) => Promise<void>;
|
|
11
|
+
getCalendarEvents?: (config: Config, options?: CalendarFilterOptions | null) => Promise<CalendarEvent[]>;
|
|
12
|
+
createCalendarEvent?: (config: Config, event: CalendarEventTemplate) => Promise<CalendarEvent>;
|
|
13
|
+
updateCalendarEvent?: (config: Config, id: string, event: CalendarEventTemplate) => Promise<CalendarEvent>;
|
|
14
|
+
deleteCalendarEvent?: (config: Config, id: string) => Promise<void>;
|
|
15
|
+
handleCallEvent?: (config: Config, event: CallEvent) => Promise<void>;
|
|
16
|
+
handleConnectedEvent?: (config: Config) => Promise<void>;
|
|
17
|
+
getHealth?: () => Promise<void>;
|
|
18
|
+
getOAuth2RedirectUrl?: () => Promise<string>;
|
|
19
|
+
handleOAuth2Callback?: (req: Request) => Promise<{
|
|
20
|
+
apiKey: string;
|
|
21
|
+
apiUrl: string;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.model.js","sourceRoot":"","sources":["../../src/models/adapter.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge-request.model.js","sourceRoot":"","sources":["../../src/models/bridge-request.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-event.model.js","sourceRoot":"","sources":["../../src/models/calendar-event.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-filter-options.model.js","sourceRoot":"","sources":["../../src/models/calendar-filter-options.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CallDirection = void 0;
|
|
4
|
+
var CallDirection;
|
|
5
|
+
(function (CallDirection) {
|
|
6
|
+
CallDirection["IN"] = "IN";
|
|
7
|
+
CallDirection["OUT"] = "OUT";
|
|
8
|
+
})(CallDirection = exports.CallDirection || (exports.CallDirection = {}));
|
|
9
|
+
//# sourceMappingURL=call-direction.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-direction.enum.js","sourceRoot":"","sources":["../../src/models/call-direction.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,0BAAS,CAAA;IACT,4BAAW,CAAA;AACb,CAAC,EAHW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-event.model.js","sourceRoot":"","sources":["../../src/models/call-event.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel.model.js","sourceRoot":"","sources":["../../src/models/channel.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.model.js","sourceRoot":"","sources":["../../src/models/config.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Contact } from "./contact.model";
|
|
2
|
+
declare type FreshValueUpdater = (key: string) => Promise<Contact[] | null>;
|
|
3
|
+
export interface ContactCache {
|
|
4
|
+
get: (key: string, getFreshValue?: FreshValueUpdater) => Promise<Contact[] | null>;
|
|
5
|
+
set: (key: string, value: Contact[]) => Promise<void>;
|
|
6
|
+
delete: (key: string) => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-cache.model.js","sourceRoot":"","sources":["../../src/models/contact-cache.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare enum PhoneNumberLabel {
|
|
2
|
+
WORK = "WORK",
|
|
3
|
+
MOBILE = "MOBILE",
|
|
4
|
+
HOME = "HOME",
|
|
5
|
+
HOMEFAX = "HOMEFAX",
|
|
6
|
+
WORKFAX = "WORKFAX",
|
|
7
|
+
OTHERFAX = "OTHERFAX",
|
|
8
|
+
PAGER = "PAGER",
|
|
9
|
+
WORKMOBILE = "WORKMOBILE",
|
|
10
|
+
WORKPAGER = "WORKPAGER",
|
|
11
|
+
MAIN = "MAIN",
|
|
12
|
+
GOOGLEVOICE = "GOOGLEVOICE",
|
|
13
|
+
OTHER = "OTHER",
|
|
14
|
+
DIRECTDIAL = "DIRECTDIAL"
|
|
15
|
+
}
|
|
16
|
+
export interface PhoneNumber {
|
|
17
|
+
label: PhoneNumberLabel;
|
|
18
|
+
phoneNumber: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ContactTemplate {
|
|
21
|
+
name: string | null;
|
|
22
|
+
firstName: string | null;
|
|
23
|
+
lastName: string | null;
|
|
24
|
+
email: string | null;
|
|
25
|
+
organization: string | null;
|
|
26
|
+
phoneNumbers: PhoneNumber[];
|
|
27
|
+
}
|
|
28
|
+
export interface TimeoutResult {
|
|
29
|
+
status: 408;
|
|
30
|
+
description: string;
|
|
31
|
+
}
|
|
32
|
+
export interface Contact extends ContactTemplate {
|
|
33
|
+
id: string;
|
|
34
|
+
contactUrl: string | null;
|
|
35
|
+
avatarUrl: string | null;
|
|
36
|
+
readonly?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface ContactUpdate extends ContactTemplate {
|
|
39
|
+
id: string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PhoneNumberLabel = void 0;
|
|
4
|
+
var PhoneNumberLabel;
|
|
5
|
+
(function (PhoneNumberLabel) {
|
|
6
|
+
PhoneNumberLabel["WORK"] = "WORK";
|
|
7
|
+
PhoneNumberLabel["MOBILE"] = "MOBILE";
|
|
8
|
+
PhoneNumberLabel["HOME"] = "HOME";
|
|
9
|
+
PhoneNumberLabel["HOMEFAX"] = "HOMEFAX";
|
|
10
|
+
PhoneNumberLabel["WORKFAX"] = "WORKFAX";
|
|
11
|
+
PhoneNumberLabel["OTHERFAX"] = "OTHERFAX";
|
|
12
|
+
PhoneNumberLabel["PAGER"] = "PAGER";
|
|
13
|
+
PhoneNumberLabel["WORKMOBILE"] = "WORKMOBILE";
|
|
14
|
+
PhoneNumberLabel["WORKPAGER"] = "WORKPAGER";
|
|
15
|
+
PhoneNumberLabel["MAIN"] = "MAIN";
|
|
16
|
+
PhoneNumberLabel["GOOGLEVOICE"] = "GOOGLEVOICE";
|
|
17
|
+
PhoneNumberLabel["OTHER"] = "OTHER";
|
|
18
|
+
PhoneNumberLabel["DIRECTDIAL"] = "DIRECTDIAL";
|
|
19
|
+
})(PhoneNumberLabel = exports.PhoneNumberLabel || (exports.PhoneNumberLabel = {}));
|
|
20
|
+
//# sourceMappingURL=contact.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact.model.js","sourceRoot":"","sources":["../../src/models/contact.model.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAcX;AAdD,WAAY,gBAAgB;IAC1B,iCAAa,CAAA;IACb,qCAAiB,CAAA;IACjB,iCAAa,CAAA;IACb,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,yCAAqB,CAAA;IACrB,mCAAe,CAAA;IACf,6CAAyB,CAAA;IACzB,2CAAuB,CAAA;IACvB,iCAAa,CAAA;IACb,+CAA2B,CAAA;IAC3B,mCAAe,CAAA;IACf,6CAAyB,CAAA;AAC3B,CAAC,EAdW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAc3B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NextFunction, Request, Response } from "express";
|
|
2
|
+
import { Adapter, BridgeRequest, ContactCache } from ".";
|
|
3
|
+
export declare class Controller {
|
|
4
|
+
private adapter;
|
|
5
|
+
private contactCache;
|
|
6
|
+
private ajv;
|
|
7
|
+
constructor(adapter: Adapter, contactCache: ContactCache | null);
|
|
8
|
+
getContacts(req: BridgeRequest, res: Response, next: NextFunction): Promise<void>;
|
|
9
|
+
createContact(req: BridgeRequest, res: Response, next: NextFunction): Promise<void>;
|
|
10
|
+
updateContact(req: BridgeRequest, res: Response, next: NextFunction): Promise<void>;
|
|
11
|
+
deleteContact(req: BridgeRequest, res: Response, next: NextFunction): Promise<void>;
|
|
12
|
+
getCalendarEvents(req: BridgeRequest, res: Response, next: NextFunction): Promise<void>;
|
|
13
|
+
createCalendarEvent(req: BridgeRequest, res: Response, next: NextFunction): Promise<void>;
|
|
14
|
+
updateCalendarEvent(req: BridgeRequest, res: Response, next: NextFunction): Promise<void>;
|
|
15
|
+
deleteCalendarEvent(req: BridgeRequest, res: Response, next: NextFunction): Promise<void>;
|
|
16
|
+
handleCallEvent(req: BridgeRequest, res: Response, next: NextFunction): Promise<void>;
|
|
17
|
+
handleConnectedEvent(req: BridgeRequest, res: Response, next: NextFunction): Promise<void>;
|
|
18
|
+
getHealth(req: BridgeRequest, res: Response, next: NextFunction): Promise<void>;
|
|
19
|
+
oAuth2Redirect(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
20
|
+
oAuth2Callback(req: Request, res: Response): Promise<void>;
|
|
21
|
+
}
|