digitaltwin-core 0.14.2 → 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/LICENSE +20 -20
- package/README.md +494 -359
- package/dist/auth/apisix_parser.d.ts +141 -0
- package/dist/auth/apisix_parser.d.ts.map +1 -0
- package/dist/auth/apisix_parser.js +161 -0
- package/dist/auth/apisix_parser.js.map +1 -0
- package/dist/auth/auth_config.d.ts +126 -0
- package/dist/auth/auth_config.d.ts.map +1 -0
- package/dist/auth/auth_config.js +169 -0
- package/dist/auth/auth_config.js.map +1 -0
- package/dist/auth/auth_provider.d.ts +118 -0
- package/dist/auth/auth_provider.d.ts.map +1 -0
- package/dist/auth/auth_provider.js +8 -0
- package/dist/auth/auth_provider.js.map +1 -0
- package/dist/auth/auth_provider_factory.d.ts +91 -0
- package/dist/auth/auth_provider_factory.d.ts.map +1 -0
- package/dist/auth/auth_provider_factory.js +146 -0
- package/dist/auth/auth_provider_factory.js.map +1 -0
- package/dist/auth/index.d.ts +8 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +7 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/providers/gateway_auth_provider.d.ts +78 -0
- package/dist/auth/providers/gateway_auth_provider.d.ts.map +1 -0
- package/dist/auth/providers/gateway_auth_provider.js +109 -0
- package/dist/auth/providers/gateway_auth_provider.js.map +1 -0
- package/dist/auth/providers/index.d.ts +4 -0
- package/dist/auth/providers/index.d.ts.map +1 -0
- package/dist/auth/providers/index.js +4 -0
- package/dist/auth/providers/index.js.map +1 -0
- package/dist/auth/providers/jwt_auth_provider.d.ts +91 -0
- package/dist/auth/providers/jwt_auth_provider.d.ts.map +1 -0
- package/dist/auth/providers/jwt_auth_provider.js +204 -0
- package/dist/auth/providers/jwt_auth_provider.js.map +1 -0
- package/dist/auth/providers/no_auth_provider.d.ts +61 -0
- package/dist/auth/providers/no_auth_provider.d.ts.map +1 -0
- package/dist/auth/providers/no_auth_provider.js +76 -0
- package/dist/auth/providers/no_auth_provider.js.map +1 -0
- package/dist/auth/types.d.ts +100 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +2 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/auth/user_service.d.ts +86 -0
- package/dist/auth/user_service.d.ts.map +1 -0
- package/dist/auth/user_service.js +237 -0
- package/dist/auth/user_service.js.map +1 -0
- package/dist/components/assets_manager.d.ts +662 -0
- package/dist/components/assets_manager.d.ts.map +1 -0
- package/dist/components/assets_manager.js +1537 -0
- package/dist/components/assets_manager.js.map +1 -0
- package/dist/components/async_upload.d.ts +20 -0
- package/dist/components/async_upload.d.ts.map +1 -0
- package/dist/components/async_upload.js +10 -0
- package/dist/components/async_upload.js.map +1 -0
- package/dist/components/collector.d.ts +203 -0
- package/dist/components/collector.d.ts.map +1 -0
- package/dist/components/collector.js +214 -0
- package/dist/components/collector.js.map +1 -0
- package/dist/components/custom_table_manager.d.ts +503 -0
- package/dist/components/custom_table_manager.d.ts.map +1 -0
- package/dist/components/custom_table_manager.js +1023 -0
- package/dist/components/custom_table_manager.js.map +1 -0
- package/dist/components/global_assets_handler.d.ts +63 -0
- package/dist/components/global_assets_handler.d.ts.map +1 -0
- package/dist/components/global_assets_handler.js +127 -0
- package/dist/components/global_assets_handler.js.map +1 -0
- package/dist/components/handler.d.ts +104 -0
- package/dist/components/handler.d.ts.map +1 -0
- package/dist/components/handler.js +110 -0
- package/dist/components/handler.js.map +1 -0
- package/dist/components/harvester.d.ts +182 -0
- package/dist/components/harvester.d.ts.map +1 -0
- package/dist/components/harvester.js +406 -0
- package/dist/components/harvester.js.map +1 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +9 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/interfaces.d.ts +126 -0
- package/dist/components/interfaces.d.ts.map +1 -0
- package/dist/components/interfaces.js +8 -0
- package/dist/components/interfaces.js.map +1 -0
- package/dist/components/map_manager.d.ts +61 -0
- package/dist/components/map_manager.d.ts.map +1 -0
- package/dist/components/map_manager.js +242 -0
- package/dist/components/map_manager.js.map +1 -0
- package/dist/components/tileset_manager.d.ts +125 -0
- package/dist/components/tileset_manager.d.ts.map +1 -0
- package/dist/components/tileset_manager.js +623 -0
- package/dist/components/tileset_manager.js.map +1 -0
- package/dist/components/types.d.ts +226 -0
- package/dist/components/types.d.ts.map +1 -0
- package/dist/components/types.js +8 -0
- package/dist/components/types.js.map +1 -0
- package/dist/database/adapters/knex_database_adapter.d.ts +97 -0
- package/dist/database/adapters/knex_database_adapter.d.ts.map +1 -0
- package/dist/database/adapters/knex_database_adapter.js +729 -0
- package/dist/database/adapters/knex_database_adapter.js.map +1 -0
- package/dist/database/database_adapter.d.ts +262 -0
- package/dist/database/database_adapter.d.ts.map +1 -0
- package/dist/database/database_adapter.js +46 -0
- package/dist/database/database_adapter.js.map +1 -0
- package/dist/engine/digital_twin_engine.d.ts +295 -0
- package/dist/engine/digital_twin_engine.d.ts.map +1 -0
- package/dist/engine/digital_twin_engine.js +907 -0
- package/dist/engine/digital_twin_engine.js.map +1 -0
- package/dist/engine/endpoints.d.ts +47 -0
- package/dist/engine/endpoints.d.ts.map +1 -0
- package/dist/engine/endpoints.js +88 -0
- package/dist/engine/endpoints.js.map +1 -0
- package/dist/engine/error_handler.d.ts +20 -0
- package/dist/engine/error_handler.d.ts.map +1 -0
- package/dist/engine/error_handler.js +69 -0
- package/dist/engine/error_handler.js.map +1 -0
- package/dist/engine/events.d.ts +93 -0
- package/dist/engine/events.d.ts.map +1 -0
- package/dist/engine/events.js +71 -0
- package/dist/engine/events.js.map +1 -0
- package/dist/engine/health.d.ts +112 -0
- package/dist/engine/health.d.ts.map +1 -0
- package/dist/engine/health.js +190 -0
- package/dist/engine/health.js.map +1 -0
- package/dist/engine/initializer.d.ts +62 -0
- package/dist/engine/initializer.d.ts.map +1 -0
- package/dist/engine/initializer.js +108 -0
- package/dist/engine/initializer.js.map +1 -0
- package/dist/engine/queue_manager.d.ts +87 -0
- package/dist/engine/queue_manager.d.ts.map +1 -0
- package/dist/engine/queue_manager.js +196 -0
- package/dist/engine/queue_manager.js.map +1 -0
- package/dist/engine/scheduler.d.ts +30 -0
- package/dist/engine/scheduler.d.ts.map +1 -0
- package/dist/engine/scheduler.js +378 -0
- package/dist/engine/scheduler.js.map +1 -0
- package/dist/engine/upload_processor.d.ts +36 -0
- package/dist/engine/upload_processor.d.ts.map +1 -0
- package/dist/engine/upload_processor.js +113 -0
- package/dist/engine/upload_processor.js.map +1 -0
- package/dist/env/env.d.ts +134 -0
- package/dist/env/env.d.ts.map +1 -0
- package/dist/env/env.js +177 -0
- package/dist/env/env.js.map +1 -0
- package/dist/errors/index.d.ts +94 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +149 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -0
- package/dist/openapi/generator.d.ts +93 -0
- package/dist/openapi/generator.d.ts.map +1 -0
- package/dist/openapi/generator.js +293 -0
- package/dist/openapi/generator.js.map +1 -0
- package/dist/openapi/index.d.ts +9 -0
- package/dist/openapi/index.d.ts.map +1 -0
- package/dist/openapi/index.js +9 -0
- package/dist/openapi/index.js.map +1 -0
- package/dist/openapi/types.d.ts +182 -0
- package/dist/openapi/types.d.ts.map +1 -0
- package/dist/openapi/types.js +16 -0
- package/dist/openapi/types.js.map +1 -0
- package/dist/storage/adapters/local_storage_service.d.ts +57 -0
- package/dist/storage/adapters/local_storage_service.d.ts.map +1 -0
- package/dist/storage/adapters/local_storage_service.js +132 -0
- package/dist/storage/adapters/local_storage_service.js.map +1 -0
- package/dist/storage/adapters/ovh_storage_service.d.ts +72 -0
- package/dist/storage/adapters/ovh_storage_service.d.ts.map +1 -0
- package/dist/storage/adapters/ovh_storage_service.js +205 -0
- package/dist/storage/adapters/ovh_storage_service.js.map +1 -0
- package/dist/storage/storage_factory.d.ts +14 -0
- package/dist/storage/storage_factory.d.ts.map +1 -0
- package/dist/storage/storage_factory.js +43 -0
- package/dist/storage/storage_factory.js.map +1 -0
- package/dist/storage/storage_service.d.ts +163 -0
- package/dist/storage/storage_service.d.ts.map +1 -0
- package/dist/storage/storage_service.js +58 -0
- package/dist/storage/storage_service.js.map +1 -0
- package/dist/types/data_record.d.ts +123 -0
- package/dist/types/data_record.d.ts.map +1 -0
- package/dist/types/data_record.js +8 -0
- package/dist/types/data_record.js.map +1 -0
- package/dist/utils/graceful_shutdown.d.ts +44 -0
- package/dist/utils/graceful_shutdown.d.ts.map +1 -0
- package/dist/utils/graceful_shutdown.js +79 -0
- package/dist/utils/graceful_shutdown.js.map +1 -0
- package/dist/utils/http_responses.d.ts +175 -0
- package/dist/utils/http_responses.d.ts.map +1 -0
- package/dist/utils/http_responses.js +216 -0
- package/dist/utils/http_responses.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +74 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +92 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/map_to_data_record.d.ts +10 -0
- package/dist/utils/map_to_data_record.d.ts.map +1 -0
- package/dist/utils/map_to_data_record.js +36 -0
- package/dist/utils/map_to_data_record.js.map +1 -0
- package/dist/utils/safe_async.d.ts +50 -0
- package/dist/utils/safe_async.d.ts.map +1 -0
- package/dist/utils/safe_async.js +90 -0
- package/dist/utils/safe_async.js.map +1 -0
- package/dist/utils/servable_endpoint.d.ts +63 -0
- package/dist/utils/servable_endpoint.d.ts.map +1 -0
- package/dist/utils/servable_endpoint.js +67 -0
- package/dist/utils/servable_endpoint.js.map +1 -0
- package/dist/utils/zip_utils.d.ts +66 -0
- package/dist/utils/zip_utils.d.ts.map +1 -0
- package/dist/utils/zip_utils.js +169 -0
- package/dist/utils/zip_utils.js.map +1 -0
- package/dist/validation/index.d.ts +3 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +7 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/schemas.d.ts +273 -0
- package/dist/validation/schemas.d.ts.map +1 -0
- package/dist/validation/schemas.js +82 -0
- package/dist/validation/schemas.js.map +1 -0
- package/dist/validation/validate.d.ts +49 -0
- package/dist/validation/validate.d.ts.map +1 -0
- package/dist/validation/validate.js +110 -0
- package/dist/validation/validate.js.map +1 -0
- package/package.json +23 -13
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import JSZip from 'jszip';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the content of a zip file as a stream (for large files)
|
|
4
|
+
* @param zipBuffer - The content of the zip file as Buffer
|
|
5
|
+
* @returns A generator yielding tuples containing the name and content of each file in the zip file
|
|
6
|
+
*/
|
|
7
|
+
export async function* extractZipContentStream(zipBuffer) {
|
|
8
|
+
const zip = new JSZip();
|
|
9
|
+
const zipContent = await zip.loadAsync(zipBuffer);
|
|
10
|
+
for (const [name, zipObject] of Object.entries(zipContent.files)) {
|
|
11
|
+
if (!zipObject.dir) {
|
|
12
|
+
// Skip directories
|
|
13
|
+
const content = await zipObject.async('nodebuffer');
|
|
14
|
+
// Try to decode as UTF-8, fallback to Buffer for binary files
|
|
15
|
+
try {
|
|
16
|
+
const textContent = content.toString('utf-8');
|
|
17
|
+
// Check if it's valid UTF-8 by trying to encode it back
|
|
18
|
+
Buffer.from(textContent, 'utf-8');
|
|
19
|
+
yield [name, textContent];
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// If UTF-8 decoding fails, return as Buffer
|
|
23
|
+
yield [name, content];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Converts a zip file to a dictionary containing all files and their contents
|
|
30
|
+
* @param zipBuffer - The content of the zip file as Buffer
|
|
31
|
+
* @returns A dictionary containing the content of the zip file
|
|
32
|
+
*/
|
|
33
|
+
export async function zipToDict(zipBuffer) {
|
|
34
|
+
const output = {};
|
|
35
|
+
for await (const [name, content] of extractZipContentStream(zipBuffer)) {
|
|
36
|
+
output[name] = content;
|
|
37
|
+
}
|
|
38
|
+
return output;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Detects the root file for 3D Tiles tilesets
|
|
42
|
+
* Looks for tileset.json or similar entry point files
|
|
43
|
+
* @param files - List of file paths in the archive
|
|
44
|
+
* @returns The path to the root file, or undefined if not found
|
|
45
|
+
*/
|
|
46
|
+
export function detectTilesetRootFile(files) {
|
|
47
|
+
// Priority order for 3D Tiles root files
|
|
48
|
+
const rootFilePatterns = [
|
|
49
|
+
/^tileset\.json$/i,
|
|
50
|
+
/\/tileset\.json$/i,
|
|
51
|
+
/^[^/]+\/tileset\.json$/i, // One level deep
|
|
52
|
+
/tileset\.json$/i // Any tileset.json as fallback
|
|
53
|
+
];
|
|
54
|
+
for (const pattern of rootFilePatterns) {
|
|
55
|
+
const match = files.find(f => pattern.test(f));
|
|
56
|
+
if (match)
|
|
57
|
+
return match;
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Normalizes file paths from ZIP archives
|
|
63
|
+
* Removes leading directory if all files share the same root folder
|
|
64
|
+
* @param files - Original file paths from the archive
|
|
65
|
+
* @returns Normalized file paths (original -> normalized)
|
|
66
|
+
*/
|
|
67
|
+
export function normalizeArchivePaths(files) {
|
|
68
|
+
const pathMap = new Map();
|
|
69
|
+
// Check if all files share a common root directory
|
|
70
|
+
const firstParts = files.map(f => f.split('/')[0]);
|
|
71
|
+
const commonRoot = firstParts.every(p => p === firstParts[0]) && firstParts[0] !== '' ? firstParts[0] : null;
|
|
72
|
+
for (const file of files) {
|
|
73
|
+
if (commonRoot && file.startsWith(commonRoot + '/')) {
|
|
74
|
+
// Remove the common root prefix
|
|
75
|
+
pathMap.set(file, file.substring(commonRoot.length + 1));
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
pathMap.set(file, file);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return pathMap;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Extracts a ZIP archive and stores each file individually using the storage service.
|
|
85
|
+
*
|
|
86
|
+
* This function:
|
|
87
|
+
* 1. Extracts all files from the ZIP
|
|
88
|
+
* 2. Normalizes paths (removes common root directory if present)
|
|
89
|
+
* 3. Stores each file using the storage service with a unique base path
|
|
90
|
+
* 4. Returns the root file path and file count
|
|
91
|
+
*
|
|
92
|
+
* Files are uploaded in parallel batches for performance.
|
|
93
|
+
*
|
|
94
|
+
* @param zipBuffer - The ZIP file content as a Buffer
|
|
95
|
+
* @param storage - The storage service to use for saving files
|
|
96
|
+
* @param basePath - Base path/folder for storing extracted files (e.g., 'tilesets/1234567890')
|
|
97
|
+
* @returns ExtractedArchiveResult with root file and file count
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* const result = await extractAndStoreArchive(zipBuffer, storage, 'tilesets/1234567890')
|
|
102
|
+
* // result.root_file = 'tileset.json'
|
|
103
|
+
* // result.file_count = 42
|
|
104
|
+
*
|
|
105
|
+
* // Files are stored at:
|
|
106
|
+
* // tilesets/1234567890/tileset.json
|
|
107
|
+
* // tilesets/1234567890/tiles/tile_0.b3dm
|
|
108
|
+
* // etc.
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export async function extractAndStoreArchive(zipBuffer, storage, basePath) {
|
|
112
|
+
const zip = new JSZip();
|
|
113
|
+
const zipContent = await zip.loadAsync(zipBuffer);
|
|
114
|
+
// Get all file paths (excluding directories)
|
|
115
|
+
const filePaths = Object.entries(zipContent.files)
|
|
116
|
+
.filter(([_, zipObject]) => !zipObject.dir)
|
|
117
|
+
.map(([name]) => name);
|
|
118
|
+
// Normalize paths (remove common root if present)
|
|
119
|
+
const normalizedPaths = normalizeArchivePaths(filePaths);
|
|
120
|
+
// Detect root file before normalization, then get normalized path
|
|
121
|
+
const rootFileOriginal = detectTilesetRootFile(filePaths);
|
|
122
|
+
const rootFileNormalized = rootFileOriginal ? normalizedPaths.get(rootFileOriginal) : undefined;
|
|
123
|
+
// Extract and store files in parallel (batched to avoid overwhelming storage)
|
|
124
|
+
const PARALLEL_UPLOADS = 10;
|
|
125
|
+
const entries = Array.from(normalizedPaths.entries());
|
|
126
|
+
const totalFiles = entries.length;
|
|
127
|
+
let uploadedCount = 0;
|
|
128
|
+
const uploadedPaths = [];
|
|
129
|
+
console.log(`[ZipUtils] Extracting ${totalFiles} files to ${basePath}`);
|
|
130
|
+
try {
|
|
131
|
+
const totalBatches = Math.ceil(totalFiles / PARALLEL_UPLOADS);
|
|
132
|
+
// Log progress every 10% or at least every 10 batches
|
|
133
|
+
const logInterval = Math.max(1, Math.floor(totalBatches / 10));
|
|
134
|
+
for (let i = 0; i < entries.length; i += PARALLEL_UPLOADS) {
|
|
135
|
+
const batch = entries.slice(i, i + PARALLEL_UPLOADS);
|
|
136
|
+
const batchNum = Math.floor(i / PARALLEL_UPLOADS) + 1;
|
|
137
|
+
await Promise.all(batch.map(async ([originalPath, normalizedPath]) => {
|
|
138
|
+
const zipObject = zipContent.files[originalPath];
|
|
139
|
+
const content = await zipObject.async('nodebuffer');
|
|
140
|
+
// Build storage path: basePath/normalizedPath
|
|
141
|
+
const storagePath = `${basePath}/${normalizedPath}`;
|
|
142
|
+
// Save the file using saveWithPath which preserves the exact path
|
|
143
|
+
await storage.saveWithPath(content, storagePath);
|
|
144
|
+
uploadedPaths.push(storagePath);
|
|
145
|
+
}));
|
|
146
|
+
uploadedCount += batch.length;
|
|
147
|
+
// Log progress periodically (every ~10%) or on last batch
|
|
148
|
+
if (batchNum % logInterval === 0 || batchNum === totalBatches) {
|
|
149
|
+
const percent = Math.round((uploadedCount / totalFiles) * 100);
|
|
150
|
+
console.log(`[ZipUtils] Progress: ${percent}% (${uploadedCount}/${totalFiles} files)`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
// Clean up any files that were already uploaded before the error
|
|
156
|
+
if (uploadedPaths.length > 0) {
|
|
157
|
+
console.log(`[ZipUtils] Error during extraction, cleaning up ${uploadedPaths.length} uploaded files...`);
|
|
158
|
+
await storage.deleteBatch(uploadedPaths).catch(cleanupErr => {
|
|
159
|
+
console.error(`[ZipUtils] Failed to clean up files after error:`, cleanupErr);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
throw error;
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
root_file: rootFileNormalized,
|
|
166
|
+
file_count: uploadedCount
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=zip_utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip_utils.js","sourceRoot":"","sources":["../../src/utils/zip_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAazB;;;;GAIG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,uBAAuB,CAAC,SAAiB;IAC5D,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE,CAAA;IACvB,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;IAEjD,KAAK,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/D,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;YACjB,mBAAmB;YACnB,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;YAEnD,8DAA8D;YAC9D,IAAI,CAAC;gBACD,MAAM,WAAW,GAAG,OAAO,CAAC,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A;AACL,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { paginationSchema, idParamSchema, assetUploadSchema, assetUpdateSchema, assetBatchUploadSchema, customRecordCreateSchema, customRecordUpdateSchema, dateRangeQuerySchema, validatePagination, validateIdParam, validateAssetUpload, validateAssetUpdate, validateAssetBatchUpload, validateCustomRecordCreate, validateCustomRecordUpdate, validateDateRangeQuery } from './schemas.js';
|
|
2
|
+
export { validateData, safeValidate, validateQuery, validateParams, vine } from './validate.js';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EAEpB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACzB,MAAM,cAAc,CAAA;AAGrB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Validation schemas
|
|
2
|
+
export { paginationSchema, idParamSchema, assetUploadSchema, assetUpdateSchema, assetBatchUploadSchema, customRecordCreateSchema, customRecordUpdateSchema, dateRangeQuerySchema,
|
|
3
|
+
// Pre-compiled validators
|
|
4
|
+
validatePagination, validateIdParam, validateAssetUpload, validateAssetUpdate, validateAssetBatchUpload, validateCustomRecordCreate, validateCustomRecordUpdate, validateDateRangeQuery } from './schemas.js';
|
|
5
|
+
// Validation helpers
|
|
6
|
+
export { validateData, safeValidate, validateQuery, validateParams, vine } from './validate.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,OAAO,EACH,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB;AACpB,0BAA0B;AAC1B,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACzB,MAAM,cAAc,CAAA;AAErB,qBAAqB;AACrB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pagination query parameters schema
|
|
3
|
+
*/
|
|
4
|
+
export declare const paginationSchema: import("@vinejs/vine").VineObject<{
|
|
5
|
+
limit: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineNumber>;
|
|
6
|
+
offset: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineNumber>;
|
|
7
|
+
}, {
|
|
8
|
+
limit?: string | number | null | undefined;
|
|
9
|
+
offset?: string | number | null | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
limit?: number | undefined;
|
|
12
|
+
offset?: number | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
limit?: number | undefined;
|
|
15
|
+
offset?: number | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* ID parameter schema
|
|
19
|
+
*/
|
|
20
|
+
export declare const idParamSchema: import("@vinejs/vine").VineObject<{
|
|
21
|
+
id: import("@vinejs/vine").VineNumber;
|
|
22
|
+
}, {
|
|
23
|
+
id: string | number;
|
|
24
|
+
}, {
|
|
25
|
+
id: number;
|
|
26
|
+
}, {
|
|
27
|
+
id: number;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* Asset upload body schema
|
|
31
|
+
*/
|
|
32
|
+
export declare const assetUploadSchema: import("@vinejs/vine").VineObject<{
|
|
33
|
+
description: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
34
|
+
source: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
35
|
+
is_public: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineBoolean>;
|
|
36
|
+
}, {
|
|
37
|
+
description?: string | null | undefined;
|
|
38
|
+
source?: string | null | undefined;
|
|
39
|
+
is_public?: string | number | boolean | null | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
description?: string | undefined;
|
|
42
|
+
source?: string | undefined;
|
|
43
|
+
is_public?: boolean | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
description?: string | undefined;
|
|
46
|
+
source?: string | undefined;
|
|
47
|
+
isPublic?: boolean | undefined;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Asset update body schema
|
|
51
|
+
*/
|
|
52
|
+
export declare const assetUpdateSchema: import("@vinejs/vine").VineObject<{
|
|
53
|
+
description: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
54
|
+
source: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
55
|
+
is_public: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineBoolean>;
|
|
56
|
+
}, {
|
|
57
|
+
description?: string | null | undefined;
|
|
58
|
+
source?: string | null | undefined;
|
|
59
|
+
is_public?: string | number | boolean | null | undefined;
|
|
60
|
+
}, {
|
|
61
|
+
description?: string | undefined;
|
|
62
|
+
source?: string | undefined;
|
|
63
|
+
is_public?: boolean | undefined;
|
|
64
|
+
}, {
|
|
65
|
+
description?: string | undefined;
|
|
66
|
+
source?: string | undefined;
|
|
67
|
+
isPublic?: boolean | undefined;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Batch upload body schema
|
|
71
|
+
*/
|
|
72
|
+
export declare const assetBatchUploadSchema: import("@vinejs/vine").VineObject<{
|
|
73
|
+
assets: import("@vinejs/vine").OptionalModifier<import("@vinejs/vine").VineArray<import("@vinejs/vine").VineObject<{
|
|
74
|
+
description: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
75
|
+
source: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
76
|
+
is_public: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineBoolean>;
|
|
77
|
+
}, {
|
|
78
|
+
description?: string | null | undefined;
|
|
79
|
+
source?: string | null | undefined;
|
|
80
|
+
is_public?: string | number | boolean | null | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
description?: string | undefined;
|
|
83
|
+
source?: string | undefined;
|
|
84
|
+
is_public?: boolean | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
description?: string | undefined;
|
|
87
|
+
source?: string | undefined;
|
|
88
|
+
isPublic?: boolean | undefined;
|
|
89
|
+
}>>>;
|
|
90
|
+
}, {
|
|
91
|
+
assets?: {
|
|
92
|
+
description?: string | null | undefined;
|
|
93
|
+
source?: string | null | undefined;
|
|
94
|
+
is_public?: string | number | boolean | null | undefined;
|
|
95
|
+
}[] | null | undefined;
|
|
96
|
+
}, {
|
|
97
|
+
assets?: {
|
|
98
|
+
description?: string | undefined;
|
|
99
|
+
source?: string | undefined;
|
|
100
|
+
is_public?: boolean | undefined;
|
|
101
|
+
}[] | undefined;
|
|
102
|
+
}, {
|
|
103
|
+
assets?: {
|
|
104
|
+
description?: string | undefined;
|
|
105
|
+
source?: string | undefined;
|
|
106
|
+
isPublic?: boolean | undefined;
|
|
107
|
+
}[] | undefined;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* Custom record create schema (allows passthrough for dynamic fields)
|
|
111
|
+
*/
|
|
112
|
+
export declare const customRecordCreateSchema: import("@vinejs/vine").VineObject<{}, {} & {
|
|
113
|
+
[K: string]: unknown;
|
|
114
|
+
}, {} & {
|
|
115
|
+
[K: string]: unknown;
|
|
116
|
+
}, {} & {
|
|
117
|
+
[K: string]: unknown;
|
|
118
|
+
}>;
|
|
119
|
+
/**
|
|
120
|
+
* Custom record update schema
|
|
121
|
+
*/
|
|
122
|
+
export declare const customRecordUpdateSchema: import("@vinejs/vine").VineObject<{}, {} & {
|
|
123
|
+
[K: string]: unknown;
|
|
124
|
+
}, {} & {
|
|
125
|
+
[K: string]: unknown;
|
|
126
|
+
}, {} & {
|
|
127
|
+
[K: string]: unknown;
|
|
128
|
+
}>;
|
|
129
|
+
/**
|
|
130
|
+
* Date range query schema
|
|
131
|
+
*/
|
|
132
|
+
export declare const dateRangeQuerySchema: import("@vinejs/vine").VineObject<{
|
|
133
|
+
startDate: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
134
|
+
endDate: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
135
|
+
limit: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineNumber>;
|
|
136
|
+
}, {
|
|
137
|
+
startDate?: string | null | undefined;
|
|
138
|
+
endDate?: string | null | undefined;
|
|
139
|
+
limit?: string | number | null | undefined;
|
|
140
|
+
}, {
|
|
141
|
+
startDate?: string | undefined;
|
|
142
|
+
endDate?: string | undefined;
|
|
143
|
+
limit?: number | undefined;
|
|
144
|
+
}, {
|
|
145
|
+
startDate?: string | undefined;
|
|
146
|
+
endDate?: string | undefined;
|
|
147
|
+
limit?: number | undefined;
|
|
148
|
+
}>;
|
|
149
|
+
export declare const validatePagination: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
150
|
+
limit: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineNumber>;
|
|
151
|
+
offset: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineNumber>;
|
|
152
|
+
}, {
|
|
153
|
+
limit?: string | number | null | undefined;
|
|
154
|
+
offset?: string | number | null | undefined;
|
|
155
|
+
}, {
|
|
156
|
+
limit?: number | undefined;
|
|
157
|
+
offset?: number | undefined;
|
|
158
|
+
}, {
|
|
159
|
+
limit?: number | undefined;
|
|
160
|
+
offset?: number | undefined;
|
|
161
|
+
}>, Record<string, any> | undefined>;
|
|
162
|
+
export declare const validateIdParam: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
163
|
+
id: import("@vinejs/vine").VineNumber;
|
|
164
|
+
}, {
|
|
165
|
+
id: string | number;
|
|
166
|
+
}, {
|
|
167
|
+
id: number;
|
|
168
|
+
}, {
|
|
169
|
+
id: number;
|
|
170
|
+
}>, Record<string, any> | undefined>;
|
|
171
|
+
export declare const validateAssetUpload: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
172
|
+
description: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
173
|
+
source: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
174
|
+
is_public: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineBoolean>;
|
|
175
|
+
}, {
|
|
176
|
+
description?: string | null | undefined;
|
|
177
|
+
source?: string | null | undefined;
|
|
178
|
+
is_public?: string | number | boolean | null | undefined;
|
|
179
|
+
}, {
|
|
180
|
+
description?: string | undefined;
|
|
181
|
+
source?: string | undefined;
|
|
182
|
+
is_public?: boolean | undefined;
|
|
183
|
+
}, {
|
|
184
|
+
description?: string | undefined;
|
|
185
|
+
source?: string | undefined;
|
|
186
|
+
isPublic?: boolean | undefined;
|
|
187
|
+
}>, Record<string, any> | undefined>;
|
|
188
|
+
export declare const validateAssetUpdate: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
189
|
+
description: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
190
|
+
source: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
191
|
+
is_public: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineBoolean>;
|
|
192
|
+
}, {
|
|
193
|
+
description?: string | null | undefined;
|
|
194
|
+
source?: string | null | undefined;
|
|
195
|
+
is_public?: string | number | boolean | null | undefined;
|
|
196
|
+
}, {
|
|
197
|
+
description?: string | undefined;
|
|
198
|
+
source?: string | undefined;
|
|
199
|
+
is_public?: boolean | undefined;
|
|
200
|
+
}, {
|
|
201
|
+
description?: string | undefined;
|
|
202
|
+
source?: string | undefined;
|
|
203
|
+
isPublic?: boolean | undefined;
|
|
204
|
+
}>, Record<string, any> | undefined>;
|
|
205
|
+
export declare const validateAssetBatchUpload: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
206
|
+
assets: import("@vinejs/vine").OptionalModifier<import("@vinejs/vine").VineArray<import("@vinejs/vine").VineObject<{
|
|
207
|
+
description: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
208
|
+
source: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
209
|
+
is_public: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineBoolean>;
|
|
210
|
+
}, {
|
|
211
|
+
description?: string | null | undefined;
|
|
212
|
+
source?: string | null | undefined;
|
|
213
|
+
is_public?: string | number | boolean | null | undefined;
|
|
214
|
+
}, {
|
|
215
|
+
description?: string | undefined;
|
|
216
|
+
source?: string | undefined;
|
|
217
|
+
is_public?: boolean | undefined;
|
|
218
|
+
}, {
|
|
219
|
+
description?: string | undefined;
|
|
220
|
+
source?: string | undefined;
|
|
221
|
+
isPublic?: boolean | undefined;
|
|
222
|
+
}>>>;
|
|
223
|
+
}, {
|
|
224
|
+
assets?: {
|
|
225
|
+
description?: string | null | undefined;
|
|
226
|
+
source?: string | null | undefined;
|
|
227
|
+
is_public?: string | number | boolean | null | undefined;
|
|
228
|
+
}[] | null | undefined;
|
|
229
|
+
}, {
|
|
230
|
+
assets?: {
|
|
231
|
+
description?: string | undefined;
|
|
232
|
+
source?: string | undefined;
|
|
233
|
+
is_public?: boolean | undefined;
|
|
234
|
+
}[] | undefined;
|
|
235
|
+
}, {
|
|
236
|
+
assets?: {
|
|
237
|
+
description?: string | undefined;
|
|
238
|
+
source?: string | undefined;
|
|
239
|
+
isPublic?: boolean | undefined;
|
|
240
|
+
}[] | undefined;
|
|
241
|
+
}>, Record<string, any> | undefined>;
|
|
242
|
+
export declare const validateCustomRecordCreate: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{}, {} & {
|
|
243
|
+
[K: string]: unknown;
|
|
244
|
+
}, {} & {
|
|
245
|
+
[K: string]: unknown;
|
|
246
|
+
}, {} & {
|
|
247
|
+
[K: string]: unknown;
|
|
248
|
+
}>, Record<string, any> | undefined>;
|
|
249
|
+
export declare const validateCustomRecordUpdate: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{}, {} & {
|
|
250
|
+
[K: string]: unknown;
|
|
251
|
+
}, {} & {
|
|
252
|
+
[K: string]: unknown;
|
|
253
|
+
}, {} & {
|
|
254
|
+
[K: string]: unknown;
|
|
255
|
+
}>, Record<string, any> | undefined>;
|
|
256
|
+
export declare const validateDateRangeQuery: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
257
|
+
startDate: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
258
|
+
endDate: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
259
|
+
limit: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineNumber>;
|
|
260
|
+
}, {
|
|
261
|
+
startDate?: string | null | undefined;
|
|
262
|
+
endDate?: string | null | undefined;
|
|
263
|
+
limit?: string | number | null | undefined;
|
|
264
|
+
}, {
|
|
265
|
+
startDate?: string | undefined;
|
|
266
|
+
endDate?: string | undefined;
|
|
267
|
+
limit?: number | undefined;
|
|
268
|
+
}, {
|
|
269
|
+
startDate?: string | undefined;
|
|
270
|
+
endDate?: string | undefined;
|
|
271
|
+
limit?: number | undefined;
|
|
272
|
+
}>, Record<string, any> | undefined>;
|
|
273
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/validation/schemas.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAG3B,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;EAExB,CAAA;AAMF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;EAI5B,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;EAI5B,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUjC,CAAA;AAMF;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;EAA2C,CAAA;AAEhF;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;EAA2C,CAAA;AAMhF;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;EAI/B,CAAA;AAMF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;oCAAiC,CAAA;AAChE,eAAO,MAAM,eAAe;;;;;;;;oCAA8B,CAAA;AAC1D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;oCAAkC,CAAA;AAClE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;oCAAkC,CAAA;AAClE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAAuC,CAAA;AAC5E,eAAO,MAAM,0BAA0B;;;;;;oCAAyC,CAAA;AAChF,eAAO,MAAM,0BAA0B;;;;;;oCAAyC,CAAA;AAChF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;oCAAqC,CAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import vine from '@vinejs/vine';
|
|
2
|
+
// ============================================
|
|
3
|
+
// Common schemas
|
|
4
|
+
// ============================================
|
|
5
|
+
/**
|
|
6
|
+
* Pagination query parameters schema
|
|
7
|
+
*/
|
|
8
|
+
export const paginationSchema = vine.object({
|
|
9
|
+
limit: vine.number().positive().max(1000).optional(),
|
|
10
|
+
offset: vine.number().min(0).optional()
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* ID parameter schema
|
|
14
|
+
*/
|
|
15
|
+
export const idParamSchema = vine.object({
|
|
16
|
+
id: vine.number().positive()
|
|
17
|
+
});
|
|
18
|
+
// ============================================
|
|
19
|
+
// Assets Manager schemas
|
|
20
|
+
// ============================================
|
|
21
|
+
/**
|
|
22
|
+
* Asset upload body schema
|
|
23
|
+
*/
|
|
24
|
+
export const assetUploadSchema = vine.object({
|
|
25
|
+
description: vine.string().maxLength(1000).optional(),
|
|
26
|
+
source: vine.string().url().optional(),
|
|
27
|
+
is_public: vine.boolean().optional()
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Asset update body schema
|
|
31
|
+
*/
|
|
32
|
+
export const assetUpdateSchema = vine.object({
|
|
33
|
+
description: vine.string().maxLength(1000).optional(),
|
|
34
|
+
source: vine.string().url().optional(),
|
|
35
|
+
is_public: vine.boolean().optional()
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Batch upload body schema
|
|
39
|
+
*/
|
|
40
|
+
export const assetBatchUploadSchema = vine.object({
|
|
41
|
+
assets: vine
|
|
42
|
+
.array(vine.object({
|
|
43
|
+
description: vine.string().maxLength(1000).optional(),
|
|
44
|
+
source: vine.string().url().optional(),
|
|
45
|
+
is_public: vine.boolean().optional()
|
|
46
|
+
}))
|
|
47
|
+
.optional()
|
|
48
|
+
});
|
|
49
|
+
// ============================================
|
|
50
|
+
// Custom Table Manager schemas
|
|
51
|
+
// ============================================
|
|
52
|
+
/**
|
|
53
|
+
* Custom record create schema (allows passthrough for dynamic fields)
|
|
54
|
+
*/
|
|
55
|
+
export const customRecordCreateSchema = vine.object({}).allowUnknownProperties();
|
|
56
|
+
/**
|
|
57
|
+
* Custom record update schema
|
|
58
|
+
*/
|
|
59
|
+
export const customRecordUpdateSchema = vine.object({}).allowUnknownProperties();
|
|
60
|
+
// ============================================
|
|
61
|
+
// Query parameter schemas
|
|
62
|
+
// ============================================
|
|
63
|
+
/**
|
|
64
|
+
* Date range query schema
|
|
65
|
+
*/
|
|
66
|
+
export const dateRangeQuerySchema = vine.object({
|
|
67
|
+
startDate: vine.string().optional(),
|
|
68
|
+
endDate: vine.string().optional(),
|
|
69
|
+
limit: vine.number().positive().max(1000).optional()
|
|
70
|
+
});
|
|
71
|
+
// ============================================
|
|
72
|
+
// Compiled validators (for performance)
|
|
73
|
+
// ============================================
|
|
74
|
+
export const validatePagination = vine.compile(paginationSchema);
|
|
75
|
+
export const validateIdParam = vine.compile(idParamSchema);
|
|
76
|
+
export const validateAssetUpload = vine.compile(assetUploadSchema);
|
|
77
|
+
export const validateAssetUpdate = vine.compile(assetUpdateSchema);
|
|
78
|
+
export const validateAssetBatchUpload = vine.compile(assetBatchUploadSchema);
|
|
79
|
+
export const validateCustomRecordCreate = vine.compile(customRecordCreateSchema);
|
|
80
|
+
export const validateCustomRecordUpdate = vine.compile(customRecordUpdateSchema);
|
|
81
|
+
export const validateDateRangeQuery = vine.compile(dateRangeQuerySchema);
|
|
82
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/validation/schemas.ts"],"names":[],"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,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;AAC1D,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAClE,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAClE,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAA;AAC5E,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAA;AAChF,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAA;AAChF,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import vine from '@vinejs/vine';
|
|
2
|
+
type AnyValidator = {
|
|
3
|
+
validate: (data: unknown) => Promise<unknown>;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Validates data using a pre-compiled VineJS validator.
|
|
7
|
+
* @param validator - Compiled VineJS validator
|
|
8
|
+
* @param data - Data to validate
|
|
9
|
+
* @param context - Optional context for error messages
|
|
10
|
+
* @returns Validated and typed data
|
|
11
|
+
* @throws ValidationError if validation fails
|
|
12
|
+
*/
|
|
13
|
+
export declare function validateData<T>(validator: AnyValidator, data: unknown, context?: string): Promise<T>;
|
|
14
|
+
/**
|
|
15
|
+
* Validates data and returns result without throwing.
|
|
16
|
+
* Useful for optional validation or when you want to handle errors manually.
|
|
17
|
+
* @param validator - Compiled VineJS validator
|
|
18
|
+
* @param data - Data to validate
|
|
19
|
+
* @returns Object with success status, data (if valid), or errors (if invalid)
|
|
20
|
+
*/
|
|
21
|
+
export declare function safeValidate<T>(validator: AnyValidator, data: unknown): Promise<{
|
|
22
|
+
success: true;
|
|
23
|
+
data: T;
|
|
24
|
+
} | {
|
|
25
|
+
success: false;
|
|
26
|
+
errors: Array<{
|
|
27
|
+
field: string;
|
|
28
|
+
message: string;
|
|
29
|
+
}>;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Validates query parameters, coercing string values to appropriate types.
|
|
33
|
+
* Query params from Express are always strings, so we need to convert them.
|
|
34
|
+
* @param validator - Compiled VineJS validator
|
|
35
|
+
* @param query - Query object from Express request
|
|
36
|
+
* @param context - Optional context for error messages
|
|
37
|
+
* @returns Validated and typed query parameters
|
|
38
|
+
*/
|
|
39
|
+
export declare function validateQuery<T>(validator: AnyValidator, query: Record<string, unknown>, context?: string): Promise<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Validates path parameters (e.g., :id in routes).
|
|
42
|
+
* @param validator - Compiled VineJS validator
|
|
43
|
+
* @param params - Params object from Express request
|
|
44
|
+
* @param context - Optional context for error messages
|
|
45
|
+
* @returns Validated and typed parameters
|
|
46
|
+
*/
|
|
47
|
+
export declare function validateParams<T>(validator: AnyValidator, params: Record<string, string>, context?: string): Promise<T>;
|
|
48
|
+
export { vine };
|
|
49
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/validation/validate.ts"],"names":[],"mappings":"AAAA,OAAO,IAAgB,MAAM,cAAc,CAAA;AAG3C,KAAK,YAAY,GAAG;IAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,CAAA;AAErE;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAgB1G;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAChC,SAAS,E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