@twin.org/rights-management-models 0.0.2-next.2 → 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.
@@ -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";
@@ -10,9 +12,10 @@ export * from "./models/api/policyAdministrationPoint/IPepInterceptResponse";
10
12
  export * from "./models/IPolicyAdministrationPointComponent";
11
13
  export * from "./models/IPolicyDecisionPointComponent";
12
14
  export * from "./models/IPolicyEnforcementPointComponent";
15
+ export * from "./models/IPolicyExecutionAction";
13
16
  export * from "./models/IPolicyExecutionPointComponent";
14
17
  export * from "./models/IPolicyInformationPointComponent";
18
+ export * from "./models/IPolicyInformationSource";
15
19
  export * from "./models/IPolicyManagementPointComponent";
16
20
  export * from "./models/IRightsManagementComponent";
17
- export * from "./models/policyActionCallback";
18
21
  export * from "./models/policyDecisionStage";
@@ -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
+ }
package/docs/changelog.md CHANGED
@@ -1,5 +1,17 @@
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
+
3
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)
4
16
 
5
17
 
@@ -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)
@@ -21,9 +23,10 @@
21
23
 
22
24
  ## Type Aliases
23
25
 
24
- - [PolicyActionCallback](type-aliases/PolicyActionCallback.md)
25
26
  - [PolicyDecisionStage](type-aliases/PolicyDecisionStage.md)
26
27
 
27
28
  ## Variables
28
29
 
30
+ - [PolicyExecutionActionFactory](variables/PolicyExecutionActionFactory.md)
31
+ - [PolicyInformationSourceFactory](variables/PolicyInformationSourceFactory.md)
29
32
  - [PolicyDecisionStage](variables/PolicyDecisionStage.md)
@@ -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.
@@ -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.2",
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.