@twin.org/engine-types 0.0.2-next.2 → 0.0.2-next.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/dist/cjs/index.cjs +1310 -1098
  2. package/dist/esm/index.mjs +1312 -1124
  3. package/dist/types/components/attestation.d.ts +14 -8
  4. package/dist/types/components/auditableItemGraph.d.ts +7 -4
  5. package/dist/types/components/auditableItemStream.d.ts +7 -4
  6. package/dist/types/components/authenticationGenerator.d.ts +17 -0
  7. package/dist/types/components/backgroundTask.d.ts +8 -4
  8. package/dist/types/components/blobStorage.d.ts +14 -8
  9. package/dist/types/components/dataProcessing.d.ts +20 -12
  10. package/dist/types/components/dataSpaceConnector.d.ts +16 -0
  11. package/dist/types/components/documentManagement.d.ts +7 -4
  12. package/dist/types/components/entityStorage.d.ts +10 -6
  13. package/dist/types/components/eventBus.d.ts +14 -8
  14. package/dist/types/components/faucet.d.ts +8 -4
  15. package/dist/types/components/federatedCatalogue.d.ts +7 -4
  16. package/dist/types/components/identity.d.ts +14 -8
  17. package/dist/types/components/identityProfile.d.ts +14 -8
  18. package/dist/types/components/identityResolver.d.ts +14 -8
  19. package/dist/types/components/immutableProof.d.ts +7 -4
  20. package/dist/types/components/logging.d.ts +14 -8
  21. package/dist/types/components/messaging.d.ts +39 -16
  22. package/dist/types/components/nft.d.ts +14 -8
  23. package/dist/types/components/rightsManagementDap.d.ts +16 -0
  24. package/dist/types/components/rightsManagementDarp.d.ts +16 -0
  25. package/dist/types/components/rightsManagementPap.d.ts +7 -4
  26. package/dist/types/components/rightsManagementPdp.d.ts +16 -0
  27. package/dist/types/components/rightsManagementPep.d.ts +16 -0
  28. package/dist/types/components/rightsManagementPip.d.ts +16 -0
  29. package/dist/types/components/rightsManagementPmp.d.ts +16 -0
  30. package/dist/types/components/rightsManagementPnap.d.ts +16 -0
  31. package/dist/types/components/rightsManagementPnp.d.ts +16 -0
  32. package/dist/types/components/rightsManagementPxp.d.ts +16 -0
  33. package/dist/types/components/synchronisedStorage.d.ts +16 -0
  34. package/dist/types/components/taskScheduler.d.ts +7 -4
  35. package/dist/types/components/telemetry.d.ts +14 -8
  36. package/dist/types/components/vault.d.ts +8 -4
  37. package/dist/types/components/verifiableStorage.d.ts +14 -8
  38. package/dist/types/components/wallet.d.ts +8 -14
  39. package/dist/types/index.d.ts +39 -3
  40. package/dist/types/models/IEngineConfig.d.ts +67 -7
  41. package/dist/types/models/config/authenticationGeneratorComponentConfig.d.ts +9 -0
  42. package/dist/types/models/config/dataSpaceConnectorComponentConfig.d.ts +17 -0
  43. package/dist/types/models/config/entityStorageConnectorConfig.d.ts +4 -0
  44. package/dist/types/models/config/messagingAdminComponentConfig.d.ts +9 -0
  45. package/dist/types/models/config/rightsManagementDapComponentConfig.d.ts +16 -0
  46. package/dist/types/models/config/rightsManagementDarpComponentConfig.d.ts +12 -0
  47. package/dist/types/models/config/rightsManagementPapComponentConfig.d.ts +6 -2
  48. package/dist/types/models/config/rightsManagementPdpComponentConfig.d.ts +12 -0
  49. package/dist/types/models/config/rightsManagementPepComponentConfig.d.ts +12 -0
  50. package/dist/types/models/config/rightsManagementPipComponentConfig.d.ts +12 -0
  51. package/dist/types/models/config/rightsManagementPmpComponentConfig.d.ts +9 -0
  52. package/dist/types/models/config/rightsManagementPnapComponentConfig.d.ts +13 -0
  53. package/dist/types/models/config/rightsManagementPnpComponentConfig.d.ts +17 -0
  54. package/dist/types/models/config/rightsManagementPxpComponentConfig.d.ts +12 -0
  55. package/dist/types/models/config/synchronisedStorageComponentConfig.d.ts +13 -0
  56. package/dist/types/models/types/authenticationGeneratorComponentType.d.ts +13 -0
  57. package/dist/types/models/types/dataSpaceConnectorComponentType.d.ts +21 -0
  58. package/dist/types/models/types/entityStorageConnectorType.d.ts +4 -0
  59. package/dist/types/models/types/messagingAdminComponentType.d.ts +13 -0
  60. package/dist/types/models/types/rightsManagementDapComponentType.d.ts +17 -0
  61. package/dist/types/models/types/rightsManagementDarpComponentType.d.ts +13 -0
  62. package/dist/types/models/types/rightsManagementPapComponentType.d.ts +4 -0
  63. package/dist/types/models/types/rightsManagementPdpComponentType.d.ts +13 -0
  64. package/dist/types/models/types/rightsManagementPepComponentType.d.ts +17 -0
  65. package/dist/types/models/types/rightsManagementPipComponentType.d.ts +13 -0
  66. package/dist/types/models/types/rightsManagementPmpComponentType.d.ts +13 -0
  67. package/dist/types/models/types/rightsManagementPnapComponentType.d.ts +17 -0
  68. package/dist/types/models/types/rightsManagementPnpComponentType.d.ts +17 -0
  69. package/dist/types/models/types/rightsManagementPxpComponentType.d.ts +13 -0
  70. package/dist/types/models/types/synchronisedStorageComponentType.d.ts +17 -0
  71. package/dist/types/utils/engineTypeHelper.d.ts +19 -0
  72. package/docs/changelog.md +261 -0
  73. package/docs/reference/classes/EngineTypeHelper.md +61 -0
  74. package/docs/reference/functions/initialiseAttestationComponent.md +3 -13
  75. package/docs/reference/functions/initialiseAttestationConnector.md +3 -13
  76. package/docs/reference/functions/initialiseAuditableItemGraphComponent.md +3 -13
  77. package/docs/reference/functions/initialiseAuditableItemStreamComponent.md +3 -13
  78. package/docs/reference/functions/initialiseAuthenticationGeneratorComponent.md +31 -0
  79. package/docs/reference/functions/initialiseBackgroundTaskConnector.md +3 -13
  80. package/docs/reference/functions/initialiseBlobStorageComponent.md +3 -13
  81. package/docs/reference/functions/initialiseBlobStorageConnector.md +3 -13
  82. package/docs/reference/functions/initialiseDataConverterConnector.md +3 -13
  83. package/docs/reference/functions/initialiseDataExtractorConnector.md +3 -13
  84. package/docs/reference/functions/initialiseDataProcessingComponent.md +3 -13
  85. package/docs/reference/functions/initialiseDataSpaceConnectorComponent.md +31 -0
  86. package/docs/reference/functions/initialiseDocumentManagementComponent.md +3 -13
  87. package/docs/reference/functions/initialiseEntityStorageComponent.md +3 -13
  88. package/docs/reference/functions/initialiseEntityStorageConnector.md +5 -3
  89. package/docs/reference/functions/initialiseEventBusComponent.md +3 -13
  90. package/docs/reference/functions/initialiseEventBusConnector.md +3 -13
  91. package/docs/reference/functions/initialiseFaucetConnector.md +3 -13
  92. package/docs/reference/functions/initialiseFederatedCatalogueComponent.md +3 -13
  93. package/docs/reference/functions/initialiseIdentityComponent.md +3 -13
  94. package/docs/reference/functions/initialiseIdentityConnector.md +3 -13
  95. package/docs/reference/functions/initialiseIdentityProfileComponent.md +3 -13
  96. package/docs/reference/functions/initialiseIdentityProfileConnector.md +3 -13
  97. package/docs/reference/functions/initialiseIdentityResolverComponent.md +3 -13
  98. package/docs/reference/functions/initialiseIdentityResolverConnector.md +3 -13
  99. package/docs/reference/functions/initialiseImmutableProofComponent.md +3 -13
  100. package/docs/reference/functions/initialiseLoggingComponent.md +3 -13
  101. package/docs/reference/functions/initialiseLoggingConnector.md +3 -13
  102. package/docs/reference/functions/initialiseMessagingAdminComponent.md +31 -0
  103. package/docs/reference/functions/initialiseMessagingComponent.md +3 -13
  104. package/docs/reference/functions/initialiseMessagingEmailConnector.md +3 -13
  105. package/docs/reference/functions/initialiseMessagingPushNotificationConnector.md +3 -13
  106. package/docs/reference/functions/initialiseMessagingSmsConnector.md +3 -13
  107. package/docs/reference/functions/initialiseNftComponent.md +3 -13
  108. package/docs/reference/functions/initialiseNftConnector.md +3 -13
  109. package/docs/reference/functions/initialiseRightsManagementDapComponent.md +31 -0
  110. package/docs/reference/functions/initialiseRightsManagementDarpComponent.md +31 -0
  111. package/docs/reference/functions/initialiseRightsManagementPapComponent.md +3 -13
  112. package/docs/reference/functions/initialiseRightsManagementPdpComponent.md +31 -0
  113. package/docs/reference/functions/initialiseRightsManagementPepComponent.md +31 -0
  114. package/docs/reference/functions/initialiseRightsManagementPipComponent.md +31 -0
  115. package/docs/reference/functions/initialiseRightsManagementPmpComponent.md +31 -0
  116. package/docs/reference/functions/initialiseRightsManagementPnapComponent.md +31 -0
  117. package/docs/reference/functions/initialiseRightsManagementPnpComponent.md +31 -0
  118. package/docs/reference/functions/initialiseRightsManagementPxpComponent.md +31 -0
  119. package/docs/reference/functions/initialiseSynchronisedStorageComponent.md +31 -0
  120. package/docs/reference/functions/initialiseTaskSchedulerComponent.md +3 -13
  121. package/docs/reference/functions/initialiseTelemetryComponent.md +3 -13
  122. package/docs/reference/functions/initialiseTelemetryConnector.md +3 -13
  123. package/docs/reference/functions/initialiseVaultConnector.md +3 -13
  124. package/docs/reference/functions/initialiseVerifiableStorageComponent.md +3 -13
  125. package/docs/reference/functions/initialiseVerifiableStorageConnector.md +3 -13
  126. package/docs/reference/functions/initialiseWalletConnector.md +3 -13
  127. package/docs/reference/index.md +56 -5
  128. package/docs/reference/interfaces/IEngineConfig.md +81 -9
  129. package/docs/reference/type-aliases/AuthenticationGeneratorComponentConfig.md +17 -0
  130. package/docs/reference/type-aliases/AuthenticationGeneratorComponentType.md +5 -0
  131. package/docs/reference/type-aliases/DataSpaceConnectorComponentConfig.md +5 -0
  132. package/docs/reference/type-aliases/DataSpaceConnectorComponentType.md +5 -0
  133. package/docs/reference/type-aliases/EntityStorageConnectorConfig.md +1 -1
  134. package/docs/reference/type-aliases/MessagingAdminComponentConfig.md +17 -0
  135. package/docs/reference/type-aliases/MessagingAdminComponentType.md +5 -0
  136. package/docs/reference/type-aliases/RightsManagementDapComponentConfig.md +5 -0
  137. package/docs/reference/type-aliases/RightsManagementDapComponentType.md +5 -0
  138. package/docs/reference/type-aliases/RightsManagementDarpComponentConfig.md +23 -0
  139. package/docs/reference/type-aliases/RightsManagementDarpComponentType.md +5 -0
  140. package/docs/reference/type-aliases/RightsManagementPapComponentConfig.md +1 -13
  141. package/docs/reference/type-aliases/RightsManagementPdpComponentConfig.md +23 -0
  142. package/docs/reference/type-aliases/RightsManagementPdpComponentType.md +5 -0
  143. package/docs/reference/type-aliases/RightsManagementPepComponentConfig.md +23 -0
  144. package/docs/reference/type-aliases/RightsManagementPepComponentType.md +5 -0
  145. package/docs/reference/type-aliases/RightsManagementPipComponentConfig.md +23 -0
  146. package/docs/reference/type-aliases/RightsManagementPipComponentType.md +5 -0
  147. package/docs/reference/type-aliases/RightsManagementPmpComponentConfig.md +17 -0
  148. package/docs/reference/type-aliases/RightsManagementPmpComponentType.md +5 -0
  149. package/docs/reference/type-aliases/RightsManagementPnapComponentConfig.md +5 -0
  150. package/docs/reference/type-aliases/RightsManagementPnapComponentType.md +5 -0
  151. package/docs/reference/type-aliases/RightsManagementPnpComponentConfig.md +5 -0
  152. package/docs/reference/type-aliases/RightsManagementPnpComponentType.md +5 -0
  153. package/docs/reference/type-aliases/RightsManagementPxpComponentConfig.md +23 -0
  154. package/docs/reference/type-aliases/RightsManagementPxpComponentType.md +5 -0
  155. package/docs/reference/type-aliases/SynchronisedStorageComponentConfig.md +5 -0
  156. package/docs/reference/type-aliases/SynchronisedStorageComponentType.md +5 -0
  157. package/docs/reference/variables/AttestationComponentType.md +1 -1
  158. package/docs/reference/variables/AttestationConnectorType.md +1 -1
  159. package/docs/reference/variables/AuditableItemGraphComponentType.md +1 -1
  160. package/docs/reference/variables/AuditableItemStreamComponentType.md +1 -1
  161. package/docs/reference/variables/AuthenticationGeneratorComponentType.md +13 -0
  162. package/docs/reference/variables/BackgroundTaskConnectorType.md +1 -1
  163. package/docs/reference/variables/BlobStorageComponentType.md +1 -1
  164. package/docs/reference/variables/BlobStorageConnectorType.md +1 -1
  165. package/docs/reference/variables/DataConverterConnectorType.md +1 -1
  166. package/docs/reference/variables/DataExtractorConnectorType.md +1 -1
  167. package/docs/reference/variables/DataProcessingComponentType.md +1 -1
  168. package/docs/reference/variables/DataSpaceConnectorComponentType.md +25 -0
  169. package/docs/reference/variables/DltConfigType.md +1 -1
  170. package/docs/reference/variables/DocumentManagementComponentType.md +1 -1
  171. package/docs/reference/variables/EntityStorageComponentType.md +1 -1
  172. package/docs/reference/variables/EntityStorageConnectorType.md +7 -1
  173. package/docs/reference/variables/EventBusComponentType.md +1 -1
  174. package/docs/reference/variables/EventBusConnectorType.md +1 -1
  175. package/docs/reference/variables/FaucetConnectorType.md +1 -1
  176. package/docs/reference/variables/FederatedCatalogueComponentType.md +1 -1
  177. package/docs/reference/variables/IdentityComponentType.md +1 -1
  178. package/docs/reference/variables/IdentityConnectorType.md +1 -1
  179. package/docs/reference/variables/IdentityProfileComponentType.md +1 -1
  180. package/docs/reference/variables/IdentityProfileConnectorType.md +1 -1
  181. package/docs/reference/variables/IdentityResolverComponentType.md +1 -1
  182. package/docs/reference/variables/IdentityResolverConnectorType.md +1 -1
  183. package/docs/reference/variables/ImmutableProofComponentType.md +1 -1
  184. package/docs/reference/variables/LoggingComponentType.md +1 -1
  185. package/docs/reference/variables/LoggingConnectorType.md +1 -1
  186. package/docs/reference/variables/MessagingAdminComponentType.md +13 -0
  187. package/docs/reference/variables/MessagingComponentType.md +1 -1
  188. package/docs/reference/variables/MessagingEmailConnectorType.md +1 -1
  189. package/docs/reference/variables/MessagingPushNotificationConnectorType.md +1 -1
  190. package/docs/reference/variables/MessagingSmsConnectorType.md +1 -1
  191. package/docs/reference/variables/NftComponentType.md +1 -1
  192. package/docs/reference/variables/NftConnectorType.md +1 -1
  193. package/docs/reference/variables/RightsManagementDapComponentType.md +19 -0
  194. package/docs/reference/variables/RightsManagementDarpComponentType.md +13 -0
  195. package/docs/reference/variables/RightsManagementPapComponentType.md +7 -1
  196. package/docs/reference/variables/RightsManagementPdpComponentType.md +13 -0
  197. package/docs/reference/variables/RightsManagementPepComponentType.md +19 -0
  198. package/docs/reference/variables/RightsManagementPipComponentType.md +13 -0
  199. package/docs/reference/variables/RightsManagementPmpComponentType.md +13 -0
  200. package/docs/reference/variables/RightsManagementPnapComponentType.md +19 -0
  201. package/docs/reference/variables/RightsManagementPnpComponentType.md +19 -0
  202. package/docs/reference/variables/RightsManagementPxpComponentType.md +13 -0
  203. package/docs/reference/variables/{RightsManagementComponentType.md → SynchronisedStorageComponentType.md} +4 -4
  204. package/docs/reference/variables/TaskSchedulerComponentType.md +1 -1
  205. package/docs/reference/variables/TelemetryComponentType.md +1 -1
  206. package/docs/reference/variables/TelemetryConnectorType.md +1 -1
  207. package/docs/reference/variables/VaultConnectorType.md +1 -1
  208. package/docs/reference/variables/VerifiableStorageComponentType.md +1 -1
  209. package/docs/reference/variables/VerifiableStorageConnectorType.md +1 -1
  210. package/docs/reference/variables/WalletConnectorType.md +1 -1
  211. package/package.json +28 -2
  212. package/dist/types/components/rightsManagement.d.ts +0 -13
  213. package/dist/types/models/config/rightsManagementComponentConfig.d.ts +0 -13
  214. package/dist/types/models/types/rightsManagementComponentType.d.ts +0 -17
  215. package/docs/reference/functions/initialiseRightsManagementComponent.md +0 -41
  216. package/docs/reference/functions/initialiseWalletStorage.md +0 -41
  217. package/docs/reference/type-aliases/RightsManagementComponentConfig.md +0 -5
  218. package/docs/reference/type-aliases/RightsManagementComponentType.md +0 -5
@@ -17,11 +17,14 @@ var entityStorageConnectorMongodb = require('@twin.org/entity-storage-connector-
17
17
  var entityStorageConnectorMysql = require('@twin.org/entity-storage-connector-mysql');
18
18
  var entityStorageConnectorPostgresql = require('@twin.org/entity-storage-connector-postgresql');
19
19
  var entityStorageConnectorScylladb = require('@twin.org/entity-storage-connector-scylladb');
20
+ var entityStorageConnectorSynchronised = require('@twin.org/entity-storage-connector-synchronised');
20
21
  var entityStorageModels = require('@twin.org/entity-storage-models');
21
22
  var entityStorageRestClient = require('@twin.org/entity-storage-rest-client');
22
23
  var entityStorageService = require('@twin.org/entity-storage-service');
23
24
  var auditableItemStreamRestClient = require('@twin.org/auditable-item-stream-rest-client');
24
25
  var auditableItemStreamService = require('@twin.org/auditable-item-stream-service');
26
+ var apiModels = require('@twin.org/api-models');
27
+ var identityAuthentication = require('@twin.org/identity-authentication');
25
28
  var backgroundTaskConnectorEntityStorage = require('@twin.org/background-task-connector-entity-storage');
26
29
  var backgroundTaskModels = require('@twin.org/background-task-models');
27
30
  var blobStorageConnectorAwsS3 = require('@twin.org/blob-storage-connector-aws-s3');
@@ -38,6 +41,9 @@ var dataProcessingExtractors = require('@twin.org/data-processing-extractors');
38
41
  var dataProcessingModels = require('@twin.org/data-processing-models');
39
42
  var dataProcessingRestClient = require('@twin.org/data-processing-rest-client');
40
43
  var dataProcessingService = require('@twin.org/data-processing-service');
44
+ var dataSpaceConnectorRestClient = require('@twin.org/data-space-connector-rest-client');
45
+ var dataSpaceConnectorService = require('@twin.org/data-space-connector-service');
46
+ var dataSpaceConnectorSocketClient = require('@twin.org/data-space-connector-socket-client');
41
47
  var documentManagementRestClient = require('@twin.org/document-management-rest-client');
42
48
  var documentManagementService = require('@twin.org/document-management-service');
43
49
  var eventBusConnectorLocal = require('@twin.org/event-bus-connector-local');
@@ -71,9 +77,18 @@ var nftConnectorIota = require('@twin.org/nft-connector-iota');
71
77
  var nftModels = require('@twin.org/nft-models');
72
78
  var nftRestClient = require('@twin.org/nft-rest-client');
73
79
  var nftService = require('@twin.org/nft-service');
80
+ var rightsManagementDapService = require('@twin.org/rights-management-dap-service');
74
81
  var rightsManagementRestClient = require('@twin.org/rights-management-rest-client');
75
- var rightsManagementService = require('@twin.org/rights-management-service');
76
82
  var rightsManagementPapService = require('@twin.org/rights-management-pap-service');
83
+ var engineCore = require('@twin.org/engine-core');
84
+ var rightsManagementPdpService = require('@twin.org/rights-management-pdp-service');
85
+ var rightsManagementPepService = require('@twin.org/rights-management-pep-service');
86
+ var rightsManagementPipService = require('@twin.org/rights-management-pip-service');
87
+ var rightsManagementPmpService = require('@twin.org/rights-management-pmp-service');
88
+ var rightsManagementPnpService = require('@twin.org/rights-management-pnp-service');
89
+ var rightsManagementPxpService = require('@twin.org/rights-management-pxp-service');
90
+ var synchronisedStorageRestClient = require('@twin.org/synchronised-storage-rest-client');
91
+ var synchronisedStorageService = require('@twin.org/synchronised-storage-service');
77
92
  var backgroundTaskScheduler = require('@twin.org/background-task-scheduler');
78
93
  var telemetryConnectorEntityStorage = require('@twin.org/telemetry-connector-entity-storage');
79
94
  var telemetryModels = require('@twin.org/telemetry-models');
@@ -125,78 +140,50 @@ const AttestationConnectorType = {
125
140
  * @param engineCore The engine core.
126
141
  * @param context The context for the engine.
127
142
  * @param instanceConfig The instance config.
128
- * @param overrideInstanceType The instance type to override the default.
129
- * @returns The name of the instance created.
130
- * @throws GeneralError if the connector type is unknown.
131
- */
132
- function initialiseAttestationConnector(engineCore, context, instanceConfig, overrideInstanceType) {
133
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
134
- element: `Attestation Connector: ${instanceConfig.type}`
135
- }));
136
- const type = instanceConfig.type;
137
- let connector;
143
+ * @returns The instance created and the factory for it.
144
+ */
145
+ async function initialiseAttestationConnector(engineCore, context, instanceConfig) {
146
+ let component;
138
147
  let instanceType;
139
- if (type === AttestationConnectorType.Nft) {
140
- connector = new attestationConnectorNft.NftAttestationConnector({
141
- identityConnectorType: context.defaultTypes.identityConnector,
142
- nftConnectorType: context.defaultTypes.nftConnector,
148
+ if (instanceConfig.type === AttestationConnectorType.Nft) {
149
+ component = new attestationConnectorNft.NftAttestationConnector({
150
+ identityConnectorType: engineCore.getRegisteredInstanceType("identityConnector"),
151
+ nftConnectorType: engineCore.getRegisteredInstanceType("nftConnector"),
143
152
  ...instanceConfig.options
144
153
  });
145
154
  instanceType = attestationConnectorNft.NftAttestationConnector.NAMESPACE;
146
155
  }
147
- else {
148
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
149
- type,
150
- connectorType: "attestationConnector"
151
- });
152
- }
153
- const finalInstanceType = overrideInstanceType ?? instanceType;
154
- context.componentInstances.push({
155
- instanceType: finalInstanceType,
156
- component: connector
157
- });
158
- attestationModels.AttestationConnectorFactory.register(finalInstanceType, () => connector);
159
- return finalInstanceType;
156
+ return {
157
+ component,
158
+ instanceType,
159
+ factory: attestationModels.AttestationConnectorFactory
160
+ };
160
161
  }
161
162
  /**
162
163
  * Initialise the attestation component.
163
164
  * @param engineCore The engine core.
164
165
  * @param context The context for the engine.
165
166
  * @param instanceConfig The instance config.
166
- * @param overrideInstanceType The instance type to override the default.
167
- * @returns The name of the instance created.
168
- * @throws GeneralError if the component type is unknown.
169
- */
170
- function initialiseAttestationComponent(engineCore, context, instanceConfig, overrideInstanceType) {
171
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
172
- element: `Attestation Component: ${instanceConfig.type}`
173
- }));
174
- const type = instanceConfig.type;
167
+ * @returns The instance created and the factory for it.
168
+ */
169
+ async function initialiseAttestationComponent(engineCore, context, instanceConfig) {
175
170
  let component;
176
171
  let instanceType;
177
- if (type === AttestationComponentType.Service) {
172
+ if (instanceConfig.type === AttestationComponentType.Service) {
178
173
  component = new attestationService.AttestationService({
179
174
  ...instanceConfig.options
180
175
  });
181
- instanceType = core.StringHelper.kebabCase("AttestationService");
176
+ instanceType = "attestation-service";
182
177
  }
183
- else if (type === AttestationComponentType.RestClient) {
178
+ else if (instanceConfig.type === AttestationComponentType.RestClient) {
184
179
  component = new attestationRestClient.AttestationClient(instanceConfig.options);
185
- instanceType = core.StringHelper.kebabCase("AttestationClient");
186
- }
187
- else {
188
- throw new core.GeneralError("engineCore", "componentUnknownType", {
189
- type,
190
- componentType: "attestationComponent"
191
- });
180
+ instanceType = "attestation-client";
192
181
  }
193
- const finalInstanceType = overrideInstanceType ?? instanceType;
194
- context.componentInstances.push({
195
- instanceType: finalInstanceType,
196
- component
197
- });
198
- core.ComponentFactory.register(finalInstanceType, () => component);
199
- return finalInstanceType;
182
+ return {
183
+ component,
184
+ instanceType,
185
+ factory: core.ComponentFactory
186
+ };
200
187
  }
201
188
 
202
189
  // Copyright 2024 IOTA Stiftung.
@@ -258,7 +245,11 @@ const EntityStorageConnectorType = {
258
245
  /**
259
246
  * Postgre SQL.
260
247
  */
261
- PostgreSql: "postgresql"
248
+ PostgreSql: "postgresql",
249
+ /**
250
+ * Synchronised.
251
+ */
252
+ Synchronised: "synchronised"
262
253
  };
263
254
 
264
255
  // Copyright 2024 IOTA Stiftung.
@@ -269,7 +260,8 @@ const EntityStorageConnectorType = {
269
260
  * @param context The context for the engine.
270
261
  * @param typeCustom Override the type of connector to use instead of default configuration.
271
262
  * @param schema The schema for the entity storage.
272
- * @throws GeneralError if the connector type is unknown.
263
+ * @returns The name of the instance type that was created.
264
+ * @throws GeneralError when the configuration is invalid.
273
265
  */
274
266
  function initialiseEntityStorageConnector(engineCore, context, typeCustom, schema) {
275
267
  const instanceName = core.StringHelper.kebabCase(schema);
@@ -389,6 +381,23 @@ function initialiseEntityStorageConnector(engineCore, context, typeCustom, schem
389
381
  }
390
382
  });
391
383
  }
384
+ else if (type === EntityStorageConnectorType.Synchronised) {
385
+ // Create the entity storage that is wrapped by the synchronised connector
386
+ // by removing the custom type it will default to the standard storage
387
+ // mechanism for entity storage
388
+ const wrappedInstanceName = initialiseEntityStorageConnector(engineCore, context, undefined, schema);
389
+ // Use the wrapped instance name as the entity storage connector type
390
+ // for the synchronised connector
391
+ entityStorageConnector = new entityStorageConnectorSynchronised.SynchronisedEntityStorageConnector({
392
+ entitySchema: schema,
393
+ ...entityStorageConfig.options,
394
+ entityStorageConnectorType: wrappedInstanceName,
395
+ eventBusComponentType: engineCore.getRegisteredInstanceType("eventBusComponent"),
396
+ config: {
397
+ ...entityStorageConfig.options.config
398
+ }
399
+ });
400
+ }
392
401
  else {
393
402
  throw new core.GeneralError("engineCore", "connectorUnknownType", {
394
403
  type,
@@ -401,24 +410,19 @@ function initialiseEntityStorageConnector(engineCore, context, typeCustom, schem
401
410
  });
402
411
  entityStorageModels.EntityStorageConnectorFactory.register(instanceName, () => entityStorageConnector);
403
412
  }
413
+ return instanceName;
404
414
  }
405
415
  /**
406
416
  * Initialise the entity storage connector.
407
417
  * @param engineCore The engine core.
408
418
  * @param context The context for the engine.
409
419
  * @param instanceConfig The instance config.
410
- * @param overrideInstanceType The instance type to override the default.
411
- * @returns The name of the instance created.
412
- * @throws GeneralError if the connector type is unknown.
413
- */
414
- function initialiseEntityStorageComponent(engineCore, context, instanceConfig, overrideInstanceType) {
415
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
416
- element: `Entity Storage Component: ${instanceConfig.type}`
417
- }));
418
- const type = instanceConfig.type;
420
+ * @returns The instance created and the factory for it.
421
+ */
422
+ async function initialiseEntityStorageComponent(engineCore, context, instanceConfig) {
419
423
  let component;
420
424
  let instanceType;
421
- if (type === EntityStorageComponentType.Service) {
425
+ if (instanceConfig.type === EntityStorageComponentType.Service) {
422
426
  const kebabName = core.StringHelper.kebabCase(instanceConfig.options.entityStorageType);
423
427
  // See if there is a custom entity storage for this type, otherwise just use the default one.
424
428
  const hasCustom = context.config.types.entityStorageConnector?.some(c => c.type === kebabName || c.overrideInstanceType === kebabName);
@@ -431,27 +435,19 @@ function initialiseEntityStorageComponent(engineCore, context, instanceConfig, o
431
435
  });
432
436
  instanceType = core.StringHelper.kebabCase(instanceConfig.options.entityStorageType);
433
437
  }
434
- else if (type === EntityStorageComponentType.RestClient) {
438
+ else if (instanceConfig.type === EntityStorageComponentType.RestClient) {
435
439
  const kebabName = core.StringHelper.kebabCase(instanceConfig.options.entityStorageType);
436
440
  component = new entityStorageRestClient.EntityStorageClient({
437
441
  pathPrefix: kebabName,
438
442
  ...instanceConfig.options
439
443
  });
440
- instanceType = `${core.StringHelper.kebabCase("EntityStorageClient")}-${kebabName}`;
441
- }
442
- else {
443
- throw new core.GeneralError("engineCore", "componentUnknownType", {
444
- type,
445
- serviceType: "entityStorageComponent"
446
- });
444
+ instanceType = `${"entity-storage-client"}-${kebabName}`;
447
445
  }
448
- const finalInstanceType = overrideInstanceType ?? instanceType;
449
- context.componentInstances.push({
450
- instanceType: finalInstanceType,
451
- component
452
- });
453
- core.ComponentFactory.register(finalInstanceType, () => component);
454
- return finalInstanceType;
446
+ return {
447
+ component,
448
+ instanceType,
449
+ factory: core.ComponentFactory
450
+ };
455
451
  }
456
452
 
457
453
  // Copyright 2024 IOTA Stiftung.
@@ -476,45 +472,31 @@ const AuditableItemGraphComponentType = {
476
472
  * @param engineCore The engine core.
477
473
  * @param context The context for the engine.
478
474
  * @param instanceConfig The instance config.
479
- * @param overrideInstanceType The instance type to override the default.
480
- * @returns The name of the instance created.
481
- * @throws GeneralError if the component type is unknown.
482
- */
483
- function initialiseAuditableItemGraphComponent(engineCore, context, instanceConfig, overrideInstanceType) {
484
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
485
- element: `Auditable Item Graph Component: ${instanceConfig.type}`
486
- }));
487
- const type = instanceConfig.type;
475
+ * @returns The instance created and the factory for it.
476
+ */
477
+ async function initialiseAuditableItemGraphComponent(engineCore, context, instanceConfig) {
488
478
  let component;
489
479
  let instanceType;
490
- if (type === AuditableItemGraphComponentType.Service) {
480
+ if (instanceConfig.type === AuditableItemGraphComponentType.Service) {
491
481
  auditableItemGraphService.initSchema();
492
482
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.vertexEntityStorageType, "AuditableItemGraphVertex");
493
483
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.changesetEntityStorageType, "AuditableItemGraphChangeset");
494
484
  component = new auditableItemGraphService.AuditableItemGraphService({
495
- immutableProofComponentType: context.defaultTypes.immutableProofComponent,
496
- eventBusComponentType: context.defaultTypes.eventBusComponent,
485
+ immutableProofComponentType: engineCore.getRegisteredInstanceType("immutableProofComponent"),
486
+ eventBusComponentType: engineCore.getRegisteredInstanceTypeOptional("eventBusComponent"),
497
487
  ...instanceConfig.options
498
488
  });
499
- instanceType = core.StringHelper.kebabCase("AuditableItemGraphService");
489
+ instanceType = "auditable-item-graph-service";
500
490
  }
501
- else if (type === AuditableItemGraphComponentType.RestClient) {
491
+ else if (instanceConfig.type === AuditableItemGraphComponentType.RestClient) {
502
492
  component = new auditableItemGraphRestClient.AuditableItemGraphClient(instanceConfig.options);
503
- instanceType = core.StringHelper.kebabCase("AuditableItemGraphClient");
504
- }
505
- else {
506
- throw new core.GeneralError("engineCore", "componentUnknownType", {
507
- type,
508
- componentType: "auditableItemGraphComponent"
509
- });
493
+ instanceType = "auditable-item-graph-client";
510
494
  }
511
- const finalInstanceType = overrideInstanceType ?? instanceType;
512
- context.componentInstances.push({
513
- instanceType: finalInstanceType,
514
- component
515
- });
516
- core.ComponentFactory.register(finalInstanceType, () => component);
517
- return finalInstanceType;
495
+ return {
496
+ component,
497
+ instanceType,
498
+ factory: core.ComponentFactory
499
+ };
518
500
  }
519
501
 
520
502
  // Copyright 2024 IOTA Stiftung.
@@ -539,45 +521,71 @@ const AuditableItemStreamComponentType = {
539
521
  * @param engineCore The engine core.
540
522
  * @param context The context for the engine.
541
523
  * @param instanceConfig The instance config.
542
- * @param overrideInstanceType The instance type to override the default.
543
- * @returns The name of the instance created.
544
- * @throws GeneralError if the component type is unknown.
545
- */
546
- function initialiseAuditableItemStreamComponent(engineCore, context, instanceConfig, overrideInstanceType) {
547
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
548
- element: `Auditable Item Stream Component: ${instanceConfig.type}`
549
- }));
550
- const type = instanceConfig.type;
524
+ * @returns The instance created and the factory for it.
525
+ */
526
+ async function initialiseAuditableItemStreamComponent(engineCore, context, instanceConfig) {
551
527
  let component;
552
528
  let instanceType;
553
- if (type === AuditableItemStreamComponentType.Service) {
529
+ if (instanceConfig.type === AuditableItemStreamComponentType.Service) {
554
530
  auditableItemStreamService.initSchema();
555
531
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.streamEntityStorageType, "AuditableItemStream");
556
532
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.streamEntryEntityStorageType, "AuditableItemStreamEntry");
557
533
  component = new auditableItemStreamService.AuditableItemStreamService({
558
- immutableProofComponentType: context.defaultTypes.immutableProofComponent,
559
- eventBusComponentType: context.defaultTypes.eventBusComponent,
534
+ immutableProofComponentType: engineCore.getRegisteredInstanceType("immutableProofComponent"),
535
+ eventBusComponentType: engineCore.getRegisteredInstanceTypeOptional("eventBusComponent"),
560
536
  ...instanceConfig.options
561
537
  });
562
- instanceType = core.StringHelper.kebabCase("AuditableItemStreamService");
538
+ instanceType = "auditable-item-stream-service";
563
539
  }
564
- else if (type === AuditableItemStreamComponentType.RestClient) {
540
+ else if (instanceConfig.type === AuditableItemStreamComponentType.RestClient) {
565
541
  component = new auditableItemStreamRestClient.AuditableItemStreamClient(instanceConfig.options);
566
- instanceType = core.StringHelper.kebabCase("AuditableItemStreamClient");
542
+ instanceType = "auditable-item-stream-client";
567
543
  }
568
- else {
569
- throw new core.GeneralError("engineCore", "componentUnknownType", {
570
- type,
571
- componentType: "auditableItemStreamComponent"
544
+ return {
545
+ component,
546
+ instanceType,
547
+ factory: core.ComponentFactory
548
+ };
549
+ }
550
+
551
+ // Copyright 2024 IOTA Stiftung.
552
+ // SPDX-License-Identifier: Apache-2.0.
553
+ /**
554
+ * Authentication generator component types.
555
+ */
556
+ // eslint-disable-next-line @typescript-eslint/naming-convention
557
+ const AuthenticationGeneratorComponentType = {
558
+ /**
559
+ * Verifiable Credential.
560
+ */
561
+ VerifiableCredential: "verifiable-credential"
562
+ };
563
+
564
+ // Copyright 2024 IOTA Stiftung.
565
+ // SPDX-License-Identifier: Apache-2.0.
566
+ /**
567
+ * Initialise the authentication generator component.
568
+ * @param engineCore The engine core.
569
+ * @param context The context for the engine.
570
+ * @param instanceConfig The instance config.
571
+ * @returns The instance created and the factory for it.
572
+ */
573
+ async function initialiseAuthenticationGeneratorComponent(engineCore, context, instanceConfig) {
574
+ let component;
575
+ let instanceType;
576
+ if (instanceConfig.type === AuthenticationGeneratorComponentType.VerifiableCredential) {
577
+ component = new identityAuthentication.VerifiableCredentialAuthenticationGenerator({
578
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
579
+ identityConnectorType: engineCore.getRegisteredInstanceType("identityConnector"),
580
+ ...instanceConfig.options
572
581
  });
582
+ instanceType = "verifiable-credential-authentication-generator";
573
583
  }
574
- const finalInstanceType = overrideInstanceType ?? instanceType;
575
- context.componentInstances.push({
576
- instanceType: finalInstanceType,
577
- component
578
- });
579
- core.ComponentFactory.register(finalInstanceType, () => component);
580
- return finalInstanceType;
584
+ return {
585
+ component,
586
+ instanceType,
587
+ factory: apiModels.AuthenticationGeneratorFactory
588
+ };
581
589
  }
582
590
 
583
591
  // Copyright 2024 IOTA Stiftung.
@@ -600,36 +608,25 @@ const BackgroundTaskConnectorType = {
600
608
  * @param engineCore The engine core.
601
609
  * @param context The context for the engine.
602
610
  * @param instanceConfig The instance config.
603
- * @param overrideInstanceType The instance type to override the default.
604
- * @returns The name of the instance created.
605
- * @throws GeneralError if the connector type is unknown.
606
- */
607
- function initialiseBackgroundTaskConnector(engineCore, context, instanceConfig, overrideInstanceType) {
608
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
609
- element: `Background Task Connector: ${instanceConfig.type}`
610
- }));
611
- const type = instanceConfig.type;
612
- let connector;
611
+ * @returns The instance created and the factory for it.
612
+ */
613
+ async function initialiseBackgroundTaskConnector(engineCore, context, instanceConfig) {
614
+ let component;
613
615
  let instanceType;
614
- if (type === BackgroundTaskConnectorType.EntityStorage) {
616
+ if (instanceConfig.type === BackgroundTaskConnectorType.EntityStorage) {
615
617
  backgroundTaskConnectorEntityStorage.initSchema();
616
618
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.backgroundTaskEntityStorageType, "BackgroundTask");
617
- connector = new backgroundTaskConnectorEntityStorage.EntityStorageBackgroundTaskConnector({
618
- loggingConnectorType: context.defaultTypes.loggingConnector,
619
+ component = new backgroundTaskConnectorEntityStorage.EntityStorageBackgroundTaskConnector({
620
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
619
621
  ...instanceConfig.options
620
622
  });
621
623
  instanceType = backgroundTaskConnectorEntityStorage.EntityStorageBackgroundTaskConnector.NAMESPACE;
622
624
  }
623
- else {
624
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
625
- type,
626
- connectorType: "backgroundTaskConnector"
627
- });
628
- }
629
- const finalInstanceType = overrideInstanceType ?? instanceType;
630
- context.componentInstances.push({ instanceType: finalInstanceType, component: connector });
631
- backgroundTaskModels.BackgroundTaskConnectorFactory.register(finalInstanceType, () => connector);
632
- return finalInstanceType;
625
+ return {
626
+ component,
627
+ instanceType,
628
+ factory: backgroundTaskModels.BackgroundTaskConnectorFactory
629
+ };
633
630
  }
634
631
 
635
632
  // Copyright 2024 IOTA Stiftung.
@@ -689,23 +686,17 @@ const BlobStorageConnectorType = {
689
686
  * @param engineCore The engine core.
690
687
  * @param context The context for the engine.
691
688
  * @param instanceConfig The instance config.
692
- * @param overrideInstanceType The instance type to override the default.
693
- * @returns The name of the instance created.
694
- * @throws GeneralError if the connector type is unknown.
695
- */
696
- function initialiseBlobStorageConnector(engineCore, context, instanceConfig, overrideInstanceType) {
697
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
698
- element: `Blob Storage Connector: ${instanceConfig.type}`
699
- }));
700
- const type = instanceConfig.type;
701
- let connector;
689
+ * @returns The instance created and the factory for it.
690
+ */
691
+ async function initialiseBlobStorageConnector(engineCore, context, instanceConfig) {
692
+ let component;
702
693
  let instanceType;
703
- if (type === BlobStorageConnectorType.Ipfs) {
704
- connector = new blobStorageConnectorIpfs.IpfsBlobStorageConnector(instanceConfig.options);
694
+ if (instanceConfig.type === BlobStorageConnectorType.Ipfs) {
695
+ component = new blobStorageConnectorIpfs.IpfsBlobStorageConnector(instanceConfig.options);
705
696
  instanceType = blobStorageConnectorIpfs.IpfsBlobStorageConnector.NAMESPACE;
706
697
  }
707
- else if (type === BlobStorageConnectorType.File) {
708
- connector = new blobStorageConnectorFile.FileBlobStorageConnector({
698
+ else if (instanceConfig.type === BlobStorageConnectorType.File) {
699
+ component = new blobStorageConnectorFile.FileBlobStorageConnector({
709
700
  ...instanceConfig.options,
710
701
  config: {
711
702
  ...instanceConfig.options.config,
@@ -716,12 +707,12 @@ function initialiseBlobStorageConnector(engineCore, context, instanceConfig, ove
716
707
  });
717
708
  instanceType = blobStorageConnectorFile.FileBlobStorageConnector.NAMESPACE;
718
709
  }
719
- else if (type === BlobStorageConnectorType.Memory) {
720
- connector = new blobStorageConnectorMemory.MemoryBlobStorageConnector();
710
+ else if (instanceConfig.type === BlobStorageConnectorType.Memory) {
711
+ component = new blobStorageConnectorMemory.MemoryBlobStorageConnector();
721
712
  instanceType = blobStorageConnectorMemory.MemoryBlobStorageConnector.NAMESPACE;
722
713
  }
723
- else if (type === BlobStorageConnectorType.AwsS3) {
724
- connector = new blobStorageConnectorAwsS3.S3BlobStorageConnector({
714
+ else if (instanceConfig.type === BlobStorageConnectorType.AwsS3) {
715
+ component = new blobStorageConnectorAwsS3.S3BlobStorageConnector({
725
716
  ...instanceConfig.options,
726
717
  config: {
727
718
  ...instanceConfig.options.config,
@@ -730,8 +721,8 @@ function initialiseBlobStorageConnector(engineCore, context, instanceConfig, ove
730
721
  });
731
722
  instanceType = blobStorageConnectorAwsS3.S3BlobStorageConnector.NAMESPACE;
732
723
  }
733
- else if (type === BlobStorageConnectorType.GcpStorage) {
734
- connector = new blobStorageConnectorGcp.GcpBlobStorageConnector({
724
+ else if (instanceConfig.type === BlobStorageConnectorType.GcpStorage) {
725
+ component = new blobStorageConnectorGcp.GcpBlobStorageConnector({
735
726
  ...instanceConfig.options,
736
727
  config: {
737
728
  ...instanceConfig.options.config,
@@ -740,8 +731,8 @@ function initialiseBlobStorageConnector(engineCore, context, instanceConfig, ove
740
731
  });
741
732
  instanceType = blobStorageConnectorGcp.GcpBlobStorageConnector.NAMESPACE;
742
733
  }
743
- else if (type === BlobStorageConnectorType.AzureStorage) {
744
- connector = new blobStorageConnectorAzure.AzureBlobStorageConnector({
734
+ else if (instanceConfig.type === BlobStorageConnectorType.AzureStorage) {
735
+ component = new blobStorageConnectorAzure.AzureBlobStorageConnector({
745
736
  ...instanceConfig.options,
746
737
  config: {
747
738
  ...instanceConfig.options.config,
@@ -750,62 +741,40 @@ function initialiseBlobStorageConnector(engineCore, context, instanceConfig, ove
750
741
  });
751
742
  instanceType = blobStorageConnectorAzure.AzureBlobStorageConnector.NAMESPACE;
752
743
  }
753
- else {
754
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
755
- type,
756
- connectorType: "blobStorageConnector"
757
- });
758
- }
759
- const finalInstanceType = overrideInstanceType ?? instanceType;
760
- context.componentInstances.push({
761
- instanceType: finalInstanceType,
762
- component: connector
763
- });
764
- blobStorageModels.BlobStorageConnectorFactory.register(finalInstanceType, () => connector);
765
- return finalInstanceType;
744
+ return {
745
+ component,
746
+ instanceType,
747
+ factory: blobStorageModels.BlobStorageConnectorFactory
748
+ };
766
749
  }
767
750
  /**
768
751
  * Initialise the blob storage component.
769
752
  * @param engineCore The engine core.
770
753
  * @param context The context for the engine.
771
754
  * @param instanceConfig The instance config.
772
- * @param overrideInstanceType The instance type to override the default.
773
- * @returns The name of the instance created.
774
- * @throws GeneralError if the component type is unknown.
775
- */
776
- function initialiseBlobStorageComponent(engineCore, context, instanceConfig, overrideInstanceType) {
777
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
778
- element: `Blob Storage Component: ${instanceConfig.type}`
779
- }));
780
- const type = instanceConfig.type;
755
+ * @returns The instance created and the factory for it.
756
+ */
757
+ async function initialiseBlobStorageComponent(engineCore, context, instanceConfig) {
781
758
  let component;
782
759
  let instanceType;
783
- if (type === BlobStorageComponentType.Service) {
760
+ if (instanceConfig.type === BlobStorageComponentType.Service) {
784
761
  blobStorageService.initSchema();
785
762
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.entryEntityStorageType, "BlobStorageEntry");
786
763
  component = new blobStorageService.BlobStorageService({
787
- vaultConnectorType: context.defaultTypes.vaultConnector,
764
+ vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
788
765
  ...instanceConfig.options
789
766
  });
790
- instanceType = core.StringHelper.kebabCase("BlobStorageService");
767
+ instanceType = "blob-storage-service";
791
768
  }
792
- else if (type === BlobStorageComponentType.RestClient) {
769
+ else if (instanceConfig.type === BlobStorageComponentType.RestClient) {
793
770
  component = new blobStorageRestClient.BlobStorageClient(instanceConfig.options);
794
- instanceType = core.StringHelper.kebabCase("BlobStorageClient");
795
- }
796
- else {
797
- throw new core.GeneralError("engineCore", "componentUnknownType", {
798
- type,
799
- componentType: "blobStorageComponent"
800
- });
771
+ instanceType = "blob-storage-client";
801
772
  }
802
- const finalInstanceType = overrideInstanceType ?? instanceType;
803
- context.componentInstances.push({
804
- instanceType: finalInstanceType,
805
- component
806
- });
807
- core.ComponentFactory.register(finalInstanceType, () => component);
808
- return finalInstanceType;
773
+ return {
774
+ component,
775
+ instanceType,
776
+ factory: core.ComponentFactory
777
+ };
809
778
  }
810
779
 
811
780
  // Copyright 2024 IOTA Stiftung.
@@ -862,114 +831,135 @@ const DataProcessingComponentType = {
862
831
  * @param engineCore The engine core.
863
832
  * @param context The context for the engine.
864
833
  * @param instanceConfig The instance config.
865
- * @param overrideInstanceType The instance type to override the default.
866
- * @returns The name of the instance created.
867
- * @throws GeneralError if the connector type is unknown.
868
- */
869
- function initialiseDataConverterConnector(engineCore, context, instanceConfig, overrideInstanceType) {
870
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
871
- element: `Data Converter Connector: ${instanceConfig.type}`
872
- }));
873
- const type = instanceConfig.type;
874
- let connector;
834
+ * @returns The instance created and the factory for it.
835
+ */
836
+ async function initialiseDataConverterConnector(engineCore, context, instanceConfig) {
837
+ let component;
875
838
  let instanceType;
876
- if (type === DataConverterConnectorType.Json) {
877
- connector = new dataProcessingConverters.JsonConverterConnector();
839
+ if (instanceConfig.type === DataConverterConnectorType.Json) {
840
+ component = new dataProcessingConverters.JsonConverterConnector();
878
841
  instanceType = dataProcessingConverters.JsonConverterConnector.NAMESPACE;
879
842
  }
880
- else if (type === DataConverterConnectorType.Xml) {
881
- connector = new dataProcessingConverters.XmlConverterConnector();
843
+ else if (instanceConfig.type === DataConverterConnectorType.Xml) {
844
+ component = new dataProcessingConverters.XmlConverterConnector();
882
845
  instanceType = dataProcessingConverters.XmlConverterConnector.NAMESPACE;
883
846
  }
884
- else {
885
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
886
- type,
887
- connectorType: "dataConverterConnector"
888
- });
889
- }
890
- const finalInstanceType = overrideInstanceType ?? instanceType;
891
- context.componentInstances.push({
892
- instanceType: finalInstanceType,
893
- component: connector
894
- });
895
- dataProcessingModels.DataConverterConnectorFactory.register(finalInstanceType, () => connector);
896
- return finalInstanceType;
847
+ return {
848
+ component,
849
+ instanceType,
850
+ factory: dataProcessingModels.DataConverterConnectorFactory
851
+ };
897
852
  }
898
853
  /**
899
854
  * Initialise the data extractor connector.
900
855
  * @param engineCore The engine core.
901
856
  * @param context The context for the engine.
902
857
  * @param instanceConfig The instance config.
903
- * @param overrideInstanceType The instance type to override the default.
904
- * @returns The name of the instance created.
905
- * @throws GeneralError if the connector type is unknown.
906
- */
907
- function initialiseDataExtractorConnector(engineCore, context, instanceConfig, overrideInstanceType) {
908
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
909
- element: `Data Extractor Connector: ${instanceConfig.type}`
910
- }));
911
- const type = instanceConfig.type;
912
- let connector;
858
+ * @returns The instance created and the factory for it.
859
+ */
860
+ async function initialiseDataExtractorConnector(engineCore, context, instanceConfig) {
861
+ let component;
913
862
  let instanceType;
914
- if (type === DataExtractorConnectorType.JsonPath) {
915
- connector = new dataProcessingExtractors.JsonPathExtractorConnector();
863
+ if (instanceConfig.type === DataExtractorConnectorType.JsonPath) {
864
+ component = new dataProcessingExtractors.JsonPathExtractorConnector();
916
865
  instanceType = dataProcessingExtractors.JsonPathExtractorConnector.NAMESPACE;
917
866
  }
918
- else {
919
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
920
- type,
921
- connectorType: "dataExtractorConnector"
922
- });
923
- }
924
- const finalInstanceType = overrideInstanceType ?? instanceType;
925
- context.componentInstances.push({
926
- instanceType: finalInstanceType,
927
- component: connector
928
- });
929
- dataProcessingModels.DataExtractorConnectorFactory.register(finalInstanceType, () => connector);
930
- return finalInstanceType;
867
+ return {
868
+ component,
869
+ instanceType,
870
+ factory: dataProcessingModels.DataExtractorConnectorFactory
871
+ };
931
872
  }
932
873
  /**
933
874
  * Initialise the data processing component.
934
875
  * @param engineCore The engine core.
935
876
  * @param context The context for the engine.
936
877
  * @param instanceConfig The instance config.
937
- * @param overrideInstanceType The instance type to override the default.
938
- * @returns The name of the instance created.
939
- * @throws GeneralError if the component type is unknown.
940
- */
941
- function initialiseDataProcessingComponent(engineCore, context, instanceConfig, overrideInstanceType) {
942
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
943
- element: `Data Processing Component: ${instanceConfig.type}`
944
- }));
945
- const type = instanceConfig.type;
878
+ * @returns The instance created and the factory for it.
879
+ */
880
+ async function initialiseDataProcessingComponent(engineCore, context, instanceConfig) {
946
881
  let component;
947
882
  let instanceType;
948
- if (type === DataProcessingComponentType.Service) {
883
+ if (instanceConfig.type === DataProcessingComponentType.Service) {
949
884
  dataProcessingService.initSchema();
950
885
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.extractionRuleGroupStorageConnectorType, "ExtractionRuleGroup");
951
886
  component = new dataProcessingService.DataProcessingService({
952
887
  ...instanceConfig.options
953
888
  });
954
- instanceType = core.StringHelper.kebabCase("DataProcessingService");
889
+ instanceType = "data-processing-service";
955
890
  }
956
- else if (type === DataProcessingComponentType.RestClient) {
891
+ else if (instanceConfig.type === DataProcessingComponentType.RestClient) {
957
892
  component = new dataProcessingRestClient.DataProcessingClient(instanceConfig.options);
958
- instanceType = core.StringHelper.kebabCase("DataProcessingClient");
893
+ instanceType = "data-processing-client";
894
+ }
895
+ return {
896
+ component,
897
+ instanceType,
898
+ factory: core.ComponentFactory
899
+ };
900
+ }
901
+
902
+ // Copyright 2024 IOTA Stiftung.
903
+ // SPDX-License-Identifier: Apache-2.0.
904
+ /**
905
+ * Data space connector component types.
906
+ */
907
+ // eslint-disable-next-line @typescript-eslint/naming-convention
908
+ const DataSpaceConnectorComponentType = {
909
+ /**
910
+ * Service.
911
+ */
912
+ Service: "service",
913
+ /**
914
+ * REST client.
915
+ */
916
+ RestClient: "rest-client",
917
+ /**
918
+ * Socket client.
919
+ */
920
+ SocketClient: "socket-client"
921
+ };
922
+
923
+ // Copyright 2024 IOTA Stiftung.
924
+ // SPDX-License-Identifier: Apache-2.0.
925
+ /**
926
+ * Initialise the data space connector component.
927
+ * @param engineCore The engine core.
928
+ * @param context The context for the engine.
929
+ * @param instanceConfig The instance config.
930
+ * @returns The instance created and the factory for it.
931
+ */
932
+ async function initialiseDataSpaceConnectorComponent(engineCore, context, instanceConfig) {
933
+ let component;
934
+ let instanceType;
935
+ if (instanceConfig.type === DataSpaceConnectorComponentType.Service) {
936
+ dataSpaceConnectorService.initSchema();
937
+ initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.activityLogEntityStorageType, "ActivityLogDetails");
938
+ initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.activityTaskEntityStorageType, "ActivityTask");
939
+ component = new dataSpaceConnectorService.DataSpaceConnectorService({
940
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
941
+ backgroundTaskConnectorType: engineCore.getRegisteredInstanceType("backgroundTaskConnector"),
942
+ taskSchedulerComponentType: engineCore.getRegisteredInstanceType("taskSchedulerComponent"),
943
+ ...instanceConfig.options
944
+ });
945
+ instanceType = "data-space-connector-service";
946
+ }
947
+ else if (instanceConfig.type === DataSpaceConnectorComponentType.RestClient) {
948
+ component = new dataSpaceConnectorRestClient.DataSpaceConnectorClient(instanceConfig.options);
949
+ instanceType = "data-space-connector-client";
959
950
  }
960
- else {
961
- throw new core.GeneralError("engineCore", "componentUnknownType", {
962
- type,
963
- componentType: "dataProcessingComponent"
951
+ else if (instanceConfig.type === DataSpaceConnectorComponentType.SocketClient) {
952
+ component = new dataSpaceConnectorSocketClient.DataSpaceConnectorSocketClient({
953
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
954
+ ...instanceConfig.options
964
955
  });
956
+ instanceType = "data-space-connector-socket-client";
965
957
  }
966
- const finalInstanceType = overrideInstanceType ?? instanceType;
967
- context.componentInstances.push({
968
- instanceType: finalInstanceType,
969
- component
970
- });
971
- core.ComponentFactory.register(finalInstanceType, () => component);
972
- return finalInstanceType;
958
+ return {
959
+ component,
960
+ instanceType,
961
+ factory: core.ComponentFactory
962
+ };
973
963
  }
974
964
 
975
965
  // Copyright 2024 IOTA Stiftung.
@@ -996,44 +986,30 @@ const DocumentManagementComponentType = {
996
986
  * @param engineCore The engine core.
997
987
  * @param context The context for the engine.
998
988
  * @param instanceConfig The instance config.
999
- * @param overrideInstanceType The instance type to override the default.
1000
- * @returns The name of the instance created.
1001
- * @throws GeneralError if the component type is unknown.
1002
- */
1003
- function initialiseDocumentManagementComponent(engineCore, context, instanceConfig, overrideInstanceType) {
1004
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1005
- element: `Document Management Component: ${instanceConfig.type}`
1006
- }));
1007
- const type = instanceConfig.type;
989
+ * @returns The instance created and the factory for it.
990
+ */
991
+ async function initialiseDocumentManagementComponent(engineCore, context, instanceConfig) {
1008
992
  let component;
1009
993
  let instanceType;
1010
- if (type === DocumentManagementComponentType.Service) {
994
+ if (instanceConfig.type === DocumentManagementComponentType.Service) {
1011
995
  component = new documentManagementService.DocumentManagementService({
1012
- auditableItemGraphComponentType: context.defaultTypes.auditableItemGraphComponent,
1013
- blobStorageComponentType: context.defaultTypes.blobStorageComponent,
1014
- attestationComponentType: context.defaultTypes.attestationComponent,
1015
- dataProcessingComponentType: context.defaultTypes.dataProcessingComponent,
996
+ auditableItemGraphComponentType: engineCore.getRegisteredInstanceType("auditableItemGraphComponent"),
997
+ blobStorageComponentType: engineCore.getRegisteredInstanceType("blobStorageComponent"),
998
+ attestationComponentType: engineCore.getRegisteredInstanceType("attestationComponent"),
999
+ dataProcessingComponentType: engineCore.getRegisteredInstanceType("dataProcessingComponent"),
1016
1000
  ...instanceConfig.options
1017
1001
  });
1018
- instanceType = core.StringHelper.kebabCase("DocumentManagementService");
1002
+ instanceType = "document-management-service";
1019
1003
  }
1020
- else if (type === DocumentManagementComponentType.RestClient) {
1004
+ else if (instanceConfig.type === DocumentManagementComponentType.RestClient) {
1021
1005
  component = new documentManagementRestClient.DocumentManagementClient(instanceConfig.options);
1022
- instanceType = core.StringHelper.kebabCase("DocumentManagementClient");
1023
- }
1024
- else {
1025
- throw new core.GeneralError("engineCore", "componentUnknownType", {
1026
- type,
1027
- componentType: "documentManagementComponent"
1028
- });
1006
+ instanceType = "document-management-client";
1029
1007
  }
1030
- const finalInstanceType = overrideInstanceType ?? instanceType;
1031
- context.componentInstances.push({
1032
- instanceType: finalInstanceType,
1033
- component
1034
- });
1035
- core.ComponentFactory.register(finalInstanceType, () => component);
1036
- return finalInstanceType;
1008
+ return {
1009
+ component,
1010
+ instanceType,
1011
+ factory: core.ComponentFactory
1012
+ };
1037
1013
  }
1038
1014
 
1039
1015
  // Copyright 2024 IOTA Stiftung.
@@ -1073,77 +1049,68 @@ const EventBusConnectorType = {
1073
1049
  * @param engineCore The engine core.
1074
1050
  * @param context The context for the engine.
1075
1051
  * @param instanceConfig The instance config.
1076
- * @param overrideInstanceType The instance type to override the default.
1077
- * @returns The name of the instance created.
1078
- * @throws GeneralError if the connector type is unknown.
1079
- */
1080
- function initialiseEventBusConnector(engineCore, context, instanceConfig, overrideInstanceType) {
1081
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1082
- element: `Event Bus Connector: ${instanceConfig.type}`
1083
- }));
1084
- const type = instanceConfig.type;
1052
+ * @returns The instance created and the factory for it.
1053
+ */
1054
+ async function initialiseEventBusConnector(engineCore, context, instanceConfig) {
1085
1055
  let connector;
1086
1056
  let instanceType;
1087
- if (type === EventBusConnectorType.Local) {
1057
+ if (instanceConfig.type === EventBusConnectorType.Local) {
1088
1058
  connector = new eventBusConnectorLocal.LocalEventBusConnector({
1089
- loggingConnectorType: context.defaultTypes.loggingConnector,
1059
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
1090
1060
  ...instanceConfig.options
1091
1061
  });
1092
1062
  instanceType = eventBusConnectorLocal.LocalEventBusConnector.NAMESPACE;
1093
1063
  }
1094
- else {
1095
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
1096
- type,
1097
- connectorType: "eventBusConnector"
1098
- });
1099
- }
1100
- const finalInstanceType = overrideInstanceType ?? instanceType;
1101
- context.componentInstances.push({ instanceType: finalInstanceType, component: connector });
1102
- eventBusModels.EventBusConnectorFactory.register(finalInstanceType, () => connector);
1103
- return finalInstanceType;
1064
+ return {
1065
+ instanceType,
1066
+ factory: eventBusModels.EventBusConnectorFactory,
1067
+ component: connector
1068
+ };
1104
1069
  }
1105
1070
  /**
1106
1071
  * Initialise the event bus component.
1107
1072
  * @param engineCore The engine core.
1108
1073
  * @param context The context for the engine.
1109
1074
  * @param instanceConfig The instance config.
1110
- * @param overrideInstanceType The instance type to override the default.
1111
- * @returns The name of the instance created.
1112
- * @throws GeneralError if the component type is unknown.
1113
- */
1114
- function initialiseEventBusComponent(engineCore, context, instanceConfig, overrideInstanceType) {
1115
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1116
- element: `Event Bus Component: ${instanceConfig.type}`
1117
- }));
1118
- const type = instanceConfig.type;
1075
+ * @returns The instance created and the factory for it.
1076
+ */
1077
+ async function initialiseEventBusComponent(engineCore, context, instanceConfig) {
1119
1078
  let component;
1120
1079
  let instanceType;
1121
- if (type === EventBusComponentType.Service) {
1080
+ if (instanceConfig.type === EventBusComponentType.Service) {
1122
1081
  component = new eventBusService.EventBusService({
1123
- eventBusConnectorType: context.defaultTypes.eventBusConnector,
1082
+ eventBusConnectorType: engineCore.getRegisteredInstanceType("eventBusConnector"),
1124
1083
  ...instanceConfig.options
1125
1084
  });
1126
- instanceType = core.StringHelper.kebabCase("EventBusService");
1085
+ instanceType = "event-bus-service";
1127
1086
  }
1128
- else if (type === EventBusComponentType.SocketClient) {
1087
+ else if (instanceConfig.type === EventBusComponentType.SocketClient) {
1129
1088
  component = new eventBusSocketClient.EventBusSocketClient({
1130
- loggingComponentType: context.defaultTypes.loggingConnector,
1089
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
1131
1090
  ...instanceConfig.options
1132
1091
  });
1133
- instanceType = core.StringHelper.kebabCase("EventBusSocketClient");
1134
- }
1135
- else {
1136
- throw new core.GeneralError("engineCore", "componentUnknownType", {
1137
- type,
1138
- componentType: "EventBusComponent"
1139
- });
1092
+ instanceType = "event-bus-socket-client";
1140
1093
  }
1141
- const finalInstanceType = overrideInstanceType ?? instanceType;
1142
- context.componentInstances.push({ instanceType: finalInstanceType, component });
1143
- core.ComponentFactory.register(finalInstanceType, () => component);
1144
- return finalInstanceType;
1094
+ return {
1095
+ instanceType,
1096
+ factory: core.ComponentFactory,
1097
+ component
1098
+ };
1145
1099
  }
1146
1100
 
1101
+ // Copyright 2024 IOTA Stiftung.
1102
+ // SPDX-License-Identifier: Apache-2.0.
1103
+ /**
1104
+ * DLT config types.
1105
+ */
1106
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1107
+ const DltConfigType = {
1108
+ /**
1109
+ * IOTA.
1110
+ */
1111
+ Iota: "iota"
1112
+ };
1113
+
1147
1114
  // Copyright 2024 IOTA Stiftung.
1148
1115
  // SPDX-License-Identifier: Apache-2.0.
1149
1116
  /**
@@ -1163,25 +1130,48 @@ const FaucetConnectorType = {
1163
1130
 
1164
1131
  // Copyright 2024 IOTA Stiftung.
1165
1132
  // SPDX-License-Identifier: Apache-2.0.
1133
+ /**
1134
+ * Helper methods for engine config types.
1135
+ */
1136
+ class EngineTypeHelper {
1137
+ /**
1138
+ * Runtime name for the class.
1139
+ */
1140
+ static CLASS_NAME = "EngineTypeHelper";
1141
+ /**
1142
+ * Get the config for the specified component and type.
1143
+ * @param engineConfig The engine configuration.
1144
+ * @param component The component name.
1145
+ * @param type The type name.
1146
+ * @returns The config for the specified component and type or undefined if it does not exist.
1147
+ */
1148
+ static getConfigOfType(engineConfig, component, type) {
1149
+ if (core.Is.empty(engineConfig.types[component])) {
1150
+ return undefined;
1151
+ }
1152
+ // First look for any of the specific type marked as default
1153
+ let foundConfig = engineConfig.types[component]?.find(config => config.type === type && config.isDefault);
1154
+ // If we found a default config then return that otherwise return the first matching type
1155
+ if (core.Is.empty(foundConfig)) {
1156
+ foundConfig = engineConfig.types[component]?.find(config => config.type === type);
1157
+ }
1158
+ return foundConfig;
1159
+ }
1160
+ }
1161
+
1166
1162
  /**
1167
1163
  * Initialise a faucet connector.
1168
1164
  * @param engineCore The engine core.
1169
1165
  * @param context The context for the engine.
1170
1166
  * @param instanceConfig The instance config.
1171
- * @param overrideInstanceType The instance type to override the default.
1172
- * @returns The name of the instance created.
1173
- * @throws GeneralError if the connector type is unknown.
1174
- */
1175
- function initialiseFaucetConnector(engineCore, context, instanceConfig, overrideInstanceType) {
1176
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1177
- element: `Faucet Connector: ${instanceConfig.type}`
1178
- }));
1179
- const type = instanceConfig.type;
1180
- let connector;
1167
+ * @returns The instance created and the factory for it.
1168
+ */
1169
+ async function initialiseFaucetConnector(engineCore, context, instanceConfig) {
1170
+ let component;
1181
1171
  let instanceType;
1182
- if (type === FaucetConnectorType.Iota) {
1183
- const dltConfig = context.config.types.dltConfig?.find(dlt => dlt.type === context.defaultTypes.dltConfig);
1184
- connector = new walletConnectorIota.IotaFaucetConnector({
1172
+ if (instanceConfig.type === FaucetConnectorType.Iota) {
1173
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
1174
+ component = new walletConnectorIota.IotaFaucetConnector({
1185
1175
  ...instanceConfig.options,
1186
1176
  config: {
1187
1177
  ...dltConfig?.options?.config,
@@ -1190,23 +1180,17 @@ function initialiseFaucetConnector(engineCore, context, instanceConfig, override
1190
1180
  });
1191
1181
  instanceType = walletConnectorIota.IotaFaucetConnector.NAMESPACE;
1192
1182
  }
1193
- else if (type === FaucetConnectorType.EntityStorage) {
1194
- connector = new walletConnectorEntityStorage.EntityStorageFaucetConnector(instanceConfig.options);
1183
+ else if (instanceConfig.type === FaucetConnectorType.EntityStorage) {
1184
+ walletConnectorEntityStorage.initSchema();
1185
+ initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.walletAddressEntityStorageType, "WalletAddress");
1186
+ component = new walletConnectorEntityStorage.EntityStorageFaucetConnector(instanceConfig.options);
1195
1187
  instanceType = walletConnectorEntityStorage.EntityStorageFaucetConnector.NAMESPACE;
1196
1188
  }
1197
- else {
1198
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
1199
- type,
1200
- connectorType: "faucetConnector"
1201
- });
1202
- }
1203
- const finalInstanceType = overrideInstanceType ?? instanceType;
1204
- context.componentInstances.push({
1205
- instanceType: finalInstanceType,
1206
- component: connector
1207
- });
1208
- walletModels.FaucetConnectorFactory.register(finalInstanceType, () => connector);
1209
- return finalInstanceType;
1189
+ return {
1190
+ component,
1191
+ instanceType,
1192
+ factory: walletModels.FaucetConnectorFactory
1193
+ };
1210
1194
  }
1211
1195
 
1212
1196
  // Copyright 2024 IOTA Stiftung.
@@ -1233,47 +1217,33 @@ const FederatedCatalogueComponentType = {
1233
1217
  * @param engineCore The engine core.
1234
1218
  * @param context The context for the engine.
1235
1219
  * @param instanceConfig The instance config.
1236
- * @param overrideInstanceType The instance type to override the default.
1237
- * @returns The name of the instance created.
1238
- * @throws GeneralError if the component type is unknown.
1239
- */
1240
- function initialiseFederatedCatalogueComponent(engineCore, context, instanceConfig, overrideInstanceType) {
1241
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1242
- element: `Federated Catalogue Component: ${instanceConfig.type}`
1243
- }));
1244
- const type = instanceConfig.type;
1220
+ * @returns The instance created and the factory for it.
1221
+ */
1222
+ async function initialiseFederatedCatalogueComponent(engineCore, context, instanceConfig) {
1245
1223
  let component;
1246
1224
  let instanceType;
1247
- if (type === FederatedCatalogueComponentType.Service) {
1225
+ if (instanceConfig.type === FederatedCatalogueComponentType.Service) {
1248
1226
  federatedCatalogueService.initSchema();
1249
1227
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.dataResourceEntityStorageType, "DataResourceEntry");
1250
1228
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.participantEntityStorageType, "ParticipantEntry");
1251
1229
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.serviceOfferingEntityStorageType, "ServiceOfferingEntry");
1252
1230
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.dataSpaceConnectorStorageType, "DataSpaceConnectorEntry");
1253
1231
  component = new federatedCatalogueService.FederatedCatalogueService({
1254
- loggingConnectorType: context.defaultTypes.loggingConnector,
1255
- identityResolverComponentType: context.defaultTypes.identityResolverComponent,
1232
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
1233
+ identityResolverComponentType: engineCore.getRegisteredInstanceType("identityResolverComponent"),
1256
1234
  ...instanceConfig.options
1257
1235
  });
1258
- instanceType = core.StringHelper.kebabCase("FederatedCatalogueService");
1236
+ instanceType = "federated-catalogue-service";
1259
1237
  }
1260
- else if (type === FederatedCatalogueComponentType.RestClient) {
1238
+ else if (instanceConfig.type === FederatedCatalogueComponentType.RestClient) {
1261
1239
  component = new federatedCatalogueRestClient.FederatedCatalogueClient(instanceConfig.options);
1262
- instanceType = core.StringHelper.kebabCase("FederatedCatalogueClient");
1263
- }
1264
- else {
1265
- throw new core.GeneralError("engineCore", "componentUnknownType", {
1266
- type,
1267
- componentType: "FederatedCatalogueComponent"
1268
- });
1240
+ instanceType = "federated-catalogue-client";
1269
1241
  }
1270
- const finalInstanceType = overrideInstanceType ?? instanceType;
1271
- context.componentInstances.push({
1272
- instanceType: finalInstanceType,
1273
- component
1274
- });
1275
- core.ComponentFactory.register(finalInstanceType, () => component);
1276
- return finalInstanceType;
1242
+ return {
1243
+ component,
1244
+ instanceType,
1245
+ factory: core.ComponentFactory
1246
+ };
1277
1247
  }
1278
1248
 
1279
1249
  // Copyright 2024 IOTA Stiftung.
@@ -1317,21 +1287,15 @@ const IdentityConnectorType = {
1317
1287
  * @param engineCore The engine core.
1318
1288
  * @param context The context for the engine.
1319
1289
  * @param instanceConfig The instance config.
1320
- * @param overrideInstanceType The instance type to override the default.
1321
- * @returns The name of the instance created.
1322
- * @throws GeneralError if the connector type is unknown.
1323
- */
1324
- function initialiseIdentityConnector(engineCore, context, instanceConfig, overrideInstanceType) {
1325
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1326
- element: `Identity Connector: ${instanceConfig.type}`
1327
- }));
1328
- const type = instanceConfig.type;
1329
- let connector;
1290
+ * @returns The instance created and the factory for it.
1291
+ */
1292
+ async function initialiseIdentityConnector(engineCore, context, instanceConfig) {
1293
+ let component;
1330
1294
  let instanceType;
1331
- if (type === IdentityConnectorType.Iota) {
1332
- const dltConfig = context.config.types.dltConfig?.find(dlt => dlt.type === context.defaultTypes.dltConfig);
1333
- connector = new identityConnectorIota.IotaIdentityConnector({
1334
- vaultConnectorType: context.defaultTypes.vaultConnector,
1295
+ if (instanceConfig.type === IdentityConnectorType.Iota) {
1296
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
1297
+ component = new identityConnectorIota.IotaIdentityConnector({
1298
+ vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
1335
1299
  ...instanceConfig.options,
1336
1300
  config: {
1337
1301
  ...dltConfig?.options?.config,
@@ -1340,60 +1304,44 @@ function initialiseIdentityConnector(engineCore, context, instanceConfig, overri
1340
1304
  });
1341
1305
  instanceType = identityConnectorIota.IotaIdentityConnector.NAMESPACE;
1342
1306
  }
1343
- else if (type === IdentityConnectorType.EntityStorage) {
1307
+ else if (instanceConfig.type === IdentityConnectorType.EntityStorage) {
1344
1308
  identityConnectorEntityStorage.initSchema({ includeProfile: false });
1345
1309
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.didDocumentEntityStorageType, "IdentityDocument");
1346
- connector = new identityConnectorEntityStorage.EntityStorageIdentityConnector({
1347
- vaultConnectorType: context.defaultTypes.vaultConnector,
1310
+ component = new identityConnectorEntityStorage.EntityStorageIdentityConnector({
1311
+ vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
1348
1312
  ...instanceConfig.options
1349
1313
  });
1350
1314
  instanceType = identityConnectorEntityStorage.EntityStorageIdentityConnector.NAMESPACE;
1351
1315
  }
1352
- else {
1353
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
1354
- type,
1355
- connectorType: "identityConnector"
1356
- });
1357
- }
1358
- const finalInstanceType = overrideInstanceType ?? instanceType;
1359
- context.componentInstances.push({ instanceType: finalInstanceType, component: connector });
1360
- identityModels.IdentityConnectorFactory.register(finalInstanceType, () => connector);
1361
- return finalInstanceType;
1316
+ return {
1317
+ component,
1318
+ instanceType,
1319
+ factory: identityModels.IdentityConnectorFactory
1320
+ };
1362
1321
  }
1363
1322
  /**
1364
1323
  * Initialise the identity component.
1365
1324
  * @param engineCore The engine core.
1366
1325
  * @param context The context for the engine.
1367
1326
  * @param instanceConfig The instance config.
1368
- * @param overrideInstanceType The instance type to override the default.
1369
- * @returns The name of the instance created.
1370
- * @throws GeneralError if the component type is unknown.
1371
- */
1372
- function initialiseIdentityComponent(engineCore, context, instanceConfig, overrideInstanceType) {
1373
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1374
- element: `Identity Component: ${instanceConfig.type}`
1375
- }));
1376
- const type = instanceConfig.type;
1327
+ * @returns The instance created and the factory for it.
1328
+ */
1329
+ async function initialiseIdentityComponent(engineCore, context, instanceConfig) {
1377
1330
  let component;
1378
1331
  let instanceType;
1379
- if (type === IdentityComponentType.Service) {
1332
+ if (instanceConfig.type === IdentityComponentType.Service) {
1380
1333
  component = new identityService.IdentityService(instanceConfig.options);
1381
- instanceType = core.StringHelper.kebabCase("IdentityService");
1334
+ instanceType = "identity-service";
1382
1335
  }
1383
- else if (type === IdentityComponentType.RestClient) {
1336
+ else if (instanceConfig.type === IdentityComponentType.RestClient) {
1384
1337
  component = new identityRestClient.IdentityClient(instanceConfig.options);
1385
- instanceType = core.StringHelper.kebabCase("IdentityClient");
1386
- }
1387
- else {
1388
- throw new core.GeneralError("engineCore", "componentUnknownType", {
1389
- type,
1390
- componentType: "identityComponent"
1391
- });
1338
+ instanceType = "identity-client";
1392
1339
  }
1393
- const finalInstanceType = overrideInstanceType ?? instanceType;
1394
- context.componentInstances.push({ instanceType: finalInstanceType, component });
1395
- core.ComponentFactory.register(finalInstanceType, () => component);
1396
- return finalInstanceType;
1340
+ return {
1341
+ component,
1342
+ instanceType,
1343
+ factory: core.ComponentFactory
1344
+ };
1397
1345
  }
1398
1346
 
1399
1347
  // Copyright 2024 IOTA Stiftung.
@@ -1433,77 +1381,49 @@ const IdentityProfileConnectorType = {
1433
1381
  * @param engineCore The engine core.
1434
1382
  * @param context The context for the engine.
1435
1383
  * @param instanceConfig The instance config.
1436
- * @param overrideInstanceType The instance type to override the default.
1437
- * @returns The name of the instance created.
1438
- * @throws GeneralError if the connector type is unknown.
1439
- */
1440
- function initialiseIdentityProfileConnector(engineCore, context, instanceConfig, overrideInstanceType) {
1441
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1442
- element: `Identity Profile Connector: ${instanceConfig.type}`
1443
- }));
1444
- const type = instanceConfig.type;
1384
+ * @returns The instance created and the factory for it.
1385
+ */
1386
+ async function initialiseIdentityProfileConnector(engineCore, context, instanceConfig) {
1445
1387
  let connector;
1446
1388
  let instanceType;
1447
- if (type === IdentityProfileConnectorType.EntityStorage) {
1389
+ if (instanceConfig.type === IdentityProfileConnectorType.EntityStorage) {
1448
1390
  identityConnectorEntityStorage.initSchema({ includeDocument: false });
1449
1391
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.profileEntityStorageType, "IdentityProfile");
1450
1392
  connector = new identityConnectorEntityStorage.EntityStorageIdentityProfileConnector(instanceConfig.options);
1451
1393
  instanceType = identityConnectorEntityStorage.EntityStorageIdentityProfileConnector.NAMESPACE;
1452
1394
  }
1453
- else {
1454
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
1455
- type,
1456
- serviceType: "identityProfile"
1457
- });
1458
- }
1459
- const finalInstanceType = overrideInstanceType ?? instanceType;
1460
- context.componentInstances.push({
1461
- instanceType: finalInstanceType,
1462
- component: connector
1463
- });
1464
- identityModels.IdentityProfileConnectorFactory.register(finalInstanceType, () => connector);
1465
- return finalInstanceType;
1395
+ return {
1396
+ component: connector,
1397
+ instanceType,
1398
+ factory: identityModels.IdentityProfileConnectorFactory
1399
+ };
1466
1400
  }
1467
1401
  /**
1468
1402
  * Initialise the identity profile component.
1469
1403
  * @param engineCore The engine core.
1470
1404
  * @param context The context for the engine.
1471
1405
  * @param instanceConfig The instance config.
1472
- * @param overrideInstanceType The instance type to override the default.
1473
- * @returns The name of the instance created.
1474
- * @throws GeneralError if the component type is unknown.
1475
- */
1476
- function initialiseIdentityProfileComponent(engineCore, context, instanceConfig, overrideInstanceType) {
1477
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1478
- element: `Identity Profile Component: ${instanceConfig.type}`
1479
- }));
1480
- const type = instanceConfig.type;
1406
+ * @returns The instance created and the factory for it.
1407
+ */
1408
+ async function initialiseIdentityProfileComponent(engineCore, context, instanceConfig) {
1481
1409
  let component;
1482
1410
  let instanceType;
1483
- if (type === IdentityProfileComponentType.Service) {
1411
+ if (instanceConfig.type === IdentityProfileComponentType.Service) {
1484
1412
  component = new identityService.IdentityProfileService({
1485
- profileEntityConnectorType: context.defaultTypes.identityProfileConnector,
1413
+ profileEntityConnectorType: engineCore.getRegisteredInstanceType("identityProfileConnector"),
1486
1414
  ...instanceConfig.options
1487
1415
  });
1488
- instanceType = core.StringHelper.kebabCase("IdentityProfileService");
1416
+ instanceType = "identity-profile-service";
1489
1417
  }
1490
- else if (type === IdentityProfileComponentType.RestClient) {
1418
+ else if (instanceConfig.type === IdentityProfileComponentType.RestClient) {
1491
1419
  component = new identityRestClient.IdentityProfileClient(instanceConfig.options);
1492
- instanceType = core.StringHelper.kebabCase("IdentityProfileClient");
1493
- }
1494
- else {
1495
- throw new core.GeneralError("engineCore", "componentUnknownType", {
1496
- type,
1497
- componentType: "identityProfileComponent"
1498
- });
1420
+ instanceType = "identity-profile-client";
1499
1421
  }
1500
- const finalInstanceType = overrideInstanceType ?? instanceType;
1501
- context.componentInstances.push({
1502
- instanceType: finalInstanceType,
1503
- component
1504
- });
1505
- core.ComponentFactory.register(finalInstanceType, () => component);
1506
- return finalInstanceType;
1422
+ return {
1423
+ component,
1424
+ instanceType,
1425
+ factory: core.ComponentFactory
1426
+ };
1507
1427
  }
1508
1428
 
1509
1429
  // Copyright 2024 IOTA Stiftung.
@@ -1551,20 +1471,14 @@ const IdentityResolverConnectorType = {
1551
1471
  * @param engineCore The engine core.
1552
1472
  * @param context The context for the engine.
1553
1473
  * @param instanceConfig The instance config.
1554
- * @param overrideInstanceType The instance type to override the default.
1555
- * @returns The name of the instance created.
1556
- * @throws GeneralError if the connector type is unknown.
1557
- */
1558
- function initialiseIdentityResolverConnector(engineCore, context, instanceConfig, overrideInstanceType) {
1559
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1560
- element: `Identity Resolver Connector: ${instanceConfig.type}`
1561
- }));
1562
- const type = instanceConfig.type;
1563
- let connector;
1474
+ * @returns The instance created and the factory for it.
1475
+ */
1476
+ async function initialiseIdentityResolverConnector(engineCore, context, instanceConfig) {
1477
+ let component;
1564
1478
  let instanceType;
1565
- if (type === IdentityResolverConnectorType.Iota) {
1566
- const dltConfig = context.config.types.dltConfig?.find(dlt => dlt.type === context.defaultTypes.dltConfig);
1567
- connector = new identityConnectorIota.IotaIdentityResolverConnector({
1479
+ if (instanceConfig.type === IdentityResolverConnectorType.Iota) {
1480
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
1481
+ component = new identityConnectorIota.IotaIdentityResolverConnector({
1568
1482
  ...instanceConfig.options,
1569
1483
  config: {
1570
1484
  ...dltConfig?.options?.config,
@@ -1573,71 +1487,56 @@ function initialiseIdentityResolverConnector(engineCore, context, instanceConfig
1573
1487
  });
1574
1488
  instanceType = identityConnectorIota.IotaIdentityResolverConnector.NAMESPACE;
1575
1489
  }
1576
- else if (type === IdentityResolverConnectorType.EntityStorage) {
1490
+ else if (instanceConfig.type === IdentityResolverConnectorType.EntityStorage) {
1577
1491
  identityConnectorEntityStorage.initSchema({ includeProfile: false });
1578
1492
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.didDocumentEntityStorageType, "IdentityDocument");
1579
- connector = new identityConnectorEntityStorage.EntityStorageIdentityResolverConnector({
1580
- vaultConnectorType: context.defaultTypes.vaultConnector,
1493
+ component = new identityConnectorEntityStorage.EntityStorageIdentityResolverConnector({
1494
+ vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
1581
1495
  ...instanceConfig.options
1582
1496
  });
1583
1497
  instanceType = identityConnectorEntityStorage.EntityStorageIdentityResolverConnector.NAMESPACE;
1584
1498
  }
1585
- else if (type === IdentityResolverConnectorType.Universal) {
1586
- connector = new identityConnectorUniversal.UniversalResolverConnector({
1499
+ else if (instanceConfig.type === IdentityResolverConnectorType.Universal) {
1500
+ component = new identityConnectorUniversal.UniversalResolverConnector({
1587
1501
  ...instanceConfig.options
1588
1502
  });
1589
1503
  instanceType = identityConnectorUniversal.UniversalResolverConnector.NAMESPACE;
1590
1504
  }
1591
- else {
1592
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
1593
- type,
1594
- connectorType: "identityResolverConnector"
1595
- });
1596
- }
1597
- const finalInstanceType = overrideInstanceType ?? instanceType;
1598
- context.componentInstances.push({ instanceType: finalInstanceType, component: connector });
1599
- identityModels.IdentityResolverConnectorFactory.register(finalInstanceType, () => connector);
1600
- return finalInstanceType;
1505
+ return {
1506
+ component,
1507
+ instanceType,
1508
+ factory: identityModels.IdentityResolverConnectorFactory
1509
+ };
1601
1510
  }
1602
1511
  /**
1603
1512
  * Initialise the identity resolver component.
1604
1513
  * @param engineCore The engine core.
1605
1514
  * @param context The context for the engine.
1606
1515
  * @param instanceConfig The instance config.
1607
- * @param overrideInstanceType The instance type to override the default.
1608
- * @returns The name of the instance created.
1609
- * @throws GeneralError if the component type is unknown.
1610
- */
1611
- function initialiseIdentityResolverComponent(engineCore, context, instanceConfig, overrideInstanceType) {
1612
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1613
- element: `Identity Resolver Component: ${instanceConfig.type}`
1614
- }));
1615
- const type = instanceConfig.type;
1516
+ * @returns The instance created and the factory for it.
1517
+ */
1518
+ async function initialiseIdentityResolverComponent(engineCore, context, instanceConfig) {
1616
1519
  let component;
1617
1520
  let instanceType;
1618
- if (type === IdentityResolverComponentType.Service) {
1521
+ if (instanceConfig.type === IdentityResolverComponentType.Service) {
1522
+ const defaultIdentityResolverType = engineCore.getRegisteredInstanceType("identityResolverConnector");
1619
1523
  component = new identityService.IdentityResolverService({
1620
- fallbackResolverConnectorType: context.defaultTypes.identityResolverConnector !== IdentityResolverConnectorType.Universal
1524
+ fallbackResolverConnectorType: defaultIdentityResolverType !== IdentityResolverConnectorType.Universal
1621
1525
  ? IdentityResolverConnectorType.Universal
1622
1526
  : undefined,
1623
1527
  ...instanceConfig.options
1624
1528
  });
1625
- instanceType = core.StringHelper.kebabCase("IdentityResolverService");
1529
+ instanceType = "identity-resolver-service";
1626
1530
  }
1627
- else if (type === IdentityResolverComponentType.RestClient) {
1531
+ else if (instanceConfig.type === IdentityResolverComponentType.RestClient) {
1628
1532
  component = new identityRestClient.IdentityResolverClient(instanceConfig.options);
1629
- instanceType = core.StringHelper.kebabCase("IdentityResolverClient");
1630
- }
1631
- else {
1632
- throw new core.GeneralError("engineCore", "componentUnknownType", {
1633
- type,
1634
- componentType: "identityResolverComponent"
1635
- });
1533
+ instanceType = "identity-resolver-client";
1636
1534
  }
1637
- const finalInstanceType = overrideInstanceType ?? instanceType;
1638
- context.componentInstances.push({ instanceType: finalInstanceType, component });
1639
- core.ComponentFactory.register(finalInstanceType, () => component);
1640
- return finalInstanceType;
1535
+ return {
1536
+ component,
1537
+ instanceType,
1538
+ factory: core.ComponentFactory
1539
+ };
1641
1540
  }
1642
1541
 
1643
1542
  // Copyright 2024 IOTA Stiftung.
@@ -1664,46 +1563,32 @@ const ImmutableProofComponentType = {
1664
1563
  * @param engineCore The engine core.
1665
1564
  * @param context The context for the engine.
1666
1565
  * @param instanceConfig The instance config.
1667
- * @param overrideInstanceType The instance type to override the default.
1668
- * @returns The name of the instance created.
1669
- * @throws GeneralError if the component type is unknown.
1670
- */
1671
- function initialiseImmutableProofComponent(engineCore, context, instanceConfig, overrideInstanceType) {
1672
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1673
- element: `Immutable Proof Component: ${instanceConfig.type}`
1674
- }));
1675
- const type = instanceConfig.type;
1566
+ * @returns The instance created and the factory for it.
1567
+ */
1568
+ async function initialiseImmutableProofComponent(engineCore, context, instanceConfig) {
1676
1569
  let component;
1677
1570
  let instanceType;
1678
- if (type === ImmutableProofComponentType.Service) {
1571
+ if (instanceConfig.type === ImmutableProofComponentType.Service) {
1679
1572
  immutableProofService.initSchema();
1680
1573
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.immutableProofEntityStorageType, "ImmutableProof");
1681
1574
  component = new immutableProofService.ImmutableProofService({
1682
- verifiableStorageType: context.defaultTypes.verifiableStorageConnector,
1683
- identityConnectorType: context.defaultTypes.identityConnector,
1684
- backgroundTaskConnectorType: context.defaultTypes.backgroundTaskConnector,
1685
- eventBusComponentType: context.defaultTypes.eventBusComponent,
1575
+ verifiableStorageType: engineCore.getRegisteredInstanceType("verifiableStorageConnector"),
1576
+ identityConnectorType: engineCore.getRegisteredInstanceType("identityConnector"),
1577
+ backgroundTaskConnectorType: engineCore.getRegisteredInstanceType("backgroundTaskConnector"),
1578
+ eventBusComponentType: engineCore.getRegisteredInstanceTypeOptional("eventBusComponent"),
1686
1579
  ...instanceConfig.options
1687
1580
  });
1688
- instanceType = core.StringHelper.kebabCase("ImmutableProofService");
1581
+ instanceType = "immutable-proof-service";
1689
1582
  }
1690
- else if (type === ImmutableProofComponentType.RestClient) {
1583
+ else if (instanceConfig.type === ImmutableProofComponentType.RestClient) {
1691
1584
  component = new immutableProofRestClient.ImmutableProofClient(instanceConfig.options);
1692
- instanceType = core.StringHelper.kebabCase("ImmutableProofClient");
1693
- }
1694
- else {
1695
- throw new core.GeneralError("engineCore", "componentUnknownType", {
1696
- type,
1697
- componentType: "immutableProofComponent"
1698
- });
1585
+ instanceType = "immutable-proof-client";
1699
1586
  }
1700
- const finalInstanceType = overrideInstanceType ?? instanceType;
1701
- context.componentInstances.push({
1702
- instanceType: finalInstanceType,
1703
- component
1704
- });
1705
- core.ComponentFactory.register(finalInstanceType, () => component);
1706
- return finalInstanceType;
1587
+ return {
1588
+ component,
1589
+ instanceType,
1590
+ factory: core.ComponentFactory
1591
+ };
1707
1592
  }
1708
1593
 
1709
1594
  // Copyright 2024 IOTA Stiftung.
@@ -1751,81 +1636,72 @@ const LoggingConnectorType = {
1751
1636
  * @param engineCore The engine core.
1752
1637
  * @param context The engine core context.
1753
1638
  * @param instanceConfig The instance config.
1754
- * @param overrideInstanceType The instance type to override the default.
1755
- * @returns The name of the instance created.
1756
- * @throws GeneralError if the connector type is unknown.
1757
- */
1758
- function initialiseLoggingConnector(engineCore, context, instanceConfig, overrideInstanceType) {
1759
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1760
- element: `Logging Connector: ${instanceConfig.type}`
1761
- }));
1762
- const type = instanceConfig.type;
1763
- let connector;
1639
+ * @returns The instance created and the factory for it.
1640
+ */
1641
+ async function initialiseLoggingConnector(engineCore, context, instanceConfig) {
1642
+ let component;
1764
1643
  let instanceType;
1765
- if (type === LoggingConnectorType.Console) {
1766
- connector = new loggingConnectorConsole.ConsoleLoggingConnector(instanceConfig.options);
1644
+ if (instanceConfig.type === LoggingConnectorType.Console) {
1645
+ component = new loggingConnectorConsole.ConsoleLoggingConnector(instanceConfig.options);
1767
1646
  instanceType = loggingConnectorConsole.ConsoleLoggingConnector.NAMESPACE;
1768
1647
  }
1769
- else if (type === LoggingConnectorType.EntityStorage) {
1648
+ else if (instanceConfig.type === LoggingConnectorType.EntityStorage) {
1770
1649
  loggingConnectorEntityStorage.initSchema();
1771
1650
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.logEntryStorageConnectorType, "LogEntry");
1772
- connector = new loggingConnectorEntityStorage.EntityStorageLoggingConnector(instanceConfig.options);
1651
+ component = new loggingConnectorEntityStorage.EntityStorageLoggingConnector(instanceConfig.options);
1773
1652
  instanceType = loggingConnectorEntityStorage.EntityStorageLoggingConnector.NAMESPACE;
1774
1653
  }
1775
- else if (type === LoggingConnectorType.Multi) {
1776
- connector = new loggingModels.MultiLoggingConnector(instanceConfig.options);
1654
+ else if (instanceConfig.type === LoggingConnectorType.Multi) {
1655
+ component = new loggingModels.MultiLoggingConnector(instanceConfig.options);
1777
1656
  instanceType = loggingModels.MultiLoggingConnector.NAMESPACE;
1778
1657
  }
1779
- else {
1780
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
1781
- type,
1782
- connectorType: "loggingConnector"
1783
- });
1784
- }
1785
- const finalInstanceType = overrideInstanceType ?? instanceType;
1786
- context.componentInstances.push({ instanceType: finalInstanceType, component: connector });
1787
- loggingModels.LoggingConnectorFactory.register(finalInstanceType, () => connector);
1788
- return finalInstanceType;
1658
+ return {
1659
+ component,
1660
+ instanceType,
1661
+ factory: loggingModels.LoggingConnectorFactory
1662
+ };
1789
1663
  }
1790
1664
  /**
1791
1665
  * Initialise the logging component.
1792
1666
  * @param engineCore The engine core.
1793
1667
  * @param context The context for the engine.
1794
1668
  * @param instanceConfig The instance config.
1795
- * @param overrideInstanceType The instance type to override the default.
1796
- * @returns The name of the instance created.
1797
- * @throws GeneralError if the component type is unknown.
1798
- */
1799
- function initialiseLoggingComponent(engineCore, context, instanceConfig, overrideInstanceType) {
1800
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1801
- element: `Logging Component: ${instanceConfig.type}`
1802
- }));
1803
- const type = instanceConfig.type;
1669
+ * @returns The instance created and the factory for it.
1670
+ */
1671
+ async function initialiseLoggingComponent(engineCore, context, instanceConfig) {
1804
1672
  let component;
1805
1673
  let instanceType;
1806
- if (type === LoggingComponentType.Service) {
1674
+ if (instanceConfig.type === LoggingComponentType.Service) {
1807
1675
  component = new loggingService.LoggingService({
1808
- loggingConnectorType: context.defaultTypes.loggingConnector,
1676
+ loggingConnectorType: engineCore.getRegisteredInstanceType("loggingConnector"),
1809
1677
  ...instanceConfig.options
1810
1678
  });
1811
- instanceType = core.StringHelper.kebabCase("LoggingService");
1679
+ instanceType = "logging-service";
1812
1680
  }
1813
- else if (type === LoggingComponentType.RestClient) {
1681
+ else if (instanceConfig.type === LoggingComponentType.RestClient) {
1814
1682
  component = new loggingRestClient.LoggingClient(instanceConfig.options);
1815
- instanceType = core.StringHelper.kebabCase("LoggingClient");
1816
- }
1817
- else {
1818
- throw new core.GeneralError("engineCore", "componentUnknownType", {
1819
- type,
1820
- componentType: "loggingComponent"
1821
- });
1683
+ instanceType = "logging-client";
1822
1684
  }
1823
- const finalInstanceType = overrideInstanceType ?? instanceType;
1824
- context.componentInstances.push({ instanceType: finalInstanceType, component });
1825
- core.ComponentFactory.register(finalInstanceType, () => component);
1826
- return finalInstanceType;
1685
+ return {
1686
+ component,
1687
+ instanceType,
1688
+ factory: core.ComponentFactory
1689
+ };
1827
1690
  }
1828
1691
 
1692
+ // Copyright 2024 IOTA Stiftung.
1693
+ // SPDX-License-Identifier: Apache-2.0.
1694
+ /**
1695
+ * Messaging admin component types.
1696
+ */
1697
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1698
+ const MessagingAdminComponentType = {
1699
+ /**
1700
+ * Service.
1701
+ */
1702
+ Service: "service"
1703
+ };
1704
+
1829
1705
  // Copyright 2024 IOTA Stiftung.
1830
1706
  // SPDX-License-Identifier: Apache-2.0.
1831
1707
  /**
@@ -1897,168 +1773,147 @@ const MessagingSmsConnectorType = {
1897
1773
  * @param engineCore The engine core.
1898
1774
  * @param context The context for the engine.
1899
1775
  * @param instanceConfig The instance config.
1900
- * @param overrideInstanceType The instance type to override the default.
1901
- * @returns The name of the instance created.
1902
- * @throws GeneralError if the connector type is unknown.
1903
- */
1904
- function initialiseMessagingEmailConnector(engineCore, context, instanceConfig, overrideInstanceType) {
1905
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1906
- element: `Messaging Email Connector: ${instanceConfig.type}`
1907
- }));
1908
- const type = instanceConfig.type;
1909
- let connector;
1776
+ * @returns The instance created and the factory for it.
1777
+ */
1778
+ async function initialiseMessagingEmailConnector(engineCore, context, instanceConfig) {
1779
+ let component;
1910
1780
  let instanceType;
1911
- if (type === MessagingEmailConnectorType.EntityStorage) {
1781
+ if (instanceConfig.type === MessagingEmailConnectorType.EntityStorage) {
1912
1782
  messagingConnectorEntityStorage.initSchema({ email: true, sms: false, pushNotification: false });
1913
1783
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.messagingEmailEntryStorageConnectorType, "EmailEntry");
1914
- connector = new messagingConnectorEntityStorage.EntityStorageMessagingEmailConnector({
1915
- loggingConnectorType: context.defaultTypes.loggingConnector,
1784
+ component = new messagingConnectorEntityStorage.EntityStorageMessagingEmailConnector({
1785
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
1916
1786
  ...instanceConfig.options
1917
1787
  });
1918
1788
  instanceType = messagingConnectorEntityStorage.EntityStorageMessagingEmailConnector.NAMESPACE;
1919
1789
  }
1920
- else if (type === MessagingEmailConnectorType.Aws) {
1921
- connector = new messagingConnectorAws.AwsMessagingEmailConnector({
1922
- loggingConnectorType: context.defaultTypes.loggingConnector,
1790
+ else if (instanceConfig.type === MessagingEmailConnectorType.Aws) {
1791
+ component = new messagingConnectorAws.AwsMessagingEmailConnector({
1792
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
1923
1793
  ...instanceConfig.options
1924
1794
  });
1925
1795
  instanceType = messagingConnectorAws.AwsMessagingEmailConnector.NAMESPACE;
1926
1796
  }
1927
- else {
1928
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
1929
- type,
1930
- connectorType: "messagingEmailConnector"
1931
- });
1932
- }
1933
- const finalInstanceType = overrideInstanceType ?? instanceType;
1934
- context.componentInstances.push({ instanceType: finalInstanceType, component: connector });
1935
- messagingModels.MessagingEmailConnectorFactory.register(finalInstanceType, () => connector);
1936
- return finalInstanceType;
1797
+ return {
1798
+ component,
1799
+ instanceType,
1800
+ factory: messagingModels.MessagingEmailConnectorFactory
1801
+ };
1937
1802
  }
1938
1803
  /**
1939
1804
  * Initialise a messaging sms connector.
1940
1805
  * @param engineCore The engine core.
1941
1806
  * @param context The context for the engine.
1942
1807
  * @param instanceConfig The instance config.
1943
- * @param overrideInstanceType The instance type to override the default.
1944
- * @returns The name of the instance created.
1945
- * @throws GeneralError if the connector type is unknown.
1946
- */
1947
- function initialiseMessagingSmsConnector(engineCore, context, instanceConfig, overrideInstanceType) {
1948
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1949
- element: `Messaging SMS Connector: ${instanceConfig.type}`
1950
- }));
1951
- const type = instanceConfig.type;
1808
+ * @returns The instance created and the factory for it.
1809
+ */
1810
+ async function initialiseMessagingSmsConnector(engineCore, context, instanceConfig) {
1952
1811
  let connector;
1953
1812
  let instanceType;
1954
- if (type === MessagingSmsConnectorType.EntityStorage) {
1813
+ if (instanceConfig.type === MessagingSmsConnectorType.EntityStorage) {
1955
1814
  messagingConnectorEntityStorage.initSchema({ email: false, sms: true, pushNotification: false });
1956
1815
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.messagingSmsEntryStorageConnectorType, "SmsEntry");
1957
1816
  connector = new messagingConnectorEntityStorage.EntityStorageMessagingSmsConnector({
1958
- loggingConnectorType: context.defaultTypes.loggingConnector,
1817
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
1959
1818
  ...instanceConfig.options
1960
1819
  });
1961
1820
  instanceType = messagingConnectorEntityStorage.EntityStorageMessagingSmsConnector.NAMESPACE;
1962
1821
  }
1963
- else if (type === MessagingSmsConnectorType.Aws) {
1822
+ else if (instanceConfig.type === MessagingSmsConnectorType.Aws) {
1964
1823
  connector = new messagingConnectorAws.AwsMessagingSmsConnector({
1965
- loggingConnectorType: context.defaultTypes.loggingConnector,
1824
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
1966
1825
  ...instanceConfig.options
1967
1826
  });
1968
1827
  instanceType = messagingConnectorAws.AwsMessagingSmsConnector.NAMESPACE;
1969
1828
  }
1970
- else {
1971
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
1972
- type,
1973
- connectorType: "messagingSmsConnector"
1974
- });
1975
- }
1976
- const finalInstanceType = overrideInstanceType ?? instanceType;
1977
- context.componentInstances.push({ instanceType: finalInstanceType, component: connector });
1978
- messagingModels.MessagingSmsConnectorFactory.register(finalInstanceType, () => connector);
1979
- return finalInstanceType;
1829
+ return {
1830
+ instanceType,
1831
+ factory: messagingModels.MessagingSmsConnectorFactory,
1832
+ component: connector
1833
+ };
1980
1834
  }
1981
1835
  /**
1982
1836
  * Initialise a messaging push notification connector.
1983
1837
  * @param engineCore The engine core.
1984
1838
  * @param context The context for the engine.
1985
1839
  * @param instanceConfig The instance config.
1986
- * @param overrideInstanceType The instance type to override the default.
1987
- * @returns The name of the instance created.
1988
- * @throws GeneralError if the connector type is unknown.
1989
- */
1990
- function initialiseMessagingPushNotificationConnector(engineCore, context, instanceConfig, overrideInstanceType) {
1991
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
1992
- element: `Messaging Push Notification Connector: ${instanceConfig.type}`
1993
- }));
1994
- const type = instanceConfig.type;
1995
- let connector;
1840
+ * @returns The instance created and the factory for it.
1841
+ */
1842
+ async function initialiseMessagingPushNotificationConnector(engineCore, context, instanceConfig) {
1843
+ let component;
1996
1844
  let instanceType;
1997
- if (type === MessagingPushNotificationConnectorType.EntityStorage) {
1845
+ if (instanceConfig.type === MessagingPushNotificationConnectorType.EntityStorage) {
1998
1846
  messagingConnectorEntityStorage.initSchema({ email: false, sms: false, pushNotification: true });
1999
1847
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.messagingDeviceEntryStorageConnectorType, "PushNotificationDeviceEntry");
2000
1848
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.messagingMessageEntryStorageConnectorType, "PushNotificationMessageEntry");
2001
- connector = new messagingConnectorEntityStorage.EntityStorageMessagingPushNotificationConnector({
2002
- loggingConnectorType: context.defaultTypes.loggingConnector,
1849
+ component = new messagingConnectorEntityStorage.EntityStorageMessagingPushNotificationConnector({
1850
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
2003
1851
  ...instanceConfig.options
2004
1852
  });
2005
1853
  instanceType = messagingConnectorEntityStorage.EntityStorageMessagingPushNotificationConnector.NAMESPACE;
2006
1854
  }
2007
- else if (type === MessagingPushNotificationConnectorType.Aws) {
2008
- connector = new messagingConnectorAws.AwsMessagingPushNotificationConnector({
2009
- loggingConnectorType: context.defaultTypes.loggingConnector,
1855
+ else if (instanceConfig.type === MessagingPushNotificationConnectorType.Aws) {
1856
+ component = new messagingConnectorAws.AwsMessagingPushNotificationConnector({
1857
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
2010
1858
  ...instanceConfig.options
2011
1859
  });
2012
1860
  instanceType = messagingConnectorAws.AwsMessagingPushNotificationConnector.NAMESPACE;
2013
1861
  }
2014
- else {
2015
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
2016
- type,
2017
- connectorType: "messagingPushNotificationConnector"
2018
- });
2019
- }
2020
- const finalInstanceType = overrideInstanceType ?? instanceType;
2021
- context.componentInstances.push({ instanceType: finalInstanceType, component: connector });
2022
- messagingModels.MessagingPushNotificationsConnectorFactory.register(finalInstanceType, () => connector);
2023
- return finalInstanceType;
1862
+ return {
1863
+ component,
1864
+ instanceType,
1865
+ factory: messagingModels.MessagingPushNotificationsConnectorFactory
1866
+ };
2024
1867
  }
2025
1868
  /**
2026
1869
  * Initialise the messaging component.
2027
1870
  * @param engineCore The engine core.
2028
1871
  * @param context The context for the engine.
2029
1872
  * @param instanceConfig The instance config.
2030
- * @param overrideInstanceType The instance type to override the default.
2031
- * @returns The name of the instance created.
2032
- * @throws GeneralError if the component type is unknown.
2033
- */
2034
- function initialiseMessagingComponent(engineCore, context, instanceConfig, overrideInstanceType) {
2035
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
2036
- element: `Messaging Component: ${instanceConfig.type}`
2037
- }));
2038
- const type = instanceConfig.type;
1873
+ * @returns The instance created and the factory for it.
1874
+ */
1875
+ async function initialiseMessagingComponent(engineCore, context, instanceConfig) {
2039
1876
  let component;
2040
1877
  let instanceType;
2041
- if (type === MessagingComponentType.Service) {
2042
- messagingService.initSchema();
2043
- initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.templateEntryStorageConnectorType, "TemplateEntry");
1878
+ if (instanceConfig.type === MessagingComponentType.Service) {
2044
1879
  component = new messagingService.MessagingService({
2045
- messagingEmailConnectorType: context.defaultTypes.messagingEmailConnector,
2046
- messagingSmsConnectorType: context.defaultTypes.messagingSmsConnector,
2047
- messagingPushNotificationConnectorType: context.defaultTypes.messagingNotificationConnector,
1880
+ messagingEmailConnectorType: engineCore.getRegisteredInstanceTypeOptional("messagingEmailConnector"),
1881
+ messagingSmsConnectorType: engineCore.getRegisteredInstanceTypeOptional("messagingSmsConnector"),
1882
+ messagingPushNotificationConnectorType: engineCore.getRegisteredInstanceTypeOptional("messagingNotificationConnector"),
1883
+ messagingAdminComponentType: engineCore.getRegisteredInstanceTypeOptional("messagingAdminComponent"),
2048
1884
  ...instanceConfig.options
2049
1885
  });
2050
- instanceType = core.StringHelper.kebabCase("MessagingService");
1886
+ instanceType = "messaging-service";
2051
1887
  }
2052
- else {
2053
- throw new core.GeneralError("engineCore", "componentUnknownType", {
2054
- type,
2055
- componentType: "messagingComponent"
1888
+ return {
1889
+ component,
1890
+ instanceType,
1891
+ factory: core.ComponentFactory
1892
+ };
1893
+ }
1894
+ /**
1895
+ * Initialise the messaging admin component.
1896
+ * @param engineCore The engine core.
1897
+ * @param context The context for the engine.
1898
+ * @param instanceConfig The instance config.
1899
+ * @returns The instance created and the factory for it.
1900
+ */
1901
+ async function initialiseMessagingAdminComponent(engineCore, context, instanceConfig) {
1902
+ let component;
1903
+ let instanceType;
1904
+ if (instanceConfig.type === MessagingAdminComponentType.Service) {
1905
+ messagingService.initSchema();
1906
+ initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.templateEntryStorageConnectorType, "TemplateEntry");
1907
+ component = new messagingService.MessagingAdminService({
1908
+ ...instanceConfig.options
2056
1909
  });
1910
+ instanceType = "messaging-admin-service";
2057
1911
  }
2058
- const finalInstanceType = overrideInstanceType ?? instanceType;
2059
- context.componentInstances.push({ instanceType: finalInstanceType, component });
2060
- core.ComponentFactory.register(finalInstanceType, () => component);
2061
- return finalInstanceType;
1912
+ return {
1913
+ component,
1914
+ instanceType,
1915
+ factory: core.ComponentFactory
1916
+ };
2062
1917
  }
2063
1918
 
2064
1919
  // Copyright 2024 IOTA Stiftung.
@@ -2102,91 +1957,69 @@ const NftConnectorType = {
2102
1957
  * @param engineCore The engine core.
2103
1958
  * @param context The context for the engine.
2104
1959
  * @param instanceConfig The instance config.
2105
- * @param overrideInstanceType The instance type to override the default.
2106
- * @returns The name of the instance created.
2107
- * @throws GeneralError if the connector type is unknown.
2108
- */
2109
- function initialiseNftConnector(engineCore, context, instanceConfig, overrideInstanceType) {
2110
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
2111
- element: `NFT Connector: ${instanceConfig.type}`
2112
- }));
2113
- const type = instanceConfig.type;
2114
- let connector;
1960
+ * @returns The instance created and the factory for it.
1961
+ */
1962
+ async function initialiseNftConnector(engineCore, context, instanceConfig) {
1963
+ let component;
2115
1964
  let instanceType;
2116
- if (type === NftConnectorType.EntityStorage) {
1965
+ if (instanceConfig.type === NftConnectorType.EntityStorage) {
2117
1966
  nftConnectorEntityStorage.initSchema();
2118
1967
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.nftEntityStorageType, "Nft");
2119
- connector = new nftConnectorEntityStorage.EntityStorageNftConnector(instanceConfig.options);
1968
+ component = new nftConnectorEntityStorage.EntityStorageNftConnector(instanceConfig.options);
2120
1969
  instanceType = nftConnectorEntityStorage.EntityStorageNftConnector.NAMESPACE;
2121
1970
  }
2122
- else if (type === NftConnectorType.Iota) {
2123
- connector = new nftConnectorIota.IotaNftConnector({
2124
- vaultConnectorType: context.defaultTypes.vaultConnector,
2125
- walletConnectorType: context.defaultTypes.walletConnector,
2126
- ...instanceConfig.options
1971
+ else if (instanceConfig.type === NftConnectorType.Iota) {
1972
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
1973
+ component = new nftConnectorIota.IotaNftConnector({
1974
+ vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
1975
+ walletConnectorType: engineCore.getRegisteredInstanceType("walletConnector"),
1976
+ loggingComponentType: engineCore.getRegisteredInstanceTypeOptional("loggingComponent"),
1977
+ ...instanceConfig.options,
1978
+ config: {
1979
+ ...dltConfig?.options?.config,
1980
+ ...instanceConfig.options.config
1981
+ }
2127
1982
  });
2128
1983
  instanceType = nftConnectorIota.IotaNftConnector.NAMESPACE;
2129
1984
  }
2130
- else {
2131
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
2132
- type,
2133
- connectorType: "nftConnector"
2134
- });
2135
- }
2136
- const finalInstanceType = overrideInstanceType ?? instanceType;
2137
- context.componentInstances.push({
2138
- instanceType: finalInstanceType,
2139
- component: connector
2140
- });
2141
- nftModels.NftConnectorFactory.register(finalInstanceType, () => connector);
2142
- return finalInstanceType;
1985
+ return {
1986
+ component,
1987
+ instanceType,
1988
+ factory: nftModels.NftConnectorFactory
1989
+ };
2143
1990
  }
2144
1991
  /**
2145
1992
  * Initialise the NFT component.
2146
1993
  * @param engineCore The engine core.
2147
1994
  * @param context The context for the engine.
2148
1995
  * @param instanceConfig The instance config.
2149
- * @param overrideInstanceType The instance type to override the default.
2150
- * @returns The name of the instance created.
2151
- * @throws GeneralError if the component type is unknown.
2152
- */
2153
- function initialiseNftComponent(engineCore, context, instanceConfig, overrideInstanceType) {
2154
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
2155
- element: `Nft Storage Component: ${instanceConfig.type}`
2156
- }));
2157
- const type = instanceConfig.type;
1996
+ * @returns The instance created and the factory for it.
1997
+ */
1998
+ async function initialiseNftComponent(engineCore, context, instanceConfig) {
2158
1999
  let component;
2159
2000
  let instanceType;
2160
- if (type === NftComponentType.Service) {
2001
+ if (instanceConfig.type === NftComponentType.Service) {
2161
2002
  component = new nftService.NftService(instanceConfig.options);
2162
- instanceType = core.StringHelper.kebabCase("NftService");
2003
+ instanceType = "nft-service";
2163
2004
  }
2164
- else if (type === NftComponentType.RestClient) {
2005
+ else if (instanceConfig.type === NftComponentType.RestClient) {
2165
2006
  component = new nftRestClient.NftClient(instanceConfig.options);
2166
- instanceType = core.StringHelper.kebabCase("NftClient");
2007
+ instanceType = "nft-client";
2167
2008
  }
2168
- else {
2169
- throw new core.GeneralError("engineCore", "componentUnknownType", {
2170
- type,
2171
- componentType: "nftComponent"
2172
- });
2173
- }
2174
- const finalInstanceType = overrideInstanceType ?? instanceType;
2175
- context.componentInstances.push({
2176
- instanceType: finalInstanceType,
2177
- component
2178
- });
2179
- core.ComponentFactory.register(finalInstanceType, () => component);
2180
- return finalInstanceType;
2009
+ return {
2010
+ component,
2011
+ instanceType,
2012
+ factory: core.ComponentFactory
2013
+ };
2181
2014
  }
2182
2015
 
2183
2016
  // Copyright 2024 IOTA Stiftung.
2184
2017
  // SPDX-License-Identifier: Apache-2.0.
2185
2018
  /**
2186
- * Rights management component types.
2019
+ * Rights management DAP component types.
2187
2020
  */
2188
2021
  // eslint-disable-next-line @typescript-eslint/naming-convention
2189
- const RightsManagementComponentType = {
2022
+ const RightsManagementDapComponentType = {
2190
2023
  /**
2191
2024
  * Service.
2192
2025
  */
@@ -2200,45 +2033,80 @@ const RightsManagementComponentType = {
2200
2033
  // Copyright 2024 IOTA Stiftung.
2201
2034
  // SPDX-License-Identifier: Apache-2.0.
2202
2035
  /**
2203
- * Initialise the rights management component.
2036
+ * Initialise the rights management DAP component.
2204
2037
  * @param engineCore The engine core.
2205
2038
  * @param context The context for the engine.
2206
2039
  * @param instanceConfig The instance config.
2207
- * @param overrideInstanceType The instance type to override the default.
2208
- * @returns The name of the instance created.
2209
- * @throws GeneralError if the component type is unknown.
2210
- */
2211
- function initialiseRightsManagementComponent(engineCore, context, instanceConfig, overrideInstanceType) {
2212
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
2213
- element: `Rights Management Component: ${instanceConfig.type}`
2214
- }));
2215
- const type = instanceConfig.type;
2040
+ * @returns The instance created and the factory for it.
2041
+ */
2042
+ async function initialiseRightsManagementDapComponent(engineCore, context, instanceConfig) {
2216
2043
  let component;
2217
2044
  let instanceType;
2218
- if (type === RightsManagementComponentType.Service) {
2219
- component = new rightsManagementService.RightsManagementService({
2220
- papComponentType: context.defaultTypes.rightsManagementPapComponent,
2221
- ...instanceConfig.options
2045
+ if (instanceConfig.type === RightsManagementDapComponentType.Service) {
2046
+ component = new rightsManagementDapService.DataAccessPointService({
2047
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
2048
+ policyEnforcementPointComponentType: engineCore.getRegisteredInstanceType("rightsManagementPepComponent"),
2049
+ ...instanceConfig.options,
2050
+ config: {
2051
+ ...instanceConfig.options?.config
2052
+ }
2222
2053
  });
2223
- instanceType = core.StringHelper.kebabCase("RightsManagementService");
2054
+ instanceType = "data-access-point-service";
2224
2055
  }
2225
- else if (type === RightsManagementComponentType.RestClient) {
2226
- component = new rightsManagementRestClient.RightsManagementClient(instanceConfig.options);
2227
- instanceType = core.StringHelper.kebabCase("RightsManagementClient");
2228
- }
2229
- else {
2230
- throw new core.GeneralError("engineCore", "componentUnknownType", {
2231
- type,
2232
- componentType: "RightsManagementComponent"
2056
+ else if (instanceConfig.type === RightsManagementDapComponentType.RestClient) {
2057
+ component = new rightsManagementRestClient.DataAccessPointClient({
2058
+ ...instanceConfig.options,
2059
+ authenticationGeneratorType: instanceConfig.options?.authenticationGeneratorType ??
2060
+ engineCore.getRegisteredInstanceType("authenticationGeneratorComponent", [
2061
+ "verifiable-credential"
2062
+ ])
2063
+ });
2064
+ instanceType = "data-access-point-client";
2065
+ }
2066
+ return {
2067
+ component,
2068
+ instanceType,
2069
+ factory: core.ComponentFactory
2070
+ };
2071
+ }
2072
+
2073
+ // Copyright 2024 IOTA Stiftung.
2074
+ // SPDX-License-Identifier: Apache-2.0.
2075
+ /**
2076
+ * Rights management DARP component types.
2077
+ */
2078
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2079
+ const RightsManagementDarpComponentType = {
2080
+ /**
2081
+ * Service.
2082
+ */
2083
+ Service: "service"
2084
+ };
2085
+
2086
+ // Copyright 2024 IOTA Stiftung.
2087
+ // SPDX-License-Identifier: Apache-2.0.
2088
+ /**
2089
+ * Initialise the rights management DARP component.
2090
+ * @param engineCore The engine core.
2091
+ * @param context The context for the engine.
2092
+ * @param instanceConfig The instance config.
2093
+ * @returns The instance created and the factory for it.
2094
+ */
2095
+ async function initialiseRightsManagementDarpComponent(engineCore, context, instanceConfig) {
2096
+ let component;
2097
+ let instanceType;
2098
+ if (instanceConfig.type === RightsManagementDarpComponentType.Service) {
2099
+ component = new rightsManagementDapService.DataAccessRequestPointService({
2100
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
2101
+ ...instanceConfig.options
2233
2102
  });
2103
+ instanceType = "data-access-request-point-service";
2234
2104
  }
2235
- const finalInstanceType = overrideInstanceType ?? instanceType;
2236
- context.componentInstances.push({
2237
- instanceType: finalInstanceType,
2238
- component
2239
- });
2240
- core.ComponentFactory.register(finalInstanceType, () => component);
2241
- return finalInstanceType;
2105
+ return {
2106
+ component,
2107
+ instanceType,
2108
+ factory: core.ComponentFactory
2109
+ };
2242
2110
  }
2243
2111
 
2244
2112
  // Copyright 2024 IOTA Stiftung.
@@ -2251,7 +2119,11 @@ const RightsManagementPapComponentType = {
2251
2119
  /**
2252
2120
  * Service.
2253
2121
  */
2254
- Service: "service"
2122
+ Service: "service",
2123
+ /**
2124
+ * REST client.
2125
+ */
2126
+ RestClient: "rest-client"
2255
2127
  };
2256
2128
 
2257
2129
  // Copyright 2024 IOTA Stiftung.
@@ -2261,36 +2133,479 @@ const RightsManagementPapComponentType = {
2261
2133
  * @param engineCore The engine core.
2262
2134
  * @param context The context for the engine.
2263
2135
  * @param instanceConfig The instance config.
2264
- * @param overrideInstanceType The instance type to override the default.
2265
- * @returns The name of the instance created.
2266
- * @throws GeneralError if the component type is unknown.
2267
- */
2268
- function initialiseRightsManagementPapComponent(engineCore, context, instanceConfig, overrideInstanceType) {
2269
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
2270
- element: `Rights Management PAP Component: ${instanceConfig.type}`
2271
- }));
2272
- const type = instanceConfig.type;
2136
+ * @returns The instance created and the factory for it.
2137
+ */
2138
+ async function initialiseRightsManagementPapComponent(engineCore, context, instanceConfig) {
2273
2139
  let component;
2274
2140
  let instanceType;
2275
- if (type === RightsManagementPapComponentType.Service) {
2141
+ if (instanceConfig.type === RightsManagementPapComponentType.Service) {
2276
2142
  rightsManagementPapService.initSchema();
2277
2143
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.odrlPolicyEntityStorageType, "OdrlPolicy");
2278
- component = new rightsManagementPapService.PolicyAdministrationPointService(instanceConfig.options);
2279
- instanceType = core.StringHelper.kebabCase("PolicyAdministrationPointService");
2144
+ component = new rightsManagementPapService.PolicyAdministrationPointService({
2145
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
2146
+ ...instanceConfig.options
2147
+ });
2148
+ instanceType = "policy-administration-point-service";
2149
+ }
2150
+ else if (instanceConfig.type === RightsManagementPapComponentType.RestClient) {
2151
+ component = new rightsManagementRestClient.PolicyAdministrationPointClient(instanceConfig.options);
2152
+ instanceType = "policy-administration-point-client";
2280
2153
  }
2281
- else {
2282
- throw new core.GeneralError("engineCore", "componentUnknownType", {
2283
- type,
2284
- componentType: "RightsManagementPapComponent"
2154
+ return {
2155
+ component,
2156
+ instanceType,
2157
+ factory: core.ComponentFactory
2158
+ };
2159
+ }
2160
+
2161
+ // Copyright 2024 IOTA Stiftung.
2162
+ // SPDX-License-Identifier: Apache-2.0.
2163
+ /**
2164
+ * Rights management PDP component types.
2165
+ */
2166
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2167
+ const RightsManagementPdpComponentType = {
2168
+ /**
2169
+ * Service.
2170
+ */
2171
+ Service: "service"
2172
+ };
2173
+
2174
+ // Copyright 2024 IOTA Stiftung.
2175
+ // SPDX-License-Identifier: Apache-2.0.
2176
+ /**
2177
+ * Initialise the rights management PDP component.
2178
+ * @param engineCore The engine core.
2179
+ * @param context The context for the engine.
2180
+ * @param instanceConfig The instance config.
2181
+ * @returns The instance created and the factory for it.
2182
+ */
2183
+ async function initialiseRightsManagementPdpComponent(engineCore$1, context, instanceConfig) {
2184
+ let component;
2185
+ let instanceType;
2186
+ if (instanceConfig.type === RightsManagementPdpComponentType.Service) {
2187
+ const arbiterModules = [];
2188
+ if (core.Is.arrayValue(instanceConfig.options?.arbiterModulesConfig)) {
2189
+ for (const moduleConfig of instanceConfig.options.arbiterModulesConfig) {
2190
+ arbiterModules.push({
2191
+ arbiterId: moduleConfig.id,
2192
+ arbiter: await engineCore.EngineModuleHelper.loadComponent(engineCore$1, moduleConfig)
2193
+ });
2194
+ }
2195
+ }
2196
+ component = new rightsManagementPdpService.PolicyDecisionPointService({
2197
+ loggingComponentType: engineCore$1.getRegisteredInstanceType("loggingComponent"),
2198
+ policyInformationPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPipComponent"),
2199
+ policyManagementPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPmpComponent"),
2200
+ policyExecutionPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPxpComponent"),
2201
+ ...instanceConfig.options,
2202
+ config: {
2203
+ ...instanceConfig.options?.config,
2204
+ arbiters: instanceConfig.options?.config?.arbiters ?? arbiterModules
2205
+ }
2285
2206
  });
2207
+ instanceType = "policy-decision-point-service";
2286
2208
  }
2287
- const finalInstanceType = overrideInstanceType ?? instanceType;
2288
- context.componentInstances.push({
2289
- instanceType: finalInstanceType,
2290
- component
2291
- });
2292
- core.ComponentFactory.register(finalInstanceType, () => component);
2293
- return finalInstanceType;
2209
+ return {
2210
+ component,
2211
+ instanceType,
2212
+ factory: core.ComponentFactory
2213
+ };
2214
+ }
2215
+
2216
+ // Copyright 2024 IOTA Stiftung.
2217
+ // SPDX-License-Identifier: Apache-2.0.
2218
+ /**
2219
+ * Rights management PEP component types.
2220
+ */
2221
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2222
+ const RightsManagementPepComponentType = {
2223
+ /**
2224
+ * Service.
2225
+ */
2226
+ Service: "service",
2227
+ /**
2228
+ * REST client.
2229
+ */
2230
+ RestClient: "rest-client"
2231
+ };
2232
+
2233
+ // Copyright 2024 IOTA Stiftung.
2234
+ // SPDX-License-Identifier: Apache-2.0.
2235
+ /**
2236
+ * Initialise the rights management PEP component.
2237
+ * @param engineCore The engine core.
2238
+ * @param context The context for the engine.
2239
+ * @param instanceConfig The instance config.
2240
+ * @returns The instance created and the factory for it.
2241
+ */
2242
+ async function initialiseRightsManagementPepComponent(engineCore$1, context, instanceConfig) {
2243
+ let component;
2244
+ let instanceType;
2245
+ if (instanceConfig.type === RightsManagementPepComponentType.Service) {
2246
+ const processorModules = [];
2247
+ if (core.Is.arrayValue(instanceConfig.options?.processorModulesConfig)) {
2248
+ for (const moduleConfig of instanceConfig.options.processorModulesConfig) {
2249
+ processorModules.push({
2250
+ processorId: moduleConfig.id,
2251
+ processor: await engineCore.EngineModuleHelper.loadComponent(engineCore$1, moduleConfig)
2252
+ });
2253
+ }
2254
+ }
2255
+ component = new rightsManagementPepService.PolicyEnforcementPointService({
2256
+ loggingComponentType: engineCore$1.getRegisteredInstanceType("loggingComponent"),
2257
+ policyDecisionPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPdpComponent"),
2258
+ ...instanceConfig.options,
2259
+ config: {
2260
+ ...instanceConfig.options?.config,
2261
+ processors: instanceConfig.options?.config?.processors ?? processorModules
2262
+ }
2263
+ });
2264
+ instanceType = "policy-enforcement-point-service";
2265
+ }
2266
+ return {
2267
+ component,
2268
+ instanceType,
2269
+ factory: core.ComponentFactory
2270
+ };
2271
+ }
2272
+
2273
+ // Copyright 2024 IOTA Stiftung.
2274
+ // SPDX-License-Identifier: Apache-2.0.
2275
+ /**
2276
+ * Rights management PIP component types.
2277
+ */
2278
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2279
+ const RightsManagementPipComponentType = {
2280
+ /**
2281
+ * Service.
2282
+ */
2283
+ Service: "service"
2284
+ };
2285
+
2286
+ // Copyright 2024 IOTA Stiftung.
2287
+ // SPDX-License-Identifier: Apache-2.0.
2288
+ /**
2289
+ * Initialise the rights management PIP component.
2290
+ * @param engineCore The engine core.
2291
+ * @param context The context for the engine.
2292
+ * @param instanceConfig The instance config.
2293
+ * @returns The instance created and the factory for it.
2294
+ */
2295
+ async function initialiseRightsManagementPipComponent(engineCore$1, context, instanceConfig) {
2296
+ let component;
2297
+ let instanceType;
2298
+ if (instanceConfig.type === RightsManagementPipComponentType.Service) {
2299
+ const informationSourceModules = [];
2300
+ if (core.Is.arrayValue(instanceConfig.options?.informationModulesConfig)) {
2301
+ for (const moduleConfig of instanceConfig.options.informationModulesConfig) {
2302
+ informationSourceModules.push({
2303
+ sourceId: moduleConfig.id,
2304
+ source: await engineCore.EngineModuleHelper.loadComponent(engineCore$1, moduleConfig)
2305
+ });
2306
+ }
2307
+ }
2308
+ component = new rightsManagementPipService.PolicyInformationPointService({
2309
+ loggingComponentType: engineCore$1.getRegisteredInstanceType("loggingComponent"),
2310
+ ...instanceConfig.options,
2311
+ config: {
2312
+ ...instanceConfig.options?.config,
2313
+ sources: instanceConfig.options?.config?.sources ?? informationSourceModules
2314
+ }
2315
+ });
2316
+ instanceType = "policy-information-point-service";
2317
+ }
2318
+ return {
2319
+ component,
2320
+ instanceType,
2321
+ factory: core.ComponentFactory
2322
+ };
2323
+ }
2324
+
2325
+ // Copyright 2024 IOTA Stiftung.
2326
+ // SPDX-License-Identifier: Apache-2.0.
2327
+ /**
2328
+ * Rights management PMP component types.
2329
+ */
2330
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2331
+ const RightsManagementPmpComponentType = {
2332
+ /**
2333
+ * Service.
2334
+ */
2335
+ Service: "service"
2336
+ };
2337
+
2338
+ // Copyright 2024 IOTA Stiftung.
2339
+ // SPDX-License-Identifier: Apache-2.0.
2340
+ /**
2341
+ * Initialise the rights management PMP component.
2342
+ * @param engineCore The engine core.
2343
+ * @param context The context for the engine.
2344
+ * @param instanceConfig The instance config.
2345
+ * @returns The instance created and the factory for it.
2346
+ */
2347
+ async function initialiseRightsManagementPmpComponent(engineCore, context, instanceConfig) {
2348
+ let component;
2349
+ let instanceType;
2350
+ if (instanceConfig.type === RightsManagementPmpComponentType.Service) {
2351
+ component = new rightsManagementPmpService.PolicyManagementPointService({
2352
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
2353
+ policyAdministrationPointComponentType: engineCore.getRegisteredInstanceType("rightsManagementPapComponent"),
2354
+ ...instanceConfig.options
2355
+ });
2356
+ instanceType = "policy-management-point-service";
2357
+ }
2358
+ return {
2359
+ component,
2360
+ instanceType,
2361
+ factory: core.ComponentFactory
2362
+ };
2363
+ }
2364
+
2365
+ // Copyright 2024 IOTA Stiftung.
2366
+ // SPDX-License-Identifier: Apache-2.0.
2367
+ /**
2368
+ * Rights management PNAP component types.
2369
+ */
2370
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2371
+ const RightsManagementPnapComponentType = {
2372
+ /**
2373
+ * Service.
2374
+ */
2375
+ Service: "service",
2376
+ /**
2377
+ * REST client.
2378
+ */
2379
+ RestClient: "rest-client"
2380
+ };
2381
+
2382
+ // Copyright 2024 IOTA Stiftung.
2383
+ // SPDX-License-Identifier: Apache-2.0.
2384
+ /**
2385
+ * Initialise the rights management PNAP component.
2386
+ * @param engineCore The engine core.
2387
+ * @param context The context for the engine.
2388
+ * @param instanceConfig The instance config.
2389
+ * @returns The instance created and the factory for it.
2390
+ */
2391
+ async function initialiseRightsManagementPnapComponent(engineCore, context, instanceConfig) {
2392
+ let component;
2393
+ let instanceType;
2394
+ if (instanceConfig.type === RightsManagementPnapComponentType.Service) {
2395
+ rightsManagementPnpService.initSchema();
2396
+ initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.policyNegotiationEntityStorageType, "PolicyNegotiation");
2397
+ component = new rightsManagementPnpService.PolicyNegotiationAdminPointService({
2398
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
2399
+ taskSchedulerComponentType: engineCore.getRegisteredInstanceType("taskSchedulerComponent"),
2400
+ policyInformationPointComponentType: engineCore.getRegisteredInstanceType("rightsManagementPipComponent"),
2401
+ ...instanceConfig.options
2402
+ });
2403
+ instanceType = "policy-negotiation-admin-point-service";
2404
+ }
2405
+ else if (instanceConfig.type === RightsManagementPnapComponentType.RestClient) {
2406
+ component = new rightsManagementRestClient.PolicyNegotiationAdminPointClient(instanceConfig.options);
2407
+ instanceType = "policy-negotiation-admin-point-client";
2408
+ }
2409
+ return {
2410
+ component,
2411
+ instanceType,
2412
+ factory: core.ComponentFactory
2413
+ };
2414
+ }
2415
+
2416
+ // Copyright 2024 IOTA Stiftung.
2417
+ // SPDX-License-Identifier: Apache-2.0.
2418
+ /**
2419
+ * Rights management PNP component types.
2420
+ */
2421
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2422
+ const RightsManagementPnpComponentType = {
2423
+ /**
2424
+ * Service.
2425
+ */
2426
+ Service: "service",
2427
+ /**
2428
+ * REST client.
2429
+ */
2430
+ RestClient: "rest-client"
2431
+ };
2432
+
2433
+ // Copyright 2024 IOTA Stiftung.
2434
+ // SPDX-License-Identifier: Apache-2.0.
2435
+ /**
2436
+ * Initialise the rights management PNP component.
2437
+ * @param engineCore The engine core.
2438
+ * @param context The context for the engine.
2439
+ * @param instanceConfig The instance config.
2440
+ * @returns The instance created and the factory for it.
2441
+ */
2442
+ async function initialiseRightsManagementPnpComponent(engineCore$1, context, instanceConfig) {
2443
+ let component;
2444
+ let instanceType;
2445
+ if (instanceConfig.type === RightsManagementPnpComponentType.Service) {
2446
+ const negotiatorModules = [];
2447
+ if (core.Is.arrayValue(instanceConfig.options?.negotiatorModulesConfig)) {
2448
+ for (const moduleConfig of instanceConfig.options.negotiatorModulesConfig) {
2449
+ negotiatorModules.push({
2450
+ negotiatorId: moduleConfig.id,
2451
+ negotiator: await engineCore.EngineModuleHelper.loadComponent(engineCore$1, moduleConfig)
2452
+ });
2453
+ }
2454
+ }
2455
+ const requesterModules = [];
2456
+ if (core.Is.arrayValue(instanceConfig.options?.requesterModulesConfig)) {
2457
+ for (const moduleConfig of instanceConfig.options.requesterModulesConfig) {
2458
+ requesterModules.push({
2459
+ requesterId: moduleConfig.id,
2460
+ requester: await engineCore.EngineModuleHelper.loadComponent(engineCore$1, moduleConfig)
2461
+ });
2462
+ }
2463
+ }
2464
+ component = new rightsManagementPnpService.PolicyNegotiationPointService({
2465
+ loggingComponentType: engineCore$1.getRegisteredInstanceType("loggingComponent"),
2466
+ policyNegotiationAdministrationPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPnapComponent"),
2467
+ policyAdministrationPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPapComponent"),
2468
+ policyInformationPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPipComponent"),
2469
+ ...instanceConfig.options,
2470
+ config: {
2471
+ ...instanceConfig.options?.config,
2472
+ negotiators: instanceConfig.options?.config?.negotiators ?? negotiatorModules,
2473
+ requesters: instanceConfig.options?.config?.requesters ?? requesterModules
2474
+ }
2475
+ });
2476
+ instanceType = "policy-negotiation-point-service";
2477
+ }
2478
+ else if (instanceConfig.type === RightsManagementPnpComponentType.RestClient) {
2479
+ component = new rightsManagementRestClient.PolicyNegotiationPointClient({
2480
+ ...instanceConfig.options,
2481
+ authenticationGeneratorType: instanceConfig.options?.authenticationGeneratorType ??
2482
+ engineCore$1.getRegisteredInstanceType("authenticationGeneratorComponent", [
2483
+ "verifiable-credential"
2484
+ ])
2485
+ });
2486
+ instanceType = "policy-negotiation-point-client";
2487
+ }
2488
+ return {
2489
+ component,
2490
+ instanceType,
2491
+ factory: core.ComponentFactory
2492
+ };
2493
+ }
2494
+
2495
+ // Copyright 2024 IOTA Stiftung.
2496
+ // SPDX-License-Identifier: Apache-2.0.
2497
+ /**
2498
+ * Rights management PXP component types.
2499
+ */
2500
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2501
+ const RightsManagementPxpComponentType = {
2502
+ /**
2503
+ * Service.
2504
+ */
2505
+ Service: "service"
2506
+ };
2507
+
2508
+ // Copyright 2024 IOTA Stiftung.
2509
+ // SPDX-License-Identifier: Apache-2.0.
2510
+ /**
2511
+ * Initialise the rights management PXP component.
2512
+ * @param engineCore The engine core.
2513
+ * @param context The context for the engine.
2514
+ * @param instanceConfig The instance config.
2515
+ * @returns The instance created and the factory for it.
2516
+ */
2517
+ async function initialiseRightsManagementPxpComponent(engineCore$1, context, instanceConfig) {
2518
+ let component;
2519
+ let instanceType;
2520
+ if (instanceConfig.type === RightsManagementPxpComponentType.Service) {
2521
+ const modules = [];
2522
+ if (core.Is.arrayValue(instanceConfig.options?.actionModulesConfig)) {
2523
+ for (const moduleConfig of instanceConfig.options.actionModulesConfig) {
2524
+ modules.push({
2525
+ actionId: moduleConfig.id,
2526
+ action: await engineCore.EngineModuleHelper.loadComponent(engineCore$1, moduleConfig)
2527
+ });
2528
+ }
2529
+ }
2530
+ component = new rightsManagementPxpService.PolicyExecutionPointService({
2531
+ loggingComponentType: engineCore$1.getRegisteredInstanceType("loggingComponent"),
2532
+ ...instanceConfig.options,
2533
+ config: {
2534
+ ...instanceConfig.options?.config,
2535
+ actions: instanceConfig.options?.config?.actions ?? modules
2536
+ }
2537
+ });
2538
+ instanceType = "policy-execution-point-service";
2539
+ }
2540
+ return {
2541
+ component,
2542
+ instanceType,
2543
+ factory: core.ComponentFactory
2544
+ };
2545
+ }
2546
+
2547
+ // Copyright 2024 IOTA Stiftung.
2548
+ // SPDX-License-Identifier: Apache-2.0.
2549
+ /**
2550
+ * Synchronised storage component types.
2551
+ */
2552
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2553
+ const SynchronisedStorageComponentType = {
2554
+ /**
2555
+ * Service.
2556
+ */
2557
+ Service: "service",
2558
+ /**
2559
+ * REST client.
2560
+ */
2561
+ RestClient: "rest-client"
2562
+ };
2563
+
2564
+ // Copyright 2024 IOTA Stiftung.
2565
+ // SPDX-License-Identifier: Apache-2.0.
2566
+ /**
2567
+ * Initialise the synchronised storage component.
2568
+ * @param engineCore The engine core.
2569
+ * @param context The context for the engine.
2570
+ * @param instanceConfig The instance config.
2571
+ * @returns The instance created and the factory for it.
2572
+ */
2573
+ async function initialiseSynchronisedStorageComponent(engineCore, context, instanceConfig) {
2574
+ let component;
2575
+ let instanceType;
2576
+ if (instanceConfig.type === SynchronisedStorageComponentType.Service) {
2577
+ synchronisedStorageService.initSchema();
2578
+ initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.syncSnapshotStorageConnectorType, "SyncSnapshotEntry");
2579
+ component = new synchronisedStorageService.SynchronisedStorageService({
2580
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
2581
+ eventBusComponentType: engineCore.getRegisteredInstanceType("eventBusComponent"),
2582
+ vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
2583
+ verifiableStorageConnectorType: engineCore.getRegisteredInstanceType("verifiableStorageConnector"),
2584
+ taskSchedulerComponentType: engineCore.getRegisteredInstanceType("taskSchedulerComponent"),
2585
+ policyEnforcementPointComponentType: engineCore.getRegisteredInstanceTypeOptional("rightsManagementPepComponent"),
2586
+ trustedSynchronisedStorageComponentType: engineCore.getRegisteredInstanceTypeOptional("synchronisedStorageComponent", ["trusted"]),
2587
+ blobStorageConnectorType: engineCore.getRegisteredInstanceType("blobStorageConnector", [
2588
+ "public"
2589
+ ]),
2590
+ ...instanceConfig.options
2591
+ });
2592
+ instanceType = "synchronised-storage-service";
2593
+ }
2594
+ else if (instanceConfig.type === SynchronisedStorageComponentType.RestClient) {
2595
+ component = new synchronisedStorageRestClient.SynchronisedStorageClient({
2596
+ ...instanceConfig.options,
2597
+ authenticationGeneratorType: instanceConfig.options?.authenticationGeneratorType ??
2598
+ engineCore.getRegisteredInstanceType("authenticationGeneratorComponent", [
2599
+ "verifiable-credential"
2600
+ ])
2601
+ });
2602
+ instanceType = "synchronised-storage-client";
2603
+ }
2604
+ return {
2605
+ component,
2606
+ instanceType,
2607
+ factory: core.ComponentFactory
2608
+ };
2294
2609
  }
2295
2610
 
2296
2611
  // Copyright 2024 IOTA Stiftung.
@@ -2311,37 +2626,23 @@ const TaskSchedulerComponentType = {
2311
2626
  * @param engineCore The engine core.
2312
2627
  * @param context The context for the engine.
2313
2628
  * @param instanceConfig The instance config.
2314
- * @param overrideInstanceType The instance type to override the default.
2315
- * @returns The name of the instance created.
2316
- * @throws GeneralError if the connector type is unknown.
2317
- */
2318
- function initialiseTaskSchedulerComponent(engineCore, context, instanceConfig, overrideInstanceType) {
2319
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
2320
- element: `Task Scheduler: ${instanceConfig.type}`
2321
- }));
2322
- const type = instanceConfig.type;
2629
+ * @returns The instance created and the factory for it.
2630
+ */
2631
+ async function initialiseTaskSchedulerComponent(engineCore, context, instanceConfig) {
2323
2632
  let component;
2324
2633
  let instanceType;
2325
- if (type === TaskSchedulerComponentType.Service) {
2634
+ if (instanceConfig.type === TaskSchedulerComponentType.Service) {
2326
2635
  component = new backgroundTaskScheduler.TaskSchedulerService({
2327
- loggingConnectorType: context.defaultTypes.loggingConnector,
2636
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
2328
2637
  ...instanceConfig.options
2329
2638
  });
2330
- instanceType = core.StringHelper.kebabCase("TaskSchedulerService");
2331
- }
2332
- else {
2333
- throw new core.GeneralError("engineCore", "componentUnknownType", {
2334
- type,
2335
- componentType: "taskSchedulerComponent"
2336
- });
2639
+ instanceType = "task-scheduler-service";
2337
2640
  }
2338
- const finalInstanceType = overrideInstanceType ?? instanceType;
2339
- context.componentInstances.push({
2340
- instanceType: finalInstanceType,
2341
- component
2342
- });
2343
- core.ComponentFactory.register(finalInstanceType, () => component);
2344
- return finalInstanceType;
2641
+ return {
2642
+ component,
2643
+ instanceType,
2644
+ factory: core.ComponentFactory
2645
+ };
2345
2646
  }
2346
2647
 
2347
2648
  // Copyright 2024 IOTA Stiftung.
@@ -2381,75 +2682,53 @@ const TelemetryConnectorType = {
2381
2682
  * @param engineCore The engine core.
2382
2683
  * @param context The context for the engine.
2383
2684
  * @param instanceConfig The instance config.
2384
- * @param overrideInstanceType The instance type to override the default.
2385
- * @returns The name of the instance created.
2386
- * @throws GeneralError if the connector type is unknown.
2387
- */
2388
- function initialiseTelemetryConnector(engineCore, context, instanceConfig, overrideInstanceType) {
2389
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
2390
- element: `Telemetry Connector: ${instanceConfig.type}`
2391
- }));
2392
- const type = instanceConfig.type;
2393
- let connector;
2685
+ * @returns The instance created and the factory for it.
2686
+ */
2687
+ async function initialiseTelemetryConnector(engineCore, context, instanceConfig) {
2688
+ let component;
2394
2689
  let instanceType;
2395
- if (type === TelemetryConnectorType.EntityStorage) {
2690
+ if (instanceConfig.type === TelemetryConnectorType.EntityStorage) {
2396
2691
  telemetryConnectorEntityStorage.initSchema();
2397
2692
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.telemetryMetricStorageConnectorType, "TelemetryMetric");
2398
2693
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.telemetryMetricValueStorageConnectorType, "TelemetryMetricValue");
2399
- connector = new telemetryConnectorEntityStorage.EntityStorageTelemetryConnector({
2400
- loggingConnectorType: context.defaultTypes.loggingConnector,
2694
+ component = new telemetryConnectorEntityStorage.EntityStorageTelemetryConnector({
2695
+ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
2401
2696
  ...instanceConfig.options
2402
2697
  });
2403
2698
  instanceType = telemetryConnectorEntityStorage.EntityStorageTelemetryConnector.NAMESPACE;
2404
2699
  }
2405
- else {
2406
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
2407
- type,
2408
- connectorType: "telemetryConnector"
2409
- });
2410
- }
2411
- const finalInstanceType = overrideInstanceType ?? instanceType;
2412
- context.componentInstances.push({ instanceType: finalInstanceType, component: connector });
2413
- telemetryModels.TelemetryConnectorFactory.register(finalInstanceType, () => connector);
2414
- return finalInstanceType;
2700
+ return {
2701
+ instanceType,
2702
+ factory: telemetryModels.TelemetryConnectorFactory,
2703
+ component
2704
+ };
2415
2705
  }
2416
2706
  /**
2417
2707
  * Initialise the telemetry component.
2418
2708
  * @param engineCore The engine core.
2419
2709
  * @param context The context for the engine.
2420
2710
  * @param instanceConfig The instance config.
2421
- * @param overrideInstanceType The instance type to override the default.
2422
- * @returns The name of the instance created.
2423
- * @throws GeneralError if the component type is unknown.
2424
- */
2425
- function initialiseTelemetryComponent(engineCore, context, instanceConfig, overrideInstanceType) {
2426
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
2427
- element: `Telemetry Component: ${instanceConfig.type}`
2428
- }));
2429
- const type = instanceConfig.type;
2711
+ * @returns The instance created and the factory for it.
2712
+ */
2713
+ async function initialiseTelemetryComponent(engineCore, context, instanceConfig) {
2430
2714
  let component;
2431
2715
  let instanceType;
2432
- if (type === TelemetryComponentType.Service) {
2716
+ if (instanceConfig.type === TelemetryComponentType.Service) {
2433
2717
  component = new telemetryService.TelemetryService({
2434
- telemetryConnectorType: context.defaultTypes.telemetryConnector,
2718
+ telemetryConnectorType: engineCore.getRegisteredInstanceType("telemetryConnector"),
2435
2719
  ...instanceConfig.options
2436
2720
  });
2437
- instanceType = core.StringHelper.kebabCase("TelemetryService");
2721
+ instanceType = "telemetry-service";
2438
2722
  }
2439
- else if (type === TelemetryComponentType.RestClient) {
2723
+ else if (instanceConfig.type === TelemetryComponentType.RestClient) {
2440
2724
  component = new telemetryRestClient.TelemetryClient(instanceConfig.options);
2441
- instanceType = core.StringHelper.kebabCase("TelemetryClient");
2442
- }
2443
- else {
2444
- throw new core.GeneralError("engineCore", "componentUnknownType", {
2445
- type,
2446
- componentType: "telemetryComponent"
2447
- });
2725
+ instanceType = "telemetry-client";
2448
2726
  }
2449
- const finalInstanceType = overrideInstanceType ?? instanceType;
2450
- context.componentInstances.push({ instanceType: finalInstanceType, component });
2451
- core.ComponentFactory.register(finalInstanceType, () => component);
2452
- return finalInstanceType;
2727
+ return {
2728
+ component,
2729
+ instanceType,
2730
+ factory: core.ComponentFactory
2731
+ };
2453
2732
  }
2454
2733
 
2455
2734
  // Copyright 2024 IOTA Stiftung.
@@ -2469,45 +2748,32 @@ const VaultConnectorType = {
2469
2748
  Hashicorp: "hashicorp"
2470
2749
  };
2471
2750
 
2472
- // Copyright 2024 IOTA Stiftung.
2473
- // SPDX-License-Identifier: Apache-2.0.
2474
2751
  /**
2475
2752
  * Initialise the vault connector.
2476
2753
  * @param engineCore The engine core.
2477
2754
  * @param context The context for the engine.
2478
2755
  * @param instanceConfig The instance config.
2479
- * @param overrideInstanceType The instance type to override the default.
2480
- * @returns The name of the instance created.
2481
- * @throws GeneralError if the connector type is unknown.
2482
- */
2483
- function initialiseVaultConnector(engineCore, context, instanceConfig, overrideInstanceType) {
2484
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
2485
- element: `Vault Connector: ${instanceConfig.type}`
2486
- }));
2487
- const type = instanceConfig.type;
2488
- let connector;
2756
+ * @returns The instance created and the factory for it.
2757
+ */
2758
+ async function initialiseVaultConnector(engineCore, context, instanceConfig) {
2759
+ let component;
2489
2760
  let instanceType;
2490
- if (type === VaultConnectorType.EntityStorage) {
2761
+ if (instanceConfig.type === VaultConnectorType.EntityStorage) {
2491
2762
  vaultConnectorEntityStorage.initSchema();
2492
2763
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.vaultKeyEntityStorageType, "VaultKey");
2493
2764
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.vaultSecretEntityStorageType, "VaultSecret");
2494
- connector = new vaultConnectorEntityStorage.EntityStorageVaultConnector(instanceConfig.options);
2765
+ component = new vaultConnectorEntityStorage.EntityStorageVaultConnector(instanceConfig.options);
2495
2766
  instanceType = vaultConnectorEntityStorage.EntityStorageVaultConnector.NAMESPACE;
2496
2767
  }
2497
- else if (type === VaultConnectorType.Hashicorp) {
2498
- connector = new vaultConnectorHashicorp.HashicorpVaultConnector(instanceConfig.options);
2768
+ else if (instanceConfig.type === VaultConnectorType.Hashicorp) {
2769
+ component = new vaultConnectorHashicorp.HashicorpVaultConnector(instanceConfig.options);
2499
2770
  instanceType = vaultConnectorHashicorp.HashicorpVaultConnector.NAMESPACE;
2500
2771
  }
2501
- else {
2502
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
2503
- type,
2504
- connectorType: "vaultConnector"
2505
- });
2506
- }
2507
- const finalInstanceType = overrideInstanceType ?? instanceType;
2508
- context.componentInstances.push({ instanceType: finalInstanceType, component: connector });
2509
- vaultModels.VaultConnectorFactory.register(finalInstanceType, () => connector);
2510
- return finalInstanceType;
2772
+ return {
2773
+ component,
2774
+ instanceType,
2775
+ factory: vaultModels.VaultConnectorFactory
2776
+ };
2511
2777
  }
2512
2778
 
2513
2779
  // Copyright 2024 IOTA Stiftung.
@@ -2551,21 +2817,16 @@ const VerifiableStorageConnectorType = {
2551
2817
  * @param engineCore The engine core.
2552
2818
  * @param context The context for the engine.
2553
2819
  * @param instanceConfig The instance config.
2554
- * @param overrideInstanceType The instance type to override the default.
2555
- * @returns The name of the instance created.
2556
- * @throws GeneralError if the connector type is unknown.
2557
- */
2558
- function initialiseVerifiableStorageConnector(engineCore, context, instanceConfig, overrideInstanceType) {
2559
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
2560
- element: `Verifiable Storage Connector: ${instanceConfig.type}`
2561
- }));
2562
- const type = instanceConfig.type;
2563
- let connector;
2820
+ * @returns The instance created and the factory for it.
2821
+ */
2822
+ async function initialiseVerifiableStorageConnector(engineCore, context, instanceConfig) {
2823
+ let component;
2564
2824
  let instanceType;
2565
- if (type === VerifiableStorageConnectorType.Iota) {
2566
- const dltConfig = context.config.types.dltConfig?.find(dlt => dlt.type === context.defaultTypes.dltConfig);
2567
- connector = new verifiableStorageConnectorIota.IotaVerifiableStorageConnector({
2568
- vaultConnectorType: context.defaultTypes.vaultConnector,
2825
+ if (instanceConfig.type === VerifiableStorageConnectorType.Iota) {
2826
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
2827
+ component = new verifiableStorageConnectorIota.IotaVerifiableStorageConnector({
2828
+ vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
2829
+ loggingComponentType: engineCore.getRegisteredInstanceTypeOptional("loggingComponent"),
2569
2830
  ...instanceConfig.options,
2570
2831
  config: {
2571
2832
  ...dltConfig?.options?.config,
@@ -2574,65 +2835,43 @@ function initialiseVerifiableStorageConnector(engineCore, context, instanceConfi
2574
2835
  });
2575
2836
  instanceType = verifiableStorageConnectorIota.IotaVerifiableStorageConnector.NAMESPACE;
2576
2837
  }
2577
- else if (type === VerifiableStorageConnectorType.EntityStorage) {
2838
+ else if (instanceConfig.type === VerifiableStorageConnectorType.EntityStorage) {
2578
2839
  verifiableStorageConnectorEntityStorage.initSchema();
2579
2840
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.verifiableStorageEntityStorageType, "VerifiableItem");
2580
- connector = new verifiableStorageConnectorEntityStorage.EntityStorageVerifiableStorageConnector(instanceConfig.options);
2841
+ component = new verifiableStorageConnectorEntityStorage.EntityStorageVerifiableStorageConnector(instanceConfig.options);
2581
2842
  instanceType = verifiableStorageConnectorEntityStorage.EntityStorageVerifiableStorageConnector.NAMESPACE;
2582
2843
  }
2583
- else {
2584
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
2585
- type,
2586
- connectorType: "verifiableStorageConnector"
2587
- });
2588
- }
2589
- const finalInstanceType = overrideInstanceType ?? instanceType;
2590
- context.componentInstances.push({
2591
- instanceType: finalInstanceType,
2592
- component: connector
2593
- });
2594
- verifiableStorageModels.VerifiableStorageConnectorFactory.register(finalInstanceType, () => connector);
2595
- return finalInstanceType;
2844
+ return {
2845
+ component,
2846
+ instanceType,
2847
+ factory: verifiableStorageModels.VerifiableStorageConnectorFactory
2848
+ };
2596
2849
  }
2597
2850
  /**
2598
2851
  * Initialise the verifiable storage component.
2599
2852
  * @param engineCore The engine core.
2600
2853
  * @param context The context for the engine.
2601
2854
  * @param instanceConfig The instance config.
2602
- * @param overrideInstanceType The instance type to override the default.
2603
- * @returns The name of the instance created.
2604
- * @throws GeneralError if the component type is unknown.
2605
- */
2606
- function initialiseVerifiableStorageComponent(engineCore, context, instanceConfig, overrideInstanceType) {
2607
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
2608
- element: `Verifiable Storage Component: ${instanceConfig.type}`
2609
- }));
2610
- const type = instanceConfig.type;
2855
+ * @returns The instance created and the factory for it.
2856
+ */
2857
+ async function initialiseVerifiableStorageComponent(engineCore, context, instanceConfig) {
2611
2858
  let component;
2612
2859
  let instanceType;
2613
- if (type === VerifiableStorageComponentType.Service) {
2860
+ if (instanceConfig.type === VerifiableStorageComponentType.Service) {
2614
2861
  component = new verifiableStorageService.VerifiableStorageService({
2615
2862
  ...instanceConfig.options
2616
2863
  });
2617
- instanceType = core.StringHelper.kebabCase("VerifiableStorageService");
2864
+ instanceType = "verifiable-storage-service";
2618
2865
  }
2619
- else if (type === VerifiableStorageComponentType.RestClient) {
2866
+ else if (instanceConfig.type === VerifiableStorageComponentType.RestClient) {
2620
2867
  component = new verifiableStorageRestClient.VerifiableStorageClient(instanceConfig.options);
2621
- instanceType = core.StringHelper.kebabCase("VerifiableStorageClient");
2622
- }
2623
- else {
2624
- throw new core.GeneralError("engineCore", "componentUnknownType", {
2625
- type,
2626
- componentType: "verifiableStorageComponent"
2627
- });
2868
+ instanceType = "verifiable-storage-client";
2628
2869
  }
2629
- const finalInstanceType = overrideInstanceType ?? instanceType;
2630
- context.componentInstances.push({
2631
- instanceType: finalInstanceType,
2632
- component
2633
- });
2634
- core.ComponentFactory.register(finalInstanceType, () => component);
2635
- return finalInstanceType;
2870
+ return {
2871
+ component,
2872
+ instanceType,
2873
+ factory: core.ComponentFactory
2874
+ };
2636
2875
  }
2637
2876
 
2638
2877
  // Copyright 2024 IOTA Stiftung.
@@ -2652,29 +2891,21 @@ const WalletConnectorType = {
2652
2891
  Iota: "iota"
2653
2892
  };
2654
2893
 
2655
- // Copyright 2024 IOTA Stiftung.
2656
- // SPDX-License-Identifier: Apache-2.0.
2657
2894
  /**
2658
2895
  * Initialise a wallet connector.
2659
2896
  * @param engineCore The engine core.
2660
2897
  * @param context The context for the node.
2661
2898
  * @param instanceConfig The instance config.
2662
- * @param overrideInstanceType The instance type to override the default.
2663
- * @returns The name of the instance created.
2664
- * @throws GeneralError if the connector type is unknown.
2665
- */
2666
- function initialiseWalletConnector(engineCore, context, instanceConfig, overrideInstanceType) {
2667
- engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
2668
- element: `Wallet Connector: ${instanceConfig.type}`
2669
- }));
2670
- const type = instanceConfig.type;
2671
- let connector;
2899
+ * @returns The instance created and the factory for it.
2900
+ */
2901
+ async function initialiseWalletConnector(engineCore, context, instanceConfig) {
2902
+ let component;
2672
2903
  let instanceType;
2673
- if (type === WalletConnectorType.Iota) {
2674
- const dltConfig = context.config.types.dltConfig?.find(dlt => dlt.type === context.defaultTypes.dltConfig);
2675
- connector = new walletConnectorIota.IotaWalletConnector({
2676
- vaultConnectorType: context.defaultTypes.vaultConnector,
2677
- faucetConnectorType: context.defaultTypes.faucetConnector,
2904
+ if (instanceConfig.type === WalletConnectorType.Iota) {
2905
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
2906
+ component = new walletConnectorIota.IotaWalletConnector({
2907
+ vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
2908
+ faucetConnectorType: engineCore.getRegisteredInstanceType("faucetConnector"),
2678
2909
  ...instanceConfig.options,
2679
2910
  config: {
2680
2911
  ...dltConfig?.options?.config,
@@ -2683,78 +2914,38 @@ function initialiseWalletConnector(engineCore, context, instanceConfig, override
2683
2914
  });
2684
2915
  instanceType = walletConnectorIota.IotaWalletConnector.NAMESPACE;
2685
2916
  }
2686
- else if (type === WalletConnectorType.EntityStorage) {
2687
- connector = new walletConnectorEntityStorage.EntityStorageWalletConnector({
2688
- vaultConnectorType: context.defaultTypes.vaultConnector,
2689
- faucetConnectorType: context.defaultTypes.faucetConnector,
2690
- ...instanceConfig.options
2691
- });
2692
- instanceType = walletConnectorEntityStorage.EntityStorageWalletConnector.NAMESPACE;
2693
- }
2694
- else {
2695
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
2696
- type,
2697
- connectorType: "walletConnector"
2698
- });
2699
- }
2700
- const finalInstanceType = overrideInstanceType ?? instanceType;
2701
- context.componentInstances.push({
2702
- instanceType: finalInstanceType,
2703
- component: connector
2704
- });
2705
- walletModels.WalletConnectorFactory.register(finalInstanceType, () => connector);
2706
- return finalInstanceType;
2707
- }
2708
- /**
2709
- * Initialise the wallet storage.
2710
- * @param engineCore The engine core.
2711
- * @param context The context for the engine.
2712
- * @param instanceConfig The instance config.
2713
- * @param overrideInstanceType The instance type to override the default.
2714
- * @returns Nothing.
2715
- * @throws GeneralError if the connector type is unknown.
2716
- */
2717
- function initialiseWalletStorage(engineCore, context, instanceConfig, overrideInstanceType) {
2718
- const type = instanceConfig.type;
2719
- if (type === WalletConnectorType.Iota) ;
2720
- else if (type === WalletConnectorType.EntityStorage) {
2917
+ else if (instanceConfig.type === WalletConnectorType.EntityStorage) {
2721
2918
  walletConnectorEntityStorage.initSchema();
2722
2919
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.walletAddressEntityStorageType, "WalletAddress");
2723
- }
2724
- else {
2725
- throw new core.GeneralError("engineCore", "connectorUnknownType", {
2726
- type,
2727
- connectorType: "walletConnector"
2920
+ component = new walletConnectorEntityStorage.EntityStorageWalletConnector({
2921
+ vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
2922
+ faucetConnectorType: engineCore.getRegisteredInstanceType("faucetConnector"),
2923
+ ...instanceConfig.options
2728
2924
  });
2925
+ instanceType = walletConnectorEntityStorage.EntityStorageWalletConnector.NAMESPACE;
2729
2926
  }
2730
- return undefined;
2927
+ return {
2928
+ component,
2929
+ instanceType,
2930
+ factory: walletModels.WalletConnectorFactory
2931
+ };
2731
2932
  }
2732
2933
 
2733
- // Copyright 2024 IOTA Stiftung.
2734
- // SPDX-License-Identifier: Apache-2.0.
2735
- /**
2736
- * DLT config types.
2737
- */
2738
- // eslint-disable-next-line @typescript-eslint/naming-convention
2739
- const DltConfigType = {
2740
- /**
2741
- * IOTA.
2742
- */
2743
- Iota: "iota"
2744
- };
2745
-
2746
2934
  exports.AttestationComponentType = AttestationComponentType;
2747
2935
  exports.AttestationConnectorType = AttestationConnectorType;
2748
2936
  exports.AuditableItemGraphComponentType = AuditableItemGraphComponentType;
2749
2937
  exports.AuditableItemStreamComponentType = AuditableItemStreamComponentType;
2938
+ exports.AuthenticationGeneratorComponentType = AuthenticationGeneratorComponentType;
2750
2939
  exports.BackgroundTaskConnectorType = BackgroundTaskConnectorType;
2751
2940
  exports.BlobStorageComponentType = BlobStorageComponentType;
2752
2941
  exports.BlobStorageConnectorType = BlobStorageConnectorType;
2753
2942
  exports.DataConverterConnectorType = DataConverterConnectorType;
2754
2943
  exports.DataExtractorConnectorType = DataExtractorConnectorType;
2755
2944
  exports.DataProcessingComponentType = DataProcessingComponentType;
2945
+ exports.DataSpaceConnectorComponentType = DataSpaceConnectorComponentType;
2756
2946
  exports.DltConfigType = DltConfigType;
2757
2947
  exports.DocumentManagementComponentType = DocumentManagementComponentType;
2948
+ exports.EngineTypeHelper = EngineTypeHelper;
2758
2949
  exports.EntityStorageComponentType = EntityStorageComponentType;
2759
2950
  exports.EntityStorageConnectorType = EntityStorageConnectorType;
2760
2951
  exports.EventBusComponentType = EventBusComponentType;
@@ -2770,14 +2961,24 @@ exports.IdentityResolverConnectorType = IdentityResolverConnectorType;
2770
2961
  exports.ImmutableProofComponentType = ImmutableProofComponentType;
2771
2962
  exports.LoggingComponentType = LoggingComponentType;
2772
2963
  exports.LoggingConnectorType = LoggingConnectorType;
2964
+ exports.MessagingAdminComponentType = MessagingAdminComponentType;
2773
2965
  exports.MessagingComponentType = MessagingComponentType;
2774
2966
  exports.MessagingEmailConnectorType = MessagingEmailConnectorType;
2775
2967
  exports.MessagingPushNotificationConnectorType = MessagingPushNotificationConnectorType;
2776
2968
  exports.MessagingSmsConnectorType = MessagingSmsConnectorType;
2777
2969
  exports.NftComponentType = NftComponentType;
2778
2970
  exports.NftConnectorType = NftConnectorType;
2779
- exports.RightsManagementComponentType = RightsManagementComponentType;
2971
+ exports.RightsManagementDapComponentType = RightsManagementDapComponentType;
2972
+ exports.RightsManagementDarpComponentType = RightsManagementDarpComponentType;
2780
2973
  exports.RightsManagementPapComponentType = RightsManagementPapComponentType;
2974
+ exports.RightsManagementPdpComponentType = RightsManagementPdpComponentType;
2975
+ exports.RightsManagementPepComponentType = RightsManagementPepComponentType;
2976
+ exports.RightsManagementPipComponentType = RightsManagementPipComponentType;
2977
+ exports.RightsManagementPmpComponentType = RightsManagementPmpComponentType;
2978
+ exports.RightsManagementPnapComponentType = RightsManagementPnapComponentType;
2979
+ exports.RightsManagementPnpComponentType = RightsManagementPnpComponentType;
2980
+ exports.RightsManagementPxpComponentType = RightsManagementPxpComponentType;
2981
+ exports.SynchronisedStorageComponentType = SynchronisedStorageComponentType;
2781
2982
  exports.TaskSchedulerComponentType = TaskSchedulerComponentType;
2782
2983
  exports.TelemetryComponentType = TelemetryComponentType;
2783
2984
  exports.TelemetryConnectorType = TelemetryConnectorType;
@@ -2789,12 +2990,14 @@ exports.initialiseAttestationComponent = initialiseAttestationComponent;
2789
2990
  exports.initialiseAttestationConnector = initialiseAttestationConnector;
2790
2991
  exports.initialiseAuditableItemGraphComponent = initialiseAuditableItemGraphComponent;
2791
2992
  exports.initialiseAuditableItemStreamComponent = initialiseAuditableItemStreamComponent;
2993
+ exports.initialiseAuthenticationGeneratorComponent = initialiseAuthenticationGeneratorComponent;
2792
2994
  exports.initialiseBackgroundTaskConnector = initialiseBackgroundTaskConnector;
2793
2995
  exports.initialiseBlobStorageComponent = initialiseBlobStorageComponent;
2794
2996
  exports.initialiseBlobStorageConnector = initialiseBlobStorageConnector;
2795
2997
  exports.initialiseDataConverterConnector = initialiseDataConverterConnector;
2796
2998
  exports.initialiseDataExtractorConnector = initialiseDataExtractorConnector;
2797
2999
  exports.initialiseDataProcessingComponent = initialiseDataProcessingComponent;
3000
+ exports.initialiseDataSpaceConnectorComponent = initialiseDataSpaceConnectorComponent;
2798
3001
  exports.initialiseDocumentManagementComponent = initialiseDocumentManagementComponent;
2799
3002
  exports.initialiseEntityStorageComponent = initialiseEntityStorageComponent;
2800
3003
  exports.initialiseEntityStorageConnector = initialiseEntityStorageConnector;
@@ -2811,14 +3014,24 @@ exports.initialiseIdentityResolverConnector = initialiseIdentityResolverConnecto
2811
3014
  exports.initialiseImmutableProofComponent = initialiseImmutableProofComponent;
2812
3015
  exports.initialiseLoggingComponent = initialiseLoggingComponent;
2813
3016
  exports.initialiseLoggingConnector = initialiseLoggingConnector;
3017
+ exports.initialiseMessagingAdminComponent = initialiseMessagingAdminComponent;
2814
3018
  exports.initialiseMessagingComponent = initialiseMessagingComponent;
2815
3019
  exports.initialiseMessagingEmailConnector = initialiseMessagingEmailConnector;
2816
3020
  exports.initialiseMessagingPushNotificationConnector = initialiseMessagingPushNotificationConnector;
2817
3021
  exports.initialiseMessagingSmsConnector = initialiseMessagingSmsConnector;
2818
3022
  exports.initialiseNftComponent = initialiseNftComponent;
2819
3023
  exports.initialiseNftConnector = initialiseNftConnector;
2820
- exports.initialiseRightsManagementComponent = initialiseRightsManagementComponent;
3024
+ exports.initialiseRightsManagementDapComponent = initialiseRightsManagementDapComponent;
3025
+ exports.initialiseRightsManagementDarpComponent = initialiseRightsManagementDarpComponent;
2821
3026
  exports.initialiseRightsManagementPapComponent = initialiseRightsManagementPapComponent;
3027
+ exports.initialiseRightsManagementPdpComponent = initialiseRightsManagementPdpComponent;
3028
+ exports.initialiseRightsManagementPepComponent = initialiseRightsManagementPepComponent;
3029
+ exports.initialiseRightsManagementPipComponent = initialiseRightsManagementPipComponent;
3030
+ exports.initialiseRightsManagementPmpComponent = initialiseRightsManagementPmpComponent;
3031
+ exports.initialiseRightsManagementPnapComponent = initialiseRightsManagementPnapComponent;
3032
+ exports.initialiseRightsManagementPnpComponent = initialiseRightsManagementPnpComponent;
3033
+ exports.initialiseRightsManagementPxpComponent = initialiseRightsManagementPxpComponent;
3034
+ exports.initialiseSynchronisedStorageComponent = initialiseSynchronisedStorageComponent;
2822
3035
  exports.initialiseTaskSchedulerComponent = initialiseTaskSchedulerComponent;
2823
3036
  exports.initialiseTelemetryComponent = initialiseTelemetryComponent;
2824
3037
  exports.initialiseTelemetryConnector = initialiseTelemetryConnector;
@@ -2826,4 +3039,3 @@ exports.initialiseVaultConnector = initialiseVaultConnector;
2826
3039
  exports.initialiseVerifiableStorageComponent = initialiseVerifiableStorageComponent;
2827
3040
  exports.initialiseVerifiableStorageConnector = initialiseVerifiableStorageConnector;
2828
3041
  exports.initialiseWalletConnector = initialiseWalletConnector;
2829
- exports.initialiseWalletStorage = initialiseWalletStorage;