@bsv/wallet-toolbox 1.1.7 → 1.1.9

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 (317) hide show
  1. package/docs/client.md +3872 -1555
  2. package/docs/monitor.md +29 -27
  3. package/docs/services.md +22 -22
  4. package/docs/setup.md +23 -23
  5. package/docs/storage.md +2747 -438
  6. package/docs/wallet.md +3872 -1555
  7. package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +4 -4
  8. package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -1
  9. package/out/src/monitor/tasks/TaskCheckForProofs.js +2 -2
  10. package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -1
  11. package/out/src/monitor/tasks/TaskSendWaiting.d.ts +2 -2
  12. package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -1
  13. package/out/src/monitor/tasks/TaskSendWaiting.js +2 -2
  14. package/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -1
  15. package/out/src/sdk/StorageSyncReader.d.ts +30 -30
  16. package/out/src/sdk/StorageSyncReader.d.ts.map +1 -1
  17. package/out/src/sdk/StorageSyncReaderWriter.d.ts +60 -60
  18. package/out/src/sdk/StorageSyncReaderWriter.d.ts.map +1 -1
  19. package/out/src/sdk/WalletStorage.interfaces.d.ts +36 -36
  20. package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
  21. package/out/src/signer/methods/acquireDirectCertificate.d.ts.map +1 -1
  22. package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -1
  23. package/out/src/storage/StorageKnex.d.ts +61 -61
  24. package/out/src/storage/StorageKnex.d.ts.map +1 -1
  25. package/out/src/storage/StorageKnex.js +13 -4
  26. package/out/src/storage/StorageKnex.js.map +1 -1
  27. package/out/src/storage/StorageProvider.d.ts +16 -15
  28. package/out/src/storage/StorageProvider.d.ts.map +1 -1
  29. package/out/src/storage/StorageProvider.js +8 -8
  30. package/out/src/storage/StorageProvider.js.map +1 -1
  31. package/out/src/storage/StorageReader.d.ts +21 -21
  32. package/out/src/storage/StorageReader.d.ts.map +1 -1
  33. package/out/src/storage/StorageReader.js.map +1 -1
  34. package/out/src/storage/StorageReaderWriter.d.ts +60 -60
  35. package/out/src/storage/StorageReaderWriter.d.ts.map +1 -1
  36. package/out/src/storage/StorageReaderWriter.js.map +1 -1
  37. package/out/src/storage/StorageSyncReader.d.ts +17 -17
  38. package/out/src/storage/StorageSyncReader.d.ts.map +1 -1
  39. package/out/src/storage/StorageSyncReader.js.map +1 -1
  40. package/out/src/storage/WalletStorageManager.d.ts +9 -9
  41. package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
  42. package/out/src/storage/WalletStorageManager.js +2 -2
  43. package/out/src/storage/WalletStorageManager.js.map +1 -1
  44. package/out/src/storage/index.all.d.ts +2 -2
  45. package/out/src/storage/index.all.d.ts.map +1 -1
  46. package/out/src/storage/index.all.js +3 -3
  47. package/out/src/storage/index.all.js.map +1 -1
  48. package/out/src/storage/index.client.d.ts +2 -2
  49. package/out/src/storage/index.client.d.ts.map +1 -1
  50. package/out/src/storage/index.client.js +2 -25
  51. package/out/src/storage/index.client.js.map +1 -1
  52. package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +3 -3
  53. package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
  54. package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -1
  55. package/out/src/storage/methods/createAction.d.ts.map +1 -1
  56. package/out/src/storage/methods/createAction.js +1 -1
  57. package/out/src/storage/methods/createAction.js.map +1 -1
  58. package/out/src/storage/methods/getBeefForTransaction.js +2 -2
  59. package/out/src/storage/methods/getBeefForTransaction.js.map +1 -1
  60. package/out/src/storage/methods/getSyncChunk.d.ts.map +1 -1
  61. package/out/src/storage/methods/getSyncChunk.js.map +1 -1
  62. package/out/src/storage/methods/internalizeAction.d.ts.map +1 -1
  63. package/out/src/storage/methods/internalizeAction.js +1 -1
  64. package/out/src/storage/methods/internalizeAction.js.map +1 -1
  65. package/out/src/storage/methods/listActions.js.map +1 -1
  66. package/out/src/storage/methods/listCertificates.d.ts.map +1 -1
  67. package/out/src/storage/methods/listCertificates.js.map +1 -1
  68. package/out/src/storage/methods/listOutputs.js.map +1 -1
  69. package/out/src/storage/methods/processAction.d.ts +4 -4
  70. package/out/src/storage/methods/processAction.d.ts.map +1 -1
  71. package/out/src/storage/methods/processAction.js +2 -2
  72. package/out/src/storage/methods/processAction.js.map +1 -1
  73. package/out/src/storage/methods/purgeData.d.ts.map +1 -1
  74. package/out/src/storage/methods/purgeData.js.map +1 -1
  75. package/out/src/storage/methods/reviewStatus.js.map +1 -1
  76. package/out/src/storage/remoting/StorageClient.d.ts +230 -15
  77. package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
  78. package/out/src/storage/remoting/StorageClient.js +222 -7
  79. package/out/src/storage/remoting/StorageClient.js.map +1 -1
  80. package/out/src/storage/schema/entities/Certificate.d.ts +9 -9
  81. package/out/src/storage/schema/entities/Certificate.d.ts.map +1 -1
  82. package/out/src/storage/schema/entities/Certificate.js +5 -5
  83. package/out/src/storage/schema/entities/Certificate.js.map +1 -1
  84. package/out/src/storage/schema/entities/CertificateField.d.ts +9 -9
  85. package/out/src/storage/schema/entities/CertificateField.d.ts.map +1 -1
  86. package/out/src/storage/schema/entities/CertificateField.js +5 -5
  87. package/out/src/storage/schema/entities/CertificateField.js.map +1 -1
  88. package/out/src/storage/schema/entities/Commission.d.ts +9 -9
  89. package/out/src/storage/schema/entities/Commission.d.ts.map +1 -1
  90. package/out/src/storage/schema/entities/Commission.js +5 -5
  91. package/out/src/storage/schema/entities/Commission.js.map +1 -1
  92. package/out/src/storage/schema/entities/EntityBase.d.ts +1 -1
  93. package/out/src/storage/schema/entities/MergeEntity.d.ts +6 -7
  94. package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -1
  95. package/out/src/storage/schema/entities/MergeEntity.js.map +1 -1
  96. package/out/src/storage/schema/entities/Output.d.ts +9 -9
  97. package/out/src/storage/schema/entities/Output.d.ts.map +1 -1
  98. package/out/src/storage/schema/entities/Output.js +5 -5
  99. package/out/src/storage/schema/entities/Output.js.map +1 -1
  100. package/out/src/storage/schema/entities/OutputBasket.d.ts +9 -9
  101. package/out/src/storage/schema/entities/OutputBasket.d.ts.map +1 -1
  102. package/out/src/storage/schema/entities/OutputBasket.js +5 -5
  103. package/out/src/storage/schema/entities/OutputBasket.js.map +1 -1
  104. package/out/src/storage/schema/entities/OutputTag.d.ts +9 -9
  105. package/out/src/storage/schema/entities/OutputTag.d.ts.map +1 -1
  106. package/out/src/storage/schema/entities/OutputTag.js +5 -5
  107. package/out/src/storage/schema/entities/OutputTag.js.map +1 -1
  108. package/out/src/storage/schema/entities/OutputTagMap.d.ts +9 -9
  109. package/out/src/storage/schema/entities/OutputTagMap.d.ts.map +1 -1
  110. package/out/src/storage/schema/entities/OutputTagMap.js +5 -5
  111. package/out/src/storage/schema/entities/OutputTagMap.js.map +1 -1
  112. package/out/src/storage/schema/entities/ProvenTx.d.ts +11 -11
  113. package/out/src/storage/schema/entities/ProvenTx.d.ts.map +1 -1
  114. package/out/src/storage/schema/entities/ProvenTx.js +11 -11
  115. package/out/src/storage/schema/entities/ProvenTx.js.map +1 -1
  116. package/out/src/storage/schema/entities/ProvenTxReq.d.ts +19 -19
  117. package/out/src/storage/schema/entities/ProvenTxReq.d.ts.map +1 -1
  118. package/out/src/storage/schema/entities/ProvenTxReq.js +13 -13
  119. package/out/src/storage/schema/entities/ProvenTxReq.js.map +1 -1
  120. package/out/src/storage/schema/entities/SyncState.d.ts +11 -11
  121. package/out/src/storage/schema/entities/SyncState.d.ts.map +1 -1
  122. package/out/src/storage/schema/entities/SyncState.js +27 -27
  123. package/out/src/storage/schema/entities/SyncState.js.map +1 -1
  124. package/out/src/storage/schema/entities/Transaction.d.ts +11 -11
  125. package/out/src/storage/schema/entities/Transaction.d.ts.map +1 -1
  126. package/out/src/storage/schema/entities/Transaction.js +6 -6
  127. package/out/src/storage/schema/entities/Transaction.js.map +1 -1
  128. package/out/src/storage/schema/entities/TxLabel.d.ts +9 -9
  129. package/out/src/storage/schema/entities/TxLabel.d.ts.map +1 -1
  130. package/out/src/storage/schema/entities/TxLabel.js +5 -5
  131. package/out/src/storage/schema/entities/TxLabel.js.map +1 -1
  132. package/out/src/storage/schema/entities/TxLabelMap.d.ts +9 -9
  133. package/out/src/storage/schema/entities/TxLabelMap.d.ts.map +1 -1
  134. package/out/src/storage/schema/entities/TxLabelMap.js +5 -5
  135. package/out/src/storage/schema/entities/TxLabelMap.js.map +1 -1
  136. package/out/src/storage/schema/entities/User.d.ts +9 -9
  137. package/out/src/storage/schema/entities/User.d.ts.map +1 -1
  138. package/out/src/storage/schema/entities/User.js +5 -5
  139. package/out/src/storage/schema/entities/User.js.map +1 -1
  140. package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js +20 -307
  141. package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js.map +1 -1
  142. package/out/src/storage/schema/entities/__tests/CertificateTests.test.js +17 -158
  143. package/out/src/storage/schema/entities/__tests/CertificateTests.test.js.map +1 -1
  144. package/out/src/storage/schema/entities/__tests/CommissionTests.test.js +23 -309
  145. package/out/src/storage/schema/entities/__tests/CommissionTests.test.js.map +1 -1
  146. package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js +19 -306
  147. package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js.map +1 -1
  148. package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js +19 -306
  149. package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js.map +1 -1
  150. package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js +23 -237
  151. package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js.map +1 -1
  152. package/out/src/storage/schema/entities/__tests/OutputTests.test.js +20 -233
  153. package/out/src/storage/schema/entities/__tests/OutputTests.test.js.map +1 -1
  154. package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js +27 -98
  155. package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js.map +1 -1
  156. package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js +25 -241
  157. package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js.map +1 -1
  158. package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js +38 -112
  159. package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js.map +1 -1
  160. package/out/src/storage/schema/entities/__tests/TransactionTests.test.js +39 -323
  161. package/out/src/storage/schema/entities/__tests/TransactionTests.test.js.map +1 -1
  162. package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js +31 -169
  163. package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js.map +1 -1
  164. package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js +16 -159
  165. package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js.map +1 -1
  166. package/out/src/storage/schema/entities/__tests/usersTests.test.js +21 -168
  167. package/out/src/storage/schema/entities/__tests/usersTests.test.js.map +1 -1
  168. package/out/src/storage/schema/tables/Certificate.d.ts +4 -4
  169. package/out/src/storage/schema/tables/Certificate.d.ts.map +1 -1
  170. package/out/src/storage/schema/tables/CertificateField.d.ts +1 -1
  171. package/out/src/storage/schema/tables/CertificateField.d.ts.map +1 -1
  172. package/out/src/storage/schema/tables/Commission.d.ts +1 -1
  173. package/out/src/storage/schema/tables/Commission.d.ts.map +1 -1
  174. package/out/src/storage/schema/tables/MonitorEvent.d.ts +1 -1
  175. package/out/src/storage/schema/tables/MonitorEvent.d.ts.map +1 -1
  176. package/out/src/storage/schema/tables/Output.d.ts +5 -5
  177. package/out/src/storage/schema/tables/Output.d.ts.map +1 -1
  178. package/out/src/storage/schema/tables/OutputBasket.d.ts +1 -1
  179. package/out/src/storage/schema/tables/OutputBasket.d.ts.map +1 -1
  180. package/out/src/storage/schema/tables/OutputTag.d.ts +1 -1
  181. package/out/src/storage/schema/tables/OutputTag.d.ts.map +1 -1
  182. package/out/src/storage/schema/tables/OutputTagMap.d.ts +1 -1
  183. package/out/src/storage/schema/tables/OutputTagMap.d.ts.map +1 -1
  184. package/out/src/storage/schema/tables/ProvenTx.d.ts +1 -1
  185. package/out/src/storage/schema/tables/ProvenTx.d.ts.map +1 -1
  186. package/out/src/storage/schema/tables/ProvenTxReq.d.ts +2 -2
  187. package/out/src/storage/schema/tables/ProvenTxReq.d.ts.map +1 -1
  188. package/out/src/storage/schema/tables/SyncState.d.ts +1 -1
  189. package/out/src/storage/schema/tables/SyncState.d.ts.map +1 -1
  190. package/out/src/storage/schema/tables/{Settings.d.ts → TableSettings.d.ts} +2 -2
  191. package/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -0
  192. package/out/src/storage/schema/tables/{Settings.js → TableSettings.js} +1 -1
  193. package/out/src/storage/schema/tables/TableSettings.js.map +1 -0
  194. package/out/src/storage/schema/tables/Transaction.d.ts +1 -1
  195. package/out/src/storage/schema/tables/Transaction.d.ts.map +1 -1
  196. package/out/src/storage/schema/tables/TxLabel.d.ts +1 -1
  197. package/out/src/storage/schema/tables/TxLabel.d.ts.map +1 -1
  198. package/out/src/storage/schema/tables/TxLabelMap.d.ts +1 -1
  199. package/out/src/storage/schema/tables/TxLabelMap.d.ts.map +1 -1
  200. package/out/src/storage/schema/tables/User.d.ts +1 -1
  201. package/out/src/storage/schema/tables/User.d.ts.map +1 -1
  202. package/out/src/storage/schema/tables/index.d.ts +1 -1
  203. package/out/src/storage/schema/tables/index.d.ts.map +1 -1
  204. package/out/src/storage/schema/tables/index.js +1 -1
  205. package/out/src/storage/schema/tables/index.js.map +1 -1
  206. package/out/src/storage/sync/StorageMySQLDojoReader.d.ts +17 -17
  207. package/out/src/storage/sync/StorageMySQLDojoReader.d.ts.map +1 -1
  208. package/out/src/storage/sync/StorageMySQLDojoReader.js +2 -2
  209. package/out/src/storage/sync/StorageMySQLDojoReader.js.map +1 -1
  210. package/out/test/Wallet/certificate/listCertificates.test.js.map +1 -1
  211. package/out/test/Wallet/live/walletLive.man.test.js +1 -1
  212. package/out/test/Wallet/live/walletLive.man.test.js.map +1 -1
  213. package/out/test/monitor/Monitor.test.js +7 -7
  214. package/out/test/monitor/Monitor.test.js.map +1 -1
  215. package/out/test/storage/StorageMySQLDojoReader.man.test.js +1 -1
  216. package/out/test/storage/StorageMySQLDojoReader.man.test.js.map +1 -1
  217. package/out/test/storage/insert.test.js.map +1 -1
  218. package/out/test/storage/update.test.js.map +1 -1
  219. package/out/test/storage/update2.test.js.map +1 -1
  220. package/out/test/utils/TestUtilsWalletStorage.d.ts +56 -56
  221. package/out/test/utils/TestUtilsWalletStorage.d.ts.map +1 -1
  222. package/out/test/utils/TestUtilsWalletStorage.js +11 -4
  223. package/out/test/utils/TestUtilsWalletStorage.js.map +1 -1
  224. package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js.map +1 -1
  225. package/out/tsconfig.all.tsbuildinfo +1 -1
  226. package/package.json +2 -2
  227. package/src/monitor/tasks/TaskCheckForProofs.ts +11 -10
  228. package/src/monitor/tasks/TaskSendWaiting.ts +5 -5
  229. package/src/sdk/StorageSyncReader.ts +48 -30
  230. package/src/sdk/StorageSyncReaderWriter.ts +77 -63
  231. package/src/sdk/WalletStorage.interfaces.ts +55 -36
  232. package/src/signer/methods/acquireDirectCertificate.ts +2 -2
  233. package/src/storage/StorageKnex.ts +137 -106
  234. package/src/storage/StorageProvider.ts +43 -30
  235. package/src/storage/StorageReader.ts +37 -21
  236. package/src/storage/StorageReaderWriter.ts +78 -65
  237. package/src/storage/StorageSyncReader.ts +35 -17
  238. package/src/storage/WalletStorageManager.ts +18 -12
  239. package/src/storage/index.all.ts +2 -2
  240. package/src/storage/index.client.ts +2 -2
  241. package/src/storage/methods/attemptToPostReqsToNetwork.ts +3 -3
  242. package/src/storage/methods/createAction.ts +29 -26
  243. package/src/storage/methods/getBeefForTransaction.ts +3 -3
  244. package/src/storage/methods/getSyncChunk.ts +28 -13
  245. package/src/storage/methods/internalizeAction.ts +19 -17
  246. package/src/storage/methods/listActions.ts +5 -5
  247. package/src/storage/methods/listCertificates.ts +2 -2
  248. package/src/storage/methods/listOutputs.ts +5 -5
  249. package/src/storage/methods/processAction.ts +21 -17
  250. package/src/storage/methods/purgeData.ts +17 -11
  251. package/src/storage/methods/reviewStatus.ts +4 -4
  252. package/src/storage/remoting/StorageClient.ts +250 -26
  253. package/src/storage/schema/entities/Certificate.ts +16 -17
  254. package/src/storage/schema/entities/CertificateField.ts +17 -18
  255. package/src/storage/schema/entities/Commission.ts +16 -20
  256. package/src/storage/schema/entities/EntityBase.ts +1 -1
  257. package/src/storage/schema/entities/MergeEntity.ts +7 -7
  258. package/src/storage/schema/entities/Output.ts +16 -20
  259. package/src/storage/schema/entities/OutputBasket.ts +16 -17
  260. package/src/storage/schema/entities/OutputTag.ts +16 -20
  261. package/src/storage/schema/entities/OutputTagMap.ts +17 -18
  262. package/src/storage/schema/entities/ProvenTx.ts +24 -28
  263. package/src/storage/schema/entities/ProvenTxReq.ts +42 -45
  264. package/src/storage/schema/entities/SyncState.ts +61 -38
  265. package/src/storage/schema/entities/Transaction.ts +23 -23
  266. package/src/storage/schema/entities/TxLabel.ts +16 -17
  267. package/src/storage/schema/entities/TxLabelMap.ts +16 -20
  268. package/src/storage/schema/entities/User.ts +15 -19
  269. package/src/storage/schema/entities/__tests/CertificateFieldTests.test.ts +39 -318
  270. package/src/storage/schema/entities/__tests/CertificateTests.test.ts +29 -169
  271. package/src/storage/schema/entities/__tests/CommissionTests.test.ts +47 -325
  272. package/src/storage/schema/entities/__tests/OutputBasketTests.test.ts +35 -316
  273. package/src/storage/schema/entities/__tests/OutputTagMapTests.test.ts +38 -318
  274. package/src/storage/schema/entities/__tests/OutputTagTests.test.ts +36 -249
  275. package/src/storage/schema/entities/__tests/OutputTests.test.ts +30 -244
  276. package/src/storage/schema/entities/__tests/ProvenTxReqTests.test.ts +35 -101
  277. package/src/storage/schema/entities/__tests/ProvenTxTests.test.ts +27 -243
  278. package/src/storage/schema/entities/__tests/SyncStateTests.test.ts +54 -122
  279. package/src/storage/schema/entities/__tests/TransactionTests.test.ts +53 -333
  280. package/src/storage/schema/entities/__tests/TxLabelMapTests.test.ts +44 -177
  281. package/src/storage/schema/entities/__tests/TxLabelTests.test.ts +19 -163
  282. package/src/storage/schema/entities/__tests/usersTests.test.ts +31 -179
  283. package/src/storage/schema/tables/Certificate.ts +4 -4
  284. package/src/storage/schema/tables/CertificateField.ts +1 -1
  285. package/src/storage/schema/tables/Commission.ts +1 -1
  286. package/src/storage/schema/tables/MonitorEvent.ts +1 -1
  287. package/src/storage/schema/tables/Output.ts +5 -5
  288. package/src/storage/schema/tables/OutputBasket.ts +1 -1
  289. package/src/storage/schema/tables/OutputTag.ts +1 -1
  290. package/src/storage/schema/tables/OutputTagMap.ts +1 -1
  291. package/src/storage/schema/tables/ProvenTx.ts +1 -1
  292. package/src/storage/schema/tables/ProvenTxReq.ts +2 -2
  293. package/src/storage/schema/tables/SyncState.ts +1 -1
  294. package/src/storage/schema/tables/{Settings.ts → TableSettings.ts} +3 -1
  295. package/src/storage/schema/tables/Transaction.ts +1 -1
  296. package/src/storage/schema/tables/TxLabel.ts +1 -1
  297. package/src/storage/schema/tables/TxLabelMap.ts +1 -1
  298. package/src/storage/schema/tables/User.ts +1 -1
  299. package/src/storage/schema/tables/index.ts +1 -1
  300. package/src/storage/sync/StorageMySQLDojoReader.ts +68 -50
  301. package/test/Wallet/certificate/listCertificates.test.ts +12 -8
  302. package/test/Wallet/live/walletLive.man.test.ts +6 -6
  303. package/test/monitor/Monitor.test.ts +8 -8
  304. package/test/storage/StorageMySQLDojoReader.man.test.ts +1 -1
  305. package/test/storage/insert.test.ts +2 -2
  306. package/test/storage/update.test.ts +30 -30
  307. package/test/storage/update2.test.ts +23 -24
  308. package/test/utils/TestUtilsWalletStorage.ts +103 -82
  309. package/test/wallet/action/createActionToGenerateBeefs.man.test.ts +1 -2
  310. package/ts2md.json +1 -1
  311. package/out/src/storage/index.db.d.ts +0 -1
  312. package/out/src/storage/index.db.d.ts.map +0 -1
  313. package/out/src/storage/index.db.js +0 -2
  314. package/out/src/storage/index.db.js.map +0 -1
  315. package/out/src/storage/schema/tables/Settings.d.ts.map +0 -1
  316. package/out/src/storage/schema/tables/Settings.js.map +0 -1
  317. package/src/storage/index.db.ts +0 -0
@@ -1,5 +1,5 @@
1
- import { User } from '../../../../../src/storage/schema/entities/User'
2
- import { entity, table, sdk } from '../../../../../src'
1
+ import { EntityUser } from '../../../../../src/storage/schema/entities/User'
2
+ import { createSyncMap, sdk, SyncMap, TableUser } from '../../../../../src'
3
3
  import {
4
4
  TestUtilsWalletStorage as _tu,
5
5
  TestWalletNoSetup
@@ -34,7 +34,7 @@ describe('User class method tests', () => {
34
34
 
35
35
  // Test: Default constructor behavior
36
36
  test('1_creates_user_with_default_values', () => {
37
- const user = new User()
37
+ const user = new EntityUser()
38
38
 
39
39
  // Default values
40
40
  expect(user.userId).toBe(0)
@@ -47,13 +47,13 @@ describe('User class method tests', () => {
47
47
  // Test: Constructor with provided API object
48
48
  test('2_creates_user_with_provided_api_object', () => {
49
49
  const now = new Date()
50
- const apiObject: table.User = {
50
+ const apiObject: TableUser = {
51
51
  userId: 42,
52
52
  created_at: now,
53
53
  updated_at: now,
54
54
  identityKey: 'testIdentityKey'
55
55
  }
56
- const user = new User(apiObject)
56
+ const user = new EntityUser(apiObject)
57
57
 
58
58
  // Verify all properties match the API object
59
59
  expect(user.userId).toBe(42)
@@ -64,7 +64,7 @@ describe('User class method tests', () => {
64
64
 
65
65
  // Test: Getters and setters behavior
66
66
  test('3_getters_and_setters_work_correctly', () => {
67
- const user = new User()
67
+ const user = new EntityUser()
68
68
 
69
69
  // Test setting values
70
70
  const now = new Date()
@@ -87,7 +87,7 @@ describe('User class method tests', () => {
87
87
  for (const ctx1 of ctxs) {
88
88
  for (const ctx2 of ctxs2) {
89
89
  // Insert the first user into the first database
90
- const user1 = new User({
90
+ const user1 = new EntityUser({
91
91
  userId: 2,
92
92
  identityKey: 'key1',
93
93
  created_at: new Date('2023-01-01'),
@@ -96,7 +96,7 @@ describe('User class method tests', () => {
96
96
  await ctx1.activeStorage.insertUser(user1.toApi())
97
97
 
98
98
  // Insert a matching user into the second database
99
- const user2 = new User({
99
+ const user2 = new EntityUser({
100
100
  userId: 3, // Different ID
101
101
  identityKey: 'key1', // Same key
102
102
  created_at: new Date('2023-01-01'),
@@ -104,81 +104,7 @@ describe('User class method tests', () => {
104
104
  })
105
105
  await ctx2.activeStorage.insertUser(user2.toApi())
106
106
 
107
- // Create a valid SyncMap mapping IDs from db1 to db2
108
- const syncMap: entity.SyncMap = {
109
- transaction: {
110
- idMap: { [user1.userId]: user2.userId },
111
- entityName: 'Transaction',
112
- maxUpdated_at: undefined,
113
- count: 1
114
- },
115
- provenTx: {
116
- idMap: {},
117
- entityName: 'ProvenTx',
118
- maxUpdated_at: undefined,
119
- count: 0
120
- },
121
- outputBasket: {
122
- idMap: {},
123
- entityName: 'OutputBasket',
124
- maxUpdated_at: undefined,
125
- count: 0
126
- },
127
- provenTxReq: {
128
- idMap: {},
129
- entityName: 'ProvenTxReq',
130
- maxUpdated_at: undefined,
131
- count: 0
132
- },
133
- txLabel: {
134
- idMap: {},
135
- entityName: 'TxLabel',
136
- maxUpdated_at: undefined,
137
- count: 0
138
- },
139
- txLabelMap: {
140
- idMap: {},
141
- entityName: 'TxLabelMap',
142
- maxUpdated_at: undefined,
143
- count: 0
144
- },
145
- output: {
146
- idMap: {},
147
- entityName: 'Output',
148
- maxUpdated_at: undefined,
149
- count: 0
150
- },
151
- outputTag: {
152
- idMap: {},
153
- entityName: 'OutputTag',
154
- maxUpdated_at: undefined,
155
- count: 0
156
- },
157
- outputTagMap: {
158
- idMap: {},
159
- entityName: 'OutputTagMap',
160
- maxUpdated_at: undefined,
161
- count: 0
162
- },
163
- certificate: {
164
- idMap: {},
165
- entityName: 'Certificate',
166
- maxUpdated_at: undefined,
167
- count: 0
168
- },
169
- certificateField: {
170
- idMap: {},
171
- entityName: 'CertificateField',
172
- maxUpdated_at: undefined,
173
- count: 0
174
- },
175
- commission: {
176
- idMap: {},
177
- entityName: 'Commission',
178
- maxUpdated_at: undefined,
179
- count: 0
180
- }
181
- }
107
+ const syncMap = createSyncMap()
182
108
 
183
109
  // Verify the entities match across databases
184
110
  expect(user1.equals(user2.toApi(), syncMap)).toBe(true) // Should match
@@ -191,7 +117,7 @@ describe('User class method tests', () => {
191
117
  for (const ctx1 of ctxs) {
192
118
  for (const ctx2 of ctxs2) {
193
119
  // Insert the first user into the first database
194
- const user1 = new User({
120
+ const user1 = new EntityUser({
195
121
  userId: 4,
196
122
  identityKey: 'key2',
197
123
  created_at: new Date('2023-01-01'),
@@ -200,7 +126,7 @@ describe('User class method tests', () => {
200
126
  await ctx1.activeStorage.insertUser(user1.toApi())
201
127
 
202
128
  // Insert a user with a different key into the second database
203
- const user2 = new User({
129
+ const user2 = new EntityUser({
204
130
  userId: 5, // Different ID
205
131
  identityKey: 'key3', // Different key
206
132
  created_at: new Date('2023-01-01'),
@@ -208,81 +134,7 @@ describe('User class method tests', () => {
208
134
  })
209
135
  await ctx2.activeStorage.insertUser(user2.toApi())
210
136
 
211
- // Create a valid SyncMap mapping IDs from db1 to db2
212
- const syncMap: entity.SyncMap = {
213
- transaction: {
214
- idMap: { [user1.userId]: user2.userId },
215
- entityName: 'Transaction',
216
- maxUpdated_at: undefined,
217
- count: 1
218
- },
219
- provenTx: {
220
- idMap: {},
221
- entityName: 'ProvenTx',
222
- maxUpdated_at: undefined,
223
- count: 0
224
- },
225
- outputBasket: {
226
- idMap: {},
227
- entityName: 'OutputBasket',
228
- maxUpdated_at: undefined,
229
- count: 0
230
- },
231
- provenTxReq: {
232
- idMap: {},
233
- entityName: 'ProvenTxReq',
234
- maxUpdated_at: undefined,
235
- count: 0
236
- },
237
- txLabel: {
238
- idMap: {},
239
- entityName: 'TxLabel',
240
- maxUpdated_at: undefined,
241
- count: 0
242
- },
243
- txLabelMap: {
244
- idMap: {},
245
- entityName: 'TxLabelMap',
246
- maxUpdated_at: undefined,
247
- count: 0
248
- },
249
- output: {
250
- idMap: {},
251
- entityName: 'Output',
252
- maxUpdated_at: undefined,
253
- count: 0
254
- },
255
- outputTag: {
256
- idMap: {},
257
- entityName: 'OutputTag',
258
- maxUpdated_at: undefined,
259
- count: 0
260
- },
261
- outputTagMap: {
262
- idMap: {},
263
- entityName: 'OutputTagMap',
264
- maxUpdated_at: undefined,
265
- count: 0
266
- },
267
- certificate: {
268
- idMap: {},
269
- entityName: 'Certificate',
270
- maxUpdated_at: undefined,
271
- count: 0
272
- },
273
- certificateField: {
274
- idMap: {},
275
- entityName: 'CertificateField',
276
- maxUpdated_at: undefined,
277
- count: 0
278
- },
279
- commission: {
280
- idMap: {},
281
- entityName: 'Commission',
282
- maxUpdated_at: undefined,
283
- count: 0
284
- }
285
- }
137
+ const syncMap = createSyncMap()
286
138
 
287
139
  // Verify the entities do not match across databases
288
140
  expect(user1.equals(user2.toApi(), syncMap)).toBe(false) // Should not match
@@ -296,12 +148,12 @@ describe('User class method tests', () => {
296
148
  const pastDate = new Date(now.getTime() - 1000000)
297
149
 
298
150
  // Provide incomplete API object
299
- const partialApiObject: Partial<table.User> = {
151
+ const partialApiObject: Partial<TableUser> = {
300
152
  userId: 123,
301
153
  created_at: pastDate
302
154
  }
303
155
 
304
- const user = new User(partialApiObject as table.User)
156
+ const user = new EntityUser(partialApiObject as TableUser)
305
157
 
306
158
  // Default values should fill in missing fields
307
159
  expect(user.userId).toBe(123)
@@ -316,13 +168,13 @@ describe('User class method tests', () => {
316
168
  const largeUserId = Number.MAX_SAFE_INTEGER
317
169
  const longIdentityKey = 'x'.repeat(1000)
318
170
 
319
- const apiObject: table.User = {
171
+ const apiObject: TableUser = {
320
172
  userId: largeUserId,
321
173
  created_at: now,
322
174
  updated_at: now,
323
175
  identityKey: longIdentityKey
324
176
  }
325
- const user = new User(apiObject)
177
+ const user = new EntityUser(apiObject)
326
178
 
327
179
  expect(user.userId).toBe(largeUserId)
328
180
  expect(user.identityKey).toBe(longIdentityKey)
@@ -330,8 +182,8 @@ describe('User class method tests', () => {
330
182
 
331
183
  // Test: Handles empty API object
332
184
  test('10_handles_empty_api_object', () => {
333
- const emptyApiObject: table.User = {} as table.User
334
- const user = new User(emptyApiObject)
185
+ const emptyApiObject: TableUser = {} as TableUser
186
+ const user = new EntityUser(emptyApiObject)
335
187
 
336
188
  // Default values should be applied but constructor does not set default values for empty object
337
189
  expect(user.userId).toBeUndefined()
@@ -342,7 +194,7 @@ describe('User class method tests', () => {
342
194
 
343
195
  // Test: `id` getter and setter
344
196
  test('11_id_getter_and_setter_work_correctly', () => {
345
- const user = new User()
197
+ const user = new EntityUser()
346
198
 
347
199
  user.id = 123 // Test setter
348
200
  expect(user.id).toBe(123) // Test getter
@@ -350,21 +202,21 @@ describe('User class method tests', () => {
350
202
 
351
203
  // Test: `entityName` getter
352
204
  test('12_entityName_returns_User', () => {
353
- const user = new User()
205
+ const user = new EntityUser()
354
206
 
355
- expect(user.entityName).toBe('User')
207
+ expect(user.entityName).toBe('user')
356
208
  })
357
209
 
358
210
  // Test: `entityTable` getter
359
211
  test('13_entityTable_returns_users', () => {
360
- const user = new User()
212
+ const user = new EntityUser()
361
213
 
362
214
  expect(user.entityTable).toBe('users')
363
215
  })
364
216
 
365
217
  // Test: `mergeExisting` updates user when `ei.updated_at` is newer
366
218
  test('14_mergeExisting_updates_user_when_ei_updated_at_is_newer', async () => {
367
- const user = new User({
219
+ const user = new EntityUser({
368
220
  userId: 1,
369
221
  created_at: new Date('2023-01-01'),
370
222
  updated_at: new Date('2023-01-01'),
@@ -372,7 +224,7 @@ describe('User class method tests', () => {
372
224
  activeStorage: 'oldStorage'
373
225
  })
374
226
 
375
- const updatedEi: table.User = {
227
+ const updatedEi: TableUser = {
376
228
  userId: 1,
377
229
  created_at: new Date('2023-01-01'),
378
230
  updated_at: new Date('2023-02-01'), // Newer `updated_at`
@@ -382,7 +234,7 @@ describe('User class method tests', () => {
382
234
 
383
235
  const result = await user.mergeExisting(
384
236
  {
385
- updateUser: async (id: number, data: table.User) => {
237
+ updateUser: async (id: number, data: TableUser) => {
386
238
  expect(id).toBe(1)
387
239
  expect(data.activeStorage).toBe('newStorage')
388
240
  expect(data.updated_at).toBeInstanceOf(Date)
@@ -399,7 +251,7 @@ describe('User class method tests', () => {
399
251
 
400
252
  // Test: `mergeExisting` does not update user when `ei.updated_at` is older
401
253
  test('15_mergeExisting_does_not_update_user_when_ei_updated_at_is_older', async () => {
402
- const user = new User({
254
+ const user = new EntityUser({
403
255
  userId: 1,
404
256
  created_at: new Date('2023-01-01'),
405
257
  updated_at: new Date('2023-02-01'),
@@ -407,7 +259,7 @@ describe('User class method tests', () => {
407
259
  activeStorage: 'oldStorage'
408
260
  })
409
261
 
410
- const olderEi: table.User = {
262
+ const olderEi: TableUser = {
411
263
  userId: 1,
412
264
  created_at: new Date('2023-01-01'),
413
265
  updated_at: new Date('2023-01-01'), // Older `updated_at`
@@ -432,7 +284,7 @@ describe('User class method tests', () => {
432
284
 
433
285
  // Test: `mergeExisting` updates user and uses `trx` when provided
434
286
  test('16_mergeExisting_updates_user_with_trx', async () => {
435
- const user = new User({
287
+ const user = new EntityUser({
436
288
  userId: 1,
437
289
  created_at: new Date('2023-01-01'),
438
290
  updated_at: new Date('2023-01-01'),
@@ -440,7 +292,7 @@ describe('User class method tests', () => {
440
292
  activeStorage: 'oldStorage'
441
293
  })
442
294
 
443
- const updatedEi: table.User = {
295
+ const updatedEi: TableUser = {
444
296
  userId: 1,
445
297
  created_at: new Date('2023-01-01'),
446
298
  updated_at: new Date('2023-02-01'), // Newer `updated_at`
@@ -452,7 +304,7 @@ describe('User class method tests', () => {
452
304
 
453
305
  const result = await user.mergeExisting(
454
306
  {
455
- updateUser: async (id: number, data: table.User, trx: any) => {
307
+ updateUser: async (id: number, data: TableUser, trx: any) => {
456
308
  expect(id).toBe(1)
457
309
  expect(data.activeStorage).toBe('newStorage')
458
310
  expect(data.updated_at).toBeInstanceOf(Date)
@@ -471,7 +323,7 @@ describe('User class method tests', () => {
471
323
 
472
324
  // Test: `mergeNew` always throws an error
473
325
  test('17_mergeNew_always_throws_error', async () => {
474
- const user = new User()
326
+ const user = new EntityUser()
475
327
  const storage = {} // Placeholder for `storage`, not used in this case.
476
328
  const userId = 123 // Example userId
477
329
  const syncMap = {} // Placeholder for `syncMap`, not used in this case.
@@ -1,7 +1,7 @@
1
1
  import { Base64String, HexString, OutpointString, PubKeyHex } from '@bsv/sdk'
2
- import { sdk, table } from '../../../index.client'
2
+ import { sdk, TableCertificateField } from '../../../index.client'
3
3
 
4
- export interface Certificate extends sdk.EntityTimeStamp {
4
+ export interface TableCertificate extends sdk.EntityTimeStamp {
5
5
  created_at: Date
6
6
  updated_at: Date
7
7
  certificateId: number
@@ -16,6 +16,6 @@ export interface Certificate extends sdk.EntityTimeStamp {
16
16
  isDeleted: boolean
17
17
  }
18
18
 
19
- export interface CertificateX extends table.Certificate {
20
- fields?: table.CertificateField[]
19
+ export interface TableCertificateX extends TableCertificate {
20
+ fields?: TableCertificateField[]
21
21
  }
@@ -1,7 +1,7 @@
1
1
  import { Base64String } from '@bsv/sdk'
2
2
  import { sdk } from '../../../index.client'
3
3
 
4
- export interface CertificateField extends sdk.EntityTimeStamp {
4
+ export interface TableCertificateField extends sdk.EntityTimeStamp {
5
5
  created_at: Date
6
6
  updated_at: Date
7
7
  userId: number
@@ -1,6 +1,6 @@
1
1
  import { sdk } from '../../../index.client'
2
2
 
3
- export interface Commission extends sdk.EntityTimeStamp {
3
+ export interface TableCommission extends sdk.EntityTimeStamp {
4
4
  created_at: Date
5
5
  updated_at: Date
6
6
  commissionId: number
@@ -1,6 +1,6 @@
1
1
  import { sdk } from '../../../index.client'
2
2
 
3
- export interface MonitorEvent extends sdk.EntityTimeStamp {
3
+ export interface TableMonitorEvent extends sdk.EntityTimeStamp {
4
4
  created_at: Date
5
5
  updated_at: Date
6
6
  id: number
@@ -1,8 +1,8 @@
1
1
  import { Base64String, DescriptionString5to50Bytes, PubKeyHex } from '@bsv/sdk'
2
- import { OutputBasket, OutputTag } from '.'
2
+ import { TableOutputBasket, TableOutputTag } from '.'
3
3
  import { sdk } from '../../../index.client'
4
4
 
5
- export interface Output extends sdk.EntityTimeStamp {
5
+ export interface TableOutput extends sdk.EntityTimeStamp {
6
6
  created_at: Date
7
7
  updated_at: Date
8
8
  outputId: number
@@ -30,9 +30,9 @@ export interface Output extends sdk.EntityTimeStamp {
30
30
  lockingScript?: number[]
31
31
  }
32
32
 
33
- export interface OutputX extends Output {
34
- basket?: OutputBasket
35
- tags?: OutputTag[]
33
+ export interface TableOutputX extends TableOutput {
34
+ basket?: TableOutputBasket
35
+ tags?: TableOutputTag[]
36
36
  }
37
37
 
38
38
  export const outputColumnsWithoutLockingScript = [
@@ -1,6 +1,6 @@
1
1
  import { sdk } from '../../../index.client'
2
2
 
3
- export interface OutputBasket extends sdk.EntityTimeStamp {
3
+ export interface TableOutputBasket extends sdk.EntityTimeStamp {
4
4
  created_at: Date
5
5
  updated_at: Date
6
6
  basketId: number
@@ -1,6 +1,6 @@
1
1
  import { sdk } from '../../../index.client'
2
2
 
3
- export interface OutputTag extends sdk.EntityTimeStamp {
3
+ export interface TableOutputTag extends sdk.EntityTimeStamp {
4
4
  created_at: Date
5
5
  updated_at: Date
6
6
  outputTagId: number
@@ -1,6 +1,6 @@
1
1
  import { sdk } from '../../../index.client'
2
2
 
3
- export interface OutputTagMap extends sdk.EntityTimeStamp {
3
+ export interface TableOutputTagMap extends sdk.EntityTimeStamp {
4
4
  created_at: Date
5
5
  updated_at: Date
6
6
  outputTagId: number
@@ -1,6 +1,6 @@
1
1
  import { sdk } from '../../../index.client'
2
2
 
3
- export interface ProvenTx extends sdk.EntityTimeStamp {
3
+ export interface TableProvenTx extends sdk.EntityTimeStamp {
4
4
  created_at: Date
5
5
  updated_at: Date
6
6
  provenTxId: number
@@ -1,6 +1,6 @@
1
1
  import { sdk } from '../../../index.client'
2
2
 
3
- export interface ProvenTxReq extends ProvenTxReqDynamics {
3
+ export interface TableProvenTxReq extends TableProvenTxReqDynamics {
4
4
  created_at: Date
5
5
  updated_at: Date
6
6
  provenTxReqId: number
@@ -36,7 +36,7 @@ export interface ProvenTxReq extends ProvenTxReqDynamics {
36
36
  /**
37
37
  * Table properties that may change after initial record insertion.
38
38
  */
39
- export interface ProvenTxReqDynamics extends sdk.EntityTimeStamp {
39
+ export interface TableProvenTxReqDynamics extends sdk.EntityTimeStamp {
40
40
  updated_at: Date
41
41
  provenTxId?: number
42
42
  status: sdk.ProvenTxReqStatus
@@ -1,6 +1,6 @@
1
1
  import { sdk } from '../../../index.client'
2
2
 
3
- export interface SyncState extends sdk.EntityTimeStamp {
3
+ export interface TableSyncState extends sdk.EntityTimeStamp {
4
4
  created_at: Date
5
5
  updated_at: Date
6
6
  syncStateId: number
@@ -1,6 +1,8 @@
1
1
  import { sdk } from '../../../index.client'
2
2
 
3
- export interface Settings extends sdk.StorageIdentity, sdk.EntityTimeStamp {
3
+ export interface TableSettings
4
+ extends sdk.StorageIdentity,
5
+ sdk.EntityTimeStamp {
4
6
  created_at: Date
5
7
  updated_at: Date
6
8
  /**
@@ -1,7 +1,7 @@
1
1
  import { Base64String } from '@bsv/sdk'
2
2
  import { sdk } from '../../../index.client'
3
3
 
4
- export interface Transaction extends sdk.EntityTimeStamp {
4
+ export interface TableTransaction extends sdk.EntityTimeStamp {
5
5
  created_at: Date
6
6
  updated_at: Date
7
7
  transactionId: number
@@ -1,6 +1,6 @@
1
1
  import { sdk } from '../../../index.client'
2
2
 
3
- export interface TxLabel extends sdk.EntityTimeStamp {
3
+ export interface TableTxLabel extends sdk.EntityTimeStamp {
4
4
  created_at: Date
5
5
  updated_at: Date
6
6
  txLabelId: number
@@ -1,6 +1,6 @@
1
1
  import { sdk } from '../../../index.client'
2
2
 
3
- export interface TxLabelMap extends sdk.EntityTimeStamp {
3
+ export interface TableTxLabelMap extends sdk.EntityTimeStamp {
4
4
  created_at: Date
5
5
  updated_at: Date
6
6
  txLabelId: number
@@ -1,6 +1,6 @@
1
1
  import { sdk } from '../../../index.client'
2
2
 
3
- export interface User extends sdk.EntityTimeStamp {
3
+ export interface TableUser extends sdk.EntityTimeStamp {
4
4
  created_at: Date
5
5
  updated_at: Date
6
6
  userId: number
@@ -1,4 +1,4 @@
1
- export * from './Settings'
1
+ export * from './TableSettings'
2
2
  export * from './ProvenTx'
3
3
  export * from './ProvenTxReq'
4
4
  export * from './User'