@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,76 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.androidPosture = androidPosture;
7
+ exports.coveragePathFor = coveragePathFor;
8
+ exports.effectivePostureFor = effectivePostureFor;
9
+ exports.isAndroid = isAndroid;
10
+ var _reactNative = require("react-native");
11
+ var _location = require("./location.js");
12
+ /**
13
+ * Android backup posture: verified and reported, never enforced.
14
+ *
15
+ * Android decides backup participation from `android:dataExtractionRules` in
16
+ * the app's manifest. That is build-time and app-owned, and this package
17
+ * authors no native code, so it cannot contribute an entry and cannot change
18
+ * the answer at runtime (research.md R5).
19
+ *
20
+ * What it can do is check the one thing that silently breaks the documented
21
+ * fix: the rule the README tells an app to ship addresses the `file` domain,
22
+ * which is the app's `files/` directory. If the managed root did not land
23
+ * under that directory, the app can ship the XML exactly as documented and
24
+ * still have an unprotected database. That mismatch is detectable here, and
25
+ * an app learning it from this report is the whole point of FR-111 — the
26
+ * alternative is learning it from an incident.
27
+ */
28
+
29
+ function isAndroid() {
30
+ return _reactNative.Platform.OS === 'android';
31
+ }
32
+
33
+ /** The `path` an app's exclusion rule must name for the root it actually got. */
34
+ function coveragePathFor(layout) {
35
+ const root = (0, _location.normalizePath)(layout.root);
36
+ const marker = `/files/`;
37
+ const index = root.indexOf(marker);
38
+ if (index === -1) {
39
+ return null;
40
+ }
41
+ return root.slice(index + marker.length);
42
+ }
43
+ function androidPosture(layout, includeInPlatformBackup) {
44
+ const requested = includeInPlatformBackup ? 'included' : 'excluded';
45
+ const coverage = coveragePathFor(layout);
46
+ if (coverage === null) {
47
+ return {
48
+ requested,
49
+ // Not "excluded" and not "included": the package genuinely does not
50
+ // know, and saying either would be a claim it cannot support.
51
+ observed: 'unknown',
52
+ enforcedBy: 'app-manifest',
53
+ 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.'
54
+ };
55
+ }
56
+ return {
57
+ requested,
58
+ observed: 'unknown',
59
+ enforcedBy: 'app-manifest',
60
+ 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="${_location.MANAGED_ROOT_NAME}/" and that ` + `AndroidManifest.xml references it; the observed posture cannot be verified ` + `from JavaScript.`
61
+ };
62
+ }
63
+
64
+ /**
65
+ * The posture the handle reports (FR-111).
66
+ *
67
+ * Split by platform rather than smoothed over, because a consumer writing a
68
+ * privacy disclosure needs to know which of the two answers it is holding.
69
+ */
70
+ function effectivePostureFor(layout, includeInPlatformBackup, iosPostureFor) {
71
+ if (isAndroid()) {
72
+ return androidPosture(layout, includeInPlatformBackup);
73
+ }
74
+ return iosPostureFor(includeInPlatformBackup);
75
+ }
76
+ //# sourceMappingURL=backup-android-verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_location","isAndroid","Platform","OS","coveragePathFor","layout","root","normalizePath","marker","index","indexOf","slice","length","androidPosture","includeInPlatformBackup","requested","coverage","observed","enforcedBy","warning","MANAGED_ROOT_NAME","effectivePostureFor","iosPostureFor"],"sourceRoot":"../../../src","sources":["platform/backup-android-verify.ts"],"mappings":";;;;;;;;;AAiBA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,SAAA,GAAAD,OAAA;AApBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOO,SAASE,SAASA,CAAA,EAAY;EACpC,OAAOC,qBAAQ,CAACC,EAAE,KAAK,SAAS;AACjC;;AAEA;AACO,SAASC,eAAeA,CAACC,MAAqB,EAAiB;EACrE,MAAMC,IAAI,GAAG,IAAAC,uBAAa,EAACF,MAAM,CAACC,IAAI,CAAC;EACvC,MAAME,MAAM,GAAG,SAAS;EACxB,MAAMC,KAAK,GAAGH,IAAI,CAACI,OAAO,CAACF,MAAM,CAAC;EAClC,IAAIC,KAAK,KAAK,CAAC,CAAC,EAAE;IACjB,OAAO,IAAI;EACZ;EACA,OAAOH,IAAI,CAACK,KAAK,CAACF,KAAK,GAAGD,MAAM,CAACI,MAAM,CAAC;AACzC;AAEO,SAASC,cAAcA,CAC7BR,MAAqB,EACrBS,uBAAgC,EACb;EACnB,MAAMC,SAAS,GAAGD,uBAAuB,GAAG,UAAU,GAAG,UAAU;EACnE,MAAME,QAAQ,GAAGZ,eAAe,CAACC,MAAM,CAAC;EAExC,IAAIW,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,iCAAiCC,2BAAiB,cAAc,GAChE,6EAA6E,GAC7E;EACF,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAClChB,MAAqB,EACrBS,uBAAgC,EAChCQ,aAAqD,EAClC;EACnB,IAAIrB,SAAS,CAAC,CAAC,EAAE;IAChB,OAAOY,cAAc,CAACR,MAAM,EAAES,uBAAuB,CAAC;EACvD;EACA,OAAOQ,aAAa,CAACR,uBAAuB,CAAC;AAC9C","ignoreList":[]}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ensureManagedRoot = ensureManagedRoot;
7
+ exports.iosPosture = iosPosture;
8
+ exports.isIos = isIos;
9
+ var _reactNative = require("react-native");
10
+ var _fs = require("./fs.js");
11
+ /**
12
+ * iOS backup exclusion.
13
+ *
14
+ * `NSURLIsExcludedFromBackupKey` is set on the managed root at creation, and
15
+ * the attribute is inherited by everything beneath it — so one call covers
16
+ * the catalog, every scope database, and every artifact, including ones
17
+ * created years later. Setting it per file would leave a window in which a
18
+ * freshly written artifact is backed up before the attribute lands.
19
+ *
20
+ * This is the half of FR-109 the package can actually enforce. Android is
21
+ * manifest-owned; see backup-android-verify.ts and research.md R5.
22
+ */
23
+
24
+ function isIos() {
25
+ return _reactNative.Platform.OS === 'ios';
26
+ }
27
+
28
+ /**
29
+ * Create the managed root with the exclusion attribute already on it.
30
+ *
31
+ * Idempotent: `mkdir` on an existing directory re-applies the attribute,
32
+ * which matters because an app that flips the posture between launches must
33
+ * get the new one without a reinstall.
34
+ */
35
+ async function ensureManagedRoot(layout, includeInPlatformBackup) {
36
+ await (0, _fs.fileSystem)().mkdir(layout.root, isIos() ? {
37
+ NSURLIsExcludedFromBackupKey: !includeInPlatformBackup
38
+ } : {});
39
+ }
40
+
41
+ /** What the package can state about iOS, where it enforces rather than reports. */
42
+ function iosPosture(includeInPlatformBackup) {
43
+ const requested = includeInPlatformBackup ? 'included' : 'excluded';
44
+ return {
45
+ requested,
46
+ observed: requested,
47
+ enforcedBy: 'package'
48
+ };
49
+ }
50
+ //# sourceMappingURL=backup-ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_fs","isIos","Platform","OS","ensureManagedRoot","layout","includeInPlatformBackup","fileSystem","mkdir","root","NSURLIsExcludedFromBackupKey","iosPosture","requested","observed","enforcedBy"],"sourceRoot":"../../../src","sources":["platform/backup-ios.ts"],"mappings":";;;;;;;;AAaA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,GAAA,GAAAD,OAAA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQO,SAASE,KAAKA,CAAA,EAAY;EAChC,OAAOC,qBAAQ,CAACC,EAAE,KAAK,KAAK;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,iBAAiBA,CACtCC,MAAqB,EACrBC,uBAAgC,EAChB;EAChB,MAAM,IAAAC,cAAU,EAAC,CAAC,CAACC,KAAK,CACvBH,MAAM,CAACI,IAAI,EACXR,KAAK,CAAC,CAAC,GAAG;IAAES,4BAA4B,EAAE,CAACJ;EAAwB,CAAC,GAAG,CAAC,CACzE,CAAC;AACF;;AAEA;AACO,SAASK,UAAUA,CAACL,uBAAgC,EAAoB;EAC9E,MAAMM,SAAS,GAAGN,uBAAuB,GAAG,UAAU,GAAG,UAAU;EACnE,OAAO;IACNM,SAAS;IACTC,QAAQ,EAAED,SAAS;IACnBE,UAAU,EAAE;EACb,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.asciiAt = asciiAt;
7
+ exports.base64ToBytes = base64ToBytes;
8
+ exports.bytesToBase64 = bytesToBase64;
9
+ exports.concatBytes = concatBytes;
10
+ exports.host = void 0;
11
+ exports.utf8Bytes = utf8Bytes;
12
+ exports.utf8String = utf8String;
13
+ /**
14
+ * Byte handling without Node's `Buffer`.
15
+ *
16
+ * Hermes has no global `Buffer`, and `react-native-quick-crypto` installs one
17
+ * only when the app calls its `install()` — which nothing in this package or its
18
+ * documentation asked for. Until 0.2.0 attachment writes and reads used the
19
+ * global anyway, so on a device every attachment operation threw. Everything
20
+ * here is plain `Uint8Array` and a self-contained base64 codec, identical on
21
+ * Hermes and in Node.
22
+ */
23
+
24
+ const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
25
+ const LOOKUP = (() => {
26
+ const table = new Int16Array(128).fill(-1);
27
+ for (let index = 0; index < ALPHABET.length; index += 1) {
28
+ table[ALPHABET.charCodeAt(index)] = index;
29
+ }
30
+ // The URL-safe variants decode too, since some file APIs return them.
31
+ table['-'.charCodeAt(0)] = 62;
32
+ table['_'.charCodeAt(0)] = 63;
33
+ return table;
34
+ })();
35
+
36
+ /**
37
+ * Codecs Hermes and Node provide but React Native's type declarations omit.
38
+ * Read through this view so the package type-checks without DOM or Node types.
39
+ */
40
+
41
+ const host = exports.host = globalThis;
42
+
43
+ /* eslint-disable no-bitwise -- base64 is bit packing; there is no clearer way to write it. */
44
+
45
+ /** Characters per `String.fromCharCode` call; large spreads overflow the stack. */
46
+ const CHUNK = 0x8000;
47
+ function base64ToBytes(base64) {
48
+ if (host.atob) {
49
+ let binary;
50
+ try {
51
+ binary = host.atob(base64.replace(/-/g, '+').replace(/_/g, '/'));
52
+ } catch {
53
+ // atob is strict where Buffer was lenient; fall through to the
54
+ // tolerant decoder rather than turn stray characters into a crash.
55
+ }
56
+ if (binary !== undefined) {
57
+ const bytes = new Uint8Array(binary.length);
58
+ for (let index = 0; index < binary.length; index += 1) {
59
+ bytes[index] = binary.charCodeAt(index);
60
+ }
61
+ return bytes;
62
+ }
63
+ }
64
+ // Decode directly, skipping padding and anything outside the alphabet.
65
+ const bytes = new Uint8Array(Math.ceil(base64.length * 3 / 4));
66
+ let out = 0;
67
+ let buffer = 0;
68
+ let bits = 0;
69
+ for (let index = 0; index < base64.length; index += 1) {
70
+ const code = base64.charCodeAt(index);
71
+ const value = code < 128 ? LOOKUP[code] : -1;
72
+ if (value < 0) continue;
73
+ buffer = buffer << 6 | value;
74
+ bits += 6;
75
+ if (bits >= 8) {
76
+ bits -= 8;
77
+ bytes[out++] = buffer >> bits & 0xff;
78
+ }
79
+ }
80
+ return bytes.subarray(0, out);
81
+ }
82
+ function bytesToBase64(bytes) {
83
+ if (host.btoa) {
84
+ const parts = [];
85
+ for (let index = 0; index < bytes.length; index += CHUNK) {
86
+ parts.push(String.fromCharCode(...bytes.subarray(index, index + CHUNK)));
87
+ }
88
+ return host.btoa(parts.join(''));
89
+ }
90
+ const parts = [];
91
+ for (let start = 0; start < bytes.length; start += CHUNK * 3) {
92
+ let piece = '';
93
+ const end = Math.min(bytes.length, start + CHUNK * 3);
94
+ let index = start;
95
+ for (; index + 2 < end; index += 3) {
96
+ const triple = bytes[index] << 16 | bytes[index + 1] << 8 | bytes[index + 2];
97
+ piece += ALPHABET[triple >> 18] + ALPHABET[triple >> 12 & 63] + ALPHABET[triple >> 6 & 63] + ALPHABET[triple & 63];
98
+ }
99
+ const remaining = end - index;
100
+ if (remaining === 1) {
101
+ const value = bytes[index];
102
+ piece += `${ALPHABET[value >> 2]}${ALPHABET[(value & 3) << 4]}==`;
103
+ } else if (remaining === 2) {
104
+ const value = bytes[index] << 8 | bytes[index + 1];
105
+ piece += `${ALPHABET[value >> 10]}${ALPHABET[value >> 4 & 63]}${ALPHABET[(value & 15) << 2]}=`;
106
+ }
107
+ parts.push(piece);
108
+ }
109
+ return parts.join('');
110
+ }
111
+
112
+ /** UTF-8 encoding. `TextEncoder` is in Hermes and Node; the loop is the fallback. */
113
+ function utf8Bytes(value) {
114
+ if (host.TextEncoder) {
115
+ return new host.TextEncoder().encode(value);
116
+ }
117
+ const encoded = unescape(encodeURIComponent(value));
118
+ const bytes = new Uint8Array(encoded.length);
119
+ for (let index = 0; index < encoded.length; index += 1) {
120
+ bytes[index] = encoded.charCodeAt(index);
121
+ }
122
+ return bytes;
123
+ }
124
+
125
+ /** UTF-8 decoding, the inverse of `utf8Bytes`. */
126
+ function utf8String(bytes) {
127
+ if (host.TextDecoder) {
128
+ return new host.TextDecoder().decode(bytes);
129
+ }
130
+ let binary = '';
131
+ for (const byte of bytes) {
132
+ binary += String.fromCharCode(byte);
133
+ }
134
+ return decodeURIComponent(escape(binary));
135
+ }
136
+
137
+ /* eslint-enable no-bitwise */
138
+
139
+ function concatBytes(parts) {
140
+ const total = parts.reduce((sum, part) => sum + part.length, 0);
141
+ const joined = new Uint8Array(total);
142
+ let offset = 0;
143
+ for (const part of parts) {
144
+ joined.set(part, offset);
145
+ offset += part.length;
146
+ }
147
+ return joined;
148
+ }
149
+
150
+ /** The ASCII text of `length` bytes from `start`, for magic numbers. */
151
+ function asciiAt(bytes, start, length) {
152
+ let text = '';
153
+ for (let index = start; index < start + length && index < bytes.length; index += 1) {
154
+ text += String.fromCharCode(bytes[index]);
155
+ }
156
+ return text;
157
+ }
158
+ //# sourceMappingURL=bytes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ALPHABET","LOOKUP","table","Int16Array","fill","index","length","charCodeAt","host","exports","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,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGL,QAAQ,CAACM,MAAM,EAAED,KAAK,IAAI,CAAC,EAAE;IACxDH,KAAK,CAACF,QAAQ,CAACO,UAAU,CAACF,KAAK,CAAC,CAAC,GAAGA,KAAK;EAC1C;EACA;EACAH,KAAK,CAAC,GAAG,CAACK,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;EAC7BL,KAAK,CAAC,GAAG,CAACK,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;EAC7B,OAAOL,KAAK;AACb,CAAC,EAAE,CAAC;;AAEJ;AACA;AACA;AACA;;AAQO,MAAMM,IAAI,GAAAC,OAAA,CAAAD,IAAA,GAAGE,UAAmC;;AAEvD;;AAEA;AACA,MAAMC,KAAK,GAAG,MAAM;AAEb,SAASC,aAAaA,CAACC,MAAc,EAAc;EACzD,IAAIL,IAAI,CAACM,IAAI,EAAE;IACd,IAAIC,MAA0B;IAC9B,IAAI;MACHA,MAAM,GAAGP,IAAI,CAACM,IAAI,CAACD,MAAM,CAACG,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAACA,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACjE,CAAC,CAAC,MAAM;MACP;MACA;IAAA;IAED,IAAID,MA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Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.fileSystem = fileSystem;
7
+ exports.removeIfPresent = removeIfPresent;
8
+ exports.setFileSystem = setFileSystem;
9
+ var _rnCore = require("@chipmobilesdk/rn-core");
10
+ var _errors = require("../contract/errors.js");
11
+ var _errors2 = require("../diagnostics/errors.js");
12
+ /**
13
+ * The filesystem peer, behind one lazy accessor.
14
+ *
15
+ * Required lazily for the same reason the engine is: a consuming app that
16
+ * only ever runs the in-memory adapter in tests must not have to install a
17
+ * native module to import this package. Confining the require to `platform/`
18
+ * also keeps the native surface four directories wide, which is the layering
19
+ * rule the ESLint config enforces.
20
+ */
21
+
22
+ /**
23
+ * Only what the package actually uses. The peer's upload and download
24
+ * helpers are deliberately absent from this type: the package must never
25
+ * make a network request (FR-084, SC-016), and a surface that cannot express
26
+ * one is a stronger guarantee than a rule that says not to.
27
+ */
28
+
29
+ /** Loaded on first use (rn-core's lazy peer); a missing peer is `STORAGE_ACCESS`. */
30
+ const fs = (0, _rnCore.lazyPeer)('@dr.pogodin/react-native-fs', () => {
31
+ // Inside `try`, so Metro bundles an app that leaves this optional peer out.
32
+ try {
33
+ return require('@dr.pogodin/react-native-fs');
34
+ } catch (cause) {
35
+ throw cause;
36
+ }
37
+ });
38
+
39
+ /** Swap the peer. Tests and the demo app's in-memory mode only; `null` restores it. */
40
+ function setFileSystem(module) {
41
+ fs.override(module ?? undefined);
42
+ }
43
+ function fileSystem() {
44
+ return fs.require((_peer, cause) => new _errors2.StorageError(_errors.DiagnosticCodes.STORAGE_ACCESS, {
45
+ message: 'filesystem peer is not installed',
46
+ cause
47
+ }));
48
+ }
49
+
50
+ /** Remove a path, treating "already gone" as success (FR-062). */
51
+ async function removeIfPresent(path) {
52
+ try {
53
+ await fileSystem().unlink(path);
54
+ return true;
55
+ } catch {
56
+ return false;
57
+ }
58
+ }
59
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_rnCore","require","_errors","_errors2","fs","lazyPeer","cause","setFileSystem","module","override","undefined","fileSystem","_peer","StorageError","DiagnosticCodes","STORAGE_ACCESS","message","removeIfPresent","path","unlink"],"sourceRoot":"../../../src","sources":["platform/fs.ts"],"mappings":";;;;;;;;AAUA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA,MAAMG,EAAE,GAAG,IAAAC,gBAAQ,EAAC,6BAA6B,EAAE,MAAM;EACxD;EACA,IAAI;IACH,OAAOJ,OAAO,CAAC,6BAA6B,CAAC;EAC9C,CAAC,CAAC,OAAOK,KAAK,EAAE;IACf,MAAMA,KAAK;EACZ;AACD,CAAC,CAAC;;AAEF;AACO,SAASC,aAAaA,CAACC,MAAyB,EAAQ;EAC9DJ,EAAE,CAACK,QAAQ,CAACD,MAAM,IAAIE,SAAS,CAAC;AACjC;AAEO,SAASC,UAAUA,CAAA,EAAe;EACxC,OAAOP,EAAE,CAACH,OAAO,CAChB,CAACW,KAAK,EAAEN,KAAK,KACZ,IAAIO,qBAAY,CAACC,uBAAe,CAACC,cAAc,EAAE;IAChDC,OAAO,EAAE,kCAAkC;IAC3CV;EACD,CAAC,CACH,CAAC;AACF;;AAEA;AACO,eAAeW,eAAeA,CAACC,IAAY,EAAoB;EACrE,IAAI;IACH,MAAMP,UAAU,CAAC,CAAC,CAACQ,MAAM,CAACD,IAAI,CAAC;IAC/B,OAAO,IAAI;EACZ,CAAC,CAAC,MAAM;IACP,OAAO,KAAK;EACb;AACD","ignoreList":[]}
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SCOPES_DIR = exports.MANAGED_ROOT_NAME = exports.DATA_FILE = exports.CATALOG_FILE = exports.ARTIFACTS_DIR = void 0;
7
+ exports.assertValidAttachmentId = assertValidAttachmentId;
8
+ exports.assertWithinManagedArea = assertWithinManagedArea;
9
+ exports.createLayout = createLayout;
10
+ exports.layoutFor = layoutFor;
11
+ exports.normalizePath = normalizePath;
12
+ var _errors = require("../contract/errors.js");
13
+ var _errors2 = require("../diagnostics/errors.js");
14
+ var _fs = require("./fs.js");
15
+ /**
16
+ * The managed storage area, and the single guard every filesystem call routes
17
+ * through.
18
+ *
19
+ * POL-011(b) flags media-and-files as a risk because this package deletes
20
+ * files from disk on cascade. The mitigation is that there is exactly one
21
+ * function that turns a caller's intent into a path, and it refuses anything
22
+ * outside the root. One choke point is what makes SC-013a's filesystem
23
+ * tracing pass reliably rather than usually.
24
+ */
25
+
26
+ const MANAGED_ROOT_NAME = exports.MANAGED_ROOT_NAME = 'chipmobilesdk-localdb';
27
+ const CATALOG_FILE = exports.CATALOG_FILE = 'catalog.db';
28
+ const SCOPES_DIR = exports.SCOPES_DIR = 'scopes';
29
+ const DATA_FILE = exports.DATA_FILE = 'data.db';
30
+ const ARTIFACTS_DIR = exports.ARTIFACTS_DIR = 'artifacts';
31
+
32
+ /** Normalize separators and collapse redundant segments. No `..` survives. */
33
+ function normalizePath(path) {
34
+ const unified = path.replace(/\\/g, '/');
35
+ const segments = [];
36
+ for (const segment of unified.split('/')) {
37
+ if (segment === '' || segment === '.') {
38
+ continue;
39
+ }
40
+ if (segment === '..') {
41
+ segments.pop();
42
+ continue;
43
+ }
44
+ segments.push(segment);
45
+ }
46
+ const prefix = unified.startsWith('/') ? '/' : '';
47
+ return prefix + segments.join('/');
48
+ }
49
+ const SCOPE_KEY = /^[0-9a-f]{64}$/;
50
+ const ARTIFACT_ID = /^[A-Za-z0-9._-]{1,128}$/;
51
+ // `.` and `..` are made entirely of permitted characters and are the two that
52
+ // matter: `artifacts/..` resolves to the scope directory itself, still inside
53
+ // the managed root, so the boundary guard would wave it through and a cascade
54
+ // would unlink the whole scope. A leading dot is refused with them, since no
55
+ // attachment id needs one and hidden files are the package's own.
56
+ const DOT_PREFIXED = /^\./;
57
+
58
+ /**
59
+ * An attachment id must be a safe single path segment.
60
+ *
61
+ * Shared by both adapters rather than left to the one that touches a
62
+ * filesystem. The in-memory adapter has no paths to escape, but a consumer
63
+ * whose tests accept `../../etc/passwd` and whose device build refuses it has
64
+ * a test suite that stops predicting the device — which is the one thing the
65
+ * adapter exists to avoid (FR-096).
66
+ */
67
+ function assertValidAttachmentId(attachmentId) {
68
+ if (!ARTIFACT_ID.test(attachmentId) || DOT_PREFIXED.test(attachmentId)) {
69
+ (0, _errors2.raise)(_errors.DiagnosticCodes.ATTACHMENT_OUT_OF_BOUNDS, {
70
+ message: 'attachment id is not a valid path segment'
71
+ });
72
+ }
73
+ }
74
+ function createLayout(documentDirectory, databaseName) {
75
+ const root = normalizePath(`${documentDirectory}/${MANAGED_ROOT_NAME}/${databaseName}`);
76
+ const scopePath = scopeKey => {
77
+ // The scope key is our own SHA-256 output. Validating its shape here
78
+ // means a caller cannot smuggle a traversal through it even if some
79
+ // future path reaches this function with unvalidated input.
80
+ if (!SCOPE_KEY.test(scopeKey)) {
81
+ (0, _errors2.raise)(_errors.DiagnosticCodes.ATTACHMENT_OUT_OF_BOUNDS, {
82
+ message: 'scope key is not a valid digest'
83
+ });
84
+ }
85
+ return `${root}/${SCOPES_DIR}/${scopeKey}`;
86
+ };
87
+ return {
88
+ root,
89
+ catalogPath: `${root}/${CATALOG_FILE}`,
90
+ scopePath,
91
+ scopeDataPath: scopeKey => `${scopePath(scopeKey)}/${DATA_FILE}`,
92
+ scopeArtifactsPath: scopeKey => `${scopePath(scopeKey)}/${ARTIFACTS_DIR}`,
93
+ artifactPath: (scopeKey, attachmentId) => {
94
+ assertValidAttachmentId(attachmentId);
95
+ return `${scopePath(scopeKey)}/${ARTIFACTS_DIR}/${attachmentId}`;
96
+ }
97
+ };
98
+ }
99
+
100
+ /**
101
+ * The layout for one logical database, rooted at the app's private documents
102
+ * directory.
103
+ *
104
+ * Resolved lazily through the filesystem peer rather than captured at module
105
+ * load, so importing this package does not require the peer to be installed —
106
+ * a consumer running only the in-memory adapter never reaches this function.
107
+ */
108
+ function layoutFor(databaseName) {
109
+ return createLayout((0, _fs.fileSystem)().DocumentDirectoryPath, databaseName);
110
+ }
111
+
112
+ /**
113
+ * The guard. Every read, write, and delete passes through this, and anything
114
+ * resolving outside the managed root is refused before it reaches the
115
+ * filesystem (FR-073, FR-073f).
116
+ */
117
+ function assertWithinManagedArea(layout, candidate) {
118
+ const normalized = normalizePath(candidate);
119
+ const root = normalizePath(layout.root);
120
+ if (normalized !== root && !normalized.startsWith(`${root}/`)) {
121
+ (0, _errors2.raise)(_errors.DiagnosticCodes.ATTACHMENT_OUT_OF_BOUNDS, {
122
+ // The offending path is NOT reported: it may contain a scope
123
+ // component or a user-chosen filename.
124
+ message: 'path resolves outside the managed storage area'
125
+ });
126
+ }
127
+ return normalized;
128
+ }
129
+ //# sourceMappingURL=location.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_errors","require","_errors2","_fs","MANAGED_ROOT_NAME","exports","CATALOG_FILE","SCOPES_DIR","DATA_FILE","ARTIFACTS_DIR","normalizePath","path","unified","replace","segments","segment","split","pop","push","prefix","startsWith","join","SCOPE_KEY","ARTIFACT_ID","DOT_PREFIXED","assertValidAttachmentId","attachmentId","test","raise","DiagnosticCodes","ATTACHMENT_OUT_OF_BOUNDS","message","createLayout","documentDirectory","databaseName","root","scopePath","scopeKey","catalogPath","scopeDataPath","scopeArtifactsPath","artifactPath","layoutFor","fileSystem","DocumentDirectoryPath","assertWithinManagedArea","layout","candidate","normalized"],"sourceRoot":"../../../src","sources":["platform/location.ts"],"mappings":";;;;;;;;;;;AAWA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,GAAA,GAAAF,OAAA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMO,MAAMG,iBAAiB,GAAAC,OAA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,CAAC;EAC3C,MAAMZ,IAAI,GAAGzB,aAAa,CAACoC,MAAM,CAACX,IAAI,CAAC;EACvC,IAAIa,UAAU,KAAKb,IAAI,IAAI,CAACa,UAAU,CAAC5B,UAAU,CAAC,GAAGe,IAAI,GAAG,CAAC,EAAE;IAC9D,IAAAP,cAAK,EAACC,uBAAe,CAACC,wBAAwB,EAAE;MAC/C;MACA;MACAC,OAAO,EAAE;IACV,CAAC,CAAC;EACH;EACA,OAAOiB,UAAU;AAClB","ignoreList":[]}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.assertArtifactWithinBudget = assertArtifactWithinBudget;
7
+ exports.assertBatchWithinBudget = assertBatchWithinBudget;
8
+ exports.assertRecordWithinBudget = assertRecordWithinBudget;
9
+ exports.serializedSize = serializedSize;
10
+ exports.utf8Length = utf8Length;
11
+ var _config = require("../contract/config.js");
12
+ var _errors = require("../contract/errors.js");
13
+ var _errors2 = require("../diagnostics/errors.js");
14
+ /**
15
+ * Budget enforcement.
16
+ *
17
+ * Per-record size, page size, and batch size are HARD limits reported through
18
+ * typed errors (FR-088a). The rest are soft: exceeding them must not crash,
19
+ * hang, or drop data silently, and the degraded behavior is documented.
20
+ */
21
+
22
+ /**
23
+ * UTF-8 length of a string, counted rather than encoded: measuring a 256 KB
24
+ * record used to allocate a 256 KB byte array just to read its length.
25
+ */
26
+ function utf8Length(value) {
27
+ let bytes = 0;
28
+ for (let index = 0; index < value.length; index += 1) {
29
+ const unit = value.charCodeAt(index);
30
+ if (unit < 0x80) {
31
+ bytes += 1;
32
+ } else if (unit < 0x800) {
33
+ bytes += 2;
34
+ } else if (unit >= 0xd800 && unit <= 0xdbff && index + 1 < value.length) {
35
+ // A surrogate pair is one four-byte code point.
36
+ bytes += 4;
37
+ index += 1;
38
+ } else {
39
+ bytes += 3;
40
+ }
41
+ }
42
+ return bytes;
43
+ }
44
+
45
+ /** UTF-8 byte length of the serialized payload — what actually hits disk. */
46
+ function serializedSize(data) {
47
+ return utf8Length(JSON.stringify(data ?? {}));
48
+ }
49
+
50
+ /**
51
+ * Checks the size budget and returns the serialized payload, so the write that
52
+ * follows stores this string instead of serializing the record a second time.
53
+ */
54
+ function assertRecordWithinBudget(collection, data) {
55
+ const payload = JSON.stringify(data ?? {});
56
+ const size = utf8Length(payload);
57
+ if (size > _config.Budgets.MAX_RECORD_BYTES) {
58
+ // Truncating would be silent data loss; failing opaquely would leave
59
+ // the consumer guessing. The size and the limit are both safe to
60
+ // report — neither can carry a field value.
61
+ (0, _errors2.raise)(_errors.DiagnosticCodes.RECORD_TOO_LARGE, {
62
+ message: 'record exceeds the per-record size budget',
63
+ detail: {
64
+ collection,
65
+ sizeBytes: size,
66
+ limitBytes: _config.Budgets.MAX_RECORD_BYTES
67
+ }
68
+ });
69
+ }
70
+ return payload;
71
+ }
72
+ function assertBatchWithinBudget(count) {
73
+ if (count > _config.Budgets.MAX_BATCH_OPERATIONS) {
74
+ (0, _errors2.raise)(_errors.DiagnosticCodes.BATCH_TOO_LARGE, {
75
+ message: 'batch exceeds the operation budget',
76
+ detail: {
77
+ count,
78
+ limit: _config.Budgets.MAX_BATCH_OPERATIONS
79
+ }
80
+ });
81
+ }
82
+ }
83
+ function assertArtifactWithinBudget(id, size) {
84
+ if (size > _config.Budgets.MAX_ARTIFACT_BYTES) {
85
+ (0, _errors2.raise)(_errors.DiagnosticCodes.ATTACHMENT_WRITE_FAILED, {
86
+ message: 'artifact exceeds the size budget',
87
+ detail: {
88
+ attachmentId: id,
89
+ sizeBytes: size,
90
+ limitBytes: _config.Budgets.MAX_ARTIFACT_BYTES
91
+ }
92
+ });
93
+ }
94
+ }
95
+ //# sourceMappingURL=budgets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_config","require","_errors","_errors2","utf8Length","value","bytes","index","length","unit","charCodeAt","serializedSize","data","JSON","stringify","assertRecordWithinBudget","collection","payload","size","Budgets","MAX_RECORD_BYTES","raise","DiagnosticCodes","RECORD_TOO_LARGE","message","detail","sizeBytes","limitBytes","assertBatchWithinBudget","count","MAX_BATCH_OPERATIONS","BATCH_TOO_LARGE","limit","assertArtifactWithinBudget","id","MAX_ARTIFACT_BYTES","ATTACHMENT_WRITE_FAILED","attachmentId"],"sourceRoot":"../../../src","sources":["query/budgets.ts"],"mappings":";;;;;;;;;;AAQA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAXA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACO,SAASG,UAAUA,CAACC,KAAa,EAAU;EACjD,IAAIC,KAAK,GAAG,CAAC;EACb,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGF,KAAK,CAACG,MAAM,EAAED,KAAK,IAAI,CAAC,EAAE;IACrD,MAAME,IAAI,GAAGJ,KAAK,CAACK,UAAU,CAACH,KAAK,CAAC;IACpC,IAAIE,IAAI,GAAG,IAAI,EAAE;MAChBH,KAAK,IAAI,CAAC;IACX,CAAC,MAAM,IAAIG,IAAI,GAAG,KAAK,EAAE;MACxBH,KAAK,IAAI,CAAC;IACX,CAAC,MAAM,IAAIG,IAAI,IAAI,MAAM,IAAIA,IAAI,IAAI,MAAM,IAAIF,KAAK,GAAG,CAAC,GAAGF,KAAK,CAACG,MAAM,EAAE;MACxE;MACAF,KAAK,IAAI,CAAC;MACVC,KAAK,IAAI,CAAC;IACX,CAAC,MAAM;MACND,KAAK,IAAI,CAAC;IACX;EACD;EACA,OAAOA,KAAK;AACb;;AAEA;AACO,SAASK,cAAcA,CAACC,IAAwB,EAAU;EAChE,OAAOR,UAAU,CAACS,IAAI,CAACC,SAAS,CAACF,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;AAC9C;;AAEA;AACA;AACA;AACA;AACO,SAASG,wBAAwBA,CAACC,UAAkB,EAAEJ,IAAwB,EAAU;EAC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