@rc-ex/debug 1.3.4 → 1.3.6

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/package.json CHANGED
@@ -1,18 +1,21 @@
1
1
  {
2
2
  "name": "@rc-ex/debug",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
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",
7
7
  "license": "MIT",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "types": "dist/esm/index.d.ts",
8
12
  "main": "dist/cjs/index.js",
9
- "types": "dist/cjs/index.d.ts",
10
13
  "module": "dist/esm/index.js",
11
14
  "exports": {
12
15
  ".": {
16
+ "types": "./dist/esm/index.d.ts",
13
17
  "import": "./dist/esm/index.js",
14
- "require": "./dist/cjs/index.js",
15
- "types": "./dist/esm/index.d.ts"
18
+ "require": "./dist/cjs/index.js"
16
19
  }
17
20
  },
18
21
  "repository": {
@@ -28,5 +31,5 @@
28
31
  "scripts": {
29
32
  "build": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json"
30
33
  },
31
- "gitHead": "4a3dfa3b7c78e8460c531bcdd82802c7fcf3eee3"
34
+ "gitHead": "7d3bb3cd80534f35015d125bbb6492cd8582b628"
32
35
  }
package/src/index.ts DELETED
@@ -1,50 +0,0 @@
1
- import type RingCentral from "@rc-ex/core/index";
2
- import type {
3
- RestMethod,
4
- RestRequestConfig,
5
- RestResponse,
6
- } from "@rc-ex/core/types";
7
- import Utils from "@rc-ex/core/Utils";
8
- import SdkExtension from "@rc-ex/core/SdkExtension";
9
-
10
- export interface DebugOptions {
11
- loggingAction?: (message: string) => void;
12
- }
13
-
14
- class DebugExtension extends SdkExtension {
15
- public options: DebugOptions;
16
-
17
- public constructor(options: DebugOptions = {}) {
18
- super();
19
- this.options = options;
20
- this.options.loggingAction ??= (message) => console.debug(message);
21
- }
22
-
23
- public async install(rc: RingCentral) {
24
- const request: typeof rc.request = rc.request.bind(rc);
25
- rc.request = async <T>(
26
- method: RestMethod,
27
- endpoint: string,
28
- content?: {},
29
- queryParams?: {},
30
- config?: RestRequestConfig,
31
- ): Promise<RestResponse<T>> => {
32
- if (!this.enabled) {
33
- return request(method, endpoint, content, queryParams, config);
34
- }
35
- const r = await request<T>(
36
- method,
37
- endpoint,
38
- content,
39
- queryParams,
40
- config,
41
- );
42
- this.options.loggingAction!(Utils.formatTraffic(r));
43
- return r;
44
- };
45
- }
46
-
47
- public async revoke(): Promise<void> {}
48
- }
49
-
50
- export default DebugExtension;
package/tsconfig.cjs.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "esModuleInterop": true,
4
- "module": "commonjs",
5
- "declaration": true,
6
- "outDir": "./dist/cjs",
7
- "skipLibCheck": true,
8
- "sourceMap": true,
9
- "paths": {
10
- "@rc-ex/core/*": [
11
- "../../core/dist/cjs/*"
12
- ]
13
- }
14
- },
15
- "include": ["src/**/*.ts"]
16
- }
package/tsconfig.esm.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "esModuleInterop": true,
4
- "module": "esnext",
5
- "declaration": true,
6
- "outDir": "./dist/esm",
7
- "skipLibCheck": true,
8
- "sourceMap": true,
9
- "paths": {
10
- "@rc-ex/core/*": [
11
- "../../core/dist/esm/*"
12
- ]
13
- }
14
- },
15
- "include": ["src/**/*.ts"]
16
- }