@stack-spot/portal-network 0.45.0 → 0.46.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.
- package/CHANGELOG.md +14 -0
- package/dist/api/ai.d.ts +60 -34
- package/dist/api/ai.d.ts.map +1 -1
- package/dist/api/ai.js +38 -0
- package/dist/api/ai.js.map +1 -1
- package/dist/client/ai.d.ts +21 -0
- package/dist/client/ai.d.ts.map +1 -1
- package/dist/client/ai.js +19 -1
- package/dist/client/ai.js.map +1 -1
- package/dist/client/types.d.ts +1 -1
- package/dist/client/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/network/AutoInfiniteQuery.d.ts +2 -0
- package/dist/network/AutoInfiniteQuery.d.ts.map +1 -1
- package/dist/network/AutoInfiniteQuery.js +11 -8
- package/dist/network/AutoInfiniteQuery.js.map +1 -1
- package/dist/network/AutoMutation.d.ts +4 -2
- package/dist/network/AutoMutation.d.ts.map +1 -1
- package/dist/network/AutoMutation.js +5 -3
- package/dist/network/AutoMutation.js.map +1 -1
- package/dist/network/AutoOperation.d.ts +1 -3
- package/dist/network/AutoOperation.d.ts.map +1 -1
- package/dist/network/AutoOperation.js +4 -31
- package/dist/network/AutoOperation.js.map +1 -1
- package/dist/network/AutoQuery.d.ts +2 -6
- package/dist/network/AutoQuery.d.ts.map +1 -1
- package/dist/network/AutoQuery.js +7 -20
- package/dist/network/AutoQuery.js.map +1 -1
- package/dist/network/ManualInfiniteQuery.d.ts.map +1 -1
- package/dist/network/ManualInfiniteQuery.js +2 -6
- package/dist/network/ManualInfiniteQuery.js.map +1 -1
- package/dist/network/ManualMutation.d.ts +4 -2
- package/dist/network/ManualMutation.d.ts.map +1 -1
- package/dist/network/ManualMutation.js +6 -11
- package/dist/network/ManualMutation.js.map +1 -1
- package/dist/network/ManualOperation.d.ts +0 -2
- package/dist/network/ManualOperation.d.ts.map +1 -1
- package/dist/network/ManualOperation.js +0 -18
- package/dist/network/ManualOperation.js.map +1 -1
- package/dist/network/ManualQuery.d.ts +3 -7
- package/dist/network/ManualQuery.d.ts.map +1 -1
- package/dist/network/ManualQuery.js +7 -26
- package/dist/network/ManualQuery.js.map +1 -1
- package/dist/network/ReactQueryNetworkClient.d.ts.map +1 -1
- package/dist/network/ReactQueryNetworkClient.js +2 -0
- package/dist/network/ReactQueryNetworkClient.js.map +1 -1
- package/dist/network/react-query-client.d.ts.map +1 -1
- package/dist/network/react-query-client.js +9 -1
- package/dist/network/react-query-client.js.map +1 -1
- package/dist/network/types.d.ts +11 -12
- package/dist/network/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/api/ai.ts +108 -34
- package/src/client/ai.ts +6 -0
- package/src/client/types.ts +2 -1
- package/src/index.ts +1 -0
- package/src/network/AutoInfiniteQuery.ts +13 -7
- package/src/network/AutoMutation.ts +6 -4
- package/src/network/AutoOperation.ts +4 -25
- package/src/network/AutoQuery.ts +8 -16
- package/src/network/ManualInfiniteQuery.ts +2 -5
- package/src/network/ManualMutation.ts +8 -11
- package/src/network/ManualOperation.ts +0 -14
- package/src/network/ManualQuery.ts +9 -22
- package/src/network/ReactQueryNetworkClient.ts +1 -0
- package/src/network/react-query-client.ts +9 -1
- package/src/network/types.ts +9 -12
- package/dist/error/CanceledError.d.ts +0 -8
- package/dist/error/CanceledError.d.ts.map +0 -1
- package/dist/error/CanceledError.js +0 -10
- package/dist/error/CanceledError.js.map +0 -1
- package/src/error/CanceledError.ts +0 -10
|
@@ -3,4 +3,12 @@ import { QueryClient } from '@tanstack/react-query'
|
|
|
3
3
|
/**
|
|
4
4
|
* The global, unique, Query Client for React Query.
|
|
5
5
|
*/
|
|
6
|
-
export const queryClient = new QueryClient({
|
|
6
|
+
export const queryClient = new QueryClient({
|
|
7
|
+
defaultOptions: {
|
|
8
|
+
queries: {
|
|
9
|
+
refetchOnWindowFocus: false,
|
|
10
|
+
retry: false,
|
|
11
|
+
staleTime: Infinity,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
})
|
package/src/network/types.ts
CHANGED
|
@@ -136,15 +136,6 @@ export interface OperationObject<Variables> {
|
|
|
136
136
|
* @returns the query key.
|
|
137
137
|
*/
|
|
138
138
|
getPermissionKey: (...args: Variables extends void ? [] : [variables?: Partial<Variables>]) => any[],
|
|
139
|
-
/**
|
|
140
|
-
* Cancels the request if it hasn't finished yet.
|
|
141
|
-
*
|
|
142
|
-
* A canceled request will fail by throwing a `CanceledError`.
|
|
143
|
-
*
|
|
144
|
-
* @param variables the variables for the operation. If not provided, this will cancel all requests in progress for this operation.
|
|
145
|
-
* @returns true if any request has been canceled, false otherwise.
|
|
146
|
-
*/
|
|
147
|
-
cancel: (variables?: Partial<Variables>) => boolean,
|
|
148
139
|
}
|
|
149
140
|
|
|
150
141
|
export type UseQueryObjectOptions<Result> = Omit<UseQueryOptions<Result, StackspotAPIError>, 'queryFn' | 'queryKey'>
|
|
@@ -200,6 +191,12 @@ export interface QueryObject<Variables, Result> extends OperationObject<Variable
|
|
|
200
191
|
* @returns the query key.
|
|
201
192
|
*/
|
|
202
193
|
getKey: (...args: Variables extends void ? [] : [variables?: Partial<Variables>]) => any[],
|
|
194
|
+
/**
|
|
195
|
+
* Cancels the query if it hasn't finished yet.
|
|
196
|
+
*
|
|
197
|
+
* @param variables the variables for the operation. If not provided, this will cancel all requests in progress for this query.
|
|
198
|
+
*/
|
|
199
|
+
cancel: (variables?: Partial<Variables>) => void,
|
|
203
200
|
}
|
|
204
201
|
|
|
205
202
|
export type UseInfiniteQueryObjectOptions<Result> = Omit<
|
|
@@ -263,7 +260,7 @@ export interface MutationObject<Variables, Result> extends OperationObject<Varia
|
|
|
263
260
|
* @param args the variables for the mutation.
|
|
264
261
|
* @returns a promise that resolves to the response's data.
|
|
265
262
|
*/
|
|
266
|
-
mutate: (...args: Variables extends void ? [] : [variables: Variables]) => Promise<Result>,
|
|
263
|
+
mutate: (...args: Variables extends void ? [signal?: AbortSignal] : [variables: Variables, signal?: AbortSignal]) => Promise<Result>,
|
|
267
264
|
/**
|
|
268
265
|
* A React hook equivalent to React Query's `useMutation`. It creates a mutation function and the mutation states.
|
|
269
266
|
* @param options the options for `useMutation`
|
|
@@ -274,7 +271,7 @@ export interface MutationObject<Variables, Result> extends OperationObject<Varia
|
|
|
274
271
|
* - [3]: the original UseMutationResult object, from ReactQuery.
|
|
275
272
|
*
|
|
276
273
|
*/
|
|
277
|
-
useMutation: (options?: Omit<UseMutationOptions<Result, StackspotAPIError, Variables>, 'mutationFn'>) =>
|
|
274
|
+
useMutation: (options?: Omit<UseMutationOptions<Result, StackspotAPIError, Variables>, 'mutationFn'> & { signal?: AbortSignal }) =>
|
|
278
275
|
Readonly<[
|
|
279
276
|
(...args: Variables extends void
|
|
280
277
|
? [options?: MutateOptions<Result, StackspotAPIError>]
|
|
@@ -286,7 +283,7 @@ export interface MutationObject<Variables, Result> extends OperationObject<Varia
|
|
|
286
283
|
]>,
|
|
287
284
|
}
|
|
288
285
|
|
|
289
|
-
export type OperationVariables<T extends Pick<OperationObject<any>, '
|
|
286
|
+
export type OperationVariables<T extends Pick<OperationObject<any>, 'isAllowed'>> = T extends Pick<OperationObject<infer R>, 'isAllowed'>
|
|
290
287
|
? R
|
|
291
288
|
: never
|
|
292
289
|
export type OperationResult<T extends { query: (variables?: any) => Promise<any> } | { mutate: (variables?: any) => Promise<any> }> =
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { StackspotAPIError } from './StackspotAPIError.js';
|
|
2
|
-
/**
|
|
3
|
-
* This error is thrown when a request is canceled by the user before it completes.
|
|
4
|
-
*/
|
|
5
|
-
export declare class CanceledError extends StackspotAPIError {
|
|
6
|
-
constructor();
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=CanceledError.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CanceledError.d.ts","sourceRoot":"","sources":["../../src/error/CanceledError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD;;GAEG;AACH,qBAAa,aAAc,SAAQ,iBAAiB;;CAInD"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { StackspotAPIError } from './StackspotAPIError.js';
|
|
2
|
-
/**
|
|
3
|
-
* This error is thrown when a request is canceled by the user before it completes.
|
|
4
|
-
*/
|
|
5
|
-
export class CanceledError extends StackspotAPIError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super({ status: 0, message: lang => lang === 'en' ? 'Canceled by the user' : 'Cancelado pelo usuário' });
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=CanceledError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CanceledError.js","sourceRoot":"","sources":["../../src/error/CanceledError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAClD;QACE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,wBAAwB,EAAE,CAAC,CAAA;IAC1G,CAAC;CACF"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { StackspotAPIError } from './StackspotAPIError'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This error is thrown when a request is canceled by the user before it completes.
|
|
5
|
-
*/
|
|
6
|
-
export class CanceledError extends StackspotAPIError {
|
|
7
|
-
constructor() {
|
|
8
|
-
super({ status: 0, message: lang => lang === 'en' ? 'Canceled by the user' : 'Cancelado pelo usuário' })
|
|
9
|
-
}
|
|
10
|
-
}
|