@sipgate/integration-bridge 0.22.7 → 0.22.9
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/README.md +28 -24
- package/dist/cache/index.d.ts +1 -1
- package/dist/cache/storage/index.d.ts +2 -2
- package/dist/cache/storage/memory-storage-adapter.d.ts +1 -1
- package/dist/cache/storage/redis-storage-adapter.d.ts +1 -1
- package/dist/cache/storage/redis-storage-adapter.js +10 -10
- package/dist/cache/storage-cache.d.ts +5 -5
- package/dist/cache/storage-cache.js +6 -6
- package/dist/index.d.ts +7 -7
- package/dist/index.js +27 -27
- package/dist/index.test.js +2 -2
- package/dist/middlewares/error-handler.middleware.d.ts +2 -2
- package/dist/middlewares/extract-header.middleware.d.ts +2 -2
- package/dist/middlewares/extract-header.middleware.js +5 -5
- package/dist/middlewares/index.d.ts +2 -2
- package/dist/models/adapter.model.d.ts +3 -3
- package/dist/models/api-contact.model.d.ts +1 -1
- package/dist/models/bridge-request.model.d.ts +3 -3
- package/dist/models/call-event.model.d.ts +1 -1
- package/dist/models/contact-cache.model.d.ts +2 -2
- package/dist/models/contact.model.d.ts +1 -1
- package/dist/models/controller.model.d.ts +3 -3
- package/dist/models/controller.model.js +156 -156
- package/dist/models/controller.model.test.js +125 -125
- package/dist/models/custom-router.model.d.ts +1 -1
- package/dist/models/custom-routes.model.d.ts +2 -2
- package/dist/models/index.d.ts +16 -16
- package/dist/models/pubsub-client.model.d.ts +1 -1
- package/dist/models/pubsub-client.model.js +2 -2
- package/dist/models/pubsub-contacts-message.model.d.ts +1 -1
- package/dist/models/server-error.model.js +1 -1
- package/dist/models/token-cache.model.d.ts +1 -1
- package/dist/schemas/calendar-events.js +10 -10
- package/dist/schemas/contacts.js +26 -26
- package/dist/schemas/index.d.ts +2 -2
- package/dist/util/anonymize-key.js +2 -2
- package/dist/util/anonymize-key.test.js +8 -8
- package/dist/util/call-comment.d.ts +1 -1
- package/dist/util/call-comment.js +12 -12
- package/dist/util/call-event.test.js +20 -20
- package/dist/util/call-event.util.d.ts +1 -1
- package/dist/util/callEventHelper.d.ts +1 -1
- package/dist/util/callEventHelper.js +6 -6
- package/dist/util/env.js +11 -11
- package/dist/util/error.d.ts +2 -2
- package/dist/util/error.js +3 -3
- package/dist/util/gdpr/gdprSlackNotification.d.ts +2 -2
- package/dist/util/gdpr/gdprSlackNotification.js +6 -6
- package/dist/util/gdpr/index.d.ts +2 -2
- package/dist/util/get-contact-cache.d.ts +1 -1
- package/dist/util/get-contact-cache.js +4 -4
- package/dist/util/get-contact-cache.js.map +1 -1
- package/dist/util/http/index.d.ts +6 -6
- package/dist/util/http/pagination.d.ts +1 -1
- package/dist/util/http/pagination.js +1 -1
- package/dist/util/http/rate-limited-axios.d.ts +2 -2
- package/dist/util/http/rate-limited-axios.js +2 -2
- package/dist/util/http/url.js +2 -2
- package/dist/util/index.d.ts +20 -20
- package/dist/util/integration-entity.d.ts +1 -1
- package/dist/util/integration-entity.js +1 -1
- package/dist/util/lang/index.d.ts +1 -1
- package/dist/util/logger.util.js +3 -3
- package/dist/util/oauth.d.ts +2 -2
- package/dist/util/oauth.js +7 -7
- package/dist/util/phone-number-utils.d.ts +2 -2
- package/dist/util/phone-number-utils.js +5 -5
- package/dist/util/phone-number-utils.test.js +49 -49
- package/dist/util/security/index.d.ts +2 -2
- package/dist/util/security/nonce.d.ts +1 -1
- package/dist/util/security/nonce.js +2 -2
- package/dist/util/size-of.js +4 -4
- package/dist/util/token-util.d.ts +3 -3
- package/dist/util/token-util.js +11 -8
- package/dist/util/token-util.js.map +1 -1
- package/dist/util/validate.d.ts +1 -1
- package/dist/util/validate.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-contact-cache.js","sourceRoot":"","sources":["../../src/util/get-contact-cache.ts"],"names":[],"mappings":";;;AAAA,oCAAwC;AACxC,8CAA6E;AAG7E,SAAgB,eAAe;IAC7B,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAElD,IAAI,cAAc,IAAI,cAAc,KAAK,MAAM,EAAE;QAC/C,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"get-contact-cache.js","sourceRoot":"","sources":["../../src/util/get-contact-cache.ts"],"names":[],"mappings":";;;AAAA,oCAAwC;AACxC,8CAA6E;AAG7E,SAAgB,eAAe;IAC7B,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAElD,IAAI,cAAc,IAAI,cAAc,KAAK,MAAM,EAAE;QAC/C,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;KACb;IAED,IAAI,SAAS,EAAE;QACb,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;QACjD,OAAO,IAAI,oBAAY,CAAC,IAAI,6BAAmB,CAAC,SAAS,CAAC,CAAC,CAAC;KAC7D;IAED,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IAClD,OAAO,IAAI,oBAAY,CAAC,IAAI,8BAAoB,EAAE,CAAC,CAAC;AACtD,CAAC;AAfD,0CAeC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as Pagination from
|
|
2
|
-
import { RateLimitedAxios } from
|
|
3
|
-
import { getSubdomain } from
|
|
1
|
+
import * as Pagination from './pagination';
|
|
2
|
+
import { RateLimitedAxios } from './rate-limited-axios';
|
|
3
|
+
import { getSubdomain } from './url';
|
|
4
4
|
export { Pagination, RateLimitedAxios, getSubdomain };
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
5
|
+
export * from './pagination';
|
|
6
|
+
export * from './rate-limited-axios';
|
|
7
|
+
export * from './url';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxiosResponse } from
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
2
|
export type MergeDataFn<T> = (data: T, newData: T) => T;
|
|
3
3
|
export type ExtractDataFromResponseFn<T> = (response: AxiosResponse) => T;
|
|
4
4
|
export type IsEofFn<T> = (response: AxiosResponse, data: T) => boolean;
|
|
@@ -39,7 +39,7 @@ function paginate(mergeData, extractDataFromResponse, isEof, invokeNextRequest,
|
|
|
39
39
|
setImmediate(() => fetchNextPage(data, previousResponse));
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
|
-
console.error(
|
|
42
|
+
console.error('[paginate] Error during pagination', `${e}`);
|
|
43
43
|
reject(e);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AxiosRequestConfig, AxiosResponse } from
|
|
2
|
-
import { RateLimiterMemory } from
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
+
import { RateLimiterMemory } from 'rate-limiter-flexible';
|
|
3
3
|
export declare class RateLimitedAxios {
|
|
4
4
|
rateLimiter: RateLimiterMemory;
|
|
5
5
|
enableLogging: boolean;
|
|
@@ -16,7 +16,7 @@ exports.RateLimitedAxios = void 0;
|
|
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
|
17
17
|
const rate_limiter_flexible_1 = require("rate-limiter-flexible");
|
|
18
18
|
const logger_util_1 = require("../logger.util");
|
|
19
|
-
const DEFAULT_KEY =
|
|
19
|
+
const DEFAULT_KEY = 'DEFAULT_KEY';
|
|
20
20
|
class RateLimitedAxios {
|
|
21
21
|
constructor(allowedCalls, intervall, enableLogging = false) {
|
|
22
22
|
this.rateLimiter = new rate_limiter_flexible_1.RateLimiterMemory({
|
|
@@ -35,7 +35,7 @@ class RateLimitedAxios {
|
|
|
35
35
|
}
|
|
36
36
|
catch (rateLimiterRes) {
|
|
37
37
|
if (this.enableLogging) {
|
|
38
|
-
(0, logger_util_1.infoLogger)(
|
|
38
|
+
(0, logger_util_1.infoLogger)('checkRateLimitAndWait', `Waiting ${rateLimiterRes.msBeforeNext} to respect rate limit`, key ? key : '');
|
|
39
39
|
}
|
|
40
40
|
yield new Promise((resolve) => {
|
|
41
41
|
setTimeout(resolve, rateLimiterRes.msBeforeNext);
|
package/dist/util/http/url.js
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getSubdomain = void 0;
|
|
4
4
|
function getSubdomain(url) {
|
|
5
5
|
// remove https protocol from url if exists
|
|
6
|
-
url = url.replace(/^(https?:\/\/)/,
|
|
7
|
-
const subdomain = url.split(
|
|
6
|
+
url = url.replace(/^(https?:\/\/)/, '');
|
|
7
|
+
const subdomain = url.split('.')[0];
|
|
8
8
|
if (subdomain)
|
|
9
9
|
return subdomain;
|
|
10
10
|
else
|
package/dist/util/index.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import * as Http from
|
|
2
|
-
import * as CallEventHelper from
|
|
3
|
-
import * as Security from
|
|
4
|
-
import * as Lang from
|
|
5
|
-
import * as GDPR from
|
|
6
|
-
import * as OAuth from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
1
|
+
import * as Http from './http';
|
|
2
|
+
import * as CallEventHelper from './callEventHelper';
|
|
3
|
+
import * as Security from './security';
|
|
4
|
+
import * as Lang from './lang';
|
|
5
|
+
import * as GDPR from './gdpr';
|
|
6
|
+
import * as OAuth from './oauth';
|
|
7
|
+
export * from './anonymize-key';
|
|
8
|
+
export * from './call-comment';
|
|
9
|
+
export * from './env';
|
|
10
|
+
export * from './error';
|
|
11
|
+
export * from './integration-entity';
|
|
12
|
+
export * from './logger.util';
|
|
13
|
+
export * from './phone-number-utils';
|
|
14
|
+
export * from './http';
|
|
15
|
+
export * from './callEventHelper';
|
|
16
|
+
export * from './security';
|
|
17
|
+
export * from './gdpr';
|
|
18
|
+
export * from './oauth';
|
|
19
|
+
export * from './env';
|
|
20
20
|
export { Http, CallEventHelper, Security, Lang, GDPR, OAuth };
|
|
21
|
-
export * from
|
|
21
|
+
export * from './token-util';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IntegrationEntity, LoggedIntegrationEntity } from
|
|
1
|
+
import { IntegrationEntity, LoggedIntegrationEntity } from '../models';
|
|
2
2
|
export declare const isLoggedIntegrationEntity: (e: IntegrationEntity | LoggedIntegrationEntity) => e is LoggedIntegrationEntity;
|
|
3
3
|
export declare const isIntegrationEntity: (e: IntegrationEntity | LoggedIntegrationEntity) => e is IntegrationEntity;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isIntegrationEntity = exports.isLoggedIntegrationEntity = void 0;
|
|
4
4
|
const isLoggedIntegrationEntity = (e) => {
|
|
5
|
-
return
|
|
5
|
+
return 'logId' in e && typeof e.logId === 'string' && e.logId !== '';
|
|
6
6
|
};
|
|
7
7
|
exports.isLoggedIntegrationEntity = isLoggedIntegrationEntity;
|
|
8
8
|
const isIntegrationEntity = (e) => !(0, exports.isLoggedIntegrationEntity)(e);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { diffArrays } from
|
|
1
|
+
import { diffArrays } from './diff';
|
|
2
2
|
export { diffArrays };
|
package/dist/util/logger.util.js
CHANGED
|
@@ -39,7 +39,7 @@ const logger = (logFn, source, message, apiKey, ...args) => {
|
|
|
39
39
|
// eslint-disable-next-line no-console
|
|
40
40
|
const anonymizedApiKey = apiKey ? (0, anonymize_key_1.anonymizeKey)(apiKey) : undefined;
|
|
41
41
|
const formatedMessage = constructLogMessage(anonymizedApiKey ? `[${anonymizedApiKey}]` : undefined, `[${source}]`, message);
|
|
42
|
-
if (process.env.NODE_ENV ==
|
|
42
|
+
if (process.env.NODE_ENV == 'development') {
|
|
43
43
|
logFn(formatedMessage, ...args);
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
@@ -55,7 +55,7 @@ const constructLogMessage = (...args) => `${args
|
|
|
55
55
|
.map((item) => {
|
|
56
56
|
if (Array.isArray(item) && item.length == 0)
|
|
57
57
|
return;
|
|
58
|
-
return typeof item !==
|
|
58
|
+
return typeof item !== 'string' ? JSON.stringify(item) : item;
|
|
59
59
|
})
|
|
60
|
-
.join(
|
|
60
|
+
.join(' ')}`;
|
|
61
61
|
//# sourceMappingURL=logger.util.js.map
|
package/dist/util/oauth.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Request, Response } from
|
|
2
|
-
import { AxiosResponse } from
|
|
1
|
+
import { Request, Response } from 'express';
|
|
2
|
+
import { AxiosResponse } from 'axios';
|
|
3
3
|
export type ExtractTokenFromResponseFn<T> = (response: AxiosResponse) => T;
|
|
4
4
|
export interface OAuthParams {
|
|
5
5
|
accesTokenUrl: string;
|
package/dist/util/oauth.js
CHANGED
|
@@ -51,7 +51,7 @@ function getOAuth2RedirectUrl(config, req, res) {
|
|
|
51
51
|
apiUrl: config.apiUrl,
|
|
52
52
|
});
|
|
53
53
|
const searchParamsAuth = new URLSearchParams({
|
|
54
|
-
response_type:
|
|
54
|
+
response_type: 'code',
|
|
55
55
|
redirect_uri: config.redirect_uri,
|
|
56
56
|
client_id: config.client_id,
|
|
57
57
|
state,
|
|
@@ -115,7 +115,7 @@ function getAccessToken(accessTokenURL, authorizationCode, clientId, clientSecre
|
|
|
115
115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
116
116
|
console.log(`Start: fetching access tokens`);
|
|
117
117
|
const params = {
|
|
118
|
-
grant_type:
|
|
118
|
+
grant_type: 'authorization_code',
|
|
119
119
|
code: authorizationCode,
|
|
120
120
|
client_id: clientId,
|
|
121
121
|
client_secret: clientSecret,
|
|
@@ -126,12 +126,12 @@ function getAccessToken(accessTokenURL, authorizationCode, clientId, clientSecre
|
|
|
126
126
|
return yield axios_1.default.post(accessTokenURL, {}, { params: params });
|
|
127
127
|
case GetAccessTokenParamCommunication.X_WWW_FORM_URL_ENCODED:
|
|
128
128
|
return yield axios_1.default.post(accessTokenURL, new URLSearchParams(params), {
|
|
129
|
-
headers: {
|
|
129
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
130
130
|
});
|
|
131
131
|
case GetAccessTokenParamCommunication.BODY:
|
|
132
132
|
return yield axios_1.default.post(accessTokenURL, params);
|
|
133
133
|
default:
|
|
134
|
-
throw Error(
|
|
134
|
+
throw Error('Unexpected parameter communication type');
|
|
135
135
|
break;
|
|
136
136
|
}
|
|
137
137
|
console.log(`End: fetching access tokens`);
|
|
@@ -142,7 +142,7 @@ function refreshToken(accessTokenURL, refresh_token, clientId, clientSecret, par
|
|
|
142
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
143
143
|
console.log(`Start: refreshing access tokens`);
|
|
144
144
|
const params = {
|
|
145
|
-
grant_type:
|
|
145
|
+
grant_type: 'refresh_token',
|
|
146
146
|
refresh_token: refresh_token,
|
|
147
147
|
client_id: clientId,
|
|
148
148
|
client_secret: clientSecret,
|
|
@@ -152,12 +152,12 @@ function refreshToken(accessTokenURL, refresh_token, clientId, clientSecret, par
|
|
|
152
152
|
return yield axios_1.default.post(accessTokenURL, {}, { params: params });
|
|
153
153
|
case GetAccessTokenParamCommunication.X_WWW_FORM_URL_ENCODED:
|
|
154
154
|
return yield axios_1.default.post(accessTokenURL, new URLSearchParams(params), {
|
|
155
|
-
headers: {
|
|
155
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
156
156
|
});
|
|
157
157
|
case GetAccessTokenParamCommunication.BODY:
|
|
158
158
|
return yield axios_1.default.post(accessTokenURL, params);
|
|
159
159
|
default:
|
|
160
|
-
throw Error(
|
|
160
|
+
throw Error('Unexpected parameter communication type');
|
|
161
161
|
break;
|
|
162
162
|
}
|
|
163
163
|
console.log(`End: refreshing access tokens`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PhoneNumber } from
|
|
2
|
-
import { APIPhoneNumber } from
|
|
1
|
+
import { PhoneNumber } from '../models';
|
|
2
|
+
import { APIPhoneNumber } from '../models/api-contact.model';
|
|
3
3
|
export declare const normalizePhoneNumber: (phoneNumber: string) => string;
|
|
4
4
|
export declare const parsePhoneNumber: ({ label, phoneNumber }: PhoneNumber, locale: string, ignoreRegion?: boolean) => APIPhoneNumber;
|
|
5
5
|
export declare const isDirectDial: (phoneNumber: string) => boolean;
|
|
@@ -4,7 +4,7 @@ exports.isDirectDial = exports.parsePhoneNumber = exports.normalizePhoneNumber =
|
|
|
4
4
|
const awesome_phonenumber_1 = require("awesome-phonenumber");
|
|
5
5
|
const models_1 = require("../models");
|
|
6
6
|
const MIN_PHONE_NUMBER_LENGTH = 5;
|
|
7
|
-
const normalizePhoneNumber = (phoneNumber) => phoneNumber.replace(/[^\d\w\+]/g,
|
|
7
|
+
const normalizePhoneNumber = (phoneNumber) => phoneNumber.replace(/[^\d\w\+]/g, '');
|
|
8
8
|
exports.normalizePhoneNumber = normalizePhoneNumber;
|
|
9
9
|
const parsePhoneNumber = ({ label, phoneNumber }, locale, ignoreRegion = false) => {
|
|
10
10
|
var _a, _b;
|
|
@@ -13,18 +13,18 @@ const parsePhoneNumber = ({ label, phoneNumber }, locale, ignoreRegion = false)
|
|
|
13
13
|
? models_1.PhoneNumberType.DIRECT_DIAL
|
|
14
14
|
: models_1.PhoneNumberType.STANDARD;
|
|
15
15
|
try {
|
|
16
|
-
const region = locale.replace(
|
|
16
|
+
const region = locale.replace('_', '-').replace(/.+-/, '').toUpperCase();
|
|
17
17
|
const parsedPhoneNumber = (0, awesome_phonenumber_1.parsePhoneNumber)(phoneNumber, region);
|
|
18
|
-
const nationalNumber = parsedPhoneNumber.getNumber(
|
|
18
|
+
const nationalNumber = parsedPhoneNumber.getNumber('national');
|
|
19
19
|
const phoneNumberRegion = parsedPhoneNumber.getRegionCode();
|
|
20
|
-
const e164 = (_a = parsedPhoneNumber.getNumber(
|
|
20
|
+
const e164 = (_a = parsedPhoneNumber.getNumber('e164')) !== null && _a !== void 0 ? _a : phoneNumber;
|
|
21
21
|
let newVar = {
|
|
22
22
|
label,
|
|
23
23
|
type,
|
|
24
24
|
e164: isNumberDirectDial ? phoneNumber : e164,
|
|
25
25
|
localized: ignoreRegion || region === phoneNumberRegion
|
|
26
26
|
? nationalNumber !== null && nationalNumber !== void 0 ? nationalNumber : phoneNumber
|
|
27
|
-
: (_b = parsedPhoneNumber.getNumber(
|
|
27
|
+
: (_b = parsedPhoneNumber.getNumber('international')) !== null && _b !== void 0 ? _b : phoneNumber,
|
|
28
28
|
phoneNumber: e164,
|
|
29
29
|
};
|
|
30
30
|
return newVar;
|
|
@@ -2,55 +2,55 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const models_1 = require("../models");
|
|
4
4
|
const phone_number_utils_1 = require("./phone-number-utils");
|
|
5
|
-
describe(
|
|
6
|
-
it(
|
|
7
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
8
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
9
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
10
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
11
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
12
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
13
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
14
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
15
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
16
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
17
|
-
});
|
|
18
|
-
it(
|
|
19
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
20
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
21
|
-
});
|
|
22
|
-
it(
|
|
23
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
24
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
25
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
26
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
27
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
28
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
29
|
-
});
|
|
30
|
-
it(
|
|
31
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
32
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
33
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
34
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
35
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
36
|
-
});
|
|
37
|
-
it(
|
|
38
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
39
|
-
});
|
|
40
|
-
it(
|
|
41
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
42
|
-
});
|
|
43
|
-
it(
|
|
44
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
45
|
-
});
|
|
46
|
-
it(
|
|
47
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
48
|
-
});
|
|
49
|
-
it(
|
|
50
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
51
|
-
});
|
|
52
|
-
it(
|
|
53
|
-
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber:
|
|
5
|
+
describe('convertPhoneNumberToE164', () => {
|
|
6
|
+
it('converts local phone numbers', () => {
|
|
7
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '015799912345' }, 'de-DE').e164).toEqual('+4915799912345');
|
|
8
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '0495 46.68.28' }, 'fr-BE').e164).toEqual('+32495466828');
|
|
9
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '26954490' }, 'fr-LU').e164).toEqual('+35226954490');
|
|
10
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '08-663 88 95 ' }, 'se-SE').e164).toEqual('+4686638895');
|
|
11
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '801 111 111' }, 'pl-PL').e164).toEqual('+48801111111');
|
|
12
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '913 693 210' }, 'es-ES').e164).toEqual('+34913693210');
|
|
13
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '415 (555) SHOE' }, 'en-US').e164).toEqual('+14155557463');
|
|
14
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '0173 CHOO CHOO' }, 'de-DE').e164).toEqual('+4917324662466');
|
|
15
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '415 CHOO CHOO' }, 'en-US').e164).toEqual('+141524662466');
|
|
16
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '(212) 366-1182' }, 'en-US').e164).toEqual('+12123661182');
|
|
17
|
+
});
|
|
18
|
+
it('converts international phone numbers', () => {
|
|
19
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '+48 601 777 257' }, 'de-DE').e164).toEqual('+48601777257');
|
|
20
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '+49 1579 99 12345' }, 'fr-LU').e164).toEqual('+4915799912345');
|
|
21
|
+
});
|
|
22
|
+
it('sanitizes phone numbers', () => {
|
|
23
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '0157-99912345' }, 'de-DE').e164).toEqual('+4915799912345');
|
|
24
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: ' 0157-999 12345' }, 'de-DE').e164).toEqual('+4915799912345');
|
|
25
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: ' 0157-999-12345' }, 'de-DE').e164).toEqual('+4915799912345');
|
|
26
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '0157/99912345' }, 'de-DE').e164).toEqual('+4915799912345');
|
|
27
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '01579 (991) 2-3 4 5' }, 'de-DE').e164).toEqual('+4915799912345');
|
|
28
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '+49 (1579) 991/2-3 4 5' }, 'de-DE').e164).toEqual('+4915799912345');
|
|
29
|
+
});
|
|
30
|
+
it('recovers invalid locale', () => {
|
|
31
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '015799912345' }, 'de-DE').e164).toEqual('+4915799912345');
|
|
32
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '015799912345' }, 'de').e164).toEqual('+4915799912345');
|
|
33
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '015799912345' }, 'De').e164).toEqual('+4915799912345');
|
|
34
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '015799912345' }, 'DE').e164).toEqual('+4915799912345');
|
|
35
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '015799912345' }, 'de-DE').e164).toEqual('+4915799912345');
|
|
36
|
+
});
|
|
37
|
+
it('returns initial phone number on invalid locale', () => {
|
|
38
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '801 111 111' }, '').e164).toEqual('801 111 111');
|
|
39
|
+
});
|
|
40
|
+
it('returns initial phone number on invalid phone number', () => {
|
|
41
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: 'invalid' }, 'de-DE').e164).toEqual('invalid');
|
|
42
|
+
});
|
|
43
|
+
it('formats a phone number from another region', () => {
|
|
44
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '+442012341234' }, 'de-DE').localized).toEqual('+44 20 1234 1234');
|
|
45
|
+
});
|
|
46
|
+
it('formats a direct dial correctly', () => {
|
|
47
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '22' }, 'de-DE').e164).toEqual('22');
|
|
48
|
+
});
|
|
49
|
+
it('returns national number for localized if ignoreRegion flag is set', () => {
|
|
50
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '+353 86 412 0894' }, 'de-DE', true).localized).toEqual('086 412 0894');
|
|
51
|
+
});
|
|
52
|
+
it('returns national number for localized if same region', () => {
|
|
53
|
+
expect((0, phone_number_utils_1.parsePhoneNumber)({ label: models_1.PhoneNumberLabel.WORK, phoneNumber: '+353 86 412 0894' }, 'en-IE').localized).toEqual('086 412 0894');
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
//# sourceMappingURL=phone-number-utils.test.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import * as Nonce from
|
|
1
|
+
import * as Nonce from './nonce';
|
|
2
2
|
export { Nonce };
|
|
3
|
-
export * from
|
|
3
|
+
export * from './nonce';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Request, Response } from
|
|
1
|
+
import { Request, Response } from 'express';
|
|
2
2
|
export declare function nonce(): string;
|
|
3
3
|
export declare function getNonceFromCookie(request: Request, response: Response, name: string, secret: string): string | undefined;
|
|
4
4
|
export declare function setNonceCookie(req: Request, res: Response, cookieName: string, secret: string, state: string): void;
|
|
@@ -13,7 +13,7 @@ function nonce() {
|
|
|
13
13
|
.map((byte) => {
|
|
14
14
|
return byte % 10;
|
|
15
15
|
})
|
|
16
|
-
.join(
|
|
16
|
+
.join('');
|
|
17
17
|
return nonce;
|
|
18
18
|
}
|
|
19
19
|
exports.nonce = nonce;
|
|
@@ -33,7 +33,7 @@ function setNonceCookie(req, res, cookieName, secret, state) {
|
|
|
33
33
|
cookies.set(cookieName, state, {
|
|
34
34
|
signed: true,
|
|
35
35
|
expires: new Date(Date.now() + 60000),
|
|
36
|
-
sameSite:
|
|
36
|
+
sameSite: 'none',
|
|
37
37
|
secure: true,
|
|
38
38
|
});
|
|
39
39
|
}
|
package/dist/util/size-of.js
CHANGED
|
@@ -30,13 +30,13 @@ function sizeOfObject(object) {
|
|
|
30
30
|
// tslint:disable-next-line no-any
|
|
31
31
|
function sizeof(object) {
|
|
32
32
|
switch (typeof object) {
|
|
33
|
-
case
|
|
33
|
+
case 'string':
|
|
34
34
|
return object.length * ECMA_SIZES.STRING;
|
|
35
|
-
case
|
|
35
|
+
case 'boolean':
|
|
36
36
|
return ECMA_SIZES.BOOLEAN;
|
|
37
|
-
case
|
|
37
|
+
case 'number':
|
|
38
38
|
return ECMA_SIZES.NUMBER;
|
|
39
|
-
case
|
|
39
|
+
case 'object':
|
|
40
40
|
return sizeOfObject(object);
|
|
41
41
|
default:
|
|
42
42
|
return 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TokenStorageCache } from
|
|
2
|
-
import { Config } from
|
|
3
|
-
import { Token } from
|
|
1
|
+
import { TokenStorageCache } from '../cache';
|
|
2
|
+
import { Config } from '../models';
|
|
3
|
+
import { Token } from '../models/token.model';
|
|
4
4
|
export type TokenRefreshFn = (config: Config) => Promise<Token>;
|
|
5
5
|
export declare function getTokenCache(): TokenStorageCache;
|
|
6
6
|
export declare function getFreshAccessToken(config: Config, refreshFn: TokenRefreshFn, force?: boolean): Promise<string>;
|
package/dist/util/token-util.js
CHANGED
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.getFreshAccessToken = exports.getTokenCache = void 0;
|
|
13
13
|
const cache_1 = require("../cache");
|
|
14
14
|
const storage_1 = require("../cache/storage");
|
|
15
|
+
const models_1 = require("../models");
|
|
15
16
|
const __1 = require("..");
|
|
16
17
|
const REFRESH_MARKER_TTL = 5;
|
|
17
18
|
function useCollection(value) {
|
|
@@ -19,17 +20,19 @@ function useCollection(value) {
|
|
|
19
20
|
if (!INTEGRATION_NAME) {
|
|
20
21
|
return value;
|
|
21
22
|
}
|
|
22
|
-
return `${INTEGRATION_NAME}:${value.replace(/:/g,
|
|
23
|
+
return `${INTEGRATION_NAME}:${value.replace(/:/g, '_')}`;
|
|
23
24
|
}
|
|
24
25
|
function getTokenCache() {
|
|
25
|
-
const { REDIS_URL } = process.env;
|
|
26
|
+
const { REDIS_URL, INTEGRATION_NAME } = process.env;
|
|
26
27
|
if (REDIS_URL) {
|
|
27
|
-
|
|
28
|
+
if (!INTEGRATION_NAME)
|
|
29
|
+
throw new models_1.ServerError(500, 'Missing INTEGRATION_NAME variable, cannot initialize Redis token cache.');
|
|
30
|
+
console.log(`[TOKEN CACHE] Using Redis cache for integration ${INTEGRATION_NAME}`);
|
|
28
31
|
return new cache_1.TokenStorageCache(new storage_1.RedisStorageAdapter(REDIS_URL));
|
|
29
32
|
}
|
|
30
|
-
console.log(
|
|
33
|
+
console.log('[TOKEN CACHE] Using memory cache');
|
|
31
34
|
const { TOKEN_CACHE_TTL } = process.env;
|
|
32
|
-
return new cache_1.TokenStorageCache(new storage_1.MemoryStorageAdapter(parseInt(TOKEN_CACHE_TTL ||
|
|
35
|
+
return new cache_1.TokenStorageCache(new storage_1.MemoryStorageAdapter(parseInt(TOKEN_CACHE_TTL || '60')));
|
|
33
36
|
}
|
|
34
37
|
exports.getTokenCache = getTokenCache;
|
|
35
38
|
function getFreshAccessToken(config, refreshFn, force = false) {
|
|
@@ -54,12 +57,12 @@ exports.getFreshAccessToken = getFreshAccessToken;
|
|
|
54
57
|
function getNewToken(config, refreshFn) {
|
|
55
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
59
|
yield __1.tokenCache.set(useCollection(config.apiKey), {
|
|
57
|
-
refresh_token:
|
|
58
|
-
access_token:
|
|
60
|
+
refresh_token: '',
|
|
61
|
+
access_token: '',
|
|
59
62
|
isPending: true,
|
|
60
63
|
}, REFRESH_MARKER_TTL);
|
|
61
64
|
const newToken = Object.assign(Object.assign({}, (yield refreshFn(config))), { isPending: false });
|
|
62
|
-
yield __1.tokenCache.set(useCollection(config.apiKey), newToken, parseInt(process.env.TOKEN_CACHE_TTL ||
|
|
65
|
+
yield __1.tokenCache.set(useCollection(config.apiKey), newToken, parseInt(process.env.TOKEN_CACHE_TTL || '60'));
|
|
63
66
|
return newToken;
|
|
64
67
|
});
|
|
65
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-util.js","sourceRoot":"","sources":["../../src/util/token-util.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAA6C;AAC7C,8CAA6E;
|
|
1
|
+
{"version":3,"file":"token-util.js","sourceRoot":"","sources":["../../src/util/token-util.ts"],"names":[],"mappings":"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"}
|
package/dist/util/validate.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import Ajv from
|
|
1
|
+
import Ajv from 'ajv';
|
|
2
2
|
export declare function validate(ajv: Ajv, schemaKeyRef: object | string | boolean, data: object): boolean;
|
package/dist/util/validate.js
CHANGED
|
@@ -5,13 +5,13 @@ function validate(ajv, schemaKeyRef, data) {
|
|
|
5
5
|
try {
|
|
6
6
|
const valid = ajv.validate(schemaKeyRef, data);
|
|
7
7
|
if (!valid) {
|
|
8
|
-
console.error(
|
|
8
|
+
console.error('Invalid data provided by adapter', ajv.errorsText());
|
|
9
9
|
}
|
|
10
10
|
// console.log("Adapter data is", {valid});
|
|
11
11
|
return valid;
|
|
12
12
|
}
|
|
13
13
|
catch (e) {
|
|
14
|
-
console.error(
|
|
14
|
+
console.error('Error validating data', e, ajv.errorsText());
|
|
15
15
|
// Ignore validation if validation is broken
|
|
16
16
|
return true;
|
|
17
17
|
}
|