@routr/common 2.7.3 → 2.7.6

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.
@@ -20,6 +20,7 @@ export declare const hasPasswordOrThrow: (password: string) => void;
20
20
  export declare const hasDomainUriOrThrow: (domainUri: string) => void;
21
21
  export declare const isValidDomainUriOrThrow: (domainUri: string) => void;
22
22
  export declare const hasTelUrlOrThrow: (telUrl: string) => void;
23
+ export declare const isValidTelUrlOrThrow: (telUrl: string) => void;
23
24
  export declare const isValidSessionAffinityHeaderOrThrow: (sessionAffinityHeader: string) => void;
24
25
  export declare const hasCityOrThrow: (city: string) => void;
25
26
  export declare const hasCountryOrThrow: (country: string) => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasValidOutboundUrisOrThrow = exports.isValidE164OrThrow = exports.isValidContactAddressOrThrow = exports.isValidAORLinkOrThrow = exports.hasAORLinkOrThrow = exports.isValidAOROrThrow = exports.hasAOROrThrow = exports.isValidInboundUriOrThrow = exports.hasInboundUriOrThrow = exports.hasCountryISOCodeOrThrow = exports.hasCountryOrThrow = exports.hasCityOrThrow = exports.isValidSessionAffinityHeaderOrThrow = exports.hasTelUrlOrThrow = exports.isValidDomainUriOrThrow = exports.hasDomainUriOrThrow = exports.hasPasswordOrThrow = exports.isValidUsernameOrThrow = exports.hasUsernameOrThrow = exports.isValidNameOrThrow = exports.hasNameOrThrow = exports.hasRefenceOrThrow = exports.hasValidACLRulesOrThrow = exports.hasACLRulesOrThrow = exports.hasValidHeadersOrThrow = void 0;
3
+ exports.hasValidOutboundUrisOrThrow = exports.isValidE164OrThrow = exports.isValidContactAddressOrThrow = exports.isValidAORLinkOrThrow = exports.hasAORLinkOrThrow = exports.isValidAOROrThrow = exports.hasAOROrThrow = exports.isValidInboundUriOrThrow = exports.hasInboundUriOrThrow = exports.hasCountryISOCodeOrThrow = exports.hasCountryOrThrow = exports.hasCityOrThrow = exports.isValidSessionAffinityHeaderOrThrow = exports.isValidTelUrlOrThrow = exports.hasTelUrlOrThrow = exports.isValidDomainUriOrThrow = exports.hasDomainUriOrThrow = exports.hasPasswordOrThrow = exports.isValidUsernameOrThrow = exports.hasUsernameOrThrow = exports.isValidNameOrThrow = exports.hasNameOrThrow = exports.hasRefenceOrThrow = exports.hasValidACLRulesOrThrow = exports.hasACLRulesOrThrow = exports.hasValidHeadersOrThrow = void 0;
4
4
  /*
5
5
  * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
6
6
  * http://github.com/fonoster/routr
@@ -56,6 +56,8 @@ const isValidDomainUriOrThrow = (domainUri) => validOrThrow(validations_1.isVali
56
56
  exports.isValidDomainUriOrThrow = isValidDomainUriOrThrow;
57
57
  const hasTelUrlOrThrow = (telUrl) => validOrThrow(validations_1.hasTelUrl, telUrl);
58
58
  exports.hasTelUrlOrThrow = hasTelUrlOrThrow;
59
+ const isValidTelUrlOrThrow = (telUrl) => validOrThrow(validations_1.isValidTelUrl, telUrl);
60
+ exports.isValidTelUrlOrThrow = isValidTelUrlOrThrow;
59
61
  const isValidSessionAffinityHeaderOrThrow = (sessionAffinityHeader) => validOrThrow(validations_1.isValidSessionAffinityHeader, sessionAffinityHeader);
60
62
  exports.isValidSessionAffinityHeaderOrThrow = isValidSessionAffinityHeaderOrThrow;
61
63
  const hasCityOrThrow = (city) => validOrThrow(validations_1.hasCity, city);
@@ -6,18 +6,18 @@ const types_1 = require("../types");
6
6
  const assertions_1 = require("./assertions");
7
7
  const valid = schemas_1.schemaValidators.get(types_1.Kind.TRUNK);
8
8
  function mapToTrunk(config) {
9
- var _a, _b, _c, _d, _e, _f;
9
+ var _a, _b, _c, _d, _e, _f, _g;
10
10
  (0, assertions_1.assertValidSchema)(config, valid);
11
11
  return {
12
12
  apiVersion: config.apiVersion,
13
13
  ref: config.ref,
14
14
  name: config.metadata.name,
15
- sendRegister: config.spec.outbound.sendRegister,
16
- inboundUri: (_a = config.spec.inbound) === null || _a === void 0 ? void 0 : _a.uri,
17
- inboundCredentialsRef: (_b = config.spec.inbound) === null || _b === void 0 ? void 0 : _b.credentialsRef,
18
- outboundCredentialsRef: (_c = config.spec.outbound) === null || _c === void 0 ? void 0 : _c.credentialsRef,
19
- accessControlListRef: (_d = config.spec.inbound) === null || _d === void 0 ? void 0 : _d.accessControlListRef,
20
- uris: (_f = (_e = config.spec.outbound) === null || _e === void 0 ? void 0 : _e.uris) === null || _f === void 0 ? void 0 : _f.map((entry) => {
15
+ sendRegister: (_a = config.spec.outbound) === null || _a === void 0 ? void 0 : _a.sendRegister,
16
+ inboundUri: (_b = config.spec.inbound) === null || _b === void 0 ? void 0 : _b.uri,
17
+ inboundCredentialsRef: (_c = config.spec.inbound) === null || _c === void 0 ? void 0 : _c.credentialsRef,
18
+ outboundCredentialsRef: (_d = config.spec.outbound) === null || _d === void 0 ? void 0 : _d.credentialsRef,
19
+ accessControlListRef: (_e = config.spec.inbound) === null || _e === void 0 ? void 0 : _e.accessControlListRef,
20
+ uris: (_g = (_f = config.spec.outbound) === null || _f === void 0 ? void 0 : _f.uris) === null || _g === void 0 ? void 0 : _g.map((entry) => {
21
21
  var _a;
22
22
  return {
23
23
  user: entry.uri.user,
@@ -8,6 +8,7 @@ export declare const hasPassword: (password: string) => true | BadRequestError;
8
8
  export declare const hasDomainUri: (domainUri: string) => true | BadRequestError;
9
9
  export declare const isValidDomainUri: (domainUri: string) => true | BadRequestError;
10
10
  export declare const hasTelUrl: (telUrl: string) => true | BadRequestError;
11
+ export declare const isValidTelUrl: (telUrl: string) => true | BadRequestError;
11
12
  export declare const isValidSessionAffinityHeader: (sessionAffinityHeader: string) => true | BadRequestError;
12
13
  export declare const isValidHeader: (header: string) => true | BadRequestError;
13
14
  export declare const hasValidHeaders: (headers: {
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.isValidE164 = exports.isValidWeight = exports.isValidPriority = exports.isValidContactAddress = exports.isValidHost = exports.hasHost = exports.isValidPort = exports.isValidInboundUri = exports.hasInboundUri = exports.hasValidACLRules = exports.isValidACLRule = exports.hasACLRules = exports.hasCountryISOCode = exports.hasCountry = exports.hasCity = exports.isValidAORLink = exports.hasAORLink = exports.isValidAOR = exports.hasAOR = exports.hasValidHeaders = exports.isValidHeader = exports.isValidSessionAffinityHeader = exports.hasTelUrl = exports.isValidDomainUri = exports.hasDomainUri = exports.hasPassword = exports.isValidUsername = exports.hasUsername = exports.isValidName = exports.hasName = exports.hasReference = void 0;
26
+ exports.isValidE164 = exports.isValidWeight = exports.isValidPriority = exports.isValidContactAddress = exports.isValidHost = exports.hasHost = exports.isValidPort = exports.isValidInboundUri = exports.hasInboundUri = exports.hasValidACLRules = exports.isValidACLRule = exports.hasACLRules = exports.hasCountryISOCode = exports.hasCountry = exports.hasCity = exports.isValidAORLink = exports.hasAORLink = exports.isValidAOR = exports.hasAOR = exports.hasValidHeaders = exports.isValidHeader = exports.isValidSessionAffinityHeader = exports.isValidTelUrl = exports.hasTelUrl = exports.isValidDomainUri = exports.hasDomainUri = exports.hasPassword = exports.isValidUsername = exports.hasUsername = exports.isValidName = exports.hasName = exports.hasReference = void 0;
27
27
  /*
28
28
  * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
29
29
  * http://github.com/fonoster/routr
@@ -78,6 +78,12 @@ const isValidDomainUri = (domainUri) => {
78
78
  exports.isValidDomainUri = isValidDomainUri;
79
79
  const hasTelUrl = (telUrl) => telUrl ? true : new errors_1.BadRequestError("the telUrl is required");
80
80
  exports.hasTelUrl = hasTelUrl;
81
+ const isValidTelUrl = (telUrl) => {
82
+ return telUrl.startsWith("tel:")
83
+ ? true
84
+ : new errors_1.BadRequestError("the telUrl must start with `tel:`");
85
+ };
86
+ exports.isValidTelUrl = isValidTelUrl;
81
87
  // Supports alphanumeric, underscore, and dash (cannot end with dash)
82
88
  const isValidAlphanumeric = (value) => {
83
89
  if (value.endsWith("-")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/common",
3
- "version": "2.7.3",
3
+ "version": "2.7.6",
4
4
  "description": "Common package",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/routr#readme",
@@ -55,5 +55,5 @@
55
55
  "devDependencies": {
56
56
  "@types/js-yaml": "^4.0.5"
57
57
  },
58
- "gitHead": "bf6ff39f269f1d6f479d6a0b9ca35331e97e24de"
58
+ "gitHead": "e965ed91da0286f15e25c9802b942ae41f42bf98"
59
59
  }