@darseen/vaze 2.6.0 → 2.7.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 CHANGED
@@ -149,10 +149,11 @@ const { data, error } = await vaze.files.rename({
149
149
  });
150
150
  ```
151
151
 
152
- `delete(id)` Delete a file by its ID.
152
+ `delete(id, options?)` Delete a file by its ID. It moves to Recently deleted, where it can be restored until it is purged. Pass `{ permanent: true }` to remove it from storage right away. `deleteMany(ids, options?)` does the same for several files.
153
153
 
154
154
  ```ts
155
155
  const { data, error } = await vaze.files.delete("file-id-123");
156
+ await vaze.files.delete("file-id-456", { permanent: true });
156
157
  ```
157
158
 
158
159
  Folders API Access folder-related methods via `vaze.folders`. `get(options?)` Retrieve folders and their contents.
@@ -209,12 +210,21 @@ if (data) {
209
210
  }
210
211
  ```
211
212
 
212
- `delete(id)` Delete a folder by its ID.
213
+ `delete(id, options?)` Delete a folder by its ID. It moves to Recently deleted with everything inside it, unless you pass `{ permanent: true }`.
213
214
 
214
215
  ```ts
215
216
  const { data, error } = await vaze.folders.delete("folder-id");
216
217
  ```
217
218
 
219
+ Recently Deleted API Restore or purge deleted files and folders via `vaze.deleted`. Listing needs `files:read`, and restoring and purging need `files:delete`. Items are purged on their own once they are older than the instance's `deletedRetentionDays`.
220
+
221
+ ```ts
222
+ const { data } = await vaze.deleted.getAll(); // items, newest first, and retentionDays
223
+ await vaze.deleted.restore(["file-id-123", "folder-id"]); // back where they were
224
+ await vaze.deleted.purge(["file-id-456"]); // gone for good
225
+ await vaze.deleted.empty();
226
+ ```
227
+
218
228
  Keys API Manage the caller's API keys via `vaze.keys`. These calls need a client that acts as a signed-in user (`headers`) holding `api-keys:manage`; a client built with an API key gets a `403`.
219
229
 
220
230
  `getAll()` List the caller's keys, newest first.
@@ -314,4 +324,4 @@ Failed requests carry the HTTP status in `error.status`, such as `401` once a se
314
324
 
315
325
  # Types
316
326
 
317
- This SDK is built with TypeScript and exports all necessary types to ensure type safety in your applications. Types such as `File`, `Folder`, `ApiKey`, `Activity`, `User`, `Session`, `InstanceSettings`, `Stats`, `StatsAlert`, `TrafficDay`, `ApiKeyUsage`, `ApiResponse`, `ListOptions`, and `VazeOptions`.
327
+ This SDK is built with TypeScript and exports all necessary types to ensure type safety in your applications. Types such as `File`, `Folder`, `DeletedItem`, `ApiKey`, `Activity`, `User`, `Session`, `InstanceSettings`, `Stats`, `StatsAlert`, `TrafficDay`, `ApiKeyUsage`, `ApiResponse`, `ListOptions`, and `VazeOptions`.
package/dist/index.cjs CHANGED
@@ -218,6 +218,41 @@ var Activity = class extends Base {
218
218
  }
219
219
  };
220
220
 
221
+ // src/deleted.ts
222
+ var Deleted = class extends Base {
223
+ /** Most recently deleted first, with how many days items are kept. */
224
+ async getAll() {
225
+ return await this.request(
226
+ "GET",
227
+ this.apiUrl("/api/deleted")
228
+ );
229
+ }
230
+ /** Put items back where they were; one whose name is taken now fails. */
231
+ async restore(ids) {
232
+ return await this.request(
233
+ "POST",
234
+ this.apiUrl("/api/deleted/restore"),
235
+ { ids }
236
+ );
237
+ }
238
+ /** Delete items for good, before their time is up. */
239
+ async purge(ids) {
240
+ return await this.request(
241
+ "DELETE",
242
+ this.apiUrl("/api/deleted"),
243
+ { ids }
244
+ );
245
+ }
246
+ /** Delete everything in it for good. */
247
+ async empty() {
248
+ return await this.request(
249
+ "DELETE",
250
+ this.apiUrl("/api/deleted"),
251
+ { all: true }
252
+ );
253
+ }
254
+ };
255
+
221
256
  // src/files.ts
222
257
  var Files = class extends Base {
223
258
  async getAll(options) {
@@ -384,17 +419,19 @@ var Files = class extends Base {
384
419
  data: data ? { ...data, url: new URL(data.url, this.vazeUrl).toString() } : null
385
420
  };
386
421
  }
387
- async delete(id) {
422
+ /** Moves the file to Recently deleted, unless `permanent` is set. */
423
+ async delete(id, options) {
388
424
  return await this.request("DELETE", this.apiUrl("/api/files"), {
389
- id
425
+ id,
426
+ ...options
390
427
  });
391
428
  }
392
429
  /** Delete several files in one request; each id reports its own outcome. */
393
- async deleteMany(ids) {
430
+ async deleteMany(ids, options) {
394
431
  return await this.request(
395
432
  "DELETE",
396
433
  this.apiUrl("/api/files"),
397
- { ids }
434
+ { ids, ...options }
398
435
  );
399
436
  }
400
437
  };
@@ -445,9 +482,11 @@ var Folders = class extends Base {
445
482
  async setVisibility(data) {
446
483
  return await this.request("PUT", this.apiUrl("/api/folders"), data);
447
484
  }
448
- async delete(id) {
485
+ /** Moves the folder and everything in it to Recently deleted, unless `permanent` is set. */
486
+ async delete(id, options) {
449
487
  return await this.request("DELETE", this.apiUrl("/api/folders"), {
450
- id
488
+ id,
489
+ ...options
451
490
  });
452
491
  }
453
492
  };
@@ -577,10 +616,12 @@ var Vaze = class extends Base {
577
616
 
578
617
 
579
618
 
619
+
580
620
  constructor(options = {}) {
581
621
  super(options);
582
622
  this.files = new Files(options);
583
623
  this.folders = new Folders(options);
624
+ this.deleted = new Deleted(options);
584
625
  this.keys = new Keys(options);
585
626
  this.account = new Account(options);
586
627
  this.activity = new Activity(options);
package/dist/index.d.cts CHANGED
@@ -941,6 +941,25 @@ declare const files: SQLiteTableWithColumns<{
941
941
  }, {}, {
942
942
  length: number | undefined;
943
943
  }>;
944
+ deletedAt: SQLiteColumn<{
945
+ name: "deleted_at";
946
+ tableName: "files";
947
+ dataType: "string";
948
+ columnType: "SQLiteText";
949
+ data: string;
950
+ driverParam: string;
951
+ notNull: false;
952
+ hasDefault: false;
953
+ isPrimaryKey: false;
954
+ isAutoincrement: false;
955
+ hasRuntimeDefault: false;
956
+ enumValues: [string, ...string[]];
957
+ baseColumn: never;
958
+ identity: undefined;
959
+ generated: undefined;
960
+ }, {}, {
961
+ length: number | undefined;
962
+ }>;
944
963
  };
945
964
  dialect: "sqlite";
946
965
  }>;
@@ -1065,6 +1084,25 @@ declare const folders: SQLiteTableWithColumns<{
1065
1084
  }, {}, {
1066
1085
  length: number | undefined;
1067
1086
  }>;
1087
+ deletedAt: SQLiteColumn<{
1088
+ name: "deleted_at";
1089
+ tableName: "folders";
1090
+ dataType: "string";
1091
+ columnType: "SQLiteText";
1092
+ data: string;
1093
+ driverParam: string;
1094
+ notNull: false;
1095
+ hasDefault: false;
1096
+ isPrimaryKey: false;
1097
+ isAutoincrement: false;
1098
+ hasRuntimeDefault: false;
1099
+ enumValues: [string, ...string[]];
1100
+ baseColumn: never;
1101
+ identity: undefined;
1102
+ generated: undefined;
1103
+ }, {}, {
1104
+ length: number | undefined;
1105
+ }>;
1068
1106
  };
1069
1107
  dialect: "sqlite";
1070
1108
  }>;
@@ -1136,6 +1174,8 @@ type Limits = {
1136
1174
  hostingCacheMaxAge: number;
1137
1175
  activityRetentionDays: number;
1138
1176
  apiRequestRetentionDays: number;
1177
+ /** Days a deleted file or folder can be restored before it is purged. */
1178
+ deletedRetentionDays: number;
1139
1179
  };
1140
1180
  type InstanceSettings = {
1141
1181
  /** Applied to uploads and new folders that don't ask for one. */
@@ -1144,6 +1184,25 @@ type InstanceSettings = {
1144
1184
  visibilityCounts: Record<Visibility, number>;
1145
1185
  limits: Limits;
1146
1186
  };
1187
+ /** A file or folder in Recently deleted, which a restore puts back at `key`. */
1188
+ type DeletedItem = {
1189
+ id: string;
1190
+ name: string;
1191
+ /** Where it was; a restore recreates any folders on the way that are gone. */
1192
+ key: string;
1193
+ /** Bytes it holds, everything inside it for a folder. */
1194
+ size: number;
1195
+ deletedAt: string;
1196
+ /** When it is deleted for good, unless restored first. */
1197
+ purgeAt: string;
1198
+ } & ({
1199
+ type: "file";
1200
+ mimeType: string;
1201
+ } | {
1202
+ type: "folder";
1203
+ /** Files anywhere inside it. */
1204
+ files: number;
1205
+ });
1147
1206
  /** One API key's share of the week's requests. */
1148
1207
  type ApiKeyUsage = {
1149
1208
  id: string;
@@ -1203,7 +1262,7 @@ type StatsAlert =
1203
1262
  * Servers that predate them leave them out, so check before reading.
1204
1263
  */
1205
1264
  type Stats = {
1206
- /** Present when the caller holds `files:read`. */
1265
+ /** Present when the caller holds `files:read`. Files in Recently deleted aren't counted. */
1207
1266
  files: {
1208
1267
  total: number;
1209
1268
  folders: number;
@@ -1214,6 +1273,8 @@ type Stats = {
1214
1273
  available: number;
1215
1274
  /** Usable size of the data volume, which other data may share. */
1216
1275
  capacity?: number;
1276
+ /** Bytes held by files in Recently deleted, not counted in `used`. */
1277
+ deleted?: number;
1217
1278
  };
1218
1279
  types: {
1219
1280
  mimeType: string;
@@ -1292,6 +1353,21 @@ declare class Activity extends Base {
1292
1353
  }>>;
1293
1354
  }
1294
1355
 
1356
+ /** Files and folders that were deleted and can still be restored. */
1357
+ declare class Deleted extends Base {
1358
+ /** Most recently deleted first, with how many days items are kept. */
1359
+ getAll(): Promise<ApiResponse<{
1360
+ items: DeletedItem[];
1361
+ retentionDays: number;
1362
+ }>>;
1363
+ /** Put items back where they were; one whose name is taken now fails. */
1364
+ restore(ids: string[]): Promise<ApiResponse<BulkRestoreResult>>;
1365
+ /** Delete items for good, before their time is up. */
1366
+ purge(ids: string[]): Promise<ApiResponse<BulkDeleteResult>>;
1367
+ /** Delete everything in it for good. */
1368
+ empty(): Promise<ApiResponse<BulkDeleteResult>>;
1369
+ }
1370
+
1295
1371
  declare class Files extends Base {
1296
1372
  getAll(options?: ListOptions): Promise<{
1297
1373
  error: {
@@ -1408,9 +1484,10 @@ declare class Files extends Base {
1408
1484
  expiresAt: string;
1409
1485
  } | null;
1410
1486
  }>;
1411
- delete(id: string): Promise<ApiResponse<null>>;
1487
+ /** Moves the file to Recently deleted, unless `permanent` is set. */
1488
+ delete(id: string, options?: DeleteOptions): Promise<ApiResponse<null>>;
1412
1489
  /** Delete several files in one request; each id reports its own outcome. */
1413
- deleteMany(ids: string[]): Promise<ApiResponse<BulkDeleteResult>>;
1490
+ deleteMany(ids: string[], options?: DeleteOptions): Promise<ApiResponse<BulkDeleteResult>>;
1414
1491
  }
1415
1492
 
1416
1493
  declare class Folders extends Base {
@@ -1460,7 +1537,8 @@ declare class Folders extends Base {
1460
1537
  id: string;
1461
1538
  visibility: Visibility;
1462
1539
  }): Promise<ApiResponse<null>>;
1463
- delete(id: string): Promise<ApiResponse<null>>;
1540
+ /** Moves the folder and everything in it to Recently deleted, unless `permanent` is set. */
1541
+ delete(id: string, options?: DeleteOptions): Promise<ApiResponse<null>>;
1464
1542
  }
1465
1543
 
1466
1544
  /** The caller's API keys. These calls need a signed-in session, not a key. */
@@ -1528,6 +1606,7 @@ declare class Users extends Base {
1528
1606
  interface IVaze {
1529
1607
  files: Files;
1530
1608
  folders: Folders;
1609
+ deleted: Deleted;
1531
1610
  keys: Keys;
1532
1611
  account: Account;
1533
1612
  activity: Activity;
@@ -1622,6 +1701,17 @@ type BulkDeleteResult = {
1622
1701
  message: string;
1623
1702
  }[];
1624
1703
  };
1704
+ type BulkRestoreResult = {
1705
+ restored: string[];
1706
+ failed: {
1707
+ id: string;
1708
+ message: string;
1709
+ }[];
1710
+ };
1711
+ type DeleteOptions = {
1712
+ /** Skip Recently deleted and remove it from storage right away. */
1713
+ permanent?: boolean;
1714
+ };
1625
1715
 
1626
1716
  declare class Base {
1627
1717
  private apiKey;
@@ -1658,6 +1748,7 @@ declare class Account extends Base {
1658
1748
  declare class Vaze extends Base implements IVaze {
1659
1749
  files: Files;
1660
1750
  folders: Folders;
1751
+ deleted: Deleted;
1661
1752
  keys: Keys;
1662
1753
  account: Account;
1663
1754
  activity: Activity;
@@ -1677,4 +1768,4 @@ declare class Vaze extends Base implements IVaze {
1677
1768
  stats(): Promise<ApiResponse<Stats>>;
1678
1769
  }
1679
1770
 
1680
- export { type ActivityEntry as Activity, type ActivityType, type ApiKeySummary as ApiKey, type ApiKeyUsage, type ApiResponse, type BulkDeleteResult, type BulkMoveResult, type CreatedApiKey, type FileWithUrl as File, type FileReference, type Folder, type InstanceSettings, type Limits, type ListOptions, type Me, type MoveDestination, type NewKeyOptions, type NewUserOptions, type PasswordChange, type ProfileChanges, type Role, type Scope, type SessionSummary as Session, type SettingsChanges, type SignOptions, type SignedUrl, type Stats, type StatsAlert, type TrafficDay, type UserSummary as User, type UserAccess, type VazeHeaders, type VazeOptions, type Visibility, Vaze as default };
1771
+ export { type ActivityEntry as Activity, type ActivityType, type ApiKeySummary as ApiKey, type ApiKeyUsage, type ApiResponse, type BulkDeleteResult, type BulkMoveResult, type BulkRestoreResult, type CreatedApiKey, type DeleteOptions, type DeletedItem, type FileWithUrl as File, type FileReference, type Folder, type InstanceSettings, type Limits, type ListOptions, type Me, type MoveDestination, type NewKeyOptions, type NewUserOptions, type PasswordChange, type ProfileChanges, type Role, type Scope, type SessionSummary as Session, type SettingsChanges, type SignOptions, type SignedUrl, type Stats, type StatsAlert, type TrafficDay, type UserSummary as User, type UserAccess, type VazeHeaders, type VazeOptions, type Visibility, Vaze as default };
package/dist/index.d.ts CHANGED
@@ -941,6 +941,25 @@ declare const files: SQLiteTableWithColumns<{
941
941
  }, {}, {
942
942
  length: number | undefined;
943
943
  }>;
944
+ deletedAt: SQLiteColumn<{
945
+ name: "deleted_at";
946
+ tableName: "files";
947
+ dataType: "string";
948
+ columnType: "SQLiteText";
949
+ data: string;
950
+ driverParam: string;
951
+ notNull: false;
952
+ hasDefault: false;
953
+ isPrimaryKey: false;
954
+ isAutoincrement: false;
955
+ hasRuntimeDefault: false;
956
+ enumValues: [string, ...string[]];
957
+ baseColumn: never;
958
+ identity: undefined;
959
+ generated: undefined;
960
+ }, {}, {
961
+ length: number | undefined;
962
+ }>;
944
963
  };
945
964
  dialect: "sqlite";
946
965
  }>;
@@ -1065,6 +1084,25 @@ declare const folders: SQLiteTableWithColumns<{
1065
1084
  }, {}, {
1066
1085
  length: number | undefined;
1067
1086
  }>;
1087
+ deletedAt: SQLiteColumn<{
1088
+ name: "deleted_at";
1089
+ tableName: "folders";
1090
+ dataType: "string";
1091
+ columnType: "SQLiteText";
1092
+ data: string;
1093
+ driverParam: string;
1094
+ notNull: false;
1095
+ hasDefault: false;
1096
+ isPrimaryKey: false;
1097
+ isAutoincrement: false;
1098
+ hasRuntimeDefault: false;
1099
+ enumValues: [string, ...string[]];
1100
+ baseColumn: never;
1101
+ identity: undefined;
1102
+ generated: undefined;
1103
+ }, {}, {
1104
+ length: number | undefined;
1105
+ }>;
1068
1106
  };
1069
1107
  dialect: "sqlite";
1070
1108
  }>;
@@ -1136,6 +1174,8 @@ type Limits = {
1136
1174
  hostingCacheMaxAge: number;
1137
1175
  activityRetentionDays: number;
1138
1176
  apiRequestRetentionDays: number;
1177
+ /** Days a deleted file or folder can be restored before it is purged. */
1178
+ deletedRetentionDays: number;
1139
1179
  };
1140
1180
  type InstanceSettings = {
1141
1181
  /** Applied to uploads and new folders that don't ask for one. */
@@ -1144,6 +1184,25 @@ type InstanceSettings = {
1144
1184
  visibilityCounts: Record<Visibility, number>;
1145
1185
  limits: Limits;
1146
1186
  };
1187
+ /** A file or folder in Recently deleted, which a restore puts back at `key`. */
1188
+ type DeletedItem = {
1189
+ id: string;
1190
+ name: string;
1191
+ /** Where it was; a restore recreates any folders on the way that are gone. */
1192
+ key: string;
1193
+ /** Bytes it holds, everything inside it for a folder. */
1194
+ size: number;
1195
+ deletedAt: string;
1196
+ /** When it is deleted for good, unless restored first. */
1197
+ purgeAt: string;
1198
+ } & ({
1199
+ type: "file";
1200
+ mimeType: string;
1201
+ } | {
1202
+ type: "folder";
1203
+ /** Files anywhere inside it. */
1204
+ files: number;
1205
+ });
1147
1206
  /** One API key's share of the week's requests. */
1148
1207
  type ApiKeyUsage = {
1149
1208
  id: string;
@@ -1203,7 +1262,7 @@ type StatsAlert =
1203
1262
  * Servers that predate them leave them out, so check before reading.
1204
1263
  */
1205
1264
  type Stats = {
1206
- /** Present when the caller holds `files:read`. */
1265
+ /** Present when the caller holds `files:read`. Files in Recently deleted aren't counted. */
1207
1266
  files: {
1208
1267
  total: number;
1209
1268
  folders: number;
@@ -1214,6 +1273,8 @@ type Stats = {
1214
1273
  available: number;
1215
1274
  /** Usable size of the data volume, which other data may share. */
1216
1275
  capacity?: number;
1276
+ /** Bytes held by files in Recently deleted, not counted in `used`. */
1277
+ deleted?: number;
1217
1278
  };
1218
1279
  types: {
1219
1280
  mimeType: string;
@@ -1292,6 +1353,21 @@ declare class Activity extends Base {
1292
1353
  }>>;
1293
1354
  }
1294
1355
 
1356
+ /** Files and folders that were deleted and can still be restored. */
1357
+ declare class Deleted extends Base {
1358
+ /** Most recently deleted first, with how many days items are kept. */
1359
+ getAll(): Promise<ApiResponse<{
1360
+ items: DeletedItem[];
1361
+ retentionDays: number;
1362
+ }>>;
1363
+ /** Put items back where they were; one whose name is taken now fails. */
1364
+ restore(ids: string[]): Promise<ApiResponse<BulkRestoreResult>>;
1365
+ /** Delete items for good, before their time is up. */
1366
+ purge(ids: string[]): Promise<ApiResponse<BulkDeleteResult>>;
1367
+ /** Delete everything in it for good. */
1368
+ empty(): Promise<ApiResponse<BulkDeleteResult>>;
1369
+ }
1370
+
1295
1371
  declare class Files extends Base {
1296
1372
  getAll(options?: ListOptions): Promise<{
1297
1373
  error: {
@@ -1408,9 +1484,10 @@ declare class Files extends Base {
1408
1484
  expiresAt: string;
1409
1485
  } | null;
1410
1486
  }>;
1411
- delete(id: string): Promise<ApiResponse<null>>;
1487
+ /** Moves the file to Recently deleted, unless `permanent` is set. */
1488
+ delete(id: string, options?: DeleteOptions): Promise<ApiResponse<null>>;
1412
1489
  /** Delete several files in one request; each id reports its own outcome. */
1413
- deleteMany(ids: string[]): Promise<ApiResponse<BulkDeleteResult>>;
1490
+ deleteMany(ids: string[], options?: DeleteOptions): Promise<ApiResponse<BulkDeleteResult>>;
1414
1491
  }
1415
1492
 
1416
1493
  declare class Folders extends Base {
@@ -1460,7 +1537,8 @@ declare class Folders extends Base {
1460
1537
  id: string;
1461
1538
  visibility: Visibility;
1462
1539
  }): Promise<ApiResponse<null>>;
1463
- delete(id: string): Promise<ApiResponse<null>>;
1540
+ /** Moves the folder and everything in it to Recently deleted, unless `permanent` is set. */
1541
+ delete(id: string, options?: DeleteOptions): Promise<ApiResponse<null>>;
1464
1542
  }
1465
1543
 
1466
1544
  /** The caller's API keys. These calls need a signed-in session, not a key. */
@@ -1528,6 +1606,7 @@ declare class Users extends Base {
1528
1606
  interface IVaze {
1529
1607
  files: Files;
1530
1608
  folders: Folders;
1609
+ deleted: Deleted;
1531
1610
  keys: Keys;
1532
1611
  account: Account;
1533
1612
  activity: Activity;
@@ -1622,6 +1701,17 @@ type BulkDeleteResult = {
1622
1701
  message: string;
1623
1702
  }[];
1624
1703
  };
1704
+ type BulkRestoreResult = {
1705
+ restored: string[];
1706
+ failed: {
1707
+ id: string;
1708
+ message: string;
1709
+ }[];
1710
+ };
1711
+ type DeleteOptions = {
1712
+ /** Skip Recently deleted and remove it from storage right away. */
1713
+ permanent?: boolean;
1714
+ };
1625
1715
 
1626
1716
  declare class Base {
1627
1717
  private apiKey;
@@ -1658,6 +1748,7 @@ declare class Account extends Base {
1658
1748
  declare class Vaze extends Base implements IVaze {
1659
1749
  files: Files;
1660
1750
  folders: Folders;
1751
+ deleted: Deleted;
1661
1752
  keys: Keys;
1662
1753
  account: Account;
1663
1754
  activity: Activity;
@@ -1677,4 +1768,4 @@ declare class Vaze extends Base implements IVaze {
1677
1768
  stats(): Promise<ApiResponse<Stats>>;
1678
1769
  }
1679
1770
 
1680
- export { type ActivityEntry as Activity, type ActivityType, type ApiKeySummary as ApiKey, type ApiKeyUsage, type ApiResponse, type BulkDeleteResult, type BulkMoveResult, type CreatedApiKey, type FileWithUrl as File, type FileReference, type Folder, type InstanceSettings, type Limits, type ListOptions, type Me, type MoveDestination, type NewKeyOptions, type NewUserOptions, type PasswordChange, type ProfileChanges, type Role, type Scope, type SessionSummary as Session, type SettingsChanges, type SignOptions, type SignedUrl, type Stats, type StatsAlert, type TrafficDay, type UserSummary as User, type UserAccess, type VazeHeaders, type VazeOptions, type Visibility, Vaze as default };
1771
+ export { type ActivityEntry as Activity, type ActivityType, type ApiKeySummary as ApiKey, type ApiKeyUsage, type ApiResponse, type BulkDeleteResult, type BulkMoveResult, type BulkRestoreResult, type CreatedApiKey, type DeleteOptions, type DeletedItem, type FileWithUrl as File, type FileReference, type Folder, type InstanceSettings, type Limits, type ListOptions, type Me, type MoveDestination, type NewKeyOptions, type NewUserOptions, type PasswordChange, type ProfileChanges, type Role, type Scope, type SessionSummary as Session, type SettingsChanges, type SignOptions, type SignedUrl, type Stats, type StatsAlert, type TrafficDay, type UserSummary as User, type UserAccess, type VazeHeaders, type VazeOptions, type Visibility, Vaze as default };
package/dist/index.js CHANGED
@@ -218,6 +218,41 @@ var Activity = class extends Base {
218
218
  }
219
219
  };
220
220
 
221
+ // src/deleted.ts
222
+ var Deleted = class extends Base {
223
+ /** Most recently deleted first, with how many days items are kept. */
224
+ async getAll() {
225
+ return await this.request(
226
+ "GET",
227
+ this.apiUrl("/api/deleted")
228
+ );
229
+ }
230
+ /** Put items back where they were; one whose name is taken now fails. */
231
+ async restore(ids) {
232
+ return await this.request(
233
+ "POST",
234
+ this.apiUrl("/api/deleted/restore"),
235
+ { ids }
236
+ );
237
+ }
238
+ /** Delete items for good, before their time is up. */
239
+ async purge(ids) {
240
+ return await this.request(
241
+ "DELETE",
242
+ this.apiUrl("/api/deleted"),
243
+ { ids }
244
+ );
245
+ }
246
+ /** Delete everything in it for good. */
247
+ async empty() {
248
+ return await this.request(
249
+ "DELETE",
250
+ this.apiUrl("/api/deleted"),
251
+ { all: true }
252
+ );
253
+ }
254
+ };
255
+
221
256
  // src/files.ts
222
257
  var Files = class extends Base {
223
258
  async getAll(options) {
@@ -384,17 +419,19 @@ var Files = class extends Base {
384
419
  data: data ? { ...data, url: new URL(data.url, this.vazeUrl).toString() } : null
385
420
  };
386
421
  }
387
- async delete(id) {
422
+ /** Moves the file to Recently deleted, unless `permanent` is set. */
423
+ async delete(id, options) {
388
424
  return await this.request("DELETE", this.apiUrl("/api/files"), {
389
- id
425
+ id,
426
+ ...options
390
427
  });
391
428
  }
392
429
  /** Delete several files in one request; each id reports its own outcome. */
393
- async deleteMany(ids) {
430
+ async deleteMany(ids, options) {
394
431
  return await this.request(
395
432
  "DELETE",
396
433
  this.apiUrl("/api/files"),
397
- { ids }
434
+ { ids, ...options }
398
435
  );
399
436
  }
400
437
  };
@@ -445,9 +482,11 @@ var Folders = class extends Base {
445
482
  async setVisibility(data) {
446
483
  return await this.request("PUT", this.apiUrl("/api/folders"), data);
447
484
  }
448
- async delete(id) {
485
+ /** Moves the folder and everything in it to Recently deleted, unless `permanent` is set. */
486
+ async delete(id, options) {
449
487
  return await this.request("DELETE", this.apiUrl("/api/folders"), {
450
- id
488
+ id,
489
+ ...options
451
490
  });
452
491
  }
453
492
  };
@@ -572,6 +611,7 @@ var Users = class extends Base {
572
611
  var Vaze = class extends Base {
573
612
  files;
574
613
  folders;
614
+ deleted;
575
615
  keys;
576
616
  account;
577
617
  activity;
@@ -581,6 +621,7 @@ var Vaze = class extends Base {
581
621
  super(options);
582
622
  this.files = new Files(options);
583
623
  this.folders = new Folders(options);
624
+ this.deleted = new Deleted(options);
584
625
  this.keys = new Keys(options);
585
626
  this.account = new Account(options);
586
627
  this.activity = new Activity(options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darseen/vaze",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Vaze Self-Hosted file storage and hosting service SDK.",
5
5
  "keywords": [
6
6
  "api",