@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,253 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.buildFilter = buildFilter;
7
+ exports.buildKeysetPredicate = buildKeysetPredicate;
8
+ exports.buildOrderBy = buildOrderBy;
9
+ var _declare = require("../schema/declare.js");
10
+ /**
11
+ * Filter tree to parameterized SQL.
12
+ *
13
+ * Nothing a consumer supplies is ever concatenated into a statement. Field
14
+ * names are resolved through the schema first — validation has already run
15
+ * and rejected anything undeclared (FR-034) — so the only identifiers that
16
+ * reach SQL are ones this package generated from a declaration it checked.
17
+ * Values bind as parameters, without exception. Injection stops being a thing
18
+ * to remember and becomes a thing the shape of the code prevents.
19
+ *
20
+ * The other half of this file is keyset pagination. `OFFSET` was rejected for
21
+ * two measured reasons (research.md R6): it degrades linearly at the 100,000
22
+ * record budget because the engine still walks the skipped rows, and it
23
+ * shifts pages under concurrent writes so a record can be skipped or returned
24
+ * twice — the exact failure SC-007 forbids.
25
+ */
26
+
27
+ const TRUE = {
28
+ sql: '1',
29
+ params: []
30
+ };
31
+ const FALSE = {
32
+ sql: '0',
33
+ params: []
34
+ };
35
+ function columnFor(field) {
36
+ return field === 'id' ? 'id' : `"${(0, _declare.projectedColumn)(field)}"`;
37
+ }
38
+
39
+ /**
40
+ * The JSON path for a declared field.
41
+ *
42
+ * Safe to interpolate: the field name came from a schema declaration that
43
+ * validation already matched against `^[A-Za-z][A-Za-z0-9_]{0,62}$`, so it
44
+ * cannot carry a quote, a dollar sign, or a path separator.
45
+ */
46
+ function jsonType(field) {
47
+ return `json_type(payload, '$.${field}')`;
48
+ }
49
+
50
+ /** Present, and holding something a comparison can be defined over. */
51
+ function presentPrimitive(field) {
52
+ return `(${jsonType(field)} IS NOT NULL AND ${jsonType(field)} NOT IN ('object', 'array'))`;
53
+ }
54
+
55
+ /** Present and explicitly null — the condition `isNull` actually means. */
56
+ function isExplicitNull(field) {
57
+ return `${jsonType(field)} = 'null'`;
58
+ }
59
+
60
+ /** Booleans project to 0/1, so a bound parameter has to match. */
61
+ function bind(value) {
62
+ return typeof value === 'boolean' ? value ? 1 : 0 : value;
63
+ }
64
+ function comparison(node) {
65
+ const field = node.field;
66
+ const column = columnFor(field);
67
+ switch (node.op) {
68
+ case 'exists':
69
+ return {
70
+ sql: node.value ? `${jsonType(field)} IS NOT NULL` : `${jsonType(field)} IS NULL`,
71
+ params: []
72
+ };
73
+ case 'isNull':
74
+ return {
75
+ sql: isExplicitNull(field),
76
+ params: []
77
+ };
78
+ case 'isNotNull':
79
+ return {
80
+ sql: `(${jsonType(field)} IS NOT NULL AND ${jsonType(field)} != 'null')`,
81
+ params: []
82
+ };
83
+ case 'eq':
84
+ // Matching an explicit null needs the JSON type: `col = NULL` is
85
+ // NULL in SQL, which is not true, and a projected NULL cannot tell
86
+ // "absent" from "null" on its own.
87
+ return node.value === null ? {
88
+ sql: isExplicitNull(field),
89
+ params: []
90
+ } : {
91
+ sql: `${column} = ?`,
92
+ params: [bind(node.value)]
93
+ };
94
+ case 'ne':
95
+ return node.value === null ? {
96
+ sql: `(${presentPrimitive(field)} AND ${jsonType(field)} != 'null')`,
97
+ params: []
98
+ } : {
99
+ sql: `(${presentPrimitive(field)} AND ${column} IS NOT ?)`,
100
+ params: [bind(node.value)]
101
+ };
102
+ case 'lt':
103
+ case 'lte':
104
+ case 'gt':
105
+ case 'gte':
106
+ {
107
+ if (node.value === null) {
108
+ // An ordered comparison against null has no answer; SQL would
109
+ // return NULL and the in-memory adapter returns false. Being
110
+ // explicit keeps the two identical.
111
+ return FALSE;
112
+ }
113
+ const operator = {
114
+ lt: '<',
115
+ lte: '<=',
116
+ gt: '>',
117
+ gte: '>='
118
+ }[node.op];
119
+ return {
120
+ sql: `(${column} IS NOT NULL AND ${column} ${operator} ?)`,
121
+ params: [bind(node.value)]
122
+ };
123
+ }
124
+ case 'between':
125
+ {
126
+ const [low, high] = node.value;
127
+ if (low === null || high === null) {
128
+ return FALSE;
129
+ }
130
+ return {
131
+ sql: `(${column} IS NOT NULL AND ${column} BETWEEN ? AND ?)`,
132
+ params: [bind(low), bind(high)]
133
+ };
134
+ }
135
+ case 'in':
136
+ case 'nin':
137
+ {
138
+ const values = node.value;
139
+ const nonNull = values.filter(value => value !== null);
140
+ const acceptsNull = values.length !== nonNull.length;
141
+ const clauses = [];
142
+ const params = [];
143
+ if (nonNull.length > 0) {
144
+ clauses.push(`${column} IN (${nonNull.map(() => '?').join(', ')})`);
145
+ params.push(...nonNull.map(value => bind(value)));
146
+ }
147
+ if (acceptsNull) {
148
+ clauses.push(isExplicitNull(field));
149
+ }
150
+ const membership = clauses.length > 0 ? `(${clauses.join(' OR ')})` : '0';
151
+ if (node.op === 'in') {
152
+ return {
153
+ sql: membership,
154
+ params
155
+ };
156
+ }
157
+ // `nin` excludes, but only among records that have the field at
158
+ // all: an absent field satisfies no comparison, negated or not.
159
+ return {
160
+ sql: `(${presentPrimitive(field)} AND NOT IFNULL(${membership}, 0))`,
161
+ params
162
+ };
163
+ }
164
+ default:
165
+ return FALSE;
166
+ }
167
+ }
168
+ function buildFilter(node) {
169
+ if (!node) {
170
+ return TRUE;
171
+ }
172
+ switch (node.op) {
173
+ case 'and':
174
+ case 'or':
175
+ {
176
+ const parts = node.nodes.map(child => buildFilter(child));
177
+ return {
178
+ sql: `(${parts.map(part => part.sql).join(node.op === 'and' ? ' AND ' : ' OR ')})`,
179
+ params: parts.flatMap(part => part.params)
180
+ };
181
+ }
182
+ case 'not':
183
+ {
184
+ const inner = buildFilter(node.node);
185
+ // IFNULL, because NOT NULL is NULL in SQL and would quietly drop
186
+ // rows the in-memory adapter keeps.
187
+ return {
188
+ sql: `(NOT IFNULL(${inner.sql}, 0))`,
189
+ params: inner.params
190
+ };
191
+ }
192
+ default:
193
+ return comparison(node);
194
+ }
195
+ }
196
+ function buildOrderBy(sort) {
197
+ return sort.map(key => `${columnFor(key.field)} ${key.direction === 'desc' ? 'DESC' : 'ASC'}`).join(', ');
198
+ }
199
+
200
+ /**
201
+ * The keyset predicate: everything strictly after the cursor position.
202
+ *
203
+ * Lexicographic across the sort keys — equal on the first means the second
204
+ * decides, down to the `id` tiebreaker that guarantees a total order. NULL is
205
+ * treated as smaller than every value, matching both SQLite's default
206
+ * ordering and `compareValues`, so the two adapters page identically.
207
+ */
208
+ function buildKeysetPredicate(sort, anchor) {
209
+ const params = [];
210
+ const build = index => {
211
+ if (index >= sort.length) {
212
+ return '0';
213
+ }
214
+ const key = sort[index];
215
+ const column = columnFor(key.field);
216
+ const value = anchor[index] ?? null;
217
+ const descending = key.direction === 'desc';
218
+ let strictly;
219
+ if (descending) {
220
+ if (value === null) {
221
+ // Nothing sorts before null, so a descending walk anchored on
222
+ // null has nothing left ahead of it on this key.
223
+ strictly = '0';
224
+ } else {
225
+ strictly = `(${column} IS NULL OR ${column} < ?)`;
226
+ params.push(bind(value));
227
+ }
228
+ } else if (value === null) {
229
+ strictly = `${column} IS NOT NULL`;
230
+ } else {
231
+ strictly = `${column} > ?`;
232
+ params.push(bind(value));
233
+ }
234
+ const equal = `${column} IS ?`;
235
+ const equalParam = bind(value);
236
+ if (index === sort.length - 1) {
237
+ return strictly;
238
+ }
239
+
240
+ // Params are pushed in the order the fragments are concatenated, so the
241
+ // equality parameter has to land between this key's comparison and the
242
+ // next key's fragment.
243
+ const head = `(${strictly} OR (${equal} AND `;
244
+ params.push(equalParam);
245
+ const tail = build(index + 1);
246
+ return `${head}${tail}))`;
247
+ };
248
+ return {
249
+ sql: build(0),
250
+ params
251
+ };
252
+ }
253
+ //# sourceMappingURL=sql-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_declare","require","TRUE","sql","params","FALSE","columnFor","field","projectedColumn","jsonType","presentPrimitive","isExplicitNull","bind","value","comparison","node","column","op","operator","lt","lte","gt","gte","low","high","values","nonNull","filter","acceptsNull","length","clauses","push","map","join","membership","buildFilter","parts","nodes","child","part","flatMap","inner","buildOrderBy","sort","key","direction","buildKeysetPredicate","anchor","build","index","descending","strictly","equal","equalParam","head","tail"],"sourceRoot":"../../../src","sources":["sqlite/sql-builder.ts"],"mappings":";;;;;;;;AAkBA,IAAAA,QAAA,GAAAC,OAAA;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,MAAMC,IAAiB,GAAG;EAAEC,GAAG,EAAE,GAAG;EAAEC,MAAM,EAAE;AAAG,CAAC;AAClD,MAAMC,KAAkB,GAAG;EAAEF,GAAG,EAAE,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O;IAC7ChD,MAAM,CAAC2B,IAAI,CAACsB,UAAU,CAAC;IACvB,MAAME,IAAI,GAAGP,KAAK,CAACC,KAAK,GAAG,CAAC,CAAC;IAC7B,OAAO,GAAGK,IAAI,GAAGC,IAAI,IAAI;EAC1B,CAAC;EAED,OAAO;IAAEpD,GAAG,EAAE6C,KAAK,CAAC,CAAC,CAAC;IAAE5C;EAAO,CAAC;AACjC","ignoreList":[]}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.insertStatement = insertStatement;
7
+ exports.updateStatement = updateStatement;
8
+ var _declare = require("../schema/declare.js");
9
+ var _rowCodec = require("./row-codec.js");
10
+ /**
11
+ * The write statements, built in one place (LDB-12).
12
+ *
13
+ * The collection API and the batch each used to assemble their own INSERT and
14
+ * UPDATE text. Two copies of the same rule is how a batch upsert came to treat
15
+ * a soft-deleted row differently from a collection upsert.
16
+ */
17
+
18
+ // Built once per table and column list rather than on every write (PERF-10).
19
+ const insertTexts = new Map();
20
+ function insertText(table, columns) {
21
+ const key = `${table}|${columns.join(',')}`;
22
+ let sql = insertTexts.get(key);
23
+ if (sql === undefined) {
24
+ sql = `INSERT INTO "${table}" (${columns.map(name => `"${name}"`).join(', ')}) VALUES (${columns.map(() => '?').join(', ')})`;
25
+ insertTexts.set(key, sql);
26
+ }
27
+ return sql;
28
+ }
29
+
30
+ /**
31
+ * `ignore` leaves a row that already holds the id untouched and reports zero
32
+ * rows affected, so a conflict is detected without a SELECT beforehand.
33
+ */
34
+ function insertStatement(schema, id, data, now, payload, onConflict = 'fail') {
35
+ const {
36
+ columns,
37
+ values
38
+ } = (0, _rowCodec.insertColumns)(schema, id, data, now, payload);
39
+ const sql = insertText((0, _declare.collectionTable)(schema.name), columns);
40
+ return [onConflict === 'ignore' ? `${sql} ON CONFLICT(id) DO NOTHING` : sql, values];
41
+ }
42
+ function updateStatement(schema, id, data, now, payload, options = {}) {
43
+ const {
44
+ columns,
45
+ values
46
+ } = (0, _rowCodec.updateAssignments)(schema, data, now, payload);
47
+ const assignments = columns.map(name => `"${name}" = ?`);
48
+ if (options.restore === true && (0, _declare.hasSoftDelete)(schema)) {
49
+ assignments.push('deleted_at = NULL');
50
+ }
51
+ const live = options.liveOnly === true ? ' AND deleted_at IS NULL' : '';
52
+ return [`UPDATE "${(0, _declare.collectionTable)(schema.name)}" SET ${assignments.join(', ')} WHERE id = ?${live}`, [...values, id]];
53
+ }
54
+ //# sourceMappingURL=statements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_declare","require","_rowCodec","insertTexts","Map","insertText","table","columns","key","join","sql","get","undefined","map","name","set","insertStatement","schema","id","data","now","payload","onConflict","values","insertColumns","collectionTable","updateStatement","options","updateAssignments","assignments","restore","hasSoftDelete","push","live","liveOnly"],"sourceRoot":"../../../src","sources":["sqlite/statements.ts"],"mappings":";;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAVA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA,MAAME,WAAW,GAAG,IAAIC,GAAG,CAAiB,CAAC;AAE7C,SAASC,UAAUA,CAACC,KAAa,EAAEC,OAA0B,EAAU;EACtE,MAAMC,GAAG,GAAG,GAAGF,KAAK,IAAIC,OAAO,CAACE,IAAI,CAAC,GAAG,CAAC,EAAE;EAC3C,IAAIC,GAAG,GAAGP,WAAW,CAACQ,GAAG,CAACH,GAAG,CAAC;EAC9B,IAAIE,GAAG,KAAKE,SAAS,EAAE;IACtBF,GAAG,GAAG,gBAAgBJ,KAAK,MAAMC,OAAO,CAACM,GAAG,CAACC,IAAI,IAAI,IAAIA,IAAI,GAAG,CAAC,CAACL,IAAI,CAAC,IAAI,CAAC,aAAaF,OAAO,CAC9FM,GAAG,CAAC,MAAM,GAAG,CAAC,CACdJ,IAAI,CAAC,IAAI,CAAC,GAAG;IACfN,WAAW,CAACY,GAAG,CAACP,GAA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EAC5F,CAAC,GAAGV,MAAM,EAAEL,EAAE,CAAC,CACf;AACF","ignoreList":[]}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TRANSACTION_WAIT_LIMIT_MS = void 0;
7
+ exports.createTransactionQueue = createTransactionQueue;
8
+ var _errors = require("../contract/errors.js");
9
+ var _errors2 = require("../diagnostics/errors.js");
10
+ /**
11
+ * The per-handle queue that keeps a transaction to itself.
12
+ *
13
+ * A transaction holds the queue until it settles; work arriving meanwhile
14
+ * through the handle waits its turn and then runs on its own, instead of
15
+ * joining the transaction and vanishing with its rollback (LDB-01). Shared by
16
+ * the SQLite connection and the memory adapter so both isolate the same way.
17
+ *
18
+ * Pure: no engine, no React, so the memory adapter can use it without loading
19
+ * native code.
20
+ */
21
+
22
+ /**
23
+ * How long work through the handle waits behind a transaction before it is
24
+ * refused.
25
+ *
26
+ * Not a performance budget: it exists for the one wait that never ends. A
27
+ * transaction body that awaits the handle's own `collection()` or
28
+ * `attachments()` is waiting on work queued behind itself. Until 0.2.0 that
29
+ * work ran inside the transaction; now it is refused after this long with a
30
+ * message naming `tx.collection()` / `tx.attachments()`, and the transaction
31
+ * rolls back, rather than both waiting forever.
32
+ */
33
+ const TRANSACTION_WAIT_LIMIT_MS = exports.TRANSACTION_WAIT_LIMIT_MS = 10_000;
34
+ function createTransactionQueue(waitLimitMs = TRANSACTION_WAIT_LIMIT_MS) {
35
+ /** Tail of the queue. Never rejects, so one failure cannot stall the rest. */
36
+ let tail = Promise.resolve();
37
+ /** Transactions queued or running. Only work behind one of them can deadlock. */
38
+ let transactions = 0;
39
+ const enqueue = work => {
40
+ const run = tail.then(work, work);
41
+ tail = run.catch(() => undefined);
42
+ return run;
43
+ };
44
+ return {
45
+ run(work) {
46
+ if (transactions === 0) {
47
+ return enqueue(work);
48
+ }
49
+ let abandoned = false;
50
+ let timer;
51
+ const started = enqueue(() => {
52
+ clearTimeout(timer);
53
+ // Refused while waiting: it must not run late, after its caller was
54
+ // already told it failed.
55
+ return abandoned ? Promise.resolve(undefined) : work();
56
+ });
57
+ const refused = new Promise((_, reject) => {
58
+ timer = setTimeout(() => {
59
+ abandoned = true;
60
+ try {
61
+ (0, _errors2.raise)(_errors.DiagnosticCodes.TRANSACTION_STATE, {
62
+ message: 'waited too long behind an in-flight transaction; inside a transaction body use tx.collection() and tx.attachments(), not the handle'
63
+ });
64
+ } catch (error) {
65
+ reject(error);
66
+ }
67
+ }, waitLimitMs);
68
+ });
69
+ return Promise.race([started, refused]);
70
+ },
71
+ runTransaction(work) {
72
+ transactions += 1;
73
+ return enqueue(work).finally(() => {
74
+ transactions -= 1;
75
+ });
76
+ }
77
+ };
78
+ }
79
+ //# sourceMappingURL=transaction-queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_errors","require","_errors2","TRANSACTION_WAIT_LIMIT_MS","exports","createTransactionQueue","waitLimitMs","tail","Promise","resolve","transactions","enqueue","work","run","then","catch","undefined","abandoned","timer","started","clearTimeout","refused","_","reject","setTimeout","raise","DiagnosticCodes","TRANSACTION_STATE","message","error","race","runTransaction","finally"],"sourceRoot":"../../../src","sources":["sqlite/transaction-queue.ts"],"mappings":";;;;;;;AAYA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,yBAAyB,GAAAC,OAAA,CAAAD,yBAAA,GAAG,MAAM;AASxC,SAASE,sBAAsBA,CACrCC,WAAmB,GAAGH,yBAAyB,EAC5B;EACnB;EACA,IAAII,IAAsB,GAAGC,OAAO,CAACC,OAAO,CAAC,CAAC;EAC9C;EACA,IAAIC,YAAY,GAAG,CAAC;EAEpB,MAAMC,OAAO,GAAOC,IAAsB,IAAiB;IAC1D,MAAMC,GAAG,G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4
+ value: true
5
+ });
6
+ exports.runInTransaction = runInTransaction;
7
+ /**
8
+ * The transaction primitive.
9
+ *
10
+ * A transaction never spans two scopes, and not because a check forbids it:
11
+ * a transaction runs on one connection, a connection is opened against one
12
+ * scope's file, and the public surface offers no way to reach a second one
13
+ * from inside. FR-038 is a type error rather than a runtime one (research.md
14
+ * R2).
15
+ *
16
+ * Rollback fidelity is SQLite's, not this package's. A failure at any step
17
+ * unwinds through the engine's own `ROLLBACK`, which is the only way SC-006's
18
+ * "identical to its pre-transaction state, every time" survives a process
19
+ * kill halfway through.
20
+ */
21
+
22
+ /**
23
+ * Run `body` inside one transaction on one scope.
24
+ *
25
+ * Deliberately thin. The interesting behavior — read-your-own-writes,
26
+ * terminal-state rejection, what a settled transaction does when used again —
27
+ * belongs to `adapter/transaction.ts`, where both adapters can be held to the
28
+ * same rules.
29
+ */
30
+ function runInTransaction(connection, body) {
31
+ return connection.transaction(body);
32
+ }
33
+ //# sourceMappingURL=transactions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["runInTransaction","connection","body","transaction"],"sourceRoot":"../../../src","sources":["sqlite/transactions.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAgBA,CAC/BC,UAAsB,EACtBC,IAA6C,EAChC;EACb,OAAOD,UAAU,CAACE,WAAW,CAACD,IAAI,CAAC;AACpC","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.maybeNum = maybeNum;
7
+ exports.maybeText = maybeText;
8
+ exports.num = num;
9
+ exports.text = text;
10
+ /**
11
+ * Reading values back out of a result row.
12
+ *
13
+ * The engine hands back `unknown` per column, and every read site would
14
+ * otherwise repeat the same `String(...)` / `Number(...)` coercion with a
15
+ * slightly different null check. One place to do it means one place where the
16
+ * "NULL means absent, not empty string" rule is decided.
17
+ */
18
+
19
+ function text(value) {
20
+ return typeof value === 'string' ? value : String(value);
21
+ }
22
+ function num(value) {
23
+ return typeof value === 'number' ? value : Number(value);
24
+ }
25
+ function maybeText(value) {
26
+ return value == null ? null : text(value);
27
+ }
28
+ function maybeNum(value) {
29
+ return value == null ? null : num(value);
30
+ }
31
+ //# sourceMappingURL=values.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["text","value","String","num","Number","maybeText","maybeNum"],"sourceRoot":"../../../src","sources":["sqlite/values.ts"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAASA,IAAIA,CAACC,KAAc,EAAU;EAC5C,OAAO,OAAOA,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAGC,MAAM,CAACD,KAAkC,CAAC;AACtF;AAEO,SAASE,GAAGA,CAACF,KAAc,EAAU;EAC3C,OAAO,OAAOA,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAGG,MAAM,CAACH,KAAwB,CAAC;AAC5E;AAEO,SAASI,SAASA,CAACJ,KAAc,EAAiB;EACxD,OAAOA,KAAK,IAAI,IAAI,GAAG,IAAI,GAAGD,IAAI,CAACC,KAAK,CAAC;AAC1C;AAEO,SAASK,QAAQA,CAACL,KAAc,EAAiB;EACvD,OAAOA,KAAK,IAAI,IAAI,GAAG,IAAI,GAAGE,GAAG,CAACF,KAAK,CAAC;AACzC","ignoreList":[]}
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.registerAttachmentConformance = registerAttachmentConformance;
7
+ var _errors = require("../../contract/errors.js");
8
+ var _errors2 = require("../../diagnostics/errors.js");
9
+ var _bytes = require("../../platform/bytes.js");
10
+ /** US7: artifacts the package owns, and the reconciliation that keeps them honest. */
11
+ function registerAttachmentConformance(context) {
12
+ describe('conformance: attachments', () => {
13
+ beforeEach(() => context.reset());
14
+ const scope = {
15
+ kind: 'guest'
16
+ };
17
+ const content = (0, _bytes.bytesToBase64)((0, _bytes.utf8Bytes)('hello attachment'));
18
+ it('stores a reference alongside the artifact', async () => {
19
+ const handle = await context.adapter.open(context.configFor(scope));
20
+ const attachments = handle.attachments();
21
+ const reference = await attachments.write({
22
+ id: 'a1',
23
+ owner: {
24
+ collection: 'notes',
25
+ id: 'n1'
26
+ },
27
+ contentType: 'text/plain',
28
+ content
29
+ });
30
+ expect(reference.size).toBe((0, _bytes.base64ToBytes)(content).length);
31
+ expect(await attachments.read('a1')).toBe(content);
32
+ expect((await attachments.availability('a1')).state).toBe('available');
33
+ await handle.close();
34
+ });
35
+ it('reads a byte range without materialising the whole artifact', async () => {
36
+ const handle = await context.adapter.open(context.configFor(scope));
37
+ const attachments = handle.attachments();
38
+ await attachments.write({
39
+ id: 'a1',
40
+ contentType: 'text/plain',
41
+ content
42
+ });
43
+ const slice = await attachments.read('a1', {
44
+ offset: 0,
45
+ length: 5
46
+ });
47
+ expect((0, _bytes.utf8String)((0, _bytes.base64ToBytes)(slice))).toBe('hello');
48
+ await handle.close();
49
+ });
50
+ it('lists the attachments belonging to a record', async () => {
51
+ const handle = await context.adapter.open(context.configFor(scope));
52
+ const attachments = handle.attachments();
53
+ await attachments.write({
54
+ id: 'a1',
55
+ owner: {
56
+ collection: 'notes',
57
+ id: 'n1'
58
+ },
59
+ contentType: 'text/plain',
60
+ content
61
+ });
62
+ await attachments.write({
63
+ id: 'a2',
64
+ contentType: 'text/plain',
65
+ content
66
+ });
67
+ const owned = await attachments.listFor({
68
+ collection: 'notes',
69
+ id: 'n1'
70
+ });
71
+ expect(owned.map(r => r.id)).toEqual(['a1']);
72
+ await handle.close();
73
+ });
74
+ it('reports a missing artifact without making the record unreadable', async () => {
75
+ const handle = await context.adapter.open(context.configFor(scope));
76
+ await handle.collection('notes').insert({
77
+ id: 'n1',
78
+ data: {
79
+ title: 'has media'
80
+ }
81
+ });
82
+ const attachments = handle.attachments();
83
+ await attachments.write({
84
+ id: 'a1',
85
+ owner: {
86
+ collection: 'notes',
87
+ id: 'n1'
88
+ },
89
+ contentType: 'text/plain',
90
+ content
91
+ });
92
+
93
+ // Remove the artifact behind the package's back.
94
+ await context.removeArtifactBehindTheScenes(handle.scopeKey, 'a1');
95
+ expect((await attachments.availability('a1')).state).toBe('missing');
96
+ expect((await handle.collection('notes').get('n1')).data.title).toBe('has media');
97
+ await handle.close();
98
+ });
99
+ it('finds an orphaned artifact and a dangling reference', async () => {
100
+ const handle = await context.adapter.open(context.configFor(scope));
101
+ const attachments = handle.attachments();
102
+ await attachments.write({
103
+ id: 'a1',
104
+ contentType: 'text/plain',
105
+ content
106
+ });
107
+ await context.removeReferenceBehindTheScenes(handle.scopeKey, 'a1');
108
+ await attachments.write({
109
+ id: 'a2',
110
+ contentType: 'text/plain',
111
+ content
112
+ });
113
+ await context.removeArtifactBehindTheScenes(handle.scopeKey, 'a2');
114
+ const report = await attachments.reconcile();
115
+ expect(report.orphanedArtifacts).toEqual(['a1']);
116
+ expect(report.danglingReferences).toEqual(['a2']);
117
+ const removed = await attachments.reconcile({
118
+ removeOrphans: true
119
+ });
120
+ expect(removed.removedArtifacts).toEqual(['a1']);
121
+ expect((await attachments.reconcile()).orphanedArtifacts).toEqual([]);
122
+ await handle.close();
123
+ });
124
+ it('rolls a reference back with its transaction', async () => {
125
+ const handle = await context.adapter.open(context.configFor(scope));
126
+ try {
127
+ await handle.transaction(async tx => {
128
+ await tx.collection('notes').insert({
129
+ id: 'n1',
130
+ data: {
131
+ title: 'x'
132
+ }
133
+ });
134
+ await tx.attachments().write({
135
+ id: 'a1',
136
+ contentType: 'text/plain',
137
+ content
138
+ });
139
+ throw new Error('injected');
140
+ });
141
+ } catch {
142
+ // Expected.
143
+ }
144
+ expect(await handle.collection('notes').find('n1')).toBeNull();
145
+ // The reference is gone; the artifact on disk is not, which is
146
+ // exactly why reconciliation exists.
147
+ const report = await handle.attachments().reconcile();
148
+ expect(report.orphanedArtifacts).toEqual(['a1']);
149
+ await handle.close();
150
+ });
151
+ it('rejects an artifact over the size budget', async () => {
152
+ const handle = await context.adapter.open(context.configFor(scope));
153
+ const huge = (0, _bytes.bytesToBase64)(new Uint8Array(101 * 1024 * 1024));
154
+ let thrown;
155
+ try {
156
+ await handle.attachments().write({
157
+ id: 'big',
158
+ contentType: 'application/octet-stream',
159
+ content: huge
160
+ });
161
+ } catch (error) {
162
+ thrown = error;
163
+ }
164
+ expect((0, _errors2.isCode)(thrown, _errors.DiagnosticCodes.ATTACHMENT_WRITE_FAILED)).toBe(true);
165
+ await handle.close();
166
+ });
167
+ it('removes artifacts when the scope is deleted', async () => {
168
+ const handle = await context.adapter.open(context.configFor(scope));
169
+ await handle.attachments().write({
170
+ id: 'a1',
171
+ contentType: 'text/plain',
172
+ content
173
+ });
174
+ await handle.close();
175
+ const outcome = await context.adapter.deleteScopeData(context.scopeTargetFor(scope));
176
+ expect(outcome.removedArtifacts).toContain('a1');
177
+ });
178
+ });
179
+ }
180
+ //# sourceMappingURL=attachments.js.map