@routr/dispatcher 2.0.8-alpha.8 → 2.0.9
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/config/get_config.js +2 -2
- package/dist/config/schema.d.ts +4 -8
- package/dist/config/schema.js +8 -12
- package/dist/envs.d.ts +1 -0
- package/dist/envs.js +24 -0
- package/dist/errors.js +1 -1
- package/dist/find_processor.js +2 -2
- package/dist/processor.d.ts +1 -1
- package/dist/processor.js +45 -24
- package/dist/run_middlewares.js +10 -6
- package/dist/run_processor.d.ts +3 -2
- package/dist/run_processor.js +33 -27
- package/dist/runner.js +3 -4
- package/dist/service.js +1 -1
- package/dist/tracer.js +1 -1
- package/dist/types.d.ts +1 -2
- package/dist/util.js +1 -1
- package/package.json +6 -5
|
@@ -27,14 +27,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.getConfig = void 0;
|
|
30
|
-
const fs_1 = __importDefault(require("fs"));
|
|
31
30
|
const schema_1 = require("./schema");
|
|
32
31
|
const ajv_1 = __importDefault(require("ajv"));
|
|
33
32
|
const E = __importStar(require("fp-ts/Either"));
|
|
33
|
+
const common_1 = require("@routr/common");
|
|
34
34
|
const ajv = new ajv_1.default();
|
|
35
35
|
const validate = ajv.compile(schema_1.schema);
|
|
36
36
|
const getConfig = (path) => {
|
|
37
|
-
const c =
|
|
37
|
+
const c = common_1.Helper.readConfigFile(path);
|
|
38
38
|
if (!validate(Object.assign({}, c))) {
|
|
39
39
|
return E.left(new Error(JSON.stringify(validate.errors[0].message)));
|
|
40
40
|
}
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -12,16 +12,9 @@ export declare const schema: {
|
|
|
12
12
|
description: string;
|
|
13
13
|
type: string;
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
ref: {
|
|
16
16
|
description: string;
|
|
17
17
|
type: string;
|
|
18
|
-
properties: {
|
|
19
|
-
ref: {
|
|
20
|
-
description: string;
|
|
21
|
-
type: string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
required: string[];
|
|
25
18
|
};
|
|
26
19
|
spec: {
|
|
27
20
|
description: string;
|
|
@@ -44,6 +37,9 @@ export declare const schema: {
|
|
|
44
37
|
addr: {
|
|
45
38
|
type: string;
|
|
46
39
|
};
|
|
40
|
+
postProcessor: {
|
|
41
|
+
type: string;
|
|
42
|
+
};
|
|
47
43
|
};
|
|
48
44
|
required: string[];
|
|
49
45
|
};
|
package/dist/config/schema.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.schema = void 0;
|
|
4
4
|
/*
|
|
5
|
-
* Copyright (C)
|
|
5
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/routr
|
|
7
7
|
*
|
|
8
8
|
* This file is part of Routr
|
|
@@ -33,16 +33,9 @@ exports.schema = {
|
|
|
33
33
|
description: "Resource version",
|
|
34
34
|
type: "string"
|
|
35
35
|
},
|
|
36
|
-
|
|
37
|
-
description: "
|
|
38
|
-
type: "
|
|
39
|
-
properties: {
|
|
40
|
-
ref: {
|
|
41
|
-
description: "EdgePort reference",
|
|
42
|
-
type: "string"
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
required: ["ref"]
|
|
36
|
+
ref: {
|
|
37
|
+
description: "EdgePort reference",
|
|
38
|
+
type: "string"
|
|
46
39
|
},
|
|
47
40
|
spec: {
|
|
48
41
|
description: "Operations spec for EdgePort",
|
|
@@ -64,6 +57,9 @@ exports.schema = {
|
|
|
64
57
|
},
|
|
65
58
|
addr: {
|
|
66
59
|
type: "string"
|
|
60
|
+
},
|
|
61
|
+
postProcessor: {
|
|
62
|
+
type: "boolean"
|
|
67
63
|
}
|
|
68
64
|
},
|
|
69
65
|
required: ["ref", "addr"]
|
|
@@ -96,5 +92,5 @@ exports.schema = {
|
|
|
96
92
|
}
|
|
97
93
|
}
|
|
98
94
|
},
|
|
99
|
-
required: ["kind", "
|
|
95
|
+
required: ["kind", "ref", "spec", "apiVersion"]
|
|
100
96
|
};
|
package/dist/envs.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CONFIG_PATH: string;
|
package/dist/envs.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONFIG_PATH = 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 common_1 = require("@routr/common");
|
|
23
|
+
common_1.Assertions.assertEnvsAreSet(["CONFIG_PATH"]);
|
|
24
|
+
exports.CONFIG_PATH = process.env.CONFIG_PATH;
|
package/dist/errors.js
CHANGED
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.MiddlewareUnavailableError = exports.ProcessorUnavailableError = exports.NotMatchingProcessorFound = void 0;
|
|
27
27
|
/*
|
|
28
|
-
* Copyright (C)
|
|
28
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
29
29
|
* http://github.com/fonoster/routr
|
|
30
30
|
*
|
|
31
31
|
* This file is part of Routr
|
package/dist/find_processor.js
CHANGED
|
@@ -5,10 +5,10 @@ const errors_1 = require("./errors");
|
|
|
5
5
|
const hasMethod = (config, request) => config.methods.includes(request.method);
|
|
6
6
|
exports.hasMethod = hasMethod;
|
|
7
7
|
// TODO: We need a way to test the matching function
|
|
8
|
-
const filter = (request, config) => (0, exports.hasMethod)(config, request) &&
|
|
8
|
+
const filter = (request, config) => (0, exports.hasMethod)(config, request) && config.matchFunc(request);
|
|
9
9
|
exports.filter = filter;
|
|
10
10
|
const findProcessor = (list) => (request) => {
|
|
11
11
|
var _a;
|
|
12
|
-
return (_a = list.find((config) => (0, exports.filter)(request, config))) !== null && _a !== void 0 ? _a : new errors_1.NotMatchingProcessorFound(request
|
|
12
|
+
return (_a = list.find((config) => (0, exports.filter)(request, config))) !== null && _a !== void 0 ? _a : new errors_1.NotMatchingProcessorFound(request.ref);
|
|
13
13
|
};
|
|
14
14
|
exports.findProcessor = findProcessor;
|
package/dist/processor.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ import { CommonTypes as CT } from "@routr/common";
|
|
|
10
10
|
export default function processor(params: {
|
|
11
11
|
processors: ProcessorConfig[];
|
|
12
12
|
middlewares?: CT.MiddlewareConfig[];
|
|
13
|
-
}): (call: RunProcessorParams, callback: any) => void
|
|
13
|
+
}): (call: RunProcessorParams, callback: any) => Promise<void>;
|
package/dist/processor.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
5
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
15
|
/*
|
|
7
|
-
* Copyright (C)
|
|
16
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
8
17
|
* http://github.com/fonoster/routr
|
|
9
18
|
*
|
|
10
19
|
* This file is part of Routr
|
|
@@ -23,10 +32,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
32
|
*/
|
|
24
33
|
const connections_1 = __importDefault(require("./connections"));
|
|
25
34
|
const run_processor_1 = require("./run_processor");
|
|
26
|
-
const
|
|
35
|
+
const processor_1 = require("@routr/processor");
|
|
27
36
|
const run_middlewares_1 = require("./run_middlewares");
|
|
28
|
-
const
|
|
29
|
-
const logger = (0, logger_1.getLogger)({ service: "dispatcher", filePath: __filename });
|
|
37
|
+
const isErrorResponse = (request) => processor_1.Helper.isTypeResponse(request) && !processor_1.Helper.isOk(request) && !processor_1.Helper.isRinging(request);
|
|
30
38
|
/**
|
|
31
39
|
* Creates a new instance of Processor.
|
|
32
40
|
*
|
|
@@ -39,32 +47,45 @@ function processor(params) {
|
|
|
39
47
|
const middConns = (0, connections_1.default)(middlewares);
|
|
40
48
|
// Upstream request and callback
|
|
41
49
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
-
return (call, callback) => {
|
|
50
|
+
return (call, callback) => __awaiter(this, void 0, void 0, function* () {
|
|
43
51
|
const { request } = call;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
try {
|
|
53
|
+
if (isErrorResponse(request)) {
|
|
54
|
+
callback(null, yield (0, run_processor_1.runProcessor)({
|
|
55
|
+
request,
|
|
56
|
+
processors,
|
|
57
|
+
connections: procConns
|
|
58
|
+
}));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const preProcessorRequest = yield (0, run_middlewares_1.runMiddlewares)({
|
|
48
62
|
request,
|
|
49
|
-
|
|
50
|
-
connections:
|
|
63
|
+
middlewares,
|
|
64
|
+
connections: middConns,
|
|
65
|
+
runPostProcessorMiddlewares: false
|
|
51
66
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
.then((req) => {
|
|
55
|
-
// Since the chain was broken we need to skip the processor and return the updated request
|
|
56
|
-
if (req.message.messageType === common_1.CommonTypes.MessageType.RESPONSE) {
|
|
57
|
-
logger.silly("skipped processsing request", { ref: req.ref });
|
|
58
|
-
return callback(null, req);
|
|
67
|
+
if (isErrorResponse(request)) {
|
|
68
|
+
return callback(null, preProcessorRequest);
|
|
59
69
|
}
|
|
60
|
-
(0, run_processor_1.runProcessor)({
|
|
61
|
-
|
|
62
|
-
request: req,
|
|
70
|
+
const processedRequest = yield (0, run_processor_1.runProcessor)({
|
|
71
|
+
request: preProcessorRequest,
|
|
63
72
|
processors,
|
|
64
73
|
connections: procConns
|
|
65
74
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
if (isErrorResponse(request)) {
|
|
76
|
+
return callback(null, processedRequest);
|
|
77
|
+
}
|
|
78
|
+
const postProcessorRequest = yield (0, run_middlewares_1.runMiddlewares)({
|
|
79
|
+
request: processedRequest,
|
|
80
|
+
middlewares,
|
|
81
|
+
connections: middConns,
|
|
82
|
+
runPostProcessorMiddlewares: true
|
|
83
|
+
});
|
|
84
|
+
return callback(null, postProcessorRequest);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
return callback(err, null);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
69
90
|
}
|
|
70
91
|
exports.default = processor;
|
package/dist/run_middlewares.js
CHANGED
|
@@ -34,7 +34,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.runMiddlewares = void 0;
|
|
36
36
|
/*
|
|
37
|
-
* Copyright (C)
|
|
37
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
38
38
|
* http://github.com/fonoster/routr
|
|
39
39
|
*
|
|
40
40
|
* This file is part of Routr
|
|
@@ -71,17 +71,21 @@ function processMessage(middlewareRef, conn, request) {
|
|
|
71
71
|
// eslint-disable-next-line require-jsdoc
|
|
72
72
|
function runMiddlewares(params) {
|
|
73
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
const { connections, request, middlewares = [] } = params;
|
|
74
|
+
const { connections, request, middlewares = [], runPostProcessorMiddlewares } = params;
|
|
75
75
|
const req = Object.assign({}, request);
|
|
76
76
|
// eslint-disable-next-line no-async-promise-executor
|
|
77
77
|
return new Promise((resolve, rejects) => __awaiter(this, void 0, void 0, function* () {
|
|
78
78
|
// eslint-disable-next-line no-loops/no-loops
|
|
79
79
|
for (const midd of middlewares) {
|
|
80
|
-
logger.
|
|
80
|
+
logger.verbose("sending request to middleware", {
|
|
81
81
|
ref: request.ref,
|
|
82
82
|
middlewareRef: midd.ref,
|
|
83
|
-
addr: midd.addr
|
|
83
|
+
addr: midd.addr,
|
|
84
|
+
postProcessor: midd.postProcessor,
|
|
85
|
+
runPostProcessorMiddlewares
|
|
84
86
|
});
|
|
87
|
+
if (runPostProcessorMiddlewares !== midd.postProcessor)
|
|
88
|
+
continue;
|
|
85
89
|
// Get the next middleware
|
|
86
90
|
const conn = connections.get(midd.ref);
|
|
87
91
|
// Send message and re-insert response for next middleware
|
|
@@ -89,7 +93,7 @@ function runMiddlewares(params) {
|
|
|
89
93
|
req.message = (yield processMessage(midd.ref, conn, req))
|
|
90
94
|
.message;
|
|
91
95
|
if (req.message.messageType === common_1.CommonTypes.MessageType.RESPONSE) {
|
|
92
|
-
logger.
|
|
96
|
+
logger.verbose("found messageType to be responseType and broke the chain", {
|
|
93
97
|
ref: request.ref,
|
|
94
98
|
middlewareRef: midd.ref,
|
|
95
99
|
addr: midd.addr
|
|
@@ -98,7 +102,7 @@ function runMiddlewares(params) {
|
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
104
|
catch (e) {
|
|
101
|
-
rejects(e);
|
|
105
|
+
return rejects(e);
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
resolve(req);
|
package/dist/run_processor.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { RunProcessorParams } from "./types";
|
|
2
|
+
import { MessageRequest } from "@routr/common";
|
|
2
3
|
/**
|
|
3
4
|
* Runs the processor.
|
|
4
5
|
*
|
|
5
6
|
* @param {RunProcessorParams} params - The parameters for the run processor
|
|
6
|
-
* @return {Promise<
|
|
7
|
+
* @return {Promise<MessageRequest>}
|
|
7
8
|
*/
|
|
8
|
-
export declare function runProcessor(params: RunProcessorParams):
|
|
9
|
+
export declare function runProcessor(params: RunProcessorParams): Promise<MessageRequest>;
|
package/dist/run_processor.js
CHANGED
|
@@ -22,13 +22,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
25
34
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
36
|
};
|
|
28
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
38
|
exports.runProcessor = void 0;
|
|
30
39
|
/*
|
|
31
|
-
* Copyright (C)
|
|
40
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
32
41
|
* http://github.com/fonoster/routr
|
|
33
42
|
*
|
|
34
43
|
* This file is part of Routr
|
|
@@ -45,42 +54,39 @@ exports.runProcessor = void 0;
|
|
|
45
54
|
* See the License for the specific language governing permissions and
|
|
46
55
|
* limitations under the License.
|
|
47
56
|
*/
|
|
57
|
+
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
58
|
+
const api_1 = __importDefault(require("@opentelemetry/api"));
|
|
48
59
|
const errors_1 = require("./errors");
|
|
49
60
|
const find_processor_1 = require("./find_processor");
|
|
50
|
-
const api_1 = __importDefault(require("@opentelemetry/api"));
|
|
51
|
-
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
52
61
|
const logger_1 = require("@fonoster/logger");
|
|
53
62
|
const logger = (0, logger_1.getLogger)({ service: "dispatcher", filePath: __filename });
|
|
54
63
|
/**
|
|
55
64
|
* Runs the processor.
|
|
56
65
|
*
|
|
57
66
|
* @param {RunProcessorParams} params - The parameters for the run processor
|
|
58
|
-
* @return {Promise<
|
|
67
|
+
* @return {Promise<MessageRequest>}
|
|
59
68
|
*/
|
|
60
69
|
function runProcessor(params) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
callback(err, response);
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const currentSpan = api_1.default.trace.getSpan(api_1.default.context.active());
|
|
72
|
+
// Display traceid in the terminal
|
|
73
|
+
logger.verbose(`traceid: ${currentSpan === null || currentSpan === void 0 ? void 0 : currentSpan.spanContext().traceId}`);
|
|
74
|
+
const { connections, processors, request } = params;
|
|
75
|
+
return new Promise((resolve, reject) => {
|
|
76
|
+
const matchResult = (0, find_processor_1.findProcessor)(processors)(request);
|
|
77
|
+
if ("code" in matchResult) {
|
|
78
|
+
return reject(matchResult);
|
|
79
|
+
}
|
|
80
|
+
const conn = connections.get(matchResult.ref);
|
|
81
|
+
logger.verbose("forwarding request to processor", { ref: matchResult.ref });
|
|
82
|
+
conn.processMessage(request, (err, result) => {
|
|
83
|
+
if ((err === null || err === void 0 ? void 0 : err.code) === grpc.status.UNAVAILABLE) {
|
|
84
|
+
// We augment the error to indicate which processor failed
|
|
85
|
+
return reject(new errors_1.ProcessorUnavailableError(matchResult.ref));
|
|
86
|
+
}
|
|
87
|
+
resolve(Object.assign(Object.assign({}, request), result));
|
|
88
|
+
});
|
|
89
|
+
});
|
|
84
90
|
});
|
|
85
91
|
}
|
|
86
92
|
exports.runProcessor = runProcessor;
|
package/dist/runner.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
/*
|
|
8
|
-
* Copyright (C)
|
|
8
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
9
9
|
* http://github.com/fonoster/routr
|
|
10
10
|
*
|
|
11
11
|
* This file is part of Routr
|
|
@@ -24,11 +24,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
24
24
|
*/
|
|
25
25
|
const service_1 = __importDefault(require("./service"));
|
|
26
26
|
const get_config_1 = require("./config/get_config");
|
|
27
|
-
const common_1 = require("@routr/common");
|
|
28
27
|
const logger_1 = require("@fonoster/logger");
|
|
28
|
+
const envs_1 = require("./envs");
|
|
29
29
|
const logger = (0, logger_1.getLogger)({ service: "dispatcher", filePath: __filename });
|
|
30
|
-
|
|
31
|
-
const result = (0, get_config_1.getConfig)(process.env.CONFIG_PATH);
|
|
30
|
+
const result = (0, get_config_1.getConfig)(envs_1.CONFIG_PATH);
|
|
32
31
|
if (result._tag === "Right") {
|
|
33
32
|
(0, service_1.default)(result.right);
|
|
34
33
|
}
|
package/dist/service.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/*
|
|
4
|
-
* Copyright (C)
|
|
4
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
5
5
|
* http://github.com/fonoster/routr
|
|
6
6
|
*
|
|
7
7
|
* This file is part of Routr
|
package/dist/tracer.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.init = void 0;
|
|
7
7
|
/*
|
|
8
|
-
* Copyright (C)
|
|
8
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
9
9
|
* http://github.com/fonoster/routr
|
|
10
10
|
*
|
|
11
11
|
* This file is part of Routr
|
package/dist/types.d.ts
CHANGED
|
@@ -14,14 +14,13 @@ export type CallbackErrors = NotMatchingProcessorFound | ProcessorUnavailableErr
|
|
|
14
14
|
} | null;
|
|
15
15
|
export type ProcessorCallback = (err: CallbackErrors, reponse?: MessageRequest) => void;
|
|
16
16
|
export interface RunProcessorParams {
|
|
17
|
-
callback: CT.GrpcCallback;
|
|
18
17
|
connections: Map<string, ProcessorGPRCConnection>;
|
|
19
18
|
processors: ProcessorConfig[];
|
|
20
19
|
request: MessageRequest;
|
|
21
20
|
}
|
|
22
21
|
export interface RunMiddlewaresParams {
|
|
23
|
-
callback: CT.GrpcCallback;
|
|
24
22
|
connections: Map<string, ProcessorGPRCConnection>;
|
|
25
23
|
middlewares: CT.MiddlewareConfig[];
|
|
26
24
|
request: MessageRequest;
|
|
25
|
+
runPostProcessorMiddlewares: boolean;
|
|
27
26
|
}
|
package/dist/util.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getServiceInfo = void 0;
|
|
7
7
|
/*
|
|
8
|
-
* Copyright (C)
|
|
8
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
9
9
|
* http://github.com/fonoster/routr
|
|
10
10
|
*
|
|
11
11
|
* This file is part of Routr
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routr/dispatcher",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"description": "Receives SIP messages and forwards them to the corresponding Message Processor",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/routr#readme",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@fonoster/logger": "0.3.
|
|
29
|
-
"@grpc/grpc-js": "^1.
|
|
28
|
+
"@fonoster/logger": "0.3.20",
|
|
29
|
+
"@grpc/grpc-js": "^1.8.4",
|
|
30
30
|
"@opentelemetry/api": "^1.0.4",
|
|
31
31
|
"@opentelemetry/exporter-jaeger": "^1.0.4",
|
|
32
32
|
"@opentelemetry/instrumentation": "^0.27.0",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"@opentelemetry/sdk-trace-base": "^1.0.4",
|
|
36
36
|
"@opentelemetry/sdk-trace-node": "^1.0.4",
|
|
37
37
|
"@opentelemetry/semantic-conventions": "^1.0.4",
|
|
38
|
-
"@routr/common": "^2.0.
|
|
38
|
+
"@routr/common": "^2.0.9",
|
|
39
|
+
"@routr/processor": "^2.0.9",
|
|
39
40
|
"ajv": "^6.12.6",
|
|
40
41
|
"fp-ts": "^2.11.8"
|
|
41
42
|
},
|
|
@@ -46,5 +47,5 @@
|
|
|
46
47
|
"bugs": {
|
|
47
48
|
"url": "https://github.com/fonoster/routr/issues"
|
|
48
49
|
},
|
|
49
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "62eb05f0b3bfa05d84c9ce4b4644de5fb5453295"
|
|
50
51
|
}
|