@twin.org/rights-management-service 0.0.1 → 0.0.2-next.10
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 +1331 -163
- package/dist/esm/index.mjs +1317 -163
- package/dist/types/dataAccessPointRoutes.d.ts +53 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/{rightsManagementRoutes.d.ts → policyAdministrationPointRoutes.d.ts} +6 -6
- package/dist/types/policyNegotiationAdminPointRoutes.d.ts +45 -0
- package/dist/types/policyNegotiationPointRoutes.d.ts +69 -0
- package/docs/changelog.md +230 -0
- package/docs/open-api/spec.json +3214 -61
- package/docs/reference/functions/generateRestRoutesPolicyAdministrationPoint.md +25 -0
- package/docs/reference/functions/generateRestRoutesPolicyNegotiationAdminPoint.md +25 -0
- package/docs/reference/functions/{generateRestRoutesRightsManagement.md → generateRestRoutesPolicyNegotiationPoint.md} +3 -3
- package/docs/reference/functions/{papRetrieve.md → papGet.md} +5 -5
- package/docs/reference/functions/pnapGet.md +31 -0
- package/docs/reference/functions/pnapQuery.md +31 -0
- package/docs/reference/functions/pnapRemove.md +31 -0
- package/docs/reference/functions/pnapSet.md +31 -0
- package/docs/reference/functions/pnpGetNegotiation.md +31 -0
- package/docs/reference/functions/pnpNegotiationAgreement.md +31 -0
- package/docs/reference/functions/pnpNegotiationAgreementVerification.md +31 -0
- package/docs/reference/functions/pnpNegotiationOffer.md +31 -0
- package/docs/reference/functions/pnpNegotiationProviderEvents.md +31 -0
- package/docs/reference/functions/pnpNegotiationRequest.md +31 -0
- package/docs/reference/functions/pnpNegotiationTermination.md +31 -0
- package/docs/reference/index.md +18 -11
- package/docs/reference/variables/papTags.md +5 -0
- package/docs/reference/variables/pnapTags.md +5 -0
- package/docs/reference/variables/pnpTags.md +5 -0
- package/locales/en.json +1 -10
- package/package.json +11 -9
- package/dist/types/models/IRightsManagementServiceConstructorOptions.d.ts +0 -10
- package/dist/types/rightsManagementService.d.ts +0 -58
- package/docs/reference/classes/RightsManagementService.md +0 -190
- package/docs/reference/interfaces/IRightsManagementServiceConstructorOptions.md +0 -17
- package/docs/reference/variables/tags.md +0 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -4,33 +4,35 @@ var apiModels = require('@twin.org/api-models');
|
|
|
4
4
|
var core = require('@twin.org/core');
|
|
5
5
|
var standardsW3cOdrl = require('@twin.org/standards-w3c-odrl');
|
|
6
6
|
var web = require('@twin.org/web');
|
|
7
|
+
var standardsIdsContractNegotiation = require('@twin.org/standards-ids-contract-negotiation');
|
|
8
|
+
var rightsManagementModels = require('@twin.org/rights-management-models');
|
|
7
9
|
|
|
8
10
|
// Copyright 2024 IOTA Stiftung.
|
|
9
11
|
// SPDX-License-Identifier: Apache-2.0.
|
|
10
12
|
/**
|
|
11
13
|
* The source used when communicating about these routes.
|
|
12
14
|
*/
|
|
13
|
-
const ROUTES_SOURCE = "
|
|
15
|
+
const ROUTES_SOURCE$3 = "policyAdministrationPointRoutes";
|
|
14
16
|
/**
|
|
15
17
|
* The tag to associate with the routes.
|
|
16
18
|
*/
|
|
17
|
-
const
|
|
19
|
+
const papTags = [
|
|
18
20
|
{
|
|
19
21
|
name: "Policy Administration Point",
|
|
20
22
|
description: "Endpoints for managing ODRL policies in the Policy Administration Point"
|
|
21
23
|
}
|
|
22
24
|
];
|
|
23
25
|
/**
|
|
24
|
-
* The REST routes for the
|
|
26
|
+
* The REST routes for the Policy Administration Point.
|
|
25
27
|
* @param baseRouteName Prefix to prepend to the paths.
|
|
26
28
|
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
27
29
|
* @returns The generated routes.
|
|
28
30
|
*/
|
|
29
|
-
function
|
|
30
|
-
const
|
|
31
|
+
function generateRestRoutesPolicyAdministrationPoint(baseRouteName, componentName) {
|
|
32
|
+
const papCreateRoute = {
|
|
31
33
|
operationId: "papCreate",
|
|
32
34
|
summary: "Create a policy",
|
|
33
|
-
tag:
|
|
35
|
+
tag: papTags[0].name,
|
|
34
36
|
method: "POST",
|
|
35
37
|
path: `${baseRouteName}/pap/`,
|
|
36
38
|
handler: async (httpRequestContext, request) => papCreate(httpRequestContext, componentName, request),
|
|
@@ -38,7 +40,7 @@ function generateRestRoutesRightsManagement(baseRouteName, componentName) {
|
|
|
38
40
|
type: "IPapCreateRequest",
|
|
39
41
|
examples: [
|
|
40
42
|
{
|
|
41
|
-
id: "
|
|
43
|
+
id: "papCreateRequestExample",
|
|
42
44
|
request: {
|
|
43
45
|
body: {
|
|
44
46
|
"@context": standardsW3cOdrl.OdrlContexts.ContextRoot,
|
|
@@ -71,10 +73,10 @@ function generateRestRoutesRightsManagement(baseRouteName, componentName) {
|
|
|
71
73
|
}
|
|
72
74
|
]
|
|
73
75
|
};
|
|
74
|
-
const
|
|
76
|
+
const papUpdateRoute = {
|
|
75
77
|
operationId: "papUpdate",
|
|
76
78
|
summary: "Update a policy",
|
|
77
|
-
tag:
|
|
79
|
+
tag: papTags[0].name,
|
|
78
80
|
method: "PUT",
|
|
79
81
|
path: `${baseRouteName}/pap/:id`,
|
|
80
82
|
handler: async (httpRequestContext, request) => papUpdate(httpRequestContext, componentName, request),
|
|
@@ -82,7 +84,7 @@ function generateRestRoutesRightsManagement(baseRouteName, componentName) {
|
|
|
82
84
|
type: "IPapUpdateRequest",
|
|
83
85
|
examples: [
|
|
84
86
|
{
|
|
85
|
-
id: "
|
|
87
|
+
id: "papUpdateRequestExample",
|
|
86
88
|
request: {
|
|
87
89
|
pathParams: {
|
|
88
90
|
id: "urn:rights-management:abc123def456"
|
|
@@ -108,18 +110,18 @@ function generateRestRoutesRightsManagement(baseRouteName, componentName) {
|
|
|
108
110
|
}
|
|
109
111
|
]
|
|
110
112
|
};
|
|
111
|
-
const
|
|
112
|
-
operationId: "
|
|
113
|
-
summary: "
|
|
114
|
-
tag:
|
|
113
|
+
const papGetRoute = {
|
|
114
|
+
operationId: "papGet",
|
|
115
|
+
summary: "Get a policy",
|
|
116
|
+
tag: papTags[0].name,
|
|
115
117
|
method: "GET",
|
|
116
118
|
path: `${baseRouteName}/pap/:id`,
|
|
117
|
-
handler: async (httpRequestContext, request) =>
|
|
119
|
+
handler: async (httpRequestContext, request) => papGet(httpRequestContext, componentName, request),
|
|
118
120
|
requestType: {
|
|
119
|
-
type: "
|
|
121
|
+
type: "IPapGetRequest",
|
|
120
122
|
examples: [
|
|
121
123
|
{
|
|
122
|
-
id: "
|
|
124
|
+
id: "papGetRequestExample",
|
|
123
125
|
request: {
|
|
124
126
|
pathParams: {
|
|
125
127
|
id: "urn:rights-management:abc123def456"
|
|
@@ -130,10 +132,10 @@ function generateRestRoutesRightsManagement(baseRouteName, componentName) {
|
|
|
130
132
|
},
|
|
131
133
|
responseType: [
|
|
132
134
|
{
|
|
133
|
-
type: "
|
|
135
|
+
type: "IPapGetResponse",
|
|
134
136
|
examples: [
|
|
135
137
|
{
|
|
136
|
-
id: "
|
|
138
|
+
id: "papGetResponseExample",
|
|
137
139
|
response: {
|
|
138
140
|
body: {
|
|
139
141
|
"@context": standardsW3cOdrl.OdrlContexts.ContextRoot,
|
|
@@ -152,10 +154,10 @@ function generateRestRoutesRightsManagement(baseRouteName, componentName) {
|
|
|
152
154
|
}
|
|
153
155
|
]
|
|
154
156
|
};
|
|
155
|
-
const
|
|
157
|
+
const papRemoveRoute = {
|
|
156
158
|
operationId: "papRemove",
|
|
157
159
|
summary: "Remove a policy",
|
|
158
|
-
tag:
|
|
160
|
+
tag: papTags[0].name,
|
|
159
161
|
method: "DELETE",
|
|
160
162
|
path: `${baseRouteName}/pap/:id`,
|
|
161
163
|
handler: async (httpRequestContext, request) => papRemove(httpRequestContext, componentName, request),
|
|
@@ -163,7 +165,7 @@ function generateRestRoutesRightsManagement(baseRouteName, componentName) {
|
|
|
163
165
|
type: "IPapRemoveRequest",
|
|
164
166
|
examples: [
|
|
165
167
|
{
|
|
166
|
-
id: "
|
|
168
|
+
id: "papRemoveRequestExample",
|
|
167
169
|
request: {
|
|
168
170
|
pathParams: {
|
|
169
171
|
id: "urn:rights-management:abc123def456"
|
|
@@ -178,10 +180,10 @@ function generateRestRoutesRightsManagement(baseRouteName, componentName) {
|
|
|
178
180
|
}
|
|
179
181
|
]
|
|
180
182
|
};
|
|
181
|
-
const
|
|
183
|
+
const papQueryRoute = {
|
|
182
184
|
operationId: "papQuery",
|
|
183
185
|
summary: "Query policies",
|
|
184
|
-
tag:
|
|
186
|
+
tag: papTags[0].name,
|
|
185
187
|
method: "GET",
|
|
186
188
|
path: `${baseRouteName}/pap/query`,
|
|
187
189
|
handler: async (httpRequestContext, request) => papQuery(httpRequestContext, componentName, request),
|
|
@@ -189,7 +191,7 @@ function generateRestRoutesRightsManagement(baseRouteName, componentName) {
|
|
|
189
191
|
type: "IPapQueryRequest",
|
|
190
192
|
examples: [
|
|
191
193
|
{
|
|
192
|
-
id: "
|
|
194
|
+
id: "papQueryRequestExample",
|
|
193
195
|
request: {
|
|
194
196
|
query: {
|
|
195
197
|
cursor: "optional-pagination-cursor"
|
|
@@ -227,7 +229,7 @@ function generateRestRoutesRightsManagement(baseRouteName, componentName) {
|
|
|
227
229
|
}
|
|
228
230
|
]
|
|
229
231
|
};
|
|
230
|
-
return [
|
|
232
|
+
return [papCreateRoute, papUpdateRoute, papGetRoute, papRemoveRoute, papQueryRoute];
|
|
231
233
|
}
|
|
232
234
|
/**
|
|
233
235
|
* PAP: Create a policy.
|
|
@@ -237,12 +239,11 @@ function generateRestRoutesRightsManagement(baseRouteName, componentName) {
|
|
|
237
239
|
* @returns The response object with additional http response properties.
|
|
238
240
|
*/
|
|
239
241
|
async function papCreate(httpRequestContext, componentName, request) {
|
|
240
|
-
core.Guards.object(ROUTES_SOURCE, "request", request);
|
|
241
|
-
core.Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
242
|
-
core.Guards.stringValue(ROUTES_SOURCE, "httpRequestContext.nodeIdentity", httpRequestContext.nodeIdentity);
|
|
242
|
+
core.Guards.object(ROUTES_SOURCE$3, "request", request);
|
|
243
|
+
core.Guards.object(ROUTES_SOURCE$3, "request.body", request.body);
|
|
243
244
|
const component = core.ComponentFactory.get(componentName);
|
|
244
245
|
const policy = request.body;
|
|
245
|
-
const uid = await component.
|
|
246
|
+
const uid = await component.create(policy);
|
|
246
247
|
return {
|
|
247
248
|
statusCode: web.HttpStatusCode.created,
|
|
248
249
|
headers: {
|
|
@@ -258,31 +259,29 @@ async function papCreate(httpRequestContext, componentName, request) {
|
|
|
258
259
|
* @returns The response object with additional http response properties.
|
|
259
260
|
*/
|
|
260
261
|
async function papUpdate(httpRequestContext, componentName, request) {
|
|
261
|
-
core.Guards.object(ROUTES_SOURCE, "request", request);
|
|
262
|
-
core.Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
263
|
-
core.Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
264
|
-
core.Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
265
|
-
core.Guards.stringValue(ROUTES_SOURCE, "httpRequestContext.nodeIdentity", httpRequestContext.nodeIdentity);
|
|
262
|
+
core.Guards.object(ROUTES_SOURCE$3, "request", request);
|
|
263
|
+
core.Guards.object(ROUTES_SOURCE$3, "request.pathParams", request.pathParams);
|
|
264
|
+
core.Guards.stringValue(ROUTES_SOURCE$3, "request.pathParams.id", request.pathParams.id);
|
|
265
|
+
core.Guards.object(ROUTES_SOURCE$3, "request.body", request.body);
|
|
266
266
|
const component = core.ComponentFactory.get(componentName);
|
|
267
|
-
await component.
|
|
267
|
+
await component.update(request.body);
|
|
268
268
|
return {
|
|
269
269
|
statusCode: web.HttpStatusCode.noContent
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
272
|
/**
|
|
273
|
-
* PAP:
|
|
273
|
+
* PAP: Get a policy.
|
|
274
274
|
* @param httpRequestContext The request context for the API.
|
|
275
275
|
* @param componentName The name of the component to use in the routes.
|
|
276
276
|
* @param request The request.
|
|
277
277
|
* @returns The response object with additional http response properties.
|
|
278
278
|
*/
|
|
279
|
-
async function
|
|
280
|
-
core.Guards.object(ROUTES_SOURCE, "request", request);
|
|
281
|
-
core.Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
282
|
-
core.Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
283
|
-
core.Guards.stringValue(ROUTES_SOURCE, "httpRequestContext.nodeIdentity", httpRequestContext.nodeIdentity);
|
|
279
|
+
async function papGet(httpRequestContext, componentName, request) {
|
|
280
|
+
core.Guards.object(ROUTES_SOURCE$3, "request", request);
|
|
281
|
+
core.Guards.object(ROUTES_SOURCE$3, "request.pathParams", request.pathParams);
|
|
282
|
+
core.Guards.stringValue(ROUTES_SOURCE$3, "request.pathParams.id", request.pathParams.id);
|
|
284
283
|
const component = core.ComponentFactory.get(componentName);
|
|
285
|
-
const policy = await component.
|
|
284
|
+
const policy = await component.get(request.pathParams.id);
|
|
286
285
|
return {
|
|
287
286
|
body: policy
|
|
288
287
|
};
|
|
@@ -295,11 +294,11 @@ async function papRetrieve(httpRequestContext, componentName, request) {
|
|
|
295
294
|
* @returns The response object with additional http response properties.
|
|
296
295
|
*/
|
|
297
296
|
async function papRemove(httpRequestContext, componentName, request) {
|
|
298
|
-
core.Guards.object(ROUTES_SOURCE, "request", request);
|
|
299
|
-
core.Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
300
|
-
core.Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
297
|
+
core.Guards.object(ROUTES_SOURCE$3, "request", request);
|
|
298
|
+
core.Guards.object(ROUTES_SOURCE$3, "request.pathParams", request.pathParams);
|
|
299
|
+
core.Guards.stringValue(ROUTES_SOURCE$3, "request.pathParams.id", request.pathParams.id);
|
|
301
300
|
const component = core.ComponentFactory.get(componentName);
|
|
302
|
-
await component.
|
|
301
|
+
await component.remove(request.pathParams.id);
|
|
303
302
|
return {
|
|
304
303
|
statusCode: web.HttpStatusCode.noContent
|
|
305
304
|
};
|
|
@@ -312,9 +311,9 @@ async function papRemove(httpRequestContext, componentName, request) {
|
|
|
312
311
|
* @returns The response object with additional http response properties.
|
|
313
312
|
*/
|
|
314
313
|
async function papQuery(httpRequestContext, componentName, request) {
|
|
315
|
-
core.Guards.object(ROUTES_SOURCE, "request", request);
|
|
314
|
+
core.Guards.object(ROUTES_SOURCE$3, "request", request);
|
|
316
315
|
const component = core.ComponentFactory.get(componentName);
|
|
317
|
-
const result = await component.
|
|
316
|
+
const result = await component.query(apiModels.HttpParameterHelper.objectFromString(request.query?.conditions), request.query?.cursor, core.Coerce.integer(request.query?.pageSize));
|
|
318
317
|
return {
|
|
319
318
|
body: {
|
|
320
319
|
cursor: result.cursor,
|
|
@@ -323,136 +322,1305 @@ async function papQuery(httpRequestContext, componentName, request) {
|
|
|
323
322
|
};
|
|
324
323
|
}
|
|
325
324
|
|
|
326
|
-
// Copyright 2024 IOTA Stiftung.
|
|
327
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
328
325
|
/**
|
|
329
|
-
*
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
*/
|
|
340
|
-
CLASS_NAME = "RightsManagementService";
|
|
341
|
-
/**
|
|
342
|
-
* The PAP component implementation.
|
|
343
|
-
* @internal
|
|
344
|
-
*/
|
|
345
|
-
_papComponent;
|
|
346
|
-
/**
|
|
347
|
-
* Create a new instance of RightsManagementService.
|
|
348
|
-
* @param options The options for the service.
|
|
349
|
-
*/
|
|
350
|
-
constructor(options) {
|
|
351
|
-
this._papComponent = core.ComponentFactory.get(options?.papComponentType ?? "pap");
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* PAP: Create a new policy with auto-generated UID.
|
|
355
|
-
* @param policy The policy to create (uid will be auto-generated).
|
|
356
|
-
* @returns The UID of the created policy.
|
|
357
|
-
*/
|
|
358
|
-
async papCreate(policy) {
|
|
359
|
-
try {
|
|
360
|
-
core.Guards.object(this.CLASS_NAME, "policy", policy);
|
|
361
|
-
const result = await this._papComponent.create(policy);
|
|
362
|
-
return result;
|
|
363
|
-
}
|
|
364
|
-
catch (error) {
|
|
365
|
-
throw new core.GeneralError(this.CLASS_NAME, "papCreateFailed", undefined, error);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* PAP: Update an existing policy.
|
|
370
|
-
* @param policy The policy to update (must include uid).
|
|
371
|
-
* @returns Nothing.
|
|
372
|
-
*/
|
|
373
|
-
async papUpdate(policy) {
|
|
374
|
-
try {
|
|
375
|
-
core.Guards.object(this.CLASS_NAME, "policy", policy);
|
|
376
|
-
await this._papComponent.update(policy);
|
|
377
|
-
}
|
|
378
|
-
catch (error) {
|
|
379
|
-
throw new core.GeneralError(this.CLASS_NAME, "papUpdateFailed", undefined, error);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* PAP: Retrieve a policy.
|
|
384
|
-
* @param policyId The id of the policy to retrieve.
|
|
385
|
-
* @returns The policy.
|
|
386
|
-
*/
|
|
387
|
-
async papRetrieve(policyId) {
|
|
388
|
-
try {
|
|
389
|
-
core.Guards.stringValue(this.CLASS_NAME, "policyId", policyId);
|
|
390
|
-
const policy = await this._papComponent.retrieve(policyId);
|
|
391
|
-
return policy;
|
|
392
|
-
}
|
|
393
|
-
catch (error) {
|
|
394
|
-
throw new core.GeneralError(this.CLASS_NAME, "papRetrieveFailed", undefined, error);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* PAP: Remove a policy.
|
|
399
|
-
* @param policyId The id of the policy to remove.
|
|
400
|
-
* @returns Nothing.
|
|
401
|
-
*/
|
|
402
|
-
async papRemove(policyId) {
|
|
403
|
-
try {
|
|
404
|
-
core.Guards.stringValue(this.CLASS_NAME, "policyId", policyId);
|
|
405
|
-
await this._papComponent.remove(policyId);
|
|
406
|
-
}
|
|
407
|
-
catch (error) {
|
|
408
|
-
throw new core.GeneralError(this.CLASS_NAME, "papRemoveFailed", undefined, error);
|
|
409
|
-
}
|
|
326
|
+
* The source used when communicating about these routes.
|
|
327
|
+
*/
|
|
328
|
+
const ROUTES_SOURCE$2 = "policyNegotiationAdminPointRoutes";
|
|
329
|
+
/**
|
|
330
|
+
* The tag to associate with the routes.
|
|
331
|
+
*/
|
|
332
|
+
const pnapTags = [
|
|
333
|
+
{
|
|
334
|
+
name: "Policy Negotiation Administration Point",
|
|
335
|
+
description: "Endpoints for managing ODRL policies in the Policy Negotiation Administration Point"
|
|
410
336
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
337
|
+
];
|
|
338
|
+
/**
|
|
339
|
+
* The REST routes for the Policy Negotiation Administration Point.
|
|
340
|
+
* @param baseRouteName Prefix to prepend to the paths.
|
|
341
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
342
|
+
* @returns The generated routes.
|
|
343
|
+
*/
|
|
344
|
+
function generateRestRoutesPolicyNegotiationAdminPoint(baseRouteName, componentName) {
|
|
345
|
+
const pnapGetRoute = {
|
|
346
|
+
operationId: "pnapGet",
|
|
347
|
+
summary: "Get a policy negotiation",
|
|
348
|
+
tag: pnapTags[0].name,
|
|
349
|
+
method: web.HttpMethod.GET,
|
|
350
|
+
path: `${baseRouteName}/pnap/:policyId`,
|
|
351
|
+
handler: async (httpRequestContext, request) => pnapGet(httpRequestContext, componentName, request),
|
|
352
|
+
requestType: {
|
|
353
|
+
type: "IPnapGetRequest",
|
|
354
|
+
examples: [
|
|
355
|
+
{
|
|
356
|
+
id: "pnapGetRequestExample",
|
|
357
|
+
request: {
|
|
358
|
+
pathParams: { policyId: "policy-1" }
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
]
|
|
362
|
+
},
|
|
363
|
+
responseType: [
|
|
364
|
+
{
|
|
365
|
+
type: "IPnapGetResponse",
|
|
366
|
+
examples: [
|
|
367
|
+
{
|
|
368
|
+
id: "pnapGetResponseExample",
|
|
369
|
+
response: {
|
|
370
|
+
body: {
|
|
371
|
+
id: "pid",
|
|
372
|
+
correlationId: "cid",
|
|
373
|
+
dateCreated: "2025-09-03T00:00:00.000Z",
|
|
374
|
+
state: standardsIdsContractNegotiation.IdsContractNegotiationStateType.REQUESTED
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
]
|
|
425
379
|
}
|
|
426
|
-
|
|
427
|
-
|
|
380
|
+
]
|
|
381
|
+
};
|
|
382
|
+
const pnapSetRoute = {
|
|
383
|
+
operationId: "pnapSet",
|
|
384
|
+
summary: "Set a policy negotiation",
|
|
385
|
+
tag: pnapTags[0].name,
|
|
386
|
+
method: web.HttpMethod.PUT,
|
|
387
|
+
path: `${baseRouteName}/pnap/:policyId`,
|
|
388
|
+
handler: async (httpRequestContext, request) => pnapSet(httpRequestContext, componentName, request),
|
|
389
|
+
requestType: {
|
|
390
|
+
type: "IPnapSetRequest",
|
|
391
|
+
examples: [
|
|
392
|
+
{
|
|
393
|
+
id: "pnapSetRequestExample",
|
|
394
|
+
request: {
|
|
395
|
+
pathParams: { policyId: "policy-1" },
|
|
396
|
+
body: {
|
|
397
|
+
id: "pid",
|
|
398
|
+
correlationId: "cid",
|
|
399
|
+
dateCreated: "2025-09-03T00:00:00.000Z",
|
|
400
|
+
state: standardsIdsContractNegotiation.IdsContractNegotiationStateType.REQUESTED
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
]
|
|
405
|
+
},
|
|
406
|
+
responseType: [{ type: "INoContentResponse" }]
|
|
407
|
+
};
|
|
408
|
+
const pnapRemoveRoute = {
|
|
409
|
+
operationId: "pnapRemove",
|
|
410
|
+
summary: "Remove a policy negotiation",
|
|
411
|
+
tag: pnapTags[0].name,
|
|
412
|
+
method: web.HttpMethod.DELETE,
|
|
413
|
+
path: `${baseRouteName}/pnap/:policyId`,
|
|
414
|
+
handler: async (httpRequestContext, request) => pnapRemove(httpRequestContext, componentName, request),
|
|
415
|
+
requestType: {
|
|
416
|
+
type: "IPnapRemoveRequest",
|
|
417
|
+
examples: [
|
|
418
|
+
{
|
|
419
|
+
id: "pnapRemoveRequestExample",
|
|
420
|
+
request: {
|
|
421
|
+
pathParams: { policyId: "policy-1" }
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
]
|
|
425
|
+
},
|
|
426
|
+
responseType: [{ type: "INoContentResponse" }]
|
|
427
|
+
};
|
|
428
|
+
const pnapQueryRoute = {
|
|
429
|
+
operationId: "pnapQuery",
|
|
430
|
+
summary: "Query policy negotiations",
|
|
431
|
+
tag: pnapTags[0].name,
|
|
432
|
+
method: web.HttpMethod.GET,
|
|
433
|
+
path: `${baseRouteName}/pnap`,
|
|
434
|
+
handler: async (httpRequestContext, request) => pnapQuery(httpRequestContext, componentName, request),
|
|
435
|
+
requestType: {
|
|
436
|
+
type: "IPnapQueryRequest",
|
|
437
|
+
examples: [
|
|
438
|
+
{
|
|
439
|
+
id: "pnapQueryRequestExample",
|
|
440
|
+
request: {
|
|
441
|
+
query: { state: standardsIdsContractNegotiation.IdsContractNegotiationStateType.ACCEPTED, cursor: "next-cursor" }
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
]
|
|
445
|
+
},
|
|
446
|
+
responseType: [
|
|
447
|
+
{
|
|
448
|
+
type: "IPnapQueryResponse",
|
|
449
|
+
examples: [
|
|
450
|
+
{
|
|
451
|
+
id: "pnapQueryResponseExample",
|
|
452
|
+
response: {
|
|
453
|
+
body: {
|
|
454
|
+
items: [
|
|
455
|
+
{
|
|
456
|
+
id: "pid",
|
|
457
|
+
correlationId: "cid",
|
|
458
|
+
dateCreated: "2025-09-03T00:00:00.000Z",
|
|
459
|
+
state: standardsIdsContractNegotiation.IdsContractNegotiationStateType.REQUESTED
|
|
460
|
+
}
|
|
461
|
+
],
|
|
462
|
+
cursor: "next-cursor"
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
]
|
|
428
467
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
468
|
+
]
|
|
469
|
+
};
|
|
470
|
+
return [pnapGetRoute, pnapSetRoute, pnapRemoveRoute, pnapQueryRoute];
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* PNAP: Get a policy negotiation.
|
|
474
|
+
* @param httpRequestContext The request context for the API.
|
|
475
|
+
* @param componentName The name of the component to use in the routes.
|
|
476
|
+
* @param request The request.
|
|
477
|
+
* @returns The response object with additional http response properties.
|
|
478
|
+
*/
|
|
479
|
+
async function pnapGet(httpRequestContext, componentName, request) {
|
|
480
|
+
core.Guards.object(ROUTES_SOURCE$2, "request", request);
|
|
481
|
+
core.Guards.object(ROUTES_SOURCE$2, "request.pathParams", request.pathParams);
|
|
482
|
+
core.Guards.stringValue(ROUTES_SOURCE$2, "request.pathParams.policyId", request.pathParams.policyId);
|
|
483
|
+
const component = core.ComponentFactory.get(componentName);
|
|
484
|
+
const negotiation = await component.get(request.pathParams.policyId);
|
|
485
|
+
return {
|
|
486
|
+
body: negotiation
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* PNAP: Set a policy negotiation.
|
|
491
|
+
* @param httpRequestContext The request context for the API.
|
|
492
|
+
* @param componentName The name of the component to use in the routes.
|
|
493
|
+
* @param request The request.
|
|
494
|
+
* @returns The response object with additional http response properties.
|
|
495
|
+
*/
|
|
496
|
+
async function pnapSet(httpRequestContext, componentName, request) {
|
|
497
|
+
core.Guards.object(ROUTES_SOURCE$2, "request", request);
|
|
498
|
+
core.Guards.object(ROUTES_SOURCE$2, "request.pathParams", request.pathParams);
|
|
499
|
+
core.Guards.stringValue(ROUTES_SOURCE$2, "request.pathParams.policyId", request.pathParams.policyId);
|
|
500
|
+
core.Guards.object(ROUTES_SOURCE$2, "request.body", request.body);
|
|
501
|
+
const component = core.ComponentFactory.get(componentName);
|
|
502
|
+
await component.set(request.body);
|
|
503
|
+
return {
|
|
504
|
+
statusCode: web.HttpStatusCode.noContent
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* PNAP: Remove a policy negotiation.
|
|
509
|
+
* @param httpRequestContext The request context for the API.
|
|
510
|
+
* @param componentName The name of the component to use in the routes.
|
|
511
|
+
* @param request The request.
|
|
512
|
+
* @returns The response object with additional http response properties.
|
|
513
|
+
*/
|
|
514
|
+
async function pnapRemove(httpRequestContext, componentName, request) {
|
|
515
|
+
core.Guards.object(ROUTES_SOURCE$2, "request", request);
|
|
516
|
+
core.Guards.object(ROUTES_SOURCE$2, "request.pathParams", request.pathParams);
|
|
517
|
+
core.Guards.stringValue(ROUTES_SOURCE$2, "request.pathParams.policyId", request.pathParams.policyId);
|
|
518
|
+
const component = core.ComponentFactory.get(componentName);
|
|
519
|
+
await component.remove(request.pathParams.policyId);
|
|
520
|
+
return {
|
|
521
|
+
statusCode: web.HttpStatusCode.noContent
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* PNAP: Query policy negotiations.
|
|
526
|
+
* @param httpRequestContext The request context for the API.
|
|
527
|
+
* @param componentName The name of the component to use in the routes.
|
|
528
|
+
* @param request The request.
|
|
529
|
+
* @returns The response object with additional http response properties.
|
|
530
|
+
*/
|
|
531
|
+
async function pnapQuery(httpRequestContext, componentName, request) {
|
|
532
|
+
core.Guards.object(ROUTES_SOURCE$2, "request", request);
|
|
533
|
+
const component = core.ComponentFactory.get(componentName);
|
|
534
|
+
const result = await component.query(request.query?.state, request.query?.cursor);
|
|
535
|
+
return {
|
|
536
|
+
body: {
|
|
537
|
+
items: result.items,
|
|
538
|
+
cursor: result.cursor
|
|
434
539
|
}
|
|
435
|
-
}
|
|
540
|
+
};
|
|
436
541
|
}
|
|
437
542
|
|
|
438
543
|
/**
|
|
439
|
-
*
|
|
544
|
+
* The source used when communicating about these routes.
|
|
440
545
|
*/
|
|
441
|
-
const
|
|
546
|
+
const ROUTES_SOURCE$1 = "policyNegotiationPointRoutes";
|
|
547
|
+
/**
|
|
548
|
+
* The tag to associate with the routes.
|
|
549
|
+
*/
|
|
550
|
+
const pnpTags = [
|
|
551
|
+
{
|
|
552
|
+
name: "Policy Negotiation Point",
|
|
553
|
+
description: "Endpoints for managing ODRL policies in the Policy Negotiation Point"
|
|
554
|
+
}
|
|
555
|
+
];
|
|
556
|
+
/**
|
|
557
|
+
* The REST routes for the Policy Negotiation Point.
|
|
558
|
+
* @param baseRouteName Prefix to prepend to the paths.
|
|
559
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
560
|
+
* @returns The generated routes.
|
|
561
|
+
*/
|
|
562
|
+
function generateRestRoutesPolicyNegotiationPoint(baseRouteName, componentName) {
|
|
563
|
+
// https://docs.internationaldataspaces.org/ids-knowledgebase/dataspace-protocol/contract-negotiation/contract.negotiation.binding.https#id-2.1-the-negotiations-endpoint-provider-side
|
|
564
|
+
const pnpGetNegotiationRoute = {
|
|
565
|
+
operationId: "pnpGetNegotiation",
|
|
566
|
+
summary: "Get a negotiation",
|
|
567
|
+
tag: pnpTags[0].name,
|
|
568
|
+
method: "GET",
|
|
569
|
+
path: `${baseRouteName}/negotiations/:id`,
|
|
570
|
+
handler: async (httpRequestContext, request) => pnpGetNegotiation(httpRequestContext, componentName, request),
|
|
571
|
+
requestType: {
|
|
572
|
+
type: "IPnpNegotiationGetRequest",
|
|
573
|
+
examples: [
|
|
574
|
+
{
|
|
575
|
+
id: "pnpGetNegotiationRequestExample",
|
|
576
|
+
request: {
|
|
577
|
+
headers: {
|
|
578
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd,
|
|
579
|
+
[web.HeaderTypes.Authorization]: "z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC"
|
|
580
|
+
},
|
|
581
|
+
pathParams: {
|
|
582
|
+
id: "urn:contract-negotiation:00aa11bb.......ffff"
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
]
|
|
587
|
+
},
|
|
588
|
+
responseType: [
|
|
589
|
+
{
|
|
590
|
+
type: "IPnpContractNegotiationResponse",
|
|
591
|
+
examples: [
|
|
592
|
+
{
|
|
593
|
+
id: "pnpGetNegotiationResponseExample",
|
|
594
|
+
response: {
|
|
595
|
+
body: {
|
|
596
|
+
"@context": standardsIdsContractNegotiation.IdsContractNegotiationContexts.ContextRoot,
|
|
597
|
+
"@type": standardsIdsContractNegotiation.IdsContractNegotiationTypes.ContractNegotiation,
|
|
598
|
+
providerPid: "urn:contract-negotiation:002aa11bb.......ffff",
|
|
599
|
+
consumerPid: "urn:contract-negotiation:22aa11bb.......ffff",
|
|
600
|
+
state: standardsIdsContractNegotiation.IdsContractNegotiationStateType.REQUESTED
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
]
|
|
605
|
+
}
|
|
606
|
+
],
|
|
607
|
+
skipAuth: true
|
|
608
|
+
};
|
|
609
|
+
// https://docs.internationaldataspaces.org/ids-knowledgebase/dataspace-protocol/contract-negotiation/contract.negotiation.binding.https#id-2.2-the-negotiations-request-endpoint-provider-side
|
|
610
|
+
const pnpNegotiationRequestRoute = {
|
|
611
|
+
operationId: "pnpNegotiationRequest",
|
|
612
|
+
summary: "Negotiate a policy",
|
|
613
|
+
tag: pnpTags[0].name,
|
|
614
|
+
method: "POST",
|
|
615
|
+
path: `${baseRouteName}/negotiations/request`,
|
|
616
|
+
handler: async (httpRequestContext, request) => pnpNegotiationRequest(httpRequestContext, componentName, request),
|
|
617
|
+
requestType: {
|
|
618
|
+
type: "IPnpNegotiateRequest",
|
|
619
|
+
examples: [
|
|
620
|
+
{
|
|
621
|
+
id: "pnpNegotiationRequestExample",
|
|
622
|
+
request: {
|
|
623
|
+
headers: {
|
|
624
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd,
|
|
625
|
+
[web.HeaderTypes.Authorization]: "z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC"
|
|
626
|
+
},
|
|
627
|
+
body: {
|
|
628
|
+
"@context": standardsIdsContractNegotiation.IdsContractNegotiationContexts.ContextRoot,
|
|
629
|
+
"@type": standardsIdsContractNegotiation.IdsContractNegotiationTypes.ContractRequestMessage,
|
|
630
|
+
consumerPid: "urn:contract-negotiation:22aa11bb.......ffff",
|
|
631
|
+
offer: {
|
|
632
|
+
"@context": standardsW3cOdrl.OdrlContexts.ContextRoot,
|
|
633
|
+
"@type": standardsW3cOdrl.OdrlTypes.Offer,
|
|
634
|
+
uid: "urn:offer-1",
|
|
635
|
+
assigner: "urn:provider:node:1"
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
]
|
|
641
|
+
},
|
|
642
|
+
responseType: [
|
|
643
|
+
{
|
|
644
|
+
type: "IPnpContractNegotiationResponse",
|
|
645
|
+
examples: [
|
|
646
|
+
{
|
|
647
|
+
id: "IPnpNegotiationRequestResponseExample",
|
|
648
|
+
response: {
|
|
649
|
+
body: {
|
|
650
|
+
"@context": standardsIdsContractNegotiation.IdsContractNegotiationContexts.ContextRoot,
|
|
651
|
+
"@type": standardsIdsContractNegotiation.IdsContractNegotiationTypes.ContractNegotiation,
|
|
652
|
+
providerPid: "urn:contract-negotiation:00aa11bb.......ffff",
|
|
653
|
+
consumerPid: "urn:contract-negotiation:22aa11bb.......ffff",
|
|
654
|
+
state: standardsIdsContractNegotiation.IdsContractNegotiationStateType.REQUESTED
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
]
|
|
659
|
+
}
|
|
660
|
+
],
|
|
661
|
+
skipAuth: true
|
|
662
|
+
};
|
|
663
|
+
// https://docs.internationaldataspaces.org/ids-knowledgebase/dataspace-protocol/contract-negotiation/contract.negotiation.binding.https#id-2.3-the-negotiations-providerpid-request-endpoint-provider-side
|
|
664
|
+
const pnpNegotiationProviderRequestRoute = {
|
|
665
|
+
operationId: "pnpNegotiationProviderRequest",
|
|
666
|
+
summary: "Negotiate a policy with an existing provider id",
|
|
667
|
+
tag: pnpTags[0].name,
|
|
668
|
+
method: "POST",
|
|
669
|
+
path: `${baseRouteName}/negotiations/:id/request`,
|
|
670
|
+
handler: async (httpRequestContext, request) => pnpNegotiationRequest(httpRequestContext, componentName, request),
|
|
671
|
+
requestType: {
|
|
672
|
+
type: "IPnpNegotiateRequest",
|
|
673
|
+
examples: [
|
|
674
|
+
{
|
|
675
|
+
id: "pnpNegotiationProviderRequestExample",
|
|
676
|
+
request: {
|
|
677
|
+
headers: {
|
|
678
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd,
|
|
679
|
+
[web.HeaderTypes.Authorization]: "z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC"
|
|
680
|
+
},
|
|
681
|
+
pathParams: {
|
|
682
|
+
id: "urn:contract-negotiation:00aa11bb.......ffff"
|
|
683
|
+
},
|
|
684
|
+
body: {
|
|
685
|
+
"@context": standardsIdsContractNegotiation.IdsContractNegotiationContexts.ContextRoot,
|
|
686
|
+
"@type": standardsIdsContractNegotiation.IdsContractNegotiationTypes.ContractRequestMessage,
|
|
687
|
+
consumerPid: "urn:contract-negotiation:22aa11bb.......ffff",
|
|
688
|
+
offer: {
|
|
689
|
+
"@context": standardsW3cOdrl.OdrlContexts.ContextRoot,
|
|
690
|
+
"@type": standardsW3cOdrl.OdrlTypes.Offer,
|
|
691
|
+
uid: "urn:offer-1",
|
|
692
|
+
assigner: "urn:provider:node:1"
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
]
|
|
698
|
+
},
|
|
699
|
+
responseType: [
|
|
700
|
+
{
|
|
701
|
+
type: "IPnpContractResponse",
|
|
702
|
+
examples: [
|
|
703
|
+
{
|
|
704
|
+
id: "IPnpNegotiationProviderRequestResponseExample",
|
|
705
|
+
response: {
|
|
706
|
+
body: undefined
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
]
|
|
710
|
+
}
|
|
711
|
+
],
|
|
712
|
+
skipAuth: true
|
|
713
|
+
};
|
|
714
|
+
// https://docs.internationaldataspaces.org/ids-knowledgebase/dataspace-protocol/contract-negotiation/contract.negotiation.binding.https#id-2.4-the-negotiations-providerpid-events-endpoint-provider-side
|
|
715
|
+
const pnpNegotiationEventsRoute = {
|
|
716
|
+
operationId: "pnpNegotiationEvents",
|
|
717
|
+
summary: "Update the state of the negotiation",
|
|
718
|
+
tag: pnpTags[0].name,
|
|
719
|
+
method: "POST",
|
|
720
|
+
path: `${baseRouteName}/negotiations/:id/events`,
|
|
721
|
+
handler: async (httpRequestContext, request) => pnpNegotiationProviderEvents(httpRequestContext, componentName, request),
|
|
722
|
+
requestType: {
|
|
723
|
+
type: "IPnpEventRequest",
|
|
724
|
+
examples: [
|
|
725
|
+
{
|
|
726
|
+
id: "pnpNegotiationEventsRequestExample",
|
|
727
|
+
request: {
|
|
728
|
+
headers: {
|
|
729
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd,
|
|
730
|
+
[web.HeaderTypes.Authorization]: "z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC"
|
|
731
|
+
},
|
|
732
|
+
pathParams: {
|
|
733
|
+
id: "urn:contract-negotiation:00aa11bb.......ffff"
|
|
734
|
+
},
|
|
735
|
+
body: {
|
|
736
|
+
"@context": standardsIdsContractNegotiation.IdsContractNegotiationContexts.ContextRoot,
|
|
737
|
+
"@type": standardsIdsContractNegotiation.IdsContractNegotiationTypes.ContractRequestMessage,
|
|
738
|
+
providerPid: "urn:contract-negotiation:00aa11bb.......ffff",
|
|
739
|
+
consumerPid: "urn:contract-negotiation:22aa11bb.......ffff",
|
|
740
|
+
event: standardsIdsContractNegotiation.IdsContractNegotiationEventType.ACCEPTED
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
]
|
|
745
|
+
},
|
|
746
|
+
responseType: [
|
|
747
|
+
{
|
|
748
|
+
type: "IPnpContractResponse",
|
|
749
|
+
examples: [
|
|
750
|
+
{
|
|
751
|
+
id: "IPnpNegotiationRequestResponseExample",
|
|
752
|
+
response: {
|
|
753
|
+
body: undefined
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
]
|
|
757
|
+
}
|
|
758
|
+
],
|
|
759
|
+
skipAuth: true
|
|
760
|
+
};
|
|
761
|
+
// https://docs.internationaldataspaces.org/ids-knowledgebase/dataspace-protocol/contract-negotiation/contract.negotiation.binding.https#id-2.5-the-negotiations-providerpid-agreement-verification-endpoint-provider-side
|
|
762
|
+
const pnpNegotiationAgreementVerificationRoute = {
|
|
763
|
+
operationId: "pnpNegotiationAgreementVerification",
|
|
764
|
+
summary: "Set the agreement to verified",
|
|
765
|
+
tag: pnpTags[0].name,
|
|
766
|
+
method: "POST",
|
|
767
|
+
path: `${baseRouteName}/negotiations/:id/agreement/verification`,
|
|
768
|
+
handler: async (httpRequestContext, request) => pnpNegotiationAgreementVerification(httpRequestContext, componentName, request),
|
|
769
|
+
requestType: {
|
|
770
|
+
type: "IPnpAgreementVerificationRequest",
|
|
771
|
+
examples: [
|
|
772
|
+
{
|
|
773
|
+
id: "pnpNegotiationAgreementVerificationRequestExample",
|
|
774
|
+
request: {
|
|
775
|
+
headers: {
|
|
776
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd,
|
|
777
|
+
[web.HeaderTypes.Authorization]: "z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC"
|
|
778
|
+
},
|
|
779
|
+
pathParams: {
|
|
780
|
+
id: "urn:contract-negotiation:00aa11bb.......ffff"
|
|
781
|
+
},
|
|
782
|
+
body: {
|
|
783
|
+
"@context": standardsIdsContractNegotiation.IdsContractNegotiationContexts.ContextRoot,
|
|
784
|
+
"@type": standardsIdsContractNegotiation.IdsContractNegotiationTypes.ContractRequestMessage,
|
|
785
|
+
providerPid: "urn:contract-negotiation:00aa11bb.......ffff",
|
|
786
|
+
consumerPid: "urn:contract-negotiation:22aa11bb.......ffff"
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
]
|
|
791
|
+
},
|
|
792
|
+
responseType: [
|
|
793
|
+
{
|
|
794
|
+
type: "IPnpContractResponse",
|
|
795
|
+
examples: [
|
|
796
|
+
{
|
|
797
|
+
id: "IPnpNegotiationAgreementVerificationResponseExample",
|
|
798
|
+
response: {
|
|
799
|
+
body: undefined
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
]
|
|
803
|
+
}
|
|
804
|
+
],
|
|
805
|
+
skipAuth: true
|
|
806
|
+
};
|
|
807
|
+
// https://docs.internationaldataspaces.org/ids-knowledgebase/dataspace-protocol/contract-negotiation/contract.negotiation.binding.https#id-2.6-the-negotiations-providerpid-termination-endpoint-provider-side
|
|
808
|
+
const pnpNegotiationTerminationRoute = {
|
|
809
|
+
operationId: "pnpNegotiationTermination",
|
|
810
|
+
summary: "Set the agreement to terminated",
|
|
811
|
+
tag: pnpTags[0].name,
|
|
812
|
+
method: "POST",
|
|
813
|
+
path: `${baseRouteName}/negotiations/:id/termination`,
|
|
814
|
+
handler: async (httpRequestContext, request) => pnpNegotiationTermination(httpRequestContext, componentName, request),
|
|
815
|
+
requestType: {
|
|
816
|
+
type: "IPnpTerminateRequest",
|
|
817
|
+
examples: [
|
|
818
|
+
{
|
|
819
|
+
id: "pnpNegotiationTerminationRequestExample",
|
|
820
|
+
request: {
|
|
821
|
+
headers: {
|
|
822
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd,
|
|
823
|
+
[web.HeaderTypes.Authorization]: "z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC"
|
|
824
|
+
},
|
|
825
|
+
pathParams: {
|
|
826
|
+
id: "urn:contract-negotiation:00aa11bb.......ffff"
|
|
827
|
+
},
|
|
828
|
+
body: {
|
|
829
|
+
"@context": standardsIdsContractNegotiation.IdsContractNegotiationContexts.ContextRoot,
|
|
830
|
+
"@type": standardsIdsContractNegotiation.IdsContractNegotiationTypes.ContractRequestMessage,
|
|
831
|
+
providerPid: "urn:contract-negotiation:00aa11bb.......ffff",
|
|
832
|
+
consumerPid: "urn:contract-negotiation:22aa11bb.......ffff"
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
]
|
|
837
|
+
},
|
|
838
|
+
responseType: [
|
|
839
|
+
{
|
|
840
|
+
type: "IPnpContractResponse",
|
|
841
|
+
examples: [
|
|
842
|
+
{
|
|
843
|
+
id: "pnpNegotiationTerminationResponseExample",
|
|
844
|
+
response: {
|
|
845
|
+
body: undefined
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
]
|
|
849
|
+
}
|
|
850
|
+
],
|
|
851
|
+
skipAuth: true
|
|
852
|
+
};
|
|
853
|
+
// https://docs.internationaldataspaces.org/ids-knowledgebase/dataspace-protocol/contract-negotiation/contract.negotiation.binding.https#id-3.2-the-negotiations-offers-endpoint-consumer-side
|
|
854
|
+
const pnpNegotiationOfferRoute = {
|
|
855
|
+
operationId: "pnpNegotiationOffer",
|
|
856
|
+
summary: "Send the offer to the consumer",
|
|
857
|
+
tag: pnpTags[0].name,
|
|
858
|
+
method: "POST",
|
|
859
|
+
path: `${baseRouteName}/negotiations/offers`,
|
|
860
|
+
handler: async (httpRequestContext, request) => pnpNegotiationOffer(httpRequestContext, componentName, request),
|
|
861
|
+
requestType: {
|
|
862
|
+
type: "IPnpOfferRequest",
|
|
863
|
+
examples: [
|
|
864
|
+
{
|
|
865
|
+
id: "pnpNegotiationOfferRequestExample",
|
|
866
|
+
request: {
|
|
867
|
+
headers: {
|
|
868
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd,
|
|
869
|
+
[web.HeaderTypes.Authorization]: "z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC"
|
|
870
|
+
},
|
|
871
|
+
body: {
|
|
872
|
+
"@context": standardsIdsContractNegotiation.IdsContractNegotiationContexts.ContextRoot,
|
|
873
|
+
"@type": standardsIdsContractNegotiation.IdsContractNegotiationTypes.ContractRequestMessage,
|
|
874
|
+
providerPid: "urn:contract-negotiation:00aa11bb.......ffff",
|
|
875
|
+
consumerPid: "urn:contract-negotiation:22aa11bb.......ffff",
|
|
876
|
+
offer: {
|
|
877
|
+
"@context": standardsW3cOdrl.OdrlContexts.ContextRoot,
|
|
878
|
+
"@type": standardsW3cOdrl.OdrlTypes.Offer,
|
|
879
|
+
uid: "urn:offer-1",
|
|
880
|
+
assigner: "urn:provider:node:1"
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
]
|
|
886
|
+
},
|
|
887
|
+
responseType: [
|
|
888
|
+
{
|
|
889
|
+
type: "IPnpContractResponse",
|
|
890
|
+
examples: [
|
|
891
|
+
{
|
|
892
|
+
id: "pnpNegotiationOfferResponseExample",
|
|
893
|
+
response: {
|
|
894
|
+
body: {
|
|
895
|
+
"@context": standardsIdsContractNegotiation.IdsContractNegotiationContexts.ContextRoot,
|
|
896
|
+
"@type": standardsIdsContractNegotiation.IdsContractNegotiationTypes.ContractRequestMessage,
|
|
897
|
+
providerPid: "urn:contract-negotiation:00aa11bb.......ffff",
|
|
898
|
+
consumerPid: "urn:contract-negotiation:22aa11bb.......ffff"
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
]
|
|
903
|
+
}
|
|
904
|
+
],
|
|
905
|
+
skipAuth: true
|
|
906
|
+
};
|
|
907
|
+
// https://docs.internationaldataspaces.org/ids-knowledgebase/dataspace-protocol/contract-negotiation/contract.negotiation.binding.https#id-3.3-the-negotiations-consumerpid-offers-endpoint-consumer-side
|
|
908
|
+
const pnpNegotiationConsumerOfferRoute = {
|
|
909
|
+
operationId: "pnpNegotiationConsumerOffer",
|
|
910
|
+
summary: "Send the offer to the consumer with existing id",
|
|
911
|
+
tag: pnpTags[0].name,
|
|
912
|
+
method: "POST",
|
|
913
|
+
path: `${baseRouteName}/negotiations/:id/offers`,
|
|
914
|
+
handler: async (httpRequestContext, request) => pnpNegotiationOffer(httpRequestContext, componentName, request),
|
|
915
|
+
requestType: {
|
|
916
|
+
type: "IPnpOfferRequest",
|
|
917
|
+
examples: [
|
|
918
|
+
{
|
|
919
|
+
id: "pnpNegotiationConsumerOfferRequestExample",
|
|
920
|
+
request: {
|
|
921
|
+
headers: {
|
|
922
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd,
|
|
923
|
+
[web.HeaderTypes.Authorization]: "z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC"
|
|
924
|
+
},
|
|
925
|
+
pathParams: {
|
|
926
|
+
id: "urn:contract-negotiation:22aa11bb.......ffff"
|
|
927
|
+
},
|
|
928
|
+
body: {
|
|
929
|
+
"@context": standardsIdsContractNegotiation.IdsContractNegotiationContexts.ContextRoot,
|
|
930
|
+
"@type": standardsIdsContractNegotiation.IdsContractNegotiationTypes.ContractRequestMessage,
|
|
931
|
+
providerPid: "urn:contract-negotiation:00aa11bb.......ffff",
|
|
932
|
+
consumerPid: "urn:contract-negotiation:22aa11bb.......ffff",
|
|
933
|
+
offer: {
|
|
934
|
+
"@context": standardsW3cOdrl.OdrlContexts.ContextRoot,
|
|
935
|
+
"@type": standardsW3cOdrl.OdrlTypes.Offer,
|
|
936
|
+
uid: "urn:offer-1",
|
|
937
|
+
assigner: "urn:provider:node:1"
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
]
|
|
943
|
+
},
|
|
944
|
+
responseType: [
|
|
945
|
+
{
|
|
946
|
+
type: "IPnpContractResponse",
|
|
947
|
+
examples: [
|
|
948
|
+
{
|
|
949
|
+
id: "pnpNegotiationConsumerOfferResponseExample",
|
|
950
|
+
response: {
|
|
951
|
+
body: {
|
|
952
|
+
"@context": standardsIdsContractNegotiation.IdsContractNegotiationContexts.ContextRoot,
|
|
953
|
+
"@type": standardsIdsContractNegotiation.IdsContractNegotiationTypes.ContractNegotiation,
|
|
954
|
+
providerPid: "urn:contract-negotiation:00aa11bb.......ffff",
|
|
955
|
+
consumerPid: "urn:contract-negotiation:22aa11bb.......ffff"
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
]
|
|
960
|
+
}
|
|
961
|
+
],
|
|
962
|
+
skipAuth: true
|
|
963
|
+
};
|
|
964
|
+
// https://docs.internationaldataspaces.org/ids-knowledgebase/dataspace-protocol/contract-negotiation/contract.negotiation.binding.https#id-3.4-the-negotiations-consumerpid-agreement-endpoint-consumer-side
|
|
965
|
+
const pnpNegotiationAgreementRoute = {
|
|
966
|
+
operationId: "pnpNegotiationAgreement",
|
|
967
|
+
summary: "Send the agreement to the consumer",
|
|
968
|
+
tag: pnpTags[0].name,
|
|
969
|
+
method: "POST",
|
|
970
|
+
path: `${baseRouteName}/negotiations/:id/agreement`,
|
|
971
|
+
handler: async (httpRequestContext, request) => pnpNegotiationAgreement(httpRequestContext, componentName, request),
|
|
972
|
+
requestType: {
|
|
973
|
+
type: "IPnpAgreementRequest",
|
|
974
|
+
examples: [
|
|
975
|
+
{
|
|
976
|
+
id: "pnpNegotiationAgreementRequestExample",
|
|
977
|
+
request: {
|
|
978
|
+
headers: {
|
|
979
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd,
|
|
980
|
+
[web.HeaderTypes.Authorization]: "z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC"
|
|
981
|
+
},
|
|
982
|
+
pathParams: {
|
|
983
|
+
id: "urn:contract-negotiation:22aa11bb.......ffff"
|
|
984
|
+
},
|
|
985
|
+
body: {
|
|
986
|
+
"@context": standardsIdsContractNegotiation.IdsContractNegotiationContexts.ContextRoot,
|
|
987
|
+
"@type": standardsIdsContractNegotiation.IdsContractNegotiationTypes.ContractRequestMessage,
|
|
988
|
+
providerPid: "urn:contract-negotiation:00aa11bb.......ffff",
|
|
989
|
+
consumerPid: "urn:contract-negotiation:22aa11bb.......ffff",
|
|
990
|
+
agreement: {
|
|
991
|
+
"@context": standardsW3cOdrl.OdrlContexts.ContextRoot,
|
|
992
|
+
"@type": standardsW3cOdrl.OdrlTypes.Agreement,
|
|
993
|
+
uid: "urn:offer-1",
|
|
994
|
+
assigner: "urn:provider:node:1",
|
|
995
|
+
assignee: "urn:consumer:node:1"
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
]
|
|
1001
|
+
},
|
|
1002
|
+
responseType: [
|
|
1003
|
+
{
|
|
1004
|
+
type: "IPnpContractResponse",
|
|
1005
|
+
examples: [
|
|
1006
|
+
{
|
|
1007
|
+
id: "pnpNegotiationAgreementResponseExample",
|
|
1008
|
+
response: {
|
|
1009
|
+
body: undefined
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
]
|
|
1013
|
+
}
|
|
1014
|
+
],
|
|
1015
|
+
skipAuth: true
|
|
1016
|
+
};
|
|
1017
|
+
// The consumer event and terminate routes are exactly the same as the pnpNegotiationEventsRoute and pnpNegotiationTerminationRoute
|
|
1018
|
+
// https://docs.internationaldataspaces.org/ids-knowledgebase/dataspace-protocol/contract-negotiation/contract.negotiation.binding.https#id-3.5-the-negotiations-consumerpid-events-endpoint-consumer-side
|
|
1019
|
+
// https://docs.internationaldataspaces.org/ids-knowledgebase/dataspace-protocol/contract-negotiation/contract.negotiation.binding.https#id-3.6-the-negotiations-consumerpid-termination-endpoint-consumer-side
|
|
1020
|
+
return [
|
|
1021
|
+
pnpGetNegotiationRoute,
|
|
1022
|
+
pnpNegotiationRequestRoute,
|
|
1023
|
+
pnpNegotiationProviderRequestRoute,
|
|
1024
|
+
pnpNegotiationEventsRoute,
|
|
1025
|
+
pnpNegotiationAgreementVerificationRoute,
|
|
1026
|
+
pnpNegotiationTerminationRoute,
|
|
1027
|
+
pnpNegotiationOfferRoute,
|
|
1028
|
+
pnpNegotiationConsumerOfferRoute,
|
|
1029
|
+
pnpNegotiationAgreementRoute
|
|
1030
|
+
];
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Map the IDS result to an HTTP status code.
|
|
1034
|
+
* @param result The result to map.
|
|
1035
|
+
* @returns The mapped status code or undefined if no mapping was found or not an error.
|
|
1036
|
+
*/
|
|
1037
|
+
function mapError(result) {
|
|
1038
|
+
if (result?.["@type"] === standardsIdsContractNegotiation.IdsContractNegotiationTypes.ContractNegotiationError &&
|
|
1039
|
+
core.Is.object(result)) {
|
|
1040
|
+
if (core.Is.stringValue(result.code) && /notfound/i.test(result.code)) {
|
|
1041
|
+
return web.HttpStatusCode.notFound;
|
|
1042
|
+
}
|
|
1043
|
+
return web.HttpStatusCode.badRequest;
|
|
1044
|
+
}
|
|
1045
|
+
return undefined;
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* PNP: Get negotiation.
|
|
1049
|
+
* @param httpRequestContext The request context for the API.
|
|
1050
|
+
* @param componentName The name of the component to use in the routes.
|
|
1051
|
+
* @param request The request.
|
|
1052
|
+
* @returns The response object with additional http response properties.
|
|
1053
|
+
*/
|
|
1054
|
+
async function pnpGetNegotiation(httpRequestContext, componentName, request) {
|
|
1055
|
+
core.Guards.object(ROUTES_SOURCE$1, "request", request);
|
|
1056
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.headers", request.headers);
|
|
1057
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.pathParams", request.pathParams);
|
|
1058
|
+
const mimeType = request.headers[web.HeaderTypes.Accept] === web.MimeTypes.JsonLd ? "jsonld" : "json";
|
|
1059
|
+
const component = core.ComponentFactory.get(componentName);
|
|
1060
|
+
const result = await component.getNegotiation(request.pathParams.id, request.headers[web.HeaderTypes.Authorization]);
|
|
1061
|
+
return {
|
|
1062
|
+
statusCode: mapError(result),
|
|
1063
|
+
headers: {
|
|
1064
|
+
[web.HeaderTypes.ContentType]: mimeType === "json" ? web.MimeTypes.Json : web.MimeTypes.JsonLd
|
|
1065
|
+
},
|
|
1066
|
+
body: result
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* PNP: Request a negotiation.
|
|
1071
|
+
* @param httpRequestContext The request context for the API.
|
|
1072
|
+
* @param componentName The name of the component to use in the routes.
|
|
1073
|
+
* @param request The request.
|
|
1074
|
+
* @returns The response object with additional http response properties.
|
|
1075
|
+
*/
|
|
1076
|
+
async function pnpNegotiationRequest(httpRequestContext, componentName, request) {
|
|
1077
|
+
core.Guards.object(ROUTES_SOURCE$1, "request", request);
|
|
1078
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.headers", request.headers);
|
|
1079
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.body", request.body);
|
|
1080
|
+
const mimeType = request.headers[web.HeaderTypes.Accept] === web.MimeTypes.JsonLd ? "jsonld" : "json";
|
|
1081
|
+
const component = core.ComponentFactory.get(componentName);
|
|
1082
|
+
const result = await component.requestFromConsumer(request.body, request.headers[web.HeaderTypes.Authorization]);
|
|
1083
|
+
const isUpdate = core.Is.stringValue(request.pathParams?.id);
|
|
1084
|
+
if (isUpdate) {
|
|
1085
|
+
return {
|
|
1086
|
+
statusCode: mapError(result),
|
|
1087
|
+
headers: {
|
|
1088
|
+
[web.HeaderTypes.ContentType]: mimeType === "json" ? web.MimeTypes.Json : web.MimeTypes.JsonLd
|
|
1089
|
+
}
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
return {
|
|
1093
|
+
statusCode: mapError(result) ?? web.HttpStatusCode.created,
|
|
1094
|
+
headers: {
|
|
1095
|
+
[web.HeaderTypes.ContentType]: mimeType === "json" ? web.MimeTypes.Json : web.MimeTypes.JsonLd
|
|
1096
|
+
},
|
|
1097
|
+
body: result
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* PNP: Update state of negotiation.
|
|
1102
|
+
* @param httpRequestContext The request context for the API.
|
|
1103
|
+
* @param componentName The name of the component to use in the routes.
|
|
1104
|
+
* @param request The request.
|
|
1105
|
+
* @returns The response object with additional http response properties.
|
|
1106
|
+
*/
|
|
1107
|
+
async function pnpNegotiationProviderEvents(httpRequestContext, componentName, request) {
|
|
1108
|
+
core.Guards.object(ROUTES_SOURCE$1, "request", request);
|
|
1109
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.headers", request.headers);
|
|
1110
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.pathParams", request.pathParams);
|
|
1111
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.body", request.body);
|
|
1112
|
+
const mimeType = request.headers[web.HeaderTypes.Accept] === web.MimeTypes.JsonLd ? "jsonld" : "json";
|
|
1113
|
+
const component = core.ComponentFactory.get(componentName);
|
|
1114
|
+
const result = await component.event(request.body, request.pathParams.id === request.body.providerPid ? "provider" : "consumer", request.headers[web.HeaderTypes.Authorization]);
|
|
1115
|
+
return {
|
|
1116
|
+
statusCode: mapError(result),
|
|
1117
|
+
headers: {
|
|
1118
|
+
[web.HeaderTypes.ContentType]: mimeType === "json" ? web.MimeTypes.Json : web.MimeTypes.JsonLd
|
|
1119
|
+
},
|
|
1120
|
+
body: result
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* PNP: Set the agreement to verified.
|
|
1125
|
+
* @param httpRequestContext The request context for the API.
|
|
1126
|
+
* @param componentName The name of the component to use in the routes.
|
|
1127
|
+
* @param request The request.
|
|
1128
|
+
* @returns The response object with additional http response properties.
|
|
1129
|
+
*/
|
|
1130
|
+
async function pnpNegotiationAgreementVerification(httpRequestContext, componentName, request) {
|
|
1131
|
+
core.Guards.object(ROUTES_SOURCE$1, "request", request);
|
|
1132
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.headers", request.headers);
|
|
1133
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.pathParams", request.pathParams);
|
|
1134
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.body", request.body);
|
|
1135
|
+
const mimeType = request.headers[web.HeaderTypes.Accept] === web.MimeTypes.JsonLd ? "jsonld" : "json";
|
|
1136
|
+
const component = core.ComponentFactory.get(componentName);
|
|
1137
|
+
const result = await component.agreementVerificationFromConsumer(request.body, request.headers[web.HeaderTypes.Authorization]);
|
|
1138
|
+
return {
|
|
1139
|
+
statusCode: mapError(result),
|
|
1140
|
+
headers: {
|
|
1141
|
+
[web.HeaderTypes.ContentType]: mimeType === "json" ? web.MimeTypes.Json : web.MimeTypes.JsonLd
|
|
1142
|
+
},
|
|
1143
|
+
body: result
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* PNP: Terminate the provider negotiation.
|
|
1148
|
+
* @param httpRequestContext The request context for the API.
|
|
1149
|
+
* @param componentName The name of the component to use in the routes.
|
|
1150
|
+
* @param request The request.
|
|
1151
|
+
* @returns The response object with additional http response properties.
|
|
1152
|
+
*/
|
|
1153
|
+
async function pnpNegotiationTermination(httpRequestContext, componentName, request) {
|
|
1154
|
+
core.Guards.object(ROUTES_SOURCE$1, "request", request);
|
|
1155
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.headers", request.headers);
|
|
1156
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.pathParams", request.pathParams);
|
|
1157
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.body", request.body);
|
|
1158
|
+
const mimeType = request.headers[web.HeaderTypes.Accept] === web.MimeTypes.JsonLd ? "jsonld" : "json";
|
|
1159
|
+
const component = core.ComponentFactory.get(componentName);
|
|
1160
|
+
const result = await component.terminate(request.body, request.pathParams.id === request.body.providerPid ? "provider" : "consumer", request.headers[web.HeaderTypes.Authorization]);
|
|
1161
|
+
return {
|
|
1162
|
+
statusCode: mapError(result),
|
|
1163
|
+
headers: {
|
|
1164
|
+
[web.HeaderTypes.ContentType]: mimeType === "json" ? web.MimeTypes.Json : web.MimeTypes.JsonLd
|
|
1165
|
+
},
|
|
1166
|
+
body: result
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* PNP: Send the offer to the consumer.
|
|
1171
|
+
* @param httpRequestContext The request context for the API.
|
|
1172
|
+
* @param componentName The name of the component to use in the routes.
|
|
1173
|
+
* @param request The request.
|
|
1174
|
+
* @returns The response object with additional http response properties.
|
|
1175
|
+
*/
|
|
1176
|
+
async function pnpNegotiationOffer(httpRequestContext, componentName, request) {
|
|
1177
|
+
core.Guards.object(ROUTES_SOURCE$1, "request", request);
|
|
1178
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.headers", request.headers);
|
|
1179
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.body", request.body);
|
|
1180
|
+
const mimeType = request.headers[web.HeaderTypes.Accept] === web.MimeTypes.JsonLd ? "jsonld" : "json";
|
|
1181
|
+
const component = core.ComponentFactory.get(componentName);
|
|
1182
|
+
const result = await component.offerFromProvider(request.body, request.headers[web.HeaderTypes.Authorization]);
|
|
1183
|
+
const isUpdate = core.Is.stringValue(request.pathParams?.id);
|
|
1184
|
+
if (isUpdate) {
|
|
1185
|
+
return {
|
|
1186
|
+
statusCode: mapError(result),
|
|
1187
|
+
headers: {
|
|
1188
|
+
[web.HeaderTypes.ContentType]: mimeType === "json" ? web.MimeTypes.Json : web.MimeTypes.JsonLd
|
|
1189
|
+
}
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
return {
|
|
1193
|
+
statusCode: mapError(result) ?? web.HttpStatusCode.created,
|
|
1194
|
+
headers: {
|
|
1195
|
+
[web.HeaderTypes.ContentType]: mimeType === "json" ? web.MimeTypes.Json : web.MimeTypes.JsonLd
|
|
1196
|
+
},
|
|
1197
|
+
body: result
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* PNP: Send the agreement to the consumer.
|
|
1202
|
+
* @param httpRequestContext The request context for the API.
|
|
1203
|
+
* @param componentName The name of the component to use in the routes.
|
|
1204
|
+
* @param request The request.
|
|
1205
|
+
* @returns The response object with additional http response properties.
|
|
1206
|
+
*/
|
|
1207
|
+
async function pnpNegotiationAgreement(httpRequestContext, componentName, request) {
|
|
1208
|
+
core.Guards.object(ROUTES_SOURCE$1, "request", request);
|
|
1209
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.headers", request.headers);
|
|
1210
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.body", request.body);
|
|
1211
|
+
core.Guards.object(ROUTES_SOURCE$1, "request.body", request.body);
|
|
1212
|
+
const mimeType = request.headers[web.HeaderTypes.Accept] === web.MimeTypes.JsonLd ? "jsonld" : "json";
|
|
1213
|
+
const component = core.ComponentFactory.get(componentName);
|
|
1214
|
+
const result = await component.agreementFromProvider(request.body, request.headers[web.HeaderTypes.Authorization]);
|
|
1215
|
+
return {
|
|
1216
|
+
statusCode: mapError(result),
|
|
1217
|
+
headers: {
|
|
1218
|
+
[web.HeaderTypes.ContentType]: mimeType === "json" ? web.MimeTypes.Json : web.MimeTypes.JsonLd
|
|
1219
|
+
},
|
|
1220
|
+
body: result
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
/**
|
|
1225
|
+
* The source used when communicating about these routes.
|
|
1226
|
+
*/
|
|
1227
|
+
const ROUTES_SOURCE = "dataAccessPointRoutes";
|
|
1228
|
+
/**
|
|
1229
|
+
* The tag to associate with the routes.
|
|
1230
|
+
*/
|
|
1231
|
+
const dapTags = [
|
|
1232
|
+
{
|
|
1233
|
+
name: "Data Access Point",
|
|
1234
|
+
description: "Endpoints for providing access to the Rights Management Data Access Point"
|
|
1235
|
+
}
|
|
1236
|
+
];
|
|
1237
|
+
/**
|
|
1238
|
+
* The REST routes for the Data Access Point.
|
|
1239
|
+
* @param baseRouteName Prefix to prepend to the paths.
|
|
1240
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
1241
|
+
* @returns The generated routes.
|
|
1242
|
+
*/
|
|
1243
|
+
function generateRestRoutesDataAccessPoint(baseRouteName, componentName) {
|
|
1244
|
+
const dapCreateRoute = {
|
|
1245
|
+
operationId: "dapCreate",
|
|
1246
|
+
summary: "Create a new item",
|
|
1247
|
+
tag: dapTags[0].name,
|
|
1248
|
+
method: "POST",
|
|
1249
|
+
path: `${baseRouteName}/dap/:assetType`,
|
|
1250
|
+
handler: async (httpRequestContext, request) => dapCreate(httpRequestContext, componentName, request),
|
|
1251
|
+
requestType: {
|
|
1252
|
+
type: "IDapCreateRequest",
|
|
1253
|
+
examples: [
|
|
1254
|
+
{
|
|
1255
|
+
id: "dapCreateRequestExample",
|
|
1256
|
+
request: {
|
|
1257
|
+
headers: {
|
|
1258
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd,
|
|
1259
|
+
[web.HeaderTypes.Authorization]: "z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC"
|
|
1260
|
+
},
|
|
1261
|
+
pathParams: {
|
|
1262
|
+
assetType: "contacts"
|
|
1263
|
+
},
|
|
1264
|
+
body: {
|
|
1265
|
+
"@context": rightsManagementModels.RightsManagementContexts.ContextRoot,
|
|
1266
|
+
type: rightsManagementModels.RightsManagementTypes.DataAccessRequestWithObject,
|
|
1267
|
+
assetType: "contacts",
|
|
1268
|
+
object: {
|
|
1269
|
+
"@context": "https://schema.org",
|
|
1270
|
+
type: "Person",
|
|
1271
|
+
name: "Jane Doe"
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
]
|
|
1277
|
+
},
|
|
1278
|
+
responseType: [
|
|
1279
|
+
{
|
|
1280
|
+
type: "ICreatedResponse",
|
|
1281
|
+
examples: [
|
|
1282
|
+
{
|
|
1283
|
+
id: "IDapCreateResponseExample",
|
|
1284
|
+
response: {
|
|
1285
|
+
statusCode: 201,
|
|
1286
|
+
headers: {
|
|
1287
|
+
location: "urn:contacts:abc123def456"
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
]
|
|
1292
|
+
}
|
|
1293
|
+
],
|
|
1294
|
+
skipAuth: true
|
|
1295
|
+
};
|
|
1296
|
+
const dapGetRoute = {
|
|
1297
|
+
operationId: "dapGet",
|
|
1298
|
+
summary: "Get an existing item",
|
|
1299
|
+
tag: dapTags[0].name,
|
|
1300
|
+
method: "GET",
|
|
1301
|
+
path: `${baseRouteName}/dap/:assetType/:id`,
|
|
1302
|
+
handler: async (httpRequestContext, request) => dapGet(httpRequestContext, componentName, request),
|
|
1303
|
+
requestType: {
|
|
1304
|
+
type: "IDapGetRequest",
|
|
1305
|
+
examples: [
|
|
1306
|
+
{
|
|
1307
|
+
id: "dapCreateRequestExample",
|
|
1308
|
+
request: {
|
|
1309
|
+
headers: {
|
|
1310
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd,
|
|
1311
|
+
[web.HeaderTypes.Authorization]: "z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC"
|
|
1312
|
+
},
|
|
1313
|
+
pathParams: {
|
|
1314
|
+
assetType: "contacts",
|
|
1315
|
+
id: "urn:contacts:abc123def456"
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
]
|
|
1320
|
+
},
|
|
1321
|
+
responseType: [
|
|
1322
|
+
{
|
|
1323
|
+
type: "IDapGetResponse",
|
|
1324
|
+
examples: [
|
|
1325
|
+
{
|
|
1326
|
+
id: "IDapGetResponseExample",
|
|
1327
|
+
response: {
|
|
1328
|
+
body: {
|
|
1329
|
+
"@context": "https://schema.org",
|
|
1330
|
+
type: "Person",
|
|
1331
|
+
name: "Jane Doe"
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
]
|
|
1336
|
+
}
|
|
1337
|
+
],
|
|
1338
|
+
skipAuth: true
|
|
1339
|
+
};
|
|
1340
|
+
const dapUpdateRoute = {
|
|
1341
|
+
operationId: "dapUpdate",
|
|
1342
|
+
summary: "Update an existing item",
|
|
1343
|
+
tag: dapTags[0].name,
|
|
1344
|
+
method: "PUT",
|
|
1345
|
+
path: `${baseRouteName}/dap/:assetType/:id`,
|
|
1346
|
+
handler: async (httpRequestContext, request) => dapUpdate(httpRequestContext, componentName, request),
|
|
1347
|
+
requestType: {
|
|
1348
|
+
type: "IDapUpdateRequest",
|
|
1349
|
+
examples: [
|
|
1350
|
+
{
|
|
1351
|
+
id: "dapUpdateRequestExample",
|
|
1352
|
+
request: {
|
|
1353
|
+
headers: {
|
|
1354
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd,
|
|
1355
|
+
[web.HeaderTypes.Authorization]: "z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC"
|
|
1356
|
+
},
|
|
1357
|
+
pathParams: {
|
|
1358
|
+
assetType: "contacts",
|
|
1359
|
+
id: "urn:contacts:abc123def456"
|
|
1360
|
+
},
|
|
1361
|
+
body: {
|
|
1362
|
+
"@context": rightsManagementModels.RightsManagementContexts.ContextRoot,
|
|
1363
|
+
type: rightsManagementModels.RightsManagementTypes.DataAccessRequestWithObject,
|
|
1364
|
+
assetType: "contacts",
|
|
1365
|
+
object: {
|
|
1366
|
+
"@context": "https://schema.org",
|
|
1367
|
+
type: "Person",
|
|
1368
|
+
name: "Jane Doe"
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
]
|
|
1374
|
+
},
|
|
1375
|
+
responseType: [
|
|
1376
|
+
{
|
|
1377
|
+
type: "INoContentResponse"
|
|
1378
|
+
}
|
|
1379
|
+
],
|
|
1380
|
+
skipAuth: true
|
|
1381
|
+
};
|
|
1382
|
+
const dapRemoveRoute = {
|
|
1383
|
+
operationId: "dapRemove",
|
|
1384
|
+
summary: "Remove an existing item",
|
|
1385
|
+
tag: dapTags[0].name,
|
|
1386
|
+
method: "DELETE",
|
|
1387
|
+
path: `${baseRouteName}/dap/:assetType/:id`,
|
|
1388
|
+
handler: async (httpRequestContext, request) => dapRemove(httpRequestContext, componentName, request),
|
|
1389
|
+
requestType: {
|
|
1390
|
+
type: "IDapRemoveRequest",
|
|
1391
|
+
examples: [
|
|
1392
|
+
{
|
|
1393
|
+
id: "dapRemoveRequestExample",
|
|
1394
|
+
request: {
|
|
1395
|
+
headers: {
|
|
1396
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd,
|
|
1397
|
+
[web.HeaderTypes.Authorization]: "z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC"
|
|
1398
|
+
},
|
|
1399
|
+
pathParams: {
|
|
1400
|
+
assetType: "contacts",
|
|
1401
|
+
id: "urn:contacts:abc123def456"
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
]
|
|
1406
|
+
},
|
|
1407
|
+
responseType: [
|
|
1408
|
+
{
|
|
1409
|
+
type: "INoContentResponse"
|
|
1410
|
+
}
|
|
1411
|
+
],
|
|
1412
|
+
skipAuth: true
|
|
1413
|
+
};
|
|
1414
|
+
const dapQueryRoute = {
|
|
1415
|
+
operationId: "dapQuery",
|
|
1416
|
+
summary: "Query items",
|
|
1417
|
+
tag: dapTags[0].name,
|
|
1418
|
+
method: "POST",
|
|
1419
|
+
path: `${baseRouteName}/dap/:assetType/query`,
|
|
1420
|
+
handler: async (httpRequestContext, request) => dapQuery(httpRequestContext, componentName, request),
|
|
1421
|
+
requestType: {
|
|
1422
|
+
type: "IDapQueryRequest",
|
|
1423
|
+
examples: [
|
|
1424
|
+
{
|
|
1425
|
+
id: "dapQueryRequestExample",
|
|
1426
|
+
request: {
|
|
1427
|
+
headers: {
|
|
1428
|
+
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd,
|
|
1429
|
+
[web.HeaderTypes.Authorization]: "z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC"
|
|
1430
|
+
},
|
|
1431
|
+
pathParams: {
|
|
1432
|
+
assetType: "contacts"
|
|
1433
|
+
},
|
|
1434
|
+
body: {
|
|
1435
|
+
"@context": rightsManagementModels.RightsManagementContexts.ContextRoot,
|
|
1436
|
+
type: rightsManagementModels.RightsManagementTypes.DataAccessQuery,
|
|
1437
|
+
assetType: "contacts"
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
]
|
|
1442
|
+
},
|
|
1443
|
+
responseType: [
|
|
1444
|
+
{
|
|
1445
|
+
type: "IDapQueryResponse",
|
|
1446
|
+
examples: [
|
|
1447
|
+
{
|
|
1448
|
+
id: "IDapQueryResponseExample",
|
|
1449
|
+
response: {
|
|
1450
|
+
body: {
|
|
1451
|
+
"@context": rightsManagementModels.RightsManagementContexts.ContextRoot,
|
|
1452
|
+
type: rightsManagementModels.RightsManagementTypes.DataAccessQueryResponse,
|
|
1453
|
+
items: [
|
|
1454
|
+
{
|
|
1455
|
+
"@context": "https://schema.org",
|
|
1456
|
+
type: "Person",
|
|
1457
|
+
name: "Jane Doe"
|
|
1458
|
+
}
|
|
1459
|
+
]
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
]
|
|
1464
|
+
}
|
|
1465
|
+
],
|
|
1466
|
+
skipAuth: true
|
|
1467
|
+
};
|
|
1468
|
+
return [dapCreateRoute, dapGetRoute, dapUpdateRoute, dapRemoveRoute, dapQueryRoute];
|
|
1469
|
+
}
|
|
1470
|
+
/**
|
|
1471
|
+
* DAP: Create.
|
|
1472
|
+
* @param httpRequestContext The request context for the API.
|
|
1473
|
+
* @param componentName The name of the component to use in the routes.
|
|
1474
|
+
* @param request The request.
|
|
1475
|
+
* @returns The response object with additional http response properties.
|
|
1476
|
+
*/
|
|
1477
|
+
async function dapCreate(httpRequestContext, componentName, request) {
|
|
1478
|
+
core.Guards.object(ROUTES_SOURCE, "request", request);
|
|
1479
|
+
core.Guards.object(ROUTES_SOURCE, "request.headers", request.headers);
|
|
1480
|
+
core.Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1481
|
+
core.Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
1482
|
+
const component = core.ComponentFactory.get(componentName);
|
|
1483
|
+
const result = await component.create(request.pathParams.assetType, request.body.object, request.headers[web.HeaderTypes.Authorization]);
|
|
1484
|
+
return {
|
|
1485
|
+
statusCode: web.HttpStatusCode.created,
|
|
1486
|
+
headers: {
|
|
1487
|
+
[web.HeaderTypes.Location]: result
|
|
1488
|
+
}
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* DAP: Get.
|
|
1493
|
+
* @param httpRequestContext The request context for the API.
|
|
1494
|
+
* @param componentName The name of the component to use in the routes.
|
|
1495
|
+
* @param request The request.
|
|
1496
|
+
* @returns The response object with additional http response properties.
|
|
1497
|
+
*/
|
|
1498
|
+
async function dapGet(httpRequestContext, componentName, request) {
|
|
1499
|
+
core.Guards.object(ROUTES_SOURCE, "request", request);
|
|
1500
|
+
core.Guards.object(ROUTES_SOURCE, "request.headers", request.headers);
|
|
1501
|
+
core.Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1502
|
+
const mimeType = request.headers[web.HeaderTypes.Accept] === web.MimeTypes.JsonLd ? "jsonld" : "json";
|
|
1503
|
+
const component = core.ComponentFactory.get(componentName);
|
|
1504
|
+
const result = await component.get(request.pathParams.assetType, request.pathParams.id, request.headers[web.HeaderTypes.Authorization]);
|
|
1505
|
+
return {
|
|
1506
|
+
headers: {
|
|
1507
|
+
[web.HeaderTypes.ContentType]: mimeType === "json" ? web.MimeTypes.Json : web.MimeTypes.JsonLd
|
|
1508
|
+
},
|
|
1509
|
+
body: result
|
|
1510
|
+
};
|
|
1511
|
+
}
|
|
1512
|
+
/**
|
|
1513
|
+
* DAP: Update.
|
|
1514
|
+
* @param httpRequestContext The request context for the API.
|
|
1515
|
+
* @param componentName The name of the component to use in the routes.
|
|
1516
|
+
* @param request The request.
|
|
1517
|
+
* @returns The response object with additional http response properties.
|
|
1518
|
+
*/
|
|
1519
|
+
async function dapUpdate(httpRequestContext, componentName, request) {
|
|
1520
|
+
core.Guards.object(ROUTES_SOURCE, "request", request);
|
|
1521
|
+
core.Guards.object(ROUTES_SOURCE, "request.headers", request.headers);
|
|
1522
|
+
core.Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1523
|
+
core.Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
1524
|
+
const component = core.ComponentFactory.get(componentName);
|
|
1525
|
+
await component.update(request.pathParams.assetType, request.body.object, request.headers[web.HeaderTypes.Authorization]);
|
|
1526
|
+
return {
|
|
1527
|
+
statusCode: web.HttpStatusCode.noContent
|
|
1528
|
+
};
|
|
1529
|
+
}
|
|
1530
|
+
/**
|
|
1531
|
+
* DAP: Remove.
|
|
1532
|
+
* @param httpRequestContext The request context for the API.
|
|
1533
|
+
* @param componentName The name of the component to use in the routes.
|
|
1534
|
+
* @param request The request.
|
|
1535
|
+
* @returns The response object with additional http response properties.
|
|
1536
|
+
*/
|
|
1537
|
+
async function dapRemove(httpRequestContext, componentName, request) {
|
|
1538
|
+
core.Guards.object(ROUTES_SOURCE, "request", request);
|
|
1539
|
+
core.Guards.object(ROUTES_SOURCE, "request.headers", request.headers);
|
|
1540
|
+
core.Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1541
|
+
const component = core.ComponentFactory.get(componentName);
|
|
1542
|
+
await component.remove(request.pathParams.assetType, request.pathParams.id, request.headers[web.HeaderTypes.Authorization]);
|
|
1543
|
+
return {
|
|
1544
|
+
statusCode: web.HttpStatusCode.noContent
|
|
1545
|
+
};
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* DAP: Query.
|
|
1549
|
+
* @param httpRequestContext The request context for the API.
|
|
1550
|
+
* @param componentName The name of the component to use in the routes.
|
|
1551
|
+
* @param request The request.
|
|
1552
|
+
* @returns The response object with additional http response properties.
|
|
1553
|
+
*/
|
|
1554
|
+
async function dapQuery(httpRequestContext, componentName, request) {
|
|
1555
|
+
core.Guards.object(ROUTES_SOURCE, "request", request);
|
|
1556
|
+
core.Guards.object(ROUTES_SOURCE, "request.headers", request.headers);
|
|
1557
|
+
core.Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1558
|
+
core.Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
1559
|
+
const mimeType = request.headers[web.HeaderTypes.Accept] === web.MimeTypes.JsonLd ? "jsonld" : "json";
|
|
1560
|
+
const component = core.ComponentFactory.get(componentName);
|
|
1561
|
+
const result = await component.query(request.pathParams.assetType, request.body.conditions, request.body.cursor, request.body.options, request.headers[web.HeaderTypes.Authorization]);
|
|
1562
|
+
return {
|
|
1563
|
+
headers: {
|
|
1564
|
+
[web.HeaderTypes.ContentType]: mimeType === "json" ? web.MimeTypes.Json : web.MimeTypes.JsonLd
|
|
1565
|
+
},
|
|
1566
|
+
body: {
|
|
1567
|
+
"@context": rightsManagementModels.RightsManagementContexts.ContextRoot,
|
|
1568
|
+
type: rightsManagementModels.RightsManagementTypes.DataAccessQueryResponse,
|
|
1569
|
+
...result
|
|
1570
|
+
}
|
|
1571
|
+
};
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
/**
|
|
1575
|
+
* Entry points for the REST API.
|
|
1576
|
+
*/
|
|
1577
|
+
const restEntryPoints = [
|
|
1578
|
+
{
|
|
1579
|
+
name: "policy-administration-point",
|
|
1580
|
+
defaultBaseRoute: "rights-management",
|
|
1581
|
+
tags: papTags,
|
|
1582
|
+
generateRoutes: generateRestRoutesPolicyAdministrationPoint
|
|
1583
|
+
},
|
|
1584
|
+
{
|
|
1585
|
+
name: "policy-negotiation-point",
|
|
1586
|
+
defaultBaseRoute: "rights-management",
|
|
1587
|
+
tags: pnpTags,
|
|
1588
|
+
generateRoutes: generateRestRoutesPolicyNegotiationPoint
|
|
1589
|
+
},
|
|
1590
|
+
{
|
|
1591
|
+
name: "policy-negotiation-admin-point",
|
|
1592
|
+
defaultBaseRoute: "rights-management",
|
|
1593
|
+
tags: pnapTags,
|
|
1594
|
+
generateRoutes: generateRestRoutesPolicyNegotiationAdminPoint
|
|
1595
|
+
},
|
|
442
1596
|
{
|
|
443
|
-
name: "
|
|
1597
|
+
name: "data-access-point",
|
|
444
1598
|
defaultBaseRoute: "rights-management",
|
|
445
|
-
tags,
|
|
446
|
-
generateRoutes:
|
|
1599
|
+
tags: dapTags,
|
|
1600
|
+
generateRoutes: generateRestRoutesDataAccessPoint
|
|
447
1601
|
}
|
|
448
1602
|
];
|
|
449
1603
|
|
|
450
|
-
exports.
|
|
451
|
-
exports.
|
|
1604
|
+
exports.generateRestRoutesPolicyAdministrationPoint = generateRestRoutesPolicyAdministrationPoint;
|
|
1605
|
+
exports.generateRestRoutesPolicyNegotiationAdminPoint = generateRestRoutesPolicyNegotiationAdminPoint;
|
|
1606
|
+
exports.generateRestRoutesPolicyNegotiationPoint = generateRestRoutesPolicyNegotiationPoint;
|
|
452
1607
|
exports.papCreate = papCreate;
|
|
1608
|
+
exports.papGet = papGet;
|
|
453
1609
|
exports.papQuery = papQuery;
|
|
454
1610
|
exports.papRemove = papRemove;
|
|
455
|
-
exports.
|
|
1611
|
+
exports.papTags = papTags;
|
|
456
1612
|
exports.papUpdate = papUpdate;
|
|
1613
|
+
exports.pnapGet = pnapGet;
|
|
1614
|
+
exports.pnapQuery = pnapQuery;
|
|
1615
|
+
exports.pnapRemove = pnapRemove;
|
|
1616
|
+
exports.pnapSet = pnapSet;
|
|
1617
|
+
exports.pnapTags = pnapTags;
|
|
1618
|
+
exports.pnpGetNegotiation = pnpGetNegotiation;
|
|
1619
|
+
exports.pnpNegotiationAgreement = pnpNegotiationAgreement;
|
|
1620
|
+
exports.pnpNegotiationAgreementVerification = pnpNegotiationAgreementVerification;
|
|
1621
|
+
exports.pnpNegotiationOffer = pnpNegotiationOffer;
|
|
1622
|
+
exports.pnpNegotiationProviderEvents = pnpNegotiationProviderEvents;
|
|
1623
|
+
exports.pnpNegotiationRequest = pnpNegotiationRequest;
|
|
1624
|
+
exports.pnpNegotiationTermination = pnpNegotiationTermination;
|
|
1625
|
+
exports.pnpTags = pnpTags;
|
|
457
1626
|
exports.restEntryPoints = restEntryPoints;
|
|
458
|
-
exports.tags = tags;
|