@twin.org/rights-management-models 0.0.1-next.8 → 0.0.1
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 +18 -0
- package/dist/esm/index.mjs +17 -0
- package/dist/types/index.d.ts +9 -8
- package/dist/types/models/IPolicyDecisionPointComponent.d.ts +1 -1
- package/dist/types/models/IPolicyExecutionPointComponent.d.ts +6 -3
- package/dist/types/models/api/policyAdministrationPoint/IPapQueryRequest.d.ts +1 -1
- package/dist/types/models/policyDecisionStage.d.ts +17 -0
- package/docs/changelog.md +45 -0
- package/docs/reference/index.md +5 -0
- package/docs/reference/interfaces/IPapQueryRequest.md +1 -1
- package/docs/reference/interfaces/IPolicyAdministrationPointComponent.md +2 -2
- package/docs/reference/interfaces/IPolicyDecisionPointComponent.md +1 -1
- package/docs/reference/interfaces/IPolicyExecutionPointComponent.md +15 -3
- package/docs/reference/interfaces/IRightsManagementComponent.md +2 -2
- package/docs/reference/type-aliases/PolicyDecisionStage.md +5 -0
- package/docs/reference/variables/PolicyDecisionStage.md +19 -0
- package/package.json +6 -6
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
// Copyright 2024 IOTA Stiftung.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
5
|
+
/**
|
|
6
|
+
* The stage at which a PXP is executed in the PDP.
|
|
7
|
+
*/
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9
|
+
const PolicyDecisionStage = {
|
|
10
|
+
/**
|
|
11
|
+
* Before Decision.
|
|
12
|
+
*/
|
|
13
|
+
Before: "before",
|
|
14
|
+
/**
|
|
15
|
+
* After Decision.
|
|
16
|
+
*/
|
|
17
|
+
After: "after"
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.PolicyDecisionStage = PolicyDecisionStage;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
/**
|
|
4
|
+
* The stage at which a PXP is executed in the PDP.
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
const PolicyDecisionStage = {
|
|
8
|
+
/**
|
|
9
|
+
* Before Decision.
|
|
10
|
+
*/
|
|
11
|
+
Before: "before",
|
|
12
|
+
/**
|
|
13
|
+
* After Decision.
|
|
14
|
+
*/
|
|
15
|
+
After: "after"
|
|
16
|
+
};
|
|
1
17
|
|
|
18
|
+
export { PolicyDecisionStage };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
export * from "./models/api/policyAdministrationPoint/IPapCreateRequest";
|
|
2
|
+
export * from "./models/api/policyAdministrationPoint/IPapQueryRequest";
|
|
3
|
+
export * from "./models/api/policyAdministrationPoint/IPapQueryResponse";
|
|
4
|
+
export * from "./models/api/policyAdministrationPoint/IPapRemoveRequest";
|
|
5
|
+
export * from "./models/api/policyAdministrationPoint/IPapRetrieveRequest";
|
|
6
|
+
export * from "./models/api/policyAdministrationPoint/IPapRetrieveResponse";
|
|
7
|
+
export * from "./models/api/policyAdministrationPoint/IPapUpdateRequest";
|
|
1
8
|
export * from "./models/IPolicyAdministrationPointComponent";
|
|
2
9
|
export * from "./models/IPolicyDecisionPointComponent";
|
|
3
10
|
export * from "./models/IPolicyEnforcementPointComponent";
|
|
4
11
|
export * from "./models/IPolicyExecutionPointComponent";
|
|
5
12
|
export * from "./models/IPolicyInformationPointComponent";
|
|
6
13
|
export * from "./models/IPolicyManagementPointComponent";
|
|
7
|
-
export * from "./models/policyActionCallback";
|
|
8
|
-
export * from "./models/api/policyAdministrationPoint/IPapCreateRequest";
|
|
9
|
-
export * from "./models/api/policyAdministrationPoint/IPapUpdateRequest";
|
|
10
|
-
export * from "./models/api/policyAdministrationPoint/IPapRetrieveRequest";
|
|
11
|
-
export * from "./models/api/policyAdministrationPoint/IPapRetrieveResponse";
|
|
12
|
-
export * from "./models/api/policyAdministrationPoint/IPapRemoveRequest";
|
|
13
|
-
export * from "./models/api/policyAdministrationPoint/IPapQueryRequest";
|
|
14
|
-
export * from "./models/api/policyAdministrationPoint/IPapQueryResponse";
|
|
15
14
|
export * from "./models/IRightsManagementComponent";
|
|
15
|
+
export * from "./models/policyActionCallback";
|
|
16
|
+
export * from "./models/policyDecisionStage";
|
|
@@ -12,7 +12,7 @@ export interface IPolicyDecisionPointComponent extends IComponent {
|
|
|
12
12
|
* Evaluate requests from a Policy Enforcement Point (PEP).
|
|
13
13
|
* Uses the Policy Management Point (PMP) to retrieve the policies and the
|
|
14
14
|
* Policy Information Point (PIP) to retrieve additional information.
|
|
15
|
-
* Executes any actions on the Policy Execution Point (
|
|
15
|
+
* Executes any actions on the Policy Execution Point (PXP) when the decision is made.
|
|
16
16
|
* @param assetType The type of asset being processed.
|
|
17
17
|
* @param action The action being performed on the asset.
|
|
18
18
|
* @param data The data to make a decision on.
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { IComponent } from "@twin.org/core";
|
|
2
2
|
import type { IOdrlPolicy } from "@twin.org/standards-w3c-odrl";
|
|
3
3
|
import type { PolicyActionCallback } from "./policyActionCallback";
|
|
4
|
+
import type { PolicyDecisionStage } from "./policyDecisionStage";
|
|
4
5
|
/**
|
|
5
6
|
* Interface describing a Policy Execution Point (PXP) contract.
|
|
6
7
|
* When a decision is made by the Policy Decision Point (PDP),
|
|
7
|
-
* the Policy Execution Point (
|
|
8
|
+
* the Policy Execution Point (PXP) will execute any
|
|
8
9
|
* registered actions based on the decision.
|
|
9
10
|
*/
|
|
10
11
|
export interface IPolicyExecutionPointComponent extends IComponent {
|
|
11
12
|
/**
|
|
12
13
|
* Execute actions based on the PDP's decisions.
|
|
14
|
+
* @param stage The stage at which the PXP is executed in the PDP.
|
|
13
15
|
* @param assetType The type of asset being processed.
|
|
14
16
|
* @param action The action being performed on the asset.
|
|
15
17
|
* @param data The data used in the decision by the PDP.
|
|
@@ -18,14 +20,15 @@ export interface IPolicyExecutionPointComponent extends IComponent {
|
|
|
18
20
|
* @param policies The policies that apply to the data.
|
|
19
21
|
* @returns Nothing.
|
|
20
22
|
*/
|
|
21
|
-
executeActions<T = unknown>(assetType: string, action: string, data: T | undefined, userIdentity: string, nodeIdentity: string, policies: IOdrlPolicy[]): Promise<void>;
|
|
23
|
+
executeActions<T = unknown>(stage: PolicyDecisionStage, assetType: string, action: string, data: T | undefined, userIdentity: string, nodeIdentity: string, policies: IOdrlPolicy[]): Promise<void>;
|
|
22
24
|
/**
|
|
23
25
|
* Register an action to be executed.
|
|
24
26
|
* @param actionId The id of the action to register.
|
|
27
|
+
* @param stage The stage at which the action should be executed.
|
|
25
28
|
* @param action The action to execute.
|
|
26
29
|
* @returns Nothing.
|
|
27
30
|
*/
|
|
28
|
-
registerAction<T = unknown>(actionId: string, action: PolicyActionCallback<T>): Promise<void>;
|
|
31
|
+
registerAction<T = unknown>(actionId: string, stage: PolicyDecisionStage, action: PolicyActionCallback<T>): Promise<void>;
|
|
29
32
|
/**
|
|
30
33
|
* Unregister an action from the execution point.
|
|
31
34
|
* @param actionId The id of the action to unregister.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stage at which a PXP is executed in the PDP.
|
|
3
|
+
*/
|
|
4
|
+
export declare const PolicyDecisionStage: {
|
|
5
|
+
/**
|
|
6
|
+
* Before Decision.
|
|
7
|
+
*/
|
|
8
|
+
readonly Before: "before";
|
|
9
|
+
/**
|
|
10
|
+
* After Decision.
|
|
11
|
+
*/
|
|
12
|
+
readonly After: "after";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The stage at which a PXP is executed in the PDP.
|
|
16
|
+
*/
|
|
17
|
+
export type PolicyDecisionStage = (typeof PolicyDecisionStage)[keyof typeof PolicyDecisionStage];
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# @twin.org/rights-management-models - Changelog
|
|
2
2
|
|
|
3
|
+
## 0.0.1 (2025-07-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* release to production ([947f85a](https://github.com/twinfoundation/rights-management/commit/947f85ab9e23c117135dba7008a75c2d85435259))
|
|
9
|
+
|
|
10
|
+
## [0.0.1-next.12](https://github.com/twinfoundation/rights-management/compare/rights-management-models-v0.0.1-next.11...rights-management-models-v0.0.1-next.12) (2025-06-26)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add policy decision stage ([b3eb5a9](https://github.com/twinfoundation/rights-management/commit/b3eb5a96f6270247d198b57c07deca4eeb5cc0bb))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* correct PXP naming in comments ([1cd9053](https://github.com/twinfoundation/rights-management/commit/1cd9053eaa1c56a53d3cc52e75ea4d242bbe2654))
|
|
21
|
+
|
|
22
|
+
## [0.0.1-next.11](https://github.com/twinfoundation/rights-management/compare/rights-management-models-v0.0.1-next.10...rights-management-models-v0.0.1-next.11) (2025-06-20)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* query params force coercion ([8590a0d](https://github.com/twinfoundation/rights-management/commit/8590a0da92584c04b67e73c448319f96f70c34a5))
|
|
28
|
+
|
|
29
|
+
## [0.0.1-next.10](https://github.com/twinfoundation/rights-management/compare/rights-management-models-v0.0.1-next.9...rights-management-models-v0.0.1-next.10) (2025-06-12)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* update dependencies ([dd0a553](https://github.com/twinfoundation/rights-management/commit/dd0a553020b0dc5c41fb6865a2e36bd26045b0b9))
|
|
35
|
+
|
|
36
|
+
## [0.0.1-next.9](https://github.com/twinfoundation/rights-management/compare/rights-management-models-v0.0.1-next.8...rights-management-models-v0.0.1-next.9) (2025-06-06)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Features
|
|
40
|
+
|
|
41
|
+
* add publish workflows ([9f4db27](https://github.com/twinfoundation/rights-management/commit/9f4db27cccc724a5061f944b29ed7ed5317c9bbf))
|
|
42
|
+
* pap create, update methods ([#13](https://github.com/twinfoundation/rights-management/issues/13)) ([edb6c9e](https://github.com/twinfoundation/rights-management/commit/edb6c9efcfda55ac96f7594253bf831b4f0e5993))
|
|
43
|
+
* rename pap entity storage to pap service ([38a2c14](https://github.com/twinfoundation/rights-management/commit/38a2c14d8f63a86e398820166c83437be5aca1b8))
|
|
44
|
+
* rights management pap ([#4](https://github.com/twinfoundation/rights-management/issues/4)) ([d1165a9](https://github.com/twinfoundation/rights-management/commit/d1165a92f57128731cfb308d977832e28cf33493))
|
|
45
|
+
* update models based on feedback ([1f11df3](https://github.com/twinfoundation/rights-management/commit/1f11df32bdae5e0a9119e3eee9346b970c5fd345))
|
|
46
|
+
* use shared store mechanism ([#2](https://github.com/twinfoundation/rights-management/issues/2)) ([21c086d](https://github.com/twinfoundation/rights-management/commit/21c086d7be3989858ee28bedb7a1e7b97d65b752))
|
|
47
|
+
|
|
3
48
|
## [0.0.1-next.8](https://github.com/twinfoundation/rights-management/compare/rights-management-models-v0.0.1-next.7...rights-management-models-v0.0.1-next.8) (2025-06-05)
|
|
4
49
|
|
|
5
50
|
|
package/docs/reference/index.md
CHANGED
|
@@ -98,7 +98,7 @@ Nothing.
|
|
|
98
98
|
|
|
99
99
|
### query()
|
|
100
100
|
|
|
101
|
-
> **query**(`conditions?`, `cursor?`, `pageSize?`): `Promise`\<\{ `cursor
|
|
101
|
+
> **query**(`conditions?`, `cursor?`, `pageSize?`): `Promise`\<\{ `cursor?`: `string`; `policies`: `IOdrlPolicy`[]; \}\>
|
|
102
102
|
|
|
103
103
|
Query the policies using the specified conditions.
|
|
104
104
|
|
|
@@ -124,6 +124,6 @@ The number of results to return per page.
|
|
|
124
124
|
|
|
125
125
|
#### Returns
|
|
126
126
|
|
|
127
|
-
`Promise`\<\{ `cursor
|
|
127
|
+
`Promise`\<\{ `cursor?`: `string`; `policies`: `IOdrlPolicy`[]; \}\>
|
|
128
128
|
|
|
129
129
|
Cursor for next page of results and the policies matching the query.
|
|
@@ -19,7 +19,7 @@ Point (PEP) will execute any registered actions.
|
|
|
19
19
|
Evaluate requests from a Policy Enforcement Point (PEP).
|
|
20
20
|
Uses the Policy Management Point (PMP) to retrieve the policies and the
|
|
21
21
|
Policy Information Point (PIP) to retrieve additional information.
|
|
22
|
-
Executes any actions on the Policy Execution Point (
|
|
22
|
+
Executes any actions on the Policy Execution Point (PXP) when the decision is made.
|
|
23
23
|
|
|
24
24
|
#### Type Parameters
|
|
25
25
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Interface describing a Policy Execution Point (PXP) contract.
|
|
4
4
|
When a decision is made by the Policy Decision Point (PDP),
|
|
5
|
-
the Policy Execution Point (
|
|
5
|
+
the Policy Execution Point (PXP) will execute any
|
|
6
6
|
registered actions based on the decision.
|
|
7
7
|
|
|
8
8
|
## Extends
|
|
@@ -13,7 +13,7 @@ registered actions based on the decision.
|
|
|
13
13
|
|
|
14
14
|
### executeActions()
|
|
15
15
|
|
|
16
|
-
> **executeActions**\<`T`\>(`assetType`, `action`, `data`, `userIdentity`, `nodeIdentity`, `policies`): `Promise`\<`void`\>
|
|
16
|
+
> **executeActions**\<`T`\>(`stage`, `assetType`, `action`, `data`, `userIdentity`, `nodeIdentity`, `policies`): `Promise`\<`void`\>
|
|
17
17
|
|
|
18
18
|
Execute actions based on the PDP's decisions.
|
|
19
19
|
|
|
@@ -25,6 +25,12 @@ Execute actions based on the PDP's decisions.
|
|
|
25
25
|
|
|
26
26
|
#### Parameters
|
|
27
27
|
|
|
28
|
+
##### stage
|
|
29
|
+
|
|
30
|
+
[`PolicyDecisionStage`](../type-aliases/PolicyDecisionStage.md)
|
|
31
|
+
|
|
32
|
+
The stage at which the PXP is executed in the PDP.
|
|
33
|
+
|
|
28
34
|
##### assetType
|
|
29
35
|
|
|
30
36
|
`string`
|
|
@@ -71,7 +77,7 @@ Nothing.
|
|
|
71
77
|
|
|
72
78
|
### registerAction()
|
|
73
79
|
|
|
74
|
-
> **registerAction**\<`T`\>(`actionId`, `action`): `Promise`\<`void`\>
|
|
80
|
+
> **registerAction**\<`T`\>(`actionId`, `stage`, `action`): `Promise`\<`void`\>
|
|
75
81
|
|
|
76
82
|
Register an action to be executed.
|
|
77
83
|
|
|
@@ -89,6 +95,12 @@ Register an action to be executed.
|
|
|
89
95
|
|
|
90
96
|
The id of the action to register.
|
|
91
97
|
|
|
98
|
+
##### stage
|
|
99
|
+
|
|
100
|
+
[`PolicyDecisionStage`](../type-aliases/PolicyDecisionStage.md)
|
|
101
|
+
|
|
102
|
+
The stage at which the action should be executed.
|
|
103
|
+
|
|
92
104
|
##### action
|
|
93
105
|
|
|
94
106
|
[`PolicyActionCallback`](../type-aliases/PolicyActionCallback.md)\<`T`\>
|
|
@@ -99,7 +99,7 @@ Nothing.
|
|
|
99
99
|
|
|
100
100
|
### papQuery()
|
|
101
101
|
|
|
102
|
-
> **papQuery**(`conditions?`, `cursor?`, `pageSize?`): `Promise`\<\{ `cursor
|
|
102
|
+
> **papQuery**(`conditions?`, `cursor?`, `pageSize?`): `Promise`\<\{ `cursor?`: `string`; `policies`: `IOdrlPolicy`[]; \}\>
|
|
103
103
|
|
|
104
104
|
PAP: Query the policies using the specified conditions.
|
|
105
105
|
|
|
@@ -125,6 +125,6 @@ The number of results to return per page.
|
|
|
125
125
|
|
|
126
126
|
#### Returns
|
|
127
127
|
|
|
128
|
-
`Promise`\<\{ `cursor
|
|
128
|
+
`Promise`\<\{ `cursor?`: `string`; `policies`: `IOdrlPolicy`[]; \}\>
|
|
129
129
|
|
|
130
130
|
Cursor for next page of results and the policies matching the query.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Variable: PolicyDecisionStage
|
|
2
|
+
|
|
3
|
+
> `const` **PolicyDecisionStage**: `object`
|
|
4
|
+
|
|
5
|
+
The stage at which a PXP is executed in the PDP.
|
|
6
|
+
|
|
7
|
+
## Type declaration
|
|
8
|
+
|
|
9
|
+
### Before
|
|
10
|
+
|
|
11
|
+
> `readonly` **Before**: `"before"` = `"before"`
|
|
12
|
+
|
|
13
|
+
Before Decision.
|
|
14
|
+
|
|
15
|
+
### After
|
|
16
|
+
|
|
17
|
+
> `readonly` **After**: `"after"` = `"after"`
|
|
18
|
+
|
|
19
|
+
After Decision.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/rights-management-models",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "Models which define the structure of the rights management connectors and services",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/core": "
|
|
18
|
-
"@twin.org/data-json-ld": "
|
|
19
|
-
"@twin.org/entity": "
|
|
20
|
-
"@twin.org/nameof": "
|
|
21
|
-
"@twin.org/standards-w3c-odrl": "
|
|
17
|
+
"@twin.org/core": "^0.0.1",
|
|
18
|
+
"@twin.org/data-json-ld": "^0.0.1",
|
|
19
|
+
"@twin.org/entity": "^0.0.1",
|
|
20
|
+
"@twin.org/nameof": "^0.0.1",
|
|
21
|
+
"@twin.org/standards-w3c-odrl": "^0.0.1"
|
|
22
22
|
},
|
|
23
23
|
"main": "./dist/cjs/index.cjs",
|
|
24
24
|
"module": "./dist/esm/index.mjs",
|