chore: prepare v1.0.0 release
This commit is contained in:
+3
-42
@@ -1,7 +1,4 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Client-side API helpers for upload operations
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
import { isRecord } from './guards'
|
||||
import type { FolderEntry } from './client-types'
|
||||
import type { FileDiff } from './types'
|
||||
|
||||
@@ -10,16 +7,12 @@ export interface CheckResult {
|
||||
diffs: FileDiff[]
|
||||
}
|
||||
|
||||
export interface StageResult {
|
||||
interface StageResult {
|
||||
stagingId: string
|
||||
folderName: string
|
||||
filesCount: number
|
||||
}
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === 'object' && value !== null
|
||||
}
|
||||
|
||||
function getApiError(data: unknown, fallback: string) {
|
||||
return isRecord(data) && typeof data.error === 'string' ? data.error : fallback
|
||||
}
|
||||
@@ -30,23 +23,10 @@ function isFileDiff(value: unknown): value is FileDiff {
|
||||
&& (value.status === 'new' || value.status === 'changed' || value.status === 'deleted')
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Shared FormData builder
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function buildUploadFormData(
|
||||
folder: FolderEntry,
|
||||
extra?: Record<string, string>,
|
||||
): FormData {
|
||||
function buildUploadFormData(folder: FolderEntry): FormData {
|
||||
const formData = new FormData()
|
||||
formData.append('folderName', folder.folderName)
|
||||
|
||||
if (extra) {
|
||||
for (const [key, value] of Object.entries(extra)) {
|
||||
formData.append(key, value)
|
||||
}
|
||||
}
|
||||
|
||||
formData.append('files', folder.modelFile)
|
||||
formData.append('fileTypes', 'model')
|
||||
formData.append('textureNames', '')
|
||||
@@ -60,14 +40,6 @@ function buildUploadFormData(
|
||||
return formData
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Check folder diffs against remote (GitHub)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Check whether a folder already exists on the remote repo and compute diffs.
|
||||
* Throws on auth/network errors so callers can surface them to the user.
|
||||
*/
|
||||
export async function checkFolderDiffs(
|
||||
stagingId: string,
|
||||
secret: string,
|
||||
@@ -85,7 +57,6 @@ export async function checkFolderDiffs(
|
||||
|
||||
const data: unknown = await res.json()
|
||||
|
||||
// Surface auth/server errors to the caller
|
||||
if (!res.ok) {
|
||||
throw new Error(getApiError(data, `Erreur serveur (${res.status})`))
|
||||
}
|
||||
@@ -129,11 +100,6 @@ export async function stageUpload(
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Upload original files to Nextcloud Drive
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/** Upload original files to Nextcloud Drive. */
|
||||
export async function uploadDrive(
|
||||
stagingId: string,
|
||||
secret: string,
|
||||
@@ -163,11 +129,6 @@ export async function uploadDrive(
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Upload files to GitHub
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/** Upload files to GitHub. */
|
||||
export async function uploadGit(
|
||||
stagingId: string,
|
||||
secret: string,
|
||||
|
||||
Reference in New Issue
Block a user