( uploadId: string, tenantId: string | undefined, )
| 197 | } |
| 198 | |
| 199 | function requireResumableUpload( |
| 200 | uploadId: string, |
| 201 | tenantId: string | undefined, |
| 202 | ): ResumableUploadEntry { |
| 203 | const entry = RESUMABLE_UPLOADS_BY_ID.get(uploadId); |
| 204 | if (!entry) { |
| 205 | throw new AppError('INVALID_ARGS', `Upload not found: ${uploadId}`); |
| 206 | } |
| 207 | if (entry.tenantId && entry.tenantId !== tenantId) { |
| 208 | throw new AppError('UNAUTHORIZED', 'Upload belongs to a different tenant'); |
| 209 | } |
| 210 | return entry; |
| 211 | } |
| 212 | |
| 213 | function currentResumableUploadOffset(entry: ResumableUploadEntry): number { |
| 214 | if (!fs.existsSync(entry.payloadPath)) return 0; |
no test coverage detected
searching dependent graphs…