@twin.org/engine-types 0.0.3-next.1 → 0.0.3-next.10
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/backgroundTask.js +9 -11
- package/dist/es/components/backgroundTask.js.map +1 -1
- package/dist/es/components/contextIdHandler.js +31 -0
- package/dist/es/components/contextIdHandler.js.map +1 -0
- package/dist/es/components/dataSpaceConnector.js +1 -2
- package/dist/es/components/dataSpaceConnector.js.map +1 -1
- package/dist/es/components/entityStorage.js +2 -1
- package/dist/es/components/entityStorage.js.map +1 -1
- package/dist/es/components/federatedCatalogue.js +1 -5
- package/dist/es/components/federatedCatalogue.js.map +1 -1
- package/dist/es/components/federatedCatalogueFilter.js +31 -0
- package/dist/es/components/federatedCatalogueFilter.js.map +1 -0
- package/dist/es/components/immutableProof.js +2 -1
- package/dist/es/components/immutableProof.js.map +1 -1
- package/dist/es/components/rightsManagementDap.js +2 -4
- package/dist/es/components/rightsManagementDap.js.map +1 -1
- package/dist/es/components/rightsManagementDarp.js +1 -0
- package/dist/es/components/rightsManagementDarp.js.map +1 -1
- package/dist/es/components/rightsManagementDataAccessHandler.js +27 -0
- package/dist/es/components/rightsManagementDataAccessHandler.js.map +1 -0
- package/dist/es/components/rightsManagementPdp.js +2 -16
- package/dist/es/components/rightsManagementPdp.js.map +1 -1
- package/dist/es/components/rightsManagementPep.js +2 -16
- package/dist/es/components/rightsManagementPep.js.map +1 -1
- package/dist/es/components/rightsManagementPip.js +2 -16
- package/dist/es/components/rightsManagementPip.js.map +1 -1
- package/dist/es/components/rightsManagementPnp.js +3 -23
- package/dist/es/components/rightsManagementPnp.js.map +1 -1
- package/dist/es/components/rightsManagementPolicyArbiter.js +27 -0
- package/dist/es/components/rightsManagementPolicyArbiter.js.map +1 -0
- package/dist/es/components/rightsManagementPolicyEnforcementProcessor.js +27 -0
- package/dist/es/components/rightsManagementPolicyEnforcementProcessor.js.map +1 -0
- package/dist/es/components/rightsManagementPolicyExecutionAction.js +27 -0
- package/dist/es/components/rightsManagementPolicyExecutionAction.js.map +1 -0
- package/dist/es/components/rightsManagementPolicyInformationSource.js +35 -0
- package/dist/es/components/rightsManagementPolicyInformationSource.js.map +1 -0
- package/dist/es/components/rightsManagementPolicyNegotiator.js +27 -0
- package/dist/es/components/rightsManagementPolicyNegotiator.js.map +1 -0
- package/dist/es/components/rightsManagementPolicyRequester.js +27 -0
- package/dist/es/components/rightsManagementPolicyRequester.js.map +1 -0
- package/dist/es/components/rightsManagementPxp.js +2 -16
- package/dist/es/components/rightsManagementPxp.js.map +1 -1
- package/dist/es/components/synchronisedStorage.js +1 -1
- package/dist/es/components/synchronisedStorage.js.map +1 -1
- package/dist/es/components/trust.js +29 -0
- package/dist/es/components/trust.js.map +1 -0
- package/dist/es/components/trustGenerator.js +28 -0
- package/dist/es/components/trustGenerator.js.map +1 -0
- package/dist/es/components/trustVerifier.js +28 -0
- package/dist/es/components/trustVerifier.js.map +1 -0
- package/dist/es/index.js +38 -2
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/IEngineConfig.js.map +1 -1
- package/dist/es/models/config/backgroundTaskComponentConfig.js +2 -0
- package/dist/es/models/config/backgroundTaskComponentConfig.js.map +1 -0
- package/dist/es/models/config/contextIdHandlerComponentConfig.js +2 -0
- package/dist/es/models/config/contextIdHandlerComponentConfig.js.map +1 -0
- package/dist/es/models/config/federatedCatalogueFilterComponentConfig.js +2 -0
- package/dist/es/models/config/federatedCatalogueFilterComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementDarpComponentConfig.js.map +1 -1
- package/dist/es/models/config/rightsManagementDataAccessHandlerComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementDataAccessHandlerComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementPdpComponentConfig.js.map +1 -1
- package/dist/es/models/config/rightsManagementPepComponentConfig.js.map +1 -1
- package/dist/es/models/config/rightsManagementPipComponentConfig.js.map +1 -1
- package/dist/es/models/config/rightsManagementPnpComponentConfig.js.map +1 -1
- package/dist/es/models/config/rightsManagementPolicyArbiterComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementPolicyArbiterComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementPolicyEnforcementProcessorComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementPolicyEnforcementProcessorComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementPolicyExecutionActionComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementPolicyExecutionActionComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementPolicyInformationSourceComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementPolicyInformationSourceComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementPolicyNegotiatorComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementPolicyNegotiatorComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementPolicyRequesterComponentConfig.js +2 -0
- package/dist/es/models/config/rightsManagementPolicyRequesterComponentConfig.js.map +1 -0
- package/dist/es/models/config/rightsManagementPxpComponentConfig.js.map +1 -1
- package/dist/es/models/config/trustComponentConfig.js +2 -0
- package/dist/es/models/config/trustComponentConfig.js.map +1 -0
- package/dist/es/models/config/trustGeneratorComponentConfig.js +2 -0
- package/dist/es/models/config/trustGeneratorComponentConfig.js.map +1 -0
- package/dist/es/models/config/trustVerifierComponentConfig.js +2 -0
- package/dist/es/models/config/trustVerifierComponentConfig.js.map +1 -0
- package/dist/es/models/types/backgroundTaskComponentType.js +13 -0
- package/dist/es/models/types/backgroundTaskComponentType.js.map +1 -0
- package/dist/es/models/types/contextIdHandlerComponentType.js +17 -0
- package/dist/es/models/types/contextIdHandlerComponentType.js.map +1 -0
- package/dist/es/models/types/federatedCatalogueFilterComponentType.js +13 -0
- package/dist/es/models/types/federatedCatalogueFilterComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementDataAccessHandlerComponentType.js +13 -0
- package/dist/es/models/types/rightsManagementDataAccessHandlerComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementPolicyArbiterComponentType.js +13 -0
- package/dist/es/models/types/rightsManagementPolicyArbiterComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementPolicyEnforcementProcessorComponentType.js +13 -0
- package/dist/es/models/types/rightsManagementPolicyEnforcementProcessorComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementPolicyExecutionActionComponentType.js +13 -0
- package/dist/es/models/types/rightsManagementPolicyExecutionActionComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementPolicyInformationSourceComponentType.js +17 -0
- package/dist/es/models/types/rightsManagementPolicyInformationSourceComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementPolicyNegotiatorComponentType.js +13 -0
- package/dist/es/models/types/rightsManagementPolicyNegotiatorComponentType.js.map +1 -0
- package/dist/es/models/types/rightsManagementPolicyRequesterComponentType.js +13 -0
- package/dist/es/models/types/rightsManagementPolicyRequesterComponentType.js.map +1 -0
- package/dist/es/models/types/trustComponentType.js +13 -0
- package/dist/es/models/types/trustComponentType.js.map +1 -0
- package/dist/es/models/types/trustGeneratorComponentType.js +13 -0
- package/dist/es/models/types/trustGeneratorComponentType.js.map +1 -0
- package/dist/es/models/types/trustVerifierComponentType.js +13 -0
- package/dist/es/models/types/trustVerifierComponentType.js.map +1 -0
- package/dist/types/components/backgroundTask.d.ts +5 -6
- package/dist/types/components/contextIdHandler.d.ts +16 -0
- package/dist/types/components/federatedCatalogueFilter.d.ts +17 -0
- package/dist/types/components/rightsManagementDataAccessHandler.d.ts +17 -0
- package/dist/types/components/rightsManagementPolicyArbiter.d.ts +17 -0
- package/dist/types/components/rightsManagementPolicyEnforcementProcessor.d.ts +17 -0
- package/dist/types/components/rightsManagementPolicyExecutionAction.d.ts +17 -0
- package/dist/types/components/rightsManagementPolicyInformationSource.d.ts +17 -0
- package/dist/types/components/rightsManagementPolicyNegotiator.d.ts +17 -0
- package/dist/types/components/rightsManagementPolicyRequester.d.ts +17 -0
- package/dist/types/components/trust.d.ts +16 -0
- package/dist/types/components/trustGenerator.d.ts +17 -0
- package/dist/types/components/trustVerifier.d.ts +17 -0
- package/dist/types/index.d.ts +38 -2
- package/dist/types/models/IEngineConfig.d.ts +63 -3
- package/dist/types/models/config/backgroundTaskComponentConfig.d.ts +9 -0
- package/dist/types/models/config/contextIdHandlerComponentConfig.d.ts +11 -0
- package/dist/types/models/config/federatedCatalogueFilterComponentConfig.d.ts +9 -0
- package/dist/types/models/config/rightsManagementDarpComponentConfig.d.ts +1 -4
- package/dist/types/models/config/rightsManagementDataAccessHandlerComponentConfig.d.ts +9 -0
- package/dist/types/models/config/rightsManagementPdpComponentConfig.d.ts +1 -4
- package/dist/types/models/config/rightsManagementPepComponentConfig.d.ts +1 -4
- package/dist/types/models/config/rightsManagementPipComponentConfig.d.ts +1 -4
- package/dist/types/models/config/rightsManagementPnpComponentConfig.d.ts +1 -5
- package/dist/types/models/config/rightsManagementPolicyArbiterComponentConfig.d.ts +9 -0
- package/dist/types/models/config/rightsManagementPolicyEnforcementProcessorComponentConfig.d.ts +9 -0
- package/dist/types/models/config/rightsManagementPolicyExecutionActionComponentConfig.d.ts +9 -0
- package/dist/types/models/config/rightsManagementPolicyInformationSourceComponentConfig.d.ts +12 -0
- package/dist/types/models/config/rightsManagementPolicyNegotiatorComponentConfig.d.ts +9 -0
- package/dist/types/models/config/rightsManagementPolicyRequesterComponentConfig.d.ts +9 -0
- package/dist/types/models/config/rightsManagementPxpComponentConfig.d.ts +1 -4
- package/dist/types/models/config/trustComponentConfig.d.ts +9 -0
- package/dist/types/models/config/trustGeneratorComponentConfig.d.ts +9 -0
- package/dist/types/models/config/trustVerifierComponentConfig.d.ts +9 -0
- package/dist/types/models/types/backgroundTaskComponentType.d.ts +13 -0
- package/dist/types/models/types/contextIdHandlerComponentType.d.ts +17 -0
- package/dist/types/models/types/federatedCatalogueFilterComponentType.d.ts +13 -0
- package/dist/types/models/types/rightsManagementDataAccessHandlerComponentType.d.ts +13 -0
- package/dist/types/models/types/rightsManagementPolicyArbiterComponentType.d.ts +13 -0
- package/dist/types/models/types/rightsManagementPolicyEnforcementProcessorComponentType.d.ts +13 -0
- package/dist/types/models/types/rightsManagementPolicyExecutionActionComponentType.d.ts +13 -0
- package/dist/types/models/types/rightsManagementPolicyInformationSourceComponentType.d.ts +17 -0
- package/dist/types/models/types/rightsManagementPolicyNegotiatorComponentType.d.ts +13 -0
- package/dist/types/models/types/rightsManagementPolicyRequesterComponentType.d.ts +13 -0
- package/dist/types/models/types/trustComponentType.d.ts +13 -0
- package/dist/types/models/types/trustGeneratorComponentType.d.ts +13 -0
- package/dist/types/models/types/trustVerifierComponentType.d.ts +13 -0
- package/docs/changelog.md +140 -0
- package/docs/reference/functions/{initialiseBackgroundTaskConnector.md → initialiseBackgroundTaskComponent.md} +5 -5
- package/docs/reference/functions/initialiseContextIdHandlerComponent.md +31 -0
- package/docs/reference/functions/initialiseFederatedCatalogueFilterComponent.md +31 -0
- package/docs/reference/functions/initialiseRightsManagementDataAccessHandlerComponent.md +31 -0
- package/docs/reference/functions/initialiseRightsManagementPolicyArbiterComponent.md +31 -0
- package/docs/reference/functions/initialiseRightsManagementPolicyEnforcementProcessorComponent.md +31 -0
- package/docs/reference/functions/initialiseRightsManagementPolicyExecutionActionComponent.md +31 -0
- package/docs/reference/functions/initialiseRightsManagementPolicyInformationSourceComponent.md +31 -0
- package/docs/reference/functions/initialiseRightsManagementPolicyNegotiatorComponent.md +31 -0
- package/docs/reference/functions/initialiseRightsManagementPolicyRequesterComponent.md +31 -0
- package/docs/reference/functions/initialiseTrustComponent.md +31 -0
- package/docs/reference/functions/initialiseTrustGeneratorComponent.md +31 -0
- package/docs/reference/functions/initialiseTrustVerifierComponent.md +31 -0
- package/docs/reference/index.md +52 -4
- package/docs/reference/interfaces/IEngineConfig.md +75 -3
- package/docs/reference/type-aliases/BackgroundTaskComponentConfig.md +17 -0
- package/docs/reference/type-aliases/BackgroundTaskComponentType.md +5 -0
- package/docs/reference/type-aliases/ContextIdHandlerComponentConfig.md +5 -0
- package/docs/reference/type-aliases/ContextIdHandlerComponentType.md +5 -0
- package/docs/reference/type-aliases/FederatedCatalogueFilterComponentConfig.md +17 -0
- package/docs/reference/type-aliases/FederatedCatalogueFilterComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementDarpComponentConfig.md +1 -7
- package/docs/reference/type-aliases/RightsManagementDataAccessHandlerComponentConfig.md +17 -0
- package/docs/reference/type-aliases/RightsManagementDataAccessHandlerComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementPdpComponentConfig.md +1 -7
- package/docs/reference/type-aliases/RightsManagementPepComponentConfig.md +1 -7
- package/docs/reference/type-aliases/RightsManagementPipComponentConfig.md +1 -7
- package/docs/reference/type-aliases/RightsManagementPnpComponentConfig.md +1 -1
- package/docs/reference/type-aliases/RightsManagementPolicyArbiterComponentConfig.md +17 -0
- package/docs/reference/type-aliases/RightsManagementPolicyArbiterComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementPolicyEnforcementProcessorComponentConfig.md +17 -0
- package/docs/reference/type-aliases/RightsManagementPolicyEnforcementProcessorComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementPolicyExecutionActionComponentConfig.md +17 -0
- package/docs/reference/type-aliases/RightsManagementPolicyExecutionActionComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementPolicyInformationSourceComponentConfig.md +5 -0
- package/docs/reference/type-aliases/RightsManagementPolicyInformationSourceComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementPolicyNegotiatorComponentConfig.md +17 -0
- package/docs/reference/type-aliases/RightsManagementPolicyNegotiatorComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementPolicyRequesterComponentConfig.md +17 -0
- package/docs/reference/type-aliases/RightsManagementPolicyRequesterComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementPxpComponentConfig.md +1 -7
- package/docs/reference/type-aliases/TrustComponentConfig.md +17 -0
- package/docs/reference/type-aliases/TrustComponentType.md +5 -0
- package/docs/reference/type-aliases/TrustGeneratorComponentConfig.md +17 -0
- package/docs/reference/type-aliases/TrustGeneratorComponentType.md +5 -0
- package/docs/reference/type-aliases/TrustVerifierComponentConfig.md +17 -0
- package/docs/reference/type-aliases/TrustVerifierComponentType.md +5 -0
- package/docs/reference/variables/BackgroundTaskComponentType.md +13 -0
- package/docs/reference/variables/ContextIdHandlerComponentType.md +19 -0
- package/docs/reference/variables/FederatedCatalogueFilterComponentType.md +13 -0
- package/docs/reference/variables/RightsManagementDataAccessHandlerComponentType.md +13 -0
- package/docs/reference/variables/RightsManagementPolicyArbiterComponentType.md +13 -0
- package/docs/reference/variables/RightsManagementPolicyEnforcementProcessorComponentType.md +13 -0
- package/docs/reference/variables/RightsManagementPolicyExecutionActionComponentType.md +13 -0
- package/docs/reference/variables/RightsManagementPolicyInformationSourceComponentType.md +19 -0
- package/docs/reference/variables/RightsManagementPolicyNegotiatorComponentType.md +13 -0
- package/docs/reference/variables/RightsManagementPolicyRequesterComponentType.md +13 -0
- package/docs/reference/variables/TrustComponentType.md +13 -0
- package/docs/reference/variables/TrustGeneratorComponentType.md +13 -0
- package/docs/reference/variables/TrustVerifierComponentType.md +13 -0
- package/package.json +10 -4
- package/dist/es/models/config/backgroundTaskConnectorConfig.js +0 -2
- package/dist/es/models/config/backgroundTaskConnectorConfig.js.map +0 -1
- package/dist/es/models/types/backgroundTaskConnectorType.js +0 -13
- package/dist/es/models/types/backgroundTaskConnectorType.js.map +0 -1
- package/dist/types/models/config/backgroundTaskConnectorConfig.d.ts +0 -9
- package/dist/types/models/types/backgroundTaskConnectorType.d.ts +0 -13
- package/docs/reference/type-aliases/BackgroundTaskConnectorConfig.md +0 -17
- package/docs/reference/type-aliases/BackgroundTaskConnectorType.md +0 -5
- package/docs/reference/variables/BackgroundTaskConnectorType.md +0 -13
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 2024 IOTA Stiftung.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
-
import { ComponentFactory
|
|
4
|
-
import { EngineModuleHelper } from "@twin.org/engine-core";
|
|
3
|
+
import { ComponentFactory } from "@twin.org/core";
|
|
5
4
|
import { PolicyInformationPointService } from "@twin.org/rights-management-pip-service";
|
|
6
5
|
import { RightsManagementPipComponentType } from "../models/types/rightsManagementPipComponentType.js";
|
|
7
6
|
/**
|
|
@@ -15,22 +14,9 @@ export async function initialiseRightsManagementPipComponent(engineCore, context
|
|
|
15
14
|
let component;
|
|
16
15
|
let instanceType;
|
|
17
16
|
if (instanceConfig.type === RightsManagementPipComponentType.Service) {
|
|
18
|
-
const informationSourceModules = [];
|
|
19
|
-
if (Is.arrayValue(instanceConfig.options?.informationModulesConfig)) {
|
|
20
|
-
for (const moduleConfig of instanceConfig.options.informationModulesConfig) {
|
|
21
|
-
informationSourceModules.push({
|
|
22
|
-
sourceId: moduleConfig.id,
|
|
23
|
-
source: await EngineModuleHelper.loadComponent(engineCore, moduleConfig)
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
17
|
component = new PolicyInformationPointService({
|
|
28
18
|
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
29
|
-
...instanceConfig.options
|
|
30
|
-
config: {
|
|
31
|
-
...instanceConfig.options?.config,
|
|
32
|
-
sources: instanceConfig.options?.config?.sources ?? informationSourceModules
|
|
33
|
-
}
|
|
19
|
+
...instanceConfig.options
|
|
34
20
|
});
|
|
35
21
|
instanceType = "policy-information-point-service";
|
|
36
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rightsManagementPip.js","sourceRoot":"","sources":["../../../src/components/rightsManagementPip.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"rightsManagementPip.js","sourceRoot":"","sources":["../../../src/components/rightsManagementPip.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAInE,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AAGxF,OAAO,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAC;AAEvG;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,sCAAsC,CAC3D,UAAsC,EACtC,OAA0C,EAC1C,cAAkD;IAMlD,IAAI,SAAuD,CAAC;IAC5D,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,gCAAgC,CAAC,OAAO,EAAE,CAAC;QACtE,SAAS,GAAG,IAAI,6BAA6B,CAAC;YAC7C,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,qCAAiD,CAAC;IAC/D,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport type { IPolicyInformationPointComponent } from \"@twin.org/rights-management-models\";\nimport { PolicyInformationPointService } from \"@twin.org/rights-management-pip-service\";\nimport type { RightsManagementPipComponentConfig } from \"../models/config/rightsManagementPipComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { RightsManagementPipComponentType } from \"../models/types/rightsManagementPipComponentType.js\";\n\n/**\n * Initialise the rights management PIP component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseRightsManagementPipComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: RightsManagementPipComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof ComponentFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IPolicyInformationPointComponent | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === RightsManagementPipComponentType.Service) {\n\t\tcomponent = new PolicyInformationPointService({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(PolicyInformationPointService);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 2024 IOTA Stiftung.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
-
import { ComponentFactory
|
|
4
|
-
import { EngineModuleHelper } from "@twin.org/engine-core";
|
|
3
|
+
import { ComponentFactory } from "@twin.org/core";
|
|
5
4
|
import { PolicyNegotiationPointService } from "@twin.org/rights-management-pnp-service";
|
|
6
5
|
import { PolicyNegotiationPointRestClient } from "@twin.org/rights-management-rest-client";
|
|
7
6
|
import { RightsManagementPnpComponentType } from "../models/types/rightsManagementPnpComponentType.js";
|
|
@@ -16,34 +15,15 @@ export async function initialiseRightsManagementPnpComponent(engineCore, context
|
|
|
16
15
|
let component;
|
|
17
16
|
let instanceType;
|
|
18
17
|
if (instanceConfig.type === RightsManagementPnpComponentType.Service) {
|
|
19
|
-
const negotiatorModules = [];
|
|
20
|
-
if (Is.arrayValue(instanceConfig.options?.negotiatorModulesConfig)) {
|
|
21
|
-
for (const moduleConfig of instanceConfig.options.negotiatorModulesConfig) {
|
|
22
|
-
negotiatorModules.push({
|
|
23
|
-
negotiatorId: moduleConfig.id,
|
|
24
|
-
negotiator: await EngineModuleHelper.loadComponent(engineCore, moduleConfig)
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const requesterModules = [];
|
|
29
|
-
if (Is.arrayValue(instanceConfig.options?.requesterModulesConfig)) {
|
|
30
|
-
for (const moduleConfig of instanceConfig.options.requesterModulesConfig) {
|
|
31
|
-
requesterModules.push({
|
|
32
|
-
requesterId: moduleConfig.id,
|
|
33
|
-
requester: await EngineModuleHelper.loadComponent(engineCore, moduleConfig)
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
18
|
component = new PolicyNegotiationPointService({
|
|
38
19
|
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
39
20
|
policyNegotiationAdministrationPointComponentType: engineCore.getRegisteredInstanceType("rightsManagementPnapComponent"),
|
|
40
21
|
policyAdministrationPointComponentType: engineCore.getRegisteredInstanceType("rightsManagementPapComponent"),
|
|
41
22
|
policyInformationPointComponentType: engineCore.getRegisteredInstanceType("rightsManagementPipComponent"),
|
|
23
|
+
trustComponentType: engineCore.getRegisteredInstanceType("trustComponent"),
|
|
42
24
|
...instanceConfig.options,
|
|
43
25
|
config: {
|
|
44
|
-
...instanceConfig.options?.config
|
|
45
|
-
negotiators: instanceConfig.options?.config?.negotiators ?? negotiatorModules,
|
|
46
|
-
requesters: instanceConfig.options?.config?.requesters ?? requesterModules
|
|
26
|
+
...instanceConfig.options?.config
|
|
47
27
|
}
|
|
48
28
|
});
|
|
49
29
|
instanceType = "policy-negotiation-point-service";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rightsManagementPnp.js","sourceRoot":"","sources":["../../../src/components/rightsManagementPnp.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"rightsManagementPnp.js","sourceRoot":"","sources":["../../../src/components/rightsManagementPnp.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAInE,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAG3F,OAAO,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAC;AAEvG;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,sCAAsC,CAC3D,UAAsC,EACtC,OAA0C,EAC1C,cAAkD;IAMlD,IAAI,SAAuD,CAAC;IAC5D,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,gCAAgC,CAAC,OAAO,EAAE,CAAC;QACtE,SAAS,GAAG,IAAI,6BAA6B,CAAC;YAC7C,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,iDAAiD,EAAE,UAAU,CAAC,yBAAyB,CACtF,+BAA+B,CAC/B;YACD,sCAAsC,EAAE,UAAU,CAAC,yBAAyB,CAC3E,8BAA8B,CAC9B;YACD,mCAAmC,EAAE,UAAU,CAAC,yBAAyB,CACxE,8BAA8B,CAC9B;YACD,kBAAkB,EAAE,UAAU,CAAC,yBAAyB,CAAC,gBAAgB,CAAC;YAC1E,GAAG,cAAc,CAAC,OAAO;YACzB,MAAM,EAAE;gBACP,GAAG,cAAc,CAAC,OAAO,EAAE,MAAM;aACjC;SACD,CAAC,CAAC;QACH,YAAY,qCAAiD,CAAC;IAC/D,CAAC;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,gCAAgC,CAAC,UAAU,EAAE,CAAC;QAChF,SAAS,GAAG,IAAI,gCAAgC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACzE,YAAY,yCAAoD,CAAC;IAClE,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport type { IPolicyNegotiationPointComponent } from \"@twin.org/rights-management-models\";\nimport { PolicyNegotiationPointService } from \"@twin.org/rights-management-pnp-service\";\nimport { PolicyNegotiationPointRestClient } from \"@twin.org/rights-management-rest-client\";\nimport type { RightsManagementPnpComponentConfig } from \"../models/config/rightsManagementPnpComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { RightsManagementPnpComponentType } from \"../models/types/rightsManagementPnpComponentType.js\";\n\n/**\n * Initialise the rights management PNP component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseRightsManagementPnpComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: RightsManagementPnpComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof ComponentFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IPolicyNegotiationPointComponent | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === RightsManagementPnpComponentType.Service) {\n\t\tcomponent = new PolicyNegotiationPointService({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\tpolicyNegotiationAdministrationPointComponentType: engineCore.getRegisteredInstanceType(\n\t\t\t\t\"rightsManagementPnapComponent\"\n\t\t\t),\n\t\t\tpolicyAdministrationPointComponentType: engineCore.getRegisteredInstanceType(\n\t\t\t\t\"rightsManagementPapComponent\"\n\t\t\t),\n\t\t\tpolicyInformationPointComponentType: engineCore.getRegisteredInstanceType(\n\t\t\t\t\"rightsManagementPipComponent\"\n\t\t\t),\n\t\t\ttrustComponentType: engineCore.getRegisteredInstanceType(\"trustComponent\"),\n\t\t\t...instanceConfig.options,\n\t\t\tconfig: {\n\t\t\t\t...instanceConfig.options?.config\n\t\t\t}\n\t\t});\n\t\tinstanceType = nameofKebabCase(PolicyNegotiationPointService);\n\t} else if (instanceConfig.type === RightsManagementPnpComponentType.RestClient) {\n\t\tcomponent = new PolicyNegotiationPointRestClient(instanceConfig.options);\n\t\tinstanceType = nameofKebabCase(PolicyNegotiationPointRestClient);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PolicyArbiterFactory } from "@twin.org/rights-management-models";
|
|
2
|
+
import { ExamplePolicyArbiter } from "@twin.org/rights-management-plugins";
|
|
3
|
+
import { RightsManagementPolicyArbiterComponentType } from "../models/types/rightsManagementPolicyArbiterComponentType.js";
|
|
4
|
+
/**
|
|
5
|
+
* Initialise the rights management policy arbiter component.
|
|
6
|
+
* @param engineCore The engine core.
|
|
7
|
+
* @param context The context for the engine.
|
|
8
|
+
* @param instanceConfig The instance config.
|
|
9
|
+
* @returns The instance created and the factory for it.
|
|
10
|
+
*/
|
|
11
|
+
export async function initialiseRightsManagementPolicyArbiterComponent(engineCore, context, instanceConfig) {
|
|
12
|
+
let component;
|
|
13
|
+
let instanceType;
|
|
14
|
+
if (instanceConfig.type === RightsManagementPolicyArbiterComponentType.Example) {
|
|
15
|
+
component = new ExamplePolicyArbiter({
|
|
16
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
17
|
+
...instanceConfig.options
|
|
18
|
+
});
|
|
19
|
+
instanceType = "example-policy-arbiter";
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
component,
|
|
23
|
+
instanceType,
|
|
24
|
+
factory: PolicyArbiterFactory
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=rightsManagementPolicyArbiter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rightsManagementPolicyArbiter.js","sourceRoot":"","sources":["../../../src/components/rightsManagementPolicyArbiter.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC/F,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAG3E,OAAO,EAAE,0CAA0C,EAAE,MAAM,+DAA+D,CAAC;AAE3H;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gDAAgD,CACrE,UAAsC,EACtC,OAA0C,EAC1C,cAA4D;IAM5D,IAAI,SAAqC,CAAC;IAC1C,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,0CAA0C,CAAC,OAAO,EAAE,CAAC;QAChF,SAAS,GAAG,IAAI,oBAAoB,CAAC;YACpC,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,2BAAwC,CAAC;IACtD,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,oBAAoB;KAC7B,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport { type IPolicyArbiter, PolicyArbiterFactory } from \"@twin.org/rights-management-models\";\nimport { ExamplePolicyArbiter } from \"@twin.org/rights-management-plugins\";\nimport type { RightsManagementPolicyArbiterComponentConfig } from \"../models/config/rightsManagementPolicyArbiterComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { RightsManagementPolicyArbiterComponentType } from \"../models/types/rightsManagementPolicyArbiterComponentType.js\";\n\n/**\n * Initialise the rights management policy arbiter component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseRightsManagementPolicyArbiterComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: RightsManagementPolicyArbiterComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof PolicyArbiterFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IPolicyArbiter | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === RightsManagementPolicyArbiterComponentType.Example) {\n\t\tcomponent = new ExamplePolicyArbiter({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(ExamplePolicyArbiter);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: PolicyArbiterFactory\n\t};\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PolicyEnforcementProcessorFactory } from "@twin.org/rights-management-models";
|
|
2
|
+
import { ExamplePolicyEnforcementProcessor } from "@twin.org/rights-management-plugins";
|
|
3
|
+
import { RightsManagementPolicyEnforcementProcessorComponentType } from "../models/types/rightsManagementPolicyEnforcementProcessorComponentType.js";
|
|
4
|
+
/**
|
|
5
|
+
* Initialise the rights management policy enforcement processor component.
|
|
6
|
+
* @param engineCore The engine core.
|
|
7
|
+
* @param context The context for the engine.
|
|
8
|
+
* @param instanceConfig The instance config.
|
|
9
|
+
* @returns The instance created and the factory for it.
|
|
10
|
+
*/
|
|
11
|
+
export async function initialiseRightsManagementPolicyEnforcementProcessorComponent(engineCore, context, instanceConfig) {
|
|
12
|
+
let component;
|
|
13
|
+
let instanceType;
|
|
14
|
+
if (instanceConfig.type === RightsManagementPolicyEnforcementProcessorComponentType.Example) {
|
|
15
|
+
component = new ExamplePolicyEnforcementProcessor({
|
|
16
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
17
|
+
...instanceConfig.options
|
|
18
|
+
});
|
|
19
|
+
instanceType = "example-policy-enforcement-processor";
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
component,
|
|
23
|
+
instanceType,
|
|
24
|
+
factory: PolicyEnforcementProcessorFactory
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=rightsManagementPolicyEnforcementProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rightsManagementPolicyEnforcementProcessor.js","sourceRoot":"","sources":["../../../src/components/rightsManagementPolicyEnforcementProcessor.ts"],"names":[],"mappings":"AAKA,OAAO,EAEN,iCAAiC,EACjC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AAGxF,OAAO,EAAE,uDAAuD,EAAE,MAAM,4EAA4E,CAAC;AAErJ;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,6DAA6D,CAClF,UAAsC,EACtC,OAA0C,EAC1C,cAAyE;IAMzE,IAAI,SAAkD,CAAC;IACvD,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,uDAAuD,CAAC,OAAO,EAAE,CAAC;QAC7F,SAAS,GAAG,IAAI,iCAAiC,CAAC;YACjD,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,yCAAqD,CAAC;IACnE,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,iCAAiC;KAC1C,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport {\n\ttype IPolicyEnforcementProcessor,\n\tPolicyEnforcementProcessorFactory\n} from \"@twin.org/rights-management-models\";\nimport { ExamplePolicyEnforcementProcessor } from \"@twin.org/rights-management-plugins\";\nimport type { RightsManagementPolicyEnforcementProcessorComponentConfig } from \"../models/config/rightsManagementPolicyEnforcementProcessorComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { RightsManagementPolicyEnforcementProcessorComponentType } from \"../models/types/rightsManagementPolicyEnforcementProcessorComponentType.js\";\n\n/**\n * Initialise the rights management policy enforcement processor component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseRightsManagementPolicyEnforcementProcessorComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: RightsManagementPolicyEnforcementProcessorComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof PolicyEnforcementProcessorFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IPolicyEnforcementProcessor | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === RightsManagementPolicyEnforcementProcessorComponentType.Example) {\n\t\tcomponent = new ExamplePolicyEnforcementProcessor({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(ExamplePolicyEnforcementProcessor);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: PolicyEnforcementProcessorFactory\n\t};\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PolicyExecutionActionFactory } from "@twin.org/rights-management-models";
|
|
2
|
+
import { LoggingPolicyExecutionAction } from "@twin.org/rights-management-plugins";
|
|
3
|
+
import { RightsManagementPolicyExecutionActionComponentType } from "../models/types/rightsManagementPolicyExecutionActionComponentType.js";
|
|
4
|
+
/**
|
|
5
|
+
* Initialise the rights management policy execution action component.
|
|
6
|
+
* @param engineCore The engine core.
|
|
7
|
+
* @param context The context for the engine.
|
|
8
|
+
* @param instanceConfig The instance config.
|
|
9
|
+
* @returns The instance created and the factory for it.
|
|
10
|
+
*/
|
|
11
|
+
export async function initialiseRightsManagementPolicyExecutionActionComponent(engineCore, context, instanceConfig) {
|
|
12
|
+
let component;
|
|
13
|
+
let instanceType;
|
|
14
|
+
if (instanceConfig.type === RightsManagementPolicyExecutionActionComponentType.Logging) {
|
|
15
|
+
component = new LoggingPolicyExecutionAction({
|
|
16
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
17
|
+
...instanceConfig.options
|
|
18
|
+
});
|
|
19
|
+
instanceType = "logging-policy-execution-action";
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
component,
|
|
23
|
+
instanceType,
|
|
24
|
+
factory: PolicyExecutionActionFactory
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=rightsManagementPolicyExecutionAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rightsManagementPolicyExecutionAction.js","sourceRoot":"","sources":["../../../src/components/rightsManagementPolicyExecutionAction.ts"],"names":[],"mappings":"AAKA,OAAO,EAEN,4BAA4B,EAC5B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAGnF,OAAO,EAAE,kDAAkD,EAAE,MAAM,uEAAuE,CAAC;AAE3I;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,wDAAwD,CAC7E,UAAsC,EACtC,OAA0C,EAC1C,cAAoE;IAMpE,IAAI,SAA6C,CAAC;IAClD,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,kDAAkD,CAAC,OAAO,EAAE,CAAC;QACxF,SAAS,GAAG,IAAI,4BAA4B,CAAC;YAC5C,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,oCAAgD,CAAC;IAC9D,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,4BAA4B;KACrC,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport {\n\ttype IPolicyExecutionAction,\n\tPolicyExecutionActionFactory\n} from \"@twin.org/rights-management-models\";\nimport { LoggingPolicyExecutionAction } from \"@twin.org/rights-management-plugins\";\nimport type { RightsManagementPolicyExecutionActionComponentConfig } from \"../models/config/rightsManagementPolicyExecutionActionComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { RightsManagementPolicyExecutionActionComponentType } from \"../models/types/rightsManagementPolicyExecutionActionComponentType.js\";\n\n/**\n * Initialise the rights management policy execution action component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseRightsManagementPolicyExecutionActionComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: RightsManagementPolicyExecutionActionComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof PolicyExecutionActionFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IPolicyExecutionAction | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === RightsManagementPolicyExecutionActionComponentType.Logging) {\n\t\tcomponent = new LoggingPolicyExecutionAction({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(LoggingPolicyExecutionAction);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: PolicyExecutionActionFactory\n\t};\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PolicyInformationSourceFactory } from "@twin.org/rights-management-models";
|
|
2
|
+
import { IdentityPolicyInformationSource, StaticPolicyInformationSource } from "@twin.org/rights-management-plugins";
|
|
3
|
+
import { RightsManagementPolicyInformationSourceComponentType } from "../models/types/rightsManagementPolicyInformationSourceComponentType.js";
|
|
4
|
+
/**
|
|
5
|
+
* Initialise the rights management policy information source component.
|
|
6
|
+
* @param engineCore The engine core.
|
|
7
|
+
* @param context The context for the engine.
|
|
8
|
+
* @param instanceConfig The instance config.
|
|
9
|
+
* @returns The instance created and the factory for it.
|
|
10
|
+
*/
|
|
11
|
+
export async function initialiseRightsManagementPolicyInformationSourceComponent(engineCore, context, instanceConfig) {
|
|
12
|
+
let component;
|
|
13
|
+
let instanceType;
|
|
14
|
+
if (instanceConfig.type === RightsManagementPolicyInformationSourceComponentType.Identity) {
|
|
15
|
+
component = new IdentityPolicyInformationSource({
|
|
16
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
17
|
+
identityResolverComponentType: engineCore.getRegisteredInstanceType("identityResolverComponent"),
|
|
18
|
+
...instanceConfig.options
|
|
19
|
+
});
|
|
20
|
+
instanceType = "identity-policy-information-source";
|
|
21
|
+
}
|
|
22
|
+
else if (instanceConfig.type === RightsManagementPolicyInformationSourceComponentType.Static) {
|
|
23
|
+
component = new StaticPolicyInformationSource({
|
|
24
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
25
|
+
...instanceConfig.options
|
|
26
|
+
});
|
|
27
|
+
instanceType = "static-policy-information-source";
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
component,
|
|
31
|
+
instanceType,
|
|
32
|
+
factory: PolicyInformationSourceFactory
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=rightsManagementPolicyInformationSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rightsManagementPolicyInformationSource.js","sourceRoot":"","sources":["../../../src/components/rightsManagementPolicyInformationSource.ts"],"names":[],"mappings":"AAKA,OAAO,EAEN,8BAA8B,EAC9B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,+BAA+B,EAC/B,6BAA6B,EAC7B,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EAAE,oDAAoD,EAAE,MAAM,yEAAyE,CAAC;AAE/I;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,0DAA0D,CAC/E,UAAsC,EACtC,OAA0C,EAC1C,cAAsE;IAMtE,IAAI,SAA+C,CAAC;IACpD,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,oDAAoD,CAAC,QAAQ,EAAE,CAAC;QAC3F,SAAS,GAAG,IAAI,+BAA+B,CAAC;YAC/C,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,6BAA6B,EAAE,UAAU,CAAC,yBAAyB,CAClE,2BAA2B,CAC3B;YACD,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,uCAAmD,CAAC;IACjE,CAAC;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,oDAAoD,CAAC,MAAM,EAAE,CAAC;QAChG,SAAS,GAAG,IAAI,6BAA6B,CAAC;YAC7C,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,qCAAiD,CAAC;IAC/D,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,8BAA8B;KACvC,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport {\n\ttype IPolicyInformationSource,\n\tPolicyInformationSourceFactory\n} from \"@twin.org/rights-management-models\";\nimport {\n\tIdentityPolicyInformationSource,\n\tStaticPolicyInformationSource\n} from \"@twin.org/rights-management-plugins\";\nimport type { RightsManagementPolicyInformationSourceComponentConfig } from \"../models/config/rightsManagementPolicyInformationSourceComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { RightsManagementPolicyInformationSourceComponentType } from \"../models/types/rightsManagementPolicyInformationSourceComponentType.js\";\n\n/**\n * Initialise the rights management policy information source component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseRightsManagementPolicyInformationSourceComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: RightsManagementPolicyInformationSourceComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof PolicyInformationSourceFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IPolicyInformationSource | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === RightsManagementPolicyInformationSourceComponentType.Identity) {\n\t\tcomponent = new IdentityPolicyInformationSource({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\tidentityResolverComponentType: engineCore.getRegisteredInstanceType(\n\t\t\t\t\"identityResolverComponent\"\n\t\t\t),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(IdentityPolicyInformationSource);\n\t} else if (instanceConfig.type === RightsManagementPolicyInformationSourceComponentType.Static) {\n\t\tcomponent = new StaticPolicyInformationSource({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(StaticPolicyInformationSource);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: PolicyInformationSourceFactory\n\t};\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PolicyNegotiatorFactory } from "@twin.org/rights-management-models";
|
|
2
|
+
import { ExamplePolicyNegotiator } from "@twin.org/rights-management-plugins";
|
|
3
|
+
import { RightsManagementPolicyNegotiatorComponentType } from "../models/types/rightsManagementPolicyNegotiatorComponentType.js";
|
|
4
|
+
/**
|
|
5
|
+
* Initialise the rights management policy negotiator component.
|
|
6
|
+
* @param engineCore The engine core.
|
|
7
|
+
* @param context The context for the engine.
|
|
8
|
+
* @param instanceConfig The instance config.
|
|
9
|
+
* @returns The instance created and the factory for it.
|
|
10
|
+
*/
|
|
11
|
+
export async function initialiseRightsManagementPolicyNegotiatorComponent(engineCore, context, instanceConfig) {
|
|
12
|
+
let component;
|
|
13
|
+
let instanceType;
|
|
14
|
+
if (instanceConfig.type === RightsManagementPolicyNegotiatorComponentType.Example) {
|
|
15
|
+
component = new ExamplePolicyNegotiator({
|
|
16
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
17
|
+
...instanceConfig.options
|
|
18
|
+
});
|
|
19
|
+
instanceType = "example-policy-negotiator";
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
component,
|
|
23
|
+
instanceType,
|
|
24
|
+
factory: PolicyNegotiatorFactory
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=rightsManagementPolicyNegotiator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rightsManagementPolicyNegotiator.js","sourceRoot":"","sources":["../../../src/components/rightsManagementPolicyNegotiator.ts"],"names":[],"mappings":"AAKA,OAAO,EAEN,uBAAuB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAG9E,OAAO,EAAE,6CAA6C,EAAE,MAAM,kEAAkE,CAAC;AAEjI;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mDAAmD,CACxE,UAAsC,EACtC,OAA0C,EAC1C,cAA+D;IAM/D,IAAI,SAAwC,CAAC;IAC7C,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,6CAA6C,CAAC,OAAO,EAAE,CAAC;QACnF,SAAS,GAAG,IAAI,uBAAuB,CAAC;YACvC,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,8BAA2C,CAAC;IACzD,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,uBAAuB;KAChC,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport {\n\ttype IPolicyNegotiator,\n\tPolicyNegotiatorFactory\n} from \"@twin.org/rights-management-models\";\nimport { ExamplePolicyNegotiator } from \"@twin.org/rights-management-plugins\";\nimport type { RightsManagementPolicyNegotiatorComponentConfig } from \"../models/config/rightsManagementPolicyNegotiatorComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { RightsManagementPolicyNegotiatorComponentType } from \"../models/types/rightsManagementPolicyNegotiatorComponentType.js\";\n\n/**\n * Initialise the rights management policy negotiator component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseRightsManagementPolicyNegotiatorComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: RightsManagementPolicyNegotiatorComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof PolicyNegotiatorFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IPolicyNegotiator | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === RightsManagementPolicyNegotiatorComponentType.Example) {\n\t\tcomponent = new ExamplePolicyNegotiator({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(ExamplePolicyNegotiator);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: PolicyNegotiatorFactory\n\t};\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PolicyRequesterFactory } from "@twin.org/rights-management-models";
|
|
2
|
+
import { ExamplePolicyRequester } from "@twin.org/rights-management-plugins";
|
|
3
|
+
import { RightsManagementPolicyRequesterComponentType } from "../models/types/rightsManagementPolicyRequesterComponentType.js";
|
|
4
|
+
/**
|
|
5
|
+
* Initialise the rights management policy requester component.
|
|
6
|
+
* @param engineCore The engine core.
|
|
7
|
+
* @param context The context for the engine.
|
|
8
|
+
* @param instanceConfig The instance config.
|
|
9
|
+
* @returns The instance created and the factory for it.
|
|
10
|
+
*/
|
|
11
|
+
export async function initialiseRightsManagementPolicyRequesterComponent(engineCore, context, instanceConfig) {
|
|
12
|
+
let component;
|
|
13
|
+
let instanceType;
|
|
14
|
+
if (instanceConfig.type === RightsManagementPolicyRequesterComponentType.Example) {
|
|
15
|
+
component = new ExamplePolicyRequester({
|
|
16
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
17
|
+
...instanceConfig.options
|
|
18
|
+
});
|
|
19
|
+
instanceType = "example-policy-requester";
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
component,
|
|
23
|
+
instanceType,
|
|
24
|
+
factory: PolicyRequesterFactory
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=rightsManagementPolicyRequester.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rightsManagementPolicyRequester.js","sourceRoot":"","sources":["../../../src/components/rightsManagementPolicyRequester.ts"],"names":[],"mappings":"AAKA,OAAO,EAAyB,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAG7E,OAAO,EAAE,4CAA4C,EAAE,MAAM,iEAAiE,CAAC;AAE/H;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,kDAAkD,CACvE,UAAsC,EACtC,OAA0C,EAC1C,cAA8D;IAM9D,IAAI,SAAuC,CAAC;IAC5C,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,4CAA4C,CAAC,OAAO,EAAE,CAAC;QAClF,SAAS,GAAG,IAAI,sBAAsB,CAAC;YACtC,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,6BAA0C,CAAC;IACxD,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,sBAAsB;KAC/B,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport { type IPolicyRequester, PolicyRequesterFactory } from \"@twin.org/rights-management-models\";\nimport { ExamplePolicyRequester } from \"@twin.org/rights-management-plugins\";\nimport type { RightsManagementPolicyRequesterComponentConfig } from \"../models/config/rightsManagementPolicyRequesterComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { RightsManagementPolicyRequesterComponentType } from \"../models/types/rightsManagementPolicyRequesterComponentType.js\";\n\n/**\n * Initialise the rights management policy requester component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseRightsManagementPolicyRequesterComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: RightsManagementPolicyRequesterComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof PolicyRequesterFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IPolicyRequester | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === RightsManagementPolicyRequesterComponentType.Example) {\n\t\tcomponent = new ExamplePolicyRequester({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(ExamplePolicyRequester);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: PolicyRequesterFactory\n\t};\n}\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 2024 IOTA Stiftung.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
-
import { ComponentFactory
|
|
4
|
-
import { EngineModuleHelper } from "@twin.org/engine-core";
|
|
3
|
+
import { ComponentFactory } from "@twin.org/core";
|
|
5
4
|
import { PolicyExecutionPointService } from "@twin.org/rights-management-pxp-service";
|
|
6
5
|
import { RightsManagementPxpComponentType } from "../models/types/rightsManagementPxpComponentType.js";
|
|
7
6
|
/**
|
|
@@ -15,22 +14,9 @@ export async function initialiseRightsManagementPxpComponent(engineCore, context
|
|
|
15
14
|
let component;
|
|
16
15
|
let instanceType;
|
|
17
16
|
if (instanceConfig.type === RightsManagementPxpComponentType.Service) {
|
|
18
|
-
const modules = [];
|
|
19
|
-
if (Is.arrayValue(instanceConfig.options?.actionModulesConfig)) {
|
|
20
|
-
for (const moduleConfig of instanceConfig.options.actionModulesConfig) {
|
|
21
|
-
modules.push({
|
|
22
|
-
actionId: moduleConfig.id,
|
|
23
|
-
action: await EngineModuleHelper.loadComponent(engineCore, moduleConfig)
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
17
|
component = new PolicyExecutionPointService({
|
|
28
18
|
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
29
|
-
...instanceConfig.options
|
|
30
|
-
config: {
|
|
31
|
-
...instanceConfig.options?.config,
|
|
32
|
-
actions: instanceConfig.options?.config?.actions ?? modules
|
|
33
|
-
}
|
|
19
|
+
...instanceConfig.options
|
|
34
20
|
});
|
|
35
21
|
instanceType = "policy-execution-point-service";
|
|
36
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rightsManagementPxp.js","sourceRoot":"","sources":["../../../src/components/rightsManagementPxp.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"rightsManagementPxp.js","sourceRoot":"","sources":["../../../src/components/rightsManagementPxp.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAInE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAGtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAC;AAEvG;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,sCAAsC,CAC3D,UAAsC,EACtC,OAA0C,EAC1C,cAAkD;IAMlD,IAAI,SAAqD,CAAC;IAC1D,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,gCAAgC,CAAC,OAAO,EAAE,CAAC;QACtE,SAAS,GAAG,IAAI,2BAA2B,CAAC;YAC3C,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,mCAA+C,CAAC;IAC7D,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport type { IPolicyExecutionPointComponent } from \"@twin.org/rights-management-models\";\nimport { PolicyExecutionPointService } from \"@twin.org/rights-management-pxp-service\";\nimport type { RightsManagementPxpComponentConfig } from \"../models/config/rightsManagementPxpComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { RightsManagementPxpComponentType } from \"../models/types/rightsManagementPxpComponentType.js\";\n\n/**\n * Initialise the rights management PXP component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseRightsManagementPxpComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: RightsManagementPxpComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof ComponentFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: IPolicyExecutionPointComponent | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === RightsManagementPxpComponentType.Service) {\n\t\tcomponent = new PolicyExecutionPointService({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(PolicyExecutionPointService);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|
|
@@ -25,11 +25,11 @@ export async function initialiseSynchronisedStorageComponent(engineCore, context
|
|
|
25
25
|
vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
|
|
26
26
|
verifiableStorageConnectorType: engineCore.getRegisteredInstanceType("verifiableStorageConnector"),
|
|
27
27
|
taskSchedulerComponentType: engineCore.getRegisteredInstanceType("taskSchedulerComponent"),
|
|
28
|
-
policyEnforcementPointComponentType: engineCore.getRegisteredInstanceTypeOptional("rightsManagementPepComponent"),
|
|
29
28
|
trustedSynchronisedStorageComponentType: engineCore.getRegisteredInstanceTypeOptional("synchronisedStorageComponent", ["trusted"]),
|
|
30
29
|
blobStorageConnectorType: engineCore.getRegisteredInstanceType("blobStorageConnector", [
|
|
31
30
|
"public"
|
|
32
31
|
]),
|
|
32
|
+
trustComponentType: engineCore.getRegisteredInstanceType("trustComponent"),
|
|
33
33
|
...instanceConfig.options
|
|
34
34
|
});
|
|
35
35
|
instanceType = "synchronised-storage-service";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synchronisedStorage.js","sourceRoot":"","sources":["../../../src/components/synchronisedStorage.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAInE,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,EAEN,0BAA0B,EAC1B,UAAU,IAAI,6BAA6B,EAC3C,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAGtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAC;AAEvG;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,sCAAsC,CAC3D,UAAsC,EACtC,OAA0C,EAC1C,cAAkD;IAMlD,IAAI,SAAoD,CAAC;IACzD,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,gCAAgC,CAAC,OAAO,EAAE,CAAC;QACtE,6BAA6B,EAAE,CAAC;QAEhC,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,cAAc,CAAC,OAAO,EAAE,gCAAgC,uBAExD,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAC1F,CAAC;QACF,SAAS,GAAG,IAAI,0BAA0B,CAAC;YAC1C,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,qBAAqB,EAAE,UAAU,CAAC,yBAAyB,CAAC,mBAAmB,CAAC;YAChF,kBAAkB,EAAE,UAAU,CAAC,yBAAyB,CAAC,gBAAgB,CAAC;YAC1E,8BAA8B,EAAE,UAAU,CAAC,yBAAyB,CACnE,4BAA4B,CAC5B;YACD,0BAA0B,EAAE,UAAU,CAAC,yBAAyB,CAAC,wBAAwB,CAAC;YAC1F,
|
|
1
|
+
{"version":3,"file":"synchronisedStorage.js","sourceRoot":"","sources":["../../../src/components/synchronisedStorage.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAInE,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,EAEN,0BAA0B,EAC1B,UAAU,IAAI,6BAA6B,EAC3C,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAGtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAC;AAEvG;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,sCAAsC,CAC3D,UAAsC,EACtC,OAA0C,EAC1C,cAAkD;IAMlD,IAAI,SAAoD,CAAC;IACzD,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,gCAAgC,CAAC,OAAO,EAAE,CAAC;QACtE,6BAA6B,EAAE,CAAC;QAEhC,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,cAAc,CAAC,OAAO,EAAE,gCAAgC,uBAExD,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAC1F,CAAC;QACF,SAAS,GAAG,IAAI,0BAA0B,CAAC;YAC1C,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,qBAAqB,EAAE,UAAU,CAAC,yBAAyB,CAAC,mBAAmB,CAAC;YAChF,kBAAkB,EAAE,UAAU,CAAC,yBAAyB,CAAC,gBAAgB,CAAC;YAC1E,8BAA8B,EAAE,UAAU,CAAC,yBAAyB,CACnE,4BAA4B,CAC5B;YACD,0BAA0B,EAAE,UAAU,CAAC,yBAAyB,CAAC,wBAAwB,CAAC;YAC1F,uCAAuC,EAAE,UAAU,CAAC,iCAAiC,CACpF,8BAA8B,EAC9B,CAAC,SAAS,CAAC,CACX;YACD,wBAAwB,EAAE,UAAU,CAAC,yBAAyB,CAAC,sBAAsB,EAAE;gBACtF,QAAQ;aACR,CAAC;YACF,kBAAkB,EAAE,UAAU,CAAC,yBAAyB,CAAC,gBAAgB,CAAC;YAC1E,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,iCAA8C,CAAC;IAC5D,CAAC;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,gCAAgC,CAAC,UAAU,EAAE,CAAC;QAChF,SAAS,GAAG,IAAI,6BAA6B,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACtE,YAAY,qCAAiD,CAAC;IAC/D,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport type { ISynchronisedStorageComponent } from \"@twin.org/synchronised-storage-models\";\nimport { SynchronisedStorageRestClient } from \"@twin.org/synchronised-storage-rest-client\";\nimport {\n\ttype SyncSnapshotEntry,\n\tSynchronisedStorageService,\n\tinitSchema as initSchemaSynchronisedStorage\n} from \"@twin.org/synchronised-storage-service\";\nimport { initialiseEntityStorageConnector } from \"./entityStorage.js\";\nimport type { SynchronisedStorageComponentConfig } from \"../models/config/synchronisedStorageComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { SynchronisedStorageComponentType } from \"../models/types/synchronisedStorageComponentType.js\";\n\n/**\n * Initialise the synchronised storage component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseSynchronisedStorageComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: SynchronisedStorageComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof ComponentFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: ISynchronisedStorageComponent | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === SynchronisedStorageComponentType.Service) {\n\t\tinitSchemaSynchronisedStorage();\n\n\t\tinitialiseEntityStorageConnector(\n\t\t\tengineCore,\n\t\t\tcontext,\n\t\t\tinstanceConfig.options?.syncSnapshotStorageConnectorType,\n\t\t\tnameof<SyncSnapshotEntry>(),\n\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node])\n\t\t);\n\t\tcomponent = new SynchronisedStorageService({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\teventBusComponentType: engineCore.getRegisteredInstanceType(\"eventBusComponent\"),\n\t\t\tvaultConnectorType: engineCore.getRegisteredInstanceType(\"vaultConnector\"),\n\t\t\tverifiableStorageConnectorType: engineCore.getRegisteredInstanceType(\n\t\t\t\t\"verifiableStorageConnector\"\n\t\t\t),\n\t\t\ttaskSchedulerComponentType: engineCore.getRegisteredInstanceType(\"taskSchedulerComponent\"),\n\t\t\ttrustedSynchronisedStorageComponentType: engineCore.getRegisteredInstanceTypeOptional(\n\t\t\t\t\"synchronisedStorageComponent\",\n\t\t\t\t[\"trusted\"]\n\t\t\t),\n\t\t\tblobStorageConnectorType: engineCore.getRegisteredInstanceType(\"blobStorageConnector\", [\n\t\t\t\t\"public\"\n\t\t\t]),\n\t\t\ttrustComponentType: engineCore.getRegisteredInstanceType(\"trustComponent\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(SynchronisedStorageService);\n\t} else if (instanceConfig.type === SynchronisedStorageComponentType.RestClient) {\n\t\tcomponent = new SynchronisedStorageRestClient(instanceConfig.options);\n\t\tinstanceType = nameofKebabCase(SynchronisedStorageRestClient);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { ComponentFactory } from "@twin.org/core";
|
|
4
|
+
import { TrustService } from "@twin.org/trust-service";
|
|
5
|
+
import { TrustComponentType } from "../models/types/trustComponentType.js";
|
|
6
|
+
/**
|
|
7
|
+
* Initialise the trust component.
|
|
8
|
+
* @param engineCore The engine core.
|
|
9
|
+
* @param context The context for the engine.
|
|
10
|
+
* @param instanceConfig The instance config.
|
|
11
|
+
* @returns The instance created and the factory for it.
|
|
12
|
+
*/
|
|
13
|
+
export async function initialiseTrustComponent(engineCore, context, instanceConfig) {
|
|
14
|
+
let component;
|
|
15
|
+
let instanceType;
|
|
16
|
+
if (instanceConfig.type === TrustComponentType.Service) {
|
|
17
|
+
component = new TrustService({
|
|
18
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
19
|
+
...instanceConfig.options
|
|
20
|
+
});
|
|
21
|
+
instanceType = "trust-service";
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
component,
|
|
25
|
+
instanceType,
|
|
26
|
+
factory: ComponentFactory
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=trust.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trust.js","sourceRoot":"","sources":["../../../src/components/trust.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAInE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC7C,UAAsC,EACtC,OAA0C,EAC1C,cAAoC;IAMpC,IAAI,SAAsC,CAAC;IAC3C,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,kBAAkB,CAAC,OAAO,EAAE,CAAC;QACxD,SAAS,GAAG,IAAI,YAAY,CAAC;YAC5B,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,kBAAgC,CAAC;IAC9C,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport type { ITrustComponent } from \"@twin.org/trust-models\";\nimport { TrustService } from \"@twin.org/trust-service\";\nimport type { TrustComponentConfig } from \"../models/config/trustComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { TrustComponentType } from \"../models/types/trustComponentType.js\";\n\n/**\n * Initialise the trust component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseTrustComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: TrustComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof ComponentFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: ITrustComponent | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === TrustComponentType.Service) {\n\t\tcomponent = new TrustService({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(TrustService);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { JwtVerifiableCredentialGenerator } from "@twin.org/trust-generators";
|
|
2
|
+
import { TrustGeneratorFactory } from "@twin.org/trust-models";
|
|
3
|
+
import { TrustGeneratorComponentType } from "../models/types/trustGeneratorComponentType.js";
|
|
4
|
+
/**
|
|
5
|
+
* Initialise the trust generator component.
|
|
6
|
+
* @param engineCore The engine core.
|
|
7
|
+
* @param context The context for the engine.
|
|
8
|
+
* @param instanceConfig The instance config.
|
|
9
|
+
* @returns The instance created and the factory for it.
|
|
10
|
+
*/
|
|
11
|
+
export async function initialiseTrustGeneratorComponent(engineCore, context, instanceConfig) {
|
|
12
|
+
let component;
|
|
13
|
+
let instanceType;
|
|
14
|
+
if (instanceConfig.type === TrustGeneratorComponentType.JwtVerifiableCredential) {
|
|
15
|
+
component = new JwtVerifiableCredentialGenerator({
|
|
16
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
17
|
+
identityComponentType: engineCore.getRegisteredInstanceType("identityComponent"),
|
|
18
|
+
...instanceConfig.options
|
|
19
|
+
});
|
|
20
|
+
instanceType = "jwt-verifiable-credential-generator";
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
component,
|
|
24
|
+
instanceType,
|
|
25
|
+
factory: TrustGeneratorFactory
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=trustGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trustGenerator.js","sourceRoot":"","sources":["../../../src/components/trustGenerator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAwB,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAGrF,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAE7F;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iCAAiC,CACtD,UAAsC,EACtC,OAA0C,EAC1C,cAA6C;IAM7C,IAAI,SAAsC,CAAC;IAC3C,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,2BAA2B,CAAC,uBAAuB,EAAE,CAAC;QACjF,SAAS,GAAG,IAAI,gCAAgC,CAAC;YAChD,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,qBAAqB,EAAE,UAAU,CAAC,yBAAyB,CAAC,mBAAmB,CAAC;YAChF,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,wCAAoD,CAAC;IAClE,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,qBAAqB;KAC9B,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport { JwtVerifiableCredentialGenerator } from \"@twin.org/trust-generators\";\nimport { type ITrustGenerator, TrustGeneratorFactory } from \"@twin.org/trust-models\";\nimport type { TrustGeneratorComponentConfig } from \"../models/config/trustGeneratorComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { TrustGeneratorComponentType } from \"../models/types/trustGeneratorComponentType.js\";\n\n/**\n * Initialise the trust generator component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseTrustGeneratorComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: TrustGeneratorComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof TrustGeneratorFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: ITrustGenerator | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === TrustGeneratorComponentType.JwtVerifiableCredential) {\n\t\tcomponent = new JwtVerifiableCredentialGenerator({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\tidentityComponentType: engineCore.getRegisteredInstanceType(\"identityComponent\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(JwtVerifiableCredentialGenerator);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: TrustGeneratorFactory\n\t};\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TrustVerifierFactory } from "@twin.org/trust-models";
|
|
2
|
+
import { JwtVerifiableCredentialVerifier } from "@twin.org/trust-verifiers";
|
|
3
|
+
import { TrustVerifierComponentType } from "../models/types/trustVerifierComponentType.js";
|
|
4
|
+
/**
|
|
5
|
+
* Initialise the trust verifier component.
|
|
6
|
+
* @param engineCore The engine core.
|
|
7
|
+
* @param context The context for the engine.
|
|
8
|
+
* @param instanceConfig The instance config.
|
|
9
|
+
* @returns The instance created and the factory for it.
|
|
10
|
+
*/
|
|
11
|
+
export async function initialiseTrustVerifierComponent(engineCore, context, instanceConfig) {
|
|
12
|
+
let component;
|
|
13
|
+
let instanceType;
|
|
14
|
+
if (instanceConfig.type === TrustVerifierComponentType.JwtVerifiableCredential) {
|
|
15
|
+
component = new JwtVerifiableCredentialVerifier({
|
|
16
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
17
|
+
identityComponentType: engineCore.getRegisteredInstanceType("identityComponent"),
|
|
18
|
+
...instanceConfig.options
|
|
19
|
+
});
|
|
20
|
+
instanceType = "jwt-verifiable-credential-verifier";
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
component,
|
|
24
|
+
instanceType,
|
|
25
|
+
factory: TrustVerifierFactory
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=trustVerifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trustVerifier.js","sourceRoot":"","sources":["../../../src/components/trustVerifier.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAG5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAE3F;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACrD,UAAsC,EACtC,OAA0C,EAC1C,cAA4C;IAM5C,IAAI,SAAqC,CAAC;IAC1C,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,0BAA0B,CAAC,uBAAuB,EAAE,CAAC;QAChF,SAAS,GAAG,IAAI,+BAA+B,CAAC;YAC/C,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;YAC9E,qBAAqB,EAAE,UAAU,CAAC,yBAAyB,CAAC,mBAAmB,CAAC;YAChF,GAAG,cAAc,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,YAAY,uCAAmD,CAAC;IACjE,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,oBAAoB;KAC7B,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport { type ITrustVerifier, TrustVerifierFactory } from \"@twin.org/trust-models\";\nimport { JwtVerifiableCredentialVerifier } from \"@twin.org/trust-verifiers\";\nimport type { TrustVerifierComponentConfig } from \"../models/config/trustVerifierComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { TrustVerifierComponentType } from \"../models/types/trustVerifierComponentType.js\";\n\n/**\n * Initialise the trust verifier component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseTrustVerifierComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: TrustVerifierComponentConfig\n): Promise<{\n\tinstanceType?: string;\n\tfactory?: typeof TrustVerifierFactory;\n\tcomponent?: IComponent;\n}> {\n\tlet component: ITrustVerifier | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === TrustVerifierComponentType.JwtVerifiableCredential) {\n\t\tcomponent = new JwtVerifiableCredentialVerifier({\n\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\"),\n\t\t\tidentityComponentType: engineCore.getRegisteredInstanceType(\"identityComponent\"),\n\t\t\t...instanceConfig.options\n\t\t});\n\t\tinstanceType = nameofKebabCase(JwtVerifiableCredentialVerifier);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: TrustVerifierFactory\n\t};\n}\n"]}
|