@twin.org/rights-management-service 0.9.0 → 0.9.1-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/es/policyAdministrationPointRoutes.js +12 -9
- package/dist/es/policyAdministrationPointRoutes.js.map +1 -1
- package/dist/es/policyNegotiationAdminPointRoutes.js +13 -12
- package/dist/es/policyNegotiationAdminPointRoutes.js.map +1 -1
- package/dist/es/policyNegotiationPointRoutes.js +24 -35
- package/dist/es/policyNegotiationPointRoutes.js.map +1 -1
- package/dist/types/policyAdministrationPointRoutes.d.ts +2 -1
- package/dist/types/policyNegotiationAdminPointRoutes.d.ts +2 -1
- package/dist/types/policyNegotiationPointRoutes.d.ts +1 -1
- package/docs/changelog.md +288 -0
- package/docs/reference/functions/papCreate.md +7 -1
- package/docs/reference/functions/pnapCreate.md +7 -1
- package/package.json +12 -12
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Copyright 2025 IOTA Stiftung.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
-
import { HttpContextIdKeys, HttpParameterHelper, HttpUrlHelper } from "@twin.org/api-models";
|
|
3
|
+
import { HttpContextIdKeys, HttpHeaderHelper, HttpParameterHelper, HttpUrlHelper } from "@twin.org/api-models";
|
|
4
4
|
import { ContextIdStore } from "@twin.org/context";
|
|
5
|
-
import { Coerce, ComponentFactory, Guards
|
|
5
|
+
import { Coerce, ComponentFactory, Guards } from "@twin.org/core";
|
|
6
6
|
import { POLICY_METADATA_CONTEXT } from "@twin.org/rights-management-models";
|
|
7
7
|
import { OdrlContexts, OdrlPolicyType } from "@twin.org/standards-w3c-odrl";
|
|
8
|
-
import {
|
|
8
|
+
import { HttpStatusCode } from "@twin.org/web";
|
|
9
9
|
/**
|
|
10
10
|
* The source used when communicating about these routes.
|
|
11
11
|
*/
|
|
@@ -44,7 +44,7 @@ export function generateRestRoutesPolicyAdministrationPoint(baseRouteName, compo
|
|
|
44
44
|
tag: papTags[0].name,
|
|
45
45
|
method: "POST",
|
|
46
46
|
path: `${baseRouteName}/policy/admin`,
|
|
47
|
-
handler: async (httpRequestContext, request) => papCreate(httpRequestContext, componentName, request),
|
|
47
|
+
handler: async (httpRequestContext, request) => papCreate(httpRequestContext, componentName, request, baseRouteName),
|
|
48
48
|
requestType: {
|
|
49
49
|
type: "IPapCreateRequest",
|
|
50
50
|
examples: [
|
|
@@ -394,14 +394,19 @@ export function generateRestRoutesPolicyAdministrationPoint(baseRouteName, compo
|
|
|
394
394
|
* @param httpRequestContext The request context for the API.
|
|
395
395
|
* @param componentName The name of the component to use in the routes.
|
|
396
396
|
* @param request The request.
|
|
397
|
+
* @param baseRouteName The base route name to use for generating the location header.
|
|
397
398
|
* @returns The response object with additional http response properties.
|
|
398
399
|
*/
|
|
399
|
-
export async function papCreate(httpRequestContext, componentName, request) {
|
|
400
|
+
export async function papCreate(httpRequestContext, componentName, request, baseRouteName) {
|
|
400
401
|
Guards.object(ROUTES_SOURCE, "request", request);
|
|
401
402
|
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
402
403
|
const component = ComponentFactory.get(componentName);
|
|
403
404
|
const policy = request.body;
|
|
404
405
|
const uid = await component.create(policy);
|
|
406
|
+
const contextIds = await ContextIdStore.getContextIds();
|
|
407
|
+
const publicOrigin = contextIds?.[HttpContextIdKeys.PublicOrigin];
|
|
408
|
+
const headers = {};
|
|
409
|
+
HttpHeaderHelper.buildId(headers, uid, HttpUrlHelper.combineOriginPath(publicOrigin, `${baseRouteName}/policy/admin/:id`));
|
|
405
410
|
return {
|
|
406
411
|
statusCode: HttpStatusCode.created,
|
|
407
412
|
headers: {
|
|
@@ -529,10 +534,8 @@ export async function papQuery(httpRequestContext, componentName, request) {
|
|
|
529
534
|
action: request.query?.action
|
|
530
535
|
}, HttpParameterHelper.objectFromString(request.query?.conditions), request.query?.cursor, Coerce.integer(request.query?.limit));
|
|
531
536
|
const headers = {};
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
headers[HeaderTypes.Link] = HeaderHelper.createLinkHeader(HttpUrlHelper.replaceOrigin(httpRequestContext.serverRequest.url, contextIds?.[HttpContextIdKeys.PublicOrigin]), { cursor: result.cursor }, "next");
|
|
535
|
-
}
|
|
537
|
+
const contextIds = await ContextIdStore.getContextIds();
|
|
538
|
+
HttpHeaderHelper.buildCursor(headers, httpRequestContext.serverRequest.url, contextIds?.[HttpContextIdKeys.PublicOrigin], result.cursor);
|
|
536
539
|
return {
|
|
537
540
|
headers,
|
|
538
541
|
body: result.policies
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policyAdministrationPointRoutes.js","sourceRoot":"","sources":["../../src/policyAdministrationPointRoutes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EAMb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EACN,uBAAuB,EAevB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAwB,MAAM,8BAA8B,CAAC;AAClG,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE1E;;GAEG;AACH,MAAM,aAAa,GAAG,iCAAiC,CAAC;AAExD;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAW;IAC9B;QACC,IAAI,EAAE,6BAA6B;QACnC,WAAW,EAAE,yEAAyE;KACtF;CACD,CAAC;AAEF;;;GAGG;AACH,MAAM,2BAA2B,GAAoB;IACpD,YAAY,CAAC,OAAO;IACpB,uBAAuB;CACvB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,2CAA2C,CAC1D,aAAqB,EACrB,aA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C,GAAG,CAAsC,aAAa,CAAC,CAAC;IAC3F,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,KAAK,CACnC;QACC,QAAQ,EAAE,OAAO,CAAC,KAAK,EAAE,QAAQ;QACjC,QAAQ,EAAE,OAAO,CAAC,KAAK,EAAE,QAAQ;QACjC,MAAM,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM;QAC7B,MAAM,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM;KAC7B,EACD,mBAAmB,CAAC,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,EAC/D,OAAO,CAAC,KAAK,EAAE,MAAM,EACrB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CACpC,CAAC;IAEF,MAAM,OAAO,GAAiC,EAAE,CAAC;IAEjD,IAAI,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,aAAa,EAAE,CAAC;QAExD,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,gBAAgB,CACxD,aAAa,CAAC,aAAa,CAC1B,kBAAkB,CAAC,aAAa,CAAC,GAAG,EACpC,UAAU,EAAE,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAC5C,EACD,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EACzB,MAAM,CACN,CAAC;IACH,CAAC;IAED,OAAO;QACN,OAAO;QACP,IAAI,EAAE,MAAM,CAAC,QAAQ;KACrB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tHttpContextIdKeys,\n\tHttpParameterHelper,\n\tHttpUrlHelper,\n\ttype ICreatedResponse,\n\ttype IHttpRequestContext,\n\ttype INoContentResponse,\n\ttype IRestRoute,\n\ttype ITag\n} from \"@twin.org/api-models\";\nimport { ContextIdStore } from \"@twin.org/context\";\nimport { Coerce, ComponentFactory, Guards, Is } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tPOLICY_METADATA_CONTEXT,\n\ttype IPapCreateRequest,\n\ttype IPapGetAgreementRequest,\n\ttype IPapGetAgreementResponse,\n\ttype IPapGetOfferRequest,\n\ttype IPapGetOfferResponse,\n\ttype IPapGetRequest,\n\ttype IPapGetResponse,\n\ttype IPapGetSetRequest,\n\ttype IPapGetSetResponse,\n\ttype IPapQueryRequest,\n\ttype IPapQueryResponse,\n\ttype IPapRemoveRequest,\n\ttype IPapUpdateRequest,\n\ttype IPolicyAdministrationPointComponent\n} from \"@twin.org/rights-management-models\";\nimport { OdrlContexts, OdrlPolicyType, type OdrlContextType } from \"@twin.org/standards-w3c-odrl\";\nimport { HeaderHelper, HeaderTypes, HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"policyAdministrationPointRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const papTags: ITag[] = [\n\t{\n\t\tname: \"Policy Administration Point\",\n\t\tdescription: \"Endpoints for managing ODRL policies in the Policy Administration Point\"\n\t}\n];\n\n/**\n * Example JSON-LD context returned by PAP read endpoints for policies with metadata timestamps.\n * Uses `POLICY_METADATA_CONTEXT` from rights-management-models merged with ODRL context.\n */\nconst PAP_POLICY_RESPONSE_CONTEXT: OdrlContextType = [\n\tOdrlContexts.Context,\n\tPOLICY_METADATA_CONTEXT\n];\n\n/**\n * The REST routes for the Policy Administration Point.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesPolicyAdministrationPoint(\n\tbaseRouteName: string,\n\tcomponentName: string\n): IRestRoute[] {\n\tconst papPolicyExampleLifecycle = {\n\t\tdateCreated: \"2025-09-03T00:00:00.000Z\",\n\t\tdateModified: \"2025-09-03T00:00:00.000Z\"\n\t};\n\n\tconst papCreateRoute: IRestRoute<IPapCreateRequest, ICreatedResponse> = {\n\t\toperationId: \"papCreate\",\n\t\tsummary: \"Create a policy\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/policy/admin`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapCreate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapCreateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papCreateRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": OdrlContexts.Context,\n\t\t\t\t\t\t\t\"@type\": OdrlPolicyType.Set,\n\t\t\t\t\t\t\tpermission: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttarget: \"http://example.com/asset/1\",\n\t\t\t\t\t\t\t\t\taction: \"use\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<ICreatedResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"papCreateResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tstatusCode: 201,\n\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\tlocation: \"urn:rights-management:abc123def456\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst papUpdateRoute: IRestRoute<IPapUpdateRequest, INoContentResponse> = {\n\t\toperationId: \"papUpdate\",\n\t\tsummary: \"Update a policy\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"PUT\",\n\t\tpath: `${baseRouteName}/policy/admin/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapUpdate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapUpdateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papUpdateRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:rights-management:abc123def456\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": OdrlContexts.Context,\n\t\t\t\t\t\t\t\"@type\": OdrlPolicyType.Set,\n\t\t\t\t\t\t\t\"@id\": \"urn:rights-management:abc123def456\",\n\t\t\t\t\t\t\tpermission: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttarget: \"http://example.com/asset/2\",\n\t\t\t\t\t\t\t\t\taction: \"read\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst papGetRoute: IRestRoute<IPapGetRequest, IPapGetResponse> = {\n\t\toperationId: \"papGet\",\n\t\tsummary: \"Get a policy\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/policy/admin/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapGet(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapGetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papGetRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:rights-management:abc123def456\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPapGetResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"papGetResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": PAP_POLICY_RESPONSE_CONTEXT,\n\t\t\t\t\t\t\t\t\"@type\": OdrlPolicyType.Set,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:rights-management:abc123def456\",\n\t\t\t\t\t\t\t\t...papPolicyExampleLifecycle,\n\t\t\t\t\t\t\t\tpermission: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttarget: \"http://example.com/asset/1\",\n\t\t\t\t\t\t\t\t\t\taction: \"use\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst papGetAgreementRoute: IRestRoute<IPapGetAgreementRequest, IPapGetAgreementResponse> = {\n\t\toperationId: \"papGetAgreement\",\n\t\tsummary: \"Get a policy agreement\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/policy/admin/agreement/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapGetAgreement(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapGetAgreementRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papGetAgreementRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:rights-management:abc123def456\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPapGetAgreementResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"papGetResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": PAP_POLICY_RESPONSE_CONTEXT,\n\t\t\t\t\t\t\t\t\"@type\": OdrlPolicyType.Agreement,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:rights-management:abc123def456\",\n\t\t\t\t\t\t\t\t...papPolicyExampleLifecycle,\n\t\t\t\t\t\t\t\tpermission: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttarget: \"http://example.com/asset/1\",\n\t\t\t\t\t\t\t\t\t\taction: \"use\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tassignee: \"did:example:receiver\",\n\t\t\t\t\t\t\t\tassigner: \"did:example:sender\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst papGetOfferRoute: IRestRoute<IPapGetOfferRequest, IPapGetOfferResponse> = {\n\t\toperationId: \"papGetOffer\",\n\t\tsummary: \"Get a policy offer\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/policy/admin/offer/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapGetOffer(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapGetOfferRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papGetOfferRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:rights-management:abc123def456\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPapGetOfferResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"papGetResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": PAP_POLICY_RESPONSE_CONTEXT,\n\t\t\t\t\t\t\t\t\"@type\": OdrlPolicyType.Offer,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:rights-management:abc123def456\",\n\t\t\t\t\t\t\t\t...papPolicyExampleLifecycle,\n\t\t\t\t\t\t\t\tpermission: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttarget: \"http://example.com/asset/1\",\n\t\t\t\t\t\t\t\t\t\taction: \"use\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tassignee: \"did:example:receiver\",\n\t\t\t\t\t\t\t\tassigner: \"did:example:sender\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst papGetSetRoute: IRestRoute<IPapGetSetRequest, IPapGetSetResponse> = {\n\t\toperationId: \"papGetSet\",\n\t\tsummary: \"Get a policy set\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/policy/admin/set/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapGetSet(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapGetSetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papGetSetRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:rights-management:abc123def456\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPapGetSetResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"papGetResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": PAP_POLICY_RESPONSE_CONTEXT,\n\t\t\t\t\t\t\t\t\"@type\": OdrlPolicyType.Set,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:rights-management:abc123def456\",\n\t\t\t\t\t\t\t\t...papPolicyExampleLifecycle,\n\t\t\t\t\t\t\t\tpermission: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttarget: \"http://example.com/asset/1\",\n\t\t\t\t\t\t\t\t\t\taction: \"use\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tassignee: \"did:example:receiver\",\n\t\t\t\t\t\t\t\tassigner: \"did:example:sender\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst papRemoveRoute: IRestRoute<IPapRemoveRequest, INoContentResponse> = {\n\t\toperationId: \"papRemove\",\n\t\tsummary: \"Remove a policy\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"DELETE\",\n\t\tpath: `${baseRouteName}/policy/admin/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapRemove(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapRemoveRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papRemoveRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:rights-management:abc123def456\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst papQueryRoute: IRestRoute<IPapQueryRequest, IPapQueryResponse> = {\n\t\toperationId: \"papQuery\",\n\t\tsummary: \"Query policies\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/policy/admin`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapQuery(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapQueryRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papQueryRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tcursor: \"optional-pagination-cursor\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPapQueryResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"papQueryResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"@context\": PAP_POLICY_RESPONSE_CONTEXT,\n\t\t\t\t\t\t\t\t\t\"@type\": OdrlPolicyType.Set,\n\t\t\t\t\t\t\t\t\t\"@id\": \"urn:rights-management:abc123def456\",\n\t\t\t\t\t\t\t\t\t...papPolicyExampleLifecycle,\n\t\t\t\t\t\t\t\t\tpermission: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\ttarget: \"http://example.com/asset/1\",\n\t\t\t\t\t\t\t\t\t\t\taction: \"use\"\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\treturn [\n\t\tpapCreateRoute,\n\t\tpapUpdateRoute,\n\t\tpapGetRoute,\n\t\tpapGetAgreementRoute,\n\t\tpapGetOfferRoute,\n\t\tpapGetSetRoute,\n\t\tpapRemoveRoute,\n\t\tpapQueryRoute\n\t];\n}\n\n/**\n * PAP: Create a policy.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function papCreate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapCreateRequest\n): Promise<ICreatedResponse> {\n\tGuards.object<IPapCreateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPapCreateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\n\tconst policy = request.body;\n\tconst uid = await component.create(policy);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.created,\n\t\theaders: {\n\t\t\tlocation: uid\n\t\t}\n\t};\n}\n\n/**\n * PAP: Update a policy.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function papUpdate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapUpdateRequest\n): Promise<INoContentResponse> {\n\tGuards.object(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object(ROUTES_SOURCE, nameof(request.pathParams), request.pathParams);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\tGuards.object(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\tawait component.update(request.body);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * PAP: Get a policy.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function papGet(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapGetRequest\n): Promise<IPapGetResponse> {\n\tGuards.object<IPapGetRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPapGetRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\tconst policy = await component.get(request.pathParams.id);\n\n\treturn {\n\t\tbody: policy\n\t};\n}\n\n/**\n * PAP: Get a agreement.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function papGetAgreement(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapGetAgreementRequest\n): Promise<IPapGetAgreementResponse> {\n\tGuards.object<IPapGetAgreementRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPapGetAgreementRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\tconst policy = await component.getAgreement(request.pathParams.id);\n\n\treturn {\n\t\tbody: policy\n\t};\n}\n\n/**\n * PAP: Get an offer.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function papGetOffer(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapGetOfferRequest\n): Promise<IPapGetOfferResponse> {\n\tGuards.object<IPapGetOfferRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPapGetOfferRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\tconst policy = await component.getOffer(request.pathParams.id);\n\n\treturn {\n\t\tbody: policy\n\t};\n}\n\n/**\n * PAP: Get a set.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function papGetSet(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapGetSetRequest\n): Promise<IPapGetSetResponse> {\n\tGuards.object<IPapGetSetRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPapGetSetRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\tconst policy = await component.getSet(request.pathParams.id);\n\n\treturn {\n\t\tbody: policy\n\t};\n}\n\n/**\n * PAP: Remove a policy.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function papRemove(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapRemoveRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IPapRemoveRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPapRemoveRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\tawait component.remove(request.pathParams.id);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * PAP: Query policies.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function papQuery(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapQueryRequest\n): Promise<IPapQueryResponse> {\n\tGuards.object<IPapQueryRequest>(ROUTES_SOURCE, nameof(request), request);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\tconst result = await component.query(\n\t\t{\n\t\t\tassigner: request.query?.assigner,\n\t\t\tassignee: request.query?.assignee,\n\t\t\ttarget: request.query?.target,\n\t\t\taction: request.query?.action\n\t\t},\n\t\tHttpParameterHelper.objectFromString(request.query?.conditions),\n\t\trequest.query?.cursor,\n\t\tCoerce.integer(request.query?.limit)\n\t);\n\n\tconst headers: IPapQueryResponse[\"headers\"] = {};\n\n\tif (Is.stringValue(result.cursor)) {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\n\t\theaders[HeaderTypes.Link] = HeaderHelper.createLinkHeader(\n\t\t\tHttpUrlHelper.replaceOrigin(\n\t\t\t\thttpRequestContext.serverRequest.url,\n\t\t\t\tcontextIds?.[HttpContextIdKeys.PublicOrigin]\n\t\t\t),\n\t\t\t{ cursor: result.cursor },\n\t\t\t\"next\"\n\t\t);\n\t}\n\n\treturn {\n\t\theaders,\n\t\tbody: result.policies\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"policyAdministrationPointRoutes.js","sourceRoot":"","sources":["../../src/policyAdministrationPointRoutes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EAMb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,gBAAg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AC/D,OAAO,CAAC,KAAK,EAAE,MAAM,EACrB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CACpC,CAAC;IAEF,MAAM,OAAO,GAAiC,EAAE,CAAC;IAEjD,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,aAAa,EAAE,CAAC;IACxD,gBAAgB,CAAC,WAAW,CAC3B,OAAO,EACP,kBAAkB,CAAC,aAAa,CAAC,GAAG,EACpC,UAAU,EAAE,CAAC,iBAAiB,CAAC,YAAY,CAAC,EAC5C,MAAM,CAAC,MAAM,CACb,CAAC;IAEF,OAAO;QACN,OAAO;QACP,IAAI,EAAE,MAAM,CAAC,QAAQ;KACrB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tHttpContextIdKeys,\n\tHttpHeaderHelper,\n\tHttpParameterHelper,\n\tHttpUrlHelper,\n\ttype ICreatedResponse,\n\ttype IHttpRequestContext,\n\ttype INoContentResponse,\n\ttype IRestRoute,\n\ttype ITag\n} from \"@twin.org/api-models\";\nimport { ContextIdStore } from \"@twin.org/context\";\nimport { Coerce, ComponentFactory, Guards } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tPOLICY_METADATA_CONTEXT,\n\ttype IPapCreateRequest,\n\ttype IPapGetAgreementRequest,\n\ttype IPapGetAgreementResponse,\n\ttype IPapGetOfferRequest,\n\ttype IPapGetOfferResponse,\n\ttype IPapGetRequest,\n\ttype IPapGetResponse,\n\ttype IPapGetSetRequest,\n\ttype IPapGetSetResponse,\n\ttype IPapQueryRequest,\n\ttype IPapQueryResponse,\n\ttype IPapRemoveRequest,\n\ttype IPapUpdateRequest,\n\ttype IPolicyAdministrationPointComponent\n} from \"@twin.org/rights-management-models\";\nimport { OdrlContexts, OdrlPolicyType, type OdrlContextType } from \"@twin.org/standards-w3c-odrl\";\nimport { HttpStatusCode, type IHttpHeaders } from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"policyAdministrationPointRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const papTags: ITag[] = [\n\t{\n\t\tname: \"Policy Administration Point\",\n\t\tdescription: \"Endpoints for managing ODRL policies in the Policy Administration Point\"\n\t}\n];\n\n/**\n * Example JSON-LD context returned by PAP read endpoints for policies with metadata timestamps.\n * Uses `POLICY_METADATA_CONTEXT` from rights-management-models merged with ODRL context.\n */\nconst PAP_POLICY_RESPONSE_CONTEXT: OdrlContextType = [\n\tOdrlContexts.Context,\n\tPOLICY_METADATA_CONTEXT\n];\n\n/**\n * The REST routes for the Policy Administration Point.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesPolicyAdministrationPoint(\n\tbaseRouteName: string,\n\tcomponentName: string\n): IRestRoute[] {\n\tconst papPolicyExampleLifecycle = {\n\t\tdateCreated: \"2025-09-03T00:00:00.000Z\",\n\t\tdateModified: \"2025-09-03T00:00:00.000Z\"\n\t};\n\n\tconst papCreateRoute: IRestRoute<IPapCreateRequest, ICreatedResponse> = {\n\t\toperationId: \"papCreate\",\n\t\tsummary: \"Create a policy\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/policy/admin`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapCreate(httpRequestContext, componentName, request, baseRouteName),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapCreateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papCreateRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": OdrlContexts.Context,\n\t\t\t\t\t\t\t\"@type\": OdrlPolicyType.Set,\n\t\t\t\t\t\t\tpermission: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttarget: \"http://example.com/asset/1\",\n\t\t\t\t\t\t\t\t\taction: \"use\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<ICreatedResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"papCreateResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tstatusCode: 201,\n\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\tlocation: \"urn:rights-management:abc123def456\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst papUpdateRoute: IRestRoute<IPapUpdateRequest, INoContentResponse> = {\n\t\toperationId: \"papUpdate\",\n\t\tsummary: \"Update a policy\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"PUT\",\n\t\tpath: `${baseRouteName}/policy/admin/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapUpdate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapUpdateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papUpdateRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:rights-management:abc123def456\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": OdrlContexts.Context,\n\t\t\t\t\t\t\t\"@type\": OdrlPolicyType.Set,\n\t\t\t\t\t\t\t\"@id\": \"urn:rights-management:abc123def456\",\n\t\t\t\t\t\t\tpermission: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttarget: \"http://example.com/asset/2\",\n\t\t\t\t\t\t\t\t\taction: \"read\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst papGetRoute: IRestRoute<IPapGetRequest, IPapGetResponse> = {\n\t\toperationId: \"papGet\",\n\t\tsummary: \"Get a policy\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/policy/admin/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapGet(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapGetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papGetRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:rights-management:abc123def456\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPapGetResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"papGetResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": PAP_POLICY_RESPONSE_CONTEXT,\n\t\t\t\t\t\t\t\t\"@type\": OdrlPolicyType.Set,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:rights-management:abc123def456\",\n\t\t\t\t\t\t\t\t...papPolicyExampleLifecycle,\n\t\t\t\t\t\t\t\tpermission: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttarget: \"http://example.com/asset/1\",\n\t\t\t\t\t\t\t\t\t\taction: \"use\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst papGetAgreementRoute: IRestRoute<IPapGetAgreementRequest, IPapGetAgreementResponse> = {\n\t\toperationId: \"papGetAgreement\",\n\t\tsummary: \"Get a policy agreement\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/policy/admin/agreement/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapGetAgreement(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapGetAgreementRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papGetAgreementRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:rights-management:abc123def456\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPapGetAgreementResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"papGetResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": PAP_POLICY_RESPONSE_CONTEXT,\n\t\t\t\t\t\t\t\t\"@type\": OdrlPolicyType.Agreement,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:rights-management:abc123def456\",\n\t\t\t\t\t\t\t\t...papPolicyExampleLifecycle,\n\t\t\t\t\t\t\t\tpermission: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttarget: \"http://example.com/asset/1\",\n\t\t\t\t\t\t\t\t\t\taction: \"use\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tassignee: \"did:example:receiver\",\n\t\t\t\t\t\t\t\tassigner: \"did:example:sender\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst papGetOfferRoute: IRestRoute<IPapGetOfferRequest, IPapGetOfferResponse> = {\n\t\toperationId: \"papGetOffer\",\n\t\tsummary: \"Get a policy offer\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/policy/admin/offer/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapGetOffer(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapGetOfferRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papGetOfferRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:rights-management:abc123def456\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPapGetOfferResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"papGetResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": PAP_POLICY_RESPONSE_CONTEXT,\n\t\t\t\t\t\t\t\t\"@type\": OdrlPolicyType.Offer,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:rights-management:abc123def456\",\n\t\t\t\t\t\t\t\t...papPolicyExampleLifecycle,\n\t\t\t\t\t\t\t\tpermission: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttarget: \"http://example.com/asset/1\",\n\t\t\t\t\t\t\t\t\t\taction: \"use\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tassignee: \"did:example:receiver\",\n\t\t\t\t\t\t\t\tassigner: \"did:example:sender\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst papGetSetRoute: IRestRoute<IPapGetSetRequest, IPapGetSetResponse> = {\n\t\toperationId: \"papGetSet\",\n\t\tsummary: \"Get a policy set\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/policy/admin/set/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapGetSet(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapGetSetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papGetSetRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:rights-management:abc123def456\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPapGetSetResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"papGetResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": PAP_POLICY_RESPONSE_CONTEXT,\n\t\t\t\t\t\t\t\t\"@type\": OdrlPolicyType.Set,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:rights-management:abc123def456\",\n\t\t\t\t\t\t\t\t...papPolicyExampleLifecycle,\n\t\t\t\t\t\t\t\tpermission: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttarget: \"http://example.com/asset/1\",\n\t\t\t\t\t\t\t\t\t\taction: \"use\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tassignee: \"did:example:receiver\",\n\t\t\t\t\t\t\t\tassigner: \"did:example:sender\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst papRemoveRoute: IRestRoute<IPapRemoveRequest, INoContentResponse> = {\n\t\toperationId: \"papRemove\",\n\t\tsummary: \"Remove a policy\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"DELETE\",\n\t\tpath: `${baseRouteName}/policy/admin/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapRemove(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapRemoveRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papRemoveRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:rights-management:abc123def456\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst papQueryRoute: IRestRoute<IPapQueryRequest, IPapQueryResponse> = {\n\t\toperationId: \"papQuery\",\n\t\tsummary: \"Query policies\",\n\t\ttag: papTags[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/policy/admin`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpapQuery(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPapQueryRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"papQueryRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tcursor: \"optional-pagination-cursor\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPapQueryResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"papQueryResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"@context\": PAP_POLICY_RESPONSE_CONTEXT,\n\t\t\t\t\t\t\t\t\t\"@type\": OdrlPolicyType.Set,\n\t\t\t\t\t\t\t\t\t\"@id\": \"urn:rights-management:abc123def456\",\n\t\t\t\t\t\t\t\t\t...papPolicyExampleLifecycle,\n\t\t\t\t\t\t\t\t\tpermission: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\ttarget: \"http://example.com/asset/1\",\n\t\t\t\t\t\t\t\t\t\t\taction: \"use\"\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\treturn [\n\t\tpapCreateRoute,\n\t\tpapUpdateRoute,\n\t\tpapGetRoute,\n\t\tpapGetAgreementRoute,\n\t\tpapGetOfferRoute,\n\t\tpapGetSetRoute,\n\t\tpapRemoveRoute,\n\t\tpapQueryRoute\n\t];\n}\n\n/**\n * PAP: Create a policy.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @param baseRouteName The base route name to use for generating the location header.\n * @returns The response object with additional http response properties.\n */\nexport async function papCreate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapCreateRequest,\n\tbaseRouteName: string\n): Promise<ICreatedResponse> {\n\tGuards.object<IPapCreateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPapCreateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\n\tconst policy = request.body;\n\tconst uid = await component.create(policy);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tconst publicOrigin = contextIds?.[HttpContextIdKeys.PublicOrigin];\n\n\tconst headers: IHttpHeaders = {};\n\tHttpHeaderHelper.buildId(\n\t\theaders,\n\t\tuid,\n\t\tHttpUrlHelper.combineOriginPath(publicOrigin, `${baseRouteName}/policy/admin/:id`)\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.created,\n\t\theaders: {\n\t\t\tlocation: uid\n\t\t}\n\t};\n}\n\n/**\n * PAP: Update a policy.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function papUpdate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapUpdateRequest\n): Promise<INoContentResponse> {\n\tGuards.object(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object(ROUTES_SOURCE, nameof(request.pathParams), request.pathParams);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\tGuards.object(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\tawait component.update(request.body);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * PAP: Get a policy.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function papGet(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapGetRequest\n): Promise<IPapGetResponse> {\n\tGuards.object<IPapGetRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPapGetRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\tconst policy = await component.get(request.pathParams.id);\n\n\treturn {\n\t\tbody: policy\n\t};\n}\n\n/**\n * PAP: Get a agreement.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function papGetAgreement(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapGetAgreementRequest\n): Promise<IPapGetAgreementResponse> {\n\tGuards.object<IPapGetAgreementRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPapGetAgreementRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\tconst policy = await component.getAgreement(request.pathParams.id);\n\n\treturn {\n\t\tbody: policy\n\t};\n}\n\n/**\n * PAP: Get an offer.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function papGetOffer(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapGetOfferRequest\n): Promise<IPapGetOfferResponse> {\n\tGuards.object<IPapGetOfferRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPapGetOfferRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\tconst policy = await component.getOffer(request.pathParams.id);\n\n\treturn {\n\t\tbody: policy\n\t};\n}\n\n/**\n * PAP: Get a set.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function papGetSet(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapGetSetRequest\n): Promise<IPapGetSetResponse> {\n\tGuards.object<IPapGetSetRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPapGetSetRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\tconst policy = await component.getSet(request.pathParams.id);\n\n\treturn {\n\t\tbody: policy\n\t};\n}\n\n/**\n * PAP: Remove a policy.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function papRemove(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapRemoveRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IPapRemoveRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPapRemoveRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\tawait component.remove(request.pathParams.id);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * PAP: Query policies.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function papQuery(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPapQueryRequest\n): Promise<IPapQueryResponse> {\n\tGuards.object<IPapQueryRequest>(ROUTES_SOURCE, nameof(request), request);\n\n\tconst component = ComponentFactory.get<IPolicyAdministrationPointComponent>(componentName);\n\tconst result = await component.query(\n\t\t{\n\t\t\tassigner: request.query?.assigner,\n\t\t\tassignee: request.query?.assignee,\n\t\t\ttarget: request.query?.target,\n\t\t\taction: request.query?.action\n\t\t},\n\t\tHttpParameterHelper.objectFromString(request.query?.conditions),\n\t\trequest.query?.cursor,\n\t\tCoerce.integer(request.query?.limit)\n\t);\n\n\tconst headers: IPapQueryResponse[\"headers\"] = {};\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tHttpHeaderHelper.buildCursor(\n\t\theaders,\n\t\thttpRequestContext.serverRequest.url,\n\t\tcontextIds?.[HttpContextIdKeys.PublicOrigin],\n\t\tresult.cursor\n\t);\n\n\treturn {\n\t\theaders,\n\t\tbody: result.policies\n\t};\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Copyright 2025 IOTA Stiftung.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
-
import { HttpContextIdKeys, HttpUrlHelper } from "@twin.org/api-models";
|
|
3
|
+
import { HttpContextIdKeys, HttpHeaderHelper, HttpUrlHelper } from "@twin.org/api-models";
|
|
4
4
|
import { ContextIdStore } from "@twin.org/context";
|
|
5
|
-
import { ComponentFactory, Guards
|
|
5
|
+
import { ComponentFactory, Guards } from "@twin.org/core";
|
|
6
6
|
import { DataspaceProtocolContractNegotiationStateType } from "@twin.org/standards-dataspace-protocol";
|
|
7
|
-
import {
|
|
7
|
+
import { HeaderTypes, HttpMethod, HttpStatusCode } from "@twin.org/web";
|
|
8
8
|
/**
|
|
9
9
|
* The source used when communicating about these routes.
|
|
10
10
|
*/
|
|
@@ -31,7 +31,7 @@ export function generateRestRoutesPolicyNegotiationAdminPoint(baseRouteName, com
|
|
|
31
31
|
tag: pnapTags[0].name,
|
|
32
32
|
method: HttpMethod.POST,
|
|
33
33
|
path: `${baseRouteName}/negotiations/admin`,
|
|
34
|
-
handler: async (httpRequestContext, request) => pnapCreate(httpRequestContext, componentName, request),
|
|
34
|
+
handler: async (httpRequestContext, request) => pnapCreate(httpRequestContext, componentName, request, baseRouteName),
|
|
35
35
|
requestType: {
|
|
36
36
|
type: "IPnapCreateRequest",
|
|
37
37
|
examples: [
|
|
@@ -197,18 +197,21 @@ export function generateRestRoutesPolicyNegotiationAdminPoint(baseRouteName, com
|
|
|
197
197
|
* @param httpRequestContext The request context for the API.
|
|
198
198
|
* @param componentName The name of the component to use in the routes.
|
|
199
199
|
* @param request The request.
|
|
200
|
+
* @param baseRouteName The base route name to use for the Location header.
|
|
200
201
|
* @returns The response object with additional http response properties.
|
|
201
202
|
*/
|
|
202
|
-
export async function pnapCreate(httpRequestContext, componentName, request) {
|
|
203
|
+
export async function pnapCreate(httpRequestContext, componentName, request, baseRouteName) {
|
|
203
204
|
Guards.object(ROUTES_SOURCE, "request", request);
|
|
204
205
|
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
205
206
|
const component = ComponentFactory.get(componentName);
|
|
206
207
|
const id = await component.create(request.body.id);
|
|
208
|
+
const contextIds = await ContextIdStore.getContextIds();
|
|
209
|
+
const publicOrigin = contextIds?.[HttpContextIdKeys.PublicOrigin];
|
|
210
|
+
const headers = {};
|
|
211
|
+
HttpHeaderHelper.buildId(headers, id, HttpUrlHelper.combineOriginPath(publicOrigin, `${baseRouteName}/negotiations/admin/:id`));
|
|
207
212
|
return {
|
|
208
213
|
statusCode: HttpStatusCode.created,
|
|
209
|
-
headers
|
|
210
|
-
[HeaderTypes.Location]: id
|
|
211
|
-
}
|
|
214
|
+
headers
|
|
212
215
|
};
|
|
213
216
|
}
|
|
214
217
|
/**
|
|
@@ -275,10 +278,8 @@ export async function pnapQuery(httpRequestContext, componentName, request) {
|
|
|
275
278
|
const component = ComponentFactory.get(componentName);
|
|
276
279
|
const result = await component.query(request.query?.state, request.query?.cursor);
|
|
277
280
|
const headers = {};
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
headers[HeaderTypes.Link] = HeaderHelper.createLinkHeader(HttpUrlHelper.replaceOrigin(httpRequestContext.serverRequest.url, contextIds?.[HttpContextIdKeys.PublicOrigin]), { cursor: result.cursor }, "next");
|
|
281
|
-
}
|
|
281
|
+
const contextIds = await ContextIdStore.getContextIds();
|
|
282
|
+
HttpHeaderHelper.buildCursor(headers, httpRequestContext.serverRequest.url, contextIds?.[HttpContextIdKeys.PublicOrigin], result.cursor);
|
|
282
283
|
return {
|
|
283
284
|
headers,
|
|
284
285
|
body: result.items
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policyNegotiationAdminPointRoutes.js","sourceRoot":"","sources":["../../src/policyNegotiationAdminPointRoutes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,iBAAiB,EACjB,aAAa,EAMb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAY9D,OAAO,EAAE,6CAA6C,EAAE,MAAM,wCAAwC,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEtF;;GAEG;AACH,MAAM,aAAa,GAAG,mCAAmC,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAW;IAC/B;QACC,IAAI,EAAE,yCAAyC;QAC/C,WAAW,EACV,qFAAqF;KACtF;CACD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,6CAA6C,CAC5D,aAAqB,EACrB,aAAqB;IAErB,MAAM,eAAe,GAAqD;QACzE,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,uDAAuD;QAChE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI;QACrB,MAAM,EAAE,UAAU,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IAE1E,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAwC,aAAa,CAAC,CAAC;IAC7F,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAElF,MAAM,OAAO,GAAkC,EAAE,CAAC;IAElD,IAAI,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,aAAa,EAAE,CAAC;QACxD,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,gBAAgB,CACxD,aAAa,CAAC,aAAa,CAC1B,kBAAkB,CAAC,aAAa,CAAC,GAAG,EACpC,UAAU,EAAE,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAC5C,EACD,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EACzB,MAAM,CACN,CAAC;IACH,CAAC;IAED,OAAO;QACN,OAAO;QACP,IAAI,EAAE,MAAM,CAAC,KAAK;KAClB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tHttpContextIdKeys,\n\tHttpUrlHelper,\n\ttype ICreatedResponse,\n\ttype IHttpRequestContext,\n\ttype INoContentResponse,\n\ttype IRestRoute,\n\ttype ITag\n} from \"@twin.org/api-models\";\nimport { ContextIdStore } from \"@twin.org/context\";\nimport { ComponentFactory, Guards, Is } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type {\n\tIPnapCreateRequest,\n\tIPnapGetRequest,\n\tIPnapGetResponse,\n\tIPnapQueryRequest,\n\tIPnapQueryResponse,\n\tIPnapRemoveRequest,\n\tIPnapSetRequest,\n\tIPolicyNegotiationAdminPointComponent\n} from \"@twin.org/rights-management-models\";\nimport { DataspaceProtocolContractNegotiationStateType } from \"@twin.org/standards-dataspace-protocol\";\nimport { HeaderHelper, HeaderTypes, HttpMethod, HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"policyNegotiationAdminPointRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const pnapTags: ITag[] = [\n\t{\n\t\tname: \"Policy Negotiation Administration Point\",\n\t\tdescription:\n\t\t\t\"Endpoints for managing ODRL policies in the Policy Negotiation Administration Point\"\n\t}\n];\n\n/**\n * The REST routes for the Policy Negotiation Administration Point.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesPolicyNegotiationAdminPoint(\n\tbaseRouteName: string,\n\tcomponentName: string\n): IRestRoute[] {\n\tconst pnapCreateRoute: IRestRoute<IPnapCreateRequest, ICreatedResponse> = {\n\t\toperationId: \"pnapCreate\",\n\t\tsummary: \"Pre-register a consumer-side policy negotiation entry\",\n\t\ttag: pnapTags[0].name,\n\t\tmethod: HttpMethod.POST,\n\t\tpath: `${baseRouteName}/negotiations/admin`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnapCreate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnapCreateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnapCreateRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:consumer-pid\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<ICreatedResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnapCreateResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tstatusCode: 201,\n\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\t[HeaderTypes.Location]:\n\t\t\t\t\t\t\t\t\t\"urn:contract-negotiation:01970000-0000-7000-8000-000000000000\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst pnapGetRoute: IRestRoute<IPnapGetRequest, IPnapGetResponse> = {\n\t\toperationId: \"pnapGet\",\n\t\tsummary: \"Get a policy negotiation\",\n\t\ttag: pnapTags[0].name,\n\t\tmethod: HttpMethod.GET,\n\t\tpath: `${baseRouteName}/negotiations/admin/:policyId`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnapGet(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnapGetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnapGetRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: { policyId: \"policy-1\" }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnapGetResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnapGetResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tid: \"pid\",\n\t\t\t\t\t\t\t\tcorrelationId: \"cid\",\n\t\t\t\t\t\t\t\tdateCreated: \"2025-09-03T00:00:00.000Z\",\n\t\t\t\t\t\t\t\tstate: DataspaceProtocolContractNegotiationStateType.REQUESTED,\n\t\t\t\t\t\t\t\torganizationIdentity: \"did:iota:123456789abcdefghi\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst pnapSetRoute: IRestRoute<IPnapSetRequest, INoContentResponse> = {\n\t\toperationId: \"pnapSet\",\n\t\tsummary: \"Set a policy negotiation\",\n\t\ttag: pnapTags[0].name,\n\t\tmethod: HttpMethod.PUT,\n\t\tpath: `${baseRouteName}/negotiations/admin/:policyId`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnapSet(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnapSetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnapSetRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: { policyId: \"policy-1\" },\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tid: \"pid\",\n\t\t\t\t\t\t\tcorrelationId: \"cid\",\n\t\t\t\t\t\t\tdateCreated: \"2025-09-03T00:00:00.000Z\",\n\t\t\t\t\t\t\tstate: DataspaceProtocolContractNegotiationStateType.REQUESTED,\n\t\t\t\t\t\t\torganizationIdentity: \"did:iota:123456789abcdefghi\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [{ type: nameof<INoContentResponse>() }]\n\t};\n\n\tconst pnapRemoveRoute: IRestRoute<IPnapRemoveRequest, INoContentResponse> = {\n\t\toperationId: \"pnapRemove\",\n\t\tsummary: \"Remove a policy negotiation\",\n\t\ttag: pnapTags[0].name,\n\t\tmethod: HttpMethod.DELETE,\n\t\tpath: `${baseRouteName}/negotiations/admin/:policyId`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnapRemove(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnapRemoveRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnapRemoveRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: { policyId: \"policy-1\" }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [{ type: nameof<INoContentResponse>() }]\n\t};\n\n\tconst pnapQueryRoute: IRestRoute<IPnapQueryRequest, IPnapQueryResponse> = {\n\t\toperationId: \"pnapQuery\",\n\t\tsummary: \"Query policy negotiations\",\n\t\ttag: pnapTags[0].name,\n\t\tmethod: HttpMethod.GET,\n\t\tpath: `${baseRouteName}/negotiations/admin`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnapQuery(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnapQueryRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnapQueryRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tstate: DataspaceProtocolContractNegotiationStateType.ACCEPTED,\n\t\t\t\t\t\t\tcursor: \"next-cursor\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnapQueryResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnapQueryResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: \"pid\",\n\t\t\t\t\t\t\t\t\tcorrelationId: \"cid\",\n\t\t\t\t\t\t\t\t\tdateCreated: \"2025-09-03T00:00:00.000Z\",\n\t\t\t\t\t\t\t\t\tstate: DataspaceProtocolContractNegotiationStateType.REQUESTED,\n\t\t\t\t\t\t\t\t\torganizationIdentity: \"did:iota:123456789abcdefghi\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\treturn [pnapCreateRoute, pnapGetRoute, pnapSetRoute, pnapRemoveRoute, pnapQueryRoute];\n}\n\n/**\n * PNAP: Pre-register a consumer-side policy negotiation entry.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnapCreate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnapCreateRequest\n): Promise<ICreatedResponse> {\n\tGuards.object<IPnapCreateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnapCreateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationAdminPointComponent>(componentName);\n\tconst id = await component.create(request.body.id);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.created,\n\t\theaders: {\n\t\t\t[HeaderTypes.Location]: id\n\t\t}\n\t};\n}\n\n/**\n * PNAP: Get a policy negotiation.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnapGet(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnapGetRequest\n): Promise<IPnapGetResponse> {\n\tGuards.object<IPnapGetRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object(ROUTES_SOURCE, nameof(request.pathParams), request.pathParams);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams.policyId),\n\t\trequest.pathParams.policyId\n\t);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationAdminPointComponent>(componentName);\n\tconst negotiation = await component.get(request.pathParams.policyId);\n\n\treturn {\n\t\tbody: negotiation\n\t};\n}\n\n/**\n * PNAP: Set a policy negotiation.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnapSet(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnapSetRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IPnapSetRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object(ROUTES_SOURCE, nameof(request.pathParams), request.pathParams);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams.policyId),\n\t\trequest.pathParams.policyId\n\t);\n\tGuards.object(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationAdminPointComponent>(componentName);\n\tawait component.set(request.body);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * PNAP: Remove a policy negotiation.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnapRemove(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnapRemoveRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IPnapRemoveRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object(ROUTES_SOURCE, nameof(request.pathParams), request.pathParams);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams.policyId),\n\t\trequest.pathParams.policyId\n\t);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationAdminPointComponent>(componentName);\n\tawait component.remove(request.pathParams.policyId);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * PNAP: Query policy negotiations.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnapQuery(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnapQueryRequest\n): Promise<IPnapQueryResponse> {\n\tGuards.object<IPnapQueryRequest>(ROUTES_SOURCE, nameof(request), request);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationAdminPointComponent>(componentName);\n\tconst result = await component.query(request.query?.state, request.query?.cursor);\n\n\tconst headers: IPnapQueryResponse[\"headers\"] = {};\n\n\tif (Is.stringValue(result.cursor)) {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\theaders[HeaderTypes.Link] = HeaderHelper.createLinkHeader(\n\t\t\tHttpUrlHelper.replaceOrigin(\n\t\t\t\thttpRequestContext.serverRequest.url,\n\t\t\t\tcontextIds?.[HttpContextIdKeys.PublicOrigin]\n\t\t\t),\n\t\t\t{ cursor: result.cursor },\n\t\t\t\"next\"\n\t\t);\n\t}\n\n\treturn {\n\t\theaders,\n\t\tbody: result.items\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"policyNegotiationAdminPointRoutes.js","sourceRoot":"","sources":["../../src/policyNegotiationAdminPointRoutes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EAMb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAY1D,OAAO,EAAE,6CAA6C,EAAE,MAAM,wCAAwC,CAAC;AACvG,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAqB,MAAM,eAAe,CAAC;AAE3F;;GAEG;AACH,MAAM,aAAa,GAAG,mCAAmC,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAW;IAC/B;QACC,IAAI,EAAE,yCAAyC;QAC/C,WAAW,EACV,qFAAqF;KACtF;CACD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,6CAA6C,CAC5D,aAAqB,EACrB,aAAqB;IAErB,MAAM,eAAe,GAAqD;QACzE,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,uDAAuD;QAChE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI;QACrB,MAAM,EAAE,UAAU,CAAC,IAAI;QACvB,IAAI,EAAE,GAAG,aAAa,qBAAqB;QAC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ACN,UAAU,EAAE,cAAc,CAAC,SAAS;KACpC,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC9B,kBAAuC,EACvC,aAAqB,EACrB,OAA0B;IAE1B,MAAM,CAAC,MAAM,CAAoB,aAAa,aAAmB,OAAO,CAAC,CAAC;IAE1E,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAwC,aAAa,CAAC,CAAC;IAC7F,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAElF,MAAM,OAAO,GAAkC,EAAE,CAAC;IAElD,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,aAAa,EAAE,CAAC;IACxD,gBAAgB,CAAC,WAAW,CAC3B,OAAO,EACP,kBAAkB,CAAC,aAAa,CAAC,GAAG,EACpC,UAAU,EAAE,CAAC,iBAAiB,CAAC,YAAY,CAAC,EAC5C,MAAM,CAAC,MAAM,CACb,CAAC;IAEF,OAAO;QACN,OAAO;QACP,IAAI,EAAE,MAAM,CAAC,KAAK;KAClB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tHttpContextIdKeys,\n\tHttpHeaderHelper,\n\tHttpUrlHelper,\n\ttype ICreatedResponse,\n\ttype IHttpRequestContext,\n\ttype INoContentResponse,\n\ttype IRestRoute,\n\ttype ITag\n} from \"@twin.org/api-models\";\nimport { ContextIdStore } from \"@twin.org/context\";\nimport { ComponentFactory, Guards } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type {\n\tIPnapCreateRequest,\n\tIPnapGetRequest,\n\tIPnapGetResponse,\n\tIPnapQueryRequest,\n\tIPnapQueryResponse,\n\tIPnapRemoveRequest,\n\tIPnapSetRequest,\n\tIPolicyNegotiationAdminPointComponent\n} from \"@twin.org/rights-management-models\";\nimport { DataspaceProtocolContractNegotiationStateType } from \"@twin.org/standards-dataspace-protocol\";\nimport { HeaderTypes, HttpMethod, HttpStatusCode, type IHttpHeaders } from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"policyNegotiationAdminPointRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const pnapTags: ITag[] = [\n\t{\n\t\tname: \"Policy Negotiation Administration Point\",\n\t\tdescription:\n\t\t\t\"Endpoints for managing ODRL policies in the Policy Negotiation Administration Point\"\n\t}\n];\n\n/**\n * The REST routes for the Policy Negotiation Administration Point.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesPolicyNegotiationAdminPoint(\n\tbaseRouteName: string,\n\tcomponentName: string\n): IRestRoute[] {\n\tconst pnapCreateRoute: IRestRoute<IPnapCreateRequest, ICreatedResponse> = {\n\t\toperationId: \"pnapCreate\",\n\t\tsummary: \"Pre-register a consumer-side policy negotiation entry\",\n\t\ttag: pnapTags[0].name,\n\t\tmethod: HttpMethod.POST,\n\t\tpath: `${baseRouteName}/negotiations/admin`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnapCreate(httpRequestContext, componentName, request, baseRouteName),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnapCreateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnapCreateRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:consumer-pid\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<ICreatedResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnapCreateResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tstatusCode: 201,\n\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\t[HeaderTypes.Location]:\n\t\t\t\t\t\t\t\t\t\"urn:contract-negotiation:01970000-0000-7000-8000-000000000000\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst pnapGetRoute: IRestRoute<IPnapGetRequest, IPnapGetResponse> = {\n\t\toperationId: \"pnapGet\",\n\t\tsummary: \"Get a policy negotiation\",\n\t\ttag: pnapTags[0].name,\n\t\tmethod: HttpMethod.GET,\n\t\tpath: `${baseRouteName}/negotiations/admin/:policyId`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnapGet(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnapGetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnapGetRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: { policyId: \"policy-1\" }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnapGetResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnapGetResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tid: \"pid\",\n\t\t\t\t\t\t\t\tcorrelationId: \"cid\",\n\t\t\t\t\t\t\t\tdateCreated: \"2025-09-03T00:00:00.000Z\",\n\t\t\t\t\t\t\t\tstate: DataspaceProtocolContractNegotiationStateType.REQUESTED,\n\t\t\t\t\t\t\t\torganizationIdentity: \"did:iota:123456789abcdefghi\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst pnapSetRoute: IRestRoute<IPnapSetRequest, INoContentResponse> = {\n\t\toperationId: \"pnapSet\",\n\t\tsummary: \"Set a policy negotiation\",\n\t\ttag: pnapTags[0].name,\n\t\tmethod: HttpMethod.PUT,\n\t\tpath: `${baseRouteName}/negotiations/admin/:policyId`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnapSet(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnapSetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnapSetRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: { policyId: \"policy-1\" },\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tid: \"pid\",\n\t\t\t\t\t\t\tcorrelationId: \"cid\",\n\t\t\t\t\t\t\tdateCreated: \"2025-09-03T00:00:00.000Z\",\n\t\t\t\t\t\t\tstate: DataspaceProtocolContractNegotiationStateType.REQUESTED,\n\t\t\t\t\t\t\torganizationIdentity: \"did:iota:123456789abcdefghi\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [{ type: nameof<INoContentResponse>() }]\n\t};\n\n\tconst pnapRemoveRoute: IRestRoute<IPnapRemoveRequest, INoContentResponse> = {\n\t\toperationId: \"pnapRemove\",\n\t\tsummary: \"Remove a policy negotiation\",\n\t\ttag: pnapTags[0].name,\n\t\tmethod: HttpMethod.DELETE,\n\t\tpath: `${baseRouteName}/negotiations/admin/:policyId`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnapRemove(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnapRemoveRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnapRemoveRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: { policyId: \"policy-1\" }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [{ type: nameof<INoContentResponse>() }]\n\t};\n\n\tconst pnapQueryRoute: IRestRoute<IPnapQueryRequest, IPnapQueryResponse> = {\n\t\toperationId: \"pnapQuery\",\n\t\tsummary: \"Query policy negotiations\",\n\t\ttag: pnapTags[0].name,\n\t\tmethod: HttpMethod.GET,\n\t\tpath: `${baseRouteName}/negotiations/admin`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnapQuery(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnapQueryRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnapQueryRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tstate: DataspaceProtocolContractNegotiationStateType.ACCEPTED,\n\t\t\t\t\t\t\tcursor: \"next-cursor\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnapQueryResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnapQueryResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: \"pid\",\n\t\t\t\t\t\t\t\t\tcorrelationId: \"cid\",\n\t\t\t\t\t\t\t\t\tdateCreated: \"2025-09-03T00:00:00.000Z\",\n\t\t\t\t\t\t\t\t\tstate: DataspaceProtocolContractNegotiationStateType.REQUESTED,\n\t\t\t\t\t\t\t\t\torganizationIdentity: \"did:iota:123456789abcdefghi\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\treturn [pnapCreateRoute, pnapGetRoute, pnapSetRoute, pnapRemoveRoute, pnapQueryRoute];\n}\n\n/**\n * PNAP: Pre-register a consumer-side policy negotiation entry.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @param baseRouteName The base route name to use for the Location header.\n * @returns The response object with additional http response properties.\n */\nexport async function pnapCreate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnapCreateRequest,\n\tbaseRouteName: string\n): Promise<ICreatedResponse> {\n\tGuards.object<IPnapCreateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnapCreateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationAdminPointComponent>(componentName);\n\tconst id = await component.create(request.body.id);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tconst publicOrigin = contextIds?.[HttpContextIdKeys.PublicOrigin];\n\n\tconst headers: IHttpHeaders = {};\n\tHttpHeaderHelper.buildId(\n\t\theaders,\n\t\tid,\n\t\tHttpUrlHelper.combineOriginPath(publicOrigin, `${baseRouteName}/negotiations/admin/:id`)\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.created,\n\t\theaders\n\t};\n}\n\n/**\n * PNAP: Get a policy negotiation.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnapGet(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnapGetRequest\n): Promise<IPnapGetResponse> {\n\tGuards.object<IPnapGetRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object(ROUTES_SOURCE, nameof(request.pathParams), request.pathParams);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams.policyId),\n\t\trequest.pathParams.policyId\n\t);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationAdminPointComponent>(componentName);\n\tconst negotiation = await component.get(request.pathParams.policyId);\n\n\treturn {\n\t\tbody: negotiation\n\t};\n}\n\n/**\n * PNAP: Set a policy negotiation.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnapSet(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnapSetRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IPnapSetRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object(ROUTES_SOURCE, nameof(request.pathParams), request.pathParams);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams.policyId),\n\t\trequest.pathParams.policyId\n\t);\n\tGuards.object(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationAdminPointComponent>(componentName);\n\tawait component.set(request.body);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * PNAP: Remove a policy negotiation.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnapRemove(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnapRemoveRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IPnapRemoveRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object(ROUTES_SOURCE, nameof(request.pathParams), request.pathParams);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams.policyId),\n\t\trequest.pathParams.policyId\n\t);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationAdminPointComponent>(componentName);\n\tawait component.remove(request.pathParams.policyId);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * PNAP: Query policy negotiations.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnapQuery(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnapQueryRequest\n): Promise<IPnapQueryResponse> {\n\tGuards.object<IPnapQueryRequest>(ROUTES_SOURCE, nameof(request), request);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationAdminPointComponent>(componentName);\n\tconst result = await component.query(request.query?.state, request.query?.cursor);\n\n\tconst headers: IPnapQueryResponse[\"headers\"] = {};\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tHttpHeaderHelper.buildCursor(\n\t\theaders,\n\t\thttpRequestContext.serverRequest.url,\n\t\tcontextIds?.[HttpContextIdKeys.PublicOrigin],\n\t\tresult.cursor\n\t);\n\n\treturn {\n\t\theaders,\n\t\tbody: result.items\n\t};\n}\n"]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Copyright 2025 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { HttpHeaderHelper } from "@twin.org/api-models";
|
|
1
4
|
import { ComponentFactory, Guards, Is } from "@twin.org/core";
|
|
2
5
|
import { OdrlPolicyHelper } from "@twin.org/rights-management-models";
|
|
3
6
|
import { DataspaceProtocolContexts, DataspaceProtocolContractNegotiationEventType, DataspaceProtocolContractNegotiationStateType, DataspaceProtocolContractNegotiationTypes } from "@twin.org/standards-dataspace-protocol";
|
|
@@ -516,13 +519,11 @@ export async function pnpGetNegotiation(httpRequestContext, componentName, reque
|
|
|
516
519
|
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
517
520
|
const component = ComponentFactory.get(componentName);
|
|
518
521
|
const result = await component.getNegotiation(request.pathParams.id, HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
|
|
522
|
+
const headers = {};
|
|
523
|
+
HttpHeaderHelper.buildJsonContentType(headers, request.headers);
|
|
519
524
|
return {
|
|
520
525
|
statusCode: mapError(result),
|
|
521
|
-
headers
|
|
522
|
-
[HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd
|
|
523
|
-
? MimeTypes.JsonLd
|
|
524
|
-
: MimeTypes.Json
|
|
525
|
-
},
|
|
526
|
+
headers,
|
|
526
527
|
body: result
|
|
527
528
|
};
|
|
528
529
|
}
|
|
@@ -540,13 +541,11 @@ export async function pnpNegotiationRequest(httpRequestContext, componentName, r
|
|
|
540
541
|
const component = ComponentFactory.get(componentName);
|
|
541
542
|
const result = await component.requestFromConsumer(request.body, HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
|
|
542
543
|
const isUpdate = Is.stringValue(request.pathParams?.id);
|
|
544
|
+
const headers = {};
|
|
545
|
+
HttpHeaderHelper.buildJsonContentType(headers, request.headers);
|
|
543
546
|
return {
|
|
544
547
|
statusCode: mapError(result) ?? (isUpdate ? undefined : HttpStatusCode.created),
|
|
545
|
-
headers
|
|
546
|
-
[HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd
|
|
547
|
-
? MimeTypes.JsonLd
|
|
548
|
-
: MimeTypes.Json
|
|
549
|
-
},
|
|
548
|
+
headers,
|
|
550
549
|
body: result
|
|
551
550
|
};
|
|
552
551
|
}
|
|
@@ -564,13 +563,11 @@ export async function pnpNegotiationProviderEvents(httpRequestContext, component
|
|
|
564
563
|
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
565
564
|
const component = ComponentFactory.get(componentName);
|
|
566
565
|
const result = await component.event(request.body, request.pathParams.id === request.body.providerPid ? "provider" : "consumer", HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
|
|
566
|
+
const headers = {};
|
|
567
|
+
HttpHeaderHelper.buildJsonContentType(headers, request.headers);
|
|
567
568
|
return {
|
|
568
569
|
statusCode: mapError(result),
|
|
569
|
-
headers
|
|
570
|
-
[HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd
|
|
571
|
-
? MimeTypes.JsonLd
|
|
572
|
-
: MimeTypes.Json
|
|
573
|
-
},
|
|
570
|
+
headers,
|
|
574
571
|
body: result
|
|
575
572
|
};
|
|
576
573
|
}
|
|
@@ -588,13 +585,11 @@ export async function pnpNegotiationAgreementVerification(httpRequestContext, co
|
|
|
588
585
|
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
589
586
|
const component = ComponentFactory.get(componentName);
|
|
590
587
|
const result = await component.agreementVerificationFromConsumer(request.body, HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
|
|
588
|
+
const headers = {};
|
|
589
|
+
HttpHeaderHelper.buildJsonContentType(headers, request.headers);
|
|
591
590
|
return {
|
|
592
591
|
statusCode: mapError(result),
|
|
593
|
-
headers
|
|
594
|
-
[HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd
|
|
595
|
-
? MimeTypes.JsonLd
|
|
596
|
-
: MimeTypes.Json
|
|
597
|
-
},
|
|
592
|
+
headers,
|
|
598
593
|
body: result
|
|
599
594
|
};
|
|
600
595
|
}
|
|
@@ -612,13 +607,11 @@ export async function pnpNegotiationTermination(httpRequestContext, componentNam
|
|
|
612
607
|
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
613
608
|
const component = ComponentFactory.get(componentName);
|
|
614
609
|
const result = await component.terminate(request.body, request.pathParams.id === request.body.providerPid ? "provider" : "consumer", HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
|
|
610
|
+
const headers = {};
|
|
611
|
+
HttpHeaderHelper.buildJsonContentType(headers, request.headers);
|
|
615
612
|
return {
|
|
616
613
|
statusCode: mapError(result),
|
|
617
|
-
headers
|
|
618
|
-
[HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd
|
|
619
|
-
? MimeTypes.JsonLd
|
|
620
|
-
: MimeTypes.Json
|
|
621
|
-
},
|
|
614
|
+
headers,
|
|
622
615
|
body: result
|
|
623
616
|
};
|
|
624
617
|
}
|
|
@@ -636,13 +629,11 @@ export async function pnpNegotiationOffer(httpRequestContext, componentName, req
|
|
|
636
629
|
const component = ComponentFactory.get(componentName);
|
|
637
630
|
const result = await component.offerFromProvider(request.body, HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
|
|
638
631
|
const isUpdate = Is.stringValue(request.pathParams?.id);
|
|
632
|
+
const headers = {};
|
|
633
|
+
HttpHeaderHelper.buildJsonContentType(headers, request.headers);
|
|
639
634
|
return {
|
|
640
635
|
statusCode: mapError(result) ?? (isUpdate ? undefined : HttpStatusCode.created),
|
|
641
|
-
headers
|
|
642
|
-
[HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd
|
|
643
|
-
? MimeTypes.JsonLd
|
|
644
|
-
: MimeTypes.Json
|
|
645
|
-
},
|
|
636
|
+
headers,
|
|
646
637
|
body: result
|
|
647
638
|
};
|
|
648
639
|
}
|
|
@@ -660,13 +651,11 @@ export async function pnpNegotiationAgreement(httpRequestContext, componentName,
|
|
|
660
651
|
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
661
652
|
const component = ComponentFactory.get(componentName);
|
|
662
653
|
const result = await component.agreementFromProvider(request.body, HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
|
|
654
|
+
const headers = {};
|
|
655
|
+
HttpHeaderHelper.buildJsonContentType(headers, request.headers);
|
|
663
656
|
return {
|
|
664
657
|
statusCode: mapError(result),
|
|
665
|
-
headers
|
|
666
|
-
[HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd
|
|
667
|
-
? MimeTypes.JsonLd
|
|
668
|
-
: MimeTypes.Json
|
|
669
|
-
},
|
|
658
|
+
headers,
|
|
670
659
|
body: result
|
|
671
660
|
};
|
|
672
661
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policyNegotiationPointRoutes.js","sourceRoot":"","sources":["../../src/policyNegotiationPointRoutes.ts"],"names":[],"mappings":"AAGA,OAA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AAM;gBAClB,CAAC,CAAC,SAAS,CAAC,IAAI;SAClB;QACD,IAAI,EAAE,MAAM;KACZ,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IHttpRequestContext, IRestRoute, ITag } from \"@twin.org/api-models\";\nimport { ComponentFactory, Guards, Is } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\ttype IPnpAgreementRequest,\n\ttype IPnpAgreementVerificationRequest,\n\ttype IPnpContractNegotiationResponse,\n\ttype IPnpContractResponse,\n\ttype IPnpEventRequest,\n\ttype IPnpNegotiateRequest,\n\ttype IPnpNegotiationGetRequest,\n\ttype IPnpOfferRequest,\n\ttype IPnpTerminateRequest,\n\ttype IPolicyNegotiationPointComponent\n} from \"@twin.org/rights-management-models\";\nimport {\n\tDataspaceProtocolContexts,\n\tDataspaceProtocolContractNegotiationEventType,\n\tDataspaceProtocolContractNegotiationStateType,\n\tDataspaceProtocolContractNegotiationTypes,\n\ttype IDataspaceProtocolContractNegotiation,\n\ttype IDataspaceProtocolContractNegotiationError\n} from \"@twin.org/standards-dataspace-protocol\";\nimport { OdrlTypes } from \"@twin.org/standards-w3c-odrl\";\nimport { HeaderHelper, HeaderTypes, HttpStatusCode, MimeTypes } from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"policyNegotiationPointRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const pnpTags: ITag[] = [\n\t{\n\t\tname: \"Policy Negotiation Point\",\n\t\tdescription: \"Endpoints for managing ODRL policies in the Policy Negotiation Point\"\n\t}\n];\n\n/**\n * The REST routes for the Policy Negotiation Point.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesPolicyNegotiationPoint(\n\tbaseRouteName: string,\n\tcomponentName: string\n): IRestRoute[] {\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-get-provider\n\tconst pnpGetNegotiationRoute: IRestRoute<\n\t\tIPnpNegotiationGetRequest,\n\t\tIPnpContractNegotiationResponse\n\t> = {\n\t\toperationId: \"pnpGetNegotiation\",\n\t\tsummary: \"Get a negotiation\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/negotiations/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpGetNegotiation(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpNegotiationGetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpGetNegotiationRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:00aa11bb.......ffff\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractNegotiationResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnpGetNegotiationResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractNegotiation,\n\t\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:002aa11bb.......ffff\",\n\t\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\t\tstate: DataspaceProtocolContractNegotiationStateType.REQUESTED\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-providerpid-request-post\n\tconst pnpNegotiationRequestRoute: IRestRoute<\n\t\tIPnpNegotiateRequest,\n\t\tIPnpContractNegotiationResponse | IPnpContractResponse\n\t> = {\n\t\toperationId: \"pnpNegotiationRequest\",\n\t\tsummary: \"Negotiate a policy\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/request`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationRequest(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpNegotiateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractRequestMessage,\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\toffer: {\n\t\t\t\t\t\t\t\t\"@type\": OdrlTypes.Offer,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:offer-1\",\n\t\t\t\t\t\t\t\tassigner: \"urn:provider:node:1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractNegotiationResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"IPnpNegotiationRequestResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractNegotiation,\n\t\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\t\tstate: DataspaceProtocolContractNegotiationStateType.REQUESTED\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-providerpid-request-post\n\tconst pnpNegotiationProviderRequestRoute: IRestRoute<\n\t\tIPnpNegotiateRequest,\n\t\tIPnpContractNegotiationResponse | IPnpContractResponse\n\t> = {\n\t\toperationId: \"pnpNegotiationProviderRequest\",\n\t\tsummary: \"Negotiate a policy with an existing provider id\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/:id/request`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationRequest(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpNegotiateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationProviderRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:00aa11bb.......ffff\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractRequestMessage,\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\toffer: {\n\t\t\t\t\t\t\t\t\"@type\": OdrlTypes.Offer,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:offer-1\",\n\t\t\t\t\t\t\t\tassigner: \"urn:provider:node:1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"IPnpNegotiationProviderRequestResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-providerpid-events-post\n\tconst pnpNegotiationEventsRoute: IRestRoute<IPnpEventRequest, IPnpContractResponse> = {\n\t\toperationId: \"pnpNegotiationEvents\",\n\t\tsummary: \"Update the state of the negotiation\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/:id/events`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationProviderEvents(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpEventRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationEventsRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:00aa11bb.......ffff\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractNegotiationEventMessage,\n\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\tevent: DataspaceProtocolContractNegotiationEventType.ACCEPTED\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"IPnpNegotiationRequestResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-providerpid-agreement-verification-post\n\tconst pnpNegotiationAgreementVerificationRoute: IRestRoute<\n\t\tIPnpAgreementVerificationRequest,\n\t\tIPnpContractResponse\n\t> = {\n\t\toperationId: \"pnpNegotiationAgreementVerification\",\n\t\tsummary: \"Set the agreement to verified\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/:id/agreement/verification`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationAgreementVerification(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpAgreementVerificationRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationAgreementVerificationRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:00aa11bb.......ffff\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\":\n\t\t\t\t\t\t\t\tDataspaceProtocolContractNegotiationTypes.ContractAgreementVerificationMessage,\n\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"IPnpNegotiationAgreementVerificationResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-providerpid-termination-post\n\tconst pnpNegotiationTerminationRoute: IRestRoute<IPnpTerminateRequest, IPnpContractResponse> = {\n\t\toperationId: \"pnpNegotiationTermination\",\n\t\tsummary: \"Set the agreement to terminated\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/:id/termination`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationTermination(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpTerminateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationTerminationRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:00aa11bb.......ffff\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\":\n\t\t\t\t\t\t\t\tDataspaceProtocolContractNegotiationTypes.ContractNegotiationTerminationMessage,\n\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnpNegotiationTerminationResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-offers-post\n\tconst pnpNegotiationOfferRoute: IRestRoute<\n\t\tIPnpOfferRequest,\n\t\tIPnpContractNegotiationResponse | IPnpContractResponse\n\t> = {\n\t\toperationId: \"pnpNegotiationOffer\",\n\t\tsummary: \"Send the offer to the consumer\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/offers`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationOffer(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpOfferRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationOfferRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractOfferMessage,\n\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\toffer: {\n\t\t\t\t\t\t\t\t\"@type\": OdrlTypes.Offer,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:offer-1\",\n\t\t\t\t\t\t\t\tassigner: \"urn:provider:node:1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnpNegotiationOfferResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractNegotiationError,\n\t\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-consumerpid-offers-post\n\tconst pnpNegotiationConsumerOfferRoute: IRestRoute<\n\t\tIPnpOfferRequest,\n\t\tIPnpContractNegotiationResponse | IPnpContractResponse\n\t> = {\n\t\toperationId: \"pnpNegotiationConsumerOffer\",\n\t\tsummary: \"Send the offer to the consumer with existing id\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/:id/offers`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationOffer(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpOfferRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationConsumerOfferRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:22aa11bb.......ffff\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractOfferMessage,\n\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\toffer: {\n\t\t\t\t\t\t\t\t\"@type\": OdrlTypes.Offer,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:offer-1\",\n\t\t\t\t\t\t\t\tassigner: \"urn:provider:node:1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnpNegotiationConsumerOfferResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractNegotiationError,\n\t\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-consumerpid-agreement-post\n\tconst pnpNegotiationAgreementRoute: IRestRoute<IPnpAgreementRequest, IPnpContractResponse> = {\n\t\toperationId: \"pnpNegotiationAgreement\",\n\t\tsummary: \"Send the agreement to the consumer\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/:id/agreement`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationAgreement(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpAgreementRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationAgreementRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:22aa11bb.......ffff\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractAgreementMessage,\n\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\tagreement: {\n\t\t\t\t\t\t\t\t\"@type\": OdrlTypes.Agreement,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:offer-1\",\n\t\t\t\t\t\t\t\tassigner: \"urn:provider:node:1\",\n\t\t\t\t\t\t\t\tassignee: \"urn:consumer:node:1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnpNegotiationAgreementResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// The consumer event and terminate routes are exactly the same as the pnpNegotiationEventsRoute and pnpNegotiationTerminationRoute\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-consumerpid-events-post\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-consumerpid-termination-post\n\n\treturn [\n\t\tpnpGetNegotiationRoute,\n\t\tpnpNegotiationRequestRoute,\n\t\tpnpNegotiationProviderRequestRoute,\n\t\tpnpNegotiationEventsRoute,\n\t\tpnpNegotiationAgreementVerificationRoute,\n\t\tpnpNegotiationTerminationRoute,\n\t\tpnpNegotiationOfferRoute,\n\t\tpnpNegotiationConsumerOfferRoute,\n\t\tpnpNegotiationAgreementRoute\n\t];\n}\n\n/**\n * Map the IDS result to an HTTP status code.\n * @param result The result to map.\n * @returns The mapped status code or undefined if no mapping was found or not an error.\n */\nfunction mapError(\n\tresult:\n\t\t| IDataspaceProtocolContractNegotiation\n\t\t| IDataspaceProtocolContractNegotiationError\n\t\t| undefined\n): HttpStatusCode | undefined {\n\tif (\n\t\tOdrlPolicyHelper.getType(result) ===\n\t\t\tDataspaceProtocolContractNegotiationTypes.ContractNegotiationError &&\n\t\tIs.object<IDataspaceProtocolContractNegotiationError>(result)\n\t) {\n\t\tif (Is.stringValue(result.code) && /notfound/i.test(result.code)) {\n\t\t\treturn HttpStatusCode.notFound;\n\t\t}\n\t\treturn HttpStatusCode.badRequest;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * PNP: Get negotiation.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnpGetNegotiation(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnpNegotiationGetRequest\n): Promise<IPnpContractNegotiationResponse> {\n\tGuards.object<IPnpNegotiationGetRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnpNegotiationGetRequest[\"headers\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.headers),\n\t\trequest.headers\n\t);\n\tGuards.object<IPnpNegotiationGetRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.getNegotiation(\n\t\trequest.pathParams.id,\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\treturn {\n\t\tstatusCode: mapError(result),\n\t\theaders: {\n\t\t\t[HeaderTypes.ContentType]:\n\t\t\t\trequest.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd\n\t\t\t\t\t? MimeTypes.JsonLd\n\t\t\t\t\t: MimeTypes.Json\n\t\t},\n\t\tbody: result\n\t};\n}\n\n/**\n * PNP: Request a negotiation.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnpNegotiationRequest(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnpNegotiateRequest\n): Promise<IPnpContractNegotiationResponse | IPnpContractResponse> {\n\tGuards.object<IPnpNegotiateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnpNegotiateRequest[\"headers\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.headers),\n\t\trequest.headers\n\t);\n\tGuards.object<IPnpNegotiateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.requestFromConsumer(\n\t\trequest.body,\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\tconst isUpdate = Is.stringValue(request.pathParams?.id);\n\n\treturn {\n\t\tstatusCode: mapError(result) ?? (isUpdate ? undefined : HttpStatusCode.created),\n\t\theaders: {\n\t\t\t[HeaderTypes.ContentType]:\n\t\t\t\trequest.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd\n\t\t\t\t\t? MimeTypes.JsonLd\n\t\t\t\t\t: MimeTypes.Json\n\t\t},\n\t\tbody: result\n\t};\n}\n\n/**\n * PNP: Update state of negotiation.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnpNegotiationProviderEvents(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnpEventRequest\n): Promise<IPnpContractResponse> {\n\tGuards.object<IPnpEventRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnpEventRequest[\"headers\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.headers),\n\t\trequest.headers\n\t);\n\tGuards.object<IPnpEventRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.object<IPnpEventRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.event(\n\t\trequest.body,\n\t\trequest.pathParams.id === request.body.providerPid ? \"provider\" : \"consumer\",\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\treturn {\n\t\tstatusCode: mapError(result),\n\t\theaders: {\n\t\t\t[HeaderTypes.ContentType]:\n\t\t\t\trequest.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd\n\t\t\t\t\t? MimeTypes.JsonLd\n\t\t\t\t\t: MimeTypes.Json\n\t\t},\n\t\tbody: result\n\t};\n}\n\n/**\n * PNP: Set the agreement to verified.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnpNegotiationAgreementVerification(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnpAgreementVerificationRequest\n): Promise<IPnpContractResponse> {\n\tGuards.object<IPnpAgreementVerificationRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnpAgreementVerificationRequest[\"headers\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.headers),\n\t\trequest.headers\n\t);\n\tGuards.object<IPnpAgreementVerificationRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.object<IPnpAgreementVerificationRequest[\"body\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.body),\n\t\trequest.body\n\t);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.agreementVerificationFromConsumer(\n\t\trequest.body,\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\treturn {\n\t\tstatusCode: mapError(result),\n\t\theaders: {\n\t\t\t[HeaderTypes.ContentType]:\n\t\t\t\trequest.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd\n\t\t\t\t\t? MimeTypes.JsonLd\n\t\t\t\t\t: MimeTypes.Json\n\t\t},\n\t\tbody: result\n\t};\n}\n\n/**\n * PNP: Terminate the provider negotiation.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnpNegotiationTermination(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnpTerminateRequest\n): Promise<IPnpContractResponse> {\n\tGuards.object<IPnpTerminateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnpTerminateRequest[\"headers\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.headers),\n\t\trequest.headers\n\t);\n\tGuards.object<IPnpTerminateRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.object<IPnpTerminateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.terminate(\n\t\trequest.body,\n\t\trequest.pathParams.id === request.body.providerPid ? \"provider\" : \"consumer\",\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\treturn {\n\t\tstatusCode: mapError(result),\n\t\theaders: {\n\t\t\t[HeaderTypes.ContentType]:\n\t\t\t\trequest.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd\n\t\t\t\t\t? MimeTypes.JsonLd\n\t\t\t\t\t: MimeTypes.Json\n\t\t},\n\t\tbody: result\n\t};\n}\n\n/**\n * PNP: Send the offer to the consumer.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnpNegotiationOffer(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnpOfferRequest\n): Promise<IPnpContractNegotiationResponse | IPnpContractResponse> {\n\tGuards.object<IPnpOfferRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnpOfferRequest[\"headers\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.headers),\n\t\trequest.headers\n\t);\n\tGuards.object<IPnpOfferRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.offerFromProvider(\n\t\trequest.body,\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\tconst isUpdate = Is.stringValue(request.pathParams?.id);\n\n\treturn {\n\t\tstatusCode: mapError(result) ?? (isUpdate ? undefined : HttpStatusCode.created),\n\t\theaders: {\n\t\t\t[HeaderTypes.ContentType]:\n\t\t\t\trequest.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd\n\t\t\t\t\t? MimeTypes.JsonLd\n\t\t\t\t\t: MimeTypes.Json\n\t\t},\n\t\tbody: result\n\t};\n}\n\n/**\n * PNP: Send the agreement to the consumer.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnpNegotiationAgreement(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnpAgreementRequest\n): Promise<IPnpContractResponse> {\n\tGuards.object<IPnpAgreementRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnpAgreementRequest[\"headers\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.headers),\n\t\trequest.headers\n\t);\n\tGuards.object<IPnpAgreementRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tGuards.object<IPnpAgreementRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.agreementFromProvider(\n\t\trequest.body,\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\treturn {\n\t\tstatusCode: mapError(result),\n\t\theaders: {\n\t\t\t[HeaderTypes.ContentType]:\n\t\t\t\trequest.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd\n\t\t\t\t\t? MimeTypes.JsonLd\n\t\t\t\t\t: MimeTypes.Json\n\t\t},\n\t\tbody: result\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"policyNegotiationPointRoutes.js","sourceRoot":"","sources":["../../src/policyNegotiationPointRoutes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,gBAAgB,EAIhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,EACN,gBAAgB,EAWhB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,yBAAyB,EACzB,6CAA6C,EAC7C,6CAA6C,EAC7C,yCAAyC,EAGzC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EACN,YAAY,EACZ,WAAW,EACX,cAAc,EAEd,SAAS,EACT,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,MAAM,aAAa,GAAG,8BAA8B,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAW;IAC9B;QACC,IAAI,EAAE,0BAA0B;QAChC,WAAW,EAAE,sEAAsE;KACnF;CACD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,wCAAwC,CACvD,aAAqB,EACrB,aAAqB;IAErB,wGAAwG;IACxG,MAAM,sBAAsB,GAGxB;QACH,WAAW,EAAE,mBAAmB;QAChC,OAAO,EAAE,mBAAmB;QAC5B,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;QACpB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,GAAG,aAAa,mBAAmB;QACzC,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,OAAO,EA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CAAC;IAEhE,OAAO;QACN,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC;QAC/E,OAAO;QACP,IAAI,EAAE,MAAM;KACZ,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC5C,kBAAuC,EACvC,aAAqB,EACrB,OAA6B;IAE7B,MAAM,CAAC,MAAM,CAAuB,aAAa,aAAmB,OAAO,CAAC,CAAC;IAC7E,MAAM,CAAC,MAAM,CACZ,aAAa,qBAEb,OAAO,CAAC,OAAO,CACf,CAAC;IACF,MAAM,CAAC,MAAM,CAA+B,aAAa,kBAAwB,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/F,MAAM,CAAC,MAAM,CACZ,aAAa,wBAEb,OAAO,CAAC,UAAU,CAClB,CAAC;IAEF,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAmC,aAAa,CAAC,CAAC;IACxF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,qBAAqB,CACnD,OAAO,CAAC,IAAI,EACZ,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CACxE,CAAC;IAEF,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,gBAAgB,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAEhE,OAAO;QACN,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC;QAC5B,OAAO;QACP,IAAI,EAAE,MAAM;KACZ,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tHttpHeaderHelper,\n\ttype IHttpRequestContext,\n\ttype IRestRoute,\n\ttype ITag\n} from \"@twin.org/api-models\";\nimport { ComponentFactory, Guards, Is } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\ttype IPnpAgreementRequest,\n\ttype IPnpAgreementVerificationRequest,\n\ttype IPnpContractNegotiationResponse,\n\ttype IPnpContractResponse,\n\ttype IPnpEventRequest,\n\ttype IPnpNegotiateRequest,\n\ttype IPnpNegotiationGetRequest,\n\ttype IPnpOfferRequest,\n\ttype IPnpTerminateRequest,\n\ttype IPolicyNegotiationPointComponent\n} from \"@twin.org/rights-management-models\";\nimport {\n\tDataspaceProtocolContexts,\n\tDataspaceProtocolContractNegotiationEventType,\n\tDataspaceProtocolContractNegotiationStateType,\n\tDataspaceProtocolContractNegotiationTypes,\n\ttype IDataspaceProtocolContractNegotiation,\n\ttype IDataspaceProtocolContractNegotiationError\n} from \"@twin.org/standards-dataspace-protocol\";\nimport { OdrlTypes } from \"@twin.org/standards-w3c-odrl\";\nimport {\n\tHeaderHelper,\n\tHeaderTypes,\n\tHttpStatusCode,\n\ttype IHttpHeaders,\n\tMimeTypes\n} from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"policyNegotiationPointRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const pnpTags: ITag[] = [\n\t{\n\t\tname: \"Policy Negotiation Point\",\n\t\tdescription: \"Endpoints for managing ODRL policies in the Policy Negotiation Point\"\n\t}\n];\n\n/**\n * The REST routes for the Policy Negotiation Point.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesPolicyNegotiationPoint(\n\tbaseRouteName: string,\n\tcomponentName: string\n): IRestRoute[] {\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-get-provider\n\tconst pnpGetNegotiationRoute: IRestRoute<\n\t\tIPnpNegotiationGetRequest,\n\t\tIPnpContractNegotiationResponse\n\t> = {\n\t\toperationId: \"pnpGetNegotiation\",\n\t\tsummary: \"Get a negotiation\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/negotiations/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpGetNegotiation(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpNegotiationGetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpGetNegotiationRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:00aa11bb.......ffff\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractNegotiationResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnpGetNegotiationResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractNegotiation,\n\t\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:002aa11bb.......ffff\",\n\t\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\t\tstate: DataspaceProtocolContractNegotiationStateType.REQUESTED\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-providerpid-request-post\n\tconst pnpNegotiationRequestRoute: IRestRoute<\n\t\tIPnpNegotiateRequest,\n\t\tIPnpContractNegotiationResponse | IPnpContractResponse\n\t> = {\n\t\toperationId: \"pnpNegotiationRequest\",\n\t\tsummary: \"Negotiate a policy\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/request`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationRequest(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpNegotiateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractRequestMessage,\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\toffer: {\n\t\t\t\t\t\t\t\t\"@type\": OdrlTypes.Offer,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:offer-1\",\n\t\t\t\t\t\t\t\tassigner: \"urn:provider:node:1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractNegotiationResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"IPnpNegotiationRequestResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractNegotiation,\n\t\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\t\tstate: DataspaceProtocolContractNegotiationStateType.REQUESTED\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-providerpid-request-post\n\tconst pnpNegotiationProviderRequestRoute: IRestRoute<\n\t\tIPnpNegotiateRequest,\n\t\tIPnpContractNegotiationResponse | IPnpContractResponse\n\t> = {\n\t\toperationId: \"pnpNegotiationProviderRequest\",\n\t\tsummary: \"Negotiate a policy with an existing provider id\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/:id/request`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationRequest(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpNegotiateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationProviderRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:00aa11bb.......ffff\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractRequestMessage,\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\toffer: {\n\t\t\t\t\t\t\t\t\"@type\": OdrlTypes.Offer,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:offer-1\",\n\t\t\t\t\t\t\t\tassigner: \"urn:provider:node:1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"IPnpNegotiationProviderRequestResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-providerpid-events-post\n\tconst pnpNegotiationEventsRoute: IRestRoute<IPnpEventRequest, IPnpContractResponse> = {\n\t\toperationId: \"pnpNegotiationEvents\",\n\t\tsummary: \"Update the state of the negotiation\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/:id/events`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationProviderEvents(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpEventRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationEventsRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:00aa11bb.......ffff\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractNegotiationEventMessage,\n\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\tevent: DataspaceProtocolContractNegotiationEventType.ACCEPTED\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"IPnpNegotiationRequestResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-providerpid-agreement-verification-post\n\tconst pnpNegotiationAgreementVerificationRoute: IRestRoute<\n\t\tIPnpAgreementVerificationRequest,\n\t\tIPnpContractResponse\n\t> = {\n\t\toperationId: \"pnpNegotiationAgreementVerification\",\n\t\tsummary: \"Set the agreement to verified\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/:id/agreement/verification`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationAgreementVerification(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpAgreementVerificationRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationAgreementVerificationRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:00aa11bb.......ffff\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\":\n\t\t\t\t\t\t\t\tDataspaceProtocolContractNegotiationTypes.ContractAgreementVerificationMessage,\n\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"IPnpNegotiationAgreementVerificationResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-providerpid-termination-post\n\tconst pnpNegotiationTerminationRoute: IRestRoute<IPnpTerminateRequest, IPnpContractResponse> = {\n\t\toperationId: \"pnpNegotiationTermination\",\n\t\tsummary: \"Set the agreement to terminated\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/:id/termination`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationTermination(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpTerminateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationTerminationRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:00aa11bb.......ffff\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\":\n\t\t\t\t\t\t\t\tDataspaceProtocolContractNegotiationTypes.ContractNegotiationTerminationMessage,\n\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnpNegotiationTerminationResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-offers-post\n\tconst pnpNegotiationOfferRoute: IRestRoute<\n\t\tIPnpOfferRequest,\n\t\tIPnpContractNegotiationResponse | IPnpContractResponse\n\t> = {\n\t\toperationId: \"pnpNegotiationOffer\",\n\t\tsummary: \"Send the offer to the consumer\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/offers`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationOffer(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpOfferRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationOfferRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractOfferMessage,\n\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\toffer: {\n\t\t\t\t\t\t\t\t\"@type\": OdrlTypes.Offer,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:offer-1\",\n\t\t\t\t\t\t\t\tassigner: \"urn:provider:node:1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnpNegotiationOfferResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractNegotiationError,\n\t\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-consumerpid-offers-post\n\tconst pnpNegotiationConsumerOfferRoute: IRestRoute<\n\t\tIPnpOfferRequest,\n\t\tIPnpContractNegotiationResponse | IPnpContractResponse\n\t> = {\n\t\toperationId: \"pnpNegotiationConsumerOffer\",\n\t\tsummary: \"Send the offer to the consumer with existing id\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/:id/offers`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationOffer(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpOfferRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationConsumerOfferRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:22aa11bb.......ffff\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractOfferMessage,\n\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\toffer: {\n\t\t\t\t\t\t\t\t\"@type\": OdrlTypes.Offer,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:offer-1\",\n\t\t\t\t\t\t\t\tassigner: \"urn:provider:node:1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnpNegotiationConsumerOfferResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractNegotiationError,\n\t\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-consumerpid-agreement-post\n\tconst pnpNegotiationAgreementRoute: IRestRoute<IPnpAgreementRequest, IPnpContractResponse> = {\n\t\toperationId: \"pnpNegotiationAgreement\",\n\t\tsummary: \"Send the agreement to the consumer\",\n\t\ttag: pnpTags[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/negotiations/:id/agreement`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tpnpNegotiationAgreement(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IPnpAgreementRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"pnpNegotiationAgreementRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd,\n\t\t\t\t\t\t\t[HeaderTypes.Authorization]: \"z3Vcuh2BP9ShC.z3Vcuh2BP9ShC.z3Vcuh2BP9ShC\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"urn:contract-negotiation:22aa11bb.......ffff\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractAgreementMessage,\n\t\t\t\t\t\t\tproviderPid: \"urn:contract-negotiation:00aa11bb.......ffff\",\n\t\t\t\t\t\t\tconsumerPid: \"urn:contract-negotiation:22aa11bb.......ffff\",\n\t\t\t\t\t\t\tagreement: {\n\t\t\t\t\t\t\t\t\"@type\": OdrlTypes.Agreement,\n\t\t\t\t\t\t\t\t\"@id\": \"urn:offer-1\",\n\t\t\t\t\t\t\t\tassigner: \"urn:provider:node:1\",\n\t\t\t\t\t\t\t\tassignee: \"urn:consumer:node:1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IPnpContractResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"pnpNegotiationAgreementResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\tskipAuth: true\n\t};\n\n\t// The consumer event and terminate routes are exactly the same as the pnpNegotiationEventsRoute and pnpNegotiationTerminationRoute\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-consumerpid-events-post\n\t// https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiations-consumerpid-termination-post\n\n\treturn [\n\t\tpnpGetNegotiationRoute,\n\t\tpnpNegotiationRequestRoute,\n\t\tpnpNegotiationProviderRequestRoute,\n\t\tpnpNegotiationEventsRoute,\n\t\tpnpNegotiationAgreementVerificationRoute,\n\t\tpnpNegotiationTerminationRoute,\n\t\tpnpNegotiationOfferRoute,\n\t\tpnpNegotiationConsumerOfferRoute,\n\t\tpnpNegotiationAgreementRoute\n\t];\n}\n\n/**\n * Map the IDS result to an HTTP status code.\n * @param result The result to map.\n * @returns The mapped status code or undefined if no mapping was found or not an error.\n */\nfunction mapError(\n\tresult:\n\t\t| IDataspaceProtocolContractNegotiation\n\t\t| IDataspaceProtocolContractNegotiationError\n\t\t| undefined\n): HttpStatusCode | undefined {\n\tif (\n\t\tOdrlPolicyHelper.getType(result) ===\n\t\t\tDataspaceProtocolContractNegotiationTypes.ContractNegotiationError &&\n\t\tIs.object<IDataspaceProtocolContractNegotiationError>(result)\n\t) {\n\t\tif (Is.stringValue(result.code) && /notfound/i.test(result.code)) {\n\t\t\treturn HttpStatusCode.notFound;\n\t\t}\n\t\treturn HttpStatusCode.badRequest;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * PNP: Get negotiation.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnpGetNegotiation(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnpNegotiationGetRequest\n): Promise<IPnpContractNegotiationResponse> {\n\tGuards.object<IPnpNegotiationGetRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnpNegotiationGetRequest[\"headers\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.headers),\n\t\trequest.headers\n\t);\n\tGuards.object<IPnpNegotiationGetRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.getNegotiation(\n\t\trequest.pathParams.id,\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\tconst headers: IHttpHeaders = {};\n\tHttpHeaderHelper.buildJsonContentType(headers, request.headers);\n\n\treturn {\n\t\tstatusCode: mapError(result),\n\t\theaders,\n\t\tbody: result\n\t};\n}\n\n/**\n * PNP: Request a negotiation.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnpNegotiationRequest(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnpNegotiateRequest\n): Promise<IPnpContractNegotiationResponse | IPnpContractResponse> {\n\tGuards.object<IPnpNegotiateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnpNegotiateRequest[\"headers\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.headers),\n\t\trequest.headers\n\t);\n\tGuards.object<IPnpNegotiateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.requestFromConsumer(\n\t\trequest.body,\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\tconst isUpdate = Is.stringValue(request.pathParams?.id);\n\n\tconst headers: IHttpHeaders = {};\n\tHttpHeaderHelper.buildJsonContentType(headers, request.headers);\n\n\treturn {\n\t\tstatusCode: mapError(result) ?? (isUpdate ? undefined : HttpStatusCode.created),\n\t\theaders,\n\t\tbody: result\n\t};\n}\n\n/**\n * PNP: Update state of negotiation.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnpNegotiationProviderEvents(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnpEventRequest\n): Promise<IPnpContractResponse> {\n\tGuards.object<IPnpEventRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnpEventRequest[\"headers\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.headers),\n\t\trequest.headers\n\t);\n\tGuards.object<IPnpEventRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.object<IPnpEventRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.event(\n\t\trequest.body,\n\t\trequest.pathParams.id === request.body.providerPid ? \"provider\" : \"consumer\",\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\tconst headers: IHttpHeaders = {};\n\tHttpHeaderHelper.buildJsonContentType(headers, request.headers);\n\n\treturn {\n\t\tstatusCode: mapError(result),\n\t\theaders,\n\t\tbody: result\n\t};\n}\n\n/**\n * PNP: Set the agreement to verified.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnpNegotiationAgreementVerification(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnpAgreementVerificationRequest\n): Promise<IPnpContractResponse> {\n\tGuards.object<IPnpAgreementVerificationRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnpAgreementVerificationRequest[\"headers\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.headers),\n\t\trequest.headers\n\t);\n\tGuards.object<IPnpAgreementVerificationRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.object<IPnpAgreementVerificationRequest[\"body\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.body),\n\t\trequest.body\n\t);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.agreementVerificationFromConsumer(\n\t\trequest.body,\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\tconst headers: IHttpHeaders = {};\n\tHttpHeaderHelper.buildJsonContentType(headers, request.headers);\n\n\treturn {\n\t\tstatusCode: mapError(result),\n\t\theaders,\n\t\tbody: result\n\t};\n}\n\n/**\n * PNP: Terminate the provider negotiation.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnpNegotiationTermination(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnpTerminateRequest\n): Promise<IPnpContractResponse> {\n\tGuards.object<IPnpTerminateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnpTerminateRequest[\"headers\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.headers),\n\t\trequest.headers\n\t);\n\tGuards.object<IPnpTerminateRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.object<IPnpTerminateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.terminate(\n\t\trequest.body,\n\t\trequest.pathParams.id === request.body.providerPid ? \"provider\" : \"consumer\",\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\tconst headers: IHttpHeaders = {};\n\tHttpHeaderHelper.buildJsonContentType(headers, request.headers);\n\n\treturn {\n\t\tstatusCode: mapError(result),\n\t\theaders,\n\t\tbody: result\n\t};\n}\n\n/**\n * PNP: Send the offer to the consumer.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnpNegotiationOffer(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnpOfferRequest\n): Promise<IPnpContractNegotiationResponse | IPnpContractResponse> {\n\tGuards.object<IPnpOfferRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnpOfferRequest[\"headers\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.headers),\n\t\trequest.headers\n\t);\n\tGuards.object<IPnpOfferRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.offerFromProvider(\n\t\trequest.body,\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\tconst isUpdate = Is.stringValue(request.pathParams?.id);\n\n\tconst headers: IHttpHeaders = {};\n\tHttpHeaderHelper.buildJsonContentType(headers, request.headers);\n\n\treturn {\n\t\tstatusCode: mapError(result) ?? (isUpdate ? undefined : HttpStatusCode.created),\n\t\theaders,\n\t\tbody: result\n\t};\n}\n\n/**\n * PNP: Send the agreement to the consumer.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function pnpNegotiationAgreement(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IPnpAgreementRequest\n): Promise<IPnpContractResponse> {\n\tGuards.object<IPnpAgreementRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IPnpAgreementRequest[\"headers\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.headers),\n\t\trequest.headers\n\t);\n\tGuards.object<IPnpAgreementRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tGuards.object<IPnpAgreementRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.agreementFromProvider(\n\t\trequest.body,\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\tconst headers: IHttpHeaders = {};\n\tHttpHeaderHelper.buildJsonContentType(headers, request.headers);\n\n\treturn {\n\t\tstatusCode: mapError(result),\n\t\theaders,\n\t\tbody: result\n\t};\n}\n"]}
|
|
@@ -16,9 +16,10 @@ export declare function generateRestRoutesPolicyAdministrationPoint(baseRouteNam
|
|
|
16
16
|
* @param httpRequestContext The request context for the API.
|
|
17
17
|
* @param componentName The name of the component to use in the routes.
|
|
18
18
|
* @param request The request.
|
|
19
|
+
* @param baseRouteName The base route name to use for generating the location header.
|
|
19
20
|
* @returns The response object with additional http response properties.
|
|
20
21
|
*/
|
|
21
|
-
export declare function papCreate(httpRequestContext: IHttpRequestContext, componentName: string, request: IPapCreateRequest): Promise<ICreatedResponse>;
|
|
22
|
+
export declare function papCreate(httpRequestContext: IHttpRequestContext, componentName: string, request: IPapCreateRequest, baseRouteName: string): Promise<ICreatedResponse>;
|
|
22
23
|
/**
|
|
23
24
|
* PAP: Update a policy.
|
|
24
25
|
* @param httpRequestContext The request context for the API.
|
|
@@ -16,9 +16,10 @@ export declare function generateRestRoutesPolicyNegotiationAdminPoint(baseRouteN
|
|
|
16
16
|
* @param httpRequestContext The request context for the API.
|
|
17
17
|
* @param componentName The name of the component to use in the routes.
|
|
18
18
|
* @param request The request.
|
|
19
|
+
* @param baseRouteName The base route name to use for the Location header.
|
|
19
20
|
* @returns The response object with additional http response properties.
|
|
20
21
|
*/
|
|
21
|
-
export declare function pnapCreate(httpRequestContext: IHttpRequestContext, componentName: string, request: IPnapCreateRequest): Promise<ICreatedResponse>;
|
|
22
|
+
export declare function pnapCreate(httpRequestContext: IHttpRequestContext, componentName: string, request: IPnapCreateRequest, baseRouteName: string): Promise<ICreatedResponse>;
|
|
22
23
|
/**
|
|
23
24
|
* PNAP: Get a policy negotiation.
|
|
24
25
|
* @param httpRequestContext The request context for the API.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type IHttpRequestContext, type IRestRoute, type ITag } from "@twin.org/api-models";
|
|
2
2
|
import { type IPnpAgreementRequest, type IPnpAgreementVerificationRequest, type IPnpContractNegotiationResponse, type IPnpContractResponse, type IPnpEventRequest, type IPnpNegotiateRequest, type IPnpNegotiationGetRequest, type IPnpOfferRequest, type IPnpTerminateRequest } from "@twin.org/rights-management-models";
|
|
3
3
|
/**
|
|
4
4
|
* The tag to associate with the routes.
|
package/docs/changelog.md
CHANGED
|
@@ -6,6 +6,294 @@
|
|
|
6
6
|
|
|
7
7
|
* remove EcosystemPolicy support from PAP/REST routes and generated API surface for v2.
|
|
8
8
|
|
|
9
|
+
## [0.9.1-next.10](https://github.com/iotaledger/twin-rights-management/compare/rights-management-service-v0.9.1-next.9...rights-management-service-v0.9.1-next.10) (2026-07-20)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Miscellaneous Chores
|
|
13
|
+
|
|
14
|
+
* **rights-management-service:** Synchronize repo versions
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Dependencies
|
|
18
|
+
|
|
19
|
+
* The following workspace dependencies were updated
|
|
20
|
+
* dependencies
|
|
21
|
+
* @twin.org/rights-management-models bumped from 0.9.1-next.9 to 0.9.1-next.10
|
|
22
|
+
* devDependencies
|
|
23
|
+
* @twin.org/rights-management-pap-service bumped from 0.9.1-next.9 to 0.9.1-next.10
|
|
24
|
+
* @twin.org/rights-management-pdp-service bumped from 0.9.1-next.9 to 0.9.1-next.10
|
|
25
|
+
* @twin.org/rights-management-pep-service bumped from 0.9.1-next.9 to 0.9.1-next.10
|
|
26
|
+
* @twin.org/rights-management-pip-service bumped from 0.9.1-next.9 to 0.9.1-next.10
|
|
27
|
+
* @twin.org/rights-management-pmp-service bumped from 0.9.1-next.9 to 0.9.1-next.10
|
|
28
|
+
* @twin.org/rights-management-pnp-service bumped from 0.9.1-next.9 to 0.9.1-next.10
|
|
29
|
+
* @twin.org/rights-management-pxp-service bumped from 0.9.1-next.9 to 0.9.1-next.10
|
|
30
|
+
|
|
31
|
+
## [0.9.1-next.9](https://github.com/iotaledger/twin-rights-management/compare/rights-management-service-v0.9.1-next.8...rights-management-service-v0.9.1-next.9) (2026-07-20)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Miscellaneous Chores
|
|
35
|
+
|
|
36
|
+
* **rights-management-service:** Synchronize repo versions
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Dependencies
|
|
40
|
+
|
|
41
|
+
* The following workspace dependencies were updated
|
|
42
|
+
* dependencies
|
|
43
|
+
* @twin.org/rights-management-models bumped from 0.9.1-next.8 to 0.9.1-next.9
|
|
44
|
+
* devDependencies
|
|
45
|
+
* @twin.org/rights-management-pap-service bumped from 0.9.1-next.8 to 0.9.1-next.9
|
|
46
|
+
* @twin.org/rights-management-pdp-service bumped from 0.9.1-next.8 to 0.9.1-next.9
|
|
47
|
+
* @twin.org/rights-management-pep-service bumped from 0.9.1-next.8 to 0.9.1-next.9
|
|
48
|
+
* @twin.org/rights-management-pip-service bumped from 0.9.1-next.8 to 0.9.1-next.9
|
|
49
|
+
* @twin.org/rights-management-pmp-service bumped from 0.9.1-next.8 to 0.9.1-next.9
|
|
50
|
+
* @twin.org/rights-management-pnp-service bumped from 0.9.1-next.8 to 0.9.1-next.9
|
|
51
|
+
* @twin.org/rights-management-pxp-service bumped from 0.9.1-next.8 to 0.9.1-next.9
|
|
52
|
+
|
|
53
|
+
## [0.9.1-next.8](https://github.com/iotaledger/twin-rights-management/compare/rights-management-service-v0.9.1-next.7...rights-management-service-v0.9.1-next.8) (2026-07-17)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Miscellaneous Chores
|
|
57
|
+
|
|
58
|
+
* **rights-management-service:** Synchronize repo versions
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Dependencies
|
|
62
|
+
|
|
63
|
+
* The following workspace dependencies were updated
|
|
64
|
+
* dependencies
|
|
65
|
+
* @twin.org/rights-management-models bumped from 0.9.1-next.7 to 0.9.1-next.8
|
|
66
|
+
* devDependencies
|
|
67
|
+
* @twin.org/rights-management-pap-service bumped from 0.9.1-next.7 to 0.9.1-next.8
|
|
68
|
+
* @twin.org/rights-management-pdp-service bumped from 0.9.1-next.7 to 0.9.1-next.8
|
|
69
|
+
* @twin.org/rights-management-pep-service bumped from 0.9.1-next.7 to 0.9.1-next.8
|
|
70
|
+
* @twin.org/rights-management-pip-service bumped from 0.9.1-next.7 to 0.9.1-next.8
|
|
71
|
+
* @twin.org/rights-management-pmp-service bumped from 0.9.1-next.7 to 0.9.1-next.8
|
|
72
|
+
* @twin.org/rights-management-pnp-service bumped from 0.9.1-next.7 to 0.9.1-next.8
|
|
73
|
+
* @twin.org/rights-management-pxp-service bumped from 0.9.1-next.7 to 0.9.1-next.8
|
|
74
|
+
|
|
75
|
+
## [0.9.1-next.7](https://github.com/iotaledger/twin-rights-management/compare/rights-management-service-v0.9.1-next.6...rights-management-service-v0.9.1-next.7) (2026-07-16)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### Miscellaneous Chores
|
|
79
|
+
|
|
80
|
+
* **rights-management-service:** Synchronize repo versions
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Dependencies
|
|
84
|
+
|
|
85
|
+
* The following workspace dependencies were updated
|
|
86
|
+
* dependencies
|
|
87
|
+
* @twin.org/rights-management-models bumped from 0.9.1-next.6 to 0.9.1-next.7
|
|
88
|
+
* devDependencies
|
|
89
|
+
* @twin.org/rights-management-pap-service bumped from 0.9.1-next.6 to 0.9.1-next.7
|
|
90
|
+
* @twin.org/rights-management-pdp-service bumped from 0.9.1-next.6 to 0.9.1-next.7
|
|
91
|
+
* @twin.org/rights-management-pep-service bumped from 0.9.1-next.6 to 0.9.1-next.7
|
|
92
|
+
* @twin.org/rights-management-pip-service bumped from 0.9.1-next.6 to 0.9.1-next.7
|
|
93
|
+
* @twin.org/rights-management-pmp-service bumped from 0.9.1-next.6 to 0.9.1-next.7
|
|
94
|
+
* @twin.org/rights-management-pnp-service bumped from 0.9.1-next.6 to 0.9.1-next.7
|
|
95
|
+
* @twin.org/rights-management-pxp-service bumped from 0.9.1-next.6 to 0.9.1-next.7
|
|
96
|
+
|
|
97
|
+
## [0.9.1-next.6](https://github.com/iotaledger/twin-rights-management/compare/rights-management-service-v0.9.1-next.5...rights-management-service-v0.9.1-next.6) (2026-07-15)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
### Miscellaneous Chores
|
|
101
|
+
|
|
102
|
+
* **rights-management-service:** Synchronize repo versions
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### Dependencies
|
|
106
|
+
|
|
107
|
+
* The following workspace dependencies were updated
|
|
108
|
+
* dependencies
|
|
109
|
+
* @twin.org/rights-management-models bumped from 0.9.1-next.5 to 0.9.1-next.6
|
|
110
|
+
* devDependencies
|
|
111
|
+
* @twin.org/rights-management-pap-service bumped from 0.9.1-next.5 to 0.9.1-next.6
|
|
112
|
+
* @twin.org/rights-management-pdp-service bumped from 0.9.1-next.5 to 0.9.1-next.6
|
|
113
|
+
* @twin.org/rights-management-pep-service bumped from 0.9.1-next.5 to 0.9.1-next.6
|
|
114
|
+
* @twin.org/rights-management-pip-service bumped from 0.9.1-next.5 to 0.9.1-next.6
|
|
115
|
+
* @twin.org/rights-management-pmp-service bumped from 0.9.1-next.5 to 0.9.1-next.6
|
|
116
|
+
* @twin.org/rights-management-pnp-service bumped from 0.9.1-next.5 to 0.9.1-next.6
|
|
117
|
+
* @twin.org/rights-management-pxp-service bumped from 0.9.1-next.5 to 0.9.1-next.6
|
|
118
|
+
|
|
119
|
+
## [0.9.1-next.5](https://github.com/iotaledger/twin-rights-management/compare/rights-management-service-v0.9.1-next.4...rights-management-service-v0.9.1-next.5) (2026-07-14)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
### Miscellaneous Chores
|
|
123
|
+
|
|
124
|
+
* **rights-management-service:** Synchronize repo versions
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### Dependencies
|
|
128
|
+
|
|
129
|
+
* The following workspace dependencies were updated
|
|
130
|
+
* dependencies
|
|
131
|
+
* @twin.org/rights-management-models bumped from 0.9.1-next.4 to 0.9.1-next.5
|
|
132
|
+
* devDependencies
|
|
133
|
+
* @twin.org/rights-management-pap-service bumped from 0.9.1-next.4 to 0.9.1-next.5
|
|
134
|
+
* @twin.org/rights-management-pdp-service bumped from 0.9.1-next.4 to 0.9.1-next.5
|
|
135
|
+
* @twin.org/rights-management-pep-service bumped from 0.9.1-next.4 to 0.9.1-next.5
|
|
136
|
+
* @twin.org/rights-management-pip-service bumped from 0.9.1-next.4 to 0.9.1-next.5
|
|
137
|
+
* @twin.org/rights-management-pmp-service bumped from 0.9.1-next.4 to 0.9.1-next.5
|
|
138
|
+
* @twin.org/rights-management-pnp-service bumped from 0.9.1-next.4 to 0.9.1-next.5
|
|
139
|
+
* @twin.org/rights-management-pxp-service bumped from 0.9.1-next.4 to 0.9.1-next.5
|
|
140
|
+
|
|
141
|
+
## [0.9.1-next.4](https://github.com/iotaledger/twin-rights-management/compare/rights-management-service-v0.9.1-next.3...rights-management-service-v0.9.1-next.4) (2026-07-02)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
### Miscellaneous Chores
|
|
145
|
+
|
|
146
|
+
* **rights-management-service:** Synchronize repo versions
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
### Dependencies
|
|
150
|
+
|
|
151
|
+
* The following workspace dependencies were updated
|
|
152
|
+
* dependencies
|
|
153
|
+
* @twin.org/rights-management-models bumped from 0.9.1-next.3 to 0.9.1-next.4
|
|
154
|
+
* devDependencies
|
|
155
|
+
* @twin.org/rights-management-pap-service bumped from 0.9.1-next.3 to 0.9.1-next.4
|
|
156
|
+
* @twin.org/rights-management-pdp-service bumped from 0.9.1-next.3 to 0.9.1-next.4
|
|
157
|
+
* @twin.org/rights-management-pep-service bumped from 0.9.1-next.3 to 0.9.1-next.4
|
|
158
|
+
* @twin.org/rights-management-pip-service bumped from 0.9.1-next.3 to 0.9.1-next.4
|
|
159
|
+
* @twin.org/rights-management-pmp-service bumped from 0.9.1-next.3 to 0.9.1-next.4
|
|
160
|
+
* @twin.org/rights-management-pnp-service bumped from 0.9.1-next.3 to 0.9.1-next.4
|
|
161
|
+
* @twin.org/rights-management-pxp-service bumped from 0.9.1-next.3 to 0.9.1-next.4
|
|
162
|
+
|
|
163
|
+
## [0.9.1-next.3](https://github.com/iotaledger/twin-rights-management/compare/rights-management-service-v0.9.1-next.2...rights-management-service-v0.9.1-next.3) (2026-06-30)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
### Features
|
|
167
|
+
|
|
168
|
+
* rest enhancements ([#229](https://github.com/iotaledger/twin-rights-management/issues/229)) ([b48de25](https://github.com/iotaledger/twin-rights-management/commit/b48de25820eddb4cc53020bb2afbd91497d22de5))
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
### Dependencies
|
|
172
|
+
|
|
173
|
+
* The following workspace dependencies were updated
|
|
174
|
+
* dependencies
|
|
175
|
+
* @twin.org/rights-management-models bumped from 0.9.1-next.2 to 0.9.1-next.3
|
|
176
|
+
* devDependencies
|
|
177
|
+
* @twin.org/rights-management-pap-service bumped from 0.9.1-next.2 to 0.9.1-next.3
|
|
178
|
+
* @twin.org/rights-management-pdp-service bumped from 0.9.1-next.2 to 0.9.1-next.3
|
|
179
|
+
* @twin.org/rights-management-pep-service bumped from 0.9.1-next.2 to 0.9.1-next.3
|
|
180
|
+
* @twin.org/rights-management-pip-service bumped from 0.9.1-next.2 to 0.9.1-next.3
|
|
181
|
+
* @twin.org/rights-management-pmp-service bumped from 0.9.1-next.2 to 0.9.1-next.3
|
|
182
|
+
* @twin.org/rights-management-pnp-service bumped from 0.9.1-next.2 to 0.9.1-next.3
|
|
183
|
+
* @twin.org/rights-management-pxp-service bumped from 0.9.1-next.2 to 0.9.1-next.3
|
|
184
|
+
|
|
185
|
+
## [0.9.1-next.2](https://github.com/iotaledger/twin-rights-management/compare/rights-management-service-v0.9.1-next.1...rights-management-service-v0.9.1-next.2) (2026-06-29)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
### Features
|
|
189
|
+
|
|
190
|
+
* enhanced rest testing ([#227](https://github.com/iotaledger/twin-rights-management/issues/227)) ([f76c137](https://github.com/iotaledger/twin-rights-management/commit/f76c13781c987e0fd153aa316abfd27113317fad))
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
### Dependencies
|
|
194
|
+
|
|
195
|
+
* The following workspace dependencies were updated
|
|
196
|
+
* dependencies
|
|
197
|
+
* @twin.org/rights-management-models bumped from 0.9.1-next.1 to 0.9.1-next.2
|
|
198
|
+
* devDependencies
|
|
199
|
+
* @twin.org/rights-management-pap-service bumped from 0.9.1-next.1 to 0.9.1-next.2
|
|
200
|
+
* @twin.org/rights-management-pdp-service bumped from 0.9.1-next.1 to 0.9.1-next.2
|
|
201
|
+
* @twin.org/rights-management-pep-service bumped from 0.9.1-next.1 to 0.9.1-next.2
|
|
202
|
+
* @twin.org/rights-management-pip-service bumped from 0.9.1-next.1 to 0.9.1-next.2
|
|
203
|
+
* @twin.org/rights-management-pmp-service bumped from 0.9.1-next.1 to 0.9.1-next.2
|
|
204
|
+
* @twin.org/rights-management-pnp-service bumped from 0.9.1-next.1 to 0.9.1-next.2
|
|
205
|
+
* @twin.org/rights-management-pxp-service bumped from 0.9.1-next.1 to 0.9.1-next.2
|
|
206
|
+
|
|
207
|
+
## [0.9.1-next.1](https://github.com/iotaledger/twin-rights-management/compare/rights-management-service-v0.9.1-next.0...rights-management-service-v0.9.1-next.1) (2026-06-26)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
### Features
|
|
211
|
+
|
|
212
|
+
* add context id features ([#51](https://github.com/iotaledger/twin-rights-management/issues/51)) ([239922c](https://github.com/iotaledger/twin-rights-management/commit/239922c82a7fa94b66c8ee0e924bc58ddaaba395))
|
|
213
|
+
* add create() to pre-register consumer-side contract negotiations ([#187](https://github.com/iotaledger/twin-rights-management/issues/187)) ([6007f83](https://github.com/iotaledger/twin-rights-management/commit/6007f83579cc8d4dbc4c2243fed0cbe948371f82))
|
|
214
|
+
* add DAP (Data Access Point) ([#40](https://github.com/iotaledger/twin-rights-management/issues/40)) ([f3e684b](https://github.com/iotaledger/twin-rights-management/commit/f3e684ba1f9a934394c64635f393fbb6709ff480))
|
|
215
|
+
* add default enforcement processor ([#73](https://github.com/iotaledger/twin-rights-management/issues/73)) ([0c64d49](https://github.com/iotaledger/twin-rights-management/commit/0c64d49bab363b3da6d197536a605f7929a7c584))
|
|
216
|
+
* add default policy arbiter ([#76](https://github.com/iotaledger/twin-rights-management/issues/76)) ([b62ff9c](https://github.com/iotaledger/twin-rights-management/commit/b62ff9ce1b3400c4a95909da01863af47f430dbf))
|
|
217
|
+
* add EcosystemPolicy typed getter across PAP stack ([#114](https://github.com/iotaledger/twin-rights-management/issues/114)) ([2a8e941](https://github.com/iotaledger/twin-rights-management/commit/2a8e941bbea229fb74f81dc869ce1f85c66c300d))
|
|
218
|
+
* add factory pattern ([d26b4c0](https://github.com/iotaledger/twin-rights-management/commit/d26b4c08a2f3ba5758df66a1c48203b8d8e3638e))
|
|
219
|
+
* add includeErrorDetails config ([73af46f](https://github.com/iotaledger/twin-rights-management/commit/73af46fa92fb7661334dc4674219705724967d79))
|
|
220
|
+
* add JSON-LD types for negotiation ([6be61f8](https://github.com/iotaledger/twin-rights-management/commit/6be61f890537cb9d22d4fad90092b858de2c9c2d))
|
|
221
|
+
* add PAP-managed schema.org lifecycle timestamps to policies ([#176](https://github.com/iotaledger/twin-rights-management/issues/176)) ([8d53036](https://github.com/iotaledger/twin-rights-management/commit/8d5303674b93a59532c0f16864b8484378ebe16c))
|
|
222
|
+
* add policy negotiation point PNP, PNAP and PNRP ([#32](https://github.com/iotaledger/twin-rights-management/issues/32)) ([90f0659](https://github.com/iotaledger/twin-rights-management/commit/90f06593a1126df3c2f4ca23cf95a08260fd6415))
|
|
223
|
+
* add scaffold for other services ([de25f34](https://github.com/iotaledger/twin-rights-management/commit/de25f34c40fb65b6d73df98965ea4e368019da84))
|
|
224
|
+
* add skipTenant to PNP route definitions ([#110](https://github.com/iotaledger/twin-rights-management/issues/110)) ([5a8e925](https://github.com/iotaledger/twin-rights-management/commit/5a8e925868c94d12e382e184c5a16ee8135194b1))
|
|
225
|
+
* add validate-locales ([78f30cf](https://github.com/iotaledger/twin-rights-management/commit/78f30cf61054655c815e5fc42972ee39502e3687))
|
|
226
|
+
* additional pap features ([#69](https://github.com/iotaledger/twin-rights-management/issues/69)) ([a80d511](https://github.com/iotaledger/twin-rights-management/commit/a80d511ace8fad9fbf4c02cb82ead261a5944b34))
|
|
227
|
+
* adopt node/tenant identifier model in PNP + IPolicyNegotiation ([#145](https://github.com/iotaledger/twin-rights-management/issues/145)) ([0911bfc](https://github.com/iotaledger/twin-rights-management/commit/0911bfc6b59d1067958cb3a70d2fae823c9f2359))
|
|
228
|
+
* capture organization identity ([#88](https://github.com/iotaledger/twin-rights-management/issues/88)) ([8fcee6e](https://github.com/iotaledger/twin-rights-management/commit/8fcee6e676bb5a9a344d83c50567066e447aca76))
|
|
229
|
+
* change callback url to callback path ([#65](https://github.com/iotaledger/twin-rights-management/issues/65)) ([f02ceaf](https://github.com/iotaledger/twin-rights-management/commit/f02ceaf0a53083f088690c7d3a384045b1061821))
|
|
230
|
+
* consistent uid usage ([#83](https://github.com/iotaledger/twin-rights-management/issues/83)) ([bdfb9f9](https://github.com/iotaledger/twin-rights-management/commit/bdfb9f92777cbfdb65b5b7df5660b70d869ed19d))
|
|
231
|
+
* engine compatibility updates ([490e015](https://github.com/iotaledger/twin-rights-management/commit/490e015901d6a5ac6563da484a18fc5f285556b1))
|
|
232
|
+
* eslint migration to flat config ([5313718](https://github.com/iotaledger/twin-rights-management/commit/5313718f15efb4f6b1f257bf9807770baef7eed3))
|
|
233
|
+
* eslint migration to flat config ([23a0c08](https://github.com/iotaledger/twin-rights-management/commit/23a0c085e7fc2e522c8d85d325dc5844b9c3fd8e))
|
|
234
|
+
* improve json path handling ([#133](https://github.com/iotaledger/twin-rights-management/issues/133)) ([0a3c0c4](https://github.com/iotaledger/twin-rights-management/commit/0a3c0c41f15f74a6e2463ed9802c7b662d3e95f6))
|
|
235
|
+
* international dataspaces contract negotiation ([#41](https://github.com/iotaledger/twin-rights-management/issues/41)) ([41ed515](https://github.com/iotaledger/twin-rights-management/commit/41ed5154d6cef48bc99db3158dbde6ec88523a0b))
|
|
236
|
+
* introduce context for additional environment input ([e1d0392](https://github.com/iotaledger/twin-rights-management/commit/e1d0392622e5a018b695644f423c5b23cc40d3b7))
|
|
237
|
+
* move create and verify proofs to helper ([a4e1f4a](https://github.com/iotaledger/twin-rights-management/commit/a4e1f4afe01ea12c36f29672197128e65819c875))
|
|
238
|
+
* organization identifiers ([#177](https://github.com/iotaledger/twin-rights-management/issues/177)) ([98d2484](https://github.com/iotaledger/twin-rights-management/commit/98d24841e3ecbb9a5225c151d171f8a9c08ccfbc))
|
|
239
|
+
* pap create, update methods ([#13](https://github.com/iotaledger/twin-rights-management/issues/13)) ([edb6c9e](https://github.com/iotaledger/twin-rights-management/commit/edb6c9efcfda55ac96f7594253bf831b4f0e5993))
|
|
240
|
+
* pdp add ([#39](https://github.com/iotaledger/twin-rights-management/issues/39)) ([68b9a8a](https://github.com/iotaledger/twin-rights-management/commit/68b9a8a7a3cf2902f9eecb590ca3316c6b1671f0))
|
|
241
|
+
* pnp callback encryption, getDatasetTargets helper, engine-driven callbackPath ([#132](https://github.com/iotaledger/twin-rights-management/issues/132)) ([e642154](https://github.com/iotaledger/twin-rights-management/commit/e6421546336bfa73a7c0a9fe102beeaa518249dd))
|
|
242
|
+
* remove data access point ([#67](https://github.com/iotaledger/twin-rights-management/issues/67)) ([8573676](https://github.com/iotaledger/twin-rights-management/commit/8573676862c9f1634a66a0677b225b4de16a89cd))
|
|
243
|
+
* remove element factories ([8cb4af8](https://github.com/iotaledger/twin-rights-management/commit/8cb4af85a5c9c01e3b68ecc7109cf701b914ea9a))
|
|
244
|
+
* remove hosting component ([#207](https://github.com/iotaledger/twin-rights-management/issues/207)) ([2a51690](https://github.com/iotaledger/twin-rights-management/commit/2a5169085b7df2245a474580e88b5b4e501006fe))
|
|
245
|
+
* remove unnecessary config options from service ([31ef3a2](https://github.com/iotaledger/twin-rights-management/commit/31ef3a2eb2293efdad7e6b8b55f105cc62bba3ed))
|
|
246
|
+
* remove unused namespace ([e8aa679](https://github.com/iotaledger/twin-rights-management/commit/e8aa679479231a49f86dd8dec5f9b811bd3f595f))
|
|
247
|
+
* rename pap entity storage to pap service ([38a2c14](https://github.com/iotaledger/twin-rights-management/commit/38a2c14d8f63a86e398820166c83437be5aca1b8))
|
|
248
|
+
* rights management pap ([#4](https://github.com/iotaledger/twin-rights-management/issues/4)) ([d1165a9](https://github.com/iotaledger/twin-rights-management/commit/d1165a92f57128731cfb308d977832e28cf33493))
|
|
249
|
+
* separate rest routes ([538b86b](https://github.com/iotaledger/twin-rights-management/commit/538b86be26b46711279101aa01fec119419d8149))
|
|
250
|
+
* simplify pnap create request ([be4dfe7](https://github.com/iotaledger/twin-rights-management/commit/be4dfe726a0bc7af11eb05cfd0525e7bff8a7d98))
|
|
251
|
+
* typescript 6 update ([18f6f1e](https://github.com/iotaledger/twin-rights-management/commit/18f6f1edba890462c068ba0b76ae6dd005e798be))
|
|
252
|
+
* update contexts ([#63](https://github.com/iotaledger/twin-rights-management/issues/63)) ([e55200f](https://github.com/iotaledger/twin-rights-management/commit/e55200f9929eaced6c446be25969dbe0f95ee909))
|
|
253
|
+
* update dataspace protocol dependencies ([9dcc477](https://github.com/iotaledger/twin-rights-management/commit/9dcc47755c2f5a7fd3ef30e656f1988944cd4b54))
|
|
254
|
+
* update dataspace standards packages ([dbd5bf6](https://github.com/iotaledger/twin-rights-management/commit/dbd5bf62403a97c758ee2320d9cac378c568165b))
|
|
255
|
+
* update dependencies ([5bfbb30](https://github.com/iotaledger/twin-rights-management/commit/5bfbb302bb245c8cd8015ff497db3793077d43cd))
|
|
256
|
+
* update dependencies ([dd0a553](https://github.com/iotaledger/twin-rights-management/commit/dd0a553020b0dc5c41fb6865a2e36bd26045b0b9))
|
|
257
|
+
* update dspace dependencies ([072917b](https://github.com/iotaledger/twin-rights-management/commit/072917bcfa052a6d61e6cd3676e275ba7fc4ec25))
|
|
258
|
+
* update framework core ([d0ffcba](https://github.com/iotaledger/twin-rights-management/commit/d0ffcba9cf1dc2b562193ee298f099612d100ce8))
|
|
259
|
+
* update namespaces and contexts ([#61](https://github.com/iotaledger/twin-rights-management/issues/61)) ([033446b](https://github.com/iotaledger/twin-rights-management/commit/033446b91ccf0c7664061afda9a1ad49d3c671ec))
|
|
260
|
+
* update naming ([e75ae80](https://github.com/iotaledger/twin-rights-management/commit/e75ae80dcf3d8099a1dea32ef498efb640de52ef))
|
|
261
|
+
* update processors ([#71](https://github.com/iotaledger/twin-rights-management/issues/71)) ([d6e8c1e](https://github.com/iotaledger/twin-rights-management/commit/d6e8c1e593acb28556674d5180123f220766eb6b))
|
|
262
|
+
* update standards packages ([db0740b](https://github.com/iotaledger/twin-rights-management/commit/db0740b1d8925fcb3bf4204641e0dc573af40f2b))
|
|
263
|
+
* update to more specific ds odrl types ([c56dc49](https://github.com/iotaledger/twin-rights-management/commit/c56dc4991d4e1e8ca3beb737d2a70dddf6f5cd44))
|
|
264
|
+
* update to use built in vc authentication ([f982b86](https://github.com/iotaledger/twin-rights-management/commit/f982b8676a7d21add85195c73558ef4f0fd9be29))
|
|
265
|
+
* update twindev schemas ([5d4edc1](https://github.com/iotaledger/twin-rights-management/commit/5d4edc1326fef611619d4b371a5d05a75ada719a))
|
|
266
|
+
* use Bearer format for token headers ([74d7d7c](https://github.com/iotaledger/twin-rights-management/commit/74d7d7cc59906c78798f78c5ed9211a3ee8dcd10))
|
|
267
|
+
* use per request http headers ([#59](https://github.com/iotaledger/twin-rights-management/issues/59)) ([8806642](https://github.com/iotaledger/twin-rights-management/commit/88066429c362ac98fb870727a4fc55c9b533f1a4))
|
|
268
|
+
* use url transformer ([79b3b91](https://github.com/iotaledger/twin-rights-management/commit/79b3b918e622a11621548c5fe80ed77c335e947b))
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
### Bug Fixes
|
|
272
|
+
|
|
273
|
+
* adding missing dependency ([#15](https://github.com/iotaledger/twin-rights-management/issues/15)) ([c7e6267](https://github.com/iotaledger/twin-rights-management/commit/c7e62678b296ef8d28c31921cb78aeabe674cd84))
|
|
274
|
+
* comment ([6ddc741](https://github.com/iotaledger/twin-rights-management/commit/6ddc7410088865de7bd68c814221f747de43a13f))
|
|
275
|
+
* make logging tests deterministic and complete hosting mock ([#173](https://github.com/iotaledger/twin-rights-management/issues/173)) ([80fa587](https://github.com/iotaledger/twin-rights-management/commit/80fa587a83cb73ab0cfc14b40fa7b878ccf64da5))
|
|
276
|
+
* modifying the function name for the rest routes ([#6](https://github.com/iotaledger/twin-rights-management/issues/6)) ([7915111](https://github.com/iotaledger/twin-rights-management/commit/7915111ac608c9d69bcaa819c85b553fc9bace6a))
|
|
277
|
+
* query params force coercion ([8590a0d](https://github.com/iotaledger/twin-rights-management/commit/8590a0da92584c04b67e73c448319f96f70c34a5))
|
|
278
|
+
* resolve 5 bugs preventing PNP contract negotiation callbacks ([#98](https://github.com/iotaledger/twin-rights-management/issues/98)) ([4a065d6](https://github.com/iotaledger/twin-rights-management/commit/4a065d669440f47dc44c3602abe7efa1ea9d45ff))
|
|
279
|
+
* slimline openapi spec ([aacb9d5](https://github.com/iotaledger/twin-rights-management/commit/aacb9d50f80d3652ef7419ca3777f53e542773f1))
|
|
280
|
+
* use async getStore in tests ([61b9951](https://github.com/iotaledger/twin-rights-management/commit/61b99512f90faa26d22d57b6fbd3186a5cb53672))
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
### Dependencies
|
|
284
|
+
|
|
285
|
+
* The following workspace dependencies were updated
|
|
286
|
+
* dependencies
|
|
287
|
+
* @twin.org/rights-management-models bumped from 0.9.1-next.0 to 0.9.1-next.1
|
|
288
|
+
* devDependencies
|
|
289
|
+
* @twin.org/rights-management-pap-service bumped from 0.9.1-next.0 to 0.9.1-next.1
|
|
290
|
+
* @twin.org/rights-management-pdp-service bumped from 0.9.1-next.0 to 0.9.1-next.1
|
|
291
|
+
* @twin.org/rights-management-pep-service bumped from 0.9.1-next.0 to 0.9.1-next.1
|
|
292
|
+
* @twin.org/rights-management-pip-service bumped from 0.9.1-next.0 to 0.9.1-next.1
|
|
293
|
+
* @twin.org/rights-management-pmp-service bumped from 0.9.1-next.0 to 0.9.1-next.1
|
|
294
|
+
* @twin.org/rights-management-pnp-service bumped from 0.9.1-next.0 to 0.9.1-next.1
|
|
295
|
+
* @twin.org/rights-management-pxp-service bumped from 0.9.1-next.0 to 0.9.1-next.1
|
|
296
|
+
|
|
9
297
|
## [0.9.0](https://github.com/iotaledger/twin-rights-management/compare/rights-management-service-v0.9.0...rights-management-service-v0.9.0) (2026-06-25)
|
|
10
298
|
|
|
11
299
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Function: papCreate()
|
|
2
2
|
|
|
3
|
-
> **papCreate**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`ICreatedResponse`\>
|
|
3
|
+
> **papCreate**(`httpRequestContext`, `componentName`, `request`, `baseRouteName`): `Promise`\<`ICreatedResponse`\>
|
|
4
4
|
|
|
5
5
|
PAP: Create a policy.
|
|
6
6
|
|
|
@@ -24,6 +24,12 @@ The name of the component to use in the routes.
|
|
|
24
24
|
|
|
25
25
|
The request.
|
|
26
26
|
|
|
27
|
+
### baseRouteName
|
|
28
|
+
|
|
29
|
+
`string`
|
|
30
|
+
|
|
31
|
+
The base route name to use for generating the location header.
|
|
32
|
+
|
|
27
33
|
## Returns
|
|
28
34
|
|
|
29
35
|
`Promise`\<`ICreatedResponse`\>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Function: pnapCreate()
|
|
2
2
|
|
|
3
|
-
> **pnapCreate**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`ICreatedResponse`\>
|
|
3
|
+
> **pnapCreate**(`httpRequestContext`, `componentName`, `request`, `baseRouteName`): `Promise`\<`ICreatedResponse`\>
|
|
4
4
|
|
|
5
5
|
PNAP: Pre-register a consumer-side policy negotiation entry.
|
|
6
6
|
|
|
@@ -24,6 +24,12 @@ The name of the component to use in the routes.
|
|
|
24
24
|
|
|
25
25
|
The request.
|
|
26
26
|
|
|
27
|
+
### baseRouteName
|
|
28
|
+
|
|
29
|
+
`string`
|
|
30
|
+
|
|
31
|
+
The base route name to use for the Location header.
|
|
32
|
+
|
|
27
33
|
## Returns
|
|
28
34
|
|
|
29
35
|
`Promise`\<`ICreatedResponse`\>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/rights-management-service",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1-next.10",
|
|
4
4
|
"description": "Unified rights management service exposing policy and negotiation capabilities.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
"node": ">=20.0.0"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@twin.org/api-models": "
|
|
22
|
-
"@twin.org/context": "
|
|
23
|
-
"@twin.org/core": "
|
|
24
|
-
"@twin.org/data-json-ld": "
|
|
25
|
-
"@twin.org/entity": "
|
|
26
|
-
"@twin.org/nameof": "
|
|
27
|
-
"@twin.org/rights-management-models": "
|
|
28
|
-
"@twin.org/standards-dataspace-protocol": "
|
|
29
|
-
"@twin.org/standards-w3c-did": "
|
|
30
|
-
"@twin.org/standards-w3c-odrl": "
|
|
31
|
-
"@twin.org/web": "
|
|
21
|
+
"@twin.org/api-models": "next",
|
|
22
|
+
"@twin.org/context": "next",
|
|
23
|
+
"@twin.org/core": "next",
|
|
24
|
+
"@twin.org/data-json-ld": "next",
|
|
25
|
+
"@twin.org/entity": "next",
|
|
26
|
+
"@twin.org/nameof": "next",
|
|
27
|
+
"@twin.org/rights-management-models": "0.9.1-next.10",
|
|
28
|
+
"@twin.org/standards-dataspace-protocol": "next",
|
|
29
|
+
"@twin.org/standards-w3c-did": "next",
|
|
30
|
+
"@twin.org/standards-w3c-odrl": "next",
|
|
31
|
+
"@twin.org/web": "next"
|
|
32
32
|
},
|
|
33
33
|
"main": "./dist/es/index.js",
|
|
34
34
|
"types": "./dist/types/index.d.ts",
|