Socket
Socket
Sign inDemoInstall

@aspida/react-query

Package Overview
Dependencies
1
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.11.0 to 1.12.0

4

dist/index.d.ts
import { UseQueryResult, UseQueryOptions } from 'react-query';
declare type QueryOptions<T extends (option: any) => Promise<any>> = Parameters<Parameters<T> extends [Parameters<T>[0]] ? (option: Parameters<T>[0] & UseQueryOptions<ReturnType<T> extends Promise<infer S> ? S : never>) => void : (option?: Parameters<T>[0] & UseQueryOptions<ReturnType<T> extends Promise<infer S> ? S : never>) => void>;
declare type QueryResult<T extends (option: any) => Promise<any>> = UseQueryResult<ReturnType<T> extends Promise<infer S> ? S : never, any>;
type QueryOptions<T extends (option: any) => Promise<any>> = Parameters<Parameters<T> extends [Parameters<T>[0]] ? (option: Parameters<T>[0] & UseQueryOptions<ReturnType<T> extends Promise<infer S> ? S : never>) => void : (option?: Parameters<T>[0] & UseQueryOptions<ReturnType<T> extends Promise<infer S> ? S : never>) => void>;
type QueryResult<T extends (option: any) => Promise<any>> = UseQueryResult<ReturnType<T> extends Promise<infer S> ? S : never, any>;
declare function useAspidaQuery<T extends Record<string, any> & {

@@ -5,0 +5,0 @@ $get: (option: any) => Promise<any>;

{
"name": "@aspida/react-query",
"version": "1.11.0",
"version": "1.12.0",
"description": "React Query wrapper for aspida",

@@ -29,4 +29,4 @@ "author": "Solufa <solufa2020@gmail.com>",

"dependencies": {
"aspida": "^1.7.1"
"aspida": "^1.12.0"
}
}
# @aspida/react-query
<br />

@@ -14,5 +15,2 @@ <img src="https://aspida.github.io/aspida/logos/png/logo.png" alt="aspida" title="aspida" />

</a>
<a href="https://codecov.io/gh/aspida/aspida">
<img src="https://img.shields.io/codecov/c/github/aspida/aspida.svg" alt="Codecov" />
</a>
<a href="https://lgtm.com/projects/g/aspida/aspida/context:javascript">

@@ -52,3 +50,3 @@ <img src="https://img.shields.io/lgtm/grade/javascript/g/aspida/aspida.svg" alt="Language grade: JavaScript" />

```tsx
import { useQueryClient, useMutation, QueryClient, QueryClientProvider } from 'react-query'
import { useQueryClient, useMutation, QueryClient, QueryClientProvider } from "react-query"
import { useAspidaQuery } from "@aspida/react-query"

@@ -79,3 +77,3 @@ import aspida from "@aspida/axios" // "@aspida/fetch", "@aspida/node-fetch"

// Queries
const query = useAspidaQuery(client.todos, { query: { limit: 10 }})
const query = useAspidaQuery(client.todos, { query: { limit: 10 } })

@@ -86,4 +84,4 @@ // Mutations

// Invalidate and refetch
queryClient.invalidateQueries(client.todos.$path({ query: { limit: 10 }}))
},
queryClient.invalidateQueries(client.todos.$path({ query: { limit: 10 } }))
}
})

@@ -103,3 +101,3 @@

id: Date.now(),
title: 'Do Laundry',
title: "Do Laundry"
})

@@ -114,3 +112,3 @@ }}

render(<App />, document.getElementById('root'))
render(<App />, document.getElementById("root"))
```

@@ -123,3 +121,3 @@

```tsx
import { useMutation, QueryClient, QueryClientProvider } from 'react-query'
import { useMutation, QueryClient, QueryClientProvider } from "react-query"
import { useAspidaQuery } from "@aspida/react-query"

@@ -141,7 +139,5 @@ import aspida from "@aspida/axios" // "@aspida/fetch", "@aspida/node-fetch"

function Profile() {
const { data, error } = useAspidaQuery(
client.user._userId(123),
'get',
{ query: { name: 'mario' } }
)
const { data, error } = useAspidaQuery(client.user._userId(123), "get", {
query: { name: "mario" }
})

@@ -159,3 +155,3 @@ if (error) return <div>failed to load</div>

render(<App />, document.getElementById('root'))
render(<App />, document.getElementById("root"))
```

@@ -170,3 +166,3 @@

```tsx
import { useMutation, QueryClient, QueryClientProvider } from 'react-query'
import { useMutation, QueryClient, QueryClientProvider } from "react-query"
import { useAspidaQuery } from "@aspida/react-query"

@@ -188,10 +184,7 @@ import aspida from "@aspida/axios" // "@aspida/fetch", "@aspida/node-fetch"

function Profile() {
const { data, error } = useAspidaQuery(
client.user._userId(123),
{
query: { name: 'mario' },
refetchOnMount: true,
initialData: { name: 'anonymous' }
}
)
const { data, error } = useAspidaQuery(client.user._userId(123), {
query: { name: "mario" },
refetchOnMount: true,
initialData: { name: "anonymous" }
})

@@ -202,3 +195,3 @@ if (error) return <div>failed to load</div>

render(<App />, document.getElementById('root'))
render(<App />, document.getElementById("root"))
```

@@ -205,0 +198,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc