@rc-ex/debug 1.1.18 → 1.2.1

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
@@ -19,9 +19,11 @@ const debugExtension = new DebugExtension();
19
19
  await rc.installExtension(debugExtension);
20
20
  ```
21
21
 
22
- With this extension installed, details for every API request traffic will be printed using `console.debug`.
22
+ With this extension installed, details for every API request traffic will be
23
+ printed using `console.debug`.
23
24
 
24
- Below is sample output for `await rc.restapi().account().extension().messageStore().list()`:
25
+ Below is sample output for
26
+ `await rc.restapi().account().extension().messageStore().list()`:
25
27
 
26
28
  ```
27
29
  console.debug
@@ -80,11 +82,13 @@ Request:
80
82
  }
81
83
  ```
82
84
 
83
- For a working sample, please check this [test case](../../../test/debug-extension.spec.ts).
85
+ For a working sample, please check this
86
+ [test case](../../../test/debug-extension.spec.ts).
84
87
 
85
88
  ## loggingAction
86
89
 
87
- Optionally, you can specify a `loggingAction` function to the extension constructor.
90
+ Optionally, you can specify a `loggingAction` function to the extension
91
+ constructor.
88
92
 
89
93
  ```ts
90
94
  export type LoggingAction = (message: string) => void;
@@ -93,5 +97,5 @@ export type LoggingAction = (message: string) => void;
93
97
  `loggingAction` determines how debug messages are logged. By default it is:
94
98
 
95
99
  ```ts
96
- (message) => console.debug(message);
100
+ ((message) => console.debug(message));
97
101
  ```
package/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type RingCentral from '@rc-ex/core';
2
- import SdkExtension from '@rc-ex/core/lib/SdkExtension';
1
+ import type RingCentral from "@rc-ex/core";
2
+ import SdkExtension from "@rc-ex/core/src/SdkExtension";
3
3
  export interface DebugOptions {
4
4
  loggingAction?: (message: string) => void;
5
5
  }
package/lib/index.js CHANGED
@@ -3,15 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const Utils_1 = __importDefault(require("@rc-ex/core/lib/Utils"));
7
- const SdkExtension_1 = __importDefault(require("@rc-ex/core/lib/SdkExtension"));
6
+ const Utils_1 = __importDefault(require("@rc-ex/core/src/Utils"));
7
+ const SdkExtension_1 = __importDefault(require("@rc-ex/core/src/SdkExtension"));
8
8
  class DebugExtension extends SdkExtension_1.default {
9
9
  constructor(options = {}) {
10
10
  var _a;
11
11
  var _b;
12
12
  super();
13
13
  this.options = options;
14
- // eslint-disable-next-line no-console
15
14
  (_a = (_b = this.options).loggingAction) !== null && _a !== void 0 ? _a : (_b.loggingAction = (message) => console.debug(message));
16
15
  }
17
16
  async install(rc) {
@@ -25,7 +24,6 @@ class DebugExtension extends SdkExtension_1.default {
25
24
  return r;
26
25
  };
27
26
  }
28
- // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-empty-function
29
27
  async revoke() { }
30
28
  }
31
29
  exports.default = DebugExtension;
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAEA,kEAA0C;AAC1C,gFAAwD;AAMxD,MAAM,cAAe,SAAQ,sBAAY;IAGvC,YAAmB,UAAwB,EAAE;;;QAC3C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,sCAAsC;QACtC,YAAA,IAAI,CAAC,OAAO,EAAC,aAAa,uCAAb,aAAa,GAAK,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAC;IACrE,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,EAAe;QAClC,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACpC,EAAE,CAAC,OAAO,GAAG,KAAK,EAChB,MAAkB,EAClB,QAAgB,EAChB,OAAY,EACZ,WAAgB,EAChB,MAA0B,EAEA,EAAE;YAC5B,IAAI,CAAC,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,CAAC,GAAG,MAAM,OAAO,CACrB,MAAM,EACN,QAAQ,EACR,OAAO,EACP,WAAW,EACX,MAAM,CACP,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,aAAc,CAAC,eAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;YACpD,OAAO,CAAC,CAAC;QACX,CAAC,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,MAAM,KAAmB,CAAC;CACxC;AAED,kBAAe,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-ex/debug",
3
- "version": "1.1.18",
3
+ "version": "1.2.1",
4
4
  "description": "Debug extension for ringcentral-extensible project",
5
5
  "author": "Tyler Liu <tyler.liu@ringcentral.com>",
6
6
  "homepage": "https://github.com/ringcentral/ringcentral-extensible/tree/master/packages/extensions/debug",
@@ -18,7 +18,7 @@
18
18
  "access": "public"
19
19
  },
20
20
  "devDependencies": {
21
- "@rc-ex/core": "^1.4.2"
21
+ "@rc-ex/core": "^1.5.1"
22
22
  },
23
- "gitHead": "b992e8e21a97a1d7dc1e77ae5c6ccb13591839d6"
23
+ "gitHead": "1a8a5becc832b92af73f1ad1f58b87f38fee3650"
24
24
  }
package/src/index.ts CHANGED
@@ -1,7 +1,11 @@
1
- import type RingCentral from '@rc-ex/core';
2
- import type { RestRequestConfig, RestResponse, RestMethod } from '@rc-ex/core/lib/types';
3
- import Utils from '@rc-ex/core/lib/Utils';
4
- import SdkExtension from '@rc-ex/core/lib/SdkExtension';
1
+ import type RingCentral from "@rc-ex/core";
2
+ import type {
3
+ RestMethod,
4
+ RestRequestConfig,
5
+ RestResponse,
6
+ } from "@rc-ex/core/src/types";
7
+ import Utils from "@rc-ex/core/src/Utils";
8
+ import SdkExtension from "@rc-ex/core/src/SdkExtension";
5
9
 
6
10
  export interface DebugOptions {
7
11
  loggingAction?: (message: string) => void;
@@ -13,7 +17,6 @@ class DebugExtension extends SdkExtension {
13
17
  public constructor(options: DebugOptions = {}) {
14
18
  super();
15
19
  this.options = options;
16
- // eslint-disable-next-line no-console
17
20
  this.options.loggingAction ??= (message) => console.debug(message);
18
21
  }
19
22
 
@@ -25,18 +28,22 @@ class DebugExtension extends SdkExtension {
25
28
  content?: {},
26
29
  queryParams?: {},
27
30
  config?: RestRequestConfig,
28
- // eslint-disable-next-line max-params
29
31
  ): Promise<RestResponse<T>> => {
30
32
  if (!this.enabled) {
31
33
  return request(method, endpoint, content, queryParams, config);
32
34
  }
33
- const r = await request<T>(method, endpoint, content, queryParams, config);
35
+ const r = await request<T>(
36
+ method,
37
+ endpoint,
38
+ content,
39
+ queryParams,
40
+ config,
41
+ );
34
42
  this.options.loggingAction!(Utils.formatTraffic(r));
35
43
  return r;
36
44
  };
37
45
  }
38
46
 
39
- // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-empty-function
40
47
  public async revoke(): Promise<void> {}
41
48
  }
42
49