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,134 @@
1
+ "use strict";
2
+
3
+ import { CloudSyncError, ErrorCode } from "../errors.js";
4
+ import { byteLength } from "./bytes.js";
5
+
6
+ /**
7
+ * Key validation.
8
+ *
9
+ * One key string has to be three different things at once - an
10
+ * `NSUbiquitousKeyValueStore` key, a CloudKit `recordName` and a Google Drive
11
+ * file name - and the three disagree about what is legal. Nothing checked, a
12
+ * key that is fine on iOS comes back from CloudKit Web Services as
13
+ * `BAD_REQUEST`, which this package maps to `ERR_CONTAINER_MISCONFIGURED`, and
14
+ * the developer goes looking at their entitlements.
15
+ *
16
+ * So the rules are stated here, checked before the request, and reported with
17
+ * the offending key and the specific rule it broke.
18
+ */
19
+
20
+ /**
21
+ * Apple: "The maximum length for a key string is 64 bytes using UTF8 encoding."
22
+ * Note *bytes*, not characters - a key of emoji is four times longer than it
23
+ * looks.
24
+ */
25
+ const KV_MAX_KEY_BYTES = 64;
26
+
27
+ /** CloudKit's documented ceiling for a record name. */
28
+ const CK_MAX_RECORD_NAME = 255;
29
+
30
+ /**
31
+ * CloudKit accepts ASCII letters, digits, `-`, `_` and `.` in a record name.
32
+ *
33
+ * Checked **only when a CloudKit provider is configured**. It is a CloudKit
34
+ * restriction, not a universal one: `NSUbiquitousKeyValueStore` keys are plain
35
+ * strings with no character rules at all, and Drive file names are nearly as
36
+ * permissive. Applying it everywhere rejected keys that had been working in
37
+ * production for years - `auth/anonymousUserId/v1` in an app that only ever
38
+ * used the key-value store - which is a far worse outcome than the server
39
+ * error this check exists to pre-empt.
40
+ */
41
+ const SAFE_KEY = /^[A-Za-z0-9._-]+$/;
42
+
43
+ /** CloudKit reserves the leading underscore for its own system record names. */
44
+ const RESERVED_PREFIX = '_';
45
+
46
+ /** Providers whose keys become CloudKit record names. */
47
+ const CLOUDKIT_PROVIDERS = ['cloudKit', 'cloudKitEncrypted'];
48
+ function usesCloudKit(providers) {
49
+ return providers.find(p => CLOUDKIT_PROVIDERS.includes(p)) ?? null;
50
+ }
51
+ /**
52
+ * The first rule `key` breaks for this set of providers, or null when it is
53
+ * usable everywhere.
54
+ *
55
+ * Provider-aware on purpose: the 64-byte ceiling is the key-value store's
56
+ * alone, and rejecting a 100-character key for an app that only configured
57
+ * Drive would be a false alarm.
58
+ */
59
+ export function checkKey(key, providers) {
60
+ if (typeof key !== 'string' || key.length === 0) return {
61
+ reason: 'a key must be a non-empty string',
62
+ provider: null
63
+ };
64
+
65
+ // Every rule below this line belongs to a specific provider, and is only
66
+ // applied when that provider is actually configured. Rejecting a key for a
67
+ // restriction that cannot apply is not caution, it is a false alarm - and one
68
+ // that breaks working apps rather than pre-empting a server error.
69
+ const cloudKitProvider = usesCloudKit(providers);
70
+ if (cloudKitProvider != null) {
71
+ if (!SAFE_KEY.test(key)) return {
72
+ reason: 'a key may contain only ASCII letters, digits, and the characters . _ - ' + 'once it has to serve as a CloudKit record name',
73
+ provider: cloudKitProvider
74
+ };
75
+ if (key.startsWith(RESERVED_PREFIX)) return {
76
+ reason: 'a key may not start with "_", which CloudKit reserves for system records',
77
+ provider: cloudKitProvider
78
+ };
79
+ if (key.length > CK_MAX_RECORD_NAME) return {
80
+ reason: `a CloudKit record name is limited to ${CK_MAX_RECORD_NAME} characters ` + `(got ${key.length})`,
81
+ provider: cloudKitProvider
82
+ };
83
+ }
84
+ if (providers.includes('icloudKV')) {
85
+ const bytes = byteLength(key);
86
+ if (bytes > KV_MAX_KEY_BYTES) return {
87
+ reason: `an iCloud key-value store key is limited to ${KV_MAX_KEY_BYTES} UTF-8 bytes ` + `(got ${bytes})`,
88
+ provider: 'icloudKV'
89
+ };
90
+ }
91
+ return null;
92
+ }
93
+
94
+ /** Throws {@link ErrorCode.INVALID_KEY} when `key` is unusable. */
95
+ export function assertKey(key, providers) {
96
+ const broken = checkKey(key, providers);
97
+ if (broken == null) return;
98
+ throw new CloudSyncError(ErrorCode.INVALID_KEY, `[RNCloudSync] Invalid key ${JSON.stringify(key)}: ${broken.reason}.`, {
99
+ provider: broken.provider ?? undefined
100
+ });
101
+ }
102
+
103
+ /**
104
+ * Rewrites an arbitrary string into a key that passes {@link checkKey}.
105
+ *
106
+ * For callers whose keys come from somewhere they do not control - a file name,
107
+ * a user-entered label, an id from another system. Illegal characters become
108
+ * `-`, and anything too long is truncated and suffixed with a short hash of the
109
+ * original so two different long keys cannot collide.
110
+ */
111
+ export function sanitizeKey(raw, maxBytes = KV_MAX_KEY_BYTES) {
112
+ const cleaned = raw.replace(/[^A-Za-z0-9._-]/g, '-').replace(/^_+/, '');
113
+ const base = cleaned.length > 0 ? cleaned : 'key';
114
+ if (byteLength(base) <= maxBytes) return base;
115
+
116
+ // Truncating alone would map every long key with a shared prefix onto the
117
+ // same short key, silently merging unrelated values.
118
+ const suffix = `-${hash(raw)}`;
119
+ const room = Math.max(1, maxBytes - suffix.length);
120
+ let head = base.slice(0, room);
121
+ while (byteLength(head) > room) head = head.slice(0, -1);
122
+ return head + suffix;
123
+ }
124
+
125
+ /** FNV-1a, base36. Not cryptographic - only needs to separate collisions. */
126
+ function hash(s) {
127
+ let h = 0x811c9dc5;
128
+ for (let i = 0; i < s.length; i += 1) {
129
+ h ^= s.charCodeAt(i);
130
+ h = Math.imul(h, 0x01000193) >>> 0;
131
+ }
132
+ return h.toString(36);
133
+ }
134
+ //# sourceMappingURL=keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CloudSyncError","ErrorCode","byteLength","KV_MAX_KEY_BYTES","CK_MAX_RECORD_NAME","SAFE_KEY","RESERVED_PREFIX","CLOUDKIT_PROVIDERS","usesCloudKit","providers","find","p","includes","checkKey","key","length","reason","provider","cloudKitProvider","test","startsWith","bytes","assertKey","broken","INVALID_KEY","JSON","stringify","undefined","sanitizeKey","raw","maxBytes","cleaned","replace","base","suffix","hash","room","Math","max","head","slice","s","h","i","charCodeAt","imul","toString"],"sourceRoot":"../../../src","sources":["internal/keys.ts"],"mappings":";;AAAA,SAASA,cAAc,EAAEC,SAAS,QAAQ,cAAW;AAErD,SAASC,UAAU,QAAQ,YAAS;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,EAAE;;AAE3B;AACA,MAAMC,kBAAkB,GAAG,GAAG;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAQ,GAAG,mBAAmB;;AAEpC;AACA,MAAMC,eAAe,GAAG,GAAG;;AAE3B;AACA,MAAMC,kBAA2C,GAAG,CAAC,UAAU,EAAE,mBAAmB,CAAC;A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AACA,SAASC,IAAIA,CAACM,CAAS,EAAU;EAC/B,IAAIC,CAAC,GAAG,UAAU;EAClB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,CAAC,CAAC1B,MAAM,EAAE4B,CAAC,IAAI,CAAC,EAAE;IACpCD,CAAC,IAAID,CAAC,CAACG,UAAU,CAACD,CAAC,CAAC;IACpBD,CAAC,GAAGL,IAAI,CAACQ,IAAI,CAACH,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC;EACpC;EACA,OAAOA,CAAC,CAACI,QAAQ,CAAC,EAAE,CAAC;AACvB","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ import { getNativeModule } from "./nativeModule.js";
4
+ let enabled = false;
5
+
6
+ /**
7
+ * Toggles verbose logging in both JS and the native layer.
8
+ *
9
+ * Off by default: a storage library logging every read on a hot path is noise,
10
+ * and cloud payloads can contain user data that should not land in a device log.
11
+ */
12
+ export function setLogsEnabled(value) {
13
+ enabled = value;
14
+ getNativeModule()?.setLogsEnabled(value);
15
+ }
16
+ export function isLogsEnabled() {
17
+ return enabled;
18
+ }
19
+ export function log(...args) {
20
+ if (!enabled) return;
21
+ console.warn('[RNCloudSync]', ...args);
22
+ }
23
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getNativeModule","enabled","setLogsEnabled","value","isLogsEnabled","log","args","console","warn"],"sourceRoot":"../../../src","sources":["internal/logger.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,mBAAgB;AAEhD,IAAIC,OAAO,GAAG,KAAK;;AAEnB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,KAAc,EAAQ;EACnDF,OAAO,GAAGE,KAAK;EACfH,eAAe,CAAC,CAAC,EAAEE,cAAc,CAACC,KAAK,CAAC;AAC1C;AAEA,OAAO,SAASC,aAAaA,CAAA,EAAY;EACvC,OAAOH,OAAO;AAChB;AAEA,OAAO,SAASI,GAAGA,CAAC,GAAGC,IAAe,EAAQ;EAC5C,IAAI,CAACL,OAAO,EAAE;EACdM,OAAO,CAACC,IAAI,CAAC,eAAe,EAAE,GAAGF,IAAI,CAAC;AACxC","ignoreList":[]}
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+
3
+ import { NativeEventEmitter, NativeModules, Platform, TurboModuleRegistry } from 'react-native';
4
+ import { CloudSyncError, ErrorCode } from "../errors.js";
5
+ const MODULE_NAME = 'RNCloudSync';
6
+ const LINKING_ERROR = `[RNCloudSync] The native module doesn't seem to be linked. Make sure you have:\n\n` + ` - run 'pod install' (iOS) or rebuilt the app (Android) after installing\n` + ` - rebuilt the app after installing, not just restarted Metro\n` + ` - not using Expo Go, which cannot load custom native modules\n`;
7
+ let cached = null;
8
+ let resolved = false;
9
+
10
+ /**
11
+ * Whether the running app is on the New Architecture.
12
+ *
13
+ * Detected from which registry produced the module rather than from a global
14
+ * flag, because `global.__turboModuleProxy` is not reliable across the RN
15
+ * versions this package supports (0.71 through 0.86+).
16
+ */
17
+ let isNewArch = false;
18
+
19
+ /**
20
+ * Resolves the native module lazily.
21
+ *
22
+ * New arch exposes it through TurboModuleRegistry; old arch through the
23
+ * NativeModules proxy. Resolution is deferred rather than done at import time
24
+ * so that merely importing this package on a platform without the native module
25
+ * (web, or Android for the iCloud provider) does not throw at bundle-evaluation
26
+ * time - which is exactly the crash cryptoc had to work around with a
27
+ * `Platform.OS === 'ios' ? requireNativeModule(...) : null` guard.
28
+ */
29
+ export function getNativeModule() {
30
+ if (resolved) return cached;
31
+ resolved = true;
32
+
33
+ // Everything here is wrapped, because "there is no native module" has to be a
34
+ // `null`, never a throw. react-native-web exports no `TurboModuleRegistry` at
35
+ // all, so on a web build served by webpack/Vite/Next - which, unlike Metro,
36
+ // do not resolve the `.web.ts` platform extension - `TurboModuleRegistry` is
37
+ // `undefined` and calling `.get` on it is a TypeError. That surfaced as a
38
+ // crash inside `cloudKit.isAvailable()`, a method documented as safe to call
39
+ // on a render path.
40
+ try {
41
+ // TurboModuleRegistry.get is safe on the old architecture too - it simply
42
+ // returns null there rather than throwing (unlike getEnforcing).
43
+ const turbo = TurboModuleRegistry?.get(MODULE_NAME);
44
+ if (turbo != null) {
45
+ cached = turbo;
46
+ isNewArch = true;
47
+ return cached;
48
+ }
49
+ } catch {
50
+ // Fall through to the legacy registry.
51
+ }
52
+ try {
53
+ const legacy = NativeModules?.[MODULE_NAME];
54
+ if (legacy != null) {
55
+ cached = legacy;
56
+ isNewArch = false;
57
+ return cached;
58
+ }
59
+ } catch {
60
+ // No registry either. Treated as "no native module", same as web.
61
+ }
62
+ cached = null;
63
+ return null;
64
+ }
65
+
66
+ /** Like {@link getNativeModule} but throws a diagnostic instead of returning null. */
67
+ export function requireNativeModule() {
68
+ const m = getNativeModule();
69
+ if (m == null) throw new CloudSyncError(ErrorCode.UNSUPPORTED_PLATFORM, Platform.OS === 'web' ? '[RNCloudSync] This provider requires a native module and is not available on web.' : LINKING_ERROR);
70
+ return m;
71
+ }
72
+ export function hasNativeModule() {
73
+ return getNativeModule() != null;
74
+ }
75
+ let legacyEmitter = null;
76
+ function getLegacyEmitter() {
77
+ if (legacyEmitter == null)
78
+ // The old-architecture module is an RCTEventEmitter, so it is a valid
79
+ // NativeEventEmitter argument. On Android events always travel over
80
+ // RCTDeviceEventEmitter, which NativeEventEmitter also handles.
81
+ legacyEmitter = new NativeEventEmitter(NativeModules[MODULE_NAME]);
82
+ return legacyEmitter;
83
+ }
84
+
85
+ /**
86
+ * Event names differ per architecture.
87
+ *
88
+ * Codegen's EventEmitter properties must be named `onSomething`, while the old
89
+ * architecture's `supportedEvents` list uses the bare name. Rather than leak
90
+ * that split into every call site, subscribe through this helper.
91
+ * (react-native-background-downloader carries the same `onDownloadBegin` vs
92
+ * `downloadBegin` split for the same reason.)
93
+ */
94
+ export function subscribeNativeEvent(newArchName, legacyName, listener) {
95
+ const m = getNativeModule();
96
+ if (m == null) return () => undefined;
97
+ if (isNewArch) {
98
+ const emitter = m[newArchName];
99
+ const sub = emitter(listener);
100
+ return () => {
101
+ sub.remove();
102
+ };
103
+ }
104
+ const sub = getLegacyEmitter().addListener(legacyName, listener);
105
+ return () => {
106
+ sub.remove();
107
+ };
108
+ }
109
+
110
+ /** Exposed for tests and diagnostics only. */
111
+ export function __resetNativeModuleCache() {
112
+ cached = null;
113
+ resolved = false;
114
+ legacyEmitter = null;
115
+ isNewArch = false;
116
+ }
117
+ //# sourceMappingURL=nativeModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeEventEmitter","NativeModules","Platform","TurboModuleRegistry","CloudSyncError","ErrorCode","MODULE_NAME","LINKING_ERROR","cached","resolved","isNewArch","getNativeModule","turbo","get","legacy","requireNativeModule","m","UNSUPPORTED_PLATFORM","OS","hasNativeModule","legacyEmitter","getLegacyEmitter","subscribeNativeEvent","newArchName","legacyName","listener","undefined","emitter","sub","remove","addListener","__resetNativeModuleCache"],"sourceRoot":"../../../src","sources":["internal/nativeModule.ts"],"mappings":";;AAAA,SAASA,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,mBAAmB,QAAQ,cAAc;AAG/F,SAASC,cAAc,EAAEC,SAAS,QAAQ,cAAW;AAGrD,MAAMC,WAAW,GAAG,aAAa;AAEjC,MAAMC,aAAa,GACf,oFAAoF,GAClF,6EAA6E,GAC7E,kEAAkE,GAClE,kEAAkE;AAExE,IAAIC,MAAmB,GAAG,IAAI;AAC9B,IAAIC,QAAQ,GAAG,KAAK;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,SAAS,GAAG,KAAK;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAA,EAAgB;EAC7C,IAAIF,QAAQ,EAAE,OAAOD,MAAM;EAC3BC,QAAQ,GAAG,IAAI;;EAEf;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAI;IACF;IACA;IACA,MAAMG,KAAK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AAE,OAAO,MAAMU,SAAS;EAErC,IAAIhB,SAAS,EAAE;IACb,MAAMiB,OAAO,GAAGX,CAAC,CAACO,WAAW,CAE5B;IACD,MAAMK,GAAG,GAAGD,OAAO,CAACF,QAAQ,CAAC;IAC7B,OAAO,MAAM;MACXG,GAAG,CAACC,MAAM,CAAC,CAAC;IACd,CAAC;EACH;EAEA,MAAMD,GAAG,GAAGP,gBAAgB,CAAC,CAAC,CAACS,WAAW,CAACN,UAAU,EAAEC,QAAgC,CAAC;EACxF,OAAO,MAAM;IACXG,GAAG,CAACC,MAAM,CAAC,CAAC;EACd,CAAC;AACH;;AAEA;AACA,OAAO,SAASE,wBAAwBA,CAAA,EAAS;EAC/CvB,MAAM,GAAG,IAAI;EACbC,QAAQ,GAAG,KAAK;EAChBW,aAAa,GAAG,IAAI;EACpBV,SAAS,GAAG,KAAK;AACnB","ignoreList":[]}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ import { cancelled, timedOut } from "../errors.js";
4
+
5
+ /**
6
+ * Rejects with {@link ErrorCode.TIMEOUT} if `promise` has not settled in time.
7
+ *
8
+ * React Native's `fetch` has no default timeout, and neither does CloudKit's
9
+ * native stack, so an unanswered socket hangs an operation forever. That is
10
+ * worse than an error: the store calls `isAvailable()` before every operation,
11
+ * so one hung probe stalls reads and writes that would otherwise have fallen
12
+ * through to a working provider.
13
+ *
14
+ * The underlying work is *not* cancelled - a promise cannot be. This only stops
15
+ * the caller waiting on it, which is why the timeout error is classified as
16
+ * retryable rather than as a failure.
17
+ */
18
+ export function withTimeout(promise, ms, provider) {
19
+ if (!Number.isFinite(ms) || ms <= 0) return promise;
20
+ return new Promise((resolve, reject) => {
21
+ const timer = setTimeout(() => reject(timedOut(ms, provider)), ms);
22
+ promise.then(value => {
23
+ clearTimeout(timer);
24
+ resolve(value);
25
+ }, error => {
26
+ clearTimeout(timer);
27
+ reject(error);
28
+ });
29
+ });
30
+ }
31
+
32
+ /**
33
+ * The subset of `AbortSignal` this package needs.
34
+ *
35
+ * Typed structurally rather than as the DOM `AbortSignal` so a caller can pass
36
+ * one from any polyfill, and so the package does not require `lib.dom` to be in
37
+ * a consumer's `tsconfig`.
38
+ */
39
+
40
+ /** Throws {@link ErrorCode.CANCELLED} if the signal is already aborted. */
41
+ export function throwIfAborted(signal, provider) {
42
+ if (signal?.aborted === true) throw cancelled(provider);
43
+ }
44
+
45
+ /**
46
+ * Races `promise` against an abort signal.
47
+ *
48
+ * Used by the chunked transfer paths, where "cancel" has to take effect between
49
+ * chunks rather than only once the whole multi-hundred-megabyte file has moved.
50
+ */
51
+ export function withAbort(promise, signal, provider) {
52
+ if (signal == null) return promise;
53
+ if (signal.aborted) return Promise.reject(cancelled(provider));
54
+ return new Promise((resolve, reject) => {
55
+ const onAbort = () => reject(cancelled(provider));
56
+ signal.addEventListener('abort', onAbort);
57
+ const done = () => signal.removeEventListener('abort', onAbort);
58
+ promise.then(value => {
59
+ done();
60
+ resolve(value);
61
+ }, error => {
62
+ done();
63
+ reject(error);
64
+ });
65
+ });
66
+ }
67
+ //# sourceMappingURL=timeout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["cancelled","timedOut","withTimeout","promise","ms","provider","Number","isFinite","Promise","resolve","reject","timer","setTimeout","then","value","clearTimeout","error","throwIfAborted","signal","aborted","withAbort","onAbort","addEventListener","done","removeEventListener"],"sourceRoot":"../../../src","sources":["internal/timeout.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,cAAW;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAIC,OAAmB,EAAEC,EAAU,EAAEC,QAAiB,EAAc;EAC7F,IAAI,CAACC,MAAM,CAACC,QAAQ,CAACH,EAAE,CAAC,IAAIA,EAAE,IAAI,CAAC,EAAE,OAAOD,OAAO;EAEnD,OAAO,IAAIK,OAAO,CAAI,CAACC,OAAO,EAAEC,MAAM,KAA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