react-native-cloud-storage 2.3.0 → 3.0.1
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 +1 -1
- package/android/build.gradle +1 -14
- package/android/src/main/java/com/voicekit/CloudStorageLocalFileSystemModule.kt +16 -20
- package/android/src/main/java/com/voicekit/CloudStoragePackage.kt +23 -8
- package/dist/commonjs/cloud-storage.js +68 -31
- package/dist/commonjs/cloud-storage.js.map +1 -1
- package/dist/commonjs/specs/NativeCloudStorageCloudKitIOS.js +9 -0
- package/dist/commonjs/specs/NativeCloudStorageCloudKitIOS.js.map +1 -0
- package/dist/commonjs/specs/NativeCloudStorageLocalFileSystem.js +9 -0
- package/dist/commonjs/specs/NativeCloudStorageLocalFileSystem.js.map +1 -0
- package/dist/commonjs/storages/cloudkit.js +5 -3
- package/dist/commonjs/storages/cloudkit.js.map +1 -1
- package/dist/commonjs/storages/google-drive/client.js +3 -2
- package/dist/commonjs/storages/google-drive/client.js.map +1 -1
- package/dist/commonjs/storages/google-drive/index.js +99 -77
- package/dist/commonjs/storages/google-drive/index.js.map +1 -1
- package/dist/commonjs/types/main.js +18 -1
- package/dist/commonjs/types/main.js.map +1 -1
- package/dist/commonjs/utils/constants.js +2 -1
- package/dist/commonjs/utils/constants.js.map +1 -1
- package/dist/commonjs/utils/local-fs.js +3 -2
- package/dist/commonjs/utils/local-fs.js.map +1 -1
- package/dist/commonjs/utils/native.js.map +1 -1
- package/dist/module/cloud-storage.js +70 -33
- package/dist/module/cloud-storage.js.map +1 -1
- package/dist/module/specs/NativeCloudStorageCloudKitIOS.js +5 -0
- package/dist/module/specs/NativeCloudStorageCloudKitIOS.js.map +1 -0
- package/dist/module/specs/NativeCloudStorageLocalFileSystem.js +5 -0
- package/dist/module/specs/NativeCloudStorageLocalFileSystem.js.map +1 -0
- package/dist/module/storages/cloudkit.js +3 -2
- package/dist/module/storages/cloudkit.js.map +1 -1
- package/dist/module/storages/google-drive/client.js +3 -2
- package/dist/module/storages/google-drive/client.js.map +1 -1
- package/dist/module/storages/google-drive/index.js +99 -77
- package/dist/module/storages/google-drive/index.js.map +1 -1
- package/dist/module/types/main.js +21 -1
- package/dist/module/types/main.js.map +1 -1
- package/dist/module/utils/constants.js +2 -1
- package/dist/module/utils/constants.js.map +1 -1
- package/dist/module/utils/local-fs.js +2 -2
- package/dist/module/utils/local-fs.js.map +1 -1
- package/dist/module/utils/native.js.map +1 -1
- package/dist/typescript/cloud-storage.d.ts +15 -6
- package/dist/typescript/cloud-storage.d.ts.map +1 -1
- package/dist/typescript/specs/NativeCloudStorageCloudKitIOS.d.ts +30 -0
- package/dist/typescript/specs/NativeCloudStorageCloudKitIOS.d.ts.map +1 -0
- package/dist/typescript/specs/NativeCloudStorageLocalFileSystem.d.ts +24 -0
- package/dist/typescript/specs/NativeCloudStorageLocalFileSystem.d.ts.map +1 -0
- package/dist/typescript/storages/cloudkit.d.ts +3 -0
- package/dist/typescript/storages/cloudkit.d.ts.map +1 -1
- package/dist/typescript/storages/google-drive/client.d.ts +1 -1
- package/dist/typescript/storages/google-drive/client.d.ts.map +1 -1
- package/dist/typescript/storages/google-drive/index.d.ts +7 -1
- package/dist/typescript/storages/google-drive/index.d.ts.map +1 -1
- package/dist/typescript/types/main.d.ts +27 -0
- package/dist/typescript/types/main.d.ts.map +1 -1
- package/dist/typescript/types/native.d.ts +6 -43
- package/dist/typescript/types/native.d.ts.map +1 -1
- package/dist/typescript/utils/constants.d.ts.map +1 -1
- package/dist/typescript/utils/local-fs.d.ts +1 -2
- package/dist/typescript/utils/local-fs.d.ts.map +1 -1
- package/dist/typescript/utils/native.d.ts +1 -1
- package/dist/typescript/utils/native.d.ts.map +1 -1
- package/ios/CloudStorage-Bridging-Header.h +0 -1
- package/ios/CloudStorageCloudKit.swift +15 -14
- package/ios/CloudStorageLocalFileSystem.swift +7 -6
- package/ios/RCTCloudStorageCloudKit.mm +218 -0
- package/ios/RCTCloudStorageLocalFileSystem.mm +149 -0
- package/ios/Utils/CloudKitUtils.swift +8 -2
- package/ios/Utils/FileUtils.swift +2 -4
- package/ios/Utils/Promise.swift +1 -0
- package/ios/Utils/Types.swift +1 -0
- package/ios/react_native_cloud_storage.h +6 -0
- package/package.json +31 -17
- package/react-native-cloud-storage.podspec +2 -0
- package/src/cloud-storage.ts +98 -50
- package/src/specs/NativeCloudStorageCloudKitIOS.ts +33 -0
- package/src/specs/NativeCloudStorageLocalFileSystem.ts +28 -0
- package/src/storages/cloudkit.ts +10 -2
- package/src/storages/google-drive/client.ts +2 -1
- package/src/storages/google-drive/index.ts +126 -120
- package/src/types/main.ts +29 -1
- package/src/types/native.ts +10 -54
- package/src/utils/constants.ts +1 -0
- package/src/utils/local-fs.ts +2 -2
- package/src/utils/native.ts +1 -1
- package/ios/CloudStorageCloudKit.m +0 -24
- package/ios/CloudStorageEventEmitter.m +0 -16
- package/ios/CloudStorageEventEmitter.swift +0 -30
- package/ios/CloudStorageLocalFileSystem.m +0 -15
|
@@ -39,12 +39,19 @@ export default class GoogleDrive {
|
|
|
39
39
|
{
|
|
40
40
|
return 'drive';
|
|
41
41
|
}
|
|
42
|
+
case 'documents_legacy':
|
|
43
|
+
{
|
|
44
|
+
return 'drive';
|
|
45
|
+
}
|
|
42
46
|
case 'app_data':
|
|
43
47
|
{
|
|
44
48
|
return 'appDataFolder';
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
}
|
|
52
|
+
isRootPath(path) {
|
|
53
|
+
return path === '' || path === '/';
|
|
54
|
+
}
|
|
48
55
|
resolvePathToDirectories(path) {
|
|
49
56
|
if (path.startsWith('/')) path = path.slice(1);
|
|
50
57
|
if (path.endsWith('/')) path = path.slice(0, -1);
|
|
@@ -55,83 +62,94 @@ export default class GoogleDrive {
|
|
|
55
62
|
filename: actualFilename
|
|
56
63
|
};
|
|
57
64
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/* when multiple directories carry the same name, we need to check every one of them if their parent id exists in
|
|
65
|
-
the files array - if it does not, it means that the directory is a child of the root directory and the one we're
|
|
66
|
-
looking for */
|
|
67
|
-
for (const possibleTopDirectory of possibleTopDirectories) {
|
|
68
|
-
if (!files.some(f => f.id === possibleTopDirectory.parents[0] && f.mimeType === MimeTypes.FOLDER)) {
|
|
69
|
-
topDirectoryId = possibleTopDirectory.id;
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (!topDirectoryId) {
|
|
75
|
-
throw new CloudStorageError(`Could not find top directory with name ${directoryTree[0]}`, NativeCloudStorageErrorCode.DIRECTORY_NOT_FOUND);
|
|
65
|
+
escapeDriveQueryValue(value) {
|
|
66
|
+
return value.replaceAll('\\', String.raw`\\`).replaceAll("'", String.raw`\'`);
|
|
67
|
+
}
|
|
68
|
+
async getQueryRootParentId(scope) {
|
|
69
|
+
if (scope === 'app_data') {
|
|
70
|
+
return this.getRootDirectory(scope);
|
|
76
71
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
72
|
+
return this.getRootDirectoryId(scope);
|
|
73
|
+
}
|
|
74
|
+
async findDirectoryByNameAndParent(name, parentId, scope) {
|
|
75
|
+
const escapedName = this.escapeDriveQueryValue(name);
|
|
76
|
+
const escapedParentId = this.escapeDriveQueryValue(parentId);
|
|
77
|
+
const query = `name = '${escapedName}' and '${escapedParentId}' in parents and mimeType = '${MimeTypes.FOLDER}' and trashed = false`;
|
|
78
|
+
return this.drive.listFiles(this.getRootDirectory(scope), query);
|
|
79
|
+
}
|
|
80
|
+
async findFilesByNameAndParent(name, parentId, scope) {
|
|
81
|
+
const escapedName = this.escapeDriveQueryValue(name);
|
|
82
|
+
const escapedParentId = this.escapeDriveQueryValue(parentId);
|
|
83
|
+
const query = `name = '${escapedName}' and '${escapedParentId}' in parents and trashed = false`;
|
|
84
|
+
return this.drive.listFiles(this.getRootDirectory(scope), query);
|
|
85
|
+
}
|
|
86
|
+
async findFilesByParent(parentId, scope) {
|
|
87
|
+
const escapedParentId = this.escapeDriveQueryValue(parentId);
|
|
88
|
+
const query = `'${escapedParentId}' in parents and trashed = false`;
|
|
89
|
+
return this.drive.listFiles(this.getRootDirectory(scope), query);
|
|
90
|
+
}
|
|
91
|
+
async findParentDirectoryId(directoryTree, scope) {
|
|
92
|
+
let parentDirectoryId = await this.getQueryRootParentId(scope);
|
|
93
|
+
for (const directoryName of directoryTree) {
|
|
94
|
+
const directories = await this.findDirectoryByNameAndParent(directoryName, parentDirectoryId, scope);
|
|
95
|
+
if (directories.length === 0) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
parentDirectoryId = directories[0].id;
|
|
86
99
|
}
|
|
87
|
-
return
|
|
100
|
+
return parentDirectoryId;
|
|
88
101
|
}
|
|
89
102
|
|
|
90
103
|
/**
|
|
91
104
|
* Gets the Google Drive ID of the root directory for the given scope.
|
|
92
105
|
* @param scope The scope to get the root directory for.
|
|
93
|
-
* @returns A promise that resolves to the ID of the root directory
|
|
106
|
+
* @returns A promise that resolves to the ID of the root directory.
|
|
94
107
|
*/
|
|
95
108
|
async getRootDirectoryId(scope) {
|
|
109
|
+
if (scope !== 'app_data') {
|
|
110
|
+
return 'root';
|
|
111
|
+
}
|
|
96
112
|
const files = await this.drive.listFiles(this.getRootDirectory(scope));
|
|
97
113
|
for (const file of files) {
|
|
98
|
-
|
|
114
|
+
const parentId = file.parents?.[0];
|
|
115
|
+
if (parentId && !files.some(candidate => candidate.id === parentId)) {
|
|
116
|
+
return parentId;
|
|
117
|
+
}
|
|
99
118
|
}
|
|
100
|
-
return
|
|
119
|
+
return this.getRootDirectory(scope);
|
|
101
120
|
}
|
|
102
|
-
checkIfMultipleFilesWithSameName(path, files
|
|
121
|
+
checkIfMultipleFilesWithSameName(path, files) {
|
|
103
122
|
const {
|
|
104
123
|
strictFilenames
|
|
105
124
|
} = this.options;
|
|
106
|
-
|
|
107
|
-
if (possibleFiles.length <= 1) return;
|
|
125
|
+
if (files.length <= 1) return;
|
|
108
126
|
if (strictFilenames) {
|
|
109
|
-
throw new CloudStorageError(`Multiple files with the same name found at path ${path}: ${
|
|
127
|
+
throw new CloudStorageError(`Multiple files with the same name found at path ${path}: ${files.map(f => f.id).join(', ')}`, NativeCloudStorageErrorCode.MULTIPLE_FILES_SAME_NAME);
|
|
110
128
|
}
|
|
111
129
|
}
|
|
112
130
|
async getFileId(path, scope, throwIf = false) {
|
|
113
131
|
try {
|
|
114
|
-
|
|
115
|
-
|
|
132
|
+
if (this.isRootPath(path)) {
|
|
133
|
+
if (throwIf === 'directory') {
|
|
134
|
+
throw new CloudStorageError(`Path ${path} is a directory`, NativeCloudStorageErrorCode.PATH_IS_DIRECTORY);
|
|
135
|
+
}
|
|
116
136
|
const rootDirectoryId = await this.getRootDirectoryId(scope);
|
|
117
|
-
if (
|
|
137
|
+
if (scope !== 'app_data') {
|
|
138
|
+
await this.drive.getFile(rootDirectoryId);
|
|
139
|
+
}
|
|
118
140
|
return rootDirectoryId;
|
|
119
141
|
}
|
|
120
142
|
const {
|
|
121
143
|
directories,
|
|
122
144
|
filename
|
|
123
145
|
} = this.resolvePathToDirectories(path);
|
|
124
|
-
const parentDirectoryId = this.findParentDirectoryId(
|
|
125
|
-
let file;
|
|
146
|
+
const parentDirectoryId = await this.findParentDirectoryId(directories, scope);
|
|
126
147
|
if (parentDirectoryId === null) {
|
|
127
|
-
|
|
128
|
-
/* when the file is supposed to be in the root directory, we need to get the file where the name is the filename
|
|
129
|
-
and the first parent has an id which does not exist in the files array */
|
|
130
|
-
file = files.find(f => f.name === filename && !files.some(f2 => f2.id === f.parents[0]));
|
|
131
|
-
} else {
|
|
132
|
-
this.checkIfMultipleFilesWithSameName(path, files, filename, parentDirectoryId);
|
|
133
|
-
file = files.find(f => f.name === filename && f.parents[0] === parentDirectoryId);
|
|
148
|
+
throw new CloudStorageError(`File not found`, NativeCloudStorageErrorCode.FILE_NOT_FOUND);
|
|
134
149
|
}
|
|
150
|
+
const files = await this.findFilesByNameAndParent(filename, parentDirectoryId, scope);
|
|
151
|
+
this.checkIfMultipleFilesWithSameName(path, files);
|
|
152
|
+
const file = files[0];
|
|
135
153
|
if (!file) throw new CloudStorageError(`File not found`, NativeCloudStorageErrorCode.FILE_NOT_FOUND);
|
|
136
154
|
if (file.mimeType === MimeTypes.FOLDER && throwIf === 'directory') {
|
|
137
155
|
throw new CloudStorageError(`Path ${path} is a directory`, NativeCloudStorageErrorCode.PATH_IS_DIRECTORY);
|
|
@@ -160,7 +178,7 @@ export default class GoogleDrive {
|
|
|
160
178
|
let fileId;
|
|
161
179
|
let previousContent = '';
|
|
162
180
|
try {
|
|
163
|
-
fileId = await this.getFileId(path, scope);
|
|
181
|
+
fileId = await this.getFileId(path, scope, 'directory');
|
|
164
182
|
previousContent = await this.drive.getFileText(fileId);
|
|
165
183
|
} catch (error) {
|
|
166
184
|
if (error instanceof CloudStorageError && error.code === NativeCloudStorageErrorCode.FILE_NOT_FOUND) {
|
|
@@ -175,15 +193,17 @@ export default class GoogleDrive {
|
|
|
175
193
|
mimeType: MimeTypes.TEXT
|
|
176
194
|
});
|
|
177
195
|
} else {
|
|
178
|
-
const files = await this.drive.listFiles(this.getRootDirectory(scope));
|
|
179
196
|
const {
|
|
180
197
|
directories,
|
|
181
198
|
filename
|
|
182
199
|
} = this.resolvePathToDirectories(path);
|
|
183
|
-
const parentDirectoryId = this.findParentDirectoryId(
|
|
200
|
+
const parentDirectoryId = await this.findParentDirectoryId(directories, scope);
|
|
201
|
+
if (parentDirectoryId === null) {
|
|
202
|
+
throw new CloudStorageError(`Directory not found`, NativeCloudStorageErrorCode.DIRECTORY_NOT_FOUND);
|
|
203
|
+
}
|
|
184
204
|
await this.drive.createFile({
|
|
185
205
|
name: filename,
|
|
186
|
-
parents:
|
|
206
|
+
parents: [parentDirectoryId]
|
|
187
207
|
}, {
|
|
188
208
|
body: data,
|
|
189
209
|
mimeType: MimeTypes.TEXT
|
|
@@ -194,7 +214,7 @@ export default class GoogleDrive {
|
|
|
194
214
|
let fileId;
|
|
195
215
|
if (overwrite) {
|
|
196
216
|
try {
|
|
197
|
-
fileId = await this.getFileId(path, scope);
|
|
217
|
+
fileId = await this.getFileId(path, scope, 'directory');
|
|
198
218
|
} catch (error) {
|
|
199
219
|
if (error instanceof CloudStorageError && error.code === NativeCloudStorageErrorCode.FILE_NOT_FOUND) {
|
|
200
220
|
/* do nothing, simply create the file */
|
|
@@ -204,7 +224,7 @@ export default class GoogleDrive {
|
|
|
204
224
|
}
|
|
205
225
|
} else {
|
|
206
226
|
try {
|
|
207
|
-
await this.getFileId(path, scope);
|
|
227
|
+
await this.getFileId(path, scope, 'directory');
|
|
208
228
|
throw new CloudStorageError(`File ${path} already exists`, NativeCloudStorageErrorCode.FILE_ALREADY_EXISTS);
|
|
209
229
|
} catch (error) {
|
|
210
230
|
if (error instanceof CloudStorageError && error.code === NativeCloudStorageErrorCode.FILE_NOT_FOUND) {
|
|
@@ -220,15 +240,17 @@ export default class GoogleDrive {
|
|
|
220
240
|
mimeType: MimeTypes.TEXT
|
|
221
241
|
});
|
|
222
242
|
} else {
|
|
223
|
-
const files = await this.drive.listFiles(this.getRootDirectory(scope));
|
|
224
243
|
const {
|
|
225
244
|
directories,
|
|
226
245
|
filename
|
|
227
246
|
} = this.resolvePathToDirectories(path);
|
|
228
|
-
const parentDirectoryId = this.findParentDirectoryId(
|
|
247
|
+
const parentDirectoryId = await this.findParentDirectoryId(directories, scope);
|
|
248
|
+
if (parentDirectoryId === null) {
|
|
249
|
+
throw new CloudStorageError(`Directory not found`, NativeCloudStorageErrorCode.DIRECTORY_NOT_FOUND);
|
|
250
|
+
}
|
|
229
251
|
await this.drive.createFile({
|
|
230
252
|
name: filename,
|
|
231
|
-
parents:
|
|
253
|
+
parents: [parentDirectoryId]
|
|
232
254
|
}, {
|
|
233
255
|
body: data,
|
|
234
256
|
mimeType: MimeTypes.TEXT
|
|
@@ -236,42 +258,41 @@ export default class GoogleDrive {
|
|
|
236
258
|
}
|
|
237
259
|
}
|
|
238
260
|
async listFiles(path, scope) {
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
return [...new Set(allFiles.filter(f => (f.parents ?? [])[0] === rootDirectoryId).map(f => f.name))];
|
|
243
|
-
} else {
|
|
244
|
-
const fileId = await this.getFileId(path, scope);
|
|
245
|
-
const files = allFiles.filter(f => (f.parents ?? [])[0] === fileId);
|
|
246
|
-
return [...new Set(files.map(f => f.name))];
|
|
247
|
-
}
|
|
261
|
+
const parentDirectoryId = this.isRootPath(path) ? await this.getQueryRootParentId(scope) : await this.getFileId(path, scope);
|
|
262
|
+
const files = await this.findFilesByParent(parentDirectoryId, scope);
|
|
263
|
+
return [...new Set(files.map(f => f.name))];
|
|
248
264
|
}
|
|
249
265
|
async createDirectory(path, scope) {
|
|
266
|
+
if (this.isRootPath(path)) {
|
|
267
|
+
throw new CloudStorageError(`Directory ${path} already exists`, NativeCloudStorageErrorCode.FILE_ALREADY_EXISTS);
|
|
268
|
+
}
|
|
250
269
|
try {
|
|
251
270
|
await this.getFileId(path, scope);
|
|
252
271
|
throw new CloudStorageError(`File ${path} already exists`, NativeCloudStorageErrorCode.FILE_ALREADY_EXISTS);
|
|
253
272
|
} catch (error) {
|
|
254
273
|
if (error instanceof CloudStorageError && error.code === NativeCloudStorageErrorCode.FILE_NOT_FOUND) {
|
|
255
|
-
/* do nothing, simply create the
|
|
274
|
+
/* do nothing, simply create the directory */
|
|
256
275
|
} else if (error instanceof CloudStorageError && error.code === NativeCloudStorageErrorCode.PATH_IS_DIRECTORY) {
|
|
257
276
|
throw new CloudStorageError(`Directory ${path} already exists`, NativeCloudStorageErrorCode.FILE_ALREADY_EXISTS);
|
|
258
277
|
} else {
|
|
259
278
|
throw error;
|
|
260
279
|
}
|
|
261
280
|
}
|
|
262
|
-
const files = await this.drive.listFiles(this.getRootDirectory(scope));
|
|
263
281
|
const {
|
|
264
282
|
directories,
|
|
265
283
|
filename
|
|
266
284
|
} = this.resolvePathToDirectories(path);
|
|
267
|
-
const parentDirectoryId = this.findParentDirectoryId(
|
|
285
|
+
const parentDirectoryId = await this.findParentDirectoryId(directories, scope);
|
|
286
|
+
if (parentDirectoryId === null) {
|
|
287
|
+
throw new CloudStorageError(`Directory not found`, NativeCloudStorageErrorCode.DIRECTORY_NOT_FOUND);
|
|
288
|
+
}
|
|
268
289
|
await this.drive.createDirectory({
|
|
269
290
|
name: filename,
|
|
270
|
-
parents:
|
|
291
|
+
parents: [parentDirectoryId]
|
|
271
292
|
});
|
|
272
293
|
}
|
|
273
294
|
async readFile(path, scope) {
|
|
274
|
-
const fileId = await this.getFileId(path, scope);
|
|
295
|
+
const fileId = await this.getFileId(path, scope, 'directory');
|
|
275
296
|
const content = await this.drive.getFileText(fileId);
|
|
276
297
|
return content;
|
|
277
298
|
}
|
|
@@ -289,8 +310,7 @@ export default class GoogleDrive {
|
|
|
289
310
|
const fileId = await this.getFileId(path, scope, 'file');
|
|
290
311
|
if (!recursive) {
|
|
291
312
|
// check if the directory is empty
|
|
292
|
-
const
|
|
293
|
-
const filesInDirectory = files.filter(f => (f.parents ?? [])[0] === fileId);
|
|
313
|
+
const filesInDirectory = await this.findFilesByParent(fileId, scope);
|
|
294
314
|
if (filesInDirectory.length > 0) {
|
|
295
315
|
throw new CloudStorageError(`Directory ${path} is not empty`, NativeCloudStorageErrorCode.DELETE_ERROR, filesInDirectory);
|
|
296
316
|
}
|
|
@@ -321,7 +341,7 @@ export default class GoogleDrive {
|
|
|
321
341
|
let fileId;
|
|
322
342
|
if (overwrite) {
|
|
323
343
|
try {
|
|
324
|
-
fileId = await this.getFileId(remotePath, scope);
|
|
344
|
+
fileId = await this.getFileId(remotePath, scope, 'directory');
|
|
325
345
|
} catch (error) {
|
|
326
346
|
if (error instanceof CloudStorageError && error.code === NativeCloudStorageErrorCode.FILE_NOT_FOUND) {
|
|
327
347
|
/* File doesn't exist -> we'll create it below */
|
|
@@ -331,7 +351,7 @@ export default class GoogleDrive {
|
|
|
331
351
|
}
|
|
332
352
|
} else {
|
|
333
353
|
try {
|
|
334
|
-
await this.getFileId(remotePath, scope);
|
|
354
|
+
await this.getFileId(remotePath, scope, 'directory');
|
|
335
355
|
throw new CloudStorageError(`File ${remotePath} already exists`, NativeCloudStorageErrorCode.FILE_ALREADY_EXISTS);
|
|
336
356
|
} catch (error) {
|
|
337
357
|
if (error instanceof CloudStorageError && error.code === NativeCloudStorageErrorCode.FILE_NOT_FOUND) {
|
|
@@ -351,15 +371,17 @@ export default class GoogleDrive {
|
|
|
351
371
|
});
|
|
352
372
|
} else {
|
|
353
373
|
// Need to create a new file first
|
|
354
|
-
const files = await this.drive.listFiles(this.getRootDirectory(scope));
|
|
355
374
|
const {
|
|
356
375
|
directories,
|
|
357
376
|
filename
|
|
358
377
|
} = this.resolvePathToDirectories(remotePath);
|
|
359
|
-
const parentDirectoryId = this.findParentDirectoryId(
|
|
378
|
+
const parentDirectoryId = await this.findParentDirectoryId(directories, scope);
|
|
379
|
+
if (parentDirectoryId === null) {
|
|
380
|
+
throw new CloudStorageError(`Directory not found`, NativeCloudStorageErrorCode.DIRECTORY_NOT_FOUND);
|
|
381
|
+
}
|
|
360
382
|
await this.drive.createFile({
|
|
361
383
|
name: filename,
|
|
362
|
-
parents:
|
|
384
|
+
parents: [parentDirectoryId]
|
|
363
385
|
}, {
|
|
364
386
|
mimeType,
|
|
365
387
|
localPath
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeCloudStorageErrorCode","CloudStorageError","MimeTypes","GoogleDriveApiClient","GoogleDriveHttpError","GoogleDrive","constructor","options","drive","Proxy","get","target","property","allowedFunctions","includes","toString","accessToken","length","ACCESS_TOKEN_MISSING","isCloudAvailable","getRootDirectory","scope","resolvePathToDirectories","path","startsWith","slice","endsWith","directories","split","actualFilename","pop","filename","findParentDirectoryId","files","directoryTree","possibleTopDirectories","filter","f","mimeType","FOLDER","name","topDirectoryId","id","possibleTopDirectory","some","parents","DIRECTORY_NOT_FOUND","currentDirectoryId","index","currentDirectory","find","nextDirectory","getRootDirectoryId","listFiles","file","checkIfMultipleFilesWithSameName","parentDirectoryId","strictFilenames","possibleFiles","f2","map","join","MULTIPLE_FILES_SAME_NAME","getFileId","throwIf","rootDirectoryId","FILE_NOT_FOUND","PATH_IS_DIRECTORY","error","json","status","AUTHENTICATION_FAILED","UNKNOWN","fileExists","code","appendToFile","data","fileId","previousContent","getFileText","updateFile","body","TEXT","createFile","undefined","overwrite","FILE_ALREADY_EXISTS","allFiles","Set","createDirectory","readFile","content","triggerSync","_path","_scope","deleteFile","deleteDirectory","recursive","filesInDirectory","DELETE_ERROR","statFile","getFile","size","birthtimeMs","Date","createdTime","getTime","mtimeMs","modifiedTime","isDirectory","isFile","downloadFile","remotePath","localPath","uploadFile"],"sourceRoot":"../../../../src","sources":["storages/google-drive/index.ts"],"mappings":";;AAAA,SACEA,2BAA2B,QAItB,oBAAoB;AAC3B,OAAOC,iBAAiB,MAAM,iCAAiC;AAC/D,SAASC,SAAS,QAAyD,SAAS;AACpF,OAAOC,oBAAoB,IAAIC,oBAAoB,QAAQ,UAAU;AAGrE;AACA;AACA;AACA,eAAe,MAAMC,WAAW,CAA0B;EAIxDC,WAAWA,CAACC,OAAiE,EAAE;IAC7E,IAAI,CAACA,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,KAAK,GAAG,IAAIL,oBAAoB,CAACI,OAAO,CAAC;IAE9C,OAAO,IAAIE,KAAK,CAAC,IAAI,EAAE;MACrB;MACAC,GAAGA,CAACC,MAAmB,EAAEC,QAA2B,EAAE;QACpD,MAAMC,gBAAgB,GAAG,CAAC,kBAAkB,CAAC;QAC7C,IAAI,OAAOF,MAAM,CAACC,QAAQ,CAAC,KAAK,UAAU,IAAI,CAACC,gBAAgB,CAACC,QAAQ,CAACF,QAA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EAAE;UACnG;QAAA,CACD,MAAM,IAAIE,KAAK,YAAYnE,iBAAiB,EAAE;UAC7C,MAAMmE,KAAK;QACb,CAAC,MAAM;UACL,MAAMA,KAAK;QACb;MACF;IACF;IAEA,IAAIS,MAAM,EAAE;MACV;MACA,MAAM,IAAI,CAACrE,KAAK,CAACwE,UAAU,CAACH,MAAM,EAAE;QAClCvC,QAAQ;QACR2E;MACF,CAAC,CAAC;IACJ,CAAC,MAAM;MACL;MACA,MAAMhF,KAAK,GAAG,MAAM,IAAI,CAACzB,KAAK,CAAC6C,SAAS,CAAC,IAAI,CAACjC,gBAAgB,CAACC,KAAK,CAAC,CAAC;MACtE,MAAM;QAAEM,WAAW;QAAEI;MAAS,CAAC,GAAG,IAAI,CAACT,wBAAwB,CAAC0F,UAAU,CAAC;MAC3E,MAAMxD,iBAAiB,GAAG,IAAI,CAACxB,qBAAqB,CAACC,KAAK,EAAEN,WAAW,CAAC;MAExE,MAAM,IAAI,CAACnB,KAAK,CAAC2E,UAAU,CACzB;QACE3C,IAAI,EAAET,QAAQ;QACdc,OAAO,EAAEW,iBAAiB,GACtB,CAACA,iBAAiB,CAAC,GACnBnC,KAAK,KAAK,UAAU,GACpB,CAAC,IAAI,CAACD,gBAAgB,CAACC,KAAK,CAAC,CAAC,GAC9B+D;MACN,CAAC,EACD;QACE9C,QAAQ;QACR2E;MACF,CACF,CAAC;IACH;EACF;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["NativeCloudStorageErrorCode","CloudStorageError","MimeTypes","GoogleDriveApiClient","GoogleDriveHttpError","GoogleDrive","constructor","options","drive","Proxy","get","target","property","allowedFunctions","includes","toString","accessToken","length","ACCESS_TOKEN_MISSING","isCloudAvailable","getRootDirectory","scope","isRootPath","path","resolvePathToDirectories","startsWith","slice","endsWith","directories","split","actualFilename","pop","filename","escapeDriveQueryValue","value","replaceAll","String","raw","getQueryRootParentId","getRootDirectoryId","findDirectoryByNameAndParent","name","parentId","escapedName","escapedParentId","query","FOLDER","listFiles","findFilesByNameAndParent","findFilesByParent","findParentDirectoryId","directoryTree","parentDirectoryId","directoryName","id","files","file","parents","some","candidate","checkIfMultipleFilesWithSameName","strictFilenames","map","f","join","MULTIPLE_FILES_SAME_NAME","getFileId","throwIf","PATH_IS_DIRECTORY","rootDirectoryId","getFile","FILE_NOT_FOUND","mimeType","error","json","status","AUTHENTICATION_FAILED","UNKNOWN","fileExists","code","appendToFile","data","fileId","previousContent","getFileText","updateFile","body","TEXT","DIRECTORY_NOT_FOUND","createFile","overwrite","FILE_ALREADY_EXISTS","Set","createDirectory","readFile","content","triggerSync","_path","_scope","deleteFile","deleteDirectory","recursive","filesInDirectory","DELETE_ERROR","statFile","size","birthtimeMs","Date","createdTime","getTime","mtimeMs","modifiedTime","isDirectory","isFile","downloadFile","remotePath","localPath","uploadFile"],"sourceRoot":"../../../../src","sources":["storages/google-drive/index.ts"],"mappings":";;AAAA,SACEA,2BAA2B,QAItB,oBAAoB;AAC3B,OAAOC,iBAAiB,MAAM,iCAAiC;AAC/D,SAASC,SAAS,QAAyD,SAAS;AACpF,OAAOC,oBAAoB,IAAIC,oBAAoB,QAAQ,UAAU;AAGrE;AACA;AACA;AACA,eAAe,MAAMC,WAAW,CAA0B;EAIxDC,WAAWA,CAACC,OAAiE,EAAE;IAC7E,IAAI,CAACA,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,KAAK,GAAG,IAAIL,oBAAoB,CAACI,OAAO,CAAC;IAE9C,OAAO,IAAIE,KAAK,CAAC,IAAI,EAAE;MACrB;MACAC,GAAGA,CAACC,MAAmB,EAAEC,QAA2B,EAAE;QACpD,MAAMC,gBAAgB,GAAG,CAAC,kBAAkB,CAAC;QAC7C,IAAI,OAAOF,MAAM,CAACC,QAAQ,CAAC,KAAK,UAAU,IAAI,CAACC,gBAAgB,CAACC,QAAQ,CAACF,QAAQ,CAACG,QAAQ,CAAC,CAAC,CAAC,EAAE;UAC7F,MAAM;YAAEC;UAAY,CAAC,GAAGT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AAE9F,KAAK,EAAE,WAAW,CAAC;QACpD,MAAM,IAAIpB,iBAAiB,CACzB,QAAQkH,UAAU,iBAAiB,EACnCnH,2BAA2B,CAAC2F,mBAC9B,CAAC;MACH,CAAC,CAAC,OAAOlB,KAAc,EAAE;QACvB,IAAIA,KAAK,YAAYxE,iBAAiB,IAAIwE,KAAK,CAACM,IAAI,KAAK/E,2BAA2B,CAACuE,cAAc,EAAE;UACnG;QAAA,CACD,MAAM,IAAIE,KAAK,YAAYxE,iBAAiB,EAAE;UAC7C,MAAMwE,KAAK;QACb,CAAC,MAAM;UACL,MAAMA,KAAK;QACb;MACF;IACF;IAEA,IAAIS,MAAM,EAAE;MACV;MACA,MAAM,IAAI,CAAC1E,KAAK,CAAC6E,UAAU,CAACH,MAAM,EAAE;QAClCV,QAAQ;QACR4C;MACF,CAAC,CAAC;IACJ,CAAC,MAAM;MACL;MACA,MAAM;QAAExF,WAAW;QAAEI;MAAS,CAAC,GAAG,IAAI,CAACR,wBAAwB,CAAC2F,UAAU,CAAC;MAC3E,MAAM/D,iBAAiB,GAAG,MAAM,IAAI,CAACF,qBAAqB,CAACtB,WAAW,EAAEP,KAAK,CAAC;MAC9E,IAAI+B,iBAAiB,KAAK,IAAI,EAAE;QAC9B,MAAM,IAAInD,iBAAiB,CAAC,qBAAqB,EAAED,2BAA2B,CAACwF,mBAAmB,CAAC;MACrG;MAEA,MAAM,IAAI,CAAChF,KAAK,CAACiF,UAAU,CACzB;QACEhD,IAAI,EAAET,QAAQ;QACdyB,OAAO,EAAE,CAACL,iBAAiB;MAC7B,CAAC,EACD;QACEoB,QAAQ;QACR4C;MACF,CACF,CAAC;IACH;EACF;AACF","ignoreList":[]}
|
|
@@ -1,15 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Custom utility type to make properties required, but still allow null if defined.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
4
7
|
|
|
5
8
|
export let CloudStorageScope = /*#__PURE__*/function (CloudStorageScope) {
|
|
6
9
|
CloudStorageScope["Documents"] = "documents";
|
|
7
10
|
CloudStorageScope["AppData"] = "app_data";
|
|
8
11
|
return CloudStorageScope;
|
|
9
12
|
}({});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Controls which on-device directory `CloudStorageScope.Documents` maps to on iCloud.
|
|
16
|
+
* @provider icloud
|
|
17
|
+
*/
|
|
18
|
+
|
|
10
19
|
export let CloudStorageProvider = /*#__PURE__*/function (CloudStorageProvider) {
|
|
20
|
+
/**
|
|
21
|
+
* Apple iCloud, backed by CloudKit.
|
|
22
|
+
* @platform ios
|
|
23
|
+
*/
|
|
11
24
|
CloudStorageProvider["ICloud"] = "icloud";
|
|
12
25
|
CloudStorageProvider["GoogleDrive"] = "googledrive";
|
|
13
26
|
return CloudStorageProvider;
|
|
14
27
|
}({});
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Options for a single cloud storage provider: the iCloud options when the iCloud provider is used,
|
|
31
|
+
* or the Google Drive options when the Google Drive provider is used. This is the value type of
|
|
32
|
+
* {@link CloudStorageProviderOptions} and the shape accepted by `setProviderOptions` and the
|
|
33
|
+
* `CloudStorage` constructor.
|
|
34
|
+
*/
|
|
15
35
|
//# sourceMappingURL=main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CloudStorageScope","CloudStorageProvider"],"sourceRoot":"../../../src","sources":["types/main.ts"],"mappings":";;AAAA;;AAKA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;
|
|
1
|
+
{"version":3,"names":["CloudStorageScope","CloudStorageProvider"],"sourceRoot":"../../../src","sources":["types/main.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAKA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;;AAK7B;AACA;AACA;AACA;;AAaA,WAAYC,oBAAoB,0BAApBA,oBAAoB;EAC9B;AACF;AACA;AACA;EAJYA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;;AA4ChC;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -8,7 +8,8 @@ export const LINKING_ERROR = `The package 'react-native-cloud-storage' doesn't s
|
|
|
8
8
|
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
9
9
|
export const DEFAULT_PROVIDER_OPTIONS = {
|
|
10
10
|
[CloudStorageProvider.ICloud]: {
|
|
11
|
-
scope: CloudStorageScope.AppData
|
|
11
|
+
scope: CloudStorageScope.AppData,
|
|
12
|
+
documentsMode: 'icloud'
|
|
12
13
|
},
|
|
13
14
|
[CloudStorageProvider.GoogleDrive]: {
|
|
14
15
|
scope: CloudStorageScope.AppData,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","CloudStorageProvider","CloudStorageScope","LINKING_ERROR","select","ios","default","DEFAULT_PROVIDER_OPTIONS","ICloud","scope","AppData","GoogleDrive","accessToken","strictFilenames","timeout"],"sourceRoot":"../../../src","sources":["utils/constants.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,oBAAoB,EAA+BC,iBAAiB,QAAsB,eAAe;AAElH,OAAO,MAAMC,aAAa,GACxB,qFAAqF,GACrFH,QAAQ,CAACI,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,OAAO,MAAMC,wBAAmE,GAAG;EACjF,CAACN,oBAAoB,CAACO,MAAM,GAAG;IAC7BC,KAAK,EAAEP,iBAAiB,CAACQ;
|
|
1
|
+
{"version":3,"names":["Platform","CloudStorageProvider","CloudStorageScope","LINKING_ERROR","select","ios","default","DEFAULT_PROVIDER_OPTIONS","ICloud","scope","AppData","documentsMode","GoogleDrive","accessToken","strictFilenames","timeout"],"sourceRoot":"../../../src","sources":["utils/constants.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,oBAAoB,EAA+BC,iBAAiB,QAAsB,eAAe;AAElH,OAAO,MAAMC,aAAa,GACxB,qFAAqF,GACrFH,QAAQ,CAACI,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,OAAO,MAAMC,wBAAmE,GAAG;EACjF,CAACN,oBAAoB,CAACO,MAAM,GAAG;IAC7BC,KAAK,EAAEP,iBAAiB,CAACQ,OAAO;IAChCC,aAAa,EAAE;EACjB,CAAC;EACD,CAACV,oBAAoB,CAACW,WAAW,GAAG;IAClCH,KAAK,EAAEP,iBAAiB,CAACQ,OAAO;IAChCG,WAAW,EAAE,IAAI;IACjBC,eAAe,EAAE,KAAK;IACtBC,OAAO,EAAE;EACX;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import NativeCloudStorageLocalFileSystem from '../specs/NativeCloudStorageLocalFileSystem';
|
|
4
4
|
import { createProxiedNativeModule } from '../utils/native';
|
|
5
5
|
import { LINKING_ERROR } from './constants';
|
|
6
|
-
const NativeLocalFileSystem = createProxiedNativeModule(
|
|
6
|
+
const NativeLocalFileSystem = createProxiedNativeModule(NativeCloudStorageLocalFileSystem);
|
|
7
7
|
export const localFileSystem = NativeLocalFileSystem ?? new Proxy({}, {
|
|
8
8
|
get() {
|
|
9
9
|
throw new Error(LINKING_ERROR);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["NativeCloudStorageLocalFileSystem","createProxiedNativeModule","LINKING_ERROR","NativeLocalFileSystem","localFileSystem","Proxy","get","Error"],"sourceRoot":"../../../src","sources":["utils/local-fs.ts"],"mappings":";;AAAA,OAAOA,iCAAiC,MAAM,4CAA4C;AAE1F,SAASC,yBAAyB,QAAQ,iBAAiB;AAC3D,SAASC,aAAa,QAAQ,aAAa;AAE3C,MAAMC,qBAAqB,GAAGF,yBAAyB,CACrDD,iCACF,CAAC;AAED,OAAO,MAAMI,eAAe,GAC1BD,qBAAqB,IACpB,IAAIE,KAAK,CACR,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACL,aAAa,CAAC;EAChC;AACF,CACF,CAA4B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeCloudStorageErrorCode","CloudStorageError","createProxiedNativeModule","nativeModule","Proxy","get","target","property","receiver","originalValue","Reflect","arguments_","apply","error","error_","code","Object","values","includes","message","UNKNOWN"],"sourceRoot":"../../../src","sources":["utils/native.ts"],"mappings":";;AAAA,SAASA,2BAA2B,QAAQ,iBAAiB;AAC7D,OAAOC,iBAAiB,MAAM,uBAAuB;;AAErD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,GAAsBC,
|
|
1
|
+
{"version":3,"names":["NativeCloudStorageErrorCode","CloudStorageError","createProxiedNativeModule","nativeModule","Proxy","get","target","property","receiver","originalValue","Reflect","arguments_","apply","error","error_","code","Object","values","includes","message","UNKNOWN"],"sourceRoot":"../../../src","sources":["utils/native.ts"],"mappings":";;AAAA,SAASA,2BAA2B,QAAQ,iBAAiB;AAC7D,OAAOC,iBAAiB,MAAM,uBAAuB;;AAErD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,GAAsBC,YAAkC,IAAe;EAC3G,IAAI,CAACA,YAAY,EAAE,OAAO,IAAI;EAE9B,OAAO,IAAIC,KAAK,CAACD,YAAY,EAAE;IAC7BE,GAAGA,CAACC,MAAS,EAAEC,QAAyB,EAAEC,QAAiB,EAAE;MAC3D,MAAMC,aAAa,GAAGC,OAAO,CAACL,GAAG,CAACC,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,CAAC;MAE7D,IAAI,OAAOC,aAAa,KAAK,UAAU,EAAE;QACvC,OAAO,OAAO,GAAGE,UAAqB,KAAK;UACzC,IAAI;YACF,OAAO,MAAMD,OAAO,CAACE,KAAK,CAACH,aAAa,EAAEH,MAAM,EAAEK,UAAU,CAAC;UAC/D,CAAC,CAAC,OAAOE,KAAc,EAAE;YACvB,MAAMC,MAAM,GACV,OAAOD,KAAK,KAAK,QAAQ,IACzBA,KAAK,KAAK,IAAI,IACd,MAAM,IAAIA,KAAK,IACf,OAAOA,KAAK,CAACE,IAAI,KAAK,QAAQ,IAC9BC,MAAM,CAACC,MAAM,CAACjB,2BAA2B,CAAC,CAACkB,QAAQ,CAACL,KAAK,CAACE,IAAmC,CAAC,GAC1F,IAAId,iBAAiB,CACnB,SAAS,IAAIY,KAAK,IAAI,OAAOA,KAAK,CAACM,OAAO,KAAK,QAAQ,GAAGN,KAAK,CAACM,OAAO,GAAG,eAAe,EACzFN,KAAK,CAACE,IACR,CAAC,GACD,IAAId,iBAAiB,CAAC,eAAe,EAAED,2BAA2B,CAACoB,OAAO,EAAEP,KAAK,CAAC;YACxF,MAAMC,MAAM;UACd;QACF,CAAC;MACH;MAEA,OAAOL,aAAa;IACtB;EACF,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { CloudStorageProvider, CloudStorageScope, type CloudStorageFileStat, type
|
|
1
|
+
import { CloudStorageProvider, CloudStorageScope, type CloudStorageFileStat, type CloudStorageProviderOptionsValue } from './types/main';
|
|
2
2
|
export default class RNCloudStorage {
|
|
3
3
|
private static defaultInstance;
|
|
4
4
|
private provider;
|
|
5
5
|
private cloudAvailabilityListeners;
|
|
6
|
+
private cloudAvailabilitySubscription;
|
|
6
7
|
/**
|
|
7
8
|
* Creates a new RNCloudStorage instance for the given provider.
|
|
8
9
|
* @param provider The provider to create the instance for. Defaults to the default provider for the current platform.
|
|
9
10
|
*/
|
|
10
|
-
constructor(provider?: CloudStorageProvider, options?:
|
|
11
|
+
constructor(provider?: CloudStorageProvider, options?: CloudStorageProviderOptionsValue);
|
|
11
12
|
private get nativeStorage();
|
|
12
13
|
/**
|
|
13
14
|
* Gets the default CloudStorageProvider for the current platform.
|
|
@@ -24,6 +25,11 @@ export default class RNCloudStorage {
|
|
|
24
25
|
* @returns The current CloudStorageProvider.
|
|
25
26
|
*/
|
|
26
27
|
getProvider(): CloudStorageProvider;
|
|
28
|
+
private notifyCloudAvailabilityListeners;
|
|
29
|
+
private refreshCloudAvailability;
|
|
30
|
+
private getNativeCloudKitModule;
|
|
31
|
+
private removeCloudAvailabilitySubscription;
|
|
32
|
+
private configureCloudAvailabilitySubscription;
|
|
27
33
|
/**
|
|
28
34
|
* Sets the current CloudStorageProvider.
|
|
29
35
|
* @param provider The provider to set.
|
|
@@ -33,14 +39,15 @@ export default class RNCloudStorage {
|
|
|
33
39
|
* Gets the current options for the current provider.
|
|
34
40
|
* @returns The current options for the current provider.
|
|
35
41
|
*/
|
|
36
|
-
getProviderOptions():
|
|
42
|
+
getProviderOptions(): CloudStorageProviderOptionsValue;
|
|
37
43
|
/**
|
|
38
44
|
* Sets the options for the current provider.
|
|
39
45
|
* @param options The options to set for the provider.
|
|
40
46
|
*/
|
|
41
|
-
setProviderOptions(options:
|
|
47
|
+
setProviderOptions(options: CloudStorageProviderOptionsValue): void;
|
|
42
48
|
subscribeToCloudAvailability(listener: (available: boolean) => void): void;
|
|
43
49
|
unsubscribeFromCloudAvailability(listener: (available: boolean) => void): void;
|
|
50
|
+
private resolveNativeScope;
|
|
44
51
|
/**
|
|
45
52
|
* Tests whether or not the cloud storage is available. Always returns true for Google Drive. iCloud may be
|
|
46
53
|
* unavailable right after app launch or if the user is not logged in.
|
|
@@ -96,6 +103,7 @@ export default class RNCloudStorage {
|
|
|
96
103
|
* @param path The file to trigger synchronization for.
|
|
97
104
|
* @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
|
|
98
105
|
* @returns A promise that resolves once the synchronization has been triggered.
|
|
106
|
+
* @provider icloud
|
|
99
107
|
*/
|
|
100
108
|
triggerSync(path: string, scope?: CloudStorageScope): Promise<void>;
|
|
101
109
|
/**
|
|
@@ -163,12 +171,12 @@ export default class RNCloudStorage {
|
|
|
163
171
|
* Gets the current options for the provider of the default static instance.
|
|
164
172
|
* @returns The current options for the provider of the default static instance.
|
|
165
173
|
*/
|
|
166
|
-
static getProviderOptions():
|
|
174
|
+
static getProviderOptions(): CloudStorageProviderOptionsValue;
|
|
167
175
|
/**
|
|
168
176
|
* Sets the options for the provider of the default static instance.
|
|
169
177
|
* @param options The options to set for the provider of the default static instance.
|
|
170
178
|
*/
|
|
171
|
-
static setProviderOptions(options:
|
|
179
|
+
static setProviderOptions(options: CloudStorageProviderOptionsValue): void;
|
|
172
180
|
/**
|
|
173
181
|
* Tests whether or not the file at the given path exists in the provider of the default static instance.
|
|
174
182
|
* @param path The path to test.
|
|
@@ -224,6 +232,7 @@ export default class RNCloudStorage {
|
|
|
224
232
|
* @param path The file to trigger synchronization for.
|
|
225
233
|
* @param scope The directory scope the path is in. Defaults to the default scope set for the default static instance.
|
|
226
234
|
* @returns A promise that resolves once the synchronization has been triggered.
|
|
235
|
+
* @provider icloud
|
|
227
236
|
*/
|
|
228
237
|
static triggerSync(path: string, scope?: CloudStorageScope): Promise<void>;
|
|
229
238
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-storage.d.ts","sourceRoot":"","sources":["../../src/cloud-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,oBAAoB,
|
|
1
|
+
{"version":3,"file":"cloud-storage.d.ts","sourceRoot":"","sources":["../../src/cloud-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EAC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