oportunidades 7
tests / ci (push) Waiting to run

This commit is contained in:
2026-10-13 11:40:29 +02:00
parent 20971d523f
commit 287e991486
2902 changed files with 1085456 additions and 25957 deletions
+13
View File
@@ -0,0 +1,13 @@
/** UUID v4 for operation identifiers; retries keep the caller's existing key. */
export function createOperationKey(): string {
const secureRandom = globalThis.crypto;
if (typeof secureRandom?.randomUUID === 'function') return secureRandom.randomUUID();
if (typeof secureRandom?.getRandomValues !== 'function') {
throw new Error('O navegador não disponibiliza geração criptográfica segura. Reabra o portal no endereço HTTPS configurado.');
}
const bytes = secureRandom.getRandomValues(new Uint8Array(16));
bytes[6] = (bytes[6] & 0x0f) | 0x40;
bytes[8] = (bytes[8] & 0x3f) | 0x80;
const hex = Array.from(bytes, byte => byte.toString(16).padStart(2, '0')).join('');
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
}
+1 -1
View File
@@ -21,7 +21,7 @@ export async function profileJson(
'Content-Type': 'application/json',
'X-XSRF-TOKEN': cookie ? decodeURIComponent(cookie.slice(11)) : '',
},
body: method === 'GET' ? undefined : JSON.stringify(data),
...(method === 'GET' ? {} : { body: JSON.stringify(data) }),
});
const result = await response.json();
if (!response.ok)
+8
View File
@@ -0,0 +1,8 @@
/** Display a saved JSON value without silently rendering objects as "[object Object]". */
export function valueText(value: unknown): string {
if (value === null || value === undefined) return '';
if (typeof value === 'string') return value;
if (typeof value === 'number' || typeof value === 'boolean')
return String(value);
return JSON.stringify(value) ?? '';
}