mtmsdk 0.0.48 → 0.0.50

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 (236) hide show
  1. package/dist/gomtmapi/@tanstack/react-query.gen.d.ts +2 -80
  2. package/dist/gomtmapi/@tanstack/react-query.gen.d.ts.map +1 -1
  3. package/dist/gomtmapi/@tanstack/react-query.gen.js +2 -176
  4. package/dist/gomtmapi/@tanstack/react-query.gen.js.map +1 -1
  5. package/dist/gomtmapi/index.d.ts +2 -2
  6. package/dist/gomtmapi/index.d.ts.map +1 -1
  7. package/dist/gomtmapi/index.js +1 -1
  8. package/dist/gomtmapi/index.js.map +1 -1
  9. package/dist/gomtmapi/schemas.gen.d.ts +14 -328
  10. package/dist/gomtmapi/schemas.gen.d.ts.map +1 -1
  11. package/dist/gomtmapi/schemas.gen.js +14 -341
  12. package/dist/gomtmapi/schemas.gen.js.map +1 -1
  13. package/dist/gomtmapi/sdk.gen.d.ts +2 -80
  14. package/dist/gomtmapi/sdk.gen.d.ts.map +1 -1
  15. package/dist/gomtmapi/sdk.gen.js +1 -135
  16. package/dist/gomtmapi/sdk.gen.js.map +1 -1
  17. package/dist/gomtmapi/types.gen.d.ts +10 -437
  18. package/dist/gomtmapi/types.gen.d.ts.map +1 -1
  19. package/dist/gomtmapi/zod.gen.d.ts +8 -308
  20. package/dist/gomtmapi/zod.gen.d.ts.map +1 -1
  21. package/dist/gomtmapi/zod.gen.js +4 -232
  22. package/dist/gomtmapi/zod.gen.js.map +1 -1
  23. package/dist/mtgate_api/@tanstack/react-query.gen.d.ts +1 -29
  24. package/dist/mtgate_api/@tanstack/react-query.gen.d.ts.map +1 -1
  25. package/dist/mtgate_api/@tanstack/react-query.gen.js +1 -17
  26. package/dist/mtgate_api/@tanstack/react-query.gen.js.map +1 -1
  27. package/dist/mtgate_api/index.d.ts +2 -2
  28. package/dist/mtgate_api/index.d.ts.map +1 -1
  29. package/dist/mtgate_api/index.js +1 -1
  30. package/dist/mtgate_api/index.js.map +1 -1
  31. package/dist/mtgate_api/sdk.gen.d.ts +1 -5
  32. package/dist/mtgate_api/sdk.gen.d.ts.map +1 -1
  33. package/dist/mtgate_api/sdk.gen.js +0 -4
  34. package/dist/mtgate_api/sdk.gen.js.map +1 -1
  35. package/dist/mtgate_api/types.gen.d.ts +0 -6
  36. package/dist/mtgate_api/types.gen.d.ts.map +1 -1
  37. package/dist/mtgate_api/zod.gen.d.ts +0 -5
  38. package/dist/mtgate_api/zod.gen.d.ts.map +1 -1
  39. package/dist/mtgate_api/zod.gen.js +0 -5
  40. package/dist/mtgate_api/zod.gen.js.map +1 -1
  41. package/dist/mtmai_api/index.d.ts +2 -2
  42. package/dist/mtmai_api/index.d.ts.map +1 -1
  43. package/dist/mtmai_api/index.js +1 -1
  44. package/dist/mtmai_api/index.js.map +1 -1
  45. package/dist/mtmai_api/zod.gen.d.ts +96 -96
  46. package/dist/openclaw/client-info.d.ts +0 -18
  47. package/dist/openclaw/client-info.d.ts.map +1 -1
  48. package/dist/openclaw/client-info.js +0 -6
  49. package/dist/openclaw/client-info.js.map +1 -1
  50. package/dist/openclaw/device-auth-utils.d.ts +3 -4
  51. package/dist/openclaw/device-auth-utils.d.ts.map +1 -1
  52. package/dist/openclaw/device-auth-utils.js +4 -8
  53. package/dist/openclaw/device-auth-utils.js.map +1 -1
  54. package/dist/openclaw/device-auth.d.ts.map +1 -1
  55. package/dist/openclaw/device-auth.js +5 -2
  56. package/dist/openclaw/device-auth.js.map +1 -1
  57. package/dist/openclaw/device-identity.js +2 -2
  58. package/dist/openclaw/device-identity.js.map +1 -1
  59. package/dist/openclaw/gateway.d.ts +19 -5
  60. package/dist/openclaw/gateway.d.ts.map +1 -1
  61. package/dist/openclaw/gateway.js +75 -37
  62. package/dist/openclaw/gateway.js.map +1 -1
  63. package/dist/sbmng/@tanstack/react-query.gen.d.ts +36 -8
  64. package/dist/sbmng/@tanstack/react-query.gen.d.ts.map +1 -1
  65. package/dist/sbmng/@tanstack/react-query.gen.js +22 -6
  66. package/dist/sbmng/@tanstack/react-query.gen.js.map +1 -1
  67. package/dist/sbmng/index.d.ts +2 -2
  68. package/dist/sbmng/index.d.ts.map +1 -1
  69. package/dist/sbmng/index.js +1 -1
  70. package/dist/sbmng/index.js.map +1 -1
  71. package/dist/sbmng/schemas.gen.d.ts +97 -34
  72. package/dist/sbmng/schemas.gen.d.ts.map +1 -1
  73. package/dist/sbmng/schemas.gen.js +120 -49
  74. package/dist/sbmng/schemas.gen.js.map +1 -1
  75. package/dist/sbmng/sdk.gen.d.ts +7 -3
  76. package/dist/sbmng/sdk.gen.d.ts.map +1 -1
  77. package/dist/sbmng/sdk.gen.js +11 -3
  78. package/dist/sbmng/sdk.gen.js.map +1 -1
  79. package/dist/sbmng/types.gen.d.ts +82 -30
  80. package/dist/sbmng/types.gen.d.ts.map +1 -1
  81. package/dist/supabase/schema/index.d.ts +0 -8
  82. package/dist/supabase/schema/index.d.ts.map +1 -1
  83. package/dist/supabase/schema/index.js +0 -5
  84. package/dist/supabase/schema/index.js.map +1 -1
  85. package/dist/supabase/supabase-client.d.ts +900 -719
  86. package/dist/supabase/supabase-client.d.ts.map +1 -1
  87. package/dist/supabase/supabase.d.ts +1836 -1474
  88. package/dist/supabase/supabase.d.ts.map +1 -1
  89. package/dist/supabase/use-sb-query/use-rpc-query.d.ts.map +1 -1
  90. package/dist/supabase/use-sb-query/use-rpc-query.js +2 -1
  91. package/dist/supabase/use-sb-query/use-rpc-query.js.map +1 -1
  92. package/dist/types/database.schemas.d.ts +999 -920
  93. package/dist/types/database.schemas.d.ts.map +1 -1
  94. package/dist/types/database.schemas.js +739 -435
  95. package/dist/types/database.schemas.js.map +1 -1
  96. package/dist/types/database.types.d.ts +919 -736
  97. package/dist/types/database.types.d.ts.map +1 -1
  98. package/dist/types/database.types.js +18 -2
  99. package/dist/types/database.types.js.map +1 -1
  100. package/dist/types/index.d.ts +35 -3
  101. package/dist/types/index.d.ts.map +1 -1
  102. package/dist/types/index.js +4 -1
  103. package/dist/types/index.js.map +1 -1
  104. package/package.json +4 -3
  105. package/src/gomtmapi/@tanstack/react-query.gen.ts +3 -185
  106. package/src/gomtmapi/index.ts +2 -2
  107. package/src/gomtmapi/schemas.gen.ts +14 -356
  108. package/src/gomtmapi/sdk.gen.ts +2 -144
  109. package/src/gomtmapi/types.gen.ts +10 -492
  110. package/src/gomtmapi/zod.gen.ts +4 -263
  111. package/src/mtgate_api/@tanstack/react-query.gen.ts +2 -20
  112. package/src/mtgate_api/index.ts +2 -2
  113. package/src/mtgate_api/sdk.gen.ts +1 -6
  114. package/src/mtgate_api/types.gen.ts +0 -7
  115. package/src/mtgate_api/zod.gen.ts +0 -6
  116. package/src/mtmai_api/index.ts +2 -2
  117. package/src/openclaw/client-info.ts +0 -9
  118. package/src/openclaw/device-auth-utils.ts +7 -12
  119. package/src/openclaw/device-auth.ts +5 -2
  120. package/src/openclaw/device-identity.ts +2 -2
  121. package/src/openclaw/gateway.ts +96 -50
  122. package/src/sbmng/@tanstack/react-query.gen.ts +25 -7
  123. package/src/sbmng/index.ts +2 -2
  124. package/src/sbmng/schemas.gen.ts +121 -49
  125. package/src/sbmng/sdk.gen.ts +13 -4
  126. package/src/sbmng/types.gen.ts +87 -30
  127. package/src/supabase/schema/index.ts +0 -5
  128. package/src/supabase/use-sb-query/use-rpc-query.ts +2 -1
  129. package/src/types/database.schemas.ts +948 -598
  130. package/src/types/database.types.ts +864 -674
  131. package/src/types/index.ts +20 -4
  132. package/dist/api_hatchet/@tanstack/react-query.gen.d.ts +0 -3017
  133. package/dist/api_hatchet/@tanstack/react-query.gen.d.ts.map +0 -1
  134. package/dist/api_hatchet/@tanstack/react-query.gen.js +0 -2776
  135. package/dist/api_hatchet/@tanstack/react-query.gen.js.map +0 -1
  136. package/dist/api_hatchet/client/client.gen.d.ts +0 -3
  137. package/dist/api_hatchet/client/client.gen.d.ts.map +0 -1
  138. package/dist/api_hatchet/client/client.gen.js +0 -236
  139. package/dist/api_hatchet/client/client.gen.js.map +0 -1
  140. package/dist/api_hatchet/client/index.d.ts +0 -9
  141. package/dist/api_hatchet/client/index.d.ts.map +0 -1
  142. package/dist/api_hatchet/client/index.js +0 -7
  143. package/dist/api_hatchet/client/index.js.map +0 -1
  144. package/dist/api_hatchet/client/types.gen.d.ts +0 -118
  145. package/dist/api_hatchet/client/types.gen.d.ts.map +0 -1
  146. package/dist/api_hatchet/client/types.gen.js +0 -3
  147. package/dist/api_hatchet/client/types.gen.js.map +0 -1
  148. package/dist/api_hatchet/client/utils.gen.d.ts +0 -34
  149. package/dist/api_hatchet/client/utils.gen.d.ts.map +0 -1
  150. package/dist/api_hatchet/client/utils.gen.js +0 -232
  151. package/dist/api_hatchet/client/utils.gen.js.map +0 -1
  152. package/dist/api_hatchet/client.gen.d.ts +0 -13
  153. package/dist/api_hatchet/client.gen.d.ts.map +0 -1
  154. package/dist/api_hatchet/client.gen.js +0 -4
  155. package/dist/api_hatchet/client.gen.js.map +0 -1
  156. package/dist/api_hatchet/core/auth.gen.d.ts +0 -19
  157. package/dist/api_hatchet/core/auth.gen.d.ts.map +0 -1
  158. package/dist/api_hatchet/core/auth.gen.js +0 -15
  159. package/dist/api_hatchet/core/auth.gen.js.map +0 -1
  160. package/dist/api_hatchet/core/bodySerializer.gen.d.ts +0 -26
  161. package/dist/api_hatchet/core/bodySerializer.gen.d.ts.map +0 -1
  162. package/dist/api_hatchet/core/bodySerializer.gen.js +0 -58
  163. package/dist/api_hatchet/core/bodySerializer.gen.js.map +0 -1
  164. package/dist/api_hatchet/core/params.gen.d.ts +0 -44
  165. package/dist/api_hatchet/core/params.gen.d.ts.map +0 -1
  166. package/dist/api_hatchet/core/params.gen.js +0 -101
  167. package/dist/api_hatchet/core/params.gen.js.map +0 -1
  168. package/dist/api_hatchet/core/pathSerializer.gen.d.ts +0 -34
  169. package/dist/api_hatchet/core/pathSerializer.gen.d.ts.map +0 -1
  170. package/dist/api_hatchet/core/pathSerializer.gen.js +0 -115
  171. package/dist/api_hatchet/core/pathSerializer.gen.js.map +0 -1
  172. package/dist/api_hatchet/core/queryKeySerializer.gen.d.ts +0 -19
  173. package/dist/api_hatchet/core/queryKeySerializer.gen.d.ts.map +0 -1
  174. package/dist/api_hatchet/core/queryKeySerializer.gen.js +0 -100
  175. package/dist/api_hatchet/core/queryKeySerializer.gen.js.map +0 -1
  176. package/dist/api_hatchet/core/serverSentEvents.gen.d.ts +0 -72
  177. package/dist/api_hatchet/core/serverSentEvents.gen.d.ts.map +0 -1
  178. package/dist/api_hatchet/core/serverSentEvents.gen.js +0 -138
  179. package/dist/api_hatchet/core/serverSentEvents.gen.js.map +0 -1
  180. package/dist/api_hatchet/core/types.gen.d.ts +0 -79
  181. package/dist/api_hatchet/core/types.gen.d.ts.map +0 -1
  182. package/dist/api_hatchet/core/types.gen.js +0 -3
  183. package/dist/api_hatchet/core/types.gen.js.map +0 -1
  184. package/dist/api_hatchet/core/utils.gen.d.ts +0 -20
  185. package/dist/api_hatchet/core/utils.gen.d.ts.map +0 -1
  186. package/dist/api_hatchet/core/utils.gen.js +0 -88
  187. package/dist/api_hatchet/core/utils.gen.js.map +0 -1
  188. package/dist/api_hatchet/index.d.ts +0 -3
  189. package/dist/api_hatchet/index.d.ts.map +0 -1
  190. package/dist/api_hatchet/index.js +0 -4
  191. package/dist/api_hatchet/index.js.map +0 -1
  192. package/dist/api_hatchet/schemas.gen.d.ts +0 -4068
  193. package/dist/api_hatchet/schemas.gen.d.ts.map +0 -1
  194. package/dist/api_hatchet/schemas.gen.js +0 -4743
  195. package/dist/api_hatchet/schemas.gen.js.map +0 -1
  196. package/dist/api_hatchet/sdk.gen.d.ts +0 -784
  197. package/dist/api_hatchet/sdk.gen.d.ts.map +0 -1
  198. package/dist/api_hatchet/sdk.gen.js +0 -1849
  199. package/dist/api_hatchet/sdk.gen.js.map +0 -1
  200. package/dist/api_hatchet/types.gen.d.ts +0 -6861
  201. package/dist/api_hatchet/types.gen.d.ts.map +0 -1
  202. package/dist/api_hatchet/types.gen.js +0 -209
  203. package/dist/api_hatchet/types.gen.js.map +0 -1
  204. package/dist/api_hatchet/zod.gen.d.ts +0 -10429
  205. package/dist/api_hatchet/zod.gen.d.ts.map +0 -1
  206. package/dist/api_hatchet/zod.gen.js +0 -2766
  207. package/dist/api_hatchet/zod.gen.js.map +0 -1
  208. package/dist/openclaw/uuid.d.ts +0 -6
  209. package/dist/openclaw/uuid.d.ts.map +0 -1
  210. package/dist/openclaw/uuid.js +0 -39
  211. package/dist/openclaw/uuid.js.map +0 -1
  212. package/dist/types/rpc.schemas.d.ts +0 -52
  213. package/dist/types/rpc.schemas.d.ts.map +0 -1
  214. package/dist/types/rpc.schemas.js +0 -108
  215. package/dist/types/rpc.schemas.js.map +0 -1
  216. package/src/api_hatchet/@tanstack/react-query.gen.ts +0 -3025
  217. package/src/api_hatchet/client/client.gen.ts +0 -311
  218. package/src/api_hatchet/client/index.ts +0 -25
  219. package/src/api_hatchet/client/types.gen.ts +0 -241
  220. package/src/api_hatchet/client/utils.gen.ts +0 -332
  221. package/src/api_hatchet/client.gen.ts +0 -16
  222. package/src/api_hatchet/core/auth.gen.ts +0 -42
  223. package/src/api_hatchet/core/bodySerializer.gen.ts +0 -100
  224. package/src/api_hatchet/core/params.gen.ts +0 -176
  225. package/src/api_hatchet/core/pathSerializer.gen.ts +0 -181
  226. package/src/api_hatchet/core/queryKeySerializer.gen.ts +0 -136
  227. package/src/api_hatchet/core/serverSentEvents.gen.ts +0 -266
  228. package/src/api_hatchet/core/types.gen.ts +0 -118
  229. package/src/api_hatchet/core/utils.gen.ts +0 -143
  230. package/src/api_hatchet/index.ts +0 -4
  231. package/src/api_hatchet/schemas.gen.ts +0 -4961
  232. package/src/api_hatchet/sdk.gen.ts +0 -1994
  233. package/src/api_hatchet/types.gen.ts +0 -7688
  234. package/src/api_hatchet/zod.gen.ts +0 -3230
  235. package/src/openclaw/uuid.ts +0 -48
  236. package/src/types/rpc.schemas.ts +0 -142
@@ -1,332 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
-
3
- import { getAuthToken } from '../core/auth.gen';
4
- import type { QuerySerializerOptions } from '../core/bodySerializer.gen';
5
- import { jsonBodySerializer } from '../core/bodySerializer.gen';
6
- import {
7
- serializeArrayParam,
8
- serializeObjectParam,
9
- serializePrimitiveParam,
10
- } from '../core/pathSerializer.gen';
11
- import { getUrl } from '../core/utils.gen';
12
- import type { Client, ClientOptions, Config, RequestOptions } from './types.gen';
13
-
14
- export const createQuerySerializer = <T = unknown>({
15
- parameters = {},
16
- ...args
17
- }: QuerySerializerOptions = {}) => {
18
- const querySerializer = (queryParams: T) => {
19
- const search: string[] = [];
20
- if (queryParams && typeof queryParams === 'object') {
21
- for (const name in queryParams) {
22
- const value = queryParams[name];
23
-
24
- if (value === undefined || value === null) {
25
- continue;
26
- }
27
-
28
- const options = parameters[name] || args;
29
-
30
- if (Array.isArray(value)) {
31
- const serializedArray = serializeArrayParam({
32
- allowReserved: options.allowReserved,
33
- explode: true,
34
- name,
35
- style: 'form',
36
- value,
37
- ...options.array,
38
- });
39
- if (serializedArray) search.push(serializedArray);
40
- } else if (typeof value === 'object') {
41
- const serializedObject = serializeObjectParam({
42
- allowReserved: options.allowReserved,
43
- explode: true,
44
- name,
45
- style: 'deepObject',
46
- value: value as Record<string, unknown>,
47
- ...options.object,
48
- });
49
- if (serializedObject) search.push(serializedObject);
50
- } else {
51
- const serializedPrimitive = serializePrimitiveParam({
52
- allowReserved: options.allowReserved,
53
- name,
54
- value: value as string,
55
- });
56
- if (serializedPrimitive) search.push(serializedPrimitive);
57
- }
58
- }
59
- }
60
- return search.join('&');
61
- };
62
- return querySerializer;
63
- };
64
-
65
- /**
66
- * Infers parseAs value from provided Content-Type header.
67
- */
68
- export const getParseAs = (
69
- contentType: string | null,
70
- ): Exclude<Config['parseAs'], 'auto'> => {
71
- if (!contentType) {
72
- // If no Content-Type header is provided, the best we can do is return the raw response body,
73
- // which is effectively the same as the 'stream' option.
74
- return 'stream';
75
- }
76
-
77
- const cleanContent = contentType.split(';')[0]?.trim();
78
-
79
- if (!cleanContent) {
80
- return;
81
- }
82
-
83
- if (
84
- cleanContent.startsWith('application/json') ||
85
- cleanContent.endsWith('+json')
86
- ) {
87
- return 'json';
88
- }
89
-
90
- if (cleanContent === 'multipart/form-data') {
91
- return 'formData';
92
- }
93
-
94
- if (
95
- ['application/', 'audio/', 'image/', 'video/'].some((type) =>
96
- cleanContent.startsWith(type),
97
- )
98
- ) {
99
- return 'blob';
100
- }
101
-
102
- if (cleanContent.startsWith('text/')) {
103
- return 'text';
104
- }
105
-
106
- return;
107
- };
108
-
109
- const checkForExistence = (
110
- options: Pick<RequestOptions, 'auth' | 'query'> & {
111
- headers: Headers;
112
- },
113
- name?: string,
114
- ): boolean => {
115
- if (!name) {
116
- return false;
117
- }
118
- if (
119
- options.headers.has(name) ||
120
- options.query?.[name] ||
121
- options.headers.get('Cookie')?.includes(`${name}=`)
122
- ) {
123
- return true;
124
- }
125
- return false;
126
- };
127
-
128
- export const setAuthParams = async ({
129
- security,
130
- ...options
131
- }: Pick<Required<RequestOptions>, 'security'> &
132
- Pick<RequestOptions, 'auth' | 'query'> & {
133
- headers: Headers;
134
- }) => {
135
- for (const auth of security) {
136
- if (checkForExistence(options, auth.name)) {
137
- continue;
138
- }
139
-
140
- const token = await getAuthToken(auth, options.auth);
141
-
142
- if (!token) {
143
- continue;
144
- }
145
-
146
- const name = auth.name ?? 'Authorization';
147
-
148
- switch (auth.in) {
149
- case 'query':
150
- if (!options.query) {
151
- options.query = {};
152
- }
153
- options.query[name] = token;
154
- break;
155
- case 'cookie':
156
- options.headers.append('Cookie', `${name}=${token}`);
157
- break;
158
- case 'header':
159
- default:
160
- options.headers.set(name, token);
161
- break;
162
- }
163
- }
164
- };
165
-
166
- export const buildUrl: Client['buildUrl'] = (options) =>
167
- getUrl({
168
- baseUrl: options.baseUrl as string,
169
- path: options.path,
170
- query: options.query,
171
- querySerializer:
172
- typeof options.querySerializer === 'function'
173
- ? options.querySerializer
174
- : createQuerySerializer(options.querySerializer),
175
- url: options.url,
176
- });
177
-
178
- export const mergeConfigs = (a: Config, b: Config): Config => {
179
- const config = { ...a, ...b };
180
- if (config.baseUrl?.endsWith('/')) {
181
- config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
182
- }
183
- config.headers = mergeHeaders(a.headers, b.headers);
184
- return config;
185
- };
186
-
187
- const headersEntries = (headers: Headers): Array<[string, string]> => {
188
- const entries: Array<[string, string]> = [];
189
- headers.forEach((value, key) => {
190
- entries.push([key, value]);
191
- });
192
- return entries;
193
- };
194
-
195
- export const mergeHeaders = (
196
- ...headers: Array<Required<Config>['headers'] | undefined>
197
- ): Headers => {
198
- const mergedHeaders = new Headers();
199
- for (const header of headers) {
200
- if (!header) {
201
- continue;
202
- }
203
-
204
- const iterator =
205
- header instanceof Headers
206
- ? headersEntries(header)
207
- : Object.entries(header);
208
-
209
- for (const [key, value] of iterator) {
210
- if (value === null) {
211
- mergedHeaders.delete(key);
212
- } else if (Array.isArray(value)) {
213
- for (const v of value) {
214
- mergedHeaders.append(key, v as string);
215
- }
216
- } else if (value !== undefined) {
217
- // assume object headers are meant to be JSON stringified, i.e. their
218
- // content value in OpenAPI specification is 'application/json'
219
- mergedHeaders.set(
220
- key,
221
- typeof value === 'object' ? JSON.stringify(value) : (value as string),
222
- );
223
- }
224
- }
225
- }
226
- return mergedHeaders;
227
- };
228
-
229
- type ErrInterceptor<Err, Res, Req, Options> = (
230
- error: Err,
231
- response: Res,
232
- request: Req,
233
- options: Options,
234
- ) => Err | Promise<Err>;
235
-
236
- type ReqInterceptor<Req, Options> = (
237
- request: Req,
238
- options: Options,
239
- ) => Req | Promise<Req>;
240
-
241
- type ResInterceptor<Res, Req, Options> = (
242
- response: Res,
243
- request: Req,
244
- options: Options,
245
- ) => Res | Promise<Res>;
246
-
247
- class Interceptors<Interceptor> {
248
- fns: Array<Interceptor | null> = [];
249
-
250
- clear(): void {
251
- this.fns = [];
252
- }
253
-
254
- eject(id: number | Interceptor): void {
255
- const index = this.getInterceptorIndex(id);
256
- if (this.fns[index]) {
257
- this.fns[index] = null;
258
- }
259
- }
260
-
261
- exists(id: number | Interceptor): boolean {
262
- const index = this.getInterceptorIndex(id);
263
- return Boolean(this.fns[index]);
264
- }
265
-
266
- getInterceptorIndex(id: number | Interceptor): number {
267
- if (typeof id === 'number') {
268
- return this.fns[id] ? id : -1;
269
- }
270
- return this.fns.indexOf(id);
271
- }
272
-
273
- update(
274
- id: number | Interceptor,
275
- fn: Interceptor,
276
- ): number | Interceptor | false {
277
- const index = this.getInterceptorIndex(id);
278
- if (this.fns[index]) {
279
- this.fns[index] = fn;
280
- return id;
281
- }
282
- return false;
283
- }
284
-
285
- use(fn: Interceptor): number {
286
- this.fns.push(fn);
287
- return this.fns.length - 1;
288
- }
289
- }
290
-
291
- export interface Middleware<Req, Res, Err, Options> {
292
- error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
293
- request: Interceptors<ReqInterceptor<Req, Options>>;
294
- response: Interceptors<ResInterceptor<Res, Req, Options>>;
295
- }
296
-
297
- export const createInterceptors = <Req, Res, Err, Options>(): Middleware<
298
- Req,
299
- Res,
300
- Err,
301
- Options
302
- > => ({
303
- error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(),
304
- request: new Interceptors<ReqInterceptor<Req, Options>>(),
305
- response: new Interceptors<ResInterceptor<Res, Req, Options>>(),
306
- });
307
-
308
- const defaultQuerySerializer = createQuerySerializer({
309
- allowReserved: false,
310
- array: {
311
- explode: true,
312
- style: 'form',
313
- },
314
- object: {
315
- explode: true,
316
- style: 'deepObject',
317
- },
318
- });
319
-
320
- const defaultHeaders = {
321
- 'Content-Type': 'application/json',
322
- };
323
-
324
- export const createConfig = <T extends ClientOptions = ClientOptions>(
325
- override: Config<Omit<ClientOptions, keyof T> & T> = {},
326
- ): Config<Omit<ClientOptions, keyof T> & T> => ({
327
- ...jsonBodySerializer,
328
- headers: defaultHeaders,
329
- parseAs: 'auto',
330
- querySerializer: defaultQuerySerializer,
331
- ...override,
332
- });
@@ -1,16 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
-
3
- import { type ClientOptions, type Config, createClient, createConfig } from './client';
4
- import type { ClientOptions as ClientOptions2 } from './types.gen';
5
-
6
- /**
7
- * The `createClientConfig()` function will be called on client initialization
8
- * and the returned object will become the client's initial configuration.
9
- *
10
- * You may want to initialize your client this way instead of calling
11
- * `setConfig()`. This is useful for example if you're using Next.js
12
- * to ensure your client always has the correct values.
13
- */
14
- export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
15
-
16
- export const client = createClient(createConfig<ClientOptions2>());
@@ -1,42 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
-
3
- export type AuthToken = string | undefined;
4
-
5
- export interface Auth {
6
- /**
7
- * Which part of the request do we use to send the auth?
8
- *
9
- * @default 'header'
10
- */
11
- in?: 'header' | 'query' | 'cookie';
12
- /**
13
- * Header or query parameter name.
14
- *
15
- * @default 'Authorization'
16
- */
17
- name?: string;
18
- scheme?: 'basic' | 'bearer';
19
- type: 'apiKey' | 'http';
20
- }
21
-
22
- export const getAuthToken = async (
23
- auth: Auth,
24
- callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken,
25
- ): Promise<string | undefined> => {
26
- const token =
27
- typeof callback === 'function' ? await callback(auth) : callback;
28
-
29
- if (!token) {
30
- return;
31
- }
32
-
33
- if (auth.scheme === 'bearer') {
34
- return `Bearer ${token}`;
35
- }
36
-
37
- if (auth.scheme === 'basic') {
38
- return `Basic ${btoa(token)}`;
39
- }
40
-
41
- return token;
42
- };
@@ -1,100 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
-
3
- import type {
4
- ArrayStyle,
5
- ObjectStyle,
6
- SerializerOptions,
7
- } from './pathSerializer.gen';
8
-
9
- export type QuerySerializer = (query: Record<string, unknown>) => string;
10
-
11
- export type BodySerializer = (body: any) => any;
12
-
13
- type QuerySerializerOptionsObject = {
14
- allowReserved?: boolean;
15
- array?: Partial<SerializerOptions<ArrayStyle>>;
16
- object?: Partial<SerializerOptions<ObjectStyle>>;
17
- };
18
-
19
- export type QuerySerializerOptions = QuerySerializerOptionsObject & {
20
- /**
21
- * Per-parameter serialization overrides. When provided, these settings
22
- * override the global array/object settings for specific parameter names.
23
- */
24
- parameters?: Record<string, QuerySerializerOptionsObject>;
25
- };
26
-
27
- const serializeFormDataPair = (
28
- data: FormData,
29
- key: string,
30
- value: unknown,
31
- ): void => {
32
- if (typeof value === 'string' || value instanceof Blob) {
33
- data.append(key, value);
34
- } else if (value instanceof Date) {
35
- data.append(key, value.toISOString());
36
- } else {
37
- data.append(key, JSON.stringify(value));
38
- }
39
- };
40
-
41
- const serializeUrlSearchParamsPair = (
42
- data: URLSearchParams,
43
- key: string,
44
- value: unknown,
45
- ): void => {
46
- if (typeof value === 'string') {
47
- data.append(key, value);
48
- } else {
49
- data.append(key, JSON.stringify(value));
50
- }
51
- };
52
-
53
- export const formDataBodySerializer = {
54
- bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
55
- body: T,
56
- ): FormData => {
57
- const data = new FormData();
58
-
59
- Object.entries(body).forEach(([key, value]) => {
60
- if (value === undefined || value === null) {
61
- return;
62
- }
63
- if (Array.isArray(value)) {
64
- value.forEach((v) => serializeFormDataPair(data, key, v));
65
- } else {
66
- serializeFormDataPair(data, key, value);
67
- }
68
- });
69
-
70
- return data;
71
- },
72
- };
73
-
74
- export const jsonBodySerializer = {
75
- bodySerializer: <T>(body: T): string =>
76
- JSON.stringify(body, (_key, value) =>
77
- typeof value === 'bigint' ? value.toString() : value,
78
- ),
79
- };
80
-
81
- export const urlSearchParamsBodySerializer = {
82
- bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
83
- body: T,
84
- ): string => {
85
- const data = new URLSearchParams();
86
-
87
- Object.entries(body).forEach(([key, value]) => {
88
- if (value === undefined || value === null) {
89
- return;
90
- }
91
- if (Array.isArray(value)) {
92
- value.forEach((v) => serializeUrlSearchParamsPair(data, key, v));
93
- } else {
94
- serializeUrlSearchParamsPair(data, key, value);
95
- }
96
- });
97
-
98
- return data.toString();
99
- },
100
- };
@@ -1,176 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
-
3
- type Slot = 'body' | 'headers' | 'path' | 'query';
4
-
5
- export type Field =
6
- | {
7
- in: Exclude<Slot, 'body'>;
8
- /**
9
- * Field name. This is the name we want the user to see and use.
10
- */
11
- key: string;
12
- /**
13
- * Field mapped name. This is the name we want to use in the request.
14
- * If omitted, we use the same value as `key`.
15
- */
16
- map?: string;
17
- }
18
- | {
19
- in: Extract<Slot, 'body'>;
20
- /**
21
- * Key isn't required for bodies.
22
- */
23
- key?: string;
24
- map?: string;
25
- }
26
- | {
27
- /**
28
- * Field name. This is the name we want the user to see and use.
29
- */
30
- key: string;
31
- /**
32
- * Field mapped name. This is the name we want to use in the request.
33
- * If `in` is omitted, `map` aliases `key` to the transport layer.
34
- */
35
- map: Slot;
36
- };
37
-
38
- export interface Fields {
39
- allowExtra?: Partial<Record<Slot, boolean>>;
40
- args?: ReadonlyArray<Field>;
41
- }
42
-
43
- export type FieldsConfig = ReadonlyArray<Field | Fields>;
44
-
45
- const extraPrefixesMap: Record<string, Slot> = {
46
- $body_: 'body',
47
- $headers_: 'headers',
48
- $path_: 'path',
49
- $query_: 'query',
50
- };
51
- const extraPrefixes = Object.entries(extraPrefixesMap);
52
-
53
- type KeyMap = Map<
54
- string,
55
- | {
56
- in: Slot;
57
- map?: string;
58
- }
59
- | {
60
- in?: never;
61
- map: Slot;
62
- }
63
- >;
64
-
65
- const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
66
- if (!map) {
67
- map = new Map();
68
- }
69
-
70
- for (const config of fields) {
71
- if ('in' in config) {
72
- if (config.key) {
73
- map.set(config.key, {
74
- in: config.in,
75
- map: config.map,
76
- });
77
- }
78
- } else if ('key' in config) {
79
- map.set(config.key, {
80
- map: config.map,
81
- });
82
- } else if (config.args) {
83
- buildKeyMap(config.args, map);
84
- }
85
- }
86
-
87
- return map;
88
- };
89
-
90
- interface Params {
91
- body: unknown;
92
- headers: Record<string, unknown>;
93
- path: Record<string, unknown>;
94
- query: Record<string, unknown>;
95
- }
96
-
97
- const stripEmptySlots = (params: Params) => {
98
- for (const [slot, value] of Object.entries(params)) {
99
- if (value && typeof value === 'object' && !Object.keys(value).length) {
100
- delete params[slot as Slot];
101
- }
102
- }
103
- };
104
-
105
- export const buildClientParams = (
106
- args: ReadonlyArray<unknown>,
107
- fields: FieldsConfig,
108
- ) => {
109
- const params: Params = {
110
- body: {},
111
- headers: {},
112
- path: {},
113
- query: {},
114
- };
115
-
116
- const map = buildKeyMap(fields);
117
-
118
- let config: FieldsConfig[number] | undefined;
119
-
120
- for (const [index, arg] of args.entries()) {
121
- if (fields[index]) {
122
- config = fields[index];
123
- }
124
-
125
- if (!config) {
126
- continue;
127
- }
128
-
129
- if ('in' in config) {
130
- if (config.key) {
131
- const field = map.get(config.key)!;
132
- const name = field.map || config.key;
133
- if (field.in) {
134
- (params[field.in] as Record<string, unknown>)[name] = arg;
135
- }
136
- } else {
137
- params.body = arg;
138
- }
139
- } else {
140
- for (const [key, value] of Object.entries(arg ?? {})) {
141
- const field = map.get(key);
142
-
143
- if (field) {
144
- if (field.in) {
145
- const name = field.map || key;
146
- (params[field.in] as Record<string, unknown>)[name] = value;
147
- } else {
148
- params[field.map] = value;
149
- }
150
- } else {
151
- const extra = extraPrefixes.find(([prefix]) =>
152
- key.startsWith(prefix),
153
- );
154
-
155
- if (extra) {
156
- const [prefix, slot] = extra;
157
- (params[slot] as Record<string, unknown>)[
158
- key.slice(prefix.length)
159
- ] = value;
160
- } else if ('allowExtra' in config && config.allowExtra) {
161
- for (const [slot, allowed] of Object.entries(config.allowExtra)) {
162
- if (allowed) {
163
- (params[slot as Slot] as Record<string, unknown>)[key] = value;
164
- break;
165
- }
166
- }
167
- }
168
- }
169
- }
170
- }
171
- }
172
-
173
- stripEmptySlots(params);
174
-
175
- return params;
176
- };