jr-common-micro 1.1.26 → 1.1.28

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.
@@ -194,6 +194,7 @@ export interface JrBlogListRequest {
194
194
  sort_by?: string | undefined;
195
195
  sort_direction?: string | undefined;
196
196
  optimized?: boolean | undefined;
197
+ coin?: string | undefined;
197
198
  }
198
199
  export interface JrBlogListResponse {
199
200
  status: ResponseStatus | undefined;
@@ -223,6 +223,7 @@ export declare class JrBlogListRequest extends Message<JrBlogListRequest> {
223
223
  sortBy?: string;
224
224
  sortDirection?: string;
225
225
  optimized?: boolean;
226
+ coin?: string;
226
227
  constructor(data?: PartialMessage<JrBlogListRequest>);
227
228
  static readonly runtime: typeof proto3;
228
229
  static readonly typeName = "micro.v1.news.JrBlogListRequest";
@@ -404,6 +404,7 @@ class JrBlogListRequest extends protobuf_1.Message {
404
404
  sortBy;
405
405
  sortDirection;
406
406
  optimized;
407
+ coin;
407
408
  constructor(data) {
408
409
  super();
409
410
  protobuf_1.proto3.util.initPartial(data, this);
@@ -421,6 +422,7 @@ class JrBlogListRequest extends protobuf_1.Message {
421
422
  { no: 8, name: "sort_by", kind: "scalar", T: 9, opt: true },
422
423
  { no: 9, name: "sort_direction", kind: "scalar", T: 9, opt: true },
423
424
  { no: 10, name: "optimized", kind: "scalar", T: 8, opt: true },
425
+ { no: 11, name: "coin", kind: "scalar", T: 9, opt: true },
424
426
  ]);
425
427
  static fromBinary(bytes, options) {
426
428
  return new JrBlogListRequest().fromBinary(bytes, options);
@@ -65,6 +65,6 @@ export declare const getRedisLogMessage: (functionName: string, redis: {
65
65
  data?: any;
66
66
  misc?: Record<string, any>;
67
67
  }) => LogMessage;
68
- export declare function executeWithReturn<T extends (...args: any[]) => any>(logger: any, logMessage: LogMessage, func: T, ...args: Parameters<T>): Promise<ReturnType<T>>;
69
- export declare function executeWithoutReturn<T extends (...args: any[]) => any>(logger: any, logMessage: LogMessage, func: T, ...args: Parameters<T>): Promise<ReturnType<T>>;
68
+ export declare function executeWithReturn<T extends (...args: any[]) => any>(logger: any, logMessage: LogMessage, func: T, elasticsearchService?: any, elasticsearch_logs_index?: string, methodName?: string, ...args: Parameters<T>): Promise<ReturnType<T>>;
69
+ export declare function executeWithoutReturn<T extends (...args: any[]) => any>(logger: any, logMessage: LogMessage, func: T, elasticsearchService?: any, elasticsearch_logs_index?: string, methodName?: string, ...args: Parameters<T>): Promise<ReturnType<T>>;
70
70
  export declare function jsonStringify(val: any): string;
@@ -390,7 +390,7 @@ const getRedisLogMessage = (functionName, redis, options) => {
390
390
  };
391
391
  };
392
392
  exports.getRedisLogMessage = getRedisLogMessage;
393
- async function executeWithReturn(logger, logMessage, func, ...args) {
393
+ async function executeWithReturn(logger, logMessage, func, elasticsearchService, elasticsearch_logs_index, methodName, ...args) {
394
394
  try {
395
395
  const result = await func(...args);
396
396
  if (isEmptyAtAll(result)) {
@@ -405,17 +405,35 @@ async function executeWithReturn(logger, logMessage, func, ...args) {
405
405
  }
406
406
  catch (error) {
407
407
  logMessage.misc = { ...logMessage.misc, error };
408
+ if (elasticsearchService && elasticsearch_logs_index) {
409
+ elasticsearchService.log(elasticsearch_logs_index, {
410
+ action: 'executeWithReturn',
411
+ method: methodName,
412
+ status: 'error',
413
+ message: logMessage,
414
+ timestamp: new Date(),
415
+ });
416
+ }
408
417
  logger.error(logMessage);
409
418
  return null;
410
419
  }
411
420
  }
412
- async function executeWithoutReturn(logger, logMessage, func, ...args) {
421
+ async function executeWithoutReturn(logger, logMessage, func, elasticsearchService, elasticsearch_logs_index, methodName, ...args) {
413
422
  try {
414
423
  const result = await func(...args);
415
424
  return result;
416
425
  }
417
426
  catch (error) {
418
427
  logMessage.misc = { ...logMessage.misc, error };
428
+ if (elasticsearchService && elasticsearch_logs_index) {
429
+ elasticsearchService.log(elasticsearch_logs_index, {
430
+ action: 'executeWithoutReturn',
431
+ method: methodName,
432
+ status: 'error',
433
+ message: logMessage,
434
+ timestamp: new Date(),
435
+ });
436
+ }
419
437
  logger.error(logMessage);
420
438
  return null;
421
439
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jr-common-micro",
3
- "version": "1.1.26",
3
+ "version": "1.1.28",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -108,6 +108,7 @@ message JrBlogListRequest {
108
108
  optional string sort_by = 8;
109
109
  optional string sort_direction = 9;
110
110
  optional bool optimized = 10;
111
+ optional string coin = 11;
111
112
  }
112
113
 
113
114
  message JrBlogListResponse {