@chipmobilesdk/rn-local-db 0.4.0 → 0.5.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 (680) hide show
  1. package/CHANGELOG.md +137 -0
  2. package/README.md +69 -8
  3. package/lib/commonjs/adapter/budgets.js +79 -0
  4. package/lib/commonjs/adapter/budgets.js.map +1 -0
  5. package/lib/commonjs/adapter/collection.js +236 -0
  6. package/lib/commonjs/adapter/collection.js.map +1 -0
  7. package/lib/commonjs/adapter/deletion.js +291 -0
  8. package/lib/commonjs/adapter/deletion.js.map +1 -0
  9. package/lib/commonjs/adapter/handle.js +259 -0
  10. package/lib/commonjs/adapter/handle.js.map +1 -0
  11. package/lib/commonjs/adapter/index.js +67 -0
  12. package/lib/commonjs/adapter/index.js.map +1 -0
  13. package/lib/commonjs/adapter/lifecycle.js +176 -0
  14. package/lib/commonjs/adapter/lifecycle.js.map +1 -0
  15. package/lib/commonjs/adapter/schema-sync.js +124 -0
  16. package/lib/commonjs/adapter/schema-sync.js.map +1 -0
  17. package/lib/commonjs/adapter/transaction.js +58 -0
  18. package/lib/commonjs/adapter/transaction.js.map +1 -0
  19. package/lib/commonjs/artifacts/availability.js +90 -0
  20. package/lib/commonjs/artifacts/availability.js.map +1 -0
  21. package/lib/commonjs/artifacts/cascade.js +80 -0
  22. package/lib/commonjs/artifacts/cascade.js.map +1 -0
  23. package/lib/commonjs/artifacts/paths.js +31 -0
  24. package/lib/commonjs/artifacts/paths.js.map +1 -0
  25. package/lib/commonjs/artifacts/reconcile.js +55 -0
  26. package/lib/commonjs/artifacts/reconcile.js.map +1 -0
  27. package/lib/commonjs/artifacts/store.js +300 -0
  28. package/lib/commonjs/artifacts/store.js.map +1 -0
  29. package/lib/commonjs/contract/adapter.js +6 -0
  30. package/lib/commonjs/contract/adapter.js.map +1 -0
  31. package/lib/commonjs/contract/attachment.js +2 -0
  32. package/lib/commonjs/contract/attachment.js.map +1 -0
  33. package/lib/commonjs/contract/backup.js +2 -0
  34. package/lib/commonjs/contract/backup.js.map +1 -0
  35. package/lib/commonjs/contract/config.js +31 -0
  36. package/lib/commonjs/contract/config.js.map +1 -0
  37. package/lib/commonjs/contract/encryption.js +6 -0
  38. package/lib/commonjs/contract/encryption.js.map +1 -0
  39. package/lib/commonjs/contract/errors.js +64 -0
  40. package/lib/commonjs/contract/errors.js.map +1 -0
  41. package/lib/commonjs/contract/migration.js +6 -0
  42. package/lib/commonjs/contract/migration.js.map +1 -0
  43. package/lib/commonjs/contract/query.js +6 -0
  44. package/lib/commonjs/contract/query.js.map +1 -0
  45. package/lib/commonjs/contract/record.js +6 -0
  46. package/lib/commonjs/contract/record.js.map +1 -0
  47. package/lib/commonjs/contract/schema.js +2 -0
  48. package/lib/commonjs/contract/schema.js.map +1 -0
  49. package/lib/commonjs/contract/scope.js +2 -0
  50. package/lib/commonjs/contract/scope.js.map +1 -0
  51. package/lib/commonjs/contract/transaction.js +6 -0
  52. package/lib/commonjs/contract/transaction.js.map +1 -0
  53. package/lib/commonjs/crypto/chunked-cipher.js +147 -0
  54. package/lib/commonjs/crypto/chunked-cipher.js.map +1 -0
  55. package/lib/commonjs/crypto/derive.js +61 -0
  56. package/lib/commonjs/crypto/derive.js.map +1 -0
  57. package/lib/commonjs/crypto/key-provider.js +70 -0
  58. package/lib/commonjs/crypto/key-provider.js.map +1 -0
  59. package/lib/commonjs/crypto/provider.js +54 -0
  60. package/lib/commonjs/crypto/provider.js.map +1 -0
  61. package/lib/commonjs/diagnostics/dev-log.js +127 -0
  62. package/lib/commonjs/diagnostics/dev-log.js.map +1 -0
  63. package/lib/commonjs/diagnostics/errors.js +57 -0
  64. package/lib/commonjs/diagnostics/errors.js.map +1 -0
  65. package/lib/commonjs/diagnostics/faults.js +54 -0
  66. package/lib/commonjs/diagnostics/faults.js.map +1 -0
  67. package/lib/commonjs/diagnostics/map-native.js +98 -0
  68. package/lib/commonjs/diagnostics/map-native.js.map +1 -0
  69. package/lib/commonjs/diagnostics/redact.js +110 -0
  70. package/lib/commonjs/diagnostics/redact.js.map +1 -0
  71. package/lib/commonjs/index.js +70 -0
  72. package/lib/commonjs/index.js.map +1 -0
  73. package/lib/commonjs/migration/executor.js +136 -0
  74. package/lib/commonjs/migration/executor.js.map +1 -0
  75. package/lib/commonjs/migration/ledger.js +64 -0
  76. package/lib/commonjs/migration/ledger.js.map +1 -0
  77. package/lib/commonjs/migration/validate-chain.js +76 -0
  78. package/lib/commonjs/migration/validate-chain.js.map +1 -0
  79. package/lib/commonjs/package.json +1 -0
  80. package/lib/commonjs/platform/backup-android-verify.js +76 -0
  81. package/lib/commonjs/platform/backup-android-verify.js.map +1 -0
  82. package/lib/commonjs/platform/backup-ios.js +50 -0
  83. package/lib/commonjs/platform/backup-ios.js.map +1 -0
  84. package/lib/commonjs/platform/bytes.js +158 -0
  85. package/lib/commonjs/platform/bytes.js.map +1 -0
  86. package/lib/commonjs/platform/fs.js +59 -0
  87. package/lib/commonjs/platform/fs.js.map +1 -0
  88. package/lib/commonjs/platform/location.js +129 -0
  89. package/lib/commonjs/platform/location.js.map +1 -0
  90. package/lib/commonjs/query/budgets.js +95 -0
  91. package/lib/commonjs/query/budgets.js.map +1 -0
  92. package/lib/commonjs/query/compare.js +97 -0
  93. package/lib/commonjs/query/compare.js.map +1 -0
  94. package/lib/commonjs/query/cursor.js +97 -0
  95. package/lib/commonjs/query/cursor.js.map +1 -0
  96. package/lib/commonjs/query/filter.js +82 -0
  97. package/lib/commonjs/query/filter.js.map +1 -0
  98. package/lib/commonjs/query/paginate.js +48 -0
  99. package/lib/commonjs/query/paginate.js.map +1 -0
  100. package/lib/commonjs/query/sort.js +61 -0
  101. package/lib/commonjs/query/sort.js.map +1 -0
  102. package/lib/commonjs/query/validate.js +180 -0
  103. package/lib/commonjs/query/validate.js.map +1 -0
  104. package/lib/commonjs/schema/declare.js +47 -0
  105. package/lib/commonjs/schema/declare.js.map +1 -0
  106. package/lib/commonjs/schema/validate-config.js +115 -0
  107. package/lib/commonjs/schema/validate-config.js.map +1 -0
  108. package/lib/commonjs/scope/hash.js +107 -0
  109. package/lib/commonjs/scope/hash.js.map +1 -0
  110. package/lib/commonjs/scope/normalize.js +73 -0
  111. package/lib/commonjs/scope/normalize.js.map +1 -0
  112. package/lib/commonjs/scope/validate.js +81 -0
  113. package/lib/commonjs/scope/validate.js.map +1 -0
  114. package/lib/commonjs/sqlite/adapter.js +31 -0
  115. package/lib/commonjs/sqlite/adapter.js.map +1 -0
  116. package/lib/commonjs/sqlite/batch.js +218 -0
  117. package/lib/commonjs/sqlite/batch.js.map +1 -0
  118. package/lib/commonjs/sqlite/catalog.js +81 -0
  119. package/lib/commonjs/sqlite/catalog.js.map +1 -0
  120. package/lib/commonjs/sqlite/connection.js +210 -0
  121. package/lib/commonjs/sqlite/connection.js.map +1 -0
  122. package/lib/commonjs/sqlite/index-coverage.js +42 -0
  123. package/lib/commonjs/sqlite/index-coverage.js.map +1 -0
  124. package/lib/commonjs/sqlite/native.js +54 -0
  125. package/lib/commonjs/sqlite/native.js.map +1 -0
  126. package/lib/commonjs/sqlite/row-codec.js +192 -0
  127. package/lib/commonjs/sqlite/row-codec.js.map +1 -0
  128. package/lib/commonjs/sqlite/sql-builder.js +253 -0
  129. package/lib/commonjs/sqlite/sql-builder.js.map +1 -0
  130. package/lib/commonjs/sqlite/statements.js +54 -0
  131. package/lib/commonjs/sqlite/statements.js.map +1 -0
  132. package/lib/commonjs/sqlite/transaction-queue.js +79 -0
  133. package/lib/commonjs/sqlite/transaction-queue.js.map +1 -0
  134. package/lib/commonjs/sqlite/transactions.js +33 -0
  135. package/lib/commonjs/sqlite/transactions.js.map +1 -0
  136. package/lib/commonjs/sqlite/values.js +31 -0
  137. package/lib/commonjs/sqlite/values.js.map +1 -0
  138. package/lib/commonjs/testing/conformance/attachments.js +180 -0
  139. package/lib/commonjs/testing/conformance/attachments.js.map +1 -0
  140. package/lib/commonjs/testing/conformance/encryption.js +187 -0
  141. package/lib/commonjs/testing/conformance/encryption.js.map +1 -0
  142. package/lib/commonjs/testing/conformance/index.js +103 -0
  143. package/lib/commonjs/testing/conformance/index.js.map +1 -0
  144. package/lib/commonjs/testing/conformance/lifecycle.js +134 -0
  145. package/lib/commonjs/testing/conformance/lifecycle.js.map +1 -0
  146. package/lib/commonjs/testing/conformance/migrations.js +167 -0
  147. package/lib/commonjs/testing/conformance/migrations.js.map +1 -0
  148. package/lib/commonjs/testing/conformance/queries.js +278 -0
  149. package/lib/commonjs/testing/conformance/queries.js.map +1 -0
  150. package/lib/commonjs/testing/conformance/records.js +224 -0
  151. package/lib/commonjs/testing/conformance/records.js.map +1 -0
  152. package/lib/commonjs/testing/conformance/scopes.js +107 -0
  153. package/lib/commonjs/testing/conformance/scopes.js.map +1 -0
  154. package/lib/commonjs/testing/conformance/transactions.js +228 -0
  155. package/lib/commonjs/testing/conformance/transactions.js.map +1 -0
  156. package/lib/commonjs/testing/faults.js +38 -0
  157. package/lib/commonjs/testing/faults.js.map +1 -0
  158. package/lib/commonjs/testing/index.js +59 -0
  159. package/lib/commonjs/testing/index.js.map +1 -0
  160. package/lib/commonjs/testing/memory-adapter/attachments.js +145 -0
  161. package/lib/commonjs/testing/memory-adapter/attachments.js.map +1 -0
  162. package/lib/commonjs/testing/memory-adapter/collection.js +224 -0
  163. package/lib/commonjs/testing/memory-adapter/collection.js.map +1 -0
  164. package/lib/commonjs/testing/memory-adapter/index.js +366 -0
  165. package/lib/commonjs/testing/memory-adapter/index.js.map +1 -0
  166. package/lib/commonjs/testing/memory-adapter/migrations.js +126 -0
  167. package/lib/commonjs/testing/memory-adapter/migrations.js.map +1 -0
  168. package/lib/commonjs/testing/memory-adapter/reset.js +49 -0
  169. package/lib/commonjs/testing/memory-adapter/reset.js.map +1 -0
  170. package/lib/commonjs/testing/memory-adapter/store.js +107 -0
  171. package/lib/commonjs/testing/memory-adapter/store.js.map +1 -0
  172. package/lib/module/adapter/budgets.js +51 -0
  173. package/lib/module/adapter/budgets.js.map +1 -0
  174. package/lib/module/adapter/collection.js +232 -0
  175. package/lib/module/adapter/collection.js.map +1 -0
  176. package/lib/module/adapter/deletion.js +280 -0
  177. package/lib/module/adapter/deletion.js.map +1 -0
  178. package/lib/module/adapter/handle.js +254 -0
  179. package/lib/module/adapter/handle.js.map +1 -0
  180. package/lib/module/adapter/index.js +59 -0
  181. package/lib/module/adapter/index.js.map +1 -0
  182. package/lib/module/adapter/lifecycle.js +172 -0
  183. package/lib/module/adapter/lifecycle.js.map +1 -0
  184. package/lib/module/adapter/schema-sync.js +121 -0
  185. package/lib/module/adapter/schema-sync.js.map +1 -0
  186. package/lib/module/adapter/transaction.js +54 -0
  187. package/lib/module/adapter/transaction.js.map +1 -0
  188. package/lib/module/artifacts/availability.js +86 -0
  189. package/lib/module/artifacts/availability.js.map +1 -0
  190. package/lib/module/artifacts/cascade.js +75 -0
  191. package/lib/module/artifacts/cascade.js.map +1 -0
  192. package/lib/module/artifacts/paths.js +26 -0
  193. package/lib/module/artifacts/paths.js.map +1 -0
  194. package/lib/module/artifacts/reconcile.js +51 -0
  195. package/lib/module/artifacts/reconcile.js.map +1 -0
  196. package/lib/module/artifacts/store.js +289 -0
  197. package/lib/module/artifacts/store.js.map +1 -0
  198. package/lib/module/contract/adapter.js +4 -0
  199. package/lib/module/contract/adapter.js.map +1 -0
  200. package/lib/module/contract/attachment.js +2 -0
  201. package/lib/module/contract/attachment.js.map +1 -0
  202. package/lib/module/contract/backup.js +2 -0
  203. package/lib/module/contract/backup.js.map +1 -0
  204. package/lib/module/contract/config.js +27 -0
  205. package/lib/module/contract/config.js.map +1 -0
  206. package/lib/module/contract/encryption.js +4 -0
  207. package/lib/module/contract/encryption.js.map +1 -0
  208. package/lib/module/contract/errors.js +60 -0
  209. package/lib/module/contract/errors.js.map +1 -0
  210. package/lib/module/contract/migration.js +4 -0
  211. package/lib/module/contract/migration.js.map +1 -0
  212. package/lib/module/contract/query.js +4 -0
  213. package/lib/module/contract/query.js.map +1 -0
  214. package/lib/module/contract/record.js +4 -0
  215. package/lib/module/contract/record.js.map +1 -0
  216. package/lib/module/contract/schema.js +2 -0
  217. package/lib/module/contract/schema.js.map +1 -0
  218. package/lib/module/contract/scope.js +2 -0
  219. package/lib/module/contract/scope.js.map +1 -0
  220. package/lib/module/contract/transaction.js +4 -0
  221. package/lib/module/contract/transaction.js.map +1 -0
  222. package/lib/module/crypto/chunked-cipher.js +134 -0
  223. package/lib/module/crypto/chunked-cipher.js.map +1 -0
  224. package/lib/module/crypto/derive.js +56 -0
  225. package/lib/module/crypto/derive.js.map +1 -0
  226. package/lib/module/crypto/key-provider.js +67 -0
  227. package/lib/module/crypto/key-provider.js.map +1 -0
  228. package/lib/module/crypto/provider.js +49 -0
  229. package/lib/module/crypto/provider.js.map +1 -0
  230. package/lib/module/diagnostics/dev-log.js +120 -0
  231. package/lib/module/diagnostics/dev-log.js.map +1 -0
  232. package/lib/module/diagnostics/errors.js +44 -0
  233. package/lib/module/diagnostics/errors.js.map +1 -0
  234. package/lib/module/diagnostics/faults.js +47 -0
  235. package/lib/module/diagnostics/faults.js.map +1 -0
  236. package/lib/module/diagnostics/map-native.js +93 -0
  237. package/lib/module/diagnostics/map-native.js.map +1 -0
  238. package/lib/module/diagnostics/redact.js +102 -0
  239. package/lib/module/diagnostics/redact.js.map +1 -0
  240. package/lib/module/index.js +28 -0
  241. package/lib/module/index.js.map +1 -0
  242. package/lib/module/migration/executor.js +132 -0
  243. package/lib/module/migration/executor.js.map +1 -0
  244. package/lib/module/migration/ledger.js +57 -0
  245. package/lib/module/migration/ledger.js.map +1 -0
  246. package/lib/module/migration/validate-chain.js +70 -0
  247. package/lib/module/migration/validate-chain.js.map +1 -0
  248. package/lib/module/package.json +1 -0
  249. package/lib/module/platform/backup-android-verify.js +69 -0
  250. package/lib/module/platform/backup-android-verify.js.map +1 -0
  251. package/lib/module/platform/backup-ios.js +44 -0
  252. package/lib/module/platform/backup-ios.js.map +1 -0
  253. package/lib/module/platform/bytes.js +148 -0
  254. package/lib/module/platform/bytes.js.map +1 -0
  255. package/lib/module/platform/fs.js +54 -0
  256. package/lib/module/platform/fs.js.map +1 -0
  257. package/lib/module/platform/location.js +120 -0
  258. package/lib/module/platform/location.js.map +1 -0
  259. package/lib/module/query/budgets.js +88 -0
  260. package/lib/module/query/budgets.js.map +1 -0
  261. package/lib/module/query/compare.js +90 -0
  262. package/lib/module/query/compare.js.map +1 -0
  263. package/lib/module/query/cursor.js +91 -0
  264. package/lib/module/query/cursor.js.map +1 -0
  265. package/lib/module/query/filter.js +78 -0
  266. package/lib/module/query/filter.js.map +1 -0
  267. package/lib/module/query/paginate.js +40 -0
  268. package/lib/module/query/paginate.js.map +1 -0
  269. package/lib/module/query/sort.js +53 -0
  270. package/lib/module/query/sort.js.map +1 -0
  271. package/lib/module/query/validate.js +173 -0
  272. package/lib/module/query/validate.js.map +1 -0
  273. package/lib/module/schema/declare.js +37 -0
  274. package/lib/module/schema/declare.js.map +1 -0
  275. package/lib/module/schema/validate-config.js +111 -0
  276. package/lib/module/schema/validate-config.js.map +1 -0
  277. package/lib/module/scope/hash.js +102 -0
  278. package/lib/module/scope/hash.js.map +1 -0
  279. package/lib/module/scope/normalize.js +67 -0
  280. package/lib/module/scope/normalize.js.map +1 -0
  281. package/lib/module/scope/validate.js +76 -0
  282. package/lib/module/scope/validate.js.map +1 -0
  283. package/lib/module/sqlite/adapter.js +27 -0
  284. package/lib/module/sqlite/adapter.js.map +1 -0
  285. package/lib/module/sqlite/batch.js +214 -0
  286. package/lib/module/sqlite/batch.js.map +1 -0
  287. package/lib/module/sqlite/catalog.js +72 -0
  288. package/lib/module/sqlite/catalog.js.map +1 -0
  289. package/lib/module/sqlite/connection.js +206 -0
  290. package/lib/module/sqlite/connection.js.map +1 -0
  291. package/lib/module/sqlite/index-coverage.js +38 -0
  292. package/lib/module/sqlite/index-coverage.js.map +1 -0
  293. package/lib/module/sqlite/native.js +48 -0
  294. package/lib/module/sqlite/native.js.map +1 -0
  295. package/lib/module/sqlite/row-codec.js +176 -0
  296. package/lib/module/sqlite/row-codec.js.map +1 -0
  297. package/lib/module/sqlite/sql-builder.js +247 -0
  298. package/lib/module/sqlite/sql-builder.js.map +1 -0
  299. package/lib/module/sqlite/statements.js +49 -0
  300. package/lib/module/sqlite/statements.js.map +1 -0
  301. package/lib/module/sqlite/transaction-queue.js +75 -0
  302. package/lib/module/sqlite/transaction-queue.js.map +1 -0
  303. package/lib/module/sqlite/transactions.js +29 -0
  304. package/lib/module/sqlite/transactions.js.map +1 -0
  305. package/lib/module/sqlite/values.js +24 -0
  306. package/lib/module/sqlite/values.js.map +1 -0
  307. package/lib/module/testing/conformance/attachments.js +176 -0
  308. package/lib/module/testing/conformance/attachments.js.map +1 -0
  309. package/lib/module/testing/conformance/encryption.js +183 -0
  310. package/lib/module/testing/conformance/encryption.js.map +1 -0
  311. package/lib/module/testing/conformance/index.js +97 -0
  312. package/lib/module/testing/conformance/index.js.map +1 -0
  313. package/lib/module/testing/conformance/lifecycle.js +130 -0
  314. package/lib/module/testing/conformance/lifecycle.js.map +1 -0
  315. package/lib/module/testing/conformance/migrations.js +163 -0
  316. package/lib/module/testing/conformance/migrations.js.map +1 -0
  317. package/lib/module/testing/conformance/queries.js +274 -0
  318. package/lib/module/testing/conformance/queries.js.map +1 -0
  319. package/lib/module/testing/conformance/records.js +220 -0
  320. package/lib/module/testing/conformance/records.js.map +1 -0
  321. package/lib/module/testing/conformance/scopes.js +103 -0
  322. package/lib/module/testing/conformance/scopes.js.map +1 -0
  323. package/lib/module/testing/conformance/transactions.js +224 -0
  324. package/lib/module/testing/conformance/transactions.js.map +1 -0
  325. package/lib/module/testing/faults.js +16 -0
  326. package/lib/module/testing/faults.js.map +1 -0
  327. package/lib/module/testing/index.js +16 -0
  328. package/lib/module/testing/index.js.map +1 -0
  329. package/lib/module/testing/memory-adapter/attachments.js +142 -0
  330. package/lib/module/testing/memory-adapter/attachments.js.map +1 -0
  331. package/lib/module/testing/memory-adapter/collection.js +220 -0
  332. package/lib/module/testing/memory-adapter/collection.js.map +1 -0
  333. package/lib/module/testing/memory-adapter/index.js +351 -0
  334. package/lib/module/testing/memory-adapter/index.js.map +1 -0
  335. package/lib/module/testing/memory-adapter/migrations.js +122 -0
  336. package/lib/module/testing/memory-adapter/migrations.js.map +1 -0
  337. package/lib/module/testing/memory-adapter/reset.js +44 -0
  338. package/lib/module/testing/memory-adapter/reset.js.map +1 -0
  339. package/lib/module/testing/memory-adapter/store.js +94 -0
  340. package/lib/module/testing/memory-adapter/store.js.map +1 -0
  341. package/lib/typescript/commonjs/adapter/budgets.d.ts +19 -0
  342. package/lib/typescript/commonjs/adapter/budgets.d.ts.map +1 -0
  343. package/lib/typescript/commonjs/adapter/collection.d.ts +25 -0
  344. package/lib/typescript/commonjs/adapter/collection.d.ts.map +1 -0
  345. package/lib/typescript/commonjs/adapter/deletion.d.ts +48 -0
  346. package/lib/typescript/commonjs/adapter/deletion.d.ts.map +1 -0
  347. package/lib/typescript/commonjs/adapter/handle.d.ts +30 -0
  348. package/lib/typescript/commonjs/adapter/handle.d.ts.map +1 -0
  349. package/lib/typescript/commonjs/adapter/index.d.ts +30 -0
  350. package/lib/typescript/commonjs/adapter/index.d.ts.map +1 -0
  351. package/lib/typescript/commonjs/adapter/lifecycle.d.ts +25 -0
  352. package/lib/typescript/commonjs/adapter/lifecycle.d.ts.map +1 -0
  353. package/lib/typescript/commonjs/adapter/schema-sync.d.ts +19 -0
  354. package/lib/typescript/commonjs/adapter/schema-sync.d.ts.map +1 -0
  355. package/lib/typescript/commonjs/adapter/transaction.d.ts +32 -0
  356. package/lib/typescript/commonjs/adapter/transaction.d.ts.map +1 -0
  357. package/lib/typescript/commonjs/artifacts/availability.d.ts +19 -0
  358. package/lib/typescript/commonjs/artifacts/availability.d.ts.map +1 -0
  359. package/lib/typescript/commonjs/artifacts/cascade.d.ts +26 -0
  360. package/lib/typescript/commonjs/artifacts/cascade.d.ts.map +1 -0
  361. package/lib/typescript/commonjs/artifacts/paths.d.ts +16 -0
  362. package/lib/typescript/commonjs/artifacts/paths.d.ts.map +1 -0
  363. package/lib/typescript/commonjs/artifacts/reconcile.d.ts +23 -0
  364. package/lib/typescript/commonjs/artifacts/reconcile.d.ts.map +1 -0
  365. package/lib/typescript/commonjs/artifacts/store.d.ts +45 -0
  366. package/lib/typescript/commonjs/artifacts/store.d.ts.map +1 -0
  367. package/lib/typescript/commonjs/contract/adapter.d.ts +55 -0
  368. package/lib/typescript/commonjs/contract/adapter.d.ts.map +1 -0
  369. package/lib/typescript/commonjs/contract/attachment.d.ts +84 -0
  370. package/lib/typescript/commonjs/contract/attachment.d.ts.map +1 -0
  371. package/lib/typescript/commonjs/contract/backup.d.ts +26 -0
  372. package/lib/typescript/commonjs/contract/backup.d.ts.map +1 -0
  373. package/lib/typescript/commonjs/contract/config.d.ts +50 -0
  374. package/lib/typescript/commonjs/contract/config.d.ts.map +1 -0
  375. package/lib/typescript/commonjs/contract/encryption.d.ts +31 -0
  376. package/lib/typescript/commonjs/contract/encryption.d.ts.map +1 -0
  377. package/lib/typescript/commonjs/contract/errors.d.ts +50 -0
  378. package/lib/typescript/commonjs/contract/errors.d.ts.map +1 -0
  379. package/lib/typescript/commonjs/contract/migration.d.ts +37 -0
  380. package/lib/typescript/commonjs/contract/migration.d.ts.map +1 -0
  381. package/lib/typescript/commonjs/contract/query.d.ts +79 -0
  382. package/lib/typescript/commonjs/contract/query.d.ts.map +1 -0
  383. package/lib/typescript/commonjs/contract/record.d.ts +43 -0
  384. package/lib/typescript/commonjs/contract/record.d.ts.map +1 -0
  385. package/lib/typescript/commonjs/contract/schema.d.ts +33 -0
  386. package/lib/typescript/commonjs/contract/schema.d.ts.map +1 -0
  387. package/lib/typescript/commonjs/contract/scope.d.ts +33 -0
  388. package/lib/typescript/commonjs/contract/scope.d.ts.map +1 -0
  389. package/lib/typescript/commonjs/contract/transaction.d.ts +66 -0
  390. package/lib/typescript/commonjs/contract/transaction.d.ts.map +1 -0
  391. package/lib/typescript/commonjs/crypto/chunked-cipher.d.ts +57 -0
  392. package/lib/typescript/commonjs/crypto/chunked-cipher.d.ts.map +1 -0
  393. package/lib/typescript/commonjs/crypto/derive.d.ts +28 -0
  394. package/lib/typescript/commonjs/crypto/derive.d.ts.map +1 -0
  395. package/lib/typescript/commonjs/crypto/key-provider.d.ts +30 -0
  396. package/lib/typescript/commonjs/crypto/key-provider.d.ts.map +1 -0
  397. package/lib/typescript/commonjs/crypto/provider.d.ts +35 -0
  398. package/lib/typescript/commonjs/crypto/provider.d.ts.map +1 -0
  399. package/lib/typescript/commonjs/diagnostics/dev-log.d.ts +35 -0
  400. package/lib/typescript/commonjs/diagnostics/dev-log.d.ts.map +1 -0
  401. package/lib/typescript/commonjs/diagnostics/errors.d.ts +34 -0
  402. package/lib/typescript/commonjs/diagnostics/errors.d.ts.map +1 -0
  403. package/lib/typescript/commonjs/diagnostics/faults.d.ts +26 -0
  404. package/lib/typescript/commonjs/diagnostics/faults.d.ts.map +1 -0
  405. package/lib/typescript/commonjs/diagnostics/map-native.d.ts +31 -0
  406. package/lib/typescript/commonjs/diagnostics/map-native.d.ts.map +1 -0
  407. package/lib/typescript/commonjs/diagnostics/redact.d.ts +70 -0
  408. package/lib/typescript/commonjs/diagnostics/redact.d.ts.map +1 -0
  409. package/lib/typescript/commonjs/index.d.ts +30 -0
  410. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  411. package/lib/typescript/commonjs/migration/executor.d.ts +40 -0
  412. package/lib/typescript/commonjs/migration/executor.d.ts.map +1 -0
  413. package/lib/typescript/commonjs/migration/ledger.d.ts +34 -0
  414. package/lib/typescript/commonjs/migration/ledger.d.ts.map +1 -0
  415. package/lib/typescript/commonjs/migration/validate-chain.d.ts +20 -0
  416. package/lib/typescript/commonjs/migration/validate-chain.d.ts.map +1 -0
  417. package/lib/typescript/commonjs/package.json +1 -0
  418. package/lib/typescript/commonjs/platform/backup-android-verify.d.ts +30 -0
  419. package/lib/typescript/commonjs/platform/backup-android-verify.d.ts.map +1 -0
  420. package/lib/typescript/commonjs/platform/backup-ios.d.ts +26 -0
  421. package/lib/typescript/commonjs/platform/backup-ios.d.ts.map +1 -0
  422. package/lib/typescript/commonjs/platform/bytes.d.ts +36 -0
  423. package/lib/typescript/commonjs/platform/bytes.d.ts.map +1 -0
  424. package/lib/typescript/commonjs/platform/fs.d.ts +47 -0
  425. package/lib/typescript/commonjs/platform/fs.d.ts.map +1 -0
  426. package/lib/typescript/commonjs/platform/location.d.ts +53 -0
  427. package/lib/typescript/commonjs/platform/location.d.ts.map +1 -0
  428. package/lib/typescript/commonjs/query/budgets.d.ts +23 -0
  429. package/lib/typescript/commonjs/query/budgets.d.ts.map +1 -0
  430. package/lib/typescript/commonjs/query/compare.d.ts +42 -0
  431. package/lib/typescript/commonjs/query/compare.d.ts.map +1 -0
  432. package/lib/typescript/commonjs/query/cursor.d.ts +27 -0
  433. package/lib/typescript/commonjs/query/cursor.d.ts.map +1 -0
  434. package/lib/typescript/commonjs/query/filter.d.ts +11 -0
  435. package/lib/typescript/commonjs/query/filter.d.ts.map +1 -0
  436. package/lib/typescript/commonjs/query/paginate.d.ts +15 -0
  437. package/lib/typescript/commonjs/query/paginate.d.ts.map +1 -0
  438. package/lib/typescript/commonjs/query/sort.d.ts +19 -0
  439. package/lib/typescript/commonjs/query/sort.d.ts.map +1 -0
  440. package/lib/typescript/commonjs/query/validate.d.ts +15 -0
  441. package/lib/typescript/commonjs/query/validate.d.ts.map +1 -0
  442. package/lib/typescript/commonjs/schema/declare.d.ts +20 -0
  443. package/lib/typescript/commonjs/schema/declare.d.ts.map +1 -0
  444. package/lib/typescript/commonjs/schema/validate-config.d.ts +11 -0
  445. package/lib/typescript/commonjs/schema/validate-config.d.ts.map +1 -0
  446. package/lib/typescript/commonjs/scope/hash.d.ts +24 -0
  447. package/lib/typescript/commonjs/scope/hash.d.ts.map +1 -0
  448. package/lib/typescript/commonjs/scope/normalize.d.ts +46 -0
  449. package/lib/typescript/commonjs/scope/normalize.d.ts.map +1 -0
  450. package/lib/typescript/commonjs/scope/validate.d.ts +15 -0
  451. package/lib/typescript/commonjs/scope/validate.d.ts.map +1 -0
  452. package/lib/typescript/commonjs/sqlite/adapter.d.ts +16 -0
  453. package/lib/typescript/commonjs/sqlite/adapter.d.ts.map +1 -0
  454. package/lib/typescript/commonjs/sqlite/batch.d.ts +25 -0
  455. package/lib/typescript/commonjs/sqlite/batch.d.ts.map +1 -0
  456. package/lib/typescript/commonjs/sqlite/catalog.d.ts +34 -0
  457. package/lib/typescript/commonjs/sqlite/catalog.d.ts.map +1 -0
  458. package/lib/typescript/commonjs/sqlite/connection.d.ts +58 -0
  459. package/lib/typescript/commonjs/sqlite/connection.d.ts.map +1 -0
  460. package/lib/typescript/commonjs/sqlite/index-coverage.d.ts +18 -0
  461. package/lib/typescript/commonjs/sqlite/index-coverage.d.ts.map +1 -0
  462. package/lib/typescript/commonjs/sqlite/native.d.ts +48 -0
  463. package/lib/typescript/commonjs/sqlite/native.d.ts.map +1 -0
  464. package/lib/typescript/commonjs/sqlite/row-codec.d.ts +69 -0
  465. package/lib/typescript/commonjs/sqlite/row-codec.d.ts.map +1 -0
  466. package/lib/typescript/commonjs/sqlite/sql-builder.d.ts +34 -0
  467. package/lib/typescript/commonjs/sqlite/sql-builder.d.ts.map +1 -0
  468. package/lib/typescript/commonjs/sqlite/statements.d.ts +26 -0
  469. package/lib/typescript/commonjs/sqlite/statements.d.ts.map +1 -0
  470. package/lib/typescript/commonjs/sqlite/transaction-queue.d.ts +31 -0
  471. package/lib/typescript/commonjs/sqlite/transaction-queue.d.ts.map +1 -0
  472. package/lib/typescript/commonjs/sqlite/transactions.d.ts +26 -0
  473. package/lib/typescript/commonjs/sqlite/transactions.d.ts.map +1 -0
  474. package/lib/typescript/commonjs/sqlite/values.d.ts +13 -0
  475. package/lib/typescript/commonjs/sqlite/values.d.ts.map +1 -0
  476. package/lib/typescript/commonjs/testing/conformance/attachments.d.ts +4 -0
  477. package/lib/typescript/commonjs/testing/conformance/attachments.d.ts.map +1 -0
  478. package/lib/typescript/commonjs/testing/conformance/encryption.d.ts +4 -0
  479. package/lib/typescript/commonjs/testing/conformance/encryption.d.ts.map +1 -0
  480. package/lib/typescript/commonjs/testing/conformance/index.d.ts +58 -0
  481. package/lib/typescript/commonjs/testing/conformance/index.d.ts.map +1 -0
  482. package/lib/typescript/commonjs/testing/conformance/lifecycle.d.ts +4 -0
  483. package/lib/typescript/commonjs/testing/conformance/lifecycle.d.ts.map +1 -0
  484. package/lib/typescript/commonjs/testing/conformance/migrations.d.ts +4 -0
  485. package/lib/typescript/commonjs/testing/conformance/migrations.d.ts.map +1 -0
  486. package/lib/typescript/commonjs/testing/conformance/queries.d.ts +4 -0
  487. package/lib/typescript/commonjs/testing/conformance/queries.d.ts.map +1 -0
  488. package/lib/typescript/commonjs/testing/conformance/records.d.ts +4 -0
  489. package/lib/typescript/commonjs/testing/conformance/records.d.ts.map +1 -0
  490. package/lib/typescript/commonjs/testing/conformance/scopes.d.ts +4 -0
  491. package/lib/typescript/commonjs/testing/conformance/scopes.d.ts.map +1 -0
  492. package/lib/typescript/commonjs/testing/conformance/transactions.d.ts +4 -0
  493. package/lib/typescript/commonjs/testing/conformance/transactions.d.ts.map +1 -0
  494. package/lib/typescript/commonjs/testing/faults.d.ts +13 -0
  495. package/lib/typescript/commonjs/testing/faults.d.ts.map +1 -0
  496. package/lib/typescript/commonjs/testing/index.d.ts +13 -0
  497. package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
  498. package/lib/typescript/commonjs/testing/memory-adapter/attachments.d.ts +23 -0
  499. package/lib/typescript/commonjs/testing/memory-adapter/attachments.d.ts.map +1 -0
  500. package/lib/typescript/commonjs/testing/memory-adapter/collection.d.ts +19 -0
  501. package/lib/typescript/commonjs/testing/memory-adapter/collection.d.ts.map +1 -0
  502. package/lib/typescript/commonjs/testing/memory-adapter/index.d.ts +22 -0
  503. package/lib/typescript/commonjs/testing/memory-adapter/index.d.ts.map +1 -0
  504. package/lib/typescript/commonjs/testing/memory-adapter/migrations.d.ts +11 -0
  505. package/lib/typescript/commonjs/testing/memory-adapter/migrations.d.ts.map +1 -0
  506. package/lib/typescript/commonjs/testing/memory-adapter/reset.d.ts +23 -0
  507. package/lib/typescript/commonjs/testing/memory-adapter/reset.d.ts.map +1 -0
  508. package/lib/typescript/commonjs/testing/memory-adapter/store.d.ts +54 -0
  509. package/lib/typescript/commonjs/testing/memory-adapter/store.d.ts.map +1 -0
  510. package/lib/typescript/module/adapter/budgets.d.ts +19 -0
  511. package/lib/typescript/module/adapter/budgets.d.ts.map +1 -0
  512. package/lib/typescript/module/adapter/collection.d.ts +25 -0
  513. package/lib/typescript/module/adapter/collection.d.ts.map +1 -0
  514. package/lib/typescript/module/adapter/deletion.d.ts +48 -0
  515. package/lib/typescript/module/adapter/deletion.d.ts.map +1 -0
  516. package/lib/typescript/module/adapter/handle.d.ts +30 -0
  517. package/lib/typescript/module/adapter/handle.d.ts.map +1 -0
  518. package/lib/typescript/module/adapter/index.d.ts +30 -0
  519. package/lib/typescript/module/adapter/index.d.ts.map +1 -0
  520. package/lib/typescript/module/adapter/lifecycle.d.ts +25 -0
  521. package/lib/typescript/module/adapter/lifecycle.d.ts.map +1 -0
  522. package/lib/typescript/module/adapter/schema-sync.d.ts +19 -0
  523. package/lib/typescript/module/adapter/schema-sync.d.ts.map +1 -0
  524. package/lib/typescript/module/adapter/transaction.d.ts +32 -0
  525. package/lib/typescript/module/adapter/transaction.d.ts.map +1 -0
  526. package/lib/typescript/module/artifacts/availability.d.ts +19 -0
  527. package/lib/typescript/module/artifacts/availability.d.ts.map +1 -0
  528. package/lib/typescript/module/artifacts/cascade.d.ts +26 -0
  529. package/lib/typescript/module/artifacts/cascade.d.ts.map +1 -0
  530. package/lib/typescript/module/artifacts/paths.d.ts +16 -0
  531. package/lib/typescript/module/artifacts/paths.d.ts.map +1 -0
  532. package/lib/typescript/module/artifacts/reconcile.d.ts +23 -0
  533. package/lib/typescript/module/artifacts/reconcile.d.ts.map +1 -0
  534. package/lib/typescript/module/artifacts/store.d.ts +45 -0
  535. package/lib/typescript/module/artifacts/store.d.ts.map +1 -0
  536. package/lib/typescript/module/contract/adapter.d.ts +55 -0
  537. package/lib/typescript/module/contract/adapter.d.ts.map +1 -0
  538. package/lib/typescript/module/contract/attachment.d.ts +84 -0
  539. package/lib/typescript/module/contract/attachment.d.ts.map +1 -0
  540. package/lib/typescript/module/contract/backup.d.ts +26 -0
  541. package/lib/typescript/module/contract/backup.d.ts.map +1 -0
  542. package/lib/typescript/module/contract/config.d.ts +50 -0
  543. package/lib/typescript/module/contract/config.d.ts.map +1 -0
  544. package/lib/typescript/module/contract/encryption.d.ts +31 -0
  545. package/lib/typescript/module/contract/encryption.d.ts.map +1 -0
  546. package/lib/typescript/module/contract/errors.d.ts +50 -0
  547. package/lib/typescript/module/contract/errors.d.ts.map +1 -0
  548. package/lib/typescript/module/contract/migration.d.ts +37 -0
  549. package/lib/typescript/module/contract/migration.d.ts.map +1 -0
  550. package/lib/typescript/module/contract/query.d.ts +79 -0
  551. package/lib/typescript/module/contract/query.d.ts.map +1 -0
  552. package/lib/typescript/module/contract/record.d.ts +43 -0
  553. package/lib/typescript/module/contract/record.d.ts.map +1 -0
  554. package/lib/typescript/module/contract/schema.d.ts +33 -0
  555. package/lib/typescript/module/contract/schema.d.ts.map +1 -0
  556. package/lib/typescript/module/contract/scope.d.ts +33 -0
  557. package/lib/typescript/module/contract/scope.d.ts.map +1 -0
  558. package/lib/typescript/module/contract/transaction.d.ts +66 -0
  559. package/lib/typescript/module/contract/transaction.d.ts.map +1 -0
  560. package/lib/typescript/module/crypto/chunked-cipher.d.ts +57 -0
  561. package/lib/typescript/module/crypto/chunked-cipher.d.ts.map +1 -0
  562. package/lib/typescript/module/crypto/derive.d.ts +28 -0
  563. package/lib/typescript/module/crypto/derive.d.ts.map +1 -0
  564. package/lib/typescript/module/crypto/key-provider.d.ts +30 -0
  565. package/lib/typescript/module/crypto/key-provider.d.ts.map +1 -0
  566. package/lib/typescript/module/crypto/provider.d.ts +35 -0
  567. package/lib/typescript/module/crypto/provider.d.ts.map +1 -0
  568. package/lib/typescript/module/diagnostics/dev-log.d.ts +35 -0
  569. package/lib/typescript/module/diagnostics/dev-log.d.ts.map +1 -0
  570. package/lib/typescript/module/diagnostics/errors.d.ts +34 -0
  571. package/lib/typescript/module/diagnostics/errors.d.ts.map +1 -0
  572. package/lib/typescript/module/diagnostics/faults.d.ts +26 -0
  573. package/lib/typescript/module/diagnostics/faults.d.ts.map +1 -0
  574. package/lib/typescript/module/diagnostics/map-native.d.ts +31 -0
  575. package/lib/typescript/module/diagnostics/map-native.d.ts.map +1 -0
  576. package/lib/typescript/module/diagnostics/redact.d.ts +70 -0
  577. package/lib/typescript/module/diagnostics/redact.d.ts.map +1 -0
  578. package/lib/typescript/module/index.d.ts +30 -0
  579. package/lib/typescript/module/index.d.ts.map +1 -0
  580. package/lib/typescript/module/migration/executor.d.ts +40 -0
  581. package/lib/typescript/module/migration/executor.d.ts.map +1 -0
  582. package/lib/typescript/module/migration/ledger.d.ts +34 -0
  583. package/lib/typescript/module/migration/ledger.d.ts.map +1 -0
  584. package/lib/typescript/module/migration/validate-chain.d.ts +20 -0
  585. package/lib/typescript/module/migration/validate-chain.d.ts.map +1 -0
  586. package/lib/typescript/module/package.json +1 -0
  587. package/lib/typescript/module/platform/backup-android-verify.d.ts +30 -0
  588. package/lib/typescript/module/platform/backup-android-verify.d.ts.map +1 -0
  589. package/lib/typescript/module/platform/backup-ios.d.ts +26 -0
  590. package/lib/typescript/module/platform/backup-ios.d.ts.map +1 -0
  591. package/lib/typescript/module/platform/bytes.d.ts +36 -0
  592. package/lib/typescript/module/platform/bytes.d.ts.map +1 -0
  593. package/lib/typescript/module/platform/fs.d.ts +47 -0
  594. package/lib/typescript/module/platform/fs.d.ts.map +1 -0
  595. package/lib/typescript/module/platform/location.d.ts +53 -0
  596. package/lib/typescript/module/platform/location.d.ts.map +1 -0
  597. package/lib/typescript/module/query/budgets.d.ts +23 -0
  598. package/lib/typescript/module/query/budgets.d.ts.map +1 -0
  599. package/lib/typescript/module/query/compare.d.ts +42 -0
  600. package/lib/typescript/module/query/compare.d.ts.map +1 -0
  601. package/lib/typescript/module/query/cursor.d.ts +27 -0
  602. package/lib/typescript/module/query/cursor.d.ts.map +1 -0
  603. package/lib/typescript/module/query/filter.d.ts +11 -0
  604. package/lib/typescript/module/query/filter.d.ts.map +1 -0
  605. package/lib/typescript/module/query/paginate.d.ts +15 -0
  606. package/lib/typescript/module/query/paginate.d.ts.map +1 -0
  607. package/lib/typescript/module/query/sort.d.ts +19 -0
  608. package/lib/typescript/module/query/sort.d.ts.map +1 -0
  609. package/lib/typescript/module/query/validate.d.ts +15 -0
  610. package/lib/typescript/module/query/validate.d.ts.map +1 -0
  611. package/lib/typescript/module/schema/declare.d.ts +20 -0
  612. package/lib/typescript/module/schema/declare.d.ts.map +1 -0
  613. package/lib/typescript/module/schema/validate-config.d.ts +11 -0
  614. package/lib/typescript/module/schema/validate-config.d.ts.map +1 -0
  615. package/lib/typescript/module/scope/hash.d.ts +24 -0
  616. package/lib/typescript/module/scope/hash.d.ts.map +1 -0
  617. package/lib/typescript/module/scope/normalize.d.ts +46 -0
  618. package/lib/typescript/module/scope/normalize.d.ts.map +1 -0
  619. package/lib/typescript/module/scope/validate.d.ts +15 -0
  620. package/lib/typescript/module/scope/validate.d.ts.map +1 -0
  621. package/lib/typescript/module/sqlite/adapter.d.ts +16 -0
  622. package/lib/typescript/module/sqlite/adapter.d.ts.map +1 -0
  623. package/lib/typescript/module/sqlite/batch.d.ts +25 -0
  624. package/lib/typescript/module/sqlite/batch.d.ts.map +1 -0
  625. package/lib/typescript/module/sqlite/catalog.d.ts +34 -0
  626. package/lib/typescript/module/sqlite/catalog.d.ts.map +1 -0
  627. package/lib/typescript/module/sqlite/connection.d.ts +58 -0
  628. package/lib/typescript/module/sqlite/connection.d.ts.map +1 -0
  629. package/lib/typescript/module/sqlite/index-coverage.d.ts +18 -0
  630. package/lib/typescript/module/sqlite/index-coverage.d.ts.map +1 -0
  631. package/lib/typescript/module/sqlite/native.d.ts +48 -0
  632. package/lib/typescript/module/sqlite/native.d.ts.map +1 -0
  633. package/lib/typescript/module/sqlite/row-codec.d.ts +69 -0
  634. package/lib/typescript/module/sqlite/row-codec.d.ts.map +1 -0
  635. package/lib/typescript/module/sqlite/sql-builder.d.ts +34 -0
  636. package/lib/typescript/module/sqlite/sql-builder.d.ts.map +1 -0
  637. package/lib/typescript/module/sqlite/statements.d.ts +26 -0
  638. package/lib/typescript/module/sqlite/statements.d.ts.map +1 -0
  639. package/lib/typescript/module/sqlite/transaction-queue.d.ts +31 -0
  640. package/lib/typescript/module/sqlite/transaction-queue.d.ts.map +1 -0
  641. package/lib/typescript/module/sqlite/transactions.d.ts +26 -0
  642. package/lib/typescript/module/sqlite/transactions.d.ts.map +1 -0
  643. package/lib/typescript/module/sqlite/values.d.ts +13 -0
  644. package/lib/typescript/module/sqlite/values.d.ts.map +1 -0
  645. package/lib/typescript/module/testing/conformance/attachments.d.ts +4 -0
  646. package/lib/typescript/module/testing/conformance/attachments.d.ts.map +1 -0
  647. package/lib/typescript/module/testing/conformance/encryption.d.ts +4 -0
  648. package/lib/typescript/module/testing/conformance/encryption.d.ts.map +1 -0
  649. package/lib/typescript/module/testing/conformance/index.d.ts +58 -0
  650. package/lib/typescript/module/testing/conformance/index.d.ts.map +1 -0
  651. package/lib/typescript/module/testing/conformance/lifecycle.d.ts +4 -0
  652. package/lib/typescript/module/testing/conformance/lifecycle.d.ts.map +1 -0
  653. package/lib/typescript/module/testing/conformance/migrations.d.ts +4 -0
  654. package/lib/typescript/module/testing/conformance/migrations.d.ts.map +1 -0
  655. package/lib/typescript/module/testing/conformance/queries.d.ts +4 -0
  656. package/lib/typescript/module/testing/conformance/queries.d.ts.map +1 -0
  657. package/lib/typescript/module/testing/conformance/records.d.ts +4 -0
  658. package/lib/typescript/module/testing/conformance/records.d.ts.map +1 -0
  659. package/lib/typescript/module/testing/conformance/scopes.d.ts +4 -0
  660. package/lib/typescript/module/testing/conformance/scopes.d.ts.map +1 -0
  661. package/lib/typescript/module/testing/conformance/transactions.d.ts +4 -0
  662. package/lib/typescript/module/testing/conformance/transactions.d.ts.map +1 -0
  663. package/lib/typescript/module/testing/faults.d.ts +13 -0
  664. package/lib/typescript/module/testing/faults.d.ts.map +1 -0
  665. package/lib/typescript/module/testing/index.d.ts +13 -0
  666. package/lib/typescript/module/testing/index.d.ts.map +1 -0
  667. package/lib/typescript/module/testing/memory-adapter/attachments.d.ts +23 -0
  668. package/lib/typescript/module/testing/memory-adapter/attachments.d.ts.map +1 -0
  669. package/lib/typescript/module/testing/memory-adapter/collection.d.ts +19 -0
  670. package/lib/typescript/module/testing/memory-adapter/collection.d.ts.map +1 -0
  671. package/lib/typescript/module/testing/memory-adapter/index.d.ts +22 -0
  672. package/lib/typescript/module/testing/memory-adapter/index.d.ts.map +1 -0
  673. package/lib/typescript/module/testing/memory-adapter/migrations.d.ts +11 -0
  674. package/lib/typescript/module/testing/memory-adapter/migrations.d.ts.map +1 -0
  675. package/lib/typescript/module/testing/memory-adapter/reset.d.ts +23 -0
  676. package/lib/typescript/module/testing/memory-adapter/reset.d.ts.map +1 -0
  677. package/lib/typescript/module/testing/memory-adapter/store.d.ts +54 -0
  678. package/lib/typescript/module/testing/memory-adapter/store.d.ts.map +1 -0
  679. package/package.json +51 -16
  680. package/src/crypto/provider.ts +7 -3
@@ -0,0 +1 @@
1
+ {"version":3,"names":["deleteDatabase","deleteScopeData","openDatabase","resetScope","DiagnosticCodes","StorageError","isCode","isStorageError","setDiagnosticLogger","Budgets"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAASA,cAAc,EAAEC,eAAe,EAAEC,YAAY,EAAEC,UAAU,QAAQ,oBAAW;;AAErF;AACA,SAASC,eAAe,EAAEC,YAAY,EAAEC,MAAM,EAAEC,cAAc,QAAQ,yBAAsB;AAC5F,SAASC,mBAAmB,QAA+B,0BAAuB;;AAElF;AACA,SAASC,OAAO,QAAQ,sBAAmB;;AAE3C","ignoreList":[]}
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The migration executor.
5
+ *
6
+ * Four rules, each of which exists because the alternative loses data:
7
+ *
8
+ * - **Ascending, and pending only.** A migration whose version is at or below
9
+ * the recorded one has already run against this scope (FR-047, FR-049).
10
+ * - **One transaction per migration.** A failure unwinds that migration and
11
+ * nothing else, so the recorded version and the data always agree.
12
+ * - **The recorded version moves only on success**, inside the same
13
+ * transaction as the migration's own writes. Writing it separately would
14
+ * leave a window where a crash records a migration that did not happen.
15
+ * - **A failure returns no handle** (FR-050). Half-migrated data behind a
16
+ * working handle is the failure this whole design exists to prevent, and it
17
+ * is worse than being unable to open at all: the app writes to it.
18
+ *
19
+ * A retry starts from the same version rather than skipping ahead (FR-051),
20
+ * which is what makes a transient failure — a locked keychain, a full disk
21
+ * mid-migration — recoverable on the next launch instead of permanent.
22
+ */
23
+
24
+ import { DiagnosticCodes } from "../contract/errors.js";
25
+ import { raise } from "../diagnostics/errors.js";
26
+ import { throwIfFaulted } from "../diagnostics/faults.js";
27
+ import { createSqlCollection } from "../adapter/collection.js";
28
+ import { ensureLedger, FORMAT_VERSION, readVersions, recordAttempt, writeSchemaVersion } from "./ledger.js";
29
+ import { pendingMigrations, validateMigrationChain } from "./validate-chain.js";
30
+ function migrationContextFor(context, executor) {
31
+ return {
32
+ collection(name) {
33
+ return createSqlCollection({
34
+ executor: () => executor,
35
+ schema: context.schemaFor(name),
36
+ now: context.now,
37
+ // Inside a migration the handle does not exist yet, so there is
38
+ // no closed-handle or deleted-scope state to guard against.
39
+ assertUsable: () => {}
40
+ });
41
+ },
42
+ async abort() {
43
+ // A migration that wants to give up should throw; aborting the
44
+ // transaction from inside while the executor still believes it is
45
+ // running would record an outcome that never happened.
46
+ raise(DiagnosticCodes.TRANSACTION_STATE, {
47
+ message: 'a migration cannot abort its own transaction'
48
+ });
49
+ },
50
+ async execute(sql, params) {
51
+ await executor.execute(sql, params);
52
+ }
53
+ };
54
+ }
55
+ export async function runMigrations(context) {
56
+ const {
57
+ config,
58
+ connection
59
+ } = context;
60
+ validateMigrationChain(config);
61
+ // Skipped when the open already found its bookkeeping tables in place.
62
+ if (context.ledgerReady !== true) {
63
+ await ensureLedger(connection);
64
+ }
65
+ const {
66
+ schema: recorded,
67
+ format
68
+ } = await readVersions(connection);
69
+ if (format > FORMAT_VERSION) {
70
+ // A file laid out by a newer release of this package. Reading it with
71
+ // older code is the same hazard as a schema downgrade, one layer down.
72
+ await context.closeOnFailure();
73
+ raise(DiagnosticCodes.SCHEMA_DOWNGRADE, {
74
+ message: 'database was written by a newer version of this package',
75
+ detail: {
76
+ recordedVersion: format,
77
+ version: FORMAT_VERSION
78
+ }
79
+ });
80
+ }
81
+ if (recorded > config.schemaVersion) {
82
+ // Opening anyway would mean newer data read by older code, which drops
83
+ // whatever the newer schema added — silently, and on write (FR-052).
84
+ await context.closeOnFailure();
85
+ raise(DiagnosticCodes.SCHEMA_DOWNGRADE, {
86
+ message: 'recorded schema version is newer than the declared one',
87
+ detail: {
88
+ recordedVersion: recorded,
89
+ version: config.schemaVersion
90
+ }
91
+ });
92
+ }
93
+ let current = recorded;
94
+ for (const migration of pendingMigrations(config, recorded)) {
95
+ try {
96
+ await connection.transaction(async tx => {
97
+ throwIfFaulted('migration');
98
+ await migration.migrate(migrationContextFor(context, tx));
99
+ await writeSchemaVersion(tx, migration.version);
100
+ await recordAttempt(tx, {
101
+ version: migration.version,
102
+ attemptedAt: context.now(),
103
+ outcome: 'applied'
104
+ });
105
+ });
106
+ current = migration.version;
107
+ } catch (error) {
108
+ // Recorded outside the rolled-back transaction, or it would vanish
109
+ // with the migration it describes.
110
+ await recordAttempt(connection, {
111
+ version: migration.version,
112
+ attemptedAt: context.now(),
113
+ outcome: 'failed',
114
+ failureCode: error.code ?? DiagnosticCodes.MIGRATION_FAILED
115
+ });
116
+ await context.closeOnFailure();
117
+ raise(DiagnosticCodes.MIGRATION_FAILED, {
118
+ message: 'migration failed',
119
+ migration: {
120
+ // Unchanged: the next open retries from here rather than
121
+ // skipping the migration that failed.
122
+ recordedVersion: current,
123
+ failingVersion: migration.version,
124
+ outcome: 'failed'
125
+ },
126
+ cause: error
127
+ });
128
+ }
129
+ }
130
+ return current;
131
+ }
132
+ //# sourceMappingURL=executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DiagnosticCodes","raise","throwIfFaulted","createSqlCollection","ensureLedger","FORMAT_VERSION","readVersions","recordAttempt","writeSchemaVersion","pendingMigrations","validateMigrationChain","migrationContextFor","context","executor","collection","name","schema","schemaFor","now","assertUsable","abort","TRANSACTION_STATE","message","execute","sql","params","runMigrations","config","connection","ledgerReady","recorded","format","closeOnFailure","SCHEMA_DOWNGRADE","detail","recordedVersion","version","schemaVersion","current","migration","transaction","tx","migrate","attemptedAt","outcome","error","failureCode","code","MIGRATION_FAILED","failingVersion","cause"],"sourceRoot":"../../../src","sources":["migration/executor.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAAQ,uBAAoB;AAKpD,SAASC,KAAK,QAAQ,0BAAuB;AAC7C,SAASC,cAAc,QAAQ,0BAAuB;AACtD,SAASC,mBAAmB,QAAQ,0BAAuB;AAE3D,SACCC,YAAY,EACZC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,kBAAkB,QACZ,aAAU;AACjB,SAASC,iBAAiB,EAAEC,sBAAsB,QAAQ,qBAAkB;AAkB5E,SAASC,mBAAmBA,CAACC,OAA4B,EAAEC,QAAkB,EAAoB;EAChG,OAAO;IACNC,UAAUA,CAA+BC,IAAY,EAAoB;MACxE,OAAOZ,mBAAmB,CA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AAe,EAAEG,OAAO;UACxBW,cAAc,EAAEV,SAAS,CAACH,OAAO;UACjCQ,OAAO,EAAE;QACV,CAAC;QACDM,KAAK,EAAEL;MACR,CAAC,CAAC;IACH;EACD;EAEA,OAAOP,OAAO;AACf","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The per-scope migration ledger.
5
+ *
6
+ * Per scope, not per database, and that is the whole reason FR-054 works: a
7
+ * scope created after a migration shipped starts at version 0 and is migrated
8
+ * on first open, rather than being assumed current because some other scope
9
+ * already ran the chain.
10
+ *
11
+ * The ledger records a **code**, never a message (FR-079). A migration that
12
+ * failed because a domain constraint was violated could otherwise write the
13
+ * offending value into a table that outlives the failure — a payload leak
14
+ * with a long half-life, sitting in a file the next crash report might carry.
15
+ */
16
+
17
+ import { text } from "../sqlite/values.js";
18
+
19
+ /** Physical layout version, independent of the app's schema version. */
20
+ export const FORMAT_VERSION = 1;
21
+ const CREATE_META = `CREATE TABLE IF NOT EXISTS _meta (
22
+ key TEXT PRIMARY KEY,
23
+ value TEXT NOT NULL
24
+ )`;
25
+ const CREATE_MIGRATIONS = `CREATE TABLE IF NOT EXISTS _migrations (
26
+ version INTEGER PRIMARY KEY,
27
+ attempted_at INTEGER NOT NULL,
28
+ outcome TEXT NOT NULL,
29
+ failure_code TEXT
30
+ )`;
31
+ export async function ensureLedger(executor) {
32
+ await executor.execute(CREATE_META);
33
+ await executor.execute(CREATE_MIGRATIONS);
34
+ await executor.execute('INSERT INTO _meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO NOTHING', ['format_version', String(FORMAT_VERSION)]);
35
+ await executor.execute('INSERT INTO _meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO NOTHING', ['schema_version', '0']);
36
+ }
37
+ /** Both versions in one read: every open asks for them. */
38
+ export async function readVersions(executor) {
39
+ const result = await executor.execute("SELECT key, value FROM _meta WHERE key IN ('schema_version', 'format_version')");
40
+ const values = new Map(result.rows.map(row => [text(row.key), Number(text(row.value))]));
41
+ return {
42
+ schema: values.get('schema_version') ?? 0,
43
+ format: values.get('format_version') ?? FORMAT_VERSION
44
+ };
45
+ }
46
+ export async function writeSchemaVersion(executor, version) {
47
+ await executor.execute('INSERT INTO _meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value', ['schema_version', String(version)]);
48
+ }
49
+ export async function recordAttempt(executor, entry) {
50
+ await executor.execute(`INSERT INTO _migrations (version, attempted_at, outcome, failure_code)
51
+ VALUES (?, ?, ?, ?)
52
+ ON CONFLICT(version) DO UPDATE SET
53
+ attempted_at = excluded.attempted_at,
54
+ outcome = excluded.outcome,
55
+ failure_code = excluded.failure_code`, [entry.version, entry.attemptedAt, entry.outcome, entry.failureCode ?? null]);
56
+ }
57
+ //# sourceMappingURL=ledger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["text","FORMAT_VERSION","CREATE_META","CREATE_MIGRATIONS","ensureLedger","executor","execute","String","readVersions","result","values","Map","rows","map","row","key","Number","value","schema","get","format","writeSchemaVersion","version","recordAttempt","entry","attemptedAt","outcome","failureCode"],"sourceRoot":"../../../src","sources":["migration/ledger.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,IAAI,QAAQ,qBAAkB;;AAEvC;AACA,OAAO,MAAMC,cAAc,GAAG,CAAC;AAE/B,MAAMC,WAAW,GAAG;AACpB;AACA;AACA,EAAE;AAEF,MAAMC,iBAAiB,GAAG;AAC1B;AACA;AACA;AACA;AACA,EAAE;AAEF,OAAO,eAAeC,YAAYA,CAACC,QAAkB,EAAiB;EACrE,MAAMA,QAAQ,CAACC,OAAO,CAACJ,WAAW,CAAC;EACnC,MAAMG,QAAQ,CAACC,OAAO,CAACH,iBAAiB,CAAC;EACzC,MAAME,QAAQ,CAACC,OAAO,CACrB,0EAA0E,EAC1E,CAAC,gBAAgB,EAAEC,MAAM,CAACN,cAAc,CAAC,CAC1C,CAAC;EACD,MAAMI,QAAQ,CAACC,OAAO,CACrB,0EAA0E,EAC1E,CAAC,gBAAgB,EAAE,GAAG,CACvB,CAAC;AACF;AASA;AACA,OAAO,eAAeE,YAAYA,CAACH,QAAkB,EAA6B;EACjF,MAAMI,MAAM,GAAG,MAAMJ,QAAQ,CAACC,OAAO,CACpC,gFACD,CAAC;EACD,MAAMI,MAAM,GAAG,IAAIC,GAAG,CAACF,MAAM,CAACG,IAAI,CAACC,GAAG,CAACC,GAAG,IAAI,CAACd,IAAI,CAACc,GAAG,CAACC,GAAG,CAAC,EAAEC,MAAM,CAAChB,IAAI,CAACc,GAAG,CAACG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;EACxF,OAAO;IACNC,MAAM,EAAER,MAAM,CAACS,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC;IACzCC,MAAM,EAAEV,MAAM,CAACS,GAAG,CAAC,gBAAgB,CAAC,IAAIlB;EACzC,CAAC;AACF;AAEA,OAAO,eAAeoB,kBAAkBA,CAAChB,QAAkB,EAAEiB,OAAe,EAAiB;EAC5F,MAAMjB,QAAQ,CAACC,OAAO,CACrB,oGAAoG,EACpG,CAAC,gBAAgB,EAAEC,MAAM,CAACe,OAAO,CAAC,CACnC,CAAC;AACF;AAEA,OAAO,eAAeC,aAAaA,CAClClB,QAAkB,EAClBmB,KAAgG,EAChF;EAChB,MAAMnB,QAAQ,CAACC,OAAO,CACrB;AACF;AACA;AACA;AACA;AACA,0CAA0C,EACxC,CAACkB,KAAK,CAACF,OAAO,EAAEE,KAAK,CAACC,WAAW,EAAED,KAAK,CAACE,OAAO,EAAEF,KAAK,CAACG,WAAW,IAAI,IAAI,CAC5E,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Migration chain validation, run before any migration executes (FR-053).
5
+ *
6
+ * Validating first is what stops a half-run chain from being the thing that
7
+ * discovers the problem. A duplicate version, a gap, or a chain that does not
8
+ * reach the declared `schemaVersion` are all configuration errors the
9
+ * developer can fix; discovering them after migration 3 of 5 has already
10
+ * rewritten a user's data is not.
11
+ *
12
+ * A gap is refused rather than skipped over deliberately. A user upgrading
13
+ * from the version inside the gap has no path across it, and opening anyway
14
+ * would hand them a database the code believes is current and is not.
15
+ */
16
+
17
+ import { DiagnosticCodes } from "../contract/errors.js";
18
+ import { raise } from "../diagnostics/errors.js";
19
+ function invalid(message, detail) {
20
+ raise(DiagnosticCodes.MIGRATION_CONFIG_INVALID, {
21
+ message,
22
+ detail
23
+ });
24
+ }
25
+ export function validateMigrationChain(config) {
26
+ const migrations = config.migrations ?? [];
27
+ if (!Number.isInteger(config.schemaVersion) || config.schemaVersion < 1) {
28
+ invalid('schemaVersion must be a positive integer');
29
+ }
30
+ const versions = new Set();
31
+ for (const migration of migrations) {
32
+ if (!Number.isInteger(migration.version) || migration.version < 1) {
33
+ invalid('migration version must be a positive integer');
34
+ }
35
+ if (versions.has(migration.version)) {
36
+ invalid('duplicate migration version', {
37
+ version: migration.version
38
+ });
39
+ }
40
+ versions.add(migration.version);
41
+ if (typeof migration.migrate !== 'function') {
42
+ invalid('migration has no migrate function', {
43
+ version: migration.version
44
+ });
45
+ }
46
+ }
47
+ for (let version = 1; version <= config.schemaVersion; version += 1) {
48
+ if (!versions.has(version)) {
49
+ invalid('migration chain has a gap', {
50
+ version
51
+ });
52
+ }
53
+ }
54
+ for (const version of versions) {
55
+ if (version > config.schemaVersion) {
56
+ invalid('migration version exceeds the declared schemaVersion', {
57
+ version
58
+ });
59
+ }
60
+ }
61
+ }
62
+
63
+ /** Ascending, because the order a consumer declared them in is not a contract. */
64
+ export function orderedMigrations(config) {
65
+ return [...(config.migrations ?? [])].sort((a, b) => a.version - b.version);
66
+ }
67
+ export function pendingMigrations(config, recordedVersion) {
68
+ return orderedMigrations(config).filter(migration => migration.version > recordedVersion);
69
+ }
70
+ //# sourceMappingURL=validate-chain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DiagnosticCodes","raise","invalid","message","detail","MIGRATION_CONFIG_INVALID","validateMigrationChain","config","migrations","Number","isInteger","schemaVersion","versions","Set","migration","version","has","add","migrate","orderedMigrations","sort","a","b","pendingMigrations","recordedVersion","filter"],"sourceRoot":"../../../src","sources":["migration/validate-chain.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAAQ,uBAAoB;AAEpD,SAASC,KAAK,QAAQ,0BAAuB;AAE7C,SAASC,OAAOA,CAACC,OAAe,EAAEC,MAAgC,EAAS;EAC1EH,KAAK,CAACD,eAAe,CAACK,wBAAwB,EAAE;IAAEF,OAAO;IAAEC;EAAO,CAAC,CAAC;AACrE;AAEA,OAAO,SAASE,sBAAsBA,CAACC,MAAsB,EAAQ;EACpE,MAAMC,UAAU,GAAGD,MAAM,CAACC,UAAU,IAAI,EAAE;EAE1C,IAAI,CAACC,MAAM,CAACC,SAAS,CAACH,MAAM,CAACI,aAAa,CAAC,IAAIJ,MAAM,CAACI,aAAa,GAAG,CAAC,EAAE;IACxET,OAAO,CAAC,0CAA0C,CAAC;EACpD;EAEA,MAAMU,QAAQ,GAAG,IAAIC,GAAG,CAAS,CAAC;EAClC,KAAK,MAAMC,SAAS,IAAIN,UAAU,EAAE;IACnC,IAAI,CAACC,MAAM,CAACC,SAAS,CAACI,SAAS,CAACC,OAAO,CAAC,IAAID,SAAS,CAACC,OAAO,GAAG,CAAC,EAAE;MAClEb,OAAO,CAAC,8CAA8C,CAAC;IACxD;IACA,IAAIU,QAAQ,CAACI,GAAG,CAACF,SAAS,CAACC,OAAO,CAAC,EAAE;MACpCb,OAAO,CAAC,6BAA6B,EAAE;QAAEa,OAAO,EAAED,SAAS,CAACC;MAAQ,CAAC,CAAC;IACvE;IACAH,QAAQ,CAACK,GAAG,CAACH,SAAS,CAACC,OAAO,CAAC;IAC/B,IAAI,OAAOD,SAAS,CAACI,OAAO,KAAK,UAAU,EAAE;MAC5ChB,OAAO,CAAC,mCAAmC,EAAE;QAAEa,OAAO,EAAED,SAAS,CAACC;MAAQ,CAAC,CAAC;IAC7E;EACD;EAEA,KAAK,IAAIA,OAAO,GAAG,CAAC,EAAEA,OAAO,IAAIR,MAAM,CAACI,aAAa,EAAEI,OAAO,IAAI,CAAC,EAAE;IACpE,IAAI,CAACH,QAAQ,CAACI,GAAG,CAACD,OAAO,CAAC,EAAE;MAC3Bb,OAAO,CAAC,2BAA2B,EAAE;QAAEa;MAAQ,CAAC,CAAC;IAClD;EACD;EAEA,KAAK,MAAMA,OAAO,IAAIH,QAAQ,EAAE;IAC/B,IAAIG,OAAO,GAAGR,MAAM,CAACI,aAAa,EAAE;MACnCT,OAAO,CAAC,sDAAsD,EAAE;QAAEa;MAAQ,CAAC,CAAC;IAC7E;EACD;AACD;;AAEA;AACA,OAAO,SAASI,iBAAiBA,CAACZ,MAAsB,EAAe;EACtE,OAAO,CAAC,IAAIA,MAAM,CAACC,UAAU,IAAI,EAAE,CAAC,CAAC,CAACY,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACN,OAAO,GAAGO,CAAC,CAACP,OAAO,CAAC;AAC5E;AAEA,OAAO,SAASQ,iBAAiBA,CAAChB,MAAsB,EAAEiB,eAAuB,EAAe;EAC/F,OAAOL,iBAAiB,CAACZ,MAAM,CAAC,CAACkB,MAAM,CAACX,SAAS,IAAIA,SAAS,CAACC,OAAO,GAAGS,eAAe,CAAC;AAC1F","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Android backup posture: verified and reported, never enforced.
5
+ *
6
+ * Android decides backup participation from `android:dataExtractionRules` in
7
+ * the app's manifest. That is build-time and app-owned, and this package
8
+ * authors no native code, so it cannot contribute an entry and cannot change
9
+ * the answer at runtime (research.md R5).
10
+ *
11
+ * What it can do is check the one thing that silently breaks the documented
12
+ * fix: the rule the README tells an app to ship addresses the `file` domain,
13
+ * which is the app's `files/` directory. If the managed root did not land
14
+ * under that directory, the app can ship the XML exactly as documented and
15
+ * still have an unprotected database. That mismatch is detectable here, and
16
+ * an app learning it from this report is the whole point of FR-111 — the
17
+ * alternative is learning it from an incident.
18
+ */
19
+
20
+ import { Platform } from 'react-native';
21
+ import { MANAGED_ROOT_NAME, normalizePath } from "./location.js";
22
+ export function isAndroid() {
23
+ return Platform.OS === 'android';
24
+ }
25
+
26
+ /** The `path` an app's exclusion rule must name for the root it actually got. */
27
+ export function coveragePathFor(layout) {
28
+ const root = normalizePath(layout.root);
29
+ const marker = `/files/`;
30
+ const index = root.indexOf(marker);
31
+ if (index === -1) {
32
+ return null;
33
+ }
34
+ return root.slice(index + marker.length);
35
+ }
36
+ export function androidPosture(layout, includeInPlatformBackup) {
37
+ const requested = includeInPlatformBackup ? 'included' : 'excluded';
38
+ const coverage = coveragePathFor(layout);
39
+ if (coverage === null) {
40
+ return {
41
+ requested,
42
+ // Not "excluded" and not "included": the package genuinely does not
43
+ // know, and saying either would be a claim it cannot support.
44
+ observed: 'unknown',
45
+ enforcedBy: 'app-manifest',
46
+ warning: 'The managed storage area is not under the Android file domain, so the ' + 'documented data_extraction_rules.xml entry will not cover it. Backup ' + 'posture cannot be honoured on this platform until the app supplies a ' + 'rule matching the actual storage location.'
47
+ };
48
+ }
49
+ return {
50
+ requested,
51
+ observed: 'unknown',
52
+ enforcedBy: 'app-manifest',
53
+ warning: `Android backup participation is declared by the app, not this package. ` + `Confirm android/app/src/main/res/xml/data_extraction_rules.xml contains an ` + `entry for domain="file" path="${MANAGED_ROOT_NAME}/" and that ` + `AndroidManifest.xml references it; the observed posture cannot be verified ` + `from JavaScript.`
54
+ };
55
+ }
56
+
57
+ /**
58
+ * The posture the handle reports (FR-111).
59
+ *
60
+ * Split by platform rather than smoothed over, because a consumer writing a
61
+ * privacy disclosure needs to know which of the two answers it is holding.
62
+ */
63
+ export function effectivePostureFor(layout, includeInPlatformBackup, iosPostureFor) {
64
+ if (isAndroid()) {
65
+ return androidPosture(layout, includeInPlatformBackup);
66
+ }
67
+ return iosPostureFor(includeInPlatformBackup);
68
+ }
69
+ //# sourceMappingURL=backup-android-verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","MANAGED_ROOT_NAME","normalizePath","isAndroid","OS","coveragePathFor","layout","root","marker","index","indexOf","slice","length","androidPosture","includeInPlatformBackup","requested","coverage","observed","enforcedBy","warning","effectivePostureFor","iosPostureFor"],"sourceRoot":"../../../src","sources":["platform/backup-android-verify.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,cAAc;AAGvC,SAASC,iBAAiB,EAAEC,aAAa,QAA4B,eAAY;AAEjF,OAAO,SAASC,SAASA,CAAA,EAAY;EACpC,OAAOH,QAAQ,CAACI,EAAE,KAAK,SAAS;AACjC;;AAEA;AACA,OAAO,SAASC,eAAeA,CAACC,MAAqB,EAAiB;EACrE,MAAMC,IAAI,GAAGL,aAAa,CAACI,MAAM,CAACC,IAAI,CAAC;EACvC,MAAMC,MAAM,GAAG,SAAS;EACxB,MAAMC,KAAK,GAAGF,IAAI,CAACG,OAAO,CAACF,MAAM,CAAC;EAClC,IAAIC,KAAK,KAAK,CAAC,CAAC,EAAE;IACjB,OAAO,IAAI;EACZ;EACA,OAAOF,IAAI,CAACI,KAAK,CAACF,KAAK,GAAGD,MAAM,CAACI,MAAM,CAAC;AACzC;AAEA,OAAO,SAASC,cAAcA,CAC7BP,MAAqB,EACrBQ,uBAAgC,EACb;EACnB,MAAMC,SAAS,GAAGD,uBAAuB,GAAG,UAAU,GAAG,UAAU;EACnE,MAAME,QAAQ,GAAGX,eAAe,CAACC,MAAM,CAAC;EAExC,IAAIU,QAAQ,KAAK,IAAI,EAAE;IACtB,OAAO;MACND,SAAS;MACT;MACA;MACAE,QAAQ,EAAE,SAAS;MACnBC,UAAU,EAAE,cAAc;MAC1BC,OAAO,EACN,wEAAwE,GACxE,uEAAuE,GACvE,uEAAuE,GACvE;IACF,CAAC;EACF;EAEA,OAAO;IACNJ,SAAS;IACTE,QAAQ,EAAE,SAAS;IACnBC,UAAU,EAAE,cAAc;IAC1BC,OAAO,EACN,yEAAyE,GACzE,6EAA6E,GAC7E,iCAAiClB,iBAAiB,cAAc,GAChE,6EAA6E,GAC7E;EACF,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASmB,mBAAmBA,CAClCd,MAAqB,EACrBQ,uBAAgC,EAChCO,aAAqD,EAClC;EACnB,IAAIlB,SAAS,CAAC,CAAC,EAAE;IAChB,OAAOU,cAAc,CAACP,MAAM,EAAEQ,uBAAuB,CAAC;EACvD;EACA,OAAOO,aAAa,CAACP,uBAAuB,CAAC;AAC9C","ignoreList":[]}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * iOS backup exclusion.
5
+ *
6
+ * `NSURLIsExcludedFromBackupKey` is set on the managed root at creation, and
7
+ * the attribute is inherited by everything beneath it — so one call covers
8
+ * the catalog, every scope database, and every artifact, including ones
9
+ * created years later. Setting it per file would leave a window in which a
10
+ * freshly written artifact is backed up before the attribute lands.
11
+ *
12
+ * This is the half of FR-109 the package can actually enforce. Android is
13
+ * manifest-owned; see backup-android-verify.ts and research.md R5.
14
+ */
15
+
16
+ import { Platform } from 'react-native';
17
+ import { fileSystem } from "./fs.js";
18
+ export function isIos() {
19
+ return Platform.OS === 'ios';
20
+ }
21
+
22
+ /**
23
+ * Create the managed root with the exclusion attribute already on it.
24
+ *
25
+ * Idempotent: `mkdir` on an existing directory re-applies the attribute,
26
+ * which matters because an app that flips the posture between launches must
27
+ * get the new one without a reinstall.
28
+ */
29
+ export async function ensureManagedRoot(layout, includeInPlatformBackup) {
30
+ await fileSystem().mkdir(layout.root, isIos() ? {
31
+ NSURLIsExcludedFromBackupKey: !includeInPlatformBackup
32
+ } : {});
33
+ }
34
+
35
+ /** What the package can state about iOS, where it enforces rather than reports. */
36
+ export function iosPosture(includeInPlatformBackup) {
37
+ const requested = includeInPlatformBackup ? 'included' : 'excluded';
38
+ return {
39
+ requested,
40
+ observed: requested,
41
+ enforcedBy: 'package'
42
+ };
43
+ }
44
+ //# sourceMappingURL=backup-ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","fileSystem","isIos","OS","ensureManagedRoot","layout","includeInPlatformBackup","mkdir","root","NSURLIsExcludedFromBackupKey","iosPosture","requested","observed","enforcedBy"],"sourceRoot":"../../../src","sources":["platform/backup-ios.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,cAAc;AAGvC,SAASC,UAAU,QAAQ,SAAM;AAGjC,OAAO,SAASC,KAAKA,CAAA,EAAY;EAChC,OAAOF,QAAQ,CAACG,EAAE,KAAK,KAAK;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,iBAAiBA,CACtCC,MAAqB,EACrBC,uBAAgC,EAChB;EAChB,MAAML,UAAU,CAAC,CAAC,CAACM,KAAK,CACvBF,MAAM,CAACG,IAAI,EACXN,KAAK,CAAC,CAAC,GAAG;IAAEO,4BAA4B,EAAE,CAACH;EAAwB,CAAC,GAAG,CAAC,CACzE,CAAC;AACF;;AAEA;AACA,OAAO,SAASI,UAAUA,CAACJ,uBAAgC,EAAoB;EAC9E,MAAMK,SAAS,GAAGL,uBAAuB,GAAG,UAAU,GAAG,UAAU;EACnE,OAAO;IACNK,SAAS;IACTC,QAAQ,EAAED,SAAS;IACnBE,UAAU,EAAE;EACb,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Byte handling without Node's `Buffer`.
5
+ *
6
+ * Hermes has no global `Buffer`, and `react-native-quick-crypto` installs one
7
+ * only when the app calls its `install()` — which nothing in this package or its
8
+ * documentation asked for. Until 0.2.0 attachment writes and reads used the
9
+ * global anyway, so on a device every attachment operation threw. Everything
10
+ * here is plain `Uint8Array` and a self-contained base64 codec, identical on
11
+ * Hermes and in Node.
12
+ */
13
+
14
+ const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
15
+ const LOOKUP = (() => {
16
+ const table = new Int16Array(128).fill(-1);
17
+ for (let index = 0; index < ALPHABET.length; index += 1) {
18
+ table[ALPHABET.charCodeAt(index)] = index;
19
+ }
20
+ // The URL-safe variants decode too, since some file APIs return them.
21
+ table['-'.charCodeAt(0)] = 62;
22
+ table['_'.charCodeAt(0)] = 63;
23
+ return table;
24
+ })();
25
+
26
+ /**
27
+ * Codecs Hermes and Node provide but React Native's type declarations omit.
28
+ * Read through this view so the package type-checks without DOM or Node types.
29
+ */
30
+
31
+ export const host = globalThis;
32
+
33
+ /* eslint-disable no-bitwise -- base64 is bit packing; there is no clearer way to write it. */
34
+
35
+ /** Characters per `String.fromCharCode` call; large spreads overflow the stack. */
36
+ const CHUNK = 0x8000;
37
+ export function base64ToBytes(base64) {
38
+ if (host.atob) {
39
+ let binary;
40
+ try {
41
+ binary = host.atob(base64.replace(/-/g, '+').replace(/_/g, '/'));
42
+ } catch {
43
+ // atob is strict where Buffer was lenient; fall through to the
44
+ // tolerant decoder rather than turn stray characters into a crash.
45
+ }
46
+ if (binary !== undefined) {
47
+ const bytes = new Uint8Array(binary.length);
48
+ for (let index = 0; index < binary.length; index += 1) {
49
+ bytes[index] = binary.charCodeAt(index);
50
+ }
51
+ return bytes;
52
+ }
53
+ }
54
+ // Decode directly, skipping padding and anything outside the alphabet.
55
+ const bytes = new Uint8Array(Math.ceil(base64.length * 3 / 4));
56
+ let out = 0;
57
+ let buffer = 0;
58
+ let bits = 0;
59
+ for (let index = 0; index < base64.length; index += 1) {
60
+ const code = base64.charCodeAt(index);
61
+ const value = code < 128 ? LOOKUP[code] : -1;
62
+ if (value < 0) continue;
63
+ buffer = buffer << 6 | value;
64
+ bits += 6;
65
+ if (bits >= 8) {
66
+ bits -= 8;
67
+ bytes[out++] = buffer >> bits & 0xff;
68
+ }
69
+ }
70
+ return bytes.subarray(0, out);
71
+ }
72
+ export function bytesToBase64(bytes) {
73
+ if (host.btoa) {
74
+ const parts = [];
75
+ for (let index = 0; index < bytes.length; index += CHUNK) {
76
+ parts.push(String.fromCharCode(...bytes.subarray(index, index + CHUNK)));
77
+ }
78
+ return host.btoa(parts.join(''));
79
+ }
80
+ const parts = [];
81
+ for (let start = 0; start < bytes.length; start += CHUNK * 3) {
82
+ let piece = '';
83
+ const end = Math.min(bytes.length, start + CHUNK * 3);
84
+ let index = start;
85
+ for (; index + 2 < end; index += 3) {
86
+ const triple = bytes[index] << 16 | bytes[index + 1] << 8 | bytes[index + 2];
87
+ piece += ALPHABET[triple >> 18] + ALPHABET[triple >> 12 & 63] + ALPHABET[triple >> 6 & 63] + ALPHABET[triple & 63];
88
+ }
89
+ const remaining = end - index;
90
+ if (remaining === 1) {
91
+ const value = bytes[index];
92
+ piece += `${ALPHABET[value >> 2]}${ALPHABET[(value & 3) << 4]}==`;
93
+ } else if (remaining === 2) {
94
+ const value = bytes[index] << 8 | bytes[index + 1];
95
+ piece += `${ALPHABET[value >> 10]}${ALPHABET[value >> 4 & 63]}${ALPHABET[(value & 15) << 2]}=`;
96
+ }
97
+ parts.push(piece);
98
+ }
99
+ return parts.join('');
100
+ }
101
+
102
+ /** UTF-8 encoding. `TextEncoder` is in Hermes and Node; the loop is the fallback. */
103
+ export function utf8Bytes(value) {
104
+ if (host.TextEncoder) {
105
+ return new host.TextEncoder().encode(value);
106
+ }
107
+ const encoded = unescape(encodeURIComponent(value));
108
+ const bytes = new Uint8Array(encoded.length);
109
+ for (let index = 0; index < encoded.length; index += 1) {
110
+ bytes[index] = encoded.charCodeAt(index);
111
+ }
112
+ return bytes;
113
+ }
114
+
115
+ /** UTF-8 decoding, the inverse of `utf8Bytes`. */
116
+ export function utf8String(bytes) {
117
+ if (host.TextDecoder) {
118
+ return new host.TextDecoder().decode(bytes);
119
+ }
120
+ let binary = '';
121
+ for (const byte of bytes) {
122
+ binary += String.fromCharCode(byte);
123
+ }
124
+ return decodeURIComponent(escape(binary));
125
+ }
126
+
127
+ /* eslint-enable no-bitwise */
128
+
129
+ export function concatBytes(parts) {
130
+ const total = parts.reduce((sum, part) => sum + part.length, 0);
131
+ const joined = new Uint8Array(total);
132
+ let offset = 0;
133
+ for (const part of parts) {
134
+ joined.set(part, offset);
135
+ offset += part.length;
136
+ }
137
+ return joined;
138
+ }
139
+
140
+ /** The ASCII text of `length` bytes from `start`, for magic numbers. */
141
+ export function asciiAt(bytes, start, length) {
142
+ let text = '';
143
+ for (let index = start; index < start + length && index < bytes.length; index += 1) {
144
+ text += String.fromCharCode(bytes[index]);
145
+ }
146
+ return text;
147
+ }
148
+ //# sourceMappingURL=bytes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ALPHABET","LOOKUP","table","Int16Array","fill","index","length","charCodeAt","host","globalThis","CHUNK","base64ToBytes","base64","atob","binary","replace","undefined","bytes","Uint8Array","Math","ceil","out","buffer","bits","code","value","subarray","bytesToBase64","btoa","parts","push","String","fromCharCode","join","start","piece","end","min","triple","remaining","utf8Bytes","TextEncoder","encode","encoded","unescape","encodeURIComponent","utf8String","TextDecoder","decode","byte","decodeURIComponent","escape","concatBytes","total","reduce","sum","part","joined","offset","set","asciiAt","text"],"sourceRoot":"../../../src","sources":["platform/bytes.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,QAAQ,GAAG,kEAAkE;AACnF,MAAMC,MAAM,GAAG,CAAC,MAAM;EACrB,MAAMC,KAAK,GAAG,IAAIC,UAAU,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC,CAAC;EAC1C,KAAK,IAA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B,KAAK,GAAGxB,KAAK,CAACyB,MAAM,CAAC,CAACC,GAAG,EAAEC,IAAI,KAAKD,GAAG,GAAGC,IAAI,CAAClD,MAAM,EAAE,CAAC,CAAC;EAC/D,MAAMmD,MAAM,GAAG,IAAIvC,UAAU,CAACmC,KAAK,CAAC;EACpC,IAAIK,MAAM,GAAG,CAAC;EACd,KAAK,MAAMF,IAAI,IAAI3B,KAAK,EAAE;IACzB4B,MAAM,CAACE,GAAG,CAACH,IAAI,EAAEE,MAAM,CAAC;IACxBA,MAAM,IAAIF,IAAI,CAAClD,MAAM;EACtB;EACA,OAAOmD,MAAM;AACd;;AAEA;AACA,OAAO,SAASG,OAAOA,CAAC3C,KAAiB,EAAEiB,KAAa,EAAE5B,MAAc,EAAU;EACjF,IAAIuD,IAAI,GAAG,EAAE;EACb,KAAK,IAAIxD,KAAK,GAAG6B,KAAK,EAAE7B,KAAK,GAAG6B,KAAK,GAAG5B,MAAM,IAAID,KAAK,GAAGY,KAAK,CAACX,MAAM,EAAED,KAAK,IAAI,CAAC,EAAE;IACnFwD,IAAI,IAAI9B,MAAM,CAACC,YAAY,CAACf,KAAK,CAACZ,KAAK,CAAE,CAAC;EAC3C;EACA,OAAOwD,IAAI;AACZ","ignoreList":[]}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The filesystem peer, behind one lazy accessor.
5
+ *
6
+ * Required lazily for the same reason the engine is: a consuming app that
7
+ * only ever runs the in-memory adapter in tests must not have to install a
8
+ * native module to import this package. Confining the require to `platform/`
9
+ * also keeps the native surface four directories wide, which is the layering
10
+ * rule the ESLint config enforces.
11
+ */
12
+
13
+ import { lazyPeer } from '@chipmobilesdk/rn-core';
14
+ import { DiagnosticCodes } from "../contract/errors.js";
15
+ import { StorageError } from "../diagnostics/errors.js";
16
+
17
+ /**
18
+ * Only what the package actually uses. The peer's upload and download
19
+ * helpers are deliberately absent from this type: the package must never
20
+ * make a network request (FR-084, SC-016), and a surface that cannot express
21
+ * one is a stronger guarantee than a rule that says not to.
22
+ */
23
+
24
+ /** Loaded on first use (rn-core's lazy peer); a missing peer is `STORAGE_ACCESS`. */
25
+ const fs = lazyPeer('@dr.pogodin/react-native-fs', () => {
26
+ // Inside `try`, so Metro bundles an app that leaves this optional peer out.
27
+ try {
28
+ return require('@dr.pogodin/react-native-fs');
29
+ } catch (cause) {
30
+ throw cause;
31
+ }
32
+ });
33
+
34
+ /** Swap the peer. Tests and the demo app's in-memory mode only; `null` restores it. */
35
+ export function setFileSystem(module) {
36
+ fs.override(module ?? undefined);
37
+ }
38
+ export function fileSystem() {
39
+ return fs.require((_peer, cause) => new StorageError(DiagnosticCodes.STORAGE_ACCESS, {
40
+ message: 'filesystem peer is not installed',
41
+ cause
42
+ }));
43
+ }
44
+
45
+ /** Remove a path, treating "already gone" as success (FR-062). */
46
+ export async function removeIfPresent(path) {
47
+ try {
48
+ await fileSystem().unlink(path);
49
+ return true;
50
+ } catch {
51
+ return false;
52
+ }
53
+ }
54
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["lazyPeer","DiagnosticCodes","StorageError","fs","require","cause","setFileSystem","module","override","undefined","fileSystem","_peer","STORAGE_ACCESS","message","removeIfPresent","path","unlink"],"sourceRoot":"../../../src","sources":["platform/fs.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,wBAAwB;AAEjD,SAASC,eAAe,QAAQ,uBAAoB;AACpD,SAASC,YAAY,QAAQ,0BAAuB;;AAepD;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA,MAAMC,EAAE,GAAGH,QAAQ,CAAC,6BAA6B,EAAE,MAAM;EACxD;EACA,IAAI;IACH,OAAOI,OAAO,CAAC,6BAA6B,CAAC;EAC9C,CAAC,CAAC,OAAOC,KAAK,EAAE;IACf,MAAMA,KAAK;EACZ;AACD,CAAC,CAAC;;AAEF;AACA,OAAO,SAASC,aAAaA,CAACC,MAAyB,EAAQ;EAC9DJ,EAAE,CAACK,QAAQ,CAACD,MAAM,IAAIE,SAAS,CAAC;AACjC;AAEA,OAAO,SAASC,UAAUA,CAAA,EAAe;EACxC,OAAOP,EAAE,CAACC,OAAO,CAChB,CAACO,KAAK,EAAEN,KAAK,KACZ,IAAIH,YAAY,CAACD,eAAe,CAACW,cAAc,EAAE;IAChDC,OAAO,EAAE,kCAAkC;IAC3CR;EACD,CAAC,CACH,CAAC;AACF;;AAEA;AACA,OAAO,eAAeS,eAAeA,CAACC,IAAY,EAAoB;EACrE,IAAI;IACH,MAAML,UAAU,CAAC,CAAC,CAACM,MAAM,CAACD,IAAI,CAAC;IAC/B,OAAO,IAAI;EACZ,CAAC,CAAC,MAAM;IACP,OAAO,KAAK;EACb;AACD","ignoreList":[]}