@wildo-ai/zod-decorators 1.0.0
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/esm/__mocks__/mime.d.ts +12 -0
- package/dist/esm/__mocks__/mime.d.ts.map +1 -0
- package/dist/esm/__mocks__/mime.js +75 -0
- package/dist/esm/__mocks__/mime.js.map +1 -0
- package/dist/esm/commons.d.ts +26 -0
- package/dist/esm/commons.d.ts.map +1 -0
- package/dist/esm/commons.js +41 -0
- package/dist/esm/commons.js.map +1 -0
- package/dist/esm/currencies.shared.schemas.d.ts +208 -0
- package/dist/esm/currencies.shared.schemas.d.ts.map +1 -0
- package/dist/esm/currencies.shared.schemas.js +228 -0
- package/dist/esm/currencies.shared.schemas.js.map +1 -0
- package/dist/esm/files/agent-file-formats.d.ts +99 -0
- package/dist/esm/files/agent-file-formats.d.ts.map +1 -0
- package/dist/esm/files/agent-file-formats.js +163 -0
- package/dist/esm/files/agent-file-formats.js.map +1 -0
- package/dist/esm/files/extension-nature-map.d.ts +12 -0
- package/dist/esm/files/extension-nature-map.d.ts.map +1 -0
- package/dist/esm/files/extension-nature-map.js +63 -0
- package/dist/esm/files/extension-nature-map.js.map +1 -0
- package/dist/esm/files/file-extensions.enum.d.ts +58 -0
- package/dist/esm/files/file-extensions.enum.d.ts.map +1 -0
- package/dist/esm/files/file-extensions.enum.js +65 -0
- package/dist/esm/files/file-extensions.enum.js.map +1 -0
- package/dist/esm/files/mime-registry.d.ts +72 -0
- package/dist/esm/files/mime-registry.d.ts.map +1 -0
- package/dist/esm/files/mime-registry.js +174 -0
- package/dist/esm/files/mime-registry.js.map +1 -0
- package/dist/esm/files/unified-registry.d.ts +112 -0
- package/dist/esm/files/unified-registry.d.ts.map +1 -0
- package/dist/esm/files/unified-registry.js +190 -0
- package/dist/esm/files/unified-registry.js.map +1 -0
- package/dist/esm/index.d.ts +29 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +36 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/testing/decorated-test-schemas.d.ts +27 -0
- package/dist/esm/testing/decorated-test-schemas.d.ts.map +1 -0
- package/dist/esm/testing/decorated-test-schemas.js +26 -0
- package/dist/esm/testing/decorated-test-schemas.js.map +1 -0
- package/dist/esm/testing.d.ts +6 -0
- package/dist/esm/testing.d.ts.map +1 -0
- package/dist/esm/testing.js +6 -0
- package/dist/esm/testing.js.map +1 -0
- package/dist/esm/zod-bigdecimal.d.ts +193 -0
- package/dist/esm/zod-bigdecimal.d.ts.map +1 -0
- package/dist/esm/zod-bigdecimal.js +274 -0
- package/dist/esm/zod-bigdecimal.js.map +1 -0
- package/dist/esm/zod-code.d.ts +95 -0
- package/dist/esm/zod-code.d.ts.map +1 -0
- package/dist/esm/zod-code.js +160 -0
- package/dist/esm/zod-code.js.map +1 -0
- package/dist/esm/zod-color.d.ts +8 -0
- package/dist/esm/zod-color.d.ts.map +1 -0
- package/dist/esm/zod-color.js +88 -0
- package/dist/esm/zod-color.js.map +1 -0
- package/dist/esm/zod-decorators.types.d.ts +2207 -0
- package/dist/esm/zod-decorators.types.d.ts.map +1 -0
- package/dist/esm/zod-decorators.types.js +771 -0
- package/dist/esm/zod-decorators.types.js.map +1 -0
- package/dist/esm/zod-duration.d.ts +128 -0
- package/dist/esm/zod-duration.d.ts.map +1 -0
- package/dist/esm/zod-duration.js +174 -0
- package/dist/esm/zod-duration.js.map +1 -0
- package/dist/esm/zod-file.d.ts +219 -0
- package/dist/esm/zod-file.d.ts.map +1 -0
- package/dist/esm/zod-file.js +469 -0
- package/dist/esm/zod-file.js.map +1 -0
- package/dist/esm/zod-money.d.ts +223 -0
- package/dist/esm/zod-money.d.ts.map +1 -0
- package/dist/esm/zod-money.js +293 -0
- package/dist/esm/zod-money.js.map +1 -0
- package/dist/esm/zod-phone.d.ts +75 -0
- package/dist/esm/zod-phone.d.ts.map +1 -0
- package/dist/esm/zod-phone.js +116 -0
- package/dist/esm/zod-phone.js.map +1 -0
- package/dist/esm/zod-range.d.ts +87 -0
- package/dist/esm/zod-range.d.ts.map +1 -0
- package/dist/esm/zod-range.js +138 -0
- package/dist/esm/zod-range.js.map +1 -0
- package/dist/esm/zod-utils.shared.d.ts +783 -0
- package/dist/esm/zod-utils.shared.d.ts.map +1 -0
- package/dist/esm/zod-utils.shared.js +2647 -0
- package/dist/esm/zod-utils.shared.js.map +1 -0
- package/dist/esm/zod-versioned.d.ts +150 -0
- package/dist/esm/zod-versioned.d.ts.map +1 -0
- package/dist/esm/zod-versioned.js +172 -0
- package/dist/esm/zod-versioned.js.map +1 -0
- package/dist/esm/zod.module-override.d.ts +413 -0
- package/dist/esm/zod.module-override.d.ts.map +1 -0
- package/dist/esm/zod.module-override.js +1093 -0
- package/dist/esm/zod.module-override.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// FILE SCHEMA HELPER
|
|
3
|
+
// ============================================================================
|
|
4
|
+
import { SCHEMA_METADATA, FileMimeTypeGroups, FileNature, FileDisplayNature, FileStorageAccepted, ZodDecorator } from "./zod-decorators.types.js";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { addChainableMethods } from "./zod.module-override.js";
|
|
7
|
+
import { UnifiedFileFormatRegistry } from "./files/unified-registry.js";
|
|
8
|
+
/**
|
|
9
|
+
* Deduplicated warning tracker for unsupported storage providers.
|
|
10
|
+
* Prevents console spam when the same schema is created multiple times (e.g., in tests or HMR).
|
|
11
|
+
*/
|
|
12
|
+
const _warnedStorageProviders = new Set();
|
|
13
|
+
const _supportedProviders = new Set([FileStorageAccepted.WILDO_MANAGED, FileStorageAccepted.LOCAL_DIRECTORY]);
|
|
14
|
+
/**
|
|
15
|
+
* Zod schema for SingleFileValue.
|
|
16
|
+
*/
|
|
17
|
+
export const SingleFileValueSchema = z.object({
|
|
18
|
+
fileId: z.string().min(1),
|
|
19
|
+
updatedAt: z.date(),
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Zod schema for MultipleFileValue.
|
|
23
|
+
*/
|
|
24
|
+
export const MultipleFileValueSchema = z.object({
|
|
25
|
+
fileIds: z.array(z.string().min(1)),
|
|
26
|
+
updatedAt: z.date(),
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Resolve MIME type groups to actual MIME types.
|
|
30
|
+
* Handles both single group names and arrays of groups/MIME types.
|
|
31
|
+
*/
|
|
32
|
+
export function resolveMimeTypes(allowedMimeTypes) {
|
|
33
|
+
if (!allowedMimeTypes)
|
|
34
|
+
return undefined;
|
|
35
|
+
// If it's a single group name
|
|
36
|
+
if (typeof allowedMimeTypes === 'string') {
|
|
37
|
+
if (allowedMimeTypes in FileMimeTypeGroups) {
|
|
38
|
+
return [...FileMimeTypeGroups[allowedMimeTypes]];
|
|
39
|
+
}
|
|
40
|
+
// Single MIME type
|
|
41
|
+
return [allowedMimeTypes];
|
|
42
|
+
}
|
|
43
|
+
// If it's an array
|
|
44
|
+
if (Array.isArray(allowedMimeTypes)) {
|
|
45
|
+
const resolved = [];
|
|
46
|
+
for (const item of allowedMimeTypes) {
|
|
47
|
+
if (item in FileMimeTypeGroups) {
|
|
48
|
+
// It's a group name
|
|
49
|
+
resolved.push(...FileMimeTypeGroups[item]);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// It's a MIME type
|
|
53
|
+
resolved.push(item);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Remove duplicates
|
|
57
|
+
return [...new Set(resolved)];
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* z_file() - Creates file schemas for file uploads.
|
|
63
|
+
*
|
|
64
|
+
* File values are stored as: { fileId: string, updatedAt: Date }
|
|
65
|
+
* - fileId: Reference to the file in storage (foreign key, indexed)
|
|
66
|
+
* - updatedAt: When the file was last updated
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* import { z_file } from '@wildo-ai/zod-decorators';
|
|
71
|
+
*
|
|
72
|
+
* const avatar = z_file();
|
|
73
|
+
* const document = z_file({ allowedMimeTypes: 'Documents' });
|
|
74
|
+
* const images = z_file({
|
|
75
|
+
* allowedMimeTypes: 'Images',
|
|
76
|
+
* maxSize: 5 * 1024 * 1024, // 5MB
|
|
77
|
+
* overridable: true
|
|
78
|
+
* });
|
|
79
|
+
*
|
|
80
|
+
* // With decorators (chainable)
|
|
81
|
+
* z_file().fileUI({ edit: { editMode: FileEditMode.DROPZONE } })
|
|
82
|
+
* z_file({ allowedMimeTypes: ['Images', 'PDF'] }).isHidden({ edit: true })
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
/**
|
|
86
|
+
* Creates a file schema with metadata for detection and form component rendering.
|
|
87
|
+
*
|
|
88
|
+
* @param options - Configuration options for file field
|
|
89
|
+
* @returns A Zod object schema with metadata for file detection
|
|
90
|
+
*/
|
|
91
|
+
export function createFileSchema(options = {}) {
|
|
92
|
+
const { overridable = true, allowedMimeTypes, maxSize, minSize, multiple = false, maxFiles, nature, storageAccepted, filePathBinding, imageConstraints, videoConstraints, audioConstraints, documentConstraints, rag, scanPolicy, onParentDelete = 'cascade', sharable, sharableDefaults, } = options;
|
|
93
|
+
// Warn at schema creation if non-WILDO_MANAGED storage providers are configured (not yet supported)
|
|
94
|
+
// Uses deduplication to avoid console spam during tests or HMR
|
|
95
|
+
if (storageAccepted && storageAccepted.some(s => !_supportedProviders.has(s))) {
|
|
96
|
+
const unsupported = storageAccepted.filter(s => !_supportedProviders.has(s));
|
|
97
|
+
const warnKey = unsupported.sort().join(',');
|
|
98
|
+
if (!_warnedStorageProviders.has(warnKey)) {
|
|
99
|
+
_warnedStorageProviders.add(warnKey);
|
|
100
|
+
console.warn(`[z_file] storageAccepted contains unsupported providers: ${unsupported.join(', ')}. ` +
|
|
101
|
+
`Only '${FileStorageAccepted.WILDO_MANAGED}' and '${FileStorageAccepted.LOCAL_DIRECTORY}' are currently implemented. ` +
|
|
102
|
+
`External storage providers (OneDrive, Google Drive, Dropbox) will be ignored until their integrations are available.`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (filePathBinding) {
|
|
106
|
+
if (filePathBinding.multipleFilePolicy && !multiple) {
|
|
107
|
+
console.warn('[z_file] filePathBinding.multipleFilePolicy is set but multiple is false — multipleFilePolicy will be ignored. ' +
|
|
108
|
+
'Either set multiple: true or remove multipleFilePolicy.');
|
|
109
|
+
}
|
|
110
|
+
if (filePathBinding.fileName && multiple) {
|
|
111
|
+
console.warn('[z_file] filePathBinding.fileName is set on a multiple file field — fileName is ignored for multiple uploads. ' +
|
|
112
|
+
'Use filePathBinding.multipleFilePolicy.fileNameTemplate instead.');
|
|
113
|
+
}
|
|
114
|
+
const implicitOrExplicitS3 = !storageAccepted || storageAccepted.includes(FileStorageAccepted.WILDO_MANAGED);
|
|
115
|
+
const localIncluded = storageAccepted?.includes(FileStorageAccepted.LOCAL_DIRECTORY);
|
|
116
|
+
if (filePathBinding.includeApplicationId === false && implicitOrExplicitS3 && !localIncluded) {
|
|
117
|
+
console.warn('[z_file] filePathBinding.includeApplicationId is false with WILDO_MANAGED storage. ' +
|
|
118
|
+
'S3 keys will not be scoped by applicationId — ensure cross-app collision is acceptable.');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// Resolve MIME type groups to actual MIME types
|
|
122
|
+
const resolvedMimeTypes = resolveMimeTypes(allowedMimeTypes);
|
|
123
|
+
// Create the file object schema based on single/multiple
|
|
124
|
+
const fileSchema = multiple
|
|
125
|
+
? z.object({
|
|
126
|
+
fileIds: z.array(z.string().min(1)),
|
|
127
|
+
updatedAt: z.date(),
|
|
128
|
+
})
|
|
129
|
+
: z.object({
|
|
130
|
+
fileId: z.string().min(1),
|
|
131
|
+
updatedAt: z.date(),
|
|
132
|
+
});
|
|
133
|
+
// No longer stored in metadata — consumers derive accept from allowedMimeTypes via buildAcceptAttribute()
|
|
134
|
+
// Store file metadata in SCHEMA_METADATA.fileConfig
|
|
135
|
+
const fileMetadata = {
|
|
136
|
+
isFile: true,
|
|
137
|
+
overridable,
|
|
138
|
+
...(resolvedMimeTypes !== undefined && { allowedMimeTypes: resolvedMimeTypes }),
|
|
139
|
+
...(maxSize !== undefined && { maxSize }),
|
|
140
|
+
...(minSize !== undefined && { minSize }),
|
|
141
|
+
multiple,
|
|
142
|
+
...(maxFiles !== undefined && { maxFiles }),
|
|
143
|
+
...(nature !== undefined && { nature }),
|
|
144
|
+
...(storageAccepted !== undefined && { storageAccepted }),
|
|
145
|
+
...(filePathBinding !== undefined && { filePathBinding }),
|
|
146
|
+
...(imageConstraints !== undefined && { imageConstraints }),
|
|
147
|
+
...(videoConstraints !== undefined && { videoConstraints }),
|
|
148
|
+
...(audioConstraints !== undefined && { audioConstraints }),
|
|
149
|
+
...(documentConstraints !== undefined && { documentConstraints }),
|
|
150
|
+
...(rag !== undefined && { rag }),
|
|
151
|
+
...(scanPolicy !== undefined && { scanPolicy }),
|
|
152
|
+
onParentDelete,
|
|
153
|
+
...(sharable !== undefined && { sharable }),
|
|
154
|
+
...(sharableDefaults !== undefined && { sharableDefaults }),
|
|
155
|
+
};
|
|
156
|
+
// Initialize or extend SCHEMA_METADATA with file config
|
|
157
|
+
const existingMetadata = fileSchema[SCHEMA_METADATA] || {};
|
|
158
|
+
fileSchema[SCHEMA_METADATA] = {
|
|
159
|
+
...existingMetadata,
|
|
160
|
+
fileConfig: fileMetadata,
|
|
161
|
+
};
|
|
162
|
+
// Add chainable decorator methods to the file schema instance
|
|
163
|
+
addChainableMethods(fileSchema);
|
|
164
|
+
if (multiple) {
|
|
165
|
+
return fileSchema;
|
|
166
|
+
}
|
|
167
|
+
return fileSchema;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Creates a file schema for file uploads with reference storage.
|
|
171
|
+
* Named z_file to indicate it's a Zod helper function exported standalone.
|
|
172
|
+
*
|
|
173
|
+
* Single file values are stored as: { fileId: string, updatedAt: Date }
|
|
174
|
+
* Multiple file values are stored as: { fileIds: string[], updatedAt: Date }
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* import { z_file } from '@wildo-ai/zod-decorators';
|
|
179
|
+
*
|
|
180
|
+
* // Simple usage - single file, any type
|
|
181
|
+
* z_file()
|
|
182
|
+
*
|
|
183
|
+
* // With MIME type groups (shortcuts)
|
|
184
|
+
* z_file({ allowedMimeTypes: 'Images' })
|
|
185
|
+
* z_file({ allowedMimeTypes: 'PDF' })
|
|
186
|
+
* z_file({ allowedMimeTypes: ['Images', 'Video'] })
|
|
187
|
+
* z_file({ allowedMimeTypes: 'Documents' }) // PDF + Office
|
|
188
|
+
*
|
|
189
|
+
* // With specific MIME types
|
|
190
|
+
* z_file({ allowedMimeTypes: ['image/png', 'image/jpeg'] })
|
|
191
|
+
*
|
|
192
|
+
* // With size constraints
|
|
193
|
+
* z_file({ maxSize: 10 * 1024 * 1024 }) // 10MB max
|
|
194
|
+
*
|
|
195
|
+
* // Multiple files (uses fileIds instead of fileId)
|
|
196
|
+
* z_file({ multiple: true, maxFiles: 5 })
|
|
197
|
+
*
|
|
198
|
+
* // Non-overridable (append-only)
|
|
199
|
+
* z_file({ overridable: false })
|
|
200
|
+
*
|
|
201
|
+
* // RAG and text extraction
|
|
202
|
+
* z_file({ rag: { enabled: true, extractText: true } })
|
|
203
|
+
*
|
|
204
|
+
* // With decorators
|
|
205
|
+
* z_file().fileUI({ edit: { editMode: FileEditMode.DROPZONE } })
|
|
206
|
+
* z_file().isHidden({ display: true })
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
export function z_file(options) {
|
|
210
|
+
return createFileSchema(options);
|
|
211
|
+
}
|
|
212
|
+
// ============================================================================
|
|
213
|
+
// UTILITY FUNCTIONS
|
|
214
|
+
// ============================================================================
|
|
215
|
+
/**
|
|
216
|
+
* Format file size for display.
|
|
217
|
+
*/
|
|
218
|
+
export function formatFileSize(bytes) {
|
|
219
|
+
if (!Number.isFinite(bytes))
|
|
220
|
+
return '—';
|
|
221
|
+
if (bytes === 0)
|
|
222
|
+
return '0 B';
|
|
223
|
+
if (bytes < 0)
|
|
224
|
+
return '-' + formatFileSize(Math.abs(bytes));
|
|
225
|
+
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
226
|
+
const k = 1024;
|
|
227
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
228
|
+
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${units[i]}`;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Build enhanced accept attribute string from MIME types.
|
|
232
|
+
* Includes both MIME types and extensions for better browser compatibility.
|
|
233
|
+
* Format: "image/*,.jpg,.jpeg,.png" or "application/pdf,.pdf"
|
|
234
|
+
*
|
|
235
|
+
* @param mimeTypes - Array of MIME type strings
|
|
236
|
+
* @returns Accept attribute string with MIME types and extensions
|
|
237
|
+
*/
|
|
238
|
+
export function buildAcceptAttribute(mimeTypes) {
|
|
239
|
+
if (!mimeTypes || mimeTypes.length === 0)
|
|
240
|
+
return '';
|
|
241
|
+
const parts = new Set();
|
|
242
|
+
const extensions = new Set();
|
|
243
|
+
for (const mimeType of mimeTypes) {
|
|
244
|
+
// Add MIME type
|
|
245
|
+
parts.add(mimeType);
|
|
246
|
+
// Get extensions for this MIME type
|
|
247
|
+
const mimeExtensions = UnifiedFileFormatRegistry.getExtensions(mimeType);
|
|
248
|
+
for (const ext of mimeExtensions) {
|
|
249
|
+
if (ext) {
|
|
250
|
+
extensions.add(`.${ext}`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
// Also check if it's a wildcard MIME type (e.g., image/*)
|
|
254
|
+
// In that case, get all extensions for that nature
|
|
255
|
+
if (mimeType.endsWith('/*')) {
|
|
256
|
+
const formatType = UnifiedFileFormatRegistry.getFormatTypeFromMimeType(mimeType);
|
|
257
|
+
if (formatType && formatType.type === 'nature') {
|
|
258
|
+
const natureExtensions = UnifiedFileFormatRegistry.getExtensionsForNature(formatType.nature);
|
|
259
|
+
for (const ext of natureExtensions) {
|
|
260
|
+
if (ext) {
|
|
261
|
+
extensions.add(`.${ext}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
// Combine MIME types and extensions
|
|
268
|
+
const allParts = [...parts, ...extensions];
|
|
269
|
+
return allParts.join(',');
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Get file extension from filename.
|
|
273
|
+
* Uses UnifiedFileFormatRegistry for consistency.
|
|
274
|
+
*/
|
|
275
|
+
export function getFileExtension(filename) {
|
|
276
|
+
return UnifiedFileFormatRegistry.getFileExtension(filename);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Check if a MIME type is allowed based on allowed types.
|
|
280
|
+
*/
|
|
281
|
+
export function isMimeTypeAllowed(mimeType, allowedMimeTypes) {
|
|
282
|
+
if (!allowedMimeTypes || allowedMimeTypes.length === 0)
|
|
283
|
+
return true;
|
|
284
|
+
// Check exact match
|
|
285
|
+
if (allowedMimeTypes.includes(mimeType))
|
|
286
|
+
return true;
|
|
287
|
+
// Check wildcard match (e.g., "image/*")
|
|
288
|
+
const [type] = mimeType.split('/');
|
|
289
|
+
if (allowedMimeTypes.includes(`${type}/*`))
|
|
290
|
+
return true;
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Get a human-readable description of allowed file types.
|
|
295
|
+
* Uses UnifiedFileFormatRegistry for better format detection.
|
|
296
|
+
*/
|
|
297
|
+
export function getAcceptDescription(allowedMimeTypes) {
|
|
298
|
+
if (!allowedMimeTypes || allowedMimeTypes.length === 0)
|
|
299
|
+
return 'All files';
|
|
300
|
+
const types = new Set();
|
|
301
|
+
for (const mime of allowedMimeTypes) {
|
|
302
|
+
// Use registry to detect format type
|
|
303
|
+
const formatType = UnifiedFileFormatRegistry.getFormatTypeFromMimeType(mime);
|
|
304
|
+
if (formatType) {
|
|
305
|
+
if (formatType.type === 'nature') {
|
|
306
|
+
// Map FileNature to human-readable names
|
|
307
|
+
const natureNames = {
|
|
308
|
+
[FileNature.IMAGE]: 'Images',
|
|
309
|
+
[FileNature.VIDEO]: 'Videos',
|
|
310
|
+
[FileNature.AUDIO]: 'Audio files',
|
|
311
|
+
[FileNature.PDF]: 'PDF',
|
|
312
|
+
[FileNature.OFFICE]: 'Office documents',
|
|
313
|
+
[FileNature.ARCHIVE]: 'Archives',
|
|
314
|
+
};
|
|
315
|
+
const name = natureNames[formatType.nature];
|
|
316
|
+
if (name) {
|
|
317
|
+
types.add(name);
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
else if (formatType.type === 'agent') {
|
|
322
|
+
// Map agent formats to human-readable names
|
|
323
|
+
const agentNames = {
|
|
324
|
+
'text': 'Text files',
|
|
325
|
+
'markdown': 'Markdown',
|
|
326
|
+
'json': 'JSON',
|
|
327
|
+
'typescript': 'TypeScript',
|
|
328
|
+
'typescript_react': 'TypeScript React',
|
|
329
|
+
'yaml': 'YAML',
|
|
330
|
+
};
|
|
331
|
+
const name = agentNames[formatType.format] || formatType.format.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
|
|
332
|
+
types.add(name);
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
// Fallback: use MIME type patterns
|
|
337
|
+
if (mime === 'application/pdf') {
|
|
338
|
+
types.add('PDF');
|
|
339
|
+
}
|
|
340
|
+
else if (mime.startsWith('image/')) {
|
|
341
|
+
types.add('Images');
|
|
342
|
+
}
|
|
343
|
+
else if (mime.startsWith('video/')) {
|
|
344
|
+
types.add('Videos');
|
|
345
|
+
}
|
|
346
|
+
else if (mime.startsWith('audio/')) {
|
|
347
|
+
types.add('Audio');
|
|
348
|
+
}
|
|
349
|
+
else if (mime.includes('document') || mime.includes('word') || mime.includes('excel') || mime.includes('powerpoint')) {
|
|
350
|
+
types.add('Office documents');
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
// Get extension-like description
|
|
354
|
+
const ext = mime.split('/').pop()?.toUpperCase();
|
|
355
|
+
if (ext)
|
|
356
|
+
types.add(ext);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return Array.from(types).join(', ') || 'Selected file types';
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Get file nature from schema metadata.
|
|
363
|
+
* @param schema - Zod schema (must be a file schema)
|
|
364
|
+
* @returns FileNature or undefined if not set
|
|
365
|
+
*/
|
|
366
|
+
export function getFileNature(schema) {
|
|
367
|
+
const metadata = schema[SCHEMA_METADATA];
|
|
368
|
+
return metadata?.fileConfig?.nature;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Get storage accepted from schema metadata.
|
|
372
|
+
* @param schema - Zod schema (must be a file schema)
|
|
373
|
+
* @returns Array of FileStorageAccepted or undefined if not set
|
|
374
|
+
*/
|
|
375
|
+
export function getStorageAccepted(schema) {
|
|
376
|
+
const metadata = schema[SCHEMA_METADATA];
|
|
377
|
+
return metadata?.fileConfig?.storageAccepted;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Get file constraints from schema metadata.
|
|
381
|
+
* @param schema - Zod schema (must be a file schema)
|
|
382
|
+
* @returns Object with all constraint properties or undefined if not set
|
|
383
|
+
*/
|
|
384
|
+
export function getFileConstraints(schema) {
|
|
385
|
+
const metadata = schema[SCHEMA_METADATA];
|
|
386
|
+
const fileConfig = metadata?.fileConfig;
|
|
387
|
+
if (!fileConfig)
|
|
388
|
+
return undefined;
|
|
389
|
+
const hasConstraints = fileConfig.imageConstraints ||
|
|
390
|
+
fileConfig.videoConstraints ||
|
|
391
|
+
fileConfig.audioConstraints ||
|
|
392
|
+
fileConfig.documentConstraints;
|
|
393
|
+
if (!hasConstraints)
|
|
394
|
+
return undefined;
|
|
395
|
+
return {
|
|
396
|
+
...(fileConfig.imageConstraints && { imageConstraints: fileConfig.imageConstraints }),
|
|
397
|
+
...(fileConfig.videoConstraints && { videoConstraints: fileConfig.videoConstraints }),
|
|
398
|
+
...(fileConfig.audioConstraints && { audioConstraints: fileConfig.audioConstraints }),
|
|
399
|
+
...(fileConfig.documentConstraints && { documentConstraints: fileConfig.documentConstraints }),
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
// ============================================================================
|
|
403
|
+
// DISPLAY NATURE RESOLUTION
|
|
404
|
+
// ============================================================================
|
|
405
|
+
/**
|
|
406
|
+
* Mapping from schema-level `FileNature` to rendering-level `FileDisplayNature`.
|
|
407
|
+
*
|
|
408
|
+
* PDF and OFFICE both render as DOCUMENT.
|
|
409
|
+
* ARCHIVE and ALL are GENERIC (no specialized renderer).
|
|
410
|
+
*/
|
|
411
|
+
const FILE_NATURE_TO_DISPLAY_NATURE = {
|
|
412
|
+
[FileNature.IMAGE]: FileDisplayNature.IMAGE,
|
|
413
|
+
[FileNature.VIDEO]: FileDisplayNature.VIDEO,
|
|
414
|
+
[FileNature.AUDIO]: FileDisplayNature.AUDIO,
|
|
415
|
+
[FileNature.PDF]: FileDisplayNature.DOCUMENT,
|
|
416
|
+
[FileNature.OFFICE]: FileDisplayNature.DOCUMENT,
|
|
417
|
+
[FileNature.ARCHIVE]: FileDisplayNature.GENERIC,
|
|
418
|
+
[FileNature.ALL]: FileDisplayNature.GENERIC,
|
|
419
|
+
};
|
|
420
|
+
/**
|
|
421
|
+
* Detect `FileDisplayNature` from a MIME type string.
|
|
422
|
+
*
|
|
423
|
+
* Used as a fallback when no `FileNature` is declared in schema metadata.
|
|
424
|
+
*/
|
|
425
|
+
function detectDisplayNatureFromMimeType(mimeType) {
|
|
426
|
+
if (mimeType.startsWith('image/'))
|
|
427
|
+
return FileDisplayNature.IMAGE;
|
|
428
|
+
if (mimeType.startsWith('video/'))
|
|
429
|
+
return FileDisplayNature.VIDEO;
|
|
430
|
+
if (mimeType.startsWith('audio/'))
|
|
431
|
+
return FileDisplayNature.AUDIO;
|
|
432
|
+
if (mimeType === 'application/pdf' ||
|
|
433
|
+
mimeType.includes('document') || mimeType.includes('word') ||
|
|
434
|
+
mimeType.includes('spreadsheet') || mimeType.includes('excel') ||
|
|
435
|
+
mimeType.includes('presentation') || mimeType.includes('powerpoint'))
|
|
436
|
+
return FileDisplayNature.DOCUMENT;
|
|
437
|
+
return FileDisplayNature.GENERIC;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Resolve the rendering-level display nature for a file.
|
|
441
|
+
*
|
|
442
|
+
* Resolution priority:
|
|
443
|
+
* 1. `schemaNature` (from `z_file({ nature: ... })` metadata) → mapped via `FILE_NATURE_TO_DISPLAY_NATURE`
|
|
444
|
+
* 2. `mimeType` (from file metadata or browser File object) → detected via MIME prefix matching
|
|
445
|
+
* 3. `FileDisplayNature.GENERIC` (fallback)
|
|
446
|
+
*
|
|
447
|
+
* @param schemaNature - The `FileNature` declared in schema metadata (from `getFileMetadata(schema)?.nature`)
|
|
448
|
+
* @param mimeType - The MIME type of the actual file
|
|
449
|
+
* @returns The `FileDisplayNature` to use for rendering
|
|
450
|
+
*
|
|
451
|
+
* @example
|
|
452
|
+
* ```typescript
|
|
453
|
+
* const displayNature = resolveFileDisplayNature(fileSchemaMetadata?.nature, metadata.mimeType)
|
|
454
|
+
* // FileDisplayNature.IMAGE | .VIDEO | .AUDIO | .DOCUMENT | .GENERIC
|
|
455
|
+
* ```
|
|
456
|
+
*/
|
|
457
|
+
export function resolveFileDisplayNature(schemaNature, mimeType) {
|
|
458
|
+
// Priority 1: Schema-declared nature
|
|
459
|
+
if (schemaNature) {
|
|
460
|
+
return FILE_NATURE_TO_DISPLAY_NATURE[schemaNature] ?? FileDisplayNature.GENERIC;
|
|
461
|
+
}
|
|
462
|
+
// Priority 2: MIME type detection
|
|
463
|
+
if (mimeType) {
|
|
464
|
+
return detectDisplayNatureFromMimeType(mimeType);
|
|
465
|
+
}
|
|
466
|
+
// Priority 3: Fallback
|
|
467
|
+
return FileDisplayNature.GENERIC;
|
|
468
|
+
}
|
|
469
|
+
//# sourceMappingURL=zod-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod-file.js","sourceRoot":"","sources":["../../src/zod-file.ts"],"names":[],"mappings":"AACA,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAG/E,OAAO,EAEL,eAAe,EAIf,kBAAkB,EAElB,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EAMnB,YAAY,EAEb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAKrE;;;GAGG;AACH,MAAM,uBAAuB,GAAG,IAAI,GAAG,EAAU,CAAC;AAClD,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,mBAAmB,CAAC,aAAa,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC,CAAC;AA6B9G;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA+D,CAAC,CAAC,MAAM,CAAC;IACxG,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE;CACpB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA4E,CAAC,CAAC,MAAM,CAAC;IACvH,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACnC,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE;CACpB,CAAC,CAAC;AAGH;;;GAGG;AACH,MAA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