@fayz-ai/core 0.67.0 → 0.67.2
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/dist/{chunk-2Z7MPNXC.js → chunk-EG6IXJNY.js} +3 -3
- package/dist/{chunk-2Z7MPNXC.js.map → chunk-EG6IXJNY.js.map} +1 -1
- package/dist/{chunk-6LAI6MGE.js → chunk-JGRPFH56.js} +4 -4
- package/dist/{chunk-6LAI6MGE.js.map → chunk-JGRPFH56.js.map} +1 -1
- package/dist/{chunk-UKWE5OML.js → chunk-K2P64WBC.js} +3 -3
- package/dist/{chunk-UKWE5OML.js.map → chunk-K2P64WBC.js.map} +1 -1
- package/dist/{chunk-5RMRPOXN.js → chunk-MU2SFXGA.js} +4 -4
- package/dist/{chunk-5RMRPOXN.js.map → chunk-MU2SFXGA.js.map} +1 -1
- package/dist/{chunk-2G5NSY4P.js → chunk-RO7HJJUV.js} +4 -4
- package/dist/{chunk-2G5NSY4P.js.map → chunk-RO7HJJUV.js.map} +1 -1
- package/dist/{chunk-JTWPDLT2.js → chunk-TA3Y6ZLC.js} +4 -4
- package/dist/{chunk-JTWPDLT2.js.map → chunk-TA3Y6ZLC.js.map} +1 -1
- package/dist/{chunk-R7RFVRPT.js → chunk-YHSRDP6M.js} +3 -3
- package/dist/{chunk-R7RFVRPT.js.map → chunk-YHSRDP6M.js.map} +1 -1
- package/dist/data/index.js +4 -4
- package/dist/i18n/index.js +1 -1
- package/dist/index.js +12 -12
- package/dist/integrations/index.js +4 -4
- package/dist/plugin/index.js +3 -3
- package/dist/testing/index.js +5 -5
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tl } from './chunk-
|
|
1
|
+
import { tl } from './chunk-JGRPFH56.js';
|
|
2
2
|
|
|
3
3
|
// src/data/errors.ts
|
|
4
4
|
var RETRYABLE_KINDS = ["offline", "server"];
|
|
@@ -142,5 +142,5 @@ function describeError(err, fallback) {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
export { DataError, describeError, errorMessage, offlineMessage, toDataError };
|
|
145
|
-
//# sourceMappingURL=chunk-
|
|
146
|
-
//# sourceMappingURL=chunk-
|
|
145
|
+
//# sourceMappingURL=chunk-EG6IXJNY.js.map
|
|
146
|
+
//# sourceMappingURL=chunk-EG6IXJNY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/data/errors.ts","../src/lib/error-message.ts"],"names":[],"mappings":";;;AA8BA,IAAM,eAAA,GAA4C,CAAC,SAAA,EAAW,QAAQ,CAAA;AAc/D,IAAM,SAAA,GAAN,cAAwB,KAAA,CAAM;AAAA,EASnC,WAAA,CAAY,IAAA,EAAqB,OAAA,EAAiB,OAAA,GAA4B,EAAC,EAAG;AAChF,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,WAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,SAAA,GAAY,eAAA,CAAgB,QAAA,CAAS,IAAI,CAAA;AAC9C,IAAA,IAAA,CAAK,QAAQ,OAAA,CAAQ,KAAA;AACrB,IAAA,IAAA,CAAK,SAAS,OAAA,CAAQ,MAAA;AACtB,IAAA,IAAA,CAAK,OAAO,OAAA,CAAQ,IAAA;AACpB,IAAA,IAAA,CAAK,UAAU,OAAA,CAAQ,OAAA;AACvB,IAAA,IAAA,CAAK,OAAO,OAAA,CAAQ,IAAA;AAAA,EACtB;AACF;AAOA,IAAM,UAAA,GAA4C;AAAA;AAAA,EAEhD,QAAA,EAAU,SAAA;AAAA;AAAA,EACV,QAAA,EAAU,gBAAA;AAAA;AAAA,EACV,QAAA,EAAU,WAAA;AAAA;AAAA,EACV,QAAA,EAAU,gBAAA;AAAA;AAAA,EACV,QAAA,EAAU,gBAAA;AAAA;AAAA,EACV,QAAA,EAAU,gBAAA;AAAA;AAAA,EACV,QAAA,EAAU,cAAA;AAAA;AA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AE,IAAA,CAAK,UAAK,CAAA;AAI3D,IAAA,IAAI,OAAO,CAAA,CAAE,IAAA,KAAS,QAAA,IAAY,CAAA,CAAE,IAAA,EAAM,OAAO,CAAA,EAAG,QAAQ,CAAA,EAAA,EAAK,CAAA,CAAE,IAAI,CAAA,CAAA,CAAA;AAAA,EACzE;AACA,EAAA,MAAM,IAAA,GAAO,MAAA,CAAO,GAAA,IAAO,EAAE,EAAE,IAAA,EAAK;AAEpC,EAAA,OAAO,IAAA,IAAQ,IAAA,KAAS,iBAAA,GAAoB,IAAA,GAAO,QAAA;AACrD;AAEO,SAAS,cAAA,GAAyB;AACvC,EAAA,OAAO,EAAA,CAAG,2BAA2B,gCAA6B,CAAA;AACpE;AAOO,SAAS,aAAA,CAAc,KAAc,QAAA,EAA2B;AACrE,EAAA,OAAO,aAAa,GAAA,EAAK,QAAA,IAAY,EAAA,CAAG,kCAAA,EAAoC,iCAAiC,CAAC,CAAA;AAChH","file":"chunk-2Z7MPNXC.js","sourcesContent":["// ---------------------------------------------------------------------------\n// Data error taxonomy — one normalized shape for everything the data door can\n// fail with, so callers branch on a `kind` instead of grepping a message.\n//\n// The split that matters most is 'forbidden' vs 'missing-object': a PostgREST\n// \"permission denied for table x\" (42501) once surfaced to a user as \"analytics\n// engine missing\", sending everyone to look for a migration that was already\n// applied. They are different failures with different fixes — a grant versus a\n// deploy — and the taxonomy has to keep them apart.\n// ---------------------------------------------------------------------------\n\nexport type DataErrorKind =\n /** No usable network: fetch failed, request aborted, timed out. */\n | 'offline'\n /** No identity: missing/expired JWT. Re-authenticate. */\n | 'unauthorized'\n /** Identity known, access refused: RLS or a missing GRANT. */\n | 'forbidden'\n /** The object exists, the row does not. */\n | 'not-found'\n /** The table/view/function itself is not there — a deploy gap, not a data gap. */\n | 'missing-object'\n /** The write lost a race or duplicates a unique key. */\n | 'conflict'\n /** The request itself is wrong: bad syntax, constraint violated, no tenant. */\n | 'invalid'\n /** Anything the backend blames on itself. */\n | 'server'\n\n/** Only these are worth trying again with the same input. */\nconst RETRYABLE_KINDS: readonly DataErrorKind[] = ['offline', 'server']\n\nexport interface DataErrorOptions {\n /** The original throw, preserved for reporters that want the real object. */\n cause?: unknown\n /** HTTP status when the failure came over the wire. */\n status?: number\n /** PostgREST (`PGRST116`) or Postgres (`42501`) code. */\n code?: string\n details?: string\n /** Postgres often puts the actionable fix here — surface it, do not drop it. */\n hint?: string\n}\n\nexport class DataError extends Error {\n readonly kind: DataErrorKind\n readonly retryable: boolean\n readonly cause?: unknown\n readonly status?: number\n readonly code?: string\n readonly details?: string\n readonly hint?: string\n\n constructor(kind: DataErrorKind, message: string, options: DataErrorOptions = {}) {\n super(message)\n this.name = 'DataError'\n this.kind = kind\n this.retryable = RETRYABLE_KINDS.includes(kind)\n this.cause = options.cause\n this.status = options.status\n this.code = options.code\n this.details = options.details\n this.hint = options.hint\n }\n}\n\n// ---------------------------------------------------------------------------\n// Classification\n// ---------------------------------------------------------------------------\n\n/** Postgres + PostgREST codes are stable; branch on them before any text. */\nconst CODE_KINDS: Record<string, DataErrorKind> = {\n // PostgREST\n PGRST100: 'invalid', // parse error in the query string\n PGRST106: 'missing-object', // schema not exposed\n PGRST116: 'not-found', // zero rows where exactly one was requested\n PGRST202: 'missing-object', // function not found in schema cache\n PGRST204: 'missing-object', // column not found in schema cache\n PGRST205: 'missing-object', // table not found in schema cache\n PGRST301: 'unauthorized', // JWT invalid or expired\n PGRST302: 'unauthorized', // anonymous access disabled\n // Postgres\n '22007': 'invalid', // invalid datetime format\n '22P02': 'invalid', // invalid input syntax\n '23502': 'invalid', // not-null violation\n '23505': 'conflict', // unique violation\n '23514': 'invalid', // check violation\n '42501': 'forbidden', // insufficient privilege / permission denied\n '42883': 'missing-object', // undefined function\n '42P01': 'missing-object', // undefined table\n '53300': 'server', // too many connections\n '57014': 'server', // statement timeout, server side\n}\n\n/** Transport-level codes — the request never reached PostgREST. */\nconst OFFLINE_CODES = new Set(['ECONNREFUSED', 'ECONNRESET', 'ENOTFOUND', 'ETIMEDOUT', 'EAI_AGAIN'])\n\nconst OFFLINE_TEXT = /failed to fetch|fetch failed|network ?error|networkrequestfailed|load failed|connection (refused|reset|closed)|err_internet_disconnected|aborted|signal is aborted|the operation was aborted|timed out|timeout|sem conexão com a internet|no internet connection/i\n\nfunction statusKind(status: number): DataErrorKind {\n if (status === 401) return 'unauthorized'\n if (status === 403) return 'forbidden'\n if (status === 404 || status === 406) return 'not-found'\n if (status === 408) return 'offline'\n if (status === 409) return 'conflict'\n if (status === 400 || status === 422) return 'invalid'\n if (status >= 500) return 'server'\n return 'server'\n}\n\nfunction textKind(message: string): DataErrorKind | undefined {\n const m = message.toLowerCase()\n if (/permission denied|row-level security|row level security|insufficient privilege/.test(m)) return 'forbidden'\n if (/does not exist|undefined table|undefined function|schema cache|could not find the (table|function)/.test(m)) return 'missing-object'\n if (/jwt|not authenticated|invalid token|unauthorized|no api key/.test(m)) return 'unauthorized'\n if (/duplicate key|already exists|conflict/.test(m)) return 'conflict'\n if (/invalid input (syntax|value)|violates (not-null|check) constraint|invalid request/.test(m)) return 'invalid'\n if (/no rows|not found/.test(m)) return 'not-found'\n return undefined\n}\n\nfunction pick(source: Record<string, unknown>, key: string): unknown {\n const value = source[key]\n return value === null ? undefined : value\n}\n\nfunction readStatus(source: Record<string, unknown>): number | undefined {\n for (const key of ['status', 'statusCode', 'httpStatus']) {\n const value = pick(source, key)\n if (typeof value === 'number') return value\n if (typeof value === 'string' && /^\\d{3}$/.test(value)) return Number(value)\n }\n const response = pick(source, 'response')\n if (response && typeof response === 'object') {\n const status = (response as Record<string, unknown>).status\n if (typeof status === 'number') return status\n }\n return undefined\n}\n\nfunction isOffline(name: string, message: string, code: string | undefined, status: number | undefined): boolean {\n if (name === 'AbortError' || name === 'TimeoutError') return true\n if (code && OFFLINE_CODES.has(code)) return true\n if (status !== undefined) return false\n // navigator.onLine is a hint, not a verdict — it only decides errors we could\n // not classify from a code or a status.\n const nav = (globalThis as { navigator?: { onLine?: boolean } }).navigator\n if (nav && nav.onLine === false) return true\n return OFFLINE_TEXT.test(message)\n}\n\n/**\n * Normalizes anything thrown by the data layer into a {@link DataError}.\n * Idempotent — a DataError passes through untouched.\n */\nexport function toDataError(err: unknown): DataError {\n if (err instanceof DataError) return err\n\n const source: Record<string, unknown> =\n err && typeof err === 'object' ? (err as Record<string, unknown>) : {}\n const name = typeof source.name === 'string' ? source.name : ''\n const rawMessage = typeof source.message === 'string' ? source.message : ''\n const message = rawMessage || (typeof err === 'string' ? err : '') || 'data request failed'\n const codeValue = pick(source, 'code')\n const code = typeof codeValue === 'string' ? codeValue : typeof codeValue === 'number' ? String(codeValue) : undefined\n const status = readStatus(source)\n const details = typeof source.details === 'string' ? source.details : undefined\n const hint = typeof source.hint === 'string' ? source.hint : undefined\n\n let kind: DataErrorKind | undefined = code ? CODE_KINDS[code] : undefined\n if (!kind && isOffline(name, message, code, status)) kind = 'offline'\n if (!kind && status !== undefined) kind = statusKind(status)\n if (!kind) kind = textKind(message)\n\n return new DataError(kind ?? 'server', message, { cause: err, status, code, details, hint })\n}\n","import { toDataError } from '../data/errors'\nimport { tl } from '../i18n'\n\n/**\n * A readable message out of anything a data layer throws.\n *\n * Supabase/PostgREST reject with a PLAIN OBJECT ({message, details, hint,\n * code}), not an Error — so the usual `err instanceof Error ? err.message :\n * String(err)` renders the literal text \"[object Object]\" and hides the one\n * piece of information the user needed. The workspace wizard showed exactly\n * that for a 400 whose body named the failing constraint.\n *\n * Lives in core because every layer above it catches from Supabase: ui, admin,\n * storefront and the plugins all had their own copy of the broken ternary.\n * The careful branches below are plugin-shop's, which had already met this on\n * its settings screens and worked out what each case has to answer.\n *\n * `fallback` is a parameter because the last resort is the one string a user\n * actually reads, and it belongs in their language: SDK prose is English, but\n * merchant-facing copy is the carve-out (see fayz-ssr/AGENTS.md). plugin-shop\n * passes 'erro desconhecido'.\n */\nexport function errorMessage(err: unknown, fallback = 'Unknown error'): string {\n // \"TypeError: Failed to fetch\" is the browser's wording, not the user's: say what happened.\n if (err != null && toDataError(err).kind === 'offline') return offlineMessage()\n // An Error is answered by an Error, message or not. Falling through to the\n // object branch would reach `String(err)` and render the useless word\n // \"Error\" — a refusal with no reason is worse than a generic one, because\n // there is nothing to search for and nothing to report.\n if (err instanceof Error) return err.message.trim() || fallback\n if (typeof err === 'string') return err\n if (err && typeof err === 'object') {\n const e = err as { message?: unknown; details?: unknown; hint?: unknown; code?: unknown }\n // `hint` is worth keeping when Postgres offers one: on a permission error\n // it names the GRANT that is missing, which is the difference between a\n // shrug and a fix.\n const parts = [e.message, e.details, e.hint]\n .filter((p): p is string => typeof p === 'string' && p.trim().length > 0)\n if (parts.length > 0) return [...new Set(parts)].join(' — ')\n // Only a code to go on. The bare code alone (\"erro 23514\") reads as noise;\n // pairing it with the fallback keeps the sentence in the reader's language\n // and still carries the one token worth searching for.\n if (typeof e.code === 'string' && e.code) return `${fallback} (${e.code})`\n }\n const text = String(err ?? '').trim()\n // Never hand back the stringification of an object nobody can read.\n return text && text !== '[object Object]' ? text : fallback\n}\n\nexport function offlineMessage(): string {\n return tl('No internet connection.', 'Sem conexão com a internet.')\n}\n\n/**\n * The text to put on screen for a failure: offline is named as such, a PostgREST\n * object yields its message, and nothing renders as \"[object Object]\". The\n * fallback is in the reader's language.\n */\nexport function describeError(err: unknown, fallback?: string): string {\n return errorMessage(err, fallback ?? tl('Something went wrong. Try again.', 'Algo deu errado. Tente de novo.'))\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/data/errors.ts","../src/lib/error-message.ts"],"names":[],"mappings":";;;AA8BA,IAAM,eAAA,GAA4C,CAAC,SAAA,EAAW,QAAQ,CAAA;AAc/D,IAAM,SAAA,GAAN,cAAwB,KAAA,CAAM;AAAA,EASnC,WAAA,CAAY,IAAA,EAAqB,OAAA,EAAiB,OAAA,GAA4B,EAAC,EAAG;AAChF,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,WAAA;AACZ,IAA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CAAC,CAAA;AAChH","file":"chunk-EG6IXJNY.js","sourcesContent":["// ---------------------------------------------------------------------------\n// Data error taxonomy — one normalized shape for everything the data door can\n// fail with, so callers branch on a `kind` instead of grepping a message.\n//\n// The split that matters most is 'forbidden' vs 'missing-object': a PostgREST\n// \"permission denied for table x\" (42501) once surfaced to a user as \"analytics\n// engine missing\", sending everyone to look for a migration that was already\n// applied. They are different failures with different fixes — a grant versus a\n// deploy — and the taxonomy has to keep them apart.\n// ---------------------------------------------------------------------------\n\nexport type DataErrorKind =\n /** No usable network: fetch failed, request aborted, timed out. */\n | 'offline'\n /** No identity: missing/expired JWT. Re-authenticate. */\n | 'unauthorized'\n /** Identity known, access refused: RLS or a missing GRANT. */\n | 'forbidden'\n /** The object exists, the row does not. */\n | 'not-found'\n /** The table/view/function itself is not there — a deploy gap, not a data gap. */\n | 'missing-object'\n /** The write lost a race or duplicates a unique key. */\n | 'conflict'\n /** The request itself is wrong: bad syntax, constraint violated, no tenant. */\n | 'invalid'\n /** Anything the backend blames on itself. */\n | 'server'\n\n/** Only these are worth trying again with the same input. */\nconst RETRYABLE_KINDS: readonly DataErrorKind[] = ['offline', 'server']\n\nexport interface DataErrorOptions {\n /** The original throw, preserved for reporters that want the real object. */\n cause?: unknown\n /** HTTP status when the failure came over the wire. */\n status?: number\n /** PostgREST (`PGRST116`) or Postgres (`42501`) code. */\n code?: string\n details?: string\n /** Postgres often puts the actionable fix here — surface it, do not drop it. */\n hint?: string\n}\n\nexport class DataError extends Error {\n readonly kind: DataErrorKind\n readonly retryable: boolean\n readonly cause?: unknown\n readonly status?: number\n readonly code?: string\n readonly details?: string\n readonly hint?: string\n\n constructor(kind: DataErrorKind, message: string, options: DataErrorOptions = {}) {\n super(message)\n this.name = 'DataError'\n this.kind = kind\n this.retryable = RETRYABLE_KINDS.includes(kind)\n this.cause = options.cause\n this.status = options.status\n this.code = options.code\n this.details = options.details\n this.hint = options.hint\n }\n}\n\n// ---------------------------------------------------------------------------\n// Classification\n// ---------------------------------------------------------------------------\n\n/** Postgres + PostgREST codes are stable; branch on them before any text. */\nconst CODE_KINDS: Record<string, DataErrorKind> = {\n // PostgREST\n PGRST100: 'invalid', // parse error in the query string\n PGRST106: 'missing-object', // schema not exposed\n PGRST116: 'not-found', // zero rows where exactly one was requested\n PGRST202: 'missing-object', // function not found in schema cache\n PGRST204: 'missing-object', // column not found in schema cache\n PGRST205: 'missing-object', // table not found in schema cache\n PGRST301: 'unauthorized', // JWT invalid or expired\n PGRST302: 'unauthorized', // anonymous access disabled\n // Postgres\n '22007': 'invalid', // invalid datetime format\n '22P02': 'invalid', // invalid input syntax\n '23502': 'invalid', // not-null violation\n '23505': 'conflict', // unique violation\n '23514': 'invalid', // check violation\n '42501': 'forbidden', // insufficient privilege / permission denied\n '42883': 'missing-object', // undefined function\n '42P01': 'missing-object', // undefined table\n '53300': 'server', // too many connections\n '57014': 'server', // statement timeout, server side\n}\n\n/** Transport-level codes — the request never reached PostgREST. */\nconst OFFLINE_CODES = new Set(['ECONNREFUSED', 'ECONNRESET', 'ENOTFOUND', 'ETIMEDOUT', 'EAI_AGAIN'])\n\nconst OFFLINE_TEXT = /failed to fetch|fetch failed|network ?error|networkrequestfailed|load failed|connection (refused|reset|closed)|err_internet_disconnected|aborted|signal is aborted|the operation was aborted|timed out|timeout|sem conexão com a internet|no internet connection/i\n\nfunction statusKind(status: number): DataErrorKind {\n if (status === 401) return 'unauthorized'\n if (status === 403) return 'forbidden'\n if (status === 404 || status === 406) return 'not-found'\n if (status === 408) return 'offline'\n if (status === 409) return 'conflict'\n if (status === 400 || status === 422) return 'invalid'\n if (status >= 500) return 'server'\n return 'server'\n}\n\nfunction textKind(message: string): DataErrorKind | undefined {\n const m = message.toLowerCase()\n if (/permission denied|row-level security|row level security|insufficient privilege/.test(m)) return 'forbidden'\n if (/does not exist|undefined table|undefined function|schema cache|could not find the (table|function)/.test(m)) return 'missing-object'\n if (/jwt|not authenticated|invalid token|unauthorized|no api key/.test(m)) return 'unauthorized'\n if (/duplicate key|already exists|conflict/.test(m)) return 'conflict'\n if (/invalid input (syntax|value)|violates (not-null|check) constraint|invalid request/.test(m)) return 'invalid'\n if (/no rows|not found/.test(m)) return 'not-found'\n return undefined\n}\n\nfunction pick(source: Record<string, unknown>, key: string): unknown {\n const value = source[key]\n return value === null ? undefined : value\n}\n\nfunction readStatus(source: Record<string, unknown>): number | undefined {\n for (const key of ['status', 'statusCode', 'httpStatus']) {\n const value = pick(source, key)\n if (typeof value === 'number') return value\n if (typeof value === 'string' && /^\\d{3}$/.test(value)) return Number(value)\n }\n const response = pick(source, 'response')\n if (response && typeof response === 'object') {\n const status = (response as Record<string, unknown>).status\n if (typeof status === 'number') return status\n }\n return undefined\n}\n\nfunction isOffline(name: string, message: string, code: string | undefined, status: number | undefined): boolean {\n if (name === 'AbortError' || name === 'TimeoutError') return true\n if (code && OFFLINE_CODES.has(code)) return true\n if (status !== undefined) return false\n // navigator.onLine is a hint, not a verdict — it only decides errors we could\n // not classify from a code or a status.\n const nav = (globalThis as { navigator?: { onLine?: boolean } }).navigator\n if (nav && nav.onLine === false) return true\n return OFFLINE_TEXT.test(message)\n}\n\n/**\n * Normalizes anything thrown by the data layer into a {@link DataError}.\n * Idempotent — a DataError passes through untouched.\n */\nexport function toDataError(err: unknown): DataError {\n if (err instanceof DataError) return err\n\n const source: Record<string, unknown> =\n err && typeof err === 'object' ? (err as Record<string, unknown>) : {}\n const name = typeof source.name === 'string' ? source.name : ''\n const rawMessage = typeof source.message === 'string' ? source.message : ''\n const message = rawMessage || (typeof err === 'string' ? err : '') || 'data request failed'\n const codeValue = pick(source, 'code')\n const code = typeof codeValue === 'string' ? codeValue : typeof codeValue === 'number' ? String(codeValue) : undefined\n const status = readStatus(source)\n const details = typeof source.details === 'string' ? source.details : undefined\n const hint = typeof source.hint === 'string' ? source.hint : undefined\n\n let kind: DataErrorKind | undefined = code ? CODE_KINDS[code] : undefined\n if (!kind && isOffline(name, message, code, status)) kind = 'offline'\n if (!kind && status !== undefined) kind = statusKind(status)\n if (!kind) kind = textKind(message)\n\n return new DataError(kind ?? 'server', message, { cause: err, status, code, details, hint })\n}\n","import { toDataError } from '../data/errors'\nimport { tl } from '../i18n'\n\n/**\n * A readable message out of anything a data layer throws.\n *\n * Supabase/PostgREST reject with a PLAIN OBJECT ({message, details, hint,\n * code}), not an Error — so the usual `err instanceof Error ? err.message :\n * String(err)` renders the literal text \"[object Object]\" and hides the one\n * piece of information the user needed. The workspace wizard showed exactly\n * that for a 400 whose body named the failing constraint.\n *\n * Lives in core because every layer above it catches from Supabase: ui, admin,\n * storefront and the plugins all had their own copy of the broken ternary.\n * The careful branches below are plugin-shop's, which had already met this on\n * its settings screens and worked out what each case has to answer.\n *\n * `fallback` is a parameter because the last resort is the one string a user\n * actually reads, and it belongs in their language: SDK prose is English, but\n * merchant-facing copy is the carve-out (see fayz-ssr/AGENTS.md). plugin-shop\n * passes 'erro desconhecido'.\n */\nexport function errorMessage(err: unknown, fallback = 'Unknown error'): string {\n // \"TypeError: Failed to fetch\" is the browser's wording, not the user's: say what happened.\n if (err != null && toDataError(err).kind === 'offline') return offlineMessage()\n // An Error is answered by an Error, message or not. Falling through to the\n // object branch would reach `String(err)` and render the useless word\n // \"Error\" — a refusal with no reason is worse than a generic one, because\n // there is nothing to search for and nothing to report.\n if (err instanceof Error) return err.message.trim() || fallback\n if (typeof err === 'string') return err\n if (err && typeof err === 'object') {\n const e = err as { message?: unknown; details?: unknown; hint?: unknown; code?: unknown }\n // `hint` is worth keeping when Postgres offers one: on a permission error\n // it names the GRANT that is missing, which is the difference between a\n // shrug and a fix.\n const parts = [e.message, e.details, e.hint]\n .filter((p): p is string => typeof p === 'string' && p.trim().length > 0)\n if (parts.length > 0) return [...new Set(parts)].join(' — ')\n // Only a code to go on. The bare code alone (\"erro 23514\") reads as noise;\n // pairing it with the fallback keeps the sentence in the reader's language\n // and still carries the one token worth searching for.\n if (typeof e.code === 'string' && e.code) return `${fallback} (${e.code})`\n }\n const text = String(err ?? '').trim()\n // Never hand back the stringification of an object nobody can read.\n return text && text !== '[object Object]' ? text : fallback\n}\n\nexport function offlineMessage(): string {\n return tl('No internet connection.', 'Sem conexão com a internet.')\n}\n\n/**\n * The text to put on screen for a failure: offline is named as such, a PostgREST\n * object yields its message, and nothing renders as \"[object Object]\". The\n * fallback is in the reader's language.\n */\nexport function describeError(err: unknown, fallback?: string): string {\n return errorMessage(err, fallback ?? tl('Something went wrong. Try again.', 'Algo deu errado. Tente de novo.'))\n}\n"]}
|
|
@@ -1505,7 +1505,7 @@ var coreTranslations = {
|
|
|
1505
1505
|
"connectors.trigger.webhook": "provider notice",
|
|
1506
1506
|
"connectors.authorize.oauthOnly": "Nothing to fill in: you authorize on the provider\u2019s own screen and come back.",
|
|
1507
1507
|
"connectors.authorize.oauthOrKey": "Authorize on the provider\u2019s own screen and come back \u2014 or paste the account\u2019s secret key below.",
|
|
1508
|
-
"connectors.authorize.nothingToFill": "Nothing to fill in: this provider\u2019s key is
|
|
1508
|
+
"connectors.authorize.nothingToFill": "Nothing to fill in: this provider\u2019s key is already set up. How it behaves is set up right after connecting.",
|
|
1509
1509
|
// Not every partner hands a code back on a redirect. AppMax issues the keys
|
|
1510
1510
|
// when you INSTALL the app inside its own panel, so the honest instruction
|
|
1511
1511
|
// is the two-step gesture, not a Connect button that could never finish.
|
|
@@ -1826,7 +1826,7 @@ var coreTranslations = {
|
|
|
1826
1826
|
"connectors.trigger.webhook": "aviso do provedor",
|
|
1827
1827
|
"connectors.authorize.oauthOnly": "Nada para preencher: voc\xEA autoriza na tela do pr\xF3prio provedor e volta para c\xE1.",
|
|
1828
1828
|
"connectors.authorize.oauthOrKey": "Autorize na tela do pr\xF3prio provedor e volte para c\xE1 \u2014 ou cole a chave secreta da conta abaixo.",
|
|
1829
|
-
"connectors.authorize.nothingToFill": "Nada para preencher: a chave deste provedor
|
|
1829
|
+
"connectors.authorize.nothingToFill": "Nada para preencher: a chave deste provedor j\xE1 vem configurada. Como ele funciona voc\xEA ajusta logo depois de conectar.",
|
|
1830
1830
|
// Genérica de propósito: nem todo provedor tem "app da Fayz para instalar".
|
|
1831
1831
|
// Na AbacatePay o lojista CRIA a própria chave no painel dele, e a frase
|
|
1832
1832
|
// antiga mandava procurar um app que não existe.
|
|
@@ -2093,5 +2093,5 @@ function preloadLocale(locale) {
|
|
|
2093
2093
|
}
|
|
2094
2094
|
|
|
2095
2095
|
export { I18nProvider, coreTranslations, getCurrentLocale, mergeTranslations, preloadLocale, registerTranslations, resolveLocale, setCurrentLocale, setLocaleStore, tl, useI18nConfig, useTranslation };
|
|
2096
|
-
//# sourceMappingURL=chunk-
|
|
2097
|
-
//# sourceMappingURL=chunk-
|
|
2096
|
+
//# sourceMappingURL=chunk-JGRPFH56.js.map
|
|
2097
|
+
//# sourceMappingURL=chunk-JGRPFH56.js.map
|