@routr/common 2.0.8-alpha.13 → 2.0.8-alpha.15
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/connect/api/client.d.ts +3 -0
- package/dist/connect/api/client.js +154 -0
- package/dist/connect/api/index.d.ts +2 -0
- package/dist/connect/api/index.js +36 -0
- package/dist/connect/api/types.d.ts +55 -0
- package/dist/connect/api/types.js +2 -0
- package/dist/connect/config.d.ts +109 -0
- package/dist/connect/config.js +2 -0
- package/dist/connect/converters.d.ts +10 -0
- package/dist/connect/converters.js +176 -0
- package/dist/connect/grpc_client.d.ts +8 -1
- package/dist/connect/grpc_client.js +44 -6
- package/dist/connect/index.d.ts +3 -1
- package/dist/connect/index.js +3 -1
- package/dist/connect/protos/acl.proto +117 -0
- package/dist/connect/protos/agents.proto +154 -0
- package/dist/connect/protos/credentials.proto +116 -0
- package/dist/connect/protos/domains.proto +150 -0
- package/dist/connect/protos/numbers.proto +184 -0
- package/dist/connect/protos/peers.proto +166 -0
- package/dist/connect/protos/trunks.proto +186 -0
- package/dist/connect/schemas/acl.d.ts +61 -0
- package/dist/connect/schemas/acl.js +80 -0
- package/dist/connect/schemas/agent.d.ts +60 -0
- package/dist/connect/schemas/agent.js +79 -0
- package/dist/connect/schemas/crendentials.d.ts +55 -0
- package/dist/connect/schemas/crendentials.js +74 -0
- package/dist/connect/schemas/domain.d.ts +73 -0
- package/dist/connect/schemas/domain.js +92 -0
- package/dist/connect/schemas/index.d.ts +1 -0
- package/dist/connect/schemas/index.js +35 -0
- package/dist/connect/schemas/number.d.ts +78 -0
- package/dist/connect/schemas/number.js +97 -0
- package/dist/connect/schemas/peer.d.ts +68 -0
- package/dist/connect/schemas/peer.js +87 -0
- package/dist/connect/schemas/trunk.d.ts +116 -0
- package/dist/connect/schemas/trunk.js +135 -0
- package/dist/connect/schemas/validators.d.ts +2 -0
- package/dist/connect/schemas/validators.js +43 -0
- package/dist/connect/types.d.ts +74 -25
- package/dist/connect/types.js +7 -30
- package/dist/errors.d.ts +35 -1
- package/dist/errors.js +51 -5
- package/dist/helper.d.ts +1 -0
- package/dist/helper.js +11 -3
- package/dist/index.d.ts +5 -4
- package/dist/index.js +5 -5
- package/dist/protos/common.proto +0 -2
- package/dist/protos/location.proto +3 -2
- package/dist/service.d.ts +2 -2
- package/dist/service.js +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +3 -3
- package/dist/connect/data_api.d.ts +0 -11
- package/dist/connect/data_api.js +0 -91
- package/dist/protos/resources.proto +0 -108
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
$id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
type: string;
|
|
6
|
+
properties: {
|
|
7
|
+
apiVersion: {
|
|
8
|
+
enum: string[];
|
|
9
|
+
};
|
|
10
|
+
kind: {
|
|
11
|
+
enum: string[];
|
|
12
|
+
};
|
|
13
|
+
ref: {
|
|
14
|
+
description: string;
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
metadata: {
|
|
18
|
+
description: string;
|
|
19
|
+
type: string;
|
|
20
|
+
properties: {
|
|
21
|
+
name: {
|
|
22
|
+
description: string;
|
|
23
|
+
type: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
required: string[];
|
|
27
|
+
};
|
|
28
|
+
spec: {
|
|
29
|
+
description: string;
|
|
30
|
+
type: string;
|
|
31
|
+
properties: {
|
|
32
|
+
username: {
|
|
33
|
+
description: string;
|
|
34
|
+
type: string;
|
|
35
|
+
minLength: number;
|
|
36
|
+
maxLength: number;
|
|
37
|
+
readOnly: boolean;
|
|
38
|
+
};
|
|
39
|
+
aor: {
|
|
40
|
+
description: string;
|
|
41
|
+
type: string;
|
|
42
|
+
minLength: number;
|
|
43
|
+
maxLength: number;
|
|
44
|
+
};
|
|
45
|
+
contactAddr: {
|
|
46
|
+
description: string;
|
|
47
|
+
type: string;
|
|
48
|
+
maxLength: number;
|
|
49
|
+
};
|
|
50
|
+
credentialsRef: {
|
|
51
|
+
description: string;
|
|
52
|
+
type: string;
|
|
53
|
+
};
|
|
54
|
+
accessControlListRef: {
|
|
55
|
+
description: string;
|
|
56
|
+
type: string;
|
|
57
|
+
};
|
|
58
|
+
enabled: {
|
|
59
|
+
description: string;
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
required: string[];
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
required: string[];
|
|
67
|
+
};
|
|
68
|
+
export default _default;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
|
|
5
|
+
* http://github.com/fonoster
|
|
6
|
+
*
|
|
7
|
+
* This file is part of Routr.
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the MIT License (the "License");
|
|
10
|
+
* you may not use this file except in compliance with
|
|
11
|
+
* the License. You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* https://opensource.org/licenses/MIT
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
* See the License for the specific language governing permissions and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
exports.default = {
|
|
22
|
+
$id: "https://json-schema.org/draft/2020-12/schema",
|
|
23
|
+
title: "Agent validation schema",
|
|
24
|
+
description: "The spec defined for Peer validation",
|
|
25
|
+
type: "object",
|
|
26
|
+
properties: {
|
|
27
|
+
apiVersion: {
|
|
28
|
+
enum: ["v2draft1", "v2.0", "v2"]
|
|
29
|
+
},
|
|
30
|
+
kind: {
|
|
31
|
+
enum: ["Peer", "peer"]
|
|
32
|
+
},
|
|
33
|
+
ref: {
|
|
34
|
+
description: "Reference to the resource",
|
|
35
|
+
type: "string"
|
|
36
|
+
},
|
|
37
|
+
metadata: {
|
|
38
|
+
description: "Resource metadata",
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: {
|
|
41
|
+
name: {
|
|
42
|
+
description: "Resource's friendly name",
|
|
43
|
+
type: "string"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
required: ["name"]
|
|
47
|
+
},
|
|
48
|
+
spec: {
|
|
49
|
+
description: "Operations spec for an Peer",
|
|
50
|
+
type: "object",
|
|
51
|
+
properties: {
|
|
52
|
+
username: {
|
|
53
|
+
description: "The username for the Peer",
|
|
54
|
+
type: "string",
|
|
55
|
+
minLength: 3,
|
|
56
|
+
maxLength: 60,
|
|
57
|
+
readOnly: true
|
|
58
|
+
},
|
|
59
|
+
aor: {
|
|
60
|
+
description: "Address of the Peer (acceptable schemas are sip, backend.)",
|
|
61
|
+
type: "string",
|
|
62
|
+
minLength: 3,
|
|
63
|
+
maxLength: 255
|
|
64
|
+
},
|
|
65
|
+
contactAddr: {
|
|
66
|
+
description: "Contact address of the Peer",
|
|
67
|
+
type: "string",
|
|
68
|
+
maxLength: 255
|
|
69
|
+
},
|
|
70
|
+
credentialsRef: {
|
|
71
|
+
description: "The credential the Peer uses to authenticate",
|
|
72
|
+
type: "string"
|
|
73
|
+
},
|
|
74
|
+
accessControlListRef: {
|
|
75
|
+
description: "The ACL the Peer uses to control access to the Peer (Reserved for future use)",
|
|
76
|
+
type: "string"
|
|
77
|
+
},
|
|
78
|
+
enabled: {
|
|
79
|
+
description: "Whether the Peer is enabled",
|
|
80
|
+
type: "boolean"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
required: ["username"]
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
required: ["apiVersion", "kind", "ref", "metadata", "spec"]
|
|
87
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
$id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
type: string;
|
|
6
|
+
properties: {
|
|
7
|
+
apiVersion: {
|
|
8
|
+
enum: string[];
|
|
9
|
+
};
|
|
10
|
+
kind: {
|
|
11
|
+
enum: string[];
|
|
12
|
+
};
|
|
13
|
+
ref: {
|
|
14
|
+
description: string;
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
metadata: {
|
|
18
|
+
description: string;
|
|
19
|
+
type: string;
|
|
20
|
+
properties: {
|
|
21
|
+
name: {
|
|
22
|
+
description: string;
|
|
23
|
+
type: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
required: string[];
|
|
27
|
+
};
|
|
28
|
+
spec: {
|
|
29
|
+
description: string;
|
|
30
|
+
type: string;
|
|
31
|
+
properties: {
|
|
32
|
+
inbound: {
|
|
33
|
+
description: string;
|
|
34
|
+
type: string;
|
|
35
|
+
properties: {
|
|
36
|
+
uri: {
|
|
37
|
+
description: string;
|
|
38
|
+
type: string;
|
|
39
|
+
};
|
|
40
|
+
accessControlListRef: {
|
|
41
|
+
description: string;
|
|
42
|
+
type: string;
|
|
43
|
+
};
|
|
44
|
+
credentialsRef: {
|
|
45
|
+
description: string;
|
|
46
|
+
type: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
required: string[];
|
|
50
|
+
};
|
|
51
|
+
outbound: {
|
|
52
|
+
description: string;
|
|
53
|
+
type: string;
|
|
54
|
+
properties: {
|
|
55
|
+
sendRegister: {
|
|
56
|
+
description: string;
|
|
57
|
+
type: string;
|
|
58
|
+
};
|
|
59
|
+
credentialsRef: {
|
|
60
|
+
description: string;
|
|
61
|
+
type: string;
|
|
62
|
+
};
|
|
63
|
+
uris: {
|
|
64
|
+
description: string;
|
|
65
|
+
type: string;
|
|
66
|
+
items: {
|
|
67
|
+
type: string;
|
|
68
|
+
properties: {
|
|
69
|
+
uri: {
|
|
70
|
+
description: string;
|
|
71
|
+
type: string;
|
|
72
|
+
properties: {
|
|
73
|
+
host: {
|
|
74
|
+
description: string;
|
|
75
|
+
type: string;
|
|
76
|
+
};
|
|
77
|
+
port: {
|
|
78
|
+
description: string;
|
|
79
|
+
type: string;
|
|
80
|
+
};
|
|
81
|
+
transport: {
|
|
82
|
+
description: string;
|
|
83
|
+
enum: string[];
|
|
84
|
+
};
|
|
85
|
+
user: {
|
|
86
|
+
description: string;
|
|
87
|
+
type: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
required: string[];
|
|
91
|
+
};
|
|
92
|
+
weight: {
|
|
93
|
+
description: string;
|
|
94
|
+
type: string;
|
|
95
|
+
};
|
|
96
|
+
priority: {
|
|
97
|
+
description: string;
|
|
98
|
+
type: string;
|
|
99
|
+
};
|
|
100
|
+
enabled: {
|
|
101
|
+
description: string;
|
|
102
|
+
type: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
required: string[];
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
required: string[];
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
required: string[];
|
|
115
|
+
};
|
|
116
|
+
export default _default;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
|
|
5
|
+
* http://github.com/fonoster
|
|
6
|
+
*
|
|
7
|
+
* This file is part of Routr.
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the MIT License (the "License");
|
|
10
|
+
* you may not use this file except in compliance with
|
|
11
|
+
* the License. You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* https://opensource.org/licenses/MIT
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
* See the License for the specific language governing permissions and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
exports.default = {
|
|
22
|
+
$id: "https://json-schema.org/draft/2020-12/schema",
|
|
23
|
+
title: "Agent validation schema",
|
|
24
|
+
description: "The spec defined for Peer validation",
|
|
25
|
+
type: "object",
|
|
26
|
+
properties: {
|
|
27
|
+
apiVersion: {
|
|
28
|
+
enum: ["v2draft1", "v2.0", "v2"]
|
|
29
|
+
},
|
|
30
|
+
kind: {
|
|
31
|
+
enum: ["Trunk", "trunk"]
|
|
32
|
+
},
|
|
33
|
+
ref: {
|
|
34
|
+
description: "Reference to the resource",
|
|
35
|
+
type: "string"
|
|
36
|
+
},
|
|
37
|
+
metadata: {
|
|
38
|
+
description: "Resource metadata",
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: {
|
|
41
|
+
name: {
|
|
42
|
+
description: "Resource's friendly name",
|
|
43
|
+
type: "string"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
required: ["name"]
|
|
47
|
+
},
|
|
48
|
+
spec: {
|
|
49
|
+
description: "Operations spec for an Trunk",
|
|
50
|
+
type: "object",
|
|
51
|
+
properties: {
|
|
52
|
+
inbound: {
|
|
53
|
+
description: "Inbound configuration",
|
|
54
|
+
type: "object",
|
|
55
|
+
properties: {
|
|
56
|
+
uri: {
|
|
57
|
+
description: "URI of the inbound endpoint",
|
|
58
|
+
type: "string"
|
|
59
|
+
},
|
|
60
|
+
accessControlListRef: {
|
|
61
|
+
description: "Reference to the ACL to be used for inbound traffic",
|
|
62
|
+
type: "string"
|
|
63
|
+
},
|
|
64
|
+
credentialsRef: {
|
|
65
|
+
description: "Reference to the credentials to be used for inbound traffic",
|
|
66
|
+
type: "string"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
required: ["uri"]
|
|
70
|
+
},
|
|
71
|
+
outbound: {
|
|
72
|
+
description: "Outbound configuration",
|
|
73
|
+
type: "object",
|
|
74
|
+
properties: {
|
|
75
|
+
sendRegister: {
|
|
76
|
+
description: "Whether to send register messages",
|
|
77
|
+
type: "boolean"
|
|
78
|
+
},
|
|
79
|
+
credentialsRef: {
|
|
80
|
+
description: "Reference to the credentials to be used for outbound traffic",
|
|
81
|
+
type: "string"
|
|
82
|
+
},
|
|
83
|
+
uris: {
|
|
84
|
+
description: "List of URIs to be used for outbound traffic",
|
|
85
|
+
type: "array",
|
|
86
|
+
items: {
|
|
87
|
+
type: "object",
|
|
88
|
+
properties: {
|
|
89
|
+
uri: {
|
|
90
|
+
description: "URI to be used for outbound traffic",
|
|
91
|
+
type: "object",
|
|
92
|
+
properties: {
|
|
93
|
+
host: {
|
|
94
|
+
description: "Hostname of the URI",
|
|
95
|
+
type: "string"
|
|
96
|
+
},
|
|
97
|
+
port: {
|
|
98
|
+
description: "Port of the URI",
|
|
99
|
+
type: "integer"
|
|
100
|
+
},
|
|
101
|
+
transport: {
|
|
102
|
+
description: "Transport of the URI",
|
|
103
|
+
enum: ["tcp", "sctp", "udp", "tls", "ws", "wss"]
|
|
104
|
+
},
|
|
105
|
+
user: {
|
|
106
|
+
description: "Username of the URI",
|
|
107
|
+
type: "string"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
required: ["host", "port", "transport"]
|
|
111
|
+
},
|
|
112
|
+
weight: {
|
|
113
|
+
description: "Weight of the URI",
|
|
114
|
+
type: "integer"
|
|
115
|
+
},
|
|
116
|
+
priority: {
|
|
117
|
+
description: "Priority of the URI",
|
|
118
|
+
type: "integer"
|
|
119
|
+
},
|
|
120
|
+
enabled: {
|
|
121
|
+
description: "Whether the URI is enabled",
|
|
122
|
+
type: "boolean"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
required: ["uri"]
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
required: ["uris"]
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
required: ["apiVersion", "kind", "ref", "metadata", "spec"]
|
|
135
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.schemaValidators = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
|
|
9
|
+
* http://github.com/fonoster
|
|
10
|
+
*
|
|
11
|
+
* This file is part of Routr.
|
|
12
|
+
*
|
|
13
|
+
* Licensed under the MIT License (the "License");
|
|
14
|
+
* you may not use this file except in compliance with
|
|
15
|
+
* the License. You may obtain a copy of the License at
|
|
16
|
+
*
|
|
17
|
+
* https://opensource.org/licenses/MIT
|
|
18
|
+
*
|
|
19
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
20
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
+
* See the License for the specific language governing permissions and
|
|
23
|
+
* limitations under the License.
|
|
24
|
+
*/
|
|
25
|
+
const types_1 = require("../types");
|
|
26
|
+
const ajv_1 = __importDefault(require("ajv"));
|
|
27
|
+
const acl_1 = __importDefault(require("./acl"));
|
|
28
|
+
const agent_1 = __importDefault(require("./agent"));
|
|
29
|
+
const crendentials_1 = __importDefault(require("./crendentials"));
|
|
30
|
+
const domain_1 = __importDefault(require("./domain"));
|
|
31
|
+
const number_1 = __importDefault(require("./number"));
|
|
32
|
+
const peer_1 = __importDefault(require("./peer"));
|
|
33
|
+
const trunk_1 = __importDefault(require("./trunk"));
|
|
34
|
+
const validator = (schema) => new ajv_1.default().compile(schema);
|
|
35
|
+
const schemaValidators = new Map();
|
|
36
|
+
exports.schemaValidators = schemaValidators;
|
|
37
|
+
schemaValidators.set(types_1.Kind.ACL, validator(acl_1.default));
|
|
38
|
+
schemaValidators.set(types_1.Kind.AGENT, validator(agent_1.default));
|
|
39
|
+
schemaValidators.set(types_1.Kind.CREDENTIALS, validator(crendentials_1.default));
|
|
40
|
+
schemaValidators.set(types_1.Kind.DOMAIN, validator(domain_1.default));
|
|
41
|
+
schemaValidators.set(types_1.Kind.NUMBER, validator(number_1.default));
|
|
42
|
+
schemaValidators.set(types_1.Kind.PEER, validator(peer_1.default));
|
|
43
|
+
schemaValidators.set(types_1.Kind.TRUNK, validator(trunk_1.default));
|
package/dist/connect/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JsonData, Transport } from "../types";
|
|
1
2
|
export declare enum Kind {
|
|
2
3
|
AGENT = "agent",
|
|
3
4
|
PEER = "peer",
|
|
@@ -5,34 +6,82 @@ export declare enum Kind {
|
|
|
5
6
|
TRUNK = "trunk",
|
|
6
7
|
DOMAIN = "domain",
|
|
7
8
|
UNKNOWN = "unknown",
|
|
8
|
-
|
|
9
|
+
CREDENTIALS = "credentials",
|
|
9
10
|
ACL = "accesscontrollist"
|
|
10
11
|
}
|
|
11
|
-
export declare enum
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
FIND_NUMBER_BY_TELURL = "find_number_by_telurl",
|
|
17
|
-
FIND_TRUNKS_WITH_SEND_REGISTER = "find_trunks_with_send_register",
|
|
18
|
-
FIND_TRUNK_BY_REQUEST_URI = "find_trunk_by_request_uri"
|
|
19
|
-
}
|
|
20
|
-
export interface FindParameters {
|
|
21
|
-
kind: Kind;
|
|
22
|
-
criteria: FindCriteria;
|
|
23
|
-
parameters: Record<string, string>;
|
|
24
|
-
}
|
|
25
|
-
export interface DataAPI {
|
|
26
|
-
get: (ref: string) => Promise<Resource>;
|
|
27
|
-
findBy: (request: FindParameters) => Promise<Resource[]>;
|
|
28
|
-
}
|
|
29
|
-
export interface Resource {
|
|
12
|
+
export declare enum APIVersion {
|
|
13
|
+
V2DRAFT1 = "v2draft1",
|
|
14
|
+
V2 = "v2"
|
|
15
|
+
}
|
|
16
|
+
export interface RoutrResourceBase {
|
|
30
17
|
apiVersion: string;
|
|
31
|
-
kind: Kind;
|
|
32
18
|
ref: string;
|
|
33
|
-
|
|
19
|
+
name: string;
|
|
20
|
+
createdAt?: Date;
|
|
21
|
+
updatedAt?: Date;
|
|
22
|
+
extended?: JsonData;
|
|
23
|
+
}
|
|
24
|
+
export interface AccessControlList extends RoutrResourceBase {
|
|
25
|
+
allow: string[];
|
|
26
|
+
deny: string[];
|
|
27
|
+
}
|
|
28
|
+
export interface Domain extends RoutrResourceBase {
|
|
29
|
+
domainUri: string;
|
|
30
|
+
accessControlList: AccessControlList;
|
|
31
|
+
egressPolicies: EgressPolicy[];
|
|
32
|
+
}
|
|
33
|
+
export interface EgressPolicy {
|
|
34
|
+
number: INumber;
|
|
35
|
+
rule: string;
|
|
36
|
+
}
|
|
37
|
+
export interface Agent extends RoutrResourceBase {
|
|
38
|
+
username: string;
|
|
39
|
+
privacy: string;
|
|
40
|
+
enabled: boolean;
|
|
41
|
+
domain?: Domain;
|
|
42
|
+
credentials?: Credentials;
|
|
43
|
+
}
|
|
44
|
+
export interface Credentials extends RoutrResourceBase {
|
|
45
|
+
username: string;
|
|
46
|
+
password: string;
|
|
47
|
+
}
|
|
48
|
+
export interface INumber extends RoutrResourceBase {
|
|
49
|
+
telUrl: string;
|
|
50
|
+
aorLink: string;
|
|
51
|
+
city: string;
|
|
52
|
+
country: string;
|
|
53
|
+
countryIsoCode: string;
|
|
54
|
+
sessionAffinityHeader: string;
|
|
55
|
+
extraHeaders: {
|
|
34
56
|
name: string;
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
|
|
57
|
+
value: string;
|
|
58
|
+
}[];
|
|
59
|
+
trunk?: Trunk;
|
|
60
|
+
}
|
|
61
|
+
export interface Trunk extends RoutrResourceBase {
|
|
62
|
+
sendRegister: boolean;
|
|
63
|
+
inboundUri: string;
|
|
64
|
+
accessControlList?: AccessControlList;
|
|
65
|
+
inboundCredentials?: Credentials;
|
|
66
|
+
outboundCredentials?: Credentials;
|
|
67
|
+
uris: TrunkUri[];
|
|
68
|
+
}
|
|
69
|
+
export interface TrunkUri {
|
|
70
|
+
host: string;
|
|
71
|
+
port: number;
|
|
72
|
+
transport: Transport;
|
|
73
|
+
user: string;
|
|
74
|
+
weight: number;
|
|
75
|
+
priority: number;
|
|
76
|
+
enabled: boolean;
|
|
77
|
+
}
|
|
78
|
+
export interface Peer extends RoutrResourceBase {
|
|
79
|
+
username: string;
|
|
80
|
+
aor: string;
|
|
81
|
+
contactAddr: string;
|
|
82
|
+
enabled: boolean;
|
|
83
|
+
accessControlList?: AccessControlList;
|
|
84
|
+
credentials?: Credentials;
|
|
38
85
|
}
|
|
86
|
+
export type RoutrResourceUnion = Agent | Peer | INumber | Trunk | Domain | Credentials | AccessControlList;
|
|
87
|
+
export type RoutableResourceUnion = Agent | Peer | INumber;
|
package/dist/connect/types.js
CHANGED
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
/*
|
|
5
|
-
* Copyright (C) 2022 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
|
-
*/
|
|
3
|
+
exports.APIVersion = exports.Kind = void 0;
|
|
22
4
|
var Kind;
|
|
23
5
|
(function (Kind) {
|
|
24
6
|
Kind["AGENT"] = "agent";
|
|
@@ -27,16 +9,11 @@ var Kind;
|
|
|
27
9
|
Kind["TRUNK"] = "trunk";
|
|
28
10
|
Kind["DOMAIN"] = "domain";
|
|
29
11
|
Kind["UNKNOWN"] = "unknown";
|
|
30
|
-
Kind["
|
|
12
|
+
Kind["CREDENTIALS"] = "credentials";
|
|
31
13
|
Kind["ACL"] = "accesscontrollist";
|
|
32
14
|
})(Kind = exports.Kind || (exports.Kind = {}));
|
|
33
|
-
var
|
|
34
|
-
(function (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
FindCriteria["FIND_DOMAIN_BY_DOMAINURI"] = "find_domain_by_domainuri";
|
|
39
|
-
FindCriteria["FIND_NUMBER_BY_TELURL"] = "find_number_by_telurl";
|
|
40
|
-
FindCriteria["FIND_TRUNKS_WITH_SEND_REGISTER"] = "find_trunks_with_send_register";
|
|
41
|
-
FindCriteria["FIND_TRUNK_BY_REQUEST_URI"] = "find_trunk_by_request_uri";
|
|
42
|
-
})(FindCriteria = exports.FindCriteria || (exports.FindCriteria = {}));
|
|
15
|
+
var APIVersion;
|
|
16
|
+
(function (APIVersion) {
|
|
17
|
+
APIVersion["V2DRAFT1"] = "v2draft1";
|
|
18
|
+
APIVersion["V2"] = "v2";
|
|
19
|
+
})(APIVersion = exports.APIVersion || (exports.APIVersion = {}));
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Error thrown if the definition for a service is not found.
|
|
3
3
|
*/
|
|
4
|
-
export declare class
|
|
4
|
+
export declare class ServiceDefinitionNotFoundError extends Error {
|
|
5
5
|
/**
|
|
6
6
|
* Constructs a new ServiceDefinitionNotFound error.
|
|
7
7
|
*
|
|
@@ -22,3 +22,37 @@ export declare class ServiceUnavailableError extends Error {
|
|
|
22
22
|
*/
|
|
23
23
|
constructor(address: string);
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Thrown for unimplemented handlers.
|
|
27
|
+
*/
|
|
28
|
+
export declare class UnimplementedError extends Error {
|
|
29
|
+
code: number;
|
|
30
|
+
/**
|
|
31
|
+
* Creates an instance of UnimplementedError.
|
|
32
|
+
*/
|
|
33
|
+
constructor();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Thrown if the resource is not found.
|
|
37
|
+
*/
|
|
38
|
+
export declare class ResourceNotFoundError extends Error {
|
|
39
|
+
code: number;
|
|
40
|
+
/**
|
|
41
|
+
* Creates an instance of UnimplementedError.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} ref - the reference of the resource
|
|
44
|
+
*/
|
|
45
|
+
constructor(ref: string);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Thrown if the request is invalid.
|
|
49
|
+
*/
|
|
50
|
+
export declare class BadRequestError extends Error {
|
|
51
|
+
code: number;
|
|
52
|
+
/**
|
|
53
|
+
* Creates an instance of UnimplementedError.
|
|
54
|
+
*
|
|
55
|
+
* @param {string} message - optional message with the error. Defaults to "bad request."
|
|
56
|
+
*/
|
|
57
|
+
constructor(message?: string);
|
|
58
|
+
}
|