@fayz-ai/core 0.61.0 → 0.66.0

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.
Files changed (37) hide show
  1. package/dist/{chunk-37YMNSAI.js → chunk-6Q5BVKW3.js} +10 -6
  2. package/dist/chunk-6Q5BVKW3.js.map +1 -0
  3. package/dist/{chunk-3Q7EFWGY.js → chunk-HLQTDBV2.js} +9 -3
  4. package/dist/chunk-HLQTDBV2.js.map +1 -0
  5. package/dist/{chunk-2YIEIPMV.js → chunk-OYE4ATKB.js} +3 -3
  6. package/dist/{chunk-2YIEIPMV.js.map → chunk-OYE4ATKB.js.map} +1 -1
  7. package/dist/{chunk-TID5GW4V.js → chunk-QBJIBL4J.js} +3 -3
  8. package/dist/{chunk-TID5GW4V.js.map → chunk-QBJIBL4J.js.map} +1 -1
  9. package/dist/{chunk-XXHB7ZRM.js → chunk-QIKUNNMW.js} +4 -4
  10. package/dist/{chunk-XXHB7ZRM.js.map → chunk-QIKUNNMW.js.map} +1 -1
  11. package/dist/{chunk-WJFMTCEE.js → chunk-SFU34NWN.js} +3 -3
  12. package/dist/{chunk-WJFMTCEE.js.map → chunk-SFU34NWN.js.map} +1 -1
  13. package/dist/{chunk-DBJKX2EL.js → chunk-VFQMXAZ6.js} +4 -4
  14. package/dist/{chunk-DBJKX2EL.js.map → chunk-VFQMXAZ6.js.map} +1 -1
  15. package/dist/data/index.js +4 -4
  16. package/dist/i18n/index.js +1 -1
  17. package/dist/i18n/shell-translations.en.d.ts.map +1 -1
  18. package/dist/i18n/shell-translations.pt-br.d.ts.map +1 -1
  19. package/dist/index.d.ts +3 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +186 -49
  22. package/dist/index.js.map +1 -1
  23. package/dist/integrations/index.js +4 -4
  24. package/dist/lib/lazy-component.d.ts +18 -0
  25. package/dist/lib/lazy-component.d.ts.map +1 -0
  26. package/dist/plugin/index.js +3 -3
  27. package/dist/router/app-router.d.ts +62 -0
  28. package/dist/router/app-router.d.ts.map +1 -0
  29. package/dist/{shell-translations.pt-br-LTCOFMII.js → shell-translations.pt-br-UHWZOGGK.js} +8 -2
  30. package/dist/shell-translations.pt-br-UHWZOGGK.js.map +1 -0
  31. package/dist/testing/index.js +5 -5
  32. package/dist/testing.d.ts +0 -5
  33. package/dist/testing.d.ts.map +1 -1
  34. package/package.json +2 -1
  35. package/dist/chunk-37YMNSAI.js.map +0 -1
  36. package/dist/chunk-3Q7EFWGY.js.map +0 -1
  37. package/dist/shell-translations.pt-br-LTCOFMII.js.map +0 -1
@@ -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,QA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E,SAAS,CAAC,CAAA;AAC1E,IAAA,IAAI,KAAA,CAAM,MAAA,GAAS,CAAA,EAAG,OAAO,CAAC,GAAG,IAAI,GAAA,CAAI,KAAK,CAAC,CAAA,CAAE,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-2YIEIPMV.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,O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OO,SAAS,aAAA,CAAc,KAAc,QAAA,EAA2B;AACrE,EAAA,OAAO,aAAa,GAAA,EAAK,QAAA,IAAY,EAAA,CAAG,kCAAA,EAAoC,iCAAiC,CAAC,CAAA;AAChH","file":"chunk-OYE4ATKB.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,5 +1,5 @@
1
1
  import { Registry } from './chunk-EWKX4VUM.js';
2
- import { errorMessage } from './chunk-2YIEIPMV.js';
2
+ import { errorMessage } from './chunk-OYE4ATKB.js';
3
3
  import { getAllEntities } from './chunk-CU64QI4A.js';
4
4
  import * as React from 'react';
5
5
 
@@ -1342,5 +1342,5 @@ function useConnectorsForPlugin(hostPluginId) {
1342
1342
  }
1343
1343
 
1344
1344
  export { BLOCK_SETTING_TYPES, PLUGIN_API_VERSION, PluginRuntimeProvider, auditBlocks, blockRegistry, buildEntityDomainEvents, checkAgainstSchema, checkBlockConstraints, checkBlockContext, checkNodePlacement, clearExtensionPoints, clearHandles, clearLoaders, componentRegistry, dataNeedKey, defaultPropsFromSettings, defineBlock, defineExtensionPoint, defineLoader, definePlugin, describeBlock, describeBlocks, describeExtensionPoints, describeLoaders, entityEventKey, extensionAfterHooks, extensionPointRegistry, formatSchemaIssues, getAnalyticsCards, getBlock, getBlockMeta, getComponent, getDashboardWidgets, getHandle, getMetric, getPage, getPlugin, getPluginFactory, getScaffold, getWidgetsForZone, handleNameFor, handleRegistry, hasExtensionPoint, hasHandle, hasLoader, isBlockEnabledOn, isLoaderParamRef, isLoaderPropRef, isModuleOnInRuntime, listBlocks, listExtensionHandlers, listExtensionPoints, listHandles, listLoaders, listMetrics, listPluginFactories, listPlugins, loaderRegistry, metricRegistry, pageRegistry, pluginFactoryRegistry, pluginRegistry, registerBlock, registerComponent, registerExtensionHandler, registerHandle, registerMetric, registerPage, registerPlugin, registerPluginFactory, registerScaffold, repairBlockTree, requiredModulesOn, resolveHandle, resolveLoader, resolvePluginComponent, resolvePluginRuntime, runEscapeValve, runExtensionPoint, scaffoldRegistry, settingsToJsonSchema, summarizeBlockAudit, unregisterExtensionHandler, useConnectorsForPlugin, usePluginRuntime, usePluginRuntimeOptional };
1345
- //# sourceMappingURL=chunk-TID5GW4V.js.map
1346
- //# sourceMappingURL=chunk-TID5GW4V.js.map
1345
+ //# sourceMappingURL=chunk-QBJIBL4J.js.map
1346
+ //# sourceMappingURL=chunk-QBJIBL4J.js.map