@tonightpass/react 0.0.170 → 0.0.171

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.js CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var P=require('swr'),tonightpass=require('tonightpass'),f=require('swr/infinite');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var P__default=/*#__PURE__*/_interopDefault(P);var f__default=/*#__PURE__*/_interopDefault(f);var o=new tonightpass.Client({baseURL:tonightpass.DEFAULT_API_URL});function m(e,t,n){let{requestOptions:s,...p}=n||{};return P__default.default(e?[e,t]:null,async([r,i])=>await o.get(r,i,s),p)}function w(e,t){let{requestOptions:n,...s}=t||{};return f__default.default(e,async([a,r])=>await o.get(a,r,n),s)}exports.client=o;exports.useAPI=m;exports.useAPIInfinite=w;//# sourceMappingURL=index.js.map
1
+ 'use strict';var P=require('swr'),tonightpass=require('tonightpass'),f=require('swr/infinite');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var P__default=/*#__PURE__*/_interopDefault(P);var f__default=/*#__PURE__*/_interopDefault(f);var r=new tonightpass.Client({baseURL:tonightpass.DEFAULT_API_URL});function m(e,t,n){let{requestOptions:s,...p}=n||{};return P__default.default(e?[e,t]:null,async([o,i])=>await r.get(o,i,s),p)}function w(e,t){let{requestOptions:n,...s}=t||{};return f__default.default(e,async([a,o])=>await r.get(a,o,n),s)}exports.client=r;exports.useAPI=m;exports.useAPIInfinite=w;//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
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,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
+ {"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,kBAAeD,CAAAA,CAAAA,CARN,MAAO,CAACH,CAAAA,CAAWC,CAAU,CAI1B,GAAA,MAAMX,EAAO,GAAIU,CAAAA,CAAAA,CAAWC,EAAYJ,CAAc,CAAA,CAIlCC,CAAS,CAClD","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(getKey, fetcher, swrConfig);\n}\n"]}
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import P from'swr';import {Client,DEFAULT_API_URL}from'tonightpass';import f from'swr/infinite';var o=new Client({baseURL:DEFAULT_API_URL});function m(e,t,n){let{requestOptions:s,...p}=n||{};return P(e?[e,t]:null,async([r,i])=>await o.get(r,i,s),p)}function w(e,t){let{requestOptions:n,...s}=t||{};return f(e,async([a,r])=>await o.get(a,r,n),s)}export{o as client,m as useAPI,w as useAPIInfinite};//# sourceMappingURL=index.mjs.map
1
+ import P from'swr';import {Client,DEFAULT_API_URL}from'tonightpass';import f from'swr/infinite';var r=new Client({baseURL:DEFAULT_API_URL});function m(e,t,n){let{requestOptions:s,...p}=n||{};return P(e?[e,t]:null,async([o,i])=>await r.get(o,i,s),p)}function w(e,t){let{requestOptions:n,...s}=t||{};return f(e,async([a,o])=>await r.get(a,o,n),s)}export{r as client,m as useAPI,w as useAPIInfinite};//# sourceMappingURL=index.mjs.map
2
2
  //# sourceMappingURL=index.mjs.map
@@ -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,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"]}
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,CAAeD,CAAAA,CAAAA,CARN,MAAO,CAACH,CAAAA,CAAWC,CAAU,CAI1B,GAAA,MAAMX,EAAO,GAAIU,CAAAA,CAAAA,CAAWC,EAAYJ,CAAc,CAAA,CAIlCC,CAAS,CAClD","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(getKey, fetcher, swrConfig);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonightpass/react",
3
- "version": "0.0.170",
3
+ "version": "0.0.171",
4
4
  "description": "@tonightpass react sdk.",
5
5
  "repository": {
6
6
  "type": "git",