@qualisero/openapi-endpoint 0.16.0 → 0.17.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/README.md +10 -1
- package/dist/cli.js +10 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -118,10 +118,19 @@ await createPet.mutateAsync({ data: { name: 'Fluffy' } })
|
|
|
118
118
|
const updatePet = api.updatePet.useMutation({ petId: '123' })
|
|
119
119
|
await updatePet.mutateAsync({ data: { name: 'Updated' } })
|
|
120
120
|
|
|
121
|
-
//
|
|
121
|
+
// Deferred path params: omit at hook time, provide at call time
|
|
122
122
|
const deletePet = api.deletePet.useMutation()
|
|
123
123
|
await deletePet.mutateAsync({ pathParams: { petId: '123' } })
|
|
124
124
|
|
|
125
|
+
// Deferred path params with options
|
|
126
|
+
const updateWithCache = api.updatePet.useMutation(undefined, {
|
|
127
|
+
invalidateOperations: { listPets: {} },
|
|
128
|
+
})
|
|
129
|
+
await updateWithCache.mutateAsync({
|
|
130
|
+
data: { name: 'Updated' },
|
|
131
|
+
pathParams: { petId: '123' },
|
|
132
|
+
})
|
|
133
|
+
|
|
125
134
|
// With options
|
|
126
135
|
const mutation = api.createPet.useMutation({
|
|
127
136
|
dontInvalidate: true,
|
package/dist/cli.js
CHANGED
|
@@ -973,9 +973,15 @@ function _mutationWithParams<Op extends AllOps>(
|
|
|
973
973
|
type Response = ApiResponse<Op>
|
|
974
974
|
type QueryParams = ApiQueryParams<Op>
|
|
975
975
|
|
|
976
|
-
//
|
|
977
|
-
//
|
|
976
|
+
// Three-overload interface:
|
|
977
|
+
// 1. Deferred path params — omit or pass undefined/null; supply at mutateAsync() time via pathParams variable
|
|
978
|
+
// 2. Eager path params — object, Ref, or ComputedRef (exact via object-literal checking)
|
|
979
|
+
// 3. Getter function — exact via NoExcessReturn constraint
|
|
978
980
|
type _UseMutation = {
|
|
981
|
+
(
|
|
982
|
+
pathParams?: undefined | null,
|
|
983
|
+
options?: MutationOptions<Response, PathParams, RequestBody, QueryParams>,
|
|
984
|
+
): MutationReturn<Response, PathParams, RequestBody, QueryParams>
|
|
979
985
|
(
|
|
980
986
|
pathParams: PathParamsInput | Ref<PathParamsInput> | ComputedRef<PathParamsInput>,
|
|
981
987
|
options?: MutationOptions<Response, PathParams, RequestBody, QueryParams>,
|
|
@@ -987,7 +993,7 @@ function _mutationWithParams<Op extends AllOps>(
|
|
|
987
993
|
}
|
|
988
994
|
|
|
989
995
|
const _impl = (
|
|
990
|
-
pathParams: ReactiveOr<PathParamsInput
|
|
996
|
+
pathParams: ReactiveOr<PathParamsInput> | undefined | null,
|
|
991
997
|
options?: MutationOptions<Response, PathParams, RequestBody, QueryParams>,
|
|
992
998
|
): MutationReturn<Response, PathParams, RequestBody, QueryParams> =>
|
|
993
999
|
useEndpointMutation<Response, PathParams, RequestBody, QueryParams>(
|
|
@@ -1009,7 +1015,7 @@ function _mutationWithParams<Op extends AllOps>(
|
|
|
1009
1015
|
* - \`isPending\`: Alias for isLoading
|
|
1010
1016
|
* - \`status\`: 'idle' | 'pending' | 'error' | 'success'
|
|
1011
1017
|
*
|
|
1012
|
-
* @param pathParams - Path parameters (object, ref, computed, or
|
|
1018
|
+
* @param pathParams - Path parameters (object, ref, computed, getter function, or undefined/null for deferred supply at call time)
|
|
1013
1019
|
* @param options - Mutation options (onSuccess, onError, etc.)
|
|
1014
1020
|
* @returns Mutation result object
|
|
1015
1021
|
*/
|