@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,56 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Per-artifact key derivation.
5
+ *
6
+ * The database key is handed straight to SQLCipher. Using that same material
7
+ * as the AES-GCM key for artifacts would mean the two keystreams share a
8
+ * secret, so a weakness in either one — a nonce collision in the artifact
9
+ * format, a padding oracle in the database format — becomes a weakness in
10
+ * both. HKDF costs one hash and removes the coupling entirely (research.md
11
+ * R4).
12
+ *
13
+ * The artifact id is the HKDF `info`, so two artifacts under the same
14
+ * database key derive different subkeys. That is what makes the deterministic
15
+ * nonce scheme safe: a nonce is only ever reused with a different key.
16
+ */
17
+
18
+ import { cipherModule } from "./provider.js";
19
+ import { utf8Bytes } from "../platform/bytes.js";
20
+ const HKDF_DIGEST = 'sha256';
21
+ const KEY_BYTES = 32;
22
+ const NONCE_BYTES = 12;
23
+ function bytesOf(value) {
24
+ return utf8Bytes(value);
25
+ }
26
+
27
+ /** 32 bytes, one artifact, one database key. */
28
+ export function deriveArtifactKey(databaseKey, scopeKey, attachmentId) {
29
+ const derived = cipherModule().hkdfSync(HKDF_DIGEST, bytesOf(databaseKey),
30
+ // The scope digest as salt keeps two scopes holding an artifact under
31
+ // the same id from deriving the same subkey.
32
+ bytesOf(scopeKey), bytesOf(`chipmobilesdk-localdb/artifact/${attachmentId}`), KEY_BYTES);
33
+ return new Uint8Array(derived);
34
+ }
35
+
36
+ /**
37
+ * Deterministic 12-byte nonce from the chunk index.
38
+ *
39
+ * Deterministic rather than random because a random nonce would have to be
40
+ * stored per chunk, and because uniqueness is already guaranteed one level
41
+ * up: the key is unique per artifact, so an index that is unique within the
42
+ * artifact is unique under that key. The remaining four bytes are a fixed
43
+ * domain tag rather than padding, so a nonce from this scheme can never
44
+ * collide with one from a future scheme that uses the same counter space.
45
+ */
46
+ export function nonceForChunk(index) {
47
+ const nonce = new Uint8Array(NONCE_BYTES);
48
+ const view = new DataView(nonce.buffer);
49
+ view.setUint32(0, 0x4c444231, false); // "LDB1"
50
+ // Split across two 32-bit writes rather than a BigInt: chunk indexes stay
51
+ // far inside the safe integer range, and Hermes is happier without one.
52
+ view.setUint32(4, Math.floor(index / 0x100000000), false);
53
+ view.setUint32(8, index % 0x100000000, false);
54
+ return nonce;
55
+ }
56
+ //# sourceMappingURL=derive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["cipherModule","utf8Bytes","HKDF_DIGEST","KEY_BYTES","NONCE_BYTES","bytesOf","value","deriveArtifactKey","databaseKey","scopeKey","attachmentId","derived","hkdfSync","Uint8Array","nonceForChunk","index","nonce","view","DataView","buffer","setUint32","Math","floor"],"sourceRoot":"../../../src","sources":["crypto/derive.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,YAAY,QAAQ,eAAY;AACzC,SAASC,SAAS,QAAQ,sBAAmB;AAE7C,MAAMC,WAAW,GAAG,QAAQ;AAC5B,MAAMC,SAAS,GAAG,EAAE;AACpB,MAAMC,WAAW,GAAG,EAAE;AAEtB,SAASC,OAAOA,CAACC,KAAa,EAAc;EAC3C,OAAOL,SAAS,CAACK,KAAK,CAAC;AACxB;;AAEA;AACA,OAAO,SAASC,iBAAiBA,CAChCC,WAAmB,EACnBC,QAAgB,EAChBC,YAAoB,EACP;EACb,MAAMC,OAAO,GAAGX,YAAY,CAAC,CAAC,CAACY,QAAQ,CACtCV,WAAW,EACXG,OAAO,CAACG,WAAW,CAAC;EACpB;EACA;EACAH,OAAO,CAACI,QAAQ,CAAC,EACjBJ,OAAO,CAAC,kCAAkCK,YAAY,EAAE,CAAC,EACzDP,SACD,CAAC;EACD,OAAO,IAAIU,UAAU,CAACF,OAAO,CAAC;AAC/B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,aAAaA,CAACC,KAAa,EAAc;EACxD,MAAMC,KAAK,GAAG,IAAIH,UAAU,CAACT,WAAW,CAAC;EACzC,MAAMa,IAAI,GAAG,IAAIC,QAAQ,CAACF,KAAK,CAACG,MAAM,CAAC;EACvCF,IAAI,CAACG,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;EACtC;EACA;EACAH,IAAI,CAACG,SAAS,CAAC,CAAC,EAAEC,IAAI,CAACC,KAAK,CAACP,KAAK,GAAG,WAAW,CAAC,EAAE,KAAK,CAAC;EACzDE,IAAI,CAACG,SAAS,CAAC,CAAC,EAAEL,KAAK,GAAG,WAAW,EAAE,KAAK,CAAC;EAC7C,OAAOC,KAAK;AACb","ignoreList":[]}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Key acquisition, scoped to one handle's lifetime.
5
+ *
6
+ * The package never generates, derives from its own material, persists,
7
+ * caches beyond the handle, transmits, or returns a key (FR-098). What it
8
+ * does is ask the app for one at open and hold it exactly as long as the
9
+ * connection that needs it — which is also why no keychain library appears in
10
+ * this package's dependencies (LIB-004).
11
+ *
12
+ * The provider receives the resolved scope, so an app can key per identity.
13
+ * That is not a convenience: it is what makes destroying one identity's key a
14
+ * meaningful answer to a deletion request, rather than a gesture that leaves
15
+ * the data readable under a shared key (FR-104).
16
+ */
17
+
18
+ import { DiagnosticCodes } from "../contract/errors.js";
19
+ import { raise } from "../diagnostics/errors.js";
20
+ import { throwIfFaulted } from "../diagnostics/faults.js";
21
+
22
+ /**
23
+ * A key with an explicit end of life.
24
+ *
25
+ * Handing the string around directly would leave copies wherever it was
26
+ * passed. A handle that can be released gives the connection one place to
27
+ * drop it, and gives `key-hygiene.test.ts` something to assert against.
28
+ */
29
+
30
+ export async function acquireKey(encryption, scope) {
31
+ let key;
32
+ throwIfFaulted('keyProvider');
33
+ try {
34
+ key = await encryption.keyProvider.getKey(scope);
35
+ } catch (error) {
36
+ // A locked device is an expected condition, not a bug (FR-102), which
37
+ // is why this code is retryable and distinct from an invalid key.
38
+ raise(DiagnosticCodes.KEY_PROVIDER_FAILED, {
39
+ message: 'key provider failed',
40
+ cause: error
41
+ });
42
+ }
43
+ if (typeof key !== 'string' || key.length === 0) {
44
+ raise(DiagnosticCodes.KEY_INVALID, {
45
+ message: 'key provider returned no usable key'
46
+ });
47
+ }
48
+ let released = false;
49
+ return {
50
+ value() {
51
+ if (released || key === null) {
52
+ raise(DiagnosticCodes.KEY_INVALID, {
53
+ message: 'key material has already been released'
54
+ });
55
+ }
56
+ return key;
57
+ },
58
+ release() {
59
+ released = true;
60
+ key = null;
61
+ },
62
+ get released() {
63
+ return released;
64
+ }
65
+ };
66
+ }
67
+ //# sourceMappingURL=key-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DiagnosticCodes","raise","throwIfFaulted","acquireKey","encryption","scope","key","keyProvider","getKey","error","KEY_PROVIDER_FAILED","message","cause","length","KEY_INVALID","released","value","release"],"sourceRoot":"../../../src","sources":["crypto/key-provider.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAAQ,uBAAoB;AAEpD,SAASC,KAAK,QAAQ,0BAAuB;AAC7C,SAASC,cAAc,QAAQ,0BAAuB;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,OAAO,eAAeC,UAAUA,CAC/BC,UAA4B,EAC5BC,KAAoB,EACC;EACrB,IAAIC,GAAkB;EAEtBJ,cAAc,CAAC,aAAa,CAAC;EAE7B,IAAI;IACHI,GAAG,GAAG,MAAMF,UAAU,CAACG,WAAW,CAACC,MAAM,CAACH,KAAK,CAAC;EACjD,CAAC,CAAC,OAAOI,KAAK,EAAE;IACf;IACA;IACAR,KAAK,CAACD,eAAe,CAACU,mBAAmB,EAAE;MAC1CC,OAAO,EAAE,qBAAqB;MAC9BC,KAAK,EAAEH;IACR,CAAC,CAAC;EACH;EAEA,IAAI,OAAOH,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACO,MAAM,KAAK,CAAC,EAAE;IAChDZ,KAAK,CAACD,eAAe,CAACc,WAAW,EAAE;MAClCH,OAAO,EAAE;IACV,CAAC,CAAC;EACH;EAEA,IAAII,QAAQ,GAAG,KAAK;EACpB,OAAO;IACNC,KAAKA,CAAA,EAAW;MACf,IAAID,QAAQ,IAAIT,GAAG,KAAK,IAAI,EAAE;QAC7BL,KAAK,CAACD,eAAe,CAACc,WAAW,EAAE;UAClCH,OAAO,EAAE;QACV,CAAC,CAAC;MACH;MACA,OAAOL,GAAG;IACX,CAAC;IACDW,OAAOA,CAAA,EAAS;MACfF,QAAQ,GAAG,IAAI;MACfT,GAAG,GAAG,IAAI;IACX,CAAC;IACD,IAAIS,QAAQA,CAAA,EAAY;MACvB,OAAOA,QAAQ;IAChB;EACD,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The cipher peer, behind one lazy accessor.
5
+ *
6
+ * Marked optional in `peerDependenciesMeta`: an app that never enables
7
+ * encryption should not have to install a native crypto module. That makes
8
+ * "the peer is absent" a supported state rather than a broken install, so it
9
+ * reports `ENCRYPTION_UNAVAILABLE` — the same code as a missing SQLCipher
10
+ * build flag, because from the app's side it is the same problem: encryption
11
+ * was asked for and cannot be delivered (research.md R1a).
12
+ */
13
+
14
+ import { lazyPeer } from '@chipmobilesdk/rn-core';
15
+ import { DiagnosticCodes } from "../contract/errors.js";
16
+ import { StorageError } from "../diagnostics/errors.js";
17
+
18
+ /**
19
+ * The two things this package asks of a cipher: AES-256-GCM for artifacts, and
20
+ * HKDF to derive each artifact's subkey. Hashing is not among them — the scope
21
+ * digest is SHA-256 in plain TypeScript (`scope/hash.ts`), because it runs on
22
+ * every scope resolution including the ones that never open an encrypted
23
+ * database, where a native module may not be installed at all (WS4-08).
24
+ */
25
+
26
+ /** Loaded on first use (rn-core's lazy peer); optional, so absence is a normal answer. */
27
+ const cipher = lazyPeer('react-native-quick-crypto', () => {
28
+ // Inside `try`, so Metro bundles an app that leaves this optional peer out.
29
+ try {
30
+ return require('react-native-quick-crypto');
31
+ } catch (cause) {
32
+ throw cause;
33
+ }
34
+ });
35
+
36
+ /** Swap the module. Tests only; `null` goes back to the real one. */
37
+ export function setCipherModule(module) {
38
+ cipher.override(module ?? undefined);
39
+ }
40
+ export function isCipherAvailable() {
41
+ return cipher.isAvailable();
42
+ }
43
+ export function cipherModule() {
44
+ return cipher.require((_peer, cause) => new StorageError(DiagnosticCodes.ENCRYPTION_UNAVAILABLE, {
45
+ message: 'cipher peer is not installed',
46
+ cause
47
+ }));
48
+ }
49
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["lazyPeer","DiagnosticCodes","StorageError","cipher","require","cause","setCipherModule","module","override","undefined","isCipherAvailable","isAvailable","cipherModule","_peer","ENCRYPTION_UNAVAILABLE","message"],"sourceRoot":"../../../src","sources":["crypto/provider.ts"],"mappings":";;AAAA;AACA;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;AACA;;AA6BA;AACA,MAAMC,MAAM,GAAGH,QAAQ,CAAC,2BAA2B,EAAE,MAAM;EAC1D;EACA,IAAI;IACH,OAAOI,OAAO,CAAC,2BAA2B,CAAC;EAC5C,CAAC,CAAC,OAAOC,KAAK,EAAE;IACf,MAAMA,KAAK;EACZ;AACD,CAAC,CAAC;;AAEF;AACA,OAAO,SAASC,eAAeA,CAACC,MAA2B,EAAQ;EAClEJ,MAAM,CAACK,QAAQ,CAACD,MAAM,IAAIE,SAAS,CAAC;AACrC;AAEA,OAAO,SAASC,iBAAiBA,CAAA,EAAY;EAC5C,OAAOP,MAAM,CAACQ,WAAW,CAAC,CAAC;AAC5B;AAEA,OAAO,SAASC,YAAYA,CAAA,EAAiB;EAC5C,OAAOT,MAAM,CAACC,OAAO,CACpB,CAACS,KAAK,EAAER,KAAK,KACZ,IAAIH,YAAY,CAACD,eAAe,CAACa,sBAAsB,EAAE;IACxDC,OAAO,EAAE,8BAA8B;IACvCV;EACD,CAAC,CACH,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Development-only diagnostics.
5
+ *
6
+ * Operation names, durations, and counts are safe to report. Record payloads,
7
+ * field values, and query parameters are not — in any build, including this
8
+ * one (FR-080, FR-081). There is deliberately no path here that accepts a
9
+ * payload, so a future caller cannot pass one by accident.
10
+ */
11
+
12
+ import { createDiagnosticChannel, hasSdkSinks } from '@chipmobilesdk/rn-core';
13
+ let logger = null;
14
+
15
+ /** Passing null removes the logger. */
16
+ export function setDiagnosticLogger(next) {
17
+ logger = next;
18
+ }
19
+ function isDevelopmentBuild() {
20
+ // __DEV__ is a React Native global; the typeof guard keeps this usable
21
+ // under plain Node when the package is exercised from Jest.
22
+ if (typeof __DEV__ !== 'undefined') return __DEV__ === true;
23
+ const {
24
+ process
25
+ } = globalThis;
26
+ return process?.env?.NODE_ENV !== 'production';
27
+ }
28
+
29
+ /**
30
+ * A failed operation also reaches the app's SDK sinks (`installSdkSink` from
31
+ * rn-core, CORE-08), in any build: its code, the operation and the collection,
32
+ * which are identifiers this package defines. Successes stay with the
33
+ * development logger.
34
+ */
35
+ const channel = createDiagnosticChannel('rn-local-db');
36
+ export function logDiagnostic(event) {
37
+ if (event.outcome !== undefined) {
38
+ channel.emit(event.outcome, 'warn', {
39
+ operation: event.operation,
40
+ ...(event.collection === undefined ? {} : {
41
+ collection: event.collection
42
+ }),
43
+ ...(event.adapter === undefined ? {} : {
44
+ adapter: event.adapter
45
+ })
46
+ });
47
+ }
48
+ if (!logger || !isDevelopmentBuild()) {
49
+ return;
50
+ }
51
+ logger(event);
52
+ }
53
+ export function isLogging() {
54
+ return logger !== null && isDevelopmentBuild();
55
+ }
56
+
57
+ /**
58
+ * Wrap a collection so every operation reports its name, duration, and result
59
+ * count — and nothing else.
60
+ *
61
+ * Wrapping once here rather than instrumenting each operation in the adapters
62
+ * is what keeps the guarantee checkable: there is one place that decides what
63
+ * a log line may contain, and it has no access to a payload to leak even if a
64
+ * future change wanted one. The wrapper is applied only when a logger is
65
+ * installed and the build is a development build, so a production bundle pays
66
+ * nothing and emits nothing (FR-081).
67
+ */
68
+ export function instrument(collection, adapter, operations) {
69
+ // Unwrapped unless someone is listening: production pays nothing by default.
70
+ if (!isLogging() && !hasSdkSinks()) {
71
+ return operations;
72
+ }
73
+ const wrapped = {};
74
+ for (const [name, operation] of Object.entries(operations)) {
75
+ if (typeof operation !== 'function') {
76
+ wrapped[name] = operation;
77
+ continue;
78
+ }
79
+ wrapped[name] = async (...args) => {
80
+ const started = Date.now();
81
+ try {
82
+ const result = await operation(...args);
83
+ logDiagnostic({
84
+ operation: `${collection}.${name}`,
85
+ durationMs: Date.now() - started,
86
+ collection,
87
+ adapter,
88
+ ...(countOf(result) === undefined ? {} : {
89
+ count: countOf(result)
90
+ })
91
+ });
92
+ return result;
93
+ } catch (error) {
94
+ // The code, never the message: a failure log is exactly where a
95
+ // payload-bearing native message would otherwise end up.
96
+ logDiagnostic({
97
+ operation: `${collection}.${name}`,
98
+ durationMs: Date.now() - started,
99
+ collection,
100
+ adapter,
101
+ outcome: error.code ?? 'failed'
102
+ });
103
+ throw error;
104
+ }
105
+ };
106
+ }
107
+ return wrapped;
108
+ }
109
+
110
+ /** How many records an operation produced, when that is a meaningful answer. */
111
+ function countOf(result) {
112
+ if (typeof result === 'number') {
113
+ return result;
114
+ }
115
+ if (result && typeof result === 'object' && Array.isArray(result.records)) {
116
+ return result.records.length;
117
+ }
118
+ return undefined;
119
+ }
120
+ //# sourceMappingURL=dev-log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createDiagnosticChannel","hasSdkSinks","logger","setDiagnosticLogger","next","isDevelopmentBuild","__DEV__","process","globalThis","env","NODE_ENV","channel","logDiagnostic","event","outcome","undefined","emit","operation","collection","adapter","isLogging","instrument","operations","wrapped","name","Object","entries","args","started","Date","now","result","durationMs","countOf","count","error","code","Array","isArray","records","length"],"sourceRoot":"../../../src","sources":["diagnostics/dev-log.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,uBAAuB,EAAEC,WAAW,QAAQ,wBAAwB;AAc7E,IAAIC,MAA+B,GAAG,IAAI;;AAE1C;AACA,OAAO,SAASC,mBAAmBA,CAACC,IAA6B,EAAQ;EACxEF,MAAM,GAAGE,IAAI;AACd;AAEA,SAASC,kBAAkBA,CAAA,EAAY;EACtC;EACA;EACA,IAAI,OAAOC,OAAO,KAAK,WAAW,EAAE,OAAOA,OAAO,KAAK,IAAI;EAC3D,MAAM;IAAEC;EAAQ,CAAC,GAAGC,UAAwE;EAC5F,OAAOD,OAAO,EAAEE,GAAG,EAAEC,QAAQ,KAAK,YAAY;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,OAAO,GAAGX,uBAAuB,CAAC,aAAa,CAAC;AAEtD,OAAO,SAASY,aAAaA,CAACC,KAAsB,EAAQ;EAC3D,IAAIA,KAAK,CAACC,OAAO,KAAKC,SAAS,EAAE;IAChCJ,OAAO,CAACK,IAAI,CAACH,KAAK,CAACC,OAAO,EAAE,MAAM,EAAE;MACnCG,SAAS,EAAEJ,KAAK,CAACI,SAAS;MAC1B,IAAIJ,KAAK,CAACK,UAAU,KAAKH,SAAS,GAAG,CAAC,CAAC,GAAG;QAAEG,UAAU,EAAEL,KAAK,CAACK;MAAW,CAAC,CAAC;MAC3E,IAAIL,KAAK,CAACM,OAAO,KAAKJ,SAAS,GAAG,CAAC,CAAC,GAAG;QAAEI,OAAO,EAAEN,KAAK,CAACM;MAAQ,CAAC;IAClE,CAAC,CAAC;EACH;EACA,IAAI,CAACjB,MAAM,IAAI,CAACG,kBAAkB,CAAC,CAAC,EAAE;IACrC;EACD;EACAH,MAAM,CAACW,KAAK,CAAC;AACd;AAEA,OAAO,SAASO,SAASA,CAAA,EAAY;EACpC,OAAOlB,MAAM,KAAK,IAAI,IAAIG,kBAAkB,CAAC,CAAC;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASgB,UAAUA,CACzBH,UAAkB,EAClBC,OAA4B,EAC5BG,UAAa,EACT;EACJ;EACA,IAAI,CAACF,SAAS,CAAC,CAAC,IAAI,CAACnB,WAAW,CAAC,CAAC,EAAE;IACnC,OAAOqB,UAAU;EAClB;EAEA,MAAMC,OAAgC,GAAG,CAAC,CAAC;EAC3C,KAAK,MAAM,CAACC,IAAI,EAAEP,SAAS,CAAC,IAAIQ,MAAM,CAACC,OAAO,CAACJ,UAAU,CAAC,EAAE;IAC3D,IAAI,OAAOL,SAAS,KAAK,UAAU,EAAE;MACpCM,OAAO,CAACC,IAAI,CAAC,GAAGP,SAAS;MACzB;IACD;IACAM,OAAO,CAACC,IAAI,CAAC,GAAG,OAAO,GAAGG,IAAa,KAAuB;MAC7D,MAAMC,OAAO,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;MAC1B,IAAI;QACH,MAAMC,MAAM,GAAG,MAAOd,SAAS,CAA6C,GAAGU,IAAI,CAAC;QACpFf,aAAa,CAAC;UACbK,SAAS,EAAE,GAAGC,UAAU,IAAIM,IAAI,EAAE;UAClCQ,UAAU,EAAEH,IAAI,CAACC,GAAG,CAAC,CAAC,GAAGF,OAAO;UAChCV,UAAU;UACVC,OAAO;UACP,IAAIc,OAAO,CAACF,MAAM,CAAC,KAAKhB,SAAS,GAAG,CAAC,CAAC,GAAG;YAAEmB,KAAK,EAAED,OAAO,CAACF,MAAM;UAAE,CAAC;QACpE,CAAC,CAAC;QACF,OAAOA,MAAM;MACd,CAAC,CAAC,OAAOI,KAAK,EAAE;QACf;QACA;QACAvB,aAAa,CAAC;UACbK,SAAS,EAAE,GAAGC,UAAU,IAAIM,IAAI,EAAE;UAClCQ,UAAU,EAAEH,IAAI,CAACC,GAAG,CAAC,CAAC,GAAGF,OAAO;UAChCV,UAAU;UACVC,OAAO;UACPL,OAAO,EAAGqB,KAAK,CAAuBC,IAAI,IAAI;QAC/C,CAAC,CAAC;QACF,MAAMD,KAAK;MACZ;IACD,CAAC;EACF;EACA,OAAOZ,OAAO;AACf;;AAEA;AACA,SAASU,OAAOA,CAACF,MAAe,EAAsB;EACrD,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IAC/B,OAAOA,MAAM;EACd;EACA,IACCA,MAAM,IACN,OAAOA,MAAM,KAAK,QAAQ,IAC1BM,KAAK,CAACC,OAAO,CAAEP,MAAM,CAA2BQ,OAAO,CAAC,EACvD;IACD,OAAQR,MAAM,CAA4BQ,OAAO,CAACC,MAAM;EACzD;EACA,OAAOzB,SAAS;AACjB","ignoreList":[]}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The single error type the package raises.
5
+ *
6
+ * Everything is redacted on the way in (see redact.ts), so there is no path
7
+ * by which a field value, query parameter, scope component, or key reaches an
8
+ * error object at all.
9
+ */
10
+
11
+ import { SdkError } from '@chipmobilesdk/rn-core';
12
+ import { DiagnosticCodes, RETRYABLE_CODES } from "../contract/errors.js";
13
+ import { redactCause, redactDetail, sanitizeAuthoredMessage } from "./redact.js";
14
+ /** The package's error; an `SdkError` (`@chipmobilesdk/rn-core`) with `pkg: 'rn-local-db'`. */
15
+ export class StorageError extends SdkError {
16
+ constructor(code, init = {}) {
17
+ // Call sites pass only authored literals (authored-messages.test.ts).
18
+ const message = init.message ? sanitizeAuthoredMessage(init.message) : code;
19
+ // `cause` is deliberately NOT kept: the native error it came from may
20
+ // quote the offending value. Only its redacted identifier survives.
21
+ super('rn-local-db', code, {
22
+ message,
23
+ retryable: RETRYABLE_CODES.has(code),
24
+ redactedCause: redactCause(init.cause)
25
+ });
26
+ this.name = 'StorageError';
27
+ this.detail = redactDetail(init.detail);
28
+ // Version numbers and an outcome enum — no payload can hide in these.
29
+ this.migration = init.migration;
30
+ }
31
+ }
32
+ export function isStorageError(value) {
33
+ return value instanceof StorageError;
34
+ }
35
+
36
+ /** So no consumer ever has to parse a message string (FR-082). */
37
+ export function isCode(value, code) {
38
+ return isStorageError(value) && value.code === code;
39
+ }
40
+ export function raise(code, init) {
41
+ throw new StorageError(code, init);
42
+ }
43
+ export { DiagnosticCodes };
44
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SdkError","DiagnosticCodes","RETRYABLE_CODES","redactCause","redactDetail","sanitizeAuthoredMessage","StorageError","constructor","code","init","message","retryable","has","redactedCause","cause","name","detail","migration","isStorageError","value","isCode","raise"],"sourceRoot":"../../../src","sources":["diagnostics/errors.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,wBAAwB;AAEjD,SAASC,eAAe,EAAEC,eAAe,QAA6B,uBAAoB;AAE1F,SAASC,WAAW,EAAEC,YAAY,EAAEC,uBAAuB,QAAQ,aAAU;AAc7E;AACA,OAAO,MAAMC,YAAY,SAASN,QAAQ,CAAiB;EAI1DO,WAAWA,CAACC,IAAoB,EAAEC,IAAsB,GAAG,CAAC,CAAC,EAAE;IAC9D;IACA,MAAMC,OAAO,GAAGD,IAAI,CAACC,OAAO,GAAGL,uBAAuB,CAACI,IAAI,CAACC,OAAO,CAAC,GAAGF,IAAI;IAC3E;IACA;IACA,KAAK,CAAC,aAAa,EAAEA,IAAI,EAAE;MAC1BE,OAAO;MACPC,SAAS,EAAET,eAAe,CAACU,GAAG,CAACJ,IAAI,CAAC;MACpCK,aAAa,EAAEV,WAAW,CAACM,IAAI,CAACK,KAAK;IACtC,CAAC,CAAC;IACF,IAAI,CAACC,IAAI,GAAG,cAAc;IAC1B,IAAI,CAACC,MAAM,GAAGZ,YAAY,CAACK,IAAI,CAACO,MAAM,CAAC;IACvC;IACA,IAAI,CAACC,SAAS,GAAGR,IAAI,CAACQ,SAAS;EAChC;AACD;AAEA,OAAO,SAASC,cAAcA,CAACC,KAAc,EAAyB;EACrE,OAAOA,KAAK,YAAYb,YAAY;AACrC;;AAEA;AACA,OAAO,SAASc,MAAMA,CAACD,KAAc,EAAEX,IAAoB,EAAW;EACrE,OAAOU,cAAc,CAACC,KAAK,CAAC,IAAIA,KAAK,CAACX,IAAI,KAAKA,IAAI;AACpD;AAEA,OAAO,SAASa,KAAKA,CAACb,IAAoB,EAAEC,IAAuB,EAAS;EAC3E,MAAM,IAAIH,YAAY,CAACE,IAAI,EAAEC,IAAI,CAAC;AACnC;AAEA,SAASR,eAAe","ignoreList":[]}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The fault registry.
5
+ *
6
+ * It lives here rather than under `testing/` because FR-095 wants every
7
+ * documented failure reachable from a real app running the real adapter — the
8
+ * demo's fault-injection panel exercises the on-device path, not a simulation
9
+ * of it. So the check has to exist in production code.
10
+ *
11
+ * What does *not* exist in production code is a way to inject: `injectFault`
12
+ * and `clearFaults` are exported only from the `./testing` entrypoint. With
13
+ * nothing injected this is one lookup in an empty map, which is the price of
14
+ * being able to prove a recovery path works before a user finds it broken.
15
+ */
16
+
17
+ import { StorageError } from "./errors.js";
18
+ const faults = new Map();
19
+ export function injectFault(spec) {
20
+ faults.set(spec.at, {
21
+ code: spec.code,
22
+ remaining: spec.times ?? Number.POSITIVE_INFINITY
23
+ });
24
+ }
25
+ export function clearFaults() {
26
+ faults.clear();
27
+ }
28
+ export function activeFaults() {
29
+ return [...faults.keys()];
30
+ }
31
+ export function throwIfFaulted(point) {
32
+ if (faults.size === 0) {
33
+ return;
34
+ }
35
+ const fault = faults.get(point);
36
+ if (!fault || fault.remaining <= 0) {
37
+ return;
38
+ }
39
+ fault.remaining -= 1;
40
+ if (fault.remaining <= 0) {
41
+ faults.delete(point);
42
+ }
43
+ throw new StorageError(fault.code, {
44
+ message: `injected fault at ${point}`
45
+ });
46
+ }
47
+ //# sourceMappingURL=faults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StorageError","faults","Map","injectFault","spec","set","at","code","remaining","times","Number","POSITIVE_INFINITY","clearFaults","clear","activeFaults","keys","throwIfFaulted","point","size","fault","get","delete","message"],"sourceRoot":"../../../src","sources":["diagnostics/faults.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,YAAY,QAAQ,aAAU;AAYvC,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAA0D,CAAC;AAEjF,OAAO,SAASC,WAAWA,CAACC,IAAe,EAAQ;EAClDH,MAAM,CAACI,GAAG,CAACD,IAAI,CAACE,EAAE,EAAE;IACnBC,IAAI,EAAEH,IAAI,CAACG,IAAI;IACfC,SAAS,EAAEJ,IAAI,CAACK,KAAK,IAAIC,MAAM,CAACC;EACjC,CAAC,CAAC;AACH;AAEA,OAAO,SAASC,WAAWA,CAAA,EAAS;EACnCX,MAAM,CAACY,KAAK,CAAC,CAAC;AACf;AAEA,OAAO,SAASC,YAAYA,CAAA,EAAiB;EAC5C,OAAO,CAAC,GAAGb,MAAM,CAACc,IAAI,CAAC,CAAC,CAAC;AAC1B;AAEA,OAAO,SAASC,cAAcA,CAACC,KAAiB,EAAQ;EACvD,IAAIhB,MAAM,CAACiB,IAAI,KAAK,CAAC,EAAE;IACtB;EACD;EACA,MAAMC,KAAK,GAAGlB,MAAM,CAACmB,GAAG,CAACH,KAAK,CAAC;EAC/B,IAAI,CAACE,KAAK,IAAIA,KAAK,CAACX,SAAS,IAAI,CAAC,EAAE;IACnC;EACD;EACAW,KAAK,CAACX,SAAS,IAAI,CAAC;EACpB,IAAIW,KAAK,CAACX,SAAS,IAAI,CAAC,EAAE;IACzBP,MAAM,CAACoB,MAAM,CAACJ,KAAK,CAAC;EACrB;EACA,MAAM,IAAIjB,YAAY,CAACmB,KAAK,CAACZ,IAAI,EAAE;IAAEe,OAAO,EAAE,qBAAqBL,KAAK;EAAG,CAAC,CAAC;AAC9E","ignoreList":[]}
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Native error to diagnostic code.
5
+ *
6
+ * The three failures FR-076 insists stay apart — a full disk, a filesystem
7
+ * the app cannot reach, and a corrupt database — arrive from SQLite and from
8
+ * the filesystem peer as ordinary errors with a string on them. Collapsing
9
+ * them into one write failure would be the easy thing and the wrong one: an
10
+ * app frees space for the first, retries after unlock for the second, and has
11
+ * to offer a reset for the third.
12
+ *
13
+ * Only the code is derived here. The message never travels — it is redacted
14
+ * at construction by `StorageError` (FR-079).
15
+ */
16
+
17
+ import { DiagnosticCodes } from "../contract/errors.js";
18
+ import { isStorageError, raise } from "./errors.js";
19
+ function textOf(error) {
20
+ if (error instanceof Error) {
21
+ return `${error.message} ${error.code ?? ''}`;
22
+ }
23
+ if (typeof error === 'string') {
24
+ return error;
25
+ }
26
+ return '';
27
+ }
28
+ const DISK_FULL = /SQLITE_FULL|database or disk is full|ENOSPC|no space left/i;
29
+ const NOT_A_DATABASE = /SQLITE_NOTADB|file is not a database|encrypted or is not a database/i;
30
+ const CORRUPT = /SQLITE_CORRUPT|database disk image is malformed|malformed database/i;
31
+ const CONFLICT = /UNIQUE constraint failed|PRIMARY KEY must be unique|SQLITE_CONSTRAINT_PRIMARYKEY/i;
32
+ const ACCESS = /SQLITE_CANTOPEN|SQLITE_READONLY|SQLITE_PERM|SQLITE_AUTH|EACCES|EPERM|EROFS|ENOENT|EISDIR/i;
33
+ const BUSY = /SQLITE_BUSY|SQLITE_LOCKED|database is locked/i;
34
+ export function mapNativeError(error, context) {
35
+ const text = textOf(error);
36
+ if (DISK_FULL.test(text)) {
37
+ return DiagnosticCodes.DISK_FULL;
38
+ }
39
+ if (NOT_A_DATABASE.test(text)) {
40
+ // A wrong key and a corrupt file are indistinguishable from the engine's
41
+ // answer alone. Reporting corruption for a wrong key would push an app
42
+ // towards destroying recoverable data, so the encrypted case wins.
43
+ return context.encrypted ? DiagnosticCodes.KEY_INVALID : DiagnosticCodes.CORRUPTION;
44
+ }
45
+ if (CORRUPT.test(text)) {
46
+ return DiagnosticCodes.CORRUPTION;
47
+ }
48
+ if (CONFLICT.test(text)) {
49
+ return DiagnosticCodes.RECORD_CONFLICT;
50
+ }
51
+ if (ACCESS.test(text)) {
52
+ return DiagnosticCodes.STORAGE_ACCESS;
53
+ }
54
+ if (BUSY.test(text)) {
55
+ // Retryable, and distinct from a permanent write failure.
56
+ return context.operation === 'transaction' ? DiagnosticCodes.TRANSACTION_FAILED : DiagnosticCodes.WRITE_FAILED;
57
+ }
58
+ switch (context.operation) {
59
+ case 'open':
60
+ return DiagnosticCodes.OPEN_FAILED;
61
+ case 'read':
62
+ return DiagnosticCodes.STORAGE_ACCESS;
63
+ case 'transaction':
64
+ return DiagnosticCodes.TRANSACTION_FAILED;
65
+ case 'attachment':
66
+ return DiagnosticCodes.ATTACHMENT_WRITE_FAILED;
67
+ case 'delete':
68
+ case 'write':
69
+ default:
70
+ return DiagnosticCodes.WRITE_FAILED;
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Re-raise a native failure as a typed one, preserving an error the package
76
+ * already classified rather than reclassifying it as a generic write failure.
77
+ */
78
+ export function raiseNative(error, context) {
79
+ if (isStorageError(error)) {
80
+ throw error;
81
+ }
82
+ raise(mapNativeError(error, context), {
83
+ // The native message is deliberately not the error's message. It goes
84
+ // through `cause`, which redacts it — passing it here as well would be
85
+ // two chances to leak the same string for no extra information.
86
+ message: `native ${context.operation} failed`,
87
+ detail: {
88
+ operation: context.operation
89
+ },
90
+ cause: error
91
+ });
92
+ }
93
+ //# sourceMappingURL=map-native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DiagnosticCodes","isStorageError","raise","textOf","error","Error","message","code","DISK_FULL","NOT_A_DATABASE","CORRUPT","CONFLICT","ACCESS","BUSY","mapNativeError","context","text","test","encrypted","KEY_INVALID","CORRUPTION","RECORD_CONFLICT","STORAGE_ACCESS","operation","TRANSACTION_FAILED","WRITE_FAILED","OPEN_FAILED","ATTACHMENT_WRITE_FAILED","raiseNative","detail","cause"],"sourceRoot":"../../../src","sources":["diagnostics/map-native.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,eAAe,QAA6B,uBAAoB;AACzE,SAASC,cAAc,EAAEC,KAAK,QAAQ,aAAU;AAahD,SAASC,MAAMA,CAACC,KAAc,EAAU;EACvC,IAAIA,KAAK,YAAYC,KAAK,EAAE;IAC3B,OAAO,GAAGD,KAAK,CAACE,OAAO,IAAKF,KAAK,CAAuBG,IAAI,IAAI,EAAE,EAAE;EACrE;EACA,IAAI,OAAOH,KAAK,KAAK,QAAQ,EAAE;IAC9B,OAAOA,KAAK;EACb;EACA,OAAO,EAAE;AACV;AAEA,MAAMI,SAAS,GAAG,4DAA4D;AAC9E,MAAMC,cAAc,GAAG,sEAAsE;AAC7F,MAAMC,OAAO,GAAG,qEAAqE;AACrF,MAAMC,QAAQ,GACb,mFAAmF;AACpF,MAAMC,MAAM,GACX,2FAA2F;AAC5F,MAAMC,IAAI,GAAG,+CAA+C;AAE5D,OAAO,SAASC,cAAcA,CAACV,KAAc,EAAEW,OAAsB,EAAkB;EACtF,MAAMC,IAAI,GAAGb,MAAM,CAACC,KAAK,CAAC;EAE1B,IAAII,SAAS,CAACS,IAAI,CAACD,IAAI,CAAC,EAAE;IACzB,OAAOhB,eAAe,CAACQ,SAAS;EACjC;EACA,IAAIC,cAAc,CAACQ,IAAI,CAACD,IAAI,CAAC,EAAE;IAC9B;IACA;IACA;IACA,OAAOD,OAAO,CAACG,SAAS,GAAGlB,eAAe,CAACmB,WAAW,GAAGnB,eAAe,CAACoB,UAAU;EACpF;EACA,IAAIV,OAAO,CAACO,IAAI,CAACD,IAAI,CAAC,EAAE;IACvB,OAAOhB,eAAe,CAACoB,UAAU;EAClC;EACA,IAAIT,QAAQ,CAACM,IAAI,CAACD,IAAI,CAAC,EAAE;IACxB,OAAOhB,eAAe,CAACqB,eAAe;EACvC;EACA,IAAIT,MAAM,CAACK,IAAI,CAACD,IAAI,CAAC,EAAE;IACtB,OAAOhB,eAAe,CAACsB,cAAc;EACtC;EACA,IAAIT,IAAI,CAACI,IAAI,CAACD,IAAI,CAAC,EAAE;IACpB;IACA,OAAOD,OAAO,CAACQ,SAAS,KAAK,aAAa,GACvCvB,eAAe,CAACwB,kBAAkB,GAClCxB,eAAe,CAACyB,YAAY;EAChC;EAEA,QAAQV,OAAO,CAACQ,SAAS;IACxB,KAAK,MAAM;MACV,OAAOvB,eAAe,CAAC0B,WAAW;IACnC,KAAK,MAAM;MACV,OAAO1B,eAAe,CAACsB,cAAc;IACtC,KAAK,aAAa;MACjB,OAAOtB,eAAe,CAACwB,kBAAkB;IAC1C,KAAK,YAAY;MAChB,OAAOxB,eAAe,CAAC2B,uBAAuB;IAC/C,KAAK,QAAQ;IACb,KAAK,OAAO;IACZ;MACC,OAAO3B,eAAe,CAACyB,YAAY;EACrC;AACD;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASG,WAAWA,CAACxB,KAAc,EAAEW,OAAsB,EAAS;EAC1E,IAAId,cAAc,CAACG,KAAK,CAAC,EAAE;IAC1B,MAAMA,KAAK;EACZ;EACAF,KAAK,CAACY,cAAc,CAACV,KAAK,EAAEW,OAAO,CAAC,EAAE;IACrC;IACA;IACA;IACAT,OAAO,EAAE,UAAUS,OAAO,CAACQ,SAAS,SAAS;IAC7CM,MAAM,EAAE;MAAEN,SAAS,EAAER,OAAO,CAACQ;IAAU,CAAC;IACxCO,KAAK,EAAE1B;EACR,CAAC,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Redaction, applied at construction rather than at logging time.
5
+ *
6
+ * The distinction matters: an error object that never held a payload cannot
7
+ * leak one through a consumer's crash reporter, which is where these leaks
8
+ * actually happen in practice. Redacting on the way out of a logger would
9
+ * still leave the values sitting on the object for anything else to pick up
10
+ * (FR-079, FR-099).
11
+ */
12
+
13
+ import { REDACTED, leadingIdentifier, pickAllowed } from '@chipmobilesdk/rn-core';
14
+
15
+ /**
16
+ * The allowlist IS the mechanism. Every key here has been reviewed as
17
+ * incapable of carrying user data: identifiers the app already knows, sizes,
18
+ * counts, and version numbers.
19
+ *
20
+ * A denylist was tried and removed. It rejected `recordId` because the name
21
+ * contains "record", which is the failure mode denylists always have — they
22
+ * guess from names. A closed allowlist cannot guess, and adding to it is a
23
+ * deliberate act with a reviewer attached.
24
+ */
25
+ export const SAFE_DETAIL_KEYS = new Set(['code', 'collection', 'recordId', 'attachmentId', 'scopeKey', 'version', 'recordedVersion', 'failingVersion', 'outcome', 'operation', 'adapter', 'platform', 'sizeBytes', 'limitBytes', 'count', 'limit']);
26
+
27
+ /**
28
+ * Reduce foreign text to an identifier, or to nothing.
29
+ *
30
+ * "Foreign" means text this package did not author: a SQLite message, a
31
+ * filesystem error, an `Error` a consumer's own migration threw. Any of them
32
+ * can contain anything — SQLite quotes bound parameters back, and a migration
33
+ * that fails on a constraint routinely names the value that violated it.
34
+ *
35
+ * An earlier version of this tried to keep the readable part: the text before
36
+ * the first colon, if it "looked like a class of failure". That heuristic
37
+ * fails on the case that matters. `Patient reported chest pain` looks exactly
38
+ * like a class of failure — short, no punctuation, no digits — and is a
39
+ * medical record. There is no shape test that separates prose describing a
40
+ * failure from prose describing a person, so there is no version of the
41
+ * heuristic worth keeping.
42
+ *
43
+ * What survives is a leading `SQLITE_*` / `ENOENT`-style identifier, which is
44
+ * a closed vocabulary of engine and libc constants and cannot be a value.
45
+ * Everything else becomes `[redacted]`. A developer who needs more can
46
+ * reproduce with the development logger; a crash report cannot.
47
+ */
48
+ export function redactForeignText(text) {
49
+ return leadingIdentifier(text);
50
+ }
51
+ const MAX_AUTHORED_MESSAGE = 160;
52
+
53
+ /**
54
+ * A message this package wrote itself.
55
+ *
56
+ * Every `raise()` call site passes a string literal, and the handful that
57
+ * interpolate do so with a value from a closed set — an operator name, a
58
+ * fault point, a sanitized identifier. `authored-messages.test.ts` enforces
59
+ * that mechanically against the source, so this is a checked property rather
60
+ * than a convention someone has to remember.
61
+ *
62
+ * So no filtering happens here: filtering a message the package wrote would
63
+ * destroy the only readable part of the error for no gain. Foreign text never
64
+ * reaches this function — it goes through `redactForeignText` above.
65
+ */
66
+ export function sanitizeAuthoredMessage(message) {
67
+ return message.split('\n')[0].trim().slice(0, MAX_AUTHORED_MESSAGE);
68
+ }
69
+
70
+ /**
71
+ * Reduce a consumer-supplied identifier to a bounded, punctuation-free token.
72
+ *
73
+ * A field name is worth naming — FR-034 exists so a typo is distinguishable
74
+ * from a deliberate choice, and "which field?" is the whole answer. But the
75
+ * name arrives from the consumer, so it is capped and stripped rather than
76
+ * trusted verbatim.
77
+ */
78
+ export function sanitizeIdentifier(identifier) {
79
+ const cleaned = identifier.replace(/\W/g, '').slice(0, 64);
80
+ return cleaned.length > 0 ? cleaned : REDACTED;
81
+ }
82
+
83
+ /** Keep only keys on the allowlist, and only primitive values. */
84
+ export function redactDetail(detail) {
85
+ const safe = pickAllowed(detail, SAFE_DETAIL_KEYS);
86
+ return safe && Object.keys(safe).length > 0 ? safe : undefined;
87
+ }
88
+
89
+ /** Reduce an unknown thrown value to a message-shaped string, redacted. */
90
+ export function redactCause(cause) {
91
+ if (cause === undefined || cause === null) {
92
+ return undefined;
93
+ }
94
+ if (cause instanceof Error) {
95
+ return redactForeignText(cause.message);
96
+ }
97
+ if (typeof cause === 'string') {
98
+ return redactForeignText(cause);
99
+ }
100
+ return REDACTED;
101
+ }
102
+ //# sourceMappingURL=redact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["REDACTED","leadingIdentifier","pickAllowed","SAFE_DETAIL_KEYS","Set","redactForeignText","text","MAX_AUTHORED_MESSAGE","sanitizeAuthoredMessage","message","split","trim","slice","sanitizeIdentifier","identifier","cleaned","replace","length","redactDetail","detail","safe","Object","keys","undefined","redactCause","cause","Error"],"sourceRoot":"../../../src","sources":["diagnostics/redact.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,iBAAiB,EAAEC,WAAW,QAAQ,wBAAwB;;AAEjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,IAAIC,GAAG,CAAC,CACvC,MAAM,EACN,YAAY,EACZ,UAAU,EACV,cAAc,EACd,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EACV,WAAW,EACX,YAAY,EACZ,OAAO,EACP,OAAO,CACP,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,IAAY,EAAU;EACvD,OAAOL,iBAAiB,CAACK,IAAI,CAAC;AAC/B;AAEA,MAAMC,oBAAoB,GAAG,GAAG;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAACC,OAAe,EAAU;EAChE,OAAOA,OAAO,CAACC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAEC,IAAI,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC,EAAEL,oBAAoB,CAAC;AACrE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,kBAAkBA,CAACC,UAAkB,EAAU;EAC9D,MAAMC,OAAO,GAAGD,UAAU,CAACE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAACJ,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;EAC1D,OAAOG,OAAO,CAACE,MAAM,GAAG,CAAC,GAAGF,OAAO,GAAGf,QAAQ;AAC/C;;AAEA;AACA,OAAO,SAASkB,YAAYA,CAC3BC,MAA2C,EACa;EACxD,MAAMC,IAAI,GAAGlB,WAAW,CAACiB,MAAM,EAAEhB,gBAAgB,CAAC;EAClD,OAAOiB,IAAI,IAAIC,MAAM,CAACC,IAAI,CAACF,IAAI,CAAC,CAACH,MAAM,GAAG,CAAC,GAAGG,IAAI,GAAGG,SAAS;AAC/D;;AAEA;AACA,OAAO,SAASC,WAAWA,CAACC,KAAc,EAAsB;EAC/D,IAAIA,KAAK,KAAKF,SAAS,IAAIE,KAAK,KAAK,IAAI,EAAE;IAC1C,OAAOF,SAAS;EACjB;EACA,IAAIE,KAAK,YAAYC,KAAK,EAAE;IAC3B,OAAOrB,iBAAiB,CAACoB,KAAK,CAAChB,OAAO,CAAC;EACxC;EACA,IAAI,OAAOgB,KAAK,KAAK,QAAQ,EAAE;IAC9B,OAAOpB,iBAAiB,CAACoB,KAAK,CAAC;EAChC;EACA,OAAOzB,QAAQ;AAChB","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * `@chipmobilesdk/rn-local-db`
5
+ *
6
+ * Offline-first, scope-isolated local storage for ChipMobileSdk apps.
7
+ *
8
+ * What is deliberately absent is part of the contract: there is no
9
+ * `switchScope`, and no read, write, or query operation accepts a scope
10
+ * argument. Scope is bound to a handle at open time and immutable, so a
11
+ * cross-scope leak is not expressible rather than merely prevented.
12
+ *
13
+ * The underlying engine, the physical layout, key material, and the query
14
+ * translation are private and unreachable by deep import.
15
+ */
16
+
17
+ // Lifecycle
18
+ export { deleteDatabase, deleteScopeData, openDatabase, resetScope } from "./adapter/index.js";
19
+
20
+ // Diagnostics
21
+ export { DiagnosticCodes, StorageError, isCode, isStorageError } from "./diagnostics/errors.js";
22
+ export { setDiagnosticLogger } from "./diagnostics/dev-log.js";
23
+
24
+ // Budgets, so a consumer can check before it writes rather than after
25
+ export { Budgets } from "./contract/config.js";
26
+
27
+ // Contract types
28
+ //# sourceMappingURL=index.js.map