@twin.org/rights-management-models 0.0.2-next.1 → 0.0.2-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/cjs/index.cjs +20 -0
  2. package/dist/esm/index.mjs +19 -1
  3. package/dist/types/factories/policyExecutionActionFactory.d.ts +6 -0
  4. package/dist/types/factories/policyInformationSourceFactory.d.ts +6 -0
  5. package/dist/types/index.d.ts +6 -1
  6. package/dist/types/models/IPolicyEnforcementPointComponent.d.ts +1 -1
  7. package/dist/types/models/IPolicyExecutionAction.d.ts +19 -0
  8. package/dist/types/models/IPolicyExecutionPointComponent.d.ts +5 -4
  9. package/dist/types/models/IPolicyInformationPointComponent.d.ts +19 -1
  10. package/dist/types/models/IPolicyInformationSource.d.ts +18 -0
  11. package/dist/types/models/IRightsManagementComponent.d.ts +10 -0
  12. package/dist/types/models/api/policyAdministrationPoint/IPepInterceptRequest.d.ts +22 -0
  13. package/dist/types/models/api/policyAdministrationPoint/IPepInterceptResponse.d.ts +9 -0
  14. package/docs/changelog.md +19 -0
  15. package/docs/reference/index.md +6 -1
  16. package/docs/reference/interfaces/IPepInterceptRequest.md +29 -0
  17. package/docs/reference/interfaces/IPepInterceptResponse.md +11 -0
  18. package/docs/reference/interfaces/IPolicyEnforcementPointComponent.md +4 -4
  19. package/docs/reference/interfaces/IPolicyExecutionAction.md +61 -0
  20. package/docs/reference/interfaces/IPolicyExecutionPointComponent.md +12 -18
  21. package/docs/reference/interfaces/IPolicyInformationPointComponent.md +60 -10
  22. package/docs/reference/interfaces/IPolicyInformationSource.md +55 -0
  23. package/docs/reference/interfaces/IRightsManagementComponent.md +52 -0
  24. package/docs/reference/variables/PolicyDecisionStage.md +1 -1
  25. package/docs/reference/variables/PolicyExecutionActionFactory.md +5 -0
  26. package/docs/reference/variables/PolicyInformationSourceFactory.md +5 -0
  27. package/package.json +1 -1
  28. package/dist/types/models/policyActionCallback.d.ts +0 -16
  29. package/docs/reference/type-aliases/PolicyActionCallback.md +0 -59
@@ -1,5 +1,23 @@
1
1
  'use strict';
2
2
 
3
+ var core = require('@twin.org/core');
4
+
5
+ // Copyright 2024 IOTA Stiftung.
6
+ // SPDX-License-Identifier: Apache-2.0.
7
+ /**
8
+ * Factory for creating policy execution actions.
9
+ */
10
+ // eslint-disable-next-line @typescript-eslint/naming-convention
11
+ const PolicyExecutionActionFactory = core.Factory.createFactory("policy-execution", true);
12
+
13
+ // Copyright 2024 IOTA Stiftung.
14
+ // SPDX-License-Identifier: Apache-2.0.
15
+ /**
16
+ * Factory for creating policy information sources.
17
+ */
18
+ // eslint-disable-next-line @typescript-eslint/naming-convention
19
+ const PolicyInformationSourceFactory = core.Factory.createFactory("policy-information", true);
20
+
3
21
  // Copyright 2024 IOTA Stiftung.
4
22
  // SPDX-License-Identifier: Apache-2.0.
5
23
  /**
@@ -18,3 +36,5 @@ const PolicyDecisionStage = {
18
36
  };
19
37
 
20
38
  exports.PolicyDecisionStage = PolicyDecisionStage;
39
+ exports.PolicyExecutionActionFactory = PolicyExecutionActionFactory;
40
+ exports.PolicyInformationSourceFactory = PolicyInformationSourceFactory;
@@ -1,3 +1,21 @@
1
+ import { Factory } from '@twin.org/core';
2
+
3
+ // Copyright 2024 IOTA Stiftung.
4
+ // SPDX-License-Identifier: Apache-2.0.
5
+ /**
6
+ * Factory for creating policy execution actions.
7
+ */
8
+ // eslint-disable-next-line @typescript-eslint/naming-convention
9
+ const PolicyExecutionActionFactory = Factory.createFactory("policy-execution", true);
10
+
11
+ // Copyright 2024 IOTA Stiftung.
12
+ // SPDX-License-Identifier: Apache-2.0.
13
+ /**
14
+ * Factory for creating policy information sources.
15
+ */
16
+ // eslint-disable-next-line @typescript-eslint/naming-convention
17
+ const PolicyInformationSourceFactory = Factory.createFactory("policy-information", true);
18
+
1
19
  // Copyright 2024 IOTA Stiftung.
2
20
  // SPDX-License-Identifier: Apache-2.0.
3
21
  /**
@@ -15,4 +33,4 @@ const PolicyDecisionStage = {
15
33
  After: "after"
16
34
  };
17
35
 
18
- export { PolicyDecisionStage };
36
+ export { PolicyDecisionStage, PolicyExecutionActionFactory, PolicyInformationSourceFactory };
@@ -0,0 +1,6 @@
1
+ import { Factory } from "@twin.org/core";
2
+ import type { IPolicyExecutionAction } from "../models/IPolicyExecutionAction";
3
+ /**
4
+ * Factory for creating policy execution actions.
5
+ */
6
+ export declare const PolicyExecutionActionFactory: Factory<IPolicyExecutionAction>;
@@ -0,0 +1,6 @@
1
+ import { Factory } from "@twin.org/core";
2
+ import type { IPolicyInformationSource } from "../models/IPolicyInformationSource";
3
+ /**
4
+ * Factory for creating policy information sources.
5
+ */
6
+ export declare const PolicyInformationSourceFactory: Factory<IPolicyInformationSource>;
@@ -1,3 +1,5 @@
1
+ export * from "./factories/policyExecutionActionFactory";
2
+ export * from "./factories/policyInformationSourceFactory";
1
3
  export * from "./models/api/policyAdministrationPoint/IPapCreateRequest";
2
4
  export * from "./models/api/policyAdministrationPoint/IPapQueryRequest";
3
5
  export * from "./models/api/policyAdministrationPoint/IPapQueryResponse";
@@ -5,12 +7,15 @@ export * from "./models/api/policyAdministrationPoint/IPapRemoveRequest";
5
7
  export * from "./models/api/policyAdministrationPoint/IPapRetrieveRequest";
6
8
  export * from "./models/api/policyAdministrationPoint/IPapRetrieveResponse";
7
9
  export * from "./models/api/policyAdministrationPoint/IPapUpdateRequest";
10
+ export * from "./models/api/policyAdministrationPoint/IPepInterceptRequest";
11
+ export * from "./models/api/policyAdministrationPoint/IPepInterceptResponse";
8
12
  export * from "./models/IPolicyAdministrationPointComponent";
9
13
  export * from "./models/IPolicyDecisionPointComponent";
10
14
  export * from "./models/IPolicyEnforcementPointComponent";
15
+ export * from "./models/IPolicyExecutionAction";
11
16
  export * from "./models/IPolicyExecutionPointComponent";
12
17
  export * from "./models/IPolicyInformationPointComponent";
18
+ export * from "./models/IPolicyInformationSource";
13
19
  export * from "./models/IPolicyManagementPointComponent";
14
20
  export * from "./models/IRightsManagementComponent";
15
- export * from "./models/policyActionCallback";
16
21
  export * from "./models/policyDecisionStage";
@@ -15,5 +15,5 @@ export interface IPolicyEnforcementPointComponent extends IComponent {
15
15
  * @param nodeIdentity The node identity to use in the decision making.
16
16
  * @returns The manipulated data with any policies applied.
17
17
  */
18
- intercept<T = unknown>(assetType: string, action: string, data: T | undefined, userIdentity: string, nodeIdentity: string): Promise<T | undefined>;
18
+ intercept<T = unknown>(assetType: string, action: string, data: T | undefined, userIdentity: string | undefined, nodeIdentity: string | undefined): Promise<T | undefined>;
19
19
  }
@@ -0,0 +1,19 @@
1
+ import type { IOdrlPolicy } from "@twin.org/standards-w3c-odrl";
2
+ import type { PolicyDecisionStage } from "./policyDecisionStage";
3
+ /**
4
+ * Interface for policy execution actions.
5
+ */
6
+ export interface IPolicyExecutionAction {
7
+ /**
8
+ * Execute function type for policy actions.
9
+ * @param assetType The type of asset being processed.
10
+ * @param action The action being performed on the asset.
11
+ * @param data The data to process.
12
+ * @param userIdentity The user identity to use in the decision making.
13
+ * @param nodeIdentity The node identity to use in the decision making.
14
+ * @param policies The policies that apply to the data.
15
+ * @param stage The stage of the policy decision.
16
+ * @returns A promise that resolves when the action is complete.
17
+ */
18
+ execute(assetType: string, action: string, data: unknown, userIdentity: string, nodeIdentity: string, policies: IOdrlPolicy[], stage: PolicyDecisionStage): Promise<void>;
19
+ }
@@ -1,6 +1,6 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
2
  import type { IOdrlPolicy } from "@twin.org/standards-w3c-odrl";
3
- import type { PolicyActionCallback } from "./policyActionCallback";
3
+ import type { IPolicyExecutionAction } from "./IPolicyExecutionAction";
4
4
  import type { PolicyDecisionStage } from "./policyDecisionStage";
5
5
  /**
6
6
  * Interface describing a Policy Execution Point (PXP) contract.
@@ -20,7 +20,7 @@ export interface IPolicyExecutionPointComponent extends IComponent {
20
20
  * @param policies The policies that apply to the data.
21
21
  * @returns Nothing.
22
22
  */
23
- executeActions<T = unknown>(stage: PolicyDecisionStage, assetType: string, action: string, data: T | undefined, userIdentity: string, nodeIdentity: string, policies: IOdrlPolicy[]): Promise<void>;
23
+ executeActions(stage: PolicyDecisionStage, assetType: string, action: string, data: unknown, userIdentity: string, nodeIdentity: string, policies: IOdrlPolicy[]): Promise<void>;
24
24
  /**
25
25
  * Register an action to be executed.
26
26
  * @param actionId The id of the action to register.
@@ -28,11 +28,12 @@ export interface IPolicyExecutionPointComponent extends IComponent {
28
28
  * @param action The action to execute.
29
29
  * @returns Nothing.
30
30
  */
31
- registerAction<T = unknown>(actionId: string, stage: PolicyDecisionStage, action: PolicyActionCallback<T>): Promise<void>;
31
+ registerAction(actionId: string, stage: PolicyDecisionStage, action: IPolicyExecutionAction): Promise<void>;
32
32
  /**
33
33
  * Unregister an action from the execution point.
34
34
  * @param actionId The id of the action to unregister.
35
+ * @param stage The stage at which the action was executed.
35
36
  * @returns Nothing.
36
37
  */
37
- unregisterAction(actionId: string): Promise<void>;
38
+ unregisterAction(actionId: string, stage: PolicyDecisionStage): Promise<void>;
38
39
  }
@@ -1,5 +1,7 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
2
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
3
+ import type { IOdrlPolicy } from "@twin.org/standards-w3c-odrl";
4
+ import type { IPolicyInformationSource } from "./IPolicyInformationSource";
3
5
  /**
4
6
  * Interface describing a Policy Information Point (PEP) contract.
5
7
  * Provides additional information to the Policy Decision Point (PDP) when
@@ -13,7 +15,23 @@ export interface IPolicyInformationPointComponent extends IComponent {
13
15
  * @param data The data to get any additional information for.
14
16
  * @param userIdentity The user identity to get additional information for.
15
17
  * @param nodeIdentity The node identity to get additional information for.
18
+ * @param policies The policies that apply to the data.
16
19
  * @returns Returns additional information based on the data and identities.
17
20
  */
18
- retrieve<T = unknown>(assetType: string, action: string, data: T | undefined, userIdentity: string, nodeIdentity: string): Promise<IJsonLdNodeObject[]>;
21
+ retrieve(assetType: string, action: string, data: unknown, userIdentity: string, nodeIdentity: string, policies: IOdrlPolicy[]): Promise<{
22
+ [source: string]: IJsonLdNodeObject[];
23
+ }>;
24
+ /**
25
+ * Register a source to use for retrieval.
26
+ * @param sourceId The id of the source to register.
27
+ * @param source The source to register.
28
+ * @returns Nothing.
29
+ */
30
+ registerSource(sourceId: string, source: IPolicyInformationSource): Promise<void>;
31
+ /**
32
+ * Unregister a source from the retrieval.
33
+ * @param sourceId The id of the source to unregister.
34
+ * @returns Nothing.
35
+ */
36
+ unregisterSource(sourceId: string): Promise<void>;
19
37
  }
@@ -0,0 +1,18 @@
1
+ import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import type { IOdrlPolicy } from "@twin.org/standards-w3c-odrl";
3
+ /**
4
+ * Interface for policy information sources.
5
+ */
6
+ export interface IPolicyInformationSource {
7
+ /**
8
+ * Retrieve information from the sources.
9
+ * @param assetType The type of asset being processed.
10
+ * @param action The action being performed on the asset.
11
+ * @param data The data to process.
12
+ * @param userIdentity The user identity to use in the decision making.
13
+ * @param nodeIdentity The node identity to use in the decision making.
14
+ * @param policies The policies that apply to the data.
15
+ * @returns The objects containing relevant information or undefined if nothing relevant is found.
16
+ */
17
+ retrieve(assetType: string, action: string, data: unknown, userIdentity: string, nodeIdentity: string, policies: IOdrlPolicy[]): Promise<IJsonLdNodeObject[] | undefined>;
18
+ }
@@ -41,4 +41,14 @@ export interface IRightsManagementComponent extends IComponent {
41
41
  cursor?: string;
42
42
  policies: IOdrlPolicy[];
43
43
  }>;
44
+ /**
45
+ * PEP: Process the data using Policy Decision Point (PDP) and return the manipulated data.
46
+ * @param assetType The type of asset being processed.
47
+ * @param action The action being performed on the asset.
48
+ * @param data The data to process.
49
+ * @param userIdentity The user identity to use in the decision making.
50
+ * @param nodeIdentity The node identity to use in the decision making.
51
+ * @returns The manipulated data with any policies applied.
52
+ */
53
+ pepIntercept<T = unknown>(assetType: string, action: string, data: T | undefined, userIdentity: string | undefined, nodeIdentity: string | undefined): Promise<T | undefined>;
44
54
  }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The request structure for intercepting a request and enforcing a policy.
3
+ */
4
+ export interface IPepInterceptRequest {
5
+ /**
6
+ * The body parameters of the request.
7
+ */
8
+ body: {
9
+ /**
10
+ * The type of the asset to enforce the policy on.
11
+ */
12
+ assetType: string;
13
+ /**
14
+ * The action to perform on the asset.
15
+ */
16
+ action: string;
17
+ /**
18
+ * The data to include in the request.
19
+ */
20
+ data: unknown;
21
+ };
22
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The response structure for intercepting a request and enforcing a policy.
3
+ */
4
+ export interface IPepInterceptResponse {
5
+ /**
6
+ * The manipulated data with any policies applied.
7
+ */
8
+ body: unknown;
9
+ }
package/docs/changelog.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @twin.org/rights-management-models - Changelog
2
2
 
3
+ ## [0.0.2-next.3](https://github.com/twinfoundation/rights-management/compare/rights-management-models-v0.0.2-next.2...rights-management-models-v0.0.2-next.3) (2025-08-29)
4
+
5
+
6
+ ### Features
7
+
8
+ * add policy information point ([#27](https://github.com/twinfoundation/rights-management/issues/27)) ([61a1cd1](https://github.com/twinfoundation/rights-management/commit/61a1cd18f0c2c4a847c0a30da70de6814c777e29))
9
+ * eslint migration to flat config ([23a0c08](https://github.com/twinfoundation/rights-management/commit/23a0c085e7fc2e522c8d85d325dc5844b9c3fd8e))
10
+ * policy execution point ([#26](https://github.com/twinfoundation/rights-management/issues/26)) ([d930f10](https://github.com/twinfoundation/rights-management/commit/d930f104006a0d815cdf222b87d11d749351fb84))
11
+ * switch execution callback to class/factory pattern ([60db8cf](https://github.com/twinfoundation/rights-management/commit/60db8cfa213d7d4432396b196442d592a5dab6a6))
12
+ * switch execution callback to class/factory pattern ([a6b5660](https://github.com/twinfoundation/rights-management/commit/a6b56602aad98652de06961c436c76d52bf42665))
13
+ * switch execution callback to class/factory pattern ([8294daf](https://github.com/twinfoundation/rights-management/commit/8294daf933b74a1f90f1a34f206b215e59d76810))
14
+
15
+ ## [0.0.2-next.2](https://github.com/twinfoundation/rights-management/compare/rights-management-models-v0.0.2-next.1...rights-management-models-v0.0.2-next.2) (2025-08-22)
16
+
17
+
18
+ ### Features
19
+
20
+ * add scaffold for other services ([de25f34](https://github.com/twinfoundation/rights-management/commit/de25f34c40fb65b6d73df98965ea4e368019da84))
21
+
3
22
  ## [0.0.2-next.1](https://github.com/twinfoundation/rights-management/compare/rights-management-models-v0.0.2-next.0...rights-management-models-v0.0.2-next.1) (2025-08-20)
4
23
 
5
24
 
@@ -5,8 +5,10 @@
5
5
  - [IPolicyAdministrationPointComponent](interfaces/IPolicyAdministrationPointComponent.md)
6
6
  - [IPolicyDecisionPointComponent](interfaces/IPolicyDecisionPointComponent.md)
7
7
  - [IPolicyEnforcementPointComponent](interfaces/IPolicyEnforcementPointComponent.md)
8
+ - [IPolicyExecutionAction](interfaces/IPolicyExecutionAction.md)
8
9
  - [IPolicyExecutionPointComponent](interfaces/IPolicyExecutionPointComponent.md)
9
10
  - [IPolicyInformationPointComponent](interfaces/IPolicyInformationPointComponent.md)
11
+ - [IPolicyInformationSource](interfaces/IPolicyInformationSource.md)
10
12
  - [IPolicyManagementPointComponent](interfaces/IPolicyManagementPointComponent.md)
11
13
  - [IRightsManagementComponent](interfaces/IRightsManagementComponent.md)
12
14
  - [IPapCreateRequest](interfaces/IPapCreateRequest.md)
@@ -16,12 +18,15 @@
16
18
  - [IPapRetrieveRequest](interfaces/IPapRetrieveRequest.md)
17
19
  - [IPapRetrieveResponse](interfaces/IPapRetrieveResponse.md)
18
20
  - [IPapUpdateRequest](interfaces/IPapUpdateRequest.md)
21
+ - [IPepInterceptRequest](interfaces/IPepInterceptRequest.md)
22
+ - [IPepInterceptResponse](interfaces/IPepInterceptResponse.md)
19
23
 
20
24
  ## Type Aliases
21
25
 
22
- - [PolicyActionCallback](type-aliases/PolicyActionCallback.md)
23
26
  - [PolicyDecisionStage](type-aliases/PolicyDecisionStage.md)
24
27
 
25
28
  ## Variables
26
29
 
30
+ - [PolicyExecutionActionFactory](variables/PolicyExecutionActionFactory.md)
31
+ - [PolicyInformationSourceFactory](variables/PolicyInformationSourceFactory.md)
27
32
  - [PolicyDecisionStage](variables/PolicyDecisionStage.md)
@@ -0,0 +1,29 @@
1
+ # Interface: IPepInterceptRequest
2
+
3
+ The request structure for intercepting a request and enforcing a policy.
4
+
5
+ ## Properties
6
+
7
+ ### body
8
+
9
+ > **body**: `object`
10
+
11
+ The body parameters of the request.
12
+
13
+ #### assetType
14
+
15
+ > **assetType**: `string`
16
+
17
+ The type of the asset to enforce the policy on.
18
+
19
+ #### action
20
+
21
+ > **action**: `string`
22
+
23
+ The action to perform on the asset.
24
+
25
+ #### data
26
+
27
+ > **data**: `unknown`
28
+
29
+ The data to include in the request.
@@ -0,0 +1,11 @@
1
+ # Interface: IPepInterceptResponse
2
+
3
+ The response structure for intercepting a request and enforcing a policy.
4
+
5
+ ## Properties
6
+
7
+ ### body
8
+
9
+ > **body**: `unknown`
10
+
11
+ The manipulated data with any policies applied.
@@ -45,16 +45,16 @@ The data to process.
45
45
 
46
46
  ##### userIdentity
47
47
 
48
- `string`
49
-
50
48
  The user identity to use in the decision making.
51
49
 
52
- ##### nodeIdentity
50
+ `undefined` | `string`
53
51
 
54
- `string`
52
+ ##### nodeIdentity
55
53
 
56
54
  The node identity to use in the decision making.
57
55
 
56
+ `undefined` | `string`
57
+
58
58
  #### Returns
59
59
 
60
60
  `Promise`\<`undefined` \| `T`\>
@@ -0,0 +1,61 @@
1
+ # Interface: IPolicyExecutionAction
2
+
3
+ Interface for policy execution actions.
4
+
5
+ ## Methods
6
+
7
+ ### execute()
8
+
9
+ > **execute**(`assetType`, `action`, `data`, `userIdentity`, `nodeIdentity`, `policies`, `stage`): `Promise`\<`void`\>
10
+
11
+ Execute function type for policy actions.
12
+
13
+ #### Parameters
14
+
15
+ ##### assetType
16
+
17
+ `string`
18
+
19
+ The type of asset being processed.
20
+
21
+ ##### action
22
+
23
+ `string`
24
+
25
+ The action being performed on the asset.
26
+
27
+ ##### data
28
+
29
+ `unknown`
30
+
31
+ The data to process.
32
+
33
+ ##### userIdentity
34
+
35
+ `string`
36
+
37
+ The user identity to use in the decision making.
38
+
39
+ ##### nodeIdentity
40
+
41
+ `string`
42
+
43
+ The node identity to use in the decision making.
44
+
45
+ ##### policies
46
+
47
+ `IOdrlPolicy`[]
48
+
49
+ The policies that apply to the data.
50
+
51
+ ##### stage
52
+
53
+ [`PolicyDecisionStage`](../type-aliases/PolicyDecisionStage.md)
54
+
55
+ The stage of the policy decision.
56
+
57
+ #### Returns
58
+
59
+ `Promise`\<`void`\>
60
+
61
+ A promise that resolves when the action is complete.
@@ -13,16 +13,10 @@ registered actions based on the decision.
13
13
 
14
14
  ### executeActions()
15
15
 
16
- > **executeActions**\<`T`\>(`stage`, `assetType`, `action`, `data`, `userIdentity`, `nodeIdentity`, `policies`): `Promise`\<`void`\>
16
+ > **executeActions**(`stage`, `assetType`, `action`, `data`, `userIdentity`, `nodeIdentity`, `policies`): `Promise`\<`void`\>
17
17
 
18
18
  Execute actions based on the PDP's decisions.
19
19
 
20
- #### Type Parameters
21
-
22
- ##### T
23
-
24
- `T` = `unknown`
25
-
26
20
  #### Parameters
27
21
 
28
22
  ##### stage
@@ -45,9 +39,9 @@ The action being performed on the asset.
45
39
 
46
40
  ##### data
47
41
 
48
- The data used in the decision by the PDP.
42
+ `unknown`
49
43
 
50
- `undefined` | `T`
44
+ The data used in the decision by the PDP.
51
45
 
52
46
  ##### userIdentity
53
47
 
@@ -77,16 +71,10 @@ Nothing.
77
71
 
78
72
  ### registerAction()
79
73
 
80
- > **registerAction**\<`T`\>(`actionId`, `stage`, `action`): `Promise`\<`void`\>
74
+ > **registerAction**(`actionId`, `stage`, `action`): `Promise`\<`void`\>
81
75
 
82
76
  Register an action to be executed.
83
77
 
84
- #### Type Parameters
85
-
86
- ##### T
87
-
88
- `T` = `unknown`
89
-
90
78
  #### Parameters
91
79
 
92
80
  ##### actionId
@@ -103,7 +91,7 @@ The stage at which the action should be executed.
103
91
 
104
92
  ##### action
105
93
 
106
- [`PolicyActionCallback`](../type-aliases/PolicyActionCallback.md)\<`T`\>
94
+ [`IPolicyExecutionAction`](IPolicyExecutionAction.md)
107
95
 
108
96
  The action to execute.
109
97
 
@@ -117,7 +105,7 @@ Nothing.
117
105
 
118
106
  ### unregisterAction()
119
107
 
120
- > **unregisterAction**(`actionId`): `Promise`\<`void`\>
108
+ > **unregisterAction**(`actionId`, `stage`): `Promise`\<`void`\>
121
109
 
122
110
  Unregister an action from the execution point.
123
111
 
@@ -129,6 +117,12 @@ Unregister an action from the execution point.
129
117
 
130
118
  The id of the action to unregister.
131
119
 
120
+ ##### stage
121
+
122
+ [`PolicyDecisionStage`](../type-aliases/PolicyDecisionStage.md)
123
+
124
+ The stage at which the action was executed.
125
+
132
126
  #### Returns
133
127
 
134
128
  `Promise`\<`void`\>
@@ -12,16 +12,10 @@ it is making decisions.
12
12
 
13
13
  ### retrieve()
14
14
 
15
- > **retrieve**\<`T`\>(`assetType`, `action`, `data`, `userIdentity`, `nodeIdentity`): `Promise`\<`IJsonLdNodeObject`[]\>
15
+ > **retrieve**(`assetType`, `action`, `data`, `userIdentity`, `nodeIdentity`, `policies`): `Promise`\<\{\[`source`: `string`\]: `IJsonLdNodeObject`[]; \}\>
16
16
 
17
17
  Retrieve additional information which is relevant in the PDP decision making.
18
18
 
19
- #### Type Parameters
20
-
21
- ##### T
22
-
23
- `T` = `unknown`
24
-
25
19
  #### Parameters
26
20
 
27
21
  ##### assetType
@@ -38,9 +32,9 @@ The action being performed on the asset.
38
32
 
39
33
  ##### data
40
34
 
41
- The data to get any additional information for.
35
+ `unknown`
42
36
 
43
- `undefined` | `T`
37
+ The data to get any additional information for.
44
38
 
45
39
  ##### userIdentity
46
40
 
@@ -54,8 +48,64 @@ The user identity to get additional information for.
54
48
 
55
49
  The node identity to get additional information for.
56
50
 
51
+ ##### policies
52
+
53
+ `IOdrlPolicy`[]
54
+
55
+ The policies that apply to the data.
56
+
57
57
  #### Returns
58
58
 
59
- `Promise`\<`IJsonLdNodeObject`[]\>
59
+ `Promise`\<\{\[`source`: `string`\]: `IJsonLdNodeObject`[]; \}\>
60
60
 
61
61
  Returns additional information based on the data and identities.
62
+
63
+ ***
64
+
65
+ ### registerSource()
66
+
67
+ > **registerSource**(`sourceId`, `source`): `Promise`\<`void`\>
68
+
69
+ Register a source to use for retrieval.
70
+
71
+ #### Parameters
72
+
73
+ ##### sourceId
74
+
75
+ `string`
76
+
77
+ The id of the source to register.
78
+
79
+ ##### source
80
+
81
+ [`IPolicyInformationSource`](IPolicyInformationSource.md)
82
+
83
+ The source to register.
84
+
85
+ #### Returns
86
+
87
+ `Promise`\<`void`\>
88
+
89
+ Nothing.
90
+
91
+ ***
92
+
93
+ ### unregisterSource()
94
+
95
+ > **unregisterSource**(`sourceId`): `Promise`\<`void`\>
96
+
97
+ Unregister a source from the retrieval.
98
+
99
+ #### Parameters
100
+
101
+ ##### sourceId
102
+
103
+ `string`
104
+
105
+ The id of the source to unregister.
106
+
107
+ #### Returns
108
+
109
+ `Promise`\<`void`\>
110
+
111
+ Nothing.
@@ -0,0 +1,55 @@
1
+ # Interface: IPolicyInformationSource
2
+
3
+ Interface for policy information sources.
4
+
5
+ ## Methods
6
+
7
+ ### retrieve()
8
+
9
+ > **retrieve**(`assetType`, `action`, `data`, `userIdentity`, `nodeIdentity`, `policies`): `Promise`\<`undefined` \| `IJsonLdNodeObject`[]\>
10
+
11
+ Retrieve information from the sources.
12
+
13
+ #### Parameters
14
+
15
+ ##### assetType
16
+
17
+ `string`
18
+
19
+ The type of asset being processed.
20
+
21
+ ##### action
22
+
23
+ `string`
24
+
25
+ The action being performed on the asset.
26
+
27
+ ##### data
28
+
29
+ `unknown`
30
+
31
+ The data to process.
32
+
33
+ ##### userIdentity
34
+
35
+ `string`
36
+
37
+ The user identity to use in the decision making.
38
+
39
+ ##### nodeIdentity
40
+
41
+ `string`
42
+
43
+ The node identity to use in the decision making.
44
+
45
+ ##### policies
46
+
47
+ `IOdrlPolicy`[]
48
+
49
+ The policies that apply to the data.
50
+
51
+ #### Returns
52
+
53
+ `Promise`\<`undefined` \| `IJsonLdNodeObject`[]\>
54
+
55
+ The objects containing relevant information or undefined if nothing relevant is found.
@@ -128,3 +128,55 @@ The number of results to return per page.
128
128
  `Promise`\<\{ `cursor?`: `string`; `policies`: `IOdrlPolicy`[]; \}\>
129
129
 
130
130
  Cursor for next page of results and the policies matching the query.
131
+
132
+ ***
133
+
134
+ ### pepIntercept()
135
+
136
+ > **pepIntercept**\<`T`\>(`assetType`, `action`, `data`, `userIdentity`, `nodeIdentity`): `Promise`\<`undefined` \| `T`\>
137
+
138
+ PEP: Process the data using Policy Decision Point (PDP) and return the manipulated data.
139
+
140
+ #### Type Parameters
141
+
142
+ ##### T
143
+
144
+ `T` = `unknown`
145
+
146
+ #### Parameters
147
+
148
+ ##### assetType
149
+
150
+ `string`
151
+
152
+ The type of asset being processed.
153
+
154
+ ##### action
155
+
156
+ `string`
157
+
158
+ The action being performed on the asset.
159
+
160
+ ##### data
161
+
162
+ The data to process.
163
+
164
+ `undefined` | `T`
165
+
166
+ ##### userIdentity
167
+
168
+ The user identity to use in the decision making.
169
+
170
+ `undefined` | `string`
171
+
172
+ ##### nodeIdentity
173
+
174
+ The node identity to use in the decision making.
175
+
176
+ `undefined` | `string`
177
+
178
+ #### Returns
179
+
180
+ `Promise`\<`undefined` \| `T`\>
181
+
182
+ The manipulated data with any policies applied.
@@ -4,7 +4,7 @@
4
4
 
5
5
  The stage at which a PXP is executed in the PDP.
6
6
 
7
- ## Type declaration
7
+ ## Type Declaration
8
8
 
9
9
  ### Before
10
10
 
@@ -0,0 +1,5 @@
1
+ # Variable: PolicyExecutionActionFactory
2
+
3
+ > `const` **PolicyExecutionActionFactory**: `Factory`\<[`IPolicyExecutionAction`](../interfaces/IPolicyExecutionAction.md)\>
4
+
5
+ Factory for creating policy execution actions.
@@ -0,0 +1,5 @@
1
+ # Variable: PolicyInformationSourceFactory
2
+
3
+ > `const` **PolicyInformationSourceFactory**: `Factory`\<[`IPolicyInformationSource`](../interfaces/IPolicyInformationSource.md)\>
4
+
5
+ Factory for creating policy information sources.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/rights-management-models",
3
- "version": "0.0.2-next.1",
3
+ "version": "0.0.2-next.3",
4
4
  "description": "Models which define the structure of the rights management connectors and services",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,16 +0,0 @@
1
- import type { IOdrlPolicy } from "@twin.org/standards-w3c-odrl";
2
- /**
3
- * Callback function type for policy actions.
4
- * This function is called when a policy action is executed.
5
- * It receives the asset type, action, data, user identity,
6
- * node identity, and the policies that apply to the data.
7
- * The function should return a promise that resolves when the action is complete.
8
- * @param assetType The type of asset being processed.
9
- * @param action The action being performed on the asset.
10
- * @param data The data to process.
11
- * @param userIdentity The user identity to use in the decision making.
12
- * @param nodeIdentity The node identity to use in the decision making.
13
- * @param policies The policies that apply to the data.
14
- * @returns A promise that resolves when the action is complete.
15
- */
16
- export type PolicyActionCallback<T = unknown> = (assetType: string, action: string, data: T | undefined, userIdentity: string, nodeIdentity: string, policies: IOdrlPolicy[]) => Promise<void>;
@@ -1,59 +0,0 @@
1
- # Type Alias: PolicyActionCallback()\<T\>
2
-
3
- > **PolicyActionCallback**\<`T`\> = (`assetType`, `action`, `data`, `userIdentity`, `nodeIdentity`, `policies`) => `Promise`\<`void`\>
4
-
5
- Callback function type for policy actions.
6
- This function is called when a policy action is executed.
7
- It receives the asset type, action, data, user identity,
8
- node identity, and the policies that apply to the data.
9
- The function should return a promise that resolves when the action is complete.
10
-
11
- ## Type Parameters
12
-
13
- ### T
14
-
15
- `T` = `unknown`
16
-
17
- ## Parameters
18
-
19
- ### assetType
20
-
21
- `string`
22
-
23
- The type of asset being processed.
24
-
25
- ### action
26
-
27
- `string`
28
-
29
- The action being performed on the asset.
30
-
31
- ### data
32
-
33
- The data to process.
34
-
35
- `T` | `undefined`
36
-
37
- ### userIdentity
38
-
39
- `string`
40
-
41
- The user identity to use in the decision making.
42
-
43
- ### nodeIdentity
44
-
45
- `string`
46
-
47
- The node identity to use in the decision making.
48
-
49
- ### policies
50
-
51
- `IOdrlPolicy`[]
52
-
53
- The policies that apply to the data.
54
-
55
- ## Returns
56
-
57
- `Promise`\<`void`\>
58
-
59
- A promise that resolves when the action is complete.