@routr/common 2.19.0 → 2.20.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.
- package/dist/errors.d.ts +14 -0
- package/dist/errors.js +19 -1
- package/dist/helper.js +2 -1
- package/package.json +2 -2
package/dist/errors.d.ts
CHANGED
|
@@ -10,6 +10,20 @@ export declare class ServiceDefinitionNotFoundError extends Error {
|
|
|
10
10
|
*/
|
|
11
11
|
constructor(name: string, version: string);
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Error thrown when a request must leave over a transport the EdgePort has no
|
|
15
|
+
* listening point for, for example a trunk URI with transport=tls on an
|
|
16
|
+
* EdgePort without a tls transport.
|
|
17
|
+
*/
|
|
18
|
+
export declare class NoListeningPointError extends Error {
|
|
19
|
+
transport: string;
|
|
20
|
+
/**
|
|
21
|
+
* Constructs a new NoListeningPointError error.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} transport - The transport without a listening point.
|
|
24
|
+
*/
|
|
25
|
+
constructor(transport: string);
|
|
26
|
+
}
|
|
13
27
|
/**
|
|
14
28
|
* Error thrown if the service is not available.
|
|
15
29
|
*/
|
package/dist/errors.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.BadRequestError = exports.ResourceAlreadyExistsError = exports.ResourceNotFoundError = exports.UnimplementedError = exports.ClientConnectionError = exports.ServiceUnavailableError = exports.ServiceDefinitionNotFoundError = void 0;
|
|
36
|
+
exports.BadRequestError = exports.ResourceAlreadyExistsError = exports.ResourceNotFoundError = exports.UnimplementedError = exports.ClientConnectionError = exports.ServiceUnavailableError = exports.NoListeningPointError = exports.ServiceDefinitionNotFoundError = void 0;
|
|
37
37
|
/*
|
|
38
38
|
* Copyright (C) 2026 by Fonoster Inc (https://fonoster.com)
|
|
39
39
|
* http://github.com/fonoster/routr
|
|
@@ -70,6 +70,24 @@ class ServiceDefinitionNotFoundError extends Error {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
exports.ServiceDefinitionNotFoundError = ServiceDefinitionNotFoundError;
|
|
73
|
+
/**
|
|
74
|
+
* Error thrown when a request must leave over a transport the EdgePort has no
|
|
75
|
+
* listening point for, for example a trunk URI with transport=tls on an
|
|
76
|
+
* EdgePort without a tls transport.
|
|
77
|
+
*/
|
|
78
|
+
class NoListeningPointError extends Error {
|
|
79
|
+
/**
|
|
80
|
+
* Constructs a new NoListeningPointError error.
|
|
81
|
+
*
|
|
82
|
+
* @param {string} transport - The transport without a listening point.
|
|
83
|
+
*/
|
|
84
|
+
constructor(transport) {
|
|
85
|
+
super(`no listening point found for transport ${transport}; add the transport to the EdgePort's spec.transport (and spec.securityContext for tls or wss)`);
|
|
86
|
+
this.transport = transport;
|
|
87
|
+
Object.setPrototypeOf(this, NoListeningPointError.prototype);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.NoListeningPointError = NoListeningPointError;
|
|
73
91
|
/**
|
|
74
92
|
* Error thrown if the service is not available.
|
|
75
93
|
*/
|
package/dist/helper.js
CHANGED
|
@@ -58,6 +58,7 @@ exports.toPascalCase = exports.readConfigFile = exports.getListeningPoint = expo
|
|
|
58
58
|
const yaml = __importStar(require("js-yaml"));
|
|
59
59
|
const fs_1 = __importDefault(require("fs"));
|
|
60
60
|
const types_1 = require("./types");
|
|
61
|
+
const errors_1 = require("./errors");
|
|
61
62
|
/**
|
|
62
63
|
* Makes a deep copy of an object.
|
|
63
64
|
*
|
|
@@ -97,7 +98,7 @@ const getListeningPoint = (listeningPoints, transport) => {
|
|
|
97
98
|
? listeningPoints.find((lp) => lp.transport.toUpperCase() === transport.toUpperCase())
|
|
98
99
|
: listeningPoints.find((lp) => lp.transport.toUpperCase() === types_1.Transport.UDP);
|
|
99
100
|
if (!listeningPoint) {
|
|
100
|
-
throw new
|
|
101
|
+
throw new errors_1.NoListeningPointError(transport !== null && transport !== void 0 ? transport : types_1.Transport.UDP);
|
|
101
102
|
}
|
|
102
103
|
return listeningPoint;
|
|
103
104
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routr/common",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.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": "
|
|
56
|
+
"gitHead": "3705573eb10fd828b0b736702eee5a5d036d7cdc"
|
|
57
57
|
}
|