SYNC: Merge branch 'feature/firestore'

This commit is contained in:
SPRINX0\prochazka
2025-07-25 07:52:30 +02:00
committed by Diflow
parent b12587626d
commit ca145967dc
7 changed files with 91 additions and 40 deletions

View File

@@ -1,26 +1,3 @@
/**
* @template [T = any]
* @typedef {Object} FileParseResultSuccess
* @property {true} success
* @property {T} data
*/
/**
* @typedef {Object} FileParseResultError
* @property {false} success
* @property {string} error
*/
/**
* @template [T = any]
* @typedef {FileParseResultSuccess<T> | FileParseResultError} FileParseResult
*/
/**
* @template [T = any]
* @param {File} file
* @returns {Promise<FileParseResult<T>>}
*/
export async function parseFileAsJson(file) {
try {
const text = await file.text();

View File

@@ -0,0 +1,15 @@
export async function parseFileAsString(file) {
try {
const text = await file.text();
const data = text;
return {
success: true,
data,
};
} catch (error) {
return {
success: false,
error: error instanceof Error ? error.message : 'Unknown parsing error',
};
}
}