@twin.org/engine-types 0.0.2-next.13 → 0.0.2-next.15
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/cjs/index.cjs +276 -112
- package/dist/esm/index.mjs +263 -103
- package/dist/types/components/authenticationGenerator.d.ts +13 -0
- package/dist/types/components/rightsManagementDap.d.ts +13 -0
- package/dist/types/components/{rightsManagementPnrp.d.ts → rightsManagementDarp.d.ts} +3 -3
- package/dist/types/index.d.ts +10 -4
- package/dist/types/models/IEngineConfig.d.ts +13 -3
- package/dist/types/models/config/authenticationGeneratorComponentConfig.d.ts +9 -0
- package/dist/types/models/config/rightsManagementDapComponentConfig.d.ts +16 -0
- package/dist/types/models/config/rightsManagementDarpComponentConfig.d.ts +12 -0
- package/dist/types/models/config/rightsManagementPdpComponentConfig.d.ts +4 -1
- package/dist/types/models/config/rightsManagementPnpComponentConfig.d.ts +2 -1
- package/dist/types/models/types/authenticationGeneratorComponentType.d.ts +13 -0
- package/dist/types/models/types/rightsManagementDapComponentType.d.ts +17 -0
- package/dist/types/models/types/rightsManagementDarpComponentType.d.ts +13 -0
- package/docs/changelog.md +30 -0
- package/docs/reference/functions/initialiseAuthenticationGeneratorComponent.md +41 -0
- package/docs/reference/functions/initialiseRightsManagementDapComponent.md +41 -0
- package/docs/reference/functions/{initialiseRightsManagementPnrpComponent.md → initialiseRightsManagementDarpComponent.md} +4 -4
- package/docs/reference/index.md +12 -4
- package/docs/reference/interfaces/IEngineConfig.md +15 -3
- package/docs/reference/type-aliases/AuthenticationGeneratorComponentConfig.md +17 -0
- package/docs/reference/type-aliases/AuthenticationGeneratorComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementDapComponentConfig.md +5 -0
- package/docs/reference/type-aliases/RightsManagementDapComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementDarpComponentConfig.md +23 -0
- package/docs/reference/type-aliases/RightsManagementDarpComponentType.md +5 -0
- package/docs/reference/type-aliases/RightsManagementPdpComponentConfig.md +7 -1
- package/docs/reference/type-aliases/RightsManagementPnpComponentConfig.md +1 -1
- package/docs/reference/variables/AuthenticationGeneratorComponentType.md +13 -0
- package/docs/reference/variables/RightsManagementDapComponentType.md +19 -0
- package/docs/reference/variables/RightsManagementDarpComponentType.md +13 -0
- package/package.json +6 -3
- package/dist/types/models/config/rightsManagementPnrpComponentConfig.d.ts +0 -9
- package/dist/types/models/types/rightsManagementPnrpComponentType.d.ts +0 -13
- package/docs/reference/type-aliases/RightsManagementPnrpComponentConfig.md +0 -17
- package/docs/reference/type-aliases/RightsManagementPnrpComponentType.md +0 -5
- package/docs/reference/variables/RightsManagementPnrpComponentType.md +0 -13
package/dist/cjs/index.cjs
CHANGED
|
@@ -23,6 +23,8 @@ var entityStorageRestClient = require('@twin.org/entity-storage-rest-client');
|
|
|
23
23
|
var entityStorageService = require('@twin.org/entity-storage-service');
|
|
24
24
|
var auditableItemStreamRestClient = require('@twin.org/auditable-item-stream-rest-client');
|
|
25
25
|
var auditableItemStreamService = require('@twin.org/auditable-item-stream-service');
|
|
26
|
+
var apiModels = require('@twin.org/api-models');
|
|
27
|
+
var identityAuthentication = require('@twin.org/identity-authentication');
|
|
26
28
|
var backgroundTaskConnectorEntityStorage = require('@twin.org/background-task-connector-entity-storage');
|
|
27
29
|
var backgroundTaskModels = require('@twin.org/background-task-models');
|
|
28
30
|
var blobStorageConnectorAwsS3 = require('@twin.org/blob-storage-connector-aws-s3');
|
|
@@ -75,10 +77,11 @@ var nftConnectorIota = require('@twin.org/nft-connector-iota');
|
|
|
75
77
|
var nftModels = require('@twin.org/nft-models');
|
|
76
78
|
var nftRestClient = require('@twin.org/nft-rest-client');
|
|
77
79
|
var nftService = require('@twin.org/nft-service');
|
|
78
|
-
var
|
|
80
|
+
var rightsManagementDapService = require('@twin.org/rights-management-dap-service');
|
|
79
81
|
var rightsManagementRestClient = require('@twin.org/rights-management-rest-client');
|
|
80
|
-
var
|
|
82
|
+
var rightsManagementPapService = require('@twin.org/rights-management-pap-service');
|
|
81
83
|
var engineCore = require('@twin.org/engine-core');
|
|
84
|
+
var rightsManagementPdpService = require('@twin.org/rights-management-pdp-service');
|
|
82
85
|
var rightsManagementPepService = require('@twin.org/rights-management-pep-service');
|
|
83
86
|
var rightsManagementPipService = require('@twin.org/rights-management-pip-service');
|
|
84
87
|
var rightsManagementPmpService = require('@twin.org/rights-management-pmp-service');
|
|
@@ -615,6 +618,60 @@ async function initialiseAuditableItemStreamComponent(engineCore, context, insta
|
|
|
615
618
|
return finalInstanceType;
|
|
616
619
|
}
|
|
617
620
|
|
|
621
|
+
// Copyright 2024 IOTA Stiftung.
|
|
622
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
623
|
+
/**
|
|
624
|
+
* Authentication generator component types.
|
|
625
|
+
*/
|
|
626
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
627
|
+
const AuthenticationGeneratorComponentType = {
|
|
628
|
+
/**
|
|
629
|
+
* Verifiable Credential.
|
|
630
|
+
*/
|
|
631
|
+
VerifiableCredential: "verifiable-credential"
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
// Copyright 2024 IOTA Stiftung.
|
|
635
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
636
|
+
/**
|
|
637
|
+
* Initialise the authentication generator component.
|
|
638
|
+
* @param engineCore The engine core.
|
|
639
|
+
* @param context The context for the engine.
|
|
640
|
+
* @param instanceConfig The instance config.
|
|
641
|
+
* @param overrideInstanceType The instance type to override the default.
|
|
642
|
+
* @returns The name of the instance created.
|
|
643
|
+
* @throws GeneralError if the component type is unknown.
|
|
644
|
+
*/
|
|
645
|
+
async function initialiseAuthenticationGeneratorComponent(engineCore, context, instanceConfig, overrideInstanceType) {
|
|
646
|
+
engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
|
|
647
|
+
element: `Authentication Generator Component: ${instanceConfig.type}`
|
|
648
|
+
}));
|
|
649
|
+
const type = instanceConfig.type;
|
|
650
|
+
let component;
|
|
651
|
+
let instanceType;
|
|
652
|
+
if (type === AuthenticationGeneratorComponentType.VerifiableCredential) {
|
|
653
|
+
component = new identityAuthentication.VerifiableCredentialAuthenticationGenerator({
|
|
654
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
655
|
+
identityConnectorType: engineCore.getRegisteredInstanceType("identityConnector"),
|
|
656
|
+
...instanceConfig.options
|
|
657
|
+
});
|
|
658
|
+
instanceType = core.StringHelper.kebabCase("VerifiableCredentialAuthenticationGenerator");
|
|
659
|
+
}
|
|
660
|
+
else {
|
|
661
|
+
throw new core.GeneralError("engineCore", "componentUnknownType", {
|
|
662
|
+
type,
|
|
663
|
+
componentType: "AuthenticationGeneratorComponent"
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
const finalInstanceType = overrideInstanceType ?? instanceType;
|
|
667
|
+
context.componentInstances.push({
|
|
668
|
+
instanceType: finalInstanceType,
|
|
669
|
+
component
|
|
670
|
+
});
|
|
671
|
+
apiModels.AuthenticationGeneratorFactory.register(finalInstanceType, () => component);
|
|
672
|
+
return finalInstanceType;
|
|
673
|
+
}
|
|
674
|
+
|
|
618
675
|
// Copyright 2024 IOTA Stiftung.
|
|
619
676
|
// SPDX-License-Identifier: Apache-2.0.
|
|
620
677
|
/**
|
|
@@ -2292,6 +2349,130 @@ async function initialiseNftComponent(engineCore, context, instanceConfig, overr
|
|
|
2292
2349
|
return finalInstanceType;
|
|
2293
2350
|
}
|
|
2294
2351
|
|
|
2352
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2353
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
2354
|
+
/**
|
|
2355
|
+
* Rights management DAP component types.
|
|
2356
|
+
*/
|
|
2357
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2358
|
+
const RightsManagementDapComponentType = {
|
|
2359
|
+
/**
|
|
2360
|
+
* Service.
|
|
2361
|
+
*/
|
|
2362
|
+
Service: "service",
|
|
2363
|
+
/**
|
|
2364
|
+
* REST client.
|
|
2365
|
+
*/
|
|
2366
|
+
RestClient: "rest-client"
|
|
2367
|
+
};
|
|
2368
|
+
|
|
2369
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2370
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
2371
|
+
/**
|
|
2372
|
+
* Initialise the rights management DAP component.
|
|
2373
|
+
* @param engineCore The engine core.
|
|
2374
|
+
* @param context The context for the engine.
|
|
2375
|
+
* @param instanceConfig The instance config.
|
|
2376
|
+
* @param overrideInstanceType The instance type to override the default.
|
|
2377
|
+
* @returns The name of the instance created.
|
|
2378
|
+
* @throws GeneralError if the component type is unknown.
|
|
2379
|
+
*/
|
|
2380
|
+
async function initialiseRightsManagementDapComponent(engineCore, context, instanceConfig, overrideInstanceType) {
|
|
2381
|
+
engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
|
|
2382
|
+
element: `Rights Management DAP Component: ${instanceConfig.type}`
|
|
2383
|
+
}));
|
|
2384
|
+
const type = instanceConfig.type;
|
|
2385
|
+
let component;
|
|
2386
|
+
let instanceType;
|
|
2387
|
+
if (type === RightsManagementDapComponentType.Service) {
|
|
2388
|
+
component = new rightsManagementDapService.DataAccessPointService({
|
|
2389
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
2390
|
+
policyEnforcementPointComponentType: engineCore.getRegisteredInstanceType("rightsManagementPepComponent"),
|
|
2391
|
+
...instanceConfig.options,
|
|
2392
|
+
config: {
|
|
2393
|
+
...instanceConfig.options?.config
|
|
2394
|
+
}
|
|
2395
|
+
});
|
|
2396
|
+
instanceType = core.StringHelper.kebabCase("DataAccessPointService");
|
|
2397
|
+
}
|
|
2398
|
+
else if (type === RightsManagementDapComponentType.RestClient) {
|
|
2399
|
+
component = new rightsManagementRestClient.DataAccessPointClient({
|
|
2400
|
+
...instanceConfig.options,
|
|
2401
|
+
authenticationGeneratorType: instanceConfig.options?.authenticationGeneratorType ??
|
|
2402
|
+
engineCore.getRegisteredInstanceType("authenticationGeneratorComponent", [
|
|
2403
|
+
"verifiable-credential"
|
|
2404
|
+
])
|
|
2405
|
+
});
|
|
2406
|
+
instanceType = core.StringHelper.kebabCase("DataAccessPointClient");
|
|
2407
|
+
}
|
|
2408
|
+
else {
|
|
2409
|
+
throw new core.GeneralError("engineCore", "componentUnknownType", {
|
|
2410
|
+
type,
|
|
2411
|
+
componentType: "RightsManagementDapComponent"
|
|
2412
|
+
});
|
|
2413
|
+
}
|
|
2414
|
+
const finalInstanceType = overrideInstanceType ?? instanceType;
|
|
2415
|
+
context.componentInstances.push({
|
|
2416
|
+
instanceType: finalInstanceType,
|
|
2417
|
+
component
|
|
2418
|
+
});
|
|
2419
|
+
core.ComponentFactory.register(finalInstanceType, () => component);
|
|
2420
|
+
return finalInstanceType;
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2424
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
2425
|
+
/**
|
|
2426
|
+
* Rights management DARP component types.
|
|
2427
|
+
*/
|
|
2428
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2429
|
+
const RightsManagementDarpComponentType = {
|
|
2430
|
+
/**
|
|
2431
|
+
* Service.
|
|
2432
|
+
*/
|
|
2433
|
+
Service: "service"
|
|
2434
|
+
};
|
|
2435
|
+
|
|
2436
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2437
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
2438
|
+
/**
|
|
2439
|
+
* Initialise the rights management DARP component.
|
|
2440
|
+
* @param engineCore The engine core.
|
|
2441
|
+
* @param context The context for the engine.
|
|
2442
|
+
* @param instanceConfig The instance config.
|
|
2443
|
+
* @param overrideInstanceType The instance type to override the default.
|
|
2444
|
+
* @returns The name of the instance created.
|
|
2445
|
+
* @throws GeneralError if the component type is unknown.
|
|
2446
|
+
*/
|
|
2447
|
+
async function initialiseRightsManagementDarpComponent(engineCore, context, instanceConfig, overrideInstanceType) {
|
|
2448
|
+
engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
|
|
2449
|
+
element: `Rights Management DARP Component: ${instanceConfig.type}`
|
|
2450
|
+
}));
|
|
2451
|
+
const type = instanceConfig.type;
|
|
2452
|
+
let component;
|
|
2453
|
+
let instanceType;
|
|
2454
|
+
if (type === RightsManagementDarpComponentType.Service) {
|
|
2455
|
+
component = new rightsManagementDapService.DataAccessRequestPointService({
|
|
2456
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
2457
|
+
...instanceConfig.options
|
|
2458
|
+
});
|
|
2459
|
+
instanceType = core.StringHelper.kebabCase("DataAccessRequestPointService");
|
|
2460
|
+
}
|
|
2461
|
+
else {
|
|
2462
|
+
throw new core.GeneralError("engineCore", "componentUnknownType", {
|
|
2463
|
+
type,
|
|
2464
|
+
componentType: "RightsManagementDarpComponent"
|
|
2465
|
+
});
|
|
2466
|
+
}
|
|
2467
|
+
const finalInstanceType = overrideInstanceType ?? instanceType;
|
|
2468
|
+
context.componentInstances.push({
|
|
2469
|
+
instanceType: finalInstanceType,
|
|
2470
|
+
component
|
|
2471
|
+
});
|
|
2472
|
+
core.ComponentFactory.register(finalInstanceType, () => component);
|
|
2473
|
+
return finalInstanceType;
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2295
2476
|
// Copyright 2024 IOTA Stiftung.
|
|
2296
2477
|
// SPDX-License-Identifier: Apache-2.0.
|
|
2297
2478
|
/**
|
|
@@ -2379,20 +2560,33 @@ const RightsManagementPdpComponentType = {
|
|
|
2379
2560
|
* @returns The name of the instance created.
|
|
2380
2561
|
* @throws GeneralError if the component type is unknown.
|
|
2381
2562
|
*/
|
|
2382
|
-
async function initialiseRightsManagementPdpComponent(engineCore, context, instanceConfig, overrideInstanceType) {
|
|
2383
|
-
engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
|
|
2563
|
+
async function initialiseRightsManagementPdpComponent(engineCore$1, context, instanceConfig, overrideInstanceType) {
|
|
2564
|
+
engineCore$1.logInfo(core.I18n.formatMessage("engineCore.configuring", {
|
|
2384
2565
|
element: `Rights Management PDP Component: ${instanceConfig.type}`
|
|
2385
2566
|
}));
|
|
2386
2567
|
const type = instanceConfig.type;
|
|
2387
2568
|
let component;
|
|
2388
2569
|
let instanceType;
|
|
2389
2570
|
if (type === RightsManagementPdpComponentType.Service) {
|
|
2571
|
+
const arbiterModules = [];
|
|
2572
|
+
if (core.Is.arrayValue(instanceConfig.options?.arbiterModulesConfig)) {
|
|
2573
|
+
for (const moduleConfig of instanceConfig.options.arbiterModulesConfig) {
|
|
2574
|
+
arbiterModules.push({
|
|
2575
|
+
arbiterId: moduleConfig.id,
|
|
2576
|
+
arbiter: await engineCore.EngineModuleHelper.loadComponent(engineCore$1, moduleConfig)
|
|
2577
|
+
});
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2390
2580
|
component = new rightsManagementPdpService.PolicyDecisionPointService({
|
|
2391
|
-
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
2392
|
-
policyInformationPointComponentType: engineCore.getRegisteredInstanceType("rightsManagementPipComponent"),
|
|
2393
|
-
policyManagementPointComponentType: engineCore.getRegisteredInstanceType("rightsManagementPmpComponent"),
|
|
2394
|
-
policyExecutionPointComponentType: engineCore.getRegisteredInstanceType("rightsManagementPxpComponent"),
|
|
2395
|
-
...instanceConfig.options
|
|
2581
|
+
loggingComponentType: engineCore$1.getRegisteredInstanceType("loggingComponent"),
|
|
2582
|
+
policyInformationPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPipComponent"),
|
|
2583
|
+
policyManagementPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPmpComponent"),
|
|
2584
|
+
policyExecutionPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPxpComponent"),
|
|
2585
|
+
...instanceConfig.options,
|
|
2586
|
+
config: {
|
|
2587
|
+
...instanceConfig.options?.config,
|
|
2588
|
+
arbiters: instanceConfig.options?.config?.arbiters ?? arbiterModules
|
|
2589
|
+
}
|
|
2396
2590
|
});
|
|
2397
2591
|
instanceType = core.StringHelper.kebabCase("PolicyDecisionPointService");
|
|
2398
2592
|
}
|
|
@@ -2447,10 +2641,10 @@ async function initialiseRightsManagementPepComponent(engineCore$1, context, ins
|
|
|
2447
2641
|
let component;
|
|
2448
2642
|
let instanceType;
|
|
2449
2643
|
if (type === RightsManagementPepComponentType.Service) {
|
|
2450
|
-
const
|
|
2644
|
+
const processorModules = [];
|
|
2451
2645
|
if (core.Is.arrayValue(instanceConfig.options?.processorModulesConfig)) {
|
|
2452
2646
|
for (const moduleConfig of instanceConfig.options.processorModulesConfig) {
|
|
2453
|
-
|
|
2647
|
+
processorModules.push({
|
|
2454
2648
|
processorId: moduleConfig.id,
|
|
2455
2649
|
processor: await engineCore.EngineModuleHelper.loadComponent(engineCore$1, moduleConfig)
|
|
2456
2650
|
});
|
|
@@ -2462,7 +2656,7 @@ async function initialiseRightsManagementPepComponent(engineCore$1, context, ins
|
|
|
2462
2656
|
...instanceConfig.options,
|
|
2463
2657
|
config: {
|
|
2464
2658
|
...instanceConfig.options?.config,
|
|
2465
|
-
processors: instanceConfig.options?.config?.processors ??
|
|
2659
|
+
processors: instanceConfig.options?.config?.processors ?? processorModules
|
|
2466
2660
|
}
|
|
2467
2661
|
});
|
|
2468
2662
|
instanceType = core.StringHelper.kebabCase("PolicyEnforcementPointService");
|
|
@@ -2514,10 +2708,10 @@ async function initialiseRightsManagementPipComponent(engineCore$1, context, ins
|
|
|
2514
2708
|
let component;
|
|
2515
2709
|
let instanceType;
|
|
2516
2710
|
if (type === RightsManagementPipComponentType.Service) {
|
|
2517
|
-
const
|
|
2711
|
+
const informationSourceModules = [];
|
|
2518
2712
|
if (core.Is.arrayValue(instanceConfig.options?.informationModulesConfig)) {
|
|
2519
2713
|
for (const moduleConfig of instanceConfig.options.informationModulesConfig) {
|
|
2520
|
-
|
|
2714
|
+
informationSourceModules.push({
|
|
2521
2715
|
sourceId: moduleConfig.id,
|
|
2522
2716
|
source: await engineCore.EngineModuleHelper.loadComponent(engineCore$1, moduleConfig)
|
|
2523
2717
|
});
|
|
@@ -2528,7 +2722,7 @@ async function initialiseRightsManagementPipComponent(engineCore$1, context, ins
|
|
|
2528
2722
|
...instanceConfig.options,
|
|
2529
2723
|
config: {
|
|
2530
2724
|
...instanceConfig.options?.config,
|
|
2531
|
-
sources: instanceConfig.options?.config?.sources ??
|
|
2725
|
+
sources: instanceConfig.options?.config?.sources ?? informationSourceModules
|
|
2532
2726
|
}
|
|
2533
2727
|
});
|
|
2534
2728
|
instanceType = core.StringHelper.kebabCase("PolicyInformationPointService");
|
|
@@ -2602,84 +2796,6 @@ async function initialiseRightsManagementPmpComponent(engineCore, context, insta
|
|
|
2602
2796
|
return finalInstanceType;
|
|
2603
2797
|
}
|
|
2604
2798
|
|
|
2605
|
-
// Copyright 2024 IOTA Stiftung.
|
|
2606
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
2607
|
-
/**
|
|
2608
|
-
* Rights management PNP component types.
|
|
2609
|
-
*/
|
|
2610
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2611
|
-
const RightsManagementPnpComponentType = {
|
|
2612
|
-
/**
|
|
2613
|
-
* Service.
|
|
2614
|
-
*/
|
|
2615
|
-
Service: "service",
|
|
2616
|
-
/**
|
|
2617
|
-
* REST client.
|
|
2618
|
-
*/
|
|
2619
|
-
RestClient: "rest-client"
|
|
2620
|
-
};
|
|
2621
|
-
|
|
2622
|
-
// Copyright 2024 IOTA Stiftung.
|
|
2623
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
2624
|
-
/**
|
|
2625
|
-
* Initialise the rights management PNP component.
|
|
2626
|
-
* @param engineCore The engine core.
|
|
2627
|
-
* @param context The context for the engine.
|
|
2628
|
-
* @param instanceConfig The instance config.
|
|
2629
|
-
* @param overrideInstanceType The instance type to override the default.
|
|
2630
|
-
* @returns The name of the instance created.
|
|
2631
|
-
* @throws GeneralError if the component type is unknown.
|
|
2632
|
-
*/
|
|
2633
|
-
async function initialiseRightsManagementPnpComponent(engineCore$1, context, instanceConfig, overrideInstanceType) {
|
|
2634
|
-
engineCore$1.logInfo(core.I18n.formatMessage("engineCore.configuring", {
|
|
2635
|
-
element: `Rights Management PNP Component: ${instanceConfig.type}`
|
|
2636
|
-
}));
|
|
2637
|
-
const type = instanceConfig.type;
|
|
2638
|
-
let component;
|
|
2639
|
-
let instanceType;
|
|
2640
|
-
if (type === RightsManagementPnpComponentType.Service) {
|
|
2641
|
-
const modules = [];
|
|
2642
|
-
if (core.Is.arrayValue(instanceConfig.options?.negotiatorModulesConfig)) {
|
|
2643
|
-
for (const moduleConfig of instanceConfig.options.negotiatorModulesConfig) {
|
|
2644
|
-
modules.push({
|
|
2645
|
-
negotiatorId: moduleConfig.id,
|
|
2646
|
-
negotiator: await engineCore.EngineModuleHelper.loadComponent(engineCore$1, moduleConfig)
|
|
2647
|
-
});
|
|
2648
|
-
}
|
|
2649
|
-
}
|
|
2650
|
-
component = new rightsManagementPnpService.PolicyNegotiationPointService({
|
|
2651
|
-
loggingComponentType: engineCore$1.getRegisteredInstanceType("loggingComponent"),
|
|
2652
|
-
identityConnectorType: engineCore$1.getRegisteredInstanceType("identityConnector"),
|
|
2653
|
-
policyNegotiationAdministrationPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPnapComponent"),
|
|
2654
|
-
policyAdministrationPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPapComponent"),
|
|
2655
|
-
policyInformationPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPipComponent"),
|
|
2656
|
-
...instanceConfig.options,
|
|
2657
|
-
config: {
|
|
2658
|
-
...instanceConfig.options?.config,
|
|
2659
|
-
negotiators: instanceConfig.options?.config?.negotiators ?? modules
|
|
2660
|
-
}
|
|
2661
|
-
});
|
|
2662
|
-
instanceType = core.StringHelper.kebabCase("PolicyNegotiationPointService");
|
|
2663
|
-
}
|
|
2664
|
-
else if (type === RightsManagementPnpComponentType.RestClient) {
|
|
2665
|
-
component = new rightsManagementRestClient.PolicyNegotiationPointClient(instanceConfig.options);
|
|
2666
|
-
instanceType = core.StringHelper.kebabCase("PolicyNegotiationPointClient");
|
|
2667
|
-
}
|
|
2668
|
-
else {
|
|
2669
|
-
throw new core.GeneralError("engineCore", "componentUnknownType", {
|
|
2670
|
-
type,
|
|
2671
|
-
componentType: "RightsManagementPnpComponent"
|
|
2672
|
-
});
|
|
2673
|
-
}
|
|
2674
|
-
const finalInstanceType = overrideInstanceType ?? instanceType;
|
|
2675
|
-
context.componentInstances.push({
|
|
2676
|
-
instanceType: finalInstanceType,
|
|
2677
|
-
component
|
|
2678
|
-
});
|
|
2679
|
-
core.ComponentFactory.register(finalInstanceType, () => component);
|
|
2680
|
-
return finalInstanceType;
|
|
2681
|
-
}
|
|
2682
|
-
|
|
2683
2799
|
// Copyright 2024 IOTA Stiftung.
|
|
2684
2800
|
// SPDX-License-Identifier: Apache-2.0.
|
|
2685
2801
|
/**
|
|
@@ -2748,20 +2864,24 @@ async function initialiseRightsManagementPnapComponent(engineCore, context, inst
|
|
|
2748
2864
|
// Copyright 2024 IOTA Stiftung.
|
|
2749
2865
|
// SPDX-License-Identifier: Apache-2.0.
|
|
2750
2866
|
/**
|
|
2751
|
-
* Rights management
|
|
2867
|
+
* Rights management PNP component types.
|
|
2752
2868
|
*/
|
|
2753
2869
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2754
|
-
const
|
|
2870
|
+
const RightsManagementPnpComponentType = {
|
|
2755
2871
|
/**
|
|
2756
2872
|
* Service.
|
|
2757
2873
|
*/
|
|
2758
|
-
Service: "service"
|
|
2874
|
+
Service: "service",
|
|
2875
|
+
/**
|
|
2876
|
+
* REST client.
|
|
2877
|
+
*/
|
|
2878
|
+
RestClient: "rest-client"
|
|
2759
2879
|
};
|
|
2760
2880
|
|
|
2761
2881
|
// Copyright 2024 IOTA Stiftung.
|
|
2762
2882
|
// SPDX-License-Identifier: Apache-2.0.
|
|
2763
2883
|
/**
|
|
2764
|
-
* Initialise the rights management
|
|
2884
|
+
* Initialise the rights management PNP component.
|
|
2765
2885
|
* @param engineCore The engine core.
|
|
2766
2886
|
* @param context The context for the engine.
|
|
2767
2887
|
* @param instanceConfig The instance config.
|
|
@@ -2769,26 +2889,60 @@ const RightsManagementPnrpComponentType = {
|
|
|
2769
2889
|
* @returns The name of the instance created.
|
|
2770
2890
|
* @throws GeneralError if the component type is unknown.
|
|
2771
2891
|
*/
|
|
2772
|
-
async function
|
|
2773
|
-
engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
|
|
2774
|
-
element: `Rights Management
|
|
2892
|
+
async function initialiseRightsManagementPnpComponent(engineCore$1, context, instanceConfig, overrideInstanceType) {
|
|
2893
|
+
engineCore$1.logInfo(core.I18n.formatMessage("engineCore.configuring", {
|
|
2894
|
+
element: `Rights Management PNP Component: ${instanceConfig.type}`
|
|
2775
2895
|
}));
|
|
2776
2896
|
const type = instanceConfig.type;
|
|
2777
2897
|
let component;
|
|
2778
2898
|
let instanceType;
|
|
2779
|
-
if (type ===
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2899
|
+
if (type === RightsManagementPnpComponentType.Service) {
|
|
2900
|
+
const negotiatorModules = [];
|
|
2901
|
+
if (core.Is.arrayValue(instanceConfig.options?.negotiatorModulesConfig)) {
|
|
2902
|
+
for (const moduleConfig of instanceConfig.options.negotiatorModulesConfig) {
|
|
2903
|
+
negotiatorModules.push({
|
|
2904
|
+
negotiatorId: moduleConfig.id,
|
|
2905
|
+
negotiator: await engineCore.EngineModuleHelper.loadComponent(engineCore$1, moduleConfig)
|
|
2906
|
+
});
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2909
|
+
const requesterModules = [];
|
|
2910
|
+
if (core.Is.arrayValue(instanceConfig.options?.requesterModulesConfig)) {
|
|
2911
|
+
for (const moduleConfig of instanceConfig.options.requesterModulesConfig) {
|
|
2912
|
+
requesterModules.push({
|
|
2913
|
+
requesterId: moduleConfig.id,
|
|
2914
|
+
requester: await engineCore.EngineModuleHelper.loadComponent(engineCore$1, moduleConfig)
|
|
2915
|
+
});
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
component = new rightsManagementPnpService.PolicyNegotiationPointService({
|
|
2919
|
+
loggingComponentType: engineCore$1.getRegisteredInstanceType("loggingComponent"),
|
|
2920
|
+
policyNegotiationAdministrationPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPnapComponent"),
|
|
2921
|
+
policyAdministrationPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPapComponent"),
|
|
2922
|
+
policyInformationPointComponentType: engineCore$1.getRegisteredInstanceType("rightsManagementPipComponent"),
|
|
2923
|
+
...instanceConfig.options,
|
|
2924
|
+
config: {
|
|
2925
|
+
...instanceConfig.options?.config,
|
|
2926
|
+
negotiators: instanceConfig.options?.config?.negotiators ?? negotiatorModules,
|
|
2927
|
+
requesters: instanceConfig.options?.config?.requesters ?? requesterModules
|
|
2928
|
+
}
|
|
2785
2929
|
});
|
|
2786
|
-
instanceType = core.StringHelper.kebabCase("
|
|
2930
|
+
instanceType = core.StringHelper.kebabCase("PolicyNegotiationPointService");
|
|
2931
|
+
}
|
|
2932
|
+
else if (type === RightsManagementPnpComponentType.RestClient) {
|
|
2933
|
+
component = new rightsManagementRestClient.PolicyNegotiationPointClient({
|
|
2934
|
+
...instanceConfig.options,
|
|
2935
|
+
authenticationGeneratorType: instanceConfig.options?.authenticationGeneratorType ??
|
|
2936
|
+
engineCore$1.getRegisteredInstanceType("authenticationGeneratorComponent", [
|
|
2937
|
+
"verifiable-credential"
|
|
2938
|
+
])
|
|
2939
|
+
});
|
|
2940
|
+
instanceType = core.StringHelper.kebabCase("PolicyNegotiationPointClient");
|
|
2787
2941
|
}
|
|
2788
2942
|
else {
|
|
2789
2943
|
throw new core.GeneralError("engineCore", "componentUnknownType", {
|
|
2790
2944
|
type,
|
|
2791
|
-
componentType: "
|
|
2945
|
+
componentType: "RightsManagementPnpComponent"
|
|
2792
2946
|
});
|
|
2793
2947
|
}
|
|
2794
2948
|
const finalInstanceType = overrideInstanceType ?? instanceType;
|
|
@@ -2909,8 +3063,8 @@ async function initialiseSynchronisedStorageComponent(engineCore, context, insta
|
|
|
2909
3063
|
eventBusComponentType: engineCore.getRegisteredInstanceType("eventBusComponent"),
|
|
2910
3064
|
vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
|
|
2911
3065
|
verifiableStorageConnectorType: engineCore.getRegisteredInstanceType("verifiableStorageConnector"),
|
|
2912
|
-
identityConnectorType: engineCore.getRegisteredInstanceType("identityConnector"),
|
|
2913
3066
|
taskSchedulerComponentType: engineCore.getRegisteredInstanceType("taskSchedulerComponent"),
|
|
3067
|
+
policyEnforcementPointComponentType: engineCore.getRegisteredInstanceTypeOptional("rightsManagementPepComponent"),
|
|
2914
3068
|
trustedSynchronisedStorageComponentType: engineCore.getRegisteredInstanceTypeOptional("synchronisedStorageComponent", ["trusted"]),
|
|
2915
3069
|
blobStorageConnectorType: engineCore.getRegisteredInstanceType("blobStorageConnector", [
|
|
2916
3070
|
"public"
|
|
@@ -2920,7 +3074,13 @@ async function initialiseSynchronisedStorageComponent(engineCore, context, insta
|
|
|
2920
3074
|
instanceType = core.StringHelper.kebabCase("SynchronisedStorageService");
|
|
2921
3075
|
}
|
|
2922
3076
|
else if (type === SynchronisedStorageComponentType.RestClient) {
|
|
2923
|
-
component = new synchronisedStorageRestClient.SynchronisedStorageClient(
|
|
3077
|
+
component = new synchronisedStorageRestClient.SynchronisedStorageClient({
|
|
3078
|
+
...instanceConfig.options,
|
|
3079
|
+
authenticationGeneratorType: instanceConfig.options?.authenticationGeneratorType ??
|
|
3080
|
+
engineCore.getRegisteredInstanceType("authenticationGeneratorComponent", [
|
|
3081
|
+
"verifiable-credential"
|
|
3082
|
+
])
|
|
3083
|
+
});
|
|
2924
3084
|
instanceType = core.StringHelper.kebabCase("SynchronisedStorageClient");
|
|
2925
3085
|
}
|
|
2926
3086
|
else {
|
|
@@ -3394,6 +3554,7 @@ exports.AttestationComponentType = AttestationComponentType;
|
|
|
3394
3554
|
exports.AttestationConnectorType = AttestationConnectorType;
|
|
3395
3555
|
exports.AuditableItemGraphComponentType = AuditableItemGraphComponentType;
|
|
3396
3556
|
exports.AuditableItemStreamComponentType = AuditableItemStreamComponentType;
|
|
3557
|
+
exports.AuthenticationGeneratorComponentType = AuthenticationGeneratorComponentType;
|
|
3397
3558
|
exports.BackgroundTaskConnectorType = BackgroundTaskConnectorType;
|
|
3398
3559
|
exports.BlobStorageComponentType = BlobStorageComponentType;
|
|
3399
3560
|
exports.BlobStorageConnectorType = BlobStorageConnectorType;
|
|
@@ -3424,6 +3585,8 @@ exports.MessagingPushNotificationConnectorType = MessagingPushNotificationConnec
|
|
|
3424
3585
|
exports.MessagingSmsConnectorType = MessagingSmsConnectorType;
|
|
3425
3586
|
exports.NftComponentType = NftComponentType;
|
|
3426
3587
|
exports.NftConnectorType = NftConnectorType;
|
|
3588
|
+
exports.RightsManagementDapComponentType = RightsManagementDapComponentType;
|
|
3589
|
+
exports.RightsManagementDarpComponentType = RightsManagementDarpComponentType;
|
|
3427
3590
|
exports.RightsManagementPapComponentType = RightsManagementPapComponentType;
|
|
3428
3591
|
exports.RightsManagementPdpComponentType = RightsManagementPdpComponentType;
|
|
3429
3592
|
exports.RightsManagementPepComponentType = RightsManagementPepComponentType;
|
|
@@ -3431,7 +3594,6 @@ exports.RightsManagementPipComponentType = RightsManagementPipComponentType;
|
|
|
3431
3594
|
exports.RightsManagementPmpComponentType = RightsManagementPmpComponentType;
|
|
3432
3595
|
exports.RightsManagementPnapComponentType = RightsManagementPnapComponentType;
|
|
3433
3596
|
exports.RightsManagementPnpComponentType = RightsManagementPnpComponentType;
|
|
3434
|
-
exports.RightsManagementPnrpComponentType = RightsManagementPnrpComponentType;
|
|
3435
3597
|
exports.RightsManagementPxpComponentType = RightsManagementPxpComponentType;
|
|
3436
3598
|
exports.SynchronisedStorageComponentType = SynchronisedStorageComponentType;
|
|
3437
3599
|
exports.TaskSchedulerComponentType = TaskSchedulerComponentType;
|
|
@@ -3445,6 +3607,7 @@ exports.initialiseAttestationComponent = initialiseAttestationComponent;
|
|
|
3445
3607
|
exports.initialiseAttestationConnector = initialiseAttestationConnector;
|
|
3446
3608
|
exports.initialiseAuditableItemGraphComponent = initialiseAuditableItemGraphComponent;
|
|
3447
3609
|
exports.initialiseAuditableItemStreamComponent = initialiseAuditableItemStreamComponent;
|
|
3610
|
+
exports.initialiseAuthenticationGeneratorComponent = initialiseAuthenticationGeneratorComponent;
|
|
3448
3611
|
exports.initialiseBackgroundTaskConnector = initialiseBackgroundTaskConnector;
|
|
3449
3612
|
exports.initialiseBlobStorageComponent = initialiseBlobStorageComponent;
|
|
3450
3613
|
exports.initialiseBlobStorageConnector = initialiseBlobStorageConnector;
|
|
@@ -3474,6 +3637,8 @@ exports.initialiseMessagingPushNotificationConnector = initialiseMessagingPushNo
|
|
|
3474
3637
|
exports.initialiseMessagingSmsConnector = initialiseMessagingSmsConnector;
|
|
3475
3638
|
exports.initialiseNftComponent = initialiseNftComponent;
|
|
3476
3639
|
exports.initialiseNftConnector = initialiseNftConnector;
|
|
3640
|
+
exports.initialiseRightsManagementDapComponent = initialiseRightsManagementDapComponent;
|
|
3641
|
+
exports.initialiseRightsManagementDarpComponent = initialiseRightsManagementDarpComponent;
|
|
3477
3642
|
exports.initialiseRightsManagementPapComponent = initialiseRightsManagementPapComponent;
|
|
3478
3643
|
exports.initialiseRightsManagementPdpComponent = initialiseRightsManagementPdpComponent;
|
|
3479
3644
|
exports.initialiseRightsManagementPepComponent = initialiseRightsManagementPepComponent;
|
|
@@ -3481,7 +3646,6 @@ exports.initialiseRightsManagementPipComponent = initialiseRightsManagementPipCo
|
|
|
3481
3646
|
exports.initialiseRightsManagementPmpComponent = initialiseRightsManagementPmpComponent;
|
|
3482
3647
|
exports.initialiseRightsManagementPnapComponent = initialiseRightsManagementPnapComponent;
|
|
3483
3648
|
exports.initialiseRightsManagementPnpComponent = initialiseRightsManagementPnpComponent;
|
|
3484
|
-
exports.initialiseRightsManagementPnrpComponent = initialiseRightsManagementPnrpComponent;
|
|
3485
3649
|
exports.initialiseRightsManagementPxpComponent = initialiseRightsManagementPxpComponent;
|
|
3486
3650
|
exports.initialiseSynchronisedStorageComponent = initialiseSynchronisedStorageComponent;
|
|
3487
3651
|
exports.initialiseTaskSchedulerComponent = initialiseTaskSchedulerComponent;
|