@meistrari/vault-sdk 1.4.2 → 1.4.3

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.cjs CHANGED
@@ -181,9 +181,8 @@ async function getFileHash(blob) {
181
181
  return hashHex;
182
182
  }
183
183
  async function detectFileMimeType(blob) {
184
- const result = await fileType.fileTypeFromBlob(blob).catch(() => void 0);
185
- if (result?.mime) {
186
- return result.mime;
184
+ if (blob instanceof Blob && blob.type) {
185
+ return blob.type;
187
186
  }
188
187
  if ("name" in blob && typeof blob.name === "string") {
189
188
  const extension = blob.name.split(".").pop()?.toLowerCase();
@@ -194,8 +193,9 @@ async function detectFileMimeType(blob) {
194
193
  }
195
194
  }
196
195
  }
197
- if (blob instanceof Blob && blob.type) {
198
- return blob.type;
196
+ const result = await fileType.fileTypeFromBlob(blob).catch(() => void 0);
197
+ if (result?.mime) {
198
+ return result.mime;
199
199
  }
200
200
  return void 0;
201
201
  }
@@ -282,6 +282,9 @@ class VaultFile {
282
282
  headers,
283
283
  signal
284
284
  });
285
+ if (response.status === 204 || response.headers.get("content-length") === "0") {
286
+ return null;
287
+ }
285
288
  const content = await response.json();
286
289
  return content;
287
290
  }
package/dist/index.mjs CHANGED
@@ -179,9 +179,8 @@ async function getFileHash(blob) {
179
179
  return hashHex;
180
180
  }
181
181
  async function detectFileMimeType(blob) {
182
- const result = await fileTypeFromBlob(blob).catch(() => void 0);
183
- if (result?.mime) {
184
- return result.mime;
182
+ if (blob instanceof Blob && blob.type) {
183
+ return blob.type;
185
184
  }
186
185
  if ("name" in blob && typeof blob.name === "string") {
187
186
  const extension = blob.name.split(".").pop()?.toLowerCase();
@@ -192,8 +191,9 @@ async function detectFileMimeType(blob) {
192
191
  }
193
192
  }
194
193
  }
195
- if (blob instanceof Blob && blob.type) {
196
- return blob.type;
194
+ const result = await fileTypeFromBlob(blob).catch(() => void 0);
195
+ if (result?.mime) {
196
+ return result.mime;
197
197
  }
198
198
  return void 0;
199
199
  }
@@ -280,6 +280,9 @@ class VaultFile {
280
280
  headers,
281
281
  signal
282
282
  });
283
+ if (response.status === 204 || response.headers.get("content-length") === "0") {
284
+ return null;
285
+ }
283
286
  const content = await response.json();
284
287
  return content;
285
288
  }
package/package.json CHANGED
@@ -1,49 +1,49 @@
1
1
  {
2
- "name": "@meistrari/vault-sdk",
3
- "version": "1.4.2",
4
- "license": "UNLICENSED",
5
- "repository": {
6
- "type": "git",
7
- "url": "https://github.com/meistrari/vault.git"
8
- },
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.mjs",
13
- "require": "./dist/index.cjs"
2
+ "name": "@meistrari/vault-sdk",
3
+ "version": "1.4.3",
4
+ "license": "UNLICENSED",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/meistrari/vault.git"
8
+ },
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.mjs",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "main": "dist/index.mjs",
17
+ "types": "dist/index.d.ts",
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "scripts": {
22
+ "test": "vitest --no-watch",
23
+ "test:watch": "vitest",
24
+ "build": "unbuild",
25
+ "lint": "eslint .",
26
+ "lint:fix": "eslint . --fix",
27
+ "check": "bun run lint && bun tsc --noEmit"
28
+ },
29
+ "dependencies": {
30
+ "@meistrari/vault-shared": "0.0.5",
31
+ "file-type": "21.0.0",
32
+ "mime-types": "3.0.1",
33
+ "ofetch": "1.4.1",
34
+ "zod": "3.23.8"
35
+ },
36
+ "devDependencies": {
37
+ "@types/bun": "latest",
38
+ "@types/mime-types": "3.0.1",
39
+ "msw": "2.6.8",
40
+ "unbuild": "2.0.0",
41
+ "vitest": "2.1.9"
42
+ },
43
+ "peerDependencies": {
44
+ "typescript": "^5.0.0"
45
+ },
46
+ "publishConfig": {
47
+ "access": "public"
14
48
  }
15
- },
16
- "main": "dist/index.mjs",
17
- "types": "dist/index.d.ts",
18
- "files": [
19
- "dist"
20
- ],
21
- "scripts": {
22
- "test": "vitest --no-watch",
23
- "test:watch": "vitest",
24
- "build": "unbuild",
25
- "lint": "eslint .",
26
- "lint:fix": "eslint . --fix",
27
- "check": "bun run lint && bun tsc --noEmit"
28
- },
29
- "dependencies": {
30
- "@meistrari/vault-shared": "0.0.5",
31
- "file-type": "21.0.0",
32
- "mime-types": "3.0.1",
33
- "ofetch": "1.4.1",
34
- "zod": "3.23.8"
35
- },
36
- "devDependencies": {
37
- "@types/bun": "latest",
38
- "@types/mime-types": "3.0.1",
39
- "msw": "2.6.8",
40
- "unbuild": "2.0.0",
41
- "vitest": "2.1.9"
42
- },
43
- "peerDependencies": {
44
- "typescript": "^5.0.0"
45
- },
46
- "publishConfig": {
47
- "access": "public"
48
- }
49
- }
49
+ }