@veloxts/storage 0.6.58 → 0.6.59

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 CHANGED
@@ -43,6 +43,20 @@ export { FileExistsError, FileNotFoundError, InvalidPathError, isFileNotFoundErr
43
43
  export { createStorageManager, type StorageManager, storage } from './manager.js';
44
44
  export { _resetStandaloneStorage, getStorage, getStorageFromInstance, storagePlugin, } from './plugin.js';
45
45
  export type { CopyOptions, FileMetadata, FileVisibility, GetOptions, ListOptions, ListResult, LocalStorageConfig, PutOptions, S3StorageConfig, SignedUrlOptions, StorageBaseOptions, StorageConfig, StorageDefaultOptions, StorageDriver, StorageLocalOptions, StorageManagerOptions, StoragePluginOptions, StorageS3Options, StorageStore, } from './types.js';
46
+ /**
47
+ * Utility functions for storage operations.
48
+ *
49
+ * @deprecated Import from '@veloxts/storage/utils' instead. Will be removed in v2.0.
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * // Old (deprecated):
54
+ * import { formatBytes, detectMimeType } from '@veloxts/storage';
55
+ *
56
+ * // New:
57
+ * import { formatBytes, detectMimeType } from '@veloxts/storage/utils';
58
+ * ```
59
+ */
46
60
  export { basename, detectMimeType, dirname, extname, formatBytes, joinPath, normalizePath, uniqueFileName, validatePath, } from './utils.js';
47
61
  /**
48
62
  * DI tokens and providers for @veloxts/storage
package/dist/index.js CHANGED
@@ -46,7 +46,20 @@ export { FileExistsError, FileNotFoundError, InvalidPathError, isFileNotFoundErr
46
46
  export { createStorageManager, storage } from './manager.js';
47
47
  // Plugin
48
48
  export { _resetStandaloneStorage, getStorage, getStorageFromInstance, storagePlugin, } from './plugin.js';
49
- // Utilities
49
+ /**
50
+ * Utility functions for storage operations.
51
+ *
52
+ * @deprecated Import from '@veloxts/storage/utils' instead. Will be removed in v2.0.
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * // Old (deprecated):
57
+ * import { formatBytes, detectMimeType } from '@veloxts/storage';
58
+ *
59
+ * // New:
60
+ * import { formatBytes, detectMimeType } from '@veloxts/storage/utils';
61
+ * ```
62
+ */
50
63
  export { basename, detectMimeType, dirname, extname, formatBytes, joinPath, normalizePath, uniqueFileName, validatePath, } from './utils.js';
51
64
  // ============================================================================
52
65
  // Dependency Injection
package/dist/manager.d.ts CHANGED
@@ -224,6 +224,33 @@ export interface StorageManager {
224
224
  * @returns Current visibility, or null if not determinable
225
225
  */
226
226
  getVisibility(path: string): Promise<FileVisibility | null>;
227
+ /**
228
+ * Make a file publicly accessible.
229
+ * Convenience method that calls setVisibility(path, 'public').
230
+ *
231
+ * @param path - File path/key
232
+ *
233
+ * @example
234
+ * ```typescript
235
+ * await storage.makePublic('uploads/avatar.jpg');
236
+ * const url = await storage.url('uploads/avatar.jpg');
237
+ * ```
238
+ */
239
+ makePublic(path: string): Promise<void>;
240
+ /**
241
+ * Make a file private (not publicly accessible).
242
+ * Convenience method that calls setVisibility(path, 'private').
243
+ *
244
+ * @param path - File path/key
245
+ *
246
+ * @example
247
+ * ```typescript
248
+ * await storage.makePrivate('documents/sensitive.pdf');
249
+ * // Use signedUrl() for temporary access
250
+ * const signedUrl = await storage.signedUrl('documents/sensitive.pdf');
251
+ * ```
252
+ */
253
+ makePrivate(path: string): Promise<void>;
227
254
  /**
228
255
  * Close/cleanup the storage connection.
229
256
  */
package/dist/manager.js CHANGED
@@ -99,6 +99,8 @@ export async function createStorageManager(options = {}) {
99
99
  signedUrl: (path, signedOptions) => store.signedUrl(path, signedOptions),
100
100
  setVisibility: (path, visibility) => store.setVisibility(path, visibility),
101
101
  getVisibility: (path) => store.getVisibility(path),
102
+ makePublic: (path) => store.setVisibility(path, 'public'),
103
+ makePrivate: (path) => store.setVisibility(path, 'private'),
102
104
  close: () => store.close(),
103
105
  };
104
106
  return manager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veloxts/storage",
3
- "version": "0.6.58",
3
+ "version": "0.6.59",
4
4
  "description": "Multi-driver file storage abstraction for VeloxTS framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -11,6 +11,10 @@
11
11
  "types": "./dist/index.d.ts",
12
12
  "import": "./dist/index.js"
13
13
  },
14
+ "./utils": {
15
+ "types": "./dist/utils.d.ts",
16
+ "import": "./dist/utils.js"
17
+ },
14
18
  "./drivers/local": {
15
19
  "types": "./dist/drivers/local.d.ts",
16
20
  "import": "./dist/drivers/local.js"
@@ -28,7 +32,7 @@
28
32
  "dependencies": {
29
33
  "fastify-plugin": "5.1.0",
30
34
  "mime-types": "2.1.35",
31
- "@veloxts/core": "0.6.58"
35
+ "@veloxts/core": "0.6.59"
32
36
  },
33
37
  "peerDependencies": {
34
38
  "@aws-sdk/client-s3": ">=3.0.0",
@@ -57,7 +61,7 @@
57
61
  "fastify": "5.6.2",
58
62
  "typescript": "5.8.3",
59
63
  "vitest": "4.0.16",
60
- "@veloxts/testing": "0.6.58"
64
+ "@veloxts/testing": "0.6.59"
61
65
  },
62
66
  "publishConfig": {
63
67
  "access": "public"