@openremote/rest 1.0.3 → 1.2.0-snapshot.20240512154942
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/{dist → lib}/index.d.ts +6 -2
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -0
- package/{dist → lib}/restclient.d.ts +564 -370
- package/lib/restclient.js +1 -0
- package/lib/restclient.js.map +1 -0
- package/package.json +20 -16
- package/LICENSE.txt +0 -2359
- package/dist/.tsbuildinfo +0 -9118
- package/dist/index.js +0 -30
- package/dist/index.js.map +0 -1
- package/dist/restclient.js +0 -901
- package/dist/restclient.js.map +0 -1
- package/dist/umd/index.bundle.js +0 -8
- package/dist/umd/index.js +0 -1
package/{dist → lib}/index.d.ts
RENAMED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
2
|
-
import { ApiClient } from "./restclient";
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig, GenericAxiosResponse, AxiosError } from "axios";
|
|
2
|
+
import { ApiClient, RestResponse } from "./restclient";
|
|
3
|
+
declare const isAxiosError: (payload: any) => payload is AxiosError<any, any>;
|
|
4
|
+
export { RestResponse, GenericAxiosResponse, AxiosError, isAxiosError };
|
|
3
5
|
export declare class RestApi {
|
|
4
6
|
get api(): ApiClient;
|
|
5
7
|
protected _client: ApiClient;
|
|
6
8
|
protected _axiosInstance: AxiosInstance;
|
|
9
|
+
protected _baseUrl: string;
|
|
7
10
|
constructor();
|
|
8
11
|
get axiosInstance(): AxiosInstance;
|
|
12
|
+
get baseUrl(): string;
|
|
9
13
|
setTimeout(timeout: number): void;
|
|
10
14
|
addRequestInterceptor(interceptor: (config: AxiosRequestConfig) => AxiosRequestConfig): void;
|
|
11
15
|
initialise(baseUrl: string): void;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import axios from"axios";import{ApiClient}from"./restclient";import Qs from"qs";const isAxiosError=axios.isAxiosError;export{isAxiosError};export class RestApi{get api(){return this._client}constructor(){this._axiosInstance=axios.create(),this._axiosInstance.defaults.headers.common["Content-Type"]="application/json",this._axiosInstance.interceptors.request.use((t=>(t.paramsSerializer=t=>Qs.stringify(t,{arrayFormat:"repeat"}),t)))}get axiosInstance(){return this._axiosInstance}get baseUrl(){return this._baseUrl}setTimeout(t){this._axiosInstance.defaults.timeout=t}addRequestInterceptor(t){this._axiosInstance.interceptors.request.use(t)}initialise(t){this._baseUrl=t,this._client=new ApiClient(t,this._axiosInstance)}}export default new RestApi;
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA4E,MAAM,OAAO,CAAC;AACjG,OAAO,EAAC,SAAS,EAAe,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;AAExC,OAAO,EAAiD,YAAY,EAAC,CAAC;AAEtE,MAAM,OAAO,OAAO;IAEhB,IAAI,GAAG;QACH,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAMD;QACI,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACrC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;QACjF,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACpD,MAAM,CAAC,gBAAgB,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAC,WAAW,EAAE,QAAQ,EAAC,CAAC,CAAC;YACpF,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,IAAI,aAA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