@squonk/account-server-client 2.1.0-rc.2 → 2.1.0-rc.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/admin/admin.cjs +30 -8
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.cts +50 -0
- package/admin/admin.d.ts +26 -6
- package/admin/admin.js +30 -8
- package/admin/admin.js.map +1 -1
- package/asset/asset.cjs +62 -22
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.cts +260 -0
- package/asset/asset.d.ts +79 -36
- package/asset/asset.js +54 -14
- package/asset/asset.js.map +1 -1
- package/{chunk-3RNIDX7T.js → chunk-EBOQPVLG.js} +2 -2
- package/{chunk-3RNIDX7T.js.map → chunk-EBOQPVLG.js.map} +1 -1
- package/{chunk-UZTHSGDT.cjs → chunk-TKLTUR4R.cjs} +2 -2
- package/chunk-TKLTUR4R.cjs.map +1 -0
- package/event-stream/event-stream.cjs +64 -19
- package/event-stream/event-stream.cjs.map +1 -1
- package/event-stream/event-stream.d.cts +142 -0
- package/event-stream/event-stream.d.ts +66 -20
- package/event-stream/event-stream.js +61 -16
- package/event-stream/event-stream.js.map +1 -1
- package/index.cjs +10 -10
- package/index.cjs.map +1 -1
- package/{custom-instance-35e5d4fd.d.ts → index.d.cts} +165 -163
- package/index.d.ts +702 -2
- package/index.js +9 -9
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +53 -14
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.cts +91 -0
- package/merchant/merchant.d.ts +48 -8
- package/merchant/merchant.js +52 -13
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +110 -28
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.cts +271 -0
- package/organisation/organisation.d.ts +114 -25
- package/organisation/organisation.js +103 -21
- package/organisation/organisation.js.map +1 -1
- package/package.json +13 -13
- package/product/product.cjs +182 -47
- package/product/product.cjs.map +1 -1
- package/product/product.d.cts +399 -0
- package/product/product.d.ts +180 -31
- package/product/product.js +172 -37
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +274 -280
- package/src/admin/admin.ts +114 -84
- package/src/asset/asset.ts +480 -565
- package/src/custom-instance.ts +3 -4
- package/src/event-stream/event-stream.ts +300 -275
- package/src/merchant/merchant.ts +206 -142
- package/src/organisation/organisation.ts +549 -490
- package/src/product/product.ts +829 -688
- package/src/state/state.ts +112 -75
- package/src/unit/unit.ts +645 -599
- package/src/user/user.ts +489 -469
- package/state/state.cjs +29 -8
- package/state/state.cjs.map +1 -1
- package/state/state.d.cts +46 -0
- package/state/state.d.ts +26 -6
- package/state/state.js +29 -8
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +120 -32
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.cts +322 -0
- package/unit/unit.d.ts +133 -38
- package/unit/unit.js +112 -24
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +96 -22
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +271 -0
- package/user/user.d.ts +96 -24
- package/user/user.js +90 -16
- package/user/user.js.map +1 -1
- package/chunk-UZTHSGDT.cjs.map +0 -1
package/asset/asset.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/asset/asset.ts"],"sourcesContent":["/**\n * Generated by orval v6.15.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 **Organisations**, **Units**, **Products**, **Users**, and **Assets**.\n\n * OpenAPI spec version: 2.1\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n AssetGetResponse,\n AsError,\n GetAssetParams,\n AssetPostResponse,\n AssetPostBodyBody,\n AssetPatchBodyBody,\n AttachAssetParams,\n DetachAssetParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\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 Assets you have access to.\n\nAssets are text and file resources that can be attached to (have a *scope* that applies to) **User** accounts, **Products**, **Units**, **Organisations** or can be **Global**. Assets can be requested by **Merchants**. The Data Manager uses assets to provide additional information that's often sensitive to **Job** (and **Application**) **Instances**.\n\nUsers must *attach* an Asset to a **Merchant** before the **Merchant** can ue it\n\n * @summary Gets Assets\n */\nexport const getAsset = (\n params?: GetAssetParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<AssetGetResponse>(\n { url: `/asset`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetAssetQueryKey = (params?: GetAssetParams) =>\n [\"account-server-api\", `/asset`, ...(params ? [params] : [])] as const;\n\nexport const getGetAssetQueryOptions = <\n TData = Awaited<ReturnType<typeof getAsset>>,\n TError = ErrorType<AsError | void>\n>(\n params?: GetAssetParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getAsset>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetAssetQueryKey(params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getAsset>>> = ({\n signal,\n }) => getAsset(params, requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetAssetQueryResult = NonNullable<\n Awaited<ReturnType<typeof getAsset>>\n>;\nexport type GetAssetQueryError = ErrorType<AsError | void>;\n\nexport const useGetAsset = <\n TData = Awaited<ReturnType<typeof getAsset>>,\n TError = ErrorType<AsError | void>\n>(\n params?: GetAssetParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getAsset>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetAssetQueryOptions(params, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Creates an Asset, which can be attached to a **User** account, a **Product**, **Unit**, **Organisation** or can be made **Global**\n\n * @summary Create an Asset\n */\nexport const createAsset = (\n assetPostBodyBody: AssetPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n formData.append(\"name\", assetPostBodyBody.name);\n if (assetPostBodyBody.content_file !== undefined) {\n formData.append(\"content_file\", assetPostBodyBody.content_file);\n }\n if (assetPostBodyBody.content_string !== undefined) {\n formData.append(\"content_string\", assetPostBodyBody.content_string);\n }\n formData.append(\"scope\", assetPostBodyBody.scope);\n if (assetPostBodyBody.scope_id !== undefined) {\n formData.append(\"scope_id\", assetPostBodyBody.scope_id);\n }\n formData.append(\"secret\", assetPostBodyBody.secret.toString());\n if (assetPostBodyBody.description !== undefined) {\n formData.append(\"description\", assetPostBodyBody.description);\n }\n\n return customInstance<AssetPostResponse>(\n {\n url: `/asset`,\n method: \"post\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport const getCreateAssetMutationOptions = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createAsset>>,\n TError,\n { data: AssetPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof createAsset>>,\n TError,\n { data: AssetPostBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createAsset>>,\n { data: AssetPostBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return createAsset(data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type CreateAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof createAsset>>\n>;\nexport type CreateAssetMutationBody = AssetPostBodyBody;\nexport type CreateAssetMutationError = ErrorType<AsError | void>;\n\nexport const useCreateAsset = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createAsset>>,\n TError,\n { data: AssetPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getCreateAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Used to update or replace Asset *Content* or *Description*.\n\nThe content of an Asset currently in use will not be affected by a change made here. If a **Merchant** has already obtained the Asset it may continue to use the original value until the **Merchant** requests the **Asset** again.\n\n * @summary Adjust an existing Asset\n */\nexport const patchAsset = (\n assetId: string,\n assetPatchBodyBody: AssetPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n if (assetPatchBodyBody.content_file !== undefined) {\n formData.append(\"content_file\", assetPatchBodyBody.content_file);\n }\n if (assetPatchBodyBody.content_string !== undefined) {\n formData.append(\"content_string\", assetPatchBodyBody.content_string);\n }\n if (assetPatchBodyBody.description !== undefined) {\n formData.append(\"description\", assetPatchBodyBody.description);\n }\n\n return customInstance<void>(\n {\n url: `/asset/${assetId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport const getPatchAssetMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchAsset>>,\n TError,\n { assetId: string; data: AssetPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof patchAsset>>,\n TError,\n { assetId: string; data: AssetPatchBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchAsset>>,\n { assetId: string; data: AssetPatchBodyBody }\n > = (props) => {\n const { assetId, data } = props ?? {};\n\n return patchAsset(assetId, data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type PatchAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchAsset>>\n>;\nexport type PatchAssetMutationBody = AssetPatchBodyBody;\nexport type PatchAssetMutationError = ErrorType<AsError>;\n\nexport const usePatchAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchAsset>>,\n TError,\n { assetId: string; data: AssetPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getPatchAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Deletes a known Asset. Assets that are attached to **Merchants** cannot be deleted\n\n * @summary Deletes an Asset\n */\nexport const deleteAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteAssetMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteAsset>>,\n TError,\n { assetId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return deleteAsset(assetId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteAsset>>\n>;\n\nexport type DeleteAssetMutationError = ErrorType<AsError>;\n\nexport const useDeleteAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Disables a known Asset\n\n * @summary Disables an Asset\n */\nexport const disableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/disable`, method: \"patch\" },\n options\n );\n};\n\nexport const getDisableAssetMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof disableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof disableAsset>>,\n TError,\n { assetId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof disableAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return disableAsset(assetId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DisableAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof disableAsset>>\n>;\n\nexport type DisableAssetMutationError = ErrorType<AsError>;\n\nexport const useDisableAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof disableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDisableAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Enables a known Asset\n\n * @summary Enables an Asset\n */\nexport const enableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/enable`, method: \"patch\" },\n options\n );\n};\n\nexport const getEnableAssetMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof enableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof enableAsset>>,\n TError,\n { assetId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof enableAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return enableAsset(assetId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type EnableAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof enableAsset>>\n>;\n\nexport type EnableAssetMutationError = ErrorType<AsError>;\n\nexport const useEnableAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof enableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getEnableAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Attaches an Asset to a **Merchant**. This allows the **Merchant** to query the Asset. **Merchants** cannot obtain Assets that are not attached to them.\n\n * @summary Attaches an Asset to a Merchant\n */\nexport const attachAsset = (\n assetId: string,\n params?: AttachAssetParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/attach`, method: \"patch\", params },\n options\n );\n};\n\nexport const getAttachAssetMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof attachAsset>>,\n TError,\n { assetId: string; params?: AttachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof attachAsset>>,\n TError,\n { assetId: string; params?: AttachAssetParams },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof attachAsset>>,\n { assetId: string; params?: AttachAssetParams }\n > = (props) => {\n const { assetId, params } = props ?? {};\n\n return attachAsset(assetId, params, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type AttachAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof attachAsset>>\n>;\n\nexport type AttachAssetMutationError = ErrorType<AsError>;\n\nexport const useAttachAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof attachAsset>>,\n TError,\n { assetId: string; params?: AttachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getAttachAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Detaches an Asset from a **Merchant**\n\n * @summary Detaches an Asset from a Merchant\n */\nexport const detachAsset = (\n assetId: string,\n params?: DetachAssetParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/asset/${assetId}/detach`, method: \"patch\", params },\n options\n );\n};\n\nexport const getDetachAssetMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof detachAsset>>,\n TError,\n { assetId: string; params?: DetachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof detachAsset>>,\n TError,\n { assetId: string; params?: DetachAssetParams },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof detachAsset>>,\n { assetId: string; params?: DetachAssetParams }\n > = (props) => {\n const { assetId, params } = props ?? {};\n\n return detachAsset(assetId, params, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DetachAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof detachAsset>>\n>;\n\nexport type DetachAssetMutationError = ErrorType<AsError>;\n\nexport const useDetachAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof detachAsset>>,\n TError,\n { assetId: string; params?: DetachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDetachAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n"],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAuC/B,IAAM,WAAW,CACtB,QACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,UAAU,QAAQ,OAAO,QAAQ,OAAO;AAAA,IAC/C;AAAA,EACF;AACF;AAEO,IAAM,sBAAsB,CAAC,WAClC,CAAC,sBAAsB,UAAU,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAAE;AAEvD,IAAM,0BAA0B,CAIrC,QACA,YAUG;AACH,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,oBAAoB,MAAM;AAErE,QAAM,UAA+D,CAAC;AAAA,IACpE;AAAA,EACF,MAAM,SAAS,QAAQ,gBAAgB,MAAM;AAE7C,SAAO,EAAE,UAAU,SAAS,GAAG,aAAa;AAC9C;AAOO,IAAM,cAAc,CAIzB,QACA,YAQ2D;AAC3D,QAAM,eAAe,wBAAwB,QAAQ,OAAO;AAE5D,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AAOO,IAAM,cAAc,CACzB,mBAC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EAAE,YAAY,GAAG,gBAAgB;AAC1C;AAQO,IAAM,iBAAiB,CAG5B,YAQI;AACJ,QAAM,kBAAkB,8BAA8B,OAAO;AAE7D,SAAO,YAAY,eAAe;AACpC;AAMO,IAAM,cAAc,CACzB,SACA,QACA,YACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,UAAU,kBAAkB,QAAQ,SAAS,OAAO;AAAA,IAC3D;AAAA,EACF;AACF;AAEO,IAAM,gCAAgC,CAG3C,YAaG;AACH,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,SAAS,OAAO,IAAI,SAAS,CAAC;AAEtC,WAAO,YAAY,SAAS,QAAQ,cAAc;AAAA,EACpD;AAEA,SAAO,EAAE,YAAY,GAAG,gBAAgB;AAC1C;AAQO,IAAM,iBAAiB,CAG5B,YAQI;AACJ,QAAM,kBAAkB,8BAA8B,OAAO;AAE7D,SAAO,YAAY,eAAe;AACpC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/asset/asset.ts"],"sourcesContent":["/**\n * Generated by orval v6.25.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 **Organisations**, **Units**, **Products**, **Users**, and **Assets**.\n\n * OpenAPI spec version: 2.1\n */\nimport {\n useMutation,\n useQuery,\n useSuspenseQuery\n} from '@tanstack/react-query'\nimport type {\n MutationFunction,\n QueryFunction,\n QueryKey,\n UseMutationOptions,\n UseQueryOptions,\n UseQueryResult,\n UseSuspenseQueryOptions,\n UseSuspenseQueryResult\n} from '@tanstack/react-query'\nimport type {\n AsError,\n AssetGetResponse,\n AssetPatchBodyBody,\n AssetPostBodyBody,\n AssetPostResponse,\n AttachAssetParams,\n DetachAssetParams,\n GetAssetParams\n} from '../account-server-api.schemas'\nimport { customInstance } from '.././custom-instance';\nimport type { ErrorType } from '.././custom-instance';\n\n\ntype SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];\n\n\n/**\n * Gets Assets you have access to.\n\n * @summary Gets Assets\n */\nexport const getAsset = (\n params?: GetAssetParams,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<AssetGetResponse>(\n {url: `/asset`, method: 'GET',\n params, signal\n },\n options);\n }\n \n\nexport const getGetAssetQueryKey = (params?: GetAssetParams,) => {\n return [\"account-server-api\", `/asset`, ...(params ? [params]: [])] as const;\n }\n\n \nexport const getGetAssetQueryOptions = <TData = Awaited<ReturnType<typeof getAsset>>, TError = ErrorType<AsError | void>>(params?: GetAssetParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetAssetQueryKey(params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getAsset>>> = ({ signal }) => getAsset(params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetAssetQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>\nexport type GetAssetQueryError = ErrorType<AsError | void>\n\n/**\n * @summary Gets Assets\n */\nexport const useGetAsset = <TData = Awaited<ReturnType<typeof getAsset>>, TError = ErrorType<AsError | void>>(\n params?: GetAssetParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetAssetQueryOptions(params,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\nexport const getGetAssetSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getAsset>>, TError = ErrorType<AsError | void>>(params?: GetAssetParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetAssetQueryKey(params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getAsset>>> = ({ signal }) => getAsset(params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetAssetSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>\nexport type GetAssetSuspenseQueryError = ErrorType<AsError | void>\n\n/**\n * @summary Gets Assets\n */\nexport const useGetAssetSuspense = <TData = Awaited<ReturnType<typeof getAsset>>, TError = ErrorType<AsError | void>>(\n params?: GetAssetParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetAssetSuspenseQueryOptions(params,options)\n\n const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n/**\n * Creates an Asset, which can be attached to a **User** account, a **Product**, **Unit**, **Organisation** or can be made **Global**\n\nAssets are text and file resources that can be requested by **Merchants**. The Data Manager **Merchant** uses assets to provide additional information that's often sensitive to **Job** (and **Application**) **Instances**.\n\nAssets must be *enabled* before they can be used.\n\nThey must also be *attached* to a **Merchant** before the **Merchant** can ue them. Assets are only available to merchants if they are enabled and attached.\n\n * @summary Create an Asset\n */\nexport const createAsset = (\n assetPostBodyBody: AssetPostBodyBody,\n options?: SecondParameter<typeof customInstance>,) => {\n \n const formData = new FormData();\nformData.append('name', assetPostBodyBody.name)\nif(assetPostBodyBody.content_file !== undefined) {\n formData.append('content_file', assetPostBodyBody.content_file)\n }\nif(assetPostBodyBody.content_string !== undefined) {\n formData.append('content_string', assetPostBodyBody.content_string)\n }\nformData.append('scope', assetPostBodyBody.scope)\nif(assetPostBodyBody.scope_id !== undefined) {\n formData.append('scope_id', assetPostBodyBody.scope_id)\n }\nformData.append('secret', assetPostBodyBody.secret.toString())\nif(assetPostBodyBody.description !== undefined) {\n formData.append('description', assetPostBodyBody.description)\n }\n\n return customInstance<AssetPostResponse>(\n {url: `/asset`, method: 'POST',\n headers: {'Content-Type': 'multipart/form-data', },\n data: formData\n },\n options);\n }\n \n\n\nexport const getCreateAssetMutationOptions = <TError = ErrorType<AsError | void>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: AssetPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: AssetPostBodyBody}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof createAsset>>, {data: AssetPostBodyBody}> = (props) => {\n const {data} = props ?? {};\n\n return createAsset(data,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CreateAssetMutationResult = NonNullable<Awaited<ReturnType<typeof createAsset>>>\n export type CreateAssetMutationBody = AssetPostBodyBody\n export type CreateAssetMutationError = ErrorType<AsError | void>\n\n /**\n * @summary Create an Asset\n */\nexport const useCreateAsset = <TError = ErrorType<AsError | void>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: AssetPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getCreateAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Used to update or replace Asset *Content* or *Description*.\n\nThe content of an Asset currently in use will not be affected by a change made here. If a **Merchant** has already obtained the Asset it may continue to use the original value until the **Merchant** requests the **Asset** again.\n\n * @summary Adjust an existing Asset\n */\nexport const patchAsset = (\n assetId: string,\n assetPatchBodyBody: AssetPatchBodyBody,\n options?: SecondParameter<typeof customInstance>,) => {\n \n const formData = new FormData();\nif(assetPatchBodyBody.content_file !== undefined) {\n formData.append('content_file', assetPatchBodyBody.content_file)\n }\nif(assetPatchBodyBody.content_string !== undefined) {\n formData.append('content_string', assetPatchBodyBody.content_string)\n }\nif(assetPatchBodyBody.description !== undefined) {\n formData.append('description', assetPatchBodyBody.description)\n }\n\n return customInstance<void>(\n {url: `/asset/${assetId}`, method: 'PATCH',\n headers: {'Content-Type': 'multipart/form-data', },\n data: formData\n },\n options);\n }\n \n\n\nexport const getPatchAssetMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchAsset>>, TError,{assetId: string;data: AssetPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof patchAsset>>, TError,{assetId: string;data: AssetPatchBodyBody}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof patchAsset>>, {assetId: string;data: AssetPatchBodyBody}> = (props) => {\n const {assetId,data} = props ?? {};\n\n return patchAsset(assetId,data,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type PatchAssetMutationResult = NonNullable<Awaited<ReturnType<typeof patchAsset>>>\n export type PatchAssetMutationBody = AssetPatchBodyBody\n export type PatchAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Adjust an existing Asset\n */\nexport const usePatchAsset = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchAsset>>, TError,{assetId: string;data: AssetPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getPatchAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Deletes a known Asset. Assets that are attached to **Merchants** cannot be deleted\n\n * @summary Deletes an Asset\n */\nexport const deleteAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/asset/${assetId}`, method: 'DELETE'\n },\n options);\n }\n \n\n\nexport const getDeleteAssetMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{assetId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteAsset>>, {assetId: string}> = (props) => {\n const {assetId} = props ?? {};\n\n return deleteAsset(assetId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteAssetMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAsset>>>\n \n export type DeleteAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Deletes an Asset\n */\nexport const useDeleteAsset = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDeleteAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Disables a known Asset\n\n * @summary Disables an Asset\n */\nexport const disableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/asset/${assetId}/disable`, method: 'PATCH'\n },\n options);\n }\n \n\n\nexport const getDisableAssetMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof disableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof disableAsset>>, TError,{assetId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof disableAsset>>, {assetId: string}> = (props) => {\n const {assetId} = props ?? {};\n\n return disableAsset(assetId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DisableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof disableAsset>>>\n \n export type DisableAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Disables an Asset\n */\nexport const useDisableAsset = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof disableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDisableAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Enables a known Asset\n\n * @summary Enables an Asset\n */\nexport const enableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/asset/${assetId}/enable`, method: 'PATCH'\n },\n options);\n }\n \n\n\nexport const getEnableAssetMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof enableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof enableAsset>>, TError,{assetId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof enableAsset>>, {assetId: string}> = (props) => {\n const {assetId} = props ?? {};\n\n return enableAsset(assetId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type EnableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof enableAsset>>>\n \n export type EnableAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Enables an Asset\n */\nexport const useEnableAsset = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof enableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getEnableAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Attaches an Asset to a **Merchant**. This allows the **Merchant** to query the Asset. **Merchants** cannot obtain Assets that are not attached to them.\n\n * @summary Attaches an Asset to a Merchant\n */\nexport const attachAsset = (\n assetId: string,\n params?: AttachAssetParams,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/asset/${assetId}/attach`, method: 'PATCH',\n params\n },\n options);\n }\n \n\n\nexport const getAttachAssetMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachAsset>>, TError,{assetId: string;params?: AttachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof attachAsset>>, TError,{assetId: string;params?: AttachAssetParams}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof attachAsset>>, {assetId: string;params?: AttachAssetParams}> = (props) => {\n const {assetId,params} = props ?? {};\n\n return attachAsset(assetId,params,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AttachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof attachAsset>>>\n \n export type AttachAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Attaches an Asset to a Merchant\n */\nexport const useAttachAsset = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachAsset>>, TError,{assetId: string;params?: AttachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getAttachAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Detaches an Asset from a **Merchant**\n\n * @summary Detaches an Asset from a Merchant\n */\nexport const detachAsset = (\n assetId: string,\n params?: DetachAssetParams,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/asset/${assetId}/detach`, method: 'PATCH',\n params\n },\n options);\n }\n \n\n\nexport const getDetachAssetMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof detachAsset>>, TError,{assetId: string;params?: DetachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof detachAsset>>, TError,{assetId: string;params?: DetachAssetParams}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof detachAsset>>, {assetId: string;params?: DetachAssetParams}> = (props) => {\n const {assetId,params} = props ?? {};\n\n return detachAsset(assetId,params,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DetachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof detachAsset>>>\n \n export type DetachAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Detaches an Asset from a Merchant\n */\nexport const useDetachAsset = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof detachAsset>>, TError,{assetId: string;params?: DetachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDetachAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n "],"mappings":";;;;;AAUA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAiCA,IAAM,WAAW,CACpB,QACH,SAAiD,WAC7C;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,YAAY,SAAQ,QAAO,cAAc;AAAA,EACnD;AAKL,SAAQ,EAAE,YAAY,GAAG,gBAAgB;AAAC;AAStC,IAAM,iBAAiB,CACN,YACnB;AAEC,QAAM,kBAAkB,8BAA8B,OAAO;AAE7D,SAAO,YAAY,eAAe;AACpC;AAMG,IAAM,cAAc,CACvB,SACA,QACH,YAAsD;AAGjD,SAAO;AAAA,IACP;AAAA,MAAC,KAAK,UAAU,OAAO;AAAA,MAAW,QAAQ;AAAA,MACxC;AAAA,IACJ;AAAA,IACE;AAAA,EAAO;AACT;AAIG,IAAM,gCAAgC,CACrB,YACyG;AAChI,QAAM,EAAC,UAAU,iBAAiB,SAAS,eAAc,IAAI,WAAW,CAAC;AAKpE,QAAM,aAAsH,CAAC,UAAU;AACnI,UAAM,EAAC,SAAQ,OAAM,IAAI,SAAS,CAAC;AAEnC,WAAQ,YAAY,SAAQ,QAAO,cAAc;AAAA,EACnD;AAKL,SAAQ,EAAE,YAAY,GAAG,gBAAgB;AAAC;AAStC,IAAM,iBAAiB,CACN,YACnB;AAEC,QAAM,kBAAkB,8BAA8B,OAAO;AAE7D,SAAO,YAAY,eAAe;AACpC;","names":[]}
|
|
@@ -13,7 +13,7 @@ var customInstance = (config, options) => {
|
|
|
13
13
|
({ data }) => data
|
|
14
14
|
);
|
|
15
15
|
promise.cancel = () => {
|
|
16
|
-
source.cancel("Query was cancelled
|
|
16
|
+
source.cancel("Query was cancelled");
|
|
17
17
|
};
|
|
18
18
|
return promise;
|
|
19
19
|
};
|
|
@@ -24,4 +24,4 @@ export {
|
|
|
24
24
|
setBaseUrl,
|
|
25
25
|
customInstance
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-EBOQPVLG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom-instance.ts"],"sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n //
|
|
1
|
+
{"version":3,"sources":["../src/custom-instance.ts"],"sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // @ts-expect-error need to add a cancel method to the promise\n promise.cancel = () => {\n source.cancel('Query was cancelled');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],"mappings":";AAUA,OAAO,WAA+C;AAE/C,IAAM,iBAAiB,MAAM,OAAO;AAOpC,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,eAAe,IAAI,UAAU,KAAK;AAC3E;AAMO,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AACpC;AAEO,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY,OAAO;AAExC,QAAM,UAAU,eAAe,EAAE,GAAG,QAAQ,GAAG,SAAS,aAAa,OAAO,MAAM,CAAC,EAAE;AAAA,IACnF,CAAC,EAAE,KAAK,MAAM;AAAA,EAChB;AAGA,UAAQ,SAAS,MAAM;AACrB,WAAO,OAAO,qBAAqB;AAAA,EACrC;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -13,7 +13,7 @@ var customInstance = (config, options) => {
|
|
|
13
13
|
({ data }) => data
|
|
14
14
|
);
|
|
15
15
|
promise.cancel = () => {
|
|
16
|
-
source.cancel("Query was cancelled
|
|
16
|
+
source.cancel("Query was cancelled");
|
|
17
17
|
};
|
|
18
18
|
return promise;
|
|
19
19
|
};
|
|
@@ -24,4 +24,4 @@ var customInstance = (config, options) => {
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
exports.AXIOS_INSTANCE = AXIOS_INSTANCE; exports.setAuthToken = setAuthToken; exports.setBaseUrl = setBaseUrl; exports.customInstance = customInstance;
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-TKLTUR4R.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/custom-instance.ts"],"names":[],"mappings":";AAUA,OAAO,WAA+C;AAE/C,IAAM,iBAAiB,MAAM,OAAO;AAOpC,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,eAAe,IAAI,UAAU,KAAK;AAC3E;AAMO,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AACpC;AAEO,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY,OAAO;AAExC,QAAM,UAAU,eAAe,EAAE,GAAG,QAAQ,GAAG,SAAS,aAAa,OAAO,MAAM,CAAC,EAAE;AAAA,IACnF,CAAC,EAAE,KAAK,MAAM;AAAA,EAChB;AAGA,UAAQ,SAAS,MAAM;AACrB,WAAO,OAAO,qBAAqB;AAAA,EACrC;AAEA,SAAO;AACT","sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // @ts-expect-error need to add a cancel method to the promise\n promise.cancel = () => {\n source.cancel('Query was cancelled');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"]}
|
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkTKLTUR4Rcjs = require('../chunk-TKLTUR4R.cjs');
|
|
4
4
|
|
|
5
5
|
// src/event-stream/event-stream.ts
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
6
10
|
var _reactquery = require('@tanstack/react-query');
|
|
7
11
|
var getEventStream = (options, signal) => {
|
|
8
|
-
return
|
|
9
|
-
{
|
|
12
|
+
return _chunkTKLTUR4Rcjs.customInstance.call(void 0,
|
|
13
|
+
{
|
|
14
|
+
url: `/event-stream`,
|
|
15
|
+
method: "GET",
|
|
16
|
+
signal
|
|
17
|
+
},
|
|
10
18
|
options
|
|
11
19
|
);
|
|
12
20
|
};
|
|
13
|
-
var getGetEventStreamQueryKey = () =>
|
|
21
|
+
var getGetEventStreamQueryKey = () => {
|
|
22
|
+
return ["account-server-api", `/event-stream`];
|
|
23
|
+
};
|
|
14
24
|
var getGetEventStreamQueryOptions = (options) => {
|
|
15
25
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
16
26
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetEventStreamQueryKey()));
|
|
17
|
-
const queryFn = ({
|
|
18
|
-
signal
|
|
19
|
-
}) => getEventStream(requestOptions, signal);
|
|
27
|
+
const queryFn = ({ signal }) => getEventStream(requestOptions, signal);
|
|
20
28
|
return { queryKey, queryFn, ...queryOptions };
|
|
21
29
|
};
|
|
22
30
|
var useGetEventStream = (options) => {
|
|
@@ -25,9 +33,24 @@ var useGetEventStream = (options) => {
|
|
|
25
33
|
query.queryKey = queryOptions.queryKey;
|
|
26
34
|
return query;
|
|
27
35
|
};
|
|
36
|
+
var getGetEventStreamSuspenseQueryOptions = (options) => {
|
|
37
|
+
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
38
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetEventStreamQueryKey()));
|
|
39
|
+
const queryFn = ({ signal }) => getEventStream(requestOptions, signal);
|
|
40
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
41
|
+
};
|
|
42
|
+
var useGetEventStreamSuspense = (options) => {
|
|
43
|
+
const queryOptions = getGetEventStreamSuspenseQueryOptions(options);
|
|
44
|
+
const query = _reactquery.useSuspenseQuery.call(void 0, queryOptions);
|
|
45
|
+
query.queryKey = queryOptions.queryKey;
|
|
46
|
+
return query;
|
|
47
|
+
};
|
|
28
48
|
var createEventStream = (options) => {
|
|
29
|
-
return
|
|
30
|
-
{
|
|
49
|
+
return _chunkTKLTUR4Rcjs.customInstance.call(void 0,
|
|
50
|
+
{
|
|
51
|
+
url: `/event-stream`,
|
|
52
|
+
method: "POST"
|
|
53
|
+
},
|
|
31
54
|
options
|
|
32
55
|
);
|
|
33
56
|
};
|
|
@@ -43,12 +66,18 @@ var useCreateEventStream = (options) => {
|
|
|
43
66
|
return _reactquery.useMutation.call(void 0, mutationOptions);
|
|
44
67
|
};
|
|
45
68
|
var getEventStreamEvents = (eventStreamId, options, signal) => {
|
|
46
|
-
return
|
|
47
|
-
{
|
|
69
|
+
return _chunkTKLTUR4Rcjs.customInstance.call(void 0,
|
|
70
|
+
{
|
|
71
|
+
url: `/event-stream/${eventStreamId}`,
|
|
72
|
+
method: "GET",
|
|
73
|
+
signal
|
|
74
|
+
},
|
|
48
75
|
options
|
|
49
76
|
);
|
|
50
77
|
};
|
|
51
|
-
var getGetEventStreamEventsQueryKey = (eventStreamId) =>
|
|
78
|
+
var getGetEventStreamEventsQueryKey = (eventStreamId) => {
|
|
79
|
+
return ["account-server-api", `/event-stream/${eventStreamId}`];
|
|
80
|
+
};
|
|
52
81
|
var getGetEventStreamEventsQueryOptions = (eventStreamId, options) => {
|
|
53
82
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
54
83
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetEventStreamEventsQueryKey(eventStreamId)));
|
|
@@ -56,17 +85,29 @@ var getGetEventStreamEventsQueryOptions = (eventStreamId, options) => {
|
|
|
56
85
|
return { queryKey, queryFn, enabled: !!eventStreamId, ...queryOptions };
|
|
57
86
|
};
|
|
58
87
|
var useGetEventStreamEvents = (eventStreamId, options) => {
|
|
59
|
-
const queryOptions = getGetEventStreamEventsQueryOptions(
|
|
60
|
-
eventStreamId,
|
|
61
|
-
options
|
|
62
|
-
);
|
|
88
|
+
const queryOptions = getGetEventStreamEventsQueryOptions(eventStreamId, options);
|
|
63
89
|
const query = _reactquery.useQuery.call(void 0, queryOptions);
|
|
64
90
|
query.queryKey = queryOptions.queryKey;
|
|
65
91
|
return query;
|
|
66
92
|
};
|
|
93
|
+
var getGetEventStreamEventsSuspenseQueryOptions = (eventStreamId, options) => {
|
|
94
|
+
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
95
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetEventStreamEventsQueryKey(eventStreamId)));
|
|
96
|
+
const queryFn = ({ signal }) => getEventStreamEvents(eventStreamId, requestOptions, signal);
|
|
97
|
+
return { queryKey, queryFn, enabled: !!eventStreamId, ...queryOptions };
|
|
98
|
+
};
|
|
99
|
+
var useGetEventStreamEventsSuspense = (eventStreamId, options) => {
|
|
100
|
+
const queryOptions = getGetEventStreamEventsSuspenseQueryOptions(eventStreamId, options);
|
|
101
|
+
const query = _reactquery.useSuspenseQuery.call(void 0, queryOptions);
|
|
102
|
+
query.queryKey = queryOptions.queryKey;
|
|
103
|
+
return query;
|
|
104
|
+
};
|
|
67
105
|
var deleteEventStream = (eventStreamId, options) => {
|
|
68
|
-
return
|
|
69
|
-
{
|
|
106
|
+
return _chunkTKLTUR4Rcjs.customInstance.call(void 0,
|
|
107
|
+
{
|
|
108
|
+
url: `/event-stream/${eventStreamId}`,
|
|
109
|
+
method: "DELETE"
|
|
110
|
+
},
|
|
70
111
|
options
|
|
71
112
|
);
|
|
72
113
|
};
|
|
@@ -97,5 +138,9 @@ var useDeleteEventStream = (options) => {
|
|
|
97
138
|
|
|
98
139
|
|
|
99
140
|
|
|
100
|
-
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
exports.createEventStream = createEventStream; exports.deleteEventStream = deleteEventStream; exports.getCreateEventStreamMutationOptions = getCreateEventStreamMutationOptions; exports.getDeleteEventStreamMutationOptions = getDeleteEventStreamMutationOptions; exports.getEventStream = getEventStream; exports.getEventStreamEvents = getEventStreamEvents; exports.getGetEventStreamEventsQueryKey = getGetEventStreamEventsQueryKey; exports.getGetEventStreamEventsQueryOptions = getGetEventStreamEventsQueryOptions; exports.getGetEventStreamEventsSuspenseQueryOptions = getGetEventStreamEventsSuspenseQueryOptions; exports.getGetEventStreamQueryKey = getGetEventStreamQueryKey; exports.getGetEventStreamQueryOptions = getGetEventStreamQueryOptions; exports.getGetEventStreamSuspenseQueryOptions = getGetEventStreamSuspenseQueryOptions; exports.useCreateEventStream = useCreateEventStream; exports.useDeleteEventStream = useDeleteEventStream; exports.useGetEventStream = useGetEventStream; exports.useGetEventStreamEvents = useGetEventStreamEvents; exports.useGetEventStreamEventsSuspense = useGetEventStreamEventsSuspense; exports.useGetEventStreamSuspense = useGetEventStreamSuspense;
|
|
101
146
|
//# sourceMappingURL=event-stream.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/event-stream/event-stream.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AA6B/B,IAAM,iBAAiB,CAC5B,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO;AAAA,IAC9C;AAAA,EACF;AACF;AAEO,IAAM,4BAA4B,MAAM,CAAC,sBAAsB,eAAe;AAE9E,IAAM,gCAAgC,CAG3C,YAW4B;AAC5B,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,0BAA0B;AAErE,QAAM,UAAqE,CAAC;AAAA,IAC1E;AAAA,EACF,MAAM,eAAe,gBAAgB,MAAM;AAE3C,SAAO,EAAE,UAAU,SAAS,GAAG,aAAa;AAC9C;AAOO,IAAM,oBAAoB,CAG/B,YAO4D;AAC5D,QAAM,eAAe,8BAA8B,OAAO;AAE1D,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AASO,IAAM,oBAAoB,CAC/B,YACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO;AAAA,IACvC;AAAA,EACF;AACF;AAEO,IAAM,sCAAsC,CAIjD,YAaG;AACH,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,MAAM;AACR,WAAO,kBAAkB,cAAc;AAAA,EACzC;AAEA,SAAO,EAAE,YAAY,GAAG,gBAAgB;AAC1C;AAQO,IAAM,uBAAuB,CAIlC,YAQI;AACJ,QAA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.15.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 **Organisations**, **Units**, **Products**, **Users**, and **Assets**.\n\n * OpenAPI spec version: 2.1\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n EventStreamGetPostResponse,\n AsError,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\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 your EventStream ID and read token, if you have created one.\n\n * @summary Gets the details of your EventStream\n */\nexport const getEventStream = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<EventStreamGetPostResponse>(\n { url: `/event-stream`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetEventStreamQueryKey = () => [\"account-server-api\", `/event-stream`] as const;\n\nexport const getGetEventStreamQueryOptions = <\n TData = Awaited<ReturnType<typeof getEventStream>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getEventStream>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<\n Awaited<ReturnType<typeof getEventStream>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetEventStreamQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStream>>> = ({\n signal,\n }) => getEventStream(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetEventStreamQueryResult = NonNullable<\n Awaited<ReturnType<typeof getEventStream>>\n>;\nexport type GetEventStreamQueryError = ErrorType<void | AsError>;\n\nexport const useGetEventStream = <\n TData = Awaited<ReturnType<typeof getEventStream>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getEventStream>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetEventStreamQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Creates a new event stream (based on the **Server Sent Events** framework) for the authenticated user.\n\nA user is only permitted one event stream.\n\n * @summary Create a new Server-Sent Events EventStream\n */\nexport const createEventStream = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<EventStreamGetPostResponse>(\n { url: `/event-stream`, method: \"post\" },\n options\n );\n};\n\nexport const getCreateEventStreamMutationOptions = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createEventStream>>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof createEventStream>>,\n TError,\n TVariables,\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createEventStream>>,\n TVariables\n > = () => {\n return createEventStream(requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type CreateEventStreamMutationResult = NonNullable<\n Awaited<ReturnType<typeof createEventStream>>\n>;\n\nexport type CreateEventStreamMutationError = ErrorType<AsError | void>;\n\nexport const useCreateEventStream = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createEventStream>>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getCreateEventStreamMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Gets events that you are entitled to receive. Events are delivered as **Server Sent Events** and you are expected to continuously read form this endpoint or it will be closed.\n\nThis is an un-authenticated endpoint. In order to read from the stream the caller must provide the **read token** they were allocated when the stream was created The token must be provided in the request header property `X-IM-AS-EventStreamReadToken`.\n\n * @summary Subscribe to Server-Sent Events events from an EventStream\n */\nexport const getEventStreamEvents = (\n eventStreamId: number,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<string>(\n { url: `/event-stream/${eventStreamId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetEventStreamEventsQueryKey = (eventStreamId: number) =>\n [\"account-server-api\", `/event-stream/${eventStreamId}`] as const;\n\nexport const getGetEventStreamEventsQueryOptions = <\n TData = Awaited<ReturnType<typeof getEventStreamEvents>>,\n TError = ErrorType<void | AsError>\n>(\n eventStreamId: number,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getEventStreamEvents>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getEventStreamEvents>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetEventStreamEventsQueryKey(eventStreamId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getEventStreamEvents>>\n > = ({ signal }) =>\n getEventStreamEvents(eventStreamId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!eventStreamId, ...queryOptions };\n};\n\nexport type GetEventStreamEventsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getEventStreamEvents>>\n>;\nexport type GetEventStreamEventsQueryError = ErrorType<void | AsError>;\n\nexport const useGetEventStreamEvents = <\n TData = Awaited<ReturnType<typeof getEventStreamEvents>>,\n TError = ErrorType<void | AsError>\n>(\n eventStreamId: number,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getEventStreamEvents>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetEventStreamEventsQueryOptions(\n eventStreamId,\n options\n );\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Deletes an Event Stream.\n\nYou must be the user who created the event stream.\n\n * @summary Deletes an existing EventStream (that you created)\n */\nexport const deleteEventStream = (\n eventStreamId: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/event-stream/${eventStreamId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteEventStreamMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteEventStream>>,\n TError,\n { eventStreamId: number },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteEventStream>>,\n TError,\n { eventStreamId: number },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteEventStream>>,\n { eventStreamId: number }\n > = (props) => {\n const { eventStreamId } = props ?? {};\n\n return deleteEventStream(eventStreamId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteEventStreamMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteEventStream>>\n>;\n\nexport type DeleteEventStreamMutationError = ErrorType<AsError>;\n\nexport const useDeleteEventStream = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteEventStream>>,\n TError,\n { eventStreamId: number },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteEventStreamMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/event-stream/event-stream.ts"],"names":[],"mappings":";;;;;AAUA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA2BA,IAAM,iBAAiB,CAE7B,SAAiD,WAC7C;AAGC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAiB,QAAQ;AAAA,MAAO;AAAA,IACxC;AAAA,IACE;AAAA,EAAO;AACT;AAGG,IAAM,4BAA4B,MAAM;AAC3C,SAAO,CAAC,sBAAsB,eAAe;AAC7C;AAGG,IAAM,gCAAgC,CAA0F,YAClI;AAEL,QAAM,EAAC,OAAO,cAAc,SAAS,eAAc,IAAI,WAAW,CAAC;AAEjE,QAAM,YAAY,6CAAc,aAAY,0BAA0B;AAIpE,QAAM,UAAqE,CAAC,EAAE,OAAO,MAAM,eAAe,gBAAgB,MAAM;AAMjI,SAAQ,EAAE,UAAU,SAAS,GAAG,aAAY;AAC/C;AAQO,IAAM,oBAAoB,CAC/B,YAE8D;AAE9D,QAAM,eAAe,8BAA8B,OAAO;AAE1D,QAAM,QAAQ,SAAS,YAAY;AAEnC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AAIO,IAAM,wCAAwC,CAA0F,YAC1I;AAEL,QAAM,EAAC,OAAO,cAAc,SAAS,eAAc,IAAI,WAAW,CAAC;AAEjE,QAAM,YAAY,6CAAc,aAAY,0BAA0B;AAIpE,QAAM,UAAqE,CAAC,EAAE,OAAO,MAAM,eAAe,gBAAgB,MAAM;AAMjI,SAAQ,EAAE,UAAU,SAAS,GAAG,aAAY;AAC/C;AAQO,IAAM,4BAA4B,CACvC,YAEsE;AAEtE,QAAM,eAAe,sCAAsC,OAAO;AAElE,QAAM,QAAQ,iBAAiB,YAAY;AAE3C,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AAWO,I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S,eAAc,IAAI,WAAW,CAAC;AAEjE,QAAM,YAAY,6CAAc,aAAY,gCAAgC,aAAa;AAIvF,QAAM,UAA2E,CAAC,EAAE,OAAO,MAAM,qBAAqB,eAAe,gBAAgB,MAAM;AAM5J,SAAQ,EAAE,UAAU,SAAS,SAAS,CAAC,CAAE,eAAgB,GAAG,aAAY;AAC3E;AAQO,IAAM,kCAAkC,CAC9C,eAAuB,YAEgD;AAEtE,QAAM,eAAe,4CAA4C,eAAc,OAAO;AAEtF,QAAM,QAAQ,iBAAiB,YAAY;AAE3C,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AAWO,IAAM,oBAAoB,CAC7B,eACH,YAAsD;AAGjD,SAAO;AAAA,IACP;AAAA,MAAC,KAAK,iBAAiB,aAAa;AAAA,MAAI,QAAQ;AAAA,IAClD;AAAA,IACE;AAAA,EAAO;AACT;AAIG,IAAM,sCAAsC,CAC3B,YAC0F;AACjH,QAAM,EAAC,UAAU,iBAAiB,SAAS,eAAc,IAAI,WAAW,CAAC;AAKpE,QAAM,aAAuG,CAAC,UAAU;AACpH,UAAM,EAAC,cAAa,IAAI,SAAS,CAAC;AAElC,WAAQ,kBAAkB,eAAc,cAAc;AAAA,EACxD;AAKL,SAAQ,EAAE,YAAY,GAAG,gBAAgB;AAAC;AAStC,IAAM,uBAAuB,CACZ,YACnB;AAEC,QAAM,kBAAkB,oCAAoC,OAAO;AAEnE,SAAO,YAAY,eAAe;AACpC","sourcesContent":["/**\n * Generated by orval v6.25.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 **Organisations**, **Units**, **Products**, **Users**, and **Assets**.\n\n * OpenAPI spec version: 2.1\n */\nimport {\n useMutation,\n useQuery,\n useSuspenseQuery\n} from '@tanstack/react-query'\nimport type {\n MutationFunction,\n QueryFunction,\n QueryKey,\n UseMutationOptions,\n UseQueryOptions,\n UseQueryResult,\n UseSuspenseQueryOptions,\n UseSuspenseQueryResult\n} from '@tanstack/react-query'\nimport type {\n AsError,\n EventStreamGetPostResponse\n} from '../account-server-api.schemas'\nimport { customInstance } from '.././custom-instance';\nimport type { ErrorType } from '.././custom-instance';\n\n\ntype SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];\n\n\n/**\n * Gets your EventStream ID and read token, if you have created one.\n\n * @summary Gets the details of your EventStream\n */\nexport const getEventStream = (\n \n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<EventStreamGetPostResponse>(\n {url: `/event-stream`, method: 'GET', signal\n },\n options);\n }\n \n\nexport const getGetEventStreamQueryKey = () => {\n return [\"account-server-api\", `/event-stream`] as const;\n }\n\n \nexport const getGetEventStreamQueryOptions = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetEventStreamQueryKey();\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStream>>> = ({ signal }) => getEventStream(requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetEventStreamQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStream>>>\nexport type GetEventStreamQueryError = ErrorType<void | AsError>\n\n/**\n * @summary Gets the details of your EventStream\n */\nexport const useGetEventStream = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(\n options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetEventStreamQueryOptions(options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\nexport const getGetEventStreamSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetEventStreamQueryKey();\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStream>>> = ({ signal }) => getEventStream(requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetEventStreamSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStream>>>\nexport type GetEventStreamSuspenseQueryError = ErrorType<void | AsError>\n\n/**\n * @summary Gets the details of your EventStream\n */\nexport const useGetEventStreamSuspense = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(\n options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetEventStreamSuspenseQueryOptions(options)\n\n const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n/**\n * Creates a new event stream (based on the **Server Sent Events** framework) for the authenticated user.\n\nA user is only permitted one event stream.\n\n * @summary Create a new Server-Sent Events EventStream\n */\nexport const createEventStream = (\n \n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<EventStreamGetPostResponse>(\n {url: `/event-stream`, method: 'POST'\n },\n options);\n }\n \n\n\nexport const getCreateEventStreamMutationOptions = <TError = ErrorType<AsError | void>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createEventStream>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof createEventStream>>, TError,void, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof createEventStream>>, void> = () => {\n \n\n return createEventStream(requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CreateEventStreamMutationResult = NonNullable<Awaited<ReturnType<typeof createEventStream>>>\n \n export type CreateEventStreamMutationError = ErrorType<AsError | void>\n\n /**\n * @summary Create a new Server-Sent Events EventStream\n */\nexport const useCreateEventStream = <TError = ErrorType<AsError | void>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createEventStream>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getCreateEventStreamMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Gets events that you are entitled to receive. Events are delivered as **Server Sent Events** and you are expected to continuously read form this endpoint or it will be closed.\n\nThis is an un-authenticated endpoint. In order to read from the stream the caller must provide either the User access token that belongs to the event stream or the **read token** that was allocated when the stream was created. The **read token** must be provided in the request header property `X-IM-AS-EventStreamReadToken`.\n\n * @summary Subscribe to Server-Sent Events events from an EventStream\n */\nexport const getEventStreamEvents = (\n eventStreamId: number,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<string>(\n {url: `/event-stream/${eventStreamId}`, method: 'GET', signal\n },\n options);\n }\n \n\nexport const getGetEventStreamEventsQueryKey = (eventStreamId: number,) => {\n return [\"account-server-api\", `/event-stream/${eventStreamId}`] as const;\n }\n\n \nexport const getGetEventStreamEventsQueryOptions = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(eventStreamId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetEventStreamEventsQueryKey(eventStreamId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStreamEvents>>> = ({ signal }) => getEventStreamEvents(eventStreamId, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, enabled: !!(eventStreamId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetEventStreamEventsQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStreamEvents>>>\nexport type GetEventStreamEventsQueryError = ErrorType<void | AsError>\n\n/**\n * @summary Subscribe to Server-Sent Events events from an EventStream\n */\nexport const useGetEventStreamEvents = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(\n eventStreamId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetEventStreamEventsQueryOptions(eventStreamId,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\nexport const getGetEventStreamEventsSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(eventStreamId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetEventStreamEventsQueryKey(eventStreamId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStreamEvents>>> = ({ signal }) => getEventStreamEvents(eventStreamId, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, enabled: !!(eventStreamId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetEventStreamEventsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStreamEvents>>>\nexport type GetEventStreamEventsSuspenseQueryError = ErrorType<void | AsError>\n\n/**\n * @summary Subscribe to Server-Sent Events events from an EventStream\n */\nexport const useGetEventStreamEventsSuspense = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(\n eventStreamId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetEventStreamEventsSuspenseQueryOptions(eventStreamId,options)\n\n const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n/**\n * Deletes an Event Stream.\n\nYou must be the user who created the event stream.\n\n * @summary Deletes an existing EventStream (that you created)\n */\nexport const deleteEventStream = (\n eventStreamId: number,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/event-stream/${eventStreamId}`, method: 'DELETE'\n },\n options);\n }\n \n\n\nexport const getDeleteEventStreamMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteEventStream>>, TError,{eventStreamId: number}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteEventStream>>, TError,{eventStreamId: number}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteEventStream>>, {eventStreamId: number}> = (props) => {\n const {eventStreamId} = props ?? {};\n\n return deleteEventStream(eventStreamId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteEventStreamMutationResult = NonNullable<Awaited<ReturnType<typeof deleteEventStream>>>\n \n export type DeleteEventStreamMutationError = ErrorType<AsError>\n\n /**\n * @summary Deletes an existing EventStream (that you created)\n */\nexport const useDeleteEventStream = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteEventStream>>, TError,{eventStreamId: number}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDeleteEventStreamMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n "]}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import * as _tanstack_react_query_build_legacy_types from '@tanstack/react-query/build/legacy/types';
|
|
2
|
+
import { UseQueryOptions, QueryKey, UseQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult, UseMutationOptions } from '@tanstack/react-query';
|
|
3
|
+
import { customInstance, EventStreamGetPostResponse, ErrorType, AsError } from '../index.cjs';
|
|
4
|
+
import 'axios';
|
|
5
|
+
|
|
6
|
+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
7
|
+
/**
|
|
8
|
+
* Gets your EventStream ID and read token, if you have created one.
|
|
9
|
+
|
|
10
|
+
* @summary Gets the details of your EventStream
|
|
11
|
+
*/
|
|
12
|
+
declare const getEventStream: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<EventStreamGetPostResponse>;
|
|
13
|
+
declare const getGetEventStreamQueryKey: () => readonly ["account-server-api", "/event-stream"];
|
|
14
|
+
declare const getGetEventStreamQueryOptions: <TData = EventStreamGetPostResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
15
|
+
query?: Partial<UseQueryOptions<EventStreamGetPostResponse, TError, TData, QueryKey>> | undefined;
|
|
16
|
+
request?: SecondParameter<typeof customInstance>;
|
|
17
|
+
} | undefined) => UseQueryOptions<EventStreamGetPostResponse, TError, TData, QueryKey> & {
|
|
18
|
+
queryKey: QueryKey;
|
|
19
|
+
};
|
|
20
|
+
type GetEventStreamQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStream>>>;
|
|
21
|
+
type GetEventStreamQueryError = ErrorType<void | AsError>;
|
|
22
|
+
/**
|
|
23
|
+
* @summary Gets the details of your EventStream
|
|
24
|
+
*/
|
|
25
|
+
declare const useGetEventStream: <TData = EventStreamGetPostResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
26
|
+
query?: Partial<UseQueryOptions<EventStreamGetPostResponse, TError, TData, QueryKey>> | undefined;
|
|
27
|
+
request?: SecondParameter<typeof customInstance>;
|
|
28
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
29
|
+
queryKey: QueryKey;
|
|
30
|
+
};
|
|
31
|
+
declare const getGetEventStreamSuspenseQueryOptions: <TData = EventStreamGetPostResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
32
|
+
query?: Partial<UseSuspenseQueryOptions<EventStreamGetPostResponse, TError, TData, QueryKey>> | undefined;
|
|
33
|
+
request?: SecondParameter<typeof customInstance>;
|
|
34
|
+
} | undefined) => UseSuspenseQueryOptions<EventStreamGetPostResponse, TError, TData, QueryKey> & {
|
|
35
|
+
queryKey: QueryKey;
|
|
36
|
+
};
|
|
37
|
+
type GetEventStreamSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStream>>>;
|
|
38
|
+
type GetEventStreamSuspenseQueryError = ErrorType<void | AsError>;
|
|
39
|
+
/**
|
|
40
|
+
* @summary Gets the details of your EventStream
|
|
41
|
+
*/
|
|
42
|
+
declare const useGetEventStreamSuspense: <TData = EventStreamGetPostResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
43
|
+
query?: Partial<UseSuspenseQueryOptions<EventStreamGetPostResponse, TError, TData, QueryKey>> | undefined;
|
|
44
|
+
request?: SecondParameter<typeof customInstance>;
|
|
45
|
+
} | undefined) => UseSuspenseQueryResult<TData, TError> & {
|
|
46
|
+
queryKey: QueryKey;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new event stream (based on the **Server Sent Events** framework) for the authenticated user.
|
|
50
|
+
|
|
51
|
+
A user is only permitted one event stream.
|
|
52
|
+
|
|
53
|
+
* @summary Create a new Server-Sent Events EventStream
|
|
54
|
+
*/
|
|
55
|
+
declare const createEventStream: (options?: SecondParameter<typeof customInstance>) => Promise<EventStreamGetPostResponse>;
|
|
56
|
+
declare const getCreateEventStreamMutationOptions: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
57
|
+
mutation?: UseMutationOptions<EventStreamGetPostResponse, TError, void, TContext> | undefined;
|
|
58
|
+
request?: SecondParameter<typeof customInstance>;
|
|
59
|
+
} | undefined) => UseMutationOptions<EventStreamGetPostResponse, TError, void, TContext>;
|
|
60
|
+
type CreateEventStreamMutationResult = NonNullable<Awaited<ReturnType<typeof createEventStream>>>;
|
|
61
|
+
type CreateEventStreamMutationError = ErrorType<AsError | void>;
|
|
62
|
+
/**
|
|
63
|
+
* @summary Create a new Server-Sent Events EventStream
|
|
64
|
+
*/
|
|
65
|
+
declare const useCreateEventStream: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
66
|
+
mutation?: UseMutationOptions<EventStreamGetPostResponse, TError, void, TContext> | undefined;
|
|
67
|
+
request?: SecondParameter<typeof customInstance>;
|
|
68
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<EventStreamGetPostResponse, TError, void, TContext>;
|
|
69
|
+
/**
|
|
70
|
+
* Gets events that you are entitled to receive. Events are delivered as **Server Sent Events** and you are expected to continuously read form this endpoint or it will be closed.
|
|
71
|
+
|
|
72
|
+
This is an un-authenticated endpoint. In order to read from the stream the caller must provide either the User access token that belongs to the event stream or the **read token** that was allocated when the stream was created. The **read token** must be provided in the request header property `X-IM-AS-EventStreamReadToken`.
|
|
73
|
+
|
|
74
|
+
* @summary Subscribe to Server-Sent Events events from an EventStream
|
|
75
|
+
*/
|
|
76
|
+
declare const getEventStreamEvents: (eventStreamId: number, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<string>;
|
|
77
|
+
declare const getGetEventStreamEventsQueryKey: (eventStreamId: number) => readonly ["account-server-api", `/event-stream/${number}`];
|
|
78
|
+
declare const getGetEventStreamEventsQueryOptions: <TData = string, TError = ErrorType<void | AsError>>(eventStreamId: number, options?: {
|
|
79
|
+
query?: Partial<UseQueryOptions<string, TError, TData, QueryKey>> | undefined;
|
|
80
|
+
request?: SecondParameter<typeof customInstance>;
|
|
81
|
+
} | undefined) => UseQueryOptions<string, TError, TData, QueryKey> & {
|
|
82
|
+
queryKey: QueryKey;
|
|
83
|
+
};
|
|
84
|
+
type GetEventStreamEventsQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStreamEvents>>>;
|
|
85
|
+
type GetEventStreamEventsQueryError = ErrorType<void | AsError>;
|
|
86
|
+
/**
|
|
87
|
+
* @summary Subscribe to Server-Sent Events events from an EventStream
|
|
88
|
+
*/
|
|
89
|
+
declare const useGetEventStreamEvents: <TData = string, TError = ErrorType<void | AsError>>(eventStreamId: number, options?: {
|
|
90
|
+
query?: Partial<UseQueryOptions<string, TError, TData, QueryKey>> | undefined;
|
|
91
|
+
request?: SecondParameter<typeof customInstance>;
|
|
92
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
93
|
+
queryKey: QueryKey;
|
|
94
|
+
};
|
|
95
|
+
declare const getGetEventStreamEventsSuspenseQueryOptions: <TData = string, TError = ErrorType<void | AsError>>(eventStreamId: number, options?: {
|
|
96
|
+
query?: Partial<UseSuspenseQueryOptions<string, TError, TData, QueryKey>> | undefined;
|
|
97
|
+
request?: SecondParameter<typeof customInstance>;
|
|
98
|
+
} | undefined) => UseSuspenseQueryOptions<string, TError, TData, QueryKey> & {
|
|
99
|
+
queryKey: QueryKey;
|
|
100
|
+
};
|
|
101
|
+
type GetEventStreamEventsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStreamEvents>>>;
|
|
102
|
+
type GetEventStreamEventsSuspenseQueryError = ErrorType<void | AsError>;
|
|
103
|
+
/**
|
|
104
|
+
* @summary Subscribe to Server-Sent Events events from an EventStream
|
|
105
|
+
*/
|
|
106
|
+
declare const useGetEventStreamEventsSuspense: <TData = string, TError = ErrorType<void | AsError>>(eventStreamId: number, options?: {
|
|
107
|
+
query?: Partial<UseSuspenseQueryOptions<string, TError, TData, QueryKey>> | undefined;
|
|
108
|
+
request?: SecondParameter<typeof customInstance>;
|
|
109
|
+
} | undefined) => UseSuspenseQueryResult<TData, TError> & {
|
|
110
|
+
queryKey: QueryKey;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Deletes an Event Stream.
|
|
114
|
+
|
|
115
|
+
You must be the user who created the event stream.
|
|
116
|
+
|
|
117
|
+
* @summary Deletes an existing EventStream (that you created)
|
|
118
|
+
*/
|
|
119
|
+
declare const deleteEventStream: (eventStreamId: number, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
120
|
+
declare const getDeleteEventStreamMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
121
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
122
|
+
eventStreamId: number;
|
|
123
|
+
}, TContext> | undefined;
|
|
124
|
+
request?: SecondParameter<typeof customInstance>;
|
|
125
|
+
} | undefined) => UseMutationOptions<void, TError, {
|
|
126
|
+
eventStreamId: number;
|
|
127
|
+
}, TContext>;
|
|
128
|
+
type DeleteEventStreamMutationResult = NonNullable<Awaited<ReturnType<typeof deleteEventStream>>>;
|
|
129
|
+
type DeleteEventStreamMutationError = ErrorType<AsError>;
|
|
130
|
+
/**
|
|
131
|
+
* @summary Deletes an existing EventStream (that you created)
|
|
132
|
+
*/
|
|
133
|
+
declare const useDeleteEventStream: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
134
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
135
|
+
eventStreamId: number;
|
|
136
|
+
}, TContext> | undefined;
|
|
137
|
+
request?: SecondParameter<typeof customInstance>;
|
|
138
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
|
|
139
|
+
eventStreamId: number;
|
|
140
|
+
}, TContext>;
|
|
141
|
+
|
|
142
|
+
export { type CreateEventStreamMutationError, type CreateEventStreamMutationResult, type DeleteEventStreamMutationError, type DeleteEventStreamMutationResult, type GetEventStreamEventsQueryError, type GetEventStreamEventsQueryResult, type GetEventStreamEventsSuspenseQueryError, type GetEventStreamEventsSuspenseQueryResult, type GetEventStreamQueryError, type GetEventStreamQueryResult, type GetEventStreamSuspenseQueryError, type GetEventStreamSuspenseQueryResult, createEventStream, deleteEventStream, getCreateEventStreamMutationOptions, getDeleteEventStreamMutationOptions, getEventStream, getEventStreamEvents, getGetEventStreamEventsQueryKey, getGetEventStreamEventsQueryOptions, getGetEventStreamEventsSuspenseQueryOptions, getGetEventStreamQueryKey, getGetEventStreamQueryOptions, getGetEventStreamSuspenseQueryOptions, useCreateEventStream, useDeleteEventStream, useGetEventStream, useGetEventStreamEvents, useGetEventStreamEventsSuspense, useGetEventStreamSuspense };
|