@twin.org/rights-management-service 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 +429 -0
- package/dist/esm/index.mjs +420 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/models/IRightsManagementServiceConfig.d.ts +25 -0
- package/dist/types/models/IRightsManagementServiceConstructorOptions.d.ts +10 -0
- package/dist/types/restEntryPoints.d.ts +5 -0
- package/dist/types/rightsManagementRoutes.d.ts +45 -0
- package/dist/types/rightsManagementService.d.ts +60 -0
- package/docs/changelog.md +20 -0
- package/docs/examples.md +1 -0
- package/docs/open-api/spec.json +3984 -0
- package/docs/reference/classes/RightsManagementService.md +212 -0
- package/docs/reference/functions/generateRestRoutes.md +25 -0
- package/docs/reference/functions/papQuery.md +31 -0
- package/docs/reference/functions/papRemove.md +31 -0
- package/docs/reference/functions/papRetrieve.md +31 -0
- package/docs/reference/functions/papStore.md +31 -0
- package/docs/reference/index.md +23 -0
- package/docs/reference/interfaces/IRightsManagementServiceConfig.md +43 -0
- package/docs/reference/interfaces/IRightsManagementServiceConstructorOptions.md +11 -0
- package/docs/reference/variables/restEntryPoints.md +5 -0
- package/docs/reference/variables/tags.md +5 -0
- package/locales/en.json +10 -0
- package/package.json +45 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Class: RightsManagementService
|
|
2
|
+
|
|
3
|
+
Service for performing Rights Management operations.
|
|
4
|
+
This is a unified service that provides access to all Rights Management components.
|
|
5
|
+
|
|
6
|
+
## Implements
|
|
7
|
+
|
|
8
|
+
- `IRightsManagementComponent`
|
|
9
|
+
|
|
10
|
+
## Constructors
|
|
11
|
+
|
|
12
|
+
### Constructor
|
|
13
|
+
|
|
14
|
+
> **new RightsManagementService**(`options?`): `RightsManagementService`
|
|
15
|
+
|
|
16
|
+
Create a new instance of RightsManagementService.
|
|
17
|
+
|
|
18
|
+
#### Parameters
|
|
19
|
+
|
|
20
|
+
##### options?
|
|
21
|
+
|
|
22
|
+
[`IRightsManagementServiceConstructorOptions`](../interfaces/IRightsManagementServiceConstructorOptions.md)
|
|
23
|
+
|
|
24
|
+
The options for the service.
|
|
25
|
+
|
|
26
|
+
#### Returns
|
|
27
|
+
|
|
28
|
+
`RightsManagementService`
|
|
29
|
+
|
|
30
|
+
## Properties
|
|
31
|
+
|
|
32
|
+
### NAMESPACE
|
|
33
|
+
|
|
34
|
+
> `readonly` `static` **NAMESPACE**: `string` = `"rights-management"`
|
|
35
|
+
|
|
36
|
+
The namespace supported by the Rights Management service.
|
|
37
|
+
|
|
38
|
+
***
|
|
39
|
+
|
|
40
|
+
### CLASS\_NAME
|
|
41
|
+
|
|
42
|
+
> `readonly` **CLASS\_NAME**: `string`
|
|
43
|
+
|
|
44
|
+
Runtime name for the class.
|
|
45
|
+
|
|
46
|
+
#### Implementation of
|
|
47
|
+
|
|
48
|
+
`IRightsManagementComponent.CLASS_NAME`
|
|
49
|
+
|
|
50
|
+
## Methods
|
|
51
|
+
|
|
52
|
+
### papStore()
|
|
53
|
+
|
|
54
|
+
> **papStore**(`policy`, `userIdentity`, `nodeIdentity`): `Promise`\<`void`\>
|
|
55
|
+
|
|
56
|
+
PAP: Store a policy.
|
|
57
|
+
|
|
58
|
+
#### Parameters
|
|
59
|
+
|
|
60
|
+
##### policy
|
|
61
|
+
|
|
62
|
+
`IOdrlPolicy`
|
|
63
|
+
|
|
64
|
+
The policy to store.
|
|
65
|
+
|
|
66
|
+
##### userIdentity
|
|
67
|
+
|
|
68
|
+
The identity of the user performing the operation.
|
|
69
|
+
|
|
70
|
+
`undefined` | `string`
|
|
71
|
+
|
|
72
|
+
##### nodeIdentity
|
|
73
|
+
|
|
74
|
+
`string`
|
|
75
|
+
|
|
76
|
+
The identity of the node the operation is performed on.
|
|
77
|
+
|
|
78
|
+
#### Returns
|
|
79
|
+
|
|
80
|
+
`Promise`\<`void`\>
|
|
81
|
+
|
|
82
|
+
Nothing.
|
|
83
|
+
|
|
84
|
+
#### Implementation of
|
|
85
|
+
|
|
86
|
+
`IRightsManagementComponent.papStore`
|
|
87
|
+
|
|
88
|
+
***
|
|
89
|
+
|
|
90
|
+
### papRetrieve()
|
|
91
|
+
|
|
92
|
+
> **papRetrieve**(`policyId`, `userIdentity`, `nodeIdentity`): `Promise`\<`IOdrlPolicy`\>
|
|
93
|
+
|
|
94
|
+
PAP: Retrieve a policy.
|
|
95
|
+
|
|
96
|
+
#### Parameters
|
|
97
|
+
|
|
98
|
+
##### policyId
|
|
99
|
+
|
|
100
|
+
`string`
|
|
101
|
+
|
|
102
|
+
The id of the policy to retrieve.
|
|
103
|
+
|
|
104
|
+
##### userIdentity
|
|
105
|
+
|
|
106
|
+
The identity of the user performing the operation.
|
|
107
|
+
|
|
108
|
+
`undefined` | `string`
|
|
109
|
+
|
|
110
|
+
##### nodeIdentity
|
|
111
|
+
|
|
112
|
+
`string`
|
|
113
|
+
|
|
114
|
+
The identity of the node the operation is performed on.
|
|
115
|
+
|
|
116
|
+
#### Returns
|
|
117
|
+
|
|
118
|
+
`Promise`\<`IOdrlPolicy`\>
|
|
119
|
+
|
|
120
|
+
The policy.
|
|
121
|
+
|
|
122
|
+
#### Implementation of
|
|
123
|
+
|
|
124
|
+
`IRightsManagementComponent.papRetrieve`
|
|
125
|
+
|
|
126
|
+
***
|
|
127
|
+
|
|
128
|
+
### papRemove()
|
|
129
|
+
|
|
130
|
+
> **papRemove**(`policyId`, `userIdentity`, `nodeIdentity`): `Promise`\<`void`\>
|
|
131
|
+
|
|
132
|
+
PAP: Remove a policy.
|
|
133
|
+
|
|
134
|
+
#### Parameters
|
|
135
|
+
|
|
136
|
+
##### policyId
|
|
137
|
+
|
|
138
|
+
`string`
|
|
139
|
+
|
|
140
|
+
The id of the policy to remove.
|
|
141
|
+
|
|
142
|
+
##### userIdentity
|
|
143
|
+
|
|
144
|
+
The identity of the user performing the operation.
|
|
145
|
+
|
|
146
|
+
`undefined` | `string`
|
|
147
|
+
|
|
148
|
+
##### nodeIdentity
|
|
149
|
+
|
|
150
|
+
`string`
|
|
151
|
+
|
|
152
|
+
The identity of the node the operation is performed on.
|
|
153
|
+
|
|
154
|
+
#### Returns
|
|
155
|
+
|
|
156
|
+
`Promise`\<`void`\>
|
|
157
|
+
|
|
158
|
+
Nothing.
|
|
159
|
+
|
|
160
|
+
#### Implementation of
|
|
161
|
+
|
|
162
|
+
`IRightsManagementComponent.papRemove`
|
|
163
|
+
|
|
164
|
+
***
|
|
165
|
+
|
|
166
|
+
### papQuery()
|
|
167
|
+
|
|
168
|
+
> **papQuery**(`conditions?`, `cursor?`, `pageSize?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<\{ `cursor`: `string`; `policies`: `IOdrlPolicy`[]; \}\>
|
|
169
|
+
|
|
170
|
+
PAP: Query the policies using the specified conditions.
|
|
171
|
+
|
|
172
|
+
#### Parameters
|
|
173
|
+
|
|
174
|
+
##### conditions?
|
|
175
|
+
|
|
176
|
+
`EntityCondition`\<`IOdrlPolicy`\>
|
|
177
|
+
|
|
178
|
+
The conditions to use for the query.
|
|
179
|
+
|
|
180
|
+
##### cursor?
|
|
181
|
+
|
|
182
|
+
`string`
|
|
183
|
+
|
|
184
|
+
The cursor to use for pagination.
|
|
185
|
+
|
|
186
|
+
##### pageSize?
|
|
187
|
+
|
|
188
|
+
`number`
|
|
189
|
+
|
|
190
|
+
The number of results to return per page.
|
|
191
|
+
|
|
192
|
+
##### userIdentity?
|
|
193
|
+
|
|
194
|
+
`string`
|
|
195
|
+
|
|
196
|
+
The identity of the user performing the operation.
|
|
197
|
+
|
|
198
|
+
##### nodeIdentity?
|
|
199
|
+
|
|
200
|
+
`string`
|
|
201
|
+
|
|
202
|
+
The identity of the node the operation is performed on.
|
|
203
|
+
|
|
204
|
+
#### Returns
|
|
205
|
+
|
|
206
|
+
`Promise`\<\{ `cursor`: `string`; `policies`: `IOdrlPolicy`[]; \}\>
|
|
207
|
+
|
|
208
|
+
Cursor for next page of results and the policies matching the query.
|
|
209
|
+
|
|
210
|
+
#### Implementation of
|
|
211
|
+
|
|
212
|
+
`IRightsManagementComponent.papQuery`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Function: generateRestRoutes()
|
|
2
|
+
|
|
3
|
+
> **generateRestRoutes**(`baseRouteName`, `componentName`): `IRestRoute`\<`any`, `any`\>[]
|
|
4
|
+
|
|
5
|
+
The REST routes for the Rights Management.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### baseRouteName
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
Prefix to prepend to the paths.
|
|
14
|
+
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The name of the component to use in the routes stored in the ComponentFactory.
|
|
20
|
+
|
|
21
|
+
## Returns
|
|
22
|
+
|
|
23
|
+
`IRestRoute`\<`any`, `any`\>[]
|
|
24
|
+
|
|
25
|
+
The generated routes.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: papQuery()
|
|
2
|
+
|
|
3
|
+
> **papQuery**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IPapQueryResponse`\>
|
|
4
|
+
|
|
5
|
+
PAP: Query policies.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
12
|
+
|
|
13
|
+
The request context for the API.
|
|
14
|
+
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The name of the component to use in the routes.
|
|
20
|
+
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`IPapQueryRequest`
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`IPapQueryResponse`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: papRemove()
|
|
2
|
+
|
|
3
|
+
> **papRemove**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
|
|
4
|
+
|
|
5
|
+
PAP: Remove a policy.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
12
|
+
|
|
13
|
+
The request context for the API.
|
|
14
|
+
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The name of the component to use in the routes.
|
|
20
|
+
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`IPapRemoveRequest`
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`INoContentResponse`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: papRetrieve()
|
|
2
|
+
|
|
3
|
+
> **papRetrieve**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IPapRetrieveResponse`\>
|
|
4
|
+
|
|
5
|
+
PAP: Retrieve a policy.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
12
|
+
|
|
13
|
+
The request context for the API.
|
|
14
|
+
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The name of the component to use in the routes.
|
|
20
|
+
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`IPapRetrieveRequest`
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`IPapRetrieveResponse`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: papStore()
|
|
2
|
+
|
|
3
|
+
> **papStore**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`ICreatedResponse`\>
|
|
4
|
+
|
|
5
|
+
PAP: Store a policy.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
12
|
+
|
|
13
|
+
The request context for the API.
|
|
14
|
+
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The name of the component to use in the routes.
|
|
20
|
+
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`IPapStoreRequest`
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`ICreatedResponse`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @twin.org/rights-management-service
|
|
2
|
+
|
|
3
|
+
## Classes
|
|
4
|
+
|
|
5
|
+
- [RightsManagementService](classes/RightsManagementService.md)
|
|
6
|
+
|
|
7
|
+
## Interfaces
|
|
8
|
+
|
|
9
|
+
- [IRightsManagementServiceConfig](interfaces/IRightsManagementServiceConfig.md)
|
|
10
|
+
- [IRightsManagementServiceConstructorOptions](interfaces/IRightsManagementServiceConstructorOptions.md)
|
|
11
|
+
|
|
12
|
+
## Variables
|
|
13
|
+
|
|
14
|
+
- [restEntryPoints](variables/restEntryPoints.md)
|
|
15
|
+
- [tags](variables/tags.md)
|
|
16
|
+
|
|
17
|
+
## Functions
|
|
18
|
+
|
|
19
|
+
- [generateRestRoutes](functions/generateRestRoutes.md)
|
|
20
|
+
- [papStore](functions/papStore.md)
|
|
21
|
+
- [papRetrieve](functions/papRetrieve.md)
|
|
22
|
+
- [papRemove](functions/papRemove.md)
|
|
23
|
+
- [papQuery](functions/papQuery.md)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Interface: IRightsManagementServiceConfig
|
|
2
|
+
|
|
3
|
+
The configuration for the RightsManagementService.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### papNamespace?
|
|
8
|
+
|
|
9
|
+
> `optional` **papNamespace**: `string`
|
|
10
|
+
|
|
11
|
+
The namespace for the PAP component.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### defaultEntityStorageType?
|
|
16
|
+
|
|
17
|
+
> `optional` **defaultEntityStorageType**: `string`
|
|
18
|
+
|
|
19
|
+
The default entity storage type.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### includeUserIdentity?
|
|
24
|
+
|
|
25
|
+
> `optional` **includeUserIdentity**: `boolean`
|
|
26
|
+
|
|
27
|
+
Should the user identity be included in entity storage operations.
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### includeNodeIdentity?
|
|
32
|
+
|
|
33
|
+
> `optional` **includeNodeIdentity**: `boolean`
|
|
34
|
+
|
|
35
|
+
Should the node identity be included in entity storage operations.
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
39
|
+
### maxQueryResults?
|
|
40
|
+
|
|
41
|
+
> `optional` **maxQueryResults**: `number`
|
|
42
|
+
|
|
43
|
+
The maximum number of results to return in a query.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Interface: IRightsManagementServiceConstructorOptions
|
|
2
|
+
|
|
3
|
+
The constructor options for the RightsManagementService.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### config?
|
|
8
|
+
|
|
9
|
+
> `optional` **config**: [`IRightsManagementServiceConfig`](IRightsManagementServiceConfig.md)
|
|
10
|
+
|
|
11
|
+
The configuration for the service.
|
package/locales/en.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@twin.org/rights-management-service",
|
|
3
|
+
"version": "0.0.1-next.3",
|
|
4
|
+
"description": "Rights Management service implementation and REST endpoint definitions",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/twinfoundation/rights-management.git",
|
|
8
|
+
"directory": "packages/rights-management-service"
|
|
9
|
+
},
|
|
10
|
+
"author": "cornel.filip@iota.org; adrian.sanchez.sequeira@iota.org",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20.0.0"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@twin.org/api-models": "next",
|
|
18
|
+
"@twin.org/core": "next",
|
|
19
|
+
"@twin.org/entity": "next",
|
|
20
|
+
"@twin.org/entity-storage-service": "next",
|
|
21
|
+
"@twin.org/nameof": "next",
|
|
22
|
+
"@twin.org/rights-management-models": "0.0.1-next.3",
|
|
23
|
+
"@twin.org/rights-management-pap-entity-storage": "0.0.1-next.3",
|
|
24
|
+
"@twin.org/standards-w3c-odrl": "next",
|
|
25
|
+
"@twin.org/web": "next"
|
|
26
|
+
},
|
|
27
|
+
"main": "./dist/cjs/index.cjs",
|
|
28
|
+
"module": "./dist/esm/index.mjs",
|
|
29
|
+
"types": "./dist/types/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/types/index.d.ts",
|
|
33
|
+
"require": "./dist/cjs/index.cjs",
|
|
34
|
+
"import": "./dist/esm/index.mjs"
|
|
35
|
+
},
|
|
36
|
+
"./locales/*.json": "./locales/*.json"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist/cjs",
|
|
40
|
+
"dist/esm",
|
|
41
|
+
"dist/types",
|
|
42
|
+
"locales",
|
|
43
|
+
"docs"
|
|
44
|
+
]
|
|
45
|
+
}
|