@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,9 @@
1
- import { entity, table, sdk } from '../../../../../src'
1
+ import { createSyncMap, sdk, SyncMap, TableOutput } from '../../../../../src'
2
2
  import {
3
3
  TestUtilsWalletStorage as _tu,
4
4
  TestWalletNoSetup
5
5
  } from '../../../../../test/utils/TestUtilsWalletStorage'
6
- import { Output } from '../../../../../src/storage/schema/entities/Output'
6
+ import { EntityOutput } from '../../../../../src/storage/schema/entities/Output'
7
7
 
8
8
  describe('Output class method tests', () => {
9
9
  jest.setTimeout(99999999)
@@ -35,7 +35,7 @@ describe('Output class method tests', () => {
35
35
  const ctx = ctxs[0]
36
36
 
37
37
  // Insert initial record into the database
38
- const initialData: table.Output = {
38
+ const initialData: TableOutput = {
39
39
  outputId: 601,
40
40
  created_at: new Date('2023-01-01'),
41
41
  updated_at: new Date('2023-01-02'),
@@ -64,84 +64,12 @@ describe('Output class method tests', () => {
64
64
  await ctx.activeStorage.insertOutput(initialData)
65
65
 
66
66
  // Create two Output entities from the same data
67
- const entity1 = new Output(initialData)
68
- const entity2 = new Output(initialData)
69
-
70
- // Create a valid SyncMap
71
- const syncMap: entity.SyncMap = {
72
- transaction: {
73
- idMap: { 100: 100 },
74
- entityName: 'Transaction',
75
- maxUpdated_at: undefined,
76
- count: 0
77
- },
78
- outputBasket: {
79
- idMap: { 1: 1 },
80
- entityName: 'OutputBasket',
81
- maxUpdated_at: undefined,
82
- count: 0
83
- },
84
- provenTx: {
85
- idMap: {},
86
- entityName: 'ProvenTx',
87
- maxUpdated_at: undefined,
88
- count: 0
89
- },
90
- output: {
91
- idMap: {},
92
- entityName: 'Output',
93
- maxUpdated_at: undefined,
94
- count: 0
95
- },
96
- outputTag: {
97
- idMap: {},
98
- entityName: 'OutputTag',
99
- maxUpdated_at: undefined,
100
- count: 0
101
- },
102
- provenTxReq: {
103
- idMap: {},
104
- entityName: 'ProvenTxReq',
105
- maxUpdated_at: undefined,
106
- count: 0
107
- },
108
- txLabel: {
109
- idMap: {},
110
- entityName: 'TxLabel',
111
- maxUpdated_at: undefined,
112
- count: 0
113
- },
114
- txLabelMap: {
115
- idMap: {},
116
- entityName: 'TxLabelMap',
117
- maxUpdated_at: undefined,
118
- count: 0
119
- },
120
- outputTagMap: {
121
- idMap: {},
122
- entityName: 'OutputTagMap',
123
- maxUpdated_at: undefined,
124
- count: 0
125
- },
126
- certificate: {
127
- idMap: {},
128
- entityName: 'Certificate',
129
- maxUpdated_at: undefined,
130
- count: 0
131
- },
132
- certificateField: {
133
- idMap: {},
134
- entityName: 'CertificateField',
135
- maxUpdated_at: undefined,
136
- count: 0
137
- },
138
- commission: {
139
- idMap: {},
140
- entityName: 'Commission',
141
- maxUpdated_at: undefined,
142
- count: 0
143
- }
144
- }
67
+ const entity1 = new EntityOutput(initialData)
68
+ const entity2 = new EntityOutput(initialData)
69
+
70
+ const syncMap = createSyncMap()
71
+ syncMap.transaction.idMap[100] = 100
72
+ syncMap.outputBasket.idMap[1] = 1
145
73
 
146
74
  // Verify equals with and without SyncMap
147
75
  expect(entity1.equals(entity2.toApi())).toBe(true)
@@ -153,7 +81,7 @@ describe('Output class method tests', () => {
153
81
  const ctx = ctxs[0]
154
82
 
155
83
  // Insert initial record into the database
156
- const initialData: table.Output = {
84
+ const initialData: TableOutput = {
157
85
  outputId: 602,
158
86
  created_at: new Date('2023-01-01'),
159
87
  updated_at: new Date('2023-01-02'),
@@ -182,8 +110,8 @@ describe('Output class method tests', () => {
182
110
  await ctx.activeStorage.insertOutput(initialData)
183
111
 
184
112
  // Create two Output entities with differing data
185
- const entity1 = new Output(initialData)
186
- const entity2 = new Output({
113
+ const entity1 = new EntityOutput(initialData)
114
+ const entity2 = new EntityOutput({
187
115
  ...initialData,
188
116
  satoshis: 2000
189
117
  })
@@ -197,7 +125,7 @@ describe('Output class method tests', () => {
197
125
  const ctx = ctxs[0]
198
126
 
199
127
  // Insert initial record into the database
200
- const initialData: table.Output = {
128
+ const initialData: TableOutput = {
201
129
  outputId: 603,
202
130
  created_at: new Date('2023-01-01'),
203
131
  updated_at: new Date('2023-01-02'),
@@ -226,8 +154,8 @@ describe('Output class method tests', () => {
226
154
  await ctx.activeStorage.insertOutput(initialData)
227
155
 
228
156
  // Create two Output entities with differing array data
229
- const entity1 = new Output(initialData)
230
- const entity2 = new Output({
157
+ const entity1 = new EntityOutput(initialData)
158
+ const entity2 = new EntityOutput({
231
159
  ...initialData,
232
160
  lockingScript: [1, 2, 4]
233
161
  })
@@ -241,7 +169,7 @@ describe('Output class method tests', () => {
241
169
  const ctx = ctxs[0]
242
170
 
243
171
  // Insert initial Output record
244
- const initialData: table.Output = {
172
+ const initialData: TableOutput = {
245
173
  outputId: 701,
246
174
  created_at: new Date('2023-01-01'),
247
175
  updated_at: new Date('2023-01-02'),
@@ -271,10 +199,10 @@ describe('Output class method tests', () => {
271
199
  await ctx.activeStorage.insertOutput(initialData)
272
200
 
273
201
  // Create an Output entity from the initial data
274
- const entity = new Output(initialData)
202
+ const entity = new EntityOutput(initialData)
275
203
 
276
204
  // Simulate the `ei` argument with a later `updated_at`
277
- const updatedData: table.Output = {
205
+ const updatedData: TableOutput = {
278
206
  ...initialData,
279
207
  updated_at: new Date('2023-01-03'), // Later timestamp
280
208
  spendable: false,
@@ -292,80 +220,9 @@ describe('Output class method tests', () => {
292
220
  spentBy: 105
293
221
  }
294
222
 
295
- const syncMap: entity.SyncMap = {
296
- transaction: {
297
- idMap: { 103: 103, 105: 105 },
298
- entityName: 'Transaction',
299
- maxUpdated_at: undefined,
300
- count: 0
301
- },
302
- outputBasket: {
303
- idMap: { 1: 1 },
304
- entityName: 'OutputBasket',
305
- maxUpdated_at: undefined,
306
- count: 0
307
- },
308
- provenTx: {
309
- idMap: {},
310
- entityName: 'ProvenTx',
311
- maxUpdated_at: undefined,
312
- count: 0
313
- },
314
- output: {
315
- idMap: {},
316
- entityName: 'Output',
317
- maxUpdated_at: undefined,
318
- count: 0
319
- },
320
- outputTag: {
321
- idMap: {},
322
- entityName: 'OutputTag',
323
- maxUpdated_at: undefined,
324
- count: 0
325
- },
326
- provenTxReq: {
327
- idMap: {},
328
- entityName: 'ProvenTxReq',
329
- maxUpdated_at: undefined,
330
- count: 0
331
- },
332
- txLabel: {
333
- idMap: {},
334
- entityName: 'TxLabel',
335
- maxUpdated_at: undefined,
336
- count: 0
337
- },
338
- txLabelMap: {
339
- idMap: {},
340
- entityName: 'TxLabelMap',
341
- maxUpdated_at: undefined,
342
- count: 0
343
- },
344
- outputTagMap: {
345
- idMap: {},
346
- entityName: 'OutputTagMap',
347
- maxUpdated_at: undefined,
348
- count: 0
349
- },
350
- certificate: {
351
- idMap: {},
352
- entityName: 'Certificate',
353
- maxUpdated_at: undefined,
354
- count: 0
355
- },
356
- certificateField: {
357
- idMap: {},
358
- entityName: 'CertificateField',
359
- maxUpdated_at: undefined,
360
- count: 0
361
- },
362
- commission: {
363
- idMap: {},
364
- entityName: 'Commission',
365
- maxUpdated_at: undefined,
366
- count: 0
367
- }
368
- }
223
+ const syncMap = createSyncMap()
224
+ syncMap.transaction.idMap = { 103: 103, 105: 105 }
225
+ syncMap.outputBasket.idMap[1] = 1
369
226
 
370
227
  // Call mergeExisting
371
228
  const wasMergedRaw = await entity.mergeExisting(
@@ -426,7 +283,7 @@ describe('Output class method tests', () => {
426
283
  const ctx = ctxs[0]
427
284
 
428
285
  // Use the same initialData as before
429
- const initialData: table.Output = {
286
+ const initialData: TableOutput = {
430
287
  outputId: 702,
431
288
  created_at: new Date('2023-01-01'),
432
289
  updated_at: new Date('2023-01-02'),
@@ -456,89 +313,18 @@ describe('Output class method tests', () => {
456
313
  await ctx.activeStorage.insertOutput(initialData)
457
314
 
458
315
  // Create an Output entity from the initial data
459
- const entity = new Output(initialData)
316
+ const entity = new EntityOutput(initialData)
460
317
 
461
318
  // Simulate the `ei` argument with an earlier `updated_at`
462
- const earlierData: table.Output = {
319
+ const earlierData: TableOutput = {
463
320
  ...initialData,
464
321
  updated_at: new Date('2023-01-01'), // Earlier timestamp
465
322
  spendable: false
466
323
  }
467
324
 
468
- const syncMap: entity.SyncMap = {
469
- transaction: {
470
- idMap: { 104: 104 },
471
- entityName: 'Transaction',
472
- maxUpdated_at: undefined,
473
- count: 0
474
- },
475
- outputBasket: {
476
- idMap: { 1: 1 },
477
- entityName: 'OutputBasket',
478
- maxUpdated_at: undefined,
479
- count: 0
480
- },
481
- provenTx: {
482
- idMap: {},
483
- entityName: 'ProvenTx',
484
- maxUpdated_at: undefined,
485
- count: 0
486
- },
487
- output: {
488
- idMap: {},
489
- entityName: 'Output',
490
- maxUpdated_at: undefined,
491
- count: 0
492
- },
493
- outputTag: {
494
- idMap: {},
495
- entityName: 'OutputTag',
496
- maxUpdated_at: undefined,
497
- count: 0
498
- },
499
- provenTxReq: {
500
- idMap: {},
501
- entityName: 'ProvenTxReq',
502
- maxUpdated_at: undefined,
503
- count: 0
504
- },
505
- txLabel: {
506
- idMap: {},
507
- entityName: 'TxLabel',
508
- maxUpdated_at: undefined,
509
- count: 0
510
- },
511
- txLabelMap: {
512
- idMap: {},
513
- entityName: 'TxLabelMap',
514
- maxUpdated_at: undefined,
515
- count: 0
516
- },
517
- outputTagMap: {
518
- idMap: {},
519
- entityName: 'OutputTagMap',
520
- maxUpdated_at: undefined,
521
- count: 0
522
- },
523
- certificate: {
524
- idMap: {},
525
- entityName: 'Certificate',
526
- maxUpdated_at: undefined,
527
- count: 0
528
- },
529
- certificateField: {
530
- idMap: {},
531
- entityName: 'CertificateField',
532
- maxUpdated_at: undefined,
533
- count: 0
534
- },
535
- commission: {
536
- idMap: {},
537
- entityName: 'Commission',
538
- maxUpdated_at: undefined,
539
- count: 0
540
- }
541
- }
325
+ const syncMap = createSyncMap()
326
+ syncMap.transaction.idMap = { 104: 104 }
327
+ syncMap.outputBasket.idMap[1] = 1
542
328
 
543
329
  // Call mergeExisting
544
330
  const wasMergedRaw = await entity.mergeExisting(
@@ -570,7 +356,7 @@ describe('Output class method tests', () => {
570
356
  const now = new Date()
571
357
 
572
358
  // Initial test data
573
- const initialData: table.Output = {
359
+ const initialData: TableOutput = {
574
360
  outputId: 701,
575
361
  created_at: now,
576
362
  updated_at: now,
@@ -598,7 +384,7 @@ describe('Output class method tests', () => {
598
384
  }
599
385
 
600
386
  // Create the Output entity
601
- const entity = new Output(initialData)
387
+ const entity = new EntityOutput(initialData)
602
388
 
603
389
  // Validate getters
604
390
  expect(entity.outputId).toBe(initialData.outputId)
@@ -683,7 +469,7 @@ describe('Output class method tests', () => {
683
469
  expect(entity.outputId).toBe(900)
684
470
 
685
471
  // Validate `entityName` and `entityTable`
686
- expect(entity.entityName).toBe('Output')
472
+ expect(entity.entityName).toBe('output')
687
473
  expect(entity.entityTable).toBe('outputs')
688
474
  })
689
475
  })
@@ -1,11 +1,16 @@
1
1
  import * as bsv from '@bsv/sdk'
2
- import { entity, table, sdk } from '../../../../../src'
2
+ import {
3
+ createSyncMap,
4
+ sdk,
5
+ SyncMap,
6
+ TableProvenTxReq
7
+ } from '../../../../../src'
3
8
  import {
4
9
  TestUtilsWalletStorage as _tu,
5
10
  TestWalletNoSetup
6
11
  } from '../../../../../test/utils/TestUtilsWalletStorage'
7
12
  import {
8
- ProvenTxReq,
13
+ EntityProvenTxReq,
9
14
  ProvenTxReqHistorySummaryApi
10
15
  } from '../../../../../src/storage/schema/entities/ProvenTxReq'
11
16
 
@@ -36,7 +41,7 @@ describe('ProvenTxReq class method tests', () => {
36
41
 
37
42
  // Test: apiNotify getter and setter
38
43
  test('0_apiNotify_getter_and_setter', () => {
39
- const provenTxReq = new ProvenTxReq({
44
+ const provenTxReq = new EntityProvenTxReq({
40
45
  provenTxReqId: 0,
41
46
  created_at: new Date(),
42
47
  updated_at: new Date(),
@@ -58,7 +63,7 @@ describe('ProvenTxReq class method tests', () => {
58
63
 
59
64
  // Test: getHistorySummary method
60
65
  test('1_getHistorySummary', () => {
61
- const provenTxReq = new ProvenTxReq({
66
+ const provenTxReq = new EntityProvenTxReq({
62
67
  provenTxReqId: 0,
63
68
  created_at: new Date(),
64
69
  updated_at: new Date(),
@@ -92,7 +97,7 @@ describe('ProvenTxReq class method tests', () => {
92
97
 
93
98
  // Test: parseHistoryNote method
94
99
  test('2_parseHistoryNote', () => {
95
- const provenTxReq = new ProvenTxReq({
100
+ const provenTxReq = new EntityProvenTxReq({
96
101
  provenTxReqId: 0,
97
102
  created_at: new Date(),
98
103
  updated_at: new Date(),
@@ -118,7 +123,7 @@ describe('ProvenTxReq class method tests', () => {
118
123
  // Test: updateStorage method
119
124
  test('3_updateStorage', async () => {
120
125
  const ctx = ctxs[0]
121
- const provenTxReq = new ProvenTxReq({
126
+ const provenTxReq = new EntityProvenTxReq({
122
127
  provenTxReqId: 0,
123
128
  created_at: new Date(),
124
129
  updated_at: new Date(),
@@ -143,7 +148,7 @@ describe('ProvenTxReq class method tests', () => {
143
148
  // Test: insertOrMerge method
144
149
  test('4_insertOrMerge', async () => {
145
150
  const ctx = ctxs[0]
146
- const provenTxReq = new ProvenTxReq({
151
+ const provenTxReq = new EntityProvenTxReq({
147
152
  provenTxReqId: 0,
148
153
  created_at: new Date(),
149
154
  updated_at: new Date(),
@@ -170,7 +175,7 @@ describe('ProvenTxReq class method tests', () => {
170
175
  const currentTime = new Date()
171
176
 
172
177
  // ProvenTxReq in the first database
173
- const provenTxReq1 = new ProvenTxReq({
178
+ const provenTxReq1 = new EntityProvenTxReq({
174
179
  provenTxReqId: 405,
175
180
  created_at: currentTime,
176
181
  updated_at: currentTime,
@@ -187,7 +192,7 @@ describe('ProvenTxReq class method tests', () => {
187
192
  await ctx1.activeStorage.insertProvenTxReq(provenTxReq1.toApi())
188
193
 
189
194
  // ProvenTxReq in the second database
190
- const provenTxReq2 = new ProvenTxReq({
195
+ const provenTxReq2 = new EntityProvenTxReq({
191
196
  provenTxReqId: 406,
192
197
  created_at: currentTime,
193
198
  updated_at: currentTime,
@@ -203,31 +208,8 @@ describe('ProvenTxReq class method tests', () => {
203
208
  })
204
209
  await ctx2.activeStorage.insertProvenTxReq(provenTxReq2.toApi())
205
210
 
206
- // Create a valid SyncMap
207
- const syncMap: entity.SyncMap = {
208
- provenTx: {
209
- idMap: {},
210
- entityName: 'ProvenTx',
211
- maxUpdated_at: undefined,
212
- count: 0
213
- },
214
- provenTxReq: {
215
- idMap: { 406: 405 },
216
- entityName: 'ProvenTxReq',
217
- maxUpdated_at: undefined,
218
- count: 1
219
- },
220
- transaction: { idMap: {}, entityName: 'Transaction', count: 0 },
221
- outputBasket: { idMap: {}, entityName: 'OutputBasket', count: 0 },
222
- txLabel: { idMap: {}, entityName: 'TxLabel', count: 0 },
223
- txLabelMap: { idMap: {}, entityName: 'TxLabelMap', count: 0 },
224
- output: { idMap: {}, entityName: 'Output', count: 0 },
225
- outputTag: { idMap: {}, entityName: 'OutputTag', count: 0 },
226
- outputTagMap: { idMap: {}, entityName: 'OutputTagMap', count: 0 },
227
- certificate: { idMap: {}, entityName: 'Certificate', count: 0 },
228
- certificateField: { idMap: {}, entityName: 'CertificateField', count: 0 },
229
- commission: { idMap: {}, entityName: 'Commission', count: 0 }
230
- }
211
+ const syncMap = createSyncMap()
212
+ syncMap.provenTxReq.idMap = { 406: 405 }
231
213
 
232
214
  // Assert entities are equal
233
215
  expect(provenTxReq1.equals(provenTxReq2.toApi(), syncMap)).toBe(true)
@@ -241,7 +223,7 @@ describe('ProvenTxReq class method tests', () => {
241
223
  const currentTime = new Date()
242
224
 
243
225
  // ProvenTxReq in the first database
244
- const provenTxReq1 = new ProvenTxReq({
226
+ const provenTxReq1 = new EntityProvenTxReq({
245
227
  provenTxReqId: 407,
246
228
  created_at: currentTime,
247
229
  updated_at: currentTime,
@@ -258,7 +240,7 @@ describe('ProvenTxReq class method tests', () => {
258
240
  await ctx1.activeStorage.insertProvenTxReq(provenTxReq1.toApi())
259
241
 
260
242
  // ProvenTxReq in the second database
261
- const provenTxReq2 = new ProvenTxReq({
243
+ const provenTxReq2 = new EntityProvenTxReq({
262
244
  provenTxReqId: 408,
263
245
  created_at: currentTime,
264
246
  updated_at: currentTime,
@@ -274,31 +256,8 @@ describe('ProvenTxReq class method tests', () => {
274
256
  })
275
257
  await ctx2.activeStorage.insertProvenTxReq(provenTxReq2.toApi())
276
258
 
277
- // Create a valid SyncMap
278
- const syncMap: entity.SyncMap = {
279
- provenTx: {
280
- idMap: {},
281
- entityName: 'ProvenTx',
282
- maxUpdated_at: undefined,
283
- count: 0
284
- },
285
- provenTxReq: {
286
- idMap: { 406: 405 },
287
- entityName: 'ProvenTxReq',
288
- maxUpdated_at: undefined,
289
- count: 1
290
- },
291
- transaction: { idMap: {}, entityName: 'Transaction', count: 0 },
292
- outputBasket: { idMap: {}, entityName: 'OutputBasket', count: 0 },
293
- txLabel: { idMap: {}, entityName: 'TxLabel', count: 0 },
294
- txLabelMap: { idMap: {}, entityName: 'TxLabelMap', count: 0 },
295
- output: { idMap: {}, entityName: 'Output', count: 0 },
296
- outputTag: { idMap: {}, entityName: 'OutputTag', count: 0 },
297
- outputTagMap: { idMap: {}, entityName: 'OutputTagMap', count: 0 },
298
- certificate: { idMap: {}, entityName: 'Certificate', count: 0 },
299
- certificateField: { idMap: {}, entityName: 'CertificateField', count: 0 },
300
- commission: { idMap: {}, entityName: 'Commission', count: 0 }
301
- }
259
+ const syncMap = createSyncMap()
260
+ syncMap.provenTxReq.idMap = { 406: 405 }
302
261
 
303
262
  // Assert entities are not equal
304
263
  expect(provenTxReq1.equals(provenTxReq2.toApi(), syncMap)).toBe(false)
@@ -306,7 +265,7 @@ describe('ProvenTxReq class method tests', () => {
306
265
 
307
266
  // Test: mergeNotifyTransactionIds method
308
267
  test('7_mergeNotifyTransactionIds', () => {
309
- const provenTxReq = new ProvenTxReq({
268
+ const provenTxReq = new EntityProvenTxReq({
310
269
  provenTxReqId: 0,
311
270
  created_at: new Date(),
312
271
  updated_at: new Date(),
@@ -319,22 +278,10 @@ describe('ProvenTxReq class method tests', () => {
319
278
  notified: false
320
279
  })
321
280
 
322
- const syncMap: entity.SyncMap = {
323
- provenTx: { idMap: {}, entityName: 'provenTx', count: 0 },
324
- transaction: { idMap: { 100: 200 }, entityName: 'transaction', count: 1 },
325
- outputBasket: { idMap: {}, entityName: 'outputBasket', count: 0 },
326
- provenTxReq: { idMap: {}, entityName: 'provenTxReq', count: 0 },
327
- txLabel: { idMap: {}, entityName: 'txLabel', count: 0 },
328
- txLabelMap: { idMap: {}, entityName: 'txLabelMap', count: 0 },
329
- output: { idMap: {}, entityName: 'output', count: 0 },
330
- outputTag: { idMap: {}, entityName: 'outputTag', count: 0 },
331
- outputTagMap: { idMap: {}, entityName: 'outputTagMap', count: 0 },
332
- certificate: { idMap: {}, entityName: 'certificate', count: 0 },
333
- certificateField: { idMap: {}, entityName: 'certificateField', count: 0 },
334
- commission: { idMap: {}, entityName: 'commission', count: 0 }
335
- }
281
+ const syncMap = createSyncMap()
282
+ syncMap.transaction.idMap = { 100: 200 }
336
283
 
337
- const inputProvenTxReq: table.ProvenTxReq = {
284
+ const inputProvenTxReq: TableProvenTxReq = {
338
285
  provenTxReqId: 0,
339
286
  created_at: new Date(),
340
287
  updated_at: new Date(),
@@ -357,7 +304,7 @@ describe('ProvenTxReq class method tests', () => {
357
304
  // Test: Getters and Setters
358
305
  test('8_getters_and_setters', () => {
359
306
  const currentTime = new Date()
360
- const provenTxReq = new ProvenTxReq({
307
+ const provenTxReq = new EntityProvenTxReq({
361
308
  provenTxReqId: 123,
362
309
  created_at: currentTime,
363
310
  updated_at: currentTime,
@@ -385,7 +332,7 @@ describe('ProvenTxReq class method tests', () => {
385
332
  expect(provenTxReq.notified).toBe(true)
386
333
  expect(provenTxReq.batch).toBe('test-batch')
387
334
  expect(provenTxReq.id).toBe(123)
388
- expect(provenTxReq.entityName).toBe('ProvenTxReq')
335
+ expect(provenTxReq.entityName).toBe('provenTxReq')
389
336
  expect(provenTxReq.entityTable).toBe('proven_tx_reqs')
390
337
 
391
338
  // Verify setters
@@ -417,7 +364,7 @@ describe('ProvenTxReq class method tests', () => {
417
364
 
418
365
  // Test: parseHistoryNote method
419
366
  test('9_parseHistoryNote', () => {
420
- const provenTxReq = new ProvenTxReq({
367
+ const provenTxReq = new EntityProvenTxReq({
421
368
  provenTxReqId: 0,
422
369
  created_at: new Date(),
423
370
  updated_at: new Date(),
@@ -500,7 +447,7 @@ describe('ProvenTxReq class method tests', () => {
500
447
  // Test: mergeHistory method
501
448
  test('10_mergeHistory', () => {
502
449
  // Create the current ProvenTxReq with some initial history
503
- const provenTxReq = new ProvenTxReq({
450
+ const provenTxReq = new EntityProvenTxReq({
504
451
  provenTxReqId: 409,
505
452
  created_at: new Date(),
506
453
  updated_at: new Date(),
@@ -516,7 +463,7 @@ describe('ProvenTxReq class method tests', () => {
516
463
  })
517
464
 
518
465
  // Create another ProvenTxReq to merge with
519
- const otherProvenTxReq = new ProvenTxReq({
466
+ const otherProvenTxReq = new EntityProvenTxReq({
520
467
  provenTxReqId: 410,
521
468
  created_at: new Date(),
522
469
  updated_at: new Date(),
@@ -569,7 +516,7 @@ describe('ProvenTxReq class method tests', () => {
569
516
  ]
570
517
 
571
518
  for (const { status, expected } of testCases) {
572
- expect(entity.ProvenTxReq.isTerminalStatus(status)).toBe(expected)
519
+ expect(EntityProvenTxReq.isTerminalStatus(status)).toBe(expected)
573
520
  }
574
521
  })
575
522
 
@@ -577,7 +524,7 @@ describe('ProvenTxReq class method tests', () => {
577
524
  const ctx = ctxs[0]
578
525
 
579
526
  // Insert initial ProvenTxReq into the database
580
- const existingProvenTxReq = new entity.ProvenTxReq({
527
+ const existingProvenTxReq = new EntityProvenTxReq({
581
528
  provenTxReqId: 409,
582
529
  created_at: new Date('2025-01-01T00:00:00.000Z'),
583
530
  updated_at: new Date('2025-01-01T00:00:00.000Z'),
@@ -596,7 +543,7 @@ describe('ProvenTxReq class method tests', () => {
596
543
  await ctx.activeStorage.insertProvenTxReq(existingProvenTxReq.toApi())
597
544
 
598
545
  // Create the ProvenTxReq to be merged
599
- const incomingProvenTxReq = new entity.ProvenTxReq({
546
+ const incomingProvenTxReq = new EntityProvenTxReq({
600
547
  provenTxReqId: 410, // Different ID, simulating another entity
601
548
  created_at: new Date('2025-01-02T00:00:00.000Z'),
602
549
  updated_at: new Date('2025-01-02T00:00:00.000Z'),
@@ -612,21 +559,8 @@ describe('ProvenTxReq class method tests', () => {
612
559
  batch: 'batch1'
613
560
  })
614
561
 
615
- // Create a valid SyncMap
616
- const syncMap: entity.SyncMap = {
617
- provenTx: { idMap: {}, entityName: 'provenTx', count: 0 },
618
- transaction: { idMap: { 200: 100 }, entityName: 'transaction', count: 1 },
619
- outputBasket: { idMap: {}, entityName: 'outputBasket', count: 0 },
620
- provenTxReq: { idMap: {}, entityName: 'provenTxReq', count: 0 },
621
- txLabel: { idMap: {}, entityName: 'txLabel', count: 0 },
622
- txLabelMap: { idMap: {}, entityName: 'txLabelMap', count: 0 },
623
- output: { idMap: {}, entityName: 'output', count: 0 },
624
- outputTag: { idMap: {}, entityName: 'outputTag', count: 0 },
625
- outputTagMap: { idMap: {}, entityName: 'outputTagMap', count: 0 },
626
- certificate: { idMap: {}, entityName: 'certificate', count: 0 },
627
- certificateField: { idMap: {}, entityName: 'certificateField', count: 0 },
628
- commission: { idMap: {}, entityName: 'commission', count: 0 }
629
- }
562
+ const syncMap = createSyncMap()
563
+ syncMap.transaction.idMap = { 200: 100 }
630
564
 
631
565
  // Call mergeExisting
632
566
  const result = await existingProvenTxReq.mergeExisting(
@@ -645,7 +579,7 @@ describe('ProvenTxReq class method tests', () => {
645
579
  })
646
580
  expect(mergedProvenTxReqs.length).toBe(1)
647
581
 
648
- const mergedProvenTxReq = new entity.ProvenTxReq(mergedProvenTxReqs[0])
582
+ const mergedProvenTxReq = new EntityProvenTxReq(mergedProvenTxReqs[0])
649
583
 
650
584
  // Ensure history.notes is initialized if undefined
651
585
  const mergedNotes = mergedProvenTxReq.history.notes || {}