@twin.org/engine-types 0.0.2-next.9 → 0.0.3-next.2
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/dist/es/components/attestation.js +60 -0
- package/dist/es/components/attestation.js.map +1 -0
- package/dist/es/components/auditableItemGraph.js +44 -0
- package/dist/es/components/auditableItemGraph.js.map +1 -0
- package/dist/es/components/auditableItemStream.js +44 -0
- package/dist/es/components/auditableItemStream.js.map +1 -0
- package/dist/es/components/authenticationGenerator.js +30 -0
- package/dist/es/components/authenticationGenerator.js.map +1 -0
- package/dist/es/components/backgroundTask.js +33 -0
- package/dist/es/components/backgroundTask.js.map +1 -0
- package/dist/es/components/blobStorage.js +143 -0
- package/dist/es/components/blobStorage.js.map +1 -0
- package/dist/es/components/dataProcessing.js +89 -0
- package/dist/es/components/dataProcessing.js.map +1 -0
- package/dist/es/components/dataSpaceConnector.js +52 -0
- package/dist/es/components/dataSpaceConnector.js.map +1 -0
- package/dist/es/components/documentManagement.js +37 -0
- package/dist/es/components/documentManagement.js.map +1 -0
- package/dist/es/components/entityStorage.js +226 -0
- package/dist/es/components/entityStorage.js.map +1 -0
- package/dist/es/components/eventBus.js +63 -0
- package/dist/es/components/eventBus.js.map +1 -0
- package/dist/es/components/faucet.js +41 -0
- package/dist/es/components/faucet.js.map +1 -0
- package/dist/es/components/federatedCatalogue.js +42 -0
- package/dist/es/components/federatedCatalogue.js.map +1 -0
- package/dist/es/components/identity.js +75 -0
- package/dist/es/components/identity.js.map +1 -0
- package/dist/es/components/identityProfile.js +64 -0
- package/dist/es/components/identityProfile.js.map +1 -0
- package/dist/es/components/identityResolver.js +87 -0
- package/dist/es/components/identityResolver.js.map +1 -0
- package/dist/es/components/immutableProof.js +44 -0
- package/dist/es/components/immutableProof.js.map +1 -0
- package/dist/es/components/logging.js +73 -0
- package/dist/es/components/logging.js.map +1 -0
- package/dist/es/components/messaging.js +177 -0
- package/dist/es/components/messaging.js.map +1 -0
- package/dist/es/components/nft.js +78 -0
- package/dist/es/components/nft.js.map +1 -0
- package/dist/es/components/rightsManagementDap.js +38 -0
- package/dist/es/components/rightsManagementDap.js.map +1 -0
- package/dist/es/components/rightsManagementDarp.js +29 -0
- package/dist/es/components/rightsManagementDarp.js.map +1 -0
- package/dist/es/components/rightsManagementPap.js +41 -0
- package/dist/es/components/rightsManagementPap.js.map +1 -0
- package/dist/es/components/rightsManagementPdp.js +46 -0
- package/dist/es/components/rightsManagementPdp.js.map +1 -0
- package/dist/es/components/rightsManagementPep.js +44 -0
- package/dist/es/components/rightsManagementPep.js.map +1 -0
- package/dist/es/components/rightsManagementPip.js +43 -0
- package/dist/es/components/rightsManagementPip.js.map +1 -0
- package/dist/es/components/rightsManagementPmp.js +30 -0
- package/dist/es/components/rightsManagementPmp.js.map +1 -0
- package/dist/es/components/rightsManagementPnap.js +42 -0
- package/dist/es/components/rightsManagementPnap.js.map +1 -0
- package/dist/es/components/rightsManagementPnp.js +61 -0
- package/dist/es/components/rightsManagementPnp.js.map +1 -0
- package/dist/es/components/rightsManagementPxp.js +43 -0
- package/dist/es/components/rightsManagementPxp.js.map +1 -0
- package/dist/es/components/synchronisedStorage.js +47 -0
- package/dist/es/components/synchronisedStorage.js.map +1 -0
- package/dist/es/components/taskScheduler.js +27 -0
- package/dist/es/components/taskScheduler.js.map +1 -0
- package/dist/es/components/telemetry.js +71 -0
- package/dist/es/components/telemetry.js.map +1 -0
- package/dist/es/components/tenant.js +32 -0
- package/dist/es/components/tenant.js.map +1 -0
- package/dist/es/components/vault.js +33 -0
- package/dist/es/components/vault.js.map +1 -0
- package/dist/es/components/verifiableStorage.js +79 -0
- package/dist/es/components/verifiableStorage.js.map +1 -0
- package/dist/es/components/wallet.js +47 -0
- package/dist/es/components/wallet.js.map +1 -0
- package/dist/es/index.js +152 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IEngineConfig.js +2 -0
- package/dist/es/models/IEngineConfig.js.map +1 -0
- package/dist/es/models/config/attestationComponentConfig.js +2 -0
- package/dist/es/models/config/attestationComponentConfig.js.map +1 -0
- package/dist/es/models/config/attestationConnectorConfig.js +2 -0
- package/dist/es/models/config/attestationConnectorConfig.js.map +1 -0
- package/dist/es/models/config/auditableItemGraphComponentConfig.js +2 -0
- package/dist/es/models/config/auditableItemGraphComponentConfig.js.map +1 -0
- package/dist/es/models/config/auditableItemStreamComponentConfig.js +2 -0
- package/dist/es/models/config/auditableItemStreamComponentConfig.js.map +1 -0
- package/dist/es/models/config/authenticationGeneratorComponentConfig.js +2 -0
- package/dist/es/models/config/authenticationGeneratorComponentConfig.js.map +1 -0
- package/dist/es/models/config/backgroundTaskConnectorConfig.js +2 -0
- package/dist/es/models/config/backgroundTaskConnectorConfig.js.map +1 -0
- package/dist/es/models/config/blobStorageComponentConfig.js +2 -0
- package/dist/es/models/config/blobStorageComponentConfig.js.map +1 -0
- package/dist/es/models/config/blobStorageConnectorConfig.js +2 -0
- package/dist/es/models/config/blobStorageConnectorConfig.js.map +1 -0
- package/dist/es/models/config/dataConverterConnectorConfig.js +2 -0
- package/dist/es/models/config/dataConverterConnectorConfig.js.map +1 -0
- package/dist/es/models/config/dataExtractorConnectorConfig.js +2 -0
- package/dist/es/models/config/dataExtractorConnectorConfig.js.map +1 -0
- package/dist/es/models/config/dataProcessingComponentConfig.js +2 -0
- package/dist/es/models/config/dataProcessingComponentConfig.js.map +1 -0
- package/dist/es/models/config/dataSpaceConnectorComponentConfig.js +2 -0
- package/dist/es/models/config/dataSpaceConnectorComponentConfig.js.map +1 -0
- package/dist/es/models/config/dltConfig.js +2 -0
- package/dist/es/models/config/dltConfig.js.map +1 -0
- package/dist/es/models/config/documentManagementComponentConfig.js +2 -0
- package/dist/es/models/config/documentManagementComponentConfig.js.map +1 -0
- package/dist/es/models/config/entityStorageComponentConfig.js +2 -0
- package/dist/es/models/config/entityStorageComponentConfig.js.map +1 -0
- package/dist/es/models/config/entityStorageConnectorConfig.js +2 -0
- package/dist/es/models/config/entityStorageConnectorConfig.js.map +1 -0
- package/dist/es/models/config/eventBusComponentConfig.js +2 -0
- package/dist/es/models/config/eventBusComponentConfig.js.map +1 -0
- package/dist/es/models/config/eventBusConnectorConfig.js +2 -0
- package/dist/es/models/config/eventBusConnectorConfig.js.map +1 -0
- package/dist/es/models/config/faucetConnectorConfig.js +2 -0
- package/dist/es/models/config/faucetConnectorConfig.js.map +1 -0
- package/dist/es/models/config/federatedCatalogueComponentConfig.js +2 -0
- package/dist/es/models/config/federatedCatalogueComponentConfig.js.map +1 -0
- package/dist/es/models/config/identityComponentConfig.js +2 -0
- package/dist/es/models/config/identityComponentConfig.js.map +1 -0
- package/dist/es/models/config/identityConnectorConfig.js +2 -0
- package/dist/es/models/config/identityConnectorConfig.js.map +1 -0
- package/dist/es/models/config/identityProfileComponentConfig.js +2 -0
- package/dist/es/models/config/identityProfileComponentConfig.js.map +1 -0
- package/dist/es/models/config/identityProfileConnectorConfig.js +2 -0
- package/dist/es/models/config/identityProfileConnectorConfig.js.map +1 -0
- package/dist/es/models/config/identityResolverComponentConfig.js +2 -0
- package/dist/es/models/config/identityResolverComponentConfig.js.map +1 -0
- package/dist/es/models/config/identityResolverConnectorConfig.js +2 -0
- package/dist/es/models/config/identityResolverConnectorConfig.js.map +1 -0
- package/dist/es/models/config/immutableProofComponentConfig.js +2 -0
- package/dist/es/models/config/immutableProofComponentConfig.js.map +1 -0
- package/dist/es/models/config/loggingComponentConfig.js +2 -0
- package/dist/es/models/config/loggingComponentConfig.js.map +1 -0
- package/dist/es/models/config/loggingConnectorConfig.js +2 -0
- package/dist/es/models/config/loggingConnectorConfig.js.map +1 -0
- package/dist/es/models/config/messagingAdminComponentConfig.js +2 -0
- package/dist/es/models/config/messagingAdminComponentConfig.js.map +1 -0
- package/dist/es/models/config/messagingComponentConfig.js +2 -0
- package/dist/es/models/config/messagingComponentConfig.js.map +1 -0
- package/dist/es/models/config/messagingEmailConnectorConfig.js +2 -0
- package/dist/es/models/config/messagingEmailConnectorConfig.js.map +1 -0
- package/dist/es/models/config/messagingPushNotificationConnectorConfig.js +2 -0
- package/dist/es/models/config/messagingPushNotificationConnectorConfig.js.map +1 -0
- package/dist/es/models/config/messagingSmsConnectorConfig.js +2 -0
- package/dist/es/models/config/messagingSmsConnectorConfig.js.map +1 -0
- package/dist/es/models/config/nftComponentConfig.js +2 -0
- package/dist/es/models/config/nftComponentConfig.js.map +1 -0
- package/dist/es/models/config/nftConnectorConfig.js +2 -0
- package/dist/es/models/config/nftConnectorConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementDapComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementDapComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementDarpComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementDarpComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementPapComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementPapComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementPdpComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementPdpComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementPepComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementPepComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementPipComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementPipComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementPmpComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementPmpComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementPnapComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementPnapComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementPnpComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementPnpComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementPxpComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementPxpComponentConfig.js.map +1 -0
- package/dist/es/models/config/synchronisedStorageComponentConfig.js +2 -0
- package/dist/es/models/config/synchronisedStorageComponentConfig.js.map +1 -0
- package/dist/es/models/config/taskSchedulerComponentConfig.js +2 -0
- package/dist/es/models/config/taskSchedulerComponentConfig.js.map +1 -0
- package/dist/es/models/config/telemetryComponentConfig.js +2 -0
- package/dist/es/models/config/telemetryComponentConfig.js.map +1 -0
- package/dist/es/models/config/telemetryConnectorConfig.js +2 -0
- package/dist/es/models/config/telemetryConnectorConfig.js.map +1 -0
- package/dist/es/models/config/tenantAdminComponentConfig.js +2 -0
- package/dist/es/models/config/tenantAdminComponentConfig.js.map +1 -0
- package/dist/es/models/config/vaultConnectorConfig.js +2 -0
- package/dist/es/models/config/vaultConnectorConfig.js.map +1 -0
- package/dist/es/models/config/verifiableStorageComponentConfig.js +2 -0
- package/dist/es/models/config/verifiableStorageComponentConfig.js.map +1 -0
- package/dist/es/models/config/verifiableStorageConnectorConfig.js +2 -0
- package/dist/es/models/config/verifiableStorageConnectorConfig.js.map +1 -0
- package/dist/es/models/config/walletConnectorConfig.js +2 -0
- package/dist/es/models/config/walletConnectorConfig.js.map +1 -0
- package/dist/es/models/types/attestationComponentType.js +17 -0
- package/dist/es/models/types/attestationComponentType.js.map +1 -0
- package/dist/es/models/types/attestationConnectorType.js +13 -0
- package/dist/es/models/types/attestationConnectorType.js.map +1 -0
- package/dist/es/models/types/auditableItemGraphComponentType.js +17 -0
- package/dist/es/models/types/auditableItemGraphComponentType.js.map +1 -0
- package/dist/es/models/types/auditableItemStreamComponentType.js +17 -0
- package/dist/es/models/types/auditableItemStreamComponentType.js.map +1 -0
- package/dist/es/models/types/authenticationGeneratorComponentType.js +13 -0
- package/dist/es/models/types/authenticationGeneratorComponentType.js.map +1 -0
- package/dist/es/models/types/backgroundTaskConnectorType.js +13 -0
- package/dist/es/models/types/backgroundTaskConnectorType.js.map +1 -0
- package/dist/es/models/types/blobStorageComponentType.js +17 -0
- package/dist/es/models/types/blobStorageComponentType.js.map +1 -0
- package/dist/es/models/types/blobStorageConnectorType.js +33 -0
- package/dist/es/models/types/blobStorageConnectorType.js.map +1 -0
- package/dist/es/models/types/dataConverterConnectorType.js +17 -0
- package/dist/es/models/types/dataConverterConnectorType.js.map +1 -0
- package/dist/es/models/types/dataExtractorConnectorType.js +13 -0
- package/dist/es/models/types/dataExtractorConnectorType.js.map +1 -0
- package/dist/es/models/types/dataProcessingComponentType.js +17 -0
- package/dist/es/models/types/dataProcessingComponentType.js.map +1 -0
- package/dist/es/models/types/dataSpaceConnectorComponentType.js +21 -0
- package/dist/es/models/types/dataSpaceConnectorComponentType.js.map +1 -0
- package/dist/es/models/types/dltConfigType.js +13 -0
- package/dist/es/models/types/dltConfigType.js.map +1 -0
- package/dist/es/models/types/documentManagementComponentType.js +17 -0
- package/dist/es/models/types/documentManagementComponentType.js.map +1 -0
- package/dist/es/models/types/entityStorageComponentType.js +17 -0
- package/dist/es/models/types/entityStorageComponentType.js.map +1 -0
- package/dist/es/models/types/entityStorageConnectorType.js +49 -0
- package/dist/es/models/types/entityStorageConnectorType.js.map +1 -0
- package/dist/es/models/types/eventBusComponentType.js +17 -0
- package/dist/es/models/types/eventBusComponentType.js.map +1 -0
- package/dist/es/models/types/eventBusConnectorType.js +13 -0
- package/dist/es/models/types/eventBusConnectorType.js.map +1 -0
- package/dist/es/models/types/faucetConnectorType.js +17 -0
- package/dist/es/models/types/faucetConnectorType.js.map +1 -0
- package/dist/es/models/types/federatedCatalogueComponentType.js +17 -0
- package/dist/es/models/types/federatedCatalogueComponentType.js.map +1 -0
- package/dist/es/models/types/identityComponentType.js +17 -0
- package/dist/es/models/types/identityComponentType.js.map +1 -0
- package/dist/es/models/types/identityConnectorType.js +17 -0
- package/dist/es/models/types/identityConnectorType.js.map +1 -0
- package/dist/es/models/types/identityProfileComponentType.js +17 -0
- package/dist/es/models/types/identityProfileComponentType.js.map +1 -0
- package/dist/es/models/types/identityProfileConnectorType.js +13 -0
- package/dist/es/models/types/identityProfileConnectorType.js.map +1 -0
- package/dist/es/models/types/identityResolverComponentType.js +17 -0
- package/dist/es/models/types/identityResolverComponentType.js.map +1 -0
- package/dist/es/models/types/identityResolverConnectorType.js +21 -0
- package/dist/es/models/types/identityResolverConnectorType.js.map +1 -0
- package/dist/es/models/types/immutableProofComponentType.js +17 -0
- package/dist/es/models/types/immutableProofComponentType.js.map +1 -0
- package/dist/es/models/types/loggingComponentType.js +17 -0
- package/dist/es/models/types/loggingComponentType.js.map +1 -0
- package/dist/es/models/types/loggingConnectorType.js +21 -0
- package/dist/es/models/types/loggingConnectorType.js.map +1 -0
- package/dist/es/models/types/messagingAdminComponentType.js +13 -0
- package/dist/es/models/types/messagingAdminComponentType.js.map +1 -0
- package/dist/es/models/types/messagingComponentType.js +13 -0
- package/dist/es/models/types/messagingComponentType.js.map +1 -0
- package/dist/es/models/types/messagingEmailConnectorType.js +17 -0
- package/dist/es/models/types/messagingEmailConnectorType.js.map +1 -0
- package/dist/es/models/types/messagingPushNotificationConnectorType.js +17 -0
- package/dist/es/models/types/messagingPushNotificationConnectorType.js.map +1 -0
- package/dist/es/models/types/messagingSmsConnectorType.js +17 -0
- package/dist/es/models/types/messagingSmsConnectorType.js.map +1 -0
- package/dist/es/models/types/nftComponentType.js +17 -0
- package/dist/es/models/types/nftComponentType.js.map +1 -0
- package/dist/es/models/types/nftConnectorType.js +17 -0
- package/dist/es/models/types/nftConnectorType.js.map +1 -0
- package/dist/es/models/types/rightsManagementDapComponentType.js +17 -0
- package/dist/es/models/types/rightsManagementDapComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementDarpComponentType.js +13 -0
- package/dist/es/models/types/rightsManagementDarpComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementPapComponentType.js +17 -0
- package/dist/es/models/types/rightsManagementPapComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementPdpComponentType.js +13 -0
- package/dist/es/models/types/rightsManagementPdpComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementPepComponentType.js +17 -0
- package/dist/es/models/types/rightsManagementPepComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementPipComponentType.js +13 -0
- package/dist/es/models/types/rightsManagementPipComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementPmpComponentType.js +13 -0
- package/dist/es/models/types/rightsManagementPmpComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementPnapComponentType.js +17 -0
- package/dist/es/models/types/rightsManagementPnapComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementPnpComponentType.js +17 -0
- package/dist/es/models/types/rightsManagementPnpComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementPxpComponentType.js +13 -0
- package/dist/es/models/types/rightsManagementPxpComponentType.js.map +1 -0
- package/dist/es/models/types/synchronisedStorageComponentType.js +17 -0
- package/dist/es/models/types/synchronisedStorageComponentType.js.map +1 -0
- package/dist/es/models/types/taskSchedulerComponentType.js +13 -0
- package/dist/es/models/types/taskSchedulerComponentType.js.map +1 -0
- package/dist/es/models/types/telemetryComponentType.js +17 -0
- package/dist/es/models/types/telemetryComponentType.js.map +1 -0
- package/dist/es/models/types/telemetryConnectorType.js +13 -0
- package/dist/es/models/types/telemetryConnectorType.js.map +1 -0
- package/dist/es/models/types/tenantAdminComponentType.js +13 -0
- package/dist/es/models/types/tenantAdminComponentType.js.map +1 -0
- package/dist/es/models/types/vaultConnectorType.js +17 -0
- package/dist/es/models/types/vaultConnectorType.js.map +1 -0
- package/dist/es/models/types/verifiableStorageComponentType.js +17 -0
- package/dist/es/models/types/verifiableStorageComponentType.js.map +1 -0
- package/dist/es/models/types/verifiableStorageConnectorType.js +17 -0
- package/dist/es/models/types/verifiableStorageConnectorType.js.map +1 -0
- package/dist/es/models/types/walletConnectorType.js +17 -0
- package/dist/es/models/types/walletConnectorType.js.map +1 -0
- package/dist/es/utils/engineTypeHelper.js +32 -0
- package/dist/es/utils/engineTypeHelper.js.map +1 -0
- package/dist/types/components/attestation.d.ts +17 -11
- package/dist/types/components/auditableItemGraph.d.ts +9 -6
- package/dist/types/components/auditableItemStream.d.ts +9 -6
- package/dist/types/components/authenticationGenerator.d.ts +17 -0
- package/dist/types/components/backgroundTask.d.ts +10 -6
- package/dist/types/components/blobStorage.d.ts +17 -11
- package/dist/types/components/dataProcessing.d.ts +24 -16
- package/dist/types/components/dataSpaceConnector.d.ts +16 -0
- package/dist/types/components/documentManagement.d.ts +9 -6
- package/dist/types/components/entityStorage.d.ts +12 -8
- package/dist/types/components/eventBus.d.ts +17 -11
- package/dist/types/components/faucet.d.ts +10 -6
- package/dist/types/components/federatedCatalogue.d.ts +9 -6
- package/dist/types/components/identity.d.ts +17 -11
- package/dist/types/components/identityProfile.d.ts +17 -11
- package/dist/types/components/identityResolver.d.ts +17 -11
- package/dist/types/components/immutableProof.d.ts +9 -6
- package/dist/types/components/logging.d.ts +17 -11
- package/dist/types/components/messaging.d.ts +44 -21
- package/dist/types/components/nft.d.ts +17 -11
- package/dist/types/components/rightsManagementDap.d.ts +16 -0
- package/dist/types/components/rightsManagementDarp.d.ts +16 -0
- package/dist/types/components/rightsManagementPap.d.ts +9 -6
- package/dist/types/components/rightsManagementPdp.d.ts +9 -6
- package/dist/types/components/rightsManagementPep.d.ts +9 -6
- package/dist/types/components/rightsManagementPip.d.ts +9 -6
- package/dist/types/components/rightsManagementPmp.d.ts +9 -6
- package/dist/types/components/rightsManagementPnap.d.ts +16 -0
- package/dist/types/components/rightsManagementPnp.d.ts +16 -0
- package/dist/types/components/rightsManagementPxp.d.ts +9 -6
- package/dist/types/components/synchronisedStorage.d.ts +9 -6
- package/dist/types/components/taskScheduler.d.ts +9 -6
- package/dist/types/components/telemetry.d.ts +17 -11
- package/dist/types/components/tenant.d.ts +16 -0
- package/dist/types/components/vault.d.ts +10 -6
- package/dist/types/components/verifiableStorage.d.ts +17 -11
- package/dist/types/components/wallet.d.ts +10 -16
- package/dist/types/index.d.ts +149 -128
- package/dist/types/models/IEngineConfig.d.ts +85 -50
- package/dist/types/models/config/attestationComponentConfig.d.ts +1 -1
- package/dist/types/models/config/attestationConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/auditableItemGraphComponentConfig.d.ts +1 -1
- package/dist/types/models/config/auditableItemStreamComponentConfig.d.ts +1 -1
- package/dist/types/models/config/authenticationGeneratorComponentConfig.d.ts +9 -0
- package/dist/types/models/config/backgroundTaskConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/blobStorageComponentConfig.d.ts +1 -1
- package/dist/types/models/config/blobStorageConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/dataConverterConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/dataExtractorConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/dataProcessingComponentConfig.d.ts +1 -1
- package/dist/types/models/config/dataSpaceConnectorComponentConfig.d.ts +17 -0
- package/dist/types/models/config/dltConfig.d.ts +1 -1
- package/dist/types/models/config/documentManagementComponentConfig.d.ts +1 -1
- package/dist/types/models/config/entityStorageComponentConfig.d.ts +4 -2
- package/dist/types/models/config/entityStorageConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/eventBusComponentConfig.d.ts +1 -1
- package/dist/types/models/config/eventBusConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/faucetConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/federatedCatalogueComponentConfig.d.ts +1 -1
- package/dist/types/models/config/identityComponentConfig.d.ts +1 -1
- package/dist/types/models/config/identityConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/identityProfileComponentConfig.d.ts +1 -1
- package/dist/types/models/config/identityProfileConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/identityResolverComponentConfig.d.ts +1 -1
- package/dist/types/models/config/identityResolverConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/immutableProofComponentConfig.d.ts +1 -1
- package/dist/types/models/config/loggingComponentConfig.d.ts +1 -1
- package/dist/types/models/config/loggingConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/messagingAdminComponentConfig.d.ts +9 -0
- package/dist/types/models/config/messagingComponentConfig.d.ts +1 -1
- package/dist/types/models/config/messagingEmailConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/messagingPushNotificationConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/messagingSmsConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/nftComponentConfig.d.ts +1 -1
- package/dist/types/models/config/nftConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/rightsManagementDapComponentConfig.d.ts +16 -0
- package/dist/types/models/config/rightsManagementDarpComponentConfig.d.ts +12 -0
- package/dist/types/models/config/rightsManagementPapComponentConfig.d.ts +7 -3
- package/dist/types/models/config/rightsManagementPdpComponentConfig.d.ts +6 -3
- package/dist/types/models/config/rightsManagementPepComponentConfig.d.ts +6 -3
- package/dist/types/models/config/rightsManagementPipComponentConfig.d.ts +6 -3
- package/dist/types/models/config/rightsManagementPmpComponentConfig.d.ts +3 -3
- package/dist/types/models/config/rightsManagementPnapComponentConfig.d.ts +13 -0
- package/dist/types/models/config/rightsManagementPnpComponentConfig.d.ts +17 -0
- package/dist/types/models/config/rightsManagementPxpComponentConfig.d.ts +6 -3
- package/dist/types/models/config/synchronisedStorageComponentConfig.d.ts +1 -1
- package/dist/types/models/config/taskSchedulerComponentConfig.d.ts +1 -1
- package/dist/types/models/config/telemetryComponentConfig.d.ts +1 -1
- package/dist/types/models/config/telemetryConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/tenantAdminComponentConfig.d.ts +9 -0
- package/dist/types/models/config/vaultConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/verifiableStorageComponentConfig.d.ts +1 -1
- package/dist/types/models/config/verifiableStorageConnectorConfig.d.ts +1 -1
- package/dist/types/models/config/walletConnectorConfig.d.ts +1 -1
- package/dist/types/models/types/authenticationGeneratorComponentType.d.ts +13 -0
- package/dist/types/models/types/dataSpaceConnectorComponentType.d.ts +21 -0
- package/dist/types/models/types/messagingAdminComponentType.d.ts +13 -0
- package/dist/types/models/types/rightsManagementDapComponentType.d.ts +17 -0
- package/dist/types/models/types/rightsManagementDarpComponentType.d.ts +13 -0
- package/dist/types/models/types/rightsManagementPapComponentType.d.ts +4 -0
- package/dist/types/models/types/rightsManagementPepComponentType.d.ts +4 -0
- package/dist/types/models/types/rightsManagementPnapComponentType.d.ts +17 -0
- package/dist/types/models/types/rightsManagementPnpComponentType.d.ts +17 -0
- package/dist/types/models/types/tenantAdminComponentType.d.ts +13 -0
- package/dist/types/utils/engineTypeHelper.d.ts +19 -0
- package/docs/changelog.md +318 -0
- package/docs/reference/classes/EngineTypeHelper.md +61 -0
- package/docs/reference/functions/initialiseAttestationComponent.md +3 -13
- package/docs/reference/functions/initialiseAttestationConnector.md +3 -13
- package/docs/reference/functions/initialiseAuditableItemGraphComponent.md +3 -13
- package/docs/reference/functions/initialiseAuditableItemStreamComponent.md +3 -13
- package/docs/reference/functions/initialiseAuthenticationGeneratorComponent.md +31 -0
- package/docs/reference/functions/initialiseBackgroundTaskConnector.md +3 -13
- package/docs/reference/functions/initialiseBlobStorageComponent.md +3 -13
- package/docs/reference/functions/initialiseBlobStorageConnector.md +3 -13
- package/docs/reference/functions/initialiseDataConverterConnector.md +3 -13
- package/docs/reference/functions/initialiseDataExtractorConnector.md +3 -13
- package/docs/reference/functions/initialiseDataProcessingComponent.md +3 -13
- package/docs/reference/functions/initialiseDataSpaceConnectorComponent.md +31 -0
- package/docs/reference/functions/initialiseDocumentManagementComponent.md +3 -13
- package/docs/reference/functions/initialiseEntityStorageComponent.md +3 -13
- package/docs/reference/functions/initialiseEntityStorageConnector.md +8 -2
- package/docs/reference/functions/initialiseEventBusComponent.md +3 -13
- package/docs/reference/functions/initialiseEventBusConnector.md +3 -13
- package/docs/reference/functions/initialiseFaucetConnector.md +3 -13
- package/docs/reference/functions/initialiseFederatedCatalogueComponent.md +3 -13
- package/docs/reference/functions/initialiseIdentityComponent.md +3 -13
- package/docs/reference/functions/initialiseIdentityConnector.md +3 -13
- package/docs/reference/functions/initialiseIdentityProfileComponent.md +3 -13
- package/docs/reference/functions/initialiseIdentityProfileConnector.md +3 -13
- package/docs/reference/functions/initialiseIdentityResolverComponent.md +3 -13
- package/docs/reference/functions/initialiseIdentityResolverConnector.md +3 -13
- package/docs/reference/functions/initialiseImmutableProofComponent.md +3 -13
- package/docs/reference/functions/initialiseLoggingComponent.md +3 -13
- package/docs/reference/functions/initialiseLoggingConnector.md +3 -13
- package/docs/reference/functions/initialiseMessagingAdminComponent.md +31 -0
- package/docs/reference/functions/initialiseMessagingComponent.md +3 -13
- package/docs/reference/functions/initialiseMessagingEmailConnector.md +3 -13
- package/docs/reference/functions/initialiseMessagingPushNotificationConnector.md +3 -13
- package/docs/reference/functions/initialiseMessagingSmsConnector.md +3 -13
- package/docs/reference/functions/initialiseNftComponent.md +3 -13
- package/docs/reference/functions/initialiseNftConnector.md +3 -13
- package/docs/reference/functions/initialiseRightsManagementDapComponent.md +31 -0
- package/docs/reference/functions/initialiseRightsManagementDarpComponent.md +31 -0
- package/docs/reference/functions/initialiseRightsManagementPapComponent.md +3 -13
- package/docs/reference/functions/initialiseRightsManagementPdpComponent.md +3 -13
- package/docs/reference/functions/initialiseRightsManagementPepComponent.md +3 -13
- package/docs/reference/functions/initialiseRightsManagementPipComponent.md +3 -13
- package/docs/reference/functions/initialiseRightsManagementPmpComponent.md +3 -13
- package/docs/reference/functions/initialiseRightsManagementPnapComponent.md +31 -0
- package/docs/reference/functions/initialiseRightsManagementPnpComponent.md +31 -0
- package/docs/reference/functions/initialiseRightsManagementPxpComponent.md +3 -13
- package/docs/reference/functions/initialiseSynchronisedStorageComponent.md +3 -13
- package/docs/reference/functions/initialiseTaskSchedulerComponent.md +3 -13
- package/docs/reference/functions/initialiseTelemetryComponent.md +3 -13
- package/docs/reference/functions/initialiseTelemetryConnector.md +3 -13
- package/docs/reference/functions/initialiseTenantAdminComponent.md +31 -0
- package/docs/reference/functions/initialiseVaultConnector.md +3 -13
- package/docs/reference/functions/initialiseVerifiableStorageComponent.md +3 -13
- package/docs/reference/functions/initialiseVerifiableStorageConnector.md +3 -13
- package/docs/reference/functions/initialiseWalletConnector.md +3 -13
- package/docs/reference/index.md +36 -5
- package/docs/reference/interfaces/IEngineConfig.md +45 -3
- package/docs/reference/type-aliases/AuthenticationGeneratorComponentConfig.md +17 -0
- package/docs/reference/type-aliases/AuthenticationGeneratorComponentType.md +5 -0
- package/docs/reference/type-aliases/DataSpaceConnectorComponentConfig.md +5 -0
- package/docs/reference/type-aliases/DataSpaceConnectorComponentType.md +5 -0
- package/docs/reference/type-aliases/EntityStorageComponentConfig.md +1 -1
- package/docs/reference/type-aliases/MessagingAdminComponentConfig.md +17 -0
- package/docs/reference/type-aliases/MessagingAdminComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementDapComponentConfig.md +5 -0
- package/docs/reference/type-aliases/RightsManagementDapComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementDarpComponentConfig.md +23 -0
- package/docs/reference/type-aliases/RightsManagementDarpComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementPapComponentConfig.md +1 -13
- package/docs/reference/type-aliases/RightsManagementPdpComponentConfig.md +7 -1
- package/docs/reference/type-aliases/RightsManagementPepComponentConfig.md +7 -1
- package/docs/reference/type-aliases/RightsManagementPipComponentConfig.md +7 -1
- package/docs/reference/type-aliases/RightsManagementPmpComponentConfig.md +1 -1
- package/docs/reference/type-aliases/RightsManagementPnapComponentConfig.md +5 -0
- package/docs/reference/type-aliases/RightsManagementPnapComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementPnpComponentConfig.md +5 -0
- package/docs/reference/type-aliases/RightsManagementPnpComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementPxpComponentConfig.md +7 -1
- package/docs/reference/type-aliases/TenantAdminComponentConfig.md +17 -0
- package/docs/reference/type-aliases/TenantAdminComponentType.md +5 -0
- package/docs/reference/variables/AttestationComponentType.md +1 -1
- package/docs/reference/variables/AttestationConnectorType.md +1 -1
- package/docs/reference/variables/AuditableItemGraphComponentType.md +1 -1
- package/docs/reference/variables/AuditableItemStreamComponentType.md +1 -1
- package/docs/reference/variables/AuthenticationGeneratorComponentType.md +13 -0
- package/docs/reference/variables/BackgroundTaskConnectorType.md +1 -1
- package/docs/reference/variables/BlobStorageComponentType.md +1 -1
- package/docs/reference/variables/BlobStorageConnectorType.md +1 -1
- package/docs/reference/variables/DataConverterConnectorType.md +1 -1
- package/docs/reference/variables/DataExtractorConnectorType.md +1 -1
- package/docs/reference/variables/DataProcessingComponentType.md +1 -1
- package/docs/reference/variables/DataSpaceConnectorComponentType.md +25 -0
- package/docs/reference/variables/DltConfigType.md +1 -1
- package/docs/reference/variables/DocumentManagementComponentType.md +1 -1
- package/docs/reference/variables/EntityStorageComponentType.md +1 -1
- package/docs/reference/variables/EntityStorageConnectorType.md +1 -1
- package/docs/reference/variables/EventBusComponentType.md +1 -1
- package/docs/reference/variables/EventBusConnectorType.md +1 -1
- package/docs/reference/variables/FaucetConnectorType.md +1 -1
- package/docs/reference/variables/FederatedCatalogueComponentType.md +1 -1
- package/docs/reference/variables/IdentityComponentType.md +1 -1
- package/docs/reference/variables/IdentityConnectorType.md +1 -1
- package/docs/reference/variables/IdentityProfileComponentType.md +1 -1
- package/docs/reference/variables/IdentityProfileConnectorType.md +1 -1
- package/docs/reference/variables/IdentityResolverComponentType.md +1 -1
- package/docs/reference/variables/IdentityResolverConnectorType.md +1 -1
- package/docs/reference/variables/ImmutableProofComponentType.md +1 -1
- package/docs/reference/variables/LoggingComponentType.md +1 -1
- package/docs/reference/variables/LoggingConnectorType.md +1 -1
- package/docs/reference/variables/MessagingAdminComponentType.md +13 -0
- package/docs/reference/variables/MessagingComponentType.md +1 -1
- package/docs/reference/variables/MessagingEmailConnectorType.md +1 -1
- package/docs/reference/variables/MessagingPushNotificationConnectorType.md +1 -1
- package/docs/reference/variables/MessagingSmsConnectorType.md +1 -1
- package/docs/reference/variables/NftComponentType.md +1 -1
- package/docs/reference/variables/NftConnectorType.md +1 -1
- package/docs/reference/variables/{RightsManagementComponentType.md → RightsManagementDapComponentType.md} +4 -4
- package/docs/reference/variables/RightsManagementDarpComponentType.md +13 -0
- package/docs/reference/variables/RightsManagementPapComponentType.md +7 -1
- package/docs/reference/variables/RightsManagementPdpComponentType.md +1 -1
- package/docs/reference/variables/RightsManagementPepComponentType.md +7 -1
- package/docs/reference/variables/RightsManagementPipComponentType.md +1 -1
- package/docs/reference/variables/RightsManagementPmpComponentType.md +1 -1
- package/docs/reference/variables/RightsManagementPnapComponentType.md +19 -0
- package/docs/reference/variables/RightsManagementPnpComponentType.md +19 -0
- package/docs/reference/variables/RightsManagementPxpComponentType.md +1 -1
- package/docs/reference/variables/SynchronisedStorageComponentType.md +1 -1
- package/docs/reference/variables/TaskSchedulerComponentType.md +1 -1
- package/docs/reference/variables/TelemetryComponentType.md +1 -1
- package/docs/reference/variables/TelemetryConnectorType.md +1 -1
- package/docs/reference/variables/TenantAdminComponentType.md +13 -0
- package/docs/reference/variables/VaultConnectorType.md +1 -1
- package/docs/reference/variables/VerifiableStorageComponentType.md +1 -1
- package/docs/reference/variables/VerifiableStorageConnectorType.md +1 -1
- package/docs/reference/variables/WalletConnectorType.md +1 -1
- package/locales/en.json +14 -1
- package/package.json +30 -9
- package/dist/cjs/index.cjs +0 -3224
- package/dist/esm/index.mjs +0 -3127
- package/dist/types/components/rightsManagement.d.ts +0 -13
- package/dist/types/models/config/rightsManagementComponentConfig.d.ts +0 -13
- package/dist/types/models/types/rightsManagementComponentType.d.ts +0 -17
- package/docs/reference/functions/initialiseRightsManagementComponent.md +0 -41
- package/docs/reference/functions/initialiseWalletStorage.md +0 -41
- package/docs/reference/type-aliases/RightsManagementComponentConfig.md +0 -5
- package/docs/reference/type-aliases/RightsManagementComponentType.md +0 -5
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { ComponentFactory } from "@twin.org/core";
|
|
4
|
+
import { DocumentManagementRestClient } from "@twin.org/document-management-rest-client";
|
|
5
|
+
import { DocumentManagementService } from "@twin.org/document-management-service";
|
|
6
|
+
import { DocumentManagementComponentType } from "../models/types/documentManagementComponentType.js";
|
|
7
|
+
/**
|
|
8
|
+
* Initialise the document management component.
|
|
9
|
+
* @param engineCore The engine core.
|
|
10
|
+
* @param context The context for the engine.
|
|
11
|
+
* @param instanceConfig The instance config.
|
|
12
|
+
* @returns The instance created and the factory for it.
|
|
13
|
+
*/
|
|
14
|
+
export async function initialiseDocumentManagementComponent(engineCore, context, instanceConfig) {
|
|
15
|
+
let component;
|
|
16
|
+
let instanceType;
|
|
17
|
+
if (instanceConfig.type === DocumentManagementComponentType.Service) {
|
|
18
|
+
component = new DocumentManagementService({
|
|
19
|
+
auditableItemGraphComponentType: engineCore.getRegisteredInstanceType("auditableItemGraphComponent"),
|
|
20
|
+
blobStorageComponentType: engineCore.getRegisteredInstanceType("blobStorageComponent"),
|
|
21
|
+
attestationComponentType: engineCore.getRegisteredInstanceType("attestationComponent"),
|
|
22
|
+
dataProcessingComponentType: engineCore.getRegisteredInstanceType("dataProcessingComponent"),
|
|
23
|
+
...instanceConfig.options
|
|
24
|
+
});
|
|
25
|
+
instanceType = "document-management-service";
|
|
26
|
+
}
|
|
27
|
+
else if (instanceConfig.type === DocumentManagementComponentType.RestClient) {
|
|
28
|
+
component = new DocumentManagementRestClient(instanceConfig.options);
|
|
29
|
+
instanceType = "document-management-rest-client";
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
component,
|
|
33
|
+
instanceType,
|
|
34
|
+
factory: ComponentFactory
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=documentManagement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentManagement.js","sourceRoot":"","sources":["../../../src/components/documentManagement.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAKlF,OAAO,EAAE,+BAA+B,EAAE,MAAM,oDAAoD,CAAC;AAErG;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,qCAAqC,CAC1D,UAAsC,EACtC,OAA0C,EAC1C,cAAiD;IAMjD,IAAI,SAAmD,CAAC;IACxD,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,+BAA+B,CAAC,OAAO,EAAE,CAAC;QACrE,SAAS,GAAG,IAAI,yBAAyB,CAAC;YACzC,+BAA+B,EAAE,UAAU,CAAC,yBAAyB,CACpE,6BAA6B,CAC7B;YACD,wBAAwB,EAAE,UAAU,CAAC,yBAAyB,CAAC,sBAAsB,CAAC;YACtF,wBAAwB,EAAE,UAAU,CAAC,yBAAyB,CAAC,sBAAsB,CAAC;YACtF,2BAA2B,EAAE,UAAU,CAAC,yBAAyB,CAAC,yBAAyB,CAAC;YAC5F,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,gCAA6C,CAAC;IAC3D,CAAC;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,+BAA+B,CAAC,UAAU,EAAE,CAAC;QAC/E,SAAS,GAAG,IAAI,4BAA4B,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACrE,YAAY,oCAAgD,CAAC;IAC9D,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type { IDocumentManagementComponent } from \"@twin.org/document-management-models\";\nimport { DocumentManagementRestClient } from \"@twin.org/document-management-rest-client\";\nimport { DocumentManagementService } from \"@twin.org/document-management-service\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport type { DocumentManagementComponentConfig } from \"../models/config/documentManagementComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { DocumentManagementComponentType } from \"../models/types/documentManagementComponentType.js\";\n\n/**\n * Initialise the document management component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseDocumentManagementComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: DocumentManagementComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof ComponentFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IDocumentManagementComponent | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === DocumentManagementComponentType.Service) {\n\t\tcomponent = new DocumentManagementService({\n\t\t\tauditableItemGraphComponentType: engineCore.getRegisteredInstanceType(\n\t\t\t\t\"auditableItemGraphComponent\"\n\t\t\t),\n\t\t\tblobStorageComponentType: engineCore.getRegisteredInstanceType(\"blobStorageComponent\"),\n\t\t\tattestationComponentType: engineCore.getRegisteredInstanceType(\"attestationComponent\"),\n\t\t\tdataProcessingComponentType: engineCore.getRegisteredInstanceType(\"dataProcessingComponent\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(DocumentManagementService);\n\t} else if (instanceConfig.type === DocumentManagementComponentType.RestClient) {\n\t\tcomponent = new DocumentManagementRestClient(instanceConfig.options);\n\t\tinstanceType = nameofKebabCase(DocumentManagementRestClient);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { ComponentFactory, GeneralError, I18n, Is, StringHelper } from "@twin.org/core";
|
|
5
|
+
import { CosmosDbEntityStorageConnector } from "@twin.org/entity-storage-connector-cosmosdb";
|
|
6
|
+
import { DynamoDbEntityStorageConnector } from "@twin.org/entity-storage-connector-dynamodb";
|
|
7
|
+
import { FileEntityStorageConnector } from "@twin.org/entity-storage-connector-file";
|
|
8
|
+
import { FirestoreEntityStorageConnector } from "@twin.org/entity-storage-connector-gcp-firestore";
|
|
9
|
+
import { MemoryEntityStorageConnector } from "@twin.org/entity-storage-connector-memory";
|
|
10
|
+
import { MongoDbEntityStorageConnector } from "@twin.org/entity-storage-connector-mongodb";
|
|
11
|
+
import { MySqlEntityStorageConnector } from "@twin.org/entity-storage-connector-mysql";
|
|
12
|
+
import { PostgreSqlEntityStorageConnector } from "@twin.org/entity-storage-connector-postgresql";
|
|
13
|
+
import { ScyllaDBTableConnector } from "@twin.org/entity-storage-connector-scylladb";
|
|
14
|
+
import { SynchronisedEntityStorageConnector } from "@twin.org/entity-storage-connector-synchronised";
|
|
15
|
+
import { EntityStorageConnectorFactory } from "@twin.org/entity-storage-models";
|
|
16
|
+
import { EntityStorageRestClient } from "@twin.org/entity-storage-rest-client";
|
|
17
|
+
import { EntityStorageService } from "@twin.org/entity-storage-service";
|
|
18
|
+
import { EntityStorageComponentType } from "../models/types/entityStorageComponentType.js";
|
|
19
|
+
import { EntityStorageConnectorType } from "../models/types/entityStorageConnectorType.js";
|
|
20
|
+
/**
|
|
21
|
+
* Initialise the entity storage connector.
|
|
22
|
+
* @param engineCore The engine core.
|
|
23
|
+
* @param context The context for the engine.
|
|
24
|
+
* @param typeCustom Override the type of connector to use instead of default configuration.
|
|
25
|
+
* @param schema The schema for the entity storage.
|
|
26
|
+
* @param partitionContextIds The context IDs to use for partitioning the data.
|
|
27
|
+
* @returns The name of the instance type that was created.
|
|
28
|
+
* @throws GeneralError when the configuration is invalid.
|
|
29
|
+
*/
|
|
30
|
+
export function initialiseEntityStorageConnector(engineCore, context, typeCustom, schema, partitionContextIds) {
|
|
31
|
+
const instanceName = StringHelper.kebabCase(schema);
|
|
32
|
+
if (!EntityStorageConnectorFactory.hasName(instanceName)) {
|
|
33
|
+
let entityStorageConfig;
|
|
34
|
+
if (Is.stringValue(typeCustom)) {
|
|
35
|
+
// A custom type has been specified, so look it up
|
|
36
|
+
entityStorageConfig = context.config.types.entityStorageConnector?.find(c => c.type === typeCustom || c.overrideInstanceType === typeCustom);
|
|
37
|
+
if (Is.empty(entityStorageConfig)) {
|
|
38
|
+
throw new GeneralError("engineTypes", "entityStorageCustomMissing", {
|
|
39
|
+
typeCustom,
|
|
40
|
+
storageName: instanceName
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
// The default entity storage method is either the one with the isDefault flag set
|
|
46
|
+
// or pick the first one if no default is set.
|
|
47
|
+
entityStorageConfig =
|
|
48
|
+
context.config.types.entityStorageConnector?.find(c => c.isDefault ?? false) ??
|
|
49
|
+
context.config.types.entityStorageConnector?.[0];
|
|
50
|
+
if (Is.empty(entityStorageConfig)) {
|
|
51
|
+
throw new GeneralError("engineTypes", "entityStorageMissing", {
|
|
52
|
+
storageName: instanceName
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const type = entityStorageConfig.type;
|
|
57
|
+
let entityStorageConnector;
|
|
58
|
+
engineCore.logInfo(I18n.formatMessage("info.engineTypes.configuringEntityStorage", {
|
|
59
|
+
element: "Entity Storage",
|
|
60
|
+
storageName: instanceName,
|
|
61
|
+
storageType: type
|
|
62
|
+
}));
|
|
63
|
+
if (type === EntityStorageConnectorType.Memory) {
|
|
64
|
+
entityStorageConnector = new MemoryEntityStorageConnector({
|
|
65
|
+
entitySchema: schema,
|
|
66
|
+
partitionContextIds
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
else if (type === EntityStorageConnectorType.File) {
|
|
70
|
+
entityStorageConnector = new FileEntityStorageConnector({
|
|
71
|
+
entitySchema: schema,
|
|
72
|
+
partitionContextIds,
|
|
73
|
+
...entityStorageConfig.options,
|
|
74
|
+
config: {
|
|
75
|
+
...entityStorageConfig.options.config,
|
|
76
|
+
directory: path.join(entityStorageConfig.options.config.directory, `${entityStorageConfig.options.folderPrefix ?? ""}${instanceName}`)
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else if (type === EntityStorageConnectorType.AwsDynamoDb) {
|
|
81
|
+
entityStorageConnector = new DynamoDbEntityStorageConnector({
|
|
82
|
+
entitySchema: schema,
|
|
83
|
+
partitionContextIds,
|
|
84
|
+
...entityStorageConfig.options,
|
|
85
|
+
config: {
|
|
86
|
+
...entityStorageConfig.options.config,
|
|
87
|
+
tableName: `${entityStorageConfig.options.tablePrefix ?? ""}${instanceName}`
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
else if (type === EntityStorageConnectorType.AzureCosmosDb) {
|
|
92
|
+
entityStorageConnector = new CosmosDbEntityStorageConnector({
|
|
93
|
+
entitySchema: schema,
|
|
94
|
+
partitionContextIds,
|
|
95
|
+
...entityStorageConfig.options,
|
|
96
|
+
config: {
|
|
97
|
+
...entityStorageConfig.options.config,
|
|
98
|
+
containerId: `${entityStorageConfig.options.tablePrefix ?? ""}${instanceName}`
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else if (type === EntityStorageConnectorType.GcpFirestoreDb) {
|
|
103
|
+
entityStorageConnector = new FirestoreEntityStorageConnector({
|
|
104
|
+
entitySchema: schema,
|
|
105
|
+
partitionContextIds,
|
|
106
|
+
...entityStorageConfig.options,
|
|
107
|
+
config: {
|
|
108
|
+
...entityStorageConfig.options.config,
|
|
109
|
+
collectionName: `${entityStorageConfig.options.tablePrefix ?? ""}${instanceName}`
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
else if (type === EntityStorageConnectorType.ScyllaDb) {
|
|
114
|
+
entityStorageConnector = new ScyllaDBTableConnector({
|
|
115
|
+
entitySchema: schema,
|
|
116
|
+
partitionContextIds,
|
|
117
|
+
...entityStorageConfig.options,
|
|
118
|
+
config: {
|
|
119
|
+
...entityStorageConfig.options.config,
|
|
120
|
+
tableName: `${entityStorageConfig.options.tablePrefix ?? ""}${instanceName}`
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
else if (type === EntityStorageConnectorType.MySqlDb) {
|
|
125
|
+
entityStorageConnector = new MySqlEntityStorageConnector({
|
|
126
|
+
entitySchema: schema,
|
|
127
|
+
partitionContextIds,
|
|
128
|
+
...entityStorageConfig.options,
|
|
129
|
+
config: {
|
|
130
|
+
...entityStorageConfig.options.config,
|
|
131
|
+
tableName: `${entityStorageConfig.options.tablePrefix ?? ""}${instanceName}`
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
else if (type === EntityStorageConnectorType.MongoDb) {
|
|
136
|
+
entityStorageConnector = new MongoDbEntityStorageConnector({
|
|
137
|
+
entitySchema: schema,
|
|
138
|
+
partitionContextIds,
|
|
139
|
+
...entityStorageConfig.options,
|
|
140
|
+
config: {
|
|
141
|
+
...entityStorageConfig.options.config,
|
|
142
|
+
collection: `${entityStorageConfig.options.tablePrefix ?? ""}${instanceName}`
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
else if (type === EntityStorageConnectorType.PostgreSql) {
|
|
147
|
+
entityStorageConnector = new PostgreSqlEntityStorageConnector({
|
|
148
|
+
entitySchema: schema,
|
|
149
|
+
partitionContextIds,
|
|
150
|
+
...entityStorageConfig.options,
|
|
151
|
+
config: {
|
|
152
|
+
...entityStorageConfig.options.config,
|
|
153
|
+
tableName: `${entityStorageConfig.options.tablePrefix ?? ""}${instanceName}`
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
else if (type === EntityStorageConnectorType.Synchronised) {
|
|
158
|
+
// Create the entity storage that is wrapped by the synchronised connector
|
|
159
|
+
// by removing the custom type it will default to the standard storage
|
|
160
|
+
// mechanism for entity storage
|
|
161
|
+
const wrappedInstanceName = initialiseEntityStorageConnector(engineCore, context, undefined, schema, partitionContextIds);
|
|
162
|
+
// Use the wrapped instance name as the entity storage connector type
|
|
163
|
+
// for the synchronised connector
|
|
164
|
+
entityStorageConnector = new SynchronisedEntityStorageConnector({
|
|
165
|
+
entitySchema: schema,
|
|
166
|
+
...entityStorageConfig.options,
|
|
167
|
+
entityStorageConnectorType: wrappedInstanceName,
|
|
168
|
+
eventBusComponentType: engineCore.getRegisteredInstanceType("eventBusComponent"),
|
|
169
|
+
config: {
|
|
170
|
+
...entityStorageConfig.options.config
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
throw new GeneralError("engineTypes", "connectorUnknownType", {
|
|
176
|
+
type,
|
|
177
|
+
connectorType: "entityStorageConnector"
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
context.componentInstances.push({
|
|
181
|
+
instanceType: instanceName,
|
|
182
|
+
component: entityStorageConnector,
|
|
183
|
+
started: false
|
|
184
|
+
});
|
|
185
|
+
EntityStorageConnectorFactory.register(instanceName, () => entityStorageConnector);
|
|
186
|
+
}
|
|
187
|
+
return instanceName;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Initialise the entity storage connector.
|
|
191
|
+
* @param engineCore The engine core.
|
|
192
|
+
* @param context The context for the engine.
|
|
193
|
+
* @param instanceConfig The instance config.
|
|
194
|
+
* @returns The instance created and the factory for it.
|
|
195
|
+
*/
|
|
196
|
+
export async function initialiseEntityStorageComponent(engineCore, context, instanceConfig) {
|
|
197
|
+
let component;
|
|
198
|
+
let instanceType;
|
|
199
|
+
if (instanceConfig.type === EntityStorageComponentType.Service) {
|
|
200
|
+
const kebabName = StringHelper.kebabCase(instanceConfig.options.entityStorageType);
|
|
201
|
+
// See if there is a custom entity storage for this type, otherwise just use the default one.
|
|
202
|
+
const hasCustom = context.config.types.entityStorageConnector?.some(c => c.type === kebabName || c.overrideInstanceType === kebabName);
|
|
203
|
+
initialiseEntityStorageConnector(engineCore, context, hasCustom ? kebabName : undefined, instanceConfig.options.entityStorageType, instanceConfig.options.partitionContextIds);
|
|
204
|
+
component = new EntityStorageService({
|
|
205
|
+
entityStorageType: kebabName,
|
|
206
|
+
config: {
|
|
207
|
+
...instanceConfig.options.config
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
instanceType = StringHelper.kebabCase(instanceConfig.options.entityStorageType);
|
|
211
|
+
}
|
|
212
|
+
else if (instanceConfig.type === EntityStorageComponentType.RestClient) {
|
|
213
|
+
const kebabName = StringHelper.kebabCase(instanceConfig.options.entityStorageType);
|
|
214
|
+
component = new EntityStorageRestClient({
|
|
215
|
+
pathPrefix: kebabName,
|
|
216
|
+
...instanceConfig.options
|
|
217
|
+
});
|
|
218
|
+
instanceType = `${"entity-storage-rest-client"}-${kebabName}`;
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
component,
|
|
222
|
+
instanceType,
|
|
223
|
+
factory: ComponentFactory
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=entityStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entityStorage.js","sourceRoot":"","sources":["../../../src/components/entityStorage.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACN,gBAAgB,EAChB,YAAY,EACZ,IAAI,EACJ,EAAE,EACF,YAAY,EAEZ,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,0BAA0B,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cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,GAAG,GAAG,4BAAwC,IAAI,SAAS,EAAE,CAAC;IAC3E,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport path from \"node:path\";\nimport {\n\tComponentFactory,\n\tGeneralError,\n\tI18n,\n\tIs,\n\tStringHelper,\n\ttype IComponent\n} from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { CosmosDbEntityStorageConnector } from \"@twin.org/entity-storage-connector-cosmosdb\";\nimport { DynamoDbEntityStorageConnector } from \"@twin.org/entity-storage-connector-dynamodb\";\nimport { FileEntityStorageConnector } from \"@twin.org/entity-storage-connector-file\";\nimport { FirestoreEntityStorageConnector } from \"@twin.org/entity-storage-connector-gcp-firestore\";\nimport { MemoryEntityStorageConnector } from \"@twin.org/entity-storage-connector-memory\";\nimport { MongoDbEntityStorageConnector } from \"@twin.org/entity-storage-connector-mongodb\";\nimport { MySqlEntityStorageConnector } from \"@twin.org/entity-storage-connector-mysql\";\nimport { PostgreSqlEntityStorageConnector } from \"@twin.org/entity-storage-connector-postgresql\";\nimport { ScyllaDBTableConnector } from \"@twin.org/entity-storage-connector-scylladb\";\nimport { SynchronisedEntityStorageConnector } from \"@twin.org/entity-storage-connector-synchronised\";\nimport {\n\tEntityStorageConnectorFactory,\n\ttype IEntityStorageComponent,\n\ttype IEntityStorageConnector\n} from \"@twin.org/entity-storage-models\";\nimport { EntityStorageRestClient } from \"@twin.org/entity-storage-rest-client\";\nimport { EntityStorageService } from \"@twin.org/entity-storage-service\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport type { EntityStorageComponentConfig } from \"../models/config/entityStorageComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { EntityStorageComponentType } from \"../models/types/entityStorageComponentType.js\";\nimport { EntityStorageConnectorType } from \"../models/types/entityStorageConnectorType.js\";\n\n/**\n * Initialise the entity storage connector.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param typeCustom Override the type of connector to use instead of default configuration.\n * @param schema The schema for the entity storage.\n * @param partitionContextIds The context IDs to use for partitioning the data.\n * @returns The name of the instance type that was created.\n * @throws GeneralError when the configuration is invalid.\n */\nexport function initialiseEntityStorageConnector(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\ttypeCustom: string | undefined,\n\tschema: string,\n\tpartitionContextIds: string[]\n): string {\n\tconst instanceName = StringHelper.kebabCase(schema);\n\n\tif (!EntityStorageConnectorFactory.hasName(instanceName)) {\n\t\tlet entityStorageConfig;\n\n\t\tif (Is.stringValue(typeCustom)) {\n\t\t\t// A custom type has been specified, so look it up\n\t\t\tentityStorageConfig = context.config.types.entityStorageConnector?.find(\n\t\t\t\tc => c.type === typeCustom || c.overrideInstanceType === typeCustom\n\t\t\t);\n\t\t\tif (Is.empty(entityStorageConfig)) {\n\t\t\t\tthrow new GeneralError(\"engineTypes\", \"entityStorageCustomMissing\", {\n\t\t\t\t\ttypeCustom,\n\t\t\t\t\tstorageName: instanceName\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\t// The default entity storage method is either the one with the isDefault flag set\n\t\t\t// or pick the first one if no default is set.\n\t\t\tentityStorageConfig =\n\t\t\t\tcontext.config.types.entityStorageConnector?.find(c => c.isDefault ?? false) ??\n\t\t\t\tcontext.config.types.entityStorageConnector?.[0];\n\t\t\tif (Is.empty(entityStorageConfig)) {\n\t\t\t\tthrow new GeneralError(\"engineTypes\", \"entityStorageMissing\", {\n\t\t\t\t\tstorageName: instanceName\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tconst type = entityStorageConfig.type;\n\t\tlet entityStorageConnector: IEntityStorageConnector;\n\n\t\tengineCore.logInfo(\n\t\t\tI18n.formatMessage(\"info.engineTypes.configuringEntityStorage\", {\n\t\t\t\telement: \"Entity Storage\",\n\t\t\t\tstorageName: instanceName,\n\t\t\t\tstorageType: type\n\t\t\t})\n\t\t);\n\n\t\tif (type === EntityStorageConnectorType.Memory) {\n\t\t\tentityStorageConnector = new MemoryEntityStorageConnector({\n\t\t\t\tentitySchema: schema,\n\t\t\t\tpartitionContextIds\n\t\t\t});\n\t\t} else if (type === EntityStorageConnectorType.File) {\n\t\t\tentityStorageConnector = new FileEntityStorageConnector({\n\t\t\t\tentitySchema: schema,\n\t\t\t\tpartitionContextIds,\n\t\t\t\t...entityStorageConfig.options,\n\t\t\t\tconfig: {\n\t\t\t\t\t...entityStorageConfig.options.config,\n\t\t\t\t\tdirectory: path.join(\n\t\t\t\t\t\tentityStorageConfig.options.config.directory,\n\t\t\t\t\t\t`${entityStorageConfig.options.folderPrefix ?? \"\"}${instanceName}`\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (type === EntityStorageConnectorType.AwsDynamoDb) {\n\t\t\tentityStorageConnector = new DynamoDbEntityStorageConnector({\n\t\t\t\tentitySchema: schema,\n\t\t\t\tpartitionContextIds,\n\t\t\t\t...entityStorageConfig.options,\n\t\t\t\tconfig: {\n\t\t\t\t\t...entityStorageConfig.options.config,\n\t\t\t\t\ttableName: `${entityStorageConfig.options.tablePrefix ?? \"\"}${instanceName}`\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (type === EntityStorageConnectorType.AzureCosmosDb) {\n\t\t\tentityStorageConnector = new CosmosDbEntityStorageConnector({\n\t\t\t\tentitySchema: schema,\n\t\t\t\tpartitionContextIds,\n\t\t\t\t...entityStorageConfig.options,\n\t\t\t\tconfig: {\n\t\t\t\t\t...entityStorageConfig.options.config,\n\t\t\t\t\tcontainerId: `${entityStorageConfig.options.tablePrefix ?? \"\"}${instanceName}`\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (type === EntityStorageConnectorType.GcpFirestoreDb) {\n\t\t\tentityStorageConnector = new FirestoreEntityStorageConnector({\n\t\t\t\tentitySchema: schema,\n\t\t\t\tpartitionContextIds,\n\t\t\t\t...entityStorageConfig.options,\n\t\t\t\tconfig: {\n\t\t\t\t\t...entityStorageConfig.options.config,\n\t\t\t\t\tcollectionName: `${entityStorageConfig.options.tablePrefix ?? \"\"}${instanceName}`\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (type === EntityStorageConnectorType.ScyllaDb) {\n\t\t\tentityStorageConnector = new ScyllaDBTableConnector({\n\t\t\t\tentitySchema: schema,\n\t\t\t\tpartitionContextIds,\n\t\t\t\t...entityStorageConfig.options,\n\t\t\t\tconfig: {\n\t\t\t\t\t...entityStorageConfig.options.config,\n\t\t\t\t\ttableName: `${entityStorageConfig.options.tablePrefix ?? \"\"}${instanceName}`\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (type === EntityStorageConnectorType.MySqlDb) {\n\t\t\tentityStorageConnector = new MySqlEntityStorageConnector({\n\t\t\t\tentitySchema: schema,\n\t\t\t\tpartitionContextIds,\n\t\t\t\t...entityStorageConfig.options,\n\t\t\t\tconfig: {\n\t\t\t\t\t...entityStorageConfig.options.config,\n\t\t\t\t\ttableName: `${entityStorageConfig.options.tablePrefix ?? \"\"}${instanceName}`\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (type === EntityStorageConnectorType.MongoDb) {\n\t\t\tentityStorageConnector = new MongoDbEntityStorageConnector({\n\t\t\t\tentitySchema: schema,\n\t\t\t\tpartitionContextIds,\n\t\t\t\t...entityStorageConfig.options,\n\t\t\t\tconfig: {\n\t\t\t\t\t...entityStorageConfig.options.config,\n\t\t\t\t\tcollection: `${entityStorageConfig.options.tablePrefix ?? \"\"}${instanceName}`\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (type === EntityStorageConnectorType.PostgreSql) {\n\t\t\tentityStorageConnector = new PostgreSqlEntityStorageConnector({\n\t\t\t\tentitySchema: schema,\n\t\t\t\tpartitionContextIds,\n\t\t\t\t...entityStorageConfig.options,\n\t\t\t\tconfig: {\n\t\t\t\t\t...entityStorageConfig.options.config,\n\t\t\t\t\ttableName: `${entityStorageConfig.options.tablePrefix ?? \"\"}${instanceName}`\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (type === EntityStorageConnectorType.Synchronised) {\n\t\t\t// Create the entity storage that is wrapped by the synchronised connector\n\t\t\t// by removing the custom type it will default to the standard storage\n\t\t\t// mechanism for entity storage\n\t\t\tconst wrappedInstanceName = initialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tundefined,\n\t\t\t\tschema,\n\t\t\t\tpartitionContextIds\n\t\t\t);\n\n\t\t\t// Use the wrapped instance name as the entity storage connector type\n\t\t\t// for the synchronised connector\n\t\t\tentityStorageConnector = new SynchronisedEntityStorageConnector({\n\t\t\t\tentitySchema: schema,\n\t\t\t\t...entityStorageConfig.options,\n\t\t\t\tentityStorageConnectorType: wrappedInstanceName,\n\t\t\t\teventBusComponentType: engineCore.getRegisteredInstanceType(\"eventBusComponent\"),\n\t\t\t\tconfig: {\n\t\t\t\t\t...entityStorageConfig.options.config\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tthrow new GeneralError(\"engineTypes\", \"connectorUnknownType\", {\n\t\t\t\ttype,\n\t\t\t\tconnectorType: \"entityStorageConnector\"\n\t\t\t});\n\t\t}\n\n\t\tcontext.componentInstances.push({\n\t\t\tinstanceType: instanceName,\n\t\t\tcomponent: entityStorageConnector,\n\t\t\tstarted: false\n\t\t});\n\t\tEntityStorageConnectorFactory.register(instanceName, () => entityStorageConnector);\n\t}\n\n\treturn instanceName;\n}\n\n/**\n * Initialise the entity storage connector.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseEntityStorageComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: EntityStorageComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof ComponentFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IEntityStorageComponent | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === EntityStorageComponentType.Service) {\n\t\tconst kebabName = StringHelper.kebabCase(instanceConfig.options.entityStorageType);\n\n\t\t// See if there is a custom entity storage for this type, otherwise just use the default one.\n\t\tconst hasCustom = context.config.types.entityStorageConnector?.some(\n\t\t\tc => c.type === kebabName || c.overrideInstanceType === kebabName\n\t\t);\n\n\t\tinitialiseEntityStorageConnector(\n\t\t\tengineCore,\n\t\t\tcontext,\n\t\t\thasCustom ? kebabName : undefined,\n\t\t\tinstanceConfig.options.entityStorageType,\n\t\t\tinstanceConfig.options.partitionContextIds\n\t\t);\n\t\tcomponent = new EntityStorageService({\n\t\t\tentityStorageType: kebabName,\n\t\t\tconfig: {\n\t\t\t\t...instanceConfig.options.config\n\t\t\t}\n\t\t});\n\t\tinstanceType = StringHelper.kebabCase(instanceConfig.options.entityStorageType);\n\t} else if (instanceConfig.type === EntityStorageComponentType.RestClient) {\n\t\tconst kebabName = StringHelper.kebabCase(instanceConfig.options.entityStorageType);\n\t\tcomponent = new EntityStorageRestClient({\n\t\t\tpathPrefix: kebabName,\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = `${nameofKebabCase(EntityStorageRestClient)}-${kebabName}`;\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { ComponentFactory } from "@twin.org/core";
|
|
4
|
+
import { LocalEventBusConnector } from "@twin.org/event-bus-connector-local";
|
|
5
|
+
import { EventBusConnectorFactory } from "@twin.org/event-bus-models";
|
|
6
|
+
import { EventBusService } from "@twin.org/event-bus-service";
|
|
7
|
+
import { EventBusSocketClient } from "@twin.org/event-bus-socket-client";
|
|
8
|
+
import { EventBusComponentType } from "../models/types/eventBusComponentType.js";
|
|
9
|
+
import { EventBusConnectorType } from "../models/types/eventBusConnectorType.js";
|
|
10
|
+
/**
|
|
11
|
+
* Initialise a event bus connector.
|
|
12
|
+
* @param engineCore The engine core.
|
|
13
|
+
* @param context The context for the engine.
|
|
14
|
+
* @param instanceConfig The instance config.
|
|
15
|
+
* @returns The instance created and the factory for it.
|
|
16
|
+
*/
|
|
17
|
+
export async function initialiseEventBusConnector(engineCore, context, instanceConfig) {
|
|
18
|
+
let connector;
|
|
19
|
+
let instanceType;
|
|
20
|
+
if (instanceConfig.type === EventBusConnectorType.Local) {
|
|
21
|
+
connector = new LocalEventBusConnector({
|
|
22
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
23
|
+
...instanceConfig.options
|
|
24
|
+
});
|
|
25
|
+
instanceType = LocalEventBusConnector.NAMESPACE;
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
instanceType,
|
|
29
|
+
factory: EventBusConnectorFactory,
|
|
30
|
+
component: connector
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Initialise the event bus component.
|
|
35
|
+
* @param engineCore The engine core.
|
|
36
|
+
* @param context The context for the engine.
|
|
37
|
+
* @param instanceConfig The instance config.
|
|
38
|
+
* @returns The instance created and the factory for it.
|
|
39
|
+
*/
|
|
40
|
+
export async function initialiseEventBusComponent(engineCore, context, instanceConfig) {
|
|
41
|
+
let component;
|
|
42
|
+
let instanceType;
|
|
43
|
+
if (instanceConfig.type === EventBusComponentType.Service) {
|
|
44
|
+
component = new EventBusService({
|
|
45
|
+
eventBusConnectorType: engineCore.getRegisteredInstanceType("eventBusConnector"),
|
|
46
|
+
...instanceConfig.options
|
|
47
|
+
});
|
|
48
|
+
instanceType = "event-bus-service";
|
|
49
|
+
}
|
|
50
|
+
else if (instanceConfig.type === EventBusComponentType.SocketClient) {
|
|
51
|
+
component = new EventBusSocketClient({
|
|
52
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
53
|
+
...instanceConfig.options
|
|
54
|
+
});
|
|
55
|
+
instanceType = "event-bus-socket-client";
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
instanceType,
|
|
59
|
+
factory: ComponentFactory,
|
|
60
|
+
component
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=eventBus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventBus.js","sourceRoot":"","sources":["../../../src/components/eventBus.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EACN,wBAAwB,EAGxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAKzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAChD,UAAsC,EACtC,OAA0C,EAC1C,cAAuC;IAMvC,IAAI,SAAyC,CAAC;IAC9C,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,qBAAqB,CAAC,KAAK,EAAE,CAAC;QACzD,SAAS,GAAG,IAAI,sBAAsB,CAAC;YACtC,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,GAAG,sBAAsB,CAAC,SAAS,CAAC;IACjD,CAAC;IAED,OAAO;QACN,YAAY;QACZ,OAAO,EAAE,wBAAwB;QACjC,SAAS,EAAE,SAAS;KACpB,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAChD,UAAsC,EACtC,OAA0C,EAC1C,cAAuC;IAMvC,IAAI,SAAyC,CAAC;IAC9C,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,qBAAqB,CAAC,OAAO,EAAE,CAAC;QAC3D,SAAS,GAAG,IAAI,eAAe,CAAC;YAC/B,qBAAqB,EAAE,UAAU,CAAC,yBAAyB,CAAC,mBAAmB,CAAC;YAChF,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,sBAAmC,CAAC;IACjD,CAAC;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,qBAAqB,CAAC,YAAY,EAAE,CAAC;QACvE,SAAS,GAAG,IAAI,oBAAoB,CAAC;YACpC,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,4BAAwC,CAAC;IACtD,CAAC;IAED,OAAO;QACN,YAAY;QACZ,OAAO,EAAE,gBAAgB;QACzB,SAAS;KACT,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { LocalEventBusConnector } from \"@twin.org/event-bus-connector-local\";\nimport {\n\tEventBusConnectorFactory,\n\ttype IEventBusComponent,\n\ttype IEventBusConnector\n} from \"@twin.org/event-bus-models\";\nimport { EventBusService } from \"@twin.org/event-bus-service\";\nimport { EventBusSocketClient } from \"@twin.org/event-bus-socket-client\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport type { EventBusComponentConfig } from \"../models/config/eventBusComponentConfig.js\";\nimport type { EventBusConnectorConfig } from \"../models/config/eventBusConnectorConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { EventBusComponentType } from \"../models/types/eventBusComponentType.js\";\nimport { EventBusConnectorType } from \"../models/types/eventBusConnectorType.js\";\n\n/**\n * Initialise a event bus connector.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseEventBusConnector(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: EventBusConnectorConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof EventBusConnectorFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet connector: IEventBusConnector | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === EventBusConnectorType.Local) {\n\t\tconnector = new LocalEventBusConnector({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = LocalEventBusConnector.NAMESPACE;\n\t}\n\n\treturn {\n\t\tinstanceType,\n\t\tfactory: EventBusConnectorFactory,\n\t\tcomponent: connector\n\t};\n}\n\n/**\n * Initialise the event bus component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseEventBusComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: EventBusComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof ComponentFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IEventBusComponent | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === EventBusComponentType.Service) {\n\t\tcomponent = new EventBusService({\n\t\t\teventBusConnectorType: engineCore.getRegisteredInstanceType(\"eventBusConnector\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(EventBusService);\n\t} else if (instanceConfig.type === EventBusComponentType.SocketClient) {\n\t\tcomponent = new EventBusSocketClient({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(EventBusSocketClient);\n\t}\n\n\treturn {\n\t\tinstanceType,\n\t\tfactory: ComponentFactory,\n\t\tcomponent\n\t};\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { EntityStorageFaucetConnector, initSchema as initSchemaWallet } from "@twin.org/wallet-connector-entity-storage";
|
|
2
|
+
import { IotaFaucetConnector } from "@twin.org/wallet-connector-iota";
|
|
3
|
+
import { FaucetConnectorFactory } from "@twin.org/wallet-models";
|
|
4
|
+
import { initialiseEntityStorageConnector } from "./entityStorage.js";
|
|
5
|
+
import { DltConfigType } from "../models/types/dltConfigType.js";
|
|
6
|
+
import { FaucetConnectorType } from "../models/types/faucetConnectorType.js";
|
|
7
|
+
import { EngineTypeHelper } from "../utils/engineTypeHelper.js";
|
|
8
|
+
/**
|
|
9
|
+
* Initialise a faucet connector.
|
|
10
|
+
* @param engineCore The engine core.
|
|
11
|
+
* @param context The context for the engine.
|
|
12
|
+
* @param instanceConfig The instance config.
|
|
13
|
+
* @returns The instance created and the factory for it.
|
|
14
|
+
*/
|
|
15
|
+
export async function initialiseFaucetConnector(engineCore, context, instanceConfig) {
|
|
16
|
+
let component;
|
|
17
|
+
let instanceType;
|
|
18
|
+
if (instanceConfig.type === FaucetConnectorType.Iota) {
|
|
19
|
+
const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
|
|
20
|
+
component = new IotaFaucetConnector({
|
|
21
|
+
...instanceConfig.options,
|
|
22
|
+
config: {
|
|
23
|
+
...dltConfig?.options?.config,
|
|
24
|
+
...instanceConfig.options.config
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
instanceType = IotaFaucetConnector.NAMESPACE;
|
|
28
|
+
}
|
|
29
|
+
else if (instanceConfig.type === FaucetConnectorType.EntityStorage) {
|
|
30
|
+
initSchemaWallet();
|
|
31
|
+
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.walletAddressEntityStorageType, "WalletAddress", []);
|
|
32
|
+
component = new EntityStorageFaucetConnector(instanceConfig.options);
|
|
33
|
+
instanceType = EntityStorageFaucetConnector.NAMESPACE;
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
component,
|
|
37
|
+
instanceType,
|
|
38
|
+
factory: FaucetConnectorFactory
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=faucet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"faucet.js","sourceRoot":"","sources":["../../../src/components/faucet.ts"],"names":[],"mappings":"AAKA,OAAO,EACN,4BAA4B,EAC5B,UAAU,IAAI,gBAAgB,EAE9B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAyB,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAItE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC9C,UAAsC,EACtC,OAA0C,EAC1C,cAAqC;IAMrC,IAAI,SAAuC,CAAC;IAC5C,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,mBAAmB,CAAC,IAAI,EAAE,CAAC;QACtD,MAAM,SAAS,GAAG,gBAAgB,CAAC,eAAe,CACjD,UAAU,CAAC,SAAS,EAAE,EACtB,WAAW,EACX,aAAa,CAAC,IAAI,CAClB,CAAC;QACF,SAAS,GAAG,IAAI,mBAAmB,CAAC;YACnC,GAAG,cAAc,CAAC,OAAO;YACzB,MAAM,EAAE;gBACP,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM;gBAC7B,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM;aAChC;SACD,CAAC,CAAC;QACH,YAAY,GAAG,mBAAmB,CAAC,SAAS,CAAC;IAC9C,CAAC;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,mBAAmB,CAAC,aAAa,EAAE,CAAC;QACtE,gBAAgB,EAAE,CAAC;QACnB,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,cAAc,CAAC,OAAO,EAAE,8BAA8B,mBAEtD,EAAE,CACF,CAAC;QAEF,SAAS,GAAG,IAAI,4BAA4B,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACrE,YAAY,GAAG,4BAA4B,CAAC,SAAS,CAAC;IACvD,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,sBAAsB;KAC/B,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tEntityStorageFaucetConnector,\n\tinitSchema as initSchemaWallet,\n\ttype WalletAddress\n} from \"@twin.org/wallet-connector-entity-storage\";\nimport { IotaFaucetConnector } from \"@twin.org/wallet-connector-iota\";\nimport { FaucetConnectorFactory, type IFaucetConnector } from \"@twin.org/wallet-models\";\nimport { initialiseEntityStorageConnector } from \"./entityStorage.js\";\nimport type { DltConfig } from \"../models/config/dltConfig.js\";\nimport type { FaucetConnectorConfig } from \"../models/config/faucetConnectorConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { DltConfigType } from \"../models/types/dltConfigType.js\";\nimport { FaucetConnectorType } from \"../models/types/faucetConnectorType.js\";\nimport { EngineTypeHelper } from \"../utils/engineTypeHelper.js\";\n\n/**\n * Initialise a faucet connector.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseFaucetConnector(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: FaucetConnectorConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof FaucetConnectorFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IFaucetConnector | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === FaucetConnectorType.Iota) {\n\t\tconst dltConfig = EngineTypeHelper.getConfigOfType<DltConfig>(\n\t\t\tengineCore.getConfig(),\n\t\t\t\"dltConfig\",\n\t\t\tDltConfigType.Iota\n\t\t);\n\t\tcomponent = new IotaFaucetConnector({\n\t\t\t...instanceConfig.options,\n\t\t\tconfig: {\n\t\t\t\t...dltConfig?.options?.config,\n\t\t\t\t...instanceConfig.options.config\n\t\t\t}\n\t\t});\n\t\tinstanceType = IotaFaucetConnector.NAMESPACE;\n\t} else if (instanceConfig.type === FaucetConnectorType.EntityStorage) {\n\t\tinitSchemaWallet();\n\t\tinitialiseEntityStorageConnector(\n\t\t\tengineCore,\n\t\t\tcontext,\n\t\t\tinstanceConfig.options?.walletAddressEntityStorageType,\n\t\t\tnameof<WalletAddress>(),\n\t\t\t[]\n\t\t);\n\n\t\tcomponent = new EntityStorageFaucetConnector(instanceConfig.options);\n\t\tinstanceType = EntityStorageFaucetConnector.NAMESPACE;\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: FaucetConnectorFactory\n\t};\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { ContextIdHelper, ContextIdKeys } from "@twin.org/context";
|
|
4
|
+
import { ComponentFactory } from "@twin.org/core";
|
|
5
|
+
import { FederatedCatalogueRestClient } from "@twin.org/federated-catalogue-rest-client";
|
|
6
|
+
import { FederatedCatalogueService, initSchema as initSchemaFederatedCatalogue } from "@twin.org/federated-catalogue-service";
|
|
7
|
+
import { initialiseEntityStorageConnector } from "./entityStorage.js";
|
|
8
|
+
import { FederatedCatalogueComponentType } from "../models/types/federatedCatalogueComponentType.js";
|
|
9
|
+
/**
|
|
10
|
+
* Initialise the federated catalogue component.
|
|
11
|
+
* @param engineCore The engine core.
|
|
12
|
+
* @param context The context for the engine.
|
|
13
|
+
* @param instanceConfig The instance config.
|
|
14
|
+
* @returns The instance created and the factory for it.
|
|
15
|
+
*/
|
|
16
|
+
export async function initialiseFederatedCatalogueComponent(engineCore, context, instanceConfig) {
|
|
17
|
+
let component;
|
|
18
|
+
let instanceType;
|
|
19
|
+
if (instanceConfig.type === FederatedCatalogueComponentType.Service) {
|
|
20
|
+
initSchemaFederatedCatalogue();
|
|
21
|
+
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.dataResourceEntityStorageType, "DataResourceEntry", ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node]));
|
|
22
|
+
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.participantEntityStorageType, "ParticipantEntry", ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node]));
|
|
23
|
+
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.serviceOfferingEntityStorageType, "ServiceOfferingEntry", ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node]));
|
|
24
|
+
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.dataSpaceConnectorStorageType, "DataSpaceConnectorEntry", ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node]));
|
|
25
|
+
component = new FederatedCatalogueService({
|
|
26
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
27
|
+
identityResolverComponentType: engineCore.getRegisteredInstanceType("identityResolverComponent"),
|
|
28
|
+
...instanceConfig.options
|
|
29
|
+
});
|
|
30
|
+
instanceType = "federated-catalogue-service";
|
|
31
|
+
}
|
|
32
|
+
else if (instanceConfig.type === FederatedCatalogueComponentType.RestClient) {
|
|
33
|
+
component = new FederatedCatalogueRestClient(instanceConfig.options);
|
|
34
|
+
instanceType = "federated-catalogue-rest-client";
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
component,
|
|
38
|
+
instanceType,
|
|
39
|
+
factory: ComponentFactory
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=federatedCatalogue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"federatedCatalogue.js","sourceRoot":"","sources":["../../../src/components/federatedCatalogue.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAGnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACzF,OAAO,EAGN,yBAAyB,EACzB,UAAU,IAAI,4BAA4B,EAG1C,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAGtE,OAAO,EAAE,+BAA+B,EAAE,MAAM,oDAAoD,CAAC;AAErG;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,qCAAqC,CAC1D,UAAsC,EACtC,OAA0C,EAC1C,cA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;QAC/E,SAAS,GAAG,IAAI,4BAA4B,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACrE,YAAY,oCAAgD,CAAC;IAC9D,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport type { IFederatedCatalogueComponent } from \"@twin.org/federated-catalogue-models\";\nimport { FederatedCatalogueRestClient } from \"@twin.org/federated-catalogue-rest-client\";\nimport {\n\ttype DataResourceEntry,\n\ttype DataSpaceConnectorEntry,\n\tFederatedCatalogueService,\n\tinitSchema as initSchemaFederatedCatalogue,\n\ttype ParticipantEntry,\n\ttype ServiceOfferingEntry\n} from \"@twin.org/federated-catalogue-service\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport { initialiseEntityStorageConnector } from \"./entityStorage.js\";\nimport type { FederatedCatalogueComponentConfig } from \"../models/config/federatedCatalogueComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { FederatedCatalogueComponentType } from \"../models/types/federatedCatalogueComponentType.js\";\n\n/**\n * Initialise the federated catalogue component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseFederatedCatalogueComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: FederatedCatalogueComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof ComponentFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IFederatedCatalogueComponent | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === FederatedCatalogueComponentType.Service) {\n\t\tinitSchemaFederatedCatalogue();\n\n\t\tinitialiseEntityStorageConnector(\n\t\t\tengineCore,\n\t\t\tcontext,\n\t\t\tinstanceConfig.options?.dataResourceEntityStorageType,\n\t\t\tnameof<DataResourceEntry>(),\n\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node])\n\t\t);\n\t\tinitialiseEntityStorageConnector(\n\t\t\tengineCore,\n\t\t\tcontext,\n\t\t\tinstanceConfig.options?.participantEntityStorageType,\n\t\t\tnameof<ParticipantEntry>(),\n\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node])\n\t\t);\n\t\tinitialiseEntityStorageConnector(\n\t\t\tengineCore,\n\t\t\tcontext,\n\t\t\tinstanceConfig.options?.serviceOfferingEntityStorageType,\n\t\t\tnameof<ServiceOfferingEntry>(),\n\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node])\n\t\t);\n\t\tinitialiseEntityStorageConnector(\n\t\t\tengineCore,\n\t\t\tcontext,\n\t\t\tinstanceConfig.options?.dataSpaceConnectorStorageType,\n\t\t\tnameof<DataSpaceConnectorEntry>(),\n\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node])\n\t\t);\n\n\t\tcomponent = new FederatedCatalogueService({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\tidentityResolverComponentType: engineCore.getRegisteredInstanceType(\n\t\t\t\t\"identityResolverComponent\"\n\t\t\t),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(FederatedCatalogueService);\n\t} else if (instanceConfig.type === FederatedCatalogueComponentType.RestClient) {\n\t\tcomponent = new FederatedCatalogueRestClient(instanceConfig.options);\n\t\tinstanceType = nameofKebabCase(FederatedCatalogueRestClient);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { ComponentFactory } from "@twin.org/core";
|
|
4
|
+
import { EntityStorageIdentityConnector, initSchema as initSchemaIdentityStorage } from "@twin.org/identity-connector-entity-storage";
|
|
5
|
+
import { IotaIdentityConnector } from "@twin.org/identity-connector-iota";
|
|
6
|
+
import { IdentityConnectorFactory } from "@twin.org/identity-models";
|
|
7
|
+
import { IdentityRestClient } from "@twin.org/identity-rest-client";
|
|
8
|
+
import { IdentityService } from "@twin.org/identity-service";
|
|
9
|
+
import { initialiseEntityStorageConnector } from "./entityStorage.js";
|
|
10
|
+
import { DltConfigType } from "../models/types/dltConfigType.js";
|
|
11
|
+
import { IdentityComponentType } from "../models/types/identityComponentType.js";
|
|
12
|
+
import { IdentityConnectorType } from "../models/types/identityConnectorType.js";
|
|
13
|
+
import { EngineTypeHelper } from "../utils/engineTypeHelper.js";
|
|
14
|
+
/**
|
|
15
|
+
* Initialise the identity connector.
|
|
16
|
+
* @param engineCore The engine core.
|
|
17
|
+
* @param context The context for the engine.
|
|
18
|
+
* @param instanceConfig The instance config.
|
|
19
|
+
* @returns The instance created and the factory for it.
|
|
20
|
+
*/
|
|
21
|
+
export async function initialiseIdentityConnector(engineCore, context, instanceConfig) {
|
|
22
|
+
let component;
|
|
23
|
+
let instanceType;
|
|
24
|
+
if (instanceConfig.type === IdentityConnectorType.Iota) {
|
|
25
|
+
const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
|
|
26
|
+
component = new IotaIdentityConnector({
|
|
27
|
+
vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
|
|
28
|
+
...instanceConfig.options,
|
|
29
|
+
config: {
|
|
30
|
+
...dltConfig?.options?.config,
|
|
31
|
+
...instanceConfig.options.config
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
instanceType = IotaIdentityConnector.NAMESPACE;
|
|
35
|
+
}
|
|
36
|
+
else if (instanceConfig.type === IdentityConnectorType.EntityStorage) {
|
|
37
|
+
initSchemaIdentityStorage({ includeProfile: false });
|
|
38
|
+
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.didDocumentEntityStorageType, "IdentityDocument", []);
|
|
39
|
+
component = new EntityStorageIdentityConnector({
|
|
40
|
+
vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
|
|
41
|
+
...instanceConfig.options
|
|
42
|
+
});
|
|
43
|
+
instanceType = EntityStorageIdentityConnector.NAMESPACE;
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
component,
|
|
47
|
+
instanceType,
|
|
48
|
+
factory: IdentityConnectorFactory
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Initialise the identity component.
|
|
53
|
+
* @param engineCore The engine core.
|
|
54
|
+
* @param context The context for the engine.
|
|
55
|
+
* @param instanceConfig The instance config.
|
|
56
|
+
* @returns The instance created and the factory for it.
|
|
57
|
+
*/
|
|
58
|
+
export async function initialiseIdentityComponent(engineCore, context, instanceConfig) {
|
|
59
|
+
let component;
|
|
60
|
+
let instanceType;
|
|
61
|
+
if (instanceConfig.type === IdentityComponentType.Service) {
|
|
62
|
+
component = new IdentityService(instanceConfig.options);
|
|
63
|
+
instanceType = "identity-service";
|
|
64
|
+
}
|
|
65
|
+
else if (instanceConfig.type === IdentityComponentType.RestClient) {
|
|
66
|
+
component = new IdentityRestClient(instanceConfig.options);
|
|
67
|
+
instanceType = "identity-rest-client";
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
component,
|
|
71
|
+
instanceType,
|
|
72
|
+
factory: ComponentFactory
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 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AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport {\n\tEntityStorageIdentityConnector,\n\tinitSchema as initSchemaIdentityStorage,\n\ttype IdentityDocument\n} from \"@twin.org/identity-connector-entity-storage\";\nimport { IotaIdentityConnector } from \"@twin.org/identity-connector-iota\";\nimport {\n\tIdentityConnectorFactory,\n\ttype IIdentityComponent,\n\ttype IIdentityConnector\n} from \"@twin.org/identity-models\";\nimport { IdentityRestClient } from \"@twin.org/identity-rest-client\";\nimport { IdentityService } from \"@twin.org/identity-service\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport { initialiseEntityStorageConnector } from \"./entityStorage.js\";\nimport type { DltConfig } from \"../models/config/dltConfig.js\";\nimport type { IdentityComponentConfig } from \"../models/config/identityComponentConfig.js\";\nimport type { IdentityConnectorConfig } from \"../models/config/identityConnectorConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { DltConfigType } from \"../models/types/dltConfigType.js\";\nimport { IdentityComponentType } from \"../models/types/identityComponentType.js\";\nimport { IdentityConnectorType } from \"../models/types/identityConnectorType.js\";\nimport { EngineTypeHelper } from \"../utils/engineTypeHelper.js\";\n\n/**\n * Initialise the identity connector.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseIdentityConnector(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: IdentityConnectorConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof IdentityConnectorFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IIdentityConnector | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === IdentityConnectorType.Iota) {\n\t\tconst dltConfig = EngineTypeHelper.getConfigOfType<DltConfig>(\n\t\t\tengineCore.getConfig(),\n\t\t\t\"dltConfig\",\n\t\t\tDltConfigType.Iota\n\t\t);\n\t\tcomponent = new IotaIdentityConnector({\n\t\t\tvaultConnectorType: engineCore.getRegisteredInstanceType(\"vaultConnector\"),\n\t\t\t...instanceConfig.options,\n\t\t\tconfig: {\n\t\t\t\t...dltConfig?.options?.config,\n\t\t\t\t...instanceConfig.options.config\n\t\t\t}\n\t\t});\n\t\tinstanceType = IotaIdentityConnector.NAMESPACE;\n\t} else if (instanceConfig.type === IdentityConnectorType.EntityStorage) {\n\t\tinitSchemaIdentityStorage({ includeProfile: false });\n\t\tinitialiseEntityStorageConnector(\n\t\t\tengineCore,\n\t\t\tcontext,\n\t\t\tinstanceConfig.options?.didDocumentEntityStorageType,\n\t\t\tnameof<IdentityDocument>(),\n\t\t\t[]\n\t\t);\n\t\tcomponent = new EntityStorageIdentityConnector({\n\t\t\tvaultConnectorType: engineCore.getRegisteredInstanceType(\"vaultConnector\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = EntityStorageIdentityConnector.NAMESPACE;\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: IdentityConnectorFactory\n\t};\n}\n\n/**\n * Initialise the identity component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseIdentityComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: IdentityComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof ComponentFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IIdentityComponent | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === IdentityComponentType.Service) {\n\t\tcomponent = new IdentityService(instanceConfig.options);\n\t\tinstanceType = nameofKebabCase(IdentityService);\n\t} else if (instanceConfig.type === IdentityComponentType.RestClient) {\n\t\tcomponent = new IdentityRestClient(instanceConfig.options);\n\t\tinstanceType = nameofKebabCase(IdentityRestClient);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|