react-native-cloud-storage 2.3.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +1 -1
  2. package/android/build.gradle +1 -14
  3. package/android/src/main/java/com/voicekit/CloudStorageLocalFileSystemModule.kt +16 -20
  4. package/android/src/main/java/com/voicekit/CloudStoragePackage.kt +23 -8
  5. package/dist/commonjs/cloud-storage.js +68 -31
  6. package/dist/commonjs/cloud-storage.js.map +1 -1
  7. package/dist/commonjs/specs/NativeCloudStorageCloudKitIOS.js +9 -0
  8. package/dist/commonjs/specs/NativeCloudStorageCloudKitIOS.js.map +1 -0
  9. package/dist/commonjs/specs/NativeCloudStorageLocalFileSystem.js +9 -0
  10. package/dist/commonjs/specs/NativeCloudStorageLocalFileSystem.js.map +1 -0
  11. package/dist/commonjs/storages/cloudkit.js +5 -3
  12. package/dist/commonjs/storages/cloudkit.js.map +1 -1
  13. package/dist/commonjs/storages/google-drive/client.js +3 -2
  14. package/dist/commonjs/storages/google-drive/client.js.map +1 -1
  15. package/dist/commonjs/storages/google-drive/index.js +99 -77
  16. package/dist/commonjs/storages/google-drive/index.js.map +1 -1
  17. package/dist/commonjs/types/main.js +18 -1
  18. package/dist/commonjs/types/main.js.map +1 -1
  19. package/dist/commonjs/utils/constants.js +2 -1
  20. package/dist/commonjs/utils/constants.js.map +1 -1
  21. package/dist/commonjs/utils/local-fs.js +3 -2
  22. package/dist/commonjs/utils/local-fs.js.map +1 -1
  23. package/dist/commonjs/utils/native.js.map +1 -1
  24. package/dist/module/cloud-storage.js +70 -33
  25. package/dist/module/cloud-storage.js.map +1 -1
  26. package/dist/module/specs/NativeCloudStorageCloudKitIOS.js +5 -0
  27. package/dist/module/specs/NativeCloudStorageCloudKitIOS.js.map +1 -0
  28. package/dist/module/specs/NativeCloudStorageLocalFileSystem.js +5 -0
  29. package/dist/module/specs/NativeCloudStorageLocalFileSystem.js.map +1 -0
  30. package/dist/module/storages/cloudkit.js +3 -2
  31. package/dist/module/storages/cloudkit.js.map +1 -1
  32. package/dist/module/storages/google-drive/client.js +3 -2
  33. package/dist/module/storages/google-drive/client.js.map +1 -1
  34. package/dist/module/storages/google-drive/index.js +99 -77
  35. package/dist/module/storages/google-drive/index.js.map +1 -1
  36. package/dist/module/types/main.js +21 -1
  37. package/dist/module/types/main.js.map +1 -1
  38. package/dist/module/utils/constants.js +2 -1
  39. package/dist/module/utils/constants.js.map +1 -1
  40. package/dist/module/utils/local-fs.js +2 -2
  41. package/dist/module/utils/local-fs.js.map +1 -1
  42. package/dist/module/utils/native.js.map +1 -1
  43. package/dist/typescript/cloud-storage.d.ts +15 -6
  44. package/dist/typescript/cloud-storage.d.ts.map +1 -1
  45. package/dist/typescript/specs/NativeCloudStorageCloudKitIOS.d.ts +30 -0
  46. package/dist/typescript/specs/NativeCloudStorageCloudKitIOS.d.ts.map +1 -0
  47. package/dist/typescript/specs/NativeCloudStorageLocalFileSystem.d.ts +24 -0
  48. package/dist/typescript/specs/NativeCloudStorageLocalFileSystem.d.ts.map +1 -0
  49. package/dist/typescript/storages/cloudkit.d.ts +3 -0
  50. package/dist/typescript/storages/cloudkit.d.ts.map +1 -1
  51. package/dist/typescript/storages/google-drive/client.d.ts +1 -1
  52. package/dist/typescript/storages/google-drive/client.d.ts.map +1 -1
  53. package/dist/typescript/storages/google-drive/index.d.ts +7 -1
  54. package/dist/typescript/storages/google-drive/index.d.ts.map +1 -1
  55. package/dist/typescript/types/main.d.ts +27 -0
  56. package/dist/typescript/types/main.d.ts.map +1 -1
  57. package/dist/typescript/types/native.d.ts +6 -43
  58. package/dist/typescript/types/native.d.ts.map +1 -1
  59. package/dist/typescript/utils/constants.d.ts.map +1 -1
  60. package/dist/typescript/utils/local-fs.d.ts +1 -2
  61. package/dist/typescript/utils/local-fs.d.ts.map +1 -1
  62. package/dist/typescript/utils/native.d.ts +1 -1
  63. package/dist/typescript/utils/native.d.ts.map +1 -1
  64. package/ios/CloudStorage-Bridging-Header.h +0 -1
  65. package/ios/CloudStorageCloudKit.swift +15 -14
  66. package/ios/CloudStorageLocalFileSystem.swift +7 -6
  67. package/ios/RCTCloudStorageCloudKit.mm +218 -0
  68. package/ios/RCTCloudStorageLocalFileSystem.mm +149 -0
  69. package/ios/Utils/CloudKitUtils.swift +8 -2
  70. package/ios/Utils/FileUtils.swift +2 -4
  71. package/ios/Utils/Promise.swift +1 -0
  72. package/ios/Utils/Types.swift +1 -0
  73. package/ios/react_native_cloud_storage.h +6 -0
  74. package/package.json +31 -17
  75. package/react-native-cloud-storage.podspec +2 -0
  76. package/src/cloud-storage.ts +98 -50
  77. package/src/specs/NativeCloudStorageCloudKitIOS.ts +33 -0
  78. package/src/specs/NativeCloudStorageLocalFileSystem.ts +28 -0
  79. package/src/storages/cloudkit.ts +10 -2
  80. package/src/storages/google-drive/client.ts +2 -1
  81. package/src/storages/google-drive/index.ts +126 -120
  82. package/src/types/main.ts +29 -1
  83. package/src/types/native.ts +10 -54
  84. package/src/utils/constants.ts +1 -0
  85. package/src/utils/local-fs.ts +2 -2
  86. package/src/utils/native.ts +1 -1
  87. package/ios/CloudStorageCloudKit.m +0 -24
  88. package/ios/CloudStorageEventEmitter.m +0 -16
  89. package/ios/CloudStorageEventEmitter.swift +0 -30
  90. package/ios/CloudStorageLocalFileSystem.m +0 -15
@@ -0,0 +1,30 @@
1
+ import type { CodegenTypes, TurboModule } from 'react-native';
2
+ export type CloudStorageFileStat = {
3
+ size: number;
4
+ birthtimeMs: number;
5
+ mtimeMs: number;
6
+ isDirectory: boolean;
7
+ isFile: boolean;
8
+ };
9
+ export type CloudAvailabilityChangedEvent = {
10
+ available: boolean;
11
+ };
12
+ export interface Spec extends TurboModule {
13
+ fileExists(path: string, scope: string): Promise<boolean>;
14
+ appendToFile(path: string, data: string, scope: string): Promise<void>;
15
+ createFile(path: string, data: string, scope: string, overwrite: boolean): Promise<void>;
16
+ createDirectory(path: string, scope: string): Promise<void>;
17
+ listFiles(path: string, scope: string): Promise<Array<string>>;
18
+ readFile(path: string, scope: string): Promise<string>;
19
+ triggerSync(path: string, scope: string): Promise<void>;
20
+ deleteFile(path: string, scope: string): Promise<void>;
21
+ deleteDirectory(path: string, recursive: boolean, scope: string): Promise<void>;
22
+ statFile(path: string, scope: string): Promise<CloudStorageFileStat>;
23
+ downloadFile(remotePath: string, localPath: string, scope: string): Promise<void>;
24
+ uploadFile(remotePath: string, localPath: string, mimeType: string, scope: string, overwrite: boolean): Promise<void>;
25
+ isCloudAvailable(): Promise<boolean>;
26
+ readonly onCloudAvailabilityChanged: CodegenTypes.EventEmitter<CloudAvailabilityChangedEvent>;
27
+ }
28
+ declare const _default: Spec | null;
29
+ export default _default;
30
+ //# sourceMappingURL=NativeCloudStorageCloudKitIOS.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeCloudStorageCloudKitIOS.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeCloudStorageCloudKitIOS.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG9D,MAAM,MAAM,oBAAoB,GAAG;IACjC,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,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1D,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvE,UAAU,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AY,CAAC,YAAY,CAAC,6BAA6B,CAAC,CAAC;CAC/F;;AAED,wBAAqE"}
@@ -0,0 +1,24 @@
1
+ import type { CodegenTypes, TurboModule } from 'react-native';
2
+ export type LocalFileSystemConstants = {
3
+ temporaryDirectory: string;
4
+ };
5
+ export type LocalFileSystemDownloadOptions = {
6
+ headers?: CodegenTypes.UnsafeObject;
7
+ };
8
+ export type LocalFileSystemUploadOptions = {
9
+ headers?: CodegenTypes.UnsafeObject;
10
+ method?: string;
11
+ uploadType?: string;
12
+ fieldName?: string;
13
+ parameters?: CodegenTypes.UnsafeObject;
14
+ };
15
+ export interface Spec extends TurboModule {
16
+ getConstants(): LocalFileSystemConstants;
17
+ createFile(path: string, data: string): Promise<string>;
18
+ readFile(path: string): Promise<string>;
19
+ downloadFile(remoteUri: string, localPath: string, options?: LocalFileSystemDownloadOptions): Promise<void>;
20
+ uploadFile(localPath: string, remoteUri: string, options: LocalFileSystemUploadOptions): Promise<void>;
21
+ }
22
+ declare const _default: Spec | null;
23
+ export default _default;
24
+ //# sourceMappingURL=NativeCloudStorageLocalFileSystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeCloudStorageLocalFileSystem.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeCloudStorageLocalFileSystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG9D,MAAM,MAAM,wBAAwB,GAAG;IACrC,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,OAAO,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC;CACxC,CAAC;AAEF,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,YAAY,IAAI,wBAAwB,CAAC;IACzC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5G,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxG;;AAED,wBAA4E"}
@@ -1,3 +1,6 @@
1
+ import { type Spec as NativeCloudStorageCloudKitTurboModule } from '../specs/NativeCloudStorageCloudKitIOS';
1
2
  import { NativeStorage } from '../types/native';
3
+ export declare const NativeCloudKitModule: NativeCloudStorageCloudKitTurboModule | null;
2
4
  export declare const NativeCloudKit: NativeStorage | null;
5
+ export type { NativeCloudStorageCloudKitTurboModule };
3
6
  //# sourceMappingURL=cloudkit.d.ts.map
@@ -1 +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
+ {"version":3,"file":"cloudkit.d.ts","sourceRoot":"","sources":["../../../src/storages/cloudkit.ts"],"names":[],"mappings":"AAAA,OAAsC,EACpC,KAAK,IAAI,IAAI,qCAAqC,EACnD,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,eAAO,MAAM,oBAAoB,8CAAgC,CAAC;AAElE,eAAO,MAAM,cAAc,sBAE1B,CAAC;AAEF,YAAY,EAAE,qCAAqC,EAAE,CAAC"}
@@ -12,7 +12,7 @@ export default class GoogleDriveApiClient {
12
12
  private buildQueryString;
13
13
  private request;
14
14
  private buildMultiPartBody;
15
- listFiles(space: GoogleDriveFileSpace): Promise<GoogleDriveFile[]>;
15
+ listFiles(space: GoogleDriveFileSpace, query?: string): Promise<GoogleDriveFile[]>;
16
16
  getFile(fileId: string): Promise<GoogleDriveFile>;
17
17
  getFileText(fileId: string): Promise<string>;
18
18
  deleteFile(fileId: string): Promise<void>;
@@ -1 +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,CA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AA;KAAE,GAClF,OAAO,CAAC,IAAI,CAAC;IAyBH,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAQ5E"}
@@ -9,12 +9,18 @@ export default class GoogleDrive implements NativeStorage {
9
9
  constructor(options: DeepRequired<CloudStorageProviderOptions['googledrive']>);
10
10
  isCloudAvailable: () => Promise<boolean>;
11
11
  private getRootDirectory;
12
+ private isRootPath;
12
13
  private resolvePathToDirectories;
14
+ private escapeDriveQueryValue;
15
+ private getQueryRootParentId;
16
+ private findDirectoryByNameAndParent;
17
+ private findFilesByNameAndParent;
18
+ private findFilesByParent;
13
19
  private findParentDirectoryId;
14
20
  /**
15
21
  * Gets the Google Drive ID of the root directory for the given scope.
16
22
  * @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.
23
+ * @returns A promise that resolves to the ID of the root directory.
18
24
  */
19
25
  private getRootDirectoryId;
20
26
  private checkIfMultipleFilesWithSameName;
@@ -1 +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;IACpC,OAAO,CAAC,OAAO,CAA2D;gBAE9D,OAAO,EAAE,YAAY,CAAC,2BAA2B,CAAC,aAAa,CAAC,CAAC;IAuBtE,gBAAgB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAG7C;IAEF,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,wBAAwB;IAQhC,OAAO,CAAC,qBAAqB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AAkB,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAkDpG,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IASrE,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiCvE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAMlE,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrE,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMlE,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB3F,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAajF,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB7F,UAAU,CACd,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,IAAI,CAAC;CAyDjB"}
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Custom utility type to make properties required, but still allow null if defined.
3
+ * @internal
4
+ */
1
5
  export type DeepRequired<T> = {
2
6
  [P in keyof T]-?: T[P] extends object ? DeepRequired<T[P]> : T[P];
3
7
  };
@@ -5,6 +9,11 @@ export declare enum CloudStorageScope {
5
9
  Documents = "documents",
6
10
  AppData = "app_data"
7
11
  }
12
+ /**
13
+ * Controls which on-device directory `CloudStorageScope.Documents` maps to on iCloud.
14
+ * @provider icloud
15
+ */
16
+ export type ICloudDocumentsMode = 'icloud' | 'legacy_sandbox';
8
17
  export interface CloudStorageFileStat {
9
18
  size: number;
10
19
  birthtimeMs: number;
@@ -15,6 +24,10 @@ export interface CloudStorageFileStat {
15
24
  isFile: () => boolean;
16
25
  }
17
26
  export declare enum CloudStorageProvider {
27
+ /**
28
+ * Apple iCloud, backed by CloudKit.
29
+ * @platform ios
30
+ */
18
31
  ICloud = "icloud",
19
32
  GoogleDrive = "googledrive"
20
33
  }
@@ -24,6 +37,13 @@ export interface CloudStorageProviderOptions {
24
37
  * The directory scope to use for iCloud operations. Defaults to 'app_data'.
25
38
  */
26
39
  scope?: CloudStorageScope;
40
+ /**
41
+ * The directory mode to use for CloudStorageScope.Documents.
42
+ * `icloud` uses the user-facing iCloud Documents directory, while
43
+ * `legacy_sandbox` uses the local app sandbox Documents directory.
44
+ * Defaults to `icloud`.
45
+ */
46
+ documentsMode?: ICloudDocumentsMode;
27
47
  };
28
48
  [CloudStorageProvider.GoogleDrive]: {
29
49
  /**
@@ -44,4 +64,11 @@ export interface CloudStorageProviderOptions {
44
64
  timeout?: number;
45
65
  };
46
66
  }
67
+ /**
68
+ * Options for a single cloud storage provider: the iCloud options when the iCloud provider is used,
69
+ * or the Google Drive options when the Google Drive provider is used. This is the value type of
70
+ * {@link CloudStorageProviderOptions} and the shape accepted by `setProviderOptions` and the
71
+ * `CloudStorage` constructor.
72
+ */
73
+ export type CloudStorageProviderOptionsValue = CloudStorageProviderOptions[keyof CloudStorageProviderOptions];
47
74
  //# sourceMappingURL=main.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/types/main.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;KAC3B,CA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,CAAC,CAAC,CAAC;CAClE,CAAC;AAEF,oBAAY,iBAAiB;IAC3B,SAAS,cAAc;IACvB,OAAO,aAAa;CACrB;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,gBAAgB,CAAC;AAE9D,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,IAAI,CAAC;IACZ,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,MAAM,EAAE,MAAM,OAAO,CAAC;CACvB;AAED,oBAAY,oBAAoB;IAC9B;;;OAGG;IACH,MAAM,WAAW;IACjB,WAAW,gBAAgB;CAC5B;AAED,MAAM,WAAW,2BAA2B;IAC1C,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE;QAC7B;;WAEG;QACH,KAAK,CAAC,EAAE,iBAAiB,CAAC;QAC1B;;;;;WAKG;QACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;KACrC,CAAC;IAEF,CAAC,oBAAoB,CAAC,WAAW,CAAC,EAAE;QAClC;;WAEG;QACH,KAAK,CAAC,EAAE,iBAAiB,CAAC;QAC1B;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B;;WAEG;QACH,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;;;;GAKG;AACH,MAAM,MAAM,gCAAgC,GAAG,2BAA2B,CAAC,MAAM,2BAA2B,CAAC,CAAC"}
@@ -1,11 +1,7 @@
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
- }
1
+ import type { CloudStorageFileStat, Spec as NativeCloudStorageCloudKitSpec } from '../specs/NativeCloudStorageCloudKitIOS';
2
+ import type { Spec as NativeCloudStorageLocalFileSystemSpec } from '../specs/NativeCloudStorageLocalFileSystem';
3
+ export type NativeStorageScope = 'documents' | 'documents_legacy' | 'app_data';
4
+ export type NativeStorageFileStat = CloudStorageFileStat;
9
5
  export declare enum NativeCloudStorageErrorCode {
10
6
  INVALID_SCOPE = "ERR_INVALID_SCOPE",
11
7
  FILE_NOT_FOUND = "ERR_FILE_NOT_FOUND",
@@ -26,39 +22,6 @@ export declare enum NativeCloudStorageErrorCode {
26
22
  INVALID_URL = "ERR_INVALID_URL",
27
23
  NETWORK_ERROR = "ERR_NETWORK_ERROR"
28
24
  }
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
- }
25
+ export type NativeLocalFileSystem = NativeCloudStorageLocalFileSystemSpec;
26
+ export type NativeStorage = Omit<NativeCloudStorageCloudKitSpec, 'onCloudAvailabilityChanged'>;
64
27
  //# sourceMappingURL=native.d.ts.map
@@ -1 +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,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,OAAO,KAAK,EACV,oBAAoB,EACpB,IAAI,IAAI,8BAA8B,EACvC,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,IAAI,qCAAqC,EAAE,MAAM,4CAA4C,CAAC;AAEhH,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,kBAAkB,GAAG,UAAU,CAAC;AAE/E,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAEzD,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,MAAM,qBAAqB,GAAG,qCAAqC,CAAC;AAE1E,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,8BAA8B,EAAE,4BAA4B,CAAC,CAAC"}
@@ -1 +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
+ {"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,CAW9E,CAAC"}
@@ -1,3 +1,2 @@
1
- import { NativeLocalFileSystem as TNativeLocalFileSystem } from '../types/native';
2
- export declare const localFileSystem: TNativeLocalFileSystem;
1
+ export declare const localFileSystem: import("../specs/NativeCloudStorageLocalFileSystem").Spec;
3
2
  //# sourceMappingURL=local-fs.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"local-fs.d.ts","sourceRoot":"","sources":["../../../src/utils/local-fs.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,eAAe,2DASE,CAAC"}
@@ -3,5 +3,5 @@
3
3
  * @param nativeModule The native module to proxy.
4
4
  * @returns The proxied native module.
5
5
  */
6
- export declare const createProxiedNativeModule: <T extends object>(nativeModule: T | undefined) => T | null;
6
+ export declare const createProxiedNativeModule: <T extends object>(nativeModule: T | null | undefined) => T | null;
7
7
  //# sourceMappingURL=native.d.ts.map
@@ -1 +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"}
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,IAAI,GAAG,SAAS,KAAG,CAAC,GAAG,IA+BpG,CAAC"}
@@ -1,3 +1,2 @@
1
1
  #import <React/RCTBridgeModule.h>
2
2
  #import <React/RCTViewManager.h>
3
- #import <React/RCTEventEmitter.h>
@@ -1,9 +1,10 @@
1
1
  import Foundation
2
+ import React
2
3
 
3
4
  @objc(CloudStorageCloudKit)
4
- class CloudStorageCloudKit: NSObject {
5
+ public class CloudStorageCloudKit: NSObject {
5
6
  @objc(fileExists:withScope:withResolver:withRejecter:)
6
- func fileExists(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
7
+ public func fileExists(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
7
8
  withPromise(resolve: resolve, reject: reject) {
8
9
  let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
9
10
  return try FileUtils.checkFileExists(fileUrl: fileUrl)
@@ -11,7 +12,7 @@ class CloudStorageCloudKit: NSObject {
11
12
  }
12
13
 
13
14
  @objc(appendToFile:withData:withScope:withResolver:withRejecter:)
14
- func appendToFile(path: String, data: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
15
+ public func appendToFile(path: String, data: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
15
16
  withPromise(resolve: resolve, reject: reject) {
16
17
  let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
17
18
 
@@ -26,7 +27,7 @@ class CloudStorageCloudKit: NSObject {
26
27
  }
27
28
 
28
29
  @objc(createFile:withData:withScope:withOverwrite:withResolver:withRejecter:)
29
- func createFile(path: String, data: String, scope: String, overwrite: Bool, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
30
+ public func createFile(path: String, data: String, scope: String, overwrite: Bool, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
30
31
  withPromise(resolve: resolve, reject: reject) {
31
32
  let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
32
33
 
@@ -39,7 +40,7 @@ class CloudStorageCloudKit: NSObject {
39
40
  }
40
41
 
41
42
  @objc(createDirectory:withScope:withResolver:withRejecter:)
42
- func createDirectory(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
43
+ public func createDirectory(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
43
44
  withPromise(resolve: resolve, reject: reject) {
44
45
  let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
45
46
  return try FileUtils.createDirectory(directoryUrl: fileUrl)
@@ -47,7 +48,7 @@ class CloudStorageCloudKit: NSObject {
47
48
  }
48
49
 
49
50
  @objc(listFiles:withScope:withResolver:withRejecter:)
50
- func listFiles(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
51
+ public func listFiles(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
51
52
  withPromise(resolve: resolve, reject: reject) {
52
53
  let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
53
54
  return try FileUtils.listFiles(directoryUrl: fileUrl)
@@ -55,7 +56,7 @@ class CloudStorageCloudKit: NSObject {
55
56
  }
56
57
 
57
58
  @objc(readFile:withScope:withResolver:withRejecter:)
58
- func readFile(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
59
+ public func readFile(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
59
60
  withPromise(resolve: resolve, reject: reject) {
60
61
  let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
61
62
  return try FileUtils.readFile(fileUrl: fileUrl)
@@ -63,7 +64,7 @@ class CloudStorageCloudKit: NSObject {
63
64
  }
64
65
 
65
66
  @objc(triggerSync:withScope:withResolver:withRejecter:)
66
- func triggerSync(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
67
+ public func triggerSync(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
67
68
  withPromise(resolve: resolve, reject: reject) {
68
69
  let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
69
70
  return try CloudKitUtils.triggerSync(fileUrl: fileUrl)
@@ -71,7 +72,7 @@ class CloudStorageCloudKit: NSObject {
71
72
  }
72
73
 
73
74
  @objc(deleteFile:withScope:withResolver:withRejecter:)
74
- func deleteFile(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
75
+ public func deleteFile(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
75
76
  withPromise(resolve: resolve, reject: reject) {
76
77
  let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
77
78
  return try FileUtils.deleteFileOrDirectory(fileUrl: fileUrl)
@@ -79,7 +80,7 @@ class CloudStorageCloudKit: NSObject {
79
80
  }
80
81
 
81
82
  @objc(deleteDirectory:withRecursive:withScope:withResolver:withRejecter:)
82
- func deleteDirectory(path: String, recursive _: Bool, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
83
+ public func deleteDirectory(path: String, recursive _: Bool, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
83
84
  withPromise(resolve: resolve, reject: reject) {
84
85
  let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
85
86
  return try FileUtils.deleteFileOrDirectory(fileUrl: fileUrl)
@@ -87,7 +88,7 @@ class CloudStorageCloudKit: NSObject {
87
88
  }
88
89
 
89
90
  @objc(statFile:withScope:withResolver:withRejecter:)
90
- func statFile(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
91
+ public func statFile(path: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
91
92
  withPromise(resolve: resolve, reject: reject) {
92
93
  let fileUrl = try CloudKitUtils.getFileURL(path: path, scope: scope)
93
94
  return try FileUtils.statFile(fileUrl: fileUrl).toDictionary()
@@ -95,7 +96,7 @@ class CloudStorageCloudKit: NSObject {
95
96
  }
96
97
 
97
98
  @objc(downloadFile:withLocalPath:withScope:withResolver:withRejecter:)
98
- func downloadFile(remotePath: String, localPath: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
99
+ public func downloadFile(remotePath: String, localPath: String, scope: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
99
100
  withPromise(resolve: resolve, reject: reject) {
100
101
  let sourceUrl = try CloudKitUtils.getFileURL(path: remotePath, scope: scope, true)
101
102
 
@@ -125,7 +126,7 @@ class CloudStorageCloudKit: NSObject {
125
126
  }
126
127
 
127
128
  @objc(uploadFile:withLocalPath:withMimeType:withScope:withOverwrite:withResolver:withRejecter:)
128
- func uploadFile(remotePath: String, localPath: String, mimeType _: String, scope: String, overwrite: Bool, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
129
+ public func uploadFile(remotePath: String, localPath: String, mimeType _: String, scope: String, overwrite: Bool, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
129
130
  withPromise(resolve: resolve, reject: reject) {
130
131
  let destinationUrl = try CloudKitUtils.getFileURL(path: remotePath, scope: scope)
131
132
  let sourceUrl = URL(fileURLWithPath: localPath)
@@ -150,7 +151,7 @@ class CloudStorageCloudKit: NSObject {
150
151
  }
151
152
 
152
153
  @objc(isCloudAvailable:withRejecter:)
153
- func isCloudAvailable(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
154
+ public func isCloudAvailable(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
154
155
  withPromise(resolve: resolve, reject: reject) {
155
156
  CloudKitUtils.isCloudKitAvailable()
156
157
  }
@@ -1,19 +1,20 @@
1
1
  import Foundation
2
2
  import MobileCoreServices
3
+ import React
3
4
 
4
5
  // MARK: - CloudStorageLocalFileSystem
5
6
 
6
7
  @objc(CloudStorageLocalFileSystem)
7
- class CloudStorageLocalFileSystem: NSObject {
8
+ public class CloudStorageLocalFileSystem: NSObject {
8
9
  @objc
9
- func constantsToExport() -> [AnyHashable: Any]! {
10
+ public func constantsToExport() -> [AnyHashable: Any]! {
10
11
  [
11
12
  "temporaryDirectory": FileUtils.temporaryDirectory.path,
12
13
  ]
13
14
  }
14
15
 
15
16
  @objc(createFile:withData:withResolver:withRejecter:)
16
- func createFile(path: String, data: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
17
+ public func createFile(path: String, data: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
17
18
  withPromise(resolve: resolve, reject: reject) {
18
19
  let fileUrl = URL(fileURLWithPath: path)
19
20
  let directoryUrl = fileUrl.deletingLastPathComponent()
@@ -33,7 +34,7 @@ class CloudStorageLocalFileSystem: NSObject {
33
34
  }
34
35
 
35
36
  @objc(readFile:withResolver:withRejecter:)
36
- func readFile(path: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
37
+ public func readFile(path: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
37
38
  withPromise(resolve: resolve, reject: reject) {
38
39
  let fileUrl = URL(fileURLWithPath: path)
39
40
  return try FileUtils.readFile(fileUrl: fileUrl)
@@ -41,7 +42,7 @@ class CloudStorageLocalFileSystem: NSObject {
41
42
  }
42
43
 
43
44
  @objc(downloadFile:withLocalPath:withOptions:withResolver:withRejecter:)
44
- func downloadFile(remoteUri: String, localPath: String, options: [String: Any]?, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
45
+ public func downloadFile(remoteUri: String, localPath: String, options: [String: Any]?, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
45
46
  guard let remoteUrl = URL(string: remoteUri) else {
46
47
  let error = CloudStorageError.invalidUrl(url: remoteUri)
47
48
  reject(error.code, error.message, nil)
@@ -92,7 +93,7 @@ class CloudStorageLocalFileSystem: NSObject {
92
93
  }
93
94
 
94
95
  @objc(uploadFile:withRemoteUri:withOptions:withResolver:withRejecter:)
95
- func uploadFile(localPath: String, remoteUri: String, options: [String: Any], resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
96
+ public func uploadFile(localPath: String, remoteUri: String, options: [String: Any], resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
96
97
  guard let remoteUrl = URL(string: remoteUri) else {
97
98
  let error = CloudStorageError.invalidUrl(url: remoteUri)
98
99
  reject(error.code, error.message, nil)