@sellout/service 0.0.383 → 1.0.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.
Files changed (68) hide show
  1. package/{src/BaseService.ts → BaseService.ts} +7 -18
  2. package/{src/NatsConnectionManager.ts → NatsConnectionManager.ts} +3 -1
  3. package/{src/PbAsyncMessageHandler.ts → PbAsyncMessageHandler.ts} +1 -2
  4. package/{src/PbBroadcastProxy.ts → PbBroadcastProxy.ts} +4 -2
  5. package/{src/Tracer.ts → Tracer.ts} +2 -7
  6. package/{src/env.ts → env.ts} +2 -0
  7. package/interfaces.ts +100 -0
  8. package/package.json +3 -23
  9. package/{.dist/build → service-build}/tsconfig.json +0 -1
  10. package/.dist/BaseService.d.ts +0 -27
  11. package/.dist/BaseService.js +0 -95
  12. package/.dist/BaseService.js.map +0 -1
  13. package/.dist/ConsoleLogManager.d.ts +0 -9
  14. package/.dist/ConsoleLogManager.js +0 -18
  15. package/.dist/ConsoleLogManager.js.map +0 -1
  16. package/.dist/MongoConnectionManager.d.ts +0 -9
  17. package/.dist/MongoConnectionManager.js +0 -52
  18. package/.dist/MongoConnectionManager.js.map +0 -1
  19. package/.dist/NatsConnectionManager.d.ts +0 -117
  20. package/.dist/NatsConnectionManager.js +0 -215
  21. package/.dist/NatsConnectionManager.js.map +0 -1
  22. package/.dist/PbAsyncMessageHandler.d.ts +0 -15
  23. package/.dist/PbAsyncMessageHandler.js +0 -27
  24. package/.dist/PbAsyncMessageHandler.js.map +0 -1
  25. package/.dist/PbBroadcastProxy.d.ts +0 -25
  26. package/.dist/PbBroadcastProxy.js +0 -41
  27. package/.dist/PbBroadcastProxy.js.map +0 -1
  28. package/.dist/PbMessageHandler.d.ts +0 -27
  29. package/.dist/PbMessageHandler.js +0 -47
  30. package/.dist/PbMessageHandler.js.map +0 -1
  31. package/.dist/PbServiceProxy.d.ts +0 -38
  32. package/.dist/PbServiceProxy.js +0 -65
  33. package/.dist/PbServiceProxy.js.map +0 -1
  34. package/.dist/Segment.d.ts +0 -12
  35. package/.dist/Segment.js +0 -34
  36. package/.dist/Segment.js.map +0 -1
  37. package/.dist/Tracer.d.ts +0 -22
  38. package/.dist/Tracer.js +0 -55
  39. package/.dist/Tracer.js.map +0 -1
  40. package/.dist/TracerExpress.d.ts +0 -1
  41. package/.dist/TracerExpress.js +0 -44
  42. package/.dist/TracerExpress.js.map +0 -1
  43. package/.dist/env.d.ts +0 -5
  44. package/.dist/env.js +0 -9
  45. package/.dist/env.js.map +0 -1
  46. package/.dist/interfaces.d.ts +0 -32
  47. package/.dist/interfaces.js +0 -3
  48. package/.dist/interfaces.js.map +0 -1
  49. package/.dist/joiToErrors.d.ts +0 -3
  50. package/.dist/joiToErrors.js +0 -45
  51. package/.dist/joiToErrors.js.map +0 -1
  52. package/.dist/schemas.d.ts +0 -0
  53. package/.dist/schemas.js +0 -1
  54. package/.dist/schemas.js.map +0 -1
  55. package/src/MongoConnectionManager.ts +0 -50
  56. package/src/build/tsconfig.json +0 -33
  57. package/src/build/tslint.json +0 -17
  58. package/src/interfaces.ts +0 -47
  59. package/tsconfig.json +0 -29
  60. package/tslint.json +0 -21
  61. /package/{src/ConsoleLogManager.ts → ConsoleLogManager.ts} +0 -0
  62. /package/{src/PbMessageHandler.ts → PbMessageHandler.ts} +0 -0
  63. /package/{src/PbServiceProxy.ts → PbServiceProxy.ts} +0 -0
  64. /package/{src/Segment.ts → Segment.ts} +0 -0
  65. /package/{src/TracerExpress.ts → TracerExpress.ts} +0 -0
  66. /package/{src/joiToErrors.ts → joiToErrors.ts} +0 -0
  67. /package/{src/schemas.ts → schemas.ts} +0 -0
  68. /package/{.dist/build → service-build}/tslint.json +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tracer.js","sourceRoot":"","sources":["../src/Tracer.ts"],"names":[],"mappings":";;AAAA,iDAA8D;AAC9D,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;AAExD,0DAA0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EAAE;YAC5C,OAAO,GAAG,UAAU,CAAC;SACtB;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAClD,CAAC;CACF;AAtDD,yBAsDC"}
@@ -1 +0,0 @@
1
- export declare const tracerExpress: (serviceName: string) => (req: any, res: any, next: any) => Promise<void>;
@@ -1,44 +0,0 @@
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
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.tracerExpress = void 0;
13
- const Tracer_1 = require("./Tracer");
14
- const url = require("url");
15
- const traceHTTP = (req, res, tracer) => {
16
- const pathname = url.parse(req.url).pathname;
17
- const span = tracer.startSpan(pathname);
18
- span.logEvent('request_recieved');
19
- span.setTag('span.kind', 'server');
20
- span.setTag('http.method', req.method);
21
- span.setTag('http.url', req.url);
22
- res.setHeader('uver-trace-id', span.context().toString());
23
- req.span = span;
24
- req.tracer = tracer;
25
- const finish = () => {
26
- span.logEvent('request_finished');
27
- span.setTag('http.status_code', res.statusCode);
28
- if (res.statusCode >= 500) {
29
- span.setTag('error', true);
30
- span.setTag('sampling.priority', 1);
31
- }
32
- span.finish();
33
- };
34
- res.on("finish", finish);
35
- };
36
- const tracerExpress = (serviceName) => {
37
- const tracer = new Tracer_1.default(serviceName);
38
- return (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
39
- traceHTTP(req, res, tracer);
40
- next();
41
- });
42
- };
43
- exports.trac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;IAChB,CAAC,CAAC;IAEF,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC,CAAC;AAEK,MAAM,aAAa,GAAG,CAAC,WAAmB,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,WAAW,CAAC,CAAC;IACvC,OAAO,CAAO,GAAG,EAAE,GAAG,EAAE,IAAI,EAAiB,EAAE;QAC7C,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QAC5B,IAAI,EAAE,CAAC;IACT,CAAC,CAAA,CAAA;AACH,CAAC,CAAC;AANW,QAAA,aAAa,iBAMxB"}
package/.dist/env.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export declare const DISABLE_PROMETHEUS: string | boolean;
2
- export declare const LOAD_TEST_ENABLED: boolean;
3
- export declare const SEGMENT_IO_WRITE_KEY: string | undefined;
4
- export declare const SENTRY_DSN: string | undefined;
5
- export declare const NODE_ENV: string;
package/.dist/env.js DELETED
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NODE_ENV = exports.SENTRY_DSN = exports.SEGMENT_IO_WRITE_KEY = exports.LOAD_TEST_ENABLED = exports.DISABLE_PROMETHEUS = void 0;
4
- exports.DISABLE_PROMETHEUS = process.env.DISABLE_PROMETHEUS || false;
5
- exports.LOAD_TEST_ENABLED = process.env.LOAD_TEST_ENABLED === '1';
6
- exports.SEGMENT_IO_WRITE_KEY = process.env.SEGMENT_IO_WRITE_KEY;
7
- exports.SENTRY_DSN = process.env.SENTRY_DSN;
8
- exports.NODE_ENV = process.env.NODE_ENV || 'development';
9
- //# sourceMappingURL=env.js.map
package/.dist/env.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,KAAK,CAAC;AAC7D,QAAA,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,GAAG,CAAC;AAC1D,QAAA,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;AACxD,QAAA,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;AACpC,QAAA,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC"}
@@ -1,32 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- export interface ISubscriptionRoutes {
4
- [routeName: string]: IMessageHandler;
5
- }
6
- export interface IConnectionManager {
7
- connect(): any;
8
- close(): any;
9
- on(event: string, cb: (...args: any[]) => void): any;
10
- send(serviceId: string, method: string, req: Buffer, cb: (error: any, reply: any) => void, timeout?: number): any;
11
- sendAsync(serviceId: string, method: string, req: Buffer, cb: (error: any, reply: any) => void, timeout?: number): any;
12
- sendBroadcast(messageId: string, req: Buffer, cb: (error: any, reply: any) => void): any;
13
- subscribe(serviceId: string, queue: string, routes: ISubscriptionRoutes): any;
14
- subscribeBroadcast(serviceId: string, routes: ISubscriptionRoutes): any;
15
- }
16
- export interface ILogManager {
17
- info(msg: string, ...params: string[]): void;
18
- warn(msg: string, ...params: string[]): void;
19
- error(msg: string, ...params: string[]): void;
20
- }
21
- export interface ILogManagerOpts {
22
- serviceName: string;
23
- }
24
- export interface IMessageHandler {
25
- process(req: Buffer): Promise<Buffer>;
26
- }
27
- export interface IServiceOpts {
28
- serviceName: string;
29
- connectionMgr: IConnectionManager;
30
- logManager: ILogManager;
31
- storageManager?: any;
32
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=interfaces.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- declare const joiToErrors: (joiErrors: any, errorClass: any) => any;
2
- export declare const joiToErrorMessages: (joiErrors: any, errorClass: any) => any;
3
- export default joiToErrors;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.joiToErrorMessages = void 0;
4
- /*
5
- * Converts Joi error objects to a { key, message } type object (pb.Error, Object, etc.)
6
- */
7
- const joiToErrors = (joiErrors, errorClass) => {
8
- const errors = joiErrors.details.map(detail => {
9
- const key = detail.path[0];
10
- const type = detail.type;
11
- // Note, these messages eventually need to be symbolic, and also localized / translated.
12
- // Right now, we're mainly using the English strings returned by the Joi validators.
13
- const defaultMessage = detail.message;
14
- const message = publicErrorMessage(key, type, defaultMessage);
15
- return new errorClass({ key, message });
16
- }, {});
17
- return errors;
18
- };
19
- /*
20
- * Override default Joi messages, which aren't always safe to show to our users.
21
- */
22
- const publicErrorMessage = (key, type, defaultMessage) => {
23
- let message = defaultMessage;
24
- switch (type) {
25
- case "string.regex.base": {
26
- // regex errors echo back the value, which is dangerous for passwords
27
- message = `"${key}" does not meet the requirements`;
28
- }
29
- }
30
- return message;
31
- };
32
- /*
33
- * Function used for more detailed key info and custom error messages
34
- */
35
- const joiToErrorMessages = (joiErrors, errorClass) => {
36
- const errors = joiErrors.details.map(detail => {
37
- const key = detail.context.label;
38
- const message = detail.message;
39
- return new errorClass({ key, message });
40
- }, {});
41
- return errors;
42
- };
43
- exports.joiToErrorMessages = joiToErrorMessages;
44
- exports.default = joiToErrors;
45
- //# sourceMappingURL=joiToErrors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"joiToErrors.js","sourceRoot":"","sources":["../src/joiToErrors.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,EAAE;IAC5C,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QAC5C,MAAM,GAAG,GAAG,M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map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":""}
@@ -1,50 +0,0 @@
1
- import wait from '@sellout/utils/.dist/wait';
2
-
3
- export default class MongoConnectionManager {
4
- public connected: boolean;
5
- public mongoConnectionString: string;
6
- public isReplicaSet: boolean;
7
- private mongoose: any;
8
- private mongoConnectionStringInternal: string;
9
-
10
- constructor(mongoose: any, mongoConnectionString: string, username: string = '', password: string = '') {
11
- const parsed = new URL(mongoConnectionString);
12
-
13
- parsed.username = username;
14
- parsed.password = password;
15
- parsed.pathname = '/admin';
16
-
17
- this.connected = false;
18
- this.mongoConnectionStringInternal = parsed.toString();
19
- this.isReplicaSet = parsed.protocol === 'mongodb+srv:';
20
-
21
- // redact username/password from publicly available connection string
22
- parsed.username = '__user__';
23
- parsed.password = '__pass__';
24
- this.mongoConnectionString = parsed.toString();
25
- this.mongoose = mongoose;
26
- }
27
-
28
- public async connect() {
29
- while(!this.connected) {
30
- console.log('Attempting to connect to Mongo...');
31
- this.mongoose.connect(this.mongoConnectionStringInternal, {
32
- ssl: false,
33
- useUnifiedTopology: true,
34
- useNewUrlParser: true,
35
- })
36
- .then(() => {
37
- this.connected = true;
38
- console.log(`Connected to MongoDB: ${this.mongoConnectionString}`);
39
- })
40
- .catch((e: any) => {
41
- console.error(`There was an error connecting to MongoDB: ${this.mongoConnectionString}`);
42
- console.error(e);
43
- });
44
-
45
- // wait five seconds before trying again
46
- await wait(5000);
47
- }
48
- }
49
- }
50
-
@@ -1,33 +0,0 @@
1
- {
2
- "compileOnSave": true,
3
- "compilerOptions": {
4
- "inlineSourceMap": true,
5
- "baseUrl": ".",
6
- "moduleResolution": "node",
7
- "target": "es6",
8
- "esModuleInterop": true,
9
- "lib": ["es6", "dom", "esnext.asynciterable"],
10
- "module": "commonjs",
11
- "outDir": "./.dist/",
12
- "declaration": true,
13
- "jsx": "react",
14
- // "sourceMap": true,
15
- // "strictNullChecks": true,
16
- "noUnusedLocals": true,
17
- "paths": {},
18
- "types": [
19
- "node",
20
- "long",
21
- "mocha"
22
- ]
23
- },
24
- "include": [
25
- "src/**/*.ts",
26
- "src/templates",
27
- ],
28
- "exclude": [
29
- "node_modules",
30
- "test/*",
31
- "dist/*"
32
- ]
33
- }
@@ -1,17 +0,0 @@
1
- {
2
- "extends": "tslint-config-airbnb",
3
- "rules": {
4
- "quotemark": [
5
- true,
6
- "single"
7
- ],
8
- "import-name": false,
9
- "variable-name": false,
10
- "max-line-length": false,
11
- "no-console": false,
12
- "ban": false
13
- },
14
- "jsRules": {
15
- "max-line-length": false
16
- }
17
- }
package/src/interfaces.ts DELETED
@@ -1,47 +0,0 @@
1
- export interface ISubscriptionRoutes {
2
- [routeName: string]: IMessageHandler;
3
- }
4
-
5
- export interface IConnectionManager {
6
- connect();
7
- close();
8
- on(event: string, cb: (...args: any[]) => void);
9
- send(
10
- serviceId: string,
11
- method: string,
12
- req: Buffer,
13
- cb: (error, reply) => void,
14
- timeout?: number
15
- );
16
- sendAsync(
17
- serviceId: string,
18
- method: string,
19
- req: Buffer,
20
- cb: (error, reply) => void,
21
- timeout?: number
22
- );
23
- sendBroadcast(messageId: string, req: Buffer, cb: (error, reply) => void);
24
- subscribe(serviceId: string, queue: string, routes: ISubscriptionRoutes);
25
- subscribeBroadcast(serviceId: string, routes: ISubscriptionRoutes);
26
- }
27
-
28
- export interface ILogManager {
29
- info(msg: string, ...params: string[]): void;
30
- warn(msg: string, ...params: string[]): void;
31
- error(msg: string, ...params: string[]): void;
32
- }
33
-
34
- export interface ILogManagerOpts {
35
- serviceName: string;
36
- }
37
-
38
- export interface IMessageHandler {
39
- process(req: Buffer): Promise<Buffer>;
40
- }
41
-
42
- export interface IServiceOpts {
43
- serviceName: string;
44
- connectionMgr: IConnectionManager;
45
- logManager: ILogManager;
46
- storageManager?: any;
47
- }
package/tsconfig.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "compileOnSave": true,
3
- "compilerOptions": {
4
- "baseUrl": ".",
5
- "moduleResolution": "node",
6
- "target": "es6",
7
- "module": "commonjs",
8
- "outDir": "./.dist/",
9
- "declaration": true,
10
- "jsx": "react",
11
- "sourceMap": true,
12
- "strictNullChecks": true,
13
- "noUnusedLocals": false,
14
- "paths": {},
15
- "types": [
16
- "node",
17
- "long"
18
- ]
19
- },
20
- "typeRoots": [
21
- "node_modules/@types"
22
- ],
23
- "include": [
24
- "./src/**/*.ts"
25
- ],
26
- "exclude": [
27
- "node_modules"
28
- ]
29
- }
package/tslint.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "extends": "tslint-config-airbnb",
3
- "rules": {
4
- "max-line-length": {
5
- "options": [120]
6
- },
7
- "no-console": false,
8
- "ban": [
9
- true,
10
- {
11
- "name": ["Math", "random"],
12
- "message": "Use a better RNG, perhaps UUID?"
13
- }
14
- ]
15
- },
16
- "jsRules": {
17
- "max-line-length": {
18
- "options": [120]
19
- }
20
- }
21
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes