@squonk/account-server-client 4.2.5 → 4.4.0-4-4.2174353771

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 (92) hide show
  1. package/actions/actions.cjs +53 -0
  2. package/actions/actions.cjs.map +1 -0
  3. package/actions/actions.d.cts +72 -0
  4. package/actions/actions.d.ts +72 -0
  5. package/actions/actions.js +53 -0
  6. package/actions/actions.js.map +1 -0
  7. package/actions/package.json +7 -0
  8. package/asset/asset.cjs +99 -126
  9. package/asset/asset.cjs.map +1 -1
  10. package/asset/asset.d.cts +99 -99
  11. package/asset/asset.d.ts +99 -99
  12. package/asset/asset.js +107 -134
  13. package/asset/asset.js.map +1 -1
  14. package/charges/charges.cjs +73 -85
  15. package/charges/charges.cjs.map +1 -1
  16. package/charges/charges.d.cts +47 -47
  17. package/charges/charges.d.ts +47 -47
  18. package/charges/charges.js +78 -90
  19. package/charges/charges.js.map +1 -1
  20. package/chunk-76ADQBHZ.js +25 -0
  21. package/chunk-76ADQBHZ.js.map +1 -0
  22. package/chunk-KHB5TJT7.cjs +25 -0
  23. package/chunk-KHB5TJT7.cjs.map +1 -0
  24. package/{chunk-TKLTUR4R.cjs → chunk-RB2KVIEK.cjs} +1 -1
  25. package/chunk-RB2KVIEK.cjs.map +1 -0
  26. package/{chunk-EBOQPVLG.js → chunk-XYDLYMQ2.js} +1 -1
  27. package/chunk-XYDLYMQ2.js.map +1 -0
  28. package/event-stream/event-stream.cjs +53 -61
  29. package/event-stream/event-stream.cjs.map +1 -1
  30. package/event-stream/event-stream.d.cts +44 -44
  31. package/event-stream/event-stream.d.ts +44 -44
  32. package/event-stream/event-stream.js +58 -66
  33. package/event-stream/event-stream.js.map +1 -1
  34. package/index.cjs +56 -58
  35. package/index.cjs.map +1 -1
  36. package/index.d.cts +867 -777
  37. package/index.d.ts +867 -777
  38. package/index.js +55 -57
  39. package/index.js.map +1 -1
  40. package/merchant/merchant.cjs +38 -45
  41. package/merchant/merchant.cjs.map +1 -1
  42. package/merchant/merchant.d.cts +25 -25
  43. package/merchant/merchant.d.ts +25 -25
  44. package/merchant/merchant.js +42 -49
  45. package/merchant/merchant.js.map +1 -1
  46. package/organisation/organisation.cjs +77 -87
  47. package/organisation/organisation.cjs.map +1 -1
  48. package/organisation/organisation.d.cts +72 -70
  49. package/organisation/organisation.d.ts +72 -70
  50. package/organisation/organisation.js +83 -93
  51. package/organisation/organisation.js.map +1 -1
  52. package/package.json +15 -18
  53. package/product/product.cjs +143 -153
  54. package/product/product.cjs.map +1 -1
  55. package/product/product.d.cts +100 -100
  56. package/product/product.d.ts +100 -100
  57. package/product/product.js +153 -163
  58. package/product/product.js.map +1 -1
  59. package/src/{account-server-api.schemas.ts → API_TARGET_NAME.schemas.ts} +931 -849
  60. package/src/actions/actions.ts +249 -0
  61. package/src/asset/asset.ts +899 -634
  62. package/src/charges/charges.ts +822 -498
  63. package/src/custom-instance.ts +3 -3
  64. package/src/event-stream/event-stream.ts +530 -344
  65. package/src/index.ts +3 -3
  66. package/src/merchant/merchant.ts +355 -234
  67. package/src/options-mutator.ts +27 -0
  68. package/src/organisation/organisation.ts +812 -504
  69. package/src/product/product.ts +1373 -841
  70. package/src/state/state.ts +174 -127
  71. package/src/unit/unit.ts +1273 -603
  72. package/src/user/user.ts +895 -564
  73. package/state/state.cjs +22 -24
  74. package/state/state.cjs.map +1 -1
  75. package/state/state.d.cts +14 -14
  76. package/state/state.d.ts +14 -14
  77. package/state/state.js +24 -26
  78. package/state/state.js.map +1 -1
  79. package/unit/unit.cjs +171 -106
  80. package/unit/unit.cjs.map +1 -1
  81. package/unit/unit.d.cts +200 -90
  82. package/unit/unit.d.ts +200 -90
  83. package/unit/unit.js +179 -114
  84. package/unit/unit.js.map +1 -1
  85. package/user/user.cjs +94 -110
  86. package/user/user.cjs.map +1 -1
  87. package/user/user.d.cts +77 -77
  88. package/user/user.d.ts +77 -77
  89. package/user/user.js +101 -117
  90. package/user/user.js.map +1 -1
  91. package/chunk-EBOQPVLG.js.map +0 -1
  92. package/chunk-TKLTUR4R.cjs.map +0 -1
@@ -0,0 +1,249 @@
1
+ /**
2
+ * Generated by orval v7.10.0 🍺
3
+ * Do not edit manually.
4
+ * Account Server API
5
+ * The Informatics Matters Account Server API.
6
+
7
+ A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
8
+
9
+ * OpenAPI spec version: 4.4
10
+ */
11
+ import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
12
+ import type {
13
+ DataTag,
14
+ DefinedInitialDataOptions,
15
+ DefinedUseQueryResult,
16
+ QueryClient,
17
+ QueryFunction,
18
+ QueryKey,
19
+ UndefinedInitialDataOptions,
20
+ UseQueryOptions,
21
+ UseQueryResult,
22
+ UseSuspenseQueryOptions,
23
+ UseSuspenseQueryResult,
24
+ } from "@tanstack/react-query";
25
+
26
+ import type { ActionGetResponse, GetActionsParams } from "../API_TARGET_NAME.schemas";
27
+
28
+ import { customInstance } from ".././custom-instance";
29
+ import type { ErrorType } from ".././custom-instance";
30
+ import { queryMutator } from ".././options-mutator";
31
+
32
+ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
33
+
34
+ /**
35
+ * This endpoint delivers Action records (protocol buffers) that can be selected based on a date and time range and limited to merchants, organisations, Units, or Products. You can receive Action content as a `PROTOCOL_STRING` (the default), or `JSON_STRING`. If you do not provide a `format` `PROTOCOL_STRING` will be assumed.
36
+
37
+ You can provide a `m_id`, `org_id`, `unit_id`, `product_id`, but only one.
38
+
39
+ You can also provide `from` and `until` dates to limit the response to Actions that occur on the days you select. Actions are returned that are not before the `from` data but are before the `until` date. If neither `from` or `until` is provided `from` is assumed to be from _today_ until _tomorrow_.
40
+
41
+ You need admin privilege to use this endpoint.
42
+
43
+ * @summary Gets Actions held on the Account Server
44
+ */
45
+ export const getActions = (
46
+ params?: GetActionsParams,
47
+ options?: SecondParameter<typeof customInstance>,
48
+ signal?: AbortSignal,
49
+ ) => {
50
+ return customInstance<ActionGetResponse>(
51
+ { url: `/action`, method: "GET", params, signal },
52
+ options,
53
+ );
54
+ };
55
+
56
+ export const getGetActionsQueryKey = (params?: GetActionsParams) => {
57
+ return [`/action`, ...(params ? [params] : [])] as const;
58
+ };
59
+
60
+ export const useGetActionsQueryOptions = <
61
+ TData = Awaited<ReturnType<typeof getActions>>,
62
+ TError = ErrorType<void>,
63
+ >(
64
+ params?: GetActionsParams,
65
+ options?: {
66
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
67
+ request?: SecondParameter<typeof customInstance>;
68
+ },
69
+ ) => {
70
+ const { query: queryOptions, request: requestOptions } = options ?? {};
71
+
72
+ const queryKey = queryOptions?.queryKey ?? getGetActionsQueryKey(params);
73
+
74
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getActions>>> = ({ signal }) =>
75
+ getActions(params, requestOptions, signal);
76
+
77
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
78
+
79
+ return customOptions as UseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData> & {
80
+ queryKey: DataTag<QueryKey, TData, TError>;
81
+ };
82
+ };
83
+
84
+ export type GetActionsQueryResult = NonNullable<Awaited<ReturnType<typeof getActions>>>;
85
+ export type GetActionsQueryError = ErrorType<void>;
86
+
87
+ export function useGetActions<
88
+ TData = Awaited<ReturnType<typeof getActions>>,
89
+ TError = ErrorType<void>,
90
+ >(
91
+ params: undefined | GetActionsParams,
92
+ options: {
93
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>> &
94
+ Pick<
95
+ DefinedInitialDataOptions<
96
+ Awaited<ReturnType<typeof getActions>>,
97
+ TError,
98
+ Awaited<ReturnType<typeof getActions>>
99
+ >,
100
+ "initialData"
101
+ >;
102
+ request?: SecondParameter<typeof customInstance>;
103
+ },
104
+ queryClient?: QueryClient,
105
+ ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
106
+ export function useGetActions<
107
+ TData = Awaited<ReturnType<typeof getActions>>,
108
+ TError = ErrorType<void>,
109
+ >(
110
+ params?: GetActionsParams,
111
+ options?: {
112
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>> &
113
+ Pick<
114
+ UndefinedInitialDataOptions<
115
+ Awaited<ReturnType<typeof getActions>>,
116
+ TError,
117
+ Awaited<ReturnType<typeof getActions>>
118
+ >,
119
+ "initialData"
120
+ >;
121
+ request?: SecondParameter<typeof customInstance>;
122
+ },
123
+ queryClient?: QueryClient,
124
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
125
+ export function useGetActions<
126
+ TData = Awaited<ReturnType<typeof getActions>>,
127
+ TError = ErrorType<void>,
128
+ >(
129
+ params?: GetActionsParams,
130
+ options?: {
131
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
132
+ request?: SecondParameter<typeof customInstance>;
133
+ },
134
+ queryClient?: QueryClient,
135
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
136
+ /**
137
+ * @summary Gets Actions held on the Account Server
138
+ */
139
+
140
+ export function useGetActions<
141
+ TData = Awaited<ReturnType<typeof getActions>>,
142
+ TError = ErrorType<void>,
143
+ >(
144
+ params?: GetActionsParams,
145
+ options?: {
146
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
147
+ request?: SecondParameter<typeof customInstance>;
148
+ },
149
+ queryClient?: QueryClient,
150
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
151
+ const queryOptions = useGetActionsQueryOptions(params, options);
152
+
153
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
154
+ queryKey: DataTag<QueryKey, TData, TError>;
155
+ };
156
+
157
+ query.queryKey = queryOptions.queryKey;
158
+
159
+ return query;
160
+ }
161
+
162
+ export const useGetActionsSuspenseQueryOptions = <
163
+ TData = Awaited<ReturnType<typeof getActions>>,
164
+ TError = ErrorType<void>,
165
+ >(
166
+ params?: GetActionsParams,
167
+ options?: {
168
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
169
+ request?: SecondParameter<typeof customInstance>;
170
+ },
171
+ ) => {
172
+ const { query: queryOptions, request: requestOptions } = options ?? {};
173
+
174
+ const queryKey = queryOptions?.queryKey ?? getGetActionsQueryKey(params);
175
+
176
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getActions>>> = ({ signal }) =>
177
+ getActions(params, requestOptions, signal);
178
+
179
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
180
+
181
+ return customOptions as UseSuspenseQueryOptions<
182
+ Awaited<ReturnType<typeof getActions>>,
183
+ TError,
184
+ TData
185
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
186
+ };
187
+
188
+ export type GetActionsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getActions>>>;
189
+ export type GetActionsSuspenseQueryError = ErrorType<void>;
190
+
191
+ export function useGetActionsSuspense<
192
+ TData = Awaited<ReturnType<typeof getActions>>,
193
+ TError = ErrorType<void>,
194
+ >(
195
+ params: undefined | GetActionsParams,
196
+ options: {
197
+ query: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
198
+ request?: SecondParameter<typeof customInstance>;
199
+ },
200
+ queryClient?: QueryClient,
201
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
202
+ export function useGetActionsSuspense<
203
+ TData = Awaited<ReturnType<typeof getActions>>,
204
+ TError = ErrorType<void>,
205
+ >(
206
+ params?: GetActionsParams,
207
+ options?: {
208
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
209
+ request?: SecondParameter<typeof customInstance>;
210
+ },
211
+ queryClient?: QueryClient,
212
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
213
+ export function useGetActionsSuspense<
214
+ TData = Awaited<ReturnType<typeof getActions>>,
215
+ TError = ErrorType<void>,
216
+ >(
217
+ params?: GetActionsParams,
218
+ options?: {
219
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
220
+ request?: SecondParameter<typeof customInstance>;
221
+ },
222
+ queryClient?: QueryClient,
223
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
224
+ /**
225
+ * @summary Gets Actions held on the Account Server
226
+ */
227
+
228
+ export function useGetActionsSuspense<
229
+ TData = Awaited<ReturnType<typeof getActions>>,
230
+ TError = ErrorType<void>,
231
+ >(
232
+ params?: GetActionsParams,
233
+ options?: {
234
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
235
+ request?: SecondParameter<typeof customInstance>;
236
+ },
237
+ queryClient?: QueryClient,
238
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
239
+ const queryOptions = useGetActionsSuspenseQueryOptions(params, options);
240
+
241
+ const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
242
+ TData,
243
+ TError
244
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
245
+
246
+ query.queryKey = queryOptions.queryKey;
247
+
248
+ return query;
249
+ }