react-native-cloud-storage 2.2.2 → 2.3.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 +1 -1
- package/android/build.gradle +101 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/voicekit/CloudStorageError.kt +86 -0
- package/android/src/main/java/com/voicekit/CloudStorageLocalFileSystemModule.kt +236 -0
- package/android/src/main/java/com/voicekit/CloudStoragePackage.kt +17 -0
- package/android/src/main/java/com/voicekit/FileUtils.kt +41 -0
- package/android/src/main/java/com/voicekit/Types.kt +6 -0
- package/app.plugin.js +1 -1
- package/{lib/commonjs/RNCloudStorage.js → dist/commonjs/cloud-storage.js} +130 -80
- package/dist/commonjs/cloud-storage.js.map +1 -0
- package/dist/commonjs/expo-plugin/index.js +13 -0
- package/dist/commonjs/expo-plugin/index.js.map +1 -0
- package/{lib/commonjs/expo-plugin/withRNCloudStorageIos.js → dist/commonjs/expo-plugin/ios.js} +1 -1
- package/dist/commonjs/expo-plugin/ios.js.map +1 -0
- package/{lib/commonjs/hooks/useCloudFile.js → dist/commonjs/hooks/use-cloud-file.js} +26 -8
- package/dist/commonjs/hooks/use-cloud-file.js.map +1 -0
- package/{lib/commonjs/hooks/useIsCloudAvailable.js → dist/commonjs/hooks/use-is-cloud-available.js} +3 -3
- package/dist/commonjs/hooks/use-is-cloud-available.js.map +1 -0
- package/{lib → dist}/commonjs/index.js +10 -10
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/storages/cloudkit.js +10 -0
- package/dist/commonjs/storages/cloudkit.js.map +1 -0
- package/{lib/commonjs → dist/commonjs/storages}/google-drive/client.js +80 -38
- package/dist/commonjs/storages/google-drive/client.js.map +1 -0
- package/{lib/commonjs → dist/commonjs/storages}/google-drive/index.js +120 -64
- package/dist/commonjs/storages/google-drive/index.js.map +1 -0
- package/dist/commonjs/storages/google-drive/types.js.map +1 -0
- package/dist/commonjs/types/native.js +28 -0
- package/dist/commonjs/types/native.js.map +1 -0
- package/{lib/commonjs/utils/CloudStorageError.js → dist/commonjs/utils/cloud-storage-error.js} +3 -1
- package/dist/commonjs/utils/cloud-storage-error.js.map +1 -0
- package/dist/commonjs/utils/constants.js +24 -0
- package/dist/commonjs/utils/constants.js.map +1 -0
- package/dist/commonjs/utils/local-fs.js +16 -0
- package/dist/commonjs/utils/local-fs.js.map +1 -0
- package/dist/commonjs/utils/native.js +35 -0
- package/dist/commonjs/utils/native.js.map +1 -0
- package/{lib/module/RNCloudStorage.js → dist/module/cloud-storage.js} +130 -80
- package/dist/module/cloud-storage.js.map +1 -0
- package/dist/module/expo-plugin/index.js +8 -0
- package/dist/module/expo-plugin/index.js.map +1 -0
- package/{lib/module/expo-plugin/withRNCloudStorageIos.js → dist/module/expo-plugin/ios.js} +1 -1
- package/dist/module/expo-plugin/ios.js.map +1 -0
- package/{lib/module/hooks/useCloudFile.js → dist/module/hooks/use-cloud-file.js} +25 -7
- package/dist/module/hooks/use-cloud-file.js.map +1 -0
- package/{lib/module/hooks/useIsCloudAvailable.js → dist/module/hooks/use-is-cloud-available.js} +2 -2
- package/dist/module/hooks/use-is-cloud-available.js.map +1 -0
- package/dist/module/index.js +9 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/storages/cloudkit.js +6 -0
- package/dist/module/storages/cloudkit.js.map +1 -0
- package/{lib/module → dist/module/storages}/google-drive/client.js +80 -38
- package/dist/module/storages/google-drive/client.js.map +1 -0
- package/{lib/module → dist/module/storages}/google-drive/index.js +119 -62
- package/dist/module/storages/google-drive/index.js.map +1 -0
- package/dist/module/storages/google-drive/types.js.map +1 -0
- package/dist/module/types/native.js +24 -0
- package/dist/module/types/native.js.map +1 -0
- package/{lib/module/utils/CloudStorageError.js → dist/module/utils/cloud-storage-error.js} +3 -1
- package/dist/module/utils/cloud-storage-error.js.map +1 -0
- package/dist/module/utils/constants.js +20 -0
- package/dist/module/utils/constants.js.map +1 -0
- package/dist/module/utils/local-fs.js +12 -0
- package/dist/module/utils/local-fs.js.map +1 -0
- package/dist/module/utils/native.js +30 -0
- package/dist/module/utils/native.js.map +1 -0
- package/{lib/typescript/RNCloudStorage.d.ts → dist/typescript/cloud-storage.d.ts} +60 -8
- package/dist/typescript/cloud-storage.d.ts.map +1 -0
- package/{lib/typescript/expo-plugin/withRNCloudStorage.d.ts → dist/typescript/expo-plugin/index.d.ts} +1 -1
- package/dist/typescript/expo-plugin/index.d.ts.map +1 -0
- package/{lib/typescript/expo-plugin/withRNCloudStorageIos.d.ts → dist/typescript/expo-plugin/ios.d.ts} +1 -1
- package/dist/typescript/expo-plugin/ios.d.ts.map +1 -0
- package/{lib/typescript/hooks/useCloudFile.d.ts → dist/typescript/hooks/use-cloud-file.d.ts} +22 -4
- package/dist/typescript/hooks/use-cloud-file.d.ts.map +1 -0
- package/{lib/typescript/hooks/useIsCloudAvailable.d.ts → dist/typescript/hooks/use-is-cloud-available.d.ts} +2 -2
- package/dist/typescript/hooks/use-is-cloud-available.d.ts.map +1 -0
- package/dist/typescript/index.d.ts +7 -0
- package/dist/typescript/index.d.ts.map +1 -0
- package/dist/typescript/storages/cloudkit.d.ts +3 -0
- package/dist/typescript/storages/cloudkit.d.ts.map +1 -0
- package/{lib/typescript → dist/typescript/storages}/google-drive/client.d.ts +9 -2
- package/dist/typescript/storages/google-drive/client.d.ts.map +1 -0
- package/dist/typescript/storages/google-drive/index.d.ts +35 -0
- package/dist/typescript/storages/google-drive/index.d.ts.map +1 -0
- package/dist/typescript/storages/google-drive/types.d.ts.map +1 -0
- package/dist/typescript/types/native.d.ts +64 -0
- package/dist/typescript/types/native.d.ts.map +1 -0
- package/dist/typescript/utils/cloud-storage-error.d.ts +8 -0
- package/dist/typescript/utils/cloud-storage-error.d.ts.map +1 -0
- package/dist/typescript/utils/constants.d.ts +4 -0
- package/dist/typescript/utils/constants.d.ts.map +1 -0
- package/{lib → dist}/typescript/utils/helpers.d.ts.map +1 -1
- package/dist/typescript/utils/local-fs.d.ts +3 -0
- package/dist/typescript/utils/local-fs.d.ts.map +1 -0
- package/dist/typescript/utils/native.d.ts +7 -0
- package/dist/typescript/utils/native.d.ts.map +1 -0
- package/ios/CloudStorage.xcodeproj/project.pbxproj +12 -6
- package/ios/{CloudStorage.m → CloudStorageCloudKit.m} +4 -2
- package/ios/{CloudStorage.swift → CloudStorageCloudKit.swift} +60 -5
- package/ios/CloudStorageLocalFileSystem.m +15 -0
- package/ios/CloudStorageLocalFileSystem.swift +215 -0
- package/ios/Utils/CloudKitUtils.swift +4 -4
- package/ios/Utils/CloudStorageError.swift +8 -0
- package/ios/Utils/FileUtils.swift +19 -0
- package/ios/Utils/Types.swift +7 -1
- package/package.json +44 -103
- package/src/{RNCloudStorage.ts → cloud-storage.ts} +147 -85
- package/src/expo-plugin/{withRNCloudStorage.ts → index.ts} +2 -2
- package/src/hooks/{useCloudFile.ts → use-cloud-file.ts} +24 -6
- package/src/hooks/{useIsCloudAvailable.ts → use-is-cloud-available.ts} +1 -1
- package/src/index.ts +5 -6
- package/src/storages/cloudkit.ts +5 -0
- package/src/{google-drive → storages/google-drive}/client.ts +98 -40
- package/src/{google-drive → storages/google-drive}/index.ts +172 -89
- package/src/types/native.ts +50 -14
- package/src/utils/cloud-storage-error.ts +15 -0
- package/src/utils/constants.ts +20 -0
- package/src/utils/local-fs.ts +19 -0
- package/src/utils/native.ts +40 -0
- package/lib/commonjs/RNCloudStorage.js.map +0 -1
- package/lib/commonjs/expo-plugin/withRNCloudStorage.js +0 -13
- package/lib/commonjs/expo-plugin/withRNCloudStorage.js.map +0 -1
- package/lib/commonjs/expo-plugin/withRNCloudStorageIos.js.map +0 -1
- package/lib/commonjs/google-drive/client.js.map +0 -1
- package/lib/commonjs/google-drive/index.js.map +0 -1
- package/lib/commonjs/google-drive/types.js.map +0 -1
- package/lib/commonjs/hooks/useCloudFile.js.map +0 -1
- package/lib/commonjs/hooks/useIsCloudAvailable.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/types/native.js +0 -26
- package/lib/commonjs/types/native.js.map +0 -1
- package/lib/commonjs/utils/CloudStorageError.js.map +0 -1
- package/lib/module/RNCloudStorage.js.map +0 -1
- package/lib/module/expo-plugin/withRNCloudStorage.js +0 -8
- package/lib/module/expo-plugin/withRNCloudStorage.js.map +0 -1
- package/lib/module/expo-plugin/withRNCloudStorageIos.js.map +0 -1
- package/lib/module/google-drive/client.js.map +0 -1
- package/lib/module/google-drive/index.js.map +0 -1
- package/lib/module/google-drive/types.js.map +0 -1
- package/lib/module/hooks/useCloudFile.js.map +0 -1
- package/lib/module/hooks/useIsCloudAvailable.js.map +0 -1
- package/lib/module/index.js +0 -10
- package/lib/module/index.js.map +0 -1
- package/lib/module/types/native.js +0 -22
- package/lib/module/types/native.js.map +0 -1
- package/lib/module/utils/CloudStorageError.js.map +0 -1
- package/lib/typescript/RNCloudStorage.d.ts.map +0 -1
- package/lib/typescript/expo-plugin/withRNCloudStorage.d.ts.map +0 -1
- package/lib/typescript/expo-plugin/withRNCloudStorageIos.d.ts.map +0 -1
- package/lib/typescript/google-drive/client.d.ts.map +0 -1
- package/lib/typescript/google-drive/index.d.ts +0 -34
- package/lib/typescript/google-drive/index.d.ts.map +0 -1
- package/lib/typescript/google-drive/types.d.ts.map +0 -1
- package/lib/typescript/hooks/useCloudFile.d.ts.map +0 -1
- package/lib/typescript/hooks/useIsCloudAvailable.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -8
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/types/native.d.ts +0 -40
- package/lib/typescript/types/native.d.ts.map +0 -1
- package/lib/typescript/utils/CloudStorageError.d.ts +0 -8
- package/lib/typescript/utils/CloudStorageError.d.ts.map +0 -1
- package/src/utils/CloudStorageError.ts +0 -14
- /package/{lib → dist}/commonjs/expo-plugin/types/index.js +0 -0
- /package/{lib → dist}/commonjs/expo-plugin/types/index.js.map +0 -0
- /package/{lib/commonjs → dist/commonjs/storages}/google-drive/types.js +0 -0
- /package/{lib → dist}/commonjs/types/main.js +0 -0
- /package/{lib → dist}/commonjs/types/main.js.map +0 -0
- /package/{lib → dist}/commonjs/utils/helpers.js +0 -0
- /package/{lib → dist}/commonjs/utils/helpers.js.map +0 -0
- /package/{lib → dist}/module/expo-plugin/types/index.js +0 -0
- /package/{lib → dist}/module/expo-plugin/types/index.js.map +0 -0
- /package/{lib → dist}/module/package.json +0 -0
- /package/{lib/module → dist/module/storages}/google-drive/types.js +0 -0
- /package/{lib → dist}/module/types/main.js +0 -0
- /package/{lib → dist}/module/types/main.js.map +0 -0
- /package/{lib → dist}/module/utils/helpers.js +0 -0
- /package/{lib → dist}/module/utils/helpers.js.map +0 -0
- /package/{lib → dist}/typescript/expo-plugin/types/index.d.ts +0 -0
- /package/{lib → dist}/typescript/expo-plugin/types/index.d.ts.map +0 -0
- /package/{lib/typescript → dist/typescript/storages}/google-drive/types.d.ts +0 -0
- /package/{lib → dist}/typescript/types/main.d.ts +0 -0
- /package/{lib → dist}/typescript/types/main.d.ts.map +0 -0
- /package/{lib → dist}/typescript/utils/helpers.d.ts +0 -0
- /package/src/expo-plugin/{withRNCloudStorageIos.ts → ios.ts} +0 -0
- /package/src/{google-drive → storages/google-drive}/types.ts +0 -0
|
@@ -0,0 +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;EAC3B,CAAC;EACD,CAACT,oBAAoB,CAACU,WAAW,GAAG;IAClCF,KAAK,EAAEP,iBAAiB,CAACQ,OAAO;IAChCE,WAAW,EAAE,IAAI;IACjBC,eAAe,EAAE,KAAK;IACtBC,OAAO,EAAE;EACX;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeModules } from 'react-native';
|
|
4
|
+
import { createProxiedNativeModule } from '../utils/native';
|
|
5
|
+
import { LINKING_ERROR } from './constants';
|
|
6
|
+
const NativeLocalFileSystem = createProxiedNativeModule(NativeModules.CloudStorageLocalFileSystem);
|
|
7
|
+
export const localFileSystem = NativeLocalFileSystem ?? new Proxy({}, {
|
|
8
|
+
get() {
|
|
9
|
+
throw new Error(LINKING_ERROR);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=local-fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","createProxiedNativeModule","LINKING_ERROR","NativeLocalFileSystem","CloudStorageLocalFileSystem","localFileSystem","Proxy","get","Error"],"sourceRoot":"../../../src","sources":["utils/local-fs.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,cAAc;AAE5C,SAASC,yBAAyB,QAAQ,iBAAiB;AAC3D,SAASC,aAAa,QAAQ,aAAa;AAE3C,MAAMC,qBAAqB,GAAGF,yBAAyB,CACrDD,aAAa,CAACI,2BAChB,CAAC;AAED,OAAO,MAAMC,eAAe,GAC1BF,qBAAqB,IACpB,IAAIG,KAAK,CACR,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACN,aAAa,CAAC;EAChC;AACF,CACF,CAA4B","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeCloudStorageErrorCode } from '../types/native';
|
|
4
|
+
import CloudStorageError from './cloud-storage-error';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a proxied native module that wraps thrown errors in a CloudStorageError.
|
|
8
|
+
* @param nativeModule The native module to proxy.
|
|
9
|
+
* @returns The proxied native module.
|
|
10
|
+
*/
|
|
11
|
+
export const createProxiedNativeModule = nativeModule => {
|
|
12
|
+
if (!nativeModule) return null;
|
|
13
|
+
return new Proxy(nativeModule, {
|
|
14
|
+
get(target, property, receiver) {
|
|
15
|
+
const originalValue = Reflect.get(target, property, receiver);
|
|
16
|
+
if (typeof originalValue === 'function') {
|
|
17
|
+
return async (...arguments_) => {
|
|
18
|
+
try {
|
|
19
|
+
return await Reflect.apply(originalValue, target, arguments_);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
const error_ = typeof error === 'object' && error !== null && 'code' in error && typeof error.code === 'string' && Object.values(NativeCloudStorageErrorCode).includes(error.code) ? new CloudStorageError('message' in error && typeof error.message === 'string' ? error.message : 'Unknown error', error.code) : new CloudStorageError('Unknown error', NativeCloudStorageErrorCode.UNKNOWN, error);
|
|
22
|
+
throw error_;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return originalValue;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=native.js.map
|
|
@@ -0,0 +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,YAA2B,IAAe;EACpG,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":[]}
|
|
@@ -8,7 +8,7 @@ export default class RNCloudStorage {
|
|
|
8
8
|
* @param provider The provider to create the instance for. Defaults to the default provider for the current platform.
|
|
9
9
|
*/
|
|
10
10
|
constructor(provider?: CloudStorageProvider, options?: CloudStorageProviderOptions[keyof CloudStorageProviderOptions]);
|
|
11
|
-
private get
|
|
11
|
+
private get nativeStorage();
|
|
12
12
|
/**
|
|
13
13
|
* Gets the default CloudStorageProvider for the current platform.
|
|
14
14
|
* @returns The default CloudStorageProvider.
|
|
@@ -92,12 +92,38 @@ export default class RNCloudStorage {
|
|
|
92
92
|
*/
|
|
93
93
|
readFile(path: string, scope?: CloudStorageScope): Promise<string>;
|
|
94
94
|
/**
|
|
95
|
-
*
|
|
96
|
-
* @param path The file to trigger
|
|
95
|
+
* Triggers synchronization for the file at the given path. Does not have any effect on Google Drive.
|
|
96
|
+
* @param path The file to trigger synchronization for.
|
|
97
97
|
* @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
|
|
98
|
-
* @returns A promise that resolves once the
|
|
98
|
+
* @returns A promise that resolves once the synchronization has been triggered.
|
|
99
|
+
*/
|
|
100
|
+
triggerSync(path: string, scope?: CloudStorageScope): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Uploads the file at the given local path to the given path, creating it if it doesn't exist or overwriting it if it does.
|
|
103
|
+
* @param remotePath The remote path to upload to.
|
|
104
|
+
* @param localPath The local path of the file to upload.
|
|
105
|
+
* @param options The options for the upload. Must contain a `mimeType` property.
|
|
106
|
+
* @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
|
|
107
|
+
* @returns A promise that resolves when the file has been uploaded.
|
|
108
|
+
*/
|
|
109
|
+
uploadFile(remotePath: string, localPath: string, options: {
|
|
110
|
+
mimeType: string;
|
|
111
|
+
}, scope?: CloudStorageScope): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Triggers synchronization for the file at the given path. Does not have any effect on Google Drive.
|
|
114
|
+
* @param path The file to trigger synchronization for.
|
|
115
|
+
* @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
|
|
116
|
+
* @returns A promise that resolves once the synchronization has been triggered.
|
|
117
|
+
* @deprecated Use `triggerSync` instead.
|
|
99
118
|
*/
|
|
100
119
|
downloadFile(path: string, scope?: CloudStorageScope): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Downloads the cloud file at the given remote path to the given local path.
|
|
122
|
+
* @param remotePath The remote path of the file to download from the cloud.
|
|
123
|
+
* @param localPath The local path to download the cloud file to.
|
|
124
|
+
* @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
|
|
125
|
+
*/
|
|
126
|
+
downloadFile(remotePath: string, localPath: string, scope?: CloudStorageScope): Promise<void>;
|
|
101
127
|
/**
|
|
102
128
|
* Deletes the file at the given path.
|
|
103
129
|
* @param path The file to delete.
|
|
@@ -194,12 +220,38 @@ export default class RNCloudStorage {
|
|
|
194
220
|
*/
|
|
195
221
|
static readFile(path: string, scope?: CloudStorageScope): Promise<string>;
|
|
196
222
|
/**
|
|
197
|
-
*
|
|
198
|
-
* @param path The file to trigger
|
|
223
|
+
* Triggers synchronization for the file at the given path in the provider of the default static instance. Does not have any effect on Google Drive.
|
|
224
|
+
* @param path The file to trigger synchronization for.
|
|
199
225
|
* @param scope The directory scope the path is in. Defaults to the default scope set for the default static instance.
|
|
200
|
-
* @returns A promise that resolves once the
|
|
226
|
+
* @returns A promise that resolves once the synchronization has been triggered.
|
|
227
|
+
*/
|
|
228
|
+
static triggerSync(path: string, scope?: CloudStorageScope): Promise<void>;
|
|
229
|
+
/**
|
|
230
|
+
* Uploads the file at the given local path to the given path in the provider of the default static instance, creating it if it doesn't exist or overwriting it if it does.
|
|
231
|
+
* @param remotePath The remote path to upload to.
|
|
232
|
+
* @param localPath The local path of the file to upload.
|
|
233
|
+
* @param options The options for the upload. Must contain a `mimeType` property.
|
|
234
|
+
* @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
|
|
235
|
+
* @returns A promise that resolves when the file has been uploaded.
|
|
236
|
+
*/
|
|
237
|
+
static uploadFile(remotePath: string, localPath: string, options: {
|
|
238
|
+
mimeType: string;
|
|
239
|
+
}, scope?: CloudStorageScope): Promise<void>;
|
|
240
|
+
/**
|
|
241
|
+
* Triggers synchronization for the file at the given path in the provider of the default static instance. Does not have any effect on Google Drive.
|
|
242
|
+
* @param path The file to trigger synchronization for.
|
|
243
|
+
* @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
|
|
244
|
+
* @returns A promise that resolves once the synchronization has been triggered.
|
|
245
|
+
* @deprecated Use `triggerSync` instead.
|
|
201
246
|
*/
|
|
202
247
|
static downloadFile(path: string, scope?: CloudStorageScope): Promise<void>;
|
|
248
|
+
/**
|
|
249
|
+
* Downloads the cloud file at the given remote path to the given local path.
|
|
250
|
+
* @param remotePath The remote path of the file to download from the cloud.
|
|
251
|
+
* @param localPath The local path to download the cloud file to.
|
|
252
|
+
* @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
|
|
253
|
+
*/
|
|
254
|
+
static downloadFile(remotePath: string, localPath: string, scope?: CloudStorageScope): Promise<void>;
|
|
203
255
|
/**
|
|
204
256
|
* Deletes the file at the given path in the provider of the default static instance.
|
|
205
257
|
* @param path The file to delete.
|
|
@@ -225,4 +277,4 @@ export default class RNCloudStorage {
|
|
|
225
277
|
*/
|
|
226
278
|
static stat(path: string, scope?: CloudStorageScope): Promise<CloudStorageFileStat>;
|
|
227
279
|
}
|
|
228
|
-
//# sourceMappingURL=
|
|
280
|
+
//# sourceMappingURL=cloud-storage.d.ts.map
|
|
@@ -0,0 +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,EACzB,KAAK,2BAA2B,EAEjC,MAAM,cAAc,CAAC;AAStB,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAiB;IAC/C,OAAO,CAAC,QAAQ,CAGd;IACF,OAAO,CAAC,0BAA0B,CAAwC;IA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declare const withRNCloudStorage: ConfigPlugin<RNCloudStorageConfigPluginOptions>;
|
|
4
4
|
export default withRNCloudStorage;
|
|
5
|
-
//# sourceMappingURL=
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/expo-plugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,SAAS,CAAC;AAEjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIzD,QAAA,MAAM,kBAAkB,EAAE,YAAY,CAAC,iCAAiC,CAChC,CAAC;AAEzC,eAAe,kBAAkB,CAAC"}
|
|
@@ -2,4 +2,4 @@ import { type ConfigPlugin } from '@expo/config-plugins';
|
|
|
2
2
|
import type { RNCloudStorageConfigPluginOptions } from './types';
|
|
3
3
|
declare const withRNCloudStorageIos: ConfigPlugin<RNCloudStorageConfigPluginOptions>;
|
|
4
4
|
export default withRNCloudStorageIos;
|
|
5
|
-
//# sourceMappingURL=
|
|
5
|
+
//# sourceMappingURL=ios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../../src/expo-plugin/ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqD,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE5G,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,SAAS,CAAC;AA0CjE,QAAA,MAAM,qBAAqB,EAAE,YAAY,CAAC,iCAAiC,CAIvE,CAAC;AAEL,eAAe,qBAAqB,CAAC"}
|
package/{lib/typescript/hooks/useCloudFile.d.ts → dist/typescript/hooks/use-cloud-file.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CloudStorageScope } from '../types/main';
|
|
2
|
-
import RNCloudStorage from '../
|
|
2
|
+
import RNCloudStorage from '../cloud-storage';
|
|
3
3
|
/**
|
|
4
4
|
* A utility hook for reading and writing to a single file in the cloud.
|
|
5
5
|
* @param path The path to the file.
|
|
@@ -8,14 +8,32 @@ import RNCloudStorage from '../RNCloudStorage';
|
|
|
8
8
|
* @returns An object containing the file's contents and functions for downloading, reading, writing, and removing the file.
|
|
9
9
|
*/
|
|
10
10
|
export declare const useCloudFile: (path: string, scope?: CloudStorageScope, cloudStorageInstance?: RNCloudStorage) => {
|
|
11
|
+
/**
|
|
12
|
+
* The content of the file.
|
|
13
|
+
*/
|
|
11
14
|
content: string | null;
|
|
15
|
+
/**
|
|
16
|
+
* Reads the file from the cloud.
|
|
17
|
+
*/
|
|
12
18
|
read: () => Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Writes new content to the file.
|
|
21
|
+
*/
|
|
13
22
|
write: (newContent: string) => Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Deletes the file.
|
|
25
|
+
*/
|
|
14
26
|
remove: () => Promise<void>;
|
|
15
27
|
/**
|
|
16
|
-
*
|
|
17
|
-
* Google Drive.
|
|
28
|
+
* Triggers synchronization for the file. Needed if the file hasn't been synced yet from iCloud.
|
|
29
|
+
* Has no effect on Google Drive.
|
|
30
|
+
*/
|
|
31
|
+
sync: () => Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Triggers synchronization for the file. Needed if the file hasn't been synced yet from iCloud.
|
|
34
|
+
* Has no effect on Google Drive.
|
|
35
|
+
* @deprecated Use `sync` instead.
|
|
18
36
|
*/
|
|
19
37
|
download: () => Promise<void>;
|
|
20
38
|
};
|
|
21
|
-
//# sourceMappingURL=
|
|
39
|
+
//# sourceMappingURL=use-cloud-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-cloud-file.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-cloud-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAG9C;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,QAAQ,iBAAiB,EAAE,uBAAuB,cAAc;IAmCvG;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;wBA3BgB,MAAM;IA6BzB;;OAEG;;IAEH;;;OAGG;;IAEH;;;;OAIG;;CAGN,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import RNCloudStorage from '../
|
|
1
|
+
import RNCloudStorage from '../cloud-storage';
|
|
2
2
|
/**
|
|
3
3
|
* A hook that tests whether or not the cloud storage is available.
|
|
4
4
|
* @param cloudStorageInstance - An optional instance of RNCloudStorage to use instead of the default instance.
|
|
5
5
|
* @returns A boolean indicating whether or not the cloud storage is available.
|
|
6
6
|
*/
|
|
7
7
|
export declare const useIsCloudAvailable: (cloudStorageInstance?: RNCloudStorage) => boolean;
|
|
8
|
-
//# sourceMappingURL=
|
|
8
|
+
//# sourceMappingURL=use-is-cloud-available.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-is-cloud-available.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-is-cloud-available.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,uBAAuB,cAAc,YAqBxE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './types/main';
|
|
2
|
+
export * from './hooks/use-cloud-file';
|
|
3
|
+
export * from './hooks/use-is-cloud-available';
|
|
4
|
+
export { NativeCloudStorageErrorCode as CloudStorageErrorCode } from './types/native';
|
|
5
|
+
export { default as CloudStorageError } from './utils/cloud-storage-error';
|
|
6
|
+
export { default as CloudStorage } from './cloud-storage';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAE/C,OAAO,EAAE,2BAA2B,IAAI,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudkit.d.ts","sourceRoot":"","sources":["../../../src/storages/cloudkit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,eAAO,MAAM,cAAc,sBAA+E,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type CloudStorageProviderOptions, type DeepRequired } from '
|
|
1
|
+
import { type CloudStorageProviderOptions, type DeepRequired } from '../../types/main';
|
|
2
2
|
import { type GoogleDriveFile, type GoogleDriveFileSpace } from './types';
|
|
3
3
|
export declare class GoogleDriveHttpError extends Error {
|
|
4
4
|
status: number;
|
|
5
5
|
json: any;
|
|
6
|
-
constructor(message: string, status: number, json:
|
|
6
|
+
constructor(message: string, status: number, json: unknown);
|
|
7
7
|
}
|
|
8
8
|
export default class GoogleDriveApiClient {
|
|
9
9
|
private _fetchTimeout;
|
|
@@ -22,6 +22,9 @@ export default class GoogleDriveApiClient {
|
|
|
22
22
|
}, media: {
|
|
23
23
|
mimeType: string;
|
|
24
24
|
body: string;
|
|
25
|
+
} | {
|
|
26
|
+
mimeType: string;
|
|
27
|
+
localPath: string;
|
|
25
28
|
}): Promise<void>;
|
|
26
29
|
createDirectory(metadata: {
|
|
27
30
|
name: string;
|
|
@@ -30,6 +33,10 @@ export default class GoogleDriveApiClient {
|
|
|
30
33
|
updateFile(fileId: string, media: {
|
|
31
34
|
mimeType: string;
|
|
32
35
|
body: string;
|
|
36
|
+
} | {
|
|
37
|
+
mimeType: string;
|
|
38
|
+
localPath: string;
|
|
33
39
|
}): Promise<void>;
|
|
40
|
+
downloadFile(fileId: string, localPath: string): Promise<void>;
|
|
34
41
|
}
|
|
35
42
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/storages/google-drive/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,2BAA2B,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAG1B,MAAM,SAAS,CAAC;AAOjB,qBAAa,oBAAqB,SAAQ,KAAK;IACtC,MAAM,EAAE,MAAM,CAAC;IAEf,IAAI,EAAE,GAAG,CAAC;gBAEL,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAK3D;AAGD,MAAM,CAAC,OAAO,OAAO,oBAAoB;IACvC,OAAO,CAAC,aAAa,CAA+B;IACpD,OAAO,CAAC,OAAO,CAA2D;gBAE9D,OAAO,EAAE,YAAY,CAAC,2BAA2B,CAAC,aAAa,CAAC,CAAC;IAI7E,OAAO,CAAC,gBAAgB;YAeV,OAAO;IAqDrB,OAAO,CAAC,kBAAkB;IAeb,SAAS,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAqBlE,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,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAClF,OAAO,CAAC,IAAI,CAAC;IAqCH,eAAe,CAAC,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAU9E,UAAU,CACrB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAClF,OAAO,CAAC,IAAI,CAAC;IAyBH,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAQ5E"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { NativeStorage, type NativeStorageFileStat, type NativeStorageScope } from '../../types/native';
|
|
2
|
+
import { type CloudStorageProviderOptions, type DeepRequired } from '../../types/main';
|
|
3
|
+
/**
|
|
4
|
+
* A JavaScript-based implementation of the Google Drive API that implements the cloud storage interface.
|
|
5
|
+
*/
|
|
6
|
+
export default class GoogleDrive implements NativeStorage {
|
|
7
|
+
private drive;
|
|
8
|
+
private options;
|
|
9
|
+
constructor(options: DeepRequired<CloudStorageProviderOptions['googledrive']>);
|
|
10
|
+
isCloudAvailable: () => Promise<boolean>;
|
|
11
|
+
private getRootDirectory;
|
|
12
|
+
private resolvePathToDirectories;
|
|
13
|
+
private findParentDirectoryId;
|
|
14
|
+
/**
|
|
15
|
+
* Gets the Google Drive ID of the root directory for the given scope.
|
|
16
|
+
* @param scope The scope to get the root directory for.
|
|
17
|
+
* @returns A promise that resolves to the ID of the root directory or null if it could not be found.
|
|
18
|
+
*/
|
|
19
|
+
private getRootDirectoryId;
|
|
20
|
+
private checkIfMultipleFilesWithSameName;
|
|
21
|
+
private getFileId;
|
|
22
|
+
fileExists(path: string, scope: NativeStorageScope): Promise<boolean>;
|
|
23
|
+
appendToFile(path: string, data: string, scope: NativeStorageScope): Promise<void>;
|
|
24
|
+
createFile(path: string, data: string, scope: NativeStorageScope, overwrite: boolean): Promise<void>;
|
|
25
|
+
listFiles(path: string, scope: NativeStorageScope): Promise<string[]>;
|
|
26
|
+
createDirectory(path: string, scope: NativeStorageScope): Promise<void>;
|
|
27
|
+
readFile(path: string, scope: NativeStorageScope): Promise<string>;
|
|
28
|
+
triggerSync(_path: string, _scope: NativeStorageScope): Promise<void>;
|
|
29
|
+
deleteFile(path: string, scope: NativeStorageScope): Promise<void>;
|
|
30
|
+
deleteDirectory(path: string, recursive: boolean, scope: NativeStorageScope): Promise<void>;
|
|
31
|
+
statFile(path: string, scope: NativeStorageScope): Promise<NativeStorageFileStat>;
|
|
32
|
+
downloadFile(remotePath: string, localPath: string, scope: NativeStorageScope): Promise<void>;
|
|
33
|
+
uploadFile(remotePath: string, localPath: string, mimeType: string, scope: NativeStorageScope, overwrite: boolean): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storages/google-drive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,KAAK,2BAA2B,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEvF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,YAAW,aAAa;IACvD,OAAO,CAAC,KAAK,CAAuB;IACp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CAAC;IAC5B,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export type NativeStorageScope = 'documents' | 'app_data';
|
|
2
|
+
export interface NativeStorageFileStat {
|
|
3
|
+
size: number;
|
|
4
|
+
birthtimeMs: number;
|
|
5
|
+
mtimeMs: number;
|
|
6
|
+
isDirectory: boolean;
|
|
7
|
+
isFile: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare enum NativeCloudStorageErrorCode {
|
|
10
|
+
INVALID_SCOPE = "ERR_INVALID_SCOPE",
|
|
11
|
+
FILE_NOT_FOUND = "ERR_FILE_NOT_FOUND",
|
|
12
|
+
PATH_IS_FILE = "ERR_PATH_IS_FILE",
|
|
13
|
+
PATH_IS_DIRECTORY = "ERR_PATH_IS_DIRECTORY",
|
|
14
|
+
DIRECTORY_NOT_FOUND = "ERR_DIRECTORY_NOT_FOUND",
|
|
15
|
+
DIRECTORY_NOT_EMPTY = "ERR_DIRECTORY_NOT_EMPTY",
|
|
16
|
+
FILE_ALREADY_EXISTS = "ERR_FILE_EXISTS",
|
|
17
|
+
MULTIPLE_FILES_SAME_NAME = "ERR_MULTIPLE_FILES_SAME_NAME",
|
|
18
|
+
AUTHENTICATION_FAILED = "ERR_AUTHENTICATION_FAILED",
|
|
19
|
+
WRITE_ERROR = "ERR_WRITE_ERROR",
|
|
20
|
+
READ_ERROR = "ERR_READ_ERROR",
|
|
21
|
+
DELETE_ERROR = "ERR_DELETE_ERROR",
|
|
22
|
+
STAT_ERROR = "ERR_STAT_ERROR",
|
|
23
|
+
UNKNOWN = "ERR_UNKNOWN",
|
|
24
|
+
FILE_NOT_DOWNLOADABLE = "ERR_FILE_NOT_DOWNLOADABLE",
|
|
25
|
+
ACCESS_TOKEN_MISSING = "ERR_ACCESS_TOKEN_MISSING",
|
|
26
|
+
INVALID_URL = "ERR_INVALID_URL",
|
|
27
|
+
NETWORK_ERROR = "ERR_NETWORK_ERROR"
|
|
28
|
+
}
|
|
29
|
+
export interface NativeLocalFileSystem {
|
|
30
|
+
getConstants: () => {
|
|
31
|
+
temporaryDirectory: string;
|
|
32
|
+
};
|
|
33
|
+
createFile: (path: string, data: string) => Promise<string>;
|
|
34
|
+
readFile: (path: string) => Promise<string>;
|
|
35
|
+
downloadFile: (remoteUri: string, localPath: string, options?: {
|
|
36
|
+
headers?: Record<string, string>;
|
|
37
|
+
}) => Promise<void>;
|
|
38
|
+
uploadFile: (localPath: string, remoteUri: string, options?: {
|
|
39
|
+
headers?: Record<string, string>;
|
|
40
|
+
method?: 'PUT' | 'POST' | 'PATCH';
|
|
41
|
+
} & ({
|
|
42
|
+
uploadType?: 'binary';
|
|
43
|
+
} | {
|
|
44
|
+
uploadType?: 'multipart';
|
|
45
|
+
fieldName?: string;
|
|
46
|
+
parameters?: Record<string, string>;
|
|
47
|
+
})) => Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
export interface NativeStorage {
|
|
50
|
+
fileExists: (path: string, scope: NativeStorageScope) => Promise<boolean>;
|
|
51
|
+
appendToFile: (path: string, data: string, scope: NativeStorageScope) => Promise<void>;
|
|
52
|
+
createFile: (path: string, data: string, scope: NativeStorageScope, overwrite: boolean) => Promise<void>;
|
|
53
|
+
createDirectory: (path: string, scope: NativeStorageScope) => Promise<void>;
|
|
54
|
+
listFiles: (path: string, scope: NativeStorageScope) => Promise<string[]>;
|
|
55
|
+
readFile: (path: string, scope: NativeStorageScope) => Promise<string>;
|
|
56
|
+
deleteFile: (path: string, scope: NativeStorageScope) => Promise<void>;
|
|
57
|
+
deleteDirectory: (path: string, recursively: boolean, scope: NativeStorageScope) => Promise<void>;
|
|
58
|
+
statFile: (path: string, scope: NativeStorageScope) => Promise<NativeStorageFileStat>;
|
|
59
|
+
downloadFile: (remotePath: string, localPath: string, scope: NativeStorageScope) => Promise<void>;
|
|
60
|
+
uploadFile: (remotePath: string, localPath: string, mimeType: string, scope: NativeStorageScope, overwrite: boolean) => Promise<void>;
|
|
61
|
+
isCloudAvailable: () => Promise<boolean>;
|
|
62
|
+
triggerSync: (path: string, scope: NativeStorageScope) => Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/types/native.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,UAAU,CAAC;AAE1D,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,oBAAY,2BAA2B;IACrC,aAAa,sBAAsB;IACnC,cAAc,uBAAuB;IACrC,YAAY,qBAAqB;IACjC,iBAAiB,0BAA0B;IAC3C,mBAAmB,4BAA4B;IAC/C,mBAAmB,4BAA4B;IAC/C,mBAAmB,oBAAoB;IACvC,wBAAwB,iCAAiC;IACzD,qBAAqB,8BAA8B;IACnD,WAAW,oBAAoB;IAC/B,UAAU,mBAAmB;IAC7B,YAAY,qBAAqB;IACjC,UAAU,mBAAmB;IAC7B,OAAO,gBAAgB;IACvB,qBAAqB,8BAA8B;IACnD,oBAAoB,6BAA6B;IACjD,WAAW,oBAAoB;IAC/B,aAAa,sBAAsB;CACpC;AAED,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM;QAClB,kBAAkB,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5D,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,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C;IAC1E,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACvE,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvE,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClG,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACtF,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClG,UAAU,EAAE,CACV,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAE,OAAO,KACf,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,gBAAgB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACzE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NativeCloudStorageErrorCode } from '../types/native';
|
|
2
|
+
declare class CloudStorageError extends Error {
|
|
3
|
+
code: NativeCloudStorageErrorCode;
|
|
4
|
+
details?: any;
|
|
5
|
+
constructor(message: string, code: NativeCloudStorageErrorCode, details?: any);
|
|
6
|
+
}
|
|
7
|
+
export default CloudStorageError;
|
|
8
|
+
//# sourceMappingURL=cloud-storage-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-storage-error.d.ts","sourceRoot":"","sources":["../../../src/utils/cloud-storage-error.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAEnE,cAAM,iBAAkB,SAAQ,KAAK;IACnC,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,CAAC,EAAE,GAAG,CAAC;gBAEF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B,EAAE,OAAO,CAAC,EAAE,GAAG;CAK9E;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,2BAA2B,EAAqB,YAAY,EAAE,MAAM,eAAe,CAAC;AAEnH,eAAO,MAAM,aAAa,QAIO,CAAC;AAElC,eAAO,MAAM,wBAAwB,EAAE,YAAY,CAAC,2BAA2B,CAU9E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGrD,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGrD,eAAO,MAAM,mBAAmB,GAAI,UAAU,oBAAoB,KAAG,OAMpE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-fs.d.ts","sourceRoot":"","sources":["../../../src/utils/local-fs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,IAAI,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAQlF,eAAO,MAAM,eAAe,wBASE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a proxied native module that wraps thrown errors in a CloudStorageError.
|
|
3
|
+
* @param nativeModule The native module to proxy.
|
|
4
|
+
* @returns The proxied native module.
|
|
5
|
+
*/
|
|
6
|
+
export declare const createProxiedNativeModule: <T extends object>(nativeModule: T | undefined) => T | null;
|
|
7
|
+
//# sourceMappingURL=native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/utils/native.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,CAAC,SAAS,MAAM,EAAE,cAAc,CAAC,GAAG,SAAS,KAAG,CAAC,GAAG,IA+B7F,CAAC"}
|
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
objects = {
|
|
8
8
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
|
+
5038BD322DFB657800C1D225 /* CloudStorageLocalFileSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5038BD312DFB656A00C1D225 /* CloudStorageLocalFileSystem.swift */; };
|
|
10
11
|
50ADE3732B56EE1300DB5583 /* CloudStorageEventEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5009AB9B2B56ECD30058E83A /* CloudStorageEventEmitter.swift */; };
|
|
11
12
|
50BC353B2CA6ED940085E8B9 /* FileUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50BC353A2CA6ED940085E8B9 /* FileUtils.swift */; };
|
|
12
13
|
50BC353F2CA6EF760085E8B9 /* Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50BC353E2CA6EF760085E8B9 /* Types.swift */; };
|
|
13
14
|
50BC35412CA6F0E80085E8B9 /* CloudKitUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50BC35402CA6F0E80085E8B9 /* CloudKitUtils.swift */; };
|
|
14
15
|
50BC35452CA6FA6D0085E8B9 /* CloudStorageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50BC35442CA6FA6D0085E8B9 /* CloudStorageError.swift */; };
|
|
15
16
|
50BC35472CA6FF3F0085E8B9 /* Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50BC35462CA6FF3F0085E8B9 /* Promise.swift */; };
|
|
16
|
-
F4FF95D7245B92E800C19C63 /*
|
|
17
|
+
F4FF95D7245B92E800C19C63 /* CloudStorageCloudKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* CloudStorageCloudKit.swift */; };
|
|
17
18
|
/* End PBXBuildFile section */
|
|
18
19
|
|
|
19
20
|
/* Begin PBXCopyFilesBuildPhase section */
|
|
@@ -31,15 +32,17 @@
|
|
|
31
32
|
/* Begin PBXFileReference section */
|
|
32
33
|
134814201AA4EA6300B7C361 /* libCloudStorage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCloudStorage.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
33
34
|
5009AB9B2B56ECD30058E83A /* CloudStorageEventEmitter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloudStorageEventEmitter.swift; sourceTree = "<group>"; };
|
|
35
|
+
5038BD312DFB656A00C1D225 /* CloudStorageLocalFileSystem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloudStorageLocalFileSystem.swift; sourceTree = "<group>"; };
|
|
36
|
+
5038BD352DFB659F00C1D225 /* CloudStorageLocalFileSystem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CloudStorageLocalFileSystem.m; sourceTree = "<group>"; };
|
|
34
37
|
50ADE3712B56EDFB00DB5583 /* CloudStorageEventEmitter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CloudStorageEventEmitter.m; sourceTree = "<group>"; };
|
|
35
38
|
50BC353A2CA6ED940085E8B9 /* FileUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileUtils.swift; sourceTree = "<group>"; };
|
|
36
39
|
50BC353E2CA6EF760085E8B9 /* Types.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Types.swift; sourceTree = "<group>"; };
|
|
37
40
|
50BC35402CA6F0E80085E8B9 /* CloudKitUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloudKitUtils.swift; sourceTree = "<group>"; };
|
|
38
41
|
50BC35442CA6FA6D0085E8B9 /* CloudStorageError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloudStorageError.swift; sourceTree = "<group>"; };
|
|
39
42
|
50BC35462CA6FF3F0085E8B9 /* Promise.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Promise.swift; sourceTree = "<group>"; };
|
|
40
|
-
B3E7B5891CC2AC0600A0062D /*
|
|
43
|
+
B3E7B5891CC2AC0600A0062D /* CloudStorageCloudKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CloudStorageCloudKit.m; sourceTree = "<group>"; };
|
|
41
44
|
F4FF95D5245B92E700C19C63 /* CloudStorage-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CloudStorage-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
42
|
-
F4FF95D6245B92E800C19C63 /*
|
|
45
|
+
F4FF95D6245B92E800C19C63 /* CloudStorageCloudKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloudStorageCloudKit.swift; sourceTree = "<group>"; };
|
|
43
46
|
/* End PBXFileReference section */
|
|
44
47
|
|
|
45
48
|
/* Begin PBXFrameworksBuildPhase section */
|
|
@@ -77,10 +80,12 @@
|
|
|
77
80
|
isa = PBXGroup;
|
|
78
81
|
children = (
|
|
79
82
|
50BC35482CA704A60085E8B9 /* Utils */,
|
|
83
|
+
F4FF95D6245B92E800C19C63 /* CloudStorageCloudKit.swift */,
|
|
84
|
+
B3E7B5891CC2AC0600A0062D /* CloudStorageCloudKit.m */,
|
|
80
85
|
50ADE3712B56EDFB00DB5583 /* CloudStorageEventEmitter.m */,
|
|
81
86
|
5009AB9B2B56ECD30058E83A /* CloudStorageEventEmitter.swift */,
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
5038BD312DFB656A00C1D225 /* CloudStorageLocalFileSystem.swift */,
|
|
88
|
+
5038BD352DFB659F00C1D225 /* CloudStorageLocalFileSystem.m */,
|
|
84
89
|
F4FF95D5245B92E700C19C63 /* CloudStorage-Bridging-Header.h */,
|
|
85
90
|
134814211AA4EA7D00B7C361 /* Products */,
|
|
86
91
|
);
|
|
@@ -143,11 +148,12 @@
|
|
|
143
148
|
isa = PBXSourcesBuildPhase;
|
|
144
149
|
buildActionMask = 2147483647;
|
|
145
150
|
files = (
|
|
151
|
+
5038BD322DFB657800C1D225 /* CloudStorageLocalFileSystem.swift in Sources */,
|
|
146
152
|
50BC353B2CA6ED940085E8B9 /* FileUtils.swift in Sources */,
|
|
147
153
|
50BC35412CA6F0E80085E8B9 /* CloudKitUtils.swift in Sources */,
|
|
148
154
|
50BC35472CA6FF3F0085E8B9 /* Promise.swift in Sources */,
|
|
149
155
|
50BC35452CA6FA6D0085E8B9 /* CloudStorageError.swift in Sources */,
|
|
150
|
-
F4FF95D7245B92E800C19C63 /*
|
|
156
|
+
F4FF95D7245B92E800C19C63 /* CloudStorageCloudKit.swift in Sources */,
|
|
151
157
|
50ADE3732B56EE1300DB5583 /* CloudStorageEventEmitter.swift in Sources */,
|
|
152
158
|
50BC353F2CA6EF760085E8B9 /* Types.swift in Sources */,
|
|
153
159
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#import <React/RCTBridgeModule.h>
|
|
2
2
|
|
|
3
|
-
@interface RCT_EXTERN_MODULE(
|
|
3
|
+
@interface RCT_EXTERN_MODULE(CloudStorageCloudKit, NSObject)
|
|
4
4
|
|
|
5
5
|
RCT_EXTERN_METHOD(fileExists:(NSString *)path withScope:(NSString *)scope withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
6
6
|
RCT_EXTERN_METHOD(appendToFile:(NSString *)path withData:(NSString *)data withScope:(NSString *)scope withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
@@ -8,10 +8,12 @@ RCT_EXTERN_METHOD(createFile:(NSString *)path withData:(NSString *)data withScop
|
|
|
8
8
|
RCT_EXTERN_METHOD(createDirectory:(NSString *)path withScope:(NSString *)scope withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
9
9
|
RCT_EXTERN_METHOD(listFiles:(NSString *)path withScope:(NSString *)scope withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
10
10
|
RCT_EXTERN_METHOD(readFile:(NSString *)path withScope:(NSString *)scope withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
11
|
-
RCT_EXTERN_METHOD(
|
|
11
|
+
RCT_EXTERN_METHOD(triggerSync:(NSString *)path withScope:(NSString *)scope withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
12
12
|
RCT_EXTERN_METHOD(deleteFile:(NSString *)path withScope:(NSString *)scope withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
13
13
|
RCT_EXTERN_METHOD(deleteDirectory:(NSString *)path withRecursive:(BOOL)recursive withScope:(NSString *)scope withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
14
14
|
RCT_EXTERN_METHOD(statFile:(NSString *)path withScope:(NSString *)scope withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
15
|
+
RCT_EXTERN_METHOD(downloadFile:(NSString *)remotePath withLocalPath:(NSString *)localPath withScope:(NSString *)scope withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
16
|
+
RCT_EXTERN_METHOD(uploadFile:(NSString *)remotePath withLocalPath:(NSString *)localPath withMimeType:(NSString *)mimeType withScope:(NSString *)scope withOverwrite:(BOOL)overwrite withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
15
17
|
RCT_EXTERN_METHOD(isCloudAvailable:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
16
18
|
|
|
17
19
|
+ (BOOL)requiresMainQueueSetup
|