@telecrypt-io/storage 0.2.4 → 0.2.5

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 CHANGED
@@ -8,14 +8,14 @@ Files are encrypted on the client before upload. The server stores only opaque c
8
8
  never holds the decryption keys. Shared folders let multiple people add and read files, and a
9
9
  Recovery Key restores your files on a new device — even if you lose the original.
10
10
 
11
- **Status:** library source only. `@telecrypt-io/storage@0.2.4` is the current public release,
12
- published from this repository's protected `v0.2.4` tag with NPM Trusted Publishing/OIDC
11
+ **Status:** library source only. `@telecrypt-io/storage@0.2.5` is the current public release,
12
+ published from this repository's protected `v0.2.5` tag with NPM Trusted Publishing/OIDC
13
13
  provenance. The older `0.1.3` release is the immutable legacy combined library-and-CLI package.
14
14
 
15
15
  ## Install
16
16
 
17
17
  ```bash
18
- npm install @telecrypt-io/storage@0.2.4
18
+ npm install @telecrypt-io/storage@0.2.5
19
19
  ```
20
20
 
21
21
  This gives you the `TeleCryptIOStorage` library and its browser-safe `core` API.
@@ -74,7 +74,7 @@ function toArrayBuffer(bytes) {
74
74
  return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
75
75
  }
76
76
  export async function createFolder(storage, name) {
77
- const tree = await storage.createTree(name);
77
+ const tree = await withRateLimitRetry("createFolder", () => storage.createTree(name));
78
78
  return { id: tree.id, name };
79
79
  }
80
80
  /** Top-level folders only — excludes subdirectories of an existing tree. */
@@ -208,12 +208,12 @@ export async function listSubfolders(storage, folderId) {
208
208
  }
209
209
  export async function createSubfolder(storage, folderId, name) {
210
210
  const tree = await resolveTree(storage, folderId);
211
- const sub = await tree.createDirectory(name);
211
+ const sub = await withRateLimitRetry("createSubfolder", () => tree.createDirectory(name));
212
212
  return { id: sub.id, name };
213
213
  }
214
214
  export async function renameFolder(storage, folderId, name) {
215
215
  const tree = await resolveTree(storage, folderId);
216
- await tree.setName(name);
216
+ await withRateLimitRetry("renameFolder", () => tree.setName(name));
217
217
  return { id: folderId, name };
218
218
  }
219
219
  export async function deleteFolder(storage, folderId) {
@@ -239,7 +239,7 @@ export async function deleteFolder(storage, folderId) {
239
239
  export async function renameFile(storage, folderId, fileId, name) {
240
240
  const tree = await resolveTree(storage, folderId);
241
241
  const branch = await resolveFile(tree, fileId);
242
- await branch.setName(name);
242
+ await withRateLimitRetry("renameFile", () => branch.setName(name));
243
243
  // `setName` resolves when the homeserver accepts the state event, but a
244
244
  // fresh CLI/UI process can still read the previous local room state for a
245
245
  // short time. Do not report success until this client has observed the new
@@ -253,12 +253,12 @@ export async function renameFile(storage, folderId, fileId, name) {
253
253
  export async function deleteFile(storage, folderId, fileId) {
254
254
  const tree = await resolveTree(storage, folderId);
255
255
  const branch = await resolveFile(tree, fileId);
256
- await branch.delete();
256
+ await withRateLimitRetry("deleteFile", () => branch.delete());
257
257
  return { id: fileId, deleted: true };
258
258
  }
259
259
  export async function uploadFile(storage, folderId, name, bytes, mimetype) {
260
260
  const tree = await resolveTree(storage, folderId);
261
- const fileId = await storage.uploadFile(tree, name, toArrayBuffer(bytes), mimetype);
261
+ const fileId = await withRateLimitRetry("uploadFile", () => storage.uploadFile(tree, name, toArrayBuffer(bytes), mimetype));
262
262
  return { id: fileId, name, mimetype };
263
263
  }
264
264
  export async function downloadFile(storage, folderId, fileId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telecrypt-io/storage",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "license": "BUSL-1.1",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",