@bsv/wallet-toolbox 1.1.7 → 1.1.8

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 (316) hide show
  1. package/docs/client.md +499 -486
  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 +2177 -419
  6. package/docs/wallet.md +499 -486
  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 +2 -2
  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 +11 -11
  77. package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
  78. package/out/src/storage/remoting/StorageClient.js.map +1 -1
  79. package/out/src/storage/schema/entities/Certificate.d.ts +9 -9
  80. package/out/src/storage/schema/entities/Certificate.d.ts.map +1 -1
  81. package/out/src/storage/schema/entities/Certificate.js +5 -5
  82. package/out/src/storage/schema/entities/Certificate.js.map +1 -1
  83. package/out/src/storage/schema/entities/CertificateField.d.ts +9 -9
  84. package/out/src/storage/schema/entities/CertificateField.d.ts.map +1 -1
  85. package/out/src/storage/schema/entities/CertificateField.js +5 -5
  86. package/out/src/storage/schema/entities/CertificateField.js.map +1 -1
  87. package/out/src/storage/schema/entities/Commission.d.ts +9 -9
  88. package/out/src/storage/schema/entities/Commission.d.ts.map +1 -1
  89. package/out/src/storage/schema/entities/Commission.js +5 -5
  90. package/out/src/storage/schema/entities/Commission.js.map +1 -1
  91. package/out/src/storage/schema/entities/EntityBase.d.ts +1 -1
  92. package/out/src/storage/schema/entities/MergeEntity.d.ts +6 -7
  93. package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -1
  94. package/out/src/storage/schema/entities/MergeEntity.js.map +1 -1
  95. package/out/src/storage/schema/entities/Output.d.ts +9 -9
  96. package/out/src/storage/schema/entities/Output.d.ts.map +1 -1
  97. package/out/src/storage/schema/entities/Output.js +5 -5
  98. package/out/src/storage/schema/entities/Output.js.map +1 -1
  99. package/out/src/storage/schema/entities/OutputBasket.d.ts +9 -9
  100. package/out/src/storage/schema/entities/OutputBasket.d.ts.map +1 -1
  101. package/out/src/storage/schema/entities/OutputBasket.js +5 -5
  102. package/out/src/storage/schema/entities/OutputBasket.js.map +1 -1
  103. package/out/src/storage/schema/entities/OutputTag.d.ts +9 -9
  104. package/out/src/storage/schema/entities/OutputTag.d.ts.map +1 -1
  105. package/out/src/storage/schema/entities/OutputTag.js +5 -5
  106. package/out/src/storage/schema/entities/OutputTag.js.map +1 -1
  107. package/out/src/storage/schema/entities/OutputTagMap.d.ts +9 -9
  108. package/out/src/storage/schema/entities/OutputTagMap.d.ts.map +1 -1
  109. package/out/src/storage/schema/entities/OutputTagMap.js +5 -5
  110. package/out/src/storage/schema/entities/OutputTagMap.js.map +1 -1
  111. package/out/src/storage/schema/entities/ProvenTx.d.ts +11 -11
  112. package/out/src/storage/schema/entities/ProvenTx.d.ts.map +1 -1
  113. package/out/src/storage/schema/entities/ProvenTx.js +11 -11
  114. package/out/src/storage/schema/entities/ProvenTx.js.map +1 -1
  115. package/out/src/storage/schema/entities/ProvenTxReq.d.ts +19 -19
  116. package/out/src/storage/schema/entities/ProvenTxReq.d.ts.map +1 -1
  117. package/out/src/storage/schema/entities/ProvenTxReq.js +13 -13
  118. package/out/src/storage/schema/entities/ProvenTxReq.js.map +1 -1
  119. package/out/src/storage/schema/entities/SyncState.d.ts +11 -11
  120. package/out/src/storage/schema/entities/SyncState.d.ts.map +1 -1
  121. package/out/src/storage/schema/entities/SyncState.js +27 -27
  122. package/out/src/storage/schema/entities/SyncState.js.map +1 -1
  123. package/out/src/storage/schema/entities/Transaction.d.ts +11 -11
  124. package/out/src/storage/schema/entities/Transaction.d.ts.map +1 -1
  125. package/out/src/storage/schema/entities/Transaction.js +6 -6
  126. package/out/src/storage/schema/entities/Transaction.js.map +1 -1
  127. package/out/src/storage/schema/entities/TxLabel.d.ts +9 -9
  128. package/out/src/storage/schema/entities/TxLabel.d.ts.map +1 -1
  129. package/out/src/storage/schema/entities/TxLabel.js +5 -5
  130. package/out/src/storage/schema/entities/TxLabel.js.map +1 -1
  131. package/out/src/storage/schema/entities/TxLabelMap.d.ts +9 -9
  132. package/out/src/storage/schema/entities/TxLabelMap.d.ts.map +1 -1
  133. package/out/src/storage/schema/entities/TxLabelMap.js +5 -5
  134. package/out/src/storage/schema/entities/TxLabelMap.js.map +1 -1
  135. package/out/src/storage/schema/entities/User.d.ts +9 -9
  136. package/out/src/storage/schema/entities/User.d.ts.map +1 -1
  137. package/out/src/storage/schema/entities/User.js +5 -5
  138. package/out/src/storage/schema/entities/User.js.map +1 -1
  139. package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js +20 -307
  140. package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js.map +1 -1
  141. package/out/src/storage/schema/entities/__tests/CertificateTests.test.js +17 -158
  142. package/out/src/storage/schema/entities/__tests/CertificateTests.test.js.map +1 -1
  143. package/out/src/storage/schema/entities/__tests/CommissionTests.test.js +23 -309
  144. package/out/src/storage/schema/entities/__tests/CommissionTests.test.js.map +1 -1
  145. package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js +19 -306
  146. package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js.map +1 -1
  147. package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js +19 -306
  148. package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js.map +1 -1
  149. package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js +23 -237
  150. package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js.map +1 -1
  151. package/out/src/storage/schema/entities/__tests/OutputTests.test.js +20 -233
  152. package/out/src/storage/schema/entities/__tests/OutputTests.test.js.map +1 -1
  153. package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js +27 -98
  154. package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js.map +1 -1
  155. package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js +25 -241
  156. package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js.map +1 -1
  157. package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js +38 -112
  158. package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js.map +1 -1
  159. package/out/src/storage/schema/entities/__tests/TransactionTests.test.js +39 -323
  160. package/out/src/storage/schema/entities/__tests/TransactionTests.test.js.map +1 -1
  161. package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js +31 -169
  162. package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js.map +1 -1
  163. package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js +16 -159
  164. package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js.map +1 -1
  165. package/out/src/storage/schema/entities/__tests/usersTests.test.js +21 -168
  166. package/out/src/storage/schema/entities/__tests/usersTests.test.js.map +1 -1
  167. package/out/src/storage/schema/tables/Certificate.d.ts +4 -4
  168. package/out/src/storage/schema/tables/Certificate.d.ts.map +1 -1
  169. package/out/src/storage/schema/tables/CertificateField.d.ts +1 -1
  170. package/out/src/storage/schema/tables/CertificateField.d.ts.map +1 -1
  171. package/out/src/storage/schema/tables/Commission.d.ts +1 -1
  172. package/out/src/storage/schema/tables/Commission.d.ts.map +1 -1
  173. package/out/src/storage/schema/tables/MonitorEvent.d.ts +1 -1
  174. package/out/src/storage/schema/tables/MonitorEvent.d.ts.map +1 -1
  175. package/out/src/storage/schema/tables/Output.d.ts +5 -5
  176. package/out/src/storage/schema/tables/Output.d.ts.map +1 -1
  177. package/out/src/storage/schema/tables/OutputBasket.d.ts +1 -1
  178. package/out/src/storage/schema/tables/OutputBasket.d.ts.map +1 -1
  179. package/out/src/storage/schema/tables/OutputTag.d.ts +1 -1
  180. package/out/src/storage/schema/tables/OutputTag.d.ts.map +1 -1
  181. package/out/src/storage/schema/tables/OutputTagMap.d.ts +1 -1
  182. package/out/src/storage/schema/tables/OutputTagMap.d.ts.map +1 -1
  183. package/out/src/storage/schema/tables/ProvenTx.d.ts +1 -1
  184. package/out/src/storage/schema/tables/ProvenTx.d.ts.map +1 -1
  185. package/out/src/storage/schema/tables/ProvenTxReq.d.ts +2 -2
  186. package/out/src/storage/schema/tables/ProvenTxReq.d.ts.map +1 -1
  187. package/out/src/storage/schema/tables/SyncState.d.ts +1 -1
  188. package/out/src/storage/schema/tables/SyncState.d.ts.map +1 -1
  189. package/out/src/storage/schema/tables/{Settings.d.ts → TableSettings.d.ts} +2 -2
  190. package/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -0
  191. package/out/src/storage/schema/tables/{Settings.js → TableSettings.js} +1 -1
  192. package/out/src/storage/schema/tables/TableSettings.js.map +1 -0
  193. package/out/src/storage/schema/tables/Transaction.d.ts +1 -1
  194. package/out/src/storage/schema/tables/Transaction.d.ts.map +1 -1
  195. package/out/src/storage/schema/tables/TxLabel.d.ts +1 -1
  196. package/out/src/storage/schema/tables/TxLabel.d.ts.map +1 -1
  197. package/out/src/storage/schema/tables/TxLabelMap.d.ts +1 -1
  198. package/out/src/storage/schema/tables/TxLabelMap.d.ts.map +1 -1
  199. package/out/src/storage/schema/tables/User.d.ts +1 -1
  200. package/out/src/storage/schema/tables/User.d.ts.map +1 -1
  201. package/out/src/storage/schema/tables/index.d.ts +1 -1
  202. package/out/src/storage/schema/tables/index.d.ts.map +1 -1
  203. package/out/src/storage/schema/tables/index.js +1 -1
  204. package/out/src/storage/schema/tables/index.js.map +1 -1
  205. package/out/src/storage/sync/StorageMySQLDojoReader.d.ts +17 -17
  206. package/out/src/storage/sync/StorageMySQLDojoReader.d.ts.map +1 -1
  207. package/out/src/storage/sync/StorageMySQLDojoReader.js +2 -2
  208. package/out/src/storage/sync/StorageMySQLDojoReader.js.map +1 -1
  209. package/out/test/Wallet/certificate/listCertificates.test.js.map +1 -1
  210. package/out/test/Wallet/live/walletLive.man.test.js +1 -1
  211. package/out/test/Wallet/live/walletLive.man.test.js.map +1 -1
  212. package/out/test/monitor/Monitor.test.js +7 -7
  213. package/out/test/monitor/Monitor.test.js.map +1 -1
  214. package/out/test/storage/StorageMySQLDojoReader.man.test.js +1 -1
  215. package/out/test/storage/StorageMySQLDojoReader.man.test.js.map +1 -1
  216. package/out/test/storage/insert.test.js.map +1 -1
  217. package/out/test/storage/update.test.js.map +1 -1
  218. package/out/test/storage/update2.test.js.map +1 -1
  219. package/out/test/utils/TestUtilsWalletStorage.d.ts +56 -56
  220. package/out/test/utils/TestUtilsWalletStorage.d.ts.map +1 -1
  221. package/out/test/utils/TestUtilsWalletStorage.js +11 -4
  222. package/out/test/utils/TestUtilsWalletStorage.js.map +1 -1
  223. package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js.map +1 -1
  224. package/out/tsconfig.all.tsbuildinfo +1 -1
  225. package/package.json +2 -2
  226. package/src/monitor/tasks/TaskCheckForProofs.ts +11 -10
  227. package/src/monitor/tasks/TaskSendWaiting.ts +5 -5
  228. package/src/sdk/StorageSyncReader.ts +47 -30
  229. package/src/sdk/StorageSyncReaderWriter.ts +77 -63
  230. package/src/sdk/WalletStorage.interfaces.ts +55 -36
  231. package/src/signer/methods/acquireDirectCertificate.ts +2 -2
  232. package/src/storage/StorageKnex.ts +124 -104
  233. package/src/storage/StorageProvider.ts +43 -30
  234. package/src/storage/StorageReader.ts +36 -21
  235. package/src/storage/StorageReaderWriter.ts +78 -65
  236. package/src/storage/StorageSyncReader.ts +34 -17
  237. package/src/storage/WalletStorageManager.ts +17 -12
  238. package/src/storage/index.all.ts +2 -2
  239. package/src/storage/index.client.ts +2 -2
  240. package/src/storage/methods/attemptToPostReqsToNetwork.ts +3 -3
  241. package/src/storage/methods/createAction.ts +29 -26
  242. package/src/storage/methods/getBeefForTransaction.ts +3 -3
  243. package/src/storage/methods/getSyncChunk.ts +28 -13
  244. package/src/storage/methods/internalizeAction.ts +19 -17
  245. package/src/storage/methods/listActions.ts +5 -5
  246. package/src/storage/methods/listCertificates.ts +2 -2
  247. package/src/storage/methods/listOutputs.ts +5 -5
  248. package/src/storage/methods/processAction.ts +21 -17
  249. package/src/storage/methods/purgeData.ts +17 -11
  250. package/src/storage/methods/reviewStatus.ts +4 -4
  251. package/src/storage/remoting/StorageClient.ts +28 -18
  252. package/src/storage/schema/entities/Certificate.ts +16 -17
  253. package/src/storage/schema/entities/CertificateField.ts +17 -18
  254. package/src/storage/schema/entities/Commission.ts +16 -20
  255. package/src/storage/schema/entities/EntityBase.ts +1 -1
  256. package/src/storage/schema/entities/MergeEntity.ts +7 -7
  257. package/src/storage/schema/entities/Output.ts +16 -20
  258. package/src/storage/schema/entities/OutputBasket.ts +16 -17
  259. package/src/storage/schema/entities/OutputTag.ts +16 -20
  260. package/src/storage/schema/entities/OutputTagMap.ts +17 -18
  261. package/src/storage/schema/entities/ProvenTx.ts +24 -28
  262. package/src/storage/schema/entities/ProvenTxReq.ts +42 -45
  263. package/src/storage/schema/entities/SyncState.ts +61 -38
  264. package/src/storage/schema/entities/Transaction.ts +23 -23
  265. package/src/storage/schema/entities/TxLabel.ts +16 -17
  266. package/src/storage/schema/entities/TxLabelMap.ts +16 -20
  267. package/src/storage/schema/entities/User.ts +15 -19
  268. package/src/storage/schema/entities/__tests/CertificateFieldTests.test.ts +39 -318
  269. package/src/storage/schema/entities/__tests/CertificateTests.test.ts +29 -169
  270. package/src/storage/schema/entities/__tests/CommissionTests.test.ts +47 -325
  271. package/src/storage/schema/entities/__tests/OutputBasketTests.test.ts +35 -316
  272. package/src/storage/schema/entities/__tests/OutputTagMapTests.test.ts +38 -318
  273. package/src/storage/schema/entities/__tests/OutputTagTests.test.ts +36 -249
  274. package/src/storage/schema/entities/__tests/OutputTests.test.ts +30 -244
  275. package/src/storage/schema/entities/__tests/ProvenTxReqTests.test.ts +35 -101
  276. package/src/storage/schema/entities/__tests/ProvenTxTests.test.ts +27 -243
  277. package/src/storage/schema/entities/__tests/SyncStateTests.test.ts +54 -122
  278. package/src/storage/schema/entities/__tests/TransactionTests.test.ts +53 -333
  279. package/src/storage/schema/entities/__tests/TxLabelMapTests.test.ts +44 -177
  280. package/src/storage/schema/entities/__tests/TxLabelTests.test.ts +19 -163
  281. package/src/storage/schema/entities/__tests/usersTests.test.ts +31 -179
  282. package/src/storage/schema/tables/Certificate.ts +4 -4
  283. package/src/storage/schema/tables/CertificateField.ts +1 -1
  284. package/src/storage/schema/tables/Commission.ts +1 -1
  285. package/src/storage/schema/tables/MonitorEvent.ts +1 -1
  286. package/src/storage/schema/tables/Output.ts +5 -5
  287. package/src/storage/schema/tables/OutputBasket.ts +1 -1
  288. package/src/storage/schema/tables/OutputTag.ts +1 -1
  289. package/src/storage/schema/tables/OutputTagMap.ts +1 -1
  290. package/src/storage/schema/tables/ProvenTx.ts +1 -1
  291. package/src/storage/schema/tables/ProvenTxReq.ts +2 -2
  292. package/src/storage/schema/tables/SyncState.ts +1 -1
  293. package/src/storage/schema/tables/{Settings.ts → TableSettings.ts} +3 -1
  294. package/src/storage/schema/tables/Transaction.ts +1 -1
  295. package/src/storage/schema/tables/TxLabel.ts +1 -1
  296. package/src/storage/schema/tables/TxLabelMap.ts +1 -1
  297. package/src/storage/schema/tables/User.ts +1 -1
  298. package/src/storage/schema/tables/index.ts +1 -1
  299. package/src/storage/sync/StorageMySQLDojoReader.ts +67 -50
  300. package/test/Wallet/certificate/listCertificates.test.ts +12 -8
  301. package/test/Wallet/live/walletLive.man.test.ts +6 -6
  302. package/test/monitor/Monitor.test.ts +8 -8
  303. package/test/storage/StorageMySQLDojoReader.man.test.ts +1 -1
  304. package/test/storage/insert.test.ts +2 -2
  305. package/test/storage/update.test.ts +30 -30
  306. package/test/storage/update2.test.ts +23 -24
  307. package/test/utils/TestUtilsWalletStorage.ts +103 -82
  308. package/test/wallet/action/createActionToGenerateBeefs.man.test.ts +1 -2
  309. package/ts2md.json +1 -1
  310. package/out/src/storage/index.db.d.ts +0 -1
  311. package/out/src/storage/index.db.d.ts.map +0 -1
  312. package/out/src/storage/index.db.js +0 -2
  313. package/out/src/storage/index.db.js.map +0 -1
  314. package/out/src/storage/schema/tables/Settings.d.ts.map +0 -1
  315. package/out/src/storage/schema/tables/Settings.js.map +0 -1
  316. package/src/storage/index.db.ts +0 -0
@@ -1,9 +1,14 @@
1
- import { entity, table, sdk } from '../../../../../src'
1
+ import {
2
+ createSyncMap,
3
+ sdk,
4
+ SyncMap,
5
+ TableOutputBasket
6
+ } from '../../../../../src'
2
7
  import {
3
8
  TestUtilsWalletStorage as _tu,
4
9
  TestWalletNoSetup
5
10
  } from '../../../../../test/utils/TestUtilsWalletStorage'
6
- import { OutputBasket } from '../../../../../src/storage/schema/entities/OutputBasket'
11
+ import { EntityOutputBasket } from '../../../../../src/storage/schema/entities/OutputBasket'
7
12
 
8
13
  describe('OutputBasket class method tests', () => {
9
14
  jest.setTimeout(99999999)
@@ -34,7 +39,7 @@ describe('OutputBasket class method tests', () => {
34
39
  const ctx = ctxs[0]
35
40
 
36
41
  // Insert initial OutputBasket record with valid data
37
- const initialData: table.OutputBasket = {
42
+ const initialData: TableOutputBasket = {
38
43
  basketId: 100,
39
44
  created_at: new Date('2023-01-01'),
40
45
  updated_at: new Date('2023-01-02'),
@@ -47,10 +52,10 @@ describe('OutputBasket class method tests', () => {
47
52
  await ctx.activeStorage.insertOutputBasket(initialData)
48
53
 
49
54
  // Create an OutputBasket entity from the initial data
50
- const entity = new OutputBasket(initialData)
55
+ const entity = new EntityOutputBasket(initialData)
51
56
 
52
57
  // Simulate the `ei` argument with a later `updated_at`
53
- const updatedData: table.OutputBasket = {
58
+ const updatedData: TableOutputBasket = {
54
59
  ...initialData,
55
60
  updated_at: new Date('2023-01-03'), // Later timestamp
56
61
  numberOfDesiredUTXOs: 20, // Update this field
@@ -58,85 +63,15 @@ describe('OutputBasket class method tests', () => {
58
63
  isDeleted: true // Simulate a change in `isDeleted`
59
64
  }
60
65
 
66
+ const syncMap = createSyncMap()
67
+ syncMap.outputBasket.idMap[100] = 100
68
+
61
69
  // Call mergeExisting
62
70
  const wasMergedRaw = await entity.mergeExisting(
63
71
  ctx.activeStorage,
64
72
  undefined, // `since` is not used in this method
65
73
  updatedData,
66
- {
67
- outputBasket: {
68
- idMap: { 100: 100 },
69
- entityName: 'OutputBasket',
70
- maxUpdated_at: undefined,
71
- count: 0
72
- },
73
- output: {
74
- idMap: {},
75
- entityName: 'Output',
76
- maxUpdated_at: undefined,
77
- count: 0
78
- },
79
- transaction: {
80
- idMap: {},
81
- entityName: 'Transaction',
82
- maxUpdated_at: undefined,
83
- count: 0
84
- },
85
- provenTx: {
86
- idMap: {},
87
- entityName: 'ProvenTx',
88
- maxUpdated_at: undefined,
89
- count: 0
90
- },
91
- outputTag: {
92
- idMap: {},
93
- entityName: 'OutputTag',
94
- maxUpdated_at: undefined,
95
- count: 0
96
- },
97
- provenTxReq: {
98
- idMap: {},
99
- entityName: 'ProvenTxReq',
100
- maxUpdated_at: undefined,
101
- count: 0
102
- },
103
- txLabel: {
104
- idMap: {},
105
- entityName: 'TxLabel',
106
- maxUpdated_at: undefined,
107
- count: 0
108
- },
109
- txLabelMap: {
110
- idMap: {},
111
- entityName: 'TxLabelMap',
112
- maxUpdated_at: undefined,
113
- count: 0
114
- },
115
- outputTagMap: {
116
- idMap: {},
117
- entityName: 'OutputTagMap',
118
- maxUpdated_at: undefined,
119
- count: 0
120
- },
121
- certificate: {
122
- idMap: {},
123
- entityName: 'Certificate',
124
- maxUpdated_at: undefined,
125
- count: 0
126
- },
127
- certificateField: {
128
- idMap: {},
129
- entityName: 'CertificateField',
130
- maxUpdated_at: undefined,
131
- count: 0
132
- },
133
- commission: {
134
- idMap: {},
135
- entityName: 'Commission',
136
- maxUpdated_at: undefined,
137
- count: 0
138
- }
139
- },
74
+ syncMap,
140
75
  undefined // `trx` is not used
141
76
  )
142
77
 
@@ -165,7 +100,7 @@ describe('OutputBasket class method tests', () => {
165
100
  const ctx = ctxs[0]
166
101
 
167
102
  // Insert initial OutputBasket record with valid data
168
- const initialData: table.OutputBasket = {
103
+ const initialData: TableOutputBasket = {
169
104
  basketId: 200,
170
105
  created_at: new Date('2023-01-01'),
171
106
  updated_at: new Date('2023-01-02'),
@@ -178,10 +113,10 @@ describe('OutputBasket class method tests', () => {
178
113
  await ctx.activeStorage.insertOutputBasket(initialData)
179
114
 
180
115
  // Create an OutputBasket entity from the initial data
181
- const entity = new OutputBasket(initialData)
116
+ const entity = new EntityOutputBasket(initialData)
182
117
 
183
118
  // Simulate the `ei` argument with an earlier `updated_at`
184
- const earlierData: table.OutputBasket = {
119
+ const earlierData: TableOutputBasket = {
185
120
  ...initialData,
186
121
  updated_at: new Date('2023-01-01'), // Earlier timestamp
187
122
  numberOfDesiredUTXOs: 20, // Simulate a change
@@ -189,85 +124,15 @@ describe('OutputBasket class method tests', () => {
189
124
  isDeleted: true // Simulate a change
190
125
  }
191
126
 
127
+ const syncMap = createSyncMap()
128
+ syncMap.outputBasket.idMap[200] = 200
129
+
192
130
  // Call mergeExisting
193
131
  const wasMergedRaw = await entity.mergeExisting(
194
132
  ctx.activeStorage,
195
133
  undefined, // `since` is not used in this method
196
134
  earlierData,
197
- {
198
- outputBasket: {
199
- idMap: { 200: 200 },
200
- entityName: 'OutputBasket',
201
- maxUpdated_at: undefined,
202
- count: 0
203
- },
204
- output: {
205
- idMap: {},
206
- entityName: 'Output',
207
- maxUpdated_at: undefined,
208
- count: 0
209
- },
210
- transaction: {
211
- idMap: {},
212
- entityName: 'Transaction',
213
- maxUpdated_at: undefined,
214
- count: 0
215
- },
216
- provenTx: {
217
- idMap: {},
218
- entityName: 'ProvenTx',
219
- maxUpdated_at: undefined,
220
- count: 0
221
- },
222
- outputTag: {
223
- idMap: {},
224
- entityName: 'OutputTag',
225
- maxUpdated_at: undefined,
226
- count: 0
227
- },
228
- provenTxReq: {
229
- idMap: {},
230
- entityName: 'ProvenTxReq',
231
- maxUpdated_at: undefined,
232
- count: 0
233
- },
234
- txLabel: {
235
- idMap: {},
236
- entityName: 'TxLabel',
237
- maxUpdated_at: undefined,
238
- count: 0
239
- },
240
- txLabelMap: {
241
- idMap: {},
242
- entityName: 'TxLabelMap',
243
- maxUpdated_at: undefined,
244
- count: 0
245
- },
246
- outputTagMap: {
247
- idMap: {},
248
- entityName: 'OutputTagMap',
249
- maxUpdated_at: undefined,
250
- count: 0
251
- },
252
- certificate: {
253
- idMap: {},
254
- entityName: 'Certificate',
255
- maxUpdated_at: undefined,
256
- count: 0
257
- },
258
- certificateField: {
259
- idMap: {},
260
- entityName: 'CertificateField',
261
- maxUpdated_at: undefined,
262
- count: 0
263
- },
264
- commission: {
265
- idMap: {},
266
- entityName: 'Commission',
267
- maxUpdated_at: undefined,
268
- count: 0
269
- }
270
- },
135
+ syncMap,
271
136
  undefined // `trx` is not used
272
137
  )
273
138
 
@@ -296,7 +161,7 @@ describe('OutputBasket class method tests', () => {
296
161
  const ctx = ctxs[0]
297
162
 
298
163
  // Insert two identical OutputBasket records in the database
299
- const basketData: table.OutputBasket = {
164
+ const basketData: TableOutputBasket = {
300
165
  basketId: 401,
301
166
  created_at: new Date('2023-01-01'),
302
167
  updated_at: new Date('2023-01-02'),
@@ -310,87 +175,14 @@ describe('OutputBasket class method tests', () => {
310
175
  await ctx.activeStorage.insertOutputBasket(basketData)
311
176
 
312
177
  // Create two identical entities
313
- const entity1 = new OutputBasket(basketData)
314
- const entity2 = new OutputBasket(basketData)
178
+ const entity1 = new EntityOutputBasket(basketData)
179
+ const entity2 = new EntityOutputBasket(basketData)
315
180
 
316
181
  // Test: equals returns true for identical entities without SyncMap
317
182
  expect(entity1.equals(entity2.toApi())).toBe(true)
318
183
 
319
- // Create a valid SyncMap
320
- const syncMap = {
321
- outputBasket: {
322
- idMap: { 401: 401 },
323
- entityName: 'OutputBasket',
324
- maxUpdated_at: undefined,
325
- count: 0
326
- },
327
- transaction: {
328
- idMap: {},
329
- entityName: 'Transaction',
330
- maxUpdated_at: undefined,
331
- count: 0
332
- },
333
- provenTx: {
334
- idMap: {},
335
- entityName: 'ProvenTx',
336
- maxUpdated_at: undefined,
337
- count: 0
338
- },
339
- output: {
340
- idMap: {},
341
- entityName: 'Output',
342
- maxUpdated_at: undefined,
343
- count: 0
344
- },
345
- outputTag: {
346
- idMap: {},
347
- entityName: 'OutputTag',
348
- maxUpdated_at: undefined,
349
- count: 0
350
- },
351
- provenTxReq: {
352
- idMap: {},
353
- entityName: 'ProvenTxReq',
354
- maxUpdated_at: undefined,
355
- count: 0
356
- },
357
- txLabel: {
358
- idMap: {},
359
- entityName: 'TxLabel',
360
- maxUpdated_at: undefined,
361
- count: 0
362
- },
363
- txLabelMap: {
364
- idMap: {},
365
- entityName: 'TxLabelMap',
366
- maxUpdated_at: undefined,
367
- count: 0
368
- },
369
- outputTagMap: {
370
- idMap: {},
371
- entityName: 'OutputTagMap',
372
- maxUpdated_at: undefined,
373
- count: 0
374
- },
375
- certificate: {
376
- idMap: {},
377
- entityName: 'Certificate',
378
- maxUpdated_at: undefined,
379
- count: 0
380
- },
381
- certificateField: {
382
- idMap: {},
383
- entityName: 'CertificateField',
384
- maxUpdated_at: undefined,
385
- count: 0
386
- },
387
- commission: {
388
- idMap: {},
389
- entityName: 'Commission',
390
- maxUpdated_at: undefined,
391
- count: 0
392
- }
393
- }
184
+ const syncMap = createSyncMap()
185
+ syncMap.outputBasket.idMap[401] = 401
394
186
 
395
187
  // Test: equals returns true for identical entities with SyncMap
396
188
  expect(entity1.equals(entity2.toApi(), syncMap)).toBe(true)
@@ -400,7 +192,7 @@ describe('OutputBasket class method tests', () => {
400
192
  const ctx = ctxs[0]
401
193
 
402
194
  // Insert two different OutputBasket records in the database
403
- const basketData1: table.OutputBasket = {
195
+ const basketData1: TableOutputBasket = {
404
196
  basketId: 402,
405
197
  created_at: new Date('2023-01-01'),
406
198
  updated_at: new Date('2023-01-02'),
@@ -411,7 +203,7 @@ describe('OutputBasket class method tests', () => {
411
203
  isDeleted: false
412
204
  }
413
205
 
414
- const basketData2: table.OutputBasket = {
206
+ const basketData2: TableOutputBasket = {
415
207
  basketId: 403,
416
208
  created_at: new Date('2023-01-01'),
417
209
  updated_at: new Date('2023-01-02'),
@@ -426,87 +218,14 @@ describe('OutputBasket class method tests', () => {
426
218
  await ctx.activeStorage.insertOutputBasket(basketData2)
427
219
 
428
220
  // Create entities
429
- const entity1 = new OutputBasket(basketData1)
430
- const entity2 = new OutputBasket(basketData2)
221
+ const entity1 = new EntityOutputBasket(basketData1)
222
+ const entity2 = new EntityOutputBasket(basketData2)
431
223
 
432
224
  // Test: equals returns false for different entities without SyncMap
433
225
  expect(entity1.equals(entity2.toApi())).toBe(false)
434
226
 
435
- // Create a SyncMap with mismatched mapping
436
- const syncMap: entity.SyncMap = {
437
- outputBasket: {
438
- idMap: { 1: 2 }, // Mismatched mapping
439
- entityName: 'OutputBasket',
440
- maxUpdated_at: undefined,
441
- count: 0
442
- },
443
- output: {
444
- idMap: {},
445
- entityName: 'Output',
446
- maxUpdated_at: undefined,
447
- count: 0
448
- },
449
- transaction: {
450
- idMap: {},
451
- entityName: 'Transaction',
452
- maxUpdated_at: undefined,
453
- count: 0
454
- },
455
- provenTx: {
456
- idMap: {},
457
- entityName: 'ProvenTx',
458
- maxUpdated_at: undefined,
459
- count: 0
460
- },
461
- outputTag: {
462
- idMap: {},
463
- entityName: 'OutputTag',
464
- maxUpdated_at: undefined,
465
- count: 0
466
- },
467
- provenTxReq: {
468
- idMap: {},
469
- entityName: 'ProvenTxReq',
470
- maxUpdated_at: undefined,
471
- count: 0
472
- },
473
- txLabel: {
474
- idMap: {},
475
- entityName: 'TxLabel',
476
- maxUpdated_at: undefined,
477
- count: 0
478
- },
479
- txLabelMap: {
480
- idMap: {},
481
- entityName: 'TxLabelMap',
482
- maxUpdated_at: undefined,
483
- count: 0
484
- },
485
- outputTagMap: {
486
- idMap: {},
487
- entityName: 'OutputTagMap',
488
- maxUpdated_at: undefined,
489
- count: 0
490
- },
491
- certificate: {
492
- idMap: {},
493
- entityName: 'Certificate',
494
- maxUpdated_at: undefined,
495
- count: 0
496
- },
497
- certificateField: {
498
- idMap: {},
499
- entityName: 'CertificateField',
500
- maxUpdated_at: undefined,
501
- count: 0
502
- },
503
- commission: {
504
- idMap: {},
505
- entityName: 'Commission',
506
- maxUpdated_at: undefined,
507
- count: 0
508
- }
509
- }
227
+ const syncMap = createSyncMap()
228
+ syncMap.outputBasket.idMap[1] = 2
510
229
 
511
230
  // Test: equals returns false for different entities with SyncMap
512
231
  expect(entity1.equals(entity2.toApi(), syncMap)).toBe(false)
@@ -514,7 +233,7 @@ describe('OutputBasket class method tests', () => {
514
233
 
515
234
  test('OutputBasket getters, setters, and updateApi', () => {
516
235
  // Create a mock OutputBasket instance
517
- const initialData: table.OutputBasket = {
236
+ const initialData: TableOutputBasket = {
518
237
  basketId: 123,
519
238
  created_at: new Date('2023-01-01'),
520
239
  updated_at: new Date('2023-01-02'),
@@ -525,7 +244,7 @@ describe('OutputBasket class method tests', () => {
525
244
  isDeleted: false
526
245
  }
527
246
 
528
- const entity = new OutputBasket(initialData)
247
+ const entity = new EntityOutputBasket(initialData)
529
248
 
530
249
  // Test getters
531
250
  expect(entity.basketId).toBe(123)
@@ -537,7 +256,7 @@ describe('OutputBasket class method tests', () => {
537
256
  expect(entity.minimumDesiredUTXOValue).toBe(1000)
538
257
  expect(entity.isDeleted).toBe(false)
539
258
  expect(entity.id).toBe(123)
540
- expect(entity.entityName).toBe('OutputBasket')
259
+ expect(entity.entityName).toBe('outputBasket')
541
260
  expect(entity.entityTable).toBe('output_baskets')
542
261
 
543
262
  // Test setters