@routr/echo 2.0.5-alpha.1 → 2.0.5-alpha.12

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/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) 2021 by Fonoster Inc (https://fonoster.com)
8
+ * Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
9
9
  * http://github.com/fonoster/routr
10
10
  *
11
11
  * This file is part of Routr
@@ -22,6 +22,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
22
22
  * See the License for the specific language governing permissions and
23
23
  * limitations under the License.
24
24
  */
25
- var service_1 = __importDefault(require("./service"));
26
- // TODO: Get config from file
27
- service_1.default({ bindAddr: "0.0.0.0:51902" });
25
+ const logger_1 = __importDefault(require("@fonoster/logger"));
26
+ const processor_1 = __importDefault(require("@routr/processor"));
27
+ new processor_1.default({ bindAddr: process.env.BIND_ADDR || "0.0.0.0:51904", name: "echo" })
28
+ .listen((request, response) => {
29
+ logger_1.default.verbose("got new request: ");
30
+ logger_1.default.verbose(JSON.stringify(request, null, ' '));
31
+ response.send(request);
32
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/echo",
3
- "version": "2.0.5-alpha.1",
3
+ "version": "2.0.5-alpha.12",
4
4
  "description": "Dummy implementation of a Processor service",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/routr#readme",
@@ -15,9 +15,13 @@
15
15
  "prebuild": "rimraf ./dist tsconfig.tsbuildinfo",
16
16
  "build": "tsc -b tsconfig.json"
17
17
  },
18
+ "bin": {
19
+ "run_echo": "dist/runner.js"
20
+ },
18
21
  "dependencies": {
19
22
  "@fonoster/logger": "^0.3.3",
20
- "@routr/common": "^2.0.5-alpha.1"
23
+ "@routr/common": "^2.0.5-alpha.12",
24
+ "@routr/processor": "^2.0.5-alpha.12"
21
25
  },
22
26
  "files": [
23
27
  "dist"
@@ -32,5 +36,5 @@
32
36
  "bugs": {
33
37
  "url": "https://github.com/fonoster/routr/issues"
34
38
  },
35
- "gitHead": "12ed1225fc28e8dfed240522319d8f8178620586"
39
+ "gitHead": "1256c3ca2df3737fb2c4bc5278c348c33c245608"
36
40
  }
@@ -1,9 +0,0 @@
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
- };
package/dist/processor.js DELETED
@@ -1,53 +0,0 @@
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
- };
package/dist/service.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { EchoProcessorConfig } from "./types";
2
- export default function EchoProcessor(config: EchoProcessorConfig): void;
package/dist/service.js DELETED
@@ -1,27 +0,0 @@
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;
package/dist/types.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export interface EchoProcessorConfig {
2
- bindAddr: string;
3
- }
package/dist/types.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });