@squonk/account-server-client 2.0.10 → 2.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +1 -1
  2. package/admin/admin.cjs +19 -4
  3. package/admin/admin.cjs.map +1 -1
  4. package/admin/admin.d.cts +23 -6
  5. package/admin/admin.d.ts +23 -6
  6. package/admin/admin.js +19 -4
  7. package/admin/admin.js.map +1 -1
  8. package/asset/asset.cjs +33 -18
  9. package/asset/asset.cjs.map +1 -1
  10. package/asset/asset.d.cts +37 -18
  11. package/asset/asset.d.ts +37 -18
  12. package/asset/asset.js +25 -10
  13. package/asset/asset.js.map +1 -1
  14. package/{chunk-UKA7G3OB.js → chunk-EBOQPVLG.js} +2 -2
  15. package/{chunk-UKA7G3OB.js.map → chunk-EBOQPVLG.js.map} +1 -1
  16. package/{chunk-J22A7LHX.cjs → chunk-TKLTUR4R.cjs} +2 -2
  17. package/chunk-TKLTUR4R.cjs.map +1 -0
  18. package/event-stream/event-stream.cjs +146 -0
  19. package/event-stream/event-stream.cjs.map +1 -0
  20. package/event-stream/event-stream.d.cts +142 -0
  21. package/event-stream/event-stream.d.ts +142 -0
  22. package/event-stream/event-stream.js +146 -0
  23. package/event-stream/event-stream.js.map +1 -0
  24. package/event-stream/package.json +7 -0
  25. package/index.cjs +2 -2
  26. package/index.cjs.map +1 -1
  27. package/index.d.cts +700 -2
  28. package/index.d.ts +700 -2
  29. package/index.js +1 -1
  30. package/index.js.map +1 -1
  31. package/merchant/merchant.cjs +35 -6
  32. package/merchant/merchant.cjs.map +1 -1
  33. package/merchant/merchant.d.cts +42 -8
  34. package/merchant/merchant.d.ts +42 -8
  35. package/merchant/merchant.js +34 -5
  36. package/merchant/merchant.js.map +1 -1
  37. package/organisation/organisation.cjs +73 -16
  38. package/organisation/organisation.cjs.map +1 -1
  39. package/organisation/organisation.d.cts +84 -16
  40. package/organisation/organisation.d.ts +84 -16
  41. package/organisation/organisation.js +66 -9
  42. package/organisation/organisation.js.map +1 -1
  43. package/package.json +11 -11
  44. package/product/product.cjs +121 -22
  45. package/product/product.cjs.map +1 -1
  46. package/product/product.d.cts +141 -22
  47. package/product/product.d.ts +141 -22
  48. package/product/product.js +111 -12
  49. package/product/product.js.map +1 -1
  50. package/src/account-server-api.schemas.ts +9 -2
  51. package/src/admin/admin.ts +51 -15
  52. package/src/asset/asset.ts +64 -40
  53. package/src/custom-instance.ts +3 -4
  54. package/src/event-stream/event-stream.ts +353 -0
  55. package/src/merchant/merchant.ts +94 -19
  56. package/src/organisation/organisation.ts +185 -36
  57. package/src/product/product.ts +314 -48
  58. package/src/state/state.ts +51 -15
  59. package/src/unit/unit.ts +191 -46
  60. package/src/user/user.ts +141 -35
  61. package/state/state.cjs +19 -4
  62. package/state/state.cjs.map +1 -1
  63. package/state/state.d.cts +23 -6
  64. package/state/state.d.ts +23 -6
  65. package/state/state.js +19 -4
  66. package/state/state.js.map +1 -1
  67. package/unit/unit.cjs +77 -20
  68. package/unit/unit.cjs.map +1 -1
  69. package/unit/unit.d.cts +91 -23
  70. package/unit/unit.d.ts +91 -23
  71. package/unit/unit.js +68 -11
  72. package/unit/unit.js.map +1 -1
  73. package/user/user.cjs +59 -16
  74. package/user/user.cjs.map +1 -1
  75. package/user/user.d.cts +66 -15
  76. package/user/user.d.ts +66 -15
  77. package/user/user.js +53 -10
  78. package/user/user.js.map +1 -1
  79. package/chunk-J22A7LHX.cjs.map +0 -1
  80. package/custom-instance-56b86e9f.d.ts +0 -694
@@ -0,0 +1,146 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunkTKLTUR4Rcjs = require('../chunk-TKLTUR4R.cjs');
4
+
5
+ // src/event-stream/event-stream.ts
6
+
7
+
8
+
9
+
10
+ var _reactquery = require('@tanstack/react-query');
11
+ var getEventStream = (options, signal) => {
12
+ return _chunkTKLTUR4Rcjs.customInstance.call(void 0,
13
+ {
14
+ url: `/event-stream`,
15
+ method: "GET",
16
+ signal
17
+ },
18
+ options
19
+ );
20
+ };
21
+ var getGetEventStreamQueryKey = () => {
22
+ return ["account-server-api", `/event-stream`];
23
+ };
24
+ var getGetEventStreamQueryOptions = (options) => {
25
+ const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
26
+ const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetEventStreamQueryKey()));
27
+ const queryFn = ({ signal }) => getEventStream(requestOptions, signal);
28
+ return { queryKey, queryFn, ...queryOptions };
29
+ };
30
+ var useGetEventStream = (options) => {
31
+ const queryOptions = getGetEventStreamQueryOptions(options);
32
+ const query = _reactquery.useQuery.call(void 0, queryOptions);
33
+ query.queryKey = queryOptions.queryKey;
34
+ return query;
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
+ };
48
+ var createEventStream = (options) => {
49
+ return _chunkTKLTUR4Rcjs.customInstance.call(void 0,
50
+ {
51
+ url: `/event-stream`,
52
+ method: "POST"
53
+ },
54
+ options
55
+ );
56
+ };
57
+ var getCreateEventStreamMutationOptions = (options) => {
58
+ const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
59
+ const mutationFn = () => {
60
+ return createEventStream(requestOptions);
61
+ };
62
+ return { mutationFn, ...mutationOptions };
63
+ };
64
+ var useCreateEventStream = (options) => {
65
+ const mutationOptions = getCreateEventStreamMutationOptions(options);
66
+ return _reactquery.useMutation.call(void 0, mutationOptions);
67
+ };
68
+ var getEventStreamEvents = (eventStreamId, options, signal) => {
69
+ return _chunkTKLTUR4Rcjs.customInstance.call(void 0,
70
+ {
71
+ url: `/event-stream/${eventStreamId}`,
72
+ method: "GET",
73
+ signal
74
+ },
75
+ options
76
+ );
77
+ };
78
+ var getGetEventStreamEventsQueryKey = (eventStreamId) => {
79
+ return ["account-server-api", `/event-stream/${eventStreamId}`];
80
+ };
81
+ var getGetEventStreamEventsQueryOptions = (eventStreamId, options) => {
82
+ const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
83
+ const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetEventStreamEventsQueryKey(eventStreamId)));
84
+ const queryFn = ({ signal }) => getEventStreamEvents(eventStreamId, requestOptions, signal);
85
+ return { queryKey, queryFn, enabled: !!eventStreamId, ...queryOptions };
86
+ };
87
+ var useGetEventStreamEvents = (eventStreamId, options) => {
88
+ const queryOptions = getGetEventStreamEventsQueryOptions(eventStreamId, options);
89
+ const query = _reactquery.useQuery.call(void 0, queryOptions);
90
+ query.queryKey = queryOptions.queryKey;
91
+ return query;
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
+ };
105
+ var deleteEventStream = (eventStreamId, options) => {
106
+ return _chunkTKLTUR4Rcjs.customInstance.call(void 0,
107
+ {
108
+ url: `/event-stream/${eventStreamId}`,
109
+ method: "DELETE"
110
+ },
111
+ options
112
+ );
113
+ };
114
+ var getDeleteEventStreamMutationOptions = (options) => {
115
+ const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
116
+ const mutationFn = (props) => {
117
+ const { eventStreamId } = _nullishCoalesce(props, () => ( {}));
118
+ return deleteEventStream(eventStreamId, requestOptions);
119
+ };
120
+ return { mutationFn, ...mutationOptions };
121
+ };
122
+ var useDeleteEventStream = (options) => {
123
+ const mutationOptions = getDeleteEventStreamMutationOptions(options);
124
+ return _reactquery.useMutation.call(void 0, mutationOptions);
125
+ };
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
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;
146
+ //# sourceMappingURL=event-stream.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/event-stream/event-stream.ts"],"names":[],"mappings":"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","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 };
@@ -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.js';
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 };
@@ -0,0 +1,146 @@
1
+ import {
2
+ customInstance
3
+ } from "../chunk-EBOQPVLG.js";
4
+
5
+ // src/event-stream/event-stream.ts
6
+ import {
7
+ useMutation,
8
+ useQuery,
9
+ useSuspenseQuery
10
+ } from "@tanstack/react-query";
11
+ var getEventStream = (options, signal) => {
12
+ return customInstance(
13
+ {
14
+ url: `/event-stream`,
15
+ method: "GET",
16
+ signal
17
+ },
18
+ options
19
+ );
20
+ };
21
+ var getGetEventStreamQueryKey = () => {
22
+ return ["account-server-api", `/event-stream`];
23
+ };
24
+ var getGetEventStreamQueryOptions = (options) => {
25
+ const { query: queryOptions, request: requestOptions } = options ?? {};
26
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetEventStreamQueryKey();
27
+ const queryFn = ({ signal }) => getEventStream(requestOptions, signal);
28
+ return { queryKey, queryFn, ...queryOptions };
29
+ };
30
+ var useGetEventStream = (options) => {
31
+ const queryOptions = getGetEventStreamQueryOptions(options);
32
+ const query = useQuery(queryOptions);
33
+ query.queryKey = queryOptions.queryKey;
34
+ return query;
35
+ };
36
+ var getGetEventStreamSuspenseQueryOptions = (options) => {
37
+ const { query: queryOptions, request: requestOptions } = options ?? {};
38
+ const queryKey = (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 = useSuspenseQuery(queryOptions);
45
+ query.queryKey = queryOptions.queryKey;
46
+ return query;
47
+ };
48
+ var createEventStream = (options) => {
49
+ return customInstance(
50
+ {
51
+ url: `/event-stream`,
52
+ method: "POST"
53
+ },
54
+ options
55
+ );
56
+ };
57
+ var getCreateEventStreamMutationOptions = (options) => {
58
+ const { mutation: mutationOptions, request: requestOptions } = options ?? {};
59
+ const mutationFn = () => {
60
+ return createEventStream(requestOptions);
61
+ };
62
+ return { mutationFn, ...mutationOptions };
63
+ };
64
+ var useCreateEventStream = (options) => {
65
+ const mutationOptions = getCreateEventStreamMutationOptions(options);
66
+ return useMutation(mutationOptions);
67
+ };
68
+ var getEventStreamEvents = (eventStreamId, options, signal) => {
69
+ return customInstance(
70
+ {
71
+ url: `/event-stream/${eventStreamId}`,
72
+ method: "GET",
73
+ signal
74
+ },
75
+ options
76
+ );
77
+ };
78
+ var getGetEventStreamEventsQueryKey = (eventStreamId) => {
79
+ return ["account-server-api", `/event-stream/${eventStreamId}`];
80
+ };
81
+ var getGetEventStreamEventsQueryOptions = (eventStreamId, options) => {
82
+ const { query: queryOptions, request: requestOptions } = options ?? {};
83
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetEventStreamEventsQueryKey(eventStreamId);
84
+ const queryFn = ({ signal }) => getEventStreamEvents(eventStreamId, requestOptions, signal);
85
+ return { queryKey, queryFn, enabled: !!eventStreamId, ...queryOptions };
86
+ };
87
+ var useGetEventStreamEvents = (eventStreamId, options) => {
88
+ const queryOptions = getGetEventStreamEventsQueryOptions(eventStreamId, options);
89
+ const query = useQuery(queryOptions);
90
+ query.queryKey = queryOptions.queryKey;
91
+ return query;
92
+ };
93
+ var getGetEventStreamEventsSuspenseQueryOptions = (eventStreamId, options) => {
94
+ const { query: queryOptions, request: requestOptions } = options ?? {};
95
+ const queryKey = (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 = useSuspenseQuery(queryOptions);
102
+ query.queryKey = queryOptions.queryKey;
103
+ return query;
104
+ };
105
+ var deleteEventStream = (eventStreamId, options) => {
106
+ return customInstance(
107
+ {
108
+ url: `/event-stream/${eventStreamId}`,
109
+ method: "DELETE"
110
+ },
111
+ options
112
+ );
113
+ };
114
+ var getDeleteEventStreamMutationOptions = (options) => {
115
+ const { mutation: mutationOptions, request: requestOptions } = options ?? {};
116
+ const mutationFn = (props) => {
117
+ const { eventStreamId } = props ?? {};
118
+ return deleteEventStream(eventStreamId, requestOptions);
119
+ };
120
+ return { mutationFn, ...mutationOptions };
121
+ };
122
+ var useDeleteEventStream = (options) => {
123
+ const mutationOptions = getDeleteEventStreamMutationOptions(options);
124
+ return useMutation(mutationOptions);
125
+ };
126
+ export {
127
+ createEventStream,
128
+ deleteEventStream,
129
+ getCreateEventStreamMutationOptions,
130
+ getDeleteEventStreamMutationOptions,
131
+ getEventStream,
132
+ getEventStreamEvents,
133
+ getGetEventStreamEventsQueryKey,
134
+ getGetEventStreamEventsQueryOptions,
135
+ getGetEventStreamEventsSuspenseQueryOptions,
136
+ getGetEventStreamQueryKey,
137
+ getGetEventStreamQueryOptions,
138
+ getGetEventStreamSuspenseQueryOptions,
139
+ useCreateEventStream,
140
+ useDeleteEventStream,
141
+ useGetEventStream,
142
+ useGetEventStreamEvents,
143
+ useGetEventStreamEventsSuspense,
144
+ useGetEventStreamSuspense
145
+ };
146
+ //# sourceMappingURL=event-stream.js.map