@koine/api 2.0.0-beta.83 → 2.0.0-beta.84
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/createSwrApi.cjs.js
CHANGED
|
@@ -25,8 +25,6 @@ var e__default = /*#__PURE__*/_interopDefaultLegacy(e);
|
|
|
25
25
|
* @see https://swr.vercel.app/docs/conditional-fetching
|
|
26
26
|
*//**
|
|
27
27
|
* @private
|
|
28
|
-
*//**
|
|
29
|
-
* @private
|
|
30
28
|
*/let createUseApi=t=>(i,o,p)=>{// const fetcher = async (_endpoint: TEndpoint) => {
|
|
31
29
|
// try {
|
|
32
30
|
// const { ok, data } = await api.get(_endpoint, {
|
package/createSwrApi.esm.js
CHANGED
|
@@ -19,8 +19,6 @@ import { createApi } from './createApi.esm.js';
|
|
|
19
19
|
* @see https://swr.vercel.app/docs/conditional-fetching
|
|
20
20
|
*//**
|
|
21
21
|
* @private
|
|
22
|
-
*//**
|
|
23
|
-
* @private
|
|
24
22
|
*/let createUseApi=t=>(i,o,p)=>{// const fetcher = async (_endpoint: TEndpoint) => {
|
|
25
23
|
// try {
|
|
26
24
|
// const { ok, data } = await api.get(_endpoint, {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@koine/api",
|
|
3
3
|
"sideEffects": false,
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@koine/utils": "2.0.0-beta.
|
|
5
|
+
"@koine/utils": "2.0.0-beta.84"
|
|
6
6
|
},
|
|
7
7
|
"peerDependencies": {
|
|
8
8
|
"next": "^14.0.4",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
},
|
|
62
62
|
"module": "./index.esm.js",
|
|
63
63
|
"main": "./index.cjs.js",
|
|
64
|
-
"version": "2.0.0-beta.
|
|
64
|
+
"version": "2.0.0-beta.84"
|
|
65
65
|
}
|
package/swr/createSwrApi.d.ts
CHANGED
|
@@ -3,9 +3,8 @@ import type { Api } from "../types";
|
|
|
3
3
|
type SWRConfigurationExtended<Data = any, Error = any, Fn extends BareFetcher<any> = BareFetcher<any>> = SWRConfiguration<Data, Error, Fn> & {
|
|
4
4
|
when?: boolean | (() => boolean);
|
|
5
5
|
};
|
|
6
|
-
export type CreatedUseApi<TEndpoints extends Api.Endpoints> = ReturnType<typeof createUseApi<TEndpoints>>;
|
|
7
6
|
export declare let createUseApi: <TEndpoints extends Api.Endpoints>(api: Api.Client<TEndpoints>) => <TEndpoint extends Extract<keyof TEndpoints, string>>(endpoint: TEndpoint, options?: Api.EndpointOptions<TEndpoints, TEndpoint, "get">, config?: SWRConfigurationExtended<Api.EndpointResponseOk<TEndpoints, TEndpoint, "get">, Api.EndpointResponseFail<TEndpoints, TEndpoint, "get">>) => SWRResponse<Api.GetDataType<TEndpoints, TEndpoint, "get", "ok">, Api.GetDataType<TEndpoints, TEndpoint, "get", "fail">, any>;
|
|
8
7
|
export declare let createSwrApi: <TEndpoints extends Api.Endpoints>(apiName: string, baseUrl: string, options?: Api.ClientOptions | undefined) => Api.Client<TEndpoints> & {
|
|
9
|
-
use:
|
|
8
|
+
use: ReturnType<typeof createUseApi<TEndpoints>>;
|
|
10
9
|
};
|
|
11
10
|
export default createSwrApi;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type SWRMutationConfiguration, type SWRMutationResponse } from "swr/mutation";
|
|
2
|
-
import {
|
|
2
|
+
import { createUseApi } from "../swr/createSwrApi";
|
|
3
3
|
import type { Api } from "../types";
|
|
4
4
|
type MutationRequestMethod = Exclude<Api.RequestMethod, "get">;
|
|
5
5
|
type MutationHookName = Exclude<keyof Api.HooksMapsByName, "use">;
|
|
@@ -10,6 +10,6 @@ export declare let createSwrMutationApi: <TEndpoints extends Api.Endpoints>(apiN
|
|
|
10
10
|
usePatch: KoineApiMethodHookSWR<"usePatch", TEndpoints>;
|
|
11
11
|
useDelete: KoineApiMethodHookSWR<"useDelete", TEndpoints>;
|
|
12
12
|
} & {
|
|
13
|
-
use:
|
|
13
|
+
use: ReturnType<typeof createUseApi<TEndpoints>>;
|
|
14
14
|
};
|
|
15
15
|
export default createSwrMutationApi;
|