react-native-cloud-storage 1.5.0 → 1.5.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/LICENSE +1 -1
- package/README.md +5 -6
- package/ios/CloudStorage.swift +262 -52
- package/ios/CloudStorage.xcodeproj/project.pbxproj +0 -28
- package/ios/CloudStorage.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
- package/ios/CloudStorage.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/CloudStorage.xcodeproj/project.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/CloudStorage.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/xcschememanagement.plist +22 -0
- package/ios/CloudStorageEventEmitter.swift +4 -4
- package/lib/commonjs/RNCloudStorage.js +66 -361
- package/lib/commonjs/RNCloudStorage.js.map +1 -1
- package/lib/commonjs/createRNCloudStorage.js +48 -0
- package/lib/commonjs/createRNCloudStorage.js.map +1 -0
- package/lib/commonjs/expo-plugin/types/index.js.map +1 -1
- package/lib/commonjs/expo-plugin/withRNCloudStorage.js +3 -2
- package/lib/commonjs/expo-plugin/withRNCloudStorage.js.map +1 -1
- package/lib/commonjs/expo-plugin/withRNCloudStorageIos.js +7 -4
- package/lib/commonjs/expo-plugin/withRNCloudStorageIos.js.map +1 -1
- package/lib/commonjs/google-drive/client.js +20 -16
- package/lib/commonjs/google-drive/client.js.map +1 -1
- package/lib/commonjs/google-drive/index.js +64 -42
- package/lib/commonjs/google-drive/index.js.map +1 -1
- package/lib/commonjs/google-drive/types.js +2 -1
- package/lib/commonjs/google-drive/types.js.map +1 -1
- package/lib/commonjs/hooks/useCloudFile.js +17 -14
- package/lib/commonjs/hooks/useCloudFile.js.map +1 -1
- package/lib/commonjs/hooks/useIsCloudAvailable.js +21 -11
- package/lib/commonjs/hooks/useIsCloudAvailable.js.map +1 -1
- package/lib/commonjs/index.js +7 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/main.js +3 -8
- package/lib/commonjs/types/main.js.map +1 -1
- package/lib/commonjs/types/native.js +3 -3
- package/lib/commonjs/types/native.js.map +1 -1
- package/lib/commonjs/utils/CloudStorageError.js +2 -1
- package/lib/commonjs/utils/CloudStorageError.js.map +1 -1
- package/lib/commonjs/utils/helpers.js +15 -8
- package/lib/commonjs/utils/helpers.js.map +1 -1
- package/lib/module/RNCloudStorage.js +65 -362
- package/lib/module/RNCloudStorage.js.map +1 -1
- package/lib/module/createRNCloudStorage.js +41 -0
- package/lib/module/createRNCloudStorage.js.map +1 -0
- package/lib/module/expo-plugin/types/index.js +1 -1
- package/lib/module/expo-plugin/types/index.js.map +1 -1
- package/lib/module/expo-plugin/withRNCloudStorage.js +0 -2
- package/lib/module/expo-plugin/withRNCloudStorage.js.map +1 -1
- package/lib/module/expo-plugin/withRNCloudStorageIos.js +5 -5
- package/lib/module/expo-plugin/withRNCloudStorageIos.js.map +1 -1
- package/lib/module/google-drive/client.js +20 -18
- package/lib/module/google-drive/client.js.map +1 -1
- package/lib/module/google-drive/index.js +62 -41
- package/lib/module/google-drive/index.js.map +1 -1
- package/lib/module/google-drive/types.js +0 -2
- package/lib/module/google-drive/types.js.map +1 -1
- package/lib/module/hooks/useCloudFile.js +16 -15
- package/lib/module/hooks/useCloudFile.js.map +1 -1
- package/lib/module/hooks/useIsCloudAvailable.js +21 -13
- package/lib/module/hooks/useIsCloudAvailable.js.map +1 -1
- package/lib/module/index.js +5 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/main.js +0 -9
- package/lib/module/types/main.js.map +1 -1
- package/lib/module/types/native.js +1 -4
- package/lib/module/types/native.js.map +1 -1
- package/lib/module/utils/CloudStorageError.js +0 -2
- package/lib/module/utils/CloudStorageError.js.map +1 -1
- package/lib/module/utils/helpers.js +13 -8
- package/lib/module/utils/helpers.js.map +1 -1
- package/lib/typescript/RNCloudStorage.d.ts +39 -159
- package/lib/typescript/RNCloudStorage.d.ts.map +1 -1
- package/lib/typescript/createRNCloudStorage.d.ts +3 -0
- package/lib/typescript/createRNCloudStorage.d.ts.map +1 -0
- package/lib/typescript/google-drive/client.d.ts +3 -3
- package/lib/typescript/google-drive/client.d.ts.map +1 -1
- package/lib/typescript/google-drive/index.d.ts +18 -6
- package/lib/typescript/google-drive/index.d.ts.map +1 -1
- package/lib/typescript/hooks/useCloudFile.d.ts +7 -4
- package/lib/typescript/hooks/useCloudFile.d.ts.map +1 -1
- package/lib/typescript/hooks/useIsCloudAvailable.d.ts +2 -3
- package/lib/typescript/hooks/useIsCloudAvailable.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +4 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/types/main.d.ts +0 -33
- package/lib/typescript/types/main.d.ts.map +1 -1
- package/lib/typescript/types/native.d.ts +1 -2
- package/lib/typescript/types/native.d.ts.map +1 -1
- package/lib/typescript/utils/helpers.d.ts +9 -2
- package/lib/typescript/utils/helpers.d.ts.map +1 -1
- package/package.json +11 -9
- package/src/RNCloudStorage.ts +68 -387
- package/src/createRNCloudStorage.ts +53 -0
- package/src/google-drive/client.ts +7 -8
- package/src/google-drive/index.ts +63 -38
- package/src/hooks/useCloudFile.ts +16 -13
- package/src/hooks/useIsCloudAvailable.ts +25 -12
- package/src/index.ts +5 -0
- package/src/types/main.ts +0 -38
- package/src/types/native.ts +1 -2
- package/src/utils/helpers.ts +15 -8
- package/ios/Utils/CloudKitUtils.swift +0 -112
- package/ios/Utils/CloudStorageError.swift +0 -78
- package/ios/Utils/FileUtils.swift +0 -132
- package/ios/Utils/Promise.swift +0 -58
- package/ios/Utils/Types.swift +0 -36
- package/lib/commonjs/package.json +0 -1
- package/lib/module/package.json +0 -1
|
@@ -1,45 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
import RNCloudStorage from '../RNCloudStorage';
|
|
4
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* A utility hook for reading and writing to a single file in the cloud.
|
|
8
6
|
* @param path The path to the file.
|
|
9
|
-
* @param scope The directory scope the path is in.
|
|
10
|
-
* @param cloudStorageInstance An optional instance of RNCloudStorage to use instead of the default instance.
|
|
7
|
+
* @param scope The directory scope the path is in. If not provided, defaults to the default scope set in the library.
|
|
11
8
|
* @returns An object containing the file's contents and functions for downloading, reading, writing, and removing the file.
|
|
12
9
|
*/
|
|
13
|
-
export const useCloudFile = (path, scope
|
|
10
|
+
export const useCloudFile = (path, scope) => {
|
|
14
11
|
const [content, setContent] = useState(null);
|
|
15
|
-
const instance = cloudStorageInstance ?? RNCloudStorage;
|
|
16
12
|
const read = useCallback(async () => {
|
|
17
|
-
const exists = await
|
|
13
|
+
const exists = await RNCloudStorage.exists(path, scope);
|
|
18
14
|
if (!exists) {
|
|
19
15
|
setContent(null);
|
|
20
16
|
return;
|
|
21
17
|
}
|
|
22
|
-
|
|
23
|
-
}, [path, scope
|
|
18
|
+
RNCloudStorage.readFile(path, scope).then(setContent);
|
|
19
|
+
}, [path, scope]);
|
|
24
20
|
useEffect(() => {
|
|
25
21
|
read();
|
|
26
22
|
}, [read]);
|
|
27
23
|
const write = useCallback(async newContent => {
|
|
28
|
-
await
|
|
24
|
+
await RNCloudStorage.writeFile(path, newContent, scope);
|
|
29
25
|
read();
|
|
30
|
-
}, [path, scope, read
|
|
26
|
+
}, [path, scope, read]);
|
|
31
27
|
const remove = useCallback(async () => {
|
|
32
|
-
await
|
|
28
|
+
await RNCloudStorage.unlink(path, scope);
|
|
33
29
|
setContent(null);
|
|
34
|
-
}, [path, scope
|
|
30
|
+
}, [path, scope]);
|
|
35
31
|
const download = useCallback(async () => {
|
|
36
|
-
await
|
|
37
|
-
}, [path, scope
|
|
32
|
+
await RNCloudStorage.downloadFile(path, scope);
|
|
33
|
+
}, [path, scope]);
|
|
38
34
|
return {
|
|
39
35
|
content,
|
|
40
36
|
read,
|
|
41
37
|
write,
|
|
42
38
|
remove,
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated Use `write` instead.
|
|
41
|
+
* @alias write
|
|
42
|
+
*/
|
|
43
|
+
update: write,
|
|
43
44
|
/**
|
|
44
45
|
* Downloads the file from iCloud to the device. Needed if the file hasn't been synced yet. Has no effect on
|
|
45
46
|
* Google Drive.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNCloudStorage","useCallback","useEffect","useState","useCloudFile","path","scope","
|
|
1
|
+
{"version":3,"names":["RNCloudStorage","useCallback","useEffect","useState","useCloudFile","path","scope","content","setContent","read","exists","readFile","then","write","newContent","writeFile","remove","unlink","download","downloadFile","update"],"sourceRoot":"../../../src","sources":["hooks/useCloudFile.ts"],"mappings":"AACA,OAAOA,cAAc,MAAM,mBAAmB;AAC9C,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAGA,CAACC,IAAY,EAAEC,KAAyB,KAAK;EACvE,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGL,QAAQ,CAAgB,IAAI,CAAC;EAE3D,MAAMM,IAAI,GAAGR,WAAW,CAAC,YAAY;IACnC,MAAMS,MAAM,GAAG,MAAMV,cAAc,CAACU,MAAM,CAACL,IAAI,EAAEC,KAAK,CAAC;IACvD,IAAI,CAACI,MAAM,EAAE;MACXF,UAAU,CAAC,IAAI,CAAC;MAChB;IACF;IACAR,cAAc,CAACW,QAAQ,CAACN,IAAI,EAAEC,KAAK,CAAC,CAACM,IAAI,CAACJ,UAAU,CAAC;EACvD,CAAC,EAAE,CAACH,IAAI,EAAEC,KAAK,CAAC,CAAC;EAEjBJ,SAAS,CAAC,MAAM;IACdO,IAAI,EAAE;EACR,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EAEV,MAAMI,KAAK,GAAGZ,WAAW,CACvB,MAAOa,UAAkB,IAAK;IAC5B,MAAMd,cAAc,CAACe,SAAS,CAACV,IAAI,EAAES,UAAU,EAAER,KAAK,CAAC;IACvDG,IAAI,EAAE;EACR,CAAC,EACD,CAACJ,IAAI,EAAEC,KAAK,EAAEG,IAAI,CAAC,CACpB;EAED,MAAMO,MAAM,GAAGf,WAAW,CAAC,YAAY;IACrC,MAAMD,cAAc,CAACiB,MAAM,CAACZ,IAAI,EAAEC,KAAK,CAAC;IACxCE,UAAU,CAAC,IAAI,CAAC;EAClB,CAAC,EAAE,CAACH,IAAI,EAAEC,KAAK,CAAC,CAAC;EAEjB,MAAMY,QAAQ,GAAGjB,WAAW,CAAC,YAAY;IACvC,MAAMD,cAAc,CAACmB,YAAY,CAACd,IAAI,EAAEC,KAAK,CAAC;EAChD,CAAC,EAAE,CAACD,IAAI,EAAEC,KAAK,CAAC,CAAC;EAEjB,OAAO;IACLC,OAAO;IACPE,IAAI;IACJI,KAAK;IACLG,MAAM;IACN;AACJ;AACA;AACA;IACII,MAAM,EAAEP,KAAK;IACb;AACJ;AACA;AACA;IACIK;EACF,CAAC;AACH,CAAC"}
|
|
@@ -1,29 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { NativeEventEmitter, NativeModules, Platform, DeviceEventEmitter } from 'react-native';
|
|
4
3
|
import RNCloudStorage from '../RNCloudStorage';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* A hook that tests whether or not the cloud storage is available.
|
|
8
|
-
* @param
|
|
7
|
+
* @param _iCloudTimeout DEPRECATED: This parameter is deprecated and has no effect. It will be removed in a future version.
|
|
9
8
|
* @returns A boolean indicating whether or not the cloud storage is available.
|
|
10
9
|
*/
|
|
11
|
-
export const useIsCloudAvailable =
|
|
10
|
+
export const useIsCloudAvailable = _iCloudTimeout => {
|
|
12
11
|
const [isAvailable, setIsAvailable] = useState(false);
|
|
13
|
-
const instance = cloudStorageInstance ?? RNCloudStorage.getDefaultInstance();
|
|
14
|
-
const handleAvailabilityChange = useCallback(available => {
|
|
15
|
-
setIsAvailable(available);
|
|
16
|
-
}, []);
|
|
17
12
|
useEffect(() => {
|
|
18
13
|
// Set the initial availability state
|
|
19
|
-
|
|
14
|
+
RNCloudStorage.isCloudAvailable().then(setIsAvailable);
|
|
20
15
|
|
|
21
16
|
// Listen for changes to the cloud availability using the native event emitter
|
|
22
|
-
|
|
17
|
+
let eventEmitter;
|
|
18
|
+
if (Platform.OS === 'ios') {
|
|
19
|
+
eventEmitter = new NativeEventEmitter(NativeModules.CloudStorageEventEmitter);
|
|
20
|
+
} else {
|
|
21
|
+
eventEmitter = DeviceEventEmitter;
|
|
22
|
+
}
|
|
23
|
+
eventEmitter.addListener('RNCloudStorage.cloud.availability-changed', event => {
|
|
24
|
+
setIsAvailable(event.available);
|
|
25
|
+
});
|
|
23
26
|
return () => {
|
|
24
|
-
|
|
27
|
+
eventEmitter.removeAllListeners('RNCloudStorage.cloud.availability-changed');
|
|
25
28
|
};
|
|
26
|
-
}, [
|
|
29
|
+
}, []);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (_iCloudTimeout !== undefined) {
|
|
32
|
+
console.warn('The iCloudTimeout parameter for useIsCloudFile is deprecated and has no effect. It will be removed in a future version. Please remove it from your code.');
|
|
33
|
+
}
|
|
34
|
+
}, [_iCloudTimeout]);
|
|
27
35
|
return isAvailable;
|
|
28
36
|
};
|
|
29
37
|
//# sourceMappingURL=useIsCloudAvailable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useEffect","useState","NativeEventEmitter","NativeModules","Platform","DeviceEventEmitter","RNCloudStorage","useIsCloudAvailable","_iCloudTimeout","isAvailable","setIsAvailable","isCloudAvailable","then","eventEmitter","OS","CloudStorageEventEmitter","addListener","event","available","removeAllListeners","undefined","console","warn"],"sourceRoot":"../../../src","sources":["hooks/useIsCloudAvailable.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,kBAAkB,QAAQ,cAAc;AAC9F,OAAOC,cAAc,MAAM,mBAAmB;;AAE9C;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAIC,cAAuB,IAAK;EAC9D,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGT,QAAQ,CAAC,KAAK,CAAC;EAErDD,SAAS,CAAC,MAAM;IACd;IACAM,cAAc,CAACK,gBAAgB,EAAE,CAACC,IAAI,CAACF,cAAc,CAAC;;IAEtD;IACA,IAAIG,YAA4D;IAChE,IAAIT,QAAQ,CAACU,EAAE,KAAK,KAAK,EAAE;MACzBD,YAAY,GAAG,IAAIX,kBAAkB,CAACC,aAAa,CAACY,wBAAwB,CAAC;IAC/E,CAAC,MAAM;MACLF,YAAY,GAAGR,kBAAkB;IACnC;IAEAQ,YAAY,CAACG,WAAW,CAAC,2CAA2C,EAAGC,KAA6B,IAAK;MACvGP,cAAc,CAACO,KAAK,CAACC,SAAS,CAAC;IACjC,CAAC,CAAC;IAEF,OAAO,MAAM;MACXL,YAAY,CAACM,kBAAkB,CAAC,2CAA2C,CAAC;IAC9E,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAENnB,SAAS,CAAC,MAAM;IACd,IAAIQ,cAAc,KAAKY,SAAS,EAAE;MAChCC,OAAO,CAACC,IAAI,CACV,0JAA0J,CAC3J;IACH;EACF,CAAC,EAAE,CAACd,cAAc,CAAC,CAAC;EAEpB,OAAOC,WAAW;AACpB,CAAC"}
|
package/lib/module/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
import RNCloudStorage from './RNCloudStorage';
|
|
4
2
|
import { CloudStorageErrorCode } from './types/native';
|
|
5
3
|
export * from './types/main';
|
|
@@ -7,4 +5,9 @@ export * from './hooks/useCloudFile';
|
|
|
7
5
|
export * from './hooks/useIsCloudAvailable';
|
|
8
6
|
import CloudStorageError from './utils/CloudStorageError';
|
|
9
7
|
export { RNCloudStorage as CloudStorage, CloudStorageError, CloudStorageErrorCode };
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use the named export `CloudStorage` instead.
|
|
11
|
+
*/
|
|
12
|
+
export default RNCloudStorage;
|
|
10
13
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNCloudStorage","CloudStorageErrorCode","CloudStorageError","CloudStorage"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["RNCloudStorage","CloudStorageErrorCode","CloudStorageError","CloudStorage"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,OAAOA,cAAc,MAAM,kBAAkB;AAC7C,SAASC,qBAAqB,QAAQ,gBAAgB;AACtD,cAAc,cAAc;AAC5B,cAAc,sBAAsB;AACpC,cAAc,6BAA6B;AAC3C,OAAOC,iBAAiB,MAAM,2BAA2B;AAEzD,SAASF,cAAc,IAAIG,YAAY,EAAED,iBAAiB,EAAED,qBAAqB;;AAEjF;AACA;AACA;AACA,eAAeD,cAAc"}
|
package/lib/module/types/main.js
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/* Custom utility type to make properties required, but still allow null if defined */
|
|
4
|
-
|
|
5
1
|
export let CloudStorageScope = /*#__PURE__*/function (CloudStorageScope) {
|
|
6
2
|
CloudStorageScope["Documents"] = "documents";
|
|
7
3
|
CloudStorageScope["AppData"] = "app_data";
|
|
8
4
|
return CloudStorageScope;
|
|
9
5
|
}({});
|
|
10
|
-
export let CloudStorageProvider = /*#__PURE__*/function (CloudStorageProvider) {
|
|
11
|
-
CloudStorageProvider["ICloud"] = "icloud";
|
|
12
|
-
CloudStorageProvider["GoogleDrive"] = "googledrive";
|
|
13
|
-
return CloudStorageProvider;
|
|
14
|
-
}({});
|
|
15
6
|
//# sourceMappingURL=main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CloudStorageScope"
|
|
1
|
+
{"version":3,"names":["CloudStorageScope"],"sourceRoot":"../../../src","sources":["types/main.ts"],"mappings":"AAAA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
export let CloudStorageErrorCode = /*#__PURE__*/function (CloudStorageErrorCode) {
|
|
4
|
-
CloudStorageErrorCode["INVALID_SCOPE"] = "ERR_INVALID_SCOPE";
|
|
5
2
|
CloudStorageErrorCode["FILE_NOT_FOUND"] = "ERR_FILE_NOT_FOUND";
|
|
6
3
|
CloudStorageErrorCode["PATH_IS_FILE"] = "ERR_PATH_IS_FILE";
|
|
7
4
|
CloudStorageErrorCode["PATH_IS_DIRECTORY"] = "ERR_PATH_IS_DIRECTORY";
|
|
@@ -16,7 +13,7 @@ export let CloudStorageErrorCode = /*#__PURE__*/function (CloudStorageErrorCode)
|
|
|
16
13
|
CloudStorageErrorCode["STAT_ERROR"] = "ERR_STAT_ERROR";
|
|
17
14
|
CloudStorageErrorCode["UNKNOWN"] = "ERR_UNKNOWN";
|
|
18
15
|
CloudStorageErrorCode["FILE_NOT_DOWNLOADABLE"] = "ERR_FILE_NOT_DOWNLOADABLE";
|
|
19
|
-
CloudStorageErrorCode["
|
|
16
|
+
CloudStorageErrorCode["GOOGLE_DRIVE_ACCESS_TOKEN_MISSING"] = "ERR_GOOGLE_DRIVE_ACCESS_TOKEN_MISSING";
|
|
20
17
|
return CloudStorageErrorCode;
|
|
21
18
|
}({});
|
|
22
19
|
//# sourceMappingURL=native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CloudStorageErrorCode"],"sourceRoot":"../../../src","sources":["types/native.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["CloudStorageErrorCode"],"sourceRoot":"../../../src","sources":["types/native.ts"],"mappings":"AAUA,WAAYA,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CloudStorageError","Error","constructor","message","code","details"],"sourceRoot":"../../../src","sources":["utils/CloudStorageError.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["CloudStorageError","Error","constructor","message","code","details"],"sourceRoot":"../../../src","sources":["utils/CloudStorageError.ts"],"mappings":"AAEA,MAAMA,iBAAiB,SAASC,KAAK,CAAC;EAIpCC,WAAWA,CAACC,OAAe,EAAEC,IAA2B,EAAEC,OAAa,EAAE;IACvE,KAAK,CAACF,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,OAAO,GAAGA,OAAO;EACxB;AACF;AAEA,eAAeL,iBAAiB"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the path starts with a leading slash and adds one if it doesn't to maintain backwards compatibility.
|
|
3
|
+
* Will log a warning to the console if it had to add a leading slash. Will throw an error in the future.
|
|
4
|
+
*
|
|
5
|
+
* @param path The path to check.
|
|
6
|
+
* @returns The path with a leading slash, if it didn't have one already.
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export const verifyLeadingSlash = path => {
|
|
10
|
+
if (!path.startsWith('/')) {
|
|
11
|
+
console.warn(`[react-native-cloud-storage] Path "${path}" did not start with a leading slash. This is deprecated and will be an error in the future.`);
|
|
12
|
+
return `/${path}`;
|
|
8
13
|
}
|
|
9
|
-
return
|
|
14
|
+
return path;
|
|
10
15
|
};
|
|
11
16
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["verifyLeadingSlash","path","startsWith","console","warn"],"sourceRoot":"../../../src","sources":["utils/helpers.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,kBAAkB,GAAIC,IAAY,IAAK;EAClD,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC,EAAE;IACzBC,OAAO,CAACC,IAAI,CACT,sCAAqCH,IAAK,8FAA6F,CACzI;IACD,OAAQ,IAAGA,IAAK,EAAC;EACnB;EACA,OAAOA,IAAI;AACb,CAAC"}
|
|
@@ -1,218 +1,98 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*/
|
|
16
|
-
static getDefaultProvider(): CloudStorageProvider;
|
|
17
|
-
/**
|
|
18
|
-
* Gets the list of supported CloudStorageProviders on the current platform.
|
|
19
|
-
* @returns An array of supported CloudStorageProviders.
|
|
20
|
-
*/
|
|
21
|
-
static getSupportedProviders(): CloudStorageProvider[];
|
|
22
|
-
/**
|
|
23
|
-
* Gets the current CloudStorageProvider.
|
|
24
|
-
* @returns The current CloudStorageProvider.
|
|
25
|
-
*/
|
|
26
|
-
getProvider(): CloudStorageProvider;
|
|
27
|
-
/**
|
|
28
|
-
* Sets the current CloudStorageProvider.
|
|
29
|
-
* @param provider The provider to set.
|
|
30
|
-
*/
|
|
31
|
-
setProvider(provider: CloudStorageProvider): void;
|
|
32
|
-
/**
|
|
33
|
-
* Gets the current options for the current provider.
|
|
34
|
-
* @returns The current options for the current provider.
|
|
35
|
-
*/
|
|
36
|
-
getProviderOptions(): CloudStorageProviderOptions[keyof CloudStorageProviderOptions];
|
|
37
|
-
/**
|
|
38
|
-
* Sets the options for the current provider.
|
|
39
|
-
* @param options The options to set for the provider.
|
|
40
|
-
*/
|
|
41
|
-
setProviderOptions(options: CloudStorageProviderOptions[keyof CloudStorageProviderOptions]): void;
|
|
42
|
-
subscribeToCloudAvailability(listener: (available: boolean) => void): void;
|
|
43
|
-
unsubscribeFromCloudAvailability(listener: (available: boolean) => void): void;
|
|
1
|
+
import { CloudStorageScope, type CloudStorageFileStat } from './types/main';
|
|
2
|
+
declare const RNCloudStorage: {
|
|
3
|
+
getDefaultScope: () => CloudStorageScope;
|
|
4
|
+
setDefaultScope: (scope: CloudStorageScope) => CloudStorageScope;
|
|
5
|
+
getGoogleDriveAccessToken: () => string | null;
|
|
6
|
+
setGoogleDriveAccessToken: (accessToken: string | null) => string | null;
|
|
7
|
+
setThrowOnFilesWithSameName: (enable: boolean) => boolean;
|
|
8
|
+
setTimeout: (timeout: number) => number;
|
|
9
|
+
subscribeToFilesWithSameName: (subscriber: ({ path, fileIds }: {
|
|
10
|
+
path: string;
|
|
11
|
+
fileIds: string[];
|
|
12
|
+
}) => void) => {
|
|
13
|
+
remove: () => void;
|
|
14
|
+
};
|
|
44
15
|
/**
|
|
45
16
|
* Tests whether or not the cloud storage is available. Always returns true for Google Drive. iCloud may be
|
|
46
17
|
* unavailable right after app launch or if the user is not logged in.
|
|
47
18
|
* @returns A promise that resolves to true if the cloud storage is available, false otherwise.
|
|
48
19
|
*/
|
|
49
|
-
isCloudAvailable()
|
|
20
|
+
isCloudAvailable: () => Promise<boolean>;
|
|
50
21
|
/**
|
|
51
22
|
* Appends the data to the file at the given path, creating the file if it doesn't exist.
|
|
52
23
|
* @param path The file to append to.
|
|
53
24
|
* @param data The data to append.
|
|
54
|
-
* @param scope The directory scope the path is in. Defaults to the default scope
|
|
25
|
+
* @param scope The directory scope the path is in. Defaults to the set default scope.
|
|
55
26
|
* @returns A promise that resolves when the data has been appended.
|
|
56
27
|
*/
|
|
57
|
-
appendFile(path: string, data: string, scope?: CloudStorageScope)
|
|
28
|
+
appendFile: (path: string, data: string, scope?: CloudStorageScope) => Promise<void>;
|
|
58
29
|
/**
|
|
59
30
|
* Tests whether or not the file at the given path exists.
|
|
60
31
|
* @param path The path to test.
|
|
61
|
-
* @param scope The directory scope the path is in. Defaults to set default scope
|
|
32
|
+
* @param scope The directory scope the path is in. Defaults to the set default scope.
|
|
62
33
|
* @returns A promise that resolves to true if the path exists, false otherwise.
|
|
63
34
|
*/
|
|
64
|
-
exists(path: string, scope?: CloudStorageScope)
|
|
35
|
+
exists: (path: string, scope?: CloudStorageScope) => Promise<boolean>;
|
|
65
36
|
/**
|
|
66
37
|
* Writes to the file at the given path, creating it if it doesn't exist or overwriting it if it does.
|
|
67
38
|
* @param path The file to write to.
|
|
68
39
|
* @param data The data to write.
|
|
69
|
-
* @param scope The directory scope the path is in. Defaults to set default scope
|
|
40
|
+
* @param scope The directory scope the path is in. Defaults to the set default scope.
|
|
70
41
|
* @returns A promise that resolves when the file has been written.
|
|
71
42
|
*/
|
|
72
|
-
writeFile(path: string, data: string, scope?: CloudStorageScope)
|
|
43
|
+
writeFile: (path: string, data: string, scope?: CloudStorageScope) => Promise<void>;
|
|
73
44
|
/**
|
|
74
45
|
* Creates a new directory at the given path.
|
|
75
46
|
* @param path The directory to create.
|
|
76
|
-
* @param scope The directory scope the path is in. Defaults to set default scope
|
|
47
|
+
* @param scope The directory scope the path is in. Defaults to the set default scope.
|
|
77
48
|
* @returns A promise that resolves when the directory has been created.
|
|
78
49
|
*/
|
|
79
|
-
mkdir(path: string, scope?: CloudStorageScope)
|
|
50
|
+
mkdir: (path: string, scope?: CloudStorageScope) => Promise<void>;
|
|
80
51
|
/**
|
|
81
52
|
* Lists the contents of the directory at the given path.
|
|
82
53
|
* @param path The directory to list.
|
|
83
|
-
* @param scope The directory scope the path is in. Defaults to set default scope
|
|
54
|
+
* @param scope The directory scope the path is in. Defaults to the set default scope.
|
|
84
55
|
* @returns A promise that resolves to an array of file names, excluding '.' and '..'.
|
|
85
56
|
*/
|
|
86
|
-
readdir(path: string, scope?: CloudStorageScope)
|
|
57
|
+
readdir: (path: string, scope?: CloudStorageScope) => Promise<string[]>;
|
|
87
58
|
/**
|
|
88
59
|
* Reads the contents of the file at the given path.
|
|
89
60
|
* @param path The file to read.
|
|
90
|
-
* @param scope The directory scope the path is in. Defaults to set default scope
|
|
61
|
+
* @param scope The directory scope the path is in. Defaults to the set default scope.
|
|
91
62
|
* @returns A promise that resolves to the contents of the file.
|
|
92
63
|
*/
|
|
93
|
-
readFile(path: string, scope?: CloudStorageScope)
|
|
64
|
+
readFile: (path: string, scope?: CloudStorageScope) => Promise<string>;
|
|
94
65
|
/**
|
|
95
|
-
* Downloads the file at the given path. Does not have any effect on Google Drive.
|
|
66
|
+
* Downloads the file at the given path from iCloud. Does not have any effect on Google Drive.
|
|
96
67
|
* @param path The file to trigger the download for.
|
|
97
|
-
* @param scope The directory scope the path is in. Defaults to set default scope
|
|
68
|
+
* @param scope The directory scope the path is in. Defaults to the set default scope.
|
|
98
69
|
* @returns A promise that resolves once the download has been triggered.
|
|
99
70
|
*/
|
|
100
|
-
downloadFile(path: string, scope?: CloudStorageScope)
|
|
71
|
+
downloadFile: (path: string, scope?: CloudStorageScope) => Promise<void>;
|
|
101
72
|
/**
|
|
102
73
|
* Deletes the file at the given path.
|
|
103
74
|
* @param path The file to delete.
|
|
104
|
-
* @param scope The directory scope the path is in. Defaults to set default scope
|
|
75
|
+
* @param scope The directory scope the path is in. Defaults to the set default scope.
|
|
105
76
|
* @returns A promise that resolves when the file has been deleted.
|
|
106
77
|
*/
|
|
107
|
-
unlink(path: string, scope?: CloudStorageScope)
|
|
78
|
+
unlink: (path: string, scope?: CloudStorageScope) => Promise<void>;
|
|
108
79
|
/**
|
|
109
80
|
* Deletes the directory at the given path.
|
|
110
81
|
* @param path The directory to delete.
|
|
111
82
|
* @param options Options for the delete operation. Defaults to { recursive: false }.
|
|
112
|
-
* @param scope The directory scope the path is in. Defaults to set default scope
|
|
83
|
+
* @param scope The directory scope the path is in. Defaults to the set default scope.
|
|
113
84
|
* @returns A promise that resolves when the directory has been deleted.
|
|
114
85
|
*/
|
|
115
|
-
rmdir(path: string, options?: {
|
|
86
|
+
rmdir: (path: string, options?: {
|
|
116
87
|
recursive?: boolean;
|
|
117
|
-
}, scope?: CloudStorageScope)
|
|
88
|
+
}, scope?: CloudStorageScope) => Promise<void>;
|
|
118
89
|
/**
|
|
119
90
|
* Gets the size, creation time, and modification time of the file at the given path.
|
|
120
91
|
* @param path The file to stat.
|
|
121
|
-
* @param scope The directory scope the path is in. Defaults to set default scope
|
|
122
|
-
* @returns A promise that resolves to the CloudStorageFileStat object.
|
|
123
|
-
*/
|
|
124
|
-
stat(path: string, scope?: CloudStorageScope): Promise<CloudStorageFileStat>;
|
|
125
|
-
static getDefaultInstance(): RNCloudStorage;
|
|
126
|
-
/**
|
|
127
|
-
* Gets the current options for the provider of the default static instance.
|
|
128
|
-
* @returns The current options for the provider of the default static instance.
|
|
129
|
-
*/
|
|
130
|
-
static getProviderOptions(): CloudStorageProviderOptions[keyof CloudStorageProviderOptions];
|
|
131
|
-
/**
|
|
132
|
-
* Sets the options for the provider of the default static instance.
|
|
133
|
-
* @param options The options to set for the provider of the default static instance.
|
|
134
|
-
*/
|
|
135
|
-
static setProviderOptions(options: CloudStorageProviderOptions[keyof CloudStorageProviderOptions]): void;
|
|
136
|
-
/**
|
|
137
|
-
* Tests whether or not the file at the given path exists in the provider of the default static instance.
|
|
138
|
-
* @param path The path to test.
|
|
139
|
-
* @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
|
|
140
|
-
* @returns A promise that resolves to true if the path exists, false otherwise.
|
|
141
|
-
*/
|
|
142
|
-
static exists(path: string, scope?: CloudStorageScope): Promise<boolean>;
|
|
143
|
-
/**
|
|
144
|
-
* Tests whether or not the cloud storage is available for the provider of the default static instance. Always returns true for Google Drive. iCloud may be
|
|
145
|
-
* unavailable right after app launch or if the user is not logged in.
|
|
146
|
-
* @returns A promise that resolves to true if the cloud storage is available, false otherwise.
|
|
147
|
-
*/
|
|
148
|
-
static isCloudAvailable(): Promise<boolean>;
|
|
149
|
-
/**
|
|
150
|
-
* Appends the data to the file at the given path in the provider of the default static instance, creating the file if it doesn't exist.
|
|
151
|
-
* @param path The file to append to.
|
|
152
|
-
* @param data The data to append.
|
|
153
|
-
* @param scope The directory scope the path is in. Defaults to the default scope set for the default static instance.
|
|
154
|
-
* @returns A promise that resolves when the data has been appended.
|
|
155
|
-
*/
|
|
156
|
-
static appendFile(path: string, data: string, scope?: CloudStorageScope): Promise<void>;
|
|
157
|
-
/**
|
|
158
|
-
* Writes to the file at the given path in the provider of the default static instance, creating it if it doesn't exist or overwriting it if it does.
|
|
159
|
-
* @param path The file to write to.
|
|
160
|
-
* @param data The data to write.
|
|
161
|
-
* @param scope The directory scope the path is in. Defaults to the default scope set for the default static instance.
|
|
162
|
-
* @returns A promise that resolves when the file has been written.
|
|
163
|
-
*/
|
|
164
|
-
static writeFile(path: string, data: string, scope?: CloudStorageScope): Promise<void>;
|
|
165
|
-
/**
|
|
166
|
-
* Creates a new directory at the given path in the provider of the default static instance.
|
|
167
|
-
* @param path The directory to create.
|
|
168
|
-
* @param scope The directory scope the path is in. Defaults to the default scope set for the default static instance.
|
|
169
|
-
* @returns A promise that resolves when the directory has been created.
|
|
170
|
-
*/
|
|
171
|
-
static mkdir(path: string, scope?: CloudStorageScope): Promise<void>;
|
|
172
|
-
/**
|
|
173
|
-
* Lists the contents of the directory at the given path in the provider of the default static instance.
|
|
174
|
-
* @param path The directory to list.
|
|
175
|
-
* @param scope The directory scope the path is in. Defaults to the default scope set for the default static instance.
|
|
176
|
-
* @returns A promise that resolves to an array of file names, excluding '.' and '..'.
|
|
177
|
-
*/
|
|
178
|
-
static readdir(path: string, scope?: CloudStorageScope): Promise<string[]>;
|
|
179
|
-
/**
|
|
180
|
-
* Reads the contents of the file at the given path in the provider of the default static instance.
|
|
181
|
-
* @param path The file to read.
|
|
182
|
-
* @param scope The directory scope the path is in. Defaults to the default scope set for the default static instance.
|
|
183
|
-
* @returns A promise that resolves to the contents of the file.
|
|
184
|
-
*/
|
|
185
|
-
static readFile(path: string, scope?: CloudStorageScope): Promise<string>;
|
|
186
|
-
/**
|
|
187
|
-
* Downloads the file at the given path in the provider of the default static instance. Does not have any effect on Google Drive.
|
|
188
|
-
* @param path The file to trigger the download for.
|
|
189
|
-
* @param scope The directory scope the path is in. Defaults to the default scope set for the default static instance.
|
|
190
|
-
* @returns A promise that resolves once the download has been triggered.
|
|
191
|
-
*/
|
|
192
|
-
static downloadFile(path: string, scope?: CloudStorageScope): Promise<void>;
|
|
193
|
-
/**
|
|
194
|
-
* Deletes the file at the given path in the provider of the default static instance.
|
|
195
|
-
* @param path The file to delete.
|
|
196
|
-
* @param scope The directory scope the path is in. Defaults to the default scope set for the default static instance.
|
|
197
|
-
* @returns A promise that resolves when the file has been deleted.
|
|
198
|
-
*/
|
|
199
|
-
static unlink(path: string, scope?: CloudStorageScope): Promise<void>;
|
|
200
|
-
/**
|
|
201
|
-
* Deletes the directory at the given path in the provider of the default static instance.
|
|
202
|
-
* @param path The directory to delete.
|
|
203
|
-
* @param options Options for the delete operation. Defaults to { recursive: false }.
|
|
204
|
-
* @param scope The directory scope the path is in. Defaults to the default scope set for the default static instance.
|
|
205
|
-
* @returns A promise that resolves when the directory has been deleted.
|
|
206
|
-
*/
|
|
207
|
-
static rmdir(path: string, options?: {
|
|
208
|
-
recursive?: boolean;
|
|
209
|
-
}, scope?: CloudStorageScope): Promise<void>;
|
|
210
|
-
/**
|
|
211
|
-
* Gets the size, creation time, and modification time of the file at the given path in the provider of the default static instance.
|
|
212
|
-
* @param path The file to stat.
|
|
213
|
-
* @param scope The directory scope the path is in. Defaults to the default scope set for the default static instance.
|
|
92
|
+
* @param scope The directory scope the path is in. Defaults to the set default scope.
|
|
214
93
|
* @returns A promise that resolves to the CloudStorageFileStat object.
|
|
215
94
|
*/
|
|
216
|
-
|
|
217
|
-
}
|
|
95
|
+
stat: (path: string, scope?: CloudStorageScope) => Promise<CloudStorageFileStat>;
|
|
96
|
+
};
|
|
97
|
+
export default RNCloudStorage;
|
|
218
98
|
//# sourceMappingURL=RNCloudStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RNCloudStorage.d.ts","sourceRoot":"","sources":["../../src/RNCloudStorage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RNCloudStorage.d.ts","sourceRoot":"","sources":["../../src/RNCloudStorage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAM5E,QAAA,MAAM,cAAc;;6BAEO,iBAAiB;;6CAED,MAAM,GAAG,IAAI;0CAChB,OAAO;0BACvB,MAAM;;;;;;;IAS5B;;;;OAIG;4BACyB,QAAQ,OAAO,CAAC;IAI5C;;;;;;OAMG;uBACgB,MAAM,QAAQ,MAAM,UAAU,iBAAiB,KAAG,QAAQ,IAAI,CAAC;IAIlF;;;;;OAKG;mBACY,MAAM,UAAU,iBAAiB,KAAG,QAAQ,OAAO,CAAC;IAInE;;;;;;OAMG;sBACe,MAAM,QAAQ,MAAM,UAAU,iBAAiB,KAAG,QAAQ,IAAI,CAAC;IAIjF;;;;;OAKG;kBACW,MAAM,UAAU,iBAAiB,KAAG,QAAQ,IAAI,CAAC;IAI/D;;;;;OAKG;oBACa,MAAM,UAAU,iBAAiB,KAAG,QAAQ,MAAM,EAAE,CAAC;IAIrE;;;;;OAKG;qBACc,MAAM,UAAU,iBAAiB,KAAG,QAAQ,MAAM,CAAC;IAIpE;;;;;OAKG;yBACkB,MAAM,UAAU,iBAAiB,KAAG,QAAQ,IAAI,CAAC;IAItE;;;;;OAKG;mBACY,MAAM,UAAU,iBAAiB,KAAG,QAAQ,IAAI,CAAC;IAIhE;;;;;;OAMG;kBACW,MAAM,YAAY;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,UAAU,iBAAiB,KAAG,QAAQ,IAAI,CAAC;IAIlG;;;;;OAKG;iBACgB,MAAM,UAAU,iBAAiB,KAAG,QAAQ,oBAAoB,CAAC;CAWrF,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRNCloudStorage.d.ts","sourceRoot":"","sources":["../../src/createRNCloudStorage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,oBAAoB,MAAM,gBAAgB,CAAC;AAmCvD,MAAM,CAAC,OAAO,UAAU,oBAAoB,IAAI,oBAAoB,CAgBnE"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type CloudStorageProviderOptions, type DeepRequired } from '../types/main';
|
|
2
1
|
import { type GoogleDriveFile, type GoogleDriveFileSpace } from './types';
|
|
3
2
|
export declare class GoogleDriveHttpError extends Error {
|
|
4
3
|
status: number;
|
|
@@ -6,9 +5,10 @@ export declare class GoogleDriveHttpError extends Error {
|
|
|
6
5
|
constructor(message: string, status: number, json: any);
|
|
7
6
|
}
|
|
8
7
|
export default class GoogleDriveApiClient {
|
|
8
|
+
accessToken: string;
|
|
9
|
+
timeout: number;
|
|
9
10
|
private _fetchTimeout;
|
|
10
|
-
|
|
11
|
-
constructor(options: DeepRequired<CloudStorageProviderOptions['googledrive']>);
|
|
11
|
+
constructor(accessToken?: string);
|
|
12
12
|
private buildQueryString;
|
|
13
13
|
private request;
|
|
14
14
|
private buildMultiPartBody;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/google-drive/client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/google-drive/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAG1B,MAAM,SAAS,CAAC;AAMjB,qBAAa,oBAAqB,SAAQ,KAAK;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,CAAC;gBAEL,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;CAKvD;AAID,MAAM,CAAC,OAAO,OAAO,oBAAoB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,aAAa,CAAM;gBAEf,WAAW,GAAE,MAAW;IAKpC,OAAO,CAAC,gBAAgB;YAeV,OAAO;IA0CrB,OAAO,CAAC,kBAAkB;IAab,SAAS,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAoBlE,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IASjD,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAO5C,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMzC,UAAU,CACrB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,EAC9C,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GACxC,OAAO,CAAC,IAAI,CAAC;IAeH,eAAe,CAAC,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAU9E,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAYlG"}
|
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type NativeRNCloudStorage from '../types/native';
|
|
2
2
|
import { type NativeRNCloudCloudStorageFileStat, type NativeRNCloudCloudStorageScope } from '../types/native';
|
|
3
|
-
import { type CloudStorageProviderOptions, type DeepRequired } from '../types/main';
|
|
4
3
|
/**
|
|
5
4
|
* A proxy class that wraps the Google Drive API client implementation to match the native iOS interface.
|
|
6
5
|
*/
|
|
7
|
-
export default class GoogleDrive implements
|
|
8
|
-
private drive;
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
export default class GoogleDrive implements NativeRNCloudStorage {
|
|
7
|
+
private static drive;
|
|
8
|
+
static throwOnFilesWithSameName: boolean;
|
|
9
|
+
filesWithSameNameSubscribers: (({ path, fileIds }: {
|
|
10
|
+
path: string;
|
|
11
|
+
fileIds: string[];
|
|
12
|
+
}) => void)[];
|
|
13
|
+
constructor();
|
|
14
|
+
static set accessToken(accessToken: string | null);
|
|
15
|
+
static set timeout(timeout: number);
|
|
16
|
+
static get accessToken(): string | null;
|
|
17
|
+
subscribeToFilesWithSameName(subscriber: ({ path, fileIds }: {
|
|
18
|
+
path: string;
|
|
19
|
+
fileIds: string[];
|
|
20
|
+
}) => void): {
|
|
21
|
+
remove: () => void;
|
|
22
|
+
};
|
|
11
23
|
isCloudAvailable: () => Promise<boolean>;
|
|
12
24
|
private getRootDirectory;
|
|
13
25
|
private resolvePathToDirectories;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/google-drive/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/google-drive/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,oBAAoB,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAEL,KAAK,iCAAiC,EACtC,KAAK,8BAA8B,EACpC,MAAM,iBAAiB,CAAC;AAMzB;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,YAAW,oBAAoB;IAC9D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAoD;IACxE,OAAc,wBAAwB,UAAS;IACxC,4BAA4B,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,KAAK,IAAI,CAAC,EAAE,CAAC;;IAuB1G,WAAkB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,EAOvD;IAED,WAAkB,OAAO,CAAC,OAAO,EAAE,MAAM,EAExC;IAED,WAAkB,WAAW,IAAI,MAAM,GAAG,IAAI,CAE7C;IAEM,4BAA4B,CAAC,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,KAAK,IAAI,GAAG;QACjH,MAAM,EAAE,MAAM,IAAI,CAAC;KACpB;IAUM,gBAAgB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAsD;IAErG,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,wBAAwB;IAQhC,OAAO,CAAC,qBAAqB;IAiD7B;;;;OAIG;YACW,kBAAkB;IAShC,OAAO,CAAC,gCAAgC;YAyB1B,SAAS;IAmDjB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,OAAO,CAAC;IAUjF,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC;IAwC9F,UAAU,CACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,8BAA8B,EACrC,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,IAAI,CAAC;IAmDV,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAajF,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BnF,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,MAAM,CAAC;IAM9E,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlF,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC;IAM9E,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBvG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,iCAAiC,CAAC;CAYhH"}
|