@darco2903/cdn-api 1.0.7-beta.0 → 1.0.7-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 (71) hide show
  1. package/README.md +49 -9
  2. package/dist/client.d.ts +1039 -0
  3. package/{src/client.ts → dist/client.js} +15 -18
  4. package/{src/common.ts → dist/common.d.ts} +4 -4
  5. package/dist/common.js +4 -0
  6. package/dist/consts.d.ts +5 -0
  7. package/{src/consts.ts → dist/consts.js} +4 -8
  8. package/dist/contract/auth.d.ts +35 -0
  9. package/{src/contract/auth.ts → dist/contract/auth.js} +18 -22
  10. package/dist/contract/endpoint.d.ts +396 -0
  11. package/{src/contract/endpoint.ts → dist/contract/endpoint.js} +42 -53
  12. package/dist/contract/index.d.ts +2039 -0
  13. package/{src/contract/index.ts → dist/contract/index.js} +22 -27
  14. package/dist/contract/key.d.ts +15 -0
  15. package/{src/contract/key.ts → dist/contract/key.js} +15 -19
  16. package/dist/contract/list.d.ts +134 -0
  17. package/{src/contract/list.ts → dist/contract/list.js} +28 -30
  18. package/dist/contract/record.d.ts +412 -0
  19. package/{src/contract/record.ts → dist/contract/record.js} +71 -82
  20. package/dist/contract/service.d.ts +240 -0
  21. package/{src/contract/service.ts → dist/contract/service.js} +33 -44
  22. package/dist/contract/stats.d.ts +32 -0
  23. package/{src/contract/stats.ts → dist/contract/stats.js} +34 -36
  24. package/dist/contract/upload.d.ts +790 -0
  25. package/{src/contract/upload.ts → dist/contract/upload.js} +78 -82
  26. package/{src/index.ts → dist/index.d.ts} +2 -2
  27. package/dist/index.js +2 -0
  28. package/dist/server.d.ts +10 -0
  29. package/dist/server.js +58 -0
  30. package/{src/socket/index.ts → dist/socket/index.d.ts} +2 -2
  31. package/dist/socket/index.js +2 -0
  32. package/dist/socket/interface/index.d.ts +5 -0
  33. package/dist/socket/interface/index.js +1 -0
  34. package/{src/socket/interface/template.ts → dist/socket/interface/template.d.ts} +6 -7
  35. package/dist/socket/interface/template.js +1 -0
  36. package/dist/socket/types.d.ts +3 -0
  37. package/dist/socket/types.js +1 -0
  38. package/dist/types/creds.d.ts +8 -0
  39. package/{src/types/creds.ts → dist/types/creds.js} +5 -7
  40. package/dist/types/endpoint.d.ts +25 -0
  41. package/{src/types/endpoint.ts → dist/types/endpoint.js} +12 -19
  42. package/{src/types/index.ts → dist/types/index.d.ts} +6 -6
  43. package/dist/types/index.js +6 -0
  44. package/dist/types/jwt.d.ts +128 -0
  45. package/dist/types/jwt.js +33 -0
  46. package/dist/types/record.d.ts +97 -0
  47. package/{src/types/record.ts → dist/types/record.js} +25 -35
  48. package/dist/types/stats.d.ts +15 -0
  49. package/{src/types/stats.ts → dist/types/stats.js} +6 -9
  50. package/dist/types/upload.d.ts +45 -0
  51. package/{src/types/upload.ts → dist/types/upload.js} +12 -18
  52. package/dist/types.d.ts +32 -0
  53. package/dist/types.js +27 -0
  54. package/dist/uploader.d.ts +1044 -0
  55. package/{src/uploader.ts → dist/uploader.js} +72 -99
  56. package/package.json +2 -2
  57. package/.gitattributes +0 -2
  58. package/.github/workflows/release.yml +0 -116
  59. package/TODO.md +0 -0
  60. package/prettier.config.js +0 -24
  61. package/src/server.ts +0 -89
  62. package/src/socket/interface/index.ts +0 -12
  63. package/src/socket/types.ts +0 -7
  64. package/src/types/jwt.ts +0 -78
  65. package/src/types.ts +0 -38
  66. package/tests/keys/private.pem +0 -5
  67. package/tests/keys/public.pem +0 -4
  68. package/tests/keys.ts +0 -11
  69. package/tests/tsconfig.json +0 -12
  70. package/tests/vitest/jwt.test.ts +0 -38
  71. package/tsconfig.json +0 -14
@@ -1,18 +1,15 @@
1
- export * from "./common.js";
2
- import io from "socket.io-client";
3
- import { initClient } from "@ts-rest/core";
4
- import contract from "./contract/index.js";
5
- import type { CdnClientSocket } from "./socket/index.js";
6
-
7
- export function createClient(origin: string) {
8
- return initClient(contract, {
9
- baseUrl: origin,
10
- credentials: "include",
11
- });
12
- }
13
-
14
- export function createSocket(origin: string): CdnClientSocket {
15
- return io(origin, {
16
- autoConnect: true,
17
- });
18
- }
1
+ export * from "./common.js";
2
+ import io from "socket.io-client";
3
+ import { initClient } from "@ts-rest/core";
4
+ import contract from "./contract/index.js";
5
+ export function createClient(origin) {
6
+ return initClient(contract, {
7
+ baseUrl: origin,
8
+ credentials: "include",
9
+ });
10
+ }
11
+ export function createSocket(origin) {
12
+ return io(origin, {
13
+ autoConnect: true,
14
+ });
15
+ }
@@ -1,4 +1,4 @@
1
- export { default as contract } from "./contract/index.js";
2
- export * from "./socket/index.js";
3
- export * from "./types/index.js";
4
- export * from "./consts.js";
1
+ export { default as contract } from "./contract/index.js";
2
+ export * from "./socket/index.js";
3
+ export * from "./types/index.js";
4
+ export * from "./consts.js";
package/dist/common.js ADDED
@@ -0,0 +1,4 @@
1
+ export { default as contract } from "./contract/index.js";
2
+ export * from "./socket/index.js";
3
+ export * from "./types/index.js";
4
+ export * from "./consts.js";
@@ -0,0 +1,5 @@
1
+ import type { Algorithm } from "jsonwebtoken";
2
+ export declare const API_VERSION = "v2";
3
+ export declare const API_PATH_PREFIX = "/api/v2";
4
+ export declare const JWT_ALGORITHM: Algorithm;
5
+ export declare const STORAGE_PUBLIC_ID_LENGTH = 8;
@@ -1,8 +1,4 @@
1
- import type { Algorithm } from "jsonwebtoken";
2
-
3
- export const API_VERSION = "v2";
4
- export const API_PATH_PREFIX = `/api/${API_VERSION}`;
5
-
6
- export const JWT_ALGORITHM: Algorithm = "ES256";
7
-
8
- export const STORAGE_PUBLIC_ID_LENGTH = 8;
1
+ export const API_VERSION = "v2";
2
+ export const API_PATH_PREFIX = `/api/${API_VERSION}`;
3
+ export const JWT_ALGORITHM = "ES256";
4
+ export const STORAGE_PUBLIC_ID_LENGTH = 8;
@@ -0,0 +1,35 @@
1
+ import z from "zod";
2
+ declare const _default: {
3
+ access: {
4
+ method: "GET";
5
+ path: "/auth/access";
6
+ headers: z.ZodObject<{
7
+ authorization: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ authorization?: string | undefined;
10
+ }, {
11
+ authorization?: string | undefined;
12
+ }>;
13
+ responses: {
14
+ 200: z.ZodType<{
15
+ access: boolean;
16
+ }, z.ZodTypeDef, {
17
+ access: boolean;
18
+ }>;
19
+ 500: z.ZodObject<{
20
+ code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
21
+ error: z.ZodType<string, z.ZodTypeDef, string>;
22
+ name: z.ZodLiteral<"APIError">;
23
+ }, "strip", z.ZodTypeAny, {
24
+ code: "INTERNAL_SERVER_ERROR";
25
+ name: "APIError";
26
+ error: string;
27
+ }, {
28
+ code: "INTERNAL_SERVER_ERROR";
29
+ name: "APIError";
30
+ error: string;
31
+ }>;
32
+ };
33
+ };
34
+ };
35
+ export default _default;
@@ -1,22 +1,18 @@
1
- import { initContract } from "@ts-rest/core";
2
- import z from "zod";
3
- import { authHeaderSchema } from "@darco2903/auth-api/client";
4
- import { apiError, apiSuccess } from "../types.js";
5
-
6
- const c = initContract();
7
-
8
- export default c.router({
9
- access: {
10
- method: "GET",
11
- path: "/auth/access",
12
- headers: authHeaderSchema,
13
- responses: {
14
- 200: apiSuccess(
15
- z.object({
16
- access: z.boolean(),
17
- })
18
- ),
19
- 500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
20
- },
21
- },
22
- });
1
+ import { initContract } from "@ts-rest/core";
2
+ import z from "zod";
3
+ import { authHeaderSchema } from "@darco2903/auth-api/client";
4
+ import { apiError, apiSuccess } from "../types.js";
5
+ const c = initContract();
6
+ export default c.router({
7
+ access: {
8
+ method: "GET",
9
+ path: "/auth/access",
10
+ headers: authHeaderSchema,
11
+ responses: {
12
+ 200: apiSuccess(z.object({
13
+ access: z.boolean(),
14
+ })),
15
+ 500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
16
+ },
17
+ },
18
+ });
@@ -0,0 +1,396 @@
1
+ import z from "zod";
2
+ declare const _default: {
3
+ create: {
4
+ body: z.ZodObject<{
5
+ storage_id: z.ZodString;
6
+ endpoint: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ endpoint: string;
9
+ storage_id: string;
10
+ }, {
11
+ endpoint: string;
12
+ storage_id: string;
13
+ }>;
14
+ method: "POST";
15
+ path: "/endpoint";
16
+ headers: z.ZodObject<{
17
+ authorization: z.ZodOptional<z.ZodString>;
18
+ }, "strip", z.ZodTypeAny, {
19
+ authorization?: string | undefined;
20
+ }, {
21
+ authorization?: string | undefined;
22
+ }>;
23
+ responses: {
24
+ 200: z.ZodType<null, z.ZodTypeDef, null>;
25
+ 400: z.ZodObject<{
26
+ name: z.ZodLiteral<"ZodError">;
27
+ issues: z.ZodArray<z.ZodObject<{
28
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
29
+ message: z.ZodOptional<z.ZodString>;
30
+ code: z.ZodNativeEnum<{
31
+ invalid_type: "invalid_type";
32
+ invalid_literal: "invalid_literal";
33
+ custom: "custom";
34
+ invalid_union: "invalid_union";
35
+ invalid_union_discriminator: "invalid_union_discriminator";
36
+ invalid_enum_value: "invalid_enum_value";
37
+ unrecognized_keys: "unrecognized_keys";
38
+ invalid_arguments: "invalid_arguments";
39
+ invalid_return_type: "invalid_return_type";
40
+ invalid_date: "invalid_date";
41
+ invalid_string: "invalid_string";
42
+ too_small: "too_small";
43
+ too_big: "too_big";
44
+ invalid_intersection_types: "invalid_intersection_types";
45
+ not_multiple_of: "not_multiple_of";
46
+ not_finite: "not_finite";
47
+ }>;
48
+ }, "strip", z.ZodAny, z.objectOutputType<{
49
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
50
+ message: z.ZodOptional<z.ZodString>;
51
+ code: z.ZodNativeEnum<{
52
+ invalid_type: "invalid_type";
53
+ invalid_literal: "invalid_literal";
54
+ custom: "custom";
55
+ invalid_union: "invalid_union";
56
+ invalid_union_discriminator: "invalid_union_discriminator";
57
+ invalid_enum_value: "invalid_enum_value";
58
+ unrecognized_keys: "unrecognized_keys";
59
+ invalid_arguments: "invalid_arguments";
60
+ invalid_return_type: "invalid_return_type";
61
+ invalid_date: "invalid_date";
62
+ invalid_string: "invalid_string";
63
+ too_small: "too_small";
64
+ too_big: "too_big";
65
+ invalid_intersection_types: "invalid_intersection_types";
66
+ not_multiple_of: "not_multiple_of";
67
+ not_finite: "not_finite";
68
+ }>;
69
+ }, z.ZodAny, "strip">, z.objectInputType<{
70
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
71
+ message: z.ZodOptional<z.ZodString>;
72
+ code: z.ZodNativeEnum<{
73
+ invalid_type: "invalid_type";
74
+ invalid_literal: "invalid_literal";
75
+ custom: "custom";
76
+ invalid_union: "invalid_union";
77
+ invalid_union_discriminator: "invalid_union_discriminator";
78
+ invalid_enum_value: "invalid_enum_value";
79
+ unrecognized_keys: "unrecognized_keys";
80
+ invalid_arguments: "invalid_arguments";
81
+ invalid_return_type: "invalid_return_type";
82
+ invalid_date: "invalid_date";
83
+ invalid_string: "invalid_string";
84
+ too_small: "too_small";
85
+ too_big: "too_big";
86
+ invalid_intersection_types: "invalid_intersection_types";
87
+ not_multiple_of: "not_multiple_of";
88
+ not_finite: "not_finite";
89
+ }>;
90
+ }, z.ZodAny, "strip">>, "many">;
91
+ }, "strip", z.ZodTypeAny, {
92
+ name: "ZodError";
93
+ issues: z.objectOutputType<{
94
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
95
+ message: z.ZodOptional<z.ZodString>;
96
+ code: z.ZodNativeEnum<{
97
+ invalid_type: "invalid_type";
98
+ invalid_literal: "invalid_literal";
99
+ custom: "custom";
100
+ invalid_union: "invalid_union";
101
+ invalid_union_discriminator: "invalid_union_discriminator";
102
+ invalid_enum_value: "invalid_enum_value";
103
+ unrecognized_keys: "unrecognized_keys";
104
+ invalid_arguments: "invalid_arguments";
105
+ invalid_return_type: "invalid_return_type";
106
+ invalid_date: "invalid_date";
107
+ invalid_string: "invalid_string";
108
+ too_small: "too_small";
109
+ too_big: "too_big";
110
+ invalid_intersection_types: "invalid_intersection_types";
111
+ not_multiple_of: "not_multiple_of";
112
+ not_finite: "not_finite";
113
+ }>;
114
+ }, z.ZodAny, "strip">[];
115
+ }, {
116
+ name: "ZodError";
117
+ issues: z.objectInputType<{
118
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
119
+ message: z.ZodOptional<z.ZodString>;
120
+ code: z.ZodNativeEnum<{
121
+ invalid_type: "invalid_type";
122
+ invalid_literal: "invalid_literal";
123
+ custom: "custom";
124
+ invalid_union: "invalid_union";
125
+ invalid_union_discriminator: "invalid_union_discriminator";
126
+ invalid_enum_value: "invalid_enum_value";
127
+ unrecognized_keys: "unrecognized_keys";
128
+ invalid_arguments: "invalid_arguments";
129
+ invalid_return_type: "invalid_return_type";
130
+ invalid_date: "invalid_date";
131
+ invalid_string: "invalid_string";
132
+ too_small: "too_small";
133
+ too_big: "too_big";
134
+ invalid_intersection_types: "invalid_intersection_types";
135
+ not_multiple_of: "not_multiple_of";
136
+ not_finite: "not_finite";
137
+ }>;
138
+ }, z.ZodAny, "strip">[];
139
+ }>;
140
+ 401: z.ZodObject<{
141
+ code: z.ZodType<"UNAUTHORIZED", z.ZodTypeDef, "UNAUTHORIZED">;
142
+ error: z.ZodType<"Unauthorized", z.ZodTypeDef, "Unauthorized">;
143
+ name: z.ZodLiteral<"APIError">;
144
+ }, "strip", z.ZodTypeAny, {
145
+ code: "UNAUTHORIZED";
146
+ name: "APIError";
147
+ error: "Unauthorized";
148
+ }, {
149
+ code: "UNAUTHORIZED";
150
+ name: "APIError";
151
+ error: "Unauthorized";
152
+ }>;
153
+ 403: z.ZodObject<{
154
+ code: z.ZodType<"FORBIDDEN", z.ZodTypeDef, "FORBIDDEN">;
155
+ error: z.ZodType<"Forbidden", z.ZodTypeDef, "Forbidden">;
156
+ name: z.ZodLiteral<"APIError">;
157
+ }, "strip", z.ZodTypeAny, {
158
+ code: "FORBIDDEN";
159
+ name: "APIError";
160
+ error: "Forbidden";
161
+ }, {
162
+ code: "FORBIDDEN";
163
+ name: "APIError";
164
+ error: "Forbidden";
165
+ }>;
166
+ 404: z.ZodObject<{
167
+ code: z.ZodType<"NOT_FOUND", z.ZodTypeDef, "NOT_FOUND">;
168
+ error: z.ZodType<"Record not found", z.ZodTypeDef, "Record not found">;
169
+ name: z.ZodLiteral<"APIError">;
170
+ }, "strip", z.ZodTypeAny, {
171
+ code: "NOT_FOUND";
172
+ name: "APIError";
173
+ error: "Record not found";
174
+ }, {
175
+ code: "NOT_FOUND";
176
+ name: "APIError";
177
+ error: "Record not found";
178
+ }>;
179
+ 409: z.ZodObject<{
180
+ code: z.ZodType<"CONFLICT", z.ZodTypeDef, "CONFLICT">;
181
+ error: z.ZodType<"Endpoint already exists", z.ZodTypeDef, "Endpoint already exists">;
182
+ name: z.ZodLiteral<"APIError">;
183
+ }, "strip", z.ZodTypeAny, {
184
+ code: "CONFLICT";
185
+ name: "APIError";
186
+ error: "Endpoint already exists";
187
+ }, {
188
+ code: "CONFLICT";
189
+ name: "APIError";
190
+ error: "Endpoint already exists";
191
+ }>;
192
+ 500: z.ZodObject<{
193
+ code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
194
+ error: z.ZodType<string, z.ZodTypeDef, string>;
195
+ name: z.ZodLiteral<"APIError">;
196
+ }, "strip", z.ZodTypeAny, {
197
+ code: "INTERNAL_SERVER_ERROR";
198
+ name: "APIError";
199
+ error: string;
200
+ }, {
201
+ code: "INTERNAL_SERVER_ERROR";
202
+ name: "APIError";
203
+ error: string;
204
+ }>;
205
+ };
206
+ };
207
+ delete: {
208
+ body: z.ZodObject<{
209
+ endpoint: z.ZodString;
210
+ }, "strip", z.ZodTypeAny, {
211
+ endpoint: string;
212
+ }, {
213
+ endpoint: string;
214
+ }>;
215
+ method: "DELETE";
216
+ path: "/endpoint";
217
+ headers: z.ZodObject<{
218
+ authorization: z.ZodOptional<z.ZodString>;
219
+ }, "strip", z.ZodTypeAny, {
220
+ authorization?: string | undefined;
221
+ }, {
222
+ authorization?: string | undefined;
223
+ }>;
224
+ responses: {
225
+ 200: z.ZodType<null, z.ZodTypeDef, null>;
226
+ 400: z.ZodObject<{
227
+ name: z.ZodLiteral<"ZodError">;
228
+ issues: z.ZodArray<z.ZodObject<{
229
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
230
+ message: z.ZodOptional<z.ZodString>;
231
+ code: z.ZodNativeEnum<{
232
+ invalid_type: "invalid_type";
233
+ invalid_literal: "invalid_literal";
234
+ custom: "custom";
235
+ invalid_union: "invalid_union";
236
+ invalid_union_discriminator: "invalid_union_discriminator";
237
+ invalid_enum_value: "invalid_enum_value";
238
+ unrecognized_keys: "unrecognized_keys";
239
+ invalid_arguments: "invalid_arguments";
240
+ invalid_return_type: "invalid_return_type";
241
+ invalid_date: "invalid_date";
242
+ invalid_string: "invalid_string";
243
+ too_small: "too_small";
244
+ too_big: "too_big";
245
+ invalid_intersection_types: "invalid_intersection_types";
246
+ not_multiple_of: "not_multiple_of";
247
+ not_finite: "not_finite";
248
+ }>;
249
+ }, "strip", z.ZodAny, z.objectOutputType<{
250
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
251
+ message: z.ZodOptional<z.ZodString>;
252
+ code: z.ZodNativeEnum<{
253
+ invalid_type: "invalid_type";
254
+ invalid_literal: "invalid_literal";
255
+ custom: "custom";
256
+ invalid_union: "invalid_union";
257
+ invalid_union_discriminator: "invalid_union_discriminator";
258
+ invalid_enum_value: "invalid_enum_value";
259
+ unrecognized_keys: "unrecognized_keys";
260
+ invalid_arguments: "invalid_arguments";
261
+ invalid_return_type: "invalid_return_type";
262
+ invalid_date: "invalid_date";
263
+ invalid_string: "invalid_string";
264
+ too_small: "too_small";
265
+ too_big: "too_big";
266
+ invalid_intersection_types: "invalid_intersection_types";
267
+ not_multiple_of: "not_multiple_of";
268
+ not_finite: "not_finite";
269
+ }>;
270
+ }, z.ZodAny, "strip">, z.objectInputType<{
271
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
272
+ message: z.ZodOptional<z.ZodString>;
273
+ code: z.ZodNativeEnum<{
274
+ invalid_type: "invalid_type";
275
+ invalid_literal: "invalid_literal";
276
+ custom: "custom";
277
+ invalid_union: "invalid_union";
278
+ invalid_union_discriminator: "invalid_union_discriminator";
279
+ invalid_enum_value: "invalid_enum_value";
280
+ unrecognized_keys: "unrecognized_keys";
281
+ invalid_arguments: "invalid_arguments";
282
+ invalid_return_type: "invalid_return_type";
283
+ invalid_date: "invalid_date";
284
+ invalid_string: "invalid_string";
285
+ too_small: "too_small";
286
+ too_big: "too_big";
287
+ invalid_intersection_types: "invalid_intersection_types";
288
+ not_multiple_of: "not_multiple_of";
289
+ not_finite: "not_finite";
290
+ }>;
291
+ }, z.ZodAny, "strip">>, "many">;
292
+ }, "strip", z.ZodTypeAny, {
293
+ name: "ZodError";
294
+ issues: z.objectOutputType<{
295
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
296
+ message: z.ZodOptional<z.ZodString>;
297
+ code: z.ZodNativeEnum<{
298
+ invalid_type: "invalid_type";
299
+ invalid_literal: "invalid_literal";
300
+ custom: "custom";
301
+ invalid_union: "invalid_union";
302
+ invalid_union_discriminator: "invalid_union_discriminator";
303
+ invalid_enum_value: "invalid_enum_value";
304
+ unrecognized_keys: "unrecognized_keys";
305
+ invalid_arguments: "invalid_arguments";
306
+ invalid_return_type: "invalid_return_type";
307
+ invalid_date: "invalid_date";
308
+ invalid_string: "invalid_string";
309
+ too_small: "too_small";
310
+ too_big: "too_big";
311
+ invalid_intersection_types: "invalid_intersection_types";
312
+ not_multiple_of: "not_multiple_of";
313
+ not_finite: "not_finite";
314
+ }>;
315
+ }, z.ZodAny, "strip">[];
316
+ }, {
317
+ name: "ZodError";
318
+ issues: z.objectInputType<{
319
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
320
+ message: z.ZodOptional<z.ZodString>;
321
+ code: z.ZodNativeEnum<{
322
+ invalid_type: "invalid_type";
323
+ invalid_literal: "invalid_literal";
324
+ custom: "custom";
325
+ invalid_union: "invalid_union";
326
+ invalid_union_discriminator: "invalid_union_discriminator";
327
+ invalid_enum_value: "invalid_enum_value";
328
+ unrecognized_keys: "unrecognized_keys";
329
+ invalid_arguments: "invalid_arguments";
330
+ invalid_return_type: "invalid_return_type";
331
+ invalid_date: "invalid_date";
332
+ invalid_string: "invalid_string";
333
+ too_small: "too_small";
334
+ too_big: "too_big";
335
+ invalid_intersection_types: "invalid_intersection_types";
336
+ not_multiple_of: "not_multiple_of";
337
+ not_finite: "not_finite";
338
+ }>;
339
+ }, z.ZodAny, "strip">[];
340
+ }>;
341
+ 401: z.ZodObject<{
342
+ code: z.ZodType<"UNAUTHORIZED", z.ZodTypeDef, "UNAUTHORIZED">;
343
+ error: z.ZodType<"Unauthorized", z.ZodTypeDef, "Unauthorized">;
344
+ name: z.ZodLiteral<"APIError">;
345
+ }, "strip", z.ZodTypeAny, {
346
+ code: "UNAUTHORIZED";
347
+ name: "APIError";
348
+ error: "Unauthorized";
349
+ }, {
350
+ code: "UNAUTHORIZED";
351
+ name: "APIError";
352
+ error: "Unauthorized";
353
+ }>;
354
+ 403: z.ZodObject<{
355
+ code: z.ZodType<"FORBIDDEN", z.ZodTypeDef, "FORBIDDEN">;
356
+ error: z.ZodType<"Forbidden", z.ZodTypeDef, "Forbidden">;
357
+ name: z.ZodLiteral<"APIError">;
358
+ }, "strip", z.ZodTypeAny, {
359
+ code: "FORBIDDEN";
360
+ name: "APIError";
361
+ error: "Forbidden";
362
+ }, {
363
+ code: "FORBIDDEN";
364
+ name: "APIError";
365
+ error: "Forbidden";
366
+ }>;
367
+ 404: z.ZodObject<{
368
+ code: z.ZodType<"NOT_FOUND", z.ZodTypeDef, "NOT_FOUND">;
369
+ error: z.ZodType<"Endpoint not found", z.ZodTypeDef, "Endpoint not found">;
370
+ name: z.ZodLiteral<"APIError">;
371
+ }, "strip", z.ZodTypeAny, {
372
+ code: "NOT_FOUND";
373
+ name: "APIError";
374
+ error: "Endpoint not found";
375
+ }, {
376
+ code: "NOT_FOUND";
377
+ name: "APIError";
378
+ error: "Endpoint not found";
379
+ }>;
380
+ 500: z.ZodObject<{
381
+ code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
382
+ error: z.ZodType<string, z.ZodTypeDef, string>;
383
+ name: z.ZodLiteral<"APIError">;
384
+ }, "strip", z.ZodTypeAny, {
385
+ code: "INTERNAL_SERVER_ERROR";
386
+ name: "APIError";
387
+ error: string;
388
+ }, {
389
+ code: "INTERNAL_SERVER_ERROR";
390
+ name: "APIError";
391
+ error: string;
392
+ }>;
393
+ };
394
+ };
395
+ };
396
+ export default _default;
@@ -1,53 +1,42 @@
1
- import { initContract, ZodErrorSchema } from "@ts-rest/core";
2
- import z from "zod";
3
- import { authHeaderSchema } from "@darco2903/auth-api/client";
4
- import { apiError, apiSuccess } from "../types.js";
5
- import { endpointPathSchema } from "../types/index.js";
6
-
7
- const c = initContract();
8
-
9
- export default c.router({
10
- create: {
11
- method: "POST",
12
- path: "/endpoint",
13
- headers: authHeaderSchema,
14
- body: z.object({
15
- storage_id: z.string().nonempty(),
16
- endpoint: endpointPathSchema,
17
- }),
18
- responses: {
19
- 200: apiSuccess(z.null()),
20
- 400: ZodErrorSchema,
21
- 401: apiError(z.literal("UNAUTHORIZED"), z.literal("Unauthorized")),
22
- 403: apiError(z.literal("FORBIDDEN"), z.literal("Forbidden")),
23
- 404: apiError(
24
- z.literal("NOT_FOUND"),
25
- z.literal("Record not found")
26
- ),
27
- 409: apiError(
28
- z.literal("CONFLICT"),
29
- z.literal("Endpoint already exists")
30
- ),
31
- 500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
32
- },
33
- },
34
- delete: {
35
- method: "DELETE",
36
- path: "/endpoint",
37
- headers: authHeaderSchema,
38
- body: z.object({
39
- endpoint: endpointPathSchema,
40
- }),
41
- responses: {
42
- 200: apiSuccess(z.null()),
43
- 400: ZodErrorSchema,
44
- 401: apiError(z.literal("UNAUTHORIZED"), z.literal("Unauthorized")),
45
- 403: apiError(z.literal("FORBIDDEN"), z.literal("Forbidden")),
46
- 404: apiError(
47
- z.literal("NOT_FOUND"),
48
- z.literal("Endpoint not found")
49
- ),
50
- 500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
51
- },
52
- },
53
- });
1
+ import { initContract, ZodErrorSchema } from "@ts-rest/core";
2
+ import z from "zod";
3
+ import { authHeaderSchema } from "@darco2903/auth-api/client";
4
+ import { apiError, apiSuccess } from "../types.js";
5
+ import { endpointPathSchema } from "../types/index.js";
6
+ const c = initContract();
7
+ export default c.router({
8
+ create: {
9
+ method: "POST",
10
+ path: "/endpoint",
11
+ headers: authHeaderSchema,
12
+ body: z.object({
13
+ storage_id: z.string().nonempty(),
14
+ endpoint: endpointPathSchema,
15
+ }),
16
+ responses: {
17
+ 200: apiSuccess(z.null()),
18
+ 400: ZodErrorSchema,
19
+ 401: apiError(z.literal("UNAUTHORIZED"), z.literal("Unauthorized")),
20
+ 403: apiError(z.literal("FORBIDDEN"), z.literal("Forbidden")),
21
+ 404: apiError(z.literal("NOT_FOUND"), z.literal("Record not found")),
22
+ 409: apiError(z.literal("CONFLICT"), z.literal("Endpoint already exists")),
23
+ 500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
24
+ },
25
+ },
26
+ delete: {
27
+ method: "DELETE",
28
+ path: "/endpoint",
29
+ headers: authHeaderSchema,
30
+ body: z.object({
31
+ endpoint: endpointPathSchema,
32
+ }),
33
+ responses: {
34
+ 200: apiSuccess(z.null()),
35
+ 400: ZodErrorSchema,
36
+ 401: apiError(z.literal("UNAUTHORIZED"), z.literal("Unauthorized")),
37
+ 403: apiError(z.literal("FORBIDDEN"), z.literal("Forbidden")),
38
+ 404: apiError(z.literal("NOT_FOUND"), z.literal("Endpoint not found")),
39
+ 500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
40
+ },
41
+ },
42
+ });