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,139 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.assertKey = assertKey;
7
+ exports.checkKey = checkKey;
8
+ exports.sanitizeKey = sanitizeKey;
9
+ var _errors = require("../errors.js");
10
+ var _bytes = require("./bytes.js");
11
+ /**
12
+ * Key validation.
13
+ *
14
+ * One key string has to be three different things at once - an
15
+ * `NSUbiquitousKeyValueStore` key, a CloudKit `recordName` and a Google Drive
16
+ * file name - and the three disagree about what is legal. Nothing checked, a
17
+ * key that is fine on iOS comes back from CloudKit Web Services as
18
+ * `BAD_REQUEST`, which this package maps to `ERR_CONTAINER_MISCONFIGURED`, and
19
+ * the developer goes looking at their entitlements.
20
+ *
21
+ * So the rules are stated here, checked before the request, and reported with
22
+ * the offending key and the specific rule it broke.
23
+ */
24
+
25
+ /**
26
+ * Apple: "The maximum length for a key string is 64 bytes using UTF8 encoding."
27
+ * Note *bytes*, not characters - a key of emoji is four times longer than it
28
+ * looks.
29
+ */
30
+ const KV_MAX_KEY_BYTES = 64;
31
+
32
+ /** CloudKit's documented ceiling for a record name. */
33
+ const CK_MAX_RECORD_NAME = 255;
34
+
35
+ /**
36
+ * CloudKit accepts ASCII letters, digits, `-`, `_` and `.` in a record name.
37
+ *
38
+ * Checked **only when a CloudKit provider is configured**. It is a CloudKit
39
+ * restriction, not a universal one: `NSUbiquitousKeyValueStore` keys are plain
40
+ * strings with no character rules at all, and Drive file names are nearly as
41
+ * permissive. Applying it everywhere rejected keys that had been working in
42
+ * production for years - `auth/anonymousUserId/v1` in an app that only ever
43
+ * used the key-value store - which is a far worse outcome than the server
44
+ * error this check exists to pre-empt.
45
+ */
46
+ const SAFE_KEY = /^[A-Za-z0-9._-]+$/;
47
+
48
+ /** CloudKit reserves the leading underscore for its own system record names. */
49
+ const RESERVED_PREFIX = '_';
50
+
51
+ /** Providers whose keys become CloudKit record names. */
52
+ const CLOUDKIT_PROVIDERS = ['cloudKit', 'cloudKitEncrypted'];
53
+ function usesCloudKit(providers) {
54
+ return providers.find(p => CLOUDKIT_PROVIDERS.includes(p)) ?? null;
55
+ }
56
+ /**
57
+ * The first rule `key` breaks for this set of providers, or null when it is
58
+ * usable everywhere.
59
+ *
60
+ * Provider-aware on purpose: the 64-byte ceiling is the key-value store's
61
+ * alone, and rejecting a 100-character key for an app that only configured
62
+ * Drive would be a false alarm.
63
+ */
64
+ function checkKey(key, providers) {
65
+ if (typeof key !== 'string' || key.length === 0) return {
66
+ reason: 'a key must be a non-empty string',
67
+ provider: null
68
+ };
69
+
70
+ // Every rule below this line belongs to a specific provider, and is only
71
+ // applied when that provider is actually configured. Rejecting a key for a
72
+ // restriction that cannot apply is not caution, it is a false alarm - and one
73
+ // that breaks working apps rather than pre-empting a server error.
74
+ const cloudKitProvider = usesCloudKit(providers);
75
+ if (cloudKitProvider != null) {
76
+ if (!SAFE_KEY.test(key)) return {
77
+ reason: 'a key may contain only ASCII letters, digits, and the characters . _ - ' + 'once it has to serve as a CloudKit record name',
78
+ provider: cloudKitProvider
79
+ };
80
+ if (key.startsWith(RESERVED_PREFIX)) return {
81
+ reason: 'a key may not start with "_", which CloudKit reserves for system records',
82
+ provider: cloudKitProvider
83
+ };
84
+ if (key.length > CK_MAX_RECORD_NAME) return {
85
+ reason: `a CloudKit record name is limited to ${CK_MAX_RECORD_NAME} characters ` + `(got ${key.length})`,
86
+ provider: cloudKitProvider
87
+ };
88
+ }
89
+ if (providers.includes('icloudKV')) {
90
+ const bytes = (0, _bytes.byteLength)(key);
91
+ if (bytes > KV_MAX_KEY_BYTES) return {
92
+ reason: `an iCloud key-value store key is limited to ${KV_MAX_KEY_BYTES} UTF-8 bytes ` + `(got ${bytes})`,
93
+ provider: 'icloudKV'
94
+ };
95
+ }
96
+ return null;
97
+ }
98
+
99
+ /** Throws {@link ErrorCode.INVALID_KEY} when `key` is unusable. */
100
+ function assertKey(key, providers) {
101
+ const broken = checkKey(key, providers);
102
+ if (broken == null) return;
103
+ throw new _errors.CloudSyncError(_errors.ErrorCode.INVALID_KEY, `[RNCloudSync] Invalid key ${JSON.stringify(key)}: ${broken.reason}.`, {
104
+ provider: broken.provider ?? undefined
105
+ });
106
+ }
107
+
108
+ /**
109
+ * Rewrites an arbitrary string into a key that passes {@link checkKey}.
110
+ *
111
+ * For callers whose keys come from somewhere they do not control - a file name,
112
+ * a user-entered label, an id from another system. Illegal characters become
113
+ * `-`, and anything too long is truncated and suffixed with a short hash of the
114
+ * original so two different long keys cannot collide.
115
+ */
116
+ function sanitizeKey(raw, maxBytes = KV_MAX_KEY_BYTES) {
117
+ const cleaned = raw.replace(/[^A-Za-z0-9._-]/g, '-').replace(/^_+/, '');
118
+ const base = cleaned.length > 0 ? cleaned : 'key';
119
+ if ((0, _bytes.byteLength)(base) <= maxBytes) return base;
120
+
121
+ // Truncating alone would map every long key with a shared prefix onto the
122
+ // same short key, silently merging unrelated values.
123
+ const suffix = `-${hash(raw)}`;
124
+ const room = Math.max(1, maxBytes - suffix.length);
125
+ let head = base.slice(0, room);
126
+ while ((0, _bytes.byteLength)(head) > room) head = head.slice(0, -1);
127
+ return head + suffix;
128
+ }
129
+
130
+ /** FNV-1a, base36. Not cryptographic - only needs to separate collisions. */
131
+ function hash(s) {
132
+ let h = 0x811c9dc5;
133
+ for (let i = 0; i < s.length; i += 1) {
134
+ h ^= s.charCodeAt(i);
135
+ h = Math.imul(h, 0x01000193) >>> 0;
136
+ }
137
+ return h.toString(36);
138
+ }
139
+ //# sourceMappingURL=keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_errors","require","_bytes","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","byteLength","assertKey","broken","CloudSyncError","ErrorCode","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,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAME,gBAAgB,GAAG,EAAE;;AAE3B;AACA,MAAMC,kBAAkB,GAAG,GAAG;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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,CAAC,GAAGH,IAAI,EAAEG,IAAI,GAAGA,IAAI,CAACC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EACxD,OAAOD,IAAI,GAAGL,MAAM;AACtB;;AAEA;AACA,SAASC,IAAIA,CAACM,CAAS,EAAU;EAC/B,IAAIC,CAAC,GAAG,UAAU;EAClB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,CAAC,CAAC7B,MAAM,EAAE+B,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,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isLogsEnabled = isLogsEnabled;
7
+ exports.log = log;
8
+ exports.setLogsEnabled = setLogsEnabled;
9
+ var _nativeModule = require("./nativeModule.js");
10
+ let enabled = false;
11
+
12
+ /**
13
+ * Toggles verbose logging in both JS and the native layer.
14
+ *
15
+ * Off by default: a storage library logging every read on a hot path is noise,
16
+ * and cloud payloads can contain user data that should not land in a device log.
17
+ */
18
+ function setLogsEnabled(value) {
19
+ enabled = value;
20
+ (0, _nativeModule.getNativeModule)()?.setLogsEnabled(value);
21
+ }
22
+ function isLogsEnabled() {
23
+ return enabled;
24
+ }
25
+ function log(...args) {
26
+ if (!enabled) return;
27
+ console.warn('[RNCloudSync]', ...args);
28
+ }
29
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_nativeModule","require","enabled","setLogsEnabled","value","getNativeModule","isLogsEnabled","log","args","console","warn"],"sourceRoot":"../../../src","sources":["internal/logger.ts"],"mappings":";;;;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAEA,IAAIC,OAAO,GAAG,KAAK;;AAEnB;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAACC,KAAc,EAAQ;EACnDF,OAAO,GAAGE,KAAK;EACf,IAAAC,6BAAe,EAAC,CAAC,EAAEF,cAAc,CAACC,KAAK,CAAC;AAC1C;AAEO,SAASE,aAAaA,CAAA,EAAY;EACvC,OAAOJ,OAAO;AAChB;AAEO,SAASK,GAAGA,CAAC,GAAGC,IAAe,EAAQ;EAC5C,IAAI,CAACN,OAAO,EAAE;EACdO,OAAO,CAACC,IAAI,CAAC,eAAe,EAAE,GAAGF,IAAI,CAAC;AACxC","ignoreList":[]}
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.__resetNativeModuleCache = __resetNativeModuleCache;
7
+ exports.getNativeModule = getNativeModule;
8
+ exports.hasNativeModule = hasNativeModule;
9
+ exports.requireNativeModule = requireNativeModule;
10
+ exports.subscribeNativeEvent = subscribeNativeEvent;
11
+ var _reactNative = require("react-native");
12
+ var _errors = require("../errors.js");
13
+ const MODULE_NAME = 'RNCloudSync';
14
+ 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`;
15
+ let cached = null;
16
+ let resolved = false;
17
+
18
+ /**
19
+ * Whether the running app is on the New Architecture.
20
+ *
21
+ * Detected from which registry produced the module rather than from a global
22
+ * flag, because `global.__turboModuleProxy` is not reliable across the RN
23
+ * versions this package supports (0.71 through 0.86+).
24
+ */
25
+ let isNewArch = false;
26
+
27
+ /**
28
+ * Resolves the native module lazily.
29
+ *
30
+ * New arch exposes it through TurboModuleRegistry; old arch through the
31
+ * NativeModules proxy. Resolution is deferred rather than done at import time
32
+ * so that merely importing this package on a platform without the native module
33
+ * (web, or Android for the iCloud provider) does not throw at bundle-evaluation
34
+ * time - which is exactly the crash cryptoc had to work around with a
35
+ * `Platform.OS === 'ios' ? requireNativeModule(...) : null` guard.
36
+ */
37
+ function getNativeModule() {
38
+ if (resolved) return cached;
39
+ resolved = true;
40
+
41
+ // Everything here is wrapped, because "there is no native module" has to be a
42
+ // `null`, never a throw. react-native-web exports no `TurboModuleRegistry` at
43
+ // all, so on a web build served by webpack/Vite/Next - which, unlike Metro,
44
+ // do not resolve the `.web.ts` platform extension - `TurboModuleRegistry` is
45
+ // `undefined` and calling `.get` on it is a TypeError. That surfaced as a
46
+ // crash inside `cloudKit.isAvailable()`, a method documented as safe to call
47
+ // on a render path.
48
+ try {
49
+ // TurboModuleRegistry.get is safe on the old architecture too - it simply
50
+ // returns null there rather than throwing (unlike getEnforcing).
51
+ const turbo = _reactNative.TurboModuleRegistry?.get(MODULE_NAME);
52
+ if (turbo != null) {
53
+ cached = turbo;
54
+ isNewArch = true;
55
+ return cached;
56
+ }
57
+ } catch {
58
+ // Fall through to the legacy registry.
59
+ }
60
+ try {
61
+ const legacy = _reactNative.NativeModules?.[MODULE_NAME];
62
+ if (legacy != null) {
63
+ cached = legacy;
64
+ isNewArch = false;
65
+ return cached;
66
+ }
67
+ } catch {
68
+ // No registry either. Treated as "no native module", same as web.
69
+ }
70
+ cached = null;
71
+ return null;
72
+ }
73
+
74
+ /** Like {@link getNativeModule} but throws a diagnostic instead of returning null. */
75
+ function requireNativeModule() {
76
+ const m = getNativeModule();
77
+ if (m == null) throw new _errors.CloudSyncError(_errors.ErrorCode.UNSUPPORTED_PLATFORM, _reactNative.Platform.OS === 'web' ? '[RNCloudSync] This provider requires a native module and is not available on web.' : LINKING_ERROR);
78
+ return m;
79
+ }
80
+ function hasNativeModule() {
81
+ return getNativeModule() != null;
82
+ }
83
+ let legacyEmitter = null;
84
+ function getLegacyEmitter() {
85
+ if (legacyEmitter == null)
86
+ // The old-architecture module is an RCTEventEmitter, so it is a valid
87
+ // NativeEventEmitter argument. On Android events always travel over
88
+ // RCTDeviceEventEmitter, which NativeEventEmitter also handles.
89
+ legacyEmitter = new _reactNative.NativeEventEmitter(_reactNative.NativeModules[MODULE_NAME]);
90
+ return legacyEmitter;
91
+ }
92
+
93
+ /**
94
+ * Event names differ per architecture.
95
+ *
96
+ * Codegen's EventEmitter properties must be named `onSomething`, while the old
97
+ * architecture's `supportedEvents` list uses the bare name. Rather than leak
98
+ * that split into every call site, subscribe through this helper.
99
+ * (react-native-background-downloader carries the same `onDownloadBegin` vs
100
+ * `downloadBegin` split for the same reason.)
101
+ */
102
+ function subscribeNativeEvent(newArchName, legacyName, listener) {
103
+ const m = getNativeModule();
104
+ if (m == null) return () => undefined;
105
+ if (isNewArch) {
106
+ const emitter = m[newArchName];
107
+ const sub = emitter(listener);
108
+ return () => {
109
+ sub.remove();
110
+ };
111
+ }
112
+ const sub = getLegacyEmitter().addListener(legacyName, listener);
113
+ return () => {
114
+ sub.remove();
115
+ };
116
+ }
117
+
118
+ /** Exposed for tests and diagnostics only. */
119
+ function __resetNativeModuleCache() {
120
+ cached = null;
121
+ resolved = false;
122
+ legacyEmitter = null;
123
+ isNewArch = false;
124
+ }
125
+ //# sourceMappingURL=nativeModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_errors","MODULE_NAME","LINKING_ERROR","cached","resolved","isNewArch","getNativeModule","turbo","TurboModuleRegistry","get","legacy","NativeModules","requireNativeModule","m","CloudSyncError","ErrorCode","UNSUPPORTED_PLATFORM","Platform","OS","hasNativeModule","legacyEmitter","getLegacyEmitter","NativeEventEmitter","subscribeNativeEvent","newArchName","legacyName","listener","undefined","emitter","sub","remove","addListener","__resetNativeModuleCache"],"sourceRoot":"../../../src","sources":["internal/nativeModule.ts"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAD,OAAA;AAGA,MAAME,WAAW,GAAG,aAAa;AA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;AAClC;AAEA,IAAIc,aAAwC,GAAG,IAAI;AAEnD,SAASC,gBAAgBA,CAAA,EAAuB;EAC9C,IAAID,aAAa,IAAI,IAAI;IACvB;IACA;IACA;IACAA,aAAa,GAAG,IAAIE,+BAAkB,CACnCX,0BAAa,CAA2BV,WAAW,CACtD,CAAC;EAEH,OAAOmB,aAAa;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,oBAAoBA,CAClCC,WAAqE,EACrEC,UAA8D,EAC9DC,QAAwB,EACX;EACb,MAAMb,CAAC,GAAGP,eAAe,CAAC,CAAC;EAC3B,IAAIO,CAAC,IAAI,IAAI,EAAE,OAAO,MAAMc,SAAS;EAErC,IAAItB,SAAS,EAAE;IACb,MAAMuB,OAAO,GAAGf,CAAC,CAACW,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,GAAGR,gBAAgB,CAAC,CAAC,CAACU,WAAW,CAACN,UAAU,EAAEC,QAAgC,CAAC;EACxF,OAAO,MAAM;IACXG,GAAG,CAACC,MAAM,CAAC,CAAC;EACd,CAAC;AACH;;AAEA;AACO,SAASE,wBAAwBA,CAAA,EAAS;EAC/C7B,MAAM,GAAG,IAAI;EACbC,QAAQ,GAAG,KAAK;EAChBgB,aAAa,GAAG,IAAI;EACpBf,SAAS,GAAG,KAAK;AACnB","ignoreList":[]}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.throwIfAborted = throwIfAborted;
7
+ exports.withAbort = withAbort;
8
+ exports.withTimeout = withTimeout;
9
+ var _errors = require("../errors.js");
10
+ /**
11
+ * Rejects with {@link ErrorCode.TIMEOUT} if `promise` has not settled in time.
12
+ *
13
+ * React Native's `fetch` has no default timeout, and neither does CloudKit's
14
+ * native stack, so an unanswered socket hangs an operation forever. That is
15
+ * worse than an error: the store calls `isAvailable()` before every operation,
16
+ * so one hung probe stalls reads and writes that would otherwise have fallen
17
+ * through to a working provider.
18
+ *
19
+ * The underlying work is *not* cancelled - a promise cannot be. This only stops
20
+ * the caller waiting on it, which is why the timeout error is classified as
21
+ * retryable rather than as a failure.
22
+ */
23
+ function withTimeout(promise, ms, provider) {
24
+ if (!Number.isFinite(ms) || ms <= 0) return promise;
25
+ return new Promise((resolve, reject) => {
26
+ const timer = setTimeout(() => reject((0, _errors.timedOut)(ms, provider)), ms);
27
+ promise.then(value => {
28
+ clearTimeout(timer);
29
+ resolve(value);
30
+ }, error => {
31
+ clearTimeout(timer);
32
+ reject(error);
33
+ });
34
+ });
35
+ }
36
+
37
+ /**
38
+ * The subset of `AbortSignal` this package needs.
39
+ *
40
+ * Typed structurally rather than as the DOM `AbortSignal` so a caller can pass
41
+ * one from any polyfill, and so the package does not require `lib.dom` to be in
42
+ * a consumer's `tsconfig`.
43
+ */
44
+
45
+ /** Throws {@link ErrorCode.CANCELLED} if the signal is already aborted. */
46
+ function throwIfAborted(signal, provider) {
47
+ if (signal?.aborted === true) throw (0, _errors.cancelled)(provider);
48
+ }
49
+
50
+ /**
51
+ * Races `promise` against an abort signal.
52
+ *
53
+ * Used by the chunked transfer paths, where "cancel" has to take effect between
54
+ * chunks rather than only once the whole multi-hundred-megabyte file has moved.
55
+ */
56
+ function withAbort(promise, signal, provider) {
57
+ if (signal == null) return promise;
58
+ if (signal.aborted) return Promise.reject((0, _errors.cancelled)(provider));
59
+ return new Promise((resolve, reject) => {
60
+ const onAbort = () => reject((0, _errors.cancelled)(provider));
61
+ signal.addEventListener('abort', onAbort);
62
+ const done = () => signal.removeEventListener('abort', onAbort);
63
+ promise.then(value => {
64
+ done();
65
+ resolve(value);
66
+ }, error => {
67
+ done();
68
+ reject(error);
69
+ });
70
+ });
71
+ }
72
+ //# sourceMappingURL=timeout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_errors","require","withTimeout","promise","ms","provider","Number","isFinite","Promise","resolve","reject","timer","setTimeout","timedOut","then","value","clearTimeout","error","throwIfAborted","signal","aborted","cancelled","withAbort","onAbort","addEventListener","done","removeEventListener"],"sourceRoot":"../../../src","sources":["internal/timeout.ts"],"mappings":";;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,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,KAAK;IACzC,MAAMC,KAAK,GAAGC,UAAU,CAAC,MAAMF,MAAM,CAAC,IAAAG,gBAAQ,EAACT,EAAE,EAAEC,QAAQ,CAAC,CAAC,EAAED,EAAE,CAAC;IAElED,OAAO,CAACW,IAAI,CACTC,KAAK,IAAK;MACTC,YAAY,CAACL,KAAK,CAAC;MACnBF,OAAO,CAACM,KAAK,CAAC;IAChB,CAAC,EACAE,KAAY,IAAK;MAChBD,YAAY,CAACL,KAAK,CAAC;MACnBD,MAAM,CAACO,KAAK,CAAC;IACf,CACF,CAAC;EACH,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACO,SAASC,cAAcA,CAACC,MAA6B,EAAEd,QAAiB,EAAQ;EACrF,IAAIc,MAAM,EAAEC,OAAO,KAAK,IAAI,EAAE,MAAM,IAAAC,iBAAS,EAAChB,QAAQ,CAAC;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASiB,SAASA,CACvBnB,OAAmB,EACnBgB,MAA6B,EAC7Bd,QAAiB,EACL;EACZ,IAAIc,MAAM,IAAI,IA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