@readyfor/api-client-base 1.22.0-pr1283.aab9646 → 1.22.0-pr1284.0666ff1

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/_virtual/_rolldown/runtime.js +23 -0
  2. package/dist/apiClientConfigStore.d.ts +11 -10
  3. package/dist/apiClientConfigStore.js +10 -37
  4. package/dist/apiClientConfigStore.mjs +9 -12
  5. package/dist/apiError.d.ts +24 -25
  6. package/dist/apiError.js +68 -95
  7. package/dist/apiError.mjs +70 -18
  8. package/dist/fetcher.d.ts +8 -7
  9. package/dist/fetcher.js +57 -125
  10. package/dist/fetcher.mjs +63 -20
  11. package/dist/index.d.ts +10 -10
  12. package/dist/index.js +31 -38
  13. package/dist/index.mjs +10 -63
  14. package/dist/react/ApiClientConfigProvider.d.ts +10 -9
  15. package/dist/react/ApiClientConfigProvider.js +24 -41
  16. package/dist/react/ApiClientConfigProvider.mjs +22 -12
  17. package/dist/react/index.d.ts +4 -7
  18. package/dist/react/index.js +10 -26
  19. package/dist/react/index.mjs +4 -24
  20. package/dist/react/swr.d.ts +10 -9
  21. package/dist/react/swr.js +24 -37
  22. package/dist/react/swr.mjs +25 -5
  23. package/dist/react/useApiClientConfig.d.ts +5 -5
  24. package/dist/react/useApiClientConfig.js +18 -50
  25. package/dist/react/useApiClientConfig.mjs +19 -15
  26. package/dist/requestUrl.d.ts +3 -2
  27. package/dist/requestUrl.js +14 -49
  28. package/dist/requestUrl.mjs +13 -10
  29. package/dist/store.d.ts +6 -5
  30. package/dist/store.js +20 -43
  31. package/dist/store.mjs +20 -5
  32. package/dist/types.d.ts +5 -11
  33. package/dist/types.js +0 -16
  34. package/dist/types.mjs +1 -1
  35. package/dist/utils/headersInit.d.ts +3 -2
  36. package/dist/utils/headersInit.js +45 -49
  37. package/dist/utils/headersInit.mjs +46 -7
  38. package/dist/utils/requestInit.d.ts +10 -3
  39. package/dist/utils/requestInit.js +14 -31
  40. package/dist/utils/requestInit.mjs +15 -7
  41. package/dist/zod.d.ts +4 -3
  42. package/dist/zod.js +6 -30
  43. package/dist/zod.mjs +6 -7
  44. package/package.json +2 -19
  45. package/dist/chunk-3SEO7S3Q.mjs +0 -23
  46. package/dist/chunk-5JS6U5IM.mjs +0 -37
  47. package/dist/chunk-DH33ZDBG.mjs +0 -19
  48. package/dist/chunk-FNLUAQWC.mjs +0 -80
  49. package/dist/chunk-GD4RTKUU.mjs +0 -22
  50. package/dist/chunk-JCZWXJBU.mjs +0 -10
  51. package/dist/chunk-NOC6G3HZ.mjs +0 -21
  52. package/dist/chunk-NYICHGY2.mjs +0 -30
  53. package/dist/chunk-OVR3ZT2S.mjs +0 -118
  54. package/dist/chunk-QXFPBYPL.mjs +0 -25
  55. package/dist/chunk-TZUKIYFN.mjs +0 -14
  56. package/dist/chunk-WBQAMGXK.mjs +0 -0
@@ -1,24 +1,4 @@
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
+ 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,13 +1,14 @@
1
- import { SWRConfiguration } from 'swr';
1
+ import { SWRConfiguration } from "swr";
2
2
 
3
+ //#region src/react/swr.d.ts
3
4
  type Configuration<T> = SWRConfiguration<T> & {
4
- /**
5
- * fetchを止めるかどうかのオプション
6
- * trueの場合: useSWRの第一引数にnullが渡されます
7
- * false,または未指定の場合: useSWRの第一引数にURLが渡されます
8
- */
9
- shouldNotFetch?: boolean;
5
+ /**
6
+ * fetchを止めるかどうかのオプション
7
+ * trueの場合: useSWRの第一引数にnullが渡されます
8
+ * false,または未指定の場合: useSWRの第一引数にURLが渡されます
9
+ */
10
+ shouldNotFetch?: boolean;
10
11
  };
11
12
  declare const createSwrConfig: (config?: SWRConfiguration) => SWRConfiguration;
12
-
13
- export { type Configuration, createSwrConfig };
13
+ //#endregion
14
+ export { Configuration, createSwrConfig };
package/dist/react/swr.js CHANGED
@@ -1,41 +1,28 @@
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");
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
+ */
25
12
  const abortMiddleware = (useSWRNext) => (key, 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);
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);
33
22
  };
34
23
  const createSwrConfig = (config) => ({
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
24
+ ...config,
25
+ use: [...config?.use ?? [], abortMiddleware]
41
26
  });
27
+ //#endregion
28
+ exports.createSwrConfig = createSwrConfig;
@@ -1,6 +1,26 @@
1
- import {
2
- createSwrConfig
3
- } from "../chunk-DH33ZDBG.mjs";
4
- export {
5
- createSwrConfig
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);
6
20
  };
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';
2
- import '../store.js';
1
+ import { Config } from "../apiClientConfigStore.js";
3
2
 
4
- declare const useApiClientConfig: () => Config;
3
+ //#region src/react/useApiClientConfig.d.ts
4
+ declare const useApiClientConfig: () => any;
5
5
  declare const useApiClientConfigWithSelector: <T>(selector: (state: Config) => T) => T;
6
6
  declare const useRequestInit: (customRequestInit?: RequestInit) => RequestInit;
7
-
8
- export { useApiClientConfig, useApiClientConfigWithSelector, useRequestInit };
7
+ //#endregion
8
+ export { useApiClientConfig, useApiClientConfigWithSelector, useRequestInit };
@@ -1,56 +1,24 @@
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");
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
31
9
  const useApiClientConfig = () => {
32
- const store = (0, import_ApiClientConfigProvider.useApiClientConfigContext)();
33
- return (0, import_shim.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
10
+ const store = require_react_ApiClientConfigProvider.useApiClientConfigContext();
11
+ return (0, use_sync_external_store_shim_index_js.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
34
12
  };
35
13
  const useApiClientConfigWithSelector = (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
- );
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);
43
16
  };
44
17
  const useRequestInit = (customRequestInit = {}) => {
45
- const { defaultRequestInit = {} } = useApiClientConfig();
46
- return (0, import_react.useMemo)(
47
- () => (0, import_requestInit.mergeRequestInit)(defaultRequestInit, customRequestInit),
48
- [defaultRequestInit, customRequestInit]
49
- );
18
+ const { defaultRequestInit = {} } = useApiClientConfig();
19
+ return (0, react.useMemo)(() => require_utils_requestInit.mergeRequestInit(defaultRequestInit, customRequestInit), [defaultRequestInit, customRequestInit]);
50
20
  };
51
- // Annotate the CommonJS export names for ESM import in node:
52
- 0 && (module.exports = {
53
- useApiClientConfig,
54
- useApiClientConfigWithSelector,
55
- useRequestInit
56
- });
21
+ //#endregion
22
+ exports.useApiClientConfig = useApiClientConfig;
23
+ exports.useApiClientConfigWithSelector = useApiClientConfigWithSelector;
24
+ exports.useRequestInit = useRequestInit;
@@ -1,16 +1,20 @@
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
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);
16
10
  };
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,3 +1,4 @@
1
+ //#region src/requestUrl.d.ts
1
2
  declare function __internal__requestUrl(...args: any[]): string;
2
-
3
- export { __internal__requestUrl };
3
+ //#endregion
4
+ export { __internal__requestUrl };
@@ -1,51 +1,16 @@
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");
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
36
7
  function __internal__requestUrl(...args) {
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;
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;
47
14
  }
48
- // Annotate the CommonJS export names for ESM import in node:
49
- 0 && (module.exports = {
50
- __internal__requestUrl
51
- });
15
+ //#endregion
16
+ exports.__internal__requestUrl = __internal__requestUrl;
@@ -1,10 +1,13 @@
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
- };
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 };
package/dist/store.d.ts CHANGED
@@ -1,13 +1,14 @@
1
+ //#region src/store.d.ts
1
2
  type Listener = () => void;
2
3
  type GetState<T> = () => T;
3
4
  type SetState<T> = (fn: (state: T) => T) => void;
4
5
  type Subscribe = (listener: Listener) => Unsubscribe;
5
6
  type Unsubscribe = () => void;
6
7
  type Store<T> = {
7
- getState: GetState<T>;
8
- setState: SetState<T>;
9
- subscribe: Subscribe;
8
+ getState: GetState<T>;
9
+ setState: SetState<T>;
10
+ subscribe: Subscribe;
10
11
  };
11
12
  declare const createStore: <T>(initialState: T) => Store<T>;
12
-
13
- export { type Store, createStore };
13
+ //#endregion
14
+ export { Store, createStore };
package/dist/store.js CHANGED
@@ -1,45 +1,22 @@
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 store_exports = {};
20
- __export(store_exports, {
21
- createStore: () => createStore
22
- });
23
- module.exports = __toCommonJS(store_exports);
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/store.ts
24
3
  const createStore = (initialState) => {
25
- let state = initialState;
26
- const listeners = /* @__PURE__ */ new Set();
27
- const getState = () => state;
28
- const setState = (fn) => {
29
- state = fn(state);
30
- listeners.forEach((listener) => listener());
31
- };
32
- const subscribe = (listener) => {
33
- listeners.add(listener);
34
- return () => listeners.delete(listener);
35
- };
36
- return {
37
- getState,
38
- setState,
39
- subscribe
40
- };
4
+ let state = initialState;
5
+ const listeners = /* @__PURE__ */ new Set();
6
+ const getState = () => state;
7
+ const setState = (fn) => {
8
+ state = fn(state);
9
+ listeners.forEach((listener) => listener());
10
+ };
11
+ const subscribe = (listener) => {
12
+ listeners.add(listener);
13
+ return () => listeners.delete(listener);
14
+ };
15
+ return {
16
+ getState,
17
+ setState,
18
+ subscribe
19
+ };
41
20
  };
42
- // Annotate the CommonJS export names for ESM import in node:
43
- 0 && (module.exports = {
44
- createStore
45
- });
21
+ //#endregion
22
+ exports.createStore = createStore;
package/dist/store.mjs CHANGED
@@ -1,6 +1,21 @@
1
- import {
2
- createStore
3
- } from "./chunk-3SEO7S3Q.mjs";
4
- export {
5
- createStore
1
+ //#region src/store.ts
2
+ const createStore = (initialState) => {
3
+ let state = initialState;
4
+ const listeners = /* @__PURE__ */ new Set();
5
+ const getState = () => state;
6
+ const setState = (fn) => {
7
+ state = fn(state);
8
+ listeners.forEach((listener) => listener());
9
+ };
10
+ const subscribe = (listener) => {
11
+ listeners.add(listener);
12
+ return () => listeners.delete(listener);
13
+ };
14
+ return {
15
+ getState,
16
+ setState,
17
+ subscribe
18
+ };
6
19
  };
20
+ //#endregion
21
+ export { createStore };
package/dist/types.d.ts CHANGED
@@ -1,12 +1,6 @@
1
- type ForceDig<T, K extends string[]> = K extends [
2
- infer P extends string,
3
- ...infer Rest extends string[]
4
- ] ? T extends {
5
- [key in P]?: infer S;
6
- } ? ForceDig<Exclude<S, undefined>, Rest> : Record<string, never> : T;
1
+ //#region src/types.d.ts
2
+ type ForceDig<T, K extends string[]> = K extends [infer P extends string, ...infer Rest extends string[]] ? T extends { [key in P]?: infer S } ? ForceDig<Exclude<S, undefined>, Rest> : Record<string, never> : T;
7
3
  type RemoveBracket<T> = T extends `${infer S}[]` ? S : T;
8
- type QueryPropsFor<T extends Record<string, unknown>> = {
9
- [K in keyof T as RemoveBracket<K>]: K extends `${string}[]` ? Exclude<T[K], undefined>[] : T[K];
10
- };
11
-
12
- export type { ForceDig, QueryPropsFor };
4
+ type QueryPropsFor<T extends Record<string, unknown>> = { [K in keyof T as RemoveBracket<K>]: K extends `${string}[]` ? Exclude<T[K], undefined>[] : T[K] };
5
+ //#endregion
6
+ export { ForceDig, QueryPropsFor };
package/dist/types.js CHANGED
@@ -1,16 +0,0 @@
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var types_exports = {};
16
- module.exports = __toCommonJS(types_exports);
package/dist/types.mjs CHANGED
@@ -1 +1 @@
1
- import "./chunk-WBQAMGXK.mjs";
1
+ export {};
@@ -1,3 +1,4 @@
1
+ //#region src/utils/headersInit.d.ts
1
2
  /**
2
3
  * 二つのHeadersInitの情報を元に、新たなHeadersInitを作成する
3
4
  *
@@ -24,5 +25,5 @@ declare const mergeHeadersInit: (baseHeadersInit: HeadersInit, overrideHeadersIn
24
25
  * @returns HeadersInit として使用可能なオブジェクト
25
26
  */
26
27
  declare const toHeadersInit: (headers: Record<string, string | number | boolean | undefined>) => HeadersInit;
27
-
28
- export { mergeHeadersInit, toHeadersInit };
28
+ //#endregion
29
+ export { mergeHeadersInit, toHeadersInit };