@readyfor/api-client-base 1.22.0-pr1284.dc25e7e → 1.22.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.
Files changed (56) hide show
  1. package/dist/apiClientConfigStore.d.ts +10 -11
  2. package/dist/apiClientConfigStore.js +37 -10
  3. package/dist/apiClientConfigStore.mjs +12 -9
  4. package/dist/apiError.d.ts +25 -24
  5. package/dist/apiError.js +95 -68
  6. package/dist/apiError.mjs +18 -70
  7. package/dist/chunk-3SEO7S3Q.mjs +23 -0
  8. package/dist/chunk-5JS6U5IM.mjs +37 -0
  9. package/dist/chunk-DH33ZDBG.mjs +19 -0
  10. package/dist/chunk-FNLUAQWC.mjs +80 -0
  11. package/dist/chunk-GD4RTKUU.mjs +22 -0
  12. package/dist/chunk-JCZWXJBU.mjs +10 -0
  13. package/dist/chunk-NOC6G3HZ.mjs +21 -0
  14. package/dist/chunk-NYICHGY2.mjs +30 -0
  15. package/dist/chunk-OVR3ZT2S.mjs +118 -0
  16. package/dist/chunk-QXFPBYPL.mjs +25 -0
  17. package/dist/chunk-TZUKIYFN.mjs +14 -0
  18. package/dist/chunk-WBQAMGXK.mjs +0 -0
  19. package/dist/fetcher.d.ts +7 -8
  20. package/dist/fetcher.js +125 -57
  21. package/dist/fetcher.mjs +20 -63
  22. package/dist/index.d.ts +10 -10
  23. package/dist/index.js +38 -31
  24. package/dist/index.mjs +63 -10
  25. package/dist/react/ApiClientConfigProvider.d.ts +9 -10
  26. package/dist/react/ApiClientConfigProvider.js +41 -24
  27. package/dist/react/ApiClientConfigProvider.mjs +12 -22
  28. package/dist/react/index.d.ts +7 -4
  29. package/dist/react/index.js +26 -10
  30. package/dist/react/index.mjs +24 -4
  31. package/dist/react/swr.d.ts +9 -10
  32. package/dist/react/swr.js +37 -24
  33. package/dist/react/swr.mjs +5 -25
  34. package/dist/react/useApiClientConfig.d.ts +5 -5
  35. package/dist/react/useApiClientConfig.js +50 -18
  36. package/dist/react/useApiClientConfig.mjs +15 -19
  37. package/dist/requestUrl.d.ts +2 -3
  38. package/dist/requestUrl.js +49 -14
  39. package/dist/requestUrl.mjs +10 -13
  40. package/dist/store.d.ts +5 -6
  41. package/dist/store.js +43 -20
  42. package/dist/store.mjs +5 -20
  43. package/dist/types.d.ts +11 -5
  44. package/dist/types.js +16 -0
  45. package/dist/types.mjs +1 -1
  46. package/dist/utils/headersInit.d.ts +2 -3
  47. package/dist/utils/headersInit.js +49 -45
  48. package/dist/utils/headersInit.mjs +7 -46
  49. package/dist/utils/requestInit.d.ts +3 -10
  50. package/dist/utils/requestInit.js +31 -14
  51. package/dist/utils/requestInit.mjs +7 -15
  52. package/dist/zod.d.ts +3 -4
  53. package/dist/zod.js +30 -6
  54. package/dist/zod.mjs +7 -6
  55. package/package.json +19 -2
  56. package/dist/_virtual/_rolldown/runtime.js +0 -23
package/dist/index.mjs CHANGED
@@ -1,10 +1,63 @@
1
- import { createStore } from "./store.mjs";
2
- import { mergeHeadersInit, toHeadersInit } from "./utils/headersInit.mjs";
3
- import { mergeRequestInit } from "./utils/requestInit.mjs";
4
- import { buildRequestInitWithDefaultConfig, setApiClientConfig, store } from "./apiClientConfigStore.mjs";
5
- import { isZodError, schemaForType } from "./zod.mjs";
6
- import { HTTPError, errorStatusCode, errorTitle, getErrorStatus, getHttpErrorBody, getHttpErrorBodyReason, isHttpErrorWithStatus } from "./apiError.mjs";
7
- import { createBlobFetcher, createFileOrBlobFetcher, createJsonFetcher, createTextFetcher, createVoidFetcher } from "./fetcher.mjs";
8
- import { __internal__requestUrl } from "./requestUrl.mjs";
9
- import "./types.mjs";
10
- export { HTTPError, __internal__requestUrl, buildRequestInitWithDefaultConfig, createBlobFetcher, createFileOrBlobFetcher, createJsonFetcher, createStore, createTextFetcher, createVoidFetcher, errorStatusCode, errorTitle, getErrorStatus, getHttpErrorBody, getHttpErrorBodyReason, isHttpErrorWithStatus, isZodError, mergeHeadersInit, mergeRequestInit, schemaForType, setApiClientConfig, store, toHeadersInit };
1
+ import {
2
+ createBlobFetcher,
3
+ createFileOrBlobFetcher,
4
+ createJsonFetcher,
5
+ createTextFetcher,
6
+ createVoidFetcher
7
+ } from "./chunk-OVR3ZT2S.mjs";
8
+ import {
9
+ HTTPError,
10
+ errorStatusCode,
11
+ errorTitle,
12
+ getErrorStatus,
13
+ getHttpErrorBody,
14
+ getHttpErrorBodyReason,
15
+ isHttpErrorWithStatus
16
+ } from "./chunk-FNLUAQWC.mjs";
17
+ import {
18
+ __internal__requestUrl
19
+ } from "./chunk-GD4RTKUU.mjs";
20
+ import {
21
+ buildRequestInitWithDefaultConfig,
22
+ setApiClientConfig,
23
+ store
24
+ } from "./chunk-NOC6G3HZ.mjs";
25
+ import {
26
+ mergeRequestInit
27
+ } from "./chunk-TZUKIYFN.mjs";
28
+ import {
29
+ mergeHeadersInit,
30
+ toHeadersInit
31
+ } from "./chunk-NYICHGY2.mjs";
32
+ import {
33
+ createStore
34
+ } from "./chunk-3SEO7S3Q.mjs";
35
+ import "./chunk-WBQAMGXK.mjs";
36
+ import {
37
+ isZodError,
38
+ schemaForType
39
+ } from "./chunk-JCZWXJBU.mjs";
40
+ export {
41
+ HTTPError,
42
+ __internal__requestUrl,
43
+ buildRequestInitWithDefaultConfig,
44
+ createBlobFetcher,
45
+ createFileOrBlobFetcher,
46
+ createJsonFetcher,
47
+ createStore,
48
+ createTextFetcher,
49
+ createVoidFetcher,
50
+ errorStatusCode,
51
+ errorTitle,
52
+ getErrorStatus,
53
+ getHttpErrorBody,
54
+ getHttpErrorBodyReason,
55
+ isHttpErrorWithStatus,
56
+ isZodError,
57
+ mergeHeadersInit,
58
+ mergeRequestInit,
59
+ schemaForType,
60
+ setApiClientConfig,
61
+ store,
62
+ toHeadersInit
63
+ };
@@ -1,17 +1,16 @@
1
- import { Store } from "../store.js";
2
- import { Config } from "../apiClientConfigStore.js";
3
- import { FC, ReactNode } from "react";
4
- import { SWRConfiguration } from "swr";
1
+ import { FC, ReactNode } from 'react';
2
+ import { Config } from '../apiClientConfigStore.js';
3
+ import { Store } from '../store.js';
4
+ import { SWRConfiguration } from 'swr';
5
5
 
6
- //#region src/react/ApiClientConfigProvider.d.ts
7
6
  type Configuration = Config & {
8
- swr?: SWRConfiguration;
7
+ swr?: SWRConfiguration;
9
8
  };
10
9
  type Props = {
11
- config: Configuration;
12
- children: ReactNode;
10
+ config: Configuration;
11
+ children: ReactNode;
13
12
  };
14
13
  declare const ApiClientConfigProvider: FC<Props>;
15
14
  declare const useApiClientConfigContext: () => Store<Config>;
16
- //#endregion
17
- export { ApiClientConfigProvider, useApiClientConfigContext };
15
+
16
+ export { ApiClientConfigProvider, useApiClientConfigContext };
@@ -1,26 +1,43 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("../_virtual/_rolldown/runtime.js");
3
- const require_apiClientConfigStore = require("../apiClientConfigStore.js");
4
- const require_react_swr = require("./swr.js");
5
- let react = require("react");
6
- let swr = require("swr");
7
- let react_jsx_runtime = require("react/jsx-runtime");
8
- //#region src/react/ApiClientConfigProvider.tsx
9
- const ApiClientConfigContext = (0, react.createContext)(require_apiClientConfigStore.store);
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var ApiClientConfigProvider_exports = {};
20
+ __export(ApiClientConfigProvider_exports, {
21
+ ApiClientConfigProvider: () => ApiClientConfigProvider,
22
+ useApiClientConfigContext: () => useApiClientConfigContext
23
+ });
24
+ module.exports = __toCommonJS(ApiClientConfigProvider_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_react = require("react");
27
+ var import_apiClientConfigStore = require("../apiClientConfigStore");
28
+ var import_swr = require("swr");
29
+ var import_swr2 = require("./swr");
30
+ const ApiClientConfigContext = (0, import_react.createContext)(import_apiClientConfigStore.store);
10
31
  const ApiClientConfigProvider = (props) => {
11
- const { swr: swr$1, ...config } = props.config;
12
- (0, react.useEffect)(() => {
13
- require_apiClientConfigStore.store.setState(() => config);
14
- }, [config]);
15
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ApiClientConfigContext.Provider, {
16
- value: require_apiClientConfigStore.store,
17
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(swr.SWRConfig, {
18
- value: require_react_swr.createSwrConfig(swr$1),
19
- children: props.children
20
- })
21
- });
32
+ const { swr, ...config } = props.config;
33
+ (0, import_react.useEffect)(() => {
34
+ import_apiClientConfigStore.store.setState(() => config);
35
+ }, [config]);
36
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ApiClientConfigContext.Provider, { value: import_apiClientConfigStore.store, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_swr.SWRConfig, { value: (0, import_swr2.createSwrConfig)(swr), children: props.children }) });
22
37
  };
23
- const useApiClientConfigContext = () => (0, react.useContext)(ApiClientConfigContext) || require_apiClientConfigStore.store;
24
- //#endregion
25
- exports.ApiClientConfigProvider = ApiClientConfigProvider;
26
- exports.useApiClientConfigContext = useApiClientConfigContext;
38
+ const useApiClientConfigContext = () => (0, import_react.useContext)(ApiClientConfigContext) || import_apiClientConfigStore.store;
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ ApiClientConfigProvider,
42
+ useApiClientConfigContext
43
+ });
@@ -1,23 +1,13 @@
1
- import { store } from "../apiClientConfigStore.mjs";
2
- import { createSwrConfig } from "./swr.mjs";
3
- import { createContext, useContext, useEffect } from "react";
4
- import { SWRConfig } from "swr";
5
- import { jsx } from "react/jsx-runtime";
6
- //#region src/react/ApiClientConfigProvider.tsx
7
- const ApiClientConfigContext = createContext(store);
8
- const ApiClientConfigProvider = (props) => {
9
- const { swr, ...config } = props.config;
10
- useEffect(() => {
11
- store.setState(() => config);
12
- }, [config]);
13
- return /* @__PURE__ */ jsx(ApiClientConfigContext.Provider, {
14
- value: store,
15
- children: /* @__PURE__ */ jsx(SWRConfig, {
16
- value: createSwrConfig(swr),
17
- children: props.children
18
- })
19
- });
1
+ import {
2
+ ApiClientConfigProvider,
3
+ useApiClientConfigContext
4
+ } from "../chunk-QXFPBYPL.mjs";
5
+ import "../chunk-DH33ZDBG.mjs";
6
+ import "../chunk-NOC6G3HZ.mjs";
7
+ import "../chunk-TZUKIYFN.mjs";
8
+ import "../chunk-NYICHGY2.mjs";
9
+ import "../chunk-3SEO7S3Q.mjs";
10
+ export {
11
+ ApiClientConfigProvider,
12
+ useApiClientConfigContext
20
13
  };
21
- const useApiClientConfigContext = () => useContext(ApiClientConfigContext) || store;
22
- //#endregion
23
- export { ApiClientConfigProvider, useApiClientConfigContext };
@@ -1,4 +1,7 @@
1
- import { ApiClientConfigProvider, useApiClientConfigContext } from "./ApiClientConfigProvider.js";
2
- import { Configuration, createSwrConfig } from "./swr.js";
3
- import { useApiClientConfig, useApiClientConfigWithSelector, useRequestInit } from "./useApiClientConfig.js";
4
- export { ApiClientConfigProvider, Configuration, createSwrConfig, useApiClientConfig, useApiClientConfigContext, useApiClientConfigWithSelector, useRequestInit };
1
+ export { ApiClientConfigProvider, useApiClientConfigContext } from './ApiClientConfigProvider.js';
2
+ export { Configuration, createSwrConfig } from './swr.js';
3
+ export { useApiClientConfig, useApiClientConfigWithSelector, useRequestInit } from './useApiClientConfig.js';
4
+ import 'react';
5
+ import '../apiClientConfigStore.js';
6
+ import '../store.js';
7
+ import 'swr';
@@ -1,10 +1,26 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_react_swr = require("./swr.js");
3
- const require_react_ApiClientConfigProvider = require("./ApiClientConfigProvider.js");
4
- const require_react_useApiClientConfig = require("./useApiClientConfig.js");
5
- exports.ApiClientConfigProvider = require_react_ApiClientConfigProvider.ApiClientConfigProvider;
6
- exports.createSwrConfig = require_react_swr.createSwrConfig;
7
- exports.useApiClientConfig = require_react_useApiClientConfig.useApiClientConfig;
8
- exports.useApiClientConfigContext = require_react_ApiClientConfigProvider.useApiClientConfigContext;
9
- exports.useApiClientConfigWithSelector = require_react_useApiClientConfig.useApiClientConfigWithSelector;
10
- exports.useRequestInit = require_react_useApiClientConfig.useRequestInit;
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var react_exports = {};
17
+ module.exports = __toCommonJS(react_exports);
18
+ __reExport(react_exports, require("./ApiClientConfigProvider"), module.exports);
19
+ __reExport(react_exports, require("./swr"), module.exports);
20
+ __reExport(react_exports, require("./useApiClientConfig"), module.exports);
21
+ // Annotate the CommonJS export names for ESM import in node:
22
+ 0 && (module.exports = {
23
+ ...require("./ApiClientConfigProvider"),
24
+ ...require("./swr"),
25
+ ...require("./useApiClientConfig")
26
+ });
@@ -1,4 +1,24 @@
1
- import { createSwrConfig } from "./swr.mjs";
2
- import { ApiClientConfigProvider, useApiClientConfigContext } from "./ApiClientConfigProvider.mjs";
3
- import { useApiClientConfig, useApiClientConfigWithSelector, useRequestInit } from "./useApiClientConfig.mjs";
4
- export { ApiClientConfigProvider, createSwrConfig, useApiClientConfig, useApiClientConfigContext, useApiClientConfigWithSelector, useRequestInit };
1
+ import {
2
+ useApiClientConfig,
3
+ useApiClientConfigWithSelector,
4
+ useRequestInit
5
+ } from "../chunk-5JS6U5IM.mjs";
6
+ import {
7
+ ApiClientConfigProvider,
8
+ useApiClientConfigContext
9
+ } from "../chunk-QXFPBYPL.mjs";
10
+ import {
11
+ createSwrConfig
12
+ } from "../chunk-DH33ZDBG.mjs";
13
+ import "../chunk-NOC6G3HZ.mjs";
14
+ import "../chunk-TZUKIYFN.mjs";
15
+ import "../chunk-NYICHGY2.mjs";
16
+ import "../chunk-3SEO7S3Q.mjs";
17
+ export {
18
+ ApiClientConfigProvider,
19
+ createSwrConfig,
20
+ useApiClientConfig,
21
+ useApiClientConfigContext,
22
+ useApiClientConfigWithSelector,
23
+ useRequestInit
24
+ };
@@ -1,14 +1,13 @@
1
- import { SWRConfiguration } from "swr";
1
+ import { SWRConfiguration } from 'swr';
2
2
 
3
- //#region src/react/swr.d.ts
4
3
  type Configuration<T> = SWRConfiguration<T> & {
5
- /**
6
- * fetchを止めるかどうかのオプション
7
- * trueの場合: useSWRの第一引数にnullが渡されます
8
- * false,または未指定の場合: useSWRの第一引数にURLが渡されます
9
- */
10
- shouldNotFetch?: boolean;
4
+ /**
5
+ * fetchを止めるかどうかのオプション
6
+ * trueの場合: useSWRの第一引数にnullが渡されます
7
+ * false,または未指定の場合: useSWRの第一引数にURLが渡されます
8
+ */
9
+ shouldNotFetch?: boolean;
11
10
  };
12
11
  declare const createSwrConfig: (config?: SWRConfiguration) => SWRConfiguration;
13
- //#endregion
14
- export { Configuration, createSwrConfig };
12
+
13
+ export { type Configuration, createSwrConfig };
package/dist/react/swr.js CHANGED
@@ -1,28 +1,41 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("../_virtual/_rolldown/runtime.js");
3
- let react = require("react");
4
- //#region src/react/swr.ts
5
- /**
6
- * requestのfetchを中断させるためのmiddleware
7
- *
8
- * 同一hookにおいて、keyが更新されるなどにより、一つ前のrequestが返る前に再度fetchが行われる場合がある
9
- * その場合、一つ前のfetchが戻ってきた値がそのまま捨てられるため、responseに時間がかかるAPIの場合、純粋な負荷増加に繋がってしまう
10
- * そのため、最新のrequestのみを返すように、一つ前のrequestをabortする
11
- */
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var swr_exports = {};
20
+ __export(swr_exports, {
21
+ createSwrConfig: () => createSwrConfig
22
+ });
23
+ module.exports = __toCommonJS(swr_exports);
24
+ var import_react = require("react");
12
25
  const abortMiddleware = (useSWRNext) => (key, fetcher, config) => {
13
- const ctrlRef = (0, react.useRef)(void 0);
14
- return useSWRNext(key, fetcher ? (key, params) => {
15
- ctrlRef.current?.abort();
16
- ctrlRef.current = new AbortController();
17
- return fetcher(key, {
18
- ...params,
19
- signal: ctrlRef.current.signal
20
- });
21
- } : fetcher, config);
26
+ const ctrlRef = (0, import_react.useRef)(void 0);
27
+ const extendedFetcher = fetcher ? (key2, params) => {
28
+ ctrlRef.current?.abort();
29
+ ctrlRef.current = new AbortController();
30
+ return fetcher(key2, { ...params, signal: ctrlRef.current.signal });
31
+ } : fetcher;
32
+ return useSWRNext(key, extendedFetcher, config);
22
33
  };
23
34
  const createSwrConfig = (config) => ({
24
- ...config,
25
- use: [...config?.use ?? [], abortMiddleware]
35
+ ...config,
36
+ use: [...config?.use ?? [], abortMiddleware]
37
+ });
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ createSwrConfig
26
41
  });
27
- //#endregion
28
- exports.createSwrConfig = createSwrConfig;
@@ -1,26 +1,6 @@
1
- import { useRef } from "react";
2
- //#region src/react/swr.ts
3
- /**
4
- * requestのfetchを中断させるためのmiddleware
5
- *
6
- * 同一hookにおいて、keyが更新されるなどにより、一つ前のrequestが返る前に再度fetchが行われる場合がある
7
- * その場合、一つ前のfetchが戻ってきた値がそのまま捨てられるため、responseに時間がかかるAPIの場合、純粋な負荷増加に繋がってしまう
8
- * そのため、最新のrequestのみを返すように、一つ前のrequestをabortする
9
- */
10
- const abortMiddleware = (useSWRNext) => (key, fetcher, config) => {
11
- const ctrlRef = useRef(void 0);
12
- return useSWRNext(key, fetcher ? (key, params) => {
13
- ctrlRef.current?.abort();
14
- ctrlRef.current = new AbortController();
15
- return fetcher(key, {
16
- ...params,
17
- signal: ctrlRef.current.signal
18
- });
19
- } : fetcher, config);
1
+ import {
2
+ createSwrConfig
3
+ } from "../chunk-DH33ZDBG.mjs";
4
+ export {
5
+ createSwrConfig
20
6
  };
21
- const createSwrConfig = (config) => ({
22
- ...config,
23
- use: [...config?.use ?? [], abortMiddleware]
24
- });
25
- //#endregion
26
- export { createSwrConfig };
@@ -1,8 +1,8 @@
1
- import { Config } from "../apiClientConfigStore.js";
1
+ import { Config } from '../apiClientConfigStore.js';
2
+ import '../store.js';
2
3
 
3
- //#region src/react/useApiClientConfig.d.ts
4
- declare const useApiClientConfig: () => any;
4
+ declare const useApiClientConfig: () => Config;
5
5
  declare const useApiClientConfigWithSelector: <T>(selector: (state: Config) => T) => T;
6
6
  declare const useRequestInit: (customRequestInit?: RequestInit) => RequestInit;
7
- //#endregion
8
- export { useApiClientConfig, useApiClientConfigWithSelector, useRequestInit };
7
+
8
+ export { useApiClientConfig, useApiClientConfigWithSelector, useRequestInit };
@@ -1,24 +1,56 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("../_virtual/_rolldown/runtime.js");
3
- const require_utils_requestInit = require("../utils/requestInit.js");
4
- const require_react_ApiClientConfigProvider = require("./ApiClientConfigProvider.js");
5
- let react = require("react");
6
- let use_sync_external_store_shim_index_js = require("use-sync-external-store/shim/index.js");
7
- let use_sync_external_store_shim_with_selector_js = require("use-sync-external-store/shim/with-selector.js");
8
- //#region src/react/useApiClientConfig.ts
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var useApiClientConfig_exports = {};
20
+ __export(useApiClientConfig_exports, {
21
+ useApiClientConfig: () => useApiClientConfig,
22
+ useApiClientConfigWithSelector: () => useApiClientConfigWithSelector,
23
+ useRequestInit: () => useRequestInit
24
+ });
25
+ module.exports = __toCommonJS(useApiClientConfig_exports);
26
+ var import_ApiClientConfigProvider = require("./ApiClientConfigProvider");
27
+ var import_react = require("react");
28
+ var import_requestInit = require("../utils/requestInit");
29
+ var import_shim = require("use-sync-external-store/shim/index.js");
30
+ var import_with_selector = require("use-sync-external-store/shim/with-selector.js");
9
31
  const useApiClientConfig = () => {
10
- const store = require_react_ApiClientConfigProvider.useApiClientConfigContext();
11
- return (0, use_sync_external_store_shim_index_js.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
32
+ const store = (0, import_ApiClientConfigProvider.useApiClientConfigContext)();
33
+ return (0, import_shim.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
12
34
  };
13
35
  const useApiClientConfigWithSelector = (selector) => {
14
- const store = require_react_ApiClientConfigProvider.useApiClientConfigContext();
15
- return (0, use_sync_external_store_shim_with_selector_js.useSyncExternalStoreWithSelector)(store.subscribe, store.getState, store.getState, selector);
36
+ const store = (0, import_ApiClientConfigProvider.useApiClientConfigContext)();
37
+ return (0, import_with_selector.useSyncExternalStoreWithSelector)(
38
+ store.subscribe,
39
+ store.getState,
40
+ store.getState,
41
+ selector
42
+ );
16
43
  };
17
44
  const useRequestInit = (customRequestInit = {}) => {
18
- const { defaultRequestInit = {} } = useApiClientConfig();
19
- return (0, react.useMemo)(() => require_utils_requestInit.mergeRequestInit(defaultRequestInit, customRequestInit), [defaultRequestInit, customRequestInit]);
45
+ const { defaultRequestInit = {} } = useApiClientConfig();
46
+ return (0, import_react.useMemo)(
47
+ () => (0, import_requestInit.mergeRequestInit)(defaultRequestInit, customRequestInit),
48
+ [defaultRequestInit, customRequestInit]
49
+ );
20
50
  };
21
- //#endregion
22
- exports.useApiClientConfig = useApiClientConfig;
23
- exports.useApiClientConfigWithSelector = useApiClientConfigWithSelector;
24
- exports.useRequestInit = useRequestInit;
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ useApiClientConfig,
54
+ useApiClientConfigWithSelector,
55
+ useRequestInit
56
+ });
@@ -1,20 +1,16 @@
1
- import { mergeRequestInit } from "../utils/requestInit.mjs";
2
- import { useApiClientConfigContext } from "./ApiClientConfigProvider.mjs";
3
- import { useMemo } from "react";
4
- import { useSyncExternalStore } from "use-sync-external-store/shim/index.js";
5
- import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector.js";
6
- //#region src/react/useApiClientConfig.ts
7
- const useApiClientConfig = () => {
8
- const store = useApiClientConfigContext();
9
- return useSyncExternalStore(store.subscribe, store.getState, store.getState);
1
+ import {
2
+ useApiClientConfig,
3
+ useApiClientConfigWithSelector,
4
+ useRequestInit
5
+ } from "../chunk-5JS6U5IM.mjs";
6
+ import "../chunk-QXFPBYPL.mjs";
7
+ import "../chunk-DH33ZDBG.mjs";
8
+ import "../chunk-NOC6G3HZ.mjs";
9
+ import "../chunk-TZUKIYFN.mjs";
10
+ import "../chunk-NYICHGY2.mjs";
11
+ import "../chunk-3SEO7S3Q.mjs";
12
+ export {
13
+ useApiClientConfig,
14
+ useApiClientConfigWithSelector,
15
+ useRequestInit
10
16
  };
11
- const useApiClientConfigWithSelector = (selector) => {
12
- const store = useApiClientConfigContext();
13
- return useSyncExternalStoreWithSelector(store.subscribe, store.getState, store.getState, selector);
14
- };
15
- const useRequestInit = (customRequestInit = {}) => {
16
- const { defaultRequestInit = {} } = useApiClientConfig();
17
- return useMemo(() => mergeRequestInit(defaultRequestInit, customRequestInit), [defaultRequestInit, customRequestInit]);
18
- };
19
- //#endregion
20
- export { useApiClientConfig, useApiClientConfigWithSelector, useRequestInit };
@@ -1,4 +1,3 @@
1
- //#region src/requestUrl.d.ts
2
1
  declare function __internal__requestUrl(...args: any[]): string;
3
- //#endregion
4
- export { __internal__requestUrl };
2
+
3
+ export { __internal__requestUrl };
@@ -1,16 +1,51 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_runtime = require("./_virtual/_rolldown/runtime.js");
3
- const require_apiClientConfigStore = require("./apiClientConfigStore.js");
4
- let qs = require("qs");
5
- qs = require_runtime.__toESM(qs);
6
- //#region src/requestUrl.ts
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
+ var requestUrl_exports = {};
30
+ __export(requestUrl_exports, {
31
+ __internal__requestUrl: () => __internal__requestUrl
32
+ });
33
+ module.exports = __toCommonJS(requestUrl_exports);
34
+ var import_qs = __toESM(require("qs"));
35
+ var import_apiClientConfigStore = require("./apiClientConfigStore");
7
36
  function __internal__requestUrl(...args) {
8
- const config = require_apiClientConfigStore.store.getState();
9
- const rawPath = args[0];
10
- const params = args[1] || {};
11
- const query = args[2];
12
- const path = (config.hostName ? typeof config.hostName === "string" ? config.hostName : config.hostName(rawPath) : "") + Object.entries(params).reduce((path, [key, value]) => path.replace(`{${key}}`, String(value)), rawPath);
13
- return query ? `${path}?${qs.default.stringify(query)}` : path;
37
+ const config = import_apiClientConfigStore.store.getState();
38
+ const rawPath = args[0];
39
+ const params = args[1] || {};
40
+ const query = args[2];
41
+ const hostName = config.hostName ? typeof config.hostName === "string" ? config.hostName : config.hostName(rawPath) : "";
42
+ const path = hostName + Object.entries(params).reduce(
43
+ (path2, [key, value]) => path2.replace(`{${key}}`, String(value)),
44
+ rawPath
45
+ );
46
+ return query ? `${path}?${import_qs.default.stringify(query)}` : path;
14
47
  }
15
- //#endregion
16
- exports.__internal__requestUrl = __internal__requestUrl;
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ __internal__requestUrl
51
+ });
@@ -1,13 +1,10 @@
1
- import { store } from "./apiClientConfigStore.mjs";
2
- import qs from "qs";
3
- //#region src/requestUrl.ts
4
- function __internal__requestUrl(...args) {
5
- const config = store.getState();
6
- const rawPath = args[0];
7
- const params = args[1] || {};
8
- const query = args[2];
9
- const path = (config.hostName ? typeof config.hostName === "string" ? config.hostName : config.hostName(rawPath) : "") + Object.entries(params).reduce((path, [key, value]) => path.replace(`{${key}}`, String(value)), rawPath);
10
- return query ? `${path}?${qs.stringify(query)}` : path;
11
- }
12
- //#endregion
13
- export { __internal__requestUrl };
1
+ import {
2
+ __internal__requestUrl
3
+ } from "./chunk-GD4RTKUU.mjs";
4
+ import "./chunk-NOC6G3HZ.mjs";
5
+ import "./chunk-TZUKIYFN.mjs";
6
+ import "./chunk-NYICHGY2.mjs";
7
+ import "./chunk-3SEO7S3Q.mjs";
8
+ export {
9
+ __internal__requestUrl
10
+ };