@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,115 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.validateConfig = validateConfig;
7
+ var _config = require("../contract/config.js");
8
+ var _errors = require("../contract/errors.js");
9
+ var _errors2 = require("../diagnostics/errors.js");
10
+ var _validateChain = require("../migration/validate-chain.js");
11
+ var _validate = require("../scope/validate.js");
12
+ /**
13
+ * Configuration validation.
14
+ *
15
+ * Runs to completion before any write and before any migration executes
16
+ * (FR-006, FR-053). Order matters: scope first, then collections, then the
17
+ * migration chain — so a consumer fixes the outermost problem first rather
18
+ * than chasing a downstream symptom.
19
+ */
20
+
21
+ const IDENTIFIER = /^[A-Za-z][A-Za-z0-9_]{0,62}$/;
22
+ function configInvalid(message, detail) {
23
+ (0, _errors2.raise)(_errors.DiagnosticCodes.CONFIG_INVALID, {
24
+ message,
25
+ detail
26
+ });
27
+ }
28
+ function validateCollection(collection, seen) {
29
+ if (!IDENTIFIER.test(collection.name)) {
30
+ configInvalid('collection name is not a valid identifier', {
31
+ collection: collection.name
32
+ });
33
+ }
34
+ if (seen.has(collection.name)) {
35
+ configInvalid('duplicate collection name', {
36
+ collection: collection.name
37
+ });
38
+ }
39
+ seen.add(collection.name);
40
+ const fieldNames = new Set();
41
+ for (const field of collection.fields ?? []) {
42
+ if (!IDENTIFIER.test(field.name)) {
43
+ configInvalid('field name is not a valid identifier', {
44
+ collection: collection.name
45
+ });
46
+ }
47
+ if (fieldNames.has(field.name)) {
48
+ configInvalid('duplicate field name', {
49
+ collection: collection.name
50
+ });
51
+ }
52
+ fieldNames.add(field.name);
53
+ }
54
+ const indexNames = new Set();
55
+ for (const index of collection.indexes ?? []) {
56
+ if (!IDENTIFIER.test(index.name)) {
57
+ configInvalid('index name is not a valid identifier', {
58
+ collection: collection.name
59
+ });
60
+ }
61
+ if (indexNames.has(index.name)) {
62
+ configInvalid('duplicate index name', {
63
+ collection: collection.name
64
+ });
65
+ }
66
+ indexNames.add(index.name);
67
+ if (!Array.isArray(index.fields) || index.fields.length === 0) {
68
+ configInvalid('index declares no fields', {
69
+ collection: collection.name
70
+ });
71
+ }
72
+ for (const field of index.fields) {
73
+ if (!fieldNames.has(field)) {
74
+ // The whole point of declaring fields is that the package can
75
+ // tell a typo from a deliberate choice. Silently creating an
76
+ // index over a column that will never exist would turn a config
77
+ // bug into a mysterious full scan at runtime.
78
+ configInvalid('index references an undeclared field', {
79
+ collection: collection.name
80
+ });
81
+ }
82
+ }
83
+ }
84
+ }
85
+ function validateConfig(config) {
86
+ if (!config || typeof config !== 'object') {
87
+ configInvalid('database config is required');
88
+ }
89
+ if (typeof config.name !== 'string' || !IDENTIFIER.test(config.name)) {
90
+ configInvalid('database name is not a valid identifier');
91
+ }
92
+ (0, _validate.validateDescriptor)(config.scope);
93
+ if (!Array.isArray(config.collections) || config.collections.length === 0) {
94
+ configInvalid('at least one collection must be declared');
95
+ }
96
+ if (config.collections.length > _config.Budgets.MAX_COLLECTIONS_PER_DATABASE) {
97
+ configInvalid('collection count exceeds the budget', {
98
+ count: config.collections.length,
99
+ limit: _config.Budgets.MAX_COLLECTIONS_PER_DATABASE
100
+ });
101
+ }
102
+ const seen = new Set();
103
+ for (const collection of config.collections) {
104
+ validateCollection(collection, seen);
105
+ }
106
+
107
+ // The one definition of a valid chain, shared with the executor (LDB-12).
108
+ (0, _validateChain.validateMigrationChain)(config);
109
+ if (config.encryption && config.encryption.enabled) {
110
+ if (typeof config.encryption.keyProvider?.getKey !== 'function') {
111
+ configInvalid('encryption is enabled but no key provider was supplied');
112
+ }
113
+ }
114
+ }
115
+ //# sourceMappingURL=validate-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_config","require","_errors","_errors2","_validateChain","_validate","IDENTIFIER","configInvalid","message","detail","raise","DiagnosticCodes","CONFIG_INVALID","validateCollection","collection","seen","test","name","has","add","fieldNames","Set","field","fields","indexNames","index","indexes","Array","isArray","length","validateConfig","config","validateDescriptor","scope","collections","Budgets","MAX_COLLECTIONS_PER_DATABASE","count","limit","validateMigrationChain","encryption","enabled","keyProvider","getKey"],"sourceRoot":"../../../src","sources":["schema/validate-config.ts"],"mappings":";;;;;;AASA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,MAAM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,CAACG,WAAW,CAAC,IAAIH,MAAM,CAACG,WAAW,CAACL,MAAM,KAAK,CAAC,EAAE;IAC1EtB,aAAa,CAAC,0CAA0C,CAAC;EAC1D;EACA,IAAIwB,MAAM,CAACG,WAAW,CAACL,MAAM,GAAGM,eAAO,CAACC,4BAA4B,EAAE;IACrE7B,aAAa,CAAC,qCAAqC,EAAE;MACpD8B,KAAK,EAAEN,MAAM,CAACG,WAAW,CAACL,MAAM;MAChCS,KAAK,EAAEH,eAAO,CAACC;IAChB,CAAC,CAAC;EACH;EAEA,MAAMrB,IAAI,GAAG,IAAIM,GAAG,CAAS,CAAC;EAC9B,KAAK,MAAMP,UAAU,IAAIiB,MAAM,CAACG,WAAW,EAAE;IAC5CrB,kBAAkB,CAACC,UAAU,EAAEC,IAAI,CAAC;EACrC;;EAEA;EACA,IAAAwB,qCAAsB,EAACR,MAAM,CAAC;EAE9B,IAAIA,MAAM,CAACS,UAAU,IAAIT,MAAM,CAACS,UAAU,CAACC,OAAO,EAAE;IACnD,IAAI,OAAOV,MAAM,CAACS,UAAU,CAACE,WAAW,EAAEC,MAAM,KAAK,UAAU,EAAE;MAChEpC,aAAa,CAAC,wDAAwD,CAAC;IACxE;EACD;AACD","ignoreList":[]}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.sha256Hex = sha256Hex;
7
+ exports.utf8ByteLength = utf8ByteLength;
8
+ /**
9
+ * Scope key derivation.
10
+ *
11
+ * The directory a scope lives in is named by the SHA-256 digest of its
12
+ * canonical descriptor, never by the components themselves. FR-014 requires
13
+ * scope components be treated as sensitive, and a directory named after an
14
+ * email address puts that address in plaintext on disk — visible even when
15
+ * the database itself is encrypted, and carried into any crash report that
16
+ * includes a file path.
17
+ *
18
+ * Hashing also removes filesystem charset and length limits from the problem,
19
+ * which is what lets validation reject rather than sanitize (research.md R2).
20
+ *
21
+ * Implemented in pure TypeScript rather than over a native crypto peer so the
22
+ * scope layer stays importable from anywhere in the package, including the
23
+ * in-memory adapter running under Jest.
24
+ *
25
+ * Verified against Node's own SHA-256 in scope-resolution.test.ts — a wrong
26
+ * digest would silently merge or split scopes, so it is checked against a
27
+ * reference implementation rather than against a snapshot of this one.
28
+ */
29
+
30
+ /* eslint-disable no-bitwise -- SHA-256 is defined in terms of bitwise operations. */
31
+
32
+ const K = new Uint32Array([0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]);
33
+ function rotr(value, bits) {
34
+ return value >>> bits | value << 32 - bits;
35
+ }
36
+ function utf8Bytes(input) {
37
+ const out = [];
38
+ for (let i = 0; i < input.length; i += 1) {
39
+ let codePoint = input.codePointAt(i);
40
+ if (codePoint > 0xffff) {
41
+ i += 1;
42
+ }
43
+ if (codePoint < 0x80) {
44
+ out.push(codePoint);
45
+ } else if (codePoint < 0x800) {
46
+ out.push(0xc0 | codePoint >> 6, 0x80 | codePoint & 0x3f);
47
+ } else if (codePoint < 0x10000) {
48
+ out.push(0xe0 | codePoint >> 12, 0x80 | codePoint >> 6 & 0x3f, 0x80 | codePoint & 0x3f);
49
+ } else {
50
+ out.push(0xf0 | codePoint >> 18, 0x80 | codePoint >> 12 & 0x3f, 0x80 | codePoint >> 6 & 0x3f, 0x80 | codePoint & 0x3f);
51
+ }
52
+ }
53
+ return Uint8Array.from(out);
54
+ }
55
+ function utf8ByteLength(input) {
56
+ return utf8Bytes(input).length;
57
+ }
58
+ function sha256Hex(input) {
59
+ const bytes = utf8Bytes(input);
60
+ const bitLength = bytes.length * 8;
61
+ const paddedLength = (bytes.length + 9 >> 6) + 1 << 6;
62
+ const padded = new Uint8Array(paddedLength);
63
+ padded.set(bytes);
64
+ padded[bytes.length] = 0x80;
65
+ const view = new DataView(padded.buffer);
66
+ view.setUint32(paddedLength - 8, Math.floor(bitLength / 0x100000000), false);
67
+ view.setUint32(paddedLength - 4, bitLength >>> 0, false);
68
+ const h = new Uint32Array([0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19]);
69
+ const w = new Uint32Array(64);
70
+ for (let offset = 0; offset < paddedLength; offset += 64) {
71
+ for (let i = 0; i < 16; i += 1) {
72
+ w[i] = view.getUint32(offset + i * 4, false);
73
+ }
74
+ for (let i = 16; i < 64; i += 1) {
75
+ const s0 = rotr(w[i - 15], 7) ^ rotr(w[i - 15], 18) ^ w[i - 15] >>> 3;
76
+ const s1 = rotr(w[i - 2], 17) ^ rotr(w[i - 2], 19) ^ w[i - 2] >>> 10;
77
+ w[i] = w[i - 16] + s0 + w[i - 7] + s1 >>> 0;
78
+ }
79
+ let [a, b, c, d, e, f, g, hh] = [h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7]];
80
+ for (let i = 0; i < 64; i += 1) {
81
+ const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
82
+ const ch = e & f ^ ~e & g;
83
+ const temp1 = hh + S1 + ch + K[i] + w[i] >>> 0;
84
+ const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
85
+ const maj = a & b ^ a & c ^ b & c;
86
+ const temp2 = S0 + maj >>> 0;
87
+ hh = g;
88
+ g = f;
89
+ f = e;
90
+ e = d + temp1 >>> 0;
91
+ d = c;
92
+ c = b;
93
+ b = a;
94
+ a = temp1 + temp2 >>> 0;
95
+ }
96
+ h[0] = h[0] + a >>> 0;
97
+ h[1] = h[1] + b >>> 0;
98
+ h[2] = h[2] + c >>> 0;
99
+ h[3] = h[3] + d >>> 0;
100
+ h[4] = h[4] + e >>> 0;
101
+ h[5] = h[5] + f >>> 0;
102
+ h[6] = h[6] + g >>> 0;
103
+ h[7] = h[7] + hh >>> 0;
104
+ }
105
+ return Array.from(h, value => value.toString(16).padStart(8, '0')).join('');
106
+ }
107
+ //# sourceMappingURL=hash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["K","Uint32Array","rotr","value","bits","utf8Bytes","input","out","i","length","codePoint","codePointAt","push","Uint8Array","from","utf8ByteLength","sha256Hex","bytes","bitLength","paddedLength","padded","set","view","DataView","buffer","setUint32","Math","floor","h","w","offset","getUint32","s0","s1","a","b","c","d","e","f","g","hh","S1","ch","temp1","S0","maj","temp2","Array","toString","padStart","join"],"sourceRoot":"../../../src","sources":["scope/hash.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,MAAMA,CAAC,GAAG,IAAIC,WAAW,CAAC,CACzB,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE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AAC5E","ignoreList":[]}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SCOPE_KINDS = exports.MAX_COMPONENT_BYTES = exports.CONTROL_CHARACTER = exports.COMPONENT_SEPARATOR = exports.COMPONENT_ORDER = void 0;
7
+ exports.normalizeComponent = normalizeComponent;
8
+ exports.normalizeDescriptor = normalizeDescriptor;
9
+ /**
10
+ * Scope descriptor normalization.
11
+ *
12
+ * The package normalizes and validates; it never repairs. A component it
13
+ * cannot represent safely is an error (FR-013), because silently sanitizing
14
+ * one is how two different descriptors end up sharing a directory — which
15
+ * would be a cross-scope leak dressed up as a convenience.
16
+ */
17
+
18
+ /**
19
+ * Separates components in the canonical form.
20
+ *
21
+ * NUL rather than a printable character: a component containing the separator
22
+ * could forge another descriptor's canonical string, and every printable
23
+ * candidate occurs in legitimate identity data. Tenant names contain spaces,
24
+ * identifiers contain colons and slashes, emails contain "@" and ".". NUL
25
+ * occurs in none of them, so reserving it costs consumers nothing.
26
+ */
27
+ const COMPONENT_SEPARATOR = exports.COMPONENT_SEPARATOR = '\u0000';
28
+
29
+ /**
30
+ * Control characters are rejected wholesale rather than only the separator.
31
+ * They have no place in an identity component, and they would be trouble in a
32
+ * log line or a diagnostic even where they could not forge a canonical
33
+ * string.
34
+ */
35
+ // eslint-disable-next-line no-control-regex
36
+ const CONTROL_CHARACTER = exports.CONTROL_CHARACTER = /[\u0000-\u001f\u007f]/;
37
+ const MAX_COMPONENT_BYTES = exports.MAX_COMPONENT_BYTES = 512;
38
+
39
+ /** Fixed order, so the canonical form is stable across callers. */
40
+ const COMPONENT_ORDER = exports.COMPONENT_ORDER = ['kind', 'id', 'tenant', 'app', 'environment', 'namespace'];
41
+ const SCOPE_KINDS = exports.SCOPE_KINDS = ['guest', 'identity', 'tenant', 'workspace', 'custom'];
42
+
43
+ /**
44
+ * NFC, trimmed, case preserved.
45
+ *
46
+ * Case is preserved deliberately: the package does not know whether a
47
+ * consumer's identity system is case-sensitive, and folding case would merge
48
+ * two scopes the app considers distinct.
49
+ */
50
+ function normalizeComponent(value) {
51
+ return value.normalize('NFC').trim();
52
+ }
53
+ /** Normalize without validating. Callers must validate first. */
54
+ function normalizeDescriptor(descriptor) {
55
+ const components = {};
56
+ const parts = [];
57
+ for (const key of COMPONENT_ORDER) {
58
+ const raw = descriptor[key];
59
+ if (typeof raw !== 'string' || raw.length === 0) {
60
+ parts.push('');
61
+ continue;
62
+ }
63
+ const normalized = normalizeComponent(raw);
64
+ components[key] = normalized;
65
+ parts.push(normalized);
66
+ }
67
+ return {
68
+ kind: descriptor.kind,
69
+ components,
70
+ canonical: parts.join(COMPONENT_SEPARATOR)
71
+ };
72
+ }
73
+ //# sourceMappingURL=normalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["COMPONENT_SEPARATOR","exports","CONTROL_CHARACTER","MAX_COMPONENT_BYTES","COMPONENT_ORDER","SCOPE_KINDS","normalizeComponent","value","normalize","trim","normalizeDescriptor","descriptor","components","parts","key","raw","length","push","normalized","kind","canonical","join"],"sourceRoot":"../../../src","sources":["scope/normalize.ts"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,QAAQ;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,iBAAiB,GAAAD,OAAA,CAAAC,iBAAA,GAAG,uBAAuB;AAEjD,MAAMC,mBAAmB,GAAAF,OAAA,CAAAE,mBAAA,GAAG,GAAG;;AAEtC;AACO,MAAMC,eAAe,GAAAH,OAAA,CAAAG,eAAA,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,CAAU;AAE5F,MAAMC,WAAiC,GAAAJ,OAAA,CAAAI,WAAA,GAAG,CAChD,OAAO,EACP,UAAU,EACV,QAAQ,EACR,WAAW,EACX,QAAQ,CACR;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAACC,KAAa,EAAU;EACzD,OAAOA,KAAK,CAACC,SAAS,CAAC,KAAK,CAAC,CAACC,IAAI,CAAC,CAAC;AACrC;AAQA;AACO,SAASC,mBAAmBA,CAACC,UAA2B,EAAmB;EACjF,MAAMC,UAAkC,GAAG,CAAC,CAAC;EAC7C,MAAMC,KAAe,GAAG,EAAE;EAE1B,KAAK,MAAMC,GAAG,IAAIV,eAAe,EAAE;IAClC,MAAMW,GAAG,GAAGJ,UAAU,CAACG,GAAG,CAA0B;IACpD,IAAI,OAAOC,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACC,MAAM,KAAK,CAAC,EAAE;MAChDH,KAAK,CAACI,IAAI,CAAC,EAAE,CAAC;MACd;IACD;IACA,MAAMC,UAAU,GAAGZ,kBAAkB,CAACS,GAAG,CAAC;IAC1CH,UAAU,CAACE,GAAG,CAAC,GAAGI,UAAU;IAC5BL,KAAK,CAACI,IAAI,CAACC,UAAU,CAAC;EACvB;EAEA,OAAO;IACNC,IAAI,EAAER,UAAU,CAACQ,IAAI;IACrBP,UAAU;IACVQ,SAAS,EAAEP,KAAK,CAACQ,IAAI,CAACrB,mBAAmB;EAC1C,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.resolveScope = resolveScope;
7
+ exports.validateDescriptor = validateDescriptor;
8
+ var _errors = require("../contract/errors.js");
9
+ var _errors2 = require("../diagnostics/errors.js");
10
+ var _hash = require("./hash.js");
11
+ var _normalize = require("./normalize.js");
12
+ /**
13
+ * Scope validation and resolution.
14
+ *
15
+ * Validate, never repair (FR-013). The package never invents, derives, or
16
+ * defaults an identity of its own (FR-008).
17
+ */
18
+
19
+ function invalid(reason) {
20
+ // The reason names the *component*, never its value — naming the value
21
+ // would put a scope component into an error, which FR-014 forbids.
22
+ (0, _errors2.raise)(_errors.DiagnosticCodes.INVALID_SCOPE, {
23
+ message: reason
24
+ });
25
+ }
26
+ function validateComponent(key, raw) {
27
+ if (raw === undefined || raw === null) {
28
+ return;
29
+ }
30
+ if (typeof raw !== 'string') {
31
+ invalid(`scope component ${key} must be a string`);
32
+ }
33
+ const normalized = (0, _normalize.normalizeComponent)(raw);
34
+ if (normalized.length === 0) {
35
+ invalid(`scope component ${key} is empty after normalization`);
36
+ }
37
+ if (_normalize.CONTROL_CHARACTER.test(normalized)) {
38
+ invalid(`scope component ${key} contains a control character`);
39
+ }
40
+ if ((0, _hash.utf8ByteLength)(normalized) > _normalize.MAX_COMPONENT_BYTES) {
41
+ invalid(`scope component ${key} exceeds the maximum length`);
42
+ }
43
+ }
44
+ function validateDescriptor(descriptor) {
45
+ if (!descriptor || typeof descriptor !== 'object') {
46
+ invalid('scope descriptor is required');
47
+ }
48
+ if (!_normalize.SCOPE_KINDS.includes(descriptor.kind)) {
49
+ invalid('scope kind is not recognised');
50
+ }
51
+
52
+ // Guest is the one kind with no identity, by design: an anonymous session
53
+ // still gets its own isolated scope rather than sharing a default.
54
+ if (descriptor.kind !== 'guest') {
55
+ const id = descriptor.id;
56
+ if (typeof id !== 'string' || (0, _normalize.normalizeComponent)(id).length === 0) {
57
+ invalid('scope id is required for this kind');
58
+ }
59
+ }
60
+ for (const key of _normalize.COMPONENT_ORDER) {
61
+ if (key === 'kind') {
62
+ continue;
63
+ }
64
+ validateComponent(key, descriptor[key]);
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Deterministic: identical descriptors always resolve to the same scope, and
70
+ * descriptors differing in any component always resolve to different ones
71
+ * (FR-010).
72
+ */
73
+ function resolveScope(descriptor) {
74
+ validateDescriptor(descriptor);
75
+ const normalized = (0, _normalize.normalizeDescriptor)(descriptor);
76
+ return {
77
+ key: (0, _hash.sha256Hex)(normalized.canonical),
78
+ kind: descriptor.kind
79
+ };
80
+ }
81
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_errors","require","_errors2","_hash","_normalize","invalid","reason","raise","DiagnosticCodes","INVALID_SCOPE","message","validateComponent","key","raw","undefined","normalized","normalizeComponent","length","CONTROL_CHARACTER","test","utf8ByteLength","MAX_COMPONENT_BYTES","validateDescriptor","descriptor","SCOPE_KINDS","includes","kind","id","COMPONENT_ORDER","resolveScope","normalizeDescriptor","sha256Hex","canonical"],"sourceRoot":"../../../src","sources":["scope/validate.ts"],"mappings":";;;;;;;AAOA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAXA;AACA;AACA;AACA;AACA;AACA;;AAeA,SAASI,OAAOA,CAACC,MAAc,EAAS;EACvC;EACA;EACA,IAAAC,cAAK,EAACC,uBAAe,CAACC,aAAa,EAAE;IAAEC,OAAO,EAAEJ;EAAO,CAAC,CAAC;AAC1D;AAEA,SAASK,iBAAiBA,CAACC,GAAW,EAAEC,GAAY,EAAQ;EAC3D,IAAIA,GAAG,KAAKC,SAAS,IAAID,GAAG,KAAK,IAAI,EAAE;IACtC;EACD;EACA,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;IAC5BR,OAAO,CAAC,mBAAmBO,GAAG,mBAAmB,CAAC;EACnD;EACA,MAAMG,UAAU,GAAG,IAAAC,6BAAkB,EAACH,GAAG,CAAC;EAC1C,IAAIE,UAAU,CAACE,MAAM,KAAK,CAAC,EAAE;IAC5BZ,OAAO,CAAC,mBAAmBO,GAAG,+BAA+B,CAAC;EAC/D;EACA,IAAIM,4BAAiB,CAACC,IAAI,CAACJ,UAAU,CAAC,EAAE;IACvCV,OAAO,CAAC,mBAAmBO,GAAG,+BAA+B,CAAC;EAC/D;EACA,IAAI,IAAAQ,oBAAc,EAACL,UAAU,CAAC,GAAGM,8BAAmB,EAAE;IACrDhB,OAAO,CAAC,mBAAmBO,GAAG,6BAA6B,CAAC;EAC7D;AACD;AAEO,SAASU,kBAAkBA,CAACC,UAA8C,EAAQ;EACxF,IAAI,CAACA,UAAU,IAAI,OAAOA,UAAU,KAAK,QAAQ,EAAE;IAClDlB,OAAO,CAAC,8BAA8B,CAAC;EACxC;EACA,IAAI,CAACmB,sBAAW,CAACC,QAAQ,CAACF,UAAU,CAACG,IAAI,CAAC,EAAE;IAC3CrB,OAAO,CAAC,8BAA8B,CAAC;EACxC;;EAEA;EACA;EACA,IAAIkB,UAAU,CAACG,IAAI,KAAK,OAAO,EAAE;IAChC,MAAMC,EAAE,GAAGJ,UAAU,CAACI,EAAE;IACxB,IAAI,OAAOA,EAAE,KAAK,QAAQ,IAAI,IAAAX,6BAAkB,EAACW,EAAE,CAAC,CAACV,MAAM,KAAK,CAAC,EAAE;MAClEZ,OAAO,CAAC,oCAAoC,CAAC;IAC9C;EACD;EAEA,KAAK,MAAMO,GAAG,IAAIgB,0BAAe,EAAE;IAClC,IAAIhB,GAAG,KAAK,MAAM,EAAE;MACnB;IACD;IACAD,iBAAiB,CAACC,GAAG,EAAEW,UAAU,CAACX,GAAG,CAA0B,CAAC;EACjE;AACD;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASiB,YAAYA,CAACN,UAA2B,EAAiB;EACxED,kBAAkB,CAACC,UAAU,CAAC;EAC9B,MAAMR,UAAU,GAAG,IAAAe,8BAAmB,EAACP,UAAU,CAAC;EAClD,OAAO;IACNX,GAAG,EAAE,IAAAmB,eAAS,EAAChB,UAAU,CAACiB,SAAS,CAAC;IACpCN,IAAI,EAAEH,UAAU,CAACG;EAClB,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createSqliteAdapter = createSqliteAdapter;
7
+ var _deletion = require("../adapter/deletion.js");
8
+ var _lifecycle = require("../adapter/lifecycle.js");
9
+ /**
10
+ * The on-device adapter.
11
+ *
12
+ * Deliberately a seam rather than an implementation. Everything it composes
13
+ * lives in `adapter/`, `migration/`, `artifacts/`, and this directory, so the
14
+ * in-memory adapter can be held to the same contract by the same conformance
15
+ * suite (FR-092) without either one being the "real" version the other
16
+ * approximates.
17
+ *
18
+ * Reached only through the lazy require in `adapter/index.ts`, so a consumer
19
+ * that runs the in-memory adapter in tests never loads the native peers.
20
+ */
21
+
22
+ function createSqliteAdapter(options = {}) {
23
+ return {
24
+ name: 'sqlite',
25
+ open: config => (0, _lifecycle.openSqliteDatabase)(config, options),
26
+ deleteScopeData: _deletion.deleteScopeData,
27
+ deleteDatabase: _deletion.deleteDatabase,
28
+ resetScope: _deletion.resetScope
29
+ };
30
+ }
31
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_deletion","require","_lifecycle","createSqliteAdapter","options","name","open","config","openSqliteDatabase","deleteScopeData","deleteDatabase","resetScope"],"sourceRoot":"../../../src","sources":["sqlite/adapter.ts"],"mappings":";;;;;;AAcA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMO,SAASE,mBAAmBA,CAACC,OAAoB,GAAG,CAAC,CAAC,EAAkB;EAC9E,OAAO;IACNC,IAAI,EAAE,QAAQ;IACdC,IAAI,EAAEC,MAAM,IAAI,IAAAC,6BAAkB,EAACD,MAAM,EAAEH,OAAO,CAAC;IACnDK,eAAe,EAAfA,yBAAe;IACfC,cAAc,EAAdA,wBAAc;IACdC,UAAU,EAAVA;EACD,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,218 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.runBatch = runBatch;
7
+ var _errors = require("../contract/errors.js");
8
+ var _errors2 = require("../diagnostics/errors.js");
9
+ var _budgets = require("../query/budgets.js");
10
+ var _declare = require("../schema/declare.js");
11
+ var _statements = require("./statements.js");
12
+ /**
13
+ * Batch writes: many operations, one atomic unit, one outcome (FR-028).
14
+ *
15
+ * Every statement is resolved before any of them runs. That ordering is the
16
+ * point: a conflict or a missing record is reported with the database still
17
+ * untouched, so "the batch failed" and "the batch was partly applied" are
18
+ * never the same event. The statements then go to the engine's own
19
+ * `executeBatch`, which wraps them in a single transaction — the batch is
20
+ * atomic because SQLite makes it atomic, not because this file is careful.
21
+ *
22
+ * Resolution keeps an overlay of what earlier operations in the same batch
23
+ * did, so `insert` followed by `update` on the same id resolves against the
24
+ * batch's own effect rather than against the database as it was before it.
25
+ */
26
+
27
+ function quoted(schema) {
28
+ return `"${(0, _declare.collectionTable)(schema.name)}"`;
29
+ }
30
+
31
+ /**
32
+ * Where a record stands, as this batch has left it so far. Three states, not
33
+ * two: a soft-deleted row is invisible to reads but still holds its primary
34
+ * key, so an insert over it conflicts and an upsert over it restores it — the
35
+ * same rules the collection API applies. Treating it as absent made a batch
36
+ * upsert issue an INSERT and fail the whole batch on the primary key.
37
+ */
38
+
39
+ function conflict(schema, id) {
40
+ (0, _errors2.raise)(_errors.DiagnosticCodes.RECORD_CONFLICT, {
41
+ message: 'record already exists',
42
+ detail: {
43
+ collection: schema.name,
44
+ recordId: id
45
+ }
46
+ });
47
+ }
48
+ function missing(schema, id) {
49
+ (0, _errors2.raise)(_errors.DiagnosticCodes.RECORD_NOT_FOUND, {
50
+ message: 'record not found',
51
+ detail: {
52
+ collection: schema.name,
53
+ recordId: id
54
+ }
55
+ });
56
+ }
57
+ async function resolveInsert(resolver, operation) {
58
+ const {
59
+ schema,
60
+ now
61
+ } = resolver;
62
+ const payload = (0, _budgets.assertRecordWithinBudget)(schema.name, operation.record.data);
63
+ if ((await resolver.state(operation.record.id)) !== 'absent') {
64
+ conflict(schema, operation.record.id);
65
+ }
66
+ resolver.stage(operation.record.id, 'live');
67
+ return {
68
+ command: (0, _statements.insertStatement)(schema, operation.record.id, operation.record.data, now, payload),
69
+ outcome: {
70
+ operation: 'created',
71
+ id: operation.record.id
72
+ }
73
+ };
74
+ }
75
+ async function resolveUpdate(resolver, operation) {
76
+ const {
77
+ schema,
78
+ now
79
+ } = resolver;
80
+ const payload = (0, _budgets.assertRecordWithinBudget)(schema.name, operation.data);
81
+ if ((await resolver.state(operation.id)) !== 'live') {
82
+ missing(schema, operation.id);
83
+ }
84
+ return {
85
+ command: (0, _statements.updateStatement)(schema, operation.id, operation.data, now, payload, {
86
+ restore: false
87
+ }),
88
+ outcome: {
89
+ operation: 'updated',
90
+ id: operation.id
91
+ }
92
+ };
93
+ }
94
+ async function resolveUpsert(resolver, operation) {
95
+ const {
96
+ schema,
97
+ now
98
+ } = resolver;
99
+ const payload = (0, _budgets.assertRecordWithinBudget)(schema.name, operation.record.data);
100
+ const present = (await resolver.state(operation.record.id)) !== 'absent';
101
+ resolver.stage(operation.record.id, 'live');
102
+ return {
103
+ command: present ? (0, _statements.updateStatement)(schema, operation.record.id, operation.record.data, now, payload, {
104
+ restore: true
105
+ }) : (0, _statements.insertStatement)(schema, operation.record.id, operation.record.data, now, payload),
106
+ outcome: {
107
+ operation: present ? 'updated' : 'created',
108
+ id: operation.record.id
109
+ }
110
+ };
111
+ }
112
+ async function resolveDelete(resolver, operation) {
113
+ const {
114
+ schema
115
+ } = resolver;
116
+ if ((await resolver.state(operation.id)) !== 'live') {
117
+ missing(schema, operation.id);
118
+ }
119
+ resolver.stage(operation.id, 'absent');
120
+ return {
121
+ command: [`DELETE FROM ${quoted(schema)} WHERE id = ?`, [operation.id]],
122
+ outcome: {
123
+ operation: 'deleted',
124
+ id: operation.id
125
+ }
126
+ };
127
+ }
128
+ async function resolveSoftDelete(resolver, operation) {
129
+ const {
130
+ schema,
131
+ now
132
+ } = resolver;
133
+ if (!(0, _declare.hasSoftDelete)(schema)) {
134
+ (0, _errors2.raise)(_errors.DiagnosticCodes.CONFIG_INVALID, {
135
+ message: 'collection does not declare soft delete',
136
+ detail: {
137
+ collection: schema.name
138
+ }
139
+ });
140
+ }
141
+ if ((await resolver.state(operation.id)) !== 'live') {
142
+ missing(schema, operation.id);
143
+ }
144
+ resolver.stage(operation.id, 'softDeleted');
145
+ return {
146
+ command: [`UPDATE ${quoted(schema)} SET deleted_at = ? WHERE id = ?`, [now, operation.id]],
147
+ outcome: {
148
+ operation: 'deleted',
149
+ id: operation.id
150
+ }
151
+ };
152
+ }
153
+ function resolveOperation(resolver, operation) {
154
+ switch (operation.type) {
155
+ case 'insert':
156
+ return resolveInsert(resolver, operation);
157
+ case 'update':
158
+ return resolveUpdate(resolver, operation);
159
+ case 'upsert':
160
+ return resolveUpsert(resolver, operation);
161
+ case 'delete':
162
+ return resolveDelete(resolver, operation);
163
+ case 'softDelete':
164
+ return resolveSoftDelete(resolver, operation);
165
+ default:
166
+ (0, _errors2.raise)(_errors.DiagnosticCodes.CONFIG_INVALID, {
167
+ message: 'unsupported batch operation'
168
+ });
169
+ }
170
+ }
171
+ async function runBatch(context, operations) {
172
+ (0, _budgets.assertBatchWithinBudget)(operations.length);
173
+ const commands = [];
174
+ const outcomes = [];
175
+ const overlay = new Map();
176
+
177
+ // What the batch will touch, read once per collection (LDB-08). A batch of a
178
+ // thousand operations used to make a thousand SELECTs before its one write.
179
+ // The ids travel as one JSON parameter, so no variable limit applies.
180
+ const known = new Map();
181
+ const idsByCollection = new Map();
182
+ for (const operation of operations) {
183
+ const id = 'record' in operation ? operation.record.id : operation.id;
184
+ const ids = idsByCollection.get(operation.collection) ?? new Set();
185
+ ids.add(id);
186
+ idsByCollection.set(operation.collection, ids);
187
+ }
188
+ for (const [collection, ids] of idsByCollection) {
189
+ const schema = context.schemaFor(collection);
190
+ const result = await context.connection.execute(`SELECT id, deleted_at FROM ${quoted(schema)} WHERE id IN (SELECT value FROM json_each(?))`, [JSON.stringify([...ids])]);
191
+ for (const row of result.rows) {
192
+ known.set(`${schema.name}:${String(row.id)}`, row.deleted_at === null || row.deleted_at === undefined ? 'live' : 'softDeleted');
193
+ }
194
+ }
195
+ for (const operation of operations) {
196
+ const schema = context.schemaFor(operation.collection);
197
+ const resolver = {
198
+ schema,
199
+ now: context.now(),
200
+ async state(id) {
201
+ const key = `${schema.name}:${id}`;
202
+ return overlay.get(key) ?? known.get(key) ?? 'absent';
203
+ },
204
+ stage(id, state) {
205
+ overlay.set(`${schema.name}:${id}`, state);
206
+ }
207
+ };
208
+ const resolved = await resolveOperation(resolver, operation);
209
+ commands.push(resolved.command);
210
+ outcomes.push(resolved.outcome);
211
+ }
212
+ await context.connection.executeBatch(commands);
213
+ return {
214
+ applied: outcomes.length,
215
+ outcomes
216
+ };
217
+ }
218
+ //# sourceMappingURL=batch.js.map