@nitida/sdk 0.32.3 → 0.33.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.
- package/dist/index.d.ts +16 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/server.js +10 -0
- package/dist/server.js.map +1 -1
- package/dist/web.js +10 -0
- package/dist/web.js.map +1 -1
- package/package.json +2 -2
- package/skills/nitida-sdk/SKILL.md +3 -1
- package/src/index.ts +40 -0
package/dist/web.js
CHANGED
|
@@ -508,6 +508,13 @@ function mimeFromFileName(fileName) {
|
|
|
508
508
|
return ext ? MIME_BY_EXT[ext] ?? null : null;
|
|
509
509
|
}
|
|
510
510
|
var DEFAULT_UPLOAD_PRESETS = ["original"];
|
|
511
|
+
function kindForMime(mime) {
|
|
512
|
+
const m = (mime ?? "").toLowerCase();
|
|
513
|
+
if (m.startsWith("video/")) return "video";
|
|
514
|
+
if (m.startsWith("audio/")) return "audio";
|
|
515
|
+
if (m.startsWith("image/")) return "image";
|
|
516
|
+
return "other";
|
|
517
|
+
}
|
|
511
518
|
async function computeSha256(bytes) {
|
|
512
519
|
const buf = bytes instanceof Blob ? await bytes.arrayBuffer() : bytes instanceof Uint8Array ? bytes.buffer : bytes;
|
|
513
520
|
const digest = await crypto.subtle.digest("SHA-256", buf);
|
|
@@ -777,6 +784,7 @@ var NitidaClient = class {
|
|
|
777
784
|
// Same shape as the presign branch below, for the same reason. This
|
|
778
785
|
// DTO does carry `sha` today — but relying on that is how the other
|
|
779
786
|
// branch broke, and the value we hashed ourselves is authoritative.
|
|
787
|
+
kind: existing.kind ?? kindForMime(mime),
|
|
780
788
|
visibility: existing.visibility ?? "public",
|
|
781
789
|
presets: existing.presets ?? "",
|
|
782
790
|
variants: existing.variants ?? [],
|
|
@@ -837,6 +845,7 @@ var NitidaClient = class {
|
|
|
837
845
|
// ACTUALLY has, now that we waited for it — not from
|
|
838
846
|
// `defaultPresetForMime`, which is a guess made before anything exists.
|
|
839
847
|
// Guessing was safe only while this branch never ran.
|
|
848
|
+
kind: settled.kind ?? kindForMime(mime),
|
|
840
849
|
visibility: settled.visibility ?? "public",
|
|
841
850
|
presets: settled.presets ?? "",
|
|
842
851
|
variants: settled.variants ?? [],
|
|
@@ -888,6 +897,7 @@ var NitidaClient = class {
|
|
|
888
897
|
sha: sha.slice(0, 16),
|
|
889
898
|
mime: final.mime ?? mime,
|
|
890
899
|
oext: final.oext ?? null,
|
|
900
|
+
kind: final.kind ?? kindForMime(final.mime ?? mime),
|
|
891
901
|
visibility: final.visibility ?? "public",
|
|
892
902
|
presets: final.presets ?? "",
|
|
893
903
|
variants: final.variants ?? [],
|