reqwise-react 1.0.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.
@@ -0,0 +1,22 @@
1
+
2
+ > @reqwise/react@0.0.0 build C:\Users\PC\Desktop\Code\reqwise\packages\react
3
+ > tsup
4
+
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.5.1
8
+ CLI Using tsup config: C:\Users\PC\Desktop\Code\reqwise\packages\react\tsup.config.ts
9
+ CLI Target: es2020
10
+ CLI Cleaning output folder
11
+ CJS Build start
12
+ ESM Build start
13
+ ESM dist\index.mjs 2.86 KB
14
+ ESM dist\index.mjs.map 4.93 KB
15
+ ESM ⚡️ Build success in 16ms
16
+ CJS dist\index.js 4.70 KB
17
+ CJS dist\index.js.map 5.09 KB
18
+ CJS ⚡️ Build success in 16ms
19
+ DTS Build start
20
+ DTS ⚡️ Build success in 622ms
21
+ DTS dist\index.d.ts 2.18 KB
22
+ DTS dist\index.d.mts 2.18 KB
@@ -0,0 +1,47 @@
1
+ import * as _reqwise_core from '@reqwise/core';
2
+ import React from 'react';
3
+
4
+ type Props = {
5
+ defaultOpen?: boolean;
6
+ theme?: 'light' | 'dark';
7
+ axiosInstance?: any;
8
+ defaultLang?: string;
9
+ placement?: 'left' | 'right' | 'top' | 'bottom';
10
+ };
11
+ declare function ReqwiseDevTools({ defaultOpen, theme, axiosInstance, defaultLang, placement }: Props): React.ReactElement | null;
12
+
13
+ declare function init(cfg?: any): void;
14
+ declare function wrapAxios(instance: any): void;
15
+ declare function setAxiosInstance(instance: any): void;
16
+ declare function get(url: string, cfg?: any): Promise<any>;
17
+ declare function post(url: string, body?: any, cfg?: any): Promise<any>;
18
+ declare function put(url: string, body?: any, cfg?: any): Promise<any>;
19
+ declare function del(url: string, cfg?: any): Promise<any>;
20
+ declare const fetch: (input: RequestInfo, init?: RequestInit & _reqwise_core.RequestConfig) => Promise<Response>;
21
+ declare const record: (entry: Partial<_reqwise_core.ReqwiseEntry>) => void;
22
+
23
+ declare const _default: {
24
+ init(cfg?: any): void;
25
+ wrapAxios(instance: any): void;
26
+ setAxiosInstance(instance: any): void;
27
+ get(url: string, cfg?: any): Promise<any>;
28
+ post(url: string, body?: any, cfg?: any): Promise<any>;
29
+ put(url: string, body?: any, cfg?: any): Promise<any>;
30
+ del(url: string, cfg?: any): Promise<any>;
31
+ fetch: (input: RequestInfo, init?: RequestInit & _reqwise_core.RequestConfig) => Promise<Response>;
32
+ record: (entry: Partial<_reqwise_core.ReqwiseEntry>) => void;
33
+ default: {
34
+ init: typeof init;
35
+ wrapAxios: typeof wrapAxios;
36
+ setAxiosInstance: typeof setAxiosInstance;
37
+ get: typeof get;
38
+ post: typeof post;
39
+ put: typeof put;
40
+ del: typeof del;
41
+ fetch: (input: RequestInfo, init?: RequestInit & _reqwise_core.RequestConfig) => Promise<Response>;
42
+ record: (entry: Partial<_reqwise_core.ReqwiseEntry>) => void;
43
+ };
44
+ ReqwiseDevTools: typeof ReqwiseDevTools;
45
+ };
46
+
47
+ export { ReqwiseDevTools, _default as default, del, fetch, get, init, post, put, record, setAxiosInstance, wrapAxios };
@@ -0,0 +1,47 @@
1
+ import * as _reqwise_core from '@reqwise/core';
2
+ import React from 'react';
3
+
4
+ type Props = {
5
+ defaultOpen?: boolean;
6
+ theme?: 'light' | 'dark';
7
+ axiosInstance?: any;
8
+ defaultLang?: string;
9
+ placement?: 'left' | 'right' | 'top' | 'bottom';
10
+ };
11
+ declare function ReqwiseDevTools({ defaultOpen, theme, axiosInstance, defaultLang, placement }: Props): React.ReactElement | null;
12
+
13
+ declare function init(cfg?: any): void;
14
+ declare function wrapAxios(instance: any): void;
15
+ declare function setAxiosInstance(instance: any): void;
16
+ declare function get(url: string, cfg?: any): Promise<any>;
17
+ declare function post(url: string, body?: any, cfg?: any): Promise<any>;
18
+ declare function put(url: string, body?: any, cfg?: any): Promise<any>;
19
+ declare function del(url: string, cfg?: any): Promise<any>;
20
+ declare const fetch: (input: RequestInfo, init?: RequestInit & _reqwise_core.RequestConfig) => Promise<Response>;
21
+ declare const record: (entry: Partial<_reqwise_core.ReqwiseEntry>) => void;
22
+
23
+ declare const _default: {
24
+ init(cfg?: any): void;
25
+ wrapAxios(instance: any): void;
26
+ setAxiosInstance(instance: any): void;
27
+ get(url: string, cfg?: any): Promise<any>;
28
+ post(url: string, body?: any, cfg?: any): Promise<any>;
29
+ put(url: string, body?: any, cfg?: any): Promise<any>;
30
+ del(url: string, cfg?: any): Promise<any>;
31
+ fetch: (input: RequestInfo, init?: RequestInit & _reqwise_core.RequestConfig) => Promise<Response>;
32
+ record: (entry: Partial<_reqwise_core.ReqwiseEntry>) => void;
33
+ default: {
34
+ init: typeof init;
35
+ wrapAxios: typeof wrapAxios;
36
+ setAxiosInstance: typeof setAxiosInstance;
37
+ get: typeof get;
38
+ post: typeof post;
39
+ put: typeof put;
40
+ del: typeof del;
41
+ fetch: (input: RequestInfo, init?: RequestInit & _reqwise_core.RequestConfig) => Promise<Response>;
42
+ record: (entry: Partial<_reqwise_core.ReqwiseEntry>) => void;
43
+ };
44
+ ReqwiseDevTools: typeof ReqwiseDevTools;
45
+ };
46
+
47
+ export { ReqwiseDevTools, _default as default, del, fetch, get, init, post, put, record, setAxiosInstance, wrapAxios };
package/dist/index.js ADDED
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ ReqwiseDevTools: () => ReqwiseDevTools,
34
+ default: () => index_default,
35
+ del: () => del,
36
+ fetch: () => fetch,
37
+ get: () => get,
38
+ init: () => init,
39
+ post: () => post,
40
+ put: () => put,
41
+ record: () => record,
42
+ setAxiosInstance: () => setAxiosInstance,
43
+ wrapAxios: () => wrapAxios
44
+ });
45
+ module.exports = __toCommonJS(index_exports);
46
+
47
+ // src/ReqwiseDevTools.tsx
48
+ var import_react = require("react");
49
+ var import_core2 = require("@reqwise/core");
50
+
51
+ // src/ReqwiseClient.ts
52
+ var ReqwiseClient_exports = {};
53
+ __export(ReqwiseClient_exports, {
54
+ default: () => ReqwiseClient_default,
55
+ del: () => del,
56
+ fetch: () => fetch,
57
+ get: () => get,
58
+ init: () => init,
59
+ post: () => post,
60
+ put: () => put,
61
+ record: () => record,
62
+ setAxiosInstance: () => setAxiosInstance,
63
+ wrapAxios: () => wrapAxios
64
+ });
65
+ var import_core = __toESM(require("@reqwise/core"));
66
+ var _axiosInstance = null;
67
+ function init(cfg) {
68
+ return import_core.default.ReqwiseClient.init(cfg);
69
+ }
70
+ function wrapAxios(instance) {
71
+ _axiosInstance = instance;
72
+ return import_core.default.ReqwiseClient.wrapAxios(instance);
73
+ }
74
+ function setAxiosInstance(instance) {
75
+ _axiosInstance = instance;
76
+ return import_core.default.ReqwiseClient.wrapAxios(instance);
77
+ }
78
+ async function get(url, cfg) {
79
+ if (_axiosInstance && typeof _axiosInstance.get === "function") return _axiosInstance.get(url, cfg);
80
+ return import_core.default.ReqwiseClient.fetch(url, { method: "GET", ...cfg || {} });
81
+ }
82
+ async function post(url, body, cfg) {
83
+ if (_axiosInstance && typeof _axiosInstance.post === "function") return _axiosInstance.post(url, body, cfg);
84
+ return import_core.default.ReqwiseClient.fetch(url, { method: "POST", body: JSON.stringify(body), ...cfg || {} });
85
+ }
86
+ async function put(url, body, cfg) {
87
+ if (_axiosInstance && typeof _axiosInstance.put === "function") return _axiosInstance.put(url, body, cfg);
88
+ return import_core.default.ReqwiseClient.fetch(url, { method: "PUT", body: JSON.stringify(body), ...cfg || {} });
89
+ }
90
+ async function del(url, cfg) {
91
+ if (_axiosInstance && typeof _axiosInstance.delete === "function") return _axiosInstance.delete(url, cfg);
92
+ return import_core.default.ReqwiseClient.fetch(url, { method: "DELETE", ...cfg || {} });
93
+ }
94
+ var fetch = import_core.default.ReqwiseClient.fetch;
95
+ var record = import_core.default.ReqwiseClient.record;
96
+ var ReqwiseClient_default = {
97
+ init,
98
+ wrapAxios,
99
+ setAxiosInstance,
100
+ get,
101
+ post,
102
+ put,
103
+ del,
104
+ fetch,
105
+ record
106
+ };
107
+
108
+ // src/ReqwiseDevTools.tsx
109
+ function ReqwiseDevTools({ defaultOpen = false, theme = "dark", axiosInstance, defaultLang = "en", placement = "right" }) {
110
+ (0, import_react.useEffect)(() => {
111
+ init({ defaultOpen, defaultLang });
112
+ if (axiosInstance) setAxiosInstance(axiosInstance);
113
+ import_core2.panel.setRenderer(import_core2.renderer);
114
+ import_core2.panel.mount({ defaultOpen, theme, placement });
115
+ return () => {
116
+ import_core2.panel.unmount();
117
+ };
118
+ }, []);
119
+ return null;
120
+ }
121
+
122
+ // src/index.ts
123
+ var _default = {
124
+ ReqwiseDevTools,
125
+ ...ReqwiseClient_exports
126
+ };
127
+ var index_default = _default;
128
+ // Annotate the CommonJS export names for ESM import in node:
129
+ 0 && (module.exports = {
130
+ ReqwiseDevTools,
131
+ del,
132
+ fetch,
133
+ get,
134
+ init,
135
+ post,
136
+ put,
137
+ record,
138
+ setAxiosInstance,
139
+ wrapAxios
140
+ });
141
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/ReqwiseDevTools.tsx","../src/ReqwiseClient.ts"],"sourcesContent":["import ReqwiseDevTools from './ReqwiseDevTools'\r\nimport * as ReqwiseClient from './ReqwiseClient'\r\n\r\nexport { ReqwiseDevTools }\r\nexport * from './ReqwiseClient'\r\n\r\nconst _default = {\r\n\tReqwiseDevTools,\r\n\t...ReqwiseClient,\r\n}\r\n\r\nexport default _default\r\n","import React, { useEffect } from 'react'\r\nimport { storage, panel, renderer } from '@reqwise/core'\r\nimport * as ReqwiseClient from './ReqwiseClient'\r\n\r\ntype Props = {\r\n defaultOpen?: boolean\r\n theme?: 'light' | 'dark'\r\n axiosInstance?: any\r\n defaultLang?: string\r\n placement?: 'left' | 'right' | 'top' | 'bottom'\r\n}\r\n\r\nexport default function ReqwiseDevTools({ defaultOpen = false, theme = 'dark', axiosInstance, defaultLang = 'en', placement = 'right' }: Props): React.ReactElement | null {\r\n useEffect(() => {\r\n // initialize core client with default config and default language\r\n ReqwiseClient.init({ defaultOpen, defaultLang })\r\n if (axiosInstance) ReqwiseClient.setAxiosInstance(axiosInstance)\r\n // set renderer BEFORE mounting so it's ready when defaultOpen triggers render\r\n panel.setRenderer(renderer)\r\n // now mount the core panel into document.body\r\n panel.mount({ defaultOpen, theme: theme as any, placement })\r\n return () => {\r\n panel.unmount()\r\n }\r\n }, [])\r\n\r\n // panel renders its own toggle button and aside — nothing to render here\r\n return null\r\n}\r\n","import Core from '@reqwise/core'\r\n\r\nlet _axiosInstance: any = null\r\n\r\nexport function init(cfg?: any) {\r\n return Core.ReqwiseClient.init(cfg)\r\n}\r\n\r\nexport function wrapAxios(instance: any) {\r\n _axiosInstance = instance\r\n return Core.ReqwiseClient.wrapAxios(instance)\r\n}\r\n\r\nexport function setAxiosInstance(instance: any) {\r\n _axiosInstance = instance\r\n return Core.ReqwiseClient.wrapAxios(instance)\r\n}\r\n\r\nexport async function get(url: string, cfg?: any) {\r\n if (_axiosInstance && typeof _axiosInstance.get === 'function') return _axiosInstance.get(url, cfg)\r\n return Core.ReqwiseClient.fetch(url, { method: 'GET', ...(cfg || {}) } as any)\r\n}\r\n\r\nexport async function post(url: string, body?: any, cfg?: any) {\r\n if (_axiosInstance && typeof _axiosInstance.post === 'function') return _axiosInstance.post(url, body, cfg)\r\n return Core.ReqwiseClient.fetch(url, { method: 'POST', body: JSON.stringify(body), ...(cfg || {}) } as any)\r\n}\r\n\r\nexport async function put(url: string, body?: any, cfg?: any) {\r\n if (_axiosInstance && typeof _axiosInstance.put === 'function') return _axiosInstance.put(url, body, cfg)\r\n return Core.ReqwiseClient.fetch(url, { method: 'PUT', body: JSON.stringify(body), ...(cfg || {}) } as any)\r\n}\r\n\r\nexport async function del(url: string, cfg?: any) {\r\n if (_axiosInstance && typeof _axiosInstance.delete === 'function') return _axiosInstance.delete(url, cfg)\r\n return Core.ReqwiseClient.fetch(url, { method: 'DELETE', ...(cfg || {}) } as any)\r\n}\r\n\r\nexport const fetch = Core.ReqwiseClient.fetch\r\nexport const record = Core.ReqwiseClient.record\r\n\r\nexport default {\r\n init,\r\n wrapAxios,\r\n setAxiosInstance,\r\n get,\r\n post,\r\n put,\r\n del,\r\n fetch,\r\n record,\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAiC;AACjC,IAAAA,eAAyC;;;ACDzC;AAAA;AAA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,UAAU,GAAI,OAAO,CAAC,EAAG,CAAQ;AAClF;AAEO,IAAM,QAAQ,YAAAA,QAAK,cAAc;AACjC,IAAM,SAAS,YAAAA,QAAK,cAAc;AAEzC,IAAO,wBAAQ;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;ADvCe,SAAR,gBAAiC,EAAE,cAAc,OAAO,QAAQ,QAAQ,eAAe,cAAc,MAAM,YAAY,QAAQ,GAAqC;AACzK,8BAAU,MAAM;AAEd,IAAc,KAAK,EAAE,aAAa,YAAY,CAAC;AAC/C,QAAI,cAAe,CAAc,iBAAiB,aAAa;AAE/D,uBAAM,YAAY,qBAAQ;AAE1B,uBAAM,MAAM,EAAE,aAAa,OAAqB,UAAU,CAAC;AAC3D,WAAO,MAAM;AACX,yBAAM,QAAQ;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,CAAC;AAGL,SAAO;AACT;;;ADtBA,IAAM,WAAW;AAAA,EAChB;AAAA,EACA,GAAG;AACJ;AAEA,IAAO,gBAAQ;","names":["import_core","Core"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,101 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/ReqwiseDevTools.tsx
8
+ import { useEffect } from "react";
9
+ import { panel, renderer } from "@reqwise/core";
10
+
11
+ // src/ReqwiseClient.ts
12
+ var ReqwiseClient_exports = {};
13
+ __export(ReqwiseClient_exports, {
14
+ default: () => ReqwiseClient_default,
15
+ del: () => del,
16
+ fetch: () => fetch,
17
+ get: () => get,
18
+ init: () => init,
19
+ post: () => post,
20
+ put: () => put,
21
+ record: () => record,
22
+ setAxiosInstance: () => setAxiosInstance,
23
+ wrapAxios: () => wrapAxios
24
+ });
25
+ import Core from "@reqwise/core";
26
+ var _axiosInstance = null;
27
+ function init(cfg) {
28
+ return Core.ReqwiseClient.init(cfg);
29
+ }
30
+ function wrapAxios(instance) {
31
+ _axiosInstance = instance;
32
+ return Core.ReqwiseClient.wrapAxios(instance);
33
+ }
34
+ function setAxiosInstance(instance) {
35
+ _axiosInstance = instance;
36
+ return Core.ReqwiseClient.wrapAxios(instance);
37
+ }
38
+ async function get(url, cfg) {
39
+ if (_axiosInstance && typeof _axiosInstance.get === "function") return _axiosInstance.get(url, cfg);
40
+ return Core.ReqwiseClient.fetch(url, { method: "GET", ...cfg || {} });
41
+ }
42
+ async function post(url, body, cfg) {
43
+ if (_axiosInstance && typeof _axiosInstance.post === "function") return _axiosInstance.post(url, body, cfg);
44
+ return Core.ReqwiseClient.fetch(url, { method: "POST", body: JSON.stringify(body), ...cfg || {} });
45
+ }
46
+ async function put(url, body, cfg) {
47
+ if (_axiosInstance && typeof _axiosInstance.put === "function") return _axiosInstance.put(url, body, cfg);
48
+ return Core.ReqwiseClient.fetch(url, { method: "PUT", body: JSON.stringify(body), ...cfg || {} });
49
+ }
50
+ async function del(url, cfg) {
51
+ if (_axiosInstance && typeof _axiosInstance.delete === "function") return _axiosInstance.delete(url, cfg);
52
+ return Core.ReqwiseClient.fetch(url, { method: "DELETE", ...cfg || {} });
53
+ }
54
+ var fetch = Core.ReqwiseClient.fetch;
55
+ var record = Core.ReqwiseClient.record;
56
+ var ReqwiseClient_default = {
57
+ init,
58
+ wrapAxios,
59
+ setAxiosInstance,
60
+ get,
61
+ post,
62
+ put,
63
+ del,
64
+ fetch,
65
+ record
66
+ };
67
+
68
+ // src/ReqwiseDevTools.tsx
69
+ function ReqwiseDevTools({ defaultOpen = false, theme = "dark", axiosInstance, defaultLang = "en", placement = "right" }) {
70
+ useEffect(() => {
71
+ init({ defaultOpen, defaultLang });
72
+ if (axiosInstance) setAxiosInstance(axiosInstance);
73
+ panel.setRenderer(renderer);
74
+ panel.mount({ defaultOpen, theme, placement });
75
+ return () => {
76
+ panel.unmount();
77
+ };
78
+ }, []);
79
+ return null;
80
+ }
81
+
82
+ // src/index.ts
83
+ var _default = {
84
+ ReqwiseDevTools,
85
+ ...ReqwiseClient_exports
86
+ };
87
+ var index_default = _default;
88
+ export {
89
+ ReqwiseDevTools,
90
+ index_default as default,
91
+ del,
92
+ fetch,
93
+ get,
94
+ init,
95
+ post,
96
+ put,
97
+ record,
98
+ setAxiosInstance,
99
+ wrapAxios
100
+ };
101
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ReqwiseDevTools.tsx","../src/ReqwiseClient.ts","../src/index.ts"],"sourcesContent":["import React, { useEffect } from 'react'\r\nimport { storage, panel, renderer } from '@reqwise/core'\r\nimport * as ReqwiseClient from './ReqwiseClient'\r\n\r\ntype Props = {\r\n defaultOpen?: boolean\r\n theme?: 'light' | 'dark'\r\n axiosInstance?: any\r\n defaultLang?: string\r\n placement?: 'left' | 'right' | 'top' | 'bottom'\r\n}\r\n\r\nexport default function ReqwiseDevTools({ defaultOpen = false, theme = 'dark', axiosInstance, defaultLang = 'en', placement = 'right' }: Props): React.ReactElement | null {\r\n useEffect(() => {\r\n // initialize core client with default config and default language\r\n ReqwiseClient.init({ defaultOpen, defaultLang })\r\n if (axiosInstance) ReqwiseClient.setAxiosInstance(axiosInstance)\r\n // set renderer BEFORE mounting so it's ready when defaultOpen triggers render\r\n panel.setRenderer(renderer)\r\n // now mount the core panel into document.body\r\n panel.mount({ defaultOpen, theme: theme as any, placement })\r\n return () => {\r\n panel.unmount()\r\n }\r\n }, [])\r\n\r\n // panel renders its own toggle button and aside — nothing to render here\r\n return null\r\n}\r\n","import Core from '@reqwise/core'\r\n\r\nlet _axiosInstance: any = null\r\n\r\nexport function init(cfg?: any) {\r\n return Core.ReqwiseClient.init(cfg)\r\n}\r\n\r\nexport function wrapAxios(instance: any) {\r\n _axiosInstance = instance\r\n return Core.ReqwiseClient.wrapAxios(instance)\r\n}\r\n\r\nexport function setAxiosInstance(instance: any) {\r\n _axiosInstance = instance\r\n return Core.ReqwiseClient.wrapAxios(instance)\r\n}\r\n\r\nexport async function get(url: string, cfg?: any) {\r\n if (_axiosInstance && typeof _axiosInstance.get === 'function') return _axiosInstance.get(url, cfg)\r\n return Core.ReqwiseClient.fetch(url, { method: 'GET', ...(cfg || {}) } as any)\r\n}\r\n\r\nexport async function post(url: string, body?: any, cfg?: any) {\r\n if (_axiosInstance && typeof _axiosInstance.post === 'function') return _axiosInstance.post(url, body, cfg)\r\n return Core.ReqwiseClient.fetch(url, { method: 'POST', body: JSON.stringify(body), ...(cfg || {}) } as any)\r\n}\r\n\r\nexport async function put(url: string, body?: any, cfg?: any) {\r\n if (_axiosInstance && typeof _axiosInstance.put === 'function') return _axiosInstance.put(url, body, cfg)\r\n return Core.ReqwiseClient.fetch(url, { method: 'PUT', body: JSON.stringify(body), ...(cfg || {}) } as any)\r\n}\r\n\r\nexport async function del(url: string, cfg?: any) {\r\n if (_axiosInstance && typeof _axiosInstance.delete === 'function') return _axiosInstance.delete(url, cfg)\r\n return Core.ReqwiseClient.fetch(url, { method: 'DELETE', ...(cfg || {}) } as any)\r\n}\r\n\r\nexport const fetch = Core.ReqwiseClient.fetch\r\nexport const record = Core.ReqwiseClient.record\r\n\r\nexport default {\r\n init,\r\n wrapAxios,\r\n setAxiosInstance,\r\n get,\r\n post,\r\n put,\r\n del,\r\n fetch,\r\n record,\r\n}\r\n","import ReqwiseDevTools from './ReqwiseDevTools'\r\nimport * as ReqwiseClient from './ReqwiseClient'\r\n\r\nexport { ReqwiseDevTools }\r\nexport * from './ReqwiseClient'\r\n\r\nconst _default = {\r\n\tReqwiseDevTools,\r\n\t...ReqwiseClient,\r\n}\r\n\r\nexport default _default\r\n"],"mappings":";;;;;;;AAAA,SAAgB,iBAAiB;AACjC,SAAkB,OAAO,gBAAgB;;;ACDzC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAO,UAAU;AAEjB,IA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;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;ADvCe,SAAR,gBAAiC,EAAE,cAAc,OAAO,QAAQ,QAAQ,eAAe,cAAc,MAAM,YAAY,QAAQ,GAAqC;AACzK,YAAU,MAAM;AAEd,IAAc,KAAK,EAAE,aAAa,YAAY,CAAC;AAC/C,QAAI,cAAe,CAAc,iBAAiB,aAAa;AAE/D,UAAM,YAAY,QAAQ;AAE1B,UAAM,MAAM,EAAE,aAAa,OAAqB,UAAU,CAAC;AAC3D,WAAO,MAAM;AACX,YAAM,QAAQ;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,CAAC;AAGL,SAAO;AACT;;;AEtBA,IAAM,WAAW;AAAA,EAChB;AAAA,EACA,GAAG;AACJ;AAEA,IAAO,gBAAQ;","names":[]}
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "reqwise-react",
3
+ "version": "1.0.0",
4
+ "main": "dist/index.js",
5
+ "module": "dist/index.mjs",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./dist/index.mjs",
9
+ "require": "./dist/index.js"
10
+ }
11
+ },
12
+ "types": "dist/index.d.ts",
13
+ "peerDependencies": {
14
+ "axios": ">=1.0.0",
15
+ "react": ">=17.0.0"
16
+ },
17
+ "peerDependenciesMeta": {
18
+ "axios": {
19
+ "optional": true
20
+ }
21
+ },
22
+ "dependencies": {
23
+ "@reqwise/core": "npm:reqwise-core@^1.0.0"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "^25.8.0"
27
+ },
28
+ "scripts": {
29
+ "build": "tsup",
30
+ "type-check": "tsc -p tsconfig.json --noEmit"
31
+ }
32
+ }
@@ -0,0 +1,52 @@
1
+ import Core from '@reqwise/core'
2
+
3
+ let _axiosInstance: any = null
4
+
5
+ export function init(cfg?: any) {
6
+ return Core.ReqwiseClient.init(cfg)
7
+ }
8
+
9
+ export function wrapAxios(instance: any) {
10
+ _axiosInstance = instance
11
+ return Core.ReqwiseClient.wrapAxios(instance)
12
+ }
13
+
14
+ export function setAxiosInstance(instance: any) {
15
+ _axiosInstance = instance
16
+ return Core.ReqwiseClient.wrapAxios(instance)
17
+ }
18
+
19
+ export async function get(url: string, cfg?: any) {
20
+ if (_axiosInstance && typeof _axiosInstance.get === 'function') return _axiosInstance.get(url, cfg)
21
+ return Core.ReqwiseClient.fetch(url, { method: 'GET', ...(cfg || {}) } as any)
22
+ }
23
+
24
+ export async function post(url: string, body?: any, cfg?: any) {
25
+ if (_axiosInstance && typeof _axiosInstance.post === 'function') return _axiosInstance.post(url, body, cfg)
26
+ return Core.ReqwiseClient.fetch(url, { method: 'POST', body: JSON.stringify(body), ...(cfg || {}) } as any)
27
+ }
28
+
29
+ export async function put(url: string, body?: any, cfg?: any) {
30
+ if (_axiosInstance && typeof _axiosInstance.put === 'function') return _axiosInstance.put(url, body, cfg)
31
+ return Core.ReqwiseClient.fetch(url, { method: 'PUT', body: JSON.stringify(body), ...(cfg || {}) } as any)
32
+ }
33
+
34
+ export async function del(url: string, cfg?: any) {
35
+ if (_axiosInstance && typeof _axiosInstance.delete === 'function') return _axiosInstance.delete(url, cfg)
36
+ return Core.ReqwiseClient.fetch(url, { method: 'DELETE', ...(cfg || {}) } as any)
37
+ }
38
+
39
+ export const fetch = Core.ReqwiseClient.fetch
40
+ export const record = Core.ReqwiseClient.record
41
+
42
+ export default {
43
+ init,
44
+ wrapAxios,
45
+ setAxiosInstance,
46
+ get,
47
+ post,
48
+ put,
49
+ del,
50
+ fetch,
51
+ record,
52
+ }
@@ -0,0 +1,29 @@
1
+ import React, { useEffect } from 'react'
2
+ import { storage, panel, renderer } from '@reqwise/core'
3
+ import * as ReqwiseClient from './ReqwiseClient'
4
+
5
+ type Props = {
6
+ defaultOpen?: boolean
7
+ theme?: 'light' | 'dark'
8
+ axiosInstance?: any
9
+ defaultLang?: string
10
+ placement?: 'left' | 'right' | 'top' | 'bottom'
11
+ }
12
+
13
+ export default function ReqwiseDevTools({ defaultOpen = false, theme = 'dark', axiosInstance, defaultLang = 'en', placement = 'right' }: Props): React.ReactElement | null {
14
+ useEffect(() => {
15
+ // initialize core client with default config and default language
16
+ ReqwiseClient.init({ defaultOpen, defaultLang })
17
+ if (axiosInstance) ReqwiseClient.setAxiosInstance(axiosInstance)
18
+ // set renderer BEFORE mounting so it's ready when defaultOpen triggers render
19
+ panel.setRenderer(renderer)
20
+ // now mount the core panel into document.body
21
+ panel.mount({ defaultOpen, theme: theme as any, placement })
22
+ return () => {
23
+ panel.unmount()
24
+ }
25
+ }, [])
26
+
27
+ // panel renders its own toggle button and aside — nothing to render here
28
+ return null
29
+ }
package/src/index.ts ADDED
@@ -0,0 +1,12 @@
1
+ import ReqwiseDevTools from './ReqwiseDevTools'
2
+ import * as ReqwiseClient from './ReqwiseClient'
3
+
4
+ export { ReqwiseDevTools }
5
+ export * from './ReqwiseClient'
6
+
7
+ const _default = {
8
+ ReqwiseDevTools,
9
+ ...ReqwiseClient,
10
+ }
11
+
12
+ export default _default
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "NodeNext",
5
+ "jsx": "react-jsx",
6
+ "declaration": true,
7
+ "outDir": "dist",
8
+ "rootDir": "src",
9
+ "strict": true,
10
+ "esModuleInterop": true,
11
+ "skipLibCheck": true,
12
+ "moduleResolution": "NodeNext",
13
+ "ignoreDeprecations": "6.0"
14
+ },
15
+ "include": ["src/**/*"]
16
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from 'tsup'
2
+
3
+ export default defineConfig({
4
+ entry: ['src/index.ts'],
5
+ format: ['cjs', 'esm'],
6
+ dts: true,
7
+ sourcemap: true,
8
+ clean: true,
9
+ })