@memberjunction/storage 2.38.0 → 2.40.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.
Files changed (38) hide show
  1. package/dist/drivers/AWSFileStorage.d.ts +360 -4
  2. package/dist/drivers/AWSFileStorage.d.ts.map +1 -1
  3. package/dist/drivers/AWSFileStorage.js +357 -4
  4. package/dist/drivers/AWSFileStorage.js.map +1 -1
  5. package/dist/drivers/AzureFileStorage.d.ts +362 -2
  6. package/dist/drivers/AzureFileStorage.d.ts.map +1 -1
  7. package/dist/drivers/AzureFileStorage.js +357 -2
  8. package/dist/drivers/AzureFileStorage.js.map +1 -1
  9. package/dist/drivers/BoxFileStorage.d.ts +539 -20
  10. package/dist/drivers/BoxFileStorage.d.ts.map +1 -1
  11. package/dist/drivers/BoxFileStorage.js +521 -20
  12. package/dist/drivers/BoxFileStorage.js.map +1 -1
  13. package/dist/drivers/DropboxFileStorage.d.ts +437 -15
  14. package/dist/drivers/DropboxFileStorage.d.ts.map +1 -1
  15. package/dist/drivers/DropboxFileStorage.js +431 -15
  16. package/dist/drivers/DropboxFileStorage.js.map +1 -1
  17. package/dist/drivers/GoogleDriveFileStorage.d.ts +342 -16
  18. package/dist/drivers/GoogleDriveFileStorage.d.ts.map +1 -1
  19. package/dist/drivers/GoogleDriveFileStorage.js +340 -16
  20. package/dist/drivers/GoogleDriveFileStorage.js.map +1 -1
  21. package/dist/drivers/GoogleFileStorage.d.ts +358 -2
  22. package/dist/drivers/GoogleFileStorage.d.ts.map +1 -1
  23. package/dist/drivers/GoogleFileStorage.js +356 -2
  24. package/dist/drivers/GoogleFileStorage.js.map +1 -1
  25. package/dist/drivers/SharePointFileStorage.d.ts +434 -20
  26. package/dist/drivers/SharePointFileStorage.d.ts.map +1 -1
  27. package/dist/drivers/SharePointFileStorage.js +453 -22
  28. package/dist/drivers/SharePointFileStorage.js.map +1 -1
  29. package/dist/generic/FileStorageBase.d.ts +326 -108
  30. package/dist/generic/FileStorageBase.d.ts.map +1 -1
  31. package/dist/generic/FileStorageBase.js +54 -6
  32. package/dist/generic/FileStorageBase.js.map +1 -1
  33. package/dist/util.d.ts +125 -18
  34. package/dist/util.d.ts.map +1 -1
  35. package/dist/util.js +125 -18
  36. package/dist/util.js.map +1 -1
  37. package/package.json +4 -4
  38. package/readme.md +211 -1
@@ -1,80 +1,494 @@
1
1
  /// <reference types="node" />
2
2
  import { CreatePreAuthUploadUrlPayload, FileStorageBase, StorageListResult, StorageObjectMetadata } from '../generic/FileStorageBase';
3
+ /**
4
+ * FileStorageBase implementation for Microsoft SharePoint using the Microsoft Graph API
5
+ *
6
+ * This provider allows working with files stored in SharePoint document libraries.
7
+ * It uses the Microsoft Graph API and client credentials authentication flow to
8
+ * securely access and manipulate SharePoint files and folders.
9
+ *
10
+ * @remarks
11
+ * This implementation requires the following environment variables:
12
+ * - STORAGE_SHAREPOINT_CLIENT_ID - Azure AD application (client) ID
13
+ * - STORAGE_SHAREPOINT_CLIENT_SECRET - Azure AD application client secret
14
+ * - STORAGE_SHAREPOINT_TENANT_ID - Azure AD tenant ID
15
+ * - STORAGE_SHAREPOINT_SITE_ID - The SharePoint site ID
16
+ * - STORAGE_SHAREPOINT_DRIVE_ID - The ID of the document library (drive)
17
+ * - STORAGE_SHAREPOINT_ROOT_FOLDER_ID (optional) - ID of a subfolder to use as the root
18
+ *
19
+ * To use this provider, you need to:
20
+ * 1. Register an Azure AD application with appropriate Microsoft Graph API permissions
21
+ * (typically Files.ReadWrite.All and Sites.ReadWrite.All)
22
+ * 2. Create a client secret for the application
23
+ * 3. Grant admin consent for the permissions
24
+ * 4. Find your SharePoint site ID and document library (drive) ID using the Microsoft Graph Explorer
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * // Set required environment variables before creating the provider
29
+ * process.env.STORAGE_SHAREPOINT_CLIENT_ID = 'your-client-id';
30
+ * process.env.STORAGE_SHAREPOINT_CLIENT_SECRET = 'your-client-secret';
31
+ * process.env.STORAGE_SHAREPOINT_TENANT_ID = 'your-tenant-id';
32
+ * process.env.STORAGE_SHAREPOINT_SITE_ID = 'your-site-id';
33
+ * process.env.STORAGE_SHAREPOINT_DRIVE_ID = 'your-drive-id';
34
+ *
35
+ * // Create the provider
36
+ * const storage = new SharePointFileStorage();
37
+ *
38
+ * // Upload a file
39
+ * const fileContent = Buffer.from('Hello, SharePoint!');
40
+ * await storage.PutObject('documents/hello.txt', fileContent, 'text/plain');
41
+ *
42
+ * // Download a file
43
+ * const downloadedContent = await storage.GetObject('documents/hello.txt');
44
+ *
45
+ * // Get a temporary download URL
46
+ * const downloadUrl = await storage.CreatePreAuthDownloadUrl('documents/hello.txt');
47
+ * ```
48
+ */
3
49
  export declare class SharePointFileStorage extends FileStorageBase {
50
+ /**
51
+ * The name of this storage provider
52
+ */
4
53
  protected readonly providerName = "SharePoint";
54
+ /**
55
+ * Microsoft Graph API client
56
+ */
5
57
  private _client;
58
+ /**
59
+ * The ID of the SharePoint document library (drive)
60
+ */
6
61
  private _driveId;
62
+ /**
63
+ * The ID of the SharePoint site
64
+ */
7
65
  private _siteId;
66
+ /**
67
+ * Optional ID of a subfolder to use as the root folder (if specified)
68
+ */
8
69
  private _rootFolderId?;
70
+ /**
71
+ * Creates a new SharePointFileStorage instance
72
+ *
73
+ * This constructor reads required configuration from environment variables
74
+ * and initializes the Microsoft Graph client.
75
+ *
76
+ * @throws Error if required environment variables are missing
77
+ */
9
78
  constructor();
10
79
  /**
11
- * Get the parent item ID for a given path
80
+ * Gets the SharePoint item ID for a folder at the specified path
12
81
  *
13
- * @param path The path to get the parent folder for
14
- * @returns The parent folder ID
82
+ * This helper method navigates the folder hierarchy in SharePoint to find
83
+ * the folder specified by the path, returning its item ID.
84
+ *
85
+ * @param path - The path to get the parent folder for (e.g., 'documents/reports')
86
+ * @returns A Promise that resolves to the parent folder ID
87
+ * @throws Error if any folder in the path doesn't exist
88
+ * @private
15
89
  */
16
90
  private _getParentFolderIdByPath;
17
91
  /**
18
- * Get an item by path
92
+ * Gets a SharePoint item by its path
93
+ *
94
+ * This helper method retrieves a SharePoint item (file or folder) using
95
+ * its path. It handles path normalization and root folder redirection.
19
96
  *
20
- * @param path The path of the item
21
- * @returns The item
97
+ * @param path - The path of the item to retrieve (e.g., 'documents/reports/report.docx')
98
+ * @returns A Promise that resolves to the SharePoint item
99
+ * @throws Error if the item doesn't exist or cannot be accessed
100
+ * @private
22
101
  */
23
102
  private _getItemByPath;
24
103
  /**
25
- * Convert a SharePoint item to a StorageObjectMetadata object
104
+ * Converts a SharePoint item to a StorageObjectMetadata object
105
+ *
106
+ * This helper method transforms the Microsoft Graph API item representation
107
+ * into the standard StorageObjectMetadata format used by the FileStorageBase interface.
108
+ *
109
+ * @param item - The SharePoint item from the Microsoft Graph API
110
+ * @returns A StorageObjectMetadata object representing the item
111
+ * @private
26
112
  */
27
113
  private _itemToMetadata;
28
114
  /**
29
- * Create a pre-authenticated upload URL is not directly supported in SharePoint/OneDrive
115
+ * Creates a pre-authenticated upload URL (not supported in SharePoint)
116
+ *
117
+ * This method is not supported for SharePoint storage as SharePoint doesn't provide
118
+ * a way to generate pre-authenticated upload URLs like object storage services.
119
+ * Instead, use the PutObject method for file uploads.
120
+ *
121
+ * @param objectName - The object name (path) to create a pre-auth URL for
122
+ * @throws UnsupportedOperationError always, as this operation is not supported
123
+ * @example
124
+ * ```typescript
125
+ * // This will throw an UnsupportedOperationError
126
+ * try {
127
+ * await storage.CreatePreAuthUploadUrl('documents/report.docx');
128
+ * } catch (error) {
129
+ * if (error instanceof UnsupportedOperationError) {
130
+ * console.log('Pre-authenticated upload URLs are not supported in SharePoint.');
131
+ * // Use PutObject instead
132
+ * await storage.PutObject('documents/report.docx', fileContent, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document');
133
+ * }
134
+ * }
135
+ * ```
30
136
  */
31
137
  CreatePreAuthUploadUrl(objectName: string): Promise<CreatePreAuthUploadUrlPayload>;
32
138
  /**
33
- * Create a pre-authenticated download URL for an object
139
+ * Creates a pre-authenticated download URL for an object
140
+ *
141
+ * This method generates a time-limited, publicly accessible URL that can be used
142
+ * to download a file without authentication. The URL expires after 10 minutes.
143
+ *
144
+ * @param objectName - Path to the object to create a download URL for (e.g., 'documents/report.pdf')
145
+ * @returns A Promise that resolves to the pre-authenticated download URL
146
+ * @throws Error if the object doesn't exist or the URL creation fails
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * // Generate a pre-authenticated download URL that will work for 10 minutes
151
+ * const downloadUrl = await storage.CreatePreAuthDownloadUrl('presentations/quarterly-update.pptx');
152
+ * console.log(`Download the file using this URL: ${downloadUrl}`);
153
+ *
154
+ * // You can share this URL with users who don't have SharePoint access
155
+ * // The URL will expire after 10 minutes
156
+ * ```
34
157
  */
35
158
  CreatePreAuthDownloadUrl(objectName: string): Promise<string>;
36
159
  /**
37
- * Move an object from one location to another
160
+ * Moves an object from one location to another
161
+ *
162
+ * This method moves a file or folder from one location in SharePoint to another.
163
+ * It handles both renaming and changing the parent folder.
164
+ *
165
+ * @param oldObjectName - Current path of the object (e.g., 'old-folder/document.docx')
166
+ * @param newObjectName - New path for the object (e.g., 'new-folder/renamed-document.docx')
167
+ * @returns A Promise that resolves to true if successful, false otherwise
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * // Move a file to a different folder
172
+ * const moveResult = await storage.MoveObject(
173
+ * 'documents/old-report.pdf',
174
+ * 'archive/2023/annual-report.pdf'
175
+ * );
176
+ *
177
+ * if (moveResult) {
178
+ * console.log('File moved successfully');
179
+ * } else {
180
+ * console.error('Failed to move file');
181
+ * }
182
+ * ```
38
183
  */
39
184
  MoveObject(oldObjectName: string, newObjectName: string): Promise<boolean>;
40
185
  /**
41
- * Delete an object
186
+ * Deletes an object (file) from SharePoint
187
+ *
188
+ * This method permanently deletes a file from SharePoint storage.
189
+ * Note that deleted files may be recoverable from the SharePoint recycle bin
190
+ * depending on your SharePoint configuration.
191
+ *
192
+ * @param objectName - Path to the object to delete (e.g., 'documents/old-report.docx')
193
+ * @returns A Promise that resolves to true if successful, false if an error occurs
194
+ *
195
+ * @remarks
196
+ * - Returns true if the object doesn't exist (for idempotency)
197
+ * - Handles 404 errors by returning true since the end result is the same
198
+ *
199
+ * @example
200
+ * ```typescript
201
+ * // Delete a file
202
+ * const deleteResult = await storage.DeleteObject('temp/draft-document.docx');
203
+ *
204
+ * if (deleteResult) {
205
+ * console.log('File deleted successfully or already didn\'t exist');
206
+ * } else {
207
+ * console.error('Failed to delete file');
208
+ * }
209
+ * ```
42
210
  */
43
211
  DeleteObject(objectName: string): Promise<boolean>;
44
212
  /**
45
- * List objects in a given directory
213
+ * Lists objects in a given directory (folder)
214
+ *
215
+ * This method retrieves all files and subfolders in the specified directory.
216
+ * It returns both a list of object metadata and a list of directory prefixes.
217
+ *
218
+ * @param prefix - Path to the directory to list (e.g., 'documents/reports')
219
+ * @param delimiter - Optional delimiter character (not used in this implementation)
220
+ * @returns A Promise that resolves to a StorageListResult containing objects and prefixes
221
+ *
222
+ * @remarks
223
+ * - The `objects` array in the result includes both files and folders
224
+ * - The `prefixes` array includes only folder paths (with trailing slashes)
225
+ * - Returns empty arrays if the directory doesn't exist or an error occurs
226
+ *
227
+ * @example
228
+ * ```typescript
229
+ * // List all files and folders in the 'documents' directory
230
+ * const result = await storage.ListObjects('documents');
231
+ *
232
+ * // Process files
233
+ * for (const obj of result.objects) {
234
+ * console.log(`Name: ${obj.name}, Size: ${obj.size}, Type: ${obj.isDirectory ? 'Folder' : 'File'}`);
235
+ * }
236
+ *
237
+ * // Process subfolders
238
+ * for (const prefix of result.prefixes) {
239
+ * console.log(`Subfolder: ${prefix}`);
240
+ * }
241
+ * ```
46
242
  */
47
243
  ListObjects(prefix: string, delimiter?: string): Promise<StorageListResult>;
48
244
  /**
49
- * Create a directory
245
+ * Creates a directory (folder) in SharePoint
246
+ *
247
+ * This method creates a new folder at the specified path. The parent directory
248
+ * must already exist.
249
+ *
250
+ * @param directoryPath - Path where the directory should be created (e.g., 'documents/new-folder')
251
+ * @returns A Promise that resolves to true if successful, false if an error occurs
252
+ *
253
+ * @remarks
254
+ * - If a folder with the same name already exists, the operation will fail
255
+ * - The parent directory must exist for the operation to succeed
256
+ * - Trailing slashes in the path are automatically removed
257
+ *
258
+ * @example
259
+ * ```typescript
260
+ * // Create a new folder
261
+ * const createResult = await storage.CreateDirectory('documents/2024-reports');
262
+ *
263
+ * if (createResult) {
264
+ * console.log('Folder created successfully');
265
+ *
266
+ * // Now we can put files in this folder
267
+ * await storage.PutObject(
268
+ * 'documents/2024-reports/q1-results.xlsx',
269
+ * fileContent,
270
+ * 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
271
+ * );
272
+ * } else {
273
+ * console.error('Failed to create folder');
274
+ * }
275
+ * ```
50
276
  */
51
277
  CreateDirectory(directoryPath: string): Promise<boolean>;
52
278
  /**
53
- * Delete a directory and optionally its contents
279
+ * Deletes a directory (folder) and optionally its contents
280
+ *
281
+ * This method deletes a folder from SharePoint. By default, it will only delete
282
+ * empty folders unless the recursive parameter is set to true.
283
+ *
284
+ * @param directoryPath - Path to the directory to delete (e.g., 'archive/old-reports')
285
+ * @param recursive - If true, delete the directory and all its contents; if false, only delete if empty
286
+ * @returns A Promise that resolves to true if successful, false if an error occurs
287
+ *
288
+ * @remarks
289
+ * - If recursive=false and the directory contains files, the operation will fail
290
+ * - SharePoint deleted items may be recoverable from the recycle bin depending on site settings
291
+ * - Trailing slashes in the path are automatically removed
292
+ *
293
+ * @example
294
+ * ```typescript
295
+ * // Attempt to delete an empty folder
296
+ * const deleteResult = await storage.DeleteDirectory('temp/empty-folder');
297
+ *
298
+ * // Delete a folder and all its contents
299
+ * const recursiveDeleteResult = await storage.DeleteDirectory('archive/old-data', true);
300
+ *
301
+ * if (recursiveDeleteResult) {
302
+ * console.log('Folder and all its contents deleted successfully');
303
+ * } else {
304
+ * console.error('Failed to delete folder');
305
+ * }
306
+ * ```
54
307
  */
55
308
  DeleteDirectory(directoryPath: string, recursive?: boolean): Promise<boolean>;
56
309
  /**
57
- * Get object metadata
310
+ * Gets metadata for a file or folder
311
+ *
312
+ * This method retrieves metadata information about a file or folder, such as
313
+ * its name, size, content type, and last modified date.
314
+ *
315
+ * @param objectName - Path to the object to get metadata for (e.g., 'documents/report.pdf')
316
+ * @returns A Promise that resolves to a StorageObjectMetadata object
317
+ * @throws Error if the object doesn't exist or cannot be accessed
318
+ *
319
+ * @example
320
+ * ```typescript
321
+ * try {
322
+ * // Get metadata for a file
323
+ * const metadata = await storage.GetObjectMetadata('presentations/quarterly-update.pptx');
324
+ *
325
+ * console.log(`Name: ${metadata.name}`);
326
+ * console.log(`Size: ${metadata.size} bytes`);
327
+ * console.log(`Content Type: ${metadata.contentType}`);
328
+ * console.log(`Last Modified: ${metadata.lastModified}`);
329
+ * console.log(`Is Directory: ${metadata.isDirectory}`);
330
+ * } catch (error) {
331
+ * console.error('Error getting metadata:', error.message);
332
+ * }
333
+ * ```
58
334
  */
59
335
  GetObjectMetadata(objectName: string): Promise<StorageObjectMetadata>;
60
336
  /**
61
- * Get an object's contents
337
+ * Downloads a file's contents
338
+ *
339
+ * This method retrieves the raw content of a file as a Buffer.
340
+ *
341
+ * @param objectName - Path to the file to download (e.g., 'documents/report.pdf')
342
+ * @returns A Promise that resolves to a Buffer containing the file's contents
343
+ * @throws Error if the file doesn't exist or cannot be downloaded
344
+ *
345
+ * @remarks
346
+ * - This method uses the Graph API's download URL to retrieve the file contents
347
+ * - The method will throw an error if the object is a folder
348
+ * - For large files, consider using CreatePreAuthDownloadUrl instead
349
+ *
350
+ * @example
351
+ * ```typescript
352
+ * try {
353
+ * // Download a text file
354
+ * const fileContent = await storage.GetObject('documents/notes.txt');
355
+ *
356
+ * // Convert Buffer to string for text files
357
+ * const textContent = fileContent.toString('utf8');
358
+ * console.log('File content:', textContent);
359
+ *
360
+ * // For binary files, you can write the buffer to a local file
361
+ * // or process it as needed
362
+ * } catch (error) {
363
+ * console.error('Error downloading file:', error.message);
364
+ * }
365
+ * ```
62
366
  */
63
367
  GetObject(objectName: string): Promise<Buffer>;
64
368
  /**
65
- * Upload an object directly
369
+ * Uploads a file to SharePoint
370
+ *
371
+ * This method uploads a file to SharePoint at the specified path. It automatically
372
+ * determines whether to use a simple upload or a chunked upload based on file size.
373
+ *
374
+ * @param objectName - Path where the file should be uploaded (e.g., 'documents/report.pdf')
375
+ * @param data - Buffer containing the file content
376
+ * @param contentType - Optional MIME type of the file (if not provided, it will be guessed from the filename)
377
+ * @param metadata - Optional metadata to associate with the file (not used in SharePoint implementation)
378
+ * @returns A Promise that resolves to true if successful, false if an error occurs
379
+ *
380
+ * @remarks
381
+ * - Files smaller than 4MB use a simple upload
382
+ * - Files 4MB or larger use a chunked upload session for better reliability
383
+ * - Automatically creates the parent folder structure if it doesn't exist
384
+ * - If a file with the same name exists, it will be replaced
385
+ *
386
+ * @example
387
+ * ```typescript
388
+ * // Create a text file
389
+ * const textContent = Buffer.from('This is a sample document', 'utf8');
390
+ * const uploadResult = await storage.PutObject(
391
+ * 'documents/sample.txt',
392
+ * textContent,
393
+ * 'text/plain'
394
+ * );
395
+ *
396
+ * // Upload a large file using chunked upload
397
+ * const largeFileBuffer = fs.readFileSync('/path/to/large-presentation.pptx');
398
+ * const largeUploadResult = await storage.PutObject(
399
+ * 'presentations/quarterly-results.pptx',
400
+ * largeFileBuffer,
401
+ * 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
402
+ * );
403
+ *
404
+ * if (largeUploadResult) {
405
+ * console.log('Large file uploaded successfully');
406
+ * } else {
407
+ * console.error('Failed to upload large file');
408
+ * }
409
+ * ```
66
410
  */
67
411
  PutObject(objectName: string, data: Buffer, contentType?: string, metadata?: Record<string, string>): Promise<boolean>;
68
412
  /**
69
- * Copy an object
413
+ * Copies a file from one location to another
414
+ *
415
+ * This method creates a copy of a file at a new location. The original file
416
+ * remains unchanged.
417
+ *
418
+ * @param sourceObjectName - Path to the source file (e.g., 'templates/report-template.docx')
419
+ * @param destinationObjectName - Path where the copy should be created (e.g., 'documents/new-report.docx')
420
+ * @returns A Promise that resolves to true if successful, false if an error occurs
421
+ *
422
+ * @remarks
423
+ * - The parent folder of the destination must exist
424
+ * - Both files and folders can be copied
425
+ * - The operation is asynchronous in SharePoint and may not complete immediately
426
+ *
427
+ * @example
428
+ * ```typescript
429
+ * // Copy a file to a new location with a different name
430
+ * const copyResult = await storage.CopyObject(
431
+ * 'templates/financial-report.xlsx',
432
+ * 'reports/2024/q1-financial-report.xlsx'
433
+ * );
434
+ *
435
+ * if (copyResult) {
436
+ * console.log('File copied successfully');
437
+ * } else {
438
+ * console.error('Failed to copy file');
439
+ * }
440
+ * ```
70
441
  */
71
442
  CopyObject(sourceObjectName: string, destinationObjectName: string): Promise<boolean>;
72
443
  /**
73
- * Check if an object exists
444
+ * Checks if a file or folder exists
445
+ *
446
+ * This method verifies whether an object (file or folder) exists at the specified path.
447
+ *
448
+ * @param objectName - Path to check (e.g., 'documents/report.pdf')
449
+ * @returns A Promise that resolves to true if the object exists, false otherwise
450
+ *
451
+ * @example
452
+ * ```typescript
453
+ * // Check if a file exists before attempting to download it
454
+ * const exists = await storage.ObjectExists('presentations/quarterly-update.pptx');
455
+ *
456
+ * if (exists) {
457
+ * // File exists, proceed with download
458
+ * const fileContent = await storage.GetObject('presentations/quarterly-update.pptx');
459
+ * // Process the file...
460
+ * } else {
461
+ * console.log('File does not exist');
462
+ * }
463
+ * ```
74
464
  */
75
465
  ObjectExists(objectName: string): Promise<boolean>;
76
466
  /**
77
- * Check if a directory exists
467
+ * Checks if a directory exists
468
+ *
469
+ * This method verifies whether a folder exists at the specified path.
470
+ * Unlike ObjectExists, this method also checks that the item is a folder.
471
+ *
472
+ * @param directoryPath - Path to check (e.g., 'documents/reports')
473
+ * @returns A Promise that resolves to true if the directory exists, false otherwise
474
+ *
475
+ * @remarks
476
+ * - Returns false if the path exists but points to a file instead of a folder
477
+ * - Trailing slashes in the path are automatically removed
478
+ *
479
+ * @example
480
+ * ```typescript
481
+ * // Check if a directory exists before creating a file in it
482
+ * const dirExists = await storage.DirectoryExists('documents/reports');
483
+ *
484
+ * if (!dirExists) {
485
+ * // Create the directory first
486
+ * await storage.CreateDirectory('documents/reports');
487
+ * }
488
+ *
489
+ * // Now we can safely put a file in this directory
490
+ * await storage.PutObject('documents/reports/annual-summary.pdf', fileContent, 'application/pdf');
491
+ * ```
78
492
  */
79
493
  DirectoryExists(directoryPath: string): Promise<boolean>;
80
494
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SharePointFileStorage.d.ts","sourceRoot":"","sources":["../../src/drivers/SharePointFileStorage.ts"],"names":[],"mappings":";AAKA,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EAEtB,MAAM,4BAA4B,CAAC;AA0DpC,qBACa,qBAAsB,SAAQ,eAAe;IACxD,SAAS,CAAC,QAAQ,CAAC,YAAY,gBAAgB;IAC/C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,aAAa,CAAC,CAAS;;IAqB/B;;;;;OAKG;YACW,wBAAwB;IAwBtC;;;;;OAKG;YACW,cAAc;IAsB5B;;OAEG;IACH,OAAO,CAAC,eAAe;IA6BvB;;OAEG;IACU,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAM/F;;OAEG;IACU,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmB1E;;OAEG;IACU,UAAU,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA6BvF;;OAEG;IACU,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAoB/D;;OAEG;IACU,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO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