@orval/query 6.12.0 → 6.12.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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@
29
29
  ${_core.toObjectString.call(void 0, i,"implementation")} ${w} ): Promise<AxiosResponse<${t.definition.success||"unknown"}>> => {${v}
30
30
  return axios${T?"":".default"}.${u}(${R});
31
31
  }
32
- `},re={INFINITE:"infiniteQuery",QUERY:"query"},pt=["getNextPageParam","getPreviousPageParam"],ht=({params:e,options:n,type:r})=>{var s;if(n===!1)return"";let t=_core.isObject.call(void 0, n)?` ${(s=_core.stringify.call(void 0, _lodashomitby2.default.call(void 0, n,(o,i)=>r!==re.INFINITE&&pt.includes(i))))==null?void 0:s.slice(1,-1)}`:"";return e.length?`${!_core.isObject.call(void 0, n)||!n.hasOwnProperty("enabled")?`enabled: !!(${e.map(({name:o})=>o).join(" && ")}),`:""}${t} ...queryOptions`:n?`{${t} ...queryOptions}`:"...queryOptions"},gt=e=>e?e.hasSecondArg&&!e.isHook?`request?: SecondParameter<typeof ${e.name}>`:e.hasSecondArg&&e.isHook?`request?: SecondParameter<ReturnType<typeof ${e.name}>>`:"":"axios?: AxiosRequestConfig",un=({operationName:e,definitions:n,mutator:r,isRequestOptions:t,type:s,hasSvelteQueryV4:o})=>{let i=r==null?void 0:r.isHook,u=o?"Create":"Use",l=s?`${u}${_core.pascal.call(void 0, s)}Options<Awaited<ReturnType<${i?`ReturnType<typeof use${_core.pascal.call(void 0, e)}Hook>`:`typeof ${e}`}>>, TError, TData>`:`${u}MutationOptions<Awaited<ReturnType<${i?`ReturnType<typeof use${_core.pascal.call(void 0, e)}Hook>`:`typeof ${e}`}>>, TError,${n?`{${n}}`:"TVariables"}, TContext>`;if(!t)return`${s?"queryOptions":"mutationOptions"}?: ${l}`;let y=gt(r);return`options?: { ${s?"query":"mutation"}?:${l}, ${y}}
32
+ `},re={INFINITE:"infiniteQuery",QUERY:"query"},pt=["getNextPageParam","getPreviousPageParam"],ht=({params:e,options:n,type:r})=>{var s;if(n===!1)return"";let t=_core.isObject.call(void 0, n)?` ${(s=_core.stringify.call(void 0, _lodashomitby2.default.call(void 0, n,(o,i)=>r!==re.INFINITE&&pt.includes(i))))==null?void 0:s.slice(1,-1)}`:"";return e.length?`${!_core.isObject.call(void 0, n)||!n.hasOwnProperty("enabled")?`enabled: !!(${e.map(({name:o})=>o).join(" && ")}),`:""}${t} ...queryOptions`:n?`${t} ...queryOptions`:"...queryOptions"},gt=e=>e?e.hasSecondArg&&!e.isHook?`request?: SecondParameter<typeof ${e.name}>`:e.hasSecondArg&&e.isHook?`request?: SecondParameter<ReturnType<typeof ${e.name}>>`:"":"axios?: AxiosRequestConfig",un=({operationName:e,definitions:n,mutator:r,isRequestOptions:t,type:s,hasSvelteQueryV4:o})=>{let i=r==null?void 0:r.isHook,u=o?"Create":"Use",l=s?`${u}${_core.pascal.call(void 0, s)}Options<Awaited<ReturnType<${i?`ReturnType<typeof use${_core.pascal.call(void 0, e)}Hook>`:`typeof ${e}`}>>, TError, TData>`:`${u}MutationOptions<Awaited<ReturnType<${i?`ReturnType<typeof use${_core.pascal.call(void 0, e)}Hook>`:`typeof ${e}`}>>, TError,${n?`{${n}}`:"TVariables"}, TContext>`;if(!t)return`${s?"queryOptions":"mutationOptions"}?: ${l}`;let y=gt(r);return`options?: { ${s?"query":"mutation"}?:${l}, ${y}}
33
33
  `},bt=({outputClient:e,type:n,isMutatorHook:r,operationName:t,hasVueQueryV4:s,hasSvelteQueryV4:o})=>{switch(e){case _core.OutputClient.SVELTE_QUERY:return o?`Create${_core.pascal.call(void 0, n)}Result<TData, TError> & { queryKey: QueryKey }`:`Use${_core.pascal.call(void 0, n)}StoreResult<Awaited<ReturnType<${r?`ReturnType<typeof use${_core.pascal.call(void 0, t)}Hook>`:`typeof ${t}`}>>, TError, TData, QueryKey> & { queryKey: QueryKey }`;case _core.OutputClient.VUE_QUERY:return s?n!==re.INFINITE?"UseQueryReturnType<TData, TError> & { queryKey: QueryKey }":"UseInfiniteQueryReturnType<TData, TError> & { queryKey: QueryKey }":` UseQueryReturnType<TData, TError, Use${_core.pascal.call(void 0, n)}Result<TData, TError>> & { queryKey: QueryKey }`;case _core.OutputClient.REACT_QUERY:default:return` Use${_core.pascal.call(void 0, n)}Result<TData, TError> & { queryKey: QueryKey }`}},mt=({isRequestOptions:e,mutator:n,isExactOptionalPropertyTypes:r,hasSignal:t})=>!n&&e?t?`{ ${r?"...(signal ? { signal } : {})":"signal"}, ...axiosOptions }`:"axiosOptions":(n==null?void 0:n.hasSecondArg)&&e?t?"requestOptions, signal":"requestOptions":t?"signal":"",$t=({isRequestOptions:e,mutator:n})=>{if(!e)return"";let r="const {query: queryOptions";return n||(r+=", axios: axiosOptions"),n!=null&&n.hasSecondArg&&(r+=", request: requestOptions"),r+="} = options ?? {};",r},Et=({hasQueryParam:e,hasSignal:n})=>!e&&!n?"":e?n?"{ signal, pageParam }":"{ pageParam }":"{ signal }",Ot=({queryOption:{name:e,queryParam:n,options:r,type:t},operationName:s,queryKeyFnName:o,queryProperties:i,queryKeyProperties:u,params:l,props:y,mutator:a,queryOptionsMutator:d,queryKeyMutator:h,isRequestOptions:m,response:O,outputClient:f,isExactOptionalPropertyTypes:$,hasSignal:T,route:P,hasVueQueryV4:I,hasSvelteQueryV4:v})=>{let R=_core.toObjectString.call(void 0, y,"implementation"),w=n?y.map(({name:b})=>b==="params"?`{ ${n}: pageParam, ...params }`:b).join(","):i,Q=bt({outputClient:f,type:t,isMutatorHook:a==null?void 0:a.isHook,operationName:s,hasVueQueryV4:I,hasSvelteQueryV4:v}),x=`AxiosError<${O.definition.errors||"unknown"}>`;a&&(x=a.hasErrorType?`${a.default?_core.pascal.call(void 0, s):""}ErrorType<${O.definition.errors||"unknown"}>`:O.definition.errors||"unknown");let k=a!=null&&a.isHook?`ReturnType<typeof use${_core.pascal.call(void 0, s)}Hook>`:`typeof ${s}`,S=un({operationName:s,definitions:"",mutator:a,isRequestOptions:m,type:t,hasSvelteQueryV4:v}),j=mt({isRequestOptions:m,isExactOptionalPropertyTypes:$,mutator:a,hasSignal:T}),z=$t({isRequestOptions:m,mutator:a}),X=Et({hasQueryParam:!!n&&y.some(({type:b})=>b==="queryParam"),hasSignal:T}),V=v?"create":"use";return`
34
34
  export type ${_core.pascal.call(void 0, e)}QueryResult = NonNullable<Awaited<ReturnType<${k}>>>
35
35
  export type ${_core.pascal.call(void 0, e)}QueryError = ${x}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orval/query",
3
- "version": "6.12.0",
3
+ "version": "6.12.1",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "lint": "eslint src/**/*.ts"
14
14
  },
15
15
  "dependencies": {
16
- "@orval/core": "6.12.0",
16
+ "@orval/core": "6.12.1",
17
17
  "lodash.omitby": "^4.6.0"
18
18
  },
19
19
  "devDependencies": {