@twin.org/rights-management-models 0.0.1-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 (38) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +21 -0
  3. package/dist/cjs/index.cjs +2 -0
  4. package/dist/esm/index.mjs +1 -0
  5. package/dist/types/index.d.ts +14 -0
  6. package/dist/types/models/IPolicyAdministrationPointComponent.d.ts +53 -0
  7. package/dist/types/models/IPolicyDecisionPointComponent.d.ts +25 -0
  8. package/dist/types/models/IPolicyEnforcementPointComponent.d.ts +19 -0
  9. package/dist/types/models/IPolicyExecutionPointComponent.d.ts +35 -0
  10. package/dist/types/models/IPolicyInformationPointComponent.d.ts +19 -0
  11. package/dist/types/models/IPolicyManagementPointComponent.d.ts +18 -0
  12. package/dist/types/models/IRightsManagementComponent.d.ts +46 -0
  13. package/dist/types/models/api/policyAdministrationPoint/IPapQueryRequest.d.ts +22 -0
  14. package/dist/types/models/api/policyAdministrationPoint/IPapQueryResponse.d.ts +19 -0
  15. package/dist/types/models/api/policyAdministrationPoint/IPapRemoveRequest.d.ts +14 -0
  16. package/dist/types/models/api/policyAdministrationPoint/IPapRetrieveRequest.d.ts +14 -0
  17. package/dist/types/models/api/policyAdministrationPoint/IPapRetrieveResponse.d.ts +10 -0
  18. package/dist/types/models/api/policyAdministrationPoint/IPapStoreRequest.d.ts +15 -0
  19. package/dist/types/models/policyActionCallback.d.ts +16 -0
  20. package/docs/changelog.md +31 -0
  21. package/docs/examples.md +1 -0
  22. package/docs/reference/index.md +21 -0
  23. package/docs/reference/interfaces/IPapQueryRequest.md +29 -0
  24. package/docs/reference/interfaces/IPapQueryResponse.md +23 -0
  25. package/docs/reference/interfaces/IPapRemoveRequest.md +17 -0
  26. package/docs/reference/interfaces/IPapRetrieveRequest.md +17 -0
  27. package/docs/reference/interfaces/IPapRetrieveResponse.md +11 -0
  28. package/docs/reference/interfaces/IPapStoreRequest.md +17 -0
  29. package/docs/reference/interfaces/IPolicyAdministrationPointComponent.md +157 -0
  30. package/docs/reference/interfaces/IPolicyDecisionPointComponent.md +67 -0
  31. package/docs/reference/interfaces/IPolicyEnforcementPointComponent.md +62 -0
  32. package/docs/reference/interfaces/IPolicyExecutionPointComponent.md +124 -0
  33. package/docs/reference/interfaces/IPolicyInformationPointComponent.md +61 -0
  34. package/docs/reference/interfaces/IPolicyManagementPointComponent.md +60 -0
  35. package/docs/reference/interfaces/IRightsManagementComponent.md +156 -0
  36. package/docs/reference/type-aliases/PolicyActionCallback.md +59 -0
  37. package/locales/en.json +3 -0
  38. package/package.json +41 -0
@@ -0,0 +1,29 @@
1
+ # Interface: IPapQueryRequest
2
+
3
+ The request structure for querying policies.
4
+
5
+ ## Properties
6
+
7
+ ### query?
8
+
9
+ > `optional` **query**: `object`
10
+
11
+ The query parameters of the request.
12
+
13
+ #### conditions?
14
+
15
+ > `optional` **conditions**: `string`
16
+
17
+ The condition for the query.
18
+
19
+ #### pageSize?
20
+
21
+ > `optional` **pageSize**: `string`
22
+
23
+ The number of entries to return per page.
24
+
25
+ #### cursor?
26
+
27
+ > `optional` **cursor**: `string`
28
+
29
+ The cursor to get next chunk of data, returned in previous response.
@@ -0,0 +1,23 @@
1
+ # Interface: IPapQueryResponse
2
+
3
+ The response structure for querying policies.
4
+
5
+ ## Properties
6
+
7
+ ### body
8
+
9
+ > **body**: `object`
10
+
11
+ The body of the response.
12
+
13
+ #### cursor?
14
+
15
+ > `optional` **cursor**: `string`
16
+
17
+ The cursor for the next page of results, if there are more results available.
18
+
19
+ #### policies
20
+
21
+ > **policies**: `IOdrlPolicy`[]
22
+
23
+ The policies matching the query.
@@ -0,0 +1,17 @@
1
+ # Interface: IPapRemoveRequest
2
+
3
+ The request structure for removing a policy.
4
+
5
+ ## Properties
6
+
7
+ ### pathParams
8
+
9
+ > **pathParams**: `object`
10
+
11
+ The path parameters of the request.
12
+
13
+ #### id
14
+
15
+ > **id**: `string`
16
+
17
+ The ID of the policy to remove.
@@ -0,0 +1,17 @@
1
+ # Interface: IPapRetrieveRequest
2
+
3
+ The request structure for retrieving a policy.
4
+
5
+ ## Properties
6
+
7
+ ### pathParams
8
+
9
+ > **pathParams**: `object`
10
+
11
+ The path parameters of the request.
12
+
13
+ #### id
14
+
15
+ > **id**: `string`
16
+
17
+ The ID of the policy to retrieve.
@@ -0,0 +1,11 @@
1
+ # Interface: IPapRetrieveResponse
2
+
3
+ The response structure for retrieving a policy.
4
+
5
+ ## Properties
6
+
7
+ ### body
8
+
9
+ > **body**: `IOdrlPolicy`
10
+
11
+ The body of the response.
@@ -0,0 +1,17 @@
1
+ # Interface: IPapStoreRequest
2
+
3
+ The request structure for storing a policy.
4
+
5
+ ## Properties
6
+
7
+ ### body
8
+
9
+ > **body**: `object`
10
+
11
+ The body of the request.
12
+
13
+ #### policy
14
+
15
+ > **policy**: `IOdrlPolicy`
16
+
17
+ The policy to store.
@@ -0,0 +1,157 @@
1
+ # Interface: IPolicyAdministrationPointComponent
2
+
3
+ Interface describing a Policy Administration Point (PAP) contract.
4
+ Manages policies for the rights management, policies are also queried by the
5
+ Policy Management Point (PMP) when it handles requests from the Policy Decision Point (PDP).
6
+
7
+ ## Extends
8
+
9
+ - `IComponent`
10
+
11
+ ## Methods
12
+
13
+ ### store()
14
+
15
+ > **store**(`policy`, `userIdentity`, `nodeIdentity`): `Promise`\<`void`\>
16
+
17
+ Store a policy.
18
+
19
+ #### Parameters
20
+
21
+ ##### policy
22
+
23
+ `IOdrlPolicy`
24
+
25
+ The policy to store.
26
+
27
+ ##### userIdentity
28
+
29
+ The identity of the user performing the operation.
30
+
31
+ `undefined` | `string`
32
+
33
+ ##### nodeIdentity
34
+
35
+ `string`
36
+
37
+ The identity of the node the operation is performed on.
38
+
39
+ #### Returns
40
+
41
+ `Promise`\<`void`\>
42
+
43
+ Nothing.
44
+
45
+ ***
46
+
47
+ ### retrieve()
48
+
49
+ > **retrieve**(`policyId`, `userIdentity`, `nodeIdentity`): `Promise`\<`IOdrlPolicy`\>
50
+
51
+ Retrieve a policy.
52
+
53
+ #### Parameters
54
+
55
+ ##### policyId
56
+
57
+ `string`
58
+
59
+ The id of the policy to retrieve.
60
+
61
+ ##### userIdentity
62
+
63
+ The identity of the user performing the operation.
64
+
65
+ `undefined` | `string`
66
+
67
+ ##### nodeIdentity
68
+
69
+ `string`
70
+
71
+ The identity of the node the operation is performed on.
72
+
73
+ #### Returns
74
+
75
+ `Promise`\<`IOdrlPolicy`\>
76
+
77
+ The policy.
78
+
79
+ ***
80
+
81
+ ### remove()
82
+
83
+ > **remove**(`policyId`, `userIdentity`, `nodeIdentity`): `Promise`\<`void`\>
84
+
85
+ Remove a policy.
86
+
87
+ #### Parameters
88
+
89
+ ##### policyId
90
+
91
+ `string`
92
+
93
+ The id of the policy to remove.
94
+
95
+ ##### userIdentity
96
+
97
+ The identity of the user performing the operation.
98
+
99
+ `undefined` | `string`
100
+
101
+ ##### nodeIdentity
102
+
103
+ `string`
104
+
105
+ The identity of the node the operation is performed on.
106
+
107
+ #### Returns
108
+
109
+ `Promise`\<`void`\>
110
+
111
+ Nothing.
112
+
113
+ ***
114
+
115
+ ### query()
116
+
117
+ > **query**(`conditions?`, `cursor?`, `pageSize?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<\{ `cursor`: `string`; `policies`: `IOdrlPolicy`[]; \}\>
118
+
119
+ Query the policies using the specified conditions.
120
+
121
+ #### Parameters
122
+
123
+ ##### conditions?
124
+
125
+ `EntityCondition`\<`IOdrlPolicy`\>
126
+
127
+ The conditions to use for the query.
128
+
129
+ ##### cursor?
130
+
131
+ `string`
132
+
133
+ The cursor to use for pagination.
134
+
135
+ ##### pageSize?
136
+
137
+ `number`
138
+
139
+ The number of results to return per page.
140
+
141
+ ##### userIdentity?
142
+
143
+ `string`
144
+
145
+ The identity of the user performing the operation.
146
+
147
+ ##### nodeIdentity?
148
+
149
+ `string`
150
+
151
+ The identity of the node the operation is performed on.
152
+
153
+ #### Returns
154
+
155
+ `Promise`\<\{ `cursor`: `string`; `policies`: `IOdrlPolicy`[]; \}\>
156
+
157
+ Cursor for next page of results and the policies matching the query.
@@ -0,0 +1,67 @@
1
+ # Interface: IPolicyDecisionPointComponent
2
+
3
+ Interface describing a Policy Decision Point (PDP) contract.
4
+ Decides if a party can be granted access to a resource, will retrieve policies
5
+ from the Policy Management Point (PMP) and any additional information from the
6
+ Policy Information Point (PIP). When a decision is made, the Policy Execution
7
+ Point (PEP) will execute any registered actions.
8
+
9
+ ## Extends
10
+
11
+ - `IComponent`
12
+
13
+ ## Methods
14
+
15
+ ### evaluate()
16
+
17
+ > **evaluate**\<`T`\>(`assetType`, `action`, `data`, `userIdentity`, `nodeIdentity`): `Promise`\<`IOdrlPolicy`[]\>
18
+
19
+ Evaluate requests from a Policy Enforcement Point (PEP).
20
+ Uses the Policy Management Point (PMP) to retrieve the policies and the
21
+ Policy Information Point (PIP) to retrieve additional information.
22
+ Executes any actions on the Policy Execution Point (PEP) when the decision is made.
23
+
24
+ #### Type Parameters
25
+
26
+ ##### T
27
+
28
+ `T` = `unknown`
29
+
30
+ #### Parameters
31
+
32
+ ##### assetType
33
+
34
+ `string`
35
+
36
+ The type of asset being processed.
37
+
38
+ ##### action
39
+
40
+ `string`
41
+
42
+ The action being performed on the asset.
43
+
44
+ ##### data
45
+
46
+ The data to make a decision on.
47
+
48
+ `undefined` | `T`
49
+
50
+ ##### userIdentity
51
+
52
+ `string`
53
+
54
+ The user identity to use in the decision making.
55
+
56
+ ##### nodeIdentity
57
+
58
+ `string`
59
+
60
+ The node identity to use in the decision making.
61
+
62
+ #### Returns
63
+
64
+ `Promise`\<`IOdrlPolicy`[]\>
65
+
66
+ Returns the policy decisions which apply to the data so that the PEP
67
+ can manipulate the data accordingly.
@@ -0,0 +1,62 @@
1
+ # Interface: IPolicyEnforcementPointComponent
2
+
3
+ Interface describing a Policy Enforcement Point (PEP) contract.
4
+ Intercepts data and uses the Policy Decision Point (PDP) to make decisions on
5
+ access to a resource, based on the decision a manipulated data object can
6
+ be returned.
7
+
8
+ ## Extends
9
+
10
+ - `IComponent`
11
+
12
+ ## Methods
13
+
14
+ ### intercept()
15
+
16
+ > **intercept**\<`T`\>(`assetType`, `action`, `data`, `userIdentity`, `nodeIdentity`): `Promise`\<`undefined` \| `T`\>
17
+
18
+ Process the data using Policy Decision Point (PDP) and return the manipulated data.
19
+
20
+ #### Type Parameters
21
+
22
+ ##### T
23
+
24
+ `T` = `unknown`
25
+
26
+ #### Parameters
27
+
28
+ ##### assetType
29
+
30
+ `string`
31
+
32
+ The type of asset being processed.
33
+
34
+ ##### action
35
+
36
+ `string`
37
+
38
+ The action being performed on the asset.
39
+
40
+ ##### data
41
+
42
+ The data to process.
43
+
44
+ `undefined` | `T`
45
+
46
+ ##### userIdentity
47
+
48
+ `string`
49
+
50
+ The user identity to use in the decision making.
51
+
52
+ ##### nodeIdentity
53
+
54
+ `string`
55
+
56
+ The node identity to use in the decision making.
57
+
58
+ #### Returns
59
+
60
+ `Promise`\<`undefined` \| `T`\>
61
+
62
+ The manipulated data with any policies applied.
@@ -0,0 +1,124 @@
1
+ # Interface: IPolicyExecutionPointComponent
2
+
3
+ Interface describing a Policy Execution Point (PXP) contract.
4
+ When a decision is made by the Policy Decision Point (PDP),
5
+ the Policy Execution Point (PEP) will execute any
6
+ registered actions based on the decision.
7
+
8
+ ## Extends
9
+
10
+ - `IComponent`
11
+
12
+ ## Methods
13
+
14
+ ### executeActions()
15
+
16
+ > **executeActions**\<`T`\>(`assetType`, `action`, `data`, `userIdentity`, `nodeIdentity`, `policies`): `Promise`\<`void`\>
17
+
18
+ Execute actions based on the PDP's decisions.
19
+
20
+ #### Type Parameters
21
+
22
+ ##### T
23
+
24
+ `T` = `unknown`
25
+
26
+ #### Parameters
27
+
28
+ ##### assetType
29
+
30
+ `string`
31
+
32
+ The type of asset being processed.
33
+
34
+ ##### action
35
+
36
+ `string`
37
+
38
+ The action being performed on the asset.
39
+
40
+ ##### data
41
+
42
+ The data used in the decision by the PDP.
43
+
44
+ `undefined` | `T`
45
+
46
+ ##### userIdentity
47
+
48
+ `string`
49
+
50
+ The user identity to use in the decision making.
51
+
52
+ ##### nodeIdentity
53
+
54
+ `string`
55
+
56
+ The node identity to use in the decision making.
57
+
58
+ ##### policies
59
+
60
+ `IOdrlPolicy`[]
61
+
62
+ The policies that apply to the data.
63
+
64
+ #### Returns
65
+
66
+ `Promise`\<`void`\>
67
+
68
+ Nothing.
69
+
70
+ ***
71
+
72
+ ### registerAction()
73
+
74
+ > **registerAction**\<`T`\>(`actionId`, `action`): `Promise`\<`void`\>
75
+
76
+ Register an action to be executed.
77
+
78
+ #### Type Parameters
79
+
80
+ ##### T
81
+
82
+ `T` = `unknown`
83
+
84
+ #### Parameters
85
+
86
+ ##### actionId
87
+
88
+ `string`
89
+
90
+ The id of the action to register.
91
+
92
+ ##### action
93
+
94
+ [`PolicyActionCallback`](../type-aliases/PolicyActionCallback.md)\<`T`\>
95
+
96
+ The action to execute.
97
+
98
+ #### Returns
99
+
100
+ `Promise`\<`void`\>
101
+
102
+ Nothing.
103
+
104
+ ***
105
+
106
+ ### unregisterAction()
107
+
108
+ > **unregisterAction**(`actionId`): `Promise`\<`void`\>
109
+
110
+ Unregister an action from the execution point.
111
+
112
+ #### Parameters
113
+
114
+ ##### actionId
115
+
116
+ `string`
117
+
118
+ The id of the action to unregister.
119
+
120
+ #### Returns
121
+
122
+ `Promise`\<`void`\>
123
+
124
+ Nothing.
@@ -0,0 +1,61 @@
1
+ # Interface: IPolicyInformationPointComponent
2
+
3
+ Interface describing a Policy Information Point (PEP) contract.
4
+ Provides additional information to the Policy Decision Point (PDP) when
5
+ it is making decisions.
6
+
7
+ ## Extends
8
+
9
+ - `IComponent`
10
+
11
+ ## Methods
12
+
13
+ ### retrieve()
14
+
15
+ > **retrieve**\<`T`\>(`assetType`, `action`, `data`, `userIdentity`, `nodeIdentity`): `Promise`\<`IJsonLdNodeObject`[]\>
16
+
17
+ Retrieve additional information which is relevant in the PDP decision making.
18
+
19
+ #### Type Parameters
20
+
21
+ ##### T
22
+
23
+ `T` = `unknown`
24
+
25
+ #### Parameters
26
+
27
+ ##### assetType
28
+
29
+ `string`
30
+
31
+ The type of asset being processed.
32
+
33
+ ##### action
34
+
35
+ `string`
36
+
37
+ The action being performed on the asset.
38
+
39
+ ##### data
40
+
41
+ The data to get any additional information for.
42
+
43
+ `undefined` | `T`
44
+
45
+ ##### userIdentity
46
+
47
+ `string`
48
+
49
+ The user identity to get additional information for.
50
+
51
+ ##### nodeIdentity
52
+
53
+ `string`
54
+
55
+ The node identity to get additional information for.
56
+
57
+ #### Returns
58
+
59
+ `Promise`\<`IJsonLdNodeObject`[]\>
60
+
61
+ Returns additional information based on the data and identities.
@@ -0,0 +1,60 @@
1
+ # Interface: IPolicyManagementPointComponent
2
+
3
+ Interface describing a Policy Management Point (PMP) contract.
4
+ Provide the policies to the Policy Decision Point (PDP) based on the data and identities.
5
+
6
+ ## Extends
7
+
8
+ - `IComponent`
9
+
10
+ ## Methods
11
+
12
+ ### retrieve()
13
+
14
+ > **retrieve**\<`T`\>(`assetType`, `action`, `data`, `userIdentity`, `nodeIdentity`): `Promise`\<`IOdrlPolicy`[]\>
15
+
16
+ Get the policies from a PAP based on the data and identities.
17
+
18
+ #### Type Parameters
19
+
20
+ ##### T
21
+
22
+ `T` = `unknown`
23
+
24
+ #### Parameters
25
+
26
+ ##### assetType
27
+
28
+ `string`
29
+
30
+ The type of asset being processed.
31
+
32
+ ##### action
33
+
34
+ `string`
35
+
36
+ The action being performed on the asset.
37
+
38
+ ##### data
39
+
40
+ The data to retrieve the policies for.
41
+
42
+ `undefined` | `T`
43
+
44
+ ##### userIdentity
45
+
46
+ `string`
47
+
48
+ The user identity to retrieve the policies for.
49
+
50
+ ##### nodeIdentity
51
+
52
+ `string`
53
+
54
+ The node identity to retrieve the policies for.
55
+
56
+ #### Returns
57
+
58
+ `Promise`\<`IOdrlPolicy`[]\>
59
+
60
+ Returns the policies which apply to the data and identities so that the PDP can make a decision.