@shipengine/react-api 2.6.0 → 2.7.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/react-api",
3
- "version": "2.6.0",
3
+ "version": "2.7.1",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -2,3 +2,4 @@ export * from "./delay";
2
2
  export * from "./error";
3
3
  export * from "./logger";
4
4
  export * from "./retry";
5
+ export * from "./types";
@@ -0,0 +1,19 @@
1
+ import { UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
2
+ import { AxiosResponse } from "axios";
3
+ import { CodedError } from "@shipengine/js-api";
4
+ /**
5
+ * @category Entities
6
+ * Generic object type to be used in any useQuery hook
7
+ * @param TResponseData - The response data type from the query
8
+ * @param TQueryFnParams - The data type for the queryFnParams
9
+ */
10
+ export type QueryProps<TResponseData, TQueryFnParams = unknown> = {
11
+ queryFnParams?: TQueryFnParams;
12
+ } & Pick<UseQueryOptions<AxiosResponse<TResponseData, any>, CodedError[], TResponseData>, "enabled">;
13
+ /**
14
+ * @category Entities
15
+ * Generic object type to be used in any useMutation hook
16
+ * @param TMutationInput - The input data type for the mutation
17
+ * @param TResponseData - The response data type from the mutation
18
+ */
19
+ export type MutationProps<TMutationInput, TResponseData, TError = CodedError[], TContext = unknown> = Pick<UseMutationOptions<TResponseData, TError, TMutationInput, TContext>, "retry">;