@zyacreatives/shared 1.4.6 → 1.4.7

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.
@@ -1,45 +1,45 @@
1
1
  import { z } from "@hono/zod-openapi";
2
2
  export declare const FileEntitySchema: z.ZodObject<{
3
- key: z.ZodString;
4
3
  id: z.ZodCUID2;
4
+ key: z.ZodString;
5
+ mimeType: z.ZodString;
5
6
  url: z.ZodOptional<z.ZodURL>;
7
+ userId: z.ZodCUID2;
6
8
  createdAt: z.ZodCoercedDate<unknown>;
7
9
  updatedAt: z.ZodCoercedDate<unknown>;
8
- userId: z.ZodCUID2;
9
- mimeType: z.ZodString;
10
10
  }, z.core.$strip>;
11
- export declare const FileUpdateEntitySchema: z.ZodObject<{
11
+ export declare const FileUpdateInputSchema: z.ZodObject<{
12
12
  id: z.ZodString;
13
13
  }, z.core.$strip>;
14
- export declare const GetFilePresignedUploadUrlInputSchema: z.ZodObject<{
15
- key: z.ZodString;
16
- }, z.core.$strip>;
17
- export declare const GetFilePresignedUploadUrlOutputSchema: z.ZodObject<{
18
- url: z.ZodURL;
19
- }, z.core.$strip>;
20
- export declare const GetFilePresignedDownloadUrlParams: z.ZodObject<{
21
- fileId: z.ZodCUID2;
22
- }, z.core.$strip>;
23
- export declare const GetFilePresignedDownloadUrlOutputSchema: z.ZodObject<{
24
- url: z.ZodURL;
25
- }, z.core.$strip>;
26
14
  export declare const CreateFileInputSchema: z.ZodObject<{
27
15
  key: z.ZodString;
28
16
  mimeType: z.ZodString;
29
17
  }, z.core.$strip>;
30
18
  export declare const CreateFileOutputSchema: z.ZodObject<{
31
- key: z.ZodString;
32
19
  id: z.ZodCUID2;
20
+ key: z.ZodString;
21
+ mimeType: z.ZodString;
33
22
  url: z.ZodOptional<z.ZodURL>;
23
+ userId: z.ZodCUID2;
34
24
  createdAt: z.ZodCoercedDate<unknown>;
35
25
  updatedAt: z.ZodCoercedDate<unknown>;
36
- userId: z.ZodCUID2;
37
- mimeType: z.ZodString;
38
26
  }, z.core.$strip>;
39
- export declare const DeleteFileInputParams: z.ZodObject<{
27
+ export declare const DeleteFileInputSchema: z.ZodObject<{
40
28
  fileId: z.ZodOptional<z.ZodCUID2>;
41
29
  key: z.ZodOptional<z.ZodCUID2>;
42
30
  }, z.core.$strip>;
43
31
  export declare const DeleteFileOutputSchema: z.ZodObject<{
44
32
  id: z.ZodCUID2;
45
33
  }, z.core.$strip>;
34
+ export declare const GetPresignedUploadUrlInputSchema: z.ZodObject<{
35
+ key: z.ZodString;
36
+ }, z.core.$strip>;
37
+ export declare const GetPresignedUploadUrlOutputSchema: z.ZodObject<{
38
+ url: z.ZodURL;
39
+ }, z.core.$strip>;
40
+ export declare const GetPresignedDownloadUrlInputSchema: z.ZodObject<{
41
+ fileId: z.ZodCUID2;
42
+ }, z.core.$strip>;
43
+ export declare const GetPresignedDownloadUrlOutputSchema: z.ZodObject<{
44
+ url: z.ZodURL;
45
+ }, z.core.$strip>;
@@ -1,51 +1,49 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeleteFileOutputSchema = exports.DeleteFileInputParams = exports.CreateFileOutputSchema = exports.CreateFileInputSchema = exports.GetFilePresignedDownloadUrlOutputSchema = exports.GetFilePresignedDownloadUrlParams = exports.GetFilePresignedUploadUrlOutputSchema = exports.GetFilePresignedUploadUrlInputSchema = exports.FileUpdateEntitySchema = exports.FileEntitySchema = void 0;
3
+ exports.GetPresignedDownloadUrlOutputSchema = exports.GetPresignedDownloadUrlInputSchema = exports.GetPresignedUploadUrlOutputSchema = exports.GetPresignedUploadUrlInputSchema = exports.DeleteFileOutputSchema = exports.DeleteFileInputSchema = exports.CreateFileOutputSchema = exports.CreateFileInputSchema = exports.FileUpdateInputSchema = exports.FileEntitySchema = void 0;
4
4
  const zod_openapi_1 = require("@hono/zod-openapi");
5
5
  exports.FileEntitySchema = zod_openapi_1.z
6
6
  .object({
7
- key: zod_openapi_1.z.string().openapi({ example: "profile-pic-12345" }),
8
7
  id: zod_openapi_1.z.cuid2().openapi({ example: "f123e4567-e89b-12d3-a456-426614174000" }),
8
+ key: zod_openapi_1.z.string().openapi({ example: "profile-pic-12345" }),
9
+ mimeType: zod_openapi_1.z.string().openapi({ example: "image/jpeg" }),
9
10
  url: zod_openapi_1.z
10
11
  .url()
11
12
  .optional()
12
13
  .openapi({ example: "https://example.com/file.jpg" }),
13
- createdAt: zod_openapi_1.z.coerce.date().openapi({ example: "2025-10-14T08:00:00.000Z" }),
14
- updatedAt: zod_openapi_1.z.coerce.date().openapi({ example: "2025-10-14T09:00:00.000Z" }),
15
14
  userId: zod_openapi_1.z
16
15
  .cuid2()
17
16
  .openapi({ example: "u123e4567-e89b-12d3-a456-426614174000" }),
18
- mimeType: zod_openapi_1.z.string().openapi({ example: "image/jpeg" }),
17
+ createdAt: zod_openapi_1.z.coerce.date().openapi({ example: "2025-10-14T08:00:00.000Z" }),
18
+ updatedAt: zod_openapi_1.z.coerce.date().openapi({ example: "2025-10-14T09:00:00.000Z" }),
19
19
  })
20
20
  .openapi({ title: "FileEntity" });
21
- exports.FileUpdateEntitySchema = zod_openapi_1.z
21
+ exports.FileUpdateInputSchema = zod_openapi_1.z
22
22
  .object({
23
23
  id: zod_openapi_1.z
24
24
  .string()
25
25
  .openapi({ example: "f123e4567-e89b-12d3-a456-426614174000" }),
26
26
  })
27
- .openapi({ title: "FileUpdateEntity" });
28
- exports.GetFilePresignedUploadUrlInputSchema = zod_openapi_1.z.object({
29
- key: zod_openapi_1.z.string().openapi({ example: "/users/123/pfp" }),
30
- });
31
- exports.GetFilePresignedUploadUrlOutputSchema = zod_openapi_1.z.object({
32
- url: zod_openapi_1.z.url().openapi({ example: "https//www.cloudflare.img" }),
33
- });
34
- exports.GetFilePresignedDownloadUrlParams = zod_openapi_1.z.object({
35
- fileId: zod_openapi_1.z.cuid2().openapi({ example: "0irjif0qur09481u90r1u" }),
36
- });
37
- exports.GetFilePresignedDownloadUrlOutputSchema = exports.GetFilePresignedUploadUrlOutputSchema;
27
+ .openapi({ title: "FileUpdateInput" });
38
28
  exports.CreateFileInputSchema = zod_openapi_1.z.object({
39
29
  key: zod_openapi_1.z.string().openapi({ example: "uploads/audio/podcast789.mp3" }),
40
- mimeType: zod_openapi_1.z.string().openapi({
41
- example: "audio/mpeg",
42
- }),
30
+ mimeType: zod_openapi_1.z.string().openapi({ example: "audio/mpeg" }),
43
31
  });
44
32
  exports.CreateFileOutputSchema = exports.FileEntitySchema;
45
- exports.DeleteFileInputParams = zod_openapi_1.z.object({
33
+ exports.DeleteFileInputSchema = zod_openapi_1.z.object({
46
34
  fileId: zod_openapi_1.z.cuid2().optional().openapi({ example: "0irjif0qur09481u90r1u" }),
47
35
  key: zod_openapi_1.z.cuid2().optional(),
48
36
  });
49
37
  exports.DeleteFileOutputSchema = zod_openapi_1.z.object({
50
38
  id: zod_openapi_1.z.cuid2().openapi({ example: "r90rjnaneifijhi31" }),
51
39
  });
40
+ exports.GetPresignedUploadUrlInputSchema = zod_openapi_1.z.object({
41
+ key: zod_openapi_1.z.string().openapi({ example: "/users/123/pfp" }),
42
+ });
43
+ exports.GetPresignedUploadUrlOutputSchema = zod_openapi_1.z.object({
44
+ url: zod_openapi_1.z.url().openapi({ example: "https://www.cloudflare.img" }),
45
+ });
46
+ exports.GetPresignedDownloadUrlInputSchema = zod_openapi_1.z.object({
47
+ fileId: zod_openapi_1.z.cuid2().openapi({ example: "0irjif0qur09481u90r1u" }),
48
+ });
49
+ exports.GetPresignedDownloadUrlOutputSchema = exports.GetPresignedUploadUrlOutputSchema;
@@ -76,13 +76,13 @@ export declare const ProjectWithFilesEntitySchema: z.ZodObject<{
76
76
  id: z.ZodString;
77
77
  fileId: z.ZodString;
78
78
  file: z.ZodObject<{
79
- key: z.ZodString;
80
79
  id: z.ZodCUID2;
80
+ key: z.ZodString;
81
+ mimeType: z.ZodString;
81
82
  url: z.ZodOptional<z.ZodURL>;
83
+ userId: z.ZodCUID2;
82
84
  createdAt: z.ZodCoercedDate<unknown>;
83
85
  updatedAt: z.ZodCoercedDate<unknown>;
84
- userId: z.ZodCUID2;
85
- mimeType: z.ZodString;
86
86
  }, z.core.$strip>;
87
87
  }, z.core.$strip>>>;
88
88
  }, z.core.$strip>;
@@ -330,13 +330,13 @@ export declare const GetProjectOutputSchema: z.ZodObject<{
330
330
  id: z.ZodString;
331
331
  fileId: z.ZodString;
332
332
  file: z.ZodObject<{
333
- key: z.ZodString;
334
333
  id: z.ZodCUID2;
334
+ key: z.ZodString;
335
+ mimeType: z.ZodString;
335
336
  url: z.ZodOptional<z.ZodURL>;
337
+ userId: z.ZodCUID2;
336
338
  createdAt: z.ZodCoercedDate<unknown>;
337
339
  updatedAt: z.ZodCoercedDate<unknown>;
338
- userId: z.ZodCUID2;
339
- mimeType: z.ZodString;
340
340
  }, z.core.$strip>;
341
341
  }, z.core.$strip>>>;
342
342
  }, z.core.$strip>;
@@ -1,15 +1,15 @@
1
1
  import { z } from "@hono/zod-openapi";
2
- import { CreateFileInputSchema, CreateFileOutputSchema, DeleteFileInputParams, DeleteFileOutputSchema, FileEntitySchema, FileUpdateEntitySchema, GetFilePresignedDownloadUrlParams, GetFilePresignedUploadUrlInputSchema, GetFilePresignedUploadUrlOutputSchema } from "../schemas/file";
2
+ import { CreateFileInputSchema, CreateFileOutputSchema, DeleteFileInputSchema, DeleteFileOutputSchema, FileEntitySchema, FileUpdateInputSchema, GetPresignedDownloadUrlInputSchema, GetPresignedDownloadUrlOutputSchema, GetPresignedUploadUrlInputSchema, GetPresignedUploadUrlOutputSchema } from "../schemas/file";
3
3
  export type FileEntity = z.infer<typeof FileEntitySchema>;
4
- export type FileUpdateEntity = z.infer<typeof FileUpdateEntitySchema>;
5
- export type GetPresignedUploadUrlInput = z.infer<typeof GetFilePresignedUploadUrlInputSchema>;
6
- export type FileKeyInput = {
7
- key: string;
8
- };
9
- export type GetPresignedUploadUrlOutput = z.infer<typeof GetFilePresignedUploadUrlOutputSchema>;
10
- export type GetPresignedDownloadUrlInput = z.infer<typeof GetFilePresignedDownloadUrlParams>;
11
- export type GetPresignedDownloadUrlOutput = GetPresignedUploadUrlOutput;
12
4
  export type CreateFileInput = z.infer<typeof CreateFileInputSchema>;
13
5
  export type CreateFileOutput = z.infer<typeof CreateFileOutputSchema>;
14
- export type DeleteFileInput = z.infer<typeof DeleteFileInputParams>;
6
+ export type FileUpdateEntity = z.infer<typeof FileUpdateInputSchema>;
7
+ export type DeleteFileInput = z.infer<typeof DeleteFileInputSchema>;
15
8
  export type DeleteFileOutput = z.infer<typeof DeleteFileOutputSchema>;
9
+ export type FileKeyInput = {
10
+ key: string;
11
+ };
12
+ export type GetPresignedUploadUrlInput = z.infer<typeof GetPresignedUploadUrlInputSchema>;
13
+ export type GetPresignedUploadUrlOutput = z.infer<typeof GetPresignedUploadUrlOutputSchema>;
14
+ export type GetPresignedDownloadUrlInput = z.infer<typeof GetPresignedDownloadUrlInputSchema>;
15
+ export type GetPresignedDownloadUrlOutput = z.infer<typeof GetPresignedDownloadUrlOutputSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -2,54 +2,37 @@ import { z } from "@hono/zod-openapi";
2
2
 
3
3
  export const FileEntitySchema = z
4
4
  .object({
5
- key: z.string().openapi({ example: "profile-pic-12345" }),
6
5
  id: z.cuid2().openapi({ example: "f123e4567-e89b-12d3-a456-426614174000" }),
6
+ key: z.string().openapi({ example: "profile-pic-12345" }),
7
+ mimeType: z.string().openapi({ example: "image/jpeg" }),
7
8
  url: z
8
9
  .url()
9
10
  .optional()
10
11
  .openapi({ example: "https://example.com/file.jpg" }),
11
- createdAt: z.coerce.date().openapi({ example: "2025-10-14T08:00:00.000Z" }),
12
- updatedAt: z.coerce.date().openapi({ example: "2025-10-14T09:00:00.000Z" }),
13
12
  userId: z
14
13
  .cuid2()
15
14
  .openapi({ example: "u123e4567-e89b-12d3-a456-426614174000" }),
16
- mimeType: z.string().openapi({ example: "image/jpeg" }),
15
+ createdAt: z.coerce.date().openapi({ example: "2025-10-14T08:00:00.000Z" }),
16
+ updatedAt: z.coerce.date().openapi({ example: "2025-10-14T09:00:00.000Z" }),
17
17
  })
18
18
  .openapi({ title: "FileEntity" });
19
19
 
20
- export const FileUpdateEntitySchema = z
20
+ export const FileUpdateInputSchema = z
21
21
  .object({
22
22
  id: z
23
23
  .string()
24
24
  .openapi({ example: "f123e4567-e89b-12d3-a456-426614174000" }),
25
25
  })
26
- .openapi({ title: "FileUpdateEntity" });
27
-
28
- export const GetFilePresignedUploadUrlInputSchema = z.object({
29
- key: z.string().openapi({ example: "/users/123/pfp" }),
30
- });
31
-
32
- export const GetFilePresignedUploadUrlOutputSchema = z.object({
33
- url: z.url().openapi({ example: "https//www.cloudflare.img" }),
34
- });
35
-
36
- export const GetFilePresignedDownloadUrlParams = z.object({
37
- fileId: z.cuid2().openapi({ example: "0irjif0qur09481u90r1u" }),
38
- });
39
-
40
- export const GetFilePresignedDownloadUrlOutputSchema =
41
- GetFilePresignedUploadUrlOutputSchema;
26
+ .openapi({ title: "FileUpdateInput" });
42
27
 
43
28
  export const CreateFileInputSchema = z.object({
44
29
  key: z.string().openapi({ example: "uploads/audio/podcast789.mp3" }),
45
- mimeType: z.string().openapi({
46
- example: "audio/mpeg",
47
- }),
30
+ mimeType: z.string().openapi({ example: "audio/mpeg" }),
48
31
  });
49
32
 
50
33
  export const CreateFileOutputSchema = FileEntitySchema;
51
34
 
52
- export const DeleteFileInputParams = z.object({
35
+ export const DeleteFileInputSchema = z.object({
53
36
  fileId: z.cuid2().optional().openapi({ example: "0irjif0qur09481u90r1u" }),
54
37
  key: z.cuid2().optional(),
55
38
  });
@@ -57,3 +40,18 @@ export const DeleteFileInputParams = z.object({
57
40
  export const DeleteFileOutputSchema = z.object({
58
41
  id: z.cuid2().openapi({ example: "r90rjnaneifijhi31" }),
59
42
  });
43
+
44
+ export const GetPresignedUploadUrlInputSchema = z.object({
45
+ key: z.string().openapi({ example: "/users/123/pfp" }),
46
+ });
47
+
48
+ export const GetPresignedUploadUrlOutputSchema = z.object({
49
+ url: z.url().openapi({ example: "https://www.cloudflare.img" }),
50
+ });
51
+
52
+ export const GetPresignedDownloadUrlInputSchema = z.object({
53
+ fileId: z.cuid2().openapi({ example: "0irjif0qur09481u90r1u" }),
54
+ });
55
+
56
+ export const GetPresignedDownloadUrlOutputSchema =
57
+ GetPresignedUploadUrlOutputSchema;
package/src/types/file.ts CHANGED
@@ -2,37 +2,38 @@ import { z } from "@hono/zod-openapi";
2
2
  import {
3
3
  CreateFileInputSchema,
4
4
  CreateFileOutputSchema,
5
- DeleteFileInputParams,
5
+ DeleteFileInputSchema,
6
6
  DeleteFileOutputSchema,
7
7
  FileEntitySchema,
8
- FileUpdateEntitySchema,
9
- GetFilePresignedDownloadUrlParams,
10
- GetFilePresignedUploadUrlInputSchema,
11
- GetFilePresignedUploadUrlOutputSchema,
8
+ FileUpdateInputSchema,
9
+ GetPresignedDownloadUrlInputSchema,
10
+ GetPresignedDownloadUrlOutputSchema,
11
+ GetPresignedUploadUrlInputSchema,
12
+ GetPresignedUploadUrlOutputSchema,
12
13
  } from "../schemas/file";
13
14
 
14
15
  export type FileEntity = z.infer<typeof FileEntitySchema>;
15
16
 
16
- export type FileUpdateEntity = z.infer<typeof FileUpdateEntitySchema>;
17
+ export type CreateFileInput = z.infer<typeof CreateFileInputSchema>;
18
+ export type CreateFileOutput = z.infer<typeof CreateFileOutputSchema>;
19
+
20
+ export type FileUpdateEntity = z.infer<typeof FileUpdateInputSchema>;
21
+
22
+ export type DeleteFileInput = z.infer<typeof DeleteFileInputSchema>;
23
+ export type DeleteFileOutput = z.infer<typeof DeleteFileOutputSchema>;
24
+
25
+ export type FileKeyInput = { key: string };
17
26
 
18
27
  export type GetPresignedUploadUrlInput = z.infer<
19
- typeof GetFilePresignedUploadUrlInputSchema
28
+ typeof GetPresignedUploadUrlInputSchema
20
29
  >;
21
- export type FileKeyInput = {
22
- key: string;
23
- };
24
-
25
30
  export type GetPresignedUploadUrlOutput = z.infer<
26
- typeof GetFilePresignedUploadUrlOutputSchema
31
+ typeof GetPresignedUploadUrlOutputSchema
27
32
  >;
28
33
 
29
34
  export type GetPresignedDownloadUrlInput = z.infer<
30
- typeof GetFilePresignedDownloadUrlParams
35
+ typeof GetPresignedDownloadUrlInputSchema
36
+ >;
37
+ export type GetPresignedDownloadUrlOutput = z.infer<
38
+ typeof GetPresignedDownloadUrlOutputSchema
31
39
  >;
32
-
33
- export type GetPresignedDownloadUrlOutput = GetPresignedUploadUrlOutput;
34
-
35
- export type CreateFileInput = z.infer<typeof CreateFileInputSchema>;
36
- export type CreateFileOutput = z.infer<typeof CreateFileOutputSchema>;
37
- export type DeleteFileInput = z.infer<typeof DeleteFileInputParams>;
38
- export type DeleteFileOutput = z.infer<typeof DeleteFileOutputSchema>;