@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.
- package/LICENSE +201 -0
- package/README.md +21 -0
- package/dist/cjs/index.cjs +2 -0
- package/dist/esm/index.mjs +1 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/models/IPolicyAdministrationPointComponent.d.ts +53 -0
- package/dist/types/models/IPolicyDecisionPointComponent.d.ts +25 -0
- package/dist/types/models/IPolicyEnforcementPointComponent.d.ts +19 -0
- package/dist/types/models/IPolicyExecutionPointComponent.d.ts +35 -0
- package/dist/types/models/IPolicyInformationPointComponent.d.ts +19 -0
- package/dist/types/models/IPolicyManagementPointComponent.d.ts +18 -0
- package/dist/types/models/IRightsManagementComponent.d.ts +46 -0
- package/dist/types/models/api/policyAdministrationPoint/IPapQueryRequest.d.ts +22 -0
- package/dist/types/models/api/policyAdministrationPoint/IPapQueryResponse.d.ts +19 -0
- package/dist/types/models/api/policyAdministrationPoint/IPapRemoveRequest.d.ts +14 -0
- package/dist/types/models/api/policyAdministrationPoint/IPapRetrieveRequest.d.ts +14 -0
- package/dist/types/models/api/policyAdministrationPoint/IPapRetrieveResponse.d.ts +10 -0
- package/dist/types/models/api/policyAdministrationPoint/IPapStoreRequest.d.ts +15 -0
- package/dist/types/models/policyActionCallback.d.ts +16 -0
- package/docs/changelog.md +31 -0
- package/docs/examples.md +1 -0
- package/docs/reference/index.md +21 -0
- package/docs/reference/interfaces/IPapQueryRequest.md +29 -0
- package/docs/reference/interfaces/IPapQueryResponse.md +23 -0
- package/docs/reference/interfaces/IPapRemoveRequest.md +17 -0
- package/docs/reference/interfaces/IPapRetrieveRequest.md +17 -0
- package/docs/reference/interfaces/IPapRetrieveResponse.md +11 -0
- package/docs/reference/interfaces/IPapStoreRequest.md +17 -0
- package/docs/reference/interfaces/IPolicyAdministrationPointComponent.md +157 -0
- package/docs/reference/interfaces/IPolicyDecisionPointComponent.md +67 -0
- package/docs/reference/interfaces/IPolicyEnforcementPointComponent.md +62 -0
- package/docs/reference/interfaces/IPolicyExecutionPointComponent.md +124 -0
- package/docs/reference/interfaces/IPolicyInformationPointComponent.md +61 -0
- package/docs/reference/interfaces/IPolicyManagementPointComponent.md +60 -0
- package/docs/reference/interfaces/IRightsManagementComponent.md +156 -0
- package/docs/reference/type-aliases/PolicyActionCallback.md +59 -0
- package/locales/en.json +3 -0
- package/package.json +41 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Interface: IRightsManagementComponent
|
|
2
|
+
|
|
3
|
+
Interface describing a unified Rights Management Component.
|
|
4
|
+
This serves as a single point of entry for all rights management operations.
|
|
5
|
+
|
|
6
|
+
## Extends
|
|
7
|
+
|
|
8
|
+
- `IComponent`
|
|
9
|
+
|
|
10
|
+
## Methods
|
|
11
|
+
|
|
12
|
+
### papStore()
|
|
13
|
+
|
|
14
|
+
> **papStore**(`policy`, `userIdentity`, `nodeIdentity`): `Promise`\<`void`\>
|
|
15
|
+
|
|
16
|
+
PAP: Store a policy.
|
|
17
|
+
|
|
18
|
+
#### Parameters
|
|
19
|
+
|
|
20
|
+
##### policy
|
|
21
|
+
|
|
22
|
+
`IOdrlPolicy`
|
|
23
|
+
|
|
24
|
+
The policy to store.
|
|
25
|
+
|
|
26
|
+
##### userIdentity
|
|
27
|
+
|
|
28
|
+
The identity of the user performing the operation.
|
|
29
|
+
|
|
30
|
+
`undefined` | `string`
|
|
31
|
+
|
|
32
|
+
##### nodeIdentity
|
|
33
|
+
|
|
34
|
+
`string`
|
|
35
|
+
|
|
36
|
+
The identity of the node the operation is performed on.
|
|
37
|
+
|
|
38
|
+
#### Returns
|
|
39
|
+
|
|
40
|
+
`Promise`\<`void`\>
|
|
41
|
+
|
|
42
|
+
Nothing.
|
|
43
|
+
|
|
44
|
+
***
|
|
45
|
+
|
|
46
|
+
### papRetrieve()
|
|
47
|
+
|
|
48
|
+
> **papRetrieve**(`policyId`, `userIdentity`, `nodeIdentity`): `Promise`\<`IOdrlPolicy`\>
|
|
49
|
+
|
|
50
|
+
PAP: Retrieve a policy.
|
|
51
|
+
|
|
52
|
+
#### Parameters
|
|
53
|
+
|
|
54
|
+
##### policyId
|
|
55
|
+
|
|
56
|
+
`string`
|
|
57
|
+
|
|
58
|
+
The id of the policy to retrieve.
|
|
59
|
+
|
|
60
|
+
##### userIdentity
|
|
61
|
+
|
|
62
|
+
The identity of the user performing the operation.
|
|
63
|
+
|
|
64
|
+
`undefined` | `string`
|
|
65
|
+
|
|
66
|
+
##### nodeIdentity
|
|
67
|
+
|
|
68
|
+
`string`
|
|
69
|
+
|
|
70
|
+
The identity of the node the operation is performed on.
|
|
71
|
+
|
|
72
|
+
#### Returns
|
|
73
|
+
|
|
74
|
+
`Promise`\<`IOdrlPolicy`\>
|
|
75
|
+
|
|
76
|
+
The policy.
|
|
77
|
+
|
|
78
|
+
***
|
|
79
|
+
|
|
80
|
+
### papRemove()
|
|
81
|
+
|
|
82
|
+
> **papRemove**(`policyId`, `userIdentity`, `nodeIdentity`): `Promise`\<`void`\>
|
|
83
|
+
|
|
84
|
+
PAP: Remove a policy.
|
|
85
|
+
|
|
86
|
+
#### Parameters
|
|
87
|
+
|
|
88
|
+
##### policyId
|
|
89
|
+
|
|
90
|
+
`string`
|
|
91
|
+
|
|
92
|
+
The id of the policy to remove.
|
|
93
|
+
|
|
94
|
+
##### userIdentity
|
|
95
|
+
|
|
96
|
+
The identity of the user performing the operation.
|
|
97
|
+
|
|
98
|
+
`undefined` | `string`
|
|
99
|
+
|
|
100
|
+
##### nodeIdentity
|
|
101
|
+
|
|
102
|
+
`string`
|
|
103
|
+
|
|
104
|
+
The identity of the node the operation is performed on.
|
|
105
|
+
|
|
106
|
+
#### Returns
|
|
107
|
+
|
|
108
|
+
`Promise`\<`void`\>
|
|
109
|
+
|
|
110
|
+
Nothing.
|
|
111
|
+
|
|
112
|
+
***
|
|
113
|
+
|
|
114
|
+
### papQuery()
|
|
115
|
+
|
|
116
|
+
> **papQuery**(`conditions?`, `cursor?`, `pageSize?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<\{ `cursor`: `string`; `policies`: `IOdrlPolicy`[]; \}\>
|
|
117
|
+
|
|
118
|
+
PAP: Query the policies using the specified conditions.
|
|
119
|
+
|
|
120
|
+
#### Parameters
|
|
121
|
+
|
|
122
|
+
##### conditions?
|
|
123
|
+
|
|
124
|
+
`EntityCondition`\<`IOdrlPolicy`\>
|
|
125
|
+
|
|
126
|
+
The conditions to use for the query.
|
|
127
|
+
|
|
128
|
+
##### cursor?
|
|
129
|
+
|
|
130
|
+
`string`
|
|
131
|
+
|
|
132
|
+
The cursor to use for pagination.
|
|
133
|
+
|
|
134
|
+
##### pageSize?
|
|
135
|
+
|
|
136
|
+
`number`
|
|
137
|
+
|
|
138
|
+
The number of results to return per page.
|
|
139
|
+
|
|
140
|
+
##### userIdentity?
|
|
141
|
+
|
|
142
|
+
`string`
|
|
143
|
+
|
|
144
|
+
The identity of the user performing the operation.
|
|
145
|
+
|
|
146
|
+
##### nodeIdentity?
|
|
147
|
+
|
|
148
|
+
`string`
|
|
149
|
+
|
|
150
|
+
The identity of the node the operation is performed on.
|
|
151
|
+
|
|
152
|
+
#### Returns
|
|
153
|
+
|
|
154
|
+
`Promise`\<\{ `cursor`: `string`; `policies`: `IOdrlPolicy`[]; \}\>
|
|
155
|
+
|
|
156
|
+
Cursor for next page of results and the policies matching the query.
|
|
@@ -0,0 +1,59 @@
|
|
|
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.
|
package/locales/en.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@twin.org/rights-management-models",
|
|
3
|
+
"version": "0.0.1-next.3",
|
|
4
|
+
"description": "Models which define the structure of the rights management connectors and services",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/twinfoundation/rights-management.git",
|
|
8
|
+
"directory": "packages/rights-management-models"
|
|
9
|
+
},
|
|
10
|
+
"author": "martyn.janes@iota.org",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20.0.0"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@twin.org/core": "next",
|
|
18
|
+
"@twin.org/data-json-ld": "next",
|
|
19
|
+
"@twin.org/entity": "next",
|
|
20
|
+
"@twin.org/nameof": "next",
|
|
21
|
+
"@twin.org/standards-w3c-odrl": "next"
|
|
22
|
+
},
|
|
23
|
+
"main": "./dist/cjs/index.cjs",
|
|
24
|
+
"module": "./dist/esm/index.mjs",
|
|
25
|
+
"types": "./dist/types/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/types/index.d.ts",
|
|
29
|
+
"require": "./dist/cjs/index.cjs",
|
|
30
|
+
"import": "./dist/esm/index.mjs"
|
|
31
|
+
},
|
|
32
|
+
"./locales/*.json": "./locales/*.json"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist/cjs",
|
|
36
|
+
"dist/esm",
|
|
37
|
+
"dist/types",
|
|
38
|
+
"locales",
|
|
39
|
+
"docs"
|
|
40
|
+
]
|
|
41
|
+
}
|