@decaf-ts/for-fabric 0.8.0 → 0.10.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.
- package/lib/cjs/bin/cli.cjs +3 -2
- package/lib/cjs/bin/cli.cjs.map +1 -0
- package/lib/cjs/cli-module.cjs +26 -25
- package/lib/cjs/cli-module.cjs.map +1 -0
- package/lib/cjs/cli-utils.cjs +5 -5
- package/lib/cjs/cli-utils.cjs.map +1 -0
- package/lib/cjs/client/FabricClientAdapter.cjs +46 -40
- package/lib/cjs/client/FabricClientAdapter.cjs.map +1 -0
- package/lib/cjs/client/FabricClientDispatch.cjs +8 -7
- package/lib/cjs/client/FabricClientDispatch.cjs.map +1 -0
- package/lib/cjs/client/FabricClientPaginator.cjs +1 -0
- package/lib/cjs/client/FabricClientPaginator.cjs.map +1 -0
- package/lib/cjs/client/FabricClientRepository.cjs +4 -3
- package/lib/cjs/client/FabricClientRepository.cjs.map +1 -0
- package/lib/cjs/client/FabricClientStatement.cjs +1 -0
- package/lib/cjs/client/FabricClientStatement.cjs.map +1 -0
- package/lib/cjs/client/collections/generation.cjs +3 -2
- package/lib/cjs/client/collections/generation.cjs.map +1 -0
- package/lib/cjs/client/collections/index.cjs +1 -0
- package/lib/cjs/client/collections/index.cjs.map +1 -0
- package/lib/cjs/client/constants.cjs +1 -0
- package/lib/cjs/client/constants.cjs.map +1 -0
- package/lib/cjs/client/crypto.cjs +12 -13
- package/lib/cjs/client/crypto.cjs.map +1 -0
- package/lib/cjs/client/erc20/FabricERC20ClientRepository.cjs +7 -6
- package/lib/cjs/client/erc20/FabricERC20ClientRepository.cjs.map +1 -0
- package/lib/cjs/client/erc20/index.cjs +1 -0
- package/lib/cjs/client/erc20/index.cjs.map +1 -0
- package/lib/cjs/client/fabric-fs.cjs +1 -0
- package/lib/cjs/client/fabric-fs.cjs.map +1 -0
- package/lib/cjs/client/fabric-hsm.cjs +3 -2
- package/lib/cjs/client/fabric-hsm.cjs.map +1 -0
- package/lib/cjs/client/ids/id-extraction.cjs +1 -0
- package/lib/cjs/client/ids/id-extraction.cjs.map +1 -0
- package/lib/cjs/client/ids/index.cjs +1 -0
- package/lib/cjs/client/ids/index.cjs.map +1 -0
- package/lib/cjs/client/index.cjs +10 -9
- package/lib/cjs/client/index.cjs.map +1 -0
- package/lib/cjs/client/indexes/generation.cjs +1 -0
- package/lib/cjs/client/indexes/generation.cjs.map +1 -0
- package/lib/cjs/client/indexes/index.cjs +1 -0
- package/lib/cjs/client/indexes/index.cjs.map +1 -0
- package/lib/cjs/client/logging.cjs +1 -0
- package/lib/cjs/client/logging.cjs.map +1 -0
- package/lib/cjs/client/services/FabricEnrollmentService.cjs +17 -32
- package/lib/cjs/client/services/FabricEnrollmentService.cjs.map +1 -0
- package/lib/cjs/client/services/FabricIdentityService.cjs +15 -14
- package/lib/cjs/client/services/FabricIdentityService.cjs.map +1 -0
- package/lib/cjs/client/services/RegistrationRequestBuilder.cjs +11 -5
- package/lib/cjs/client/services/RegistrationRequestBuilder.cjs.map +1 -0
- package/lib/cjs/client/services/constants.cjs +2 -9
- package/lib/cjs/client/services/constants.cjs.map +1 -0
- package/lib/cjs/client/services/index.cjs +1 -0
- package/lib/cjs/client/services/index.cjs.map +1 -0
- package/lib/cjs/client/types.cjs +1 -0
- package/lib/cjs/client/types.cjs.map +1 -0
- package/lib/cjs/client/utils.cjs +1 -0
- package/lib/cjs/client/utils.cjs.map +1 -0
- package/lib/cjs/contract/Address.cjs +14 -8
- package/lib/cjs/contract/Address.cjs.map +1 -0
- package/lib/cjs/contract/AddressContract.cjs +15 -9
- package/lib/cjs/contract/AddressContract.cjs.map +1 -0
- package/lib/cjs/contract/AuditContract.cjs +15 -9
- package/lib/cjs/contract/AuditContract.cjs.map +1 -0
- package/lib/cjs/contract/BatchContract.cjs +15 -9
- package/lib/cjs/contract/BatchContract.cjs.map +1 -0
- package/lib/cjs/contract/MarketContract.cjs +15 -9
- package/lib/cjs/contract/MarketContract.cjs.map +1 -0
- package/lib/cjs/contract/OtherAuditContract.cjs +15 -9
- package/lib/cjs/contract/OtherAuditContract.cjs.map +1 -0
- package/lib/cjs/contract/OtherBatchContract.cjs +15 -9
- package/lib/cjs/contract/OtherBatchContract.cjs.map +1 -0
- package/lib/cjs/contract/OtherMarketContract.cjs +15 -9
- package/lib/cjs/contract/OtherMarketContract.cjs.map +1 -0
- package/lib/cjs/contract/OtherProductContract.cjs +15 -9
- package/lib/cjs/contract/OtherProductContract.cjs.map +1 -0
- package/lib/cjs/contract/OtherProductImageContract.cjs +15 -9
- package/lib/cjs/contract/OtherProductImageContract.cjs.map +1 -0
- package/lib/cjs/contract/OtherProductSharedContract.cjs +15 -9
- package/lib/cjs/contract/OtherProductSharedContract.cjs.map +1 -0
- package/lib/cjs/contract/OtherProductStrengthContract.cjs +15 -9
- package/lib/cjs/contract/OtherProductStrengthContract.cjs.map +1 -0
- package/lib/cjs/contract/Product.cjs +15 -9
- package/lib/cjs/contract/Product.cjs.map +1 -0
- package/lib/cjs/contract/ProductContract.cjs +15 -9
- package/lib/cjs/contract/ProductContract.cjs.map +1 -0
- package/lib/cjs/contract/ProductStrengthContract.cjs +15 -9
- package/lib/cjs/contract/ProductStrengthContract.cjs.map +1 -0
- package/lib/cjs/contract/SegregatedPrivateDocumentContract.cjs +15 -9
- package/lib/cjs/contract/SegregatedPrivateDocumentContract.cjs.map +1 -0
- package/lib/cjs/contract/SegregatedSharedDocumentContract.cjs +15 -9
- package/lib/cjs/contract/SegregatedSharedDocumentContract.cjs.map +1 -0
- package/lib/cjs/contract/User.cjs +13 -7
- package/lib/cjs/contract/User.cjs.map +1 -0
- package/lib/cjs/contract/UserContract.cjs +15 -9
- package/lib/cjs/contract/UserContract.cjs.map +1 -0
- package/lib/cjs/contract/index.cjs +31 -30
- package/lib/cjs/contract/index.cjs.map +1 -0
- package/lib/cjs/contract/logging-context.cjs +1 -0
- package/lib/cjs/contract/logging-context.cjs.map +1 -0
- package/lib/cjs/contract/models/Audit.cjs +17 -11
- package/lib/cjs/contract/models/Audit.cjs.map +1 -0
- package/lib/cjs/contract/models/BaseIdentifiedModel.cjs +15 -9
- package/lib/cjs/contract/models/BaseIdentifiedModel.cjs.map +1 -0
- package/lib/cjs/contract/models/BaseModel.cjs +13 -7
- package/lib/cjs/contract/models/BaseModel.cjs.map +1 -0
- package/lib/cjs/contract/models/Batch.cjs +24 -18
- package/lib/cjs/contract/models/Batch.cjs.map +1 -0
- package/lib/cjs/contract/models/GtinOwner.cjs +18 -12
- package/lib/cjs/contract/models/GtinOwner.cjs.map +1 -0
- package/lib/cjs/contract/models/History.cjs +15 -9
- package/lib/cjs/contract/models/History.cjs.map +1 -0
- package/lib/cjs/contract/models/Leaflet.cjs +25 -19
- package/lib/cjs/contract/models/Leaflet.cjs.map +1 -0
- package/lib/cjs/contract/models/LeafletFile.cjs +19 -13
- package/lib/cjs/contract/models/LeafletFile.cjs.map +1 -0
- package/lib/cjs/contract/models/Market.cjs +19 -13
- package/lib/cjs/contract/models/Market.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherAudit.cjs +20 -14
- package/lib/cjs/contract/models/OtherAudit.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherBatchShared.cjs +27 -21
- package/lib/cjs/contract/models/OtherBatchShared.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherLeaflet.cjs +27 -21
- package/lib/cjs/contract/models/OtherLeaflet.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherLeafletFile.cjs +18 -12
- package/lib/cjs/contract/models/OtherLeafletFile.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherMarket.cjs +21 -15
- package/lib/cjs/contract/models/OtherMarket.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherProduct.cjs +24 -18
- package/lib/cjs/contract/models/OtherProduct.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherProductImage.cjs +22 -16
- package/lib/cjs/contract/models/OtherProductImage.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherProductShared.cjs +32 -26
- package/lib/cjs/contract/models/OtherProductShared.cjs.map +1 -0
- package/lib/cjs/contract/models/OtherProductStrength.cjs +21 -15
- package/lib/cjs/contract/models/OtherProductStrength.cjs.map +1 -0
- package/lib/cjs/contract/models/Product.cjs +24 -18
- package/lib/cjs/contract/models/Product.cjs.map +1 -0
- package/lib/cjs/contract/models/ProductStrength.cjs +19 -13
- package/lib/cjs/contract/models/ProductStrength.cjs.map +1 -0
- package/lib/cjs/contract/models/SegregatedDocument.cjs +23 -17
- package/lib/cjs/contract/models/SegregatedDocument.cjs.map +1 -0
- package/lib/cjs/contract/models/constants.cjs +3 -4
- package/lib/cjs/contract/models/constants.cjs.map +1 -0
- package/lib/cjs/contract/models/decorators-private.cjs +11 -10
- package/lib/cjs/contract/models/decorators-private.cjs.map +1 -0
- package/lib/cjs/contract/models/decorators.cjs +13 -12
- package/lib/cjs/contract/models/decorators.cjs.map +1 -0
- package/lib/cjs/contract/models/gtin.cjs +13 -7
- package/lib/cjs/contract/models/gtin.cjs.map +1 -0
- package/lib/cjs/contract/models/history-dec.cjs +11 -10
- package/lib/cjs/contract/models/history-dec.cjs.map +1 -0
- package/lib/cjs/contracts/ContractAdapter.cjs +27 -26
- package/lib/cjs/contracts/ContractAdapter.cjs.map +1 -0
- package/lib/cjs/contracts/ContractContext.cjs +1 -0
- package/lib/cjs/contracts/ContractContext.cjs.map +1 -0
- package/lib/cjs/contracts/FabricContractDispatch.cjs +1 -0
- package/lib/cjs/contracts/FabricContractDispatch.cjs.map +1 -0
- package/lib/cjs/contracts/FabricContractPaginator.cjs +5 -4
- package/lib/cjs/contracts/FabricContractPaginator.cjs.map +1 -0
- package/lib/cjs/contracts/FabricContractRepository.cjs +8 -7
- package/lib/cjs/contracts/FabricContractRepository.cjs.map +1 -0
- package/lib/cjs/contracts/FabricContractRepositoryObservableHandler.cjs +3 -2
- package/lib/cjs/contracts/FabricContractRepositoryObservableHandler.cjs.map +1 -0
- package/lib/cjs/contracts/FabricContractSequence.cjs +1 -0
- package/lib/cjs/contracts/FabricContractSequence.cjs.map +1 -0
- package/lib/cjs/contracts/FabricContractStatement.cjs +5 -4
- package/lib/cjs/contracts/FabricContractStatement.cjs.map +1 -0
- package/lib/cjs/contracts/MigrationContract.cjs +20 -14
- package/lib/cjs/contracts/MigrationContract.cjs.map +1 -0
- package/lib/cjs/contracts/PrivateSequence.cjs +11 -5
- package/lib/cjs/contracts/PrivateSequence.cjs.map +1 -0
- package/lib/cjs/contracts/auth/decorators.cjs +3 -2
- package/lib/cjs/contracts/auth/decorators.cjs.map +1 -0
- package/lib/cjs/contracts/auth/index.cjs +1 -0
- package/lib/cjs/contracts/auth/index.cjs.map +1 -0
- package/lib/cjs/contracts/crud/crud-contract.cjs +12 -11
- package/lib/cjs/contracts/crud/crud-contract.cjs.map +1 -0
- package/lib/cjs/contracts/crud/index.cjs +1 -0
- package/lib/cjs/contracts/crud/index.cjs.map +1 -0
- package/lib/cjs/contracts/crud/serialized-crud-contract.cjs +13 -7
- package/lib/cjs/contracts/crud/serialized-crud-contract.cjs.map +1 -0
- package/lib/cjs/contracts/erc20/erc20contract.cjs +53 -47
- package/lib/cjs/contracts/erc20/erc20contract.cjs.map +1 -0
- package/lib/cjs/contracts/erc20/index.cjs +3 -2
- package/lib/cjs/contracts/erc20/index.cjs.map +1 -0
- package/lib/cjs/contracts/erc20/models.cjs +11 -5
- package/lib/cjs/contracts/erc20/models.cjs.map +1 -0
- package/lib/cjs/contracts/index.cjs +1 -0
- package/lib/cjs/contracts/index.cjs.map +1 -0
- package/lib/cjs/contracts/logging.cjs +4 -3
- package/lib/cjs/contracts/logging.cjs.map +1 -0
- package/lib/cjs/contracts/overrides.cjs +3 -2
- package/lib/cjs/contracts/overrides.cjs.map +1 -0
- package/lib/cjs/contracts/types.cjs +1 -0
- package/lib/cjs/contracts/types.cjs.map +1 -0
- package/lib/cjs/contracts/uuid.cjs +1 -0
- package/lib/cjs/contracts/uuid.cjs.map +1 -0
- package/lib/cjs/index.cjs +6 -5
- package/lib/cjs/index.cjs.map +1 -0
- package/lib/cjs/shared/ClientSerializer.cjs +1 -0
- package/lib/cjs/shared/ClientSerializer.cjs.map +1 -0
- package/lib/cjs/shared/DeterministicSerializer.cjs +1 -0
- package/lib/cjs/shared/DeterministicSerializer.cjs.map +1 -0
- package/lib/cjs/shared/SimpleDeterministicSerializer.cjs +3 -2
- package/lib/cjs/shared/SimpleDeterministicSerializer.cjs.map +1 -0
- package/lib/cjs/shared/constants.cjs +3 -18
- package/lib/cjs/shared/constants.cjs.map +1 -0
- package/lib/cjs/shared/decorators.cjs +14 -13
- package/lib/cjs/shared/decorators.cjs.map +1 -0
- package/lib/cjs/shared/erc20/erc20-constants.cjs +2 -9
- package/lib/cjs/shared/erc20/erc20-constants.cjs.map +1 -0
- package/lib/cjs/shared/erc20/index.cjs +1 -0
- package/lib/cjs/shared/erc20/index.cjs.map +1 -0
- package/lib/cjs/shared/errors.cjs +1 -0
- package/lib/cjs/shared/errors.cjs.map +1 -0
- package/lib/cjs/shared/events.cjs +1 -0
- package/lib/cjs/shared/events.cjs.map +1 -0
- package/lib/cjs/shared/fabric-types.cjs +1 -0
- package/lib/cjs/shared/fabric-types.cjs.map +1 -0
- package/lib/cjs/shared/index.cjs +1 -0
- package/lib/cjs/shared/index.cjs.map +1 -0
- package/lib/cjs/shared/interfaces/Checkable.cjs +1 -0
- package/lib/cjs/shared/interfaces/Checkable.cjs.map +1 -0
- package/lib/cjs/shared/interfaces/index.cjs +1 -0
- package/lib/cjs/shared/interfaces/index.cjs.map +1 -0
- package/lib/cjs/shared/math.cjs +4 -3
- package/lib/cjs/shared/math.cjs.map +1 -0
- package/lib/cjs/shared/model/FabricBaseModel.cjs +13 -7
- package/lib/cjs/shared/model/FabricBaseModel.cjs.map +1 -0
- package/lib/cjs/shared/model/FabricIdentifiedBaseModel.cjs +15 -9
- package/lib/cjs/shared/model/FabricIdentifiedBaseModel.cjs.map +1 -0
- package/lib/cjs/shared/model/Identity.cjs +16 -10
- package/lib/cjs/shared/model/Identity.cjs.map +1 -0
- package/lib/cjs/shared/model/IdentityCredentials.cjs +11 -5
- package/lib/cjs/shared/model/IdentityCredentials.cjs.map +1 -0
- package/lib/cjs/shared/model/index.cjs +1 -0
- package/lib/cjs/shared/model/index.cjs.map +1 -0
- package/lib/cjs/shared/overrides/Model.cjs +1 -0
- package/lib/cjs/shared/overrides/Model.cjs.map +1 -0
- package/lib/cjs/shared/overrides/index.cjs +1 -0
- package/lib/cjs/shared/overrides/index.cjs.map +1 -0
- package/lib/cjs/shared/overrides/overrides.cjs +11 -10
- package/lib/cjs/shared/overrides/overrides.cjs.map +1 -0
- package/lib/cjs/shared/types.cjs +1 -0
- package/lib/cjs/shared/types.cjs.map +1 -0
- package/lib/cjs/version.cjs +2 -1
- package/lib/cjs/version.cjs.map +1 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/bin/cli.d.cts +1 -0
- package/lib/types/bin/cli.d.mts +1 -0
- package/lib/types/cli-module.d.cts +3 -0
- package/lib/types/cli-module.d.mts +3 -0
- package/lib/types/cli-utils.d.cts +21 -0
- package/lib/types/cli-utils.d.mts +21 -0
- package/lib/types/client/FabricClientAdapter.d.cts +404 -0
- package/lib/types/client/FabricClientAdapter.d.mts +404 -0
- package/lib/types/client/FabricClientDispatch.d.cts +133 -0
- package/lib/types/client/FabricClientDispatch.d.mts +133 -0
- package/lib/types/client/FabricClientPaginator.d.cts +12 -0
- package/lib/types/client/FabricClientPaginator.d.mts +12 -0
- package/lib/types/client/FabricClientRepository.d.cts +71 -0
- package/lib/types/client/FabricClientRepository.d.mts +71 -0
- package/lib/types/client/FabricClientStatement.d.cts +64 -0
- package/lib/types/client/FabricClientStatement.d.mts +64 -0
- package/lib/types/client/collections/generation.d.cts +46 -0
- package/lib/types/client/collections/generation.d.mts +46 -0
- package/lib/types/client/collections/index.d.cts +1 -0
- package/lib/types/client/collections/index.d.mts +1 -0
- package/lib/types/client/constants.d.cts +2 -0
- package/lib/types/client/constants.d.mts +2 -0
- package/lib/types/client/crypto.d.cts +107 -0
- package/lib/types/client/crypto.d.mts +107 -0
- package/lib/types/client/erc20/FabricERC20ClientRepository.d.cts +254 -0
- package/lib/types/client/erc20/FabricERC20ClientRepository.d.mts +254 -0
- package/lib/types/client/erc20/index.d.cts +1 -0
- package/lib/types/client/erc20/index.d.mts +1 -0
- package/lib/types/client/fabric-fs.d.cts +92 -0
- package/lib/types/client/fabric-fs.d.mts +92 -0
- package/lib/types/client/fabric-hsm.d.cts +24 -0
- package/lib/types/client/fabric-hsm.d.mts +24 -0
- package/lib/types/client/ids/id-extraction.d.cts +4 -0
- package/lib/types/client/ids/id-extraction.d.mts +4 -0
- package/lib/types/client/ids/index.d.cts +1 -0
- package/lib/types/client/ids/index.d.mts +1 -0
- package/lib/types/client/index.d.cts +23 -0
- package/lib/types/client/index.d.mts +23 -0
- package/lib/types/client/indexes/generation.d.cts +10 -0
- package/lib/types/client/indexes/generation.d.mts +10 -0
- package/lib/types/client/indexes/index.d.cts +1 -0
- package/lib/types/client/indexes/index.d.mts +1 -0
- package/lib/types/client/logging.d.cts +60 -0
- package/lib/types/client/logging.d.mts +60 -0
- package/lib/types/client/services/FabricEnrollmentService.d.cts +176 -0
- package/lib/types/client/services/FabricEnrollmentService.d.mts +176 -0
- package/lib/types/client/services/FabricIdentityService.d.cts +98 -0
- package/lib/types/client/services/FabricIdentityService.d.mts +98 -0
- package/lib/types/client/services/RegistrationRequestBuilder.d.cts +19 -0
- package/lib/types/client/services/RegistrationRequestBuilder.d.mts +19 -0
- package/lib/types/client/services/constants.d.cts +15 -0
- package/lib/types/client/services/constants.d.mts +15 -0
- package/lib/types/client/services/index.d.cts +4 -0
- package/lib/types/client/services/index.d.mts +4 -0
- package/lib/types/client/types.d.cts +20 -0
- package/lib/types/client/types.d.mts +20 -0
- package/lib/types/client/utils.d.cts +71 -0
- package/lib/types/client/utils.d.mts +71 -0
- package/lib/types/contract/Address.d.cts +13 -0
- package/lib/types/contract/Address.d.mts +13 -0
- package/lib/types/contract/AddressContract.d.cts +5 -0
- package/lib/types/contract/AddressContract.d.mts +5 -0
- package/lib/types/contract/AuditContract.d.cts +5 -0
- package/lib/types/contract/AuditContract.d.mts +5 -0
- package/lib/types/contract/BatchContract.d.cts +5 -0
- package/lib/types/contract/BatchContract.d.mts +5 -0
- package/lib/types/contract/MarketContract.d.cts +5 -0
- package/lib/types/contract/MarketContract.d.mts +5 -0
- package/lib/types/contract/OtherAuditContract.d.cts +5 -0
- package/lib/types/contract/OtherAuditContract.d.mts +5 -0
- package/lib/types/contract/OtherBatchContract.d.cts +5 -0
- package/lib/types/contract/OtherBatchContract.d.mts +5 -0
- package/lib/types/contract/OtherMarketContract.d.cts +5 -0
- package/lib/types/contract/OtherMarketContract.d.mts +5 -0
- package/lib/types/contract/OtherProductContract.d.cts +5 -0
- package/lib/types/contract/OtherProductContract.d.mts +5 -0
- package/lib/types/contract/OtherProductImageContract.d.cts +5 -0
- package/lib/types/contract/OtherProductImageContract.d.mts +5 -0
- package/lib/types/contract/OtherProductSharedContract.d.cts +5 -0
- package/lib/types/contract/OtherProductSharedContract.d.mts +5 -0
- package/lib/types/contract/OtherProductStrengthContract.d.cts +5 -0
- package/lib/types/contract/OtherProductStrengthContract.d.mts +5 -0
- package/lib/types/contract/Product.d.cts +7 -0
- package/lib/types/contract/Product.d.mts +7 -0
- package/lib/types/contract/ProductContract.d.cts +5 -0
- package/lib/types/contract/ProductContract.d.mts +5 -0
- package/lib/types/contract/ProductStrengthContract.d.cts +5 -0
- package/lib/types/contract/ProductStrengthContract.d.mts +5 -0
- package/lib/types/contract/SegregatedPrivateDocumentContract.d.cts +5 -0
- package/lib/types/contract/SegregatedPrivateDocumentContract.d.mts +5 -0
- package/lib/types/contract/SegregatedSharedDocumentContract.d.cts +5 -0
- package/lib/types/contract/SegregatedSharedDocumentContract.d.mts +5 -0
- package/lib/types/contract/User.d.cts +7 -0
- package/lib/types/contract/User.d.mts +7 -0
- package/lib/types/contract/UserContract.d.cts +5 -0
- package/lib/types/contract/UserContract.d.mts +5 -0
- package/lib/types/contract/index.d.cts +2 -0
- package/lib/types/contract/index.d.mts +2 -0
- package/lib/types/contract/logging-context.d.cts +8 -0
- package/lib/types/contract/logging-context.d.mts +8 -0
- package/lib/types/contract/models/Audit.d.cts +13 -0
- package/lib/types/contract/models/Audit.d.mts +13 -0
- package/lib/types/contract/models/BaseIdentifiedModel.d.cts +7 -0
- package/lib/types/contract/models/BaseIdentifiedModel.d.mts +7 -0
- package/lib/types/contract/models/BaseModel.d.cts +7 -0
- package/lib/types/contract/models/BaseModel.d.mts +7 -0
- package/lib/types/contract/models/Batch.d.cts +18 -0
- package/lib/types/contract/models/Batch.d.mts +18 -0
- package/lib/types/contract/models/GtinOwner.d.cts +8 -0
- package/lib/types/contract/models/GtinOwner.d.mts +8 -0
- package/lib/types/contract/models/History.d.cts +9 -0
- package/lib/types/contract/models/History.d.mts +9 -0
- package/lib/types/contract/models/Leaflet.d.cts +12 -0
- package/lib/types/contract/models/Leaflet.d.mts +12 -0
- package/lib/types/contract/models/LeafletFile.d.cts +9 -0
- package/lib/types/contract/models/LeafletFile.d.mts +9 -0
- package/lib/types/contract/models/Market.d.cts +12 -0
- package/lib/types/contract/models/Market.d.mts +12 -0
- package/lib/types/contract/models/OtherAudit.d.cts +15 -0
- package/lib/types/contract/models/OtherAudit.d.mts +15 -0
- package/lib/types/contract/models/OtherBatchShared.d.cts +18 -0
- package/lib/types/contract/models/OtherBatchShared.d.mts +18 -0
- package/lib/types/contract/models/OtherLeaflet.d.cts +16 -0
- package/lib/types/contract/models/OtherLeaflet.d.mts +16 -0
- package/lib/types/contract/models/OtherLeafletFile.d.cts +10 -0
- package/lib/types/contract/models/OtherLeafletFile.d.mts +10 -0
- package/lib/types/contract/models/OtherMarket.d.cts +13 -0
- package/lib/types/contract/models/OtherMarket.d.mts +13 -0
- package/lib/types/contract/models/OtherProduct.d.cts +12 -0
- package/lib/types/contract/models/OtherProduct.d.mts +12 -0
- package/lib/types/contract/models/OtherProductImage.d.cts +9 -0
- package/lib/types/contract/models/OtherProductImage.d.mts +9 -0
- package/lib/types/contract/models/OtherProductShared.d.cts +18 -0
- package/lib/types/contract/models/OtherProductShared.d.mts +18 -0
- package/lib/types/contract/models/OtherProductStrength.d.cts +12 -0
- package/lib/types/contract/models/OtherProductStrength.d.mts +12 -0
- package/lib/types/contract/models/Product.d.cts +15 -0
- package/lib/types/contract/models/Product.d.mts +15 -0
- package/lib/types/contract/models/ProductStrength.d.cts +11 -0
- package/lib/types/contract/models/ProductStrength.d.mts +11 -0
- package/lib/types/contract/models/SegregatedDocument.d.cts +18 -0
- package/lib/types/contract/models/SegregatedDocument.d.mts +18 -0
- package/lib/types/contract/models/constants.d.cts +24 -0
- package/lib/types/contract/models/constants.d.mts +24 -0
- package/lib/types/contract/models/decorators-private.d.cts +16 -0
- package/lib/types/contract/models/decorators-private.d.mts +16 -0
- package/lib/types/contract/models/decorators.d.cts +28 -0
- package/lib/types/contract/models/decorators.d.mts +28 -0
- package/lib/types/contract/models/gtin.d.cts +8 -0
- package/lib/types/contract/models/gtin.d.mts +8 -0
- package/lib/types/contract/models/history-dec.d.cts +6 -0
- package/lib/types/contract/models/history-dec.d.mts +6 -0
- package/lib/types/contracts/ContractAdapter.d.cts +287 -0
- package/lib/types/contracts/ContractAdapter.d.mts +287 -0
- package/lib/types/contracts/ContractContext.d.cts +89 -0
- package/lib/types/contracts/ContractContext.d.mts +89 -0
- package/lib/types/contracts/FabricContractDispatch.d.cts +7 -0
- package/lib/types/contracts/FabricContractDispatch.d.mts +7 -0
- package/lib/types/contracts/FabricContractPaginator.d.cts +105 -0
- package/lib/types/contracts/FabricContractPaginator.d.mts +105 -0
- package/lib/types/contracts/FabricContractRepository.d.cts +119 -0
- package/lib/types/contracts/FabricContractRepository.d.mts +119 -0
- package/lib/types/contracts/FabricContractRepositoryObservableHandler.d.cts +62 -0
- package/lib/types/contracts/FabricContractRepositoryObservableHandler.d.mts +62 -0
- package/lib/types/contracts/FabricContractSequence.d.cts +87 -0
- package/lib/types/contracts/FabricContractSequence.d.mts +87 -0
- package/lib/types/contracts/FabricContractStatement.d.cts +36 -0
- package/lib/types/contracts/FabricContractStatement.d.mts +36 -0
- package/lib/types/contracts/MigrationContract.d.cts +22 -0
- package/lib/types/contracts/MigrationContract.d.mts +22 -0
- package/lib/types/contracts/PrivateSequence.d.cts +15 -0
- package/lib/types/contracts/PrivateSequence.d.mts +15 -0
- package/lib/types/contracts/auth/decorators.d.cts +6 -0
- package/lib/types/contracts/auth/decorators.d.mts +6 -0
- package/lib/types/contracts/auth/index.d.cts +1 -0
- package/lib/types/contracts/auth/index.d.mts +1 -0
- package/lib/types/contracts/crud/crud-contract.d.cts +199 -0
- package/lib/types/contracts/crud/crud-contract.d.mts +199 -0
- package/lib/types/contracts/crud/index.d.cts +2 -0
- package/lib/types/contracts/crud/index.d.mts +2 -0
- package/lib/types/contracts/crud/serialized-crud-contract.d.cts +42 -0
- package/lib/types/contracts/crud/serialized-crud-contract.d.mts +42 -0
- package/lib/types/contracts/erc20/erc20contract.d.cts +152 -0
- package/lib/types/contracts/erc20/erc20contract.d.mts +152 -0
- package/lib/types/contracts/erc20/index.d.cts +2 -0
- package/lib/types/contracts/erc20/index.d.mts +2 -0
- package/lib/types/contracts/erc20/models.d.cts +114 -0
- package/lib/types/contracts/erc20/models.d.mts +114 -0
- package/lib/types/contracts/index.d.cts +20 -0
- package/lib/types/contracts/index.d.mts +20 -0
- package/lib/types/contracts/logging.d.cts +54 -0
- package/lib/types/contracts/logging.d.mts +54 -0
- package/lib/types/contracts/overrides.d.cts +1 -0
- package/lib/types/contracts/overrides.d.mts +1 -0
- package/lib/types/contracts/types.d.cts +38 -0
- package/lib/types/contracts/types.d.mts +38 -0
- package/lib/types/contracts/uuid.d.cts +2 -0
- package/lib/types/contracts/uuid.d.mts +2 -0
- package/lib/types/index.d.cts +8 -0
- package/lib/types/index.d.mts +8 -0
- package/lib/types/shared/ClientSerializer.d.cts +52 -0
- package/lib/types/shared/ClientSerializer.d.mts +52 -0
- package/lib/types/shared/DeterministicSerializer.d.cts +47 -0
- package/lib/types/shared/DeterministicSerializer.d.mts +47 -0
- package/lib/types/shared/SimpleDeterministicSerializer.d.cts +7 -0
- package/lib/types/shared/SimpleDeterministicSerializer.d.mts +7 -0
- package/lib/types/shared/constants.d.cts +35 -0
- package/lib/types/shared/constants.d.mts +35 -0
- package/lib/types/shared/decorators.d.cts +81 -0
- package/lib/types/shared/decorators.d.mts +81 -0
- package/lib/types/shared/erc20/erc20-constants.d.cts +25 -0
- package/lib/types/shared/erc20/erc20-constants.d.mts +25 -0
- package/lib/types/shared/erc20/index.d.cts +1 -0
- package/lib/types/shared/erc20/index.d.mts +1 -0
- package/lib/types/shared/errors.d.cts +140 -0
- package/lib/types/shared/errors.d.mts +140 -0
- package/lib/types/shared/events.d.cts +37 -0
- package/lib/types/shared/events.d.mts +37 -0
- package/lib/types/shared/fabric-types.d.cts +32 -0
- package/lib/types/shared/fabric-types.d.mts +32 -0
- package/lib/types/shared/index.d.cts +21 -0
- package/lib/types/shared/index.d.mts +21 -0
- package/lib/types/shared/interfaces/Checkable.d.cts +23 -0
- package/lib/types/shared/interfaces/Checkable.d.mts +23 -0
- package/lib/types/shared/interfaces/index.d.cts +1 -0
- package/lib/types/shared/interfaces/index.d.mts +1 -0
- package/lib/types/shared/math.d.cts +34 -0
- package/lib/types/shared/math.d.mts +34 -0
- package/lib/types/shared/model/FabricBaseModel.d.cts +7 -0
- package/lib/types/shared/model/FabricBaseModel.d.mts +7 -0
- package/lib/types/shared/model/FabricIdentifiedBaseModel.d.cts +7 -0
- package/lib/types/shared/model/FabricIdentifiedBaseModel.d.mts +7 -0
- package/lib/types/shared/model/Identity.d.cts +42 -0
- package/lib/types/shared/model/Identity.d.mts +42 -0
- package/lib/types/shared/model/IdentityCredentials.d.cts +41 -0
- package/lib/types/shared/model/IdentityCredentials.d.mts +41 -0
- package/lib/types/shared/model/index.d.cts +4 -0
- package/lib/types/shared/model/index.d.mts +4 -0
- package/lib/types/shared/overrides/Model.d.cts +22 -0
- package/lib/types/shared/overrides/Model.d.mts +22 -0
- package/lib/types/shared/overrides/index.d.cts +2 -0
- package/lib/types/shared/overrides/index.d.mts +2 -0
- package/lib/types/shared/overrides/overrides.d.cts +1 -0
- package/lib/types/shared/overrides/overrides.d.mts +1 -0
- package/lib/types/shared/types.d.cts +125 -0
- package/lib/types/shared/types.d.mts +125 -0
- package/lib/types/version.d.cts +2 -0
- package/lib/types/version.d.mts +2 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +43 -23
- package/lib/cjs/bin/cli.js.map +0 -1
- package/lib/cjs/cli-module.js.map +0 -1
- package/lib/cjs/cli-utils.js.map +0 -1
- package/lib/cjs/client/FabricClientAdapter.js.map +0 -1
- package/lib/cjs/client/FabricClientDispatch.js.map +0 -1
- package/lib/cjs/client/FabricClientPaginator.js.map +0 -1
- package/lib/cjs/client/FabricClientRepository.js.map +0 -1
- package/lib/cjs/client/FabricClientStatement.js.map +0 -1
- package/lib/cjs/client/collections/generation.js.map +0 -1
- package/lib/cjs/client/collections/index.js.map +0 -1
- package/lib/cjs/client/constants.js.map +0 -1
- package/lib/cjs/client/crypto.js.map +0 -1
- package/lib/cjs/client/erc20/FabricERC20ClientRepository.js.map +0 -1
- package/lib/cjs/client/erc20/index.js.map +0 -1
- package/lib/cjs/client/fabric-fs.js.map +0 -1
- package/lib/cjs/client/fabric-hsm.js.map +0 -1
- package/lib/cjs/client/ids/id-extraction.js.map +0 -1
- package/lib/cjs/client/ids/index.js.map +0 -1
- package/lib/cjs/client/index.js.map +0 -1
- package/lib/cjs/client/indexes/generation.js.map +0 -1
- package/lib/cjs/client/indexes/index.js.map +0 -1
- package/lib/cjs/client/logging.js.map +0 -1
- package/lib/cjs/client/services/FabricEnrollmentService.js.map +0 -1
- package/lib/cjs/client/services/FabricIdentityService.js.map +0 -1
- package/lib/cjs/client/services/RegistrationRequestBuilder.js.map +0 -1
- package/lib/cjs/client/services/constants.js.map +0 -1
- package/lib/cjs/client/services/index.js.map +0 -1
- package/lib/cjs/client/types.js.map +0 -1
- package/lib/cjs/client/utils.js.map +0 -1
- package/lib/cjs/contract/Address.js.map +0 -1
- package/lib/cjs/contract/AddressContract.js.map +0 -1
- package/lib/cjs/contract/AuditContract.js.map +0 -1
- package/lib/cjs/contract/BatchContract.js.map +0 -1
- package/lib/cjs/contract/MarketContract.js.map +0 -1
- package/lib/cjs/contract/OtherAuditContract.js.map +0 -1
- package/lib/cjs/contract/OtherBatchContract.js.map +0 -1
- package/lib/cjs/contract/OtherMarketContract.js.map +0 -1
- package/lib/cjs/contract/OtherProductContract.js.map +0 -1
- package/lib/cjs/contract/OtherProductImageContract.js.map +0 -1
- package/lib/cjs/contract/OtherProductSharedContract.js.map +0 -1
- package/lib/cjs/contract/OtherProductStrengthContract.js.map +0 -1
- package/lib/cjs/contract/Product.js.map +0 -1
- package/lib/cjs/contract/ProductContract.js.map +0 -1
- package/lib/cjs/contract/ProductStrengthContract.js.map +0 -1
- package/lib/cjs/contract/SegregatedPrivateDocumentContract.js.map +0 -1
- package/lib/cjs/contract/SegregatedSharedDocumentContract.js.map +0 -1
- package/lib/cjs/contract/User.js.map +0 -1
- package/lib/cjs/contract/UserContract.js.map +0 -1
- package/lib/cjs/contract/index.js.map +0 -1
- package/lib/cjs/contract/logging-context.js.map +0 -1
- package/lib/cjs/contract/models/Audit.js.map +0 -1
- package/lib/cjs/contract/models/BaseIdentifiedModel.js.map +0 -1
- package/lib/cjs/contract/models/BaseModel.js.map +0 -1
- package/lib/cjs/contract/models/Batch.js.map +0 -1
- package/lib/cjs/contract/models/GtinOwner.js.map +0 -1
- package/lib/cjs/contract/models/History.js.map +0 -1
- package/lib/cjs/contract/models/Leaflet.js.map +0 -1
- package/lib/cjs/contract/models/LeafletFile.js.map +0 -1
- package/lib/cjs/contract/models/Market.js.map +0 -1
- package/lib/cjs/contract/models/OtherAudit.js.map +0 -1
- package/lib/cjs/contract/models/OtherBatchShared.js.map +0 -1
- package/lib/cjs/contract/models/OtherLeaflet.js.map +0 -1
- package/lib/cjs/contract/models/OtherLeafletFile.js.map +0 -1
- package/lib/cjs/contract/models/OtherMarket.js.map +0 -1
- package/lib/cjs/contract/models/OtherProduct.js.map +0 -1
- package/lib/cjs/contract/models/OtherProductImage.js.map +0 -1
- package/lib/cjs/contract/models/OtherProductShared.js.map +0 -1
- package/lib/cjs/contract/models/OtherProductStrength.js.map +0 -1
- package/lib/cjs/contract/models/Product.js.map +0 -1
- package/lib/cjs/contract/models/ProductStrength.js.map +0 -1
- package/lib/cjs/contract/models/SegregatedDocument.js.map +0 -1
- package/lib/cjs/contract/models/constants.js.map +0 -1
- package/lib/cjs/contract/models/decorators-private.js.map +0 -1
- package/lib/cjs/contract/models/decorators.js.map +0 -1
- package/lib/cjs/contract/models/gtin.js.map +0 -1
- package/lib/cjs/contract/models/history-dec.js.map +0 -1
- package/lib/cjs/contracts/ContractAdapter.js.map +0 -1
- package/lib/cjs/contracts/ContractContext.js.map +0 -1
- package/lib/cjs/contracts/FabricContractDispatch.js.map +0 -1
- package/lib/cjs/contracts/FabricContractPaginator.js.map +0 -1
- package/lib/cjs/contracts/FabricContractRepository.js.map +0 -1
- package/lib/cjs/contracts/FabricContractRepositoryObservableHandler.js.map +0 -1
- package/lib/cjs/contracts/FabricContractSequence.js.map +0 -1
- package/lib/cjs/contracts/FabricContractStatement.js.map +0 -1
- package/lib/cjs/contracts/MigrationContract.js.map +0 -1
- package/lib/cjs/contracts/PrivateSequence.js.map +0 -1
- package/lib/cjs/contracts/auth/decorators.js.map +0 -1
- package/lib/cjs/contracts/auth/index.js.map +0 -1
- package/lib/cjs/contracts/crud/crud-contract.js.map +0 -1
- package/lib/cjs/contracts/crud/index.js.map +0 -1
- package/lib/cjs/contracts/crud/serialized-crud-contract.js.map +0 -1
- package/lib/cjs/contracts/erc20/erc20contract.js.map +0 -1
- package/lib/cjs/contracts/erc20/index.js.map +0 -1
- package/lib/cjs/contracts/erc20/models.js.map +0 -1
- package/lib/cjs/contracts/index.js.map +0 -1
- package/lib/cjs/contracts/logging.js.map +0 -1
- package/lib/cjs/contracts/overrides.js.map +0 -1
- package/lib/cjs/contracts/types.js.map +0 -1
- package/lib/cjs/contracts/uuid.js.map +0 -1
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/shared/ClientSerializer.js.map +0 -1
- package/lib/cjs/shared/DeterministicSerializer.js.map +0 -1
- package/lib/cjs/shared/SimpleDeterministicSerializer.js.map +0 -1
- package/lib/cjs/shared/constants.js.map +0 -1
- package/lib/cjs/shared/decorators.js.map +0 -1
- package/lib/cjs/shared/erc20/erc20-constants.js.map +0 -1
- package/lib/cjs/shared/erc20/index.js.map +0 -1
- package/lib/cjs/shared/errors.js.map +0 -1
- package/lib/cjs/shared/events.js.map +0 -1
- package/lib/cjs/shared/fabric-types.js.map +0 -1
- package/lib/cjs/shared/index.js.map +0 -1
- package/lib/cjs/shared/interfaces/Checkable.js.map +0 -1
- package/lib/cjs/shared/interfaces/index.js.map +0 -1
- package/lib/cjs/shared/math.js.map +0 -1
- package/lib/cjs/shared/model/FabricBaseModel.js.map +0 -1
- package/lib/cjs/shared/model/FabricIdentifiedBaseModel.js.map +0 -1
- package/lib/cjs/shared/model/Identity.js.map +0 -1
- package/lib/cjs/shared/model/IdentityCredentials.js.map +0 -1
- package/lib/cjs/shared/model/index.js.map +0 -1
- package/lib/cjs/shared/overrides/Model.js.map +0 -1
- package/lib/cjs/shared/overrides/index.js.map +0 -1
- package/lib/cjs/shared/overrides/overrides.js.map +0 -1
- package/lib/cjs/shared/types.js.map +0 -1
- package/lib/cjs/version.js.map +0 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { JSONSerializer, Model } from "@decaf-ts/decorator-validation";
|
|
2
|
+
/**
|
|
3
|
+
* @description Client-side JSON serializer for Decaf models targeting Hyperledger Fabric
|
|
4
|
+
* @summary Extends the base JSONSerializer to embed model metadata (anchor) required to reconstruct instances on the client, and to safely serialize/deserialize Fabric-bound models.
|
|
5
|
+
* @template M extends Model - The Decaf model type handled by this serializer
|
|
6
|
+
* @param {void} [constructor] No public constructor arguments; provided for documentation completeness
|
|
7
|
+
* @return {void}
|
|
8
|
+
* @class ClientSerializer
|
|
9
|
+
* @example
|
|
10
|
+
* const serializer = new ClientSerializer<User>();
|
|
11
|
+
* const json = serializer.serialize(new User({ id: "1", name: "Alice" }));
|
|
12
|
+
* const user = serializer.deserialize(json);
|
|
13
|
+
* @mermaid
|
|
14
|
+
* sequenceDiagram
|
|
15
|
+
* participant App
|
|
16
|
+
* participant Serializer as ClientSerializer
|
|
17
|
+
* participant Model
|
|
18
|
+
* App->>Serializer: serialize(model)
|
|
19
|
+
* Serializer->>Serializer: preSerialize(model)
|
|
20
|
+
* Serializer-->>App: JSON string
|
|
21
|
+
* App->>Serializer: deserialize(json)
|
|
22
|
+
* Serializer->>Serializer: JSON.parse(json)
|
|
23
|
+
* Serializer->>Model: Model.build(parsed, anchor)
|
|
24
|
+
* Model-->>App: instance
|
|
25
|
+
*/
|
|
26
|
+
export declare class ClientSerializer<M extends Model> extends JSONSerializer<M> {
|
|
27
|
+
constructor();
|
|
28
|
+
/**
|
|
29
|
+
* @description Prepare a model for JSON serialization embedding class anchor
|
|
30
|
+
* @summary Clones the model and injects the class metadata anchor so it can be reconstructed during deserialization. Falls back to provided table name if metadata is not available.
|
|
31
|
+
* @template M - Model type handled by this serializer
|
|
32
|
+
* @param {M} model - The model instance to serialize
|
|
33
|
+
* @param {string} [modelName] - Optional table name to use when metadata cannot be derived
|
|
34
|
+
* @return {Record<string, any>} A plain object ready to be JSON.stringify'd
|
|
35
|
+
*/
|
|
36
|
+
protected preSerialize(model: M, modelName?: string): Record<string, any>;
|
|
37
|
+
/**
|
|
38
|
+
* @description Rebuilds a model from its JSON serialization
|
|
39
|
+
* @summary Parses the JSON string, retrieves the embedded model anchor, and uses Model.build to reconstruct the original instance
|
|
40
|
+
* @param {string} str - The JSON string previously produced by serialize
|
|
41
|
+
* @return {M} The reconstructed model instance
|
|
42
|
+
*/
|
|
43
|
+
deserialize(str: string): M;
|
|
44
|
+
/**
|
|
45
|
+
* @description Serializes a model to a JSON string
|
|
46
|
+
* @summary Prepares the model via preSerialize, embedding metadata needed for reconstruction, and returns a JSON string representation
|
|
47
|
+
* @param {M} model - The model instance to serialize
|
|
48
|
+
* @param {string} [table] - Optional table name to include as anchor when metadata is unavailable
|
|
49
|
+
* @return {string} A JSON string containing the serialized model with anchor metadata
|
|
50
|
+
*/
|
|
51
|
+
serialize(model: M, modelName?: string): string;
|
|
52
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { JSONSerializer, Model } from "@decaf-ts/decorator-validation";
|
|
2
|
+
/**
|
|
3
|
+
* @description Client-side JSON serializer for Decaf models targeting Hyperledger Fabric
|
|
4
|
+
* @summary Extends the base JSONSerializer to embed model metadata (anchor) required to reconstruct instances on the client, and to safely serialize/deserialize Fabric-bound models.
|
|
5
|
+
* @template M extends Model - The Decaf model type handled by this serializer
|
|
6
|
+
* @param {void} [constructor] No public constructor arguments; provided for documentation completeness
|
|
7
|
+
* @return {void}
|
|
8
|
+
* @class ClientSerializer
|
|
9
|
+
* @example
|
|
10
|
+
* const serializer = new ClientSerializer<User>();
|
|
11
|
+
* const json = serializer.serialize(new User({ id: "1", name: "Alice" }));
|
|
12
|
+
* const user = serializer.deserialize(json);
|
|
13
|
+
* @mermaid
|
|
14
|
+
* sequenceDiagram
|
|
15
|
+
* participant App
|
|
16
|
+
* participant Serializer as ClientSerializer
|
|
17
|
+
* participant Model
|
|
18
|
+
* App->>Serializer: serialize(model)
|
|
19
|
+
* Serializer->>Serializer: preSerialize(model)
|
|
20
|
+
* Serializer-->>App: JSON string
|
|
21
|
+
* App->>Serializer: deserialize(json)
|
|
22
|
+
* Serializer->>Serializer: JSON.parse(json)
|
|
23
|
+
* Serializer->>Model: Model.build(parsed, anchor)
|
|
24
|
+
* Model-->>App: instance
|
|
25
|
+
*/
|
|
26
|
+
export declare class ClientSerializer<M extends Model> extends JSONSerializer<M> {
|
|
27
|
+
constructor();
|
|
28
|
+
/**
|
|
29
|
+
* @description Prepare a model for JSON serialization embedding class anchor
|
|
30
|
+
* @summary Clones the model and injects the class metadata anchor so it can be reconstructed during deserialization. Falls back to provided table name if metadata is not available.
|
|
31
|
+
* @template M - Model type handled by this serializer
|
|
32
|
+
* @param {M} model - The model instance to serialize
|
|
33
|
+
* @param {string} [modelName] - Optional table name to use when metadata cannot be derived
|
|
34
|
+
* @return {Record<string, any>} A plain object ready to be JSON.stringify'd
|
|
35
|
+
*/
|
|
36
|
+
protected preSerialize(model: M, modelName?: string): Record<string, any>;
|
|
37
|
+
/**
|
|
38
|
+
* @description Rebuilds a model from its JSON serialization
|
|
39
|
+
* @summary Parses the JSON string, retrieves the embedded model anchor, and uses Model.build to reconstruct the original instance
|
|
40
|
+
* @param {string} str - The JSON string previously produced by serialize
|
|
41
|
+
* @return {M} The reconstructed model instance
|
|
42
|
+
*/
|
|
43
|
+
deserialize(str: string): M;
|
|
44
|
+
/**
|
|
45
|
+
* @description Serializes a model to a JSON string
|
|
46
|
+
* @summary Prepares the model via preSerialize, embedding metadata needed for reconstruction, and returns a JSON string representation
|
|
47
|
+
* @param {M} model - The model instance to serialize
|
|
48
|
+
* @param {string} [table] - Optional table name to include as anchor when metadata is unavailable
|
|
49
|
+
* @return {string} A JSON string containing the serialized model with anchor metadata
|
|
50
|
+
*/
|
|
51
|
+
serialize(model: M, modelName?: string): string;
|
|
52
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { JSONSerializer, Model } from "@decaf-ts/decorator-validation";
|
|
2
|
+
/**
|
|
3
|
+
* @description Recursively sorts object keys without reordering arrays
|
|
4
|
+
* @param {any} obj - The value to process
|
|
5
|
+
* @return {any} A copy with sorted object keys but preserved array order
|
|
6
|
+
*/
|
|
7
|
+
export declare function sortKeysOnlyRecursive(obj: any): any;
|
|
8
|
+
/**
|
|
9
|
+
* @description Deterministic JSON serializer for Fabric models
|
|
10
|
+
* @summary Ensures stable, deterministic JSON output by sorting object keys recursively before stringification, which is important for Fabric endorsement and hashing. Extends JSONSerializer to plug into existing Decaf model serialization flow.
|
|
11
|
+
* @template M - The Decaf Model subtype serialized by this instance
|
|
12
|
+
* @param {void} [constructor] No public constructor arguments
|
|
13
|
+
* @class DeterministicSerializer
|
|
14
|
+
* @example
|
|
15
|
+
* const serializer = new DeterministicSerializer<MyModel>();
|
|
16
|
+
* const json = serializer.serialize(model);
|
|
17
|
+
* const rebuilt = serializer.deserialize(json);
|
|
18
|
+
* @mermaid
|
|
19
|
+
* sequenceDiagram
|
|
20
|
+
* participant Caller
|
|
21
|
+
* participant DS as DeterministicSerializer
|
|
22
|
+
* Caller->>DS: serialize(model)
|
|
23
|
+
* DS->>DS: preSerialize(model)
|
|
24
|
+
* DS->>DS: sort-keys-recursive
|
|
25
|
+
* DS->>DS: json-stringify-deterministic
|
|
26
|
+
* DS-->>Caller: string
|
|
27
|
+
* Caller->>DS: deserialize(string)
|
|
28
|
+
* DS-->>Caller: model
|
|
29
|
+
*/
|
|
30
|
+
export declare class DeterministicSerializer<M extends Model> extends JSONSerializer<M> {
|
|
31
|
+
constructor();
|
|
32
|
+
protected preSerialize(model: M): Record<string, any>;
|
|
33
|
+
/**
|
|
34
|
+
* @summary Rebuilds a model from a serialization
|
|
35
|
+
* @param {string} str
|
|
36
|
+
*
|
|
37
|
+
* @throws {Error} If it fails to parse the string, or to build the model
|
|
38
|
+
*/
|
|
39
|
+
deserialize(str: string): M;
|
|
40
|
+
/**
|
|
41
|
+
* @description Serialize a model into a deterministic JSON string
|
|
42
|
+
* @summary Prepares the model with preSerialize, sorts keys recursively, and stringifies deterministically for stable ordering
|
|
43
|
+
* @param {M} model - The model instance to serialize
|
|
44
|
+
* @return {string} Deterministic JSON representation of the model
|
|
45
|
+
*/
|
|
46
|
+
serialize(model: M): string;
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { JSONSerializer, Model } from "@decaf-ts/decorator-validation";
|
|
2
|
+
/**
|
|
3
|
+
* @description Recursively sorts object keys without reordering arrays
|
|
4
|
+
* @param {any} obj - The value to process
|
|
5
|
+
* @return {any} A copy with sorted object keys but preserved array order
|
|
6
|
+
*/
|
|
7
|
+
export declare function sortKeysOnlyRecursive(obj: any): any;
|
|
8
|
+
/**
|
|
9
|
+
* @description Deterministic JSON serializer for Fabric models
|
|
10
|
+
* @summary Ensures stable, deterministic JSON output by sorting object keys recursively before stringification, which is important for Fabric endorsement and hashing. Extends JSONSerializer to plug into existing Decaf model serialization flow.
|
|
11
|
+
* @template M - The Decaf Model subtype serialized by this instance
|
|
12
|
+
* @param {void} [constructor] No public constructor arguments
|
|
13
|
+
* @class DeterministicSerializer
|
|
14
|
+
* @example
|
|
15
|
+
* const serializer = new DeterministicSerializer<MyModel>();
|
|
16
|
+
* const json = serializer.serialize(model);
|
|
17
|
+
* const rebuilt = serializer.deserialize(json);
|
|
18
|
+
* @mermaid
|
|
19
|
+
* sequenceDiagram
|
|
20
|
+
* participant Caller
|
|
21
|
+
* participant DS as DeterministicSerializer
|
|
22
|
+
* Caller->>DS: serialize(model)
|
|
23
|
+
* DS->>DS: preSerialize(model)
|
|
24
|
+
* DS->>DS: sort-keys-recursive
|
|
25
|
+
* DS->>DS: json-stringify-deterministic
|
|
26
|
+
* DS-->>Caller: string
|
|
27
|
+
* Caller->>DS: deserialize(string)
|
|
28
|
+
* DS-->>Caller: model
|
|
29
|
+
*/
|
|
30
|
+
export declare class DeterministicSerializer<M extends Model> extends JSONSerializer<M> {
|
|
31
|
+
constructor();
|
|
32
|
+
protected preSerialize(model: M): Record<string, any>;
|
|
33
|
+
/**
|
|
34
|
+
* @summary Rebuilds a model from a serialization
|
|
35
|
+
* @param {string} str
|
|
36
|
+
*
|
|
37
|
+
* @throws {Error} If it fails to parse the string, or to build the model
|
|
38
|
+
*/
|
|
39
|
+
deserialize(str: string): M;
|
|
40
|
+
/**
|
|
41
|
+
* @description Serialize a model into a deterministic JSON string
|
|
42
|
+
* @summary Prepares the model with preSerialize, sorts keys recursively, and stringifies deterministically for stable ordering
|
|
43
|
+
* @param {M} model - The model instance to serialize
|
|
44
|
+
* @return {string} Deterministic JSON representation of the model
|
|
45
|
+
*/
|
|
46
|
+
serialize(model: M): string;
|
|
47
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { JSONSerializer, Model } from "@decaf-ts/decorator-validation";
|
|
2
|
+
export declare class SimpleDeterministicSerializer<M extends Model> extends JSONSerializer<M> {
|
|
3
|
+
constructor();
|
|
4
|
+
deserialize(str: string, tableName?: string): M;
|
|
5
|
+
serialize(model: M, putAnchor?: boolean): string;
|
|
6
|
+
protected preSerialize(model: M, putAnchor?: boolean): Record<string, any>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { JSONSerializer, Model } from "@decaf-ts/decorator-validation";
|
|
2
|
+
export declare class SimpleDeterministicSerializer<M extends Model> extends JSONSerializer<M> {
|
|
3
|
+
constructor();
|
|
4
|
+
deserialize(str: string, tableName?: string): M;
|
|
5
|
+
serialize(model: M, putAnchor?: boolean): string;
|
|
6
|
+
protected preSerialize(model: M, putAnchor?: boolean): Record<string, any>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Keys used to mark Fabric-specific model metadata
|
|
3
|
+
* @summary Enumeration of special keys used by the serialization layer to persist Fabric-related flags on models
|
|
4
|
+
* @enum {string}
|
|
5
|
+
* @readonly
|
|
6
|
+
* @memberOf module:for-fabric.shared
|
|
7
|
+
*/
|
|
8
|
+
export declare enum FabricModelKeys {
|
|
9
|
+
/** Private data marker used to tag properties or models for Fabric private collections */
|
|
10
|
+
PRIVATE = "private",
|
|
11
|
+
SHARED = "shared",
|
|
12
|
+
/** Namespace prefix used for Fabric-specific metadata keys */
|
|
13
|
+
FABRIC = "fabric",
|
|
14
|
+
OWNED_BY = "owned-by",
|
|
15
|
+
TRANSACTION_ID = "transaction-id",
|
|
16
|
+
MIRROR = "mirror"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @description Supported identity types for Fabric credentials
|
|
20
|
+
* @summary Enumeration of identity formats recognized by this library
|
|
21
|
+
* @enum {string}
|
|
22
|
+
* @readonly
|
|
23
|
+
* @memberOf module:for-fabric.shared
|
|
24
|
+
*/
|
|
25
|
+
export declare enum IdentityType {
|
|
26
|
+
/** Standard X.509 identity format used by Hyperledger Fabric */
|
|
27
|
+
X509 = "X.509"
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @description String identifier for the Fabric adapter flavour
|
|
31
|
+
* @summary Used to tag adapters/repositories that operate against Hyperledger Fabric
|
|
32
|
+
* @const FabricFlavour
|
|
33
|
+
* @memberOf module:for-fabric.shared
|
|
34
|
+
*/
|
|
35
|
+
export declare const FabricFlavour = "hlf-fabric";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Keys used to mark Fabric-specific model metadata
|
|
3
|
+
* @summary Enumeration of special keys used by the serialization layer to persist Fabric-related flags on models
|
|
4
|
+
* @enum {string}
|
|
5
|
+
* @readonly
|
|
6
|
+
* @memberOf module:for-fabric.shared
|
|
7
|
+
*/
|
|
8
|
+
export declare enum FabricModelKeys {
|
|
9
|
+
/** Private data marker used to tag properties or models for Fabric private collections */
|
|
10
|
+
PRIVATE = "private",
|
|
11
|
+
SHARED = "shared",
|
|
12
|
+
/** Namespace prefix used for Fabric-specific metadata keys */
|
|
13
|
+
FABRIC = "fabric",
|
|
14
|
+
OWNED_BY = "owned-by",
|
|
15
|
+
TRANSACTION_ID = "transaction-id",
|
|
16
|
+
MIRROR = "mirror"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @description Supported identity types for Fabric credentials
|
|
20
|
+
* @summary Enumeration of identity formats recognized by this library
|
|
21
|
+
* @enum {string}
|
|
22
|
+
* @readonly
|
|
23
|
+
* @memberOf module:for-fabric.shared
|
|
24
|
+
*/
|
|
25
|
+
export declare enum IdentityType {
|
|
26
|
+
/** Standard X.509 identity format used by Hyperledger Fabric */
|
|
27
|
+
X509 = "X.509"
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @description String identifier for the Fabric adapter flavour
|
|
31
|
+
* @summary Used to tag adapters/repositories that operate against Hyperledger Fabric
|
|
32
|
+
* @const FabricFlavour
|
|
33
|
+
* @memberOf module:for-fabric.shared
|
|
34
|
+
*/
|
|
35
|
+
export declare const FabricFlavour = "hlf-fabric";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Repo, Context, Repository, ContextOf } from "@decaf-ts/core";
|
|
2
|
+
import { Model } from "@decaf-ts/decorator-validation";
|
|
3
|
+
import { ClientIdentity } from "fabric-shim-api";
|
|
4
|
+
import { Constructor } from "@decaf-ts/decoration";
|
|
5
|
+
import { FabricFlags } from "./types.cjs";
|
|
6
|
+
import { FabricContractFlags } from "../contracts/types.cjs";
|
|
7
|
+
import "../shared/overrides";
|
|
8
|
+
import { type FabricContractContext } from "../contracts/ContractContext.cjs";
|
|
9
|
+
/**
|
|
10
|
+
* @description Extracts the MSP ID from either a string or ClientIdentity object
|
|
11
|
+
* @param identity - The identity value which can be a string MSP ID or ClientIdentity object
|
|
12
|
+
* @returns The MSP ID as a string, or undefined if not available
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractMspId(identity: string | ClientIdentity | undefined): string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Decorator for marking methods that require ownership authorization.
|
|
17
|
+
* Checks the owner of the token before allowing the method to be executed.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* class TokenContract extends Contract {
|
|
22
|
+
* @Owner()
|
|
23
|
+
* async Mint(ctx: Context, amount: number) {
|
|
24
|
+
* // Mint token logic
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @returns {MethodDecorator} A method decorator that checks ownership authorization.
|
|
30
|
+
*/
|
|
31
|
+
export declare function Owner(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
32
|
+
export declare function ownedByOnCreate<M extends Model<boolean>, R extends Repo<M>, V>(this: R, context: ContextOf<R>, data: V, key: keyof M, model: M): Promise<void>;
|
|
33
|
+
export declare function ownedBy(): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
34
|
+
export declare function transactionIdOnCreate<M extends Model<boolean>, R extends Repo<M>, V>(this: R, context: ContextOf<R>, data: V, key: keyof M, model: M): Promise<void>;
|
|
35
|
+
export declare function transactionId(): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
36
|
+
export type MirrorCondition = (msp: string) => boolean;
|
|
37
|
+
export type MirrorMetadata = {
|
|
38
|
+
condition?: MirrorCondition;
|
|
39
|
+
resolver: CollectionResolver | string;
|
|
40
|
+
mspId: string;
|
|
41
|
+
};
|
|
42
|
+
export declare function evalMirrorMetadata<M extends Model>(model: M, resolver: undefined | string | CollectionResolver, ctx: Context<FabricContractFlags>): Promise<string>;
|
|
43
|
+
export declare function createMirrorHandler<M extends Model, R extends Repository<M, any>>(this: R, context: Context<FabricContractFlags>, data: MirrorMetadata, key: keyof M, model: M): Promise<void>;
|
|
44
|
+
export declare function updateMirrorHandler<M extends Model, R extends Repository<M, any>>(this: R, context: Context<FabricContractFlags>, data: MirrorMetadata, key: keyof M, model: M): Promise<void>;
|
|
45
|
+
export declare function deleteMirrorHandler<M extends Model, R extends Repository<M, any>>(this: R, context: Context<FabricContractFlags>, data: MirrorMetadata, key: keyof M, model: M): Promise<void>;
|
|
46
|
+
export declare function mirrorWriteGuard<M extends Model, R extends Repository<M, any>>(this: R, context: Context<FabricContractFlags>, data: MirrorMetadata, key: keyof M, model: M): Promise<void>;
|
|
47
|
+
export declare function readMirrorHandler<M extends Model, R extends Repository<M, any>>(this: R, context: Context<FabricContractFlags>, data: MirrorMetadata, key: keyof M, model: M): Promise<void>;
|
|
48
|
+
export declare function mirror(collection: CollectionResolver | string, mspIdOrCondition?: string | MirrorCondition, condition?: MirrorCondition): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
49
|
+
export type CollectionResolver = <M extends Model>(model: M | Constructor<M>, msp?: string, ...args: any[]) => string;
|
|
50
|
+
export declare const ModelCollection: CollectionResolver;
|
|
51
|
+
export declare function NamespaceCollection(namespace: string): CollectionResolver;
|
|
52
|
+
export declare const ImplicitPrivateCollection: CollectionResolver;
|
|
53
|
+
export type SegregatedDataMetadata = {
|
|
54
|
+
collections: string | CollectionResolver;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* @description Priority for early collection extraction (before pk generation at priority 60)
|
|
58
|
+
* @summary This priority ensures collections are registered in context before any sequence
|
|
59
|
+
* operations occur, allowing sequences to be replicated to private/shared collections.
|
|
60
|
+
*/
|
|
61
|
+
export declare const SEGREGATED_COLLECTION_EXTRACTION_PRIORITY = 35;
|
|
62
|
+
export declare function applySegregationFlags<M extends Model>(clazz: M, collections: string[], ctx: any): void;
|
|
63
|
+
export declare function applyMirrorFlags<M extends Model>(clazz: Constructor<M>, msp: string | undefined, ctx: FabricContractContext): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* @description Early handler to extract and register collections in context
|
|
66
|
+
* @summary Runs with priority < 40 to extract collection names before pk generation (priority 60).
|
|
67
|
+
* This allows FabricContractSequence to know which collections to replicate to.
|
|
68
|
+
* @template M - Type that extends Model
|
|
69
|
+
* @param {ContextOf<Repository<M, any>>} context - The execution context
|
|
70
|
+
* @param {SegregatedDataMetadata | SegregatedDataMetadata[]} data - The segregated data metadata
|
|
71
|
+
* @param {string | string[]} keys - The property key(s) being segregated
|
|
72
|
+
* @param {M} model - The model instance
|
|
73
|
+
* @return {Promise<void>}
|
|
74
|
+
*/
|
|
75
|
+
export declare function extractSegregatedCollections<M extends Model>(this: Repository<M, any>, context: ContextOf<typeof this>, data: SegregatedDataMetadata | SegregatedDataMetadata[], keys: keyof M | (keyof M)[], model: M): Promise<void>;
|
|
76
|
+
export declare function segregatedDataOnCreate<M extends Model>(this: Repository<M, any>, context: ContextOf<typeof this>, data: SegregatedDataMetadata | SegregatedDataMetadata[], keys: keyof M | (keyof M)[], model: M): Promise<void>;
|
|
77
|
+
export declare function segregatedDataOnRead<M extends Model>(this: Repository<M, any>, context: Context<FabricFlags>, data: SegregatedDataMetadata | SegregatedDataMetadata[], keys: keyof M | (keyof M)[], model: M): Promise<void>;
|
|
78
|
+
export declare function segregatedDataOnUpdate<M extends Model>(this: Repository<M, any>, context: ContextOf<typeof this>, data: SegregatedDataMetadata | SegregatedDataMetadata[], key: keyof M | (keyof M)[], model: M, oldModel: M): Promise<void>;
|
|
79
|
+
export declare function segregatedDataOnDelete<M extends Model, R extends Repository<M, any>, V extends SegregatedDataMetadata>(this: R, context: ContextOf<R>, data: V | V[], key: (keyof M)[], model: M): Promise<void>;
|
|
80
|
+
export declare function privateData(collection?: string | CollectionResolver): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
81
|
+
export declare function sharedData(collection: string | CollectionResolver): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Repo, Context, Repository, ContextOf } from "@decaf-ts/core";
|
|
2
|
+
import { Model } from "@decaf-ts/decorator-validation";
|
|
3
|
+
import { ClientIdentity } from "fabric-shim-api";
|
|
4
|
+
import { Constructor } from "@decaf-ts/decoration";
|
|
5
|
+
import { FabricFlags } from "./types.js";
|
|
6
|
+
import { FabricContractFlags } from "../contracts/types.js";
|
|
7
|
+
import "../shared/overrides";
|
|
8
|
+
import { type FabricContractContext } from "../contracts/ContractContext.js";
|
|
9
|
+
/**
|
|
10
|
+
* @description Extracts the MSP ID from either a string or ClientIdentity object
|
|
11
|
+
* @param identity - The identity value which can be a string MSP ID or ClientIdentity object
|
|
12
|
+
* @returns The MSP ID as a string, or undefined if not available
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractMspId(identity: string | ClientIdentity | undefined): string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Decorator for marking methods that require ownership authorization.
|
|
17
|
+
* Checks the owner of the token before allowing the method to be executed.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* class TokenContract extends Contract {
|
|
22
|
+
* @Owner()
|
|
23
|
+
* async Mint(ctx: Context, amount: number) {
|
|
24
|
+
* // Mint token logic
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @returns {MethodDecorator} A method decorator that checks ownership authorization.
|
|
30
|
+
*/
|
|
31
|
+
export declare function Owner(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
32
|
+
export declare function ownedByOnCreate<M extends Model<boolean>, R extends Repo<M>, V>(this: R, context: ContextOf<R>, data: V, key: keyof M, model: M): Promise<void>;
|
|
33
|
+
export declare function ownedBy(): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
34
|
+
export declare function transactionIdOnCreate<M extends Model<boolean>, R extends Repo<M>, V>(this: R, context: ContextOf<R>, data: V, key: keyof M, model: M): Promise<void>;
|
|
35
|
+
export declare function transactionId(): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
36
|
+
export type MirrorCondition = (msp: string) => boolean;
|
|
37
|
+
export type MirrorMetadata = {
|
|
38
|
+
condition?: MirrorCondition;
|
|
39
|
+
resolver: CollectionResolver | string;
|
|
40
|
+
mspId: string;
|
|
41
|
+
};
|
|
42
|
+
export declare function evalMirrorMetadata<M extends Model>(model: M, resolver: undefined | string | CollectionResolver, ctx: Context<FabricContractFlags>): Promise<string>;
|
|
43
|
+
export declare function createMirrorHandler<M extends Model, R extends Repository<M, any>>(this: R, context: Context<FabricContractFlags>, data: MirrorMetadata, key: keyof M, model: M): Promise<void>;
|
|
44
|
+
export declare function updateMirrorHandler<M extends Model, R extends Repository<M, any>>(this: R, context: Context<FabricContractFlags>, data: MirrorMetadata, key: keyof M, model: M): Promise<void>;
|
|
45
|
+
export declare function deleteMirrorHandler<M extends Model, R extends Repository<M, any>>(this: R, context: Context<FabricContractFlags>, data: MirrorMetadata, key: keyof M, model: M): Promise<void>;
|
|
46
|
+
export declare function mirrorWriteGuard<M extends Model, R extends Repository<M, any>>(this: R, context: Context<FabricContractFlags>, data: MirrorMetadata, key: keyof M, model: M): Promise<void>;
|
|
47
|
+
export declare function readMirrorHandler<M extends Model, R extends Repository<M, any>>(this: R, context: Context<FabricContractFlags>, data: MirrorMetadata, key: keyof M, model: M): Promise<void>;
|
|
48
|
+
export declare function mirror(collection: CollectionResolver | string, mspIdOrCondition?: string | MirrorCondition, condition?: MirrorCondition): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
49
|
+
export type CollectionResolver = <M extends Model>(model: M | Constructor<M>, msp?: string, ...args: any[]) => string;
|
|
50
|
+
export declare const ModelCollection: CollectionResolver;
|
|
51
|
+
export declare function NamespaceCollection(namespace: string): CollectionResolver;
|
|
52
|
+
export declare const ImplicitPrivateCollection: CollectionResolver;
|
|
53
|
+
export type SegregatedDataMetadata = {
|
|
54
|
+
collections: string | CollectionResolver;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* @description Priority for early collection extraction (before pk generation at priority 60)
|
|
58
|
+
* @summary This priority ensures collections are registered in context before any sequence
|
|
59
|
+
* operations occur, allowing sequences to be replicated to private/shared collections.
|
|
60
|
+
*/
|
|
61
|
+
export declare const SEGREGATED_COLLECTION_EXTRACTION_PRIORITY = 35;
|
|
62
|
+
export declare function applySegregationFlags<M extends Model>(clazz: M, collections: string[], ctx: any): void;
|
|
63
|
+
export declare function applyMirrorFlags<M extends Model>(clazz: Constructor<M>, msp: string | undefined, ctx: FabricContractContext): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* @description Early handler to extract and register collections in context
|
|
66
|
+
* @summary Runs with priority < 40 to extract collection names before pk generation (priority 60).
|
|
67
|
+
* This allows FabricContractSequence to know which collections to replicate to.
|
|
68
|
+
* @template M - Type that extends Model
|
|
69
|
+
* @param {ContextOf<Repository<M, any>>} context - The execution context
|
|
70
|
+
* @param {SegregatedDataMetadata | SegregatedDataMetadata[]} data - The segregated data metadata
|
|
71
|
+
* @param {string | string[]} keys - The property key(s) being segregated
|
|
72
|
+
* @param {M} model - The model instance
|
|
73
|
+
* @return {Promise<void>}
|
|
74
|
+
*/
|
|
75
|
+
export declare function extractSegregatedCollections<M extends Model>(this: Repository<M, any>, context: ContextOf<typeof this>, data: SegregatedDataMetadata | SegregatedDataMetadata[], keys: keyof M | (keyof M)[], model: M): Promise<void>;
|
|
76
|
+
export declare function segregatedDataOnCreate<M extends Model>(this: Repository<M, any>, context: ContextOf<typeof this>, data: SegregatedDataMetadata | SegregatedDataMetadata[], keys: keyof M | (keyof M)[], model: M): Promise<void>;
|
|
77
|
+
export declare function segregatedDataOnRead<M extends Model>(this: Repository<M, any>, context: Context<FabricFlags>, data: SegregatedDataMetadata | SegregatedDataMetadata[], keys: keyof M | (keyof M)[], model: M): Promise<void>;
|
|
78
|
+
export declare function segregatedDataOnUpdate<M extends Model>(this: Repository<M, any>, context: ContextOf<typeof this>, data: SegregatedDataMetadata | SegregatedDataMetadata[], key: keyof M | (keyof M)[], model: M, oldModel: M): Promise<void>;
|
|
79
|
+
export declare function segregatedDataOnDelete<M extends Model, R extends Repository<M, any>, V extends SegregatedDataMetadata>(this: R, context: ContextOf<R>, data: V | V[], key: (keyof M)[], model: M): Promise<void>;
|
|
80
|
+
export declare function privateData(collection?: string | CollectionResolver): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
81
|
+
export declare function sharedData(collection: string | CollectionResolver): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing the events emitted by an ERC20 contract.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This enum is used to identify the specific events that can be emitted by an ERC20 contract.
|
|
6
|
+
* The events are named according to the EIP-20 standard.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum ERC20Events {
|
|
9
|
+
/**
|
|
10
|
+
* Emitted when a `transfer` function is called successfully.
|
|
11
|
+
*
|
|
12
|
+
* @param from - The address of the sender.
|
|
13
|
+
* @param to - The address of the recipient.
|
|
14
|
+
* @param value - The amount of tokens transferred.
|
|
15
|
+
*/
|
|
16
|
+
TRANSFER = "Transfer",
|
|
17
|
+
/**
|
|
18
|
+
* Emitted when an `approve` function is called successfully.
|
|
19
|
+
*
|
|
20
|
+
* @param owner - The address of the token owner.
|
|
21
|
+
* @param spender - The address of the approved spender.
|
|
22
|
+
* @param value - The amount of tokens approved for the spender.
|
|
23
|
+
*/
|
|
24
|
+
APPROVAL = "Approval"
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing the events emitted by an ERC20 contract.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This enum is used to identify the specific events that can be emitted by an ERC20 contract.
|
|
6
|
+
* The events are named according to the EIP-20 standard.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum ERC20Events {
|
|
9
|
+
/**
|
|
10
|
+
* Emitted when a `transfer` function is called successfully.
|
|
11
|
+
*
|
|
12
|
+
* @param from - The address of the sender.
|
|
13
|
+
* @param to - The address of the recipient.
|
|
14
|
+
* @param value - The amount of tokens transferred.
|
|
15
|
+
*/
|
|
16
|
+
TRANSFER = "Transfer",
|
|
17
|
+
/**
|
|
18
|
+
* Emitted when an `approve` function is called successfully.
|
|
19
|
+
*
|
|
20
|
+
* @param owner - The address of the token owner.
|
|
21
|
+
* @param spender - The address of the approved spender.
|
|
22
|
+
* @param value - The amount of tokens approved for the spender.
|
|
23
|
+
*/
|
|
24
|
+
APPROVAL = "Approval"
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./erc20-constants.cjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./erc20-constants.js";
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { BaseError, InternalError } from "@decaf-ts/db-decorators";
|
|
2
|
+
import { AuthorizationError } from "@decaf-ts/core";
|
|
3
|
+
/**
|
|
4
|
+
* @summary Represents an overflow error in arithmetic operations in Smart Contracts
|
|
5
|
+
*
|
|
6
|
+
* @param {string} msg the error message
|
|
7
|
+
*
|
|
8
|
+
* @class OverflowError
|
|
9
|
+
* @extends InternalError
|
|
10
|
+
*
|
|
11
|
+
* @category Errors
|
|
12
|
+
*/
|
|
13
|
+
export declare class OverflowError extends InternalError {
|
|
14
|
+
constructor(msg: string | Error);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @summary Represents a failure in balance to perform a transaction in Smart Contracts
|
|
18
|
+
*
|
|
19
|
+
* @param {string} msg the error message
|
|
20
|
+
*
|
|
21
|
+
* @class BalanceError
|
|
22
|
+
* @extends InternalError
|
|
23
|
+
*
|
|
24
|
+
* @category Errors
|
|
25
|
+
*/
|
|
26
|
+
export declare class BalanceError extends InternalError {
|
|
27
|
+
constructor(msg: string | Error);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @summary Represents a failure in balance to perform a transaction in Smart Contracts
|
|
31
|
+
*
|
|
32
|
+
* @param {string} msg the error message
|
|
33
|
+
*
|
|
34
|
+
* @class BalanceError
|
|
35
|
+
* @extends InternalError
|
|
36
|
+
*
|
|
37
|
+
* @category Errors
|
|
38
|
+
*/
|
|
39
|
+
export declare class AllowanceError extends InternalError {
|
|
40
|
+
constructor(msg: string | Error);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @summary Represents a failure registrating new entities
|
|
44
|
+
*
|
|
45
|
+
* @param {string} msg the error message
|
|
46
|
+
*
|
|
47
|
+
* @class RegistrationError
|
|
48
|
+
*
|
|
49
|
+
* @categort Errors
|
|
50
|
+
*/
|
|
51
|
+
export declare class RegistrationError extends AuthorizationError {
|
|
52
|
+
constructor(msg: string | Error);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @description Error thrown when an unsupported operation is attempted
|
|
56
|
+
* @summary This error is thrown when an operation is requested that is not supported by the current
|
|
57
|
+
* persistence adapter or configuration. It extends the BaseError class and sets a 500 status code.
|
|
58
|
+
* @param {string|Error} msg - The error message or an Error object to wrap
|
|
59
|
+
* @class UnsupportedError
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* // Throwing an UnsupportedError
|
|
63
|
+
* if (!adapter.supportsTransactions()) {
|
|
64
|
+
* throw new UnsupportedError('Transactions are not supported by this adapter');
|
|
65
|
+
* }
|
|
66
|
+
*
|
|
67
|
+
* // Catching an UnsupportedError
|
|
68
|
+
* try {
|
|
69
|
+
* await adapter.beginTransaction();
|
|
70
|
+
* } catch (error) {
|
|
71
|
+
* if (error instanceof UnsupportedError) {
|
|
72
|
+
* console.error('Operation not supported:', error.message);
|
|
73
|
+
* }
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @category Errors
|
|
78
|
+
*/
|
|
79
|
+
export declare class MissingContextError extends InternalError {
|
|
80
|
+
constructor(msg: string | Error);
|
|
81
|
+
}
|
|
82
|
+
export declare class UnauthorizedPrivateDataAccess extends BaseError {
|
|
83
|
+
constructor(msg?: string | Error);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Represents an error that occurs when a required initialization step is not performed.
|
|
87
|
+
*
|
|
88
|
+
* @class NotInitializedError
|
|
89
|
+
* @extends BaseError
|
|
90
|
+
*
|
|
91
|
+
* @category Errors
|
|
92
|
+
*
|
|
93
|
+
* @param {string | Error} msg - The error message or an Error object to wrap.
|
|
94
|
+
*
|
|
95
|
+
* @throws {NotInitializedError} - Throws an error when a required initialization step is not performed.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* // Initialize the application
|
|
100
|
+
* if (!isInitialized) {
|
|
101
|
+
* throw new NotInitializedError('Application is not initialized');
|
|
102
|
+
* }
|
|
103
|
+
*
|
|
104
|
+
* // Catching an NotInitializedError
|
|
105
|
+
* try {
|
|
106
|
+
* // Perform operations that require initialization
|
|
107
|
+
* } catch (error) {
|
|
108
|
+
* if (error instanceof NotInitializedError) {
|
|
109
|
+
* console.error('Initialization error:', error.message);
|
|
110
|
+
* }
|
|
111
|
+
* }
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export declare class NotInitializedError extends BaseError {
|
|
115
|
+
constructor(msg: string | Error);
|
|
116
|
+
}
|
|
117
|
+
export declare class MissingPKCSS11Lib extends InternalError {
|
|
118
|
+
constructor(msg: string | Error);
|
|
119
|
+
}
|
|
120
|
+
export declare class EndorsementError extends InternalError {
|
|
121
|
+
constructor(message: string | Error);
|
|
122
|
+
}
|
|
123
|
+
export declare class MvccReadConflictError extends InternalError {
|
|
124
|
+
constructor(message: string | Error);
|
|
125
|
+
}
|
|
126
|
+
export declare class PhantomReadConflictError extends InternalError {
|
|
127
|
+
constructor(message: string | Error);
|
|
128
|
+
}
|
|
129
|
+
export declare class EndorsementPolicyError extends InternalError {
|
|
130
|
+
constructor(message: string | Error);
|
|
131
|
+
}
|
|
132
|
+
export declare class TransactionLimitsError extends InternalError {
|
|
133
|
+
constructor(message: string | Error, name?: string, code?: number);
|
|
134
|
+
}
|
|
135
|
+
export declare class TransactionTimeoutError extends InternalError {
|
|
136
|
+
constructor(message: string | Error);
|
|
137
|
+
}
|
|
138
|
+
export declare class TransactionBufferSizeError extends InternalError {
|
|
139
|
+
constructor(message: string | Error);
|
|
140
|
+
}
|