gdrivekit 1.1.1 → 1.1.2
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 +5 -2
- package/dist/index.js +28 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -95,9 +95,10 @@ main();
|
|
|
95
95
|
|
|
96
96
|
---
|
|
97
97
|
|
|
98
|
-
### **
|
|
98
|
+
### 🗂️ **Metadata Operations**
|
|
99
99
|
|
|
100
|
-
| Method
|
|
100
|
+
| Method | Description |
|
|
101
|
+
| --------------------- | --------------------------------------- |
|
|
101
102
|
| `getImageMetadata()` | Get image metadata (EXIF data, dimensions, etc.) |
|
|
102
103
|
| `getVideoMetadata()` | Get video metadata (duration, dimensions, etc.) |
|
|
103
104
|
|
|
@@ -178,7 +179,9 @@ main();
|
|
|
178
179
|
| `createJsonFile()` | Create a new JSON file |
|
|
179
180
|
| `readJsonFileData()` | Read JSON file content |
|
|
180
181
|
| `addJsonKeyValue()` | Add a new key-value pair to a JSON file |
|
|
182
|
+
| `pushJsonObjectToArray()` | Push a new object to a JSON array field |
|
|
181
183
|
| `updateJsonFieldAndValues()` | Update an existing field in a JSON file |
|
|
184
|
+
| `selectJsonFieldAndValues()` | Select an existing field in a JSON file |
|
|
182
185
|
| `deleteJsonFieldAndKeys()` | Delete a field from a JSON file |
|
|
183
186
|
|
|
184
187
|
---
|
package/dist/index.js
CHANGED
|
@@ -787760,7 +787760,7 @@ function updateNotifier(options) {
|
|
|
787760
787760
|
// package.json
|
|
787761
787761
|
var package_default = {
|
|
787762
787762
|
name: "gdrivekit",
|
|
787763
|
-
version: "1.1.
|
|
787763
|
+
version: "1.1.2",
|
|
787764
787764
|
description: "A lightweight Google Drive toolkit for File Management. Handle Google Drive operations easily — upload, download, and other file operations in a few lines of code.",
|
|
787765
787765
|
type: "module",
|
|
787766
787766
|
main: "dist/index.js",
|
|
@@ -787817,6 +787817,7 @@ __export(exports_operations, {
|
|
|
787817
787817
|
updateJsonFieldAndValues: () => updateJsonFieldAndValues,
|
|
787818
787818
|
updateFile: () => updateFile,
|
|
787819
787819
|
shareFile: () => shareFile,
|
|
787820
|
+
selectJsonContent: () => selectJsonContent,
|
|
787820
787821
|
searchStarredFiles: () => searchStarredFiles,
|
|
787821
787822
|
searchSharedFiles: () => searchSharedFiles,
|
|
787822
787823
|
searchModifiedAfter: () => searchModifiedAfter,
|
|
@@ -787827,6 +787828,7 @@ __export(exports_operations, {
|
|
|
787827
787828
|
renameFile: () => renameFile,
|
|
787828
787829
|
readJsonFileData: () => readJsonFileData,
|
|
787829
787830
|
readFileData: () => readFileData,
|
|
787831
|
+
pushJsonObjectToArray: () => pushJsonObjectToArray,
|
|
787830
787832
|
moveFileByName: () => moveFileByName,
|
|
787831
787833
|
moveFile: () => moveFile,
|
|
787832
787834
|
listVideos: () => listVideos,
|
|
@@ -787962,8 +787964,8 @@ async function deleteFile(fileId) {
|
|
|
787962
787964
|
async function renameFile(fileId, newName) {
|
|
787963
787965
|
return await driveService.updateFileMetadata(fileId, { name: newName });
|
|
787964
787966
|
}
|
|
787965
|
-
async function updateFile(fileId,
|
|
787966
|
-
return await driveService.updateFileContent(fileId,
|
|
787967
|
+
async function updateFile(fileId, newContent, mimeType) {
|
|
787968
|
+
return await driveService.updateFileContent(fileId, newContent, mimeType);
|
|
787967
787969
|
}
|
|
787968
787970
|
async function getFileInfo(fileId) {
|
|
787969
787971
|
return await driveService.getFileMetadata(fileId);
|
|
@@ -788005,6 +788007,13 @@ async function copyFile(fileId, newName) {
|
|
|
788005
788007
|
async function createJsonFile(jsonContent, name) {
|
|
788006
788008
|
return await driveService.createJsonFile(JSON.stringify(jsonContent), name);
|
|
788007
788009
|
}
|
|
788010
|
+
async function selectJsonContent(fileId) {
|
|
788011
|
+
const data = await driveService.selectJsonContent(fileId);
|
|
788012
|
+
return {
|
|
788013
|
+
success: true,
|
|
788014
|
+
data
|
|
788015
|
+
};
|
|
788016
|
+
}
|
|
788008
788017
|
async function readJsonFileData(fileId) {
|
|
788009
788018
|
const content = await readFileData(fileId);
|
|
788010
788019
|
try {
|
|
@@ -788045,6 +788054,9 @@ async function addJsonKeyValue(fileId, key, value) {
|
|
|
788045
788054
|
return { success: false, error: error.message };
|
|
788046
788055
|
}
|
|
788047
788056
|
}
|
|
788057
|
+
async function pushJsonObjectToArray(fileId, arrayPath, newObject) {
|
|
788058
|
+
return await driveService.pushJsonObjectToArray(fileId, arrayPath, newObject);
|
|
788059
|
+
}
|
|
788048
788060
|
async function deleteJsonFieldAndKeys(fileId, key) {
|
|
788049
788061
|
try {
|
|
788050
788062
|
const readResponse = await driveService.readFileData(fileId, true);
|
|
@@ -788067,10 +788079,18 @@ async function deleteJsonFieldAndKeys(fileId, key) {
|
|
|
788067
788079
|
current = current[part];
|
|
788068
788080
|
}
|
|
788069
788081
|
const lastKey = parts.at(-1);
|
|
788070
|
-
if (
|
|
788071
|
-
|
|
788082
|
+
if (Array.isArray(current)) {
|
|
788083
|
+
const index = parseInt(lastKey, 10);
|
|
788084
|
+
if (isNaN(index) || index < 0 || index >= current.length) {
|
|
788085
|
+
throw new Error(`Invalid array index: ${lastKey}`);
|
|
788086
|
+
}
|
|
788087
|
+
current.splice(index, 1);
|
|
788088
|
+
} else {
|
|
788089
|
+
if (!(lastKey in current)) {
|
|
788090
|
+
throw new Error(`Key '${lastKey}' does not exist`);
|
|
788091
|
+
}
|
|
788092
|
+
delete current[lastKey];
|
|
788072
788093
|
}
|
|
788073
|
-
delete current[lastKey];
|
|
788074
788094
|
const updateResponse = await driveService.updateJsonContent(fileId, jsonData);
|
|
788075
788095
|
if (!updateResponse.success) {
|
|
788076
788096
|
throw new Error(updateResponse.error || "Failed to update file");
|
|
@@ -788414,7 +788434,9 @@ var driveOperations = {
|
|
|
788414
788434
|
getVideoMetadata,
|
|
788415
788435
|
createJsonFile,
|
|
788416
788436
|
readJsonFileData,
|
|
788437
|
+
selectJsonContent,
|
|
788417
788438
|
addJsonKeyValue,
|
|
788439
|
+
pushJsonObjectToArray,
|
|
788418
788440
|
updateJsonFieldAndValues,
|
|
788419
788441
|
deleteJsonFieldAndKeys,
|
|
788420
788442
|
createFolder,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdrivekit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "A lightweight Google Drive toolkit for File Management. Handle Google Drive operations easily — upload, download, and other file operations in a few lines of code.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|