@twin.org/engine-types 0.0.3-next.20 → 0.0.3-next.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components/attestation.js +20 -22
- package/dist/es/components/attestation.js.map +1 -1
- package/dist/es/components/auditableItemGraph.js +26 -22
- package/dist/es/components/auditableItemGraph.js.map +1 -1
- package/dist/es/components/auditableItemStream.js +26 -22
- package/dist/es/components/auditableItemStream.js.map +1 -1
- package/dist/es/components/backgroundTask.js +14 -12
- package/dist/es/components/backgroundTask.js.map +1 -1
- package/dist/es/components/blobStorage.js +69 -80
- package/dist/es/components/blobStorage.js.map +1 -1
- package/dist/es/components/contextIdHandler.js +9 -9
- package/dist/es/components/contextIdHandler.js.map +1 -1
- package/dist/es/components/dataProcessing.js +33 -32
- package/dist/es/components/dataProcessing.js.map +1 -1
- package/dist/es/components/dataSpaceConnector.js +26 -25
- package/dist/es/components/dataSpaceConnector.js.map +1 -1
- package/dist/es/components/documentManagement.js +12 -12
- package/dist/es/components/documentManagement.js.map +1 -1
- package/dist/es/components/entityStorage.js +19 -20
- package/dist/es/components/entityStorage.js.map +1 -1
- package/dist/es/components/eventBus.js +19 -27
- package/dist/es/components/eventBus.js.map +1 -1
- package/dist/es/components/faucet.js +18 -18
- package/dist/es/components/faucet.js.map +1 -1
- package/dist/es/components/federatedCatalogue.js +14 -14
- package/dist/es/components/federatedCatalogue.js.map +1 -1
- package/dist/es/components/federatedCatalogueFilter.js +12 -9
- package/dist/es/components/federatedCatalogueFilter.js.map +1 -1
- package/dist/es/components/identity.js +28 -31
- package/dist/es/components/identity.js.map +1 -1
- package/dist/es/components/identityProfile.js +26 -24
- package/dist/es/components/identityProfile.js.map +1 -1
- package/dist/es/components/identityResolver.js +36 -40
- package/dist/es/components/identityResolver.js.map +1 -1
- package/dist/es/components/immutableProof.js +23 -21
- package/dist/es/components/immutableProof.js.map +1 -1
- package/dist/es/components/logging.js +28 -28
- package/dist/es/components/logging.js.map +1 -1
- package/dist/es/components/messaging.js +77 -89
- package/dist/es/components/messaging.js.map +1 -1
- package/dist/es/components/nft.js +33 -33
- package/dist/es/components/nft.js.map +1 -1
- package/dist/es/components/rightsManagementPap.js +17 -17
- package/dist/es/components/rightsManagementPap.js.map +1 -1
- package/dist/es/components/rightsManagementPdp.js +10 -10
- package/dist/es/components/rightsManagementPdp.js.map +1 -1
- package/dist/es/components/rightsManagementPep.js +10 -10
- package/dist/es/components/rightsManagementPep.js.map +1 -1
- package/dist/es/components/rightsManagementPip.js +8 -10
- package/dist/es/components/rightsManagementPip.js.map +1 -1
- package/dist/es/components/rightsManagementPmp.js +10 -10
- package/dist/es/components/rightsManagementPmp.js.map +1 -1
- package/dist/es/components/rightsManagementPnap.js +20 -18
- package/dist/es/components/rightsManagementPnap.js.map +1 -1
- package/dist/es/components/rightsManagementPnp.js +12 -14
- package/dist/es/components/rightsManagementPnp.js.map +1 -1
- package/dist/es/components/rightsManagementPolicyArbiter.js +15 -10
- package/dist/es/components/rightsManagementPolicyArbiter.js.map +1 -1
- package/dist/es/components/rightsManagementPolicyEnforcementProcessor.js +17 -11
- package/dist/es/components/rightsManagementPolicyEnforcementProcessor.js.map +1 -1
- package/dist/es/components/rightsManagementPolicyExecutionAction.js +8 -10
- package/dist/es/components/rightsManagementPolicyExecutionAction.js.map +1 -1
- package/dist/es/components/rightsManagementPolicyInformationSource.js +14 -15
- package/dist/es/components/rightsManagementPolicyInformationSource.js.map +1 -1
- package/dist/es/components/rightsManagementPolicyNegotiator.js +10 -10
- package/dist/es/components/rightsManagementPolicyNegotiator.js.map +1 -1
- package/dist/es/components/rightsManagementPolicyObligationEnforcer.js +27 -0
- package/dist/es/components/rightsManagementPolicyObligationEnforcer.js.map +1 -0
- package/dist/es/components/rightsManagementPolicyRequester.js +8 -10
- package/dist/es/components/rightsManagementPolicyRequester.js.map +1 -1
- package/dist/es/components/rightsManagementPxp.js +8 -10
- package/dist/es/components/rightsManagementPxp.js.map +1 -1
- package/dist/es/components/synchronisedStorage.js +25 -23
- package/dist/es/components/synchronisedStorage.js.map +1 -1
- package/dist/es/components/taskScheduler.js +10 -10
- package/dist/es/components/taskScheduler.js.map +1 -1
- package/dist/es/components/telemetry.js +29 -32
- package/dist/es/components/telemetry.js.map +1 -1
- package/dist/es/components/tenant.js +14 -11
- package/dist/es/components/tenant.js.map +1 -1
- package/dist/es/components/trust.js +8 -10
- package/dist/es/components/trust.js.map +1 -1
- package/dist/es/components/trustGenerator.js +10 -10
- package/dist/es/components/trustGenerator.js.map +1 -1
- package/dist/es/components/trustVerifier.js +10 -10
- package/dist/es/components/trustVerifier.js.map +1 -1
- package/dist/es/components/vault.js +15 -12
- package/dist/es/components/vault.js.map +1 -1
- package/dist/es/components/verifiableStorage.js +32 -34
- package/dist/es/components/verifiableStorage.js.map +1 -1
- package/dist/es/components/wallet.js +23 -24
- package/dist/es/components/wallet.js.map +1 -1
- package/dist/es/index.js +3 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/IEngineConfig.js.map +1 -1
- package/dist/es/models/config/blobStorageConnectorConfig.js.map +1 -1
- package/dist/es/models/config/rightsManagementPolicyArbiterComponentConfig.js.map +1 -1
- package/dist/es/models/config/rightsManagementPolicyEnforcementProcessorComponentConfig.js.map +1 -1
- package/dist/es/models/config/rightsManagementPolicyObligationEnforcerComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementPolicyObligationEnforcerComponentConfig.js.map +1 -0
- package/dist/es/models/types/rightsManagementPolicyArbiterComponentType.js +5 -1
- package/dist/es/models/types/rightsManagementPolicyArbiterComponentType.js.map +1 -1
- package/dist/es/models/types/rightsManagementPolicyEnforcementProcessorComponentType.js +5 -1
- package/dist/es/models/types/rightsManagementPolicyEnforcementProcessorComponentType.js.map +1 -1
- package/dist/es/models/types/rightsManagementPolicyObligationEnforcerComponentType.js +13 -0
- package/dist/es/models/types/rightsManagementPolicyObligationEnforcerComponentType.js.map +1 -0
- package/dist/es/utils/engineTypeHelper.js +19 -1
- package/dist/es/utils/engineTypeHelper.js.map +1 -1
- package/dist/types/components/attestation.d.ts +5 -13
- package/dist/types/components/auditableItemGraph.d.ts +3 -7
- package/dist/types/components/auditableItemStream.d.ts +3 -7
- package/dist/types/components/backgroundTask.d.ts +3 -7
- package/dist/types/components/blobStorage.d.ts +4 -12
- package/dist/types/components/contextIdHandler.d.ts +3 -7
- package/dist/types/components/dataProcessing.d.ts +5 -17
- package/dist/types/components/dataSpaceConnector.d.ts +3 -7
- package/dist/types/components/documentManagement.d.ts +3 -7
- package/dist/types/components/entityStorage.d.ts +3 -7
- package/dist/types/components/eventBus.d.ts +4 -12
- package/dist/types/components/faucet.d.ts +2 -7
- package/dist/types/components/federatedCatalogue.d.ts +3 -7
- package/dist/types/components/federatedCatalogueFilter.d.ts +2 -7
- package/dist/types/components/identity.d.ts +4 -12
- package/dist/types/components/identityProfile.d.ts +4 -12
- package/dist/types/components/identityResolver.d.ts +4 -12
- package/dist/types/components/immutableProof.d.ts +3 -7
- package/dist/types/components/logging.d.ts +4 -12
- package/dist/types/components/messaging.d.ts +7 -27
- package/dist/types/components/nft.d.ts +4 -12
- package/dist/types/components/rightsManagementPap.d.ts +3 -7
- package/dist/types/components/rightsManagementPdp.d.ts +3 -7
- package/dist/types/components/rightsManagementPep.d.ts +3 -7
- package/dist/types/components/rightsManagementPip.d.ts +3 -7
- package/dist/types/components/rightsManagementPmp.d.ts +3 -7
- package/dist/types/components/rightsManagementPnap.d.ts +3 -7
- package/dist/types/components/rightsManagementPnp.d.ts +3 -7
- package/dist/types/components/rightsManagementPolicyArbiter.d.ts +2 -7
- package/dist/types/components/rightsManagementPolicyEnforcementProcessor.d.ts +2 -7
- package/dist/types/components/rightsManagementPolicyExecutionAction.d.ts +2 -7
- package/dist/types/components/rightsManagementPolicyInformationSource.d.ts +2 -7
- package/dist/types/components/rightsManagementPolicyNegotiator.d.ts +2 -7
- package/dist/types/components/rightsManagementPolicyObligationEnforcer.d.ts +12 -0
- package/dist/types/components/rightsManagementPolicyRequester.d.ts +2 -7
- package/dist/types/components/rightsManagementPxp.d.ts +3 -7
- package/dist/types/components/synchronisedStorage.d.ts +3 -7
- package/dist/types/components/taskScheduler.d.ts +3 -7
- package/dist/types/components/telemetry.d.ts +4 -12
- package/dist/types/components/tenant.d.ts +3 -7
- package/dist/types/components/trust.d.ts +3 -7
- package/dist/types/components/trustGenerator.d.ts +2 -7
- package/dist/types/components/trustVerifier.d.ts +2 -7
- package/dist/types/components/vault.d.ts +2 -7
- package/dist/types/components/verifiableStorage.d.ts +4 -12
- package/dist/types/components/wallet.d.ts +2 -7
- package/dist/types/index.d.ts +3 -0
- package/dist/types/models/IEngineConfig.d.ts +5 -0
- package/dist/types/models/config/blobStorageConnectorConfig.d.ts +4 -1
- package/dist/types/models/config/rightsManagementPolicyArbiterComponentConfig.d.ts +4 -1
- package/dist/types/models/config/rightsManagementPolicyEnforcementProcessorComponentConfig.d.ts +4 -1
- package/dist/types/models/config/rightsManagementPolicyObligationEnforcerComponentConfig.d.ts +9 -0
- package/dist/types/models/types/rightsManagementPolicyArbiterComponentType.d.ts +4 -0
- package/dist/types/models/types/rightsManagementPolicyEnforcementProcessorComponentType.d.ts +4 -0
- package/dist/types/models/types/rightsManagementPolicyObligationEnforcerComponentType.d.ts +13 -0
- package/dist/types/utils/engineTypeHelper.d.ts +11 -0
- package/docs/changelog.md +15 -0
- package/docs/reference/classes/EngineTypeHelper.md +53 -0
- package/docs/reference/functions/initialiseAttestationComponent.md +2 -2
- package/docs/reference/functions/initialiseAttestationConnector.md +3 -3
- package/docs/reference/functions/initialiseAuditableItemGraphComponent.md +2 -2
- package/docs/reference/functions/initialiseAuditableItemStreamComponent.md +2 -2
- package/docs/reference/functions/initialiseBackgroundTaskComponent.md +2 -2
- package/docs/reference/functions/initialiseBlobStorageComponent.md +2 -2
- package/docs/reference/functions/initialiseBlobStorageConnector.md +2 -2
- package/docs/reference/functions/initialiseContextIdHandlerComponent.md +2 -2
- package/docs/reference/functions/initialiseDataConverterConnector.md +2 -2
- package/docs/reference/functions/initialiseDataExtractorConnector.md +2 -2
- package/docs/reference/functions/initialiseDataProcessingComponent.md +2 -2
- package/docs/reference/functions/initialiseDataSpaceConnectorComponent.md +2 -2
- package/docs/reference/functions/initialiseDocumentManagementComponent.md +2 -2
- package/docs/reference/functions/initialiseEntityStorageComponent.md +2 -2
- package/docs/reference/functions/initialiseEventBusComponent.md +2 -2
- package/docs/reference/functions/initialiseEventBusConnector.md +2 -2
- package/docs/reference/functions/initialiseFaucetConnector.md +2 -2
- package/docs/reference/functions/initialiseFederatedCatalogueComponent.md +2 -2
- package/docs/reference/functions/initialiseFederatedCatalogueFilterComponent.md +2 -2
- package/docs/reference/functions/initialiseIdentityComponent.md +2 -2
- package/docs/reference/functions/initialiseIdentityConnector.md +2 -2
- package/docs/reference/functions/initialiseIdentityProfileComponent.md +2 -2
- package/docs/reference/functions/initialiseIdentityProfileConnector.md +2 -2
- package/docs/reference/functions/initialiseIdentityResolverComponent.md +2 -2
- package/docs/reference/functions/initialiseIdentityResolverConnector.md +2 -2
- package/docs/reference/functions/initialiseImmutableProofComponent.md +2 -2
- package/docs/reference/functions/initialiseLoggingComponent.md +2 -2
- package/docs/reference/functions/initialiseLoggingConnector.md +2 -2
- package/docs/reference/functions/initialiseMessagingAdminComponent.md +2 -2
- package/docs/reference/functions/initialiseMessagingComponent.md +2 -2
- package/docs/reference/functions/initialiseMessagingEmailConnector.md +2 -2
- package/docs/reference/functions/initialiseMessagingPushNotificationConnector.md +2 -2
- package/docs/reference/functions/initialiseMessagingSmsConnector.md +2 -2
- package/docs/reference/functions/initialiseNftComponent.md +2 -2
- package/docs/reference/functions/initialiseNftConnector.md +2 -2
- package/docs/reference/functions/initialiseRightsManagementPapComponent.md +2 -2
- package/docs/reference/functions/initialiseRightsManagementPdpComponent.md +2 -2
- package/docs/reference/functions/initialiseRightsManagementPepComponent.md +2 -2
- package/docs/reference/functions/initialiseRightsManagementPipComponent.md +2 -2
- package/docs/reference/functions/initialiseRightsManagementPmpComponent.md +2 -2
- package/docs/reference/functions/initialiseRightsManagementPnapComponent.md +2 -2
- package/docs/reference/functions/initialiseRightsManagementPnpComponent.md +2 -2
- package/docs/reference/functions/initialiseRightsManagementPolicyArbiterComponent.md +2 -2
- package/docs/reference/functions/initialiseRightsManagementPolicyEnforcementProcessorComponent.md +2 -2
- package/docs/reference/functions/initialiseRightsManagementPolicyExecutionActionComponent.md +2 -2
- package/docs/reference/functions/initialiseRightsManagementPolicyInformationSourceComponent.md +2 -2
- package/docs/reference/functions/initialiseRightsManagementPolicyNegotiatorComponent.md +2 -2
- package/docs/reference/functions/initialiseRightsManagementPolicyObligationEnforcerComponent.md +31 -0
- package/docs/reference/functions/initialiseRightsManagementPolicyRequesterComponent.md +2 -2
- package/docs/reference/functions/initialiseRightsManagementPxpComponent.md +2 -2
- package/docs/reference/functions/initialiseSynchronisedStorageComponent.md +2 -2
- package/docs/reference/functions/initialiseTaskSchedulerComponent.md +2 -2
- package/docs/reference/functions/initialiseTelemetryComponent.md +2 -2
- package/docs/reference/functions/initialiseTelemetryConnector.md +2 -2
- package/docs/reference/functions/initialiseTenantAdminComponent.md +2 -2
- package/docs/reference/functions/initialiseTrustComponent.md +2 -2
- package/docs/reference/functions/initialiseTrustGeneratorComponent.md +2 -2
- package/docs/reference/functions/initialiseTrustVerifierComponent.md +2 -2
- package/docs/reference/functions/initialiseVaultConnector.md +2 -2
- package/docs/reference/functions/initialiseVerifiableStorageComponent.md +2 -2
- package/docs/reference/functions/initialiseVerifiableStorageConnector.md +2 -2
- package/docs/reference/functions/initialiseWalletConnector.md +2 -2
- package/docs/reference/index.md +4 -0
- package/docs/reference/interfaces/IEngineConfig.md +6 -0
- package/docs/reference/type-aliases/BlobStorageConnectorConfig.md +1 -1
- package/docs/reference/type-aliases/RightsManagementPolicyArbiterComponentConfig.md +1 -13
- package/docs/reference/type-aliases/RightsManagementPolicyEnforcementProcessorComponentConfig.md +1 -13
- package/docs/reference/type-aliases/RightsManagementPolicyObligationEnforcerComponentConfig.md +17 -0
- package/docs/reference/type-aliases/RightsManagementPolicyObligationEnforcerComponentType.md +5 -0
- package/docs/reference/variables/RightsManagementPolicyArbiterComponentType.md +6 -0
- package/docs/reference/variables/RightsManagementPolicyEnforcementProcessorComponentType.md +6 -0
- package/docs/reference/variables/RightsManagementPolicyObligationEnforcerComponentType.md +13 -0
- package/package.json +3 -3
|
@@ -7,27 +7,27 @@ import { AttestationService } from "@twin.org/attestation-service";
|
|
|
7
7
|
import { ComponentFactory } from "@twin.org/core";
|
|
8
8
|
import { AttestationComponentType } from "../models/types/attestationComponentType.js";
|
|
9
9
|
import { AttestationConnectorType } from "../models/types/attestationConnectorType.js";
|
|
10
|
+
import { EngineTypeHelper } from "../utils/engineTypeHelper.js";
|
|
10
11
|
/**
|
|
11
12
|
* Initialise the attestation connector.
|
|
12
13
|
* @param engineCore The engine core.
|
|
13
14
|
* @param context The context for the engine.
|
|
14
|
-
* @param instanceConfig The instance config.
|
|
15
|
+
* @param instanceConfig The instance config type.
|
|
15
16
|
* @returns The instance created and the factory for it.
|
|
16
17
|
*/
|
|
17
|
-
export
|
|
18
|
-
let
|
|
19
|
-
let
|
|
18
|
+
export function initialiseAttestationConnector(engineCore, context, instanceConfig) {
|
|
19
|
+
let createComponent;
|
|
20
|
+
let instanceTypeName;
|
|
20
21
|
if (instanceConfig.type === AttestationConnectorType.Nft) {
|
|
21
|
-
|
|
22
|
+
createComponent = (createConfig) => new NftAttestationConnector(EngineTypeHelper.mergeConfig({
|
|
22
23
|
identityConnectorType: engineCore.getRegisteredInstanceType("identityConnector"),
|
|
23
|
-
nftConnectorType: engineCore.getRegisteredInstanceType("nftConnector")
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
instanceType = NftAttestationConnector.NAMESPACE;
|
|
24
|
+
nftConnectorType: engineCore.getRegisteredInstanceType("nftConnector")
|
|
25
|
+
}, createConfig.options));
|
|
26
|
+
instanceTypeName = NftAttestationConnector.NAMESPACE;
|
|
27
27
|
}
|
|
28
28
|
return {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
createComponent: createComponent,
|
|
30
|
+
instanceTypeName,
|
|
31
31
|
factory: AttestationConnectorFactory
|
|
32
32
|
};
|
|
33
33
|
}
|
|
@@ -38,22 +38,20 @@ export async function initialiseAttestationConnector(engineCore, context, instan
|
|
|
38
38
|
* @param instanceConfig The instance config.
|
|
39
39
|
* @returns The instance created and the factory for it.
|
|
40
40
|
*/
|
|
41
|
-
export
|
|
42
|
-
let
|
|
43
|
-
let
|
|
41
|
+
export function initialiseAttestationComponent(engineCore, context, instanceConfig) {
|
|
42
|
+
let createComponent;
|
|
43
|
+
let instanceTypeName;
|
|
44
44
|
if (instanceConfig.type === AttestationComponentType.Service) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
instanceType = "attestation-service";
|
|
45
|
+
createComponent = (createConfig) => new AttestationService(EngineTypeHelper.mergeConfig(createConfig.options));
|
|
46
|
+
instanceTypeName = "attestation-service";
|
|
49
47
|
}
|
|
50
48
|
else if (instanceConfig.type === AttestationComponentType.RestClient) {
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
createComponent = (createConfig) => new AttestationRestClient(EngineTypeHelper.mergeConfig(createConfig.options));
|
|
50
|
+
instanceTypeName = "attestation-rest-client";
|
|
53
51
|
}
|
|
54
52
|
return {
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
createComponent: createComponent,
|
|
54
|
+
instanceTypeName,
|
|
57
55
|
factory: ComponentFactory
|
|
58
56
|
};
|
|
59
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attestation.js","sourceRoot":"","sources":["../../../src/components/attestation.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"attestation.js","sourceRoot":"","sources":["../../../src/components/attestation.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAUnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B,CAC7C,UAAsC,EACtC,OAA0C,EAC1C,cAA0C;IAE1C,IAAI,eAAe,CAAC;IACpB,IAAI,gBAAgB,CAAC;IAErB,IAAI,cAAc,CAAC,IAAI,KAAK,wBAAwB,CAAC,GAAG,EAAE,CAAC;QAC1D,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE,CACzD,IAAI,uBAAuB,CAC1B,gBAAgB,CAAC,WAAW,CAC3B;YACC,qBAAqB,EAAE,UAAU,CAAC,yBAAyB,CAAC,mBAAmB,CAAC;YAChF,gBAAgB,EAAE,UAAU,CAAC,yBAAyB,CAAC,cAAc,CAAC;SACtE,EACD,YAAY,CAAC,OAAO,CACpB,CACD,CAAC;QACH,gBAAgB,GAAG,uBAAuB,CAAC,SAAS,CAAC;IACtD,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,2BAA2B;KACpC,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B,CAC7C,UAAsC,EACtC,OAA0C,EAC1C,cAA0C;IAE1C,IAAI,eAAe,CAAC;IACpB,IAAI,gBAAgB,CAAC;IAErB,IAAI,cAAc,CAAC,IAAI,KAAK,wBAAwB,CAAC,OAAO,EAAE,CAAC;QAC9D,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE,CACzD,IAAI,kBAAkB,CACrB,gBAAgB,CAAC,WAAW,CAAqC,YAAY,CAAC,OAAO,CAAC,CACtF,CAAC;QACH,gBAAgB,wBAAsC,CAAC;IACxD,CAAC;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,wBAAwB,CAAC,UAAU,EAAE,CAAC;QACxE,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE,CACzD,IAAI,qBAAqB,CACxB,gBAAgB,CAAC,WAAW,CAAqC,YAAY,CAAC,OAAO,CAAC,CACtF,CAAC;QACH,gBAAgB,4BAAyC,CAAC;IAC3D,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { NftAttestationConnector } from \"@twin.org/attestation-connector-nft\";\nimport type { INftAttestationConnectorConstructorOptions } from \"@twin.org/attestation-connector-nft\";\nimport { AttestationConnectorFactory } from \"@twin.org/attestation-models\";\nimport { AttestationRestClient } from \"@twin.org/attestation-rest-client\";\nimport { AttestationService } from \"@twin.org/attestation-service\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport type { AttestationComponentConfig } from \"../models/config/attestationComponentConfig.js\";\nimport type { AttestationConnectorConfig } from \"../models/config/attestationConnectorConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { AttestationComponentType } from \"../models/types/attestationComponentType.js\";\nimport { AttestationConnectorType } from \"../models/types/attestationConnectorType.js\";\nimport { EngineTypeHelper } from \"../utils/engineTypeHelper.js\";\n\n/**\n * Initialise the attestation connector.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config type.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseAttestationConnector(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: AttestationConnectorConfig\n): EngineTypeInitialiserReturn<typeof instanceConfig, typeof AttestationConnectorFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === AttestationConnectorType.Nft) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew NftAttestationConnector(\n\t\t\t\tEngineTypeHelper.mergeConfig<INftAttestationConnectorConstructorOptions>(\n\t\t\t\t\t{\n\t\t\t\t\t\tidentityConnectorType: engineCore.getRegisteredInstanceType(\"identityConnector\"),\n\t\t\t\t\t\tnftConnectorType: engineCore.getRegisteredInstanceType(\"nftConnector\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\tinstanceTypeName = NftAttestationConnector.NAMESPACE;\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: AttestationConnectorFactory\n\t};\n}\n\n/**\n * Initialise the attestation component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseAttestationComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: AttestationComponentConfig\n): EngineTypeInitialiserReturn<typeof instanceConfig, typeof ComponentFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === AttestationComponentType.Service) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew AttestationService(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(AttestationService);\n\t} else if (instanceConfig.type === AttestationComponentType.RestClient) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew AttestationRestClient(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(AttestationRestClient);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
1
3
|
import { AuditableItemGraphRestClient } from "@twin.org/auditable-item-graph-rest-client";
|
|
2
4
|
import { AuditableItemGraphService, initSchema as initSchemaAuditableItemGraph } from "@twin.org/auditable-item-graph-service";
|
|
3
5
|
import { ContextIdHelper, ContextIdKeys } from "@twin.org/context";
|
|
4
6
|
import { ComponentFactory } from "@twin.org/core";
|
|
5
7
|
import { initialiseEntityStorageConnector } from "./entityStorage.js";
|
|
6
8
|
import { AuditableItemGraphComponentType } from "../models/types/auditableItemGraphComponentType.js";
|
|
9
|
+
import { EngineTypeHelper } from "../utils/engineTypeHelper.js";
|
|
7
10
|
/**
|
|
8
11
|
* Initialise the auditable item graph component.
|
|
9
12
|
* @param engineCore The engine core.
|
|
@@ -11,33 +14,34 @@ import { AuditableItemGraphComponentType } from "../models/types/auditableItemGr
|
|
|
11
14
|
* @param instanceConfig The instance config.
|
|
12
15
|
* @returns The instance created and the factory for it.
|
|
13
16
|
*/
|
|
14
|
-
export
|
|
15
|
-
let
|
|
16
|
-
let
|
|
17
|
+
export function initialiseAuditableItemGraphComponent(engineCore, context, instanceConfig) {
|
|
18
|
+
let createComponent;
|
|
19
|
+
let instanceTypeName;
|
|
17
20
|
if (instanceConfig.type === AuditableItemGraphComponentType.Service) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
createComponent = (createConfig) => {
|
|
22
|
+
initSchemaAuditableItemGraph();
|
|
23
|
+
initialiseEntityStorageConnector(engineCore, context, createConfig.options?.vertexEntityStorageType, "AuditableItemGraphVertex", ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
|
|
24
|
+
ContextIdKeys.Node,
|
|
25
|
+
ContextIdKeys.Tenant
|
|
26
|
+
]));
|
|
27
|
+
initialiseEntityStorageConnector(engineCore, context, createConfig.options?.changesetEntityStorageType, "AuditableItemGraphChangeset", ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
|
|
28
|
+
ContextIdKeys.Node,
|
|
29
|
+
ContextIdKeys.Tenant
|
|
30
|
+
]));
|
|
31
|
+
return new AuditableItemGraphService(EngineTypeHelper.mergeConfig({
|
|
32
|
+
immutableProofComponentType: engineCore.getRegisteredInstanceType("immutableProofComponent"),
|
|
33
|
+
eventBusComponentType: engineCore.getRegisteredInstanceTypeOptional("eventBusComponent")
|
|
34
|
+
}, createConfig.options));
|
|
35
|
+
};
|
|
36
|
+
instanceTypeName = "auditable-item-graph-service";
|
|
33
37
|
}
|
|
34
38
|
else if (instanceConfig.type === AuditableItemGraphComponentType.RestClient) {
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
createComponent = (createConfig) => new AuditableItemGraphRestClient(EngineTypeHelper.mergeConfig(createConfig.options));
|
|
40
|
+
instanceTypeName = "auditable-item-graph-rest-client";
|
|
37
41
|
}
|
|
38
42
|
return {
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
createComponent: createComponent,
|
|
44
|
+
instanceTypeName,
|
|
41
45
|
factory: ComponentFactory
|
|
42
46
|
};
|
|
43
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auditableItemGraph.js","sourceRoot":"","sources":["../../../src/components/auditableItemGraph.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auditableItemGraph.js","sourceRoot":"","sources":["../../../src/components/auditableItemGraph.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAEN,yBAAyB,EAEzB,UAAU,IAAI,4BAA4B,EAC1C,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAOnE,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAGtE,OAAO,EAAE,+BAA+B,EAAE,MAAM,oDAAoD,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,UAAU,qCAAqC,CACpD,UAAsC,EACtC,OAA0C,EAC1C,cAAiD;IAEjD,IAAI,eAAe,CAAC;IACpB,IAAI,gBAAgB,CAAC;IAErB,IAAI,cAAc,CAAC,IAAI,KAAK,+BAA+B,CAAC,OAAO,EAAE,CAAC;QACrE,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE;YACzD,4BAA4B,EAAE,CAAC;YAE/B,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,CAAC,OAAO,EAAE,uBAAuB,8BAE7C,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE;gBACpE,aAAa,CAAC,IAAI;gBAClB,aAAa,CAAC,MAAM;aACpB,CAAC,CACF,CAAC;YACF,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,CAAC,OAAO,EAAE,0BAA0B,iCAEhD,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE;gBACpE,aAAa,CAAC,IAAI;gBAClB,aAAa,CAAC,MAAM;aACpB,CAAC,CACF,CAAC;YAEF,OAAO,IAAI,yBAAyB,CACnC,gBAAgB,CAAC,WAAW,CAC3B;gBACC,2BAA2B,EAC1B,UAAU,CAAC,yBAAyB,CAAC,yBAAyB,CAAC;gBAChE,qBAAqB,EAAE,UAAU,CAAC,iCAAiC,CAAC,mBAAmB,CAAC;aACxF,EACD,YAAY,CAAC,OAAO,CACpB,CACD,CAAC;QACH,CAAC,CAAC;QACF,gBAAgB,iCAA6C,CAAC;IAC/D,CAAC;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,+BAA+B,CAAC,UAAU,EAAE,CAAC;QAC/E,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE,CACzD,IAAI,4BAA4B,CAC/B,gBAAgB,CAAC,WAAW,CAAqC,YAAY,CAAC,OAAO,CAAC,CACtF,CAAC;QACH,gBAAgB,qCAAgD,CAAC;IAClE,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { AuditableItemGraphRestClient } from \"@twin.org/auditable-item-graph-rest-client\";\nimport {\n\ttype AuditableItemGraphChangeset,\n\tAuditableItemGraphService,\n\ttype AuditableItemGraphVertex,\n\tinitSchema as initSchemaAuditableItemGraph\n} from \"@twin.org/auditable-item-graph-service\";\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport { initialiseEntityStorageConnector } from \"./entityStorage.js\";\nimport type { AuditableItemGraphComponentConfig } from \"../models/config/auditableItemGraphComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { AuditableItemGraphComponentType } from \"../models/types/auditableItemGraphComponentType.js\";\nimport { EngineTypeHelper } from \"../utils/engineTypeHelper.js\";\n\n/**\n * Initialise the auditable item graph component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseAuditableItemGraphComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: AuditableItemGraphComponentConfig\n): EngineTypeInitialiserReturn<typeof instanceConfig, typeof ComponentFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === AuditableItemGraphComponentType.Service) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaAuditableItemGraph();\n\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.vertexEntityStorageType,\n\t\t\t\tnameof<AuditableItemGraphVertex>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.changesetEntityStorageType,\n\t\t\t\tnameof<AuditableItemGraphChangeset>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\n\t\t\treturn new AuditableItemGraphService(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\timmutableProofComponentType:\n\t\t\t\t\t\t\tengineCore.getRegisteredInstanceType(\"immutableProofComponent\"),\n\t\t\t\t\t\teventBusComponentType: engineCore.getRegisteredInstanceTypeOptional(\"eventBusComponent\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(AuditableItemGraphService);\n\t} else if (instanceConfig.type === AuditableItemGraphComponentType.RestClient) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew AuditableItemGraphRestClient(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(AuditableItemGraphRestClient);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
1
3
|
import { AuditableItemStreamRestClient } from "@twin.org/auditable-item-stream-rest-client";
|
|
2
4
|
import { AuditableItemStreamService, initSchema as initSchemaAuditableItemStream } from "@twin.org/auditable-item-stream-service";
|
|
3
5
|
import { ContextIdHelper, ContextIdKeys } from "@twin.org/context";
|
|
4
6
|
import { ComponentFactory } from "@twin.org/core";
|
|
5
7
|
import { initialiseEntityStorageConnector } from "./entityStorage.js";
|
|
6
8
|
import { AuditableItemStreamComponentType } from "../models/types/auditableItemStreamComponentType.js";
|
|
9
|
+
import { EngineTypeHelper } from "../utils/engineTypeHelper.js";
|
|
7
10
|
/**
|
|
8
11
|
* Initialise the auditable item stream component.
|
|
9
12
|
* @param engineCore The engine core.
|
|
@@ -11,33 +14,34 @@ import { AuditableItemStreamComponentType } from "../models/types/auditableItemS
|
|
|
11
14
|
* @param instanceConfig The instance config.
|
|
12
15
|
* @returns The instance created and the factory for it.
|
|
13
16
|
*/
|
|
14
|
-
export
|
|
15
|
-
let
|
|
16
|
-
let
|
|
17
|
+
export function initialiseAuditableItemStreamComponent(engineCore, context, instanceConfig) {
|
|
18
|
+
let createComponent;
|
|
19
|
+
let instanceTypeName;
|
|
17
20
|
if (instanceConfig.type === AuditableItemStreamComponentType.Service) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
createComponent = (createConfig) => {
|
|
22
|
+
initSchemaAuditableItemStream();
|
|
23
|
+
initialiseEntityStorageConnector(engineCore, context, createConfig.options?.streamEntityStorageType, "AuditableItemStream", ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
|
|
24
|
+
ContextIdKeys.Node,
|
|
25
|
+
ContextIdKeys.Tenant
|
|
26
|
+
]));
|
|
27
|
+
initialiseEntityStorageConnector(engineCore, context, createConfig.options?.streamEntryEntityStorageType, "AuditableItemStreamEntry", ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
|
|
28
|
+
ContextIdKeys.Node,
|
|
29
|
+
ContextIdKeys.Tenant
|
|
30
|
+
]));
|
|
31
|
+
return new AuditableItemStreamService(EngineTypeHelper.mergeConfig({
|
|
32
|
+
immutableProofComponentType: engineCore.getRegisteredInstanceType("immutableProofComponent"),
|
|
33
|
+
eventBusComponentType: engineCore.getRegisteredInstanceTypeOptional("eventBusComponent")
|
|
34
|
+
}, createConfig.options));
|
|
35
|
+
};
|
|
36
|
+
instanceTypeName = "auditable-item-stream-service";
|
|
33
37
|
}
|
|
34
38
|
else if (instanceConfig.type === AuditableItemStreamComponentType.RestClient) {
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
createComponent = (createConfig) => new AuditableItemStreamRestClient(EngineTypeHelper.mergeConfig(createConfig.options));
|
|
40
|
+
instanceTypeName = "auditable-item-stream-rest-client";
|
|
37
41
|
}
|
|
38
42
|
return {
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
createComponent: createComponent,
|
|
44
|
+
instanceTypeName,
|
|
41
45
|
factory: ComponentFactory
|
|
42
46
|
};
|
|
43
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auditableItemStream.js","sourceRoot":"","sources":["../../../src/components/auditableItemStream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auditableItemStream.js","sourceRoot":"","sources":["../../../src/components/auditableItemStream.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAGN,0BAA0B,EAC1B,UAAU,IAAI,6BAA6B,EAC3C,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAOnE,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAGtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAC;AACvG,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,UAAU,sCAAsC,CACrD,UAAsC,EACtC,OAA0C,EAC1C,cAAkD;IAElD,IAAI,eAAe,CAAC;IACpB,IAAI,gBAAgB,CAAC;IAErB,IAAI,cAAc,CAAC,IAAI,KAAK,gCAAgC,CAAC,OAAO,EAAE,CAAC;QACtE,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE;YACzD,6BAA6B,EAAE,CAAC;YAEhC,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,CAAC,OAAO,EAAE,uBAAuB,yBAE7C,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE;gBACpE,aAAa,CAAC,IAAI;gBAClB,aAAa,CAAC,MAAM;aACpB,CAAC,CACF,CAAC;YACF,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,CAAC,OAAO,EAAE,4BAA4B,8BAElD,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE;gBACpE,aAAa,CAAC,IAAI;gBAClB,aAAa,CAAC,MAAM;aACpB,CAAC,CACF,CAAC;YAEF,OAAO,IAAI,0BAA0B,CACpC,gBAAgB,CAAC,WAAW,CAC3B;gBACC,2BAA2B,EAC1B,UAAU,CAAC,yBAAyB,CAAC,yBAAyB,CAAC;gBAChE,qBAAqB,EAAE,UAAU,CAAC,iCAAiC,CAAC,mBAAmB,CAAC;aACxF,EACD,YAAY,CAAC,OAAO,CACpB,CACD,CAAC;QACH,CAAC,CAAC;QACF,gBAAgB,kCAA8C,CAAC;IAChE,CAAC;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,gCAAgC,CAAC,UAAU,EAAE,CAAC;QAChF,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE,CACzD,IAAI,6BAA6B,CAChC,gBAAgB,CAAC,WAAW,CAAqC,YAAY,CAAC,OAAO,CAAC,CACtF,CAAC;QACH,gBAAgB,sCAAiD,CAAC;IACnE,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { AuditableItemStreamRestClient } from \"@twin.org/auditable-item-stream-rest-client\";\nimport {\n\ttype AuditableItemStream,\n\ttype AuditableItemStreamEntry,\n\tAuditableItemStreamService,\n\tinitSchema as initSchemaAuditableItemStream\n} from \"@twin.org/auditable-item-stream-service\";\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport { initialiseEntityStorageConnector } from \"./entityStorage.js\";\nimport type { AuditableItemStreamComponentConfig } from \"../models/config/auditableItemStreamComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { AuditableItemStreamComponentType } from \"../models/types/auditableItemStreamComponentType.js\";\nimport { EngineTypeHelper } from \"../utils/engineTypeHelper.js\";\n\n/**\n * Initialise the auditable item stream component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseAuditableItemStreamComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: AuditableItemStreamComponentConfig\n): EngineTypeInitialiserReturn<typeof instanceConfig, typeof ComponentFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === AuditableItemStreamComponentType.Service) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaAuditableItemStream();\n\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.streamEntityStorageType,\n\t\t\t\tnameof<AuditableItemStream>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.streamEntryEntityStorageType,\n\t\t\t\tnameof<AuditableItemStreamEntry>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\n\t\t\treturn new AuditableItemStreamService(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\timmutableProofComponentType:\n\t\t\t\t\t\t\tengineCore.getRegisteredInstanceType(\"immutableProofComponent\"),\n\t\t\t\t\t\teventBusComponentType: engineCore.getRegisteredInstanceTypeOptional(\"eventBusComponent\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(AuditableItemStreamService);\n\t} else if (instanceConfig.type === AuditableItemStreamComponentType.RestClient) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew AuditableItemStreamRestClient(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(AuditableItemStreamRestClient);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
1
3
|
import { BackgroundTaskService, initSchema } from "@twin.org/background-task-service";
|
|
2
4
|
import { ContextIdHelper, ContextIdKeys } from "@twin.org/context";
|
|
3
5
|
import { ComponentFactory } from "@twin.org/core";
|
|
4
6
|
import { initialiseEntityStorageConnector } from "./entityStorage.js";
|
|
5
7
|
import { BackgroundTaskComponentType } from "../models/types/backgroundTaskComponentType.js";
|
|
8
|
+
import { EngineTypeHelper } from "../utils/engineTypeHelper.js";
|
|
6
9
|
/**
|
|
7
10
|
* Initialise a background task component.
|
|
8
11
|
* @param engineCore The engine core.
|
|
@@ -10,21 +13,20 @@ import { BackgroundTaskComponentType } from "../models/types/backgroundTaskCompo
|
|
|
10
13
|
* @param instanceConfig The instance config.
|
|
11
14
|
* @returns The instance created and the factory for it.
|
|
12
15
|
*/
|
|
13
|
-
export
|
|
14
|
-
let
|
|
15
|
-
let
|
|
16
|
+
export function initialiseBackgroundTaskComponent(engineCore, context, instanceConfig) {
|
|
17
|
+
let createComponent;
|
|
18
|
+
let instanceTypeName;
|
|
16
19
|
if (instanceConfig.type === BackgroundTaskComponentType.Service) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
instanceType = "background-task-service";
|
|
20
|
+
createComponent = (createConfig) => {
|
|
21
|
+
initSchema();
|
|
22
|
+
initialiseEntityStorageConnector(engineCore, context, createConfig.options?.backgroundTaskEntityStorageType, "BackgroundTask", ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node]));
|
|
23
|
+
return new BackgroundTaskService(EngineTypeHelper.mergeConfig({ loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent") }, createConfig.options));
|
|
24
|
+
};
|
|
25
|
+
instanceTypeName = "background-task-service";
|
|
24
26
|
}
|
|
25
27
|
return {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
createComponent: createComponent,
|
|
29
|
+
instanceTypeName,
|
|
28
30
|
factory: ComponentFactory
|
|
29
31
|
};
|
|
30
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backgroundTask.js","sourceRoot":"","sources":["../../../src/components/backgroundTask.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"backgroundTask.js","sourceRoot":"","sources":["../../../src/components/backgroundTask.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,qBAAqB,EACrB,UAAU,EAEV,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAOnE,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAGtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,UAAU,iCAAiC,CAChD,UAAsC,EACtC,OAA0C,EAC1C,cAA6C;IAE7C,IAAI,eAAe,CAAC;IACpB,IAAI,gBAAgB,CAAC;IAErB,IAAI,cAAc,CAAC,IAAI,KAAK,2BAA2B,CAAC,OAAO,EAAE,CAAC;QACjE,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE;YACzD,UAAU,EAAE,CAAC;YACb,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,CAAC,OAAO,EAAE,+BAA+B,oBAErD,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAC1F,CAAC;YACF,OAAO,IAAI,qBAAqB,CAC/B,gBAAgB,CAAC,WAAW,CAC3B,EAAE,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC,EAAE,EAClF,YAAY,CAAC,OAAO,CACpB,CACD,CAAC;QACH,CAAC,CAAC;QACF,gBAAgB,4BAAyC,CAAC;IAC3D,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tBackgroundTaskService,\n\tinitSchema,\n\ttype BackgroundTask\n} from \"@twin.org/background-task-service\";\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport { initialiseEntityStorageConnector } from \"./entityStorage.js\";\nimport type { BackgroundTaskComponentConfig } from \"../models/config/backgroundTaskComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { BackgroundTaskComponentType } from \"../models/types/backgroundTaskComponentType.js\";\nimport { EngineTypeHelper } from \"../utils/engineTypeHelper.js\";\n\n/**\n * Initialise a background task component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseBackgroundTaskComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: BackgroundTaskComponentConfig\n): EngineTypeInitialiserReturn<typeof instanceConfig, typeof ComponentFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === BackgroundTaskComponentType.Service) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchema();\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.backgroundTaskEntityStorageType,\n\t\t\t\tnameof<BackgroundTask>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node])\n\t\t\t);\n\t\t\treturn new BackgroundTaskService(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{ loggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\") },\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(BackgroundTaskService);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|
|
@@ -11,10 +11,11 @@ import { BlobStorageConnectorFactory } from "@twin.org/blob-storage-models";
|
|
|
11
11
|
import { BlobStorageRestClient } from "@twin.org/blob-storage-rest-client";
|
|
12
12
|
import { BlobStorageService, initSchema as initSchemaBlobStorage } from "@twin.org/blob-storage-service";
|
|
13
13
|
import { ContextIdHelper, ContextIdKeys } from "@twin.org/context";
|
|
14
|
-
import {
|
|
14
|
+
import { ComponentFactory, Is } from "@twin.org/core";
|
|
15
15
|
import { initialiseEntityStorageConnector } from "./entityStorage.js";
|
|
16
16
|
import { BlobStorageComponentType } from "../models/types/blobStorageComponentType.js";
|
|
17
17
|
import { BlobStorageConnectorType } from "../models/types/blobStorageConnectorType.js";
|
|
18
|
+
import { EngineTypeHelper } from "../utils/engineTypeHelper.js";
|
|
18
19
|
/**
|
|
19
20
|
* Initialise the blob storage connector.
|
|
20
21
|
* @param engineCore The engine core.
|
|
@@ -22,89 +23,75 @@ import { BlobStorageConnectorType } from "../models/types/blobStorageConnectorTy
|
|
|
22
23
|
* @param instanceConfig The instance config.
|
|
23
24
|
* @returns The instance created and the factory for it.
|
|
24
25
|
*/
|
|
25
|
-
export
|
|
26
|
-
let
|
|
27
|
-
let
|
|
26
|
+
export function initialiseBlobStorageConnector(engineCore, context, instanceConfig) {
|
|
27
|
+
let createComponent;
|
|
28
|
+
let instanceTypeName;
|
|
28
29
|
if (instanceConfig.type === BlobStorageConnectorType.Ipfs) {
|
|
29
|
-
|
|
30
|
-
partitionContextIds: ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
]),
|
|
34
|
-
...instanceConfig.options
|
|
35
|
-
});
|
|
36
|
-
instanceType = IpfsBlobStorageConnector.NAMESPACE;
|
|
30
|
+
createComponent = (createConfig) => new IpfsBlobStorageConnector(EngineTypeHelper.mergeConfig({
|
|
31
|
+
partitionContextIds: ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node, ContextIdKeys.Tenant])
|
|
32
|
+
}, createConfig.options));
|
|
33
|
+
instanceTypeName = IpfsBlobStorageConnector.NAMESPACE;
|
|
37
34
|
}
|
|
38
35
|
else if (instanceConfig.type === BlobStorageConnectorType.File) {
|
|
39
|
-
|
|
40
|
-
partitionContextIds: ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
|
|
41
|
-
|
|
42
|
-
ContextIdKeys.Tenant
|
|
43
|
-
]),
|
|
44
|
-
...instanceConfig.options,
|
|
36
|
+
createComponent = (createConfig) => new FileBlobStorageConnector(EngineTypeHelper.mergeConfig({
|
|
37
|
+
partitionContextIds: ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node, ContextIdKeys.Tenant])
|
|
38
|
+
}, {
|
|
45
39
|
config: {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
: instanceConfig.options.config.directory
|
|
40
|
+
directory: Is.stringValue(createConfig?.options.storagePrefix)
|
|
41
|
+
? path.join(createConfig.options.config.directory, createConfig.options.storagePrefix)
|
|
42
|
+
: (createConfig.options.config.directory ?? "")
|
|
50
43
|
}
|
|
51
|
-
});
|
|
52
|
-
|
|
44
|
+
}, createConfig.options));
|
|
45
|
+
instanceTypeName = FileBlobStorageConnector.NAMESPACE;
|
|
53
46
|
}
|
|
54
47
|
else if (instanceConfig.type === BlobStorageConnectorType.Memory) {
|
|
55
|
-
|
|
56
|
-
partitionContextIds: ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
])
|
|
60
|
-
});
|
|
61
|
-
instanceType = MemoryBlobStorageConnector.NAMESPACE;
|
|
48
|
+
createComponent = (createConfig) => new MemoryBlobStorageConnector(EngineTypeHelper.mergeConfig({
|
|
49
|
+
partitionContextIds: ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node, ContextIdKeys.Tenant])
|
|
50
|
+
}, createConfig.options));
|
|
51
|
+
instanceTypeName = MemoryBlobStorageConnector.NAMESPACE;
|
|
62
52
|
}
|
|
63
53
|
else if (instanceConfig.type === BlobStorageConnectorType.AwsS3) {
|
|
64
|
-
|
|
65
|
-
partitionContextIds: ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
|
|
66
|
-
|
|
67
|
-
ContextIdKeys.Tenant
|
|
68
|
-
]),
|
|
69
|
-
...instanceConfig.options,
|
|
54
|
+
createComponent = (createConfig) => new S3BlobStorageConnector(EngineTypeHelper.mergeConfig({
|
|
55
|
+
partitionContextIds: ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node, ContextIdKeys.Tenant])
|
|
56
|
+
}, {
|
|
70
57
|
config: {
|
|
71
|
-
|
|
72
|
-
|
|
58
|
+
bucketName: createConfig
|
|
59
|
+
? `${createConfig.options.storagePrefix ?? ""}${createConfig.options.config.bucketName}`
|
|
60
|
+
: "",
|
|
61
|
+
region: createConfig?.options.config.region ?? ""
|
|
73
62
|
}
|
|
74
|
-
});
|
|
75
|
-
|
|
63
|
+
}, createConfig.options));
|
|
64
|
+
instanceTypeName = S3BlobStorageConnector.NAMESPACE;
|
|
76
65
|
}
|
|
77
66
|
else if (instanceConfig.type === BlobStorageConnectorType.GcpStorage) {
|
|
78
|
-
|
|
79
|
-
partitionContextIds: ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
|
|
80
|
-
|
|
81
|
-
ContextIdKeys.Tenant
|
|
82
|
-
]),
|
|
83
|
-
...instanceConfig.options,
|
|
67
|
+
createComponent = (createConfig) => new GcpBlobStorageConnector(EngineTypeHelper.mergeConfig({
|
|
68
|
+
partitionContextIds: ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node, ContextIdKeys.Tenant])
|
|
69
|
+
}, {
|
|
84
70
|
config: {
|
|
85
|
-
|
|
86
|
-
|
|
71
|
+
bucketName: createConfig
|
|
72
|
+
? `${createConfig.options.storagePrefix ?? ""}${createConfig.options.config.bucketName}`
|
|
73
|
+
: "",
|
|
74
|
+
projectId: createConfig?.options.config.projectId ?? ""
|
|
87
75
|
}
|
|
88
|
-
});
|
|
89
|
-
|
|
76
|
+
}, createConfig.options));
|
|
77
|
+
instanceTypeName = GcpBlobStorageConnector.NAMESPACE;
|
|
90
78
|
}
|
|
91
79
|
else if (instanceConfig.type === BlobStorageConnectorType.AzureStorage) {
|
|
92
|
-
|
|
93
|
-
partitionContextIds: ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
|
|
94
|
-
ContextIdKeys.Node,
|
|
95
|
-
ContextIdKeys.Tenant
|
|
96
|
-
]),
|
|
97
|
-
...instanceConfig.options,
|
|
80
|
+
createComponent = (createConfig) => new AzureBlobStorageConnector(EngineTypeHelper.mergeConfig({
|
|
81
|
+
partitionContextIds: ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node, ContextIdKeys.Tenant]),
|
|
98
82
|
config: {
|
|
99
|
-
|
|
100
|
-
|
|
83
|
+
containerName: createConfig
|
|
84
|
+
? `${createConfig.options.storagePrefix ?? ""}${createConfig.options.config.containerName}`
|
|
85
|
+
: "",
|
|
86
|
+
accountName: createConfig?.options.config.accountName ?? "",
|
|
87
|
+
accountKey: createConfig?.options.config.accountKey ?? ""
|
|
101
88
|
}
|
|
102
|
-
});
|
|
103
|
-
|
|
89
|
+
}, createConfig.options));
|
|
90
|
+
instanceTypeName = AzureBlobStorageConnector.NAMESPACE;
|
|
104
91
|
}
|
|
105
92
|
return {
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
createComponent: createComponent,
|
|
94
|
+
instanceTypeName,
|
|
108
95
|
factory: BlobStorageConnectorFactory
|
|
109
96
|
};
|
|
110
97
|
}
|
|
@@ -115,28 +102,30 @@ export async function initialiseBlobStorageConnector(engineCore, context, instan
|
|
|
115
102
|
* @param instanceConfig The instance config.
|
|
116
103
|
* @returns The instance created and the factory for it.
|
|
117
104
|
*/
|
|
118
|
-
export
|
|
119
|
-
let
|
|
120
|
-
let
|
|
105
|
+
export function initialiseBlobStorageComponent(engineCore, context, instanceConfig) {
|
|
106
|
+
let createComponent;
|
|
107
|
+
let instanceTypeName;
|
|
121
108
|
if (instanceConfig.type === BlobStorageComponentType.Service) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
instanceType = "blob-storage-service";
|
|
109
|
+
createComponent = (createConfig) => {
|
|
110
|
+
initSchemaBlobStorage();
|
|
111
|
+
initialiseEntityStorageConnector(engineCore, context, createConfig.options?.entryEntityStorageType, "BlobStorageEntry", ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
|
|
112
|
+
ContextIdKeys.Node,
|
|
113
|
+
ContextIdKeys.Tenant
|
|
114
|
+
]));
|
|
115
|
+
return new BlobStorageService(EngineTypeHelper.mergeConfig({ vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector") }, createConfig.options));
|
|
116
|
+
};
|
|
117
|
+
instanceTypeName = "blob-storage-service";
|
|
132
118
|
}
|
|
133
119
|
else if (instanceConfig.type === BlobStorageComponentType.RestClient) {
|
|
134
|
-
|
|
135
|
-
|
|
120
|
+
createComponent = (createConfig) => {
|
|
121
|
+
const mergedOptions = EngineTypeHelper.mergeConfig(createConfig.options);
|
|
122
|
+
return new BlobStorageRestClient(mergedOptions);
|
|
123
|
+
};
|
|
124
|
+
instanceTypeName = "blob-storage-rest-client";
|
|
136
125
|
}
|
|
137
126
|
return {
|
|
138
|
-
|
|
139
|
-
|
|
127
|
+
createComponent: createComponent,
|
|
128
|
+
instanceTypeName,
|
|
140
129
|
factory: ComponentFactory
|
|
141
130
|
};
|
|
142
131
|
}
|