@tonightpass/react 0.0.169 → 0.0.170

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/index.d.mts CHANGED
@@ -18,6 +18,6 @@ declare function useAPI<Path extends PathsFor<"GET">>(path: Path | null | undefi
18
18
  interface UseAPIInfiniteConfig<Path extends PathsFor<"GET">> extends SWRInfiniteConfiguration<ResponseType<Path>, ErrorType<Path>> {
19
19
  requestOptions?: APIRequestOptions;
20
20
  }
21
- declare function useAPIInfinite<Path extends PathsFor<"GET">>(getKey: (pageIndex: number, previousPageData: ResponseType<Path> | null) => [Path, Query<Path>] | null, config?: UseAPIInfiniteConfig<Path>): SWRInfiniteResponse<ResponseType<Path>, ErrorType<Path>>;
21
+ declare function useAPIInfinite<Path extends PathsFor<"GET">>(getKey: (pageIndex: number, previousPageData: ResponseType<Path> | null) => [Path, Query<Path> | undefined] | null, config?: UseAPIInfiniteConfig<Path>): SWRInfiniteResponse<ResponseType<Path>, ErrorType<Path>>;
22
22
 
23
23
  export { type ErrorType, type ResponseType, type UseAPIConfig, type UseAPIInfiniteConfig, client, useAPI, useAPIInfinite };
package/dist/index.d.ts CHANGED
@@ -18,6 +18,6 @@ declare function useAPI<Path extends PathsFor<"GET">>(path: Path | null | undefi
18
18
  interface UseAPIInfiniteConfig<Path extends PathsFor<"GET">> extends SWRInfiniteConfiguration<ResponseType<Path>, ErrorType<Path>> {
19
19
  requestOptions?: APIRequestOptions;
20
20
  }
21
- declare function useAPIInfinite<Path extends PathsFor<"GET">>(getKey: (pageIndex: number, previousPageData: ResponseType<Path> | null) => [Path, Query<Path>] | null, config?: UseAPIInfiniteConfig<Path>): SWRInfiniteResponse<ResponseType<Path>, ErrorType<Path>>;
21
+ declare function useAPIInfinite<Path extends PathsFor<"GET">>(getKey: (pageIndex: number, previousPageData: ResponseType<Path> | null) => [Path, Query<Path> | undefined] | null, config?: UseAPIInfiniteConfig<Path>): SWRInfiniteResponse<ResponseType<Path>, ErrorType<Path>>;
22
22
 
23
23
  export { type ErrorType, type ResponseType, type UseAPIConfig, type UseAPIInfiniteConfig, client, useAPI, useAPIInfinite };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/hooks/useAPI.ts","../src/hooks/useAPIInfinite.ts"],"names":["client","Client","DEFAULT_API_URL","useAPI","path","query","config","requestOptions","swrConfig","useSWR","fetchPath","fetchQuery","useAPIInfinite","getKey","useSWRInfinite"],"mappings":"8PAWO,IAAMA,EAAS,IAAIC,kBAAAA,CAAO,CAAE,OAASC,CAAAA,2BAAgB,CAAC,EAmBtD,SAASC,EACdC,CACAC,CAAAA,CAAAA,CACAC,EACkD,CAClD,GAAM,CAAE,cAAAC,CAAAA,CAAAA,CAAgB,GAAGC,CAAU,CAAA,CAAIF,GAAU,EAAC,CAUpD,OAAOG,kBAILL,CAAAA,CAAAA,CAAO,CAACA,CAAMC,CAAAA,CAAK,EAAI,IAZT,CAAA,MAAO,CAACK,CAAWC,CAAAA,CAAU,CAI1B,GAAA,MAAMX,EAAO,GAAIU,CAAAA,CAAAA,CAAWC,EAAYJ,CAAc,CAAA,CAQjCC,CAAS,CACnD,CCrCO,SAASI,CACdC,CAAAA,CAAAA,CAIAP,EAC0D,CAC1D,GAAM,CAAE,cAAAC,CAAAA,CAAAA,CAAgB,GAAGC,CAAU,CAAA,CAAIF,GAAU,EAAC,CAOpD,OAAOQ,kBACLD,CAAAA,CAAAA,CANc,MAAO,CAACH,CAAAA,CAAWC,CAAU,CAC1B,GAAA,MAAMX,EAAO,GAAIU,CAAAA,CAAAA,CAAWC,EAAYJ,CAAc,CAAA,CAOvEC,CACF,CACF","file":"index.js","sourcesContent":["import useSWR, { SWRConfiguration, SWRResponse } from \"swr\";\nimport {\n Endpoints,\n APIRequestOptions,\n Client,\n PathsFor,\n DEFAULT_API_URL,\n TonightPassAPIError,\n Query,\n} from \"tonightpass\";\n\nexport const client = new Client({ baseURL: DEFAULT_API_URL });\n\ntype AnyEndpoint = Endpoints extends infer T ? T : never;\n\ntype ForceAccept<T> = T extends never ? any : T;\n\nexport type ResponseType<Path extends PathsFor<\"GET\">> = ForceAccept<\n Extract<AnyEndpoint, { path: Path; method: \"GET\" }>[\"res\"]\n>;\n\nexport type ErrorType<Path extends PathsFor<\"GET\">> = TonightPassAPIError<\n ResponseType<Path>\n>;\n\nexport interface UseAPIConfig<Path extends PathsFor<\"GET\">>\n extends SWRConfiguration<ResponseType<Path>, ErrorType<Path>> {\n requestOptions?: APIRequestOptions;\n}\n\nexport function useAPI<Path extends PathsFor<\"GET\">>(\n path: Path | null | undefined,\n query?: Query<Path>,\n config?: UseAPIConfig<Path>,\n): SWRResponse<ResponseType<Path>, ErrorType<Path>> {\n const { requestOptions, ...swrConfig } = config || {};\n\n const fetcher = async ([fetchPath, fetchQuery]: [\n Path,\n Query<Path> | undefined,\n ]) => {\n const response = await client.get(fetchPath, fetchQuery, requestOptions);\n return response as unknown as ResponseType<Path>;\n };\n\n return useSWR<\n ResponseType<Path>,\n ErrorType<Path>,\n [Path, Query<Path> | undefined] | null\n >(path ? [path, query] : null, fetcher, swrConfig);\n}\n","import useSWRInfinite, {\n SWRInfiniteConfiguration,\n SWRInfiniteResponse,\n} from \"swr/infinite\";\nimport { APIRequestOptions, PathsFor, Query } from \"tonightpass\";\n\nimport { client, ResponseType, ErrorType } from \"./useAPI\";\n\nexport interface UseAPIInfiniteConfig<Path extends PathsFor<\"GET\">>\n extends SWRInfiniteConfiguration<ResponseType<Path>, ErrorType<Path>> {\n requestOptions?: APIRequestOptions;\n}\n\nexport function useAPIInfinite<Path extends PathsFor<\"GET\">>(\n getKey: (\n pageIndex: number,\n previousPageData: ResponseType<Path> | null,\n ) => [Path, Query<Path>] | null,\n config?: UseAPIInfiniteConfig<Path>,\n): SWRInfiniteResponse<ResponseType<Path>, ErrorType<Path>> {\n const { requestOptions, ...swrConfig } = config || {};\n\n const fetcher = async ([fetchPath, fetchQuery]: [Path, Query<Path>]) => {\n const response = await client.get(fetchPath, fetchQuery, requestOptions);\n return response as unknown as ResponseType<Path>;\n };\n\n return useSWRInfinite<ResponseType<Path>, ErrorType<Path>>(\n getKey,\n fetcher,\n swrConfig,\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/hooks/useAPI.ts","../src/hooks/useAPIInfinite.ts"],"names":["client","Client","DEFAULT_API_URL","useAPI","path","query","config","requestOptions","swrConfig","useSWR","fetchPath","fetchQuery","useAPIInfinite","getKey","useSWRInfinite"],"mappings":"8PAWO,IAAMA,EAAS,IAAIC,kBAAAA,CAAO,CAAE,OAASC,CAAAA,2BAAgB,CAAC,EAmBtD,SAASC,EACdC,CACAC,CAAAA,CAAAA,CACAC,EACkD,CAClD,GAAM,CAAE,cAAAC,CAAAA,CAAAA,CAAgB,GAAGC,CAAU,CAAA,CAAIF,GAAU,EAAC,CAUpD,OAAOG,kBAILL,CAAAA,CAAAA,CAAO,CAACA,CAAMC,CAAAA,CAAK,EAAI,IAZT,CAAA,MAAO,CAACK,CAAWC,CAAAA,CAAU,CAI1B,GAAA,MAAMX,EAAO,GAAIU,CAAAA,CAAAA,CAAWC,EAAYJ,CAAc,CAAA,CAQjCC,CAAS,CACnD,CCrCO,SAASI,CACdC,CAAAA,CAAAA,CAIAP,EAC0D,CAC1D,GAAM,CAAE,cAAAC,CAAAA,CAAAA,CAAgB,GAAGC,CAAU,CAAA,CAAIF,GAAU,EAAC,CAUpD,OAAOQ,kBACLD,CAAAA,CAAAA,CATc,MAAO,CAACH,CAAAA,CAAWC,CAAU,CAI1B,GAAA,MAAMX,EAAO,GAAIU,CAAAA,CAAAA,CAAWC,EAAYJ,CAAc,CAAA,CAOvEC,CACF,CACF","file":"index.js","sourcesContent":["import useSWR, { SWRConfiguration, SWRResponse } from \"swr\";\nimport {\n Endpoints,\n APIRequestOptions,\n Client,\n PathsFor,\n DEFAULT_API_URL,\n TonightPassAPIError,\n Query,\n} from \"tonightpass\";\n\nexport const client = new Client({ baseURL: DEFAULT_API_URL });\n\ntype AnyEndpoint = Endpoints extends infer T ? T : never;\n\ntype ForceAccept<T> = T extends never ? any : T;\n\nexport type ResponseType<Path extends PathsFor<\"GET\">> = ForceAccept<\n Extract<AnyEndpoint, { path: Path; method: \"GET\" }>[\"res\"]\n>;\n\nexport type ErrorType<Path extends PathsFor<\"GET\">> = TonightPassAPIError<\n ResponseType<Path>\n>;\n\nexport interface UseAPIConfig<Path extends PathsFor<\"GET\">>\n extends SWRConfiguration<ResponseType<Path>, ErrorType<Path>> {\n requestOptions?: APIRequestOptions;\n}\n\nexport function useAPI<Path extends PathsFor<\"GET\">>(\n path: Path | null | undefined,\n query?: Query<Path>,\n config?: UseAPIConfig<Path>,\n): SWRResponse<ResponseType<Path>, ErrorType<Path>> {\n const { requestOptions, ...swrConfig } = config || {};\n\n const fetcher = async ([fetchPath, fetchQuery]: [\n Path,\n Query<Path> | undefined,\n ]) => {\n const response = await client.get(fetchPath, fetchQuery, requestOptions);\n return response as unknown as ResponseType<Path>;\n };\n\n return useSWR<\n ResponseType<Path>,\n ErrorType<Path>,\n [Path, Query<Path> | undefined] | null\n >(path ? [path, query] : null, fetcher, swrConfig);\n}\n","import useSWRInfinite, {\n SWRInfiniteConfiguration,\n SWRInfiniteResponse,\n} from \"swr/infinite\";\nimport { APIRequestOptions, PathsFor, Query } from \"tonightpass\";\n\nimport { client, ResponseType, ErrorType } from \"./useAPI\";\n\nexport interface UseAPIInfiniteConfig<Path extends PathsFor<\"GET\">>\n extends SWRInfiniteConfiguration<ResponseType<Path>, ErrorType<Path>> {\n requestOptions?: APIRequestOptions;\n}\n\nexport function useAPIInfinite<Path extends PathsFor<\"GET\">>(\n getKey: (\n pageIndex: number,\n previousPageData: ResponseType<Path> | null,\n ) => [Path, Query<Path> | undefined] | null,\n config?: UseAPIInfiniteConfig<Path>,\n): SWRInfiniteResponse<ResponseType<Path>, ErrorType<Path>> {\n const { requestOptions, ...swrConfig } = config || {};\n\n const fetcher = async ([fetchPath, fetchQuery]: [\n Path,\n Query<Path> | undefined,\n ]) => {\n const response = await client.get(fetchPath, fetchQuery, requestOptions);\n return response as unknown as ResponseType<Path>;\n };\n\n return useSWRInfinite<ResponseType<Path>, ErrorType<Path>>(\n getKey,\n fetcher,\n swrConfig,\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/hooks/useAPI.ts","../src/hooks/useAPIInfinite.ts"],"names":["client","Client","DEFAULT_API_URL","useAPI","path","query","config","requestOptions","swrConfig","useSWR","fetchPath","fetchQuery","useAPIInfinite","getKey","useSWRInfinite"],"mappings":"gGAWO,IAAMA,EAAS,IAAIC,MAAAA,CAAO,CAAE,OAASC,CAAAA,eAAgB,CAAC,EAmBtD,SAASC,EACdC,CACAC,CAAAA,CAAAA,CACAC,EACkD,CAClD,GAAM,CAAE,cAAAC,CAAAA,CAAAA,CAAgB,GAAGC,CAAU,CAAA,CAAIF,GAAU,EAAC,CAUpD,OAAOG,CAILL,CAAAA,CAAAA,CAAO,CAACA,CAAMC,CAAAA,CAAK,EAAI,IAZT,CAAA,MAAO,CAACK,CAAWC,CAAAA,CAAU,CAI1B,GAAA,MAAMX,EAAO,GAAIU,CAAAA,CAAAA,CAAWC,EAAYJ,CAAc,CAAA,CAQjCC,CAAS,CACnD,CCrCO,SAASI,CACdC,CAAAA,CAAAA,CAIAP,EAC0D,CAC1D,GAAM,CAAE,cAAAC,CAAAA,CAAAA,CAAgB,GAAGC,CAAU,CAAA,CAAIF,GAAU,EAAC,CAOpD,OAAOQ,CACLD,CAAAA,CAAAA,CANc,MAAO,CAACH,CAAAA,CAAWC,CAAU,CAC1B,GAAA,MAAMX,EAAO,GAAIU,CAAAA,CAAAA,CAAWC,EAAYJ,CAAc,CAAA,CAOvEC,CACF,CACF","file":"index.mjs","sourcesContent":["import useSWR, { SWRConfiguration, SWRResponse } from \"swr\";\nimport {\n Endpoints,\n APIRequestOptions,\n Client,\n PathsFor,\n DEFAULT_API_URL,\n TonightPassAPIError,\n Query,\n} from \"tonightpass\";\n\nexport const client = new Client({ baseURL: DEFAULT_API_URL });\n\ntype AnyEndpoint = Endpoints extends infer T ? T : never;\n\ntype ForceAccept<T> = T extends never ? any : T;\n\nexport type ResponseType<Path extends PathsFor<\"GET\">> = ForceAccept<\n Extract<AnyEndpoint, { path: Path; method: \"GET\" }>[\"res\"]\n>;\n\nexport type ErrorType<Path extends PathsFor<\"GET\">> = TonightPassAPIError<\n ResponseType<Path>\n>;\n\nexport interface UseAPIConfig<Path extends PathsFor<\"GET\">>\n extends SWRConfiguration<ResponseType<Path>, ErrorType<Path>> {\n requestOptions?: APIRequestOptions;\n}\n\nexport function useAPI<Path extends PathsFor<\"GET\">>(\n path: Path | null | undefined,\n query?: Query<Path>,\n config?: UseAPIConfig<Path>,\n): SWRResponse<ResponseType<Path>, ErrorType<Path>> {\n const { requestOptions, ...swrConfig } = config || {};\n\n const fetcher = async ([fetchPath, fetchQuery]: [\n Path,\n Query<Path> | undefined,\n ]) => {\n const response = await client.get(fetchPath, fetchQuery, requestOptions);\n return response as unknown as ResponseType<Path>;\n };\n\n return useSWR<\n ResponseType<Path>,\n ErrorType<Path>,\n [Path, Query<Path> | undefined] | null\n >(path ? [path, query] : null, fetcher, swrConfig);\n}\n","import useSWRInfinite, {\n SWRInfiniteConfiguration,\n SWRInfiniteResponse,\n} from \"swr/infinite\";\nimport { APIRequestOptions, PathsFor, Query } from \"tonightpass\";\n\nimport { client, ResponseType, ErrorType } from \"./useAPI\";\n\nexport interface UseAPIInfiniteConfig<Path extends PathsFor<\"GET\">>\n extends SWRInfiniteConfiguration<ResponseType<Path>, ErrorType<Path>> {\n requestOptions?: APIRequestOptions;\n}\n\nexport function useAPIInfinite<Path extends PathsFor<\"GET\">>(\n getKey: (\n pageIndex: number,\n previousPageData: ResponseType<Path> | null,\n ) => [Path, Query<Path>] | null,\n config?: UseAPIInfiniteConfig<Path>,\n): SWRInfiniteResponse<ResponseType<Path>, ErrorType<Path>> {\n const { requestOptions, ...swrConfig } = config || {};\n\n const fetcher = async ([fetchPath, fetchQuery]: [Path, Query<Path>]) => {\n const response = await client.get(fetchPath, fetchQuery, requestOptions);\n return response as unknown as ResponseType<Path>;\n };\n\n return useSWRInfinite<ResponseType<Path>, ErrorType<Path>>(\n getKey,\n fetcher,\n swrConfig,\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/hooks/useAPI.ts","../src/hooks/useAPIInfinite.ts"],"names":["client","Client","DEFAULT_API_URL","useAPI","path","query","config","requestOptions","swrConfig","useSWR","fetchPath","fetchQuery","useAPIInfinite","getKey","useSWRInfinite"],"mappings":"gGAWO,IAAMA,EAAS,IAAIC,MAAAA,CAAO,CAAE,OAASC,CAAAA,eAAgB,CAAC,EAmBtD,SAASC,EACdC,CACAC,CAAAA,CAAAA,CACAC,EACkD,CAClD,GAAM,CAAE,cAAAC,CAAAA,CAAAA,CAAgB,GAAGC,CAAU,CAAA,CAAIF,GAAU,EAAC,CAUpD,OAAOG,CAILL,CAAAA,CAAAA,CAAO,CAACA,CAAMC,CAAAA,CAAK,EAAI,IAZT,CAAA,MAAO,CAACK,CAAWC,CAAAA,CAAU,CAI1B,GAAA,MAAMX,EAAO,GAAIU,CAAAA,CAAAA,CAAWC,EAAYJ,CAAc,CAAA,CAQjCC,CAAS,CACnD,CCrCO,SAASI,CACdC,CAAAA,CAAAA,CAIAP,EAC0D,CAC1D,GAAM,CAAE,cAAAC,CAAAA,CAAAA,CAAgB,GAAGC,CAAU,CAAA,CAAIF,GAAU,EAAC,CAUpD,OAAOQ,CACLD,CAAAA,CAAAA,CATc,MAAO,CAACH,CAAAA,CAAWC,CAAU,CAI1B,GAAA,MAAMX,EAAO,GAAIU,CAAAA,CAAAA,CAAWC,EAAYJ,CAAc,CAAA,CAOvEC,CACF,CACF","file":"index.mjs","sourcesContent":["import useSWR, { SWRConfiguration, SWRResponse } from \"swr\";\nimport {\n Endpoints,\n APIRequestOptions,\n Client,\n PathsFor,\n DEFAULT_API_URL,\n TonightPassAPIError,\n Query,\n} from \"tonightpass\";\n\nexport const client = new Client({ baseURL: DEFAULT_API_URL });\n\ntype AnyEndpoint = Endpoints extends infer T ? T : never;\n\ntype ForceAccept<T> = T extends never ? any : T;\n\nexport type ResponseType<Path extends PathsFor<\"GET\">> = ForceAccept<\n Extract<AnyEndpoint, { path: Path; method: \"GET\" }>[\"res\"]\n>;\n\nexport type ErrorType<Path extends PathsFor<\"GET\">> = TonightPassAPIError<\n ResponseType<Path>\n>;\n\nexport interface UseAPIConfig<Path extends PathsFor<\"GET\">>\n extends SWRConfiguration<ResponseType<Path>, ErrorType<Path>> {\n requestOptions?: APIRequestOptions;\n}\n\nexport function useAPI<Path extends PathsFor<\"GET\">>(\n path: Path | null | undefined,\n query?: Query<Path>,\n config?: UseAPIConfig<Path>,\n): SWRResponse<ResponseType<Path>, ErrorType<Path>> {\n const { requestOptions, ...swrConfig } = config || {};\n\n const fetcher = async ([fetchPath, fetchQuery]: [\n Path,\n Query<Path> | undefined,\n ]) => {\n const response = await client.get(fetchPath, fetchQuery, requestOptions);\n return response as unknown as ResponseType<Path>;\n };\n\n return useSWR<\n ResponseType<Path>,\n ErrorType<Path>,\n [Path, Query<Path> | undefined] | null\n >(path ? [path, query] : null, fetcher, swrConfig);\n}\n","import useSWRInfinite, {\n SWRInfiniteConfiguration,\n SWRInfiniteResponse,\n} from \"swr/infinite\";\nimport { APIRequestOptions, PathsFor, Query } from \"tonightpass\";\n\nimport { client, ResponseType, ErrorType } from \"./useAPI\";\n\nexport interface UseAPIInfiniteConfig<Path extends PathsFor<\"GET\">>\n extends SWRInfiniteConfiguration<ResponseType<Path>, ErrorType<Path>> {\n requestOptions?: APIRequestOptions;\n}\n\nexport function useAPIInfinite<Path extends PathsFor<\"GET\">>(\n getKey: (\n pageIndex: number,\n previousPageData: ResponseType<Path> | null,\n ) => [Path, Query<Path> | undefined] | null,\n config?: UseAPIInfiniteConfig<Path>,\n): SWRInfiniteResponse<ResponseType<Path>, ErrorType<Path>> {\n const { requestOptions, ...swrConfig } = config || {};\n\n const fetcher = async ([fetchPath, fetchQuery]: [\n Path,\n Query<Path> | undefined,\n ]) => {\n const response = await client.get(fetchPath, fetchQuery, requestOptions);\n return response as unknown as ResponseType<Path>;\n };\n\n return useSWRInfinite<ResponseType<Path>, ErrorType<Path>>(\n getKey,\n fetcher,\n swrConfig,\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonightpass/react",
3
- "version": "0.0.169",
3
+ "version": "0.0.170",
4
4
  "description": "@tonightpass react sdk.",
5
5
  "repository": {
6
6
  "type": "git",