@routr/echo 2.0.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Fonoster Inc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,9 @@
1
+ export declare function processMessage(call: any, callback: Function): void;
2
+ export declare const serviceInfo: {
3
+ name: string;
4
+ bindAddr: string;
5
+ service: any;
6
+ handlers: {
7
+ processMessage: typeof processMessage;
8
+ };
9
+ };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.serviceInfo = exports.processMessage = void 0;
18
+ /*
19
+ * Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
20
+ * http://github.com/fonoster/routr
21
+ *
22
+ * This file is part of Routr
23
+ *
24
+ * Licensed under the MIT License (the "License")
25
+ * you may not use this file except in compliance with
26
+ * the License. You may obtain a copy of the License at
27
+ *
28
+ * https://opensource.org/licenses/MIT
29
+ *
30
+ * Unless required by applicable law or agreed to in writing, software
31
+ * distributed under the License is distributed on an "AS IS" BASIS,
32
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33
+ * See the License for the specific language governing permissions and
34
+ * limitations under the License.
35
+ */
36
+ var common_1 = require("@routr/common");
37
+ var logger_1 = __importDefault(require("@fonoster/logger"));
38
+ // This processor simply echoes back the request send by the client
39
+ function processMessage(call, callback) {
40
+ logger_1.default.verbose("Got new request: ");
41
+ logger_1.default.verbose(JSON.stringify(call.request, null, ' '));
42
+ var request = __assign({}, call.request);
43
+ // Going back / OUT
44
+ request.direction = 1;
45
+ callback(null, request);
46
+ }
47
+ exports.processMessage = processMessage;
48
+ exports.serviceInfo = {
49
+ name: "echo",
50
+ bindAddr: 'placeholder',
51
+ service: common_1.PROCESSOR_OBJECT_PROTO.Processor.service,
52
+ handlers: { processMessage: processMessage }
53
+ };
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/runner.js ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ /*
8
+ * Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
9
+ * http://github.com/fonoster/routr
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
+ var service_1 = __importDefault(require("./service"));
26
+ // TODO: Get config from file
27
+ service_1.default({ bindAddr: "0.0.0.0:51902" });
@@ -0,0 +1,2 @@
1
+ import { EchoProcessorConfig } from "./types";
2
+ export default function EchoProcessor(config: EchoProcessorConfig): void;
@@ -0,0 +1,27 @@
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/routr
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
+ var common_1 = require("@routr/common");
22
+ var processor_1 = require("./processor");
23
+ function EchoProcessor(config) {
24
+ processor_1.serviceInfo.bindAddr = config.bindAddr;
25
+ common_1.createService(processor_1.serviceInfo);
26
+ }
27
+ exports.default = EchoProcessor;
@@ -0,0 +1,3 @@
1
+ export interface EchoProcessorConfig {
2
+ bindAddr: string;
3
+ }
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@routr/echo",
3
+ "version": "2.0.3",
4
+ "description": "Dummy implementation of a Processor service",
5
+ "author": "Pedro Sanders <psanders@fonoster.com>",
6
+ "homepage": "https://github.com/fonoster/routr#readme",
7
+ "license": "MIT",
8
+ "main": "dist/echo",
9
+ "types": "dist/echo",
10
+ "directories": {
11
+ "src": "src",
12
+ "test": "test"
13
+ },
14
+ "scripts": {
15
+ "prebuild": "rimraf ./dist tsconfig.tsbuildinfo",
16
+ "build": "tsc -b tsconfig.json"
17
+ },
18
+ "dependencies": {
19
+ "@fonoster/logger": "0.3.3",
20
+ "@routr/common": "^2.0.3"
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/fonoster/routr.git"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/fonoster/routr/issues"
34
+ },
35
+ "gitHead": "aaacb51da7787d678a89e34a64655fa9a1990364"
36
+ }