@plyaz/types 1.41.0 → 1.41.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/core/domain/files/schemas.d.ts +4 -3
- package/dist/core/hooks/files/upload.d.ts +7 -6
- package/dist/core/index.cjs +20 -2
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +20 -2
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +2221 -2219
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2221 -2219
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* - FilesMapper for transformations
|
|
11
11
|
*/
|
|
12
12
|
import { z } from 'zod';
|
|
13
|
+
import { ENTITY_TYPE } from '../../../storage/enums';
|
|
13
14
|
/**
|
|
14
15
|
* Media type enum - matches media.type DB ENUM
|
|
15
16
|
* Note: DB only has IMAGE, VIDEO, AUDIO, DOCUMENT (no OTHER)
|
|
@@ -69,7 +70,7 @@ export declare const FilesDatabaseRowSchema: z.ZodObject<{
|
|
|
69
70
|
virus_scan_result: z.ZodNullable<z.ZodString>;
|
|
70
71
|
metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
71
72
|
variants: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
72
|
-
entity_type: z.ZodNullable<z.
|
|
73
|
+
entity_type: z.ZodNullable<z.ZodEnum<typeof ENTITY_TYPE>>;
|
|
73
74
|
entity_id: z.ZodNullable<z.ZodString>;
|
|
74
75
|
access_level: z.ZodNullable<z.ZodString>;
|
|
75
76
|
bucket: z.ZodNullable<z.ZodString>;
|
|
@@ -107,7 +108,7 @@ export declare const CreateFilesSchema: z.ZodObject<{
|
|
|
107
108
|
virus_scan_result: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
108
109
|
metadata: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
109
110
|
variants: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
110
|
-
entity_type: z.ZodDefault<z.ZodNullable<z.
|
|
111
|
+
entity_type: z.ZodDefault<z.ZodNullable<z.ZodEnum<typeof ENTITY_TYPE>>>;
|
|
111
112
|
entity_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
112
113
|
access_level: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
113
114
|
public: "public";
|
|
@@ -145,7 +146,7 @@ export declare const PatchFilesSchema: z.ZodObject<{
|
|
|
145
146
|
virus_scan_result: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
|
|
146
147
|
metadata: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
147
148
|
variants: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
148
|
-
entity_type: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.
|
|
149
|
+
entity_type: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodEnum<typeof ENTITY_TYPE>>>>;
|
|
149
150
|
entity_id: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
|
|
150
151
|
access_level: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
151
152
|
public: "public";
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Uses Pick to extend from existing API types where applicable.
|
|
6
6
|
*/
|
|
7
7
|
import type { UploadFileRequest, GenerateDocumentRequest } from '../../../api';
|
|
8
|
+
import type { FILE_CATEGORY, ENTITY_TYPE } from '../../../storage/enums';
|
|
8
9
|
/**
|
|
9
10
|
* Options for useFileUpload hook - direct file upload
|
|
10
11
|
*
|
|
@@ -14,11 +15,11 @@ import type { UploadFileRequest, GenerateDocumentRequest } from '../../../api';
|
|
|
14
15
|
*/
|
|
15
16
|
export interface CoreFileUploadOptions {
|
|
16
17
|
/** Entity type for file organization */
|
|
17
|
-
entityType?:
|
|
18
|
+
entityType?: ENTITY_TYPE;
|
|
18
19
|
/** Entity ID for file organization */
|
|
19
20
|
entityId?: string;
|
|
20
21
|
/** File category */
|
|
21
|
-
category?:
|
|
22
|
+
category?: FILE_CATEGORY;
|
|
22
23
|
/** Whether file is public */
|
|
23
24
|
isPublic?: boolean;
|
|
24
25
|
}
|
|
@@ -27,12 +28,12 @@ export interface CoreFileUploadOptions {
|
|
|
27
28
|
* Extended from UploadFileRequest API type for consistency.
|
|
28
29
|
*/
|
|
29
30
|
export interface CoreTemplateUploadOptions extends Required<Pick<UploadFileRequest, 'templateId'>>, Pick<UploadFileRequest, 'templateData' | 'outputFormat' | 'locale' | 'pdfOptions'> {
|
|
30
|
-
/** Entity type for file organization (default:
|
|
31
|
-
entityType?:
|
|
31
|
+
/** Entity type for file organization (default: ENTITY_TYPE.SYSTEM) */
|
|
32
|
+
entityType?: ENTITY_TYPE;
|
|
32
33
|
/** Entity ID for file organization (default: 'default') */
|
|
33
34
|
entityId?: string;
|
|
34
|
-
/** File category (default:
|
|
35
|
-
category?:
|
|
35
|
+
/** File category (default: FILE_CATEGORY.DOCUMENT) */
|
|
36
|
+
category?: FILE_CATEGORY;
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
* Options for generate-only (returns buffer, no upload)
|
package/dist/core/index.cjs
CHANGED
|
@@ -395,6 +395,24 @@ var FILES_STREAM_CHANNEL = {
|
|
|
395
395
|
// Broadcast channels
|
|
396
396
|
BROADCAST: FILES_STREAM_BROADCAST_CHANNEL
|
|
397
397
|
};
|
|
398
|
+
|
|
399
|
+
// src/storage/enums.ts
|
|
400
|
+
var ENTITY_TYPE = /* @__PURE__ */ ((ENTITY_TYPE2) => {
|
|
401
|
+
ENTITY_TYPE2["USER"] = "user";
|
|
402
|
+
ENTITY_TYPE2["FAN"] = "fan";
|
|
403
|
+
ENTITY_TYPE2["ATHLETE"] = "athlete";
|
|
404
|
+
ENTITY_TYPE2["CLUB"] = "club";
|
|
405
|
+
ENTITY_TYPE2["BRAND"] = "brand";
|
|
406
|
+
ENTITY_TYPE2["ORGANIZATION"] = "organization";
|
|
407
|
+
ENTITY_TYPE2["EVENT"] = "event";
|
|
408
|
+
ENTITY_TYPE2["POST"] = "post";
|
|
409
|
+
ENTITY_TYPE2["PRODUCT"] = "product";
|
|
410
|
+
ENTITY_TYPE2["NFT"] = "nft";
|
|
411
|
+
ENTITY_TYPE2["SYSTEM"] = "system";
|
|
412
|
+
return ENTITY_TYPE2;
|
|
413
|
+
})(ENTITY_TYPE || {});
|
|
414
|
+
|
|
415
|
+
// src/core/domain/files/schemas.ts
|
|
398
416
|
var MediaTypeSchema = zod.z.enum(["IMAGE", "VIDEO", "AUDIO", "DOCUMENT"]);
|
|
399
417
|
var FileTypeSchema = zod.z.enum(["IMAGE", "VIDEO", "DOCUMENT", "AUDIO", "OTHER"]);
|
|
400
418
|
var MediaAccessLevelSchema = zod.z.enum(["public", "private", "protected"]).nullable();
|
|
@@ -422,7 +440,7 @@ var FilesDatabaseRowSchema = zod.z.object({
|
|
|
422
440
|
virus_scan_result: zod.z.string().nullable(),
|
|
423
441
|
metadata: zod.z.record(zod.z.string(), zod.z.unknown()).nullable(),
|
|
424
442
|
variants: zod.z.record(zod.z.string(), zod.z.unknown()).nullable(),
|
|
425
|
-
entity_type: zod.z.
|
|
443
|
+
entity_type: zod.z.nativeEnum(ENTITY_TYPE).nullable(),
|
|
426
444
|
entity_id: zod.z.string().nullable(),
|
|
427
445
|
access_level: zod.z.string().nullable(),
|
|
428
446
|
bucket: zod.z.string().nullable()
|
|
@@ -445,7 +463,7 @@ var CreateFilesSchema = zod.z.object({
|
|
|
445
463
|
virus_scan_result: zod.z.string().nullable().default(null),
|
|
446
464
|
metadata: zod.z.record(zod.z.string(), zod.z.unknown()).nullable().default(null),
|
|
447
465
|
variants: zod.z.record(zod.z.string(), zod.z.unknown()).nullable().default(null),
|
|
448
|
-
entity_type: zod.z.
|
|
466
|
+
entity_type: zod.z.nativeEnum(ENTITY_TYPE).nullable().default(null),
|
|
449
467
|
entity_id: zod.z.string().nullable().default(null),
|
|
450
468
|
access_level: MediaAccessLevelSchema.default(null),
|
|
451
469
|
bucket: zod.z.string().nullable().default(null)
|