@routr/common 2.0.8-alpha.17 → 2.0.8-alpha.18
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/dist/auth.d.ts +2 -2
- package/dist/connect/api/client.js +8 -10
- package/dist/connect/api/types.d.ts +4 -4
- package/dist/connect/config.d.ts +5 -5
- package/dist/connect/grpc_client.d.ts +2 -2
- package/dist/connect/index.d.ts +1 -1
- package/dist/connect/index.js +1 -1
- package/dist/connect/mappers/acl.d.ts +3 -0
- package/dist/connect/mappers/acl.js +19 -0
- package/dist/connect/mappers/agent.d.ts +3 -0
- package/dist/connect/mappers/agent.js +42 -0
- package/dist/connect/mappers/assertions.d.ts +2 -0
- package/dist/connect/mappers/assertions.js +31 -0
- package/dist/connect/mappers/credentials.d.ts +3 -0
- package/dist/connect/mappers/credentials.js +18 -0
- package/dist/connect/mappers/domain.d.ts +3 -0
- package/dist/connect/mappers/domain.js +19 -0
- package/dist/connect/mappers/index.d.ts +7 -0
- package/dist/connect/mappers/index.js +41 -0
- package/dist/connect/mappers/number.d.ts +3 -0
- package/dist/connect/mappers/number.js +26 -0
- package/dist/connect/mappers/peer.d.ts +3 -0
- package/dist/connect/mappers/peer.js +21 -0
- package/dist/connect/mappers/trunk.d.ts +3 -0
- package/dist/connect/mappers/trunk.js +34 -0
- package/dist/connect/protos/acl.proto +11 -16
- package/dist/connect/protos/agents.proto +19 -23
- package/dist/connect/protos/credentials.proto +8 -10
- package/dist/connect/protos/domains.proto +16 -18
- package/dist/connect/protos/numbers.proto +15 -25
- package/dist/connect/protos/peers.proto +21 -33
- package/dist/connect/protos/trunks.proto +16 -24
- package/dist/connect/schemas/acl.d.ts +2 -0
- package/dist/connect/schemas/acl.js +4 -2
- package/dist/connect/schemas/agent.d.ts +2 -0
- package/dist/connect/schemas/agent.js +6 -4
- package/dist/connect/schemas/crendentials.d.ts +4 -0
- package/dist/connect/schemas/crendentials.js +7 -3
- package/dist/connect/schemas/domain.d.ts +2 -0
- package/dist/connect/schemas/domain.js +4 -2
- package/dist/connect/schemas/number.d.ts +4 -0
- package/dist/connect/schemas/number.js +7 -3
- package/dist/connect/schemas/peer.d.ts +2 -0
- package/dist/connect/schemas/peer.js +5 -3
- package/dist/connect/schemas/trunk.d.ts +3 -0
- package/dist/connect/schemas/trunk.js +20 -4
- package/dist/connect/types.d.ts +18 -6
- package/dist/helper.js +2 -2
- package/dist/types.d.ts +12 -20
- package/dist/types.js +9 -23
- package/package.json +2 -2
- package/dist/connect/converters.d.ts +0 -10
- package/dist/connect/converters.js +0 -178
package/dist/auth.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { AuthChallengeRequest, AuthChallengeResponse, ResponseType } from "./typ
|
|
|
2
2
|
export declare const generateNonce: (algorithm?: string) => string;
|
|
3
3
|
export declare const buildAuthChallenge: (request: AuthChallengeRequest) => {
|
|
4
4
|
realm: string;
|
|
5
|
-
scheme:
|
|
6
|
-
algorithm:
|
|
5
|
+
scheme: "Digest";
|
|
6
|
+
algorithm: "MD5";
|
|
7
7
|
qop: import("./types").Qop;
|
|
8
8
|
opaque: string;
|
|
9
9
|
stale: boolean;
|
|
@@ -44,12 +44,10 @@ exports.serviceAPI = exports.apiClient = void 0;
|
|
|
44
44
|
*/
|
|
45
45
|
/* eslint-disable require-jsdoc */
|
|
46
46
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
47
|
-
const
|
|
47
|
+
const pb_util_1 = require("pb-util");
|
|
48
48
|
const errors_1 = require("../../errors");
|
|
49
49
|
const grpc_client_1 = require("../grpc_client");
|
|
50
50
|
const types_1 = require("../types");
|
|
51
|
-
const jsonToStruct = protobufUtil.struct.encode;
|
|
52
|
-
const structToJson = protobufUtil.struct.decode;
|
|
53
51
|
function fire(err, apiAddr) {
|
|
54
52
|
if (err.code === grpc.status.UNAVAILABLE) {
|
|
55
53
|
return new errors_1.ServiceUnavailableError(`api server at ${apiAddr} is unavailable`);
|
|
@@ -79,28 +77,28 @@ function serviceAPI(options) {
|
|
|
79
77
|
return {
|
|
80
78
|
create: (request) => new Promise((resolve, reject) => {
|
|
81
79
|
if (request.extended) {
|
|
82
|
-
request.extended =
|
|
80
|
+
request.extended = pb_util_1.struct.encode(request.extended);
|
|
83
81
|
}
|
|
84
82
|
client.create(request, (err, response) => {
|
|
85
83
|
if (err) {
|
|
86
84
|
return reject(fire(err, apiAddr));
|
|
87
85
|
}
|
|
88
86
|
if (response.extended) {
|
|
89
|
-
response.extended =
|
|
87
|
+
response.extended = pb_util_1.struct.decode(response.extended);
|
|
90
88
|
}
|
|
91
89
|
resolve(response);
|
|
92
90
|
});
|
|
93
91
|
}),
|
|
94
92
|
update: (request) => new Promise((resolve, reject) => {
|
|
95
93
|
if (request.extended) {
|
|
96
|
-
request.extended =
|
|
94
|
+
request.extended = pb_util_1.struct.encode(request.extended);
|
|
97
95
|
}
|
|
98
96
|
client.update(request, (err, response) => {
|
|
99
97
|
if (err) {
|
|
100
98
|
return reject(fire(err, apiAddr));
|
|
101
99
|
}
|
|
102
100
|
if (response.extended) {
|
|
103
|
-
response.extended =
|
|
101
|
+
response.extended = pb_util_1.struct.decode(response.extended);
|
|
104
102
|
}
|
|
105
103
|
resolve(response);
|
|
106
104
|
});
|
|
@@ -111,7 +109,7 @@ function serviceAPI(options) {
|
|
|
111
109
|
return reject(fire(err, apiAddr));
|
|
112
110
|
}
|
|
113
111
|
if (response.extended) {
|
|
114
|
-
response.extended =
|
|
112
|
+
response.extended = pb_util_1.struct.decode(response.extended);
|
|
115
113
|
}
|
|
116
114
|
resolve(response);
|
|
117
115
|
});
|
|
@@ -124,7 +122,7 @@ function serviceAPI(options) {
|
|
|
124
122
|
}
|
|
125
123
|
response.items.forEach((item) => {
|
|
126
124
|
if (item.extended) {
|
|
127
|
-
item.extended =
|
|
125
|
+
item.extended = pb_util_1.struct.decode(item.extended);
|
|
128
126
|
}
|
|
129
127
|
});
|
|
130
128
|
resolve({
|
|
@@ -140,7 +138,7 @@ function serviceAPI(options) {
|
|
|
140
138
|
}
|
|
141
139
|
response.items.forEach((item) => {
|
|
142
140
|
if (item.extended) {
|
|
143
|
-
item.extended =
|
|
141
|
+
item.extended = pb_util_1.struct.decode(item.extended);
|
|
144
142
|
}
|
|
145
143
|
});
|
|
146
144
|
resolve(response);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as grpc from "@grpc/grpc-js";
|
|
2
|
-
import {
|
|
2
|
+
import { JsonObject } from "pb-util/build";
|
|
3
3
|
import { AccessControlList, Agent, Credentials, Domain, INumber, Kind, Peer, Trunk } from "../types";
|
|
4
4
|
export interface DataAPIOptions {
|
|
5
5
|
apiAddr: string;
|
|
@@ -35,10 +35,10 @@ export type APIClient = {
|
|
|
35
35
|
numbers: ServiceAPI<INumber>;
|
|
36
36
|
};
|
|
37
37
|
export type ServiceAPI<R extends {
|
|
38
|
-
extended?:
|
|
38
|
+
extended?: JsonObject;
|
|
39
39
|
}> = {
|
|
40
|
-
create: (request:
|
|
41
|
-
update: (request:
|
|
40
|
+
create: (request: JsonObject) => Promise<R>;
|
|
41
|
+
update: (request: JsonObject) => Promise<R>;
|
|
42
42
|
get: (ref: string) => Promise<R>;
|
|
43
43
|
del: (ref: string) => Promise<void>;
|
|
44
44
|
list: (request: {
|
package/dist/connect/config.d.ts
CHANGED
|
@@ -31,9 +31,9 @@ export interface PeerConfig extends ConfigBase {
|
|
|
31
31
|
spec: {
|
|
32
32
|
aor: string;
|
|
33
33
|
username: string;
|
|
34
|
-
credentialsRef
|
|
35
|
-
contactAddr
|
|
36
|
-
enabled
|
|
34
|
+
credentialsRef?: string;
|
|
35
|
+
contactAddr?: string;
|
|
36
|
+
enabled?: boolean;
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
export interface CredentialsConfig extends ConfigBase {
|
|
@@ -48,10 +48,10 @@ export interface CredentialsConfig extends ConfigBase {
|
|
|
48
48
|
export interface DomainConfig extends ConfigBase {
|
|
49
49
|
kind: Kind.DOMAIN;
|
|
50
50
|
spec: {
|
|
51
|
-
accessControlListRef
|
|
51
|
+
accessControlListRef?: string;
|
|
52
52
|
context: {
|
|
53
53
|
domainUri: string;
|
|
54
|
-
egressPolicies
|
|
54
|
+
egressPolicies?: {
|
|
55
55
|
rule: string;
|
|
56
56
|
numberRef: string;
|
|
57
57
|
}[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as grpc from "@grpc/grpc-js";
|
|
2
|
-
import { Kind } from "./types";
|
|
2
|
+
import { Kind, KindWithoutUnknown } from "./types";
|
|
3
3
|
export declare function createClient(options: {
|
|
4
4
|
kind: Kind;
|
|
5
5
|
credentials: grpc.ChannelCredentials;
|
|
6
6
|
apiAddr: string;
|
|
7
7
|
}): any;
|
|
8
|
-
export declare function createService(kind:
|
|
8
|
+
export declare function createService(kind: KindWithoutUnknown): any;
|
package/dist/connect/index.d.ts
CHANGED
package/dist/connect/index.js
CHANGED
|
@@ -36,4 +36,4 @@ __exportStar(require("./api"), exports);
|
|
|
36
36
|
__exportStar(require("./grpc_client"), exports);
|
|
37
37
|
__exportStar(require("./types"), exports);
|
|
38
38
|
__exportStar(require("./config"), exports);
|
|
39
|
-
__exportStar(require("./
|
|
39
|
+
__exportStar(require("./mappers"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapToACL = void 0;
|
|
4
|
+
const schemas_1 = require("../schemas");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const assertions_1 = require("./assertions");
|
|
7
|
+
const valid = schemas_1.schemaValidators.get(types_1.Kind.ACL);
|
|
8
|
+
function mapToACL(config) {
|
|
9
|
+
var _a, _b, _c, _d;
|
|
10
|
+
(0, assertions_1.assertValidSchema)(config, valid);
|
|
11
|
+
return {
|
|
12
|
+
apiVersion: config.apiVersion,
|
|
13
|
+
ref: config.ref,
|
|
14
|
+
name: config.metadata.name,
|
|
15
|
+
allow: (_b = (_a = config.spec.accessControlList) === null || _a === void 0 ? void 0 : _a.allow) !== null && _b !== void 0 ? _b : [],
|
|
16
|
+
deny: (_d = (_c = config.spec.accessControlList) === null || _c === void 0 ? void 0 : _c.deny) !== null && _d !== void 0 ? _d : []
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
exports.mapToACL = mapToACL;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapToAgent = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
6
|
+
* http://github.com/fonoster
|
|
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
|
+
/* eslint-disable require-jsdoc */
|
|
23
|
+
const types_1 = require("../../types");
|
|
24
|
+
const schemas_1 = require("../schemas");
|
|
25
|
+
const types_2 = require("../types");
|
|
26
|
+
const assertions_1 = require("./assertions");
|
|
27
|
+
const valid = schemas_1.schemaValidators.get(types_2.Kind.AGENT);
|
|
28
|
+
function mapToAgent(config) {
|
|
29
|
+
var _a;
|
|
30
|
+
(0, assertions_1.assertValidSchema)(config, valid);
|
|
31
|
+
return {
|
|
32
|
+
apiVersion: config.apiVersion,
|
|
33
|
+
ref: config.ref,
|
|
34
|
+
name: config.metadata.name,
|
|
35
|
+
username: config.spec.username,
|
|
36
|
+
privacy: (_a = config.spec.privacy) !== null && _a !== void 0 ? _a : types_1.Privacy.NONE,
|
|
37
|
+
enabled: config.spec.enabled,
|
|
38
|
+
domainRef: config.spec.domainRef,
|
|
39
|
+
credentialsRef: config.spec.credentialsRef
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
exports.mapToAgent = mapToAgent;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertValidSchema = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
6
|
+
* http://github.com/fonoster
|
|
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
|
+
const logger_1 = require("@fonoster/logger");
|
|
23
|
+
const logger = (0, logger_1.getLogger)({ service: "common", filePath: __filename });
|
|
24
|
+
const assertValidSchema = (config, valid) => {
|
|
25
|
+
if (!valid(config)) {
|
|
26
|
+
const error = valid.errors[0];
|
|
27
|
+
logger.error("found a bad resource: " + error.message + " at `" + error.dataPath + "`");
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.assertValidSchema = assertValidSchema;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapToCredentials = void 0;
|
|
4
|
+
const schemas_1 = require("../schemas");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const assertions_1 = require("./assertions");
|
|
7
|
+
const valid = schemas_1.schemaValidators.get(types_1.Kind.CREDENTIALS);
|
|
8
|
+
function mapToCredentials(config) {
|
|
9
|
+
(0, assertions_1.assertValidSchema)(config, valid);
|
|
10
|
+
return {
|
|
11
|
+
apiVersion: config.apiVersion,
|
|
12
|
+
ref: config.ref,
|
|
13
|
+
name: config.metadata.name,
|
|
14
|
+
username: config.spec.credentials.username,
|
|
15
|
+
password: config.spec.credentials.password
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.mapToCredentials = mapToCredentials;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapToDomain = void 0;
|
|
4
|
+
const schemas_1 = require("../schemas");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const assertions_1 = require("./assertions");
|
|
7
|
+
const valid = schemas_1.schemaValidators.get(types_1.Kind.DOMAIN);
|
|
8
|
+
function mapToDomain(config) {
|
|
9
|
+
(0, assertions_1.assertValidSchema)(config, valid);
|
|
10
|
+
return {
|
|
11
|
+
apiVersion: config.apiVersion,
|
|
12
|
+
ref: config.ref,
|
|
13
|
+
name: config.metadata.name,
|
|
14
|
+
domainUri: config.spec.context.domainUri,
|
|
15
|
+
accessControlListRef: config.spec.accessControlListRef,
|
|
16
|
+
egressPolicies: config.spec.context.egressPolicies
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
exports.mapToDomain = mapToDomain;
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
/*
|
|
18
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
19
|
+
* http://github.com/fonoster
|
|
20
|
+
*
|
|
21
|
+
* This file is part of Routr.
|
|
22
|
+
*
|
|
23
|
+
* Licensed under the MIT License (the "License");
|
|
24
|
+
* you may not use this file except in compliance with
|
|
25
|
+
* the License. You may obtain a copy of the License at
|
|
26
|
+
*
|
|
27
|
+
* https://opensource.org/licenses/MIT
|
|
28
|
+
*
|
|
29
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
30
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
31
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
32
|
+
* See the License for the specific language governing permissions and
|
|
33
|
+
* limitations under the License.
|
|
34
|
+
*/
|
|
35
|
+
__exportStar(require("./acl"), exports);
|
|
36
|
+
__exportStar(require("./agent"), exports);
|
|
37
|
+
__exportStar(require("./credentials"), exports);
|
|
38
|
+
__exportStar(require("./trunk"), exports);
|
|
39
|
+
__exportStar(require("./number"), exports);
|
|
40
|
+
__exportStar(require("./peer"), exports);
|
|
41
|
+
__exportStar(require("./domain"), exports);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapToNumber = void 0;
|
|
4
|
+
const schemas_1 = require("../schemas");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const assertions_1 = require("./assertions");
|
|
7
|
+
const valid = schemas_1.schemaValidators.get(types_1.Kind.NUMBER);
|
|
8
|
+
function mapToNumber(config) {
|
|
9
|
+
(0, assertions_1.assertValidSchema)(config, valid);
|
|
10
|
+
const metadata = config.metadata;
|
|
11
|
+
const location = config.spec.location;
|
|
12
|
+
return {
|
|
13
|
+
apiVersion: config.apiVersion,
|
|
14
|
+
ref: config.ref,
|
|
15
|
+
name: metadata.name,
|
|
16
|
+
city: metadata.geoInfo.city,
|
|
17
|
+
country: metadata.geoInfo.country,
|
|
18
|
+
countryISOCode: metadata.geoInfo.countryISOCode,
|
|
19
|
+
telUrl: location.telUrl,
|
|
20
|
+
aorLink: location.aorLink,
|
|
21
|
+
sessionAffinityHeader: location.sessionAffinityHeader,
|
|
22
|
+
extraHeaders: location.extraHeaders,
|
|
23
|
+
trunkRef: config.spec.trunkRef
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.mapToNumber = mapToNumber;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapToPeer = void 0;
|
|
4
|
+
const schemas_1 = require("../schemas");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const assertions_1 = require("./assertions");
|
|
7
|
+
const valid = schemas_1.schemaValidators.get(types_1.Kind.PEER);
|
|
8
|
+
function mapToPeer(config) {
|
|
9
|
+
(0, assertions_1.assertValidSchema)(config, valid);
|
|
10
|
+
return {
|
|
11
|
+
apiVersion: config.apiVersion,
|
|
12
|
+
ref: config.ref,
|
|
13
|
+
name: config.metadata.name,
|
|
14
|
+
username: config.spec.username,
|
|
15
|
+
aor: config.spec.aor,
|
|
16
|
+
contactAddr: config.spec.contactAddr,
|
|
17
|
+
enabled: config.spec.enabled,
|
|
18
|
+
credentialsRef: config.spec.credentialsRef
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
exports.mapToPeer = mapToPeer;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapToTrunk = void 0;
|
|
4
|
+
const schemas_1 = require("../schemas");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const assertions_1 = require("./assertions");
|
|
7
|
+
const valid = schemas_1.schemaValidators.get(types_1.Kind.TRUNK);
|
|
8
|
+
function mapToTrunk(config) {
|
|
9
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10
|
+
(0, assertions_1.assertValidSchema)(config, valid);
|
|
11
|
+
return {
|
|
12
|
+
apiVersion: config.apiVersion,
|
|
13
|
+
ref: config.ref,
|
|
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) => {
|
|
21
|
+
var _a;
|
|
22
|
+
return {
|
|
23
|
+
user: entry.uri.user,
|
|
24
|
+
host: entry.uri.host,
|
|
25
|
+
port: entry.uri.port,
|
|
26
|
+
transport: (_a = entry.uri.transport) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
|
|
27
|
+
enabled: entry.enabled,
|
|
28
|
+
weight: entry.weight,
|
|
29
|
+
priority: entry.priority
|
|
30
|
+
};
|
|
31
|
+
})
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
exports.mapToTrunk = mapToTrunk;
|
|
@@ -20,6 +20,7 @@ syntax = "proto3";
|
|
|
20
20
|
|
|
21
21
|
package fonoster.routr.connect.acl.v2draft1;
|
|
22
22
|
|
|
23
|
+
import "google/protobuf/struct.proto";
|
|
23
24
|
import "google/protobuf/empty.proto";
|
|
24
25
|
|
|
25
26
|
// AccessControlList(ACL) service definition
|
|
@@ -52,40 +53,34 @@ message AccessControlList {
|
|
|
52
53
|
int32 created_at = 6;
|
|
53
54
|
// The date the ACL was last updated
|
|
54
55
|
int32 updated_at = 7;
|
|
56
|
+
// The extended attributes of the ACL
|
|
57
|
+
.google.protobuf.Struct extended = 8;
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
// The request message for the AccessControlList.Create method
|
|
58
61
|
message CreateACLRequest {
|
|
59
|
-
// The version of the API
|
|
60
|
-
string api_version = 1;
|
|
61
62
|
// A friendly name for the ACL
|
|
62
63
|
string name = 2;
|
|
63
64
|
// The list of allowed IP addresses
|
|
64
65
|
repeated string allow = 3;
|
|
65
66
|
// The list of denied IP addresses
|
|
66
67
|
repeated string deny = 4;
|
|
67
|
-
// The
|
|
68
|
-
|
|
69
|
-
// The date the ACL was last updated
|
|
70
|
-
int32 updated_at = 6;
|
|
68
|
+
// The extended attributes of the ACL
|
|
69
|
+
.google.protobuf.Struct extended = 5;
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
// The request message for the AccessControlList.Update method
|
|
74
73
|
message UpdateACLRequest {
|
|
75
|
-
// The version of the API
|
|
76
|
-
string api_version = 1;
|
|
77
74
|
// The ACL reference
|
|
78
|
-
string ref =
|
|
75
|
+
string ref = 1;
|
|
79
76
|
// A friendly name for the ACL
|
|
80
|
-
string name =
|
|
77
|
+
string name = 2;
|
|
81
78
|
// The list of allowed IP addresses
|
|
82
|
-
repeated string allow =
|
|
79
|
+
repeated string allow = 3;
|
|
83
80
|
// The list of denied IP addresses
|
|
84
|
-
repeated string deny =
|
|
85
|
-
// The
|
|
86
|
-
|
|
87
|
-
// The date the ACL was last updated
|
|
88
|
-
int32 updated_at = 7;
|
|
81
|
+
repeated string deny = 4;
|
|
82
|
+
// The extended attributes of the ACL
|
|
83
|
+
.google.protobuf.Struct extended = 5;
|
|
89
84
|
}
|
|
90
85
|
|
|
91
86
|
// The request message for the AccessControlList.Get method
|
|
@@ -74,44 +74,40 @@ message Agent {
|
|
|
74
74
|
|
|
75
75
|
// The request message for the Agents.Create method
|
|
76
76
|
message CreateAgentRequest {
|
|
77
|
-
// The API version of the Agent
|
|
78
|
-
string api_version = 1;
|
|
79
77
|
// The name of the Agent
|
|
80
|
-
string name =
|
|
78
|
+
string name = 1;
|
|
81
79
|
// The username of the Agent
|
|
82
|
-
string username =
|
|
80
|
+
string username = 2;
|
|
83
81
|
// The password of the Agent
|
|
84
|
-
Privacy privacy =
|
|
82
|
+
Privacy privacy = 3;
|
|
85
83
|
// The enabled status of the Agent
|
|
86
|
-
bool enabled =
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
//
|
|
90
|
-
|
|
84
|
+
bool enabled = 4;
|
|
85
|
+
// Reference to the Domain of the Agent
|
|
86
|
+
string domain_ref = 5;
|
|
87
|
+
// Reference to the Credentials of the Agent
|
|
88
|
+
string credentials_ref = 6;
|
|
91
89
|
// The extended attributes of the Agent
|
|
92
|
-
.google.protobuf.Struct extended =
|
|
90
|
+
.google.protobuf.Struct extended = 7;
|
|
93
91
|
}
|
|
94
92
|
|
|
95
93
|
// The request message for the Agents.Update method
|
|
96
94
|
message UpdateAgentRequest {
|
|
97
|
-
// The API version of the Agent
|
|
98
|
-
string api_version = 1;
|
|
99
95
|
// The unique identifier of the Agent
|
|
100
|
-
string ref =
|
|
96
|
+
string ref = 1;
|
|
101
97
|
// The name of the Agent
|
|
102
|
-
string name =
|
|
98
|
+
string name = 2;
|
|
103
99
|
// The username of the Agent
|
|
104
|
-
string username =
|
|
100
|
+
string username = 3;
|
|
105
101
|
// The privacy settings of the Agent
|
|
106
|
-
Privacy privacy =
|
|
102
|
+
Privacy privacy = 4;
|
|
107
103
|
// The enabled status of the Agent
|
|
108
|
-
bool enabled =
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
//
|
|
112
|
-
|
|
104
|
+
bool enabled = 5;
|
|
105
|
+
// Reference to the Domain of the Agent
|
|
106
|
+
string domain_ref = 6;
|
|
107
|
+
// Reference to the Credentials of the Agent
|
|
108
|
+
string credentials_ref = 7;
|
|
113
109
|
// The extended attributes of the Agent
|
|
114
|
-
.google.protobuf.Struct extended =
|
|
110
|
+
.google.protobuf.Struct extended = 8;
|
|
115
111
|
}
|
|
116
112
|
|
|
117
113
|
// The request message for the Agents.Get method
|
|
@@ -59,16 +59,14 @@ message Credentials {
|
|
|
59
59
|
|
|
60
60
|
// The request message for the CreateCredentials.Create method
|
|
61
61
|
message CreateCredentialsRequest {
|
|
62
|
-
// The API version of the Credentials
|
|
63
|
-
string api_version = 1;
|
|
64
62
|
// The name of the Credentials
|
|
65
|
-
string name =
|
|
63
|
+
string name = 1;
|
|
66
64
|
// The username of the Credentials
|
|
67
|
-
string username =
|
|
65
|
+
string username = 2;
|
|
68
66
|
// The password of the Credentials
|
|
69
|
-
string password =
|
|
67
|
+
string password = 3;
|
|
70
68
|
// The extended attributes for a set of Credentials
|
|
71
|
-
.google.protobuf.Struct extended =
|
|
69
|
+
.google.protobuf.Struct extended = 4;
|
|
72
70
|
}
|
|
73
71
|
|
|
74
72
|
// The request message for the UpdateCredentials.Update method
|
|
@@ -76,13 +74,13 @@ message UpdateCredentialsRequest {
|
|
|
76
74
|
// The reference of the Credentials to update
|
|
77
75
|
string ref = 1;
|
|
78
76
|
// The new name of the Credentials
|
|
79
|
-
string name =
|
|
77
|
+
string name = 2;
|
|
80
78
|
// The new username of the Credentials
|
|
81
|
-
string username =
|
|
79
|
+
string username = 3;
|
|
82
80
|
// The new password of the Credentials
|
|
83
|
-
string password =
|
|
81
|
+
string password = 4;
|
|
84
82
|
// The extended attributes for a set of Credentials
|
|
85
|
-
.google.protobuf.Struct extended =
|
|
83
|
+
.google.protobuf.Struct extended = 5;
|
|
86
84
|
}
|
|
87
85
|
|
|
88
86
|
// The request message for the GetCredentials.Get method
|