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.
Files changed (188) hide show
  1. package/LICENSE +1 -1
  2. package/android/build.gradle +101 -0
  3. package/android/gradle.properties +5 -0
  4. package/android/src/main/AndroidManifest.xml +3 -0
  5. package/android/src/main/AndroidManifestNew.xml +2 -0
  6. package/android/src/main/java/com/voicekit/CloudStorageError.kt +86 -0
  7. package/android/src/main/java/com/voicekit/CloudStorageLocalFileSystemModule.kt +236 -0
  8. package/android/src/main/java/com/voicekit/CloudStoragePackage.kt +17 -0
  9. package/android/src/main/java/com/voicekit/FileUtils.kt +41 -0
  10. package/android/src/main/java/com/voicekit/Types.kt +6 -0
  11. package/app.plugin.js +1 -1
  12. package/{lib/commonjs/RNCloudStorage.js → dist/commonjs/cloud-storage.js} +130 -80
  13. package/dist/commonjs/cloud-storage.js.map +1 -0
  14. package/dist/commonjs/expo-plugin/index.js +13 -0
  15. package/dist/commonjs/expo-plugin/index.js.map +1 -0
  16. package/{lib/commonjs/expo-plugin/withRNCloudStorageIos.js → dist/commonjs/expo-plugin/ios.js} +1 -1
  17. package/dist/commonjs/expo-plugin/ios.js.map +1 -0
  18. package/{lib/commonjs/hooks/useCloudFile.js → dist/commonjs/hooks/use-cloud-file.js} +26 -8
  19. package/dist/commonjs/hooks/use-cloud-file.js.map +1 -0
  20. package/{lib/commonjs/hooks/useIsCloudAvailable.js → dist/commonjs/hooks/use-is-cloud-available.js} +3 -3
  21. package/dist/commonjs/hooks/use-is-cloud-available.js.map +1 -0
  22. package/{lib → dist}/commonjs/index.js +10 -10
  23. package/dist/commonjs/index.js.map +1 -0
  24. package/dist/commonjs/storages/cloudkit.js +10 -0
  25. package/dist/commonjs/storages/cloudkit.js.map +1 -0
  26. package/{lib/commonjs → dist/commonjs/storages}/google-drive/client.js +80 -38
  27. package/dist/commonjs/storages/google-drive/client.js.map +1 -0
  28. package/{lib/commonjs → dist/commonjs/storages}/google-drive/index.js +120 -64
  29. package/dist/commonjs/storages/google-drive/index.js.map +1 -0
  30. package/dist/commonjs/storages/google-drive/types.js.map +1 -0
  31. package/dist/commonjs/types/native.js +28 -0
  32. package/dist/commonjs/types/native.js.map +1 -0
  33. package/{lib/commonjs/utils/CloudStorageError.js → dist/commonjs/utils/cloud-storage-error.js} +3 -1
  34. package/dist/commonjs/utils/cloud-storage-error.js.map +1 -0
  35. package/dist/commonjs/utils/constants.js +24 -0
  36. package/dist/commonjs/utils/constants.js.map +1 -0
  37. package/dist/commonjs/utils/local-fs.js +16 -0
  38. package/dist/commonjs/utils/local-fs.js.map +1 -0
  39. package/dist/commonjs/utils/native.js +35 -0
  40. package/dist/commonjs/utils/native.js.map +1 -0
  41. package/{lib/module/RNCloudStorage.js → dist/module/cloud-storage.js} +130 -80
  42. package/dist/module/cloud-storage.js.map +1 -0
  43. package/dist/module/expo-plugin/index.js +8 -0
  44. package/dist/module/expo-plugin/index.js.map +1 -0
  45. package/{lib/module/expo-plugin/withRNCloudStorageIos.js → dist/module/expo-plugin/ios.js} +1 -1
  46. package/dist/module/expo-plugin/ios.js.map +1 -0
  47. package/{lib/module/hooks/useCloudFile.js → dist/module/hooks/use-cloud-file.js} +25 -7
  48. package/dist/module/hooks/use-cloud-file.js.map +1 -0
  49. package/{lib/module/hooks/useIsCloudAvailable.js → dist/module/hooks/use-is-cloud-available.js} +2 -2
  50. package/dist/module/hooks/use-is-cloud-available.js.map +1 -0
  51. package/dist/module/index.js +9 -0
  52. package/dist/module/index.js.map +1 -0
  53. package/dist/module/storages/cloudkit.js +6 -0
  54. package/dist/module/storages/cloudkit.js.map +1 -0
  55. package/{lib/module → dist/module/storages}/google-drive/client.js +80 -38
  56. package/dist/module/storages/google-drive/client.js.map +1 -0
  57. package/{lib/module → dist/module/storages}/google-drive/index.js +119 -62
  58. package/dist/module/storages/google-drive/index.js.map +1 -0
  59. package/dist/module/storages/google-drive/types.js.map +1 -0
  60. package/dist/module/types/native.js +24 -0
  61. package/dist/module/types/native.js.map +1 -0
  62. package/{lib/module/utils/CloudStorageError.js → dist/module/utils/cloud-storage-error.js} +3 -1
  63. package/dist/module/utils/cloud-storage-error.js.map +1 -0
  64. package/dist/module/utils/constants.js +20 -0
  65. package/dist/module/utils/constants.js.map +1 -0
  66. package/dist/module/utils/local-fs.js +12 -0
  67. package/dist/module/utils/local-fs.js.map +1 -0
  68. package/dist/module/utils/native.js +30 -0
  69. package/dist/module/utils/native.js.map +1 -0
  70. package/{lib/typescript/RNCloudStorage.d.ts → dist/typescript/cloud-storage.d.ts} +60 -8
  71. package/dist/typescript/cloud-storage.d.ts.map +1 -0
  72. package/{lib/typescript/expo-plugin/withRNCloudStorage.d.ts → dist/typescript/expo-plugin/index.d.ts} +1 -1
  73. package/dist/typescript/expo-plugin/index.d.ts.map +1 -0
  74. package/{lib/typescript/expo-plugin/withRNCloudStorageIos.d.ts → dist/typescript/expo-plugin/ios.d.ts} +1 -1
  75. package/dist/typescript/expo-plugin/ios.d.ts.map +1 -0
  76. package/{lib/typescript/hooks/useCloudFile.d.ts → dist/typescript/hooks/use-cloud-file.d.ts} +22 -4
  77. package/dist/typescript/hooks/use-cloud-file.d.ts.map +1 -0
  78. package/{lib/typescript/hooks/useIsCloudAvailable.d.ts → dist/typescript/hooks/use-is-cloud-available.d.ts} +2 -2
  79. package/dist/typescript/hooks/use-is-cloud-available.d.ts.map +1 -0
  80. package/dist/typescript/index.d.ts +7 -0
  81. package/dist/typescript/index.d.ts.map +1 -0
  82. package/dist/typescript/storages/cloudkit.d.ts +3 -0
  83. package/dist/typescript/storages/cloudkit.d.ts.map +1 -0
  84. package/{lib/typescript → dist/typescript/storages}/google-drive/client.d.ts +9 -2
  85. package/dist/typescript/storages/google-drive/client.d.ts.map +1 -0
  86. package/dist/typescript/storages/google-drive/index.d.ts +35 -0
  87. package/dist/typescript/storages/google-drive/index.d.ts.map +1 -0
  88. package/dist/typescript/storages/google-drive/types.d.ts.map +1 -0
  89. package/dist/typescript/types/native.d.ts +64 -0
  90. package/dist/typescript/types/native.d.ts.map +1 -0
  91. package/dist/typescript/utils/cloud-storage-error.d.ts +8 -0
  92. package/dist/typescript/utils/cloud-storage-error.d.ts.map +1 -0
  93. package/dist/typescript/utils/constants.d.ts +4 -0
  94. package/dist/typescript/utils/constants.d.ts.map +1 -0
  95. package/{lib → dist}/typescript/utils/helpers.d.ts.map +1 -1
  96. package/dist/typescript/utils/local-fs.d.ts +3 -0
  97. package/dist/typescript/utils/local-fs.d.ts.map +1 -0
  98. package/dist/typescript/utils/native.d.ts +7 -0
  99. package/dist/typescript/utils/native.d.ts.map +1 -0
  100. package/ios/CloudStorage.xcodeproj/project.pbxproj +12 -6
  101. package/ios/{CloudStorage.m → CloudStorageCloudKit.m} +4 -2
  102. package/ios/{CloudStorage.swift → CloudStorageCloudKit.swift} +60 -5
  103. package/ios/CloudStorageLocalFileSystem.m +15 -0
  104. package/ios/CloudStorageLocalFileSystem.swift +215 -0
  105. package/ios/Utils/CloudKitUtils.swift +4 -4
  106. package/ios/Utils/CloudStorageError.swift +8 -0
  107. package/ios/Utils/FileUtils.swift +19 -0
  108. package/ios/Utils/Types.swift +7 -1
  109. package/package.json +44 -103
  110. package/src/{RNCloudStorage.ts → cloud-storage.ts} +147 -85
  111. package/src/expo-plugin/{withRNCloudStorage.ts → index.ts} +2 -2
  112. package/src/hooks/{useCloudFile.ts → use-cloud-file.ts} +24 -6
  113. package/src/hooks/{useIsCloudAvailable.ts → use-is-cloud-available.ts} +1 -1
  114. package/src/index.ts +5 -6
  115. package/src/storages/cloudkit.ts +5 -0
  116. package/src/{google-drive → storages/google-drive}/client.ts +98 -40
  117. package/src/{google-drive → storages/google-drive}/index.ts +172 -89
  118. package/src/types/native.ts +50 -14
  119. package/src/utils/cloud-storage-error.ts +15 -0
  120. package/src/utils/constants.ts +20 -0
  121. package/src/utils/local-fs.ts +19 -0
  122. package/src/utils/native.ts +40 -0
  123. package/lib/commonjs/RNCloudStorage.js.map +0 -1
  124. package/lib/commonjs/expo-plugin/withRNCloudStorage.js +0 -13
  125. package/lib/commonjs/expo-plugin/withRNCloudStorage.js.map +0 -1
  126. package/lib/commonjs/expo-plugin/withRNCloudStorageIos.js.map +0 -1
  127. package/lib/commonjs/google-drive/client.js.map +0 -1
  128. package/lib/commonjs/google-drive/index.js.map +0 -1
  129. package/lib/commonjs/google-drive/types.js.map +0 -1
  130. package/lib/commonjs/hooks/useCloudFile.js.map +0 -1
  131. package/lib/commonjs/hooks/useIsCloudAvailable.js.map +0 -1
  132. package/lib/commonjs/index.js.map +0 -1
  133. package/lib/commonjs/types/native.js +0 -26
  134. package/lib/commonjs/types/native.js.map +0 -1
  135. package/lib/commonjs/utils/CloudStorageError.js.map +0 -1
  136. package/lib/module/RNCloudStorage.js.map +0 -1
  137. package/lib/module/expo-plugin/withRNCloudStorage.js +0 -8
  138. package/lib/module/expo-plugin/withRNCloudStorage.js.map +0 -1
  139. package/lib/module/expo-plugin/withRNCloudStorageIos.js.map +0 -1
  140. package/lib/module/google-drive/client.js.map +0 -1
  141. package/lib/module/google-drive/index.js.map +0 -1
  142. package/lib/module/google-drive/types.js.map +0 -1
  143. package/lib/module/hooks/useCloudFile.js.map +0 -1
  144. package/lib/module/hooks/useIsCloudAvailable.js.map +0 -1
  145. package/lib/module/index.js +0 -10
  146. package/lib/module/index.js.map +0 -1
  147. package/lib/module/types/native.js +0 -22
  148. package/lib/module/types/native.js.map +0 -1
  149. package/lib/module/utils/CloudStorageError.js.map +0 -1
  150. package/lib/typescript/RNCloudStorage.d.ts.map +0 -1
  151. package/lib/typescript/expo-plugin/withRNCloudStorage.d.ts.map +0 -1
  152. package/lib/typescript/expo-plugin/withRNCloudStorageIos.d.ts.map +0 -1
  153. package/lib/typescript/google-drive/client.d.ts.map +0 -1
  154. package/lib/typescript/google-drive/index.d.ts +0 -34
  155. package/lib/typescript/google-drive/index.d.ts.map +0 -1
  156. package/lib/typescript/google-drive/types.d.ts.map +0 -1
  157. package/lib/typescript/hooks/useCloudFile.d.ts.map +0 -1
  158. package/lib/typescript/hooks/useIsCloudAvailable.d.ts.map +0 -1
  159. package/lib/typescript/index.d.ts +0 -8
  160. package/lib/typescript/index.d.ts.map +0 -1
  161. package/lib/typescript/types/native.d.ts +0 -40
  162. package/lib/typescript/types/native.d.ts.map +0 -1
  163. package/lib/typescript/utils/CloudStorageError.d.ts +0 -8
  164. package/lib/typescript/utils/CloudStorageError.d.ts.map +0 -1
  165. package/src/utils/CloudStorageError.ts +0 -14
  166. /package/{lib → dist}/commonjs/expo-plugin/types/index.js +0 -0
  167. /package/{lib → dist}/commonjs/expo-plugin/types/index.js.map +0 -0
  168. /package/{lib/commonjs → dist/commonjs/storages}/google-drive/types.js +0 -0
  169. /package/{lib → dist}/commonjs/types/main.js +0 -0
  170. /package/{lib → dist}/commonjs/types/main.js.map +0 -0
  171. /package/{lib → dist}/commonjs/utils/helpers.js +0 -0
  172. /package/{lib → dist}/commonjs/utils/helpers.js.map +0 -0
  173. /package/{lib → dist}/module/expo-plugin/types/index.js +0 -0
  174. /package/{lib → dist}/module/expo-plugin/types/index.js.map +0 -0
  175. /package/{lib → dist}/module/package.json +0 -0
  176. /package/{lib/module → dist/module/storages}/google-drive/types.js +0 -0
  177. /package/{lib → dist}/module/types/main.js +0 -0
  178. /package/{lib → dist}/module/types/main.js.map +0 -0
  179. /package/{lib → dist}/module/utils/helpers.js +0 -0
  180. /package/{lib → dist}/module/utils/helpers.js.map +0 -0
  181. /package/{lib → dist}/typescript/expo-plugin/types/index.d.ts +0 -0
  182. /package/{lib → dist}/typescript/expo-plugin/types/index.d.ts.map +0 -0
  183. /package/{lib/typescript → dist/typescript/storages}/google-drive/types.d.ts +0 -0
  184. /package/{lib → dist}/typescript/types/main.d.ts +0 -0
  185. /package/{lib → dist}/typescript/types/main.d.ts.map +0 -0
  186. /package/{lib → dist}/typescript/utils/helpers.d.ts +0 -0
  187. /package/src/expo-plugin/{withRNCloudStorageIos.ts → ios.ts} +0 -0
  188. /package/src/{google-drive → storages/google-drive}/types.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CloudStorageError","Error","constructor","message","code","details","_default","exports","default"],"sourceRoot":"../../../src","sources":["utils/cloud-storage-error.ts"],"mappings":";;;;;;AAAA;;AAGA,MAAMA,iBAAiB,SAASC,KAAK,CAAC;EAIpCC,WAAWA,CAACC,OAAe,EAAEC,IAAiC,EAAEC,OAAa,EAAE;IAC7E,KAAK,CAACF,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,OAAO,GAAGA,OAAO;EACxB;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcR,iBAAiB","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LINKING_ERROR = exports.DEFAULT_PROVIDER_OPTIONS = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _main = require("../types/main");
9
+ const LINKING_ERROR = exports.LINKING_ERROR = `The package 'react-native-cloud-storage' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
10
+ ios: "- You have run 'pod install'\n",
11
+ default: ''
12
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
13
+ const DEFAULT_PROVIDER_OPTIONS = exports.DEFAULT_PROVIDER_OPTIONS = {
14
+ [_main.CloudStorageProvider.ICloud]: {
15
+ scope: _main.CloudStorageScope.AppData
16
+ },
17
+ [_main.CloudStorageProvider.GoogleDrive]: {
18
+ scope: _main.CloudStorageScope.AppData,
19
+ accessToken: null,
20
+ strictFilenames: false,
21
+ timeout: 3000
22
+ }
23
+ };
24
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_main","LINKING_ERROR","exports","Platform","select","ios","default","DEFAULT_PROVIDER_OPTIONS","CloudStorageProvider","ICloud","scope","CloudStorageScope","AppData","GoogleDrive","accessToken","strictFilenames","timeout"],"sourceRoot":"../../../src","sources":["utils/constants.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEO,MAAME,aAAa,GAAAC,OAAA,CAAAD,aAAA,GACxB,qFAAqF,GACrFE,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAE1B,MAAMC,wBAAmE,GAAAL,OAAA,CAAAK,wBAAA,GAAG;EACjF,CAACC,0BAAoB,CAACC,MAAM,GAAG;IAC7BC,KAAK,EAAEC,uBAAiB,CAACC;EAC3B,CAAC;EACD,CAACJ,0BAAoB,CAACK,WAAW,GAAG;IAClCH,KAAK,EAAEC,uBAAiB,CAACC,OAAO;IAChCE,WAAW,EAAE,IAAI;IACjBC,eAAe,EAAE,KAAK;IACtBC,OAAO,EAAE;EACX;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.localFileSystem = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _native = require("../utils/native");
9
+ var _constants = require("./constants");
10
+ const NativeLocalFileSystem = (0, _native.createProxiedNativeModule)(_reactNative.NativeModules.CloudStorageLocalFileSystem);
11
+ const localFileSystem = exports.localFileSystem = NativeLocalFileSystem ?? new Proxy({}, {
12
+ get() {
13
+ throw new Error(_constants.LINKING_ERROR);
14
+ }
15
+ });
16
+ //# sourceMappingURL=local-fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_native","_constants","NativeLocalFileSystem","createProxiedNativeModule","NativeModules","CloudStorageLocalFileSystem","localFileSystem","exports","Proxy","get","Error","LINKING_ERROR"],"sourceRoot":"../../../src","sources":["utils/local-fs.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEA,MAAMG,qBAAqB,GAAG,IAAAC,iCAAyB,EACrDC,0BAAa,CAACC,2BAChB,CAAC;AAEM,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAC1BJ,qBAAqB,IACpB,IAAIM,KAAK,CACR,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACC,wBAAa,CAAC;EAChC;AACF,CACF,CAA4B","ignoreList":[]}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createProxiedNativeModule = void 0;
7
+ var _native = require("../types/native");
8
+ var _cloudStorageError = _interopRequireDefault(require("./cloud-storage-error"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ /**
11
+ * Creates a proxied native module that wraps thrown errors in a CloudStorageError.
12
+ * @param nativeModule The native module to proxy.
13
+ * @returns The proxied native module.
14
+ */
15
+ const createProxiedNativeModule = nativeModule => {
16
+ if (!nativeModule) return null;
17
+ return new Proxy(nativeModule, {
18
+ get(target, property, receiver) {
19
+ const originalValue = Reflect.get(target, property, receiver);
20
+ if (typeof originalValue === 'function') {
21
+ return async (...arguments_) => {
22
+ try {
23
+ return await Reflect.apply(originalValue, target, arguments_);
24
+ } catch (error) {
25
+ const error_ = typeof error === 'object' && error !== null && 'code' in error && typeof error.code === 'string' && Object.values(_native.NativeCloudStorageErrorCode).includes(error.code) ? new _cloudStorageError.default('message' in error && typeof error.message === 'string' ? error.message : 'Unknown error', error.code) : new _cloudStorageError.default('Unknown error', _native.NativeCloudStorageErrorCode.UNKNOWN, error);
26
+ throw error_;
27
+ }
28
+ };
29
+ }
30
+ return originalValue;
31
+ }
32
+ });
33
+ };
34
+ exports.createProxiedNativeModule = createProxiedNativeModule;
35
+ //# sourceMappingURL=native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_native","require","_cloudStorageError","_interopRequireDefault","e","__esModule","default","createProxiedNativeModule","nativeModule","Proxy","get","target","property","receiver","originalValue","Reflect","arguments_","apply","error","error_","code","Object","values","NativeCloudStorageErrorCode","includes","CloudStorageError","message","UNKNOWN","exports"],"sourceRoot":"../../../src","sources":["utils/native.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAsD,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtD;AACA;AACA;AACA;AACA;AACO,MAAMG,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,CAACC,mCAA2B,CAAC,CAACC,QAAQ,CAACN,KAAK,CAACE,IAAmC,CAAC,GAC1F,IAAIK,0BAAiB,CACnB,SAAS,IAAIP,KAAK,IAAI,OAAOA,KAAK,CAACQ,OAAO,KAAK,QAAQ,GAAGR,KAAK,CAACQ,OAAO,GAAG,eAAe,EACzFR,KAAK,CAACE,IACR,CAAC,GACD,IAAIK,0BAAiB,CAAC,eAAe,EAAEF,mCAA2B,CAACI,OAAO,EAAET,KAAK,CAAC;YACxF,MAAMC,MAAM;UACd;QACF,CAAC;MACH;MAEA,OAAOL,aAAa;IACtB;EACF,CAAC,CAAC;AACJ,CAAC;AAACc,OAAA,CAAArB,yBAAA,GAAAA,yBAAA","ignoreList":[]}
@@ -1,48 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  import { CloudStorageProvider, CloudStorageScope } from './types/main';
4
+ import { NativeCloudStorageErrorCode } from './types/native';
4
5
  import { isProviderSupported } from './utils/helpers';
5
6
  import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
6
- import CloudStorageError from './utils/CloudStorageError';
7
- import { CloudStorageErrorCode } from './types/native';
8
- import GoogleDrive from './google-drive';
9
- const LINKING_ERROR = `The package 'react-native-cloud-storage' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
10
- ios: "- You have run 'pod install'\n",
11
- default: ''
12
- }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
13
-
14
- // proxy NativeModules.CloudStorage to catch any errors thrown by the native module and wrap them in a CloudStorageError
15
- const nativeIosInstance = NativeModules.CloudStorage ? new Proxy(NativeModules.CloudStorage, {
16
- get(target, prop) {
17
- const originalFunction = target[prop];
18
- if (typeof originalFunction === 'function') {
19
- return async (...args) => {
20
- try {
21
- // @ts-expect-error - we can't know the types of the functions and their arguments
22
- return await originalFunction(...args);
23
- } catch (error) {
24
- if (error?.code && Object.values(CloudStorageErrorCode).includes(error.code)) {
25
- throw new CloudStorageError(error?.message || '', error.code);
26
- } else {
27
- throw new CloudStorageError('Unknown error', CloudStorageErrorCode.UNKNOWN, error);
28
- }
29
- }
30
- };
31
- }
32
- return originalFunction;
33
- }
34
- }) : null;
35
- const defaultProviderOptions = {
36
- [CloudStorageProvider.ICloud]: {
37
- scope: CloudStorageScope.AppData
38
- },
39
- [CloudStorageProvider.GoogleDrive]: {
40
- scope: CloudStorageScope.AppData,
41
- accessToken: null,
42
- strictFilenames: false,
43
- timeout: 3000
44
- }
45
- };
7
+ import GoogleDrive from './storages/google-drive';
8
+ import { NativeCloudKit } from './storages/cloudkit';
9
+ import { DEFAULT_PROVIDER_OPTIONS, LINKING_ERROR } from './utils/constants';
10
+ import CloudStorageError from './utils/cloud-storage-error';
46
11
  export default class RNCloudStorage {
47
12
  cloudAvailabilityListeners = [];
48
13
 
@@ -57,23 +22,27 @@ export default class RNCloudStorage {
57
22
  }
58
23
  this.provider = {
59
24
  provider: provider ?? RNCloudStorage.getDefaultProvider(),
60
- options: defaultProviderOptions[provider ?? RNCloudStorage.getDefaultProvider()]
25
+ options: DEFAULT_PROVIDER_OPTIONS[provider ?? RNCloudStorage.getDefaultProvider()]
61
26
  };
62
27
  this.setProvider(provider ?? RNCloudStorage.getDefaultProvider());
63
28
  if (options) {
64
29
  this.setProviderOptions(options);
65
30
  }
66
31
  }
67
- get nativeInstance() {
32
+ get nativeStorage() {
68
33
  switch (this.provider.provider) {
69
34
  case CloudStorageProvider.ICloud:
70
- return nativeIosInstance ?? new Proxy({}, {
71
- get() {
72
- throw new Error(LINKING_ERROR);
73
- }
74
- });
35
+ {
36
+ return NativeCloudKit ?? new Proxy({}, {
37
+ get() {
38
+ throw new Error(LINKING_ERROR);
39
+ }
40
+ });
41
+ }
75
42
  default:
76
- return new GoogleDrive(this.provider.options);
43
+ {
44
+ return new GoogleDrive(this.provider.options);
45
+ }
77
46
  }
78
47
  }
79
48
 
@@ -84,9 +53,13 @@ export default class RNCloudStorage {
84
53
  static getDefaultProvider() {
85
54
  switch (Platform.OS) {
86
55
  case 'ios':
87
- return CloudStorageProvider.ICloud;
56
+ {
57
+ return CloudStorageProvider.ICloud;
58
+ }
88
59
  default:
89
- return CloudStorageProvider.GoogleDrive;
60
+ {
61
+ return CloudStorageProvider.GoogleDrive;
62
+ }
90
63
  }
91
64
  }
92
65
 
@@ -95,7 +68,7 @@ export default class RNCloudStorage {
95
68
  * @returns An array of supported CloudStorageProviders.
96
69
  */
97
70
  static getSupportedProviders() {
98
- return Object.values(CloudStorageProvider).filter(isProviderSupported);
71
+ return Object.values(CloudStorageProvider).filter(provider => isProviderSupported(provider));
99
72
  }
100
73
 
101
74
  /**
@@ -116,22 +89,22 @@ export default class RNCloudStorage {
116
89
  }
117
90
  this.provider = {
118
91
  provider,
119
- options: defaultProviderOptions[provider]
92
+ options: DEFAULT_PROVIDER_OPTIONS[provider]
120
93
  };
121
94
 
122
95
  // Emit an event to notify useIsCloudAvailable() hook consumers of the new cloud availability status
123
- this.nativeInstance.isCloudAvailable().then(available => {
124
- this.cloudAvailabilityListeners.forEach(listener => {
96
+ this.nativeStorage.isCloudAvailable().then(available => {
97
+ for (const listener of this.cloudAvailabilityListeners) {
125
98
  listener(available);
126
- });
99
+ }
127
100
  });
128
101
  if (provider === CloudStorageProvider.ICloud) {
129
102
  // Listen to native cloud availability change events
130
103
  const eventEmitter = new NativeEventEmitter(NativeModules.CloudStorageEventEmitter);
131
104
  eventEmitter.addListener('RNCloudStorage.cloud.availability-changed', event => {
132
- this.cloudAvailabilityListeners.forEach(listener => {
105
+ for (const listener of this.cloudAvailabilityListeners) {
133
106
  listener(event.available);
134
- });
107
+ }
135
108
  });
136
109
  }
137
110
  }
@@ -156,9 +129,9 @@ export default class RNCloudStorage {
156
129
  };
157
130
  if (this.provider.provider === CloudStorageProvider.GoogleDrive && 'accessToken' in newOptions) {
158
131
  // Emit an event to notify useIsCloudAvailable() hook consumers of the new cloud availability status
159
- this.cloudAvailabilityListeners.forEach(listener => {
132
+ for (const listener of this.cloudAvailabilityListeners) {
160
133
  listener(!!newOptions.accessToken?.length);
161
- });
134
+ }
162
135
  }
163
136
  }
164
137
  subscribeToCloudAvailability(listener) {
@@ -176,7 +149,7 @@ export default class RNCloudStorage {
176
149
  * @returns A promise that resolves to true if the cloud storage is available, false otherwise.
177
150
  */
178
151
  isCloudAvailable() {
179
- return this.nativeInstance.isCloudAvailable();
152
+ return this.nativeStorage.isCloudAvailable();
180
153
  }
181
154
 
182
155
  /**
@@ -187,7 +160,7 @@ export default class RNCloudStorage {
187
160
  * @returns A promise that resolves when the data has been appended.
188
161
  */
189
162
  appendFile(path, data, scope) {
190
- return this.nativeInstance.appendToFile(path, data, scope ?? this.provider.options.scope);
163
+ return this.nativeStorage.appendToFile(path, data, scope ?? this.provider.options.scope);
191
164
  }
192
165
 
193
166
  /**
@@ -197,7 +170,7 @@ export default class RNCloudStorage {
197
170
  * @returns A promise that resolves to true if the path exists, false otherwise.
198
171
  */
199
172
  exists(path, scope) {
200
- return this.nativeInstance.fileExists(path, scope ?? this.provider.options.scope);
173
+ return this.nativeStorage.fileExists(path, scope ?? this.provider.options.scope);
201
174
  }
202
175
 
203
176
  /**
@@ -208,7 +181,7 @@ export default class RNCloudStorage {
208
181
  * @returns A promise that resolves when the file has been written.
209
182
  */
210
183
  writeFile(path, data, scope) {
211
- return this.nativeInstance.createFile(path, data, scope ?? this.provider.options.scope, true);
184
+ return this.nativeStorage.createFile(path, data, scope ?? this.provider.options.scope, true);
212
185
  }
213
186
 
214
187
  /**
@@ -218,7 +191,7 @@ export default class RNCloudStorage {
218
191
  * @returns A promise that resolves when the directory has been created.
219
192
  */
220
193
  mkdir(path, scope) {
221
- return this.nativeInstance.createDirectory(path, scope ?? this.provider.options.scope);
194
+ return this.nativeStorage.createDirectory(path, scope ?? this.provider.options.scope);
222
195
  }
223
196
 
224
197
  /**
@@ -228,7 +201,7 @@ export default class RNCloudStorage {
228
201
  * @returns A promise that resolves to an array of file names, excluding '.' and '..'.
229
202
  */
230
203
  readdir(path, scope) {
231
- return this.nativeInstance.listFiles(path, scope ?? this.provider.options.scope);
204
+ return this.nativeStorage.listFiles(path, scope ?? this.provider.options.scope);
232
205
  }
233
206
 
234
207
  /**
@@ -238,17 +211,55 @@ export default class RNCloudStorage {
238
211
  * @returns A promise that resolves to the contents of the file.
239
212
  */
240
213
  readFile(path, scope) {
241
- return this.nativeInstance.readFile(path, scope ?? this.provider.options.scope);
214
+ return this.nativeStorage.readFile(path, scope ?? this.provider.options.scope);
242
215
  }
243
216
 
244
217
  /**
245
- * Downloads the file at the given path. Does not have any effect on Google Drive.
246
- * @param path The file to trigger the download for.
218
+ * Triggers synchronization for the file at the given path. Does not have any effect on Google Drive.
219
+ * @param path The file to trigger synchronization for.
220
+ * @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
221
+ * @returns A promise that resolves once the synchronization has been triggered.
222
+ */
223
+ triggerSync(path, scope) {
224
+ return this.nativeStorage.triggerSync(path, scope ?? this.provider.options.scope);
225
+ }
226
+
227
+ /**
228
+ * 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.
229
+ * @param remotePath The remote path to upload to.
230
+ * @param localPath The local path of the file to upload.
231
+ * @param options The options for the upload. Must contain a `mimeType` property.
232
+ * @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
233
+ * @returns A promise that resolves when the file has been uploaded.
234
+ */
235
+ uploadFile(remotePath, localPath, options, scope) {
236
+ return this.nativeStorage.uploadFile(remotePath, localPath, options.mimeType, scope ?? this.provider.options.scope, true);
237
+ }
238
+
239
+ /**
240
+ * Triggers synchronization for the file at the given path. Does not have any effect on Google Drive.
241
+ * @param path The file to trigger synchronization for.
242
+ * @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
243
+ * @returns A promise that resolves once the synchronization has been triggered.
244
+ * @deprecated Use `triggerSync` instead.
245
+ */
246
+
247
+ /**
248
+ * Downloads the cloud file at the given remote path to the given local path.
249
+ * @param remotePath The remote path of the file to download from the cloud.
250
+ * @param localPath The local path to download the cloud file to.
247
251
  * @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
248
- * @returns A promise that resolves once the download has been triggered.
249
252
  */
250
- downloadFile(path, scope) {
251
- return this.nativeInstance.downloadFile(path, scope ?? this.provider.options.scope);
253
+
254
+ downloadFile(remotePathOrPath, localPathOrScope, scope) {
255
+ if (!localPathOrScope || !scope && typeof localPathOrScope === 'string' && Object.values(CloudStorageScope).includes(localPathOrScope)) {
256
+ // deprecated `triggerSync` call
257
+ return this.triggerSync(remotePathOrPath, scope);
258
+ }
259
+ if (!localPathOrScope) {
260
+ throw new CloudStorageError('Invalid arguments provided to downloadFile', NativeCloudStorageErrorCode.UNKNOWN);
261
+ }
262
+ return this.nativeStorage.downloadFile(remotePathOrPath, localPathOrScope, scope ?? this.provider.options.scope);
252
263
  }
253
264
 
254
265
  /**
@@ -258,7 +269,7 @@ export default class RNCloudStorage {
258
269
  * @returns A promise that resolves when the file has been deleted.
259
270
  */
260
271
  unlink(path, scope) {
261
- return this.nativeInstance.deleteFile(path, scope ?? this.provider.options.scope);
272
+ return this.nativeStorage.deleteFile(path, scope ?? this.provider.options.scope);
262
273
  }
263
274
 
264
275
  /**
@@ -269,7 +280,7 @@ export default class RNCloudStorage {
269
280
  * @returns A promise that resolves when the directory has been deleted.
270
281
  */
271
282
  rmdir(path, options, scope) {
272
- return this.nativeInstance.deleteDirectory(path, options?.recursive ?? false, scope ?? this.provider.options.scope);
283
+ return this.nativeStorage.deleteDirectory(path, options?.recursive ?? false, scope ?? this.provider.options.scope);
273
284
  }
274
285
 
275
286
  /**
@@ -279,7 +290,7 @@ export default class RNCloudStorage {
279
290
  * @returns A promise that resolves to the CloudStorageFileStat object.
280
291
  */
281
292
  async stat(path, scope) {
282
- const native = await this.nativeInstance.statFile(path, scope ?? this.provider.options.scope);
293
+ const native = await this.nativeStorage.statFile(path, scope ?? this.provider.options.scope);
283
294
  return {
284
295
  ...native,
285
296
  birthtime: new Date(native.birthtimeMs),
@@ -402,13 +413,52 @@ export default class RNCloudStorage {
402
413
  }
403
414
 
404
415
  /**
405
- * Downloads the file at the given path in the provider of the default static instance. Does not have any effect on Google Drive.
406
- * @param path The file to trigger the download for.
416
+ * 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.
417
+ * @param path The file to trigger synchronization for.
407
418
  * @param scope The directory scope the path is in. Defaults to the default scope set for the default static instance.
408
- * @returns A promise that resolves once the download has been triggered.
419
+ * @returns A promise that resolves once the synchronization has been triggered.
409
420
  */
410
- static downloadFile(path, scope) {
411
- return RNCloudStorage.getDefaultInstance().downloadFile(path, scope);
421
+ static triggerSync(path, scope) {
422
+ return RNCloudStorage.getDefaultInstance().triggerSync(path, scope);
423
+ }
424
+
425
+ /**
426
+ * 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.
427
+ * @param remotePath The remote path to upload to.
428
+ * @param localPath The local path of the file to upload.
429
+ * @param options The options for the upload. Must contain a `mimeType` property.
430
+ * @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
431
+ * @returns A promise that resolves when the file has been uploaded.
432
+ */
433
+ static uploadFile(remotePath, localPath, options, scope) {
434
+ return RNCloudStorage.getDefaultInstance().uploadFile(remotePath, localPath, options, scope);
435
+ }
436
+
437
+ /**
438
+ * 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.
439
+ * @param path The file to trigger synchronization for.
440
+ * @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
441
+ * @returns A promise that resolves once the synchronization has been triggered.
442
+ * @deprecated Use `triggerSync` instead.
443
+ */
444
+
445
+ /**
446
+ * Downloads the cloud file at the given remote path to the given local path.
447
+ * @param remotePath The remote path of the file to download from the cloud.
448
+ * @param localPath The local path to download the cloud file to.
449
+ * @param scope The directory scope the path is in. Defaults to set default scope set for the current provider.
450
+ */
451
+
452
+ static downloadFile(remotePathOrPath, localPathOrScope, scope) {
453
+ if (typeof scope === 'string') {
454
+ if (!localPathOrScope) {
455
+ throw new CloudStorageError('Invalid arguments provided to downloadFile', NativeCloudStorageErrorCode.UNKNOWN);
456
+ }
457
+ return RNCloudStorage.getDefaultInstance().downloadFile(remotePathOrPath, localPathOrScope, scope);
458
+ } else {
459
+ // deprecated `triggerSync` call
460
+ return RNCloudStorage.getDefaultInstance().triggerSync(remotePathOrPath, scope);
461
+ }
412
462
  }
413
463
 
414
464
  /**
@@ -443,4 +493,4 @@ export default class RNCloudStorage {
443
493
  }
444
494
  //#endregion
445
495
  }
446
- //# sourceMappingURL=RNCloudStorage.js.map
496
+ //# sourceMappingURL=cloud-storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CloudStorageProvider","CloudStorageScope","NativeCloudStorageErrorCode","isProviderSupported","NativeEventEmitter","NativeModules","Platform","GoogleDrive","NativeCloudKit","DEFAULT_PROVIDER_OPTIONS","LINKING_ERROR","CloudStorageError","RNCloudStorage","cloudAvailabilityListeners","constructor","provider","options","Error","getDefaultProvider","setProvider","setProviderOptions","nativeStorage","ICloud","Proxy","get","OS","getSupportedProviders","Object","values","filter","getProvider","isCloudAvailable","then","available","listener","eventEmitter","CloudStorageEventEmitter","addListener","event","getProviderOptions","newOptions","fromEntries","entries","_","v","undefined","accessToken","length","subscribeToCloudAvailability","push","unsubscribeFromCloudAvailability","l","appendFile","path","data","scope","appendToFile","exists","fileExists","writeFile","createFile","mkdir","createDirectory","readdir","listFiles","readFile","triggerSync","uploadFile","remotePath","localPath","mimeType","downloadFile","remotePathOrPath","localPathOrScope","includes","UNKNOWN","unlink","deleteFile","rmdir","deleteDirectory","recursive","stat","native","statFile","birthtime","Date","birthtimeMs","mtime","mtimeMs","isDirectory","isFile","getDefaultInstance","defaultInstance"],"sourceRoot":"../../src","sources":["cloud-storage.ts"],"mappings":";;AAAA,SACEA,oBAAoB,EACpBC,iBAAiB,QAIZ,cAAc;AACrB,SAASC,2BAA2B,QAA4B,gBAAgB;AAChF,SAASC,mBAAmB,QAAQ,iBAAiB;AACrD,SAASC,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAC1E,OAAOC,WAAW,MAAM,yBAAyB;AACjD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ACrB,MAAM,IAAI9D,iBAAiB,CAAC,4CAA4C,EAAET,2BAA2B,CAACyE,OAAO,CAAC;MAChH;MACA,OAAO/D,cAAc,CAAC+E,kBAAkB,CAAC,CAAC,CAACpB,YAAY,CAACC,gBAAgB,EAAEC,gBAAgB,EAAElB,KAAK,CAAC;IACpG,CAAC,MAAM;MACL;MACA,OAAO3C,cAAc,CAAC+E,kBAAkB,CAAC,CAAC,CAACzB,WAAW,CAACM,gBAAgB,EAAEjB,KAAK,CAAC;IACjF;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,OAAOqB,MAAMA,CAACvB,IAAY,EAAEE,KAAyB,EAAiB;IACpE,OAAO3C,cAAc,CAAC+E,kBAAkB,CAAC,CAAC,CAACf,MAAM,CAACvB,IAAI,EAAEE,KAAK,CAAC;EAChE;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,OAAOuB,KAAKA,CAACzB,IAAY,EAAErC,OAAiC,EAAEuC,KAAyB,EAAiB;IACtG,OAAO3C,cAAc,CAAC+E,kBAAkB,CAAC,CAAC,CAACb,KAAK,CAACzB,IAAI,EAAErC,OAAO,EAAEuC,KAAK,CAAC;EACxE;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,OAAO0B,IAAIA,CAAC5B,IAAY,EAAEE,KAAyB,EAAiC;IAClF,OAAO3C,cAAc,CAAC+E,kBAAkB,CAAC,CAAC,CAACV,IAAI,CAAC5B,IAAI,EAAEE,KAAK,CAAC;EAC9D;EACA;AACF","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ import withRNCloudStorageIos from './ios';
4
+ // Android config plugin not needed as there's nothing to configure.
5
+
6
+ const withRNCloudStorage = (config, options) => withRNCloudStorageIos(config, options);
7
+ export default withRNCloudStorage;
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["withRNCloudStorageIos","withRNCloudStorage","config","options"],"sourceRoot":"../../../src","sources":["expo-plugin/index.ts"],"mappings":";;AACA,OAAOA,qBAAqB,MAAM,OAAO;AAGzC;;AAEA,MAAMC,kBAAmE,GAAGA,CAACC,MAAM,EAAEC,OAAO,KAC1FH,qBAAqB,CAACE,MAAM,EAAEC,OAAO,CAAC;AAExC,eAAeF,kBAAkB","ignoreList":[]}
@@ -30,4 +30,4 @@ const withRNCloudStorageEntitlementsPlist = (config, options) => withEntitlement
30
30
  });
31
31
  const withRNCloudStorageIos = (config, options) => withPlugins(config, [[withRNCloudStorageInfoPlist, options], [withRNCloudStorageEntitlementsPlist, options]]);
32
32
  export default withRNCloudStorageIos;
33
- //# sourceMappingURL=withRNCloudStorageIos.js.map
33
+ //# sourceMappingURL=ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["withEntitlementsPlist","withInfoPlist","withPlugins","getICloudContainerIdentifier","config","options","iCloudContainerIdentifier","ios","bundleIdentifier","Error","withRNCloudStorageInfoPlist","newConfig","infoPlist","modResults","NSUbiquitousContainers","NSUbiquitousContainerIsDocumentScopePublic","NSUbiquitousContainerSupportedFolderLevels","NSUbiquitousContainerName","slug","withRNCloudStorageEntitlementsPlist","entitlementsPlist","iCloudContainerEnvironment","withRNCloudStorageIos"],"sourceRoot":"../../../src","sources":["expo-plugin/ios.ts"],"mappings":";;AAAA,SAASA,qBAAqB,EAAEC,aAAa,EAAEC,WAAW,QAA2B,sBAAsB;AAI3G,MAAMC,4BAA4B,GAAGA,CAACC,MAAkB,EAAEC,OAA0C,KAAK;EACvG,IAAIA,OAAO,EAAEC,yBAAyB,EAAE,OAAOD,OAAO,CAACC,yBAAyB;EAEhF,IAAI,CAACF,MAAM,EAAEG,GAAG,EAAEC,gBAAgB,EAAE,MAAM,IAAIC,KAAK,CAAC,+BAA+B,CAAC;EACpF,OAAO,UAAUL,MAAM,CAACG,GAAG,CAACC,gBAAgB,EAAE;AAChD,CAAC;AAED,MAAME,2BAA4E,GAAGA,CAACN,MAAM,EAAEC,OAAO,KACnGJ,aAAa,CAACG,MAAM,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3
+ import RNCloudStorage from '../cloud-storage';
4
4
  import { useCallback, useEffect, useState } from 'react';
5
5
 
6
6
  /**
@@ -32,19 +32,37 @@ export const useCloudFile = (path, scope, cloudStorageInstance) => {
32
32
  await instance.unlink(path, scope);
33
33
  setContent(null);
34
34
  }, [path, scope, instance]);
35
- const download = useCallback(async () => {
36
- await instance.downloadFile(path, scope);
35
+ const sync = useCallback(async () => {
36
+ await instance.triggerSync(path, scope);
37
37
  }, [path, scope, instance]);
38
38
  return {
39
+ /**
40
+ * The content of the file.
41
+ */
39
42
  content,
43
+ /**
44
+ * Reads the file from the cloud.
45
+ */
40
46
  read,
47
+ /**
48
+ * Writes new content to the file.
49
+ */
41
50
  write,
51
+ /**
52
+ * Deletes the file.
53
+ */
42
54
  remove,
43
55
  /**
44
- * Downloads the file from iCloud to the device. Needed if the file hasn't been synced yet. Has no effect on
45
- * Google Drive.
56
+ * Triggers synchronization for the file. Needed if the file hasn't been synced yet from iCloud.
57
+ * Has no effect on Google Drive.
58
+ */
59
+ sync,
60
+ /**
61
+ * Triggers synchronization for the file. Needed if the file hasn't been synced yet from iCloud.
62
+ * Has no effect on Google Drive.
63
+ * @deprecated Use `sync` instead.
46
64
  */
47
- download
65
+ download: sync
48
66
  };
49
67
  };
50
- //# sourceMappingURL=useCloudFile.js.map
68
+ //# sourceMappingURL=use-cloud-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["RNCloudStorage","useCallback","useEffect","useState","useCloudFile","path","scope","cloudStorageInstance","content","setContent","instance","read","exists","readFile","then","write","newContent","writeFile","remove","unlink","sync","triggerSync","download"],"sourceRoot":"../../../src","sources":["hooks/use-cloud-file.ts"],"mappings":";;AACA,OAAOA,cAAc,MAAM,kBAAkB;AAC7C,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAGA,CAACC,IAAY,EAAEC,KAAyB,EAAEC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;EAE3B,OAAO;IACL;AACJ;AACA;IACIF,OAAO;IACP;AACJ;AACA;IACIG,IAAI;IACJ;AACJ;AACA;IACII,KAAK;IACL;AACJ;AACA;IACIG,MAAM;IACN;AACJ;AACA;AACA;IACIE,IAAI;IACJ;AACJ;AACA;AACA;AACA;IACIE,QAAQ,EAAEF;EACZ,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import { useCallback, useEffect, useState } from 'react';
4
- import RNCloudStorage from '../RNCloudStorage';
4
+ import RNCloudStorage from '../cloud-storage';
5
5
 
6
6
  /**
7
7
  * A hook that tests whether or not the cloud storage is available.
@@ -26,4 +26,4 @@ export const useIsCloudAvailable = cloudStorageInstance => {
26
26
  }, [instance, handleAvailabilityChange]);
27
27
  return isAvailable;
28
28
  };
29
- //# sourceMappingURL=useIsCloudAvailable.js.map
29
+ //# sourceMappingURL=use-is-cloud-available.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useEffect","useState","RNCloudStorage","useIsCloudAvailable","cloudStorageInstance","isAvailable","setIsAvailable","instance","getDefaultInstance","handleAvailabilityChange","available","isCloudAvailable","then","subscribeToCloudAvailability","unsubscribeFromCloudAvailability"],"sourceRoot":"../../../src","sources":["hooks/use-is-cloud-available.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACxD,OAAOC,cAAc,MAAM,kBAAkB;;AAE7C;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAIC,oBAAqC,IAAK;EAC5E,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGL,QAAQ,CAAC,KAAK,CAAC;EACrD,MAAMM,QAAQ,GAAGH,oBAAoB,IAAIF,cAAc,CAACM,kBAAkB,CAAC,CAAC;EAE5E,MAAMC,wBAAwB,GAAGV,WAAW,CAAEW,SAAkB,IAAK;IACnEJ,cAAc,CAACI,SAAS,CAAC;EAC3B,CAAC,EAAE,EAAE,CAAC;EAENV,SAAS,CAAC,MAAM;IACd;IACAO,QAAQ,CAACI,gBAAgB,CAAC,CAAC,CAACC,IAAI,CAACN,cAAc,CAAC;;IAEhD;IACAC,QAAQ,CAACM,4BAA4B,CAACJ,wBAAwB,CAAC;IAE/D,OAAO,MAAM;MACXF,QAAQ,CAACO,gCAAgC,CAACL,wBAAwB,CAAC;IACrE,CAAC;EACH,CAAC,EAAE,CAACF,QAAQ,EAAEE,wBAAwB,CAAC,CAAC;EAExC,OAAOJ,WAAW;AACpB,CAAC","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ export * from './types/main';
4
+ export * from './hooks/use-cloud-file';
5
+ export * from './hooks/use-is-cloud-available';
6
+ export { NativeCloudStorageErrorCode as CloudStorageErrorCode } from './types/native';
7
+ export { default as CloudStorageError } from './utils/cloud-storage-error';
8
+ export { default as CloudStorage } from './cloud-storage';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeCloudStorageErrorCode","CloudStorageErrorCode","default","CloudStorageError","CloudStorage"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,cAAc,cAAc;AAC5B,cAAc,wBAAwB;AACtC,cAAc,gCAAgC;AAE9C,SAASA,2BAA2B,IAAIC,qBAAqB,QAAQ,gBAAgB;AACrF,SAASC,OAAO,IAAIC,iBAAiB,QAAQ,6BAA6B;AAC1E,SAASD,OAAO,IAAIE,YAAY,QAAQ,iBAAiB","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ import { NativeModules } from 'react-native';
4
+ import { createProxiedNativeModule } from '../utils/native';
5
+ export const NativeCloudKit = createProxiedNativeModule(NativeModules.CloudStorageCloudKit);
6
+ //# sourceMappingURL=cloudkit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeModules","createProxiedNativeModule","NativeCloudKit","CloudStorageCloudKit"],"sourceRoot":"../../../src","sources":["storages/cloudkit.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,cAAc;AAE5C,SAASC,yBAAyB,QAAQ,iBAAiB;AAE3D,OAAO,MAAMC,cAAc,GAAGD,yBAAyB,CAAgBD,aAAa,CAACG,oBAAoB,CAAC","ignoreList":[]}