@rc-ex/debug 1.3.12 → 1.4.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
@@ -5,7 +5,7 @@ Provide debug mode for this SDK.
5
5
  ## Install
6
6
 
7
7
  ```
8
- yarn add @rc-ex/debug
8
+ pnpm add @rc-ex/debug
9
9
  ```
10
10
 
11
11
  ## Usage
package/dist/index.cjs ADDED
@@ -0,0 +1,51 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ //#region \0rolldown/runtime.js
6
+ var __create = Object.create;
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getProtoOf = Object.getPrototypeOf;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
+ key = keys[i];
15
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: ((k) => from[k]).bind(null, key),
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+ //#endregion
27
+ let _rc_ex_core_SdkExtension = require("@rc-ex/core/SdkExtension");
28
+ _rc_ex_core_SdkExtension = __toESM(_rc_ex_core_SdkExtension, 1);
29
+ let _rc_ex_core_Utils = require("@rc-ex/core/Utils");
30
+ _rc_ex_core_Utils = __toESM(_rc_ex_core_Utils, 1);
31
+ //#region src/index.ts
32
+ var DebugExtension = class extends _rc_ex_core_SdkExtension.default {
33
+ options;
34
+ constructor(options = {}) {
35
+ super();
36
+ this.options = options;
37
+ this.options.loggingAction ??= (message) => console.debug(message);
38
+ }
39
+ async install(rc) {
40
+ const request = rc.request.bind(rc);
41
+ rc.request = async (method, endpoint, content, queryParams, config) => {
42
+ if (!this.enabled) return request(method, endpoint, content, queryParams, config);
43
+ const r = await request(method, endpoint, content, queryParams, config);
44
+ this.options.loggingAction(_rc_ex_core_Utils.default.formatTraffic(r));
45
+ return r;
46
+ };
47
+ }
48
+ async revoke() {}
49
+ };
50
+ //#endregion
51
+ exports.default = DebugExtension;
@@ -0,0 +1,15 @@
1
+ import RingCentral from "@rc-ex/core";
2
+ import SdkExtension from "@rc-ex/core/SdkExtension";
3
+
4
+ //#region src/index.d.ts
5
+ interface DebugOptions {
6
+ loggingAction?: (message: string) => void;
7
+ }
8
+ declare class DebugExtension extends SdkExtension {
9
+ options: DebugOptions;
10
+ constructor(options?: DebugOptions);
11
+ install(rc: RingCentral): Promise<void>;
12
+ revoke(): Promise<void>;
13
+ }
14
+ //#endregion
15
+ export { DebugOptions, DebugExtension as default };
@@ -0,0 +1,15 @@
1
+ import SdkExtension from "@rc-ex/core/SdkExtension";
2
+ import RingCentral from "@rc-ex/core";
3
+
4
+ //#region src/index.d.ts
5
+ interface DebugOptions {
6
+ loggingAction?: (message: string) => void;
7
+ }
8
+ declare class DebugExtension extends SdkExtension {
9
+ options: DebugOptions;
10
+ constructor(options?: DebugOptions);
11
+ install(rc: RingCentral): Promise<void>;
12
+ revoke(): Promise<void>;
13
+ }
14
+ //#endregion
15
+ export { DebugOptions, DebugExtension as default };
package/dist/index.mjs ADDED
@@ -0,0 +1,23 @@
1
+ import SdkExtension from "@rc-ex/core/SdkExtension";
2
+ import Utils from "@rc-ex/core/Utils";
3
+ //#region src/index.ts
4
+ var DebugExtension = class extends SdkExtension {
5
+ options;
6
+ constructor(options = {}) {
7
+ super();
8
+ this.options = options;
9
+ this.options.loggingAction ??= (message) => console.debug(message);
10
+ }
11
+ async install(rc) {
12
+ const request = rc.request.bind(rc);
13
+ rc.request = async (method, endpoint, content, queryParams, config) => {
14
+ if (!this.enabled) return request(method, endpoint, content, queryParams, config);
15
+ const r = await request(method, endpoint, content, queryParams, config);
16
+ this.options.loggingAction(Utils.formatTraffic(r));
17
+ return r;
18
+ };
19
+ }
20
+ async revoke() {}
21
+ };
22
+ //#endregion
23
+ export { DebugExtension as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-ex/debug",
3
- "version": "1.3.12",
3
+ "version": "1.4.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",
@@ -8,14 +8,20 @@
8
8
  "files": [
9
9
  "dist"
10
10
  ],
11
- "types": "./dist/esm/index.d.ts",
12
- "main": "./dist/cjs/index.js",
13
- "module": "./dist/esm/index.js",
11
+ "sideEffects": false,
12
+ "types": "./dist/index.d.mts",
13
+ "main": "./dist/index.cjs",
14
+ "module": "./dist/index.mjs",
14
15
  "exports": {
15
16
  ".": {
16
- "types": "./dist/esm/index.d.ts",
17
- "import": "./dist/esm/index.js",
18
- "require": "./dist/cjs/index.js"
17
+ "import": {
18
+ "types": "./dist/index.d.mts",
19
+ "default": "./dist/index.mjs"
20
+ },
21
+ "require": {
22
+ "types": "./dist/index.d.cts",
23
+ "default": "./dist/index.cjs"
24
+ }
19
25
  }
20
26
  },
21
27
  "repository": {
@@ -28,8 +34,14 @@
28
34
  "publishConfig": {
29
35
  "access": "public"
30
36
  },
31
- "scripts": {
32
- "build": "tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json"
37
+ "peerDependencies": {
38
+ "@rc-ex/core": "^1.8.1"
39
+ },
40
+ "devDependencies": {
41
+ "@rc-ex/core": "^1.8.1"
33
42
  },
34
- "gitHead": "1ded64e887920a6e6a27bc3a2173ecf3cd1d50f9"
35
- }
43
+ "type": "module",
44
+ "scripts": {
45
+ "build": "tsdown"
46
+ }
47
+ }
@@ -1,12 +0,0 @@
1
- import type RingCentral from "@rc-ex/core";
2
- import SdkExtension from "@rc-ex/core/SdkExtension";
3
- export interface DebugOptions {
4
- loggingAction?: (message: string) => void;
5
- }
6
- declare class DebugExtension extends SdkExtension {
7
- options: DebugOptions;
8
- constructor(options?: DebugOptions);
9
- install(rc: RingCentral): Promise<void>;
10
- revoke(): Promise<void>;
11
- }
12
- export default DebugExtension;
package/dist/cjs/index.js DELETED
@@ -1,28 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const Utils_1 = __importDefault(require("@rc-ex/core/Utils"));
7
- const SdkExtension_1 = __importDefault(require("@rc-ex/core/SdkExtension"));
8
- class DebugExtension extends SdkExtension_1.default {
9
- options;
10
- constructor(options = {}) {
11
- super();
12
- this.options = options;
13
- this.options.loggingAction ??= (message) => console.debug(message);
14
- }
15
- async install(rc) {
16
- const request = rc.request.bind(rc);
17
- rc.request = async (method, endpoint, content, queryParams, config) => {
18
- if (!this.enabled) {
19
- return request(method, endpoint, content, queryParams, config);
20
- }
21
- const r = await request(method, endpoint, content, queryParams, config);
22
- this.options.loggingAction(Utils_1.default.formatTraffic(r));
23
- return r;
24
- };
25
- }
26
- async revoke() { }
27
- }
28
- exports.default = DebugExtension;
@@ -1,12 +0,0 @@
1
- import type RingCentral from "@rc-ex/core";
2
- import SdkExtension from "@rc-ex/core/SdkExtension";
3
- export interface DebugOptions {
4
- loggingAction?: (message: string) => void;
5
- }
6
- declare class DebugExtension extends SdkExtension {
7
- options: DebugOptions;
8
- constructor(options?: DebugOptions);
9
- install(rc: RingCentral): Promise<void>;
10
- revoke(): Promise<void>;
11
- }
12
- export default DebugExtension;
package/dist/esm/index.js DELETED
@@ -1,23 +0,0 @@
1
- import Utils from "@rc-ex/core/Utils";
2
- import SdkExtension from "@rc-ex/core/SdkExtension";
3
- class DebugExtension extends SdkExtension {
4
- options;
5
- constructor(options = {}) {
6
- super();
7
- this.options = options;
8
- this.options.loggingAction ??= (message) => console.debug(message);
9
- }
10
- async install(rc) {
11
- const request = rc.request.bind(rc);
12
- rc.request = async (method, endpoint, content, queryParams, config) => {
13
- if (!this.enabled) {
14
- return request(method, endpoint, content, queryParams, config);
15
- }
16
- const r = await request(method, endpoint, content, queryParams, config);
17
- this.options.loggingAction(Utils.formatTraffic(r));
18
- return r;
19
- };
20
- }
21
- async revoke() { }
22
- }
23
- export default DebugExtension;