@meistrari/vault-sdk 3.1.1 → 3.2.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/README.md +49 -3
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Vault SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript SDK for interacting with the Vault file storage service. Provides file upload, download, streaming, hierarchy management, permalinks, and vault reference utilities.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
bun add @meistrari/vault-sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Table of Contents
|
|
@@ -17,6 +17,8 @@ ni @meistrari/vault-sdk
|
|
|
17
17
|
- [VaultFile](#vaultfile)
|
|
18
18
|
- [Vault Client](#vault-client)
|
|
19
19
|
- [Permalinks](#permalinks)
|
|
20
|
+
- [File Hierarchies](#file-hierarchies)
|
|
21
|
+
- [Vault Reference Utilities](#vault-reference-utilities)
|
|
20
22
|
- [Advanced Usage](#advanced-usage)
|
|
21
23
|
|
|
22
24
|
## Core Concepts
|
|
@@ -332,6 +334,50 @@ Deletes the permalink.
|
|
|
332
334
|
await permalink.delete()
|
|
333
335
|
```
|
|
334
336
|
|
|
337
|
+
## File Hierarchies
|
|
338
|
+
|
|
339
|
+
Files can be organized into parent-child relationships. See the [File Hierarchy Guide](docs/guides/file-hierarchy.md) for full details, patterns, and best practices.
|
|
340
|
+
|
|
341
|
+
```ts
|
|
342
|
+
// Create a child file
|
|
343
|
+
const child = await parentFile.createChildFromContent({
|
|
344
|
+
name: 'page-1.png',
|
|
345
|
+
content: imageBlob,
|
|
346
|
+
})
|
|
347
|
+
|
|
348
|
+
// List children
|
|
349
|
+
const children = await parentFile.getChildren()
|
|
350
|
+
|
|
351
|
+
// Iterate children with auto-pagination
|
|
352
|
+
for await (const child of parentFile.iterateChildren()) {
|
|
353
|
+
console.log(child.name)
|
|
354
|
+
}
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Options for handling edge cases:
|
|
358
|
+
|
|
359
|
+
- `onMissingParent`: `'error'` (default) or `'create-as-root'`
|
|
360
|
+
- `onParentConflict`: `'error'` (default), `'update-parent-id'`, or `'ignore'`
|
|
361
|
+
|
|
362
|
+
## Vault Reference Utilities
|
|
363
|
+
|
|
364
|
+
Utilities for working with `vault://` URIs and S3 presigned URLs.
|
|
365
|
+
|
|
366
|
+
```ts
|
|
367
|
+
import {
|
|
368
|
+
isVaultReference,
|
|
369
|
+
extractVaultReferences,
|
|
370
|
+
isS3UrlExpired,
|
|
371
|
+
convertS3UrlToVaultReference,
|
|
372
|
+
extractVaultFileIdFromS3Url,
|
|
373
|
+
} from '@meistrari/vault-sdk'
|
|
374
|
+
|
|
375
|
+
isVaultReference('vault://abc-123') // true
|
|
376
|
+
extractVaultReferences('See vault://a and vault://b') // ['vault://a', 'vault://b']
|
|
377
|
+
isS3UrlExpired(presignedUrl) // boolean
|
|
378
|
+
convertS3UrlToVaultReference(s3Url) // 'vault://...'
|
|
379
|
+
```
|
|
380
|
+
|
|
335
381
|
## Advanced Usage
|
|
336
382
|
|
|
337
383
|
### Complete Workflow Example
|
package/dist/index.cjs
CHANGED
|
@@ -237,7 +237,7 @@ function getFileName(content) {
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
const name = "@meistrari/vault-sdk";
|
|
240
|
-
const version = "3.
|
|
240
|
+
const version = "3.2.0";
|
|
241
241
|
const license = "UNLICENSED";
|
|
242
242
|
const repository = {
|
|
243
243
|
type: "git",
|
|
@@ -265,10 +265,10 @@ const scripts = {
|
|
|
265
265
|
};
|
|
266
266
|
const dependencies = {
|
|
267
267
|
"@meistrari/file-type": "22.0.0",
|
|
268
|
-
"@meistrari/vault-shared": "0.1.
|
|
268
|
+
"@meistrari/vault-shared": "0.1.1",
|
|
269
269
|
"mime-types": "3.0.1",
|
|
270
270
|
ofetch: "1.4.1",
|
|
271
|
-
zod: "3.
|
|
271
|
+
zod: "4.3.6"
|
|
272
272
|
};
|
|
273
273
|
const devDependencies = {
|
|
274
274
|
"@types/bun": "latest",
|
package/dist/index.mjs
CHANGED
|
@@ -231,7 +231,7 @@ function getFileName(content) {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
const name = "@meistrari/vault-sdk";
|
|
234
|
-
const version = "3.
|
|
234
|
+
const version = "3.2.0";
|
|
235
235
|
const license = "UNLICENSED";
|
|
236
236
|
const repository = {
|
|
237
237
|
type: "git",
|
|
@@ -259,10 +259,10 @@ const scripts = {
|
|
|
259
259
|
};
|
|
260
260
|
const dependencies = {
|
|
261
261
|
"@meistrari/file-type": "22.0.0",
|
|
262
|
-
"@meistrari/vault-shared": "0.1.
|
|
262
|
+
"@meistrari/vault-shared": "0.1.1",
|
|
263
263
|
"mime-types": "3.0.1",
|
|
264
264
|
ofetch: "1.4.1",
|
|
265
|
-
zod: "3.
|
|
265
|
+
zod: "4.3.6"
|
|
266
266
|
};
|
|
267
267
|
const devDependencies = {
|
|
268
268
|
"@types/bun": "latest",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meistrari/vault-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@meistrari/file-type": "22.0.0",
|
|
31
|
-
"@meistrari/vault-shared": "0.1.
|
|
31
|
+
"@meistrari/vault-shared": "0.1.1",
|
|
32
32
|
"mime-types": "3.0.1",
|
|
33
33
|
"ofetch": "1.4.1",
|
|
34
|
-
"zod": "3.
|
|
34
|
+
"zod": "4.3.6"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/bun": "latest",
|