@labeleer/api 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/client.gen.js +1 -1
- package/dist/generated/sdk.gen.js +191 -1
- package/package.json +3 -4
- package/dist/client/client.gen.d.ts +0 -2
- package/dist/client/client.gen.js +0 -217
- package/dist/client/index.d.ts +0 -10
- package/dist/client/index.js +0 -6
- package/dist/client/types.gen.d.ts +0 -120
- package/dist/client/types.gen.js +0 -2
- package/dist/client/utils.gen.d.ts +0 -37
- package/dist/client/utils.gen.js +0 -231
- package/dist/client.gen.d.ts +0 -12
- package/dist/client.gen.js +0 -3
- package/dist/core/auth.gen.d.ts +0 -25
- package/dist/core/auth.gen.js +0 -14
- package/dist/core/bodySerializer.gen.d.ts +0 -25
- package/dist/core/bodySerializer.gen.js +0 -57
- package/dist/core/params.gen.d.ts +0 -43
- package/dist/core/params.gen.js +0 -112
- package/dist/core/pathSerializer.gen.d.ts +0 -33
- package/dist/core/pathSerializer.gen.js +0 -114
- package/dist/core/queryKeySerializer.gen.d.ts +0 -18
- package/dist/core/queryKeySerializer.gen.js +0 -99
- package/dist/core/serverSentEvents.gen.d.ts +0 -71
- package/dist/core/serverSentEvents.gen.js +0 -136
- package/dist/core/types.gen.d.ts +0 -83
- package/dist/core/types.gen.js +0 -2
- package/dist/core/utils.gen.d.ts +0 -19
- package/dist/core/utils.gen.js +0 -87
- package/dist/sdk.gen.d.ts +0 -42
- package/dist/sdk.gen.js +0 -190
- package/dist/types/index.d.ts +0 -1366
- package/dist/types/index.js +0 -181
- package/dist/zod.gen.d.ts +0 -3149
- package/dist/zod.gen.js +0 -621
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
import * as z from 'zod';
|
|
2
3
|
import { client } from './client.gen.js';
|
|
3
|
-
import { zAddLocaleResponse, zCreateAccessTokenResponse2, zCreateProjectResponse2, zDeleteLocaleResponse, zDeleteProjectResponse, zDeleteTranslationResponse, zDeleteTranslationsResponse, zExportTranslationsResponse, zGenerateTranslationsResponse, zGetInvitationsResponse2, zGetLocalesResponse, zGetProjectsResponse2, zGetTranslationResponse, zGetTranslationsResponse2, zGetTranslationTagsResponse2, zGetUserProjectPermissionsResponse, zInviteUserToProjectResponse, zRemoveUserFromProjectResponse, zRenameTranslationKeyResponse, zRespondToInvitationResponse, zRevokeAccessTokenResponse, zUpdateAccessTokenResponse2, zUpdateProjectResponse2, zUpdateReferenceLocaleResponse, zUpdateTranslationsResponse, zUpdateTranslationTagsResponse2, zUpdateUserPermissionsResponse, } from './zod.gen.js';
|
|
4
|
+
import { zAddLocaleBody, zAddLocaleResponse, zCreateAccessTokenBody, zCreateAccessTokenPath, zCreateAccessTokenResponse2, zCreateProjectBody, zCreateProjectResponse2, zDeleteLocaleQuery, zDeleteLocaleResponse, zDeleteProjectPath, zDeleteProjectResponse, zDeleteTranslationQuery, zDeleteTranslationResponse, zDeleteTranslationsBody, zDeleteTranslationsResponse, zExportTranslationsQuery, zExportTranslationsResponse, zGenerateTranslationsQuery, zGenerateTranslationsResponse, zGetInvitationsResponse2, zGetLocalesQuery, zGetLocalesResponse, zGetProjectsResponse2, zGetTranslationQuery, zGetTranslationResponse, zGetTranslationsQuery, zGetTranslationsResponse2, zGetTranslationTagsQuery, zGetTranslationTagsResponse2, zGetUserProjectPermissionsPath, zGetUserProjectPermissionsResponse, zInviteUserToProjectBody, zInviteUserToProjectPath, zInviteUserToProjectResponse, zRemoveUserFromProjectPath, zRemoveUserFromProjectResponse, zRenameTranslationKeyBody, zRenameTranslationKeyResponse, zRespondToInvitationBody, zRespondToInvitationResponse, zRevokeAccessTokenPath, zRevokeAccessTokenResponse, zUpdateAccessTokenBody, zUpdateAccessTokenPath, zUpdateAccessTokenResponse2, zUpdateProjectBody, zUpdateProjectPath, zUpdateProjectResponse2, zUpdateReferenceLocaleBody, zUpdateReferenceLocaleResponse, zUpdateTranslationsBody, zUpdateTranslationsResponse, zUpdateTranslationTagsBody, zUpdateTranslationTagsResponse2, zUpdateUserPermissionsBody, zUpdateUserPermissionsPath, zUpdateUserPermissionsResponse, } from './zod.gen.js';
|
|
4
5
|
export const getInvitations = (options) => (options?.client ?? client).get({
|
|
6
|
+
requestValidator: async (data) => await z
|
|
7
|
+
.object({
|
|
8
|
+
body: z.never().optional(),
|
|
9
|
+
path: z.never().optional(),
|
|
10
|
+
query: z.never().optional(),
|
|
11
|
+
})
|
|
12
|
+
.parseAsync(data),
|
|
5
13
|
responseValidator: async (data) => await zGetInvitationsResponse2.parseAsync(data),
|
|
6
14
|
url: '/api/invitations',
|
|
7
15
|
...options,
|
|
8
16
|
});
|
|
9
17
|
export const respondToInvitation = (options) => (options.client ?? client).post({
|
|
18
|
+
requestValidator: async (data) => await z
|
|
19
|
+
.object({
|
|
20
|
+
body: zRespondToInvitationBody,
|
|
21
|
+
path: z.never().optional(),
|
|
22
|
+
query: z.never().optional(),
|
|
23
|
+
})
|
|
24
|
+
.parseAsync(data),
|
|
10
25
|
responseValidator: async (data) => await zRespondToInvitationResponse.parseAsync(data),
|
|
11
26
|
url: '/api/invitations',
|
|
12
27
|
...options,
|
|
@@ -16,11 +31,25 @@ export const respondToInvitation = (options) => (options.client ?? client).post(
|
|
|
16
31
|
},
|
|
17
32
|
});
|
|
18
33
|
export const revokeAccessToken = (options) => (options.client ?? client).delete({
|
|
34
|
+
requestValidator: async (data) => await z
|
|
35
|
+
.object({
|
|
36
|
+
body: z.never().optional(),
|
|
37
|
+
path: zRevokeAccessTokenPath,
|
|
38
|
+
query: z.never().optional(),
|
|
39
|
+
})
|
|
40
|
+
.parseAsync(data),
|
|
19
41
|
responseValidator: async (data) => await zRevokeAccessTokenResponse.parseAsync(data),
|
|
20
42
|
url: '/api/project/{projectId}/access-token',
|
|
21
43
|
...options,
|
|
22
44
|
});
|
|
23
45
|
export const updateAccessToken = (options) => (options.client ?? client).patch({
|
|
46
|
+
requestValidator: async (data) => await z
|
|
47
|
+
.object({
|
|
48
|
+
body: zUpdateAccessTokenBody,
|
|
49
|
+
path: zUpdateAccessTokenPath,
|
|
50
|
+
query: z.never().optional(),
|
|
51
|
+
})
|
|
52
|
+
.parseAsync(data),
|
|
24
53
|
responseValidator: async (data) => await zUpdateAccessTokenResponse2.parseAsync(data),
|
|
25
54
|
url: '/api/project/{projectId}/access-token',
|
|
26
55
|
...options,
|
|
@@ -30,6 +59,13 @@ export const updateAccessToken = (options) => (options.client ?? client).patch({
|
|
|
30
59
|
},
|
|
31
60
|
});
|
|
32
61
|
export const createAccessToken = (options) => (options.client ?? client).post({
|
|
62
|
+
requestValidator: async (data) => await z
|
|
63
|
+
.object({
|
|
64
|
+
body: zCreateAccessTokenBody,
|
|
65
|
+
path: zCreateAccessTokenPath,
|
|
66
|
+
query: z.never().optional(),
|
|
67
|
+
})
|
|
68
|
+
.parseAsync(data),
|
|
33
69
|
responseValidator: async (data) => await zCreateAccessTokenResponse2.parseAsync(data),
|
|
34
70
|
url: '/api/project/{projectId}/access-token',
|
|
35
71
|
...options,
|
|
@@ -39,6 +75,13 @@ export const createAccessToken = (options) => (options.client ?? client).post({
|
|
|
39
75
|
},
|
|
40
76
|
});
|
|
41
77
|
export const inviteUserToProject = (options) => (options.client ?? client).post({
|
|
78
|
+
requestValidator: async (data) => await z
|
|
79
|
+
.object({
|
|
80
|
+
body: zInviteUserToProjectBody,
|
|
81
|
+
path: zInviteUserToProjectPath,
|
|
82
|
+
query: z.never().optional(),
|
|
83
|
+
})
|
|
84
|
+
.parseAsync(data),
|
|
42
85
|
responseValidator: async (data) => await zInviteUserToProjectResponse.parseAsync(data),
|
|
43
86
|
url: '/api/project/{projectId}/invite',
|
|
44
87
|
...options,
|
|
@@ -48,11 +91,25 @@ export const inviteUserToProject = (options) => (options.client ?? client).post(
|
|
|
48
91
|
},
|
|
49
92
|
});
|
|
50
93
|
export const deleteProject = (options) => (options.client ?? client).delete({
|
|
94
|
+
requestValidator: async (data) => await z
|
|
95
|
+
.object({
|
|
96
|
+
body: z.never().optional(),
|
|
97
|
+
path: zDeleteProjectPath,
|
|
98
|
+
query: z.never().optional(),
|
|
99
|
+
})
|
|
100
|
+
.parseAsync(data),
|
|
51
101
|
responseValidator: async (data) => await zDeleteProjectResponse.parseAsync(data),
|
|
52
102
|
url: '/api/project/{projectId}',
|
|
53
103
|
...options,
|
|
54
104
|
});
|
|
55
105
|
export const updateProject = (options) => (options.client ?? client).put({
|
|
106
|
+
requestValidator: async (data) => await z
|
|
107
|
+
.object({
|
|
108
|
+
body: zUpdateProjectBody,
|
|
109
|
+
path: zUpdateProjectPath,
|
|
110
|
+
query: z.never().optional(),
|
|
111
|
+
})
|
|
112
|
+
.parseAsync(data),
|
|
56
113
|
responseValidator: async (data) => await zUpdateProjectResponse2.parseAsync(data),
|
|
57
114
|
url: '/api/project/{projectId}',
|
|
58
115
|
...options,
|
|
@@ -62,16 +119,37 @@ export const updateProject = (options) => (options.client ?? client).put({
|
|
|
62
119
|
},
|
|
63
120
|
});
|
|
64
121
|
export const removeUserFromProject = (options) => (options.client ?? client).delete({
|
|
122
|
+
requestValidator: async (data) => await z
|
|
123
|
+
.object({
|
|
124
|
+
body: z.never().optional(),
|
|
125
|
+
path: zRemoveUserFromProjectPath,
|
|
126
|
+
query: z.never().optional(),
|
|
127
|
+
})
|
|
128
|
+
.parseAsync(data),
|
|
65
129
|
responseValidator: async (data) => await zRemoveUserFromProjectResponse.parseAsync(data),
|
|
66
130
|
url: '/api/project/{projectId}/users/{userId}',
|
|
67
131
|
...options,
|
|
68
132
|
});
|
|
69
133
|
export const getUserProjectPermissions = (options) => (options.client ?? client).get({
|
|
134
|
+
requestValidator: async (data) => await z
|
|
135
|
+
.object({
|
|
136
|
+
body: z.never().optional(),
|
|
137
|
+
path: zGetUserProjectPermissionsPath,
|
|
138
|
+
query: z.never().optional(),
|
|
139
|
+
})
|
|
140
|
+
.parseAsync(data),
|
|
70
141
|
responseValidator: async (data) => await zGetUserProjectPermissionsResponse.parseAsync(data),
|
|
71
142
|
url: '/api/project/{projectId}/users/{userId}',
|
|
72
143
|
...options,
|
|
73
144
|
});
|
|
74
145
|
export const updateUserPermissions = (options) => (options.client ?? client).put({
|
|
146
|
+
requestValidator: async (data) => await z
|
|
147
|
+
.object({
|
|
148
|
+
body: zUpdateUserPermissionsBody,
|
|
149
|
+
path: zUpdateUserPermissionsPath,
|
|
150
|
+
query: z.never().optional(),
|
|
151
|
+
})
|
|
152
|
+
.parseAsync(data),
|
|
75
153
|
responseValidator: async (data) => await zUpdateUserPermissionsResponse.parseAsync(data),
|
|
76
154
|
url: '/api/project/{projectId}/users/{userId}',
|
|
77
155
|
...options,
|
|
@@ -81,11 +159,25 @@ export const updateUserPermissions = (options) => (options.client ?? client).put
|
|
|
81
159
|
},
|
|
82
160
|
});
|
|
83
161
|
export const getProjects = (options) => (options?.client ?? client).get({
|
|
162
|
+
requestValidator: async (data) => await z
|
|
163
|
+
.object({
|
|
164
|
+
body: z.never().optional(),
|
|
165
|
+
path: z.never().optional(),
|
|
166
|
+
query: z.never().optional(),
|
|
167
|
+
})
|
|
168
|
+
.parseAsync(data),
|
|
84
169
|
responseValidator: async (data) => await zGetProjectsResponse2.parseAsync(data),
|
|
85
170
|
url: '/api/project',
|
|
86
171
|
...options,
|
|
87
172
|
});
|
|
88
173
|
export const createProject = (options) => (options.client ?? client).post({
|
|
174
|
+
requestValidator: async (data) => await z
|
|
175
|
+
.object({
|
|
176
|
+
body: zCreateProjectBody,
|
|
177
|
+
path: z.never().optional(),
|
|
178
|
+
query: z.never().optional(),
|
|
179
|
+
})
|
|
180
|
+
.parseAsync(data),
|
|
89
181
|
responseValidator: async (data) => await zCreateProjectResponse2.parseAsync(data),
|
|
90
182
|
url: '/api/project',
|
|
91
183
|
...options,
|
|
@@ -95,21 +187,49 @@ export const createProject = (options) => (options.client ?? client).post({
|
|
|
95
187
|
},
|
|
96
188
|
});
|
|
97
189
|
export const generateTranslations = (options) => (options.client ?? client).sse.post({
|
|
190
|
+
requestValidator: async (data) => await z
|
|
191
|
+
.object({
|
|
192
|
+
body: z.never().optional(),
|
|
193
|
+
path: z.never().optional(),
|
|
194
|
+
query: zGenerateTranslationsQuery,
|
|
195
|
+
})
|
|
196
|
+
.parseAsync(data),
|
|
98
197
|
responseValidator: async (data) => await zGenerateTranslationsResponse.parseAsync(data),
|
|
99
198
|
url: '/api/translation/generate',
|
|
100
199
|
...options,
|
|
101
200
|
});
|
|
102
201
|
export const deleteTranslation = (options) => (options.client ?? client).delete({
|
|
202
|
+
requestValidator: async (data) => await z
|
|
203
|
+
.object({
|
|
204
|
+
body: z.never().optional(),
|
|
205
|
+
path: z.never().optional(),
|
|
206
|
+
query: zDeleteTranslationQuery,
|
|
207
|
+
})
|
|
208
|
+
.parseAsync(data),
|
|
103
209
|
responseValidator: async (data) => await zDeleteTranslationResponse.parseAsync(data),
|
|
104
210
|
url: '/api/translation',
|
|
105
211
|
...options,
|
|
106
212
|
});
|
|
107
213
|
export const getTranslation = (options) => (options.client ?? client).get({
|
|
214
|
+
requestValidator: async (data) => await z
|
|
215
|
+
.object({
|
|
216
|
+
body: z.never().optional(),
|
|
217
|
+
path: z.never().optional(),
|
|
218
|
+
query: zGetTranslationQuery,
|
|
219
|
+
})
|
|
220
|
+
.parseAsync(data),
|
|
108
221
|
responseValidator: async (data) => await zGetTranslationResponse.parseAsync(data),
|
|
109
222
|
url: '/api/translation',
|
|
110
223
|
...options,
|
|
111
224
|
});
|
|
112
225
|
export const renameTranslationKey = (options) => (options.client ?? client).put({
|
|
226
|
+
requestValidator: async (data) => await z
|
|
227
|
+
.object({
|
|
228
|
+
body: zRenameTranslationKeyBody,
|
|
229
|
+
path: z.never().optional(),
|
|
230
|
+
query: z.never().optional(),
|
|
231
|
+
})
|
|
232
|
+
.parseAsync(data),
|
|
113
233
|
responseValidator: async (data) => await zRenameTranslationKeyResponse.parseAsync(data),
|
|
114
234
|
url: '/api/translation',
|
|
115
235
|
...options,
|
|
@@ -119,11 +239,25 @@ export const renameTranslationKey = (options) => (options.client ?? client).put(
|
|
|
119
239
|
},
|
|
120
240
|
});
|
|
121
241
|
export const getTranslationTags = (options) => (options.client ?? client).get({
|
|
242
|
+
requestValidator: async (data) => await z
|
|
243
|
+
.object({
|
|
244
|
+
body: z.never().optional(),
|
|
245
|
+
path: z.never().optional(),
|
|
246
|
+
query: zGetTranslationTagsQuery,
|
|
247
|
+
})
|
|
248
|
+
.parseAsync(data),
|
|
122
249
|
responseValidator: async (data) => await zGetTranslationTagsResponse2.parseAsync(data),
|
|
123
250
|
url: '/api/translation/tags',
|
|
124
251
|
...options,
|
|
125
252
|
});
|
|
126
253
|
export const updateTranslationTags = (options) => (options.client ?? client).patch({
|
|
254
|
+
requestValidator: async (data) => await z
|
|
255
|
+
.object({
|
|
256
|
+
body: zUpdateTranslationTagsBody,
|
|
257
|
+
path: z.never().optional(),
|
|
258
|
+
query: z.never().optional(),
|
|
259
|
+
})
|
|
260
|
+
.parseAsync(data),
|
|
127
261
|
responseValidator: async (data) => await zUpdateTranslationTagsResponse2.parseAsync(data),
|
|
128
262
|
url: '/api/translation/tags',
|
|
129
263
|
...options,
|
|
@@ -133,21 +267,49 @@ export const updateTranslationTags = (options) => (options.client ?? client).pat
|
|
|
133
267
|
},
|
|
134
268
|
});
|
|
135
269
|
export const exportTranslations = (options) => (options.client ?? client).get({
|
|
270
|
+
requestValidator: async (data) => await z
|
|
271
|
+
.object({
|
|
272
|
+
body: z.never().optional(),
|
|
273
|
+
path: z.never().optional(),
|
|
274
|
+
query: zExportTranslationsQuery,
|
|
275
|
+
})
|
|
276
|
+
.parseAsync(data),
|
|
136
277
|
responseValidator: async (data) => await zExportTranslationsResponse.parseAsync(data),
|
|
137
278
|
url: '/api/translations/export',
|
|
138
279
|
...options,
|
|
139
280
|
});
|
|
140
281
|
export const deleteLocale = (options) => (options.client ?? client).delete({
|
|
282
|
+
requestValidator: async (data) => await z
|
|
283
|
+
.object({
|
|
284
|
+
body: z.never().optional(),
|
|
285
|
+
path: z.never().optional(),
|
|
286
|
+
query: zDeleteLocaleQuery,
|
|
287
|
+
})
|
|
288
|
+
.parseAsync(data),
|
|
141
289
|
responseValidator: async (data) => await zDeleteLocaleResponse.parseAsync(data),
|
|
142
290
|
url: '/api/translations/locales',
|
|
143
291
|
...options,
|
|
144
292
|
});
|
|
145
293
|
export const getLocales = (options) => (options.client ?? client).get({
|
|
294
|
+
requestValidator: async (data) => await z
|
|
295
|
+
.object({
|
|
296
|
+
body: z.never().optional(),
|
|
297
|
+
path: z.never().optional(),
|
|
298
|
+
query: zGetLocalesQuery,
|
|
299
|
+
})
|
|
300
|
+
.parseAsync(data),
|
|
146
301
|
responseValidator: async (data) => await zGetLocalesResponse.parseAsync(data),
|
|
147
302
|
url: '/api/translations/locales',
|
|
148
303
|
...options,
|
|
149
304
|
});
|
|
150
305
|
export const addLocale = (options) => (options.client ?? client).post({
|
|
306
|
+
requestValidator: async (data) => await z
|
|
307
|
+
.object({
|
|
308
|
+
body: zAddLocaleBody,
|
|
309
|
+
path: z.never().optional(),
|
|
310
|
+
query: z.never().optional(),
|
|
311
|
+
})
|
|
312
|
+
.parseAsync(data),
|
|
151
313
|
responseValidator: async (data) => await zAddLocaleResponse.parseAsync(data),
|
|
152
314
|
url: '/api/translations/locales',
|
|
153
315
|
...options,
|
|
@@ -157,6 +319,13 @@ export const addLocale = (options) => (options.client ?? client).post({
|
|
|
157
319
|
},
|
|
158
320
|
});
|
|
159
321
|
export const updateReferenceLocale = (options) => (options.client ?? client).put({
|
|
322
|
+
requestValidator: async (data) => await z
|
|
323
|
+
.object({
|
|
324
|
+
body: zUpdateReferenceLocaleBody,
|
|
325
|
+
path: z.never().optional(),
|
|
326
|
+
query: z.never().optional(),
|
|
327
|
+
})
|
|
328
|
+
.parseAsync(data),
|
|
160
329
|
responseValidator: async (data) => await zUpdateReferenceLocaleResponse.parseAsync(data),
|
|
161
330
|
url: '/api/translations/locales',
|
|
162
331
|
...options,
|
|
@@ -166,6 +335,13 @@ export const updateReferenceLocale = (options) => (options.client ?? client).put
|
|
|
166
335
|
},
|
|
167
336
|
});
|
|
168
337
|
export const deleteTranslations = (options) => (options.client ?? client).delete({
|
|
338
|
+
requestValidator: async (data) => await z
|
|
339
|
+
.object({
|
|
340
|
+
body: zDeleteTranslationsBody,
|
|
341
|
+
path: z.never().optional(),
|
|
342
|
+
query: z.never().optional(),
|
|
343
|
+
})
|
|
344
|
+
.parseAsync(data),
|
|
169
345
|
responseValidator: async (data) => await zDeleteTranslationsResponse.parseAsync(data),
|
|
170
346
|
url: '/api/translations',
|
|
171
347
|
...options,
|
|
@@ -175,11 +351,25 @@ export const deleteTranslations = (options) => (options.client ?? client).delete
|
|
|
175
351
|
},
|
|
176
352
|
});
|
|
177
353
|
export const getTranslations = (options) => (options.client ?? client).get({
|
|
354
|
+
requestValidator: async (data) => await z
|
|
355
|
+
.object({
|
|
356
|
+
body: z.never().optional(),
|
|
357
|
+
path: z.never().optional(),
|
|
358
|
+
query: zGetTranslationsQuery,
|
|
359
|
+
})
|
|
360
|
+
.parseAsync(data),
|
|
178
361
|
responseValidator: async (data) => await zGetTranslationsResponse2.parseAsync(data),
|
|
179
362
|
url: '/api/translations',
|
|
180
363
|
...options,
|
|
181
364
|
});
|
|
182
365
|
export const updateTranslations = (options) => (options.client ?? client).post({
|
|
366
|
+
requestValidator: async (data) => await z
|
|
367
|
+
.object({
|
|
368
|
+
body: zUpdateTranslationsBody,
|
|
369
|
+
path: z.never().optional(),
|
|
370
|
+
query: z.never().optional(),
|
|
371
|
+
})
|
|
372
|
+
.parseAsync(data),
|
|
183
373
|
responseValidator: async (data) => await zUpdateTranslationsResponse.parseAsync(data),
|
|
184
374
|
url: '/api/translations',
|
|
185
375
|
...options,
|
package/package.json
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
"name": "@labeleer/api",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Wrapper for Labeleer API interaction",
|
|
5
|
-
"version": "1.0.
|
|
6
|
-
"sideEffects": false,
|
|
5
|
+
"version": "1.0.2",
|
|
7
6
|
"private": false,
|
|
8
7
|
"homepage": "https://labeleer.com",
|
|
9
8
|
"license": "MIT",
|
|
@@ -13,9 +12,10 @@
|
|
|
13
12
|
"import:openapi": "tsx bin/import-spec.ts",
|
|
14
13
|
"generate:client": "openapi-ts",
|
|
15
14
|
"generate:api": "pnpm import:openapi && pnpm generate:client",
|
|
16
|
-
"build": "npm run generate:api && tsc --p tsconfig.json",
|
|
15
|
+
"build": "rm -rf ./dist && npm run generate:api && tsc --p tsconfig.json",
|
|
17
16
|
"prepublishOnly": "npm run build"
|
|
18
17
|
},
|
|
18
|
+
"files": ["dist"],
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
21
21
|
"types": "./dist/index.js",
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"require": "./dist/index.js"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
|
-
"files": ["dist"],
|
|
27
26
|
"dependencies": {
|
|
28
27
|
"zod": "^4.6.5"
|
|
29
28
|
},
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
-
import { createSseClient } from '../core/serverSentEvents.gen.js';
|
|
3
|
-
import { getValidRequestBody } from '../core/utils.gen.js';
|
|
4
|
-
import { buildUrl, createConfig, createInterceptors, getParseAs, mergeConfigs, mergeHeaders, setAuthParams, } from './utils.gen.js';
|
|
5
|
-
export const createClient = (config = {}) => {
|
|
6
|
-
let _config = mergeConfigs(createConfig(), config);
|
|
7
|
-
const getConfig = () => ({ ..._config });
|
|
8
|
-
const setConfig = (config) => {
|
|
9
|
-
_config = mergeConfigs(_config, config);
|
|
10
|
-
return getConfig();
|
|
11
|
-
};
|
|
12
|
-
const interceptors = createInterceptors();
|
|
13
|
-
const beforeRequest = async (options) => {
|
|
14
|
-
const opts = {
|
|
15
|
-
..._config,
|
|
16
|
-
...options,
|
|
17
|
-
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
18
|
-
headers: mergeHeaders(_config.headers, options.headers),
|
|
19
|
-
serializedBody: undefined,
|
|
20
|
-
};
|
|
21
|
-
if (opts.security) {
|
|
22
|
-
await setAuthParams(opts);
|
|
23
|
-
}
|
|
24
|
-
if (opts.requestValidator) {
|
|
25
|
-
await opts.requestValidator(opts);
|
|
26
|
-
}
|
|
27
|
-
if (opts.body !== undefined && opts.bodySerializer) {
|
|
28
|
-
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
29
|
-
}
|
|
30
|
-
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
31
|
-
if (opts.body === undefined || opts.serializedBody === '') {
|
|
32
|
-
opts.headers.delete('Content-Type');
|
|
33
|
-
}
|
|
34
|
-
const resolvedOpts = opts;
|
|
35
|
-
const url = buildUrl(resolvedOpts);
|
|
36
|
-
return { opts: resolvedOpts, url };
|
|
37
|
-
};
|
|
38
|
-
const request = async (options) => {
|
|
39
|
-
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
40
|
-
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
41
|
-
let request;
|
|
42
|
-
let response;
|
|
43
|
-
try {
|
|
44
|
-
const { opts, url } = await beforeRequest(options);
|
|
45
|
-
const requestInit = {
|
|
46
|
-
redirect: 'follow',
|
|
47
|
-
...opts,
|
|
48
|
-
body: getValidRequestBody(opts),
|
|
49
|
-
};
|
|
50
|
-
request = new Request(url, requestInit);
|
|
51
|
-
for (const fn of interceptors.request.fns) {
|
|
52
|
-
if (fn) {
|
|
53
|
-
request = await fn(request, opts);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
// fetch must be assigned here, otherwise it would throw the error:
|
|
57
|
-
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
|
58
|
-
const _fetch = opts.fetch;
|
|
59
|
-
response = await _fetch(request);
|
|
60
|
-
for (const fn of interceptors.response.fns) {
|
|
61
|
-
if (fn) {
|
|
62
|
-
response = await fn(response, request, opts);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const result = {
|
|
66
|
-
request,
|
|
67
|
-
response,
|
|
68
|
-
};
|
|
69
|
-
if (response.ok) {
|
|
70
|
-
const parseAs = (opts.parseAs === 'auto'
|
|
71
|
-
? getParseAs(response.headers.get('Content-Type'))
|
|
72
|
-
: opts.parseAs) ?? 'json';
|
|
73
|
-
if (response.status === 204 ||
|
|
74
|
-
response.headers.get('Content-Length') === '0') {
|
|
75
|
-
let emptyData;
|
|
76
|
-
switch (parseAs) {
|
|
77
|
-
case 'arrayBuffer':
|
|
78
|
-
case 'blob':
|
|
79
|
-
case 'text':
|
|
80
|
-
emptyData = await response[parseAs]();
|
|
81
|
-
break;
|
|
82
|
-
case 'formData':
|
|
83
|
-
emptyData = new FormData();
|
|
84
|
-
break;
|
|
85
|
-
case 'stream':
|
|
86
|
-
emptyData = response.body;
|
|
87
|
-
break;
|
|
88
|
-
case 'json':
|
|
89
|
-
default:
|
|
90
|
-
emptyData = {};
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
return opts.responseStyle === 'data'
|
|
94
|
-
? emptyData
|
|
95
|
-
: {
|
|
96
|
-
data: emptyData,
|
|
97
|
-
...result,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
let data;
|
|
101
|
-
switch (parseAs) {
|
|
102
|
-
case 'arrayBuffer':
|
|
103
|
-
case 'blob':
|
|
104
|
-
case 'formData':
|
|
105
|
-
case 'text':
|
|
106
|
-
data = await response[parseAs]();
|
|
107
|
-
break;
|
|
108
|
-
case 'json': {
|
|
109
|
-
// Some servers return 200 with no Content-Length and empty body.
|
|
110
|
-
// response.json() would throw; read as text and parse if non-empty.
|
|
111
|
-
const text = await response.text();
|
|
112
|
-
data = text ? JSON.parse(text) : {};
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
case 'stream':
|
|
116
|
-
return opts.responseStyle === 'data'
|
|
117
|
-
? response.body
|
|
118
|
-
: {
|
|
119
|
-
data: response.body,
|
|
120
|
-
...result,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
if (parseAs === 'json') {
|
|
124
|
-
if (opts.responseValidator) {
|
|
125
|
-
await opts.responseValidator(data);
|
|
126
|
-
}
|
|
127
|
-
if (opts.responseTransformer) {
|
|
128
|
-
data = await opts.responseTransformer(data);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return opts.responseStyle === 'data'
|
|
132
|
-
? data
|
|
133
|
-
: {
|
|
134
|
-
data,
|
|
135
|
-
...result,
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
const textError = await response.text();
|
|
139
|
-
let jsonError;
|
|
140
|
-
try {
|
|
141
|
-
jsonError = JSON.parse(textError);
|
|
142
|
-
}
|
|
143
|
-
catch {
|
|
144
|
-
// noop
|
|
145
|
-
}
|
|
146
|
-
throw jsonError ?? textError;
|
|
147
|
-
}
|
|
148
|
-
catch (error) {
|
|
149
|
-
let finalError = error;
|
|
150
|
-
for (const fn of interceptors.error.fns) {
|
|
151
|
-
if (fn) {
|
|
152
|
-
finalError = await fn(finalError, response, request, options);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
finalError = finalError || {};
|
|
156
|
-
if (throwOnError) {
|
|
157
|
-
throw finalError;
|
|
158
|
-
}
|
|
159
|
-
// TODO: we probably want to return error and improve types
|
|
160
|
-
return responseStyle === 'data'
|
|
161
|
-
? undefined
|
|
162
|
-
: {
|
|
163
|
-
error: finalError,
|
|
164
|
-
request,
|
|
165
|
-
response,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
170
|
-
const makeSseFn = (method) => async (options) => {
|
|
171
|
-
const { opts, url } = await beforeRequest(options);
|
|
172
|
-
return createSseClient({
|
|
173
|
-
...opts,
|
|
174
|
-
body: opts.body,
|
|
175
|
-
method,
|
|
176
|
-
onRequest: async (url, init) => {
|
|
177
|
-
let request = new Request(url, init);
|
|
178
|
-
for (const fn of interceptors.request.fns) {
|
|
179
|
-
if (fn) {
|
|
180
|
-
request = await fn(request, opts);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return request;
|
|
184
|
-
},
|
|
185
|
-
serializedBody: getValidRequestBody(opts),
|
|
186
|
-
url,
|
|
187
|
-
});
|
|
188
|
-
};
|
|
189
|
-
const _buildUrl = options => buildUrl({ ..._config, ...options });
|
|
190
|
-
return {
|
|
191
|
-
buildUrl: _buildUrl,
|
|
192
|
-
connect: makeMethodFn('CONNECT'),
|
|
193
|
-
delete: makeMethodFn('DELETE'),
|
|
194
|
-
get: makeMethodFn('GET'),
|
|
195
|
-
getConfig,
|
|
196
|
-
head: makeMethodFn('HEAD'),
|
|
197
|
-
interceptors,
|
|
198
|
-
options: makeMethodFn('OPTIONS'),
|
|
199
|
-
patch: makeMethodFn('PATCH'),
|
|
200
|
-
post: makeMethodFn('POST'),
|
|
201
|
-
put: makeMethodFn('PUT'),
|
|
202
|
-
request,
|
|
203
|
-
setConfig,
|
|
204
|
-
sse: {
|
|
205
|
-
connect: makeSseFn('CONNECT'),
|
|
206
|
-
delete: makeSseFn('DELETE'),
|
|
207
|
-
get: makeSseFn('GET'),
|
|
208
|
-
head: makeSseFn('HEAD'),
|
|
209
|
-
options: makeSseFn('OPTIONS'),
|
|
210
|
-
patch: makeSseFn('PATCH'),
|
|
211
|
-
post: makeSseFn('POST'),
|
|
212
|
-
put: makeSseFn('PUT'),
|
|
213
|
-
trace: makeSseFn('TRACE'),
|
|
214
|
-
},
|
|
215
|
-
trace: makeMethodFn('TRACE'),
|
|
216
|
-
};
|
|
217
|
-
};
|
package/dist/client/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type { Auth } from '../core/auth.gen.js';
|
|
2
|
-
export type { QuerySerializerOptions } from '../core/bodySerializer.gen.js';
|
|
3
|
-
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from '../core/bodySerializer.gen.js';
|
|
4
|
-
export { buildClientParams } from '../core/params.gen.js';
|
|
5
|
-
export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen.js';
|
|
6
|
-
export type { ServerSentEventsResult } from '../core/serverSentEvents.gen.js';
|
|
7
|
-
export type { ClientMeta } from '../core/types.gen.js';
|
|
8
|
-
export { createClient } from './client.gen.js';
|
|
9
|
-
export type { Client, ClientOptions, Config, CreateClientConfig, Options, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape, } from './types.gen.js';
|
|
10
|
-
export { createConfig, mergeHeaders } from './utils.gen.js';
|
package/dist/client/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
-
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from '../core/bodySerializer.gen.js';
|
|
3
|
-
export { buildClientParams } from '../core/params.gen.js';
|
|
4
|
-
export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen.js';
|
|
5
|
-
export { createClient } from './client.gen.js';
|
|
6
|
-
export { createConfig, mergeHeaders } from './utils.gen.js';
|