@twin.org/rights-management-service 0.0.3-next.21 → 0.0.3-next.23

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/README.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # TWIN Rights Management Service
2
2
 
3
- Rights Management service implementation and REST endpoint definitions.
3
+ This package provides a unified rights management service exposing policy and negotiation capabilities. It is designed for deployments that want a consolidated service interface.
4
4
 
5
5
  ## Installation
6
6
 
7
- ```shell
7
+ `shell
8
8
  npm install @twin.org/rights-management-service
9
- ```
9
+ `
10
+
11
+ ## Testing
12
+
13
+ Run the package test suite with:
14
+
15
+ `shell
16
+ npm test
17
+ `
10
18
 
11
19
  ## Examples
12
20
 
@@ -539,20 +539,10 @@ export async function pnpNegotiationRequest(httpRequestContext, componentName, r
539
539
  Guards.object(ROUTES_SOURCE, "request.body", request.body);
540
540
  const hostingComponent = ComponentFactory.get(httpRequestContext.hostingComponentType ?? "hosting");
541
541
  const component = ComponentFactory.get(componentName);
542
- const result = await component.requestFromConsumer(request.body, await hostingComponent.getPublicOrigin(httpRequestContext.serverRequest.url), HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
542
+ const result = await component.requestFromConsumer(request.body, HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]), await hostingComponent.getPublicOrigin(httpRequestContext.serverRequest.url));
543
543
  const isUpdate = Is.stringValue(request.pathParams?.id);
544
- if (isUpdate) {
545
- return {
546
- statusCode: mapError(result),
547
- headers: {
548
- [HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd
549
- ? MimeTypes.JsonLd
550
- : MimeTypes.Json
551
- }
552
- };
553
- }
554
544
  return {
555
- statusCode: mapError(result) ?? HttpStatusCode.created,
545
+ statusCode: mapError(result) ?? (isUpdate ? undefined : HttpStatusCode.created),
556
546
  headers: {
557
547
  [HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd
558
548
  ? MimeTypes.JsonLd
@@ -573,9 +563,8 @@ export async function pnpNegotiationProviderEvents(httpRequestContext, component
573
563
  Guards.object(ROUTES_SOURCE, "request.headers", request.headers);
574
564
  Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
575
565
  Guards.object(ROUTES_SOURCE, "request.body", request.body);
576
- const hostingComponent = ComponentFactory.get(httpRequestContext.hostingComponentType ?? "hosting");
577
566
  const component = ComponentFactory.get(componentName);
578
- const result = await component.event(request.body, request.pathParams.id === request.body.providerPid ? "provider" : "consumer", await hostingComponent.getPublicOrigin(httpRequestContext.serverRequest.url), HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
567
+ const result = await component.event(request.body, request.pathParams.id === request.body.providerPid ? "provider" : "consumer", HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
579
568
  return {
580
569
  statusCode: mapError(result),
581
570
  headers: {
@@ -598,9 +587,8 @@ export async function pnpNegotiationAgreementVerification(httpRequestContext, co
598
587
  Guards.object(ROUTES_SOURCE, "request.headers", request.headers);
599
588
  Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
600
589
  Guards.object(ROUTES_SOURCE, "request.body", request.body);
601
- const hostingComponent = ComponentFactory.get(httpRequestContext.hostingComponentType ?? "hosting");
602
590
  const component = ComponentFactory.get(componentName);
603
- const result = await component.agreementVerificationFromConsumer(request.body, await hostingComponent.getPublicOrigin(httpRequestContext.serverRequest.url), HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
591
+ const result = await component.agreementVerificationFromConsumer(request.body, HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
604
592
  return {
605
593
  statusCode: mapError(result),
606
594
  headers: {
@@ -646,22 +634,11 @@ export async function pnpNegotiationOffer(httpRequestContext, componentName, req
646
634
  Guards.object(ROUTES_SOURCE, "request", request);
647
635
  Guards.object(ROUTES_SOURCE, "request.headers", request.headers);
648
636
  Guards.object(ROUTES_SOURCE, "request.body", request.body);
649
- const hostingComponent = ComponentFactory.get(httpRequestContext.hostingComponentType ?? "hosting");
650
637
  const component = ComponentFactory.get(componentName);
651
- const result = await component.offerFromProvider(request.body, await hostingComponent.getPublicOrigin(httpRequestContext.serverRequest.url), HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
638
+ const result = await component.offerFromProvider(request.body, HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
652
639
  const isUpdate = Is.stringValue(request.pathParams?.id);
653
- if (isUpdate) {
654
- return {
655
- statusCode: mapError(result),
656
- headers: {
657
- [HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd
658
- ? MimeTypes.JsonLd
659
- : MimeTypes.Json
660
- }
661
- };
662
- }
663
640
  return {
664
- statusCode: mapError(result) ?? HttpStatusCode.created,
641
+ statusCode: mapError(result) ?? (isUpdate ? undefined : HttpStatusCode.created),
665
642
  headers: {
666
643
  [HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd
667
644
  ? MimeTypes.JsonLd
@@ -681,10 +658,9 @@ export async function pnpNegotiationAgreement(httpRequestContext, componentName,
681
658
  Guards.object(ROUTES_SOURCE, "request", request);
682
659
  Guards.object(ROUTES_SOURCE, "request.headers", request.headers);
683
660
  Guards.object(ROUTES_SOURCE, "request.body", request.body);
684
- Guards.object(ROUTES_SOURCE, "request.body", request.body);
685
- const hostingComponent = ComponentFactory.get(httpRequestContext.hostingComponentType ?? "hosting");
661
+ Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
686
662
  const component = ComponentFactory.get(componentName);
687
- const result = await component.agreementFromProvider(request.body, await hostingComponent.getPublicOrigin(httpRequestContext.serverRequest.url), HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
663
+ const result = await component.agreementFromProvider(request.body, HeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization]));
688
664
  return {
689
665
  statusCode: mapError(result),
690
666
  headers: {
@@ -1 +1 @@
1
- {"version":3,"file":"policyNegotiationPointRoutes.js","sourceRoot":"","sources":["../../src/policyNegotiationPointRoutes.ts"],"names":[],"mappings":"AAQA,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,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAErF;;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,IAAI;IACJ,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,EAAE,EAAE,CAC9C,iBAAiB,CAAC,kBAAkB,EAAE,aAAa,EAAE,OAAO,CAAC;QAC9D,WAAW,EAAE;YACZ,IAAI,6BAAqC;YACzC,QAAQ,EAAE;gBACT;oBACC,EAAE,EAAE,iCAAiC;oBACrC,OAAO,EAAE;wBACR,OAAO,EAAE;4BACR,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM;4BACtC,C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CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CACxE,CAAC;IAEF,OAAO;QACN,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC;QAC5B,OAAO,EAAE;YACR,CAAC,WAAW,CAAC,WAAW,CAAC,EACxB,OAAO,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC,MAAM;gBACzD,CAAC,CAAC,SAAS,CAAC,MAAM;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 {\n\tIHostingComponent,\n\tIHttpRequestContext,\n\tIRestRoute,\n\tITag\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 { 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// v\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 hostingComponent = ComponentFactory.get<IHostingComponent>(\n\t\thttpRequestContext.hostingComponentType ?? \"hosting\"\n\t);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.requestFromConsumer(\n\t\trequest.body,\n\t\tawait hostingComponent.getPublicOrigin(httpRequestContext.serverRequest.url),\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\tconst isUpdate = Is.stringValue(request.pathParams?.id);\n\n\tif (isUpdate) {\n\t\treturn {\n\t\t\tstatusCode: mapError(result),\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.ContentType]:\n\t\t\t\t\trequest.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd\n\t\t\t\t\t\t? MimeTypes.JsonLd\n\t\t\t\t\t\t: MimeTypes.Json\n\t\t\t}\n\t\t};\n\t}\n\treturn {\n\t\tstatusCode: mapError(result) ?? 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 hostingComponent = ComponentFactory.get<IHostingComponent>(\n\t\thttpRequestContext.hostingComponentType ?? \"hosting\"\n\t);\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\tawait hostingComponent.getPublicOrigin(httpRequestContext.serverRequest.url),\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 hostingComponent = ComponentFactory.get<IHostingComponent>(\n\t\thttpRequestContext.hostingComponentType ?? \"hosting\"\n\t);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.agreementVerificationFromConsumer(\n\t\trequest.body,\n\t\tawait hostingComponent.getPublicOrigin(httpRequestContext.serverRequest.url),\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 hostingComponent = ComponentFactory.get<IHostingComponent>(\n\t\thttpRequestContext.hostingComponentType ?? \"hosting\"\n\t);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.offerFromProvider(\n\t\trequest.body,\n\t\tawait hostingComponent.getPublicOrigin(httpRequestContext.serverRequest.url),\n\t\tHeaderHelper.extractBearer(request.headers?.[HeaderTypes.Authorization])\n\t);\n\n\tconst isUpdate = Is.stringValue(request.pathParams?.id);\n\n\tif (isUpdate) {\n\t\treturn {\n\t\t\tstatusCode: mapError(result),\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.ContentType]:\n\t\t\t\t\trequest.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd\n\t\t\t\t\t\t? MimeTypes.JsonLd\n\t\t\t\t\t\t: MimeTypes.Json\n\t\t\t}\n\t\t};\n\t}\n\treturn {\n\t\tstatusCode: mapError(result) ?? 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.body),\n\t\trequest.body\n\t);\n\n\tconst hostingComponent = ComponentFactory.get<IHostingComponent>(\n\t\thttpRequestContext.hostingComponentType ?? \"hosting\"\n\t);\n\n\tconst component = ComponentFactory.get<IPolicyNegotiationPointComponent>(componentName);\n\tconst result = await component.agreementFromProvider(\n\t\trequest.body,\n\t\tawait hostingComponent.getPublicOrigin(httpRequestContext.serverRequest.url),\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":"AAQA,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,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAErF;;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,IAAI;IACJ,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,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AAa,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,OAAO;QACN,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC;QAC5B,OAAO,EAAE;YACR,CAAC,WAAW,CAAC,WAAW,CAAC,EACxB,OAAO,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC,MAAM;gBACzD,CAAC,CAAC,SAAS,CAAC,MAAM;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 {\n\tIHostingComponent,\n\tIHttpRequestContext,\n\tIRestRoute,\n\tITag\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 { 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// v\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 hostingComponent = ComponentFactory.get<IHostingComponent>(\n\t\thttpRequestContext.hostingComponentType ?? \"hosting\"\n\t);\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\tawait hostingComponent.getPublicOrigin(httpRequestContext.serverRequest.url)\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"]}
package/docs/changelog.md CHANGED
@@ -1,4 +1,48 @@
1
- # @twin.org/rights-management-pap-service - Changelog
1
+ # Changelog
2
+
3
+ ## [0.0.3-next.23](https://github.com/twinfoundation/rights-management/compare/rights-management-service-v0.0.3-next.22...rights-management-service-v0.0.3-next.23) (2026-03-13)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * resolve 5 bugs preventing PNP contract negotiation callbacks ([#98](https://github.com/twinfoundation/rights-management/issues/98)) ([4a065d6](https://github.com/twinfoundation/rights-management/commit/4a065d669440f47dc44c3602abe7efa1ea9d45ff))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/rights-management-models bumped from 0.0.3-next.22 to 0.0.3-next.23
16
+ * devDependencies
17
+ * @twin.org/rights-management-pap-service bumped from 0.0.3-next.22 to 0.0.3-next.23
18
+ * @twin.org/rights-management-pdp-service bumped from 0.0.3-next.22 to 0.0.3-next.23
19
+ * @twin.org/rights-management-pep-service bumped from 0.0.3-next.22 to 0.0.3-next.23
20
+ * @twin.org/rights-management-pip-service bumped from 0.0.3-next.22 to 0.0.3-next.23
21
+ * @twin.org/rights-management-pmp-service bumped from 0.0.3-next.22 to 0.0.3-next.23
22
+ * @twin.org/rights-management-pnp-service bumped from 0.0.3-next.22 to 0.0.3-next.23
23
+ * @twin.org/rights-management-pxp-service bumped from 0.0.3-next.22 to 0.0.3-next.23
24
+
25
+ ## [0.0.3-next.22](https://github.com/twinfoundation/rights-management/compare/rights-management-service-v0.0.3-next.21...rights-management-service-v0.0.3-next.22) (2026-03-09)
26
+
27
+
28
+ ### Miscellaneous Chores
29
+
30
+ * **rights-management-service:** Synchronize repo versions
31
+
32
+
33
+ ### Dependencies
34
+
35
+ * The following workspace dependencies were updated
36
+ * dependencies
37
+ * @twin.org/rights-management-models bumped from 0.0.3-next.21 to 0.0.3-next.22
38
+ * devDependencies
39
+ * @twin.org/rights-management-pap-service bumped from 0.0.3-next.21 to 0.0.3-next.22
40
+ * @twin.org/rights-management-pdp-service bumped from 0.0.3-next.21 to 0.0.3-next.22
41
+ * @twin.org/rights-management-pep-service bumped from 0.0.3-next.21 to 0.0.3-next.22
42
+ * @twin.org/rights-management-pip-service bumped from 0.0.3-next.21 to 0.0.3-next.22
43
+ * @twin.org/rights-management-pmp-service bumped from 0.0.3-next.21 to 0.0.3-next.22
44
+ * @twin.org/rights-management-pnp-service bumped from 0.0.3-next.21 to 0.0.3-next.22
45
+ * @twin.org/rights-management-pxp-service bumped from 0.0.3-next.21 to 0.0.3-next.22
2
46
 
3
47
  ## [0.0.3-next.21](https://github.com/twinfoundation/rights-management/compare/rights-management-service-v0.0.3-next.20...rights-management-service-v0.0.3-next.21) (2026-03-06)
4
48
 
package/docs/examples.md CHANGED
@@ -1 +1,47 @@
1
- # @twin.org/rights-management-pap-service - Examples
1
+ # Rights Management Service Examples
2
+
3
+ These snippets show how to compose route collections and expose entry points for hosting components without wiring routes manually.
4
+
5
+ ## Route Generators
6
+
7
+ ```typescript
8
+ import {
9
+ generateRestRoutesPolicyAdministrationPoint,
10
+ generateRestRoutesPolicyNegotiationAdminPoint,
11
+ generateRestRoutesPolicyNegotiationPoint,
12
+ papTags,
13
+ pnapTags,
14
+ pnpTags
15
+ } from '@twin.org/rights-management-service';
16
+
17
+ const papRoutes = generateRestRoutesPolicyAdministrationPoint(
18
+ '/rights-management',
19
+ 'policy-administration-point'
20
+ );
21
+ const pnapRoutes = generateRestRoutesPolicyNegotiationAdminPoint(
22
+ '/rights-management',
23
+ 'policy-negotiation-admin-point'
24
+ );
25
+ const pnpRoutes = generateRestRoutesPolicyNegotiationPoint(
26
+ '/rights-management',
27
+ 'policy-negotiation-point'
28
+ );
29
+
30
+ console.log(papRoutes.length); // 8
31
+ console.log(pnapRoutes.length); // 4
32
+ console.log(pnpRoutes.length); // 8
33
+ console.log(papTags[0].name); // Policy Administration Point
34
+ console.log(pnapTags[0].name); // Policy Negotiation Administration Point
35
+ console.log(pnpTags[0].name); // Policy Negotiation Point
36
+ ```
37
+
38
+ ## REST Entry Points
39
+
40
+ ```typescript
41
+ import { restEntryPoints } from '@twin.org/rights-management-service';
42
+
43
+ const entryNames = restEntryPoints.map(entry => entry.name);
44
+
45
+ console.log(entryNames); // [ 'policy-administration-point', 'policy-negotiation-point', 'policy-negotiation-admin-point' ]
46
+ console.log(restEntryPoints[0].defaultBaseRoute); // rights-management
47
+ ```
@@ -3595,360 +3595,6 @@
3595
3595
  ],
3596
3596
  "description": "Set interface compliant with Eclipse Data Space Protocol.\n\nExtends IOdrlSet with DS Protocol-specific constraints:\n- `@id` is REQUIRED (used as the primary set identifier in DS Protocol)\n- `@context` is omitted (inherited from the parent Dataset/Distribution)"
3597
3597
  },
3598
- "DcatContextType": {
3599
- "type": "object",
3600
- "additionalProperties": {
3601
- "anyOf": [
3602
- {
3603
- "$ref": "https://schema.twindev.org/json-ld/JsonLdExpandedTermDefinition"
3604
- },
3605
- {
3606
- "type": [
3607
- "null",
3608
- "string"
3609
- ]
3610
- }
3611
- ]
3612
- },
3613
- "properties": {
3614
- "@base": {
3615
- "type": [
3616
- "string",
3617
- "null"
3618
- ]
3619
- },
3620
- "@direction": {
3621
- "type": [
3622
- "string",
3623
- "null"
3624
- ],
3625
- "enum": [
3626
- "ltr",
3627
- "rtl",
3628
- null
3629
- ]
3630
- },
3631
- "@import": {
3632
- "type": "string"
3633
- },
3634
- "@language": {
3635
- "type": "string"
3636
- },
3637
- "@propagate": {
3638
- "type": "boolean"
3639
- },
3640
- "@protected": {
3641
- "type": "boolean"
3642
- },
3643
- "@type": {
3644
- "type": "object",
3645
- "properties": {
3646
- "@container": {
3647
- "type": "string",
3648
- "const": "@set"
3649
- },
3650
- "@protected": {
3651
- "type": "boolean"
3652
- }
3653
- },
3654
- "required": [
3655
- "@container"
3656
- ]
3657
- },
3658
- "@version": {
3659
- "type": "string",
3660
- "const": "1.1"
3661
- },
3662
- "@vocab": {
3663
- "type": [
3664
- "string",
3665
- "null"
3666
- ]
3667
- },
3668
- "dcat": {
3669
- "type": "string",
3670
- "const": "http://www.w3.org/ns/dcat#"
3671
- },
3672
- "dcterms": {
3673
- "type": "string",
3674
- "const": "http://purl.org/dc/terms/"
3675
- },
3676
- "odrl": {
3677
- "type": "string",
3678
- "const": "http://www.w3.org/ns/odrl/2/"
3679
- },
3680
- "foaf": {
3681
- "type": "string",
3682
- "const": "https://xmlns.com/foaf/0.1/"
3683
- }
3684
- },
3685
- "required": [
3686
- "dcat",
3687
- "dcterms"
3688
- ],
3689
- "description": "The DCAT JSON-LD context type. Supports the DCAT context URL or arrays with additional context definitions."
3690
- },
3691
- "DcatDateTimeType": {
3692
- "type": "string",
3693
- "description": "Date/time values in ISO 8601 format. Can be xsd:date, xsd:dateTime, or xsd:gYear."
3694
- },
3695
- "DcatLiteralType": {
3696
- "anyOf": [
3697
- {
3698
- "type": "string"
3699
- },
3700
- {
3701
- "type": "array",
3702
- "items": {
3703
- "type": "string"
3704
- }
3705
- }
3706
- ],
3707
- "description": "Literal values can be strings or arrays of strings (for multi-valued properties)."
3708
- },
3709
- "DcatRelationship": {
3710
- "type": "object",
3711
- "properties": {
3712
- "@context": {
3713
- "$ref": "#/components/schemas/DcatContextType"
3714
- },
3715
- "@type": {
3716
- "type": "string",
3717
- "const": "dcat:Relationship",
3718
- "description": "The type identifier, typically \"Relationship\"."
3719
- },
3720
- "dcterms:relation": {
3721
- "anyOf": [
3722
- {
3723
- "$ref": "https://schema.twindev.org/json-ld/JsonLdNodeObject"
3724
- },
3725
- {
3726
- "type": "string"
3727
- }
3728
- ],
3729
- "description": "The link to a related resource."
3730
- },
3731
- "dcat:hadRole": {
3732
- "$ref": "#/components/schemas/DcatRole"
3733
- }
3734
- },
3735
- "required": [
3736
- "@context",
3737
- "@type"
3738
- ],
3739
- "description": "Interface for DCAT Relationship. An association class for attaching additional information to a relationship between DCAT Resources."
3740
- },
3741
- "DcatResource": {
3742
- "type": "object",
3743
- "properties": {
3744
- "@context": {
3745
- "$ref": "#/components/schemas/DcatContextType"
3746
- },
3747
- "@type": {
3748
- "type": "string",
3749
- "enum": [
3750
- "dcat:Resource",
3751
- "dcat:Dataset",
3752
- "dcat:DataService",
3753
- "dcat:Catalog",
3754
- "dcat:DatasetSeries"
3755
- ],
3756
- "description": "The type of the resource. Typically \"Catalog\", \"Dataset\", \"DataService\", \"DatasetSeries\", or the base \"Resource\"."
3757
- },
3758
- "@id": {
3759
- "type": "string",
3760
- "description": "The unique identifier for the resource."
3761
- },
3762
- "dcterms:title": {
3763
- "$ref": "#/components/schemas/DcatLiteralType"
3764
- },
3765
- "dcterms:description": {
3766
- "$ref": "#/components/schemas/DcatLiteralType"
3767
- },
3768
- "dcterms:identifier": {
3769
- "$ref": "#/components/schemas/DcatLiteralType"
3770
- },
3771
- "dcterms:issued": {
3772
- "$ref": "#/components/schemas/DcatDateTimeType"
3773
- },
3774
- "dcterms:modified": {
3775
- "$ref": "#/components/schemas/DcatDateTimeType"
3776
- },
3777
- "dcterms:language": {
3778
- "description": "Object or array data type",
3779
- "anyOf": [
3780
- {
3781
- "type": "string"
3782
- },
3783
- {
3784
- "type": "array",
3785
- "items": {
3786
- "type": "string"
3787
- }
3788
- }
3789
- ]
3790
- },
3791
- "dcterms:publisher": {
3792
- "anyOf": [
3793
- {
3794
- "$ref": "#/components/schemas/JsonLdObjectWithAliases<FoafAgent%2C%22foaf%22>"
3795
- },
3796
- {
3797
- "type": "string"
3798
- }
3799
- ],
3800
- "description": "An entity responsible for making the resource available."
3801
- },
3802
- "dcterms:creator": {
3803
- "anyOf": [
3804
- {
3805
- "$ref": "#/components/schemas/JsonLdObjectWithAliases<FoafAgent%2C%22foaf%22>"
3806
- },
3807
- {
3808
- "type": "string"
3809
- }
3810
- ],
3811
- "description": "An entity responsible for producing the resource."
3812
- },
3813
- "dcterms:accessRights": {
3814
- "anyOf": [
3815
- {
3816
- "$ref": "https://schema.twindev.org/json-ld/JsonLdNodeObject"
3817
- },
3818
- {
3819
- "type": "string"
3820
- }
3821
- ],
3822
- "description": "Information about who can access the resource or an indication of its security status."
3823
- },
3824
- "dcterms:license": {
3825
- "anyOf": [
3826
- {
3827
- "$ref": "https://schema.twindev.org/json-ld/JsonLdNodeObject"
3828
- },
3829
- {
3830
- "type": "string"
3831
- }
3832
- ],
3833
- "description": "A legal document under which the resource is made available."
3834
- },
3835
- "dcterms:rights": {
3836
- "anyOf": [
3837
- {
3838
- "$ref": "https://schema.twindev.org/json-ld/JsonLdNodeObject"
3839
- },
3840
- {
3841
- "type": "string"
3842
- }
3843
- ],
3844
- "description": "Information about rights held in and over the resource."
3845
- },
3846
- "dcterms:conformsTo": {
3847
- "description": "Object or array data type",
3848
- "anyOf": [
3849
- {
3850
- "type": "string"
3851
- },
3852
- {
3853
- "type": "array",
3854
- "items": {
3855
- "type": "string"
3856
- }
3857
- }
3858
- ]
3859
- },
3860
- "dcterms:type": {
3861
- "type": "string",
3862
- "description": "The nature or genre of the resource."
3863
- },
3864
- "dcat:contactPoint": {
3865
- "anyOf": [
3866
- {
3867
- "$ref": "https://schema.twindev.org/json-ld/JsonLdNodeObject"
3868
- },
3869
- {
3870
- "type": "string"
3871
- }
3872
- ],
3873
- "description": "Relevant contact information for the catalogued resource."
3874
- },
3875
- "dcat:keyword": {
3876
- "$ref": "#/components/schemas/DcatLiteralType"
3877
- },
3878
- "dcat:theme": {
3879
- "description": "Object or array data type",
3880
- "anyOf": [
3881
- {
3882
- "type": "string"
3883
- },
3884
- {
3885
- "type": "array",
3886
- "items": {
3887
- "type": "string"
3888
- }
3889
- }
3890
- ]
3891
- },
3892
- "dcat:landingPage": {
3893
- "description": "Object or array data type",
3894
- "anyOf": [
3895
- {
3896
- "type": "string"
3897
- },
3898
- {
3899
- "type": "array",
3900
- "items": {
3901
- "type": "string"
3902
- }
3903
- }
3904
- ]
3905
- },
3906
- "dcat:qualifiedRelation": {
3907
- "anyOf": [
3908
- {
3909
- "$ref": "#/components/schemas/DcatRelationship"
3910
- },
3911
- {
3912
- "type": "string"
3913
- }
3914
- ],
3915
- "description": "Link to a description of a relationship with another resource."
3916
- },
3917
- "odrl:hasPolicy": {
3918
- "$ref": "https://schema.twindev.org/w3c-odrl/OdrlPolicy"
3919
- }
3920
- },
3921
- "required": [
3922
- "@context",
3923
- "@type"
3924
- ],
3925
- "description": "Base interface for DCAT catalogued resources. This is the parent class of dcat:Dataset, dcat:DataService, and dcat:Catalog."
3926
- },
3927
- "DcatRole": {
3928
- "type": "object",
3929
- "properties": {
3930
- "@context": {
3931
- "$ref": "#/components/schemas/DcatContextType"
3932
- },
3933
- "@type": {
3934
- "type": "string",
3935
- "const": "dcat:Role",
3936
- "description": "The type identifier, typically \"Role\"."
3937
- },
3938
- "@id": {
3939
- "type": "string",
3940
- "description": "The unique identifier for the role object."
3941
- },
3942
- "dcterms:title": {
3943
- "$ref": "#/components/schemas/DcatLiteralType"
3944
- }
3945
- },
3946
- "required": [
3947
- "@context",
3948
- "@type"
3949
- ],
3950
- "description": "Interface for DCAT Role. A role is the function of a resource or agent with respect to another resource, in the context of resource attribution or resource relationships."
3951
- },
3952
3598
  "Error": {
3953
3599
  "type": "object",
3954
3600
  "properties": {
@@ -4195,56 +3841,6 @@
4195
3841
  ],
4196
3842
  "description": "Add optional \"@id\" to a type."
4197
3843
  },
4198
- "JsonLdObjectWithOptionalContext<DcatCatalogRecord>": {
4199
- "type": "object",
4200
- "properties": {
4201
- "@context": {
4202
- "$ref": "#/components/schemas/JsonLdExistingProperty<DcatCatalogRecord%2C%22%40context%22%2CIJsonLdContextDefinitionRoot>"
4203
- },
4204
- "@type": {
4205
- "type": "string",
4206
- "const": "dcat:CatalogRecord",
4207
- "description": "The type identifier, typically \"CatalogRecord\"."
4208
- },
4209
- "@id": {
4210
- "type": "string",
4211
- "description": "The unique identifier for the catalog record."
4212
- },
4213
- "dcterms:title": {
4214
- "$ref": "#/components/schemas/DcatLiteralType"
4215
- },
4216
- "dcterms:description": {
4217
- "$ref": "#/components/schemas/DcatLiteralType"
4218
- },
4219
- "dcterms:issued": {
4220
- "$ref": "#/components/schemas/DcatDateTimeType"
4221
- },
4222
- "dcterms:modified": {
4223
- "$ref": "#/components/schemas/DcatDateTimeType"
4224
- },
4225
- "dcterms:conformsTo": {
4226
- "description": "Object or array data type",
4227
- "anyOf": [
4228
- {
4229
- "type": "string"
4230
- },
4231
- {
4232
- "type": "array",
4233
- "items": {
4234
- "type": "string"
4235
- }
4236
- }
4237
- ]
4238
- },
4239
- "foaf:primaryTopic": {
4240
- "$ref": "#/components/schemas/DcatResource"
4241
- }
4242
- },
4243
- "required": [
4244
- "@type"
4245
- ],
4246
- "description": "Add optional \"@context\" to a type, inferring an existing context type from the source type when available, otherwise using the provided default."
4247
- },
4248
3844
  "PapQueryResponse": {
4249
3845
  "type": "array",
4250
3846
  "items": {
@@ -4300,6 +3896,10 @@
4300
3896
  "type": "string",
4301
3897
  "description": "The callback address to send updates to the requester."
4302
3898
  },
3899
+ "publicOrigin": {
3900
+ "type": "string",
3901
+ "description": "The public origin of the server that initiated or received this negotiation. Used to construct callback URLs in subsequent async messages."
3902
+ },
4303
3903
  "organizationIdentity": {
4304
3904
  "type": "string",
4305
3905
  "description": "Organization identity to be used when sending trust payloads."
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@twin.org/rights-management-service",
3
- "version": "0.0.3-next.21",
4
- "description": "Rights Management service implementation and REST endpoint definitions",
3
+ "version": "0.0.3-next.23",
4
+ "description": "Unified rights management service exposing policy and negotiation capabilities.",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/twinfoundation/rights-management.git",
@@ -24,7 +24,7 @@
24
24
  "@twin.org/data-json-ld": "next",
25
25
  "@twin.org/entity": "next",
26
26
  "@twin.org/nameof": "next",
27
- "@twin.org/rights-management-models": "0.0.3-next.21",
27
+ "@twin.org/rights-management-models": "0.0.3-next.23",
28
28
  "@twin.org/standards-dataspace-protocol": "next",
29
29
  "@twin.org/standards-w3c-did": "next",
30
30
  "@twin.org/standards-w3c-odrl": "next",