@squonk/account-server-client 0.1.31 → 0.1.32-rc.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/asset/asset.cjs +130 -0
- package/asset/asset.cjs.map +1 -0
- package/asset/asset.d.ts +126 -0
- package/asset/asset.js +130 -0
- package/asset/asset.js.map +1 -0
- package/asset/package.json +7 -0
- package/{custom-instance-13412a15.d.ts → custom-instance-6b9df5d3.d.ts} +124 -34
- package/index.cjs +20 -2
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +20 -2
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +48 -0
- package/merchant/merchant.cjs.map +1 -0
- package/merchant/merchant.d.ts +39 -0
- package/merchant/merchant.js +48 -0
- package/merchant/merchant.js.map +1 -0
- package/merchant/package.json +7 -0
- package/organisation/organisation.cjs +12 -12
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +10 -9
- package/organisation/organisation.js +12 -12
- package/organisation/organisation.js.map +1 -1
- package/package.json +9 -9
- package/product/product.cjs +36 -26
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +17 -16
- package/product/product.js +36 -26
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +152 -46
- package/src/asset/asset.ts +430 -0
- package/src/merchant/merchant.ts +145 -0
- package/src/organisation/organisation.ts +37 -37
- package/src/product/product.ts +91 -74
- package/src/state/state.ts +19 -16
- package/src/unit/unit.ts +64 -56
- package/src/user/user.ts +63 -62
- package/state/state.cjs +6 -4
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +7 -6
- package/state/state.js +6 -4
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +22 -18
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +14 -13
- package/unit/unit.js +22 -18
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +22 -20
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +14 -13
- package/user/user.js +22 -20
- package/user/user.js.map +1 -1
- package/service/package.json +0 -7
- package/service/service.cjs +0 -44
- package/service/service.cjs.map +0 -1
- package/service/service.d.ts +0 -49
- package/service/service.js +0 -44
- package/service/service.js.map +0 -1
- package/src/service/service.ts +0 -136
package/unit/unit.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/unit/unit.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAyCO,IAAM,uBAAuB,CAClC,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,MAAM,GACpD,OACF;AACF;AAEO,IAAM,kCAAkC,CAAC,UAAkB;AAAA,EAChE,iBAAiB;AACnB;AAOO,IAAM,0BAA0B,CAIrC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WACJ,8CAAc,aAAY,gCAAgC,KAAK;AAEjE,QAAM,UAEF,MAAM,qBAAqB,OAAO,cAAc;AAEpD,QAAM,QAAQ,SAIZ,UAAU,SAAS,iBAAE,SAAS,CAAC,CAAC,SAAU,aAAc;AAE1D,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,yBAAyB,CACpC,OACA,8BACA,YACG;AACH,SAAO,eACL;AAAA,IACE,KAAK,iBAAiB;AAAA,IACtB,QAAQ;AAAA,IACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,IAC9C,MAAM;AAAA,EACR,GACA,OACF;AACF;AAQO,IAAM,4BAA4B,CAGvC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,OAAO,SAAS,SAAS,CAAC;AAElC,WAAO,uBAAuB,OAAO,MAAM,cAAc;AAAA,EAC3D;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,UAAU,CACrB,OACA,QACA,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ACG;AAEP;AAOO,IAAM,oBAAoB,CAC/B,YACG;AACH,SAAO,eACL,EAAE,KAAK,SAAS,QAAQ,MAAM,GAC9B,OACF;AACF;AAQO,IAAM,uBAAuB,CAIlC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,MAAM;AACR,WAAO,kBAAkB,cAAc;AAAA,EACzC;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,oBAAoB,CAC/B,YACG;AACH,SAAO,eAAqB,EAAE,KAAK,SAAS,QAAQ,SAAS,GAAG,OAAO;AACzE;AAQO,IAAM,uBAAuB,CAIlC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,MAAM;AACR,WAAO,kBAAkB,cAAc;AAAA,EACzC;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B","sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n OrganisationUnitsGetResponse,\n AsError,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n UnitGetResponse,\n UnitsGetResponse,\n PersonalUnitPutResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets Organisational Units you have access to or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n AsyncReturnType<typeof getOrganisationUnits>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = AsyncReturnType<typeof getOrganisationUnits>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisationUnits>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getOrganisationUnits>\n > = () => getOrganisationUnits(orgId, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisationUnits>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a new organisation unit. You need to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Create a new Organisational Unit\n */\nexport const createOrganisationUnit = (\n orgId: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitPostResponse>(\n {\n url: `/organisation/${orgId}/unit`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n AsyncReturnType<typeof createOrganisationUnit>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createOrganisationUnit>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createOrganisationUnit>,\n { orgId: string; data: OrganisationUnitPostBodyBody }\n > = (props) => {\n const { orgId, data } = props || {};\n\n return createOrganisationUnit(orgId, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createOrganisationUnit>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units\n\n * @summary Gets a Unit\n */\nexport const getUnit = (\n orgId: string,\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/organisation/${orgId}/unit/${unitId}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (orgId: string, unitId: string) => [\n `/organisation/${orgId}/unit/${unitId}`,\n];\n\nexport type GetUnitQueryResult = NonNullable<AsyncReturnType<typeof getUnit>>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = AsyncReturnType<typeof getUnit>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n unitId: string,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getUnit>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(orgId, unitId);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getUnit>> = () =>\n getUnit(orgId, unitId, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getUnit>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!(orgId && unitId), ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products\n\n * @summary Deletes an Organisational Unit\n */\nexport const deleteOrganisationUnit = (\n orgId: string,\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n AsyncReturnType<typeof deleteOrganisationUnit>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n TError,\n { orgId: string; unitId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n { orgId: string; unitId: string }\n > = (props) => {\n const { orgId, unitId } = props || {};\n\n return deleteOrganisationUnit(orgId, unitId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n TError,\n { orgId: string; unitId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets all the Units that are public or you are a member of. Admin users can see all Units\n\n * @summary Gets Units\n */\nexport const getUnits = (options?: SecondParameter<typeof customInstance>) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\" },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport type GetUnitsQueryResult = NonNullable<AsyncReturnType<typeof getUnits>>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = AsyncReturnType<typeof getUnits>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getUnits>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getUnits>> = () =>\n getUnits(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getUnits>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users\n\n * @summary Create a new Independent User Unit\n */\nexport const createDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<PersonalUnitPutResponse>(\n { url: `/unit`, method: \"put\" },\n options\n );\n};\n\nexport type CreateDefaultUnitMutationResult = NonNullable<\n AsyncReturnType<typeof createDefaultUnit>\n>;\n\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createDefaultUnit>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createDefaultUnit>,\n TVariables\n > = () => {\n return createDefaultUnit(requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createDefaultUnit>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes an Independent Unit\n */\nexport const deleteDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>({ url: `/unit`, method: \"delete\" }, options);\n};\n\nexport type DeleteDefaultUnitMutationResult = NonNullable<\n AsyncReturnType<typeof deleteDefaultUnit>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/unit/unit.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAsCO,IAAM,uBAAuB,CAClC,OACA,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,OAAO,OAAO,GAC5D,OACF;AACF;AAEO,IAAM,kCAAkC,CAAC,UAAkB;AAAA,EAChE,iBAAiB;AACnB;AAOO,IAAM,0BAA0B,CAIrC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WACJ,8CAAc,aAAY,gCAAgC,KAAK;AAEjE,QAAM,UAEF,CAAC,EAAE,aAAa,qBAAqB,OAAO,gBAAgB,MAAM;AAEtE,QAAM,QAAQ,S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B","sourcesContent":["/**\n * Generated by orval v6.8.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n OrganisationUnitsGetResponse,\n AsError,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n UnitGetResponse,\n UnitsGetResponse,\n PersonalUnitPutResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\nexport type AwaitedInput<T> = PromiseLike<T> | T;\n\nexport type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets Organisational Units you have access to or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n > = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a new organisation unit. You need to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Create a new Organisational Unit\n */\nexport const createOrganisationUnit = (\n orgId: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitPostResponse>(\n {\n url: `/organisation/${orgId}/unit`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createOrganisationUnit>>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n { orgId: string; data: OrganisationUnitPostBodyBody }\n > = (props) => {\n const { orgId, data } = props ?? {};\n\n return createOrganisationUnit(orgId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units\n\n * @summary Gets a Unit\n */\nexport const getUnit = (\n orgId: string,\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/organisation/${orgId}/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (orgId: string, unitId: string) => [\n `/organisation/${orgId}/unit/${unitId}`,\n];\n\nexport type GetUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnit>>\n>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = Awaited<ReturnType<typeof getUnit>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n unitId: string,\n options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(orgId, unitId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({\n signal,\n }) => getUnit(orgId, unitId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnit>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!(orgId && unitId), ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products\n\n * @summary Deletes an Organisational Unit\n */\nexport const deleteOrganisationUnit = (\n orgId: string,\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { orgId: string; unitId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n { orgId: string; unitId: string }\n > = (props) => {\n const { orgId, unitId } = props ?? {};\n\n return deleteOrganisationUnit(orgId, unitId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { orgId: string; unitId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets all the Units that are public or you are a member of. Admin users can see all Units\n\n * @summary Gets Units\n */\nexport const getUnits = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport type GetUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnits>>\n>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = Awaited<ReturnType<typeof getUnits>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({\n signal,\n }) => getUnits(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnits>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users\n\n * @summary Create a new Independent User Unit\n */\nexport const createDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<PersonalUnitPutResponse>(\n { url: `/unit`, method: \"put\" },\n options\n );\n};\n\nexport type CreateDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createDefaultUnit>>\n>;\n\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TVariables\n > = () => {\n return createDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes an Independent Unit\n */\nexport const deleteDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>({ url: `/unit`, method: \"delete\" }, options);\n};\n\nexport type DeleteDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteDefaultUnit>>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|
package/unit/unit.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as react_query from 'react-query';
|
|
2
2
|
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
|
|
3
|
-
import {
|
|
3
|
+
import { a9 as customInstance, Y as OrganisationUnitsGetResponse, aa as ErrorType, a5 as AsError, O as OrganisationUnitPostBodyBody, _ as OrganisationUnitPostResponse, L as UnitGetResponse, K as UnitsGetResponse, Z as PersonalUnitPutResponse } from '../custom-instance-6b9df5d3.js';
|
|
4
4
|
import 'axios';
|
|
5
5
|
|
|
6
|
-
declare type
|
|
6
|
+
declare type AwaitedInput<T> = PromiseLike<T> | T;
|
|
7
|
+
declare type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
7
8
|
declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
8
9
|
/**
|
|
9
10
|
* Gets Organisational Units you have access to or that are public
|
|
10
11
|
|
|
11
12
|
* @summary Gets Organisational Units
|
|
12
13
|
*/
|
|
13
|
-
declare const getOrganisationUnits: (orgId: string, options?: SecondParameter<typeof customInstance
|
|
14
|
+
declare const getOrganisationUnits: (orgId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<OrganisationUnitsGetResponse>;
|
|
14
15
|
declare const getGetOrganisationUnitsQueryKey: (orgId: string) => string[];
|
|
15
|
-
declare type GetOrganisationUnitsQueryResult = NonNullable<
|
|
16
|
+
declare type GetOrganisationUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnits>>>;
|
|
16
17
|
declare type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;
|
|
17
18
|
declare const useGetOrganisationUnits: <TData = OrganisationUnitsGetResponse, TError = ErrorType<void | AsError>>(orgId: string, options?: {
|
|
18
19
|
query?: UseQueryOptions<OrganisationUnitsGetResponse, TError, TData, QueryKey> | undefined;
|
|
@@ -26,7 +27,7 @@ declare const useGetOrganisationUnits: <TData = OrganisationUnitsGetResponse, TE
|
|
|
26
27
|
* @summary Create a new Organisational Unit
|
|
27
28
|
*/
|
|
28
29
|
declare const createOrganisationUnit: (orgId: string, organisationUnitPostBodyBody: OrganisationUnitPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<OrganisationUnitPostResponse>;
|
|
29
|
-
declare type CreateOrganisationUnitMutationResult = NonNullable<
|
|
30
|
+
declare type CreateOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisationUnit>>>;
|
|
30
31
|
declare type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;
|
|
31
32
|
declare type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;
|
|
32
33
|
declare const useCreateOrganisationUnit: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
@@ -44,9 +45,9 @@ declare const useCreateOrganisationUnit: <TError = ErrorType<void | AsError>, TC
|
|
|
44
45
|
|
|
45
46
|
* @summary Gets a Unit
|
|
46
47
|
*/
|
|
47
|
-
declare const getUnit: (orgId: string, unitId: string, options?: SecondParameter<typeof customInstance
|
|
48
|
+
declare const getUnit: (orgId: string, unitId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<UnitGetResponse>;
|
|
48
49
|
declare const getGetUnitQueryKey: (orgId: string, unitId: string) => string[];
|
|
49
|
-
declare type GetUnitQueryResult = NonNullable<
|
|
50
|
+
declare type GetUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>;
|
|
50
51
|
declare type GetUnitQueryError = ErrorType<void | AsError>;
|
|
51
52
|
declare const useGetUnit: <TData = UnitGetResponse, TError = ErrorType<void | AsError>>(orgId: string, unitId: string, options?: {
|
|
52
53
|
query?: UseQueryOptions<UnitGetResponse, TError, TData, QueryKey> | undefined;
|
|
@@ -60,7 +61,7 @@ declare const useGetUnit: <TData = UnitGetResponse, TError = ErrorType<void | As
|
|
|
60
61
|
* @summary Deletes an Organisational Unit
|
|
61
62
|
*/
|
|
62
63
|
declare const deleteOrganisationUnit: (orgId: string, unitId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
63
|
-
declare type DeleteOrganisationUnitMutationResult = NonNullable<
|
|
64
|
+
declare type DeleteOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnit>>>;
|
|
64
65
|
declare type DeleteOrganisationUnitMutationError = ErrorType<AsError>;
|
|
65
66
|
declare const useDeleteOrganisationUnit: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
66
67
|
mutation?: UseMutationOptions<void, TError, {
|
|
@@ -77,9 +78,9 @@ declare const useDeleteOrganisationUnit: <TError = ErrorType<AsError>, TContext
|
|
|
77
78
|
|
|
78
79
|
* @summary Gets Units
|
|
79
80
|
*/
|
|
80
|
-
declare const getUnits: (options?: SecondParameter<typeof customInstance
|
|
81
|
+
declare const getUnits: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<UnitsGetResponse>;
|
|
81
82
|
declare const getGetUnitsQueryKey: () => string[];
|
|
82
|
-
declare type GetUnitsQueryResult = NonNullable<
|
|
83
|
+
declare type GetUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>;
|
|
83
84
|
declare type GetUnitsQueryError = ErrorType<void | AsError>;
|
|
84
85
|
declare const useGetUnits: <TData = UnitsGetResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
85
86
|
query?: UseQueryOptions<UnitsGetResponse, TError, TData, QueryKey> | undefined;
|
|
@@ -93,7 +94,7 @@ declare const useGetUnits: <TData = UnitsGetResponse, TError = ErrorType<void |
|
|
|
93
94
|
* @summary Create a new Independent User Unit
|
|
94
95
|
*/
|
|
95
96
|
declare const createDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<PersonalUnitPutResponse>;
|
|
96
|
-
declare type CreateDefaultUnitMutationResult = NonNullable<
|
|
97
|
+
declare type CreateDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createDefaultUnit>>>;
|
|
97
98
|
declare type CreateDefaultUnitMutationError = ErrorType<AsError | void>;
|
|
98
99
|
declare const useCreateDefaultUnit: <TError = ErrorType<void | AsError>, TVariables = void, TContext = unknown>(options?: {
|
|
99
100
|
mutation?: UseMutationOptions<PersonalUnitPutResponse, TError, TVariables, TContext> | undefined;
|
|
@@ -105,11 +106,11 @@ declare const useCreateDefaultUnit: <TError = ErrorType<void | AsError>, TVariab
|
|
|
105
106
|
* @summary Deletes an Independent Unit
|
|
106
107
|
*/
|
|
107
108
|
declare const deleteDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
108
|
-
declare type DeleteDefaultUnitMutationResult = NonNullable<
|
|
109
|
+
declare type DeleteDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDefaultUnit>>>;
|
|
109
110
|
declare type DeleteDefaultUnitMutationError = ErrorType<AsError>;
|
|
110
111
|
declare const useDeleteDefaultUnit: <TError = ErrorType<AsError>, TVariables = void, TContext = unknown>(options?: {
|
|
111
112
|
mutation?: UseMutationOptions<void, TError, TVariables, TContext> | undefined;
|
|
112
113
|
request?: SecondParameter<typeof customInstance>;
|
|
113
114
|
} | undefined) => react_query.UseMutationResult<void, TError, TVariables, TContext>;
|
|
114
115
|
|
|
115
|
-
export { CreateDefaultUnitMutationError, CreateDefaultUnitMutationResult, CreateOrganisationUnitMutationBody, CreateOrganisationUnitMutationError, CreateOrganisationUnitMutationResult, DeleteDefaultUnitMutationError, DeleteDefaultUnitMutationResult, DeleteOrganisationUnitMutationError, DeleteOrganisationUnitMutationResult, GetOrganisationUnitsQueryError, GetOrganisationUnitsQueryResult, GetUnitQueryError, GetUnitQueryResult, GetUnitsQueryError, GetUnitsQueryResult, createDefaultUnit, createOrganisationUnit, deleteDefaultUnit, deleteOrganisationUnit, getGetOrganisationUnitsQueryKey, getGetUnitQueryKey, getGetUnitsQueryKey, getOrganisationUnits, getUnit, getUnits, useCreateDefaultUnit, useCreateOrganisationUnit, useDeleteDefaultUnit, useDeleteOrganisationUnit, useGetOrganisationUnits, useGetUnit, useGetUnits };
|
|
116
|
+
export { Awaited, AwaitedInput, CreateDefaultUnitMutationError, CreateDefaultUnitMutationResult, CreateOrganisationUnitMutationBody, CreateOrganisationUnitMutationError, CreateOrganisationUnitMutationResult, DeleteDefaultUnitMutationError, DeleteDefaultUnitMutationResult, DeleteOrganisationUnitMutationError, DeleteOrganisationUnitMutationResult, GetOrganisationUnitsQueryError, GetOrganisationUnitsQueryResult, GetUnitQueryError, GetUnitQueryResult, GetUnitsQueryError, GetUnitsQueryResult, createDefaultUnit, createOrganisationUnit, deleteDefaultUnit, deleteOrganisationUnit, getGetOrganisationUnitsQueryKey, getGetUnitQueryKey, getGetUnitsQueryKey, getOrganisationUnits, getUnit, getUnits, useCreateDefaultUnit, useCreateOrganisationUnit, useDeleteDefaultUnit, useDeleteOrganisationUnit, useGetOrganisationUnits, useGetUnit, useGetUnits };
|
package/unit/unit.js
CHANGED
|
@@ -8,16 +8,16 @@ import {
|
|
|
8
8
|
useQuery,
|
|
9
9
|
useMutation
|
|
10
10
|
} from "react-query";
|
|
11
|
-
var getOrganisationUnits = (orgId, options) => {
|
|
12
|
-
return customInstance({ url: `/organisation/${orgId}/unit`, method: "get" }, options);
|
|
11
|
+
var getOrganisationUnits = (orgId, options, signal) => {
|
|
12
|
+
return customInstance({ url: `/organisation/${orgId}/unit`, method: "get", signal }, options);
|
|
13
13
|
};
|
|
14
14
|
var getGetOrganisationUnitsQueryKey = (orgId) => [
|
|
15
15
|
`/organisation/${orgId}/unit`
|
|
16
16
|
];
|
|
17
17
|
var useGetOrganisationUnits = (orgId, options) => {
|
|
18
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
18
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
19
19
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUnitsQueryKey(orgId);
|
|
20
|
-
const queryFn = () => getOrganisationUnits(orgId, requestOptions);
|
|
20
|
+
const queryFn = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
|
|
21
21
|
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!orgId }, queryOptions));
|
|
22
22
|
return __spreadValues({
|
|
23
23
|
queryKey
|
|
@@ -32,23 +32,25 @@ var createOrganisationUnit = (orgId, organisationUnitPostBodyBody, options) => {
|
|
|
32
32
|
}, options);
|
|
33
33
|
};
|
|
34
34
|
var useCreateOrganisationUnit = (options) => {
|
|
35
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
35
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
36
36
|
const mutationFn = (props) => {
|
|
37
|
-
const { orgId, data } = props
|
|
37
|
+
const { orgId, data } = props ?? {};
|
|
38
38
|
return createOrganisationUnit(orgId, data, requestOptions);
|
|
39
39
|
};
|
|
40
40
|
return useMutation(mutationFn, mutationOptions);
|
|
41
41
|
};
|
|
42
|
-
var getUnit = (orgId, unitId, options) => {
|
|
43
|
-
return customInstance({ url: `/organisation/${orgId}/unit/${unitId}`, method: "get" }, options);
|
|
42
|
+
var getUnit = (orgId, unitId, options, signal) => {
|
|
43
|
+
return customInstance({ url: `/organisation/${orgId}/unit/${unitId}`, method: "get", signal }, options);
|
|
44
44
|
};
|
|
45
45
|
var getGetUnitQueryKey = (orgId, unitId) => [
|
|
46
46
|
`/organisation/${orgId}/unit/${unitId}`
|
|
47
47
|
];
|
|
48
48
|
var useGetUnit = (orgId, unitId, options) => {
|
|
49
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
49
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
50
50
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUnitQueryKey(orgId, unitId);
|
|
51
|
-
const queryFn = (
|
|
51
|
+
const queryFn = ({
|
|
52
|
+
signal
|
|
53
|
+
}) => getUnit(orgId, unitId, requestOptions, signal);
|
|
52
54
|
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!(orgId && unitId) }, queryOptions));
|
|
53
55
|
return __spreadValues({
|
|
54
56
|
queryKey
|
|
@@ -58,21 +60,23 @@ var deleteOrganisationUnit = (orgId, unitId, options) => {
|
|
|
58
60
|
return customInstance({ url: `/organisation/${orgId}/unit/${unitId}`, method: "delete" }, options);
|
|
59
61
|
};
|
|
60
62
|
var useDeleteOrganisationUnit = (options) => {
|
|
61
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
63
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
62
64
|
const mutationFn = (props) => {
|
|
63
|
-
const { orgId, unitId } = props
|
|
65
|
+
const { orgId, unitId } = props ?? {};
|
|
64
66
|
return deleteOrganisationUnit(orgId, unitId, requestOptions);
|
|
65
67
|
};
|
|
66
68
|
return useMutation(mutationFn, mutationOptions);
|
|
67
69
|
};
|
|
68
|
-
var getUnits = (options) => {
|
|
69
|
-
return customInstance({ url: `/unit`, method: "get" }, options);
|
|
70
|
+
var getUnits = (options, signal) => {
|
|
71
|
+
return customInstance({ url: `/unit`, method: "get", signal }, options);
|
|
70
72
|
};
|
|
71
73
|
var getGetUnitsQueryKey = () => [`/unit`];
|
|
72
74
|
var useGetUnits = (options) => {
|
|
73
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
75
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
74
76
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUnitsQueryKey();
|
|
75
|
-
const queryFn = (
|
|
77
|
+
const queryFn = ({
|
|
78
|
+
signal
|
|
79
|
+
}) => getUnits(requestOptions, signal);
|
|
76
80
|
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
77
81
|
return __spreadValues({
|
|
78
82
|
queryKey
|
|
@@ -82,7 +86,7 @@ var createDefaultUnit = (options) => {
|
|
|
82
86
|
return customInstance({ url: `/unit`, method: "put" }, options);
|
|
83
87
|
};
|
|
84
88
|
var useCreateDefaultUnit = (options) => {
|
|
85
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
89
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
86
90
|
const mutationFn = () => {
|
|
87
91
|
return createDefaultUnit(requestOptions);
|
|
88
92
|
};
|
|
@@ -92,7 +96,7 @@ var deleteDefaultUnit = (options) => {
|
|
|
92
96
|
return customInstance({ url: `/unit`, method: "delete" }, options);
|
|
93
97
|
};
|
|
94
98
|
var useDeleteDefaultUnit = (options) => {
|
|
95
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
99
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
96
100
|
const mutationFn = () => {
|
|
97
101
|
return deleteDefaultUnit(requestOptions);
|
|
98
102
|
};
|
package/unit/unit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/unit/unit.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n OrganisationUnitsGetResponse,\n AsError,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n UnitGetResponse,\n UnitsGetResponse,\n PersonalUnitPutResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets Organisational Units you have access to or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n AsyncReturnType<typeof getOrganisationUnits>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = AsyncReturnType<typeof getOrganisationUnits>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisationUnits>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getOrganisationUnits>\n > = () => getOrganisationUnits(orgId, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisationUnits>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a new organisation unit. You need to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Create a new Organisational Unit\n */\nexport const createOrganisationUnit = (\n orgId: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitPostResponse>(\n {\n url: `/organisation/${orgId}/unit`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n AsyncReturnType<typeof createOrganisationUnit>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createOrganisationUnit>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createOrganisationUnit>,\n { orgId: string; data: OrganisationUnitPostBodyBody }\n > = (props) => {\n const { orgId, data } = props || {};\n\n return createOrganisationUnit(orgId, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createOrganisationUnit>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units\n\n * @summary Gets a Unit\n */\nexport const getUnit = (\n orgId: string,\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/organisation/${orgId}/unit/${unitId}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (orgId: string, unitId: string) => [\n `/organisation/${orgId}/unit/${unitId}`,\n];\n\nexport type GetUnitQueryResult = NonNullable<AsyncReturnType<typeof getUnit>>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = AsyncReturnType<typeof getUnit>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n unitId: string,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getUnit>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(orgId, unitId);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getUnit>> = () =>\n getUnit(orgId, unitId, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getUnit>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!(orgId && unitId), ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products\n\n * @summary Deletes an Organisational Unit\n */\nexport const deleteOrganisationUnit = (\n orgId: string,\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n AsyncReturnType<typeof deleteOrganisationUnit>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n TError,\n { orgId: string; unitId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n { orgId: string; unitId: string }\n > = (props) => {\n const { orgId, unitId } = props || {};\n\n return deleteOrganisationUnit(orgId, unitId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n TError,\n { orgId: string; unitId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets all the Units that are public or you are a member of. Admin users can see all Units\n\n * @summary Gets Units\n */\nexport const getUnits = (options?: SecondParameter<typeof customInstance>) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\" },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport type GetUnitsQueryResult = NonNullable<AsyncReturnType<typeof getUnits>>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = AsyncReturnType<typeof getUnits>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getUnits>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getUnits>> = () =>\n getUnits(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getUnits>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users\n\n * @summary Create a new Independent User Unit\n */\nexport const createDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<PersonalUnitPutResponse>(\n { url: `/unit`, method: \"put\" },\n options\n );\n};\n\nexport type CreateDefaultUnitMutationResult = NonNullable<\n AsyncReturnType<typeof createDefaultUnit>\n>;\n\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createDefaultUnit>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createDefaultUnit>,\n TVariables\n > = () => {\n return createDefaultUnit(requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createDefaultUnit>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes an Independent Unit\n */\nexport const deleteDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>({ url: `/unit`, method: \"delete\" }, options);\n};\n\nexport type DeleteDefaultUnitMutationResult = NonNullable<\n AsyncReturnType<typeof deleteDefaultUnit>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAyCO,IAAM,uBAAuB,CAClC,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,MAAM,GACpD,OACF;AACF;AAEO,IAAM,kCAAkC,CAAC,UAAkB;AAAA,EAChE,iBAAi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M,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,MAAM;AACR,WAAO,kBAAkB,cAAc;AAAA,EACzC;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/unit/unit.ts"],"sourcesContent":["/**\n * Generated by orval v6.8.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n OrganisationUnitsGetResponse,\n AsError,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n UnitGetResponse,\n UnitsGetResponse,\n PersonalUnitPutResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\nexport type AwaitedInput<T> = PromiseLike<T> | T;\n\nexport type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets Organisational Units you have access to or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n > = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a new organisation unit. You need to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Create a new Organisational Unit\n */\nexport const createOrganisationUnit = (\n orgId: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitPostResponse>(\n {\n url: `/organisation/${orgId}/unit`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createOrganisationUnit>>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n { orgId: string; data: OrganisationUnitPostBodyBody }\n > = (props) => {\n const { orgId, data } = props ?? {};\n\n return createOrganisationUnit(orgId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units\n\n * @summary Gets a Unit\n */\nexport const getUnit = (\n orgId: string,\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/organisation/${orgId}/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (orgId: string, unitId: string) => [\n `/organisation/${orgId}/unit/${unitId}`,\n];\n\nexport type GetUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnit>>\n>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = Awaited<ReturnType<typeof getUnit>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n unitId: string,\n options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(orgId, unitId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({\n signal,\n }) => getUnit(orgId, unitId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnit>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!(orgId && unitId), ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products\n\n * @summary Deletes an Organisational Unit\n */\nexport const deleteOrganisationUnit = (\n orgId: string,\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { orgId: string; unitId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n { orgId: string; unitId: string }\n > = (props) => {\n const { orgId, unitId } = props ?? {};\n\n return deleteOrganisationUnit(orgId, unitId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { orgId: string; unitId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets all the Units that are public or you are a member of. Admin users can see all Units\n\n * @summary Gets Units\n */\nexport const getUnits = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport type GetUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnits>>\n>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = Awaited<ReturnType<typeof getUnits>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({\n signal,\n }) => getUnits(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnits>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users\n\n * @summary Create a new Independent User Unit\n */\nexport const createDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<PersonalUnitPutResponse>(\n { url: `/unit`, method: \"put\" },\n options\n );\n};\n\nexport type CreateDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createDefaultUnit>>\n>;\n\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TVariables\n > = () => {\n return createDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes an Independent Unit\n */\nexport const deleteDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>({ url: `/unit`, method: \"delete\" }, options);\n};\n\nexport type DeleteDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteDefaultUnit>>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAsCO,IAAM,uBAAuB,CAClC,OACA,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,OAAO,OAAO,GAC5D,OACF;AACF;AAEO,IAAM,kCAAkC,CAAC,UAAkB;AAAA,EAChE,iBAAiB;AACnB;AAOO,IAAM,0BAA0B,CAIrC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WACJ,8CAAc,aAAY,gCAAgC,KAAK;AAEjE,QAAM,UAEF,CAAC,EAAE,aAAa,qBAAqB,OAAO,gBAAgB,MAAM;AAEtE,QAAM,QAAQ,SAIZ,UAAU,SAAS,iBAAE,SAAS,CAAC,CAAC,SAAU,aAAc;AAE1D,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,yBAAyB,CACpC,OACA,8BACA,YACG;AACH,SAAO,eACL;AAAA,IACE,KAAK,iBAAiB;AAAA,IACtB,QAAQ;AAAA,IACR,SAAS,EAAE,gBAAgB,mBAAmB;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IAAM,WAAW,CACtB,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,SAAS,QAAQ,OAAO,OAAO,GACtC,OACF;AACF;AAEO,IAAM,sBAAsB,MAAM,CAAC,OAAO;AAO1C,IAAM,cAAc,CAGzB,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,oBAAoB;AAE/D,QAAM,UAA+D,CAAC;AAAA,IACpE;AAAA,QACI,SAAS,gBAAgB,MAAM;AAErC,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,oBAAoB,CAC/B,YACG;AACH,SAAO,eACL,EAAE,KAAK,SAAS,QAAQ,MAAM,GAC9B,OACF;AACF;AAQO,IAAM,uBAAuB,CAIlC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,MAAM;AACR,WAAO,kBAAkB,cAAc;AAAA,EACzC;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,oBAAoB,CAC/B,YACG;AACH,SAAO,eAAqB,EAAE,KAAK,SAAS,QAAQ,SAAS,GAAG,OAAO;AACzE;AAQO,IAAM,uBAAuB,CAIlC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,MAAM;AACR,WAAO,kBAAkB,cAAc;AAAA,EACzC;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;","names":[]}
|
package/user/user.cjs
CHANGED
|
@@ -8,29 +8,31 @@ var _chunkNGBTCJWScjs = require('../chunk-NGBTCJWS.cjs');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _reactquery = require('react-query');
|
|
11
|
-
var getUserAccount = (options) => {
|
|
12
|
-
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/user/account`, method: "get" }, options);
|
|
11
|
+
var getUserAccount = (options, signal) => {
|
|
12
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/user/account`, method: "get", signal }, options);
|
|
13
13
|
};
|
|
14
14
|
var getGetUserAccountQueryKey = () => [`/user/account`];
|
|
15
15
|
var useGetUserAccount = (options) => {
|
|
16
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
16
|
+
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
17
17
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetUserAccountQueryKey()));
|
|
18
|
-
const queryFn = (
|
|
18
|
+
const queryFn = ({
|
|
19
|
+
signal
|
|
20
|
+
}) => getUserAccount(requestOptions, signal);
|
|
19
21
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
20
22
|
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
21
23
|
queryKey
|
|
22
24
|
}, query);
|
|
23
25
|
};
|
|
24
|
-
var getOrganisationUsers = (orgId, options) => {
|
|
25
|
-
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/organisation/${orgId}/user`, method: "get" }, options);
|
|
26
|
+
var getOrganisationUsers = (orgId, options, signal) => {
|
|
27
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/organisation/${orgId}/user`, method: "get", signal }, options);
|
|
26
28
|
};
|
|
27
29
|
var getGetOrganisationUsersQueryKey = (orgId) => [
|
|
28
30
|
`/organisation/${orgId}/user`
|
|
29
31
|
];
|
|
30
32
|
var useGetOrganisationUsers = (orgId, options) => {
|
|
31
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
33
|
+
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
32
34
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationUsersQueryKey(orgId)));
|
|
33
|
-
const queryFn = () => getOrganisationUsers(orgId, requestOptions);
|
|
35
|
+
const queryFn = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);
|
|
34
36
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkNGBTCJWScjs.__spreadValues.call(void 0, { enabled: !!orgId }, queryOptions));
|
|
35
37
|
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
36
38
|
queryKey
|
|
@@ -40,9 +42,9 @@ var addOrganisationUser = (orgId, userId, options) => {
|
|
|
40
42
|
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/organisation/${orgId}/user/${userId}`, method: "put" }, options);
|
|
41
43
|
};
|
|
42
44
|
var useAddOrganisationUser = (options) => {
|
|
43
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
45
|
+
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
44
46
|
const mutationFn = (props) => {
|
|
45
|
-
const { orgId, userId } = props
|
|
47
|
+
const { orgId, userId } = _nullishCoalesce(props, () => ( {}));
|
|
46
48
|
return addOrganisationUser(orgId, userId, requestOptions);
|
|
47
49
|
};
|
|
48
50
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
@@ -51,23 +53,23 @@ var deleteOrganisationUser = (orgId, userId, options) => {
|
|
|
51
53
|
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/organisation/${orgId}/user/${userId}`, method: "delete" }, options);
|
|
52
54
|
};
|
|
53
55
|
var useDeleteOrganisationUser = (options) => {
|
|
54
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
56
|
+
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
55
57
|
const mutationFn = (props) => {
|
|
56
|
-
const { orgId, userId } = props
|
|
58
|
+
const { orgId, userId } = _nullishCoalesce(props, () => ( {}));
|
|
57
59
|
return deleteOrganisationUser(orgId, userId, requestOptions);
|
|
58
60
|
};
|
|
59
61
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
60
62
|
};
|
|
61
|
-
var getOrganisationUnitUsers = (unitId, options) => {
|
|
62
|
-
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/unit/${unitId}/user`, method: "get" }, options);
|
|
63
|
+
var getOrganisationUnitUsers = (unitId, options, signal) => {
|
|
64
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/unit/${unitId}/user`, method: "get", signal }, options);
|
|
63
65
|
};
|
|
64
66
|
var getGetOrganisationUnitUsersQueryKey = (unitId) => [
|
|
65
67
|
`/unit/${unitId}/user`
|
|
66
68
|
];
|
|
67
69
|
var useGetOrganisationUnitUsers = (unitId, options) => {
|
|
68
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
70
|
+
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
69
71
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationUnitUsersQueryKey(unitId)));
|
|
70
|
-
const queryFn = () => getOrganisationUnitUsers(unitId, requestOptions);
|
|
72
|
+
const queryFn = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);
|
|
71
73
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkNGBTCJWScjs.__spreadValues.call(void 0, { enabled: !!unitId }, queryOptions));
|
|
72
74
|
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
73
75
|
queryKey
|
|
@@ -77,9 +79,9 @@ var addOrganisationUnitUser = (unitId, userId, options) => {
|
|
|
77
79
|
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/unit/${unitId}/user/${userId}`, method: "put" }, options);
|
|
78
80
|
};
|
|
79
81
|
var useAddOrganisationUnitUser = (options) => {
|
|
80
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
82
|
+
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
81
83
|
const mutationFn = (props) => {
|
|
82
|
-
const { unitId, userId } = props
|
|
84
|
+
const { unitId, userId } = _nullishCoalesce(props, () => ( {}));
|
|
83
85
|
return addOrganisationUnitUser(unitId, userId, requestOptions);
|
|
84
86
|
};
|
|
85
87
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
@@ -88,9 +90,9 @@ var deleteOrganisationUnitUser = (unitId, userId, options) => {
|
|
|
88
90
|
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/unit/${unitId}/user/${userId}`, method: "delete" }, options);
|
|
89
91
|
};
|
|
90
92
|
var useDeleteOrganisationUnitUser = (options) => {
|
|
91
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
93
|
+
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
92
94
|
const mutationFn = (props) => {
|
|
93
|
-
const { unitId, userId } = props
|
|
95
|
+
const { unitId, userId } = _nullishCoalesce(props, () => ( {}));
|
|
94
96
|
return deleteOrganisationUnitUser(unitId, userId, requestOptions);
|
|
95
97
|
};
|
|
96
98
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
package/user/user.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/user/user.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAqCO,IAAM,iBAAiB,CAC5B,YACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,QAAQ,MAAM,GACtC,OACF;AACF;AAEO,IAAM,4BAA4B,MAAM,CAAC,eAAe;AAOxD,IAAM,oBAAoB,CAG/B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,0BAA0B;AAErE,QAAM,UAAiE,MACrE,eAAe,cAAc;AAE/B,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,uBAA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Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n UserAccountGetResponse,\n AsError,\n UsersGetResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Returns a summary of your account\n\n * @summary Get information about your account\n */\nexport const getUserAccount = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UserAccountGetResponse>(\n { url: `/user/account`, method: \"get\" },\n options\n );\n};\n\nexport const getGetUserAccountQueryKey = () => [`/user/account`];\n\nexport type GetUserAccountQueryResult = NonNullable<\n AsyncReturnType<typeof getUserAccount>\n>;\nexport type GetUserAccountQueryError = ErrorType<void | AsError>;\n\nexport const useGetUserAccount = <\n TData = AsyncReturnType<typeof getUserAccount>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getUserAccount>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getUserAccount>> = () =>\n getUserAccount(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getUserAccount>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets users in an Organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Gets users in an organisation\n */\nexport const getOrganisationUsers = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/organisation/${orgId}/user`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationUsersQueryKey = (orgId: string) => [\n `/organisation/${orgId}/user`,\n];\n\nexport type GetOrganisationUsersQueryResult = NonNullable<\n AsyncReturnType<typeof getOrganisationUsers>\n>;\nexport type GetOrganisationUsersQueryError = ErrorType<AsError | void>;\n\nexport const useGetOrganisationUsers = <\n TData = AsyncReturnType<typeof getOrganisationUsers>,\n TError = ErrorType<AsError | void>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisationUsers>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getOrganisationUsers>\n > = () => getOrganisationUsers(orgId, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisationUsers>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Adds a user to an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Adds a user to an organisation\n */\nexport const addOrganisationUser = (\n orgId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/user/${userId}`, method: \"put\" },\n options\n );\n};\n\nexport type AddOrganisationUserMutationResult = NonNullable<\n AsyncReturnType<typeof addOrganisationUser>\n>;\n\nexport type AddOrganisationUserMutationError = ErrorType<AsError>;\n\nexport const useAddOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof addOrganisationUser>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof addOrganisationUser>,\n { orgId: string; userId: string }\n > = (props) => {\n const { orgId, userId } = props || {};\n\n return addOrganisationUser(orgId, userId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof addOrganisationUser>,\n TError,\n { orgId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Removes a user from an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Deletes a user from an organisation\n */\nexport const deleteOrganisationUser = (\n orgId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/user/${userId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUserMutationResult = NonNullable<\n AsyncReturnType<typeof deleteOrganisationUser>\n>;\n\nexport type DeleteOrganisationUserMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisationUser>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteOrganisationUser>,\n { orgId: string; userId: string }\n > = (props) => {\n const { orgId, userId } = props || {};\n\n return deleteOrganisationUser(orgId, userId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisationUser>,\n TError,\n { orgId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets users in an Organisational Unit. You have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Gets users in an Organisational Unit\n */\nexport const getOrganisationUnitUsers = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/unit/${unitId}/user`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationUnitUsersQueryKey = (unitId: string) => [\n `/unit/${unitId}/user`,\n];\n\nexport type GetOrganisationUnitUsersQueryResult = NonNullable<\n AsyncReturnType<typeof getOrganisationUnitUsers>\n>;\nexport type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;\n\nexport const useGetOrganisationUnitUsers = <\n TData = AsyncReturnType<typeof getOrganisationUnitUsers>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisationUnitUsers>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getOrganisationUnitUsers>\n > = () => getOrganisationUnitUsers(unitId, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisationUnitUsers>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!unitId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Adds a user to an Organisational Unit.\n\nUsers cannot be added to **Independent Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Adds a user to an Organisational Unit\n */\nexport const addOrganisationUnitUser = (\n unitId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}/user/${userId}`, method: \"put\" },\n options\n );\n};\n\nexport type AddOrganisationUnitUserMutationResult = NonNullable<\n AsyncReturnType<typeof addOrganisationUnitUser>\n>;\n\nexport type AddOrganisationUnitUserMutationError = ErrorType<AsError>;\n\nexport const useAddOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof addOrganisationUnitUser>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof addOrganisationUnitUser>,\n { unitId: string; userId: string }\n > = (props) => {\n const { unitId, userId } = props || {};\n\n return addOrganisationUnitUser(unitId, userId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof addOrganisationUnitUser>,\n TError,\n { unitId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Removes a user from an Organisational Unit.\n\nUsers cannot be removed from **Independent Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Deletes a user from an Organisational Unit\n */\nexport const deleteOrganisationUnitUser = (\n unitId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}/user/${userId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitUserMutationResult = NonNullable<\n AsyncReturnType<typeof deleteOrganisationUnitUser>\n>;\n\nexport type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisationUnitUser>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteOrganisationUnitUser>,\n { unitId: string; userId: string }\n > = (props) => {\n const { unitId, userId } = props || {};\n\n return deleteOrganisationUnitUser(unitId, userId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisationUnitUser>,\n TError,\n { unitId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/user/user.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAkCO,IAAM,iBAAiB,CAC5B,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO,GAC9C,OACF;AACF;AAEO,IAAM,4BAA4B,MAAM,CAAC,eAAe;AAOxD,IAAM,oBAAoB,CAG/B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,0BAA0B;AAErE,QAAM,UAAqE,CAAC;AAAA,IAC1E;AAAA,QACI,eAAe,gBAAgB,MAAM;AAE3C,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,uBAAuB,CAClC,OACA,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,OAAO,OAAO,GAC5D,OACF;AACF;AAEO,IAAM,kCAAkC,CAAC,UAAkB;AAAA,EAChE,iBAAiB;AACnB;AAOO,IAAM,0BAA0B,CAIrC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WACJ,8CAAc,aAAY,gCAAgC,KAAK;AAEjE,QAAM,UAEF,CAAC,EAAE,aAAa,qBAAqB,OAAO,gBAAgB,MAAM;AAEtE,QAAM,QAAQ,SAIZ,UAAU,SAAS,iBAAE,SAAS,CAAC,CAAC,SAAU,aAAc;AAE1D,SAAO;AAAA,IACL;AAAA,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O;AAAA,IACL;AAAA,KACG;AAEP;AAWO,IAAM,0BAA0B,CACrC,QACA,QACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,SAAS,eAAe,UAAU,QAAQ,MAAM,GACvD,OACF;AACF;AAQO,IAAM,6BAA6B,CAGxC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,QAAQ,WAAW,SAAS,CAAC;AAErC,WAAO,wBAAwB,QAAQ,QAAQ,cAAc;AAAA,EAC/D;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAUO,IAAM,6BAA6B,CACxC,QACA,QACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,SAAS,eAAe,UAAU,QAAQ,SAAS,GAC1D,OACF;AACF;AAQO,IAAM,gCAAgC,CAG3C,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,QAAQ,WAAW,SAAS,CAAC;AAErC,WAAO,2BAA2B,QAAQ,QAAQ,cAAc;AAAA,EAClE;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B","sourcesContent":["/**\n * Generated by orval v6.8.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n UserAccountGetResponse,\n AsError,\n UsersGetResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\nexport type AwaitedInput<T> = PromiseLike<T> | T;\n\nexport type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Returns a summary of your account\n\n * @summary Get information about your account\n */\nexport const getUserAccount = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UserAccountGetResponse>(\n { url: `/user/account`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUserAccountQueryKey = () => [`/user/account`];\n\nexport type GetUserAccountQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUserAccount>>\n>;\nexport type GetUserAccountQueryError = ErrorType<void | AsError>;\n\nexport const useGetUserAccount = <\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({\n signal,\n }) => getUserAccount(requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets users in an Organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Gets users in an organisation\n */\nexport const getOrganisationUsers = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/organisation/${orgId}/user`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUsersQueryKey = (orgId: string) => [\n `/organisation/${orgId}/user`,\n];\n\nexport type GetOrganisationUsersQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUsers>>\n>;\nexport type GetOrganisationUsersQueryError = ErrorType<AsError | void>;\n\nexport const useGetOrganisationUsers = <\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUsers>>\n > = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Adds a user to an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Adds a user to an organisation\n */\nexport const addOrganisationUser = (\n orgId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/user/${userId}`, method: \"put\" },\n options\n );\n};\n\nexport type AddOrganisationUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof addOrganisationUser>>\n>;\n\nexport type AddOrganisationUserMutationError = ErrorType<AsError>;\n\nexport const useAddOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n { orgId: string; userId: string }\n > = (props) => {\n const { orgId, userId } = props ?? {};\n\n return addOrganisationUser(orgId, userId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Removes a user from an organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Deletes a user from an organisation\n */\nexport const deleteOrganisationUser = (\n orgId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/user/${userId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUser>>\n>;\n\nexport type DeleteOrganisationUserMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n { orgId: string; userId: string }\n > = (props) => {\n const { orgId, userId } = props ?? {};\n\n return deleteOrganisationUser(orgId, userId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets users in an Organisational Unit. You have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Gets users in an Organisational Unit\n */\nexport const getOrganisationUnitUsers = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/unit/${unitId}/user`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitUsersQueryKey = (unitId: string) => [\n `/unit/${unitId}/user`,\n];\n\nexport type GetOrganisationUnitUsersQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>\n>;\nexport type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;\n\nexport const useGetOrganisationUnitUsers = <\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>\n > = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!unitId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Adds a user to an Organisational Unit.\n\nUsers cannot be added to **Independent Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Adds a user to an Organisational Unit\n */\nexport const addOrganisationUnitUser = (\n unitId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}/user/${userId}`, method: \"put\" },\n options\n );\n};\n\nexport type AddOrganisationUnitUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>\n>;\n\nexport type AddOrganisationUnitUserMutationError = ErrorType<AsError>;\n\nexport const useAddOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n { unitId: string; userId: string }\n > = (props) => {\n const { unitId, userId } = props ?? {};\n\n return addOrganisationUnitUser(unitId, userId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Removes a user from an Organisational Unit.\n\nUsers cannot be removed from **Independent Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Deletes a user from an Organisational Unit\n */\nexport const deleteOrganisationUnitUser = (\n unitId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}/user/${userId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>\n>;\n\nexport type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n { unitId: string; userId: string }\n > = (props) => {\n const { unitId, userId } = props ?? {};\n\n return deleteOrganisationUnitUser(unitId, userId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|