@reyaxyz/common 0.91.0 → 0.92.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/README.md CHANGED
@@ -6,5 +6,5 @@
6
6
 
7
7
  | Statements | Branches | Functions | Lines |
8
8
  | --------------------------- | ----------------------- | ------------------------- | ----------------- |
9
- | ![Statements](https://img.shields.io/badge/statements-16.52%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-17.16%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-11%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-17.14%25-red.svg?style=flat) |
9
+ | ![Statements](https://img.shields.io/badge/statements-15.4%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-16.66%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-11.21%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-15.95%25-red.svg?style=flat) |
10
10
 
@@ -4,6 +4,5 @@ export * from './number';
4
4
  export * from './retry';
5
5
  export * from './timestamp';
6
6
  export * from './token';
7
- export * from './logger';
8
7
  export * from './task-wrapper';
9
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"task-wrapper.d.ts","sourceRoot":"/","sources":["utils/task-wrapper.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,mBAAmB,EAAE,OAAO,EAC5B,QAAQ,GAAE,MAAM,GAAG,IAAW,GAC7B,IAAI,CAsBN"}
1
+ {"version":3,"file":"task-wrapper.d.ts","sourceRoot":"/","sources":["utils/task-wrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,mBAAmB,EAAE,OAAO,EAC5B,QAAQ,GAAE,MAAM,GAAG,IAAW,GAC7B,IAAI,CAsBN"}
@@ -20,6 +20,5 @@ __exportStar(require("./number"), exports);
20
20
  __exportStar(require("./retry"), exports);
21
21
  __exportStar(require("./timestamp"), exports);
22
22
  __exportStar(require("./token"), exports);
23
- __exportStar(require("./logger"), exports);
24
23
  __exportStar(require("./task-wrapper"), exports);
25
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,0CAAwB;AACxB,2CAAyB;AACzB,iDAA+B","sourcesContent":["export * from './consts';\nexport * from './network';\nexport * from './number';\nexport * from './retry';\nexport * from './timestamp';\nexport * from './token';\nexport * from './logger';\nexport * from './task-wrapper';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,0CAAwB;AACxB,iDAA+B","sourcesContent":["export * from './consts';\nexport * from './network';\nexport * from './number';\nexport * from './retry';\nexport * from './timestamp';\nexport * from './token';\nexport * from './task-wrapper';\n"]}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.wrapBackgroundTask = void 0;
4
- var logger_1 = require("./logger");
5
4
  /**
6
5
  * Wrapper that should be used around all hanging promises--any promise which is not awaited.
7
6
  *
@@ -18,7 +17,7 @@ function wrapBackgroundTask(promise, shouldRethrowErrors, taskName) {
18
17
  promise.catch(function (error) {
19
18
  // Paranoid: don't want the catch body to throw unexpectedly.
20
19
  try {
21
- logger_1.logger.error({
20
+ console.log({
22
21
  at: 'tasks#wrapBackgroundTask',
23
22
  message: 'Background task had an uncaught error',
24
23
  error: error,
@@ -1 +1 @@
1
- {"version":3,"file":"task-wrapper.js","sourceRoot":"/","sources":["utils/task-wrapper.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAElC;;;;;;;;;;GAUG;AACH,SAAgB,kBAAkB,CAChC,OAAmB,EACnB,mBAA4B,EAC5B,QAA8B;IAA9B,yBAAA,EAAA,eAA8B;IAE9B,OAAO,CAAC,KAAK,CAAC,UAAC,KAAK;QAClB,6DAA6D;QAC7D,IAAI,CAAC;YACH,eAAM,CAAC,KAAK,CAAC;gBACX,EAAE,EAAE,0BAA0B;gBAC9B,OAAO,EAAE,uCAAuC;gBAChD,KAAK,OAAA;gBACL,mBAAmB,qBAAA;gBACnB,QAAQ,UAAA;aACT,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,UAAU,EAAE,CAAC;YACpB,yCAAyC;YACzC,OAAO,CAAC,KAAK,CACX,0DAAmD,QAAQ,OAAI,EAC/D,UAAU,CACX,CAAC;QACJ,CAAC;QACD,IAAI,mBAAmB,EAAE,CAAC;YACxB,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AA1BD,gDA0BC","sourcesContent":["import { logger } from './logger';\n\n/**\n * Wrapper that should be used around all hanging promises--any promise which is not awaited.\n *\n * The purpose of the wrapper is to help enforce explicit handling of all promises in a standardized\n * way. The wrapper will act as a last fallback for logging uncaught errors, and requires the caller\n * to specify whether the task should re-throw, potentially killing the Node process.\n *\n * Context:\n * https://blog.heroku.com/best-practices-nodejs-errors\n * https://github.com/palantir/tslint/issues/4653\n */\nexport function wrapBackgroundTask<T>(\n promise: Promise<T>,\n shouldRethrowErrors: boolean,\n taskName: string | null = null,\n): void {\n promise.catch((error) => {\n // Paranoid: don't want the catch body to throw unexpectedly.\n try {\n logger.error({\n at: 'tasks#wrapBackgroundTask',\n message: 'Background task had an uncaught error',\n error,\n shouldRethrowErrors,\n taskName,\n });\n } catch (innerError) {\n /* eslint-disable-next-line no-console */\n console.error(\n `wrapBackgroundTask catch block failed (taskName=${taskName}):`,\n innerError,\n );\n }\n if (shouldRethrowErrors) {\n throw error;\n }\n });\n}\n"]}
1
+ {"version":3,"file":"task-wrapper.js","sourceRoot":"/","sources":["utils/task-wrapper.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,SAAgB,kBAAkB,CAChC,OAAmB,EACnB,mBAA4B,EAC5B,QAA8B;IAA9B,yBAAA,EAAA,eAA8B;IAE9B,OAAO,CAAC,KAAK,CAAC,UAAC,KAAK;QAClB,6DAA6D;QAC7D,IAAI,CAAC;YACH,OAAO,CAAC,GAAG,CAAC;gBACV,EAAE,EAAE,0BAA0B;gBAC9B,OAAO,EAAE,uCAAuC;gBAChD,KAAK,OAAA;gBACL,mBAAmB,qBAAA;gBACnB,QAAQ,UAAA;aACT,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,UAAU,EAAE,CAAC;YACpB,yCAAyC;YACzC,OAAO,CAAC,KAAK,CACX,0DAAmD,QAAQ,OAAI,EAC/D,UAAU,CACX,CAAC;QACJ,CAAC;QACD,IAAI,mBAAmB,EAAE,CAAC;YACxB,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AA1BD,gDA0BC","sourcesContent":["/**\n * Wrapper that should be used around all hanging promises--any promise which is not awaited.\n *\n * The purpose of the wrapper is to help enforce explicit handling of all promises in a standardized\n * way. The wrapper will act as a last fallback for logging uncaught errors, and requires the caller\n * to specify whether the task should re-throw, potentially killing the Node process.\n *\n * Context:\n * https://blog.heroku.com/best-practices-nodejs-errors\n * https://github.com/palantir/tslint/issues/4653\n */\nexport function wrapBackgroundTask<T>(\n promise: Promise<T>,\n shouldRethrowErrors: boolean,\n taskName: string | null = null,\n): void {\n promise.catch((error) => {\n // Paranoid: don't want the catch body to throw unexpectedly.\n try {\n console.log({\n at: 'tasks#wrapBackgroundTask',\n message: 'Background task had an uncaught error',\n error,\n shouldRethrowErrors,\n taskName,\n });\n } catch (innerError) {\n /* eslint-disable-next-line no-console */\n console.error(\n `wrapBackgroundTask catch block failed (taskName=${taskName}):`,\n innerError,\n );\n }\n if (shouldRethrowErrors) {\n throw error;\n }\n });\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/common",
3
- "version": "0.91.0",
3
+ "version": "0.92.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -24,8 +24,7 @@
24
24
  "axios": "^1.6.2",
25
25
  "bignumber.js": "^9.1.2",
26
26
  "ethers": "6.9.0",
27
- "lodash.clonedeep": "4.5.0",
28
- "winston": "^3.11.0"
27
+ "lodash.clonedeep": "4.5.0"
29
28
  },
30
29
  "scripts": {
31
30
  "prebuild": "rm -rf node_modules && rm -rf dist",
@@ -43,5 +42,5 @@
43
42
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
44
43
  },
45
44
  "packageManager": "pnpm@8.3.1",
46
- "gitHead": "f55d30a9441eacf53d8055369e553ef2f192af82"
45
+ "gitHead": "8210c477cc4150f9f780727b63ca592f8a1f565b"
47
46
  }
@@ -4,5 +4,4 @@ export * from './number';
4
4
  export * from './retry';
5
5
  export * from './timestamp';
6
6
  export * from './token';
7
- export * from './logger';
8
7
  export * from './task-wrapper';
@@ -1,5 +1,3 @@
1
- import { logger } from './logger';
2
-
3
1
  /**
4
2
  * Wrapper that should be used around all hanging promises--any promise which is not awaited.
5
3
  *
@@ -19,7 +17,7 @@ export function wrapBackgroundTask<T>(
19
17
  promise.catch((error) => {
20
18
  // Paranoid: don't want the catch body to throw unexpectedly.
21
19
  try {
22
- logger.error({
20
+ console.log({
23
21
  at: 'tasks#wrapBackgroundTask',
24
22
  message: 'Background task had an uncaught error',
25
23
  error,
@@ -1,4 +0,0 @@
1
- import * as winston from 'winston';
2
- declare const logger: winston.Logger;
3
- export { logger };
4
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"/","sources":["utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAoCnC,QAAA,MAAM,MAAM,gBAWV,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -1,58 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.logger = void 0;
27
- var winston = __importStar(require("winston"));
28
- var isDevelopment = process.env.NODE_ENV !== 'production';
29
- var consoleTransport = new winston.transports.Console({
30
- format: winston.format.combine(winston.format.timestamp({
31
- format: 'YYYY-MM-DD HH:mm:ss',
32
- }), winston.format.colorize({
33
- colors: {
34
- info: 'cyan',
35
- debug: 'blue',
36
- error: 'red',
37
- warn: 'yellow',
38
- },
39
- }), winston.format.printf(function (info) {
40
- return "".concat(info.timestamp, " [").concat(info.level, "] [").concat(info.context, "] ").concat(info.message);
41
- })),
42
- });
43
- var cloudTransport = new winston.transports.Console({
44
- format: winston.format.combine(winston.format.timestamp({
45
- format: 'YYYY-MM-DD HH:mm:ss',
46
- }), winston.format.printf(function (info) {
47
- return "".concat(info.timestamp, " [").concat(info.level, "] [").concat(info.context, "] ").concat(info.message);
48
- })),
49
- });
50
- var logger = winston.createLogger({
51
- level: 'info',
52
- format: winston.format.combine(winston.format.timestamp({
53
- format: 'YYYY-MM-DD HH:mm:ss',
54
- }), winston.format.errors({ stack: true }), winston.format.splat(), winston.format.json()),
55
- transports: [isDevelopment ? consoleTransport : cloudTransport],
56
- });
57
- exports.logger = logger;
58
- //# sourceMappingURL=logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"/","sources":["utils/logger.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAmC;AAEnC,IAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC;AAE5D,IAAM,gBAAgB,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;IACtD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO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CACtB;IACD,UAAU,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,cAAc,CAAC;CAChE,CAAC,CAAC;AAEM,wBAAM","sourcesContent":["import * as winston from 'winston';\n\nconst isDevelopment = process.env.NODE_ENV !== 'production';\n\nconst consoleTransport = new winston.transports.Console({\n format: winston.format.combine(\n winston.format.timestamp({\n format: 'YYYY-MM-DD HH:mm:ss',\n }),\n winston.format.colorize({\n colors: {\n info: 'cyan',\n debug: 'blue',\n error: 'red',\n warn: 'yellow',\n },\n }),\n winston.format.printf(\n (info) =>\n `${info.timestamp} [${info.level}] [${info.context}] ${info.message}`,\n ),\n ),\n});\n\nconst cloudTransport = new winston.transports.Console({\n format: winston.format.combine(\n winston.format.timestamp({\n format: 'YYYY-MM-DD HH:mm:ss',\n }),\n winston.format.printf(\n (info) =>\n `${info.timestamp} [${info.level}] [${info.context}] ${info.message}`,\n ),\n ),\n});\n\nconst logger = winston.createLogger({\n level: 'info',\n format: winston.format.combine(\n winston.format.timestamp({\n format: 'YYYY-MM-DD HH:mm:ss',\n }),\n winston.format.errors({ stack: true }),\n winston.format.splat(),\n winston.format.json(),\n ),\n transports: [isDevelopment ? consoleTransport : cloudTransport],\n});\n\nexport { logger };\n"]}
@@ -1,50 +0,0 @@
1
- import * as winston from 'winston';
2
-
3
- const isDevelopment = process.env.NODE_ENV !== 'production';
4
-
5
- const consoleTransport = new winston.transports.Console({
6
- format: winston.format.combine(
7
- winston.format.timestamp({
8
- format: 'YYYY-MM-DD HH:mm:ss',
9
- }),
10
- winston.format.colorize({
11
- colors: {
12
- info: 'cyan',
13
- debug: 'blue',
14
- error: 'red',
15
- warn: 'yellow',
16
- },
17
- }),
18
- winston.format.printf(
19
- (info) =>
20
- `${info.timestamp} [${info.level}] [${info.context}] ${info.message}`,
21
- ),
22
- ),
23
- });
24
-
25
- const cloudTransport = new winston.transports.Console({
26
- format: winston.format.combine(
27
- winston.format.timestamp({
28
- format: 'YYYY-MM-DD HH:mm:ss',
29
- }),
30
- winston.format.printf(
31
- (info) =>
32
- `${info.timestamp} [${info.level}] [${info.context}] ${info.message}`,
33
- ),
34
- ),
35
- });
36
-
37
- const logger = winston.createLogger({
38
- level: 'info',
39
- format: winston.format.combine(
40
- winston.format.timestamp({
41
- format: 'YYYY-MM-DD HH:mm:ss',
42
- }),
43
- winston.format.errors({ stack: true }),
44
- winston.format.splat(),
45
- winston.format.json(),
46
- ),
47
- transports: [isDevelopment ? consoleTransport : cloudTransport],
48
- });
49
-
50
- export { logger };