@routr/common 2.22.0 → 2.24.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.
@@ -95,6 +95,9 @@ export interface NumberConfig extends Omit<ConfigBase, "metadata"> {
95
95
  export interface TrunkConfig extends ConfigBase {
96
96
  kind: Kind.TRUNK;
97
97
  spec: {
98
+ normalizeToE164?: boolean;
99
+ rewriteFromWithNumber?: boolean;
100
+ fromDomain?: string;
98
101
  inbound: {
99
102
  uri: string;
100
103
  accessControlListRef: string;
@@ -6,18 +6,21 @@ 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, _g;
9
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
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
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) => {
16
+ normalizeToE164: (_b = config.spec.normalizeToE164) !== null && _b !== void 0 ? _b : false,
17
+ rewriteFromWithNumber: (_c = config.spec.rewriteFromWithNumber) !== null && _c !== void 0 ? _c : false,
18
+ fromDomain: config.spec.fromDomain,
19
+ inboundUri: (_d = config.spec.inbound) === null || _d === void 0 ? void 0 : _d.uri,
20
+ inboundCredentialsRef: (_e = config.spec.inbound) === null || _e === void 0 ? void 0 : _e.credentialsRef,
21
+ outboundCredentialsRef: (_f = config.spec.outbound) === null || _f === void 0 ? void 0 : _f.credentialsRef,
22
+ accessControlListRef: (_g = config.spec.inbound) === null || _g === void 0 ? void 0 : _g.accessControlListRef,
23
+ uris: (_j = (_h = config.spec.outbound) === null || _h === void 0 ? void 0 : _h.uris) === null || _j === void 0 ? void 0 : _j.map((entry) => {
21
24
  var _a;
22
25
  return {
23
26
  user: entry.uri.user,
@@ -88,6 +88,12 @@ message Trunk {
88
88
  .google.protobuf.Struct extended = 12;
89
89
  // Message recording for the calls that touch this Trunk
90
90
  fonoster.routr.connect.trace.v2beta1.Trace trace = 13;
91
+ // Normalize From, To and Request-URI users to +E.164 on calls through this Trunk
92
+ bool normalize_to_e164 = 14;
93
+ // On calls leaving through this Trunk, From becomes the Number's E.164 at from_domain
94
+ bool rewrite_from_with_number = 15;
95
+ // Host part of the rewritten From. Defaults to the outbound URI host
96
+ string from_domain = 16;
91
97
  }
92
98
 
93
99
  // The message for the Trunk.Create
@@ -112,6 +118,12 @@ message CreateTrunkRequest {
112
118
  .google.protobuf.Struct extended = 9;
113
119
  // Message recording for the calls that touch this Trunk
114
120
  fonoster.routr.connect.trace.v2beta1.Trace trace = 10;
121
+ // Normalize From, To and Request-URI users to +E.164 on calls through this Trunk
122
+ bool normalize_to_e164 = 11;
123
+ // On calls leaving through this Trunk, From becomes the Number's E.164 at from_domain
124
+ bool rewrite_from_with_number = 12;
125
+ // Host part of the rewritten From. Defaults to the outbound URI host
126
+ string from_domain = 13;
115
127
  }
116
128
 
117
129
  // The message for the Trunk.Update
@@ -138,6 +150,12 @@ message UpdateTrunkRequest {
138
150
  .google.protobuf.Struct extended = 10;
139
151
  // Message recording for the calls that touch this Trunk
140
152
  fonoster.routr.connect.trace.v2beta1.Trace trace = 11;
153
+ // Normalize From, To and Request-URI users to +E.164 on calls through this Trunk
154
+ optional bool normalize_to_e164 = 12;
155
+ // On calls leaving through this Trunk, From becomes the Number's E.164 at from_domain
156
+ optional bool rewrite_from_with_number = 13;
157
+ // Host part of the rewritten From. Defaults to the outbound URI host
158
+ optional string from_domain = 14;
141
159
  }
142
160
 
143
161
  // The message for the Trunk.Get
@@ -30,6 +30,19 @@ declare const _default: {
30
30
  description: string;
31
31
  type: string;
32
32
  properties: {
33
+ normalizeToE164: {
34
+ description: string;
35
+ type: string;
36
+ };
37
+ rewriteFromWithNumber: {
38
+ description: string;
39
+ type: string;
40
+ };
41
+ fromDomain: {
42
+ description: string;
43
+ type: string;
44
+ maxLength: number;
45
+ };
33
46
  trace: {
34
47
  description: string;
35
48
  type: string;
@@ -50,6 +50,19 @@ exports.default = {
50
50
  description: "Operations spec for an Trunk",
51
51
  type: "object",
52
52
  properties: {
53
+ normalizeToE164: {
54
+ description: "Normalize From, To and Request-URI users to +E.164 on calls through this Trunk",
55
+ type: "boolean"
56
+ },
57
+ rewriteFromWithNumber: {
58
+ description: "On calls leaving through this Trunk, From becomes the Number's E.164 at fromDomain",
59
+ type: "boolean"
60
+ },
61
+ fromDomain: {
62
+ description: "Host part of the rewritten From. Defaults to the outbound URI host",
63
+ type: "string",
64
+ maxLength: 255
65
+ },
53
66
  trace: {
54
67
  description: "Message recording for the calls that touch this Trunk",
55
68
  type: "object",
@@ -73,6 +73,9 @@ export interface INumber extends BaseConnectModel {
73
73
  }
74
74
  export interface Trunk extends BaseConnectModel {
75
75
  sendRegister: boolean;
76
+ normalizeToE164?: boolean;
77
+ rewriteFromWithNumber?: boolean;
78
+ fromDomain?: string;
76
79
  inboundUri: string;
77
80
  accessControlListRef?: string;
78
81
  accessControlList?: AccessControlList;
package/dist/index.d.ts CHANGED
@@ -13,6 +13,5 @@ export * as CommonResponse from "./response";
13
13
  export * as CommonTypes from "./types";
14
14
  export * as CommonErrors from "./errors";
15
15
  export * as ConnectSchemas from "./connect/schemas";
16
- export * as Environment from "./envs";
17
16
  export * as Verifier from "./verifier";
18
17
  export * as Trace from "./trace";
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.Trace = exports.Verifier = exports.Environment = exports.ConnectSchemas = exports.CommonErrors = exports.CommonTypes = exports.CommonResponse = exports.CommonRequester = exports.CommonConnect = exports.Assertions = exports.Tracer = exports.IpUtils = exports.Helper = exports.Redis = exports.Auth = exports.statusMap = exports.GRPC_SERVING_STATUS = exports.LOCATION_OBJECT_PROTO = exports.PROCESSOR_OBJECT_PROTO = exports.Method = exports.Transport = exports.getObjectProto = exports.createService = void 0;
36
+ exports.Trace = exports.Verifier = exports.ConnectSchemas = exports.CommonErrors = exports.CommonTypes = exports.CommonResponse = exports.CommonRequester = exports.CommonConnect = exports.Assertions = exports.Tracer = exports.IpUtils = exports.Helper = exports.Redis = exports.Auth = exports.statusMap = exports.GRPC_SERVING_STATUS = exports.LOCATION_OBJECT_PROTO = exports.PROCESSOR_OBJECT_PROTO = exports.Method = exports.Transport = exports.getObjectProto = exports.createService = void 0;
37
37
  /*
38
38
  * Copyright (C) 2026 by Fonoster Inc (https://fonoster.com)
39
39
  * http://github.com/fonoster/routr
@@ -74,6 +74,5 @@ exports.CommonResponse = __importStar(require("./response"));
74
74
  exports.CommonTypes = __importStar(require("./types"));
75
75
  exports.CommonErrors = __importStar(require("./errors"));
76
76
  exports.ConnectSchemas = __importStar(require("./connect/schemas"));
77
- exports.Environment = __importStar(require("./envs"));
78
77
  exports.Verifier = __importStar(require("./verifier"));
79
78
  exports.Trace = __importStar(require("./trace"));
package/dist/types.d.ts CHANGED
@@ -144,6 +144,19 @@ export interface Route {
144
144
  labels?: Map<string, string>;
145
145
  headers?: HeaderModifier[];
146
146
  metadata?: Record<string, string>;
147
+ /**
148
+ * Set on routes to a Trunk with normalizeToE164: the From, To and Request-URI
149
+ * users are normalized to +E.164 before the request leaves.
150
+ */
151
+ normalizeToE164?: boolean;
152
+ /**
153
+ * Set on routes to a Trunk with rewriteFromWithNumber: the identity the
154
+ * From header takes on the way out (the Number, at the Trunk's fromDomain).
155
+ */
156
+ rewriteFrom?: {
157
+ user: string;
158
+ host: string;
159
+ };
147
160
  }
148
161
  export declare enum ResponseType {
149
162
  UNKNOWN = "UNKNOWN",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/common",
3
- "version": "2.22.0",
3
+ "version": "2.24.0",
4
4
  "description": "Common package",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/routr#readme",
@@ -53,5 +53,5 @@
53
53
  "devDependencies": {
54
54
  "@types/js-yaml": "^4.0.5"
55
55
  },
56
- "gitHead": "43868fbe7fb81a31b7eadd88d6847778d10f1754"
56
+ "gitHead": "168637a54c6390bb7c79dc77a6e9f763d2ce2da2"
57
57
  }
package/dist/envs.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const ENFORCE_E164: boolean;
2
- export declare const ENFORCE_E164_WITH_MOBILE_PREFIX: boolean;
package/dist/envs.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ENFORCE_E164_WITH_MOBILE_PREFIX = exports.ENFORCE_E164 = void 0;
4
- /*
5
- * Copyright (C) 2026 by Fonoster Inc (https://fonoster.com)
6
- * http://github.com/fonoster/routr
7
- *
8
- * This file is part of Routr.
9
- *
10
- * Licensed under the MIT License (the "License");
11
- * you may not use this file except in compliance with
12
- * the License. You may obtain a copy of the License at
13
- *
14
- * https://opensource.org/licenses/MIT
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- */
22
- exports.ENFORCE_E164 = process.env.ENFORCE_E164 === "true" ? true : false;
23
- exports.ENFORCE_E164_WITH_MOBILE_PREFIX = process.env.ENFORCE_E164_WITH_MOBILE_PREFIX === "true" ? true : false;