gdrivekit 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/LICENSE +21 -0
- package/README.md +275 -0
- package/dist/auth.d.ts +3 -0
- package/dist/components/01-FileOperation/copyFile.d.ts +6 -0
- package/dist/components/01-FileOperation/deleteFile.d.ts +7 -0
- package/dist/components/01-FileOperation/downloadFile.d.ts +8 -0
- package/dist/components/01-FileOperation/getFileIdByName.d.ts +15 -0
- package/dist/components/01-FileOperation/getFileInfo.d.ts +20 -0
- package/dist/components/01-FileOperation/helpers.d.ts +18 -0
- package/dist/components/01-FileOperation/moveFile.d.ts +6 -0
- package/dist/components/01-FileOperation/readFileData.d.ts +5 -0
- package/dist/components/01-FileOperation/renameFile.d.ts +6 -0
- package/dist/components/01-FileOperation/updateFile.d.ts +8 -0
- package/dist/components/01-FileOperation/uploadFile.d.ts +12 -0
- package/dist/components/02-JsonOperation/addJsonKeyValue.d.ts +13 -0
- package/dist/components/02-JsonOperation/createJsonFile.d.ts +14 -0
- package/dist/components/02-JsonOperation/deleteJsonFieldAndKeys.d.ts +13 -0
- package/dist/components/02-JsonOperation/pushJsonObjectToArray.d.ts +5 -0
- package/dist/components/02-JsonOperation/readJsonFileData.d.ts +5 -0
- package/dist/components/02-JsonOperation/selectJsonContent.d.ts +6 -0
- package/dist/components/02-JsonOperation/updateJsonFieldAndValues.d.ts +13 -0
- package/dist/components/03-FolderOperation/createFolder.d.ts +6 -0
- package/dist/components/03-FolderOperation/deleteFolder.d.ts +7 -0
- package/dist/components/03-FolderOperation/renameFolder.d.ts +6 -0
- package/dist/components/04-SearchOperation/searchByContent.d.ts +5 -0
- package/dist/components/04-SearchOperation/searchByExactName.d.ts +5 -0
- package/dist/components/04-SearchOperation/searchByName.d.ts +5 -0
- package/dist/components/04-SearchOperation/searchByType.d.ts +5 -0
- package/dist/components/04-SearchOperation/searchFiles.d.ts +6 -0
- package/dist/components/04-SearchOperation/searchModifiedAfter.d.ts +5 -0
- package/dist/components/04-SearchOperation/searchSharedFiles.d.ts +4 -0
- package/dist/components/04-SearchOperation/searchStarredFiles.d.ts +4 -0
- package/dist/components/05-ListOperation/getFolderIdByName.d.ts +15 -0
- package/dist/components/05-ListOperation/listAllFolders.d.ts +4 -0
- package/dist/components/05-ListOperation/listArchives.d.ts +4 -0
- package/dist/components/05-ListOperation/listAudios.d.ts +4 -0
- package/dist/components/05-ListOperation/listDocs.d.ts +4 -0
- package/dist/components/05-ListOperation/listFiles.d.ts +5 -0
- package/dist/components/05-ListOperation/listFilesInFolder.d.ts +5 -0
- package/dist/components/05-ListOperation/listFoldersByName.d.ts +5 -0
- package/dist/components/05-ListOperation/listFoldersInFolder.d.ts +5 -0
- package/dist/components/05-ListOperation/listImages.d.ts +4 -0
- package/dist/components/05-ListOperation/listJSONs.d.ts +4 -0
- package/dist/components/05-ListOperation/listPDFs.d.ts +4 -0
- package/dist/components/05-ListOperation/listPresentations.d.ts +4 -0
- package/dist/components/05-ListOperation/listRecentFiles.d.ts +5 -0
- package/dist/components/05-ListOperation/listSheets.d.ts +4 -0
- package/dist/components/05-ListOperation/listVideos.d.ts +4 -0
- package/dist/components/06-BatchOperation/deleteMultipleFiles.d.ts +10 -0
- package/dist/components/06-BatchOperation/downloadMultipleFiles.d.ts +14 -0
- package/dist/components/06-BatchOperation/uploadMultipleFiles.d.ts +9 -0
- package/dist/components/07-UtilityOperation/createStream.d.ts +4 -0
- package/dist/components/07-UtilityOperation/encrypt.d.ts +8 -0
- package/dist/components/07-UtilityOperation/fileUtils.d.ts +20 -0
- package/dist/components/07-UtilityOperation/shareFile.d.ts +4 -0
- package/dist/components/07-UtilityOperation/zip.d.ts +18 -0
- package/dist/components/08-ConversionOperation/convertDocs.d.ts +5 -0
- package/dist/components/08-ConversionOperation/convertDrawing.d.ts +3 -0
- package/dist/components/08-ConversionOperation/convertPdf.d.ts +2 -0
- package/dist/components/08-ConversionOperation/convertSheets.d.ts +5 -0
- package/dist/components/08-ConversionOperation/convertSlides.d.ts +4 -0
- package/dist/components/09-WatcherOperation/watchFolderDeepEvent.d.ts +8 -0
- package/dist/components/09-WatcherOperation/watchFolderEvent.d.ts +8 -0
- package/dist/components/10-ScriptOperation/createGoogleScript.d.ts +29 -0
- package/dist/components/10-ScriptOperation/deleteGoogleScript.d.ts +4 -0
- package/dist/components/10-ScriptOperation/deployGoogleScript.d.ts +7 -0
- package/dist/components/10-ScriptOperation/runGoogleScriptFunction.d.ts +22 -0
- package/dist/components/10-ScriptOperation/updateGoogleScript.d.ts +4 -0
- package/dist/components/index.d.ts +65 -0
- package/dist/const/index.d.ts +34 -0
- package/dist/drivers/Client.d.ts +27 -0
- package/dist/drivers/GoogleDriveService.d.ts +238 -0
- package/dist/drivers/functions/archive/convertFilesAndFoldersToZip.d.ts +16 -0
- package/dist/drivers/functions/conversion/ConversionFunction.d.ts +3 -0
- package/dist/drivers/functions/encryption/decryptText.d.ts +2 -0
- package/dist/drivers/functions/encryption/encryptText.d.ts +2 -0
- package/dist/drivers/functions/files/createStream.d.ts +2 -0
- package/dist/drivers/functions/files/createStreamfilesandFolder.d.ts +2 -0
- package/dist/drivers/functions/files/deleteFile.d.ts +8 -0
- package/dist/drivers/functions/files/downloadFile.d.ts +8 -0
- package/dist/drivers/functions/files/getAllFilesInParent.d.ts +6 -0
- package/dist/drivers/functions/files/getFile.d.ts +6 -0
- package/dist/drivers/functions/files/listFiles.d.ts +6 -0
- package/dist/drivers/functions/files/moveFile.d.ts +3 -0
- package/dist/drivers/functions/files/readFileData.d.ts +4 -0
- package/dist/drivers/functions/files/updateFileContent.d.ts +2 -0
- package/dist/drivers/functions/files/uploadFile.d.ts +6 -0
- package/dist/drivers/functions/folders/createFolder.d.ts +6 -0
- package/dist/drivers/functions/json/addJsonContent.d.ts +3 -0
- package/dist/drivers/functions/json/createJsonFile.d.ts +11 -0
- package/dist/drivers/functions/json/pushJsonObjectToArray.d.ts +2 -0
- package/dist/drivers/functions/json/selectJsonContent.d.ts +2 -0
- package/dist/drivers/functions/json/updateJsonContent.d.ts +3 -0
- package/dist/drivers/functions/metadata/getCompleteFileMetadata.d.ts +3 -0
- package/dist/drivers/functions/metadata/getFileMetadata.d.ts +3 -0
- package/dist/drivers/functions/metadata/getFileTypeBreakdown.d.ts +2 -0
- package/dist/drivers/functions/metadata/getImageMetadata.d.ts +3 -0
- package/dist/drivers/functions/metadata/getVideoMetadata.d.ts +3 -0
- package/dist/drivers/functions/metadata/updateFileMetadata.d.ts +3 -0
- package/dist/drivers/functions/permissions/shareFile.d.ts +3 -0
- package/dist/drivers/functions/scripts/DeployScript.d.ts +13 -0
- package/dist/drivers/functions/scripts/createScriptProject.d.ts +13 -0
- package/dist/drivers/functions/scripts/deleteScriptProject.d.ts +10 -0
- package/dist/drivers/functions/scripts/manageTrigger.d.ts +26 -0
- package/dist/drivers/functions/scripts/runScriptProject.d.ts +6 -0
- package/dist/drivers/functions/scripts/updateScriptProject.d.ts +10 -0
- package/dist/drivers/functions/search/findDuplicate.d.ts +2 -0
- package/dist/drivers/functions/search/searchFiles.d.ts +3 -0
- package/dist/drivers/functions/storage/getStorageQuota.d.ts +3 -0
- package/dist/drivers/functions/utils.d.ts +6 -0
- package/dist/drivers/functions/watcher/watchFolder.d.ts +6 -0
- package/dist/drivers/functions/watcher/watchFolderDeep.d.ts +6 -0
- package/dist/drivers/oauth2-client.d.ts +204 -0
- package/dist/drivers/services.d.ts +37 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +36210 -0
- package/dist/operations.d.ts +330 -0
- package/package.json +62 -0
- package/types/archiver-bypass.d.ts +9 -0
- package/types/archiver-extend.d.ts +0 -0
- package/types/index.d.ts +756 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete multiple files at once
|
|
3
|
+
* @param fileIds - Array of file IDs to delete
|
|
4
|
+
*/
|
|
5
|
+
export declare function deleteMultipleFiles(fileIds: string[]): Promise<{
|
|
6
|
+
fileId: string;
|
|
7
|
+
result: import("../../types").ApiResponse<{
|
|
8
|
+
message: string;
|
|
9
|
+
}>;
|
|
10
|
+
}[]>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Download multiple files at once
|
|
3
|
+
* @param downloads - Array of {fileId, savePath} objects
|
|
4
|
+
*/
|
|
5
|
+
export declare function downloadMultipleFiles(downloads: Array<{
|
|
6
|
+
fileId: string;
|
|
7
|
+
savePath: string;
|
|
8
|
+
}>): Promise<{
|
|
9
|
+
fileId: string;
|
|
10
|
+
savePath: string;
|
|
11
|
+
result: import("../../types").ApiResponse<{
|
|
12
|
+
path: string;
|
|
13
|
+
}>;
|
|
14
|
+
}[]>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upload multiple files at once
|
|
3
|
+
* @param filePaths - Array of file paths to upload
|
|
4
|
+
* @param folderId - Optional: Upload to specific folder
|
|
5
|
+
*/
|
|
6
|
+
export declare function uploadMultipleFiles(filePaths: string[], folderId?: string): Promise<{
|
|
7
|
+
filePath: string;
|
|
8
|
+
result: import("../../types").ApiResponse<import("../../types").FileMetadata>;
|
|
9
|
+
}[]>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encrypts plain text using AES-256-GCM with password-based key derivation.
|
|
3
|
+
*/
|
|
4
|
+
export declare function encryptText(plainText: string, password: string, salt: string): Promise<import("../../types").ApiResponse<string>>;
|
|
5
|
+
/**
|
|
6
|
+
* Decrypts encrypted text using AES-256-GCM with password-based key derivation.
|
|
7
|
+
*/
|
|
8
|
+
export declare function decryptText(encryptedText: string, password: string, salt: string): Promise<import("../../types").ApiResponse<string>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find duplicate files and folders
|
|
3
|
+
*/
|
|
4
|
+
export declare function findDuplicateFilesAndFolders(): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* Get file type breakdown for a folder
|
|
7
|
+
*/
|
|
8
|
+
export declare function getFileTypeBreakdown(parentId?: string): Promise<Record<string, number>>;
|
|
9
|
+
/**
|
|
10
|
+
* Get all files in a parent folder
|
|
11
|
+
*/
|
|
12
|
+
export declare function getAllFilesInParent(parentId: string): Promise<any>;
|
|
13
|
+
/**
|
|
14
|
+
* Check if file exists by name
|
|
15
|
+
*/
|
|
16
|
+
export declare function fileExists(fileName: string): Promise<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* Get storage quota
|
|
19
|
+
*/
|
|
20
|
+
export declare function getStorageQuota(): Promise<import("../../types").ApiResponse<import("../../types").StorageQuota>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert multiple files and folders to a single zip archive
|
|
3
|
+
*/
|
|
4
|
+
export declare function filesAndFoldersToZip(options: {
|
|
5
|
+
folderId?: string;
|
|
6
|
+
fileIds?: string[];
|
|
7
|
+
zipName: string;
|
|
8
|
+
uploadToFolderId?: string;
|
|
9
|
+
password?: string;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
success: boolean;
|
|
12
|
+
data?: {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
webViewLink: string;
|
|
16
|
+
};
|
|
17
|
+
error?: string;
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FileMetadata } from "../../types/index";
|
|
2
|
+
export declare function convertTextToDocs(fileId: string): Promise<FileMetadata>;
|
|
3
|
+
export declare function convertDocsToPdf(fileId: string): Promise<FileMetadata>;
|
|
4
|
+
export declare function convertDocsToWord(fileId: string): Promise<FileMetadata>;
|
|
5
|
+
export declare function convertDocsToText(fileId: string): Promise<FileMetadata>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FileMetadata } from "../../types/index";
|
|
2
|
+
export declare function convertCsvToSheet(fileId: string): Promise<FileMetadata>;
|
|
3
|
+
export declare function convertExcelToSheet(fileId: string): Promise<FileMetadata>;
|
|
4
|
+
export declare function convertSheetToCsv(fileId: string): Promise<FileMetadata>;
|
|
5
|
+
export declare function convertSheetToPdf(fileId: string): Promise<FileMetadata>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FileMetadata } from "../../types/index";
|
|
2
|
+
export declare function convertPptToSlides(fileId: string): Promise<FileMetadata>;
|
|
3
|
+
export declare function convertSlidesToPpt(fileId: string): Promise<FileMetadata>;
|
|
4
|
+
export declare function convertSlidesToPdf(fileId: string): Promise<FileMetadata>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FileMetadata } from "../../types/index";
|
|
2
|
+
/**
|
|
3
|
+
* Watch folder deeply for changes (including subfolders)
|
|
4
|
+
*/
|
|
5
|
+
export declare function watchFolderDeepEvent(folderId: string, intervalMs: number | undefined, callback: (event: {
|
|
6
|
+
type: "added" | "modified" | "deleted";
|
|
7
|
+
file: FileMetadata;
|
|
8
|
+
}) => void): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FileMetadata } from "../../types/index";
|
|
2
|
+
/**
|
|
3
|
+
* Watch folder for changes
|
|
4
|
+
*/
|
|
5
|
+
export declare function watchFolderEvent(folderId: string, intervalMs: number | undefined, callback: (event: {
|
|
6
|
+
type: "added" | "modified" | "deleted";
|
|
7
|
+
file: FileMetadata;
|
|
8
|
+
}) => void): Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new Google Script project
|
|
3
|
+
*/
|
|
4
|
+
export declare const createGoogleScript: {
|
|
5
|
+
/**
|
|
6
|
+
* Create an HTML project.
|
|
7
|
+
* @param title Title of the script project
|
|
8
|
+
* @param htmlContent The content of index.html
|
|
9
|
+
*/
|
|
10
|
+
Html: (title: string, htmlContent: string) => Promise<{
|
|
11
|
+
scriptId: any;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Create an API project.
|
|
15
|
+
* @param title Title of the script project
|
|
16
|
+
* @param code The code containing function apiMain(params) { ... }
|
|
17
|
+
*/
|
|
18
|
+
API: (title: string, code: string) => Promise<{
|
|
19
|
+
scriptId: any;
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Create a generic Function project (RPC style).
|
|
23
|
+
* @param title Title of the script project
|
|
24
|
+
* @param code The code containing your functions
|
|
25
|
+
*/
|
|
26
|
+
Function: (title: string, code: string) => Promise<{
|
|
27
|
+
scriptId: any;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execute a Google Script Web App
|
|
3
|
+
*/
|
|
4
|
+
export declare const runGoogleScript: {
|
|
5
|
+
/**
|
|
6
|
+
* Fetch an HTML page from the script URL
|
|
7
|
+
*/
|
|
8
|
+
Html: (url: string) => Promise<any>;
|
|
9
|
+
/**
|
|
10
|
+
* Call an API endpoint on the script
|
|
11
|
+
*/
|
|
12
|
+
API: (url: string, params?: Record<string, any>) => Promise<any>;
|
|
13
|
+
/**
|
|
14
|
+
* Call a specific function (RPC style)
|
|
15
|
+
*/
|
|
16
|
+
Function: (url: string, functionName: string, params?: Record<string, any>) => Promise<any>;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Legacy support for runGoogleScriptFunction
|
|
20
|
+
* @deprecated Use runGoogleScript.Function instead
|
|
21
|
+
*/
|
|
22
|
+
export declare function runGoogleScriptFunction(url: string, functionName?: string, parameters?: Record<string, any>, projectType?: any): Promise<any>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export { readFileData } from "./01-FileOperation/readFileData";
|
|
2
|
+
export { uploadFile } from "./01-FileOperation/uploadFile";
|
|
3
|
+
export { downloadFile } from "./01-FileOperation/downloadFile";
|
|
4
|
+
export { deleteFile } from "./01-FileOperation/deleteFile";
|
|
5
|
+
export { renameFile } from "./01-FileOperation/renameFile";
|
|
6
|
+
export { updateFile } from "./01-FileOperation/updateFile";
|
|
7
|
+
export { getFileInfo, getCompleteFileInfo, getImageMetadata, getVideoMetadata, } from "./01-FileOperation/getFileInfo";
|
|
8
|
+
export { moveFile } from "./01-FileOperation/moveFile";
|
|
9
|
+
export { copyFile } from "./01-FileOperation/copyFile";
|
|
10
|
+
export { getFileIdByName } from "./01-FileOperation/getFileIdByName";
|
|
11
|
+
export { createJsonFile } from "./02-JsonOperation/createJsonFile";
|
|
12
|
+
export { selectJsonContent } from "./02-JsonOperation/selectJsonContent";
|
|
13
|
+
export { readJsonFileData } from "./02-JsonOperation/readJsonFileData";
|
|
14
|
+
export { addJsonKeyValue } from "./02-JsonOperation/addJsonKeyValue";
|
|
15
|
+
export { pushJsonObjectToArray } from "./02-JsonOperation/pushJsonObjectToArray";
|
|
16
|
+
export { deleteJsonFieldAndKeys } from "./02-JsonOperation/deleteJsonFieldAndKeys";
|
|
17
|
+
export { updateJsonFieldAndValues } from "./02-JsonOperation/updateJsonFieldAndValues";
|
|
18
|
+
export { createFolder } from "./03-FolderOperation/createFolder";
|
|
19
|
+
export { deleteFolder } from "./03-FolderOperation/deleteFolder";
|
|
20
|
+
export { renameFolder } from "./03-FolderOperation/renameFolder";
|
|
21
|
+
export { searchByName } from "./04-SearchOperation/searchByName";
|
|
22
|
+
export { searchByExactName } from "./04-SearchOperation/searchByExactName";
|
|
23
|
+
export { searchByType } from "./04-SearchOperation/searchByType";
|
|
24
|
+
export { searchModifiedAfter } from "./04-SearchOperation/searchModifiedAfter";
|
|
25
|
+
export { searchStarredFiles } from "./04-SearchOperation/searchStarredFiles";
|
|
26
|
+
export { searchSharedFiles } from "./04-SearchOperation/searchSharedFiles";
|
|
27
|
+
export { searchByContent } from "./04-SearchOperation/searchByContent";
|
|
28
|
+
export { searchFiles } from "./04-SearchOperation/searchFiles";
|
|
29
|
+
export { listFoldersByName } from "./05-ListOperation/listFoldersByName";
|
|
30
|
+
export { listAllFolders } from "./05-ListOperation/listAllFolders";
|
|
31
|
+
export { listFoldersInFolder } from "./05-ListOperation/listFoldersInFolder";
|
|
32
|
+
export { listFilesInFolder } from "./05-ListOperation/listFilesInFolder";
|
|
33
|
+
export { getFolderIdByName } from "./05-ListOperation/getFolderIdByName";
|
|
34
|
+
export { listFiles } from "./05-ListOperation/listFiles";
|
|
35
|
+
export { listRecentFiles } from "./05-ListOperation/listRecentFiles";
|
|
36
|
+
export { listPDFs } from "./05-ListOperation/listPDFs";
|
|
37
|
+
export { listImages } from "./05-ListOperation/listImages";
|
|
38
|
+
export { listVideos } from "./05-ListOperation/listVideos";
|
|
39
|
+
export { listAudios } from "./05-ListOperation/listAudios";
|
|
40
|
+
export { listArchives } from "./05-ListOperation/listArchives";
|
|
41
|
+
export { listJSONs } from "./05-ListOperation/listJSONs";
|
|
42
|
+
export { listSheets } from "./05-ListOperation/listSheets";
|
|
43
|
+
export { listPresentations } from "./05-ListOperation/listPresentations";
|
|
44
|
+
export { listDocs } from "./05-ListOperation/listDocs";
|
|
45
|
+
export { uploadMultipleFiles } from "./06-BatchOperation/uploadMultipleFiles";
|
|
46
|
+
export { deleteMultipleFiles } from "./06-BatchOperation/deleteMultipleFiles";
|
|
47
|
+
export { downloadMultipleFiles } from "./06-BatchOperation/downloadMultipleFiles";
|
|
48
|
+
export { encryptText, decryptText } from "./07-UtilityOperation/encrypt";
|
|
49
|
+
export { filesAndFoldersToZip } from "./07-UtilityOperation/zip";
|
|
50
|
+
export { findDuplicateFilesAndFolders, getFileTypeBreakdown, getAllFilesInParent, fileExists, getStorageQuota, } from "./07-UtilityOperation/fileUtils";
|
|
51
|
+
export { shareFile } from "./07-UtilityOperation/shareFile";
|
|
52
|
+
export { createStream } from "./07-UtilityOperation/createStream";
|
|
53
|
+
export { convertTextToDocs, convertDocsToPdf, convertDocsToWord, convertDocsToText, } from "./08-ConversionOperation/convertDocs";
|
|
54
|
+
export { convertCsvToSheet, convertExcelToSheet, convertSheetToCsv, convertSheetToPdf, } from "./08-ConversionOperation/convertSheets";
|
|
55
|
+
export { convertPptToSlides, convertSlidesToPpt, convertSlidesToPdf, } from "./08-ConversionOperation/convertSlides";
|
|
56
|
+
export { convertPdfToDocs } from "./08-ConversionOperation/convertPdf";
|
|
57
|
+
export { convertDrawingToPng, convertDrawingToPdf, } from "./08-ConversionOperation/convertDrawing";
|
|
58
|
+
export { watchFolderEvent } from "./09-WatcherOperation/watchFolderEvent";
|
|
59
|
+
export { watchFolderDeepEvent } from "./09-WatcherOperation/watchFolderDeepEvent";
|
|
60
|
+
export { createGoogleScript } from "./10-ScriptOperation/createGoogleScript";
|
|
61
|
+
export { updateGoogleScript } from "./10-ScriptOperation/updateGoogleScript";
|
|
62
|
+
export { deleteGoogleScript } from "./10-ScriptOperation/deleteGoogleScript";
|
|
63
|
+
export { deployGoogleScript } from "./10-ScriptOperation/deployGoogleScript";
|
|
64
|
+
export { runGoogleScript, runGoogleScriptFunction, } from "./10-ScriptOperation/runGoogleScriptFunction";
|
|
65
|
+
export type { ScriptProjectType } from "../drivers/functions/scripts/createScriptProject";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const DRIVE_API_BASE = "https://www.googleapis.com/drive/v3";
|
|
2
|
+
export declare const DRIVE_UPLOAD_BASE = "https://www.googleapis.com/upload/drive/v3";
|
|
3
|
+
export declare const SCRIPT_API_BASE = "https://script.googleapis.com/v1";
|
|
4
|
+
export declare const MIME_TYPES: {
|
|
5
|
+
readonly FOLDER: "application/vnd.google-apps.folder";
|
|
6
|
+
readonly DOCUMENT: "application/vnd.google-apps.document";
|
|
7
|
+
readonly SPREADSHEET: "application/vnd.google-apps.spreadsheet";
|
|
8
|
+
readonly PRESENTATION: "application/vnd.google-apps.presentation";
|
|
9
|
+
readonly FORM: "application/vnd.google-apps.form";
|
|
10
|
+
readonly DRAWING: "application/vnd.google-apps.drawing";
|
|
11
|
+
readonly PDF: "application/pdf";
|
|
12
|
+
readonly WORD: "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
13
|
+
readonly EXCEL: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
14
|
+
readonly POWERPOINT: "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
15
|
+
readonly TEXT: "text/plain";
|
|
16
|
+
readonly CSV: "text/csv";
|
|
17
|
+
readonly JSON: "application/json";
|
|
18
|
+
readonly JPEG: "image/jpeg";
|
|
19
|
+
readonly PNG: "image/png";
|
|
20
|
+
readonly GIF: "image/gif";
|
|
21
|
+
readonly SVG: "image/svg+xml";
|
|
22
|
+
readonly MP4: "video/mp4";
|
|
23
|
+
readonly AVI: "video/x-msvideo";
|
|
24
|
+
readonly MKV: "video/x-matroska";
|
|
25
|
+
readonly WEBM: "video/webm";
|
|
26
|
+
readonly MP3: "audio/mpeg";
|
|
27
|
+
readonly WAV: "audio/wav";
|
|
28
|
+
readonly ZIP: "application/zip";
|
|
29
|
+
readonly RAR: "application/x-rar-compressed";
|
|
30
|
+
readonly APPSCRIPT: "application/vnd.google-apps.script";
|
|
31
|
+
};
|
|
32
|
+
export declare const SCOPES: string[];
|
|
33
|
+
export declare const buildMimeLabels: (mimeTypes: Record<string, string>) => Record<string, string>;
|
|
34
|
+
export declare const MIME_LABELS: Record<string, string>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native fetch wrapper - drop-in replacement for JirenClient
|
|
3
|
+
* Uses Bun's optimized native fetch for best performance
|
|
4
|
+
*/
|
|
5
|
+
export interface HttpResponse extends Response {
|
|
6
|
+
json<T = any>(): Promise<T>;
|
|
7
|
+
}
|
|
8
|
+
type RequestBody = string | FormData | Blob | ArrayBuffer | null;
|
|
9
|
+
type RequestHeaders = Record<string, string>;
|
|
10
|
+
export declare const client: {
|
|
11
|
+
get: (url: string, opts?: {
|
|
12
|
+
headers?: RequestHeaders;
|
|
13
|
+
}) => Promise<HttpResponse>;
|
|
14
|
+
post: (url: string, body?: RequestBody, opts?: {
|
|
15
|
+
headers?: RequestHeaders;
|
|
16
|
+
}) => Promise<HttpResponse>;
|
|
17
|
+
patch: (url: string, body?: RequestBody, opts?: {
|
|
18
|
+
headers?: RequestHeaders;
|
|
19
|
+
}) => Promise<HttpResponse>;
|
|
20
|
+
delete: (url: string, opts?: {
|
|
21
|
+
headers?: RequestHeaders;
|
|
22
|
+
}) => Promise<HttpResponse>;
|
|
23
|
+
put: (url: string, body?: RequestBody, opts?: {
|
|
24
|
+
headers?: RequestHeaders;
|
|
25
|
+
}) => Promise<HttpResponse>;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { GoogleCredentials, TokenData, ListFilesParams, UploadFileMetadata, ApiResponse, FileMetadata, ListFilesResponse, ImageMediaMetadata, VideoMediaMetadata, StorageQuota } from "../types/index";
|
|
2
|
+
import { ScriptProjectType } from "./functions/scripts/createScriptProject";
|
|
3
|
+
export interface DriveServiceOptions {
|
|
4
|
+
/** Path to tokens file (default: ./tokens.json) */
|
|
5
|
+
tokensPath?: string;
|
|
6
|
+
/** Whether to auto-save tokens to file (default: true) */
|
|
7
|
+
autoSaveToFile?: boolean;
|
|
8
|
+
/** Callback when tokens are refreshed - use this for custom persistence in SSR/serverless */
|
|
9
|
+
onTokensRefresh?: (tokens: TokenData) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare class GoogleDriveService {
|
|
12
|
+
private oauth2;
|
|
13
|
+
constructor(credentials: GoogleCredentials, options?: DriveServiceOptions);
|
|
14
|
+
/**
|
|
15
|
+
* Set credentials and enable auto-refresh
|
|
16
|
+
*/
|
|
17
|
+
setCredentials(tokens: TokenData): void;
|
|
18
|
+
/**
|
|
19
|
+
* Set callback for when tokens are refreshed
|
|
20
|
+
* This is the recommended way to persist tokens in SSR/serverless environments
|
|
21
|
+
*/
|
|
22
|
+
onTokensRefreshed(callback: (tokens: TokenData) => void): void;
|
|
23
|
+
/**
|
|
24
|
+
* Check if the current token is expired or about to expire
|
|
25
|
+
*/
|
|
26
|
+
isTokenExpired(bufferMinutes?: number): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Get current tokens (useful for persistence)
|
|
29
|
+
*/
|
|
30
|
+
getTokens(): TokenData;
|
|
31
|
+
/**
|
|
32
|
+
* Manually trigger token refresh
|
|
33
|
+
*/
|
|
34
|
+
refreshToken(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Get File
|
|
37
|
+
*/
|
|
38
|
+
getFile(fileId: string): Promise<ApiResponse<FileMetadata>>;
|
|
39
|
+
/**
|
|
40
|
+
* Move file to a different folder
|
|
41
|
+
*/
|
|
42
|
+
moveFile(fileId: string, newFolderId: string): Promise<ApiResponse<FileMetadata>>;
|
|
43
|
+
/**
|
|
44
|
+
* Read file data directly (returns Buffer or text)
|
|
45
|
+
*/
|
|
46
|
+
readFileData(fileId: string, asText?: boolean): Promise<ApiResponse<string | Buffer>>;
|
|
47
|
+
/**
|
|
48
|
+
* List files in Google Drive
|
|
49
|
+
*/
|
|
50
|
+
listFiles(params?: ListFilesParams): Promise<ApiResponse<ListFilesResponse>>;
|
|
51
|
+
/**
|
|
52
|
+
* Get file metadata
|
|
53
|
+
*/
|
|
54
|
+
getFileMetadata(fileId: string): Promise<ApiResponse<FileMetadata>>;
|
|
55
|
+
/**
|
|
56
|
+
* Download file to local storage
|
|
57
|
+
*/
|
|
58
|
+
downloadFile(fileId: string, destPath: string): Promise<ApiResponse<{
|
|
59
|
+
path: string;
|
|
60
|
+
}>>;
|
|
61
|
+
/**
|
|
62
|
+
* Upload file to Google Drive (multipart upload)
|
|
63
|
+
*/
|
|
64
|
+
uploadFile(filePath: string, metadata?: UploadFileMetadata): Promise<ApiResponse<FileMetadata>>;
|
|
65
|
+
/**
|
|
66
|
+
* Update file content
|
|
67
|
+
*/
|
|
68
|
+
updateFileContent(fileId: string, content: string, mimeType: string): Promise<any>;
|
|
69
|
+
/**
|
|
70
|
+
* Update file metadata
|
|
71
|
+
*/
|
|
72
|
+
updateFileMetadata(fileId: string, metadata: Partial<FileMetadata>): Promise<ApiResponse<FileMetadata>>;
|
|
73
|
+
/**
|
|
74
|
+
* Delete file from Google Drive
|
|
75
|
+
*/
|
|
76
|
+
deleteFile(fileId: string): Promise<ApiResponse<{
|
|
77
|
+
message: string;
|
|
78
|
+
}>>;
|
|
79
|
+
/**
|
|
80
|
+
* Create folder in Google Drive
|
|
81
|
+
*/
|
|
82
|
+
createFolder(folderName: string, parentFolderId?: string): Promise<ApiResponse<FileMetadata>>;
|
|
83
|
+
/**
|
|
84
|
+
* Update JSON file content directly (without needing local file)
|
|
85
|
+
*/
|
|
86
|
+
updateJsonContent(fileId: string, jsonData: Record<string, any>): Promise<ApiResponse<FileMetadata>>;
|
|
87
|
+
/**
|
|
88
|
+
* Add a new key-value pair to a JSON file in Google Drive.
|
|
89
|
+
* If the key already exists, it will be overwritten.
|
|
90
|
+
*/
|
|
91
|
+
addJsonContent(fileId: string, key: string, value: any): Promise<ApiResponse<FileMetadata>>;
|
|
92
|
+
/**
|
|
93
|
+
* Search files by query
|
|
94
|
+
*/
|
|
95
|
+
searchFiles(searchQuery: string, pageSize?: number): Promise<ApiResponse<ListFilesResponse>>;
|
|
96
|
+
/**
|
|
97
|
+
* Get image metadata for a file
|
|
98
|
+
*/
|
|
99
|
+
getImageMetadata(fileId: string): Promise<ApiResponse<ImageMediaMetadata>>;
|
|
100
|
+
/**
|
|
101
|
+
* Get video metadata for a file
|
|
102
|
+
*/
|
|
103
|
+
getVideoMetadata(fileId: string): Promise<ApiResponse<VideoMediaMetadata>>;
|
|
104
|
+
/**
|
|
105
|
+
* Create a JSON file on Google Drive
|
|
106
|
+
*/
|
|
107
|
+
createJsonFile(jsonContent: string, name: string): Promise<{
|
|
108
|
+
success: boolean;
|
|
109
|
+
data: FileMetadata;
|
|
110
|
+
error?: undefined;
|
|
111
|
+
} | {
|
|
112
|
+
success: boolean;
|
|
113
|
+
error: string;
|
|
114
|
+
data?: undefined;
|
|
115
|
+
}>;
|
|
116
|
+
/**
|
|
117
|
+
* Get complete file metadata including image/video metadata
|
|
118
|
+
*/
|
|
119
|
+
getCompleteFileMetadata(fileId: string): Promise<ApiResponse<FileMetadata>>;
|
|
120
|
+
/**
|
|
121
|
+
* Get storageQuota
|
|
122
|
+
*/
|
|
123
|
+
getStorageQuota(): Promise<ApiResponse<StorageQuota>>;
|
|
124
|
+
/**
|
|
125
|
+
* Share File
|
|
126
|
+
*/
|
|
127
|
+
shareFile(fileId: string, emailAddress: string, role?: string): Promise<ApiResponse<void>>;
|
|
128
|
+
/**
|
|
129
|
+
* Convert Regular File to Google Docs
|
|
130
|
+
*/
|
|
131
|
+
ConversionFunction(fileId: string, targetMimeType: string): Promise<ApiResponse<FileMetadata>>;
|
|
132
|
+
/**
|
|
133
|
+
* Create stream for any Google Drive file (audio, video, image, doc, etc.)
|
|
134
|
+
*/
|
|
135
|
+
createStream(fileId: string, targetMimeType?: string): Promise<NodeJS.ReadableStream | null>;
|
|
136
|
+
/**
|
|
137
|
+
* Select json key value from google drive file
|
|
138
|
+
*/
|
|
139
|
+
selectJsonContent(fileId: string): Promise<any>;
|
|
140
|
+
pushJsonObjectToArray(fileId: string, arrayPath: string, newObject: any): Promise<any>;
|
|
141
|
+
/**
|
|
142
|
+
* Zip a Drive folder (supports nested folders, password, and same-level saving)
|
|
143
|
+
**/
|
|
144
|
+
convertFilesAndFoldersToZip(options: {
|
|
145
|
+
folderId?: string;
|
|
146
|
+
fileIds?: string[];
|
|
147
|
+
zipName: string;
|
|
148
|
+
uploadToFolderId?: string;
|
|
149
|
+
password?: string;
|
|
150
|
+
}): Promise<{
|
|
151
|
+
success: boolean;
|
|
152
|
+
data?: {
|
|
153
|
+
id: string;
|
|
154
|
+
name: string;
|
|
155
|
+
webViewLink: string;
|
|
156
|
+
};
|
|
157
|
+
error?: string;
|
|
158
|
+
}>;
|
|
159
|
+
createStreamfilesandFolder(fileId: string): Promise<NodeJS.ReadableStream | null>;
|
|
160
|
+
/**
|
|
161
|
+
* Finds and logs duplicate file and folder names in Drive (console-only version).
|
|
162
|
+
*/
|
|
163
|
+
findDuplicate(): Promise<void>;
|
|
164
|
+
/**
|
|
165
|
+
* Encrypt plain text with password + salt using AES-256-GCM
|
|
166
|
+
* Returns base64(iv + authTag + ciphertext)
|
|
167
|
+
*/
|
|
168
|
+
encryptText(plainText: string, password: string, salt: string): Promise<ApiResponse<string>>;
|
|
169
|
+
/**
|
|
170
|
+
* Decrypt text using same password + salt
|
|
171
|
+
* Input must be base64(iv + authTag + ciphertext)
|
|
172
|
+
*/
|
|
173
|
+
decryptText(encryptedBase64: string, password: string, salt: string): Promise<ApiResponse<string>>;
|
|
174
|
+
getFileTypeBreakdown(parentId?: string): Promise<Record<string, number>>;
|
|
175
|
+
getAllFilesInParent(parentId: string): Promise<Array<{
|
|
176
|
+
name: string;
|
|
177
|
+
id: string;
|
|
178
|
+
mimeType: string;
|
|
179
|
+
}>>;
|
|
180
|
+
/**
|
|
181
|
+
* Watch a single Google Drive folder (NON-recursive)
|
|
182
|
+
* Detects file add / modify / delete
|
|
183
|
+
*/
|
|
184
|
+
watchFolder(folderId: string, intervalMs: number | undefined, callback: (event: {
|
|
185
|
+
type: "added" | "modified" | "deleted";
|
|
186
|
+
file: FileMetadata;
|
|
187
|
+
}) => void): Promise<void>;
|
|
188
|
+
/**
|
|
189
|
+
* Recursive folder watcher (subfolders included)
|
|
190
|
+
* Detects EVERYTHING happening inside the folder tree.
|
|
191
|
+
*/
|
|
192
|
+
watchFolderDeep(folderId: string, intervalMs: number | undefined, callback: (event: {
|
|
193
|
+
type: "added" | "modified" | "deleted";
|
|
194
|
+
file: FileMetadata;
|
|
195
|
+
}) => void): Promise<void>;
|
|
196
|
+
createScriptProject(title: string, code: string, projectType?: ScriptProjectType): Promise<{
|
|
197
|
+
success: boolean;
|
|
198
|
+
data: {
|
|
199
|
+
scriptId: any;
|
|
200
|
+
};
|
|
201
|
+
error?: undefined;
|
|
202
|
+
} | {
|
|
203
|
+
success: boolean;
|
|
204
|
+
error: any;
|
|
205
|
+
data?: undefined;
|
|
206
|
+
}>;
|
|
207
|
+
updateScriptProject(scriptId: string, files: any[]): Promise<{
|
|
208
|
+
success: boolean;
|
|
209
|
+
data: any;
|
|
210
|
+
error?: undefined;
|
|
211
|
+
} | {
|
|
212
|
+
success: boolean;
|
|
213
|
+
error: any;
|
|
214
|
+
data?: undefined;
|
|
215
|
+
}>;
|
|
216
|
+
deleteScriptProject(scriptId: string): Promise<{
|
|
217
|
+
success: boolean;
|
|
218
|
+
data: string;
|
|
219
|
+
error?: undefined;
|
|
220
|
+
} | {
|
|
221
|
+
success: boolean;
|
|
222
|
+
error: any;
|
|
223
|
+
data?: undefined;
|
|
224
|
+
}>;
|
|
225
|
+
DeployScript(scriptId: string): Promise<{
|
|
226
|
+
success: boolean;
|
|
227
|
+
data: {
|
|
228
|
+
deploymentId: any;
|
|
229
|
+
webAppUrl: any;
|
|
230
|
+
};
|
|
231
|
+
error?: undefined;
|
|
232
|
+
} | {
|
|
233
|
+
success: boolean;
|
|
234
|
+
error: any;
|
|
235
|
+
data?: undefined;
|
|
236
|
+
}>;
|
|
237
|
+
runScriptProject(url: string, functionName?: string, parameters?: Record<string, any>, projectType?: ScriptProjectType): Promise<any>;
|
|
238
|
+
}
|