@decaf-ts/for-fabric 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/lib/cjs/version.cjs +1 -1
  2. package/lib/esm/version.js +1 -1
  3. package/lib/types/client/FabricClientAdapter.d.cts +3 -3
  4. package/lib/types/client/FabricClientAdapter.d.mts +3 -3
  5. package/lib/types/client/FabricClientDispatch.d.cts +2 -2
  6. package/lib/types/client/FabricClientDispatch.d.mts +2 -2
  7. package/lib/types/client/FabricClientPaginator.d.cts +1 -1
  8. package/lib/types/client/FabricClientPaginator.d.mts +1 -1
  9. package/lib/types/client/FabricClientRepository.d.cts +1 -1
  10. package/lib/types/client/FabricClientRepository.d.mts +1 -1
  11. package/lib/types/client/FabricClientStatement.d.cts +2 -2
  12. package/lib/types/client/FabricClientStatement.d.mts +2 -2
  13. package/lib/types/client/collections/index.d.cts +1 -1
  14. package/lib/types/client/collections/index.d.mts +1 -1
  15. package/lib/types/client/constants.d.cts +1 -1
  16. package/lib/types/client/constants.d.mts +1 -1
  17. package/lib/types/client/erc20/FabricERC20ClientRepository.d.cts +3 -3
  18. package/lib/types/client/erc20/FabricERC20ClientRepository.d.mts +3 -3
  19. package/lib/types/client/erc20/index.d.cts +1 -1
  20. package/lib/types/client/erc20/index.d.mts +1 -1
  21. package/lib/types/client/ids/index.d.cts +1 -1
  22. package/lib/types/client/ids/index.d.mts +1 -1
  23. package/lib/types/client/index.d.cts +14 -14
  24. package/lib/types/client/index.d.mts +14 -14
  25. package/lib/types/client/indexes/index.d.cts +1 -1
  26. package/lib/types/client/indexes/index.d.mts +1 -1
  27. package/lib/types/client/services/FabricEnrollmentService.d.cts +4 -4
  28. package/lib/types/client/services/FabricEnrollmentService.d.mts +4 -4
  29. package/lib/types/client/services/FabricIdentityService.d.cts +5 -5
  30. package/lib/types/client/services/FabricIdentityService.d.mts +5 -5
  31. package/lib/types/client/services/RegistrationRequestBuilder.d.cts +1 -1
  32. package/lib/types/client/services/RegistrationRequestBuilder.d.mts +1 -1
  33. package/lib/types/client/services/index.d.cts +4 -4
  34. package/lib/types/client/services/index.d.mts +4 -4
  35. package/lib/types/client/types.d.cts +1 -1
  36. package/lib/types/client/types.d.mts +1 -1
  37. package/lib/types/client/utils.d.cts +1 -1
  38. package/lib/types/client/utils.d.mts +1 -1
  39. package/lib/types/contract/AddressContract.d.cts +2 -2
  40. package/lib/types/contract/AddressContract.d.mts +2 -2
  41. package/lib/types/contract/AuditContract.d.cts +2 -2
  42. package/lib/types/contract/AuditContract.d.mts +2 -2
  43. package/lib/types/contract/BatchContract.d.cts +2 -2
  44. package/lib/types/contract/BatchContract.d.mts +2 -2
  45. package/lib/types/contract/MarketContract.d.cts +2 -2
  46. package/lib/types/contract/MarketContract.d.mts +2 -2
  47. package/lib/types/contract/OtherAuditContract.d.cts +2 -2
  48. package/lib/types/contract/OtherAuditContract.d.mts +2 -2
  49. package/lib/types/contract/OtherBatchContract.d.cts +2 -2
  50. package/lib/types/contract/OtherBatchContract.d.mts +2 -2
  51. package/lib/types/contract/OtherMarketContract.d.cts +2 -2
  52. package/lib/types/contract/OtherMarketContract.d.mts +2 -2
  53. package/lib/types/contract/OtherProductContract.d.cts +2 -2
  54. package/lib/types/contract/OtherProductContract.d.mts +2 -2
  55. package/lib/types/contract/OtherProductImageContract.d.cts +2 -2
  56. package/lib/types/contract/OtherProductImageContract.d.mts +2 -2
  57. package/lib/types/contract/OtherProductSharedContract.d.cts +2 -2
  58. package/lib/types/contract/OtherProductSharedContract.d.mts +2 -2
  59. package/lib/types/contract/OtherProductStrengthContract.d.cts +2 -2
  60. package/lib/types/contract/OtherProductStrengthContract.d.mts +2 -2
  61. package/lib/types/contract/Product.d.cts +1 -1
  62. package/lib/types/contract/Product.d.mts +1 -1
  63. package/lib/types/contract/ProductContract.d.cts +2 -2
  64. package/lib/types/contract/ProductContract.d.mts +2 -2
  65. package/lib/types/contract/ProductStrengthContract.d.cts +2 -2
  66. package/lib/types/contract/ProductStrengthContract.d.mts +2 -2
  67. package/lib/types/contract/SegregatedPrivateDocumentContract.d.cts +2 -2
  68. package/lib/types/contract/SegregatedPrivateDocumentContract.d.mts +2 -2
  69. package/lib/types/contract/SegregatedSharedDocumentContract.d.cts +2 -2
  70. package/lib/types/contract/SegregatedSharedDocumentContract.d.mts +2 -2
  71. package/lib/types/contract/UserContract.d.cts +2 -2
  72. package/lib/types/contract/UserContract.d.mts +2 -2
  73. package/lib/types/contract/models/Audit.d.cts +2 -2
  74. package/lib/types/contract/models/Audit.d.mts +2 -2
  75. package/lib/types/contract/models/BaseIdentifiedModel.d.cts +1 -1
  76. package/lib/types/contract/models/BaseIdentifiedModel.d.mts +1 -1
  77. package/lib/types/contract/models/Batch.d.cts +1 -1
  78. package/lib/types/contract/models/Batch.d.mts +1 -1
  79. package/lib/types/contract/models/GtinOwner.d.cts +1 -1
  80. package/lib/types/contract/models/GtinOwner.d.mts +1 -1
  81. package/lib/types/contract/models/Leaflet.d.cts +1 -1
  82. package/lib/types/contract/models/Leaflet.d.mts +1 -1
  83. package/lib/types/contract/models/LeafletFile.d.cts +1 -1
  84. package/lib/types/contract/models/LeafletFile.d.mts +1 -1
  85. package/lib/types/contract/models/Market.d.cts +1 -1
  86. package/lib/types/contract/models/Market.d.mts +1 -1
  87. package/lib/types/contract/models/OtherAudit.d.cts +2 -2
  88. package/lib/types/contract/models/OtherAudit.d.mts +2 -2
  89. package/lib/types/contract/models/OtherBatchShared.d.cts +1 -1
  90. package/lib/types/contract/models/OtherBatchShared.d.mts +1 -1
  91. package/lib/types/contract/models/OtherLeaflet.d.cts +2 -2
  92. package/lib/types/contract/models/OtherLeaflet.d.mts +2 -2
  93. package/lib/types/contract/models/OtherLeafletFile.d.cts +1 -1
  94. package/lib/types/contract/models/OtherLeafletFile.d.mts +1 -1
  95. package/lib/types/contract/models/OtherMarket.d.cts +1 -1
  96. package/lib/types/contract/models/OtherMarket.d.mts +1 -1
  97. package/lib/types/contract/models/OtherProduct.d.cts +1 -1
  98. package/lib/types/contract/models/OtherProduct.d.mts +1 -1
  99. package/lib/types/contract/models/OtherProductImage.d.cts +1 -1
  100. package/lib/types/contract/models/OtherProductImage.d.mts +1 -1
  101. package/lib/types/contract/models/OtherProductShared.d.cts +4 -4
  102. package/lib/types/contract/models/OtherProductShared.d.mts +4 -4
  103. package/lib/types/contract/models/OtherProductStrength.d.cts +1 -1
  104. package/lib/types/contract/models/OtherProductStrength.d.mts +1 -1
  105. package/lib/types/contract/models/Product.d.cts +3 -3
  106. package/lib/types/contract/models/Product.d.mts +3 -3
  107. package/lib/types/contract/models/ProductStrength.d.cts +1 -1
  108. package/lib/types/contract/models/ProductStrength.d.mts +1 -1
  109. package/lib/types/contract/models/SegregatedDocument.d.cts +1 -1
  110. package/lib/types/contract/models/SegregatedDocument.d.mts +1 -1
  111. package/lib/types/contract/models/decorators-private.d.cts +2 -2
  112. package/lib/types/contract/models/decorators-private.d.mts +2 -2
  113. package/lib/types/contract/models/decorators.d.cts +2 -2
  114. package/lib/types/contract/models/decorators.d.mts +2 -2
  115. package/lib/types/contract/models/history-dec.d.cts +1 -1
  116. package/lib/types/contract/models/history-dec.d.mts +1 -1
  117. package/lib/types/contracts/ContractAdapter.d.cts +5 -5
  118. package/lib/types/contracts/ContractAdapter.d.mts +5 -5
  119. package/lib/types/contracts/ContractContext.d.cts +1 -1
  120. package/lib/types/contracts/ContractContext.d.mts +1 -1
  121. package/lib/types/contracts/FabricContractDispatch.d.cts +2 -2
  122. package/lib/types/contracts/FabricContractDispatch.d.mts +2 -2
  123. package/lib/types/contracts/FabricContractPaginator.d.cts +1 -1
  124. package/lib/types/contracts/FabricContractPaginator.d.mts +1 -1
  125. package/lib/types/contracts/FabricContractRepository.d.cts +3 -3
  126. package/lib/types/contracts/FabricContractRepository.d.mts +3 -3
  127. package/lib/types/contracts/FabricContractRepositoryObservableHandler.d.cts +1 -1
  128. package/lib/types/contracts/FabricContractRepositoryObservableHandler.d.mts +1 -1
  129. package/lib/types/contracts/FabricContractStatement.d.cts +1 -1
  130. package/lib/types/contracts/FabricContractStatement.d.mts +1 -1
  131. package/lib/types/contracts/MigrationContract.d.cts +3 -3
  132. package/lib/types/contracts/MigrationContract.d.mts +3 -3
  133. package/lib/types/contracts/auth/index.d.cts +1 -1
  134. package/lib/types/contracts/auth/index.d.mts +1 -1
  135. package/lib/types/contracts/crud/crud-contract.d.cts +5 -5
  136. package/lib/types/contracts/crud/crud-contract.d.mts +5 -5
  137. package/lib/types/contracts/crud/index.d.cts +2 -2
  138. package/lib/types/contracts/crud/index.d.mts +2 -2
  139. package/lib/types/contracts/crud/serialized-crud-contract.d.cts +1 -1
  140. package/lib/types/contracts/crud/serialized-crud-contract.d.mts +1 -1
  141. package/lib/types/contracts/erc20/erc20contract.d.cts +3 -3
  142. package/lib/types/contracts/erc20/erc20contract.d.mts +3 -3
  143. package/lib/types/contracts/erc20/index.d.cts +1 -1
  144. package/lib/types/contracts/erc20/index.d.mts +1 -1
  145. package/lib/types/contracts/index.d.cts +13 -13
  146. package/lib/types/contracts/index.d.mts +13 -13
  147. package/lib/types/contracts/types.d.cts +1 -1
  148. package/lib/types/contracts/types.d.mts +1 -1
  149. package/lib/types/index.d.cts +3 -3
  150. package/lib/types/index.d.mts +3 -3
  151. package/lib/types/shared/decorators.d.cts +3 -3
  152. package/lib/types/shared/decorators.d.mts +3 -3
  153. package/lib/types/shared/erc20/index.d.cts +1 -1
  154. package/lib/types/shared/erc20/index.d.mts +1 -1
  155. package/lib/types/shared/index.d.cts +14 -14
  156. package/lib/types/shared/index.d.mts +14 -14
  157. package/lib/types/shared/interfaces/index.d.cts +1 -1
  158. package/lib/types/shared/interfaces/index.d.mts +1 -1
  159. package/lib/types/shared/model/FabricIdentifiedBaseModel.d.cts +1 -1
  160. package/lib/types/shared/model/FabricIdentifiedBaseModel.d.mts +1 -1
  161. package/lib/types/shared/model/Identity.d.cts +2 -2
  162. package/lib/types/shared/model/Identity.d.mts +2 -2
  163. package/lib/types/shared/model/index.d.cts +4 -4
  164. package/lib/types/shared/model/index.d.mts +4 -4
  165. package/lib/types/shared/overrides/Model.d.cts +2 -2
  166. package/lib/types/shared/overrides/Model.d.mts +2 -2
  167. package/lib/types/shared/overrides/index.d.cts +2 -2
  168. package/lib/types/shared/overrides/index.d.mts +2 -2
  169. package/lib/types/version.d.cts +1 -1
  170. package/lib/types/version.d.mts +1 -1
  171. package/package.json +1 -1
  172. package/lib/types/bin/cli.d.ts +0 -1
  173. package/lib/types/cli-module.d.ts +0 -3
  174. package/lib/types/cli-utils.d.ts +0 -21
  175. package/lib/types/client/FabricClientAdapter.d.ts +0 -404
  176. package/lib/types/client/FabricClientDispatch.d.ts +0 -133
  177. package/lib/types/client/FabricClientPaginator.d.ts +0 -12
  178. package/lib/types/client/FabricClientRepository.d.ts +0 -71
  179. package/lib/types/client/FabricClientStatement.d.ts +0 -64
  180. package/lib/types/client/collections/generation.d.ts +0 -46
  181. package/lib/types/client/collections/index.d.ts +0 -1
  182. package/lib/types/client/constants.d.ts +0 -2
  183. package/lib/types/client/crypto.d.ts +0 -107
  184. package/lib/types/client/erc20/FabricERC20ClientRepository.d.ts +0 -254
  185. package/lib/types/client/erc20/index.d.ts +0 -1
  186. package/lib/types/client/fabric-fs.d.ts +0 -92
  187. package/lib/types/client/fabric-hsm.d.ts +0 -24
  188. package/lib/types/client/ids/id-extraction.d.ts +0 -4
  189. package/lib/types/client/ids/index.d.ts +0 -1
  190. package/lib/types/client/index.d.ts +0 -23
  191. package/lib/types/client/indexes/generation.d.ts +0 -10
  192. package/lib/types/client/indexes/index.d.ts +0 -1
  193. package/lib/types/client/logging.d.ts +0 -60
  194. package/lib/types/client/services/FabricEnrollmentService.d.ts +0 -176
  195. package/lib/types/client/services/FabricIdentityService.d.ts +0 -98
  196. package/lib/types/client/services/RegistrationRequestBuilder.d.ts +0 -19
  197. package/lib/types/client/services/constants.d.ts +0 -15
  198. package/lib/types/client/services/index.d.ts +0 -4
  199. package/lib/types/client/types.d.ts +0 -20
  200. package/lib/types/client/utils.d.ts +0 -71
  201. package/lib/types/contract/Address.d.ts +0 -13
  202. package/lib/types/contract/AddressContract.d.ts +0 -5
  203. package/lib/types/contract/AuditContract.d.ts +0 -5
  204. package/lib/types/contract/BatchContract.d.ts +0 -5
  205. package/lib/types/contract/MarketContract.d.ts +0 -5
  206. package/lib/types/contract/OtherAuditContract.d.ts +0 -5
  207. package/lib/types/contract/OtherBatchContract.d.ts +0 -5
  208. package/lib/types/contract/OtherMarketContract.d.ts +0 -5
  209. package/lib/types/contract/OtherProductContract.d.ts +0 -5
  210. package/lib/types/contract/OtherProductImageContract.d.ts +0 -5
  211. package/lib/types/contract/OtherProductSharedContract.d.ts +0 -5
  212. package/lib/types/contract/OtherProductStrengthContract.d.ts +0 -5
  213. package/lib/types/contract/Product.d.ts +0 -7
  214. package/lib/types/contract/ProductContract.d.ts +0 -5
  215. package/lib/types/contract/ProductStrengthContract.d.ts +0 -5
  216. package/lib/types/contract/SegregatedPrivateDocumentContract.d.ts +0 -5
  217. package/lib/types/contract/SegregatedSharedDocumentContract.d.ts +0 -5
  218. package/lib/types/contract/User.d.ts +0 -7
  219. package/lib/types/contract/UserContract.d.ts +0 -5
  220. package/lib/types/contract/index.d.ts +0 -2
  221. package/lib/types/contract/logging-context.d.ts +0 -8
  222. package/lib/types/contract/models/Audit.d.ts +0 -13
  223. package/lib/types/contract/models/BaseIdentifiedModel.d.ts +0 -7
  224. package/lib/types/contract/models/BaseModel.d.ts +0 -7
  225. package/lib/types/contract/models/Batch.d.ts +0 -18
  226. package/lib/types/contract/models/GtinOwner.d.ts +0 -8
  227. package/lib/types/contract/models/History.d.ts +0 -9
  228. package/lib/types/contract/models/Leaflet.d.ts +0 -12
  229. package/lib/types/contract/models/LeafletFile.d.ts +0 -9
  230. package/lib/types/contract/models/Market.d.ts +0 -12
  231. package/lib/types/contract/models/OtherAudit.d.ts +0 -15
  232. package/lib/types/contract/models/OtherBatchShared.d.ts +0 -18
  233. package/lib/types/contract/models/OtherLeaflet.d.ts +0 -16
  234. package/lib/types/contract/models/OtherLeafletFile.d.ts +0 -10
  235. package/lib/types/contract/models/OtherMarket.d.ts +0 -13
  236. package/lib/types/contract/models/OtherProduct.d.ts +0 -12
  237. package/lib/types/contract/models/OtherProductImage.d.ts +0 -9
  238. package/lib/types/contract/models/OtherProductShared.d.ts +0 -18
  239. package/lib/types/contract/models/OtherProductStrength.d.ts +0 -12
  240. package/lib/types/contract/models/Product.d.ts +0 -15
  241. package/lib/types/contract/models/ProductStrength.d.ts +0 -11
  242. package/lib/types/contract/models/SegregatedDocument.d.ts +0 -18
  243. package/lib/types/contract/models/constants.d.ts +0 -24
  244. package/lib/types/contract/models/decorators-private.d.ts +0 -16
  245. package/lib/types/contract/models/decorators.d.ts +0 -28
  246. package/lib/types/contract/models/gtin.d.ts +0 -8
  247. package/lib/types/contract/models/history-dec.d.ts +0 -6
  248. package/lib/types/contracts/ContractAdapter.d.ts +0 -287
  249. package/lib/types/contracts/ContractContext.d.ts +0 -89
  250. package/lib/types/contracts/FabricContractDispatch.d.ts +0 -7
  251. package/lib/types/contracts/FabricContractPaginator.d.ts +0 -105
  252. package/lib/types/contracts/FabricContractRepository.d.ts +0 -119
  253. package/lib/types/contracts/FabricContractRepositoryObservableHandler.d.ts +0 -62
  254. package/lib/types/contracts/FabricContractSequence.d.ts +0 -87
  255. package/lib/types/contracts/FabricContractStatement.d.ts +0 -36
  256. package/lib/types/contracts/MigrationContract.d.ts +0 -22
  257. package/lib/types/contracts/PrivateSequence.d.ts +0 -15
  258. package/lib/types/contracts/auth/decorators.d.ts +0 -6
  259. package/lib/types/contracts/auth/index.d.ts +0 -1
  260. package/lib/types/contracts/crud/crud-contract.d.ts +0 -199
  261. package/lib/types/contracts/crud/index.d.ts +0 -2
  262. package/lib/types/contracts/crud/serialized-crud-contract.d.ts +0 -42
  263. package/lib/types/contracts/erc20/erc20contract.d.ts +0 -152
  264. package/lib/types/contracts/erc20/index.d.ts +0 -2
  265. package/lib/types/contracts/erc20/models.d.ts +0 -114
  266. package/lib/types/contracts/index.d.ts +0 -20
  267. package/lib/types/contracts/logging.d.ts +0 -54
  268. package/lib/types/contracts/overrides.d.ts +0 -1
  269. package/lib/types/contracts/types.d.ts +0 -38
  270. package/lib/types/contracts/uuid.d.ts +0 -2
  271. package/lib/types/index.d.ts +0 -8
  272. package/lib/types/shared/ClientSerializer.d.ts +0 -52
  273. package/lib/types/shared/DeterministicSerializer.d.ts +0 -47
  274. package/lib/types/shared/SimpleDeterministicSerializer.d.ts +0 -7
  275. package/lib/types/shared/constants.d.ts +0 -35
  276. package/lib/types/shared/decorators.d.ts +0 -81
  277. package/lib/types/shared/erc20/erc20-constants.d.ts +0 -25
  278. package/lib/types/shared/erc20/index.d.ts +0 -1
  279. package/lib/types/shared/errors.d.ts +0 -140
  280. package/lib/types/shared/events.d.ts +0 -37
  281. package/lib/types/shared/fabric-types.d.ts +0 -32
  282. package/lib/types/shared/index.d.ts +0 -21
  283. package/lib/types/shared/interfaces/Checkable.d.ts +0 -23
  284. package/lib/types/shared/interfaces/index.d.ts +0 -1
  285. package/lib/types/shared/math.d.ts +0 -34
  286. package/lib/types/shared/model/FabricBaseModel.d.ts +0 -7
  287. package/lib/types/shared/model/FabricIdentifiedBaseModel.d.ts +0 -7
  288. package/lib/types/shared/model/Identity.d.ts +0 -42
  289. package/lib/types/shared/model/IdentityCredentials.d.ts +0 -41
  290. package/lib/types/shared/model/index.d.ts +0 -4
  291. package/lib/types/shared/overrides/Model.d.ts +0 -22
  292. package/lib/types/shared/overrides/index.d.ts +0 -2
  293. package/lib/types/shared/overrides/overrides.d.ts +0 -1
  294. package/lib/types/shared/types.d.ts +0 -125
  295. package/lib/types/version.d.ts +0 -2
@@ -1,71 +0,0 @@
1
- import type { MaybeContextualArg } from "@decaf-ts/core";
2
- import { ContextOf, DirectionLimitOffset, FlagsOf, ObserverHandler, OrderDirection, Repository, SerializedPage } from "@decaf-ts/core";
3
- import { Model } from "@decaf-ts/decorator-validation";
4
- import { Constructor } from "@decaf-ts/decoration";
5
- import { type FabricClientAdapter } from "./FabricClientAdapter";
6
- import { PrimaryKeyType } from "@decaf-ts/db-decorators";
7
- /**
8
- * @description Repository implementation for Fabric client operations
9
- * @summary Extends the generic Repository to prepare context and arguments for CRUD operations executed via a Fabric client Adapter, wiring RepositoryFlags and Fabric-specific overrides.
10
- * @template M extends Model - The model type handled by this repository
11
- * @param {Adapter<any, MangoQuery, FabricFlags, Context<FabricFlags>>} [adapter] - Optional adapter instance used to execute operations
12
- * @param {Constructor<M>} [clazz] - Optional model constructor used by the repository
13
- * @return {void}
14
- * @class FabricClientRepository
15
- * @example
16
- * import { Repository } from "@decaf-ts/core";
17
- * import { FabricClientRepository } from "@decaf-ts/for-fabric";
18
- *
19
- * class User extends Model { id!: string; name!: string; }
20
- * const repo = new FabricClientRepository<User>();
21
- * const created = await repo.create(new User({ id: "1", name: "Alice" }));
22
- * const loaded = await repo.read("1");
23
- *
24
- * @mermaid
25
- * sequenceDiagram
26
- * participant App
27
- * participant Repo as FabricClientRepository
28
- * participant Adapter
29
- * App->>Repo: create(model)
30
- * Repo->>Repo: createPrefix(model, ...args)
31
- * Repo->>Adapter: create(table, id, model, flags)
32
- * Adapter-->>Repo: result
33
- * Repo-->>App: model
34
- */
35
- export declare class FabricClientRepository<M extends Model, A extends FabricClientAdapter = FabricClientAdapter> extends Repository<M, A> {
36
- protected _overrides: Partial<FlagsOf<ContextOf<A>>> & {
37
- ignoreValidation: boolean;
38
- ignoreHandlers: boolean;
39
- allowRawStatements: boolean;
40
- forcePrepareSimpleQueries: boolean;
41
- forcePrepareComplexQueries: boolean;
42
- allowGenerationOverride: boolean;
43
- rebuildWithTransient: boolean;
44
- };
45
- constructor(adapter?: A, clazz?: Constructor<M>, force?: boolean);
46
- override(flags: Partial<FlagsOf<ContextOf<A>>>): this;
47
- protected ObserverHandler(): ObserverHandler;
48
- paginateBy(key: keyof M, order: OrderDirection, ref?: Omit<DirectionLimitOffset, "direction">, ...args: MaybeContextualArg<ContextOf<A>>): Promise<SerializedPage<M>>;
49
- listBy(key: keyof M, order: OrderDirection, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
50
- findBy(key: keyof M, value: any, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
51
- findOneBy(key: keyof M, value: any, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M>;
52
- find(value: string, order?: OrderDirection, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
53
- page(value: string, direction?: OrderDirection, ref?: Omit<DirectionLimitOffset, "direction">, ...args: MaybeContextualArg<ContextOf<A>>): Promise<SerializedPage<M>>;
54
- statement(name: string, ...args: MaybeContextualArg<ContextOf<A>>): Promise<any>;
55
- private applyAfterRead;
56
- countOf(key?: keyof M, ...args: MaybeContextualArg<ContextOf<A>>): Promise<number>;
57
- maxOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[K]>;
58
- minOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[K]>;
59
- avgOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<number>;
60
- sumOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<number>;
61
- distinctOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[K][]>;
62
- groupOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<Record<string, M[]>>;
63
- healthcheck(...args: MaybeContextualArg<ContextOf<A>>): Promise<Record<string, any>>;
64
- create(model: M, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M>;
65
- update(model: M, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M>;
66
- protected createAllPrefix(models: M[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<[M[], ...any[], ContextOf<A>]>;
67
- createAll(models: M[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
68
- readAll(keys: PrimaryKeyType[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
69
- updateAll(models: M[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
70
- private ensureLegacyMirrorFlag;
71
- }
@@ -1,64 +0,0 @@
1
- import { AdapterFlags, Condition, Context, MaybeContextualArg, PreparedStatement, Statement, StatementExecutor } from "@decaf-ts/core";
2
- import { Model } from "@decaf-ts/decorator-validation";
3
- import { FabricClientAdapter } from "./FabricClientAdapter";
4
- import { MangoQuery } from "@decaf-ts/for-couchdb";
5
- import { FabricClientFlags } from "./types";
6
- export declare class FabricClientStatement<M extends Model, R> extends Statement<M, FabricClientAdapter, R, MangoQuery> {
7
- constructor(adapter: FabricClientAdapter, overrides?: Partial<AdapterFlags>);
8
- protected squash(ctx: Context<FabricClientFlags>): PreparedStatement<any> | undefined;
9
- protected executePrepared(...argz: MaybeContextualArg<Context<FabricClientFlags>>): Promise<R>;
10
- prepare(ctx?: Context<FabricClientFlags>): Promise<StatementExecutor<M, R>>;
11
- /**
12
- * @description Processes a record from CouchDB/Fabric
13
- * @summary Extracts the ID from a CouchDB document and reverts it to a model instance
14
- */
15
- protected processRecord(record: any, ctx: Context<FabricClientFlags>): M;
16
- /**
17
- * @description Executes a raw Mango query
18
- * @summary Sends a raw Mango query to Fabric and processes the results
19
- */
20
- raw<R>(rawInput: MangoQuery, ...args: any[]): Promise<R>;
21
- /**
22
- * @description Builds a CouchDB Mango query from the statement
23
- * @summary Converts the statement's conditions, selectors, and options into a CouchDB Mango query
24
- */
25
- protected build(): MangoQuery;
26
- /**
27
- * @description Parses a condition into a CouchDB Mango query selector
28
- * @summary Converts a Condition object into a CouchDB Mango query selector structure
29
- */
30
- protected parseCondition(condition: Condition<M>): MangoQuery;
31
- /**
32
- * @description Builds an aggregate query if aggregation is requested
33
- * @summary Checks for aggregate operations and returns a special MangoQuery for them
34
- */
35
- private buildAggregateQuery;
36
- /**
37
- * @description Creates an aggregate descriptor for a view-based aggregation
38
- */
39
- private createAggregateDescriptor;
40
- /**
41
- * @description Creates the special aggregate MangoQuery marker
42
- */
43
- private createAggregateQuery;
44
- /**
45
- * @description Gets the adapter cast to FabricClientAdapter for view access
46
- */
47
- private getFabricAdapter;
48
- /**
49
- * @description Executes an aggregate query via adapter's view method
50
- */
51
- private executeAggregate;
52
- /**
53
- * @description Handles average calculation from sum and count views
54
- */
55
- private handleAverage;
56
- /**
57
- * @description Processes the view response based on aggregate kind
58
- */
59
- private processViewResponse;
60
- /**
61
- * @description Type guard to check if info is a view-based aggregate
62
- */
63
- private isViewAggregate;
64
- }
@@ -1,46 +0,0 @@
1
- import { Constructor } from "@decaf-ts/decoration";
2
- import { CouchDBDesignDoc } from "@decaf-ts/for-couchdb";
3
- import { Model } from "@decaf-ts/decorator-validation";
4
- export type FabricPolicyIdentity = {
5
- role: {
6
- name: string;
7
- mspId: string;
8
- };
9
- };
10
- export type FabricCollection = {
11
- name: string;
12
- policy: string;
13
- requiredPeerCount: number;
14
- maxPeerCount: number;
15
- blockToLive: number;
16
- memberOnlyRead: boolean;
17
- memberOnlyWrite: boolean;
18
- endorsementPolicy: {
19
- identities: FabricPolicyIdentity[];
20
- rule: string;
21
- };
22
- };
23
- export type PrivateCollection = {
24
- name: string;
25
- policy: string;
26
- requiredPeerCount: number;
27
- maxPeerCount: number;
28
- blockToLive: number;
29
- memberOnlyRead: boolean;
30
- memberOnlyWrite: boolean;
31
- endorsementPolicy?: {
32
- signaturePolicy: string;
33
- };
34
- };
35
- export declare function collectionFor(collectionName: string, policy: string, requiredPeerCount: number, maxPeerCount: number, blockToLive: number, memberOnlyRead: boolean, memberOnlyWrite: boolean): PrivateCollection;
36
- export declare function privateCollectionFor(mspId: string, collectionName?: string, requiredPeerCount?: number, maxPeerCount?: number, blockToLive?: number, memberOnlyRead?: boolean, memberOnlyWrite?: boolean): PrivateCollection;
37
- export declare function sharedCollectionFor(mspIds: string[], collectionName: string, requiredPeerCount?: number, maxPeerCount?: number, blockToLive?: number, memberOnlyRead?: boolean, memberOnlyWrite?: boolean): PrivateCollection;
38
- export declare function extractCollections<M extends Model>(m: Constructor<M>, mspIds: string[], overrides?: {
39
- privateCols?: Partial<PrivateCollection>;
40
- sharedCols?: Partial<PrivateCollection>;
41
- }, mirror?: boolean): Promise<{
42
- privates: PrivateCollection[];
43
- shared: PrivateCollection[];
44
- }>;
45
- export declare function writeCollections(cols: PrivateCollection[], p?: string, fileName?: string): void;
46
- export declare function writeCollectionDesignDocs(docs: CouchDBDesignDoc[], p?: string, collection?: string): void;
@@ -1 +0,0 @@
1
- export * from "./generation";
@@ -1,2 +0,0 @@
1
- import { FabricClientFlags } from "./types";
2
- export declare const DefaultFabricClientFlags: FabricClientFlags;
@@ -1,107 +0,0 @@
1
- import { CryptoKey } from "@peculiar/webcrypto";
2
- export declare enum BASE_ALPHABET {
3
- BASE2 = "01",
4
- BASE8 = "01234567",
5
- BASE11 = "0123456789a",
6
- BASE16 = "0123456789abcdef",
7
- BASE32 = "0123456789ABCDEFGHJKMNPQRSTVWXYZ",
8
- BASE32_Z = "ybndrfg8ejkmcpqxot1uwisza345h769",
9
- BASE36 = "0123456789abcdefghijklmnopqrstuvwxyz",
10
- BASE58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
11
- BASE62 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
12
- BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
13
- BASE67 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.!~"
14
- }
15
- export type keyObject = {
16
- iv: ArrayBuffer;
17
- key: CryptoKey;
18
- };
19
- export declare enum CRYPTO {
20
- HASH = "SHA-256",
21
- ITERATIONS = 1000,
22
- KEYLENGTH = 48,
23
- DERIVED_IV_LENGTH = 16,
24
- DERIVED_KEY_LENGTH = 32,// Because SHA-256 used has a native size of 32 bytes
25
- ALGORYTHM = "AES-GCM",
26
- KEY_ALGORYTHM = "PBKDF2"
27
- }
28
- export declare class BaseEncoder {
29
- private alphabet;
30
- private readonly baseMap;
31
- private readonly base;
32
- private readonly leader;
33
- private readonly factor;
34
- private readonly iFactor;
35
- constructor(alphabet: BASE_ALPHABET);
36
- encode(source: Uint8Array | DataView | any[] | string): string;
37
- private decodeUnsafe;
38
- decode(source: string): Uint8Array<ArrayBufferLike>;
39
- }
40
- export declare class CryptoUtils {
41
- private static readonly b58encoder;
42
- private static readonly logger;
43
- private constructor();
44
- static fabricIdFromCertificate(certificate: string): string;
45
- static encode(str: string): string;
46
- static decode(str: string): string;
47
- static stringToArrayBuffer(str: string): ArrayBuffer;
48
- private static extractKey;
49
- static extractPrivateKey(pem: Buffer | string, usages?: any[]): Promise<import("node:crypto").webcrypto.CryptoKey>;
50
- static extractPublicKey(pem: Buffer | string, usages?: any[]): Promise<import("node:crypto").webcrypto.CryptoKey>;
51
- static sign(privateKey: string, data: Buffer): Promise<string>;
52
- static verify(certificate: string, signature: Buffer | string, data: Buffer | string): Promise<boolean>;
53
- static encrypt(certificate: string, data: string | Buffer): Promise<string>;
54
- private static getSubtleCrypto;
55
- static decrypt(privateKey: string, data: string | Buffer): Promise<any>;
56
- /**
57
- * @summary Util function to get a random master key
58
- *
59
- * @description If data is not passed, a random ArrayBuffer will be generated
60
- *
61
- * @param {ArrayBuffer} data encrytion data
62
- *
63
- * @function getMaster
64
- */
65
- static getMaster(data?: ArrayBuffer): Promise<keyObject>;
66
- /**
67
- * @summary Util function to derive a key from another key
68
- *
69
- * @param {string} salt
70
- * @param {CryptoKey} key Original key
71
- *
72
- * @function getDerivationKey
73
- */
74
- static getDerivationKey(salt: string, key: CryptoKey): Promise<{
75
- key: any;
76
- iv: ArrayBuffer;
77
- }>;
78
- /**
79
- * @summary Util function to get the key and IV from the CrytoKey array
80
- *
81
- * @param {ArrayBuffer} derivation
82
- *
83
- * @function getKey
84
- */
85
- static getKey(derivation: ArrayBuffer): Promise<{
86
- key: any;
87
- iv: ArrayBuffer;
88
- }>;
89
- /**
90
- * @summary Util function to decrypt data
91
- *
92
- * @param {string} text
93
- * @param {keyObject} keyObject
94
- *
95
- * @function encrypt
96
- */
97
- static encryptPin(text: string, keyObject: keyObject): Promise<ArrayBuffer>;
98
- /**
99
- * @summary Util function to decrypt data
100
- *
101
- * @param {BufferSource} encryptedText
102
- * @param {keyObject} keyObject
103
- *
104
- * @function decrypt
105
- */
106
- static decryptPin(encryptedText: ArrayBuffer, keyObject: keyObject): Promise<string>;
107
- }
@@ -1,254 +0,0 @@
1
- import { FabricClientRepository } from "../FabricClientRepository";
2
- import { ERC20Token, ERC20Wallet } from "../../contracts/erc20/models";
3
- import { Model, Serializer } from "@decaf-ts/decorator-validation";
4
- import { FabricClientAdapter } from "../FabricClientAdapter";
5
- import { ContextOf, ContextualArgs, EventIds, MaybeContextualArg } from "@decaf-ts/core";
6
- import { BulkCrudOperationKeys, OperationKeys } from "@decaf-ts/db-decorators";
7
- import { Constructor } from "@decaf-ts/decoration";
8
- /**
9
- * Repository for interacting with ERC20 contracts on a Hyperledger Fabric network.
10
- * Extends the base FabricClientRepository class and utilizes the ClientSerializer for data serialization.
11
- */
12
- export declare class FabricERC20ClientRepository<A extends FabricClientAdapter> extends FabricClientRepository<ERC20Wallet, A> {
13
- private static serializer;
14
- protected readonly serializer: Serializer<any>;
15
- private static decoder;
16
- /**
17
- * @description Notifies all observers of an event.
18
- * @summary Updates all registered observers with information about a database event.
19
- * @param {string} table - The table name where the event occurred.
20
- * @param {OperationKeys|BulkCrudOperationKeys|string} event - The type of event that occurred.
21
- * @param {EventIds} id - The ID or IDs of the affected records.
22
- * @param {...any[]} args - Additional arguments.
23
- * @return {Promise<void>} A promise that resolves when all observers have been notified.
24
- * @throws {InternalError} If the observer handler is not initialized.
25
- */
26
- updateObservers<M extends Model>(table: Constructor<M> | string, event: OperationKeys | BulkCrudOperationKeys | string, id: EventIds, ...args: ContextualArgs<ContextOf<A>>): Promise<void>;
27
- /**
28
- * Decodes a Uint8Array into a string using the TextDecoder.
29
- *
30
- * @param data - The Uint8Array to decode.
31
- * @returns The decoded string.
32
- */
33
- decode(data: Uint8Array): string;
34
- constructor(adapter?: A);
35
- /**
36
- * Retrieves the name of the ERC20 token.
37
- *
38
- * @description
39
- * This function interacts with the blockchain network to fetch the name of the ERC20 token.
40
- * It calls the "TokenName" transaction on the smart contract and decodes the returned data.
41
- *
42
- * @returns {Promise<string>} A promise that resolves with the name of the ERC20 token.
43
- *
44
- * @throws {Error} If the transaction fails or the decoding process fails.
45
- */
46
- tokenName(...args: MaybeContextualArg<ContextOf<A>>): Promise<string>;
47
- /**
48
- * Retrieves the symbol of the ERC20 token.
49
- *
50
- * This function interacts with the blockchain network to fetch the symbol of the ERC20 token.
51
- * It calls the "Symbol" transaction on the smart contract and decodes the returned data.
52
- *
53
- * @returns {Promise<string>} A promise that resolves with the symbol of the ERC20 token.
54
- *
55
- * @throws {Error} If the transaction fails or the decoding process fails.
56
- */
57
- symbol(...args: MaybeContextualArg<ContextOf<A>>): Promise<string>;
58
- /**
59
- * Retrieves the number of decimal places for the ERC20 token.
60
- *
61
- * This function interacts with the blockchain network to fetch the number of decimal places for the ERC20 token.
62
- * It calls the "Decimals" transaction on the smart contract and decodes the returned data.
63
- *
64
- * @returns {Promise<number>} A promise that resolves with the number of decimal places for the ERC20 token.
65
- *
66
- * @throws {Error} If the transaction fails or the decoding process fails.
67
- */
68
- decimals(...args: MaybeContextualArg<ContextOf<A>>): Promise<number>;
69
- /**
70
- * Retrieves the total supply of the ERC20 token.
71
- *
72
- * This function interacts with the blockchain network to fetch the total supply of the ERC20 token.
73
- * It calls the "TotalSupply" transaction on the smart contract and decodes the returned data.
74
- *
75
- * @returns {Promise<number>} A promise that resolves with the total supply of the ERC20 token.
76
- *
77
- * @throws {Error} If the transaction fails or the decoding process fails.
78
- */
79
- totalSupply(...args: MaybeContextualArg<ContextOf<A>>): Promise<number>;
80
- /**
81
- * Retrieves the balance of the ERC20 token for a specified owner.
82
- *
83
- * @description
84
- * This function interacts with the blockchain network to fetch the balance of the ERC20 token for a given owner.
85
- * It calls the "BalanceOf" transaction on the smart contract with the provided owner's address as a parameter.
86
- * The returned data is then decoded and converted to a number.
87
- *
88
- * @param owner - The address of the ERC20 token owner.
89
- *
90
- * @returns {Promise<number>} A promise that resolves with the balance of the ERC20 token for the specified owner.
91
- *
92
- * @throws {Error} If the transaction fails or the decoding process fails.
93
- */
94
- balanceOf(owner: string, ...args: MaybeContextualArg<ContextOf<A>>): Promise<number>;
95
- /**
96
- * Transfers a specified amount of ERC20 tokens to a recipient.
97
- *
98
- * @description
99
- * This function interacts with the blockchain network to transfer a specified amount of ERC20 tokens to a recipient.
100
- * It calls the "Transfer" transaction on the smart contract with the recipient's address and the transfer amount as parameters.
101
- * The returned data is then decoded and checked to determine if the transfer was successful.
102
- *
103
- * @param to - The address of the recipient.
104
- * @param value - The amount of ERC20 tokens to transfer.
105
- *
106
- * @returns {Promise<boolean>} A promise that resolves with `true` if the transfer was successful, and `false` otherwise.
107
- *
108
- * @throws {Error} If the transaction fails or the decoding process fails.
109
- */
110
- transfer(to: string, value: number, ...args: MaybeContextualArg<ContextOf<A>>): Promise<boolean>;
111
- /**
112
- * Transfers a specified amount of ERC20 tokens from one account to another.
113
- *
114
- * @description
115
- * This function interacts with the blockchain network to transfer a specified amount of ERC20 tokens from one account to another.
116
- * For this transfer to work the spender ( account that will trigger this function ) need to have the value approved as an allowance by the sender.
117
- * It calls the "TransferFrom" transaction on the smart contract with the sender's address, recipient's address, and the transfer amount as parameters.
118
- * The returned data is then decoded and checked to determine if the transfer was successful.
119
- *
120
- * @param from - The address of the sender.
121
- * @param to - The address of the recipient.
122
- * @param value - The amount of ERC20 tokens to transfer.
123
- *
124
- * @returns {Promise<boolean>} A promise that resolves with `true` if the transfer was successful, and `false` otherwise.
125
- *
126
- * @throws {Error} If the transaction fails or the decoding process fails.
127
- */
128
- transferFrom(from: string, to: string, value: number): Promise<boolean>;
129
- /**
130
- * Approves a specified amount of ERC20 tokens to be spent by a specified spender.
131
- *
132
- * This function interacts with the blockchain network to approve a specified amount of ERC20 tokens to be spent by a specified spender.
133
- * It calls the "Approve" transaction on the smart contract with the spender's address and the approval amount as parameters.
134
- * The returned data is then decoded and checked to determine if the approval was successful.
135
- *
136
- * @param spender - The address of the spender.
137
- * @param value - The amount of ERC20 tokens to approve for the spender.
138
- *
139
- * @returns {Promise<boolean>} A promise that resolves with `true` if the approval was successful, and `false` otherwise.
140
- *
141
- * @throws {Error} If the transaction fails or the decoding process fails.
142
- */
143
- approve(spender: string, value: number): Promise<boolean>;
144
- /**
145
- * Retrieves the allowance of ERC20 tokens that the specified owner has approved for a spender.
146
- *
147
- * @description
148
- * This function interacts with the blockchain network to fetch the allowance of ERC20 tokens that the specified owner has approved for a spender.
149
- * It calls the "Allowance" transaction on the smart contract with the owner's address and the spender's address as parameters.
150
- * The returned data is then decoded and converted to a number.
151
- *
152
- * @param owner - The address of the ERC20 token owner.
153
- * @param spender - The address of the spender.
154
- *
155
- * @returns {Promise<number>} A promise that resolves with the allowance of ERC20 tokens that the specified owner has approved for the spender.
156
- *
157
- * @throws {Error} If the transaction fails or the decoding process fails.
158
- */
159
- allowance(owner: string, spender: string): Promise<number>;
160
- /**
161
- * Initializes the ERC20 contract with the provided token information.
162
- *
163
- * @description
164
- * This function interacts with the blockchain network to initialize the ERC20 contract with the given token information.
165
- * It calls the "Initialize" transaction on the smart contract with the serialized token data as a parameter.
166
- * The returned data is then decoded and checked to determine if the initialization was successful.
167
- *
168
- * @param token - The ERC20 token information to initialize the contract with.
169
- *
170
- * @returns {Promise<boolean>} A promise that resolves with `true` if the initialization was successful, and `false` otherwise.
171
- *
172
- * @throws {Error} If the transaction fails or the decoding process fails.
173
- */
174
- initialize(token: ERC20Token): Promise<boolean>;
175
- /**
176
- * Checks if the ERC20 contract has been initialized.
177
- *
178
- * This function interacts with the blockchain network to verify if the ERC20 contract has been initialized.
179
- * It calls the "CheckInitialized" transaction on the smart contract, which does not require any parameters.
180
- *
181
- * @returns {Promise<void>} A promise that resolves when the initialization check is completed.
182
- *
183
- * @throws {Error} If the transaction fails.
184
- */
185
- checkInitialized(): Promise<void>;
186
- /**
187
- * Mints a specified amount of ERC20 tokens.
188
- *
189
- * @description
190
- * This function interacts with the blockchain network to mint a specified amount of ERC20 tokens.
191
- * It calls the "Mint" transaction on the smart contract with the minting amount as a parameter.
192
- * The function does not return any value, but it updates the minter's number of tokens.
193
- *
194
- * @param amount - The amount of ERC20 tokens to mint.
195
- *
196
- * @returns {Promise<void>} A promise that resolves when the minting process is completed.
197
- *
198
- * @throws {Error} If the transaction fails.
199
- */
200
- mint(amount: number): Promise<void>;
201
- /**
202
- * Burns a specified amount of ERC20 tokens from the minter's account.
203
- *
204
- * This function interacts with the blockchain network to burn a specified amount of ERC20 tokens.
205
- * It calls the "Burn" transaction on the smart contract with the burning amount as a parameter.
206
- * The function does not return any value, but it decreases the minter's number of tokens.
207
- *
208
- * @param amount - The amount of ERC20 tokens to burn.
209
- *
210
- * @returns {Promise<void>} A promise that resolves when the burning process is completed.
211
- *
212
- * @throws {Error} If the transaction fails.
213
- */
214
- burn(amount: number): Promise<void>;
215
- /**
216
- * Burns a specified amount of ERC20 tokens from a specified account.
217
- *
218
- * This function interacts with the blockchain network to burn a specified amount of ERC20 tokens from a given account.
219
- * It calls the "BurnFrom" transaction on the smart contract with the account's address and the burning amount as parameters.
220
- * The function does not return any value, but it decreases the specified account's number of tokens.
221
- *
222
- * @param account - The address of the account from which to burn the ERC20 tokens.
223
- * @param amount - The amount of ERC20 tokens to burn.
224
- *
225
- * @returns {Promise<void>} A promise that resolves when the burning process is completed.
226
- *
227
- * @throws {Error} If the transaction fails.
228
- */
229
- burnFrom(account: string, amount: number): Promise<void>;
230
- /**
231
- * Retrieves the balance of ERC20 tokens associated with the client's account.
232
- *
233
- * This function interacts with the blockchain network to fetch the balance of ERC20 tokens associated with the client's account.
234
- * It calls the "ClientAccountBalance" transaction on the smart contract, which does not require any parameters.
235
- * The returned data is then decoded and converted to a number.
236
- *
237
- * @returns {Promise<number>} A promise that resolves with the balance of ERC20 tokens associated with the client's account.
238
- *
239
- * @throws {Error} If the transaction fails or the decoding process fails.
240
- */
241
- clientAccountBalance(): Promise<number>;
242
- /**
243
- * Retrieves the client's account ID from the blockchain network.
244
- *
245
- * This function interacts with the blockchain network to fetch the client's account ID.
246
- * It calls the "ClientAccountID" transaction on the smart contract, which does not require any parameters.
247
- * The returned data is then decoded and returned as a string.
248
- *
249
- * @returns {Promise<string>} A promise that resolves with the client's account ID.
250
- *
251
- * @throws {Error} If the transaction fails or the decoding process fails.
252
- */
253
- clientAccountID(): Promise<string>;
254
- }
@@ -1 +0,0 @@
1
- export * from "./FabricERC20ClientRepository";
@@ -1,92 +0,0 @@
1
- import { User } from "fabric-common";
2
- import { Identity, Signer } from "@hyperledger/fabric-gateway";
3
- /**
4
- * @description Loads content from a file or returns the content if already loaded
5
- * @summary Determines if the input is already content or a path to a file, and loads the file if needed
6
- * @param {string | Uint8Array} contentOrPath - The content or path to load
7
- * @param {Function} fileReader - Function to read the file if contentOrPath is a path
8
- * @return {Promise<string | Uint8Array | Buffer>} The content
9
- * @function contentOfLoadFile
10
- * @memberOf module:for-fabric.client
11
- */
12
- export declare function contentOfLoadFile(contentOrPath: string | Uint8Array, fileReader: (path: string) => Promise<string | Uint8Array | Buffer>): Promise<string | Uint8Array<ArrayBufferLike> | Buffer<ArrayBufferLike>>;
13
- /**
14
- * @description Reads a file from the file system
15
- * @summary Loads a file using the Node.js file system module
16
- * @param {string | Buffer} contentOrPath - The content or path to load
17
- * @return {Promise<Buffer>} The file content as a Buffer
18
- * @function readFile
19
- * @memberOf module:for-fabric.client
20
- */
21
- export declare function readFile(contentOrPath: string | Buffer): Promise<Buffer<ArrayBufferLike>>;
22
- /**
23
- * @description Creates a Certificate Authority user
24
- * @summary Initializes a user with the given credentials for interacting with a Fabric CA
25
- * @param {string} userName - The user name
26
- * @param {string} privateKey - The private key as a string
27
- * @param {string} certificate - The certificate as a string
28
- * @param {string} mspId - The Membership Service Provider ID
29
- * @return {Promise<User>} Promise resolving to the created user
30
- * @function getCAUser
31
- * @memberOf module:for-fabric.client
32
- */
33
- export declare function getCAUser(userName: string, privateKey: string, certificate: string, mspId: string): Promise<User>;
34
- /**
35
- * @description Gets an identity from a certificate directory
36
- * @summary Loads a certificate from a directory and creates an Identity object
37
- * @param {string} mspId - The Membership Service Provider ID
38
- * @param {string} certDirectoryPath - Path to the directory containing the certificate
39
- * @return {Promise<Identity>} Promise resolving to the identity
40
- * @function getIdentity
41
- * @memberOf module:for-fabric.client
42
- */
43
- export declare function getIdentity(mspId: string, certDirectoryPath: string): Promise<Identity>;
44
- /**
45
- * @description Gets the full path of the first file in a directory
46
- * @summary Reads a directory and returns the path to the first file found
47
- * @param {string} dirPath - Path to the directory
48
- * @return {Promise<string>} Promise resolving to the full path of the first file
49
- * @function getFirstDirFileName
50
- * @memberOf module:for-fabric.client
51
- */
52
- export declare function getFirstDirFileName(dirPath: string): Promise<string>;
53
- /**
54
- * @description Gets the content of the first file in a directory
55
- * @summary Reads a directory, finds the first file, and returns its content as a string
56
- * @param {string} dirPath - Path to the directory
57
- * @return {Promise<string>} Promise resolving to the content of the first file
58
- * @function getFirstDirFileNameContent
59
- * @memberOf module:for-fabric.client
60
- */
61
- export declare function getFirstDirFileNameContent(dirPath: string): Promise<string>;
62
- /**
63
- * @description Gets a signer from a key directory
64
- * @summary Loads a private key from a directory and creates a Signer for Fabric transactions
65
- * @param {string} keyDirectoryPath - Path to the directory containing the private key
66
- * @return {Promise<Signer>} Promise resolving to the signer
67
- * @function getSigner
68
- * @memberOf module:for-fabric.client
69
- */
70
- export declare function getSigner(keyDirectoryPath: string): Promise<Signer>;
71
- /**
72
- * @description Extracts a private key from a PEM buffer
73
- * @summary Converts a PEM-encoded private key to a CryptoKey object
74
- * @param {Buffer} pem - The PEM-encoded private key
75
- * @return {Promise<CryptoKey>} Promise resolving to the CryptoKey
76
- * @function extractPrivateKey
77
- * @memberOf module:for-fabric.client
78
- * @mermaid
79
- * sequenceDiagram
80
- * participant Caller
81
- * participant ExtractPrivateKey
82
- * participant SubtleCrypto
83
- *
84
- * Caller->>ExtractPrivateKey: extractPrivateKey(pem)
85
- * ExtractPrivateKey->>ExtractPrivateKey: Get SubtleCrypto implementation
86
- * ExtractPrivateKey->>ExtractPrivateKey: Parse PEM format
87
- * ExtractPrivateKey->>ExtractPrivateKey: Convert to binary DER
88
- * ExtractPrivateKey->>SubtleCrypto: importKey(pkcs8, binaryDer, options)
89
- * SubtleCrypto-->>ExtractPrivateKey: CryptoKey
90
- * ExtractPrivateKey-->>Caller: CryptoKey
91
- */
92
- export declare function extractPrivateKey(pem: Buffer): Promise<any>;