@nitida/sdk 0.32.0 → 0.32.1

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/src/index.ts CHANGED
@@ -1166,6 +1166,31 @@ export type UploadResult = {
1166
1166
  * privado, servida sin una queja, que después da 404.
1167
1167
  */
1168
1168
  visibility: "public" | "private";
1169
+ /**
1170
+ * La cadena compacta de variantes que EXISTEN (`"lmoqs"`, `"o"`, …).
1171
+ *
1172
+ * ⭐⭐ EL QUINTO DEFECTO DE LA MISMA FAMILIA
1173
+ *
1174
+ * `getAssetUrl` **cambia de estrategia según este campo**. Con él, un preset
1175
+ * de imagen ausente cae a `/t/…width=N/` y el borde lo genera al vuelo:
1176
+ * **200**. Sin él, el builder no sabe qué existe, asume que todo existe, y
1177
+ * devuelve la clave de variante — que da **404 en silencio**.
1178
+ *
1179
+ * Medido 2026-08-25 sobre un asset con `presets: "lmoqs"`:
1180
+ *
1181
+ * sin `presets` → /f/v/<sha>-x.webp 404
1182
+ * con `presets` → /t/format=webp,width=3840/<sha>.webp 200
1183
+ *
1184
+ * `UploadResult` no lo llevaba, así que `getAssetUrl(up, "xl")` —el patrón
1185
+ * que enseña toda la doc— caía del lado malo.
1186
+ *
1187
+ * ⚠️ Es el mismo error que `sha`, `mime` y `oext`, por cuarta vez: **un tipo
1188
+ * de retorno que omite lo que la próxima llamada necesita convierte la
1189
+ * llamada obvia en un 404 silencioso.** Y el guarda que escribí para esto
1190
+ * fijaba los tres *hints* de `original`; `presets` no es un hint, es lo que
1191
+ * gobierna el fallback, así que quedaba afuera de lo que el guarda miraba.
1192
+ */
1193
+ presets: string;
1169
1194
  };
1170
1195
 
1171
1196
  async function computeSha256(
@@ -1718,6 +1743,7 @@ export class NitidaClient {
1718
1743
  // DTO does carry `sha` today — but relying on that is how the other
1719
1744
  // branch broke, and the value we hashed ourselves is authoritative.
1720
1745
  visibility: existing.visibility ?? "public",
1746
+ presets: existing.presets ?? "",
1721
1747
  cdnUrl: this.publicUrlOrNull(
1722
1748
  { ...existing, sha: sha.slice(0, 16) },
1723
1749
  this.bestPresetForAsset(existing, mime),
@@ -1810,6 +1836,7 @@ export class NitidaClient {
1810
1836
  // `defaultPresetForMime`, which is a guess made before anything exists.
1811
1837
  // Guessing was safe only while this branch never ran.
1812
1838
  visibility: settled.visibility ?? "public",
1839
+ presets: settled.presets ?? "",
1813
1840
  cdnUrl: this.publicUrlOrNull(
1814
1841
  { ...settled, sha: short },
1815
1842
  this.bestPresetForAsset(settled, mime),
@@ -1867,6 +1894,7 @@ export class NitidaClient {
1867
1894
  mime: final.mime ?? mime,
1868
1895
  oext: final.oext ?? null,
1869
1896
  visibility: final.visibility ?? "public",
1897
+ presets: final.presets ?? "",
1870
1898
  cdnUrl: this.publicUrlOrNull(final, this.bestPresetForAsset(final, mime)),
1871
1899
  };
1872
1900
  }