react-native-cloud-sync 0.1.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 (268) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +360 -0
  3. package/app.plugin.js +3 -0
  4. package/ios/CloudSyncError.swift +144 -0
  5. package/ios/CloudSyncImpl.swift +1263 -0
  6. package/ios/RNCloudSync.h +25 -0
  7. package/ios/RNCloudSync.mm +477 -0
  8. package/jest-mock.js +136 -0
  9. package/lib/commonjs/config.js +85 -0
  10. package/lib/commonjs/config.js.map +1 -0
  11. package/lib/commonjs/errors.js +244 -0
  12. package/lib/commonjs/errors.js.map +1 -0
  13. package/lib/commonjs/hooks.js +257 -0
  14. package/lib/commonjs/hooks.js.map +1 -0
  15. package/lib/commonjs/index.js +244 -0
  16. package/lib/commonjs/index.js.map +1 -0
  17. package/lib/commonjs/internal/autoFlush.js +65 -0
  18. package/lib/commonjs/internal/autoFlush.js.map +1 -0
  19. package/lib/commonjs/internal/base64.js +58 -0
  20. package/lib/commonjs/internal/base64.js.map +1 -0
  21. package/lib/commonjs/internal/bytes.js +32 -0
  22. package/lib/commonjs/internal/bytes.js.map +1 -0
  23. package/lib/commonjs/internal/cloudKitRest.js +527 -0
  24. package/lib/commonjs/internal/cloudKitRest.js.map +1 -0
  25. package/lib/commonjs/internal/enums.js +23 -0
  26. package/lib/commonjs/internal/enums.js.map +1 -0
  27. package/lib/commonjs/internal/googleDriveRest.js +624 -0
  28. package/lib/commonjs/internal/googleDriveRest.js.map +1 -0
  29. package/lib/commonjs/internal/keys.js +139 -0
  30. package/lib/commonjs/internal/keys.js.map +1 -0
  31. package/lib/commonjs/internal/logger.js +29 -0
  32. package/lib/commonjs/internal/logger.js.map +1 -0
  33. package/lib/commonjs/internal/nativeModule.js +125 -0
  34. package/lib/commonjs/internal/nativeModule.js.map +1 -0
  35. package/lib/commonjs/internal/timeout.js +72 -0
  36. package/lib/commonjs/internal/timeout.js.map +1 -0
  37. package/lib/commonjs/package.json +1 -0
  38. package/lib/commonjs/providers/cloudKit.js +398 -0
  39. package/lib/commonjs/providers/cloudKit.js.map +1 -0
  40. package/lib/commonjs/providers/cloudKitBackup.js +86 -0
  41. package/lib/commonjs/providers/cloudKitBackup.js.map +1 -0
  42. package/lib/commonjs/providers/cloudKitEncrypted.js +150 -0
  43. package/lib/commonjs/providers/cloudKitEncrypted.js.map +1 -0
  44. package/lib/commonjs/providers/googleDrive.js +219 -0
  45. package/lib/commonjs/providers/googleDrive.js.map +1 -0
  46. package/lib/commonjs/providers/googleDriveFiles.js +68 -0
  47. package/lib/commonjs/providers/googleDriveFiles.js.map +1 -0
  48. package/lib/commonjs/providers/icloudDocuments.js +121 -0
  49. package/lib/commonjs/providers/icloudDocuments.js.map +1 -0
  50. package/lib/commonjs/providers/icloudKV.js +171 -0
  51. package/lib/commonjs/providers/icloudKV.js.map +1 -0
  52. package/lib/commonjs/providers/icloudKV.web.js +42 -0
  53. package/lib/commonjs/providers/icloudKV.web.js.map +1 -0
  54. package/lib/commonjs/providers/memory.js +201 -0
  55. package/lib/commonjs/providers/memory.js.map +1 -0
  56. package/lib/commonjs/resolvers.js +128 -0
  57. package/lib/commonjs/resolvers.js.map +1 -0
  58. package/lib/commonjs/specs/NativeRNCloudSync.js +14 -0
  59. package/lib/commonjs/specs/NativeRNCloudSync.js.map +1 -0
  60. package/lib/commonjs/store.js +1064 -0
  61. package/lib/commonjs/store.js.map +1 -0
  62. package/lib/commonjs/testing.js +32 -0
  63. package/lib/commonjs/testing.js.map +1 -0
  64. package/lib/commonjs/types.js +86 -0
  65. package/lib/commonjs/types.js.map +1 -0
  66. package/lib/module/config.js +72 -0
  67. package/lib/module/config.js.map +1 -0
  68. package/lib/module/errors.js +231 -0
  69. package/lib/module/errors.js.map +1 -0
  70. package/lib/module/hooks.js +250 -0
  71. package/lib/module/hooks.js.map +1 -0
  72. package/lib/module/index.js +46 -0
  73. package/lib/module/index.js.map +1 -0
  74. package/lib/module/internal/autoFlush.js +62 -0
  75. package/lib/module/internal/autoFlush.js.map +1 -0
  76. package/lib/module/internal/base64.js +53 -0
  77. package/lib/module/internal/base64.js.map +1 -0
  78. package/lib/module/internal/bytes.js +28 -0
  79. package/lib/module/internal/bytes.js.map +1 -0
  80. package/lib/module/internal/cloudKitRest.js +518 -0
  81. package/lib/module/internal/cloudKitRest.js.map +1 -0
  82. package/lib/module/internal/enums.js +18 -0
  83. package/lib/module/internal/enums.js.map +1 -0
  84. package/lib/module/internal/googleDriveRest.js +620 -0
  85. package/lib/module/internal/googleDriveRest.js.map +1 -0
  86. package/lib/module/internal/keys.js +134 -0
  87. package/lib/module/internal/keys.js.map +1 -0
  88. package/lib/module/internal/logger.js +23 -0
  89. package/lib/module/internal/logger.js.map +1 -0
  90. package/lib/module/internal/nativeModule.js +117 -0
  91. package/lib/module/internal/nativeModule.js.map +1 -0
  92. package/lib/module/internal/timeout.js +67 -0
  93. package/lib/module/internal/timeout.js.map +1 -0
  94. package/lib/module/package.json +1 -0
  95. package/lib/module/providers/cloudKit.js +392 -0
  96. package/lib/module/providers/cloudKit.js.map +1 -0
  97. package/lib/module/providers/cloudKitBackup.js +82 -0
  98. package/lib/module/providers/cloudKitBackup.js.map +1 -0
  99. package/lib/module/providers/cloudKitEncrypted.js +146 -0
  100. package/lib/module/providers/cloudKitEncrypted.js.map +1 -0
  101. package/lib/module/providers/googleDrive.js +214 -0
  102. package/lib/module/providers/googleDrive.js.map +1 -0
  103. package/lib/module/providers/googleDriveFiles.js +64 -0
  104. package/lib/module/providers/googleDriveFiles.js.map +1 -0
  105. package/lib/module/providers/icloudDocuments.js +117 -0
  106. package/lib/module/providers/icloudDocuments.js.map +1 -0
  107. package/lib/module/providers/icloudKV.js +165 -0
  108. package/lib/module/providers/icloudKV.js.map +1 -0
  109. package/lib/module/providers/icloudKV.web.js +36 -0
  110. package/lib/module/providers/icloudKV.web.js.map +1 -0
  111. package/lib/module/providers/memory.js +197 -0
  112. package/lib/module/providers/memory.js.map +1 -0
  113. package/lib/module/resolvers.js +120 -0
  114. package/lib/module/resolvers.js.map +1 -0
  115. package/lib/module/specs/NativeRNCloudSync.js +12 -0
  116. package/lib/module/specs/NativeRNCloudSync.js.map +1 -0
  117. package/lib/module/store.js +1061 -0
  118. package/lib/module/store.js.map +1 -0
  119. package/lib/module/testing.js +17 -0
  120. package/lib/module/testing.js.map +1 -0
  121. package/lib/module/types.js +82 -0
  122. package/lib/module/types.js.map +1 -0
  123. package/lib/typescript/commonjs/config.d.ts +33 -0
  124. package/lib/typescript/commonjs/config.d.ts.map +1 -0
  125. package/lib/typescript/commonjs/errors.d.ts +140 -0
  126. package/lib/typescript/commonjs/errors.d.ts.map +1 -0
  127. package/lib/typescript/commonjs/hooks.d.ts +109 -0
  128. package/lib/typescript/commonjs/hooks.d.ts.map +1 -0
  129. package/lib/typescript/commonjs/index.d.ts +37 -0
  130. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  131. package/lib/typescript/commonjs/internal/autoFlush.d.ts +45 -0
  132. package/lib/typescript/commonjs/internal/autoFlush.d.ts.map +1 -0
  133. package/lib/typescript/commonjs/internal/base64.d.ts +12 -0
  134. package/lib/typescript/commonjs/internal/base64.d.ts.map +1 -0
  135. package/lib/typescript/commonjs/internal/bytes.d.ts +12 -0
  136. package/lib/typescript/commonjs/internal/bytes.d.ts.map +1 -0
  137. package/lib/typescript/commonjs/internal/cloudKitRest.d.ts +149 -0
  138. package/lib/typescript/commonjs/internal/cloudKitRest.d.ts.map +1 -0
  139. package/lib/typescript/commonjs/internal/enums.d.ts +10 -0
  140. package/lib/typescript/commonjs/internal/enums.d.ts.map +1 -0
  141. package/lib/typescript/commonjs/internal/googleDriveRest.d.ts +232 -0
  142. package/lib/typescript/commonjs/internal/googleDriveRest.d.ts.map +1 -0
  143. package/lib/typescript/commonjs/internal/keys.d.ts +28 -0
  144. package/lib/typescript/commonjs/internal/keys.d.ts.map +1 -0
  145. package/lib/typescript/commonjs/internal/logger.d.ts +10 -0
  146. package/lib/typescript/commonjs/internal/logger.d.ts.map +1 -0
  147. package/lib/typescript/commonjs/internal/nativeModule.d.ts +29 -0
  148. package/lib/typescript/commonjs/internal/nativeModule.d.ts.map +1 -0
  149. package/lib/typescript/commonjs/internal/timeout.d.ts +36 -0
  150. package/lib/typescript/commonjs/internal/timeout.d.ts.map +1 -0
  151. package/lib/typescript/commonjs/package.json +1 -0
  152. package/lib/typescript/commonjs/providers/cloudKit.d.ts +86 -0
  153. package/lib/typescript/commonjs/providers/cloudKit.d.ts.map +1 -0
  154. package/lib/typescript/commonjs/providers/cloudKitBackup.d.ts +65 -0
  155. package/lib/typescript/commonjs/providers/cloudKitBackup.d.ts.map +1 -0
  156. package/lib/typescript/commonjs/providers/cloudKitEncrypted.d.ts +37 -0
  157. package/lib/typescript/commonjs/providers/cloudKitEncrypted.d.ts.map +1 -0
  158. package/lib/typescript/commonjs/providers/googleDrive.d.ts +35 -0
  159. package/lib/typescript/commonjs/providers/googleDrive.d.ts.map +1 -0
  160. package/lib/typescript/commonjs/providers/googleDriveFiles.d.ts +59 -0
  161. package/lib/typescript/commonjs/providers/googleDriveFiles.d.ts.map +1 -0
  162. package/lib/typescript/commonjs/providers/icloudDocuments.d.ts +101 -0
  163. package/lib/typescript/commonjs/providers/icloudDocuments.d.ts.map +1 -0
  164. package/lib/typescript/commonjs/providers/icloudKV.d.ts +26 -0
  165. package/lib/typescript/commonjs/providers/icloudKV.d.ts.map +1 -0
  166. package/lib/typescript/commonjs/providers/icloudKV.web.d.ts +12 -0
  167. package/lib/typescript/commonjs/providers/icloudKV.web.d.ts.map +1 -0
  168. package/lib/typescript/commonjs/providers/memory.d.ts +90 -0
  169. package/lib/typescript/commonjs/providers/memory.d.ts.map +1 -0
  170. package/lib/typescript/commonjs/resolvers.d.ts +60 -0
  171. package/lib/typescript/commonjs/resolvers.d.ts.map +1 -0
  172. package/lib/typescript/commonjs/specs/NativeRNCloudSync.d.ts +133 -0
  173. package/lib/typescript/commonjs/specs/NativeRNCloudSync.d.ts.map +1 -0
  174. package/lib/typescript/commonjs/store.d.ts +118 -0
  175. package/lib/typescript/commonjs/store.d.ts.map +1 -0
  176. package/lib/typescript/commonjs/testing.d.ts +16 -0
  177. package/lib/typescript/commonjs/testing.d.ts.map +1 -0
  178. package/lib/typescript/commonjs/types.d.ts +367 -0
  179. package/lib/typescript/commonjs/types.d.ts.map +1 -0
  180. package/lib/typescript/module/config.d.ts +33 -0
  181. package/lib/typescript/module/config.d.ts.map +1 -0
  182. package/lib/typescript/module/errors.d.ts +140 -0
  183. package/lib/typescript/module/errors.d.ts.map +1 -0
  184. package/lib/typescript/module/hooks.d.ts +109 -0
  185. package/lib/typescript/module/hooks.d.ts.map +1 -0
  186. package/lib/typescript/module/index.d.ts +37 -0
  187. package/lib/typescript/module/index.d.ts.map +1 -0
  188. package/lib/typescript/module/internal/autoFlush.d.ts +45 -0
  189. package/lib/typescript/module/internal/autoFlush.d.ts.map +1 -0
  190. package/lib/typescript/module/internal/base64.d.ts +12 -0
  191. package/lib/typescript/module/internal/base64.d.ts.map +1 -0
  192. package/lib/typescript/module/internal/bytes.d.ts +12 -0
  193. package/lib/typescript/module/internal/bytes.d.ts.map +1 -0
  194. package/lib/typescript/module/internal/cloudKitRest.d.ts +149 -0
  195. package/lib/typescript/module/internal/cloudKitRest.d.ts.map +1 -0
  196. package/lib/typescript/module/internal/enums.d.ts +10 -0
  197. package/lib/typescript/module/internal/enums.d.ts.map +1 -0
  198. package/lib/typescript/module/internal/googleDriveRest.d.ts +232 -0
  199. package/lib/typescript/module/internal/googleDriveRest.d.ts.map +1 -0
  200. package/lib/typescript/module/internal/keys.d.ts +28 -0
  201. package/lib/typescript/module/internal/keys.d.ts.map +1 -0
  202. package/lib/typescript/module/internal/logger.d.ts +10 -0
  203. package/lib/typescript/module/internal/logger.d.ts.map +1 -0
  204. package/lib/typescript/module/internal/nativeModule.d.ts +29 -0
  205. package/lib/typescript/module/internal/nativeModule.d.ts.map +1 -0
  206. package/lib/typescript/module/internal/timeout.d.ts +36 -0
  207. package/lib/typescript/module/internal/timeout.d.ts.map +1 -0
  208. package/lib/typescript/module/package.json +1 -0
  209. package/lib/typescript/module/providers/cloudKit.d.ts +86 -0
  210. package/lib/typescript/module/providers/cloudKit.d.ts.map +1 -0
  211. package/lib/typescript/module/providers/cloudKitBackup.d.ts +65 -0
  212. package/lib/typescript/module/providers/cloudKitBackup.d.ts.map +1 -0
  213. package/lib/typescript/module/providers/cloudKitEncrypted.d.ts +37 -0
  214. package/lib/typescript/module/providers/cloudKitEncrypted.d.ts.map +1 -0
  215. package/lib/typescript/module/providers/googleDrive.d.ts +35 -0
  216. package/lib/typescript/module/providers/googleDrive.d.ts.map +1 -0
  217. package/lib/typescript/module/providers/googleDriveFiles.d.ts +59 -0
  218. package/lib/typescript/module/providers/googleDriveFiles.d.ts.map +1 -0
  219. package/lib/typescript/module/providers/icloudDocuments.d.ts +101 -0
  220. package/lib/typescript/module/providers/icloudDocuments.d.ts.map +1 -0
  221. package/lib/typescript/module/providers/icloudKV.d.ts +26 -0
  222. package/lib/typescript/module/providers/icloudKV.d.ts.map +1 -0
  223. package/lib/typescript/module/providers/icloudKV.web.d.ts +12 -0
  224. package/lib/typescript/module/providers/icloudKV.web.d.ts.map +1 -0
  225. package/lib/typescript/module/providers/memory.d.ts +90 -0
  226. package/lib/typescript/module/providers/memory.d.ts.map +1 -0
  227. package/lib/typescript/module/resolvers.d.ts +60 -0
  228. package/lib/typescript/module/resolvers.d.ts.map +1 -0
  229. package/lib/typescript/module/specs/NativeRNCloudSync.d.ts +133 -0
  230. package/lib/typescript/module/specs/NativeRNCloudSync.d.ts.map +1 -0
  231. package/lib/typescript/module/store.d.ts +118 -0
  232. package/lib/typescript/module/store.d.ts.map +1 -0
  233. package/lib/typescript/module/testing.d.ts +16 -0
  234. package/lib/typescript/module/testing.d.ts.map +1 -0
  235. package/lib/typescript/module/types.d.ts +367 -0
  236. package/lib/typescript/module/types.d.ts.map +1 -0
  237. package/package.json +186 -0
  238. package/plugin/build/index.d.ts +45 -0
  239. package/plugin/build/index.js +93 -0
  240. package/react-native-cloud-sync.podspec +48 -0
  241. package/src/config.ts +94 -0
  242. package/src/errors.ts +263 -0
  243. package/src/hooks.ts +337 -0
  244. package/src/index.ts +113 -0
  245. package/src/internal/autoFlush.ts +87 -0
  246. package/src/internal/base64.ts +63 -0
  247. package/src/internal/bytes.ts +28 -0
  248. package/src/internal/cloudKitRest.ts +654 -0
  249. package/src/internal/enums.ts +35 -0
  250. package/src/internal/googleDriveRest.ts +765 -0
  251. package/src/internal/keys.ts +160 -0
  252. package/src/internal/logger.ts +23 -0
  253. package/src/internal/nativeModule.ts +149 -0
  254. package/src/internal/timeout.ts +83 -0
  255. package/src/providers/cloudKit.ts +510 -0
  256. package/src/providers/cloudKitBackup.ts +124 -0
  257. package/src/providers/cloudKitEncrypted.ts +175 -0
  258. package/src/providers/googleDrive.ts +251 -0
  259. package/src/providers/googleDriveFiles.ts +117 -0
  260. package/src/providers/icloudDocuments.ts +175 -0
  261. package/src/providers/icloudKV.ts +206 -0
  262. package/src/providers/icloudKV.web.ts +41 -0
  263. package/src/providers/memory.ts +302 -0
  264. package/src/resolvers.ts +133 -0
  265. package/src/specs/NativeRNCloudSync.ts +184 -0
  266. package/src/store.ts +1288 -0
  267. package/src/testing.ts +22 -0
  268. package/src/types.ts +426 -0
@@ -0,0 +1,244 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "CloudSyncError", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _errors.CloudSyncError;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "DEFAULT_TIERING", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _types.DEFAULT_TIERING;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "ErrorCode", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _errors.ErrorCode;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "base64ToBytes", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _base.base64ToBytes;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "bytesToBase64", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _base.bytesToBase64;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "checkKey", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _keys.checkKey;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "cloudKit", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _cloudKit.cloudKit;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "cloudKitAssets", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _cloudKit.assets;
52
+ }
53
+ });
54
+ Object.defineProperty(exports, "cloudKitBackup", {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _cloudKitBackup.cloudKitBackup;
58
+ }
59
+ });
60
+ Object.defineProperty(exports, "cloudKitEncrypted", {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _cloudKitEncrypted.cloudKitEncrypted;
64
+ }
65
+ });
66
+ Object.defineProperty(exports, "cloudKitZones", {
67
+ enumerable: true,
68
+ get: function () {
69
+ return _cloudKit.zones;
70
+ }
71
+ });
72
+ Object.defineProperty(exports, "configureCloudKit", {
73
+ enumerable: true,
74
+ get: function () {
75
+ return _config.configureCloudKit;
76
+ }
77
+ });
78
+ Object.defineProperty(exports, "configureGoogleDrive", {
79
+ enumerable: true,
80
+ get: function () {
81
+ return _config.configureGoogleDrive;
82
+ }
83
+ });
84
+ Object.defineProperty(exports, "configureGoogleDriveFiles", {
85
+ enumerable: true,
86
+ get: function () {
87
+ return _config.configureGoogleDriveFiles;
88
+ }
89
+ });
90
+ Object.defineProperty(exports, "createCloudKitProvider", {
91
+ enumerable: true,
92
+ get: function () {
93
+ return _cloudKit.createCloudKitProvider;
94
+ }
95
+ });
96
+ Object.defineProperty(exports, "createCloudStore", {
97
+ enumerable: true,
98
+ get: function () {
99
+ return _store.createCloudStore;
100
+ }
101
+ });
102
+ Object.defineProperty(exports, "createGoogleDriveProvider", {
103
+ enumerable: true,
104
+ get: function () {
105
+ return _googleDrive.createGoogleDriveProvider;
106
+ }
107
+ });
108
+ Object.defineProperty(exports, "createMemoryProvider", {
109
+ enumerable: true,
110
+ get: function () {
111
+ return _memory.createMemoryProvider;
112
+ }
113
+ });
114
+ Object.defineProperty(exports, "googleDrive", {
115
+ enumerable: true,
116
+ get: function () {
117
+ return _googleDrive.googleDrive;
118
+ }
119
+ });
120
+ Object.defineProperty(exports, "googleDriveFiles", {
121
+ enumerable: true,
122
+ get: function () {
123
+ return _googleDriveFiles.googleDriveFiles;
124
+ }
125
+ });
126
+ Object.defineProperty(exports, "icloudDocuments", {
127
+ enumerable: true,
128
+ get: function () {
129
+ return _icloudDocuments.icloudDocuments;
130
+ }
131
+ });
132
+ Object.defineProperty(exports, "icloudKV", {
133
+ enumerable: true,
134
+ get: function () {
135
+ return _icloudKV.icloudKV;
136
+ }
137
+ });
138
+ Object.defineProperty(exports, "icloudKVGetAllItems", {
139
+ enumerable: true,
140
+ get: function () {
141
+ return _icloudKV.getAllItems;
142
+ }
143
+ });
144
+ Object.defineProperty(exports, "icloudKVSync", {
145
+ enumerable: true,
146
+ get: function () {
147
+ return _icloudKV.sync;
148
+ }
149
+ });
150
+ Object.defineProperty(exports, "isCancelled", {
151
+ enumerable: true,
152
+ get: function () {
153
+ return _errors.isCancelled;
154
+ }
155
+ });
156
+ Object.defineProperty(exports, "isCloudKitConfigured", {
157
+ enumerable: true,
158
+ get: function () {
159
+ return _config.isCloudKitConfigured;
160
+ }
161
+ });
162
+ Object.defineProperty(exports, "isCloudSyncError", {
163
+ enumerable: true,
164
+ get: function () {
165
+ return _errors.isCloudSyncError;
166
+ }
167
+ });
168
+ Object.defineProperty(exports, "isGoogleDriveConfigured", {
169
+ enumerable: true,
170
+ get: function () {
171
+ return _config.isGoogleDriveConfigured;
172
+ }
173
+ });
174
+ Object.defineProperty(exports, "isGoogleDriveFilesConfigured", {
175
+ enumerable: true,
176
+ get: function () {
177
+ return _config.isGoogleDriveFilesConfigured;
178
+ }
179
+ });
180
+ Object.defineProperty(exports, "isRetryable", {
181
+ enumerable: true,
182
+ get: function () {
183
+ return _errors.isRetryable;
184
+ }
185
+ });
186
+ Object.defineProperty(exports, "requiresUserAction", {
187
+ enumerable: true,
188
+ get: function () {
189
+ return _errors.requiresUserAction;
190
+ }
191
+ });
192
+ Object.defineProperty(exports, "resolveByModifiedAt", {
193
+ enumerable: true,
194
+ get: function () {
195
+ return _resolvers.resolveByModifiedAt;
196
+ }
197
+ });
198
+ Object.defineProperty(exports, "resolveByPreferenceOrder", {
199
+ enumerable: true,
200
+ get: function () {
201
+ return _resolvers.resolveByPreferenceOrder;
202
+ }
203
+ });
204
+ Object.defineProperty(exports, "resolveByTimestamp", {
205
+ enumerable: true,
206
+ get: function () {
207
+ return _resolvers.resolveByTimestamp;
208
+ }
209
+ });
210
+ Object.defineProperty(exports, "resolveFirstOf", {
211
+ enumerable: true,
212
+ get: function () {
213
+ return _resolvers.resolveFirstOf;
214
+ }
215
+ });
216
+ Object.defineProperty(exports, "sanitizeKey", {
217
+ enumerable: true,
218
+ get: function () {
219
+ return _keys.sanitizeKey;
220
+ }
221
+ });
222
+ Object.defineProperty(exports, "setLogsEnabled", {
223
+ enumerable: true,
224
+ get: function () {
225
+ return _logger.setLogsEnabled;
226
+ }
227
+ });
228
+ var _icloudKV = require("./providers/icloudKV");
229
+ var _cloudKit = require("./providers/cloudKit.js");
230
+ var _cloudKitBackup = require("./providers/cloudKitBackup.js");
231
+ var _cloudKitEncrypted = require("./providers/cloudKitEncrypted.js");
232
+ var _icloudDocuments = require("./providers/icloudDocuments.js");
233
+ var _googleDrive = require("./providers/googleDrive.js");
234
+ var _googleDriveFiles = require("./providers/googleDriveFiles.js");
235
+ var _memory = require("./providers/memory.js");
236
+ var _store = require("./store.js");
237
+ var _resolvers = require("./resolvers.js");
238
+ var _keys = require("./internal/keys.js");
239
+ var _config = require("./config.js");
240
+ var _base = require("./internal/base64.js");
241
+ var _errors = require("./errors.js");
242
+ var _types = require("./types.js");
243
+ var _logger = require("./internal/logger.js");
244
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_icloudKV","require","_cloudKit","_cloudKitBackup","_cloudKitEncrypted","_icloudDocuments","_googleDrive","_googleDriveFiles","_memory","_store","_resolvers","_keys","_config","_base","_errors","_types","_logger"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,IAAAA,SAAA,GAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAD,OAAA;AAMA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAGA,IAAAQ,MAAA,GAAAR,OAAA;AAQA,IAAAS,UAAA,GAAAT,OAAA;AAQA,IAAAU,KAAA,GAAAV,OAAA;AAWA,IAAAW,OAAA,GAAAX,OAAA;AAgBA,IAAAY,KAAA,GAAAZ,OAAA;AAGA,IAAAa,OAAA,GAAAb,OAAA;AAqCA,IAAAc,MAAA,GAAAd,OAAA;AAEA,IAAAe,OAAA,GAAAf,OAAA","ignoreList":[]}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.attachAutoFlush = attachAutoFlush;
7
+ var _reactNative = require("react-native");
8
+ /**
9
+ * When the store should try to drain its outbox by itself.
10
+ *
11
+ * A durable queue with no trigger is only half a feature: every retryable
12
+ * failure is captured correctly and then sits there until the app remembers to
13
+ * call `flushOutbox()`. Most apps wire that to the same two moments, so the
14
+ * store can do it for them.
15
+ *
16
+ * Deliberately *not* network-aware. Detecting a reconnect needs
17
+ * `@react-native-community/netinfo`, and taking a dependency on it to save one
18
+ * line in the host app is a bad trade - it would be installed for every user of
19
+ * this package whether or not they wanted it. Call `flushOutbox()` from your
20
+ * own NetInfo listener for that; foreground plus a slow interval already covers
21
+ * the common case, since an app that regained connectivity is nearly always
22
+ * about to be foregrounded anyway.
23
+ */
24
+
25
+ const DEFAULT_INTERVAL_MS = 60_000;
26
+
27
+ /**
28
+ * Wires `flush` to app foreground and to a timer. Returns an unsubscribe.
29
+ *
30
+ * Failures are swallowed on purpose: this is a background retry nobody is
31
+ * waiting on, and the store already reports every failure through `onError`
32
+ * and `onDropped`. Letting a rejection escape a timer callback would surface as
33
+ * an unhandled rejection warning for something the app deliberately deferred.
34
+ */
35
+ function attachAutoFlush(flush, config = {}) {
36
+ const onForeground = config.onForeground ?? true;
37
+ const intervalMs = config.intervalMs ?? DEFAULT_INTERVAL_MS;
38
+ const safeFlush = () => {
39
+ void flush().catch(() => undefined);
40
+ };
41
+ let timer = null;
42
+ let appStateSub = null;
43
+ if (intervalMs > 0) {
44
+ timer = setInterval(safeFlush, intervalMs);
45
+ // A pending retry must never be the reason a process stays alive.
46
+ timer.unref?.();
47
+ }
48
+ if (onForeground) {
49
+ let previous = _reactNative.AppState.currentState;
50
+ appStateSub = _reactNative.AppState.addEventListener('change', next => {
51
+ // Only the transition *into* active, not every state event - iOS emits
52
+ // `inactive` on the way through, and flushing twice per foreground would
53
+ // double the request rate for no benefit.
54
+ if (next === 'active' && previous !== 'active') safeFlush();
55
+ previous = next;
56
+ });
57
+ }
58
+ return () => {
59
+ if (timer != null) clearInterval(timer);
60
+ timer = null;
61
+ appStateSub?.remove();
62
+ appStateSub = null;
63
+ };
64
+ }
65
+ //# sourceMappingURL=autoFlush.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","DEFAULT_INTERVAL_MS","attachAutoFlush","flush","config","onForeground","intervalMs","safeFlush","catch","undefined","timer","appStateSub","setInterval","unref","previous","AppState","currentState","addEventListener","next","clearInterval","remove"],"sourceRoot":"../../../src","sources":["internal/autoFlush.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA,MAAMC,mBAAmB,GAAG,MAAM;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAC7BC,KAA6B,EAC7BC,MAAuB,GAAG,CAAC,CAAC,EACf;EACb,MAAMC,YAAY,GAAGD,MAAM,CAACC,YAAY,IAAI,IAAI;EAChD,MAAMC,UAAU,GAAGF,MAAM,CAACE,UAAU,IAAIL,mBAAmB;EAE3D,MAAMM,SAAS,GAAGA,CAAA,KAAY;IAC5B,KAAKJ,KAAK,CAAC,CAAC,CAACK,KAAK,CAAC,MAAMC,SAAS,CAAC;EACrC,CAAC;EAED,IAAIC,KAA4C,GAAG,IAAI;EACvD,IAAIC,WAA0C,GAAG,IAAI;EAErD,IAAIL,UAAU,GAAG,CAAC,EAAE;IAClBI,KAAK,GAAGE,WAAW,CAACL,SAAS,EAAED,UAAU,CAAC;IAC1C;IACAI,KAAK,CAACG,KAAK,GAAG,CAAC;EACjB;EAEA,IAAIR,YAAY,EAAE;IAChB,IAAIS,QAAQ,GAAGC,qBAAQ,CAACC,YAAY;IACpCL,WAAW,GAAGI,qBAAQ,CAACE,gBAAgB,CAAC,QAAQ,EAAGC,IAAI,IAAK;MAC1D;MACA;MACA;MACA,IAAIA,IAAI,KAAK,QAAQ,IAAIJ,QAAQ,KAAK,QAAQ,EAAEP,SAAS,CAAC,CAAC;MAC3DO,QAAQ,GAAGI,IAAI;IACjB,CAAC,CAAC;EACJ;EAEA,OAAO,MAAM;IACX,IAAIR,KAAK,IAAI,IAAI,EAAES,aAAa,CAACT,KAAK,CAAC;IACvCA,KAAK,GAAG,IAAI;IACZC,WAAW,EAAES,MAAM,CAAC,CAAC;IACrBT,WAAW,GAAG,IAAI;EACpB,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.base64ToBytes = base64ToBytes;
7
+ exports.bytesToBase64 = bytesToBase64;
8
+ /**
9
+ * Base64 encode/decode for the Drive binary-file path.
10
+ *
11
+ * Hand-rolled rather than `Buffer` or `atob`/`btoa`: neither is guaranteed to
12
+ * exist in a Hermes runtime, and this package ships with zero runtime
13
+ * dependencies (see `googleDriveFiles` for why - the file adapter itself is
14
+ * injected, in base64, for the same reason). A chunk is a few MB at most, so a
15
+ * lookup-table implementation is fast enough without needing a native module.
16
+ */
17
+
18
+ const CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
19
+
20
+ /** `CHARS[c]` -> its 6-bit value, indexed by char code. -1 for anything else. */
21
+ const DECODE_TABLE = (() => {
22
+ const table = new Int16Array(128).fill(-1);
23
+ for (let i = 0; i < CHARS.length; i++) table[CHARS.charCodeAt(i)] = i;
24
+ return table;
25
+ })();
26
+ function bytesToBase64(bytes) {
27
+ const chunks = [];
28
+ const len = bytes.length;
29
+ for (let i = 0; i < len; i += 3) {
30
+ const b0 = bytes[i];
31
+ const hasB1 = i + 1 < len;
32
+ const hasB2 = i + 2 < len;
33
+ const b1 = hasB1 ? bytes[i + 1] : 0;
34
+ const b2 = hasB2 ? bytes[i + 2] : 0;
35
+ chunks.push(CHARS[b0 >> 2], CHARS[(b0 & 0x03) << 4 | b1 >> 4], hasB1 ? CHARS[(b1 & 0x0f) << 2 | b2 >> 6] : '=', hasB2 ? CHARS[b2 & 0x3f] : '=');
36
+ }
37
+ return chunks.join('');
38
+ }
39
+ function base64ToBytes(base64) {
40
+ // Strip whitespace some fs libraries insert into long base64 strings, and
41
+ // any padding - length is derived from the real character count instead.
42
+ const clean = base64.replace(/[\r\n\s]/g, '').replace(/=+$/, '');
43
+ const len = clean.length;
44
+ const outLen = Math.floor(len * 3 / 4);
45
+ const bytes = new Uint8Array(outLen);
46
+ let p = 0;
47
+ for (let i = 0; i < len; i += 4) {
48
+ const e0 = DECODE_TABLE[clean.charCodeAt(i)] ?? -1;
49
+ const e1 = i + 1 < len ? DECODE_TABLE[clean.charCodeAt(i + 1)] ?? -1 : -1;
50
+ const e2 = i + 2 < len ? DECODE_TABLE[clean.charCodeAt(i + 2)] ?? -1 : -1;
51
+ const e3 = i + 3 < len ? DECODE_TABLE[clean.charCodeAt(i + 3)] ?? -1 : -1;
52
+ if (p < outLen) bytes[p++] = e0 << 2 | e1 >> 4;
53
+ if (p < outLen) bytes[p++] = (e1 & 0x0f) << 4 | e2 >> 2;
54
+ if (p < outLen) bytes[p++] = (e2 & 0x03) << 6 | e3;
55
+ }
56
+ return bytes;
57
+ }
58
+ //# sourceMappingURL=base64.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CHARS","DECODE_TABLE","table","Int16Array","fill","i","length","charCodeAt","bytesToBase64","bytes","chunks","len","b0","hasB1","hasB2","b1","b2","push","join","base64ToBytes","base64","clean","replace","outLen","Math","floor","Uint8Array","p","e0","e1","e2","e3"],"sourceRoot":"../../../src","sources":["internal/base64.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,KAAK,GAAG,kEAAkE;;AAEhF;AACA,MAAMC,YAAY,GAAG,CAAC,MAAM;EAC1B,MAAMC,KAAK,GAAG,IAAIC,UAAU,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,CAA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B,CAAC,EAAE,CAAC,GAAI,CAACE,EAAE,GAAG,IAAI,KAAK,CAAC,GAAKC,EAAE,IAAI,CAAE;IAC3D,IAAIH,CAAC,GAAGJ,MAAM,EAAEd,KAAK,CAACkB,CAAC,EAAE,CAAC,GAAI,CAACG,EAAE,GAAG,IAAI,KAAK,CAAC,GAAIC,EAAE;EACtD;EAEA,OAAOtB,KAAK;AACd","ignoreList":[]}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.byteLength = byteLength;
7
+ /**
8
+ * UTF-8 byte length.
9
+ *
10
+ * `String.length` counts UTF-16 code units, which under-reports for any
11
+ * non-ASCII payload - the exact way a "just under the limit" value turns into a
12
+ * server-side rejection.
13
+ *
14
+ * Lives in its own module because both the size-tiering path and the key
15
+ * validator need it, and neither should have to import a REST client to get it.
16
+ */
17
+ function byteLength(s) {
18
+ if (typeof TextEncoder !== 'undefined') return new TextEncoder().encode(s).length;
19
+
20
+ // Hermes without TextEncoder, and old JSC. `encodeURIComponent` percent-escapes
21
+ // every non-ASCII byte, so counting the escapes counts the UTF-8 bytes.
22
+ let bytes = 0;
23
+ const encoded = encodeURIComponent(s);
24
+ for (let i = 0; i < encoded.length; i += 1) if (encoded[i] === '%') {
25
+ bytes += 1;
26
+ i += 2;
27
+ } else {
28
+ bytes += 1;
29
+ }
30
+ return bytes;
31
+ }
32
+ //# sourceMappingURL=bytes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["byteLength","s","TextEncoder","encode","length","bytes","encoded","encodeURIComponent","i"],"sourceRoot":"../../../src","sources":["internal/bytes.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAUA,CAACC,CAAS,EAAU;EAC5C,IAAI,OAAOC,WAAW,KAAK,WAAW,EAAE,OAAO,IAAIA,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,CAAC,CAAC,CAACG,MAAM;;EAEjF;EACA;EACA,IAAIC,KAAK,GAAG,CAAC;EACb,MAAMC,OAAO,GAAGC,kBAAkB,CAACN,CAAC,CAAC;EACrC,KAAK,IAAIO,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,OAAO,CAACF,MAAM,EAAEI,CAAC,IAAI,CAAC,EACxC,IAAIF,OAAO,CAACE,CAAC,CAAC,KAAK,GAAG,EAAE;IACtBH,KAAK,IAAI,CAAC;IACVG,CAAC,IAAI,CAAC;EACR,CAAC,MACI;IACHH,KAAK,IAAI,CAAC;EACZ;EAEF,OAAOA,KAAK;AACd","ignoreList":[]}