@twin.org/dataspace-control-plane-service 0.0.3-next.16 → 0.0.3-next.17
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/dataspaceControlPlanePolicyRequester.js +4 -3
- package/dist/es/dataspaceControlPlanePolicyRequester.js.map +1 -1
- package/dist/es/dataspaceControlPlaneService.js +13 -9
- package/dist/es/dataspaceControlPlaneService.js.map +1 -1
- package/dist/es/models/INegotiationState.js +0 -2
- package/dist/es/models/INegotiationState.js.map +1 -1
- package/dist/types/dataspaceControlPlanePolicyRequester.d.ts +4 -4
- package/dist/types/models/INegotiationState.d.ts +2 -3
- package/docs/changelog.md +20 -0
- package/docs/reference/classes/DataspaceControlPlanePolicyRequester.md +2 -2
- package/docs/reference/interfaces/INegotiationState.md +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright 2025 IOTA Stiftung.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
3
|
import { ComponentFactory } from "@twin.org/core";
|
|
4
|
+
import { OdrlPolicyHelper } from "@twin.org/rights-management-models";
|
|
4
5
|
import { DataspaceProtocolContractNegotiationStateType } from "@twin.org/standards-dataspace-protocol";
|
|
5
6
|
/**
|
|
6
7
|
* Policy Requester for Dataspace Control Plane.
|
|
@@ -97,7 +98,7 @@ export class DataspaceControlPlanePolicyRequester {
|
|
|
97
98
|
message: "offerReceived",
|
|
98
99
|
data: {
|
|
99
100
|
negotiationId,
|
|
100
|
-
offerId: offer
|
|
101
|
+
offerId: offer["@id"]
|
|
101
102
|
}
|
|
102
103
|
});
|
|
103
104
|
const negotiation = this._negotiations.get(negotiationId);
|
|
@@ -123,7 +124,7 @@ export class DataspaceControlPlanePolicyRequester {
|
|
|
123
124
|
message: "agreementReceived",
|
|
124
125
|
data: {
|
|
125
126
|
negotiationId,
|
|
126
|
-
agreementId: agreement
|
|
127
|
+
agreementId: OdrlPolicyHelper.getUid(agreement) ?? ""
|
|
127
128
|
}
|
|
128
129
|
});
|
|
129
130
|
const negotiation = this._negotiations.get(negotiationId);
|
|
@@ -153,7 +154,7 @@ export class DataspaceControlPlanePolicyRequester {
|
|
|
153
154
|
if (negotiation) {
|
|
154
155
|
negotiation.state = DataspaceProtocolContractNegotiationStateType.FINALIZED;
|
|
155
156
|
negotiation.updatedAt = Date.now();
|
|
156
|
-
const agreementId = negotiation.agreement
|
|
157
|
+
const agreementId = OdrlPolicyHelper.getUid(negotiation.agreement);
|
|
157
158
|
this._negotiations.delete(negotiationId);
|
|
158
159
|
await this._loggingComponent?.log({
|
|
159
160
|
level: "info",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataspaceControlPlanePolicyRequester.js","sourceRoot":"","sources":["../../src/dataspaceControlPlanePolicyRequester.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKlD,OAAO,EAAE,6CAA6C,EAAE,MAAM,wCAAwC,CAAC;AAIvG;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,oCAAoC;IAChD;;OAEG;IACI,MAAM,CAAU,UAAU,0CAA0D;IAE3F;;;OAGG;IACc,iBAAiB,CAAqB;IAEvD;;;OAGG;IACc,SAAS,CAAwB;IAElD;;;;;OAKG;IACc,aAAa,CAAiC;IAE/D;;;;OAIG;IACH,YAAY,oBAA6B,EAAE,QAA+B;QACzE,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC,WAAW,CACpD,oBAAoB,IAAI,SAAS,CACjC,CAAC;QACF,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;IAChC,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,oCAAoC,CAAC,UAAU,CAAC;IACxD,CAAC;IAED;;;;OAIG;IACI,gBAAgB,CAAC,aAAq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G,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC1D,IAAI,WAAW,EAAE,CAAC;YACjB,WAAW,CAAC,KAAK,GAAG,6CAA6C,CAAC,UAAU,CAAC;YAC7E,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAEnC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YAEzC,MAAM,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC;gBACjC,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,oCAAoC,CAAC,UAAU;gBACvD,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;gBACd,OAAO,EAAE,qBAAqB;gBAC9B,IAAI,EAAE;oBACL,aAAa;oBACb,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC,SAAS;iBAC9C;aACD,CAAC,CAAC;YAEH,MAAM,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,aAAa,EAAE,iCAAiC,CAAC,CAAC;QAClF,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC;gBACjC,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,oCAAoC,CAAC,UAAU;gBACvD,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;gBACd,OAAO,EAAE,8BAA8B;gBACvC,IAAI,EAAE,EAAE,aAAa,EAAE;aACvB,CAAC,CAAC;QACJ,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory } from \"@twin.org/core\";\nimport type { INegotiationCallback } from \"@twin.org/dataspace-models\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type { IPolicyRequester } from \"@twin.org/rights-management-models\";\nimport { DataspaceProtocolContractNegotiationStateType } from \"@twin.org/standards-dataspace-protocol\";\nimport type { IOdrlAgreement, IOdrlOffer } from \"@twin.org/standards-w3c-odrl\";\nimport type { INegotiationState } from \"./models/INegotiationState.js\";\n\n/**\n * Policy Requester for Dataspace Control Plane.\n *\n * Handles contract negotiation callbacks from PNP and forwards state changes\n * to the control plane service via the INegotiationCallback interface.\n *\n * Callback Flow:\n * 1. Control Plane initiates negotiation via PNP.sendRequestToProvider()\n * 2. PNP calls offer() → auto-accept, notify control plane\n * 3. PNP calls agreement() → store agreement, notify control plane\n * 4. PNP calls finalised() → notify control plane with agreementId\n * 5. Control plane notifies upstream caller (e.g. supply-chain)\n */\nexport class DataspaceControlPlanePolicyRequester implements IPolicyRequester {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<DataspaceControlPlanePolicyRequester>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _loggingComponent?: ILoggingComponent;\n\n\t/**\n\t * Callback interface for notifying the control plane of negotiation state changes.\n\t * @internal\n\t */\n\tprivate readonly _callback?: INegotiationCallback;\n\n\t/**\n\t * Active negotiations tracked in memory.\n\t * Key: negotiationId\n\t * Value: Negotiation state\n\t * @internal\n\t */\n\tprivate readonly _negotiations: Map<string, INegotiationState>;\n\n\t/**\n\t * Create a new instance of DataspaceControlPlanePolicyRequester.\n\t * @param loggingComponentType Optional logging component type.\n\t * @param callback Optional callback interface for state change notifications.\n\t */\n\tconstructor(loggingComponentType?: string, callback?: INegotiationCallback) {\n\t\tthis._loggingComponent = ComponentFactory.getIfExists<ILoggingComponent>(\n\t\t\tloggingComponentType ?? \"logging\"\n\t\t);\n\t\tthis._callback = callback;\n\t\tthis._negotiations = new Map();\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn DataspaceControlPlanePolicyRequester.CLASS_NAME;\n\t}\n\n\t/**\n\t * Register a negotiation for tracking.\n\t * Called by the control plane service after initiating a negotiation via PNP.\n\t * @param negotiationId The negotiation ID returned by PNP.sendRequestToProvider().\n\t */\n\tpublic trackNegotiation(negotiationId: string): void {\n\t\tconst now = Date.now();\n\t\tthis._negotiations.set(negotiationId, {\n\t\t\tnegotiationId,\n\t\t\tstate: DataspaceProtocolContractNegotiationStateType.REQUESTED,\n\t\t\tstartedAt: now,\n\t\t\tupdatedAt: now\n\t\t});\n\t}\n\n\t/**\n\t * Get all active negotiations (for stalled cleanup).\n\t * @returns Map of negotiationId to negotiation state.\n\t */\n\tpublic getActiveNegotiations(): Map<string, INegotiationState> {\n\t\treturn this._negotiations;\n\t}\n\n\t/**\n\t * Remove a negotiation from tracking (for cleanup).\n\t * @param negotiationId The negotiation ID to remove.\n\t */\n\tpublic removeNegotiation(negotiationId: string): void {\n\t\tthis._negotiations.delete(negotiationId);\n\t}\n\n\t/**\n\t * A policy has been offered by a provider.\n\t * Called by PNP when provider sends an OfferMessage.\n\t * @param negotiationId The id of the negotiation.\n\t * @param offer The offer sent by the provider.\n\t * @returns True if the offer was accepted, false otherwise.\n\t */\n\tpublic async offer(negotiationId: string, offer: IOdrlOffer): Promise<boolean> {\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"offerReceived\",\n\t\t\tdata: {\n\t\t\t\tnegotiationId,\n\t\t\t\tofferId: offer.uid\n\t\t\t}\n\t\t});\n\n\t\tconst negotiation = this._negotiations.get(negotiationId);\n\t\tif (negotiation) {\n\t\t\tnegotiation.state = DataspaceProtocolContractNegotiationStateType.OFFERED;\n\t\t\tnegotiation.updatedAt = Date.now();\n\t\t}\n\n\t\tawait this._callback?.onStateChanged(\n\t\t\tnegotiationId,\n\t\t\tDataspaceProtocolContractNegotiationStateType.OFFERED,\n\t\t\t{ offer }\n\t\t);\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * A policy agreement has been sent by a provider.\n\t * Called by PNP when provider sends an AgreementMessage.\n\t * @param negotiationId The id of the negotiation.\n\t * @param agreement The agreement sent by the provider.\n\t * @returns True if the agreement was accepted, false otherwise.\n\t */\n\tpublic async agreement(negotiationId: string, agreement: IOdrlAgreement): Promise<boolean> {\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"agreementReceived\",\n\t\t\tdata: {\n\t\t\t\tnegotiationId,\n\t\t\t\tagreementId: agreement.uid\n\t\t\t}\n\t\t});\n\n\t\tconst negotiation = this._negotiations.get(negotiationId);\n\t\tif (negotiation) {\n\t\t\tnegotiation.state = DataspaceProtocolContractNegotiationStateType.AGREED;\n\t\t\tnegotiation.agreement = agreement;\n\t\t\tnegotiation.updatedAt = Date.now();\n\t\t}\n\n\t\tawait this._callback?.onStateChanged(\n\t\t\tnegotiationId,\n\t\t\tDataspaceProtocolContractNegotiationStateType.AGREED,\n\t\t\t{ agreement }\n\t\t);\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * A policy finalisation has been sent by a provider.\n\t * Called by PNP when provider sends a FinalizedEvent.\n\t * @param negotiationId The id of the negotiation.\n\t * @returns Nothing.\n\t */\n\tpublic async finalised(negotiationId: string): Promise<void> {\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationFinalized\",\n\t\t\tdata: { negotiationId }\n\t\t});\n\n\t\tconst negotiation = this._negotiations.get(negotiationId);\n\t\tif (negotiation) {\n\t\t\tnegotiation.state = DataspaceProtocolContractNegotiationStateType.FINALIZED;\n\t\t\tnegotiation.updatedAt = Date.now();\n\n\t\t\tconst agreementId = negotiation.agreement?.uid;\n\t\t\tthis._negotiations.delete(negotiationId);\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"negotiationCompleted\",\n\t\t\t\tdata: {\n\t\t\t\t\tnegotiationId,\n\t\t\t\t\tagreementId,\n\t\t\t\t\tdurationMs: Date.now() - negotiation.startedAt\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (agreementId) {\n\t\t\t\tawait this._callback?.onCompleted(negotiationId, agreementId);\n\t\t\t} else {\n\t\t\t\tawait this._callback?.onFailed(negotiationId, \"negotiationFinalizedNoAgreement\");\n\t\t\t}\n\t\t} else {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"unknownNegotiationFinalized\",\n\t\t\t\tdata: { negotiationId }\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * A policy termination has been sent by a provider.\n\t * Called by PNP when provider sends a TerminatedMessage or negotiation fails.\n\t * @param negotiationId The id of the negotiation.\n\t * @returns Nothing.\n\t */\n\tpublic async terminated(negotiationId: string): Promise<void> {\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"warn\",\n\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationTerminated\",\n\t\t\tdata: { negotiationId }\n\t\t});\n\n\t\tconst negotiation = this._negotiations.get(negotiationId);\n\t\tif (negotiation) {\n\t\t\tnegotiation.state = DataspaceProtocolContractNegotiationStateType.TERMINATED;\n\t\t\tnegotiation.updatedAt = Date.now();\n\n\t\t\tthis._negotiations.delete(negotiationId);\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"negotiationRejected\",\n\t\t\t\tdata: {\n\t\t\t\t\tnegotiationId,\n\t\t\t\t\tdurationMs: Date.now() - negotiation.startedAt\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tawait this._callback?.onFailed(negotiationId, \"negotiationTerminatedByProvider\");\n\t\t} else {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"unknownNegotiationTerminated\",\n\t\t\t\tdata: { negotiationId }\n\t\t\t});\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dataspaceControlPlanePolicyRequester.js","sourceRoot":"","sources":["../../src/dataspaceControlPlanePolicyRequester.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIlD,OAAO,EAAE,gBAAgB,EAAyB,MAAM,oCAAoC,CAAC;AAC7F,OAAO,EACN,6CAA6C,EAG7C,MAAM,wCAAwC,CAAC;AAGhD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,oCAAoC;IAChD;;OAEG;IACI,MAAM,CAAU,UAAU,0CAA0D;IAE3F;;;OAGG;IACc,iBAAiB,CAAqB;IAEvD;;;OAGG;IACc,SAAS,CAAwB;IAElD;;;;;OAKG;IACc,aAAa,CAAiC;IAE/D;;;;OAIG;IACH,YAAY,oBAA6B,EAAE,QAA+B;QACzE,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC,WAAW,CACpD,oBAAoB,IAAI,SAAS,CACjC,CAAC;QACF,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;IAChC,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,oCAAoC,CAAC,UAAU,CAAC;IACxD,CAAC;IAED;;;;OAIG;IACI,gBAAgB,CAAC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AAE,EAAE,aAAa,EAAE;SACvB,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC1D,IAAI,WAAW,EAAE,CAAC;YACjB,WAAW,CAAC,KAAK,GAAG,6CAA6C,CAAC,UAAU,CAAC;YAC7E,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAEnC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YAEzC,MAAM,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC;gBACjC,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,oCAAoC,CAAC,UAAU;gBACvD,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;gBACd,OAAO,EAAE,qBAAqB;gBAC9B,IAAI,EAAE;oBACL,aAAa;oBACb,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC,SAAS;iBAC9C;aACD,CAAC,CAAC;YAEH,MAAM,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,aAAa,EAAE,iCAAiC,CAAC,CAAC;QAClF,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC;gBACjC,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,oCAAoC,CAAC,UAAU;gBACvD,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;gBACd,OAAO,EAAE,8BAA8B;gBACvC,IAAI,EAAE,EAAE,aAAa,EAAE;aACvB,CAAC,CAAC;QACJ,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory } from \"@twin.org/core\";\nimport type { INegotiationCallback } from \"@twin.org/dataspace-models\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { OdrlPolicyHelper, type IPolicyRequester } from \"@twin.org/rights-management-models\";\nimport {\n\tDataspaceProtocolContractNegotiationStateType,\n\ttype IDataspaceProtocolAgreement,\n\ttype IDataspaceProtocolOffer\n} from \"@twin.org/standards-dataspace-protocol\";\nimport type { INegotiationState } from \"./models/INegotiationState.js\";\n\n/**\n * Policy Requester for Dataspace Control Plane.\n *\n * Handles contract negotiation callbacks from PNP and forwards state changes\n * to the control plane service via the INegotiationCallback interface.\n *\n * Callback Flow:\n * 1. Control Plane initiates negotiation via PNP.sendRequestToProvider()\n * 2. PNP calls offer() → auto-accept, notify control plane\n * 3. PNP calls agreement() → store agreement, notify control plane\n * 4. PNP calls finalised() → notify control plane with agreementId\n * 5. Control plane notifies upstream caller (e.g. supply-chain)\n */\nexport class DataspaceControlPlanePolicyRequester implements IPolicyRequester {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<DataspaceControlPlanePolicyRequester>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _loggingComponent?: ILoggingComponent;\n\n\t/**\n\t * Callback interface for notifying the control plane of negotiation state changes.\n\t * @internal\n\t */\n\tprivate readonly _callback?: INegotiationCallback;\n\n\t/**\n\t * Active negotiations tracked in memory.\n\t * Key: negotiationId\n\t * Value: Negotiation state\n\t * @internal\n\t */\n\tprivate readonly _negotiations: Map<string, INegotiationState>;\n\n\t/**\n\t * Create a new instance of DataspaceControlPlanePolicyRequester.\n\t * @param loggingComponentType Optional logging component type.\n\t * @param callback Optional callback interface for state change notifications.\n\t */\n\tconstructor(loggingComponentType?: string, callback?: INegotiationCallback) {\n\t\tthis._loggingComponent = ComponentFactory.getIfExists<ILoggingComponent>(\n\t\t\tloggingComponentType ?? \"logging\"\n\t\t);\n\t\tthis._callback = callback;\n\t\tthis._negotiations = new Map();\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn DataspaceControlPlanePolicyRequester.CLASS_NAME;\n\t}\n\n\t/**\n\t * Register a negotiation for tracking.\n\t * Called by the control plane service after initiating a negotiation via PNP.\n\t * @param negotiationId The negotiation ID returned by PNP.sendRequestToProvider().\n\t */\n\tpublic trackNegotiation(negotiationId: string): void {\n\t\tconst now = Date.now();\n\t\tthis._negotiations.set(negotiationId, {\n\t\t\tnegotiationId,\n\t\t\tstate: DataspaceProtocolContractNegotiationStateType.REQUESTED,\n\t\t\tstartedAt: now,\n\t\t\tupdatedAt: now\n\t\t});\n\t}\n\n\t/**\n\t * Get all active negotiations (for stalled cleanup).\n\t * @returns Map of negotiationId to negotiation state.\n\t */\n\tpublic getActiveNegotiations(): Map<string, INegotiationState> {\n\t\treturn this._negotiations;\n\t}\n\n\t/**\n\t * Remove a negotiation from tracking (for cleanup).\n\t * @param negotiationId The negotiation ID to remove.\n\t */\n\tpublic removeNegotiation(negotiationId: string): void {\n\t\tthis._negotiations.delete(negotiationId);\n\t}\n\n\t/**\n\t * A policy has been offered by a provider.\n\t * Called by PNP when provider sends an OfferMessage.\n\t * @param negotiationId The id of the negotiation.\n\t * @param offer The offer sent by the provider.\n\t * @returns True if the offer was accepted, false otherwise.\n\t */\n\tpublic async offer(negotiationId: string, offer: IDataspaceProtocolOffer): Promise<boolean> {\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"offerReceived\",\n\t\t\tdata: {\n\t\t\t\tnegotiationId,\n\t\t\t\tofferId: offer[\"@id\"]\n\t\t\t}\n\t\t});\n\n\t\tconst negotiation = this._negotiations.get(negotiationId);\n\t\tif (negotiation) {\n\t\t\tnegotiation.state = DataspaceProtocolContractNegotiationStateType.OFFERED;\n\t\t\tnegotiation.updatedAt = Date.now();\n\t\t}\n\n\t\tawait this._callback?.onStateChanged(\n\t\t\tnegotiationId,\n\t\t\tDataspaceProtocolContractNegotiationStateType.OFFERED,\n\t\t\t{ offer }\n\t\t);\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * A policy agreement has been sent by a provider.\n\t * Called by PNP when provider sends an AgreementMessage.\n\t * @param negotiationId The id of the negotiation.\n\t * @param agreement The agreement sent by the provider.\n\t * @returns True if the agreement was accepted, false otherwise.\n\t */\n\tpublic async agreement(\n\t\tnegotiationId: string,\n\t\tagreement: IDataspaceProtocolAgreement\n\t): Promise<boolean> {\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"agreementReceived\",\n\t\t\tdata: {\n\t\t\t\tnegotiationId,\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\"\n\t\t\t}\n\t\t});\n\n\t\tconst negotiation = this._negotiations.get(negotiationId);\n\t\tif (negotiation) {\n\t\t\tnegotiation.state = DataspaceProtocolContractNegotiationStateType.AGREED;\n\t\t\tnegotiation.agreement = agreement;\n\t\t\tnegotiation.updatedAt = Date.now();\n\t\t}\n\n\t\tawait this._callback?.onStateChanged(\n\t\t\tnegotiationId,\n\t\t\tDataspaceProtocolContractNegotiationStateType.AGREED,\n\t\t\t{ agreement }\n\t\t);\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * A policy finalisation has been sent by a provider.\n\t * Called by PNP when provider sends a FinalizedEvent.\n\t * @param negotiationId The id of the negotiation.\n\t * @returns Nothing.\n\t */\n\tpublic async finalised(negotiationId: string): Promise<void> {\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationFinalized\",\n\t\t\tdata: { negotiationId }\n\t\t});\n\n\t\tconst negotiation = this._negotiations.get(negotiationId);\n\t\tif (negotiation) {\n\t\t\tnegotiation.state = DataspaceProtocolContractNegotiationStateType.FINALIZED;\n\t\t\tnegotiation.updatedAt = Date.now();\n\n\t\t\tconst agreementId = OdrlPolicyHelper.getUid(negotiation.agreement);\n\t\t\tthis._negotiations.delete(negotiationId);\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"negotiationCompleted\",\n\t\t\t\tdata: {\n\t\t\t\t\tnegotiationId,\n\t\t\t\t\tagreementId,\n\t\t\t\t\tdurationMs: Date.now() - negotiation.startedAt\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (agreementId) {\n\t\t\t\tawait this._callback?.onCompleted(negotiationId, agreementId);\n\t\t\t} else {\n\t\t\t\tawait this._callback?.onFailed(negotiationId, \"negotiationFinalizedNoAgreement\");\n\t\t\t}\n\t\t} else {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"unknownNegotiationFinalized\",\n\t\t\t\tdata: { negotiationId }\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * A policy termination has been sent by a provider.\n\t * Called by PNP when provider sends a TerminatedMessage or negotiation fails.\n\t * @param negotiationId The id of the negotiation.\n\t * @returns Nothing.\n\t */\n\tpublic async terminated(negotiationId: string): Promise<void> {\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"warn\",\n\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationTerminated\",\n\t\t\tdata: { negotiationId }\n\t\t});\n\n\t\tconst negotiation = this._negotiations.get(negotiationId);\n\t\tif (negotiation) {\n\t\t\tnegotiation.state = DataspaceProtocolContractNegotiationStateType.TERMINATED;\n\t\t\tnegotiation.updatedAt = Date.now();\n\n\t\t\tthis._negotiations.delete(negotiationId);\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"negotiationRejected\",\n\t\t\t\tdata: {\n\t\t\t\t\tnegotiationId,\n\t\t\t\t\tdurationMs: Date.now() - negotiation.startedAt\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tawait this._callback?.onFailed(negotiationId, \"negotiationTerminatedByProvider\");\n\t\t} else {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlanePolicyRequester.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"unknownNegotiationTerminated\",\n\t\t\t\tdata: { negotiationId }\n\t\t\t});\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1236,7 +1236,7 @@ export class DataspaceControlPlaneService {
|
|
|
1236
1236
|
}
|
|
1237
1237
|
throw new GeneralError(DataspaceControlPlaneService.CLASS_NAME, "catalogLookupFailed", {
|
|
1238
1238
|
datasetId,
|
|
1239
|
-
agreementId: agreement
|
|
1239
|
+
agreementId: OdrlPolicyHelper.getUid(agreement) ?? "",
|
|
1240
1240
|
errorCode: catalogResult.code
|
|
1241
1241
|
});
|
|
1242
1242
|
}
|
|
@@ -1247,7 +1247,7 @@ export class DataspaceControlPlaneService {
|
|
|
1247
1247
|
message: "catalogDatasetFound",
|
|
1248
1248
|
data: {
|
|
1249
1249
|
datasetId,
|
|
1250
|
-
agreementId: agreement
|
|
1250
|
+
agreementId: OdrlPolicyHelper.getUid(agreement) ?? "",
|
|
1251
1251
|
datasetTitle: catalogResult["dcterms:title"]
|
|
1252
1252
|
}
|
|
1253
1253
|
});
|
|
@@ -1301,11 +1301,15 @@ export class DataspaceControlPlaneService {
|
|
|
1301
1301
|
getCatalogDatasetPolicies(catalogDataset) {
|
|
1302
1302
|
// Support both "odrl:hasPolicy" and "hasPolicy" to accommodate different catalog implementations
|
|
1303
1303
|
if (Is.object(catalogDataset) && !Is.empty(catalogDataset["odrl:hasPolicy"])) {
|
|
1304
|
-
|
|
1304
|
+
const items = ArrayHelper.fromObjectOrArray(catalogDataset["odrl:hasPolicy"]) ?? [];
|
|
1305
|
+
return items.map(item => ({
|
|
1306
|
+
...item,
|
|
1307
|
+
"@id": OdrlPolicyHelper.getUid(item) ?? ""
|
|
1308
|
+
}));
|
|
1305
1309
|
}
|
|
1306
1310
|
if (Is.object(catalogDataset) &&
|
|
1307
1311
|
!Is.empty(catalogDataset.hasPolicy)) {
|
|
1308
|
-
return
|
|
1312
|
+
return ArrayHelper.fromObjectOrArray(catalogDataset.hasPolicy) ?? [];
|
|
1309
1313
|
}
|
|
1310
1314
|
return [];
|
|
1311
1315
|
}
|
|
@@ -1327,7 +1331,7 @@ export class DataspaceControlPlaneService {
|
|
|
1327
1331
|
message: "catalogDatasetHasNoOffers",
|
|
1328
1332
|
data: {
|
|
1329
1333
|
datasetId: getJsonLdId(catalogDataset) ?? "",
|
|
1330
|
-
agreementId: agreement
|
|
1334
|
+
agreementId: OdrlPolicyHelper.getUid(agreement) ?? ""
|
|
1331
1335
|
}
|
|
1332
1336
|
});
|
|
1333
1337
|
return;
|
|
@@ -1341,16 +1345,16 @@ export class DataspaceControlPlaneService {
|
|
|
1341
1345
|
message: "catalogDatasetHasNoOffers",
|
|
1342
1346
|
data: {
|
|
1343
1347
|
datasetId: getJsonLdId(catalogDataset) ?? "",
|
|
1344
|
-
agreementId: agreement
|
|
1348
|
+
agreementId: OdrlPolicyHelper.getUid(agreement) ?? ""
|
|
1345
1349
|
}
|
|
1346
1350
|
});
|
|
1347
1351
|
return;
|
|
1348
1352
|
}
|
|
1349
|
-
const matchingOffer = catalogOffers.find((offer) => OdrlPolicyHelper.getUid(offer) === agreement
|
|
1353
|
+
const matchingOffer = catalogOffers.find((offer) => OdrlPolicyHelper.getUid(offer) === OdrlPolicyHelper.getUid(agreement) ||
|
|
1350
1354
|
this.isPolicyDerivedFrom(agreement, offer));
|
|
1351
1355
|
if (!matchingOffer) {
|
|
1352
1356
|
throw new GeneralError(DataspaceControlPlaneService.CLASS_NAME, "agreementNotMatchingOffer", {
|
|
1353
|
-
agreementId: agreement
|
|
1357
|
+
agreementId: OdrlPolicyHelper.getUid(agreement) ?? "",
|
|
1354
1358
|
datasetId: getJsonLdId(catalogDataset) ?? "",
|
|
1355
1359
|
availableOffers: catalogOffers
|
|
1356
1360
|
.map((o) => OdrlPolicyHelper.getUid(o) ?? "unknown")
|
|
@@ -1363,7 +1367,7 @@ export class DataspaceControlPlaneService {
|
|
|
1363
1367
|
ts: Date.now(),
|
|
1364
1368
|
message: "agreementMatchedOffer",
|
|
1365
1369
|
data: {
|
|
1366
|
-
agreementId: agreement
|
|
1370
|
+
agreementId: OdrlPolicyHelper.getUid(agreement) ?? "",
|
|
1367
1371
|
offerId: OdrlPolicyHelper.getUid(matchingOffer) ?? "",
|
|
1368
1372
|
datasetId: getJsonLdId(catalogDataset) ?? ""
|
|
1369
1373
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataspaceControlPlaneService.js","sourceRoot":"","sources":["../../src/dataspaceControlPlaneService.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EACN,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,MAAM,EACN,EAAE,EACF,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,iBAAiB,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAkC,MAAM,wBAAwB,CAAC;AACtF,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EAQnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACN,6BAA6B,EAE7B,MAAM,iCAAi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;QAE3E,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YAC3E,OAAO,KAAK,CAAC;QACd,CAAC;QAED,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;YACpE,OAAO,KAAK,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,eAAe,CAC5B,OAAkC;QAElC,IAAI,OAAO,CAAC,mBAAmB,CAAC,EAAE,CAAC;YAClC,OAAO,OAAO,CAAC;QAChB,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,aAAa,EAAE,CAAC;QACxD,MAAM,KAAK,GAAG,UAAU,EAAE,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAEvD,IAAI,KAAK,EAAE,CAAC;YACX,OAAO;gBACN,GAAG,OAAO;gBACV,mBAAmB,EAAE,KAAK;aAC1B,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ITaskSchedulerComponent } from \"@twin.org/background-task-models\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport {\n\tArrayHelper,\n\tBaseError,\n\tComponentFactory,\n\tConverter,\n\tGeneralError,\n\tGuards,\n\tIs,\n\tNotFoundError,\n\tObjectHelper,\n\tRandomHelper,\n\tStringHelper,\n\tUnauthorizedError,\n\ttype IValidationFailure,\n\ttype ObjectOrArray\n} from \"@twin.org/core\";\nimport { JsonLdHelper, type JsonLdObjectWithNoContext } from \"@twin.org/data-json-ld\";\nimport {\n\tDataspaceAppFactory,\n\tTransferProcessRole,\n\ttype IDataspaceApp,\n\ttype IDataspaceControlPlaneComponent,\n\ttype IDataspaceControlPlaneResolverComponent,\n\ttype INegotiationCallback,\n\ttype ITransferContext,\n\ttype ITransferProcess,\n\ttype TransferProcess\n} from \"@twin.org/dataspace-models\";\nimport { EngineCoreFactory } from \"@twin.org/engine-models\";\nimport {\n\tEntityStorageConnectorFactory,\n\ttype IEntityStorageConnector\n} from \"@twin.org/entity-storage-models\";\nimport type { IFederatedCatalogueComponent } from \"@twin.org/federated-catalogue-models\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\tPolicyRequesterFactory,\n\ttype IPolicyAdministrationPointComponent,\n\ttype IPolicyNegotiationAdminPointComponent,\n\ttype IPolicyNegotiationPointComponent\n} from \"@twin.org/rights-management-models\";\nimport {\n\tDataspaceProtocolContexts,\n\tDataspaceProtocolContractNegotiationTypes,\n\tDataspaceProtocolEndpointType,\n\tDataspaceProtocolHelper,\n\tDataspaceProtocolTransferProcessStateType,\n\tDataspaceProtocolTransferProcessTypes,\n\ttype DataspaceProtocolContractNegotiationStateType,\n\ttype IDataspaceProtocolContractNegotiation,\n\ttype IDataspaceProtocolContractNegotiationError,\n\ttype IDataspaceProtocolDataset,\n\ttype IDataspaceProtocolTransferCompletionMessage,\n\ttype IDataspaceProtocolTransferError,\n\ttype IDataspaceProtocolTransferProcess,\n\ttype IDataspaceProtocolTransferRequestMessage,\n\ttype IDataspaceProtocolTransferStartMessage,\n\ttype IDataspaceProtocolTransferSuspensionMessage,\n\ttype IDataspaceProtocolTransferTerminationMessage\n} from \"@twin.org/standards-dataspace-protocol\";\nimport type { IDcatDataset } from \"@twin.org/standards-w3c-dcat\";\nimport type { IOdrlAgreement, IOdrlPolicy } from \"@twin.org/standards-w3c-odrl\";\nimport { TrustHelper, type ITrustComponent } from \"@twin.org/trust-models\";\nimport { DataspaceControlPlanePolicyRequester } from \"./dataspaceControlPlanePolicyRequester.js\";\nimport type { IDataspaceControlPlaneServiceConstructorOptions } from \"./models/IDataspaceControlPlaneServiceConstructorOptions.js\";\nimport { getJsonLdId, getJsonLdType } from \"./utils/dataHelpers.js\";\nimport {\n\tisCatalogError,\n\tisCatalogErrorName,\n\ttransformToTransferError\n} from \"./utils/transferErrorUtils.js\";\n\n/**\n * Stalled negotiation threshold in milliseconds (30 minutes).\n * Negotiations that haven't received a state update within this time are considered stalled.\n */\nconst STALLED_NEGOTIATION_THRESHOLD_MS = 30 * 60 * 1000;\n\n/**\n * Dataspace Control Plane Service implementation.\n *\n * Handles contract negotiation (via PNP callbacks) and transfer process management.\n * Negotiation is fully callback-driven: negotiateAgreement() returns immediately with\n * a negotiationId, and the caller is notified via INegotiationCallback when complete.\n */\nexport class DataspaceControlPlaneService\n\timplements IDataspaceControlPlaneComponent, IDataspaceControlPlaneResolverComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<DataspaceControlPlaneService>();\n\n\t/**\n\t * Hardcoded requester type for PNP registration.\n\t * PNP uses this to route callbacks to our PolicyRequester.\n\t * @internal\n\t */\n\tprivate static readonly _REQUESTER_TYPE = \"dataspace-control-plane-requester\";\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _loggingComponent?: ILoggingComponent;\n\n\t/**\n\t * Policy Administration Point component for Agreement lookup.\n\t * @internal\n\t */\n\tprivate readonly _policyAdministrationPointComponent: IPolicyAdministrationPointComponent;\n\n\t/**\n\t * Policy Negotiation Point component for contract negotiation.\n\t * Used to negotiate agreements with providers before creating transfer processes.\n\n\t * @internal\n\t */\n\tprivate readonly _policyNegotiationPointComponent: IPolicyNegotiationPointComponent;\n\n\t/**\n\t * Policy Negotiation Admin Point component for negotiation history.\n\t * Optional - if not configured, history queries will fail gracefully.\n\t * @internal\n\t */\n\tprivate readonly _policyNegotiationAdminPointComponent?: IPolicyNegotiationAdminPointComponent;\n\n\t/**\n\t * Federated Catalogue component for dataset validation.\n\t * Used to validate that Agreements reference valid catalog datasets.\n\t * @internal\n\t */\n\tprivate readonly _federatedCatalogueComponent: IFederatedCatalogueComponent;\n\n\t/**\n\t * Entity storage for Transfer Process entities.\n\t * Shared between Control Plane and Data Plane.\n\t * @internal\n\t */\n\tprivate readonly _transferProcessStorage: IEntityStorageConnector<TransferProcess>;\n\n\t/**\n\t * The trust component for token verification and generation.\n\t * @internal\n\t */\n\tprivate readonly _trustComponent: ITrustComponent;\n\n\t/**\n\t * Override trust generator type for token generation.\n\t * @internal\n\t */\n\tprivate readonly _overrideTrustGeneratorType?: string;\n\n\t/**\n\t * Data plane endpoint path (path only, not full URL).\n\t * Will be combined with public origin from hosting component.\n\t * If not configured, PULL transfers are not supported.\n\t * @internal\n\t */\n\tprivate readonly _dataPlanePath?: string;\n\n\t/**\n\t * Policy requester instance for handling negotiation callbacks.\n\t * @internal\n\t */\n\tprivate readonly _policyRequester: DataspaceControlPlanePolicyRequester;\n\n\t/**\n\t * Task scheduler for periodic stalled negotiation cleanup.\n\t * @internal\n\t */\n\tprivate readonly _taskScheduler?: ITaskSchedulerComponent;\n\n\t/**\n\t * Registered negotiation callbacks from upstream callers, keyed by registration key.\n\t * @internal\n\t */\n\tprivate readonly _negotiationCallbacks: Map<string, INegotiationCallback>;\n\n\t/**\n\t * Create a new instance of DataspaceControlPlaneService.\n\t * @param options The options for the service.\n\t */\n\tconstructor(options?: IDataspaceControlPlaneServiceConstructorOptions) {\n\t\tthis._loggingComponent = ComponentFactory.getIfExists<ILoggingComponent>(\n\t\t\toptions?.loggingComponentType ?? \"logging\"\n\t\t);\n\n\t\t// Retrieve PAP component with default\n\t\tthis._policyAdministrationPointComponent =\n\t\t\tComponentFactory.get<IPolicyAdministrationPointComponent>(\n\t\t\t\toptions?.policyAdministrationPointComponentType ?? \"policy-administration-point\"\n\t\t\t);\n\n\t\t// Retrieve PNP component with default\n\t\tthis._policyNegotiationPointComponent = ComponentFactory.get<IPolicyNegotiationPointComponent>(\n\t\t\toptions?.policyNegotiationPointComponentType ?? \"policy-negotiation-point\"\n\t\t);\n\n\t\t// Retrieve PNAP component (optional) for negotiation history\n\t\tthis._policyNegotiationAdminPointComponent =\n\t\t\tComponentFactory.getIfExists<IPolicyNegotiationAdminPointComponent>(\n\t\t\t\toptions?.policyNegotiationAdminPointComponentType ?? \"policy-negotiation-admin-point\"\n\t\t\t);\n\n\t\t// Retrieve Federated Catalogue component with default\n\t\tthis._federatedCatalogueComponent = ComponentFactory.get<IFederatedCatalogueComponent>(\n\t\t\toptions?.federatedCatalogueComponentType ?? \"federated-catalogue\"\n\t\t);\n\n\t\tthis._transferProcessStorage = EntityStorageConnectorFactory.get<\n\t\t\tIEntityStorageConnector<TransferProcess>\n\t\t>(options?.transferProcessEntityStorageType ?? nameofKebabCase<TransferProcess>());\n\n\t\tthis._trustComponent = ComponentFactory.get<ITrustComponent>(\n\t\t\toptions?.trustComponentType ?? \"trust\"\n\t\t);\n\n\t\tthis._overrideTrustGeneratorType = options?.config?.overrideTrustGeneratorType;\n\n\t\tthis._dataPlanePath = Is.stringValue(options?.config?.dataPlanePath)\n\t\t\t? StringHelper.trimLeadingSlashes(options.config.dataPlanePath)\n\t\t\t: undefined;\n\n\t\tthis._taskScheduler = ComponentFactory.getIfExists<ITaskSchedulerComponent>(\n\t\t\toptions?.taskSchedulerComponentType ?? \"task-scheduler\"\n\t\t);\n\n\t\tthis._negotiationCallbacks = new Map();\n\n\t\tconst internalCallback: INegotiationCallback = {\n\t\t\tonStateChanged: async (negotiationId, state, data) => {\n\t\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onStateChanged(negotiationId, state, data);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\t\t\tdata: { key, negotiationId, method: \"onStateChanged\", error }\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\tonCompleted: async (negotiationId, agreementId) => {\n\t\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onCompleted(negotiationId, agreementId);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\t\t\tdata: { key, negotiationId, method: \"onCompleted\", error }\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\tonFailed: async (negotiationId, reason) => {\n\t\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onFailed(negotiationId, reason);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\t\t\tdata: { key, negotiationId, method: \"onFailed\", error }\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\n\t\tthis._policyRequester = new DataspaceControlPlanePolicyRequester(\n\t\t\toptions?.loggingComponentType ?? \"logging\",\n\t\t\tinternalCallback\n\t\t);\n\n\t\tPolicyRequesterFactory.register(\n\t\t\tDataspaceControlPlaneService._REQUESTER_TYPE,\n\t\t\t() => this._policyRequester\n\t\t);\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn DataspaceControlPlaneService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Register a callback to receive negotiation state change notifications.\n\t * Upstream modules (e.g. supply-chain) register their callback here.\n\t * @param key A unique key identifying this callback registration.\n\t * @param callback The callback interface to register.\n\t */\n\tpublic registerNegotiationCallback(key: string, callback: INegotiationCallback): void {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(key), key);\n\t\tthis._negotiationCallbacks.set(key, callback);\n\t}\n\n\t/**\n\t * Unregister a previously registered negotiation callback.\n\t * @param key The key used when registering the callback.\n\t */\n\tpublic unregisterNegotiationCallback(key: string): void {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(key), key);\n\t\tthis._negotiationCallbacks.delete(key);\n\t}\n\n\t/**\n\t * The service needs to be started when the application is initialized.\n\t * Populates the Federated Catalogue with datasets from registered apps\n\t * and starts the stalled negotiation cleanup task.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t */\n\tpublic async start(nodeLoggingComponentType?: string): Promise<void> {\n\t\tconst engine = EngineCoreFactory.getIfExists(\"engine\");\n\t\t// Skip if no engine exists OR if this is a clone instance\n\t\tif (Is.empty(engine) || engine.isClone()) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"debug\",\n\t\t\t\tts: Date.now(),\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tmessage: \"engineCloneStart\"\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tts: Date.now(),\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tmessage: \"populatingFederatedCatalogue\"\n\t\t});\n\n\t\t// Get all registered apps\n\t\tconst appNames = DataspaceAppFactory.names();\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"debug\",\n\t\t\tts: Date.now(),\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tmessage: \"discoveredApps\",\n\t\t\tdata: { count: appNames.length, apps: appNames }\n\t\t});\n\n\t\tlet registeredCount = 0;\n\t\tlet errorCount = 0;\n\n\t\t// Collect and register datasets from each app\n\t\tfor (const appName of appNames) {\n\t\t\ttry {\n\t\t\t\tconst app = DataspaceAppFactory.get<IDataspaceApp>(appName);\n\t\t\t\tconst datasets = await app.datasetsHandled();\n\n\t\t\t\tfor (const dataset of datasets) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// Ensure publisher is set (required for Federated Catalogue)\n\t\t\t\t\t\tconst datasetWithPublisher = await this.ensurePublisher(dataset);\n\n\t\t\t\t\t\t// Register with Federated Catalogue\n\t\t\t\t\t\tawait this._federatedCatalogueComponent.set(\n\t\t\t\t\t\t\tdatasetWithPublisher as unknown as IDcatDataset\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tregisteredCount++;\n\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"debug\",\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tmessage: \"datasetRegistered\",\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tdatasetId: getJsonLdId(datasetWithPublisher) ?? \"\",\n\t\t\t\t\t\t\t\tappName\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\terrorCount++;\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tmessage: \"datasetRegistrationFailed\",\n\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tdatasetId: getJsonLdId(dataset) ?? \"\",\n\t\t\t\t\t\t\t\tappName\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} catch (error) {\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tmessage: \"appDatasetsRetrievalFailed\",\n\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\tdata: { appName }\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tts: Date.now(),\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tmessage: \"federatedCataloguePopulated\",\n\t\t\tdata: {\n\t\t\t\tregisteredCount,\n\t\t\t\terrorCount,\n\t\t\t\ttotalApps: appNames.length\n\t\t\t}\n\t\t});\n\n\t\tif (this._taskScheduler) {\n\t\t\tawait this._taskScheduler.addTask(\n\t\t\t\t\"control-plane-negotiation-cleanup\",\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tnextTriggerTime: Date.now(),\n\t\t\t\t\t\tintervalMinutes: 5\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tasync () => {\n\t\t\t\t\tawait this.cleanupStalledNegotiations();\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Stop the service.\n\t * Removes the stalled negotiation cleanup task.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t */\n\tpublic async stop(nodeLoggingComponentType?: string): Promise<void> {\n\t\tif (this._taskScheduler) {\n\t\t\tawait this._taskScheduler.removeTask(\"control-plane-negotiation-cleanup\");\n\t\t}\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// CONSUMER SIDE OPERATIONS\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Request a Transfer Process.\n\t * Creates a new Transfer Process in REQUESTED state.\n\t * @param request Transfer request message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state REQUESTED, or TransferError if the operation fails.\n\t *\n\t * Role Performed: Provider\n\t * Called by: Consumer when it wants to request a new Transfer Process\n\t */\n\tpublic async requestTransfer(\n\t\trequest: IDataspaceProtocolTransferRequestMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"requestTransfer\");\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tconst isConformant = await DataspaceProtocolHelper.checkConformance(\n\t\t\tJsonLdHelper.toNodeObject(request),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tif (!isConformant) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"error\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"invalidTransferRequest\",\n\t\t\t\tdata: { validationFailures }\n\t\t\t});\n\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidTransferRequest\", {\n\t\t\t\tvalidationFailures\n\t\t\t});\n\t\t}\n\n\t\tconst providerPid = `urn:uuid:${RandomHelper.generateUuidV7()}`;\n\n\t\tlet datasetId: string;\n\t\tlet consumerIdentity: ObjectOrArray<string>;\n\t\tlet providerIdentity: ObjectOrArray<string>;\n\t\tlet policies: IOdrlPolicy[] = [];\n\n\t\ttry {\n\t\t\tconst agreement = await this.lookupAgreement(request.agreementId);\n\n\t\t\tif (!agreement) {\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"agreementNotFound\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tagreementId: request.agreementId,\n\t\t\t\t\t\thint: \"Agreement must exist before transfer. Use contract negotiation to create agreement first.\"\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"agreementNotFound\",\n\t\t\t\t\trequest.agreementId,\n\t\t\t\t\t{\n\t\t\t\t\t\tagreementId: request.agreementId,\n\t\t\t\t\t\thint: \"Perform contract negotiation first to create an agreement\"\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst assigneeIdentity = OdrlPolicyHelper.extractAssigneeIdentity(agreement);\n\t\t\tconsumerIdentity = Is.array(assigneeIdentity) ? assigneeIdentity[0] : assigneeIdentity;\n\n\t\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\t\tproviderIdentity = Is.array(assignerIdentity) ? assignerIdentity[0] : assignerIdentity;\n\t\t\tdatasetId = this.extractDatasetId(agreement);\n\n\t\t\tawait this.validateCatalogDataset(datasetId, agreement);\n\n\t\t\tpolicies = [agreement];\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, { consumerPid: request.consumerPid, providerPid });\n\t\t}\n\n\t\tconst now = new Date();\n\n\t\tconst storageEntity: TransferProcess = {\n\t\t\tid: Converter.bytesToHex(RandomHelper.generate(32)),\n\t\t\tconsumerPid: request.consumerPid,\n\t\t\tproviderPid,\n\t\t\tstate: DataspaceProtocolTransferProcessStateType.REQUESTED,\n\t\t\tagreementId: request.agreementId,\n\t\t\tdatasetId,\n\t\t\tconsumerIdentity: ArrayHelper.fromObjectOrArray<string>(consumerIdentity)[0],\n\t\t\tproviderIdentity: ArrayHelper.fromObjectOrArray<string>(providerIdentity)[0],\n\t\t\t// offerId should reference Catalog Offer (via Agreement)\n\t\t\t// For now, use agreementId as reference (proper flow: Catalog → Negotiation → Agreement)\n\t\t\tofferId: request.agreementId,\n\t\t\tpolicies,\n\t\t\tcallbackAddress: request.callbackAddress,\n\t\t\tformat: request.format,\n\t\t\tdataAddress: request.dataAddress,\n\t\t\tdateCreated: now.toISOString(),\n\t\t\tdateModified: now.toISOString()\n\t\t};\n\n\t\tawait this._transferProcessStorage.set(storageEntity);\n\n\t\tconst entity: ITransferProcess = this.storageEntityToModel(storageEntity);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"transferProcessInitiated\",\n\t\t\tdata: {\n\t\t\t\tconsumerPid: request.consumerPid,\n\t\t\t\tproviderPid,\n\t\t\t\tagreementId: request.agreementId\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tstate: entity.state\n\t\t};\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// PROVIDER SIDE OPERATIONS\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Start a Transfer Process.\n\t * Transitions Transfer Process from REQUESTED to STARTED state or resumes from SUSPENDED state.\n\t * @param message Transfer start message (DSP compliant).\n\t * @param publicOrigin The public origin URL of this service.\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Start Message (DSP compliant) with dataAddress for PULL transfers, or TransferError if the operation fails.\n\t *\n\t * Role Performed: Provider / Consumer\n\t */\n\tpublic async startTransfer(\n\t\tmessage: IDataspaceProtocolTransferStartMessage,\n\t\tpublicOrigin: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferStartMessage | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"startTransfer\");\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tconst isConformant = await DataspaceProtocolHelper.checkConformance(\n\t\t\tJsonLdHelper.toNodeObject(message),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tif (!isConformant) {\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidTransferStartMessage\", {\n\t\t\t\t\tvalidationFailures\n\t\t\t\t}),\n\t\t\t\tmessage\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByMessage(message);\n\n\t\t\tif (\n\t\t\t\tentity.state !== DataspaceProtocolTransferProcessStateType.REQUESTED &&\n\t\t\t\tentity.state !== DataspaceProtocolTransferProcessStateType.SUSPENDED\n\t\t\t) {\n\t\t\t\treturn transformToTransferError(\n\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidStateForStart\", {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tcurrentState: entity.state\n\t\t\t\t\t}),\n\t\t\t\t\tmessage\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.STARTED;\n\t\t\tentity.dateModified = new Date();\n\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessStarted\",\n\t\t\t\tdata: {\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\trole\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tconst response: IDataspaceProtocolTransferStartMessage = {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferStartMessage,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid\n\t\t\t};\n\n\t\t\t// ============================================================================\n\t\t\t// PULL vs PUSH Transfer Mode Detection (DSP Protocol)\n\t\t\t// ============================================================================\n\t\t\t// The transfer mode is determined by whether the consumer provided a dataAddress\n\t\t\t// in the original TransferRequestMessage:\n\t\t\t//\n\t\t\t// PULL Mode (dataAddress NOT provided by consumer):\n\t\t\t// - Consumer requests data but doesn't specify where to receive it\n\t\t\t// - Provider generates access token and returns dataAddress in TransferStartMessage\n\t\t\t// - Consumer uses the returned endpoint + token to PULL data from provider\n\t\t\t// - Flow: Consumer → GET /entities?consumerPid=X (with Bearer token) → Provider\n\t\t\t//\n\t\t\t// PUSH Mode (dataAddress PROVIDED by consumer):\n\t\t\t// - Consumer specifies endpoint where they want data sent (e.g., webhook URL)\n\t\t\t// - Provider will PUSH data to the consumer's specified endpoint\n\t\t\t// - Flow: Provider → POST to consumer's dataAddress endpoint → Consumer\n\t\t\t//\n\t\t\t// See: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1-err1/#transfer-start-message\n\t\t\t// ============================================================================\n\n\t\t\tif (Is.empty(entity.dataAddress)) {\n\t\t\t\tif (!Is.stringValue(this._dataPlanePath)) {\n\t\t\t\t\treturn transformToTransferError(\n\t\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"pullTransfersNotSupported\", {\n\t\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\t\tproviderPid: entity.providerPid\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tmessage\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst accessToken = await this._trustComponent.generate(\n\t\t\t\t\tentity.consumerIdentity ?? entity.consumerPid,\n\t\t\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t\t\t{\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tagreementId: entity.agreementId,\n\t\t\t\t\t\tdatasetId: entity.datasetId\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tconst tokenString = Converter.bytesToBase64(ObjectHelper.toBytes(accessToken));\n\t\t\t\tconst fullEndpoint = `${publicOrigin}/${this._dataPlanePath}`;\n\n\t\t\t\tresponse.dataAddress = {\n\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.DataAddress,\n\t\t\t\t\tendpointType: DataspaceProtocolEndpointType.HttpsQueryEndpoint,\n\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\tendpointProperties: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.EndpointProperty,\n\t\t\t\t\t\t\tname: \"authorization\",\n\t\t\t\t\t\t\tvalue: tokenString\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.EndpointProperty,\n\t\t\t\t\t\t\tname: \"authType\",\n\t\t\t\t\t\t\tvalue: \"bearer\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t};\n\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"dataAccessTokenGenerated\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\t\ttransferMode: \"PULL\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// PUSH MODE: Provider will push data to consumer's specified endpoint\n\t\t\t\t// The consumer provided dataAddress in TransferRequestMessage, indicating\n\t\t\t\t// where they want data sent. Provider acknowledges and will push data there.\n\t\t\t\t//\n\t\t\t\t// TODO: PUSH transfer implementation (RFC-007 future work)\n\t\t\t\t// Implementation would need to:\n\t\t\t\t// 1. Generate provider's own trust token to authenticate when pushing to consumer\n\t\t\t\t// 2. Validate consumer's dataAddress endpoint is reachable\n\t\t\t\t// 3. Extract any consumer-provided authorization from endpointProperties\n\t\t\t\t// 4. Schedule background task to push data to consumer's endpoint\n\t\t\t\t// 5. POST data to entity.dataAddress.endpoint with provider's trust token\n\t\t\t\t// 6. Implement retry logic with exponential backoff\n\t\t\t\t// 7. Send TransferCompletionMessage when push completes successfully\n\t\t\t\t//\n\t\t\t\t// Trust flow for PUSH (mirror of PULL):\n\t\t\t\t// - PULL: Provider generates token → Consumer uses to authenticate when pulling\n\t\t\t\t// - PUSH: Provider generates token → Provider uses to authenticate when pushing\n\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"warn\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"pushTransferModeNotImplemented\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tconsumerEndpoint: entity.dataAddress.endpoint,\n\t\t\t\t\t\ttransferMode: \"PUSH\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn response;\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// SHARED STATE MANAGEMENT OPERATIONS (Either Side)\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Complete a Transfer Process.\n\t * @param message Transfer completion message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state COMPLETED, or TransferError if the operation fails.\n\t */\n\tpublic async completeTransfer(\n\t\tmessage: IDataspaceProtocolTransferCompletionMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"completeTransfer\");\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tconst isConformant = await DataspaceProtocolHelper.checkConformance(\n\t\t\tJsonLdHelper.toNodeObject(message),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tif (!isConformant) {\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"invalidTransferCompletionMessage\",\n\t\t\t\t\t{ validationFailures }\n\t\t\t\t),\n\t\t\t\tmessage\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByMessage(message);\n\n\t\t\tif (entity.state !== DataspaceProtocolTransferProcessStateType.STARTED) {\n\t\t\t\treturn transformToTransferError(\n\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidStateForComplete\", {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tcurrentState: entity.state\n\t\t\t\t\t}),\n\t\t\t\t\tmessage\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.COMPLETED;\n\t\t\tentity.dateModified = new Date();\n\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessCompleted\",\n\t\t\t\tdata: {\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\trole\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t/**\n\t * Suspend a Transfer Process.\n\t * @param message Transfer suspension message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state SUSPENDED, or TransferError if the operation fails.\n\t */\n\tpublic async suspendTransfer(\n\t\tmessage: IDataspaceProtocolTransferSuspensionMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"suspendTransfer\");\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tconst isConformant = await DataspaceProtocolHelper.checkConformance(\n\t\t\tJsonLdHelper.toNodeObject(message),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tif (!isConformant) {\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"invalidTransferSuspensionMessage\",\n\t\t\t\t\t{ validationFailures }\n\t\t\t\t),\n\t\t\t\tmessage\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByMessage(message);\n\n\t\t\tif (entity.state !== DataspaceProtocolTransferProcessStateType.STARTED) {\n\t\t\t\treturn transformToTransferError(\n\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidStateForSuspend\", {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tcurrentState: entity.state\n\t\t\t\t\t}),\n\t\t\t\t\tmessage\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.SUSPENDED;\n\t\t\tentity.dateModified = new Date();\n\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessSuspended\",\n\t\t\t\tdata: {\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\trole,\n\t\t\t\t\treason: message.reason\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t/**\n\t * Terminate a Transfer Process.\n\t * @param message Transfer termination message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state TERMINATED, or TransferError if the operation fails.\n\t */\n\tpublic async terminateTransfer(\n\t\tmessage: IDataspaceProtocolTransferTerminationMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"terminateTransfer\");\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tconst isConformant = await DataspaceProtocolHelper.checkConformance(\n\t\t\tJsonLdHelper.toNodeObject(message),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tif (!isConformant) {\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"invalidTransferTerminationMessage\",\n\t\t\t\t\t{ validationFailures }\n\t\t\t\t),\n\t\t\t\tmessage\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByMessage(message);\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.TERMINATED;\n\t\t\tentity.dateModified = new Date();\n\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessTerminated\",\n\t\t\t\tdata: {\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\trole,\n\t\t\t\t\treason: message.reason\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t/**\n\t * Get Transfer Process state.\n\t * @param pid Process ID (consumerPid or providerPid).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with current state, or TransferError if the operation fails.\n\t */\n\tpublic async getTransferProcess(\n\t\tpid: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"getTransferProcess\");\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByPid(pid);\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessQueried\",\n\t\t\t\tdata: {\n\t\t\t\t\tpid,\n\t\t\t\t\trole,\n\t\t\t\t\tstate: entity.state\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, { consumerPid: pid, providerPid: pid });\n\t\t}\n\t}\n\n\t// ============================================================================\n\t// CONTRACT NEGOTIATION\n\t// ============================================================================\n\n\t/**\n\t * Negotiate a contract agreement with a provider.\n\t * Returns immediately with a negotiationId. The caller is notified\n\t * via the registered INegotiationCallback when the negotiation completes.\n\t *\n\t * @param offerId The offer ID from the provider's catalog.\n\t * @param providerEndpoint The provider's contract negotiation endpoint URL.\n\t * @param publicOrigin The public origin URL of this control plane (for callbacks).\n\t * @param trustPayload The trust payload for authentication.\n\t * @returns The negotiation ID. Use the registered callback for completion notification.\n\t */\n\tpublic async negotiateAgreement(\n\t\tofferId: string,\n\t\tproviderEndpoint: string,\n\t\tpublicOrigin: string,\n\t\ttrustPayload: unknown\n\t): Promise<{ negotiationId: string }> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(offerId), offerId);\n\t\tGuards.stringValue(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(providerEndpoint),\n\t\t\tproviderEndpoint\n\t\t);\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(publicOrigin), publicOrigin);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"startingContractNegotiation\",\n\t\t\tdata: { offerId, providerEndpoint, publicOrigin }\n\t\t});\n\n\t\tconst catalogResult = await this._federatedCatalogueComponent.get(offerId);\n\n\t\tif (isCatalogError(catalogResult)) {\n\t\t\tif (isCatalogErrorName(catalogResult, NotFoundError.CLASS_NAME)) {\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"datasetNotFoundInCatalog\",\n\t\t\t\t\tofferId,\n\t\t\t\t\t{\n\t\t\t\t\t\tofferId,\n\t\t\t\t\t\tproviderEndpoint\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"catalogLookupFailedForNegotiation\",\n\t\t\t\t{\n\t\t\t\t\tofferId,\n\t\t\t\t\tproviderEndpoint,\n\t\t\t\t\terrorCode: catalogResult.code\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst rawOffers = this.getCatalogDatasetPolicies(catalogResult);\n\n\t\tif (!Is.arrayValue(rawOffers)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"datasetHasNoOffers\", {\n\t\t\t\tofferId,\n\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\"\n\t\t\t});\n\t\t}\n\n\t\tconst catalogOffers = rawOffers.filter(offer => Is.object<IOdrlPolicy>(offer));\n\n\t\tif (!Is.arrayValue(catalogOffers)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"datasetHasNoValidOffers\", {\n\t\t\t\tofferId,\n\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\"\n\t\t\t});\n\t\t}\n\n\t\tconst matchingOffer = catalogOffers.find((offer: IOdrlPolicy) => {\n\t\t\tconst offerUid = OdrlPolicyHelper.getUid(offer);\n\t\t\treturn offerUid === offerId;\n\t\t});\n\n\t\tif (!matchingOffer) {\n\t\t\tconst availableOffers = catalogOffers\n\t\t\t\t.map((o: IOdrlPolicy) => OdrlPolicyHelper.getUid(o) ?? \"unknown\")\n\t\t\t\t.join(\", \");\n\n\t\t\tthrow new NotFoundError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"offerNotFoundInDataset\",\n\t\t\t\tofferId,\n\t\t\t\t{\n\t\t\t\t\tofferId,\n\t\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\",\n\t\t\t\t\tavailableOffers\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"offerFoundInCatalog\",\n\t\t\tdata: {\n\t\t\t\tofferId,\n\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\",\n\t\t\t\tofferType: getJsonLdType(matchingOffer)\n\t\t\t}\n\t\t});\n\n\t\tconst negotiationId = await this._policyNegotiationPointComponent.sendRequestToProvider(\n\t\t\tproviderEndpoint,\n\t\t\tDataspaceControlPlaneService._REQUESTER_TYPE,\n\t\t\tofferId,\n\t\t\tpublicOrigin\n\t\t);\n\n\t\tif (!negotiationId) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"negotiationInitiationFailed\",\n\t\t\t\t{\n\t\t\t\t\tofferId,\n\t\t\t\t\tproviderEndpoint\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tthis._policyRequester.trackNegotiation(negotiationId);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationInitiated\",\n\t\t\tdata: { negotiationId, offerId }\n\t\t});\n\n\t\treturn { negotiationId };\n\t}\n\n\t/**\n\t * Get the current state of a contract negotiation.\n\t * @param negotiationId The unique identifier of the negotiation.\n\t * @param trustPayload The trust payload for authentication.\n\t * @returns Current state of the negotiation.\n\t */\n\tpublic async getNegotiation(\n\t\tnegotiationId: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolContractNegotiation | IDataspaceProtocolContractNegotiationError> {\n\t\tGuards.stringValue(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(negotiationId),\n\t\t\tnegotiationId\n\t\t);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"getNegotiation\",\n\t\t\tdata: { negotiationId }\n\t\t});\n\n\t\tconst result = await this._policyNegotiationPointComponent.getNegotiation(\n\t\t\tnegotiationId,\n\t\t\ttrustPayload\n\t\t);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationStateRetrieved\",\n\t\t\tdata: {\n\t\t\t\tnegotiationId,\n\t\t\t\ttype: getJsonLdType(result),\n\t\t\t\tstate: (result as IDataspaceProtocolContractNegotiation).state\n\t\t\t}\n\t\t});\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Get negotiation history.\n\t * @param state Optional filter by negotiation state.\n\t * @param cursor Optional pagination cursor.\n\t * @param trustPayload Trust payload for authentication.\n\t * @returns List of negotiation history entries with pagination.\n\t */\n\tpublic async getNegotiationHistory(\n\t\tstate: string | undefined,\n\t\tcursor: string | undefined,\n\t\ttrustPayload: unknown\n\t): Promise<{\n\t\tnegotiations: {\n\t\t\tnegotiation:\n\t\t\t\t| IDataspaceProtocolContractNegotiation\n\t\t\t\t| IDataspaceProtocolContractNegotiationError;\n\t\t\tcreatedAt: string;\n\t\t\tofferId?: string;\n\t\t\tagreementId?: string;\n\t\t}[];\n\t\tcursor?: string;\n\t\tcount: number;\n\t}> {\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"getNegotiationHistory\",\n\t\t\tdata: { state, cursor }\n\t\t});\n\n\t\tif (!this._policyNegotiationAdminPointComponent) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"pnapNotConfigured\", {\n\t\t\t\tmessage:\n\t\t\t\t\t\"Policy Negotiation Admin Point not configured. \" +\n\t\t\t\t\t\"Set policyNegotiationAdminPointComponentType in constructor options.\"\n\t\t\t});\n\t\t}\n\n\t\tconst { items: pnapNegotiations, cursor: nextCursor } =\n\t\t\tawait this._policyNegotiationAdminPointComponent.query(\n\t\t\t\tstate as DataspaceProtocolContractNegotiationStateType | undefined,\n\t\t\t\tcursor\n\t\t\t);\n\n\t\tconst negotiations = pnapNegotiations.map(pnapNeg => {\n\t\t\tconst dspNegotiation: IDataspaceProtocolContractNegotiation = {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractNegotiation,\n\t\t\t\tconsumerPid: pnapNeg.id,\n\t\t\t\tproviderPid: pnapNeg.correlationId,\n\t\t\t\tstate: pnapNeg.state\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tnegotiation: dspNegotiation,\n\t\t\t\tcreatedAt: pnapNeg.dateCreated,\n\t\t\t\tofferId: OdrlPolicyHelper.getUid(pnapNeg.offer),\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(pnapNeg.agreement)\n\t\t\t};\n\t\t});\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationHistoryRetrieved\",\n\t\t\tdata: {\n\t\t\t\tcount: negotiations.length,\n\t\t\t\tstate,\n\t\t\t\thasCursor: Boolean(nextCursor)\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tnegotiations,\n\t\t\tcursor: nextCursor,\n\t\t\tcount: negotiations.length\n\t\t};\n\t}\n\n\t// ============================================================================\n\t// RESOLVER METHODS - IDataspaceControlPlaneResolverComponent\n\t// ============================================================================\n\n\t/**\n\t * Resolve consumerPid to Transfer Context.\n\t * @param consumerPid Consumer Process ID.\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Context with Agreement, datasetId, and Transfer Process metadata.\n\t */\n\tpublic async resolveConsumerPid(\n\t\tconsumerPid: string,\n\t\ttrustPayload: unknown\n\t): Promise<ITransferContext> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(consumerPid), consumerPid);\n\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"resolveConsumerPid\");\n\n\t\tconst storageEntity = await this._transferProcessStorage.get(consumerPid);\n\n\t\tif (!storageEntity) {\n\t\t\tthrow new NotFoundError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"transferProcessNotFound\",\n\t\t\t\tundefined,\n\t\t\t\t{ consumerPid }\n\t\t\t);\n\t\t}\n\n\t\tconst entity = this.storageEntityToModel(storageEntity);\n\n\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.TERMINATED) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"transferProcessTerminated\", {\n\t\t\t\tconsumerPid\n\t\t\t});\n\t\t}\n\n\t\tconst agreement = await this.lookupAgreement(entity.agreementId);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst currentOrgId = contextIds?.[ContextIdKeys.Organization];\n\n\t\tif (!currentOrgId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"organizationContextMissing\",\n\t\t\t\t{\n\t\t\t\t\tconsumerPid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerId = Is.array(assignerIdentity) ? assignerIdentity[0] : assignerIdentity;\n\n\t\tif (assignerId !== currentOrgId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementAssignerMismatch\",\n\t\t\t\t{\n\t\t\t\t\tconsumerPid,\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\t\texpectedOrgId: currentOrgId,\n\t\t\t\t\tactualAssigner: assignerId\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"resolvedConsumerPid\",\n\t\t\tdata: {\n\t\t\t\tconsumerPid,\n\t\t\t\tdatasetId: entity.datasetId,\n\t\t\t\tstate: entity.state,\n\t\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\torganizationId: currentOrgId\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tagreement,\n\t\t\tdatasetId: entity.datasetId,\n\t\t\tofferId: entity.offerId,\n\t\t\tstate: entity.state,\n\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\tdataAddress: entity.dataAddress\n\t\t};\n\t}\n\n\t/**\n\t * Resolve providerPid to Transfer Context.\n\t * @param providerPid Provider Process ID.\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Context with Agreement, datasetId, and Transfer Process metadata.\n\t */\n\tpublic async resolveProviderPid(\n\t\tproviderPid: string,\n\t\ttrustPayload: unknown\n\t): Promise<ITransferContext> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(providerPid), providerPid);\n\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"resolveProviderPid\");\n\n\t\tconst { entity } = await this.lookupTransferByPid(providerPid);\n\n\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.TERMINATED) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"transferProcessTerminatedProvider\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst agreement = await this.lookupAgreement(entity.agreementId);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst currentOrgId = contextIds?.[ContextIdKeys.Organization];\n\n\t\tif (!currentOrgId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"organizationContextMissingProvider\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Extract assigner UID (can be string, array, or IOdrlParty object)\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerId = Is.array(assignerIdentity) ? assignerIdentity[0] : assignerIdentity;\n\n\t\tif (assignerId !== currentOrgId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementAssignerMismatchProvider\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid,\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\t\texpectedOrgId: currentOrgId,\n\t\t\t\t\tactualAssigner: assignerId\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Validate that Agreement assignee matches expected consumer identity\n\t\t// This ensures we're pushing to the correct consumer\n\t\t// If assignee is undefined but consumerIdentity has a value, this is also a mismatch\n\t\tconst assigneeIdentity = OdrlPolicyHelper.extractAssigneeIdentity(agreement);\n\t\tconst assigneeId = Is.array(assigneeIdentity) ? assigneeIdentity[0] : assigneeIdentity;\n\n\t\tif (assigneeId !== entity.consumerIdentity) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementAssigneeMismatch\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid,\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\t\texpectedConsumerIdentity: entity.consumerIdentity,\n\t\t\t\t\tactualAssignee: assigneeId\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"resolvedProviderPid\",\n\t\t\tdata: {\n\t\t\t\tproviderPid,\n\t\t\t\tdatasetId: entity.datasetId,\n\t\t\t\tstate: entity.state,\n\t\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\torganizationId: currentOrgId\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tagreement,\n\t\t\tdatasetId: entity.datasetId,\n\t\t\tofferId: entity.offerId,\n\t\t\tstate: entity.state,\n\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\tdataAddress: entity.dataAddress\n\t\t};\n\t}\n\n\t// ============================================================================\n\t// PRIVATE HELPER METHODS\n\t// ============================================================================\n\n\t/**\n\t * Cleanup stalled negotiations.\n\t * Called periodically by the task scheduler.\n\t * @internal\n\t */\n\tprivate async cleanupStalledNegotiations(): Promise<void> {\n\t\tconst now = Date.now();\n\t\tconst stalled: string[] = [];\n\n\t\tfor (const [negotiationId, state] of this._policyRequester.getActiveNegotiations()) {\n\t\t\tif (now - state.updatedAt > STALLED_NEGOTIATION_THRESHOLD_MS) {\n\t\t\t\tstalled.push(negotiationId);\n\t\t\t}\n\t\t}\n\n\t\tfor (const negotiationId of stalled) {\n\t\t\tthis._policyRequester.removeNegotiation(negotiationId);\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"stalledNegotiationCleanedUp\",\n\t\t\t\tdata: { negotiationId }\n\t\t\t});\n\n\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\ttry {\n\t\t\t\t\tawait cb.onFailed(negotiationId, \"negotiationStalled\");\n\t\t\t\t} catch (error) {\n\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\t\tdata: { key, negotiationId, method: \"onFailed\", error }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (stalled.length > 0) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"stalledNegotiationsCleanupComplete\",\n\t\t\t\tdata: { cleanedUp: stalled.length }\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Convert a storage entity to model.\n\t * @param storageEntity The entity from storage.\n\t * @returns The model representation.\n\t * @internal\n\t */\n\tprivate storageEntityToModel(storageEntity: TransferProcess): ITransferProcess {\n\t\treturn {\n\t\t\tid: storageEntity.id,\n\t\t\tconsumerPid: storageEntity.consumerPid,\n\t\t\tproviderPid: storageEntity.providerPid,\n\t\t\tstate: storageEntity.state,\n\t\t\tagreementId: storageEntity.agreementId,\n\t\t\tdatasetId: storageEntity.datasetId,\n\t\t\tofferId: storageEntity.offerId,\n\t\t\tconsumerIdentity: storageEntity.consumerIdentity,\n\t\t\tproviderIdentity: storageEntity.providerIdentity,\n\t\t\tformat: storageEntity.format,\n\t\t\tcallbackAddress: storageEntity.callbackAddress,\n\t\t\tdateCreated: new Date(storageEntity.dateCreated),\n\t\t\tdateModified: new Date(storageEntity.dateModified),\n\t\t\tpolicies: storageEntity.policies,\n\t\t\tdataAddress: storageEntity.dataAddress\n\t\t};\n\t}\n\n\t/**\n\t * Convert a model to storage entity.\n\t * @param entity The model representation.\n\t * @returns The entity for storage.\n\t * @internal\n\t */\n\tprivate modelToStorageEntity(entity: ITransferProcess): TransferProcess {\n\t\treturn {\n\t\t\tid: entity.id,\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tstate: entity.state,\n\t\t\tagreementId: entity.agreementId,\n\t\t\tdatasetId: entity.datasetId,\n\t\t\tofferId: entity.offerId,\n\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\tformat: entity.format,\n\t\t\tcallbackAddress: entity.callbackAddress,\n\t\t\tdateCreated: entity.dateCreated.toISOString(),\n\t\t\tdateModified: entity.dateModified.toISOString(),\n\t\t\tpolicies: entity.policies,\n\t\t\tdataAddress: entity.dataAddress\n\t\t};\n\t}\n\n\t/**\n\t * Look up Agreement from PAP.\n\t * @param agreementId Agreement ID.\n\t * @returns Agreement.\n\t * @internal\n\t */\n\tprivate async lookupAgreement(agreementId: string): Promise<IOdrlAgreement> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(agreementId), agreementId);\n\n\t\tlet agreement;\n\t\ttry {\n\t\t\tagreement = await this._policyAdministrationPointComponent.getAgreement(agreementId);\n\t\t} catch (error) {\n\t\t\tif (BaseError.isErrorName(error, NotFoundError.CLASS_NAME)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementLookupFailed\",\n\t\t\t\t{ agreementId },\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\n\t\treturn agreement;\n\t}\n\n\t/**\n\t * Extract dataset ID from Agreement target.\n\t * @param agreement Agreement.\n\t * @returns Dataset ID.\n\t * @internal\n\t */\n\tprivate extractDatasetId(agreement: IOdrlAgreement): string {\n\t\tif (Is.empty(agreement.target)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"agreementMissingTarget\", {\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement)\n\t\t\t});\n\t\t}\n\n\t\tconst targetIds = OdrlPolicyHelper.getTargets(agreement);\n\n\t\tif (targetIds.length === 0) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"agreementTargetMissingUid\", {\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement)\n\t\t\t});\n\t\t}\n\n\t\t// Validate single target, multiple targets are not currently supported\n\t\tif (targetIds.length > 1) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementMultipleTargetsNotSupported\",\n\t\t\t\t{\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\t\ttargetCount: targetIds.length\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\treturn targetIds[0];\n\t}\n\n\t/**\n\t * Validate that the dataset exists in the Federated Catalogue.\n\t * @param datasetId Dataset identifier extracted from Agreement.\n\t * @param agreement The Agreement being validated.\n\t * @internal\n\t */\n\tprivate async validateCatalogDataset(\n\t\tdatasetId: string,\n\t\tagreement: IOdrlAgreement\n\t): Promise<void> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(datasetId), datasetId);\n\t\tGuards.object<IOdrlAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\n\t\t// Lookup dataset in catalog\n\t\tconst catalogResult = await this._federatedCatalogueComponent.get(datasetId);\n\n\t\tif (isCatalogError(catalogResult)) {\n\t\t\tif (isCatalogErrorName(catalogResult, NotFoundError.CLASS_NAME)) {\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"datasetNotInCatalog\",\n\t\t\t\t\tdatasetId,\n\t\t\t\t\t{\n\t\t\t\t\t\tdatasetId,\n\t\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement)\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"catalogLookupFailed\", {\n\t\t\t\tdatasetId,\n\t\t\t\tagreementId: agreement.uid,\n\t\t\t\terrorCode: catalogResult.code\n\t\t\t});\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"catalogDatasetFound\",\n\t\t\tdata: {\n\t\t\t\tdatasetId,\n\t\t\t\tagreementId: agreement.uid,\n\t\t\t\tdatasetTitle: catalogResult[\"dcterms:title\"]\n\t\t\t}\n\t\t});\n\n\t\tawait this.validateAgreementMatchesOffer(agreement, catalogResult);\n\t}\n\n\t/**\n\t * Extract PID from DSP message and lookup Transfer Process with role detection.\n\t * @param message DSP protocol message with consumerPid and/or providerPid fields.\n\t * @returns Transfer Process entity and our role in this transfer.\n\t * @internal\n\t */\n\tprivate async lookupTransferByMessage(message: {\n\t\tconsumerPid?: string;\n\t\tproviderPid?: string;\n\t}): Promise<{\n\t\tentity: ITransferProcess;\n\t\trole: TransferProcessRole;\n\t}> {\n\t\tconst pid = message.consumerPid ?? message.providerPid;\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, \"pid\", pid);\n\n\t\treturn this.lookupTransferByPid(pid);\n\t}\n\n\t/**\n\t * Lookup Transfer Process by PID and determine our role.\n\t * @param pid Either consumerPid or providerPid.\n\t * @returns Transfer Process entity and our role in this transfer.\n\t * @internal\n\t */\n\tprivate async lookupTransferByPid(pid: string): Promise<{\n\t\tentity: ITransferProcess;\n\t\trole: TransferProcessRole;\n\t}> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(pid), pid);\n\n\t\t// Check if pid is a consumerPid (primary key lookup)\n\t\tconst storageEntity = await this._transferProcessStorage.get(pid);\n\n\t\tif (storageEntity) {\n\t\t\treturn {\n\t\t\t\tentity: this.storageEntityToModel(storageEntity),\n\t\t\t\trole: TransferProcessRole.Consumer\n\t\t\t};\n\t\t}\n\n\t\t// Check if pid is a providerPid (secondary key lookup)\n\t\tconst providerPidEntity = await this._transferProcessStorage.get(pid, \"providerPid\");\n\t\tif (providerPidEntity) {\n\t\t\treturn {\n\t\t\t\tentity: this.storageEntityToModel(providerPidEntity),\n\t\t\t\trole: TransferProcessRole.Provider\n\t\t\t};\n\t\t}\n\n\t\tthrow new NotFoundError(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\"transferProcessNotFound\",\n\t\t\tpid,\n\t\t\t{\n\t\t\t\tpid\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Get raw policy entries from a catalog dataset.\n\t * @param catalogDataset Catalog dataset.\n\t * @returns Raw policy entries.\n\t * @internal\n\t */\n\tprivate getCatalogDatasetPolicies(\n\t\tcatalogDataset: IDcatDataset | IDataspaceProtocolDataset\n\t): JsonLdObjectWithNoContext<IOdrlPolicy>[] {\n\t\t// Support both \"odrl:hasPolicy\" and \"hasPolicy\" to accommodate different catalog implementations\n\t\tif (Is.object<IDcatDataset>(catalogDataset) && !Is.empty(catalogDataset[\"odrl:hasPolicy\"])) {\n\t\t\treturn (\n\t\t\t\tArrayHelper.fromObjectOrArray<JsonLdObjectWithNoContext<IOdrlPolicy>>(\n\t\t\t\t\tcatalogDataset[\"odrl:hasPolicy\"]\n\t\t\t\t) ?? []\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\tIs.object<IDataspaceProtocolDataset>(catalogDataset) &&\n\t\t\t!Is.empty(catalogDataset.hasPolicy)\n\t\t) {\n\t\t\treturn (\n\t\t\t\tArrayHelper.fromObjectOrArray<JsonLdObjectWithNoContext<IOdrlPolicy>>(\n\t\t\t\t\tcatalogDataset.hasPolicy\n\t\t\t\t) ?? []\n\t\t\t);\n\t\t}\n\n\t\treturn [];\n\t}\n\n\t/**\n\t * Validate that the Agreement policies match at least one Catalog Offer.\n\t * @param agreement Agreement to validate.\n\t * @param catalogDataset Catalog dataset containing Offers.\n\t * @internal\n\t */\n\tprivate async validateAgreementMatchesOffer(\n\t\tagreement: IOdrlAgreement,\n\t\tcatalogDataset: IDcatDataset\n\t): Promise<void> {\n\t\tGuards.object<IOdrlAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\t\tGuards.object<IDcatDataset>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(catalogDataset),\n\t\t\tcatalogDataset\n\t\t);\n\n\t\tconst rawOffers = this.getCatalogDatasetPolicies(catalogDataset);\n\n\t\tif (!Is.arrayValue(rawOffers)) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"catalogDatasetHasNoOffers\",\n\t\t\t\tdata: {\n\t\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\",\n\t\t\t\t\tagreementId: agreement.uid\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst catalogOffers = rawOffers.filter(offer => Is.object<IOdrlPolicy>(offer));\n\n\t\tif (!Is.arrayValue(catalogOffers)) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"catalogDatasetHasNoOffers\",\n\t\t\t\tdata: {\n\t\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\",\n\t\t\t\t\tagreementId: agreement.uid\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst matchingOffer = catalogOffers.find(\n\t\t\t(offer: IOdrlPolicy) =>\n\t\t\t\tOdrlPolicyHelper.getUid(offer) === agreement.uid ||\n\t\t\t\tthis.isPolicyDerivedFrom(agreement, offer)\n\t\t);\n\n\t\tif (!matchingOffer) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"agreementNotMatchingOffer\", {\n\t\t\t\tagreementId: agreement.uid,\n\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\",\n\t\t\t\tavailableOffers: catalogOffers\n\t\t\t\t\t.map((o: IOdrlPolicy) => OdrlPolicyHelper.getUid(o) ?? \"unknown\")\n\t\t\t\t\t.join(\", \")\n\t\t\t});\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"agreementMatchedOffer\",\n\t\t\tdata: {\n\t\t\t\tagreementId: agreement.uid,\n\t\t\t\tofferId: OdrlPolicyHelper.getUid(matchingOffer) ?? \"\",\n\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\"\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Check if an Agreement is derived from an Offer.\n\t * @param agreement Agreement to check.\n\t * @param offer Offer to compare against.\n\t * @returns True if Agreement appears derived from Offer.\n\t * @internal\n\t */\n\tprivate isPolicyDerivedFrom(agreement: IOdrlAgreement, offer: IOdrlPolicy): boolean {\n\t\tconst agreementTargets = OdrlPolicyHelper.getTargets(agreement);\n\t\tconst offerTargets = OdrlPolicyHelper.getTargets(offer);\n\n\t\tif (\n\t\t\tagreementTargets.length === 0 ||\n\t\t\tofferTargets.length === 0 ||\n\t\t\t!agreementTargets.some((agreementTarget: string) => offerTargets.includes(agreementTarget))\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst agreementAssignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst offerAssignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(offer);\n\n\t\tconst agreementAssigner = ArrayHelper.fromObjectOrArray(agreementAssignerIdentity);\n\t\tconst offerAssigner = ArrayHelper.fromObjectOrArray(offerAssignerIdentity);\n\n\t\tif (!agreementAssigner.some(assigner => offerAssigner.includes(assigner))) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!Is.array(agreement.permission) || !Is.array(offer.permission)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Ensure the dataset has a publisher set.\n\t * @param dataset The dataset.\n\t * @returns The dataset with publisher set.\n\t * @internal\n\t */\n\tprivate async ensurePublisher(\n\t\tdataset: IDataspaceProtocolDataset\n\t): Promise<IDataspaceProtocolDataset> {\n\t\tif (dataset[\"dcterms:publisher\"]) {\n\t\t\treturn dataset;\n\t\t}\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst orgId = contextIds?.[ContextIdKeys.Organization];\n\n\t\tif (orgId) {\n\t\t\treturn {\n\t\t\t\t...dataset,\n\t\t\t\t\"dcterms:publisher\": orgId\n\t\t\t};\n\t\t}\n\n\t\treturn dataset;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dataspaceControlPlaneService.js","sourceRoot":"","sources":["../../src/dataspaceControlPlaneService.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EACN,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,MAAM,EACN,EAAE,EACF,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,iBAAiB,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAkC,MAAM,wBAAwB,CAAC;AACtF,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EAQnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACN,6BAA6B,EAE7B,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EACN,gBAAgB,EAChB,sBAAsB,EAItB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,yBAAyB,EACzB,yCAAyC,EACzC,6BAA6B,EAC7B,uBAAuB,EACvB,yCAAyC,EACzC,qCAAqC,EAcrC,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAwB,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,oCAAoC,EAAE,MAAM,2CAA2C,CAAC;AAEjG,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EACN,cAAc,EACd,kBAAkB,EAClB,wBAAwB,EACxB,MAAM,+BAA+B,CAAC;AAEvC;;;GAGG;AACH,MAAM,gCAAgC,GAAG,EAAE,GAAG,EAAE,GAAG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AC;YAC3E,OAAO,KAAK,CAAC;QACd,CAAC;QAED,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;YACpE,OAAO,KAAK,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,eAAe,CAC5B,OAAkC;QAElC,IAAI,OAAO,CAAC,mBAAmB,CAAC,EAAE,CAAC;YAClC,OAAO,OAAO,CAAC;QAChB,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,aAAa,EAAE,CAAC;QACxD,MAAM,KAAK,GAAG,UAAU,EAAE,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAEvD,IAAI,KAAK,EAAE,CAAC;YACX,OAAO;gBACN,GAAG,OAAO;gBACV,mBAAmB,EAAE,KAAK;aAC1B,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ITaskSchedulerComponent } from \"@twin.org/background-task-models\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport {\n\tArrayHelper,\n\tBaseError,\n\tComponentFactory,\n\tConverter,\n\tGeneralError,\n\tGuards,\n\tIs,\n\tNotFoundError,\n\tObjectHelper,\n\tRandomHelper,\n\tStringHelper,\n\tUnauthorizedError,\n\ttype IValidationFailure,\n\ttype ObjectOrArray\n} from \"@twin.org/core\";\nimport { JsonLdHelper, type JsonLdObjectWithNoContext } from \"@twin.org/data-json-ld\";\nimport {\n\tDataspaceAppFactory,\n\tTransferProcessRole,\n\ttype IDataspaceApp,\n\ttype IDataspaceControlPlaneComponent,\n\ttype IDataspaceControlPlaneResolverComponent,\n\ttype INegotiationCallback,\n\ttype ITransferContext,\n\ttype ITransferProcess,\n\ttype TransferProcess\n} from \"@twin.org/dataspace-models\";\nimport { EngineCoreFactory } from \"@twin.org/engine-models\";\nimport {\n\tEntityStorageConnectorFactory,\n\ttype IEntityStorageConnector\n} from \"@twin.org/entity-storage-models\";\nimport type { IFederatedCatalogueComponent } from \"@twin.org/federated-catalogue-models\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\tPolicyRequesterFactory,\n\ttype IPolicyAdministrationPointComponent,\n\ttype IPolicyNegotiationAdminPointComponent,\n\ttype IPolicyNegotiationPointComponent\n} from \"@twin.org/rights-management-models\";\nimport {\n\tDataspaceProtocolContexts,\n\tDataspaceProtocolContractNegotiationTypes,\n\tDataspaceProtocolEndpointType,\n\tDataspaceProtocolHelper,\n\tDataspaceProtocolTransferProcessStateType,\n\tDataspaceProtocolTransferProcessTypes,\n\ttype DataspaceProtocolContractNegotiationStateType,\n\ttype IDataspaceProtocolAgreement,\n\ttype IDataspaceProtocolContractNegotiation,\n\ttype IDataspaceProtocolContractNegotiationError,\n\ttype IDataspaceProtocolDataset,\n\ttype IDataspaceProtocolPolicy,\n\ttype IDataspaceProtocolTransferCompletionMessage,\n\ttype IDataspaceProtocolTransferError,\n\ttype IDataspaceProtocolTransferProcess,\n\ttype IDataspaceProtocolTransferRequestMessage,\n\ttype IDataspaceProtocolTransferStartMessage,\n\ttype IDataspaceProtocolTransferSuspensionMessage,\n\ttype IDataspaceProtocolTransferTerminationMessage\n} from \"@twin.org/standards-dataspace-protocol\";\nimport type { IDcatDataset } from \"@twin.org/standards-w3c-dcat\";\nimport { TrustHelper, type ITrustComponent } from \"@twin.org/trust-models\";\nimport { DataspaceControlPlanePolicyRequester } from \"./dataspaceControlPlanePolicyRequester.js\";\nimport type { IDataspaceControlPlaneServiceConstructorOptions } from \"./models/IDataspaceControlPlaneServiceConstructorOptions.js\";\nimport { getJsonLdId, getJsonLdType } from \"./utils/dataHelpers.js\";\nimport {\n\tisCatalogError,\n\tisCatalogErrorName,\n\ttransformToTransferError\n} from \"./utils/transferErrorUtils.js\";\n\n/**\n * Stalled negotiation threshold in milliseconds (30 minutes).\n * Negotiations that haven't received a state update within this time are considered stalled.\n */\nconst STALLED_NEGOTIATION_THRESHOLD_MS = 30 * 60 * 1000;\n\n/**\n * Dataspace Control Plane Service implementation.\n *\n * Handles contract negotiation (via PNP callbacks) and transfer process management.\n * Negotiation is fully callback-driven: negotiateAgreement() returns immediately with\n * a negotiationId, and the caller is notified via INegotiationCallback when complete.\n */\nexport class DataspaceControlPlaneService\n\timplements IDataspaceControlPlaneComponent, IDataspaceControlPlaneResolverComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<DataspaceControlPlaneService>();\n\n\t/**\n\t * Hardcoded requester type for PNP registration.\n\t * PNP uses this to route callbacks to our PolicyRequester.\n\t * @internal\n\t */\n\tprivate static readonly _REQUESTER_TYPE = \"dataspace-control-plane-requester\";\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _loggingComponent?: ILoggingComponent;\n\n\t/**\n\t * Policy Administration Point component for Agreement lookup.\n\t * @internal\n\t */\n\tprivate readonly _policyAdministrationPointComponent: IPolicyAdministrationPointComponent;\n\n\t/**\n\t * Policy Negotiation Point component for contract negotiation.\n\t * Used to negotiate agreements with providers before creating transfer processes.\n\n\t * @internal\n\t */\n\tprivate readonly _policyNegotiationPointComponent: IPolicyNegotiationPointComponent;\n\n\t/**\n\t * Policy Negotiation Admin Point component for negotiation history.\n\t * Optional - if not configured, history queries will fail gracefully.\n\t * @internal\n\t */\n\tprivate readonly _policyNegotiationAdminPointComponent?: IPolicyNegotiationAdminPointComponent;\n\n\t/**\n\t * Federated Catalogue component for dataset validation.\n\t * Used to validate that Agreements reference valid catalog datasets.\n\t * @internal\n\t */\n\tprivate readonly _federatedCatalogueComponent: IFederatedCatalogueComponent;\n\n\t/**\n\t * Entity storage for Transfer Process entities.\n\t * Shared between Control Plane and Data Plane.\n\t * @internal\n\t */\n\tprivate readonly _transferProcessStorage: IEntityStorageConnector<TransferProcess>;\n\n\t/**\n\t * The trust component for token verification and generation.\n\t * @internal\n\t */\n\tprivate readonly _trustComponent: ITrustComponent;\n\n\t/**\n\t * Override trust generator type for token generation.\n\t * @internal\n\t */\n\tprivate readonly _overrideTrustGeneratorType?: string;\n\n\t/**\n\t * Data plane endpoint path (path only, not full URL).\n\t * Will be combined with public origin from hosting component.\n\t * If not configured, PULL transfers are not supported.\n\t * @internal\n\t */\n\tprivate readonly _dataPlanePath?: string;\n\n\t/**\n\t * Policy requester instance for handling negotiation callbacks.\n\t * @internal\n\t */\n\tprivate readonly _policyRequester: DataspaceControlPlanePolicyRequester;\n\n\t/**\n\t * Task scheduler for periodic stalled negotiation cleanup.\n\t * @internal\n\t */\n\tprivate readonly _taskScheduler?: ITaskSchedulerComponent;\n\n\t/**\n\t * Registered negotiation callbacks from upstream callers, keyed by registration key.\n\t * @internal\n\t */\n\tprivate readonly _negotiationCallbacks: Map<string, INegotiationCallback>;\n\n\t/**\n\t * Create a new instance of DataspaceControlPlaneService.\n\t * @param options The options for the service.\n\t */\n\tconstructor(options?: IDataspaceControlPlaneServiceConstructorOptions) {\n\t\tthis._loggingComponent = ComponentFactory.getIfExists<ILoggingComponent>(\n\t\t\toptions?.loggingComponentType ?? \"logging\"\n\t\t);\n\n\t\t// Retrieve PAP component with default\n\t\tthis._policyAdministrationPointComponent =\n\t\t\tComponentFactory.get<IPolicyAdministrationPointComponent>(\n\t\t\t\toptions?.policyAdministrationPointComponentType ?? \"policy-administration-point\"\n\t\t\t);\n\n\t\t// Retrieve PNP component with default\n\t\tthis._policyNegotiationPointComponent = ComponentFactory.get<IPolicyNegotiationPointComponent>(\n\t\t\toptions?.policyNegotiationPointComponentType ?? \"policy-negotiation-point\"\n\t\t);\n\n\t\t// Retrieve PNAP component (optional) for negotiation history\n\t\tthis._policyNegotiationAdminPointComponent =\n\t\t\tComponentFactory.getIfExists<IPolicyNegotiationAdminPointComponent>(\n\t\t\t\toptions?.policyNegotiationAdminPointComponentType ?? \"policy-negotiation-admin-point\"\n\t\t\t);\n\n\t\t// Retrieve Federated Catalogue component with default\n\t\tthis._federatedCatalogueComponent = ComponentFactory.get<IFederatedCatalogueComponent>(\n\t\t\toptions?.federatedCatalogueComponentType ?? \"federated-catalogue\"\n\t\t);\n\n\t\tthis._transferProcessStorage = EntityStorageConnectorFactory.get<\n\t\t\tIEntityStorageConnector<TransferProcess>\n\t\t>(options?.transferProcessEntityStorageType ?? nameofKebabCase<TransferProcess>());\n\n\t\tthis._trustComponent = ComponentFactory.get<ITrustComponent>(\n\t\t\toptions?.trustComponentType ?? \"trust\"\n\t\t);\n\n\t\tthis._overrideTrustGeneratorType = options?.config?.overrideTrustGeneratorType;\n\n\t\tthis._dataPlanePath = Is.stringValue(options?.config?.dataPlanePath)\n\t\t\t? StringHelper.trimLeadingSlashes(options.config.dataPlanePath)\n\t\t\t: undefined;\n\n\t\tthis._taskScheduler = ComponentFactory.getIfExists<ITaskSchedulerComponent>(\n\t\t\toptions?.taskSchedulerComponentType ?? \"task-scheduler\"\n\t\t);\n\n\t\tthis._negotiationCallbacks = new Map();\n\n\t\tconst internalCallback: INegotiationCallback = {\n\t\t\tonStateChanged: async (negotiationId, state, data) => {\n\t\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onStateChanged(negotiationId, state, data);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\t\t\tdata: { key, negotiationId, method: \"onStateChanged\", error }\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\tonCompleted: async (negotiationId, agreementId) => {\n\t\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onCompleted(negotiationId, agreementId);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\t\t\tdata: { key, negotiationId, method: \"onCompleted\", error }\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\tonFailed: async (negotiationId, reason) => {\n\t\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onFailed(negotiationId, reason);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\t\t\tdata: { key, negotiationId, method: \"onFailed\", error }\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\n\t\tthis._policyRequester = new DataspaceControlPlanePolicyRequester(\n\t\t\toptions?.loggingComponentType ?? \"logging\",\n\t\t\tinternalCallback\n\t\t);\n\n\t\tPolicyRequesterFactory.register(\n\t\t\tDataspaceControlPlaneService._REQUESTER_TYPE,\n\t\t\t() => this._policyRequester\n\t\t);\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn DataspaceControlPlaneService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Register a callback to receive negotiation state change notifications.\n\t * Upstream modules (e.g. supply-chain) register their callback here.\n\t * @param key A unique key identifying this callback registration.\n\t * @param callback The callback interface to register.\n\t */\n\tpublic registerNegotiationCallback(key: string, callback: INegotiationCallback): void {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(key), key);\n\t\tthis._negotiationCallbacks.set(key, callback);\n\t}\n\n\t/**\n\t * Unregister a previously registered negotiation callback.\n\t * @param key The key used when registering the callback.\n\t */\n\tpublic unregisterNegotiationCallback(key: string): void {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(key), key);\n\t\tthis._negotiationCallbacks.delete(key);\n\t}\n\n\t/**\n\t * The service needs to be started when the application is initialized.\n\t * Populates the Federated Catalogue with datasets from registered apps\n\t * and starts the stalled negotiation cleanup task.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t */\n\tpublic async start(nodeLoggingComponentType?: string): Promise<void> {\n\t\tconst engine = EngineCoreFactory.getIfExists(\"engine\");\n\t\t// Skip if no engine exists OR if this is a clone instance\n\t\tif (Is.empty(engine) || engine.isClone()) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"debug\",\n\t\t\t\tts: Date.now(),\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tmessage: \"engineCloneStart\"\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tts: Date.now(),\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tmessage: \"populatingFederatedCatalogue\"\n\t\t});\n\n\t\t// Get all registered apps\n\t\tconst appNames = DataspaceAppFactory.names();\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"debug\",\n\t\t\tts: Date.now(),\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tmessage: \"discoveredApps\",\n\t\t\tdata: { count: appNames.length, apps: appNames }\n\t\t});\n\n\t\tlet registeredCount = 0;\n\t\tlet errorCount = 0;\n\n\t\t// Collect and register datasets from each app\n\t\tfor (const appName of appNames) {\n\t\t\ttry {\n\t\t\t\tconst app = DataspaceAppFactory.get<IDataspaceApp>(appName);\n\t\t\t\tconst datasets = await app.datasetsHandled();\n\n\t\t\t\tfor (const dataset of datasets) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// Ensure publisher is set (required for Federated Catalogue)\n\t\t\t\t\t\tconst datasetWithPublisher = await this.ensurePublisher(dataset);\n\n\t\t\t\t\t\t// Register with Federated Catalogue\n\t\t\t\t\t\tawait this._federatedCatalogueComponent.set(\n\t\t\t\t\t\t\tdatasetWithPublisher as unknown as IDcatDataset\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tregisteredCount++;\n\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"debug\",\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tmessage: \"datasetRegistered\",\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tdatasetId: getJsonLdId(datasetWithPublisher) ?? \"\",\n\t\t\t\t\t\t\t\tappName\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\terrorCount++;\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tmessage: \"datasetRegistrationFailed\",\n\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tdatasetId: getJsonLdId(dataset) ?? \"\",\n\t\t\t\t\t\t\t\tappName\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} catch (error) {\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tmessage: \"appDatasetsRetrievalFailed\",\n\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\tdata: { appName }\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tts: Date.now(),\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tmessage: \"federatedCataloguePopulated\",\n\t\t\tdata: {\n\t\t\t\tregisteredCount,\n\t\t\t\terrorCount,\n\t\t\t\ttotalApps: appNames.length\n\t\t\t}\n\t\t});\n\n\t\tif (this._taskScheduler) {\n\t\t\tawait this._taskScheduler.addTask(\n\t\t\t\t\"control-plane-negotiation-cleanup\",\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tnextTriggerTime: Date.now(),\n\t\t\t\t\t\tintervalMinutes: 5\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tasync () => {\n\t\t\t\t\tawait this.cleanupStalledNegotiations();\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Stop the service.\n\t * Removes the stalled negotiation cleanup task.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t */\n\tpublic async stop(nodeLoggingComponentType?: string): Promise<void> {\n\t\tif (this._taskScheduler) {\n\t\t\tawait this._taskScheduler.removeTask(\"control-plane-negotiation-cleanup\");\n\t\t}\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// CONSUMER SIDE OPERATIONS\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Request a Transfer Process.\n\t * Creates a new Transfer Process in REQUESTED state.\n\t * @param request Transfer request message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state REQUESTED, or TransferError if the operation fails.\n\t *\n\t * Role Performed: Provider\n\t * Called by: Consumer when it wants to request a new Transfer Process\n\t */\n\tpublic async requestTransfer(\n\t\trequest: IDataspaceProtocolTransferRequestMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"requestTransfer\");\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tconst isConformant = await DataspaceProtocolHelper.checkConformance(\n\t\t\tJsonLdHelper.toNodeObject(request),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tif (!isConformant) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"error\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"invalidTransferRequest\",\n\t\t\t\tdata: { validationFailures }\n\t\t\t});\n\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidTransferRequest\", {\n\t\t\t\tvalidationFailures\n\t\t\t});\n\t\t}\n\n\t\tconst providerPid = `urn:uuid:${RandomHelper.generateUuidV7()}`;\n\n\t\tlet datasetId: string;\n\t\tlet consumerIdentity: ObjectOrArray<string>;\n\t\tlet providerIdentity: ObjectOrArray<string>;\n\t\tlet policies: IDataspaceProtocolPolicy[] = [];\n\n\t\ttry {\n\t\t\tconst agreement = await this.lookupAgreement(request.agreementId);\n\n\t\t\tif (!agreement) {\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"agreementNotFound\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tagreementId: request.agreementId,\n\t\t\t\t\t\thint: \"Agreement must exist before transfer. Use contract negotiation to create agreement first.\"\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"agreementNotFound\",\n\t\t\t\t\trequest.agreementId,\n\t\t\t\t\t{\n\t\t\t\t\t\tagreementId: request.agreementId,\n\t\t\t\t\t\thint: \"Perform contract negotiation first to create an agreement\"\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst assigneeIdentity = OdrlPolicyHelper.extractAssigneeIdentity(agreement);\n\t\t\tconsumerIdentity = Is.array(assigneeIdentity) ? assigneeIdentity[0] : assigneeIdentity;\n\n\t\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\t\tproviderIdentity = Is.array(assignerIdentity) ? assignerIdentity[0] : assignerIdentity;\n\t\t\tdatasetId = this.extractDatasetId(agreement);\n\n\t\t\tawait this.validateCatalogDataset(datasetId, agreement);\n\n\t\t\tpolicies = [agreement];\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, { consumerPid: request.consumerPid, providerPid });\n\t\t}\n\n\t\tconst now = new Date();\n\n\t\tconst storageEntity: TransferProcess = {\n\t\t\tid: Converter.bytesToHex(RandomHelper.generate(32)),\n\t\t\tconsumerPid: request.consumerPid,\n\t\t\tproviderPid,\n\t\t\tstate: DataspaceProtocolTransferProcessStateType.REQUESTED,\n\t\t\tagreementId: request.agreementId,\n\t\t\tdatasetId,\n\t\t\tconsumerIdentity: ArrayHelper.fromObjectOrArray<string>(consumerIdentity)[0],\n\t\t\tproviderIdentity: ArrayHelper.fromObjectOrArray<string>(providerIdentity)[0],\n\t\t\t// offerId should reference Catalog Offer (via Agreement)\n\t\t\t// For now, use agreementId as reference (proper flow: Catalog → Negotiation → Agreement)\n\t\t\tofferId: request.agreementId,\n\t\t\tpolicies,\n\t\t\tcallbackAddress: request.callbackAddress,\n\t\t\tformat: request.format,\n\t\t\tdataAddress: request.dataAddress,\n\t\t\tdateCreated: now.toISOString(),\n\t\t\tdateModified: now.toISOString()\n\t\t};\n\n\t\tawait this._transferProcessStorage.set(storageEntity);\n\n\t\tconst entity: ITransferProcess = this.storageEntityToModel(storageEntity);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"transferProcessInitiated\",\n\t\t\tdata: {\n\t\t\t\tconsumerPid: request.consumerPid,\n\t\t\t\tproviderPid,\n\t\t\t\tagreementId: request.agreementId\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tstate: entity.state\n\t\t};\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// PROVIDER SIDE OPERATIONS\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Start a Transfer Process.\n\t * Transitions Transfer Process from REQUESTED to STARTED state or resumes from SUSPENDED state.\n\t * @param message Transfer start message (DSP compliant).\n\t * @param publicOrigin The public origin URL of this service.\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Start Message (DSP compliant) with dataAddress for PULL transfers, or TransferError if the operation fails.\n\t *\n\t * Role Performed: Provider / Consumer\n\t */\n\tpublic async startTransfer(\n\t\tmessage: IDataspaceProtocolTransferStartMessage,\n\t\tpublicOrigin: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferStartMessage | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"startTransfer\");\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tconst isConformant = await DataspaceProtocolHelper.checkConformance(\n\t\t\tJsonLdHelper.toNodeObject(message),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tif (!isConformant) {\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidTransferStartMessage\", {\n\t\t\t\t\tvalidationFailures\n\t\t\t\t}),\n\t\t\t\tmessage\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByMessage(message);\n\n\t\t\tif (\n\t\t\t\tentity.state !== DataspaceProtocolTransferProcessStateType.REQUESTED &&\n\t\t\t\tentity.state !== DataspaceProtocolTransferProcessStateType.SUSPENDED\n\t\t\t) {\n\t\t\t\treturn transformToTransferError(\n\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidStateForStart\", {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tcurrentState: entity.state\n\t\t\t\t\t}),\n\t\t\t\t\tmessage\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.STARTED;\n\t\t\tentity.dateModified = new Date();\n\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessStarted\",\n\t\t\t\tdata: {\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\trole\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tconst response: IDataspaceProtocolTransferStartMessage = {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferStartMessage,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid\n\t\t\t};\n\n\t\t\t// ============================================================================\n\t\t\t// PULL vs PUSH Transfer Mode Detection (DSP Protocol)\n\t\t\t// ============================================================================\n\t\t\t// The transfer mode is determined by whether the consumer provided a dataAddress\n\t\t\t// in the original TransferRequestMessage:\n\t\t\t//\n\t\t\t// PULL Mode (dataAddress NOT provided by consumer):\n\t\t\t// - Consumer requests data but doesn't specify where to receive it\n\t\t\t// - Provider generates access token and returns dataAddress in TransferStartMessage\n\t\t\t// - Consumer uses the returned endpoint + token to PULL data from provider\n\t\t\t// - Flow: Consumer → GET /entities?consumerPid=X (with Bearer token) → Provider\n\t\t\t//\n\t\t\t// PUSH Mode (dataAddress PROVIDED by consumer):\n\t\t\t// - Consumer specifies endpoint where they want data sent (e.g., webhook URL)\n\t\t\t// - Provider will PUSH data to the consumer's specified endpoint\n\t\t\t// - Flow: Provider → POST to consumer's dataAddress endpoint → Consumer\n\t\t\t//\n\t\t\t// See: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1-err1/#transfer-start-message\n\t\t\t// ============================================================================\n\n\t\t\tif (Is.empty(entity.dataAddress)) {\n\t\t\t\tif (!Is.stringValue(this._dataPlanePath)) {\n\t\t\t\t\treturn transformToTransferError(\n\t\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"pullTransfersNotSupported\", {\n\t\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\t\tproviderPid: entity.providerPid\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tmessage\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst accessToken = await this._trustComponent.generate(\n\t\t\t\t\tentity.consumerIdentity ?? entity.consumerPid,\n\t\t\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t\t\t{\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tagreementId: entity.agreementId,\n\t\t\t\t\t\tdatasetId: entity.datasetId\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tconst tokenString = Converter.bytesToBase64(ObjectHelper.toBytes(accessToken));\n\t\t\t\tconst fullEndpoint = `${publicOrigin}/${this._dataPlanePath}`;\n\n\t\t\t\tresponse.dataAddress = {\n\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.DataAddress,\n\t\t\t\t\tendpointType: DataspaceProtocolEndpointType.HttpsQueryEndpoint,\n\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\tendpointProperties: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.EndpointProperty,\n\t\t\t\t\t\t\tname: \"authorization\",\n\t\t\t\t\t\t\tvalue: tokenString\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.EndpointProperty,\n\t\t\t\t\t\t\tname: \"authType\",\n\t\t\t\t\t\t\tvalue: \"bearer\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t};\n\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"dataAccessTokenGenerated\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\t\ttransferMode: \"PULL\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// PUSH MODE: Provider will push data to consumer's specified endpoint\n\t\t\t\t// The consumer provided dataAddress in TransferRequestMessage, indicating\n\t\t\t\t// where they want data sent. Provider acknowledges and will push data there.\n\t\t\t\t//\n\t\t\t\t// TODO: PUSH transfer implementation (RFC-007 future work)\n\t\t\t\t// Implementation would need to:\n\t\t\t\t// 1. Generate provider's own trust token to authenticate when pushing to consumer\n\t\t\t\t// 2. Validate consumer's dataAddress endpoint is reachable\n\t\t\t\t// 3. Extract any consumer-provided authorization from endpointProperties\n\t\t\t\t// 4. Schedule background task to push data to consumer's endpoint\n\t\t\t\t// 5. POST data to entity.dataAddress.endpoint with provider's trust token\n\t\t\t\t// 6. Implement retry logic with exponential backoff\n\t\t\t\t// 7. Send TransferCompletionMessage when push completes successfully\n\t\t\t\t//\n\t\t\t\t// Trust flow for PUSH (mirror of PULL):\n\t\t\t\t// - PULL: Provider generates token → Consumer uses to authenticate when pulling\n\t\t\t\t// - PUSH: Provider generates token → Provider uses to authenticate when pushing\n\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"warn\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"pushTransferModeNotImplemented\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tconsumerEndpoint: entity.dataAddress.endpoint,\n\t\t\t\t\t\ttransferMode: \"PUSH\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn response;\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// SHARED STATE MANAGEMENT OPERATIONS (Either Side)\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Complete a Transfer Process.\n\t * @param message Transfer completion message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state COMPLETED, or TransferError if the operation fails.\n\t */\n\tpublic async completeTransfer(\n\t\tmessage: IDataspaceProtocolTransferCompletionMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"completeTransfer\");\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tconst isConformant = await DataspaceProtocolHelper.checkConformance(\n\t\t\tJsonLdHelper.toNodeObject(message),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tif (!isConformant) {\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"invalidTransferCompletionMessage\",\n\t\t\t\t\t{ validationFailures }\n\t\t\t\t),\n\t\t\t\tmessage\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByMessage(message);\n\n\t\t\tif (entity.state !== DataspaceProtocolTransferProcessStateType.STARTED) {\n\t\t\t\treturn transformToTransferError(\n\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidStateForComplete\", {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tcurrentState: entity.state\n\t\t\t\t\t}),\n\t\t\t\t\tmessage\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.COMPLETED;\n\t\t\tentity.dateModified = new Date();\n\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessCompleted\",\n\t\t\t\tdata: {\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\trole\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t/**\n\t * Suspend a Transfer Process.\n\t * @param message Transfer suspension message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state SUSPENDED, or TransferError if the operation fails.\n\t */\n\tpublic async suspendTransfer(\n\t\tmessage: IDataspaceProtocolTransferSuspensionMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"suspendTransfer\");\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tconst isConformant = await DataspaceProtocolHelper.checkConformance(\n\t\t\tJsonLdHelper.toNodeObject(message),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tif (!isConformant) {\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"invalidTransferSuspensionMessage\",\n\t\t\t\t\t{ validationFailures }\n\t\t\t\t),\n\t\t\t\tmessage\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByMessage(message);\n\n\t\t\tif (entity.state !== DataspaceProtocolTransferProcessStateType.STARTED) {\n\t\t\t\treturn transformToTransferError(\n\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidStateForSuspend\", {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tcurrentState: entity.state\n\t\t\t\t\t}),\n\t\t\t\t\tmessage\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.SUSPENDED;\n\t\t\tentity.dateModified = new Date();\n\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessSuspended\",\n\t\t\t\tdata: {\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\trole,\n\t\t\t\t\treason: message.reason\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t/**\n\t * Terminate a Transfer Process.\n\t * @param message Transfer termination message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state TERMINATED, or TransferError if the operation fails.\n\t */\n\tpublic async terminateTransfer(\n\t\tmessage: IDataspaceProtocolTransferTerminationMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"terminateTransfer\");\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tconst isConformant = await DataspaceProtocolHelper.checkConformance(\n\t\t\tJsonLdHelper.toNodeObject(message),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tif (!isConformant) {\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"invalidTransferTerminationMessage\",\n\t\t\t\t\t{ validationFailures }\n\t\t\t\t),\n\t\t\t\tmessage\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByMessage(message);\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.TERMINATED;\n\t\t\tentity.dateModified = new Date();\n\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessTerminated\",\n\t\t\t\tdata: {\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\trole,\n\t\t\t\t\treason: message.reason\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t/**\n\t * Get Transfer Process state.\n\t * @param pid Process ID (consumerPid or providerPid).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with current state, or TransferError if the operation fails.\n\t */\n\tpublic async getTransferProcess(\n\t\tpid: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"getTransferProcess\");\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByPid(pid);\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessQueried\",\n\t\t\t\tdata: {\n\t\t\t\t\tpid,\n\t\t\t\t\trole,\n\t\t\t\t\tstate: entity.state\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, { consumerPid: pid, providerPid: pid });\n\t\t}\n\t}\n\n\t// ============================================================================\n\t// CONTRACT NEGOTIATION\n\t// ============================================================================\n\n\t/**\n\t * Negotiate a contract agreement with a provider.\n\t * Returns immediately with a negotiationId. The caller is notified\n\t * via the registered INegotiationCallback when the negotiation completes.\n\t *\n\t * @param offerId The offer ID from the provider's catalog.\n\t * @param providerEndpoint The provider's contract negotiation endpoint URL.\n\t * @param publicOrigin The public origin URL of this control plane (for callbacks).\n\t * @param trustPayload The trust payload for authentication.\n\t * @returns The negotiation ID. Use the registered callback for completion notification.\n\t */\n\tpublic async negotiateAgreement(\n\t\tofferId: string,\n\t\tproviderEndpoint: string,\n\t\tpublicOrigin: string,\n\t\ttrustPayload: unknown\n\t): Promise<{ negotiationId: string }> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(offerId), offerId);\n\t\tGuards.stringValue(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(providerEndpoint),\n\t\t\tproviderEndpoint\n\t\t);\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(publicOrigin), publicOrigin);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"startingContractNegotiation\",\n\t\t\tdata: { offerId, providerEndpoint, publicOrigin }\n\t\t});\n\n\t\tconst catalogResult = await this._federatedCatalogueComponent.get(offerId);\n\n\t\tif (isCatalogError(catalogResult)) {\n\t\t\tif (isCatalogErrorName(catalogResult, NotFoundError.CLASS_NAME)) {\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"datasetNotFoundInCatalog\",\n\t\t\t\t\tofferId,\n\t\t\t\t\t{\n\t\t\t\t\t\tofferId,\n\t\t\t\t\t\tproviderEndpoint\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"catalogLookupFailedForNegotiation\",\n\t\t\t\t{\n\t\t\t\t\tofferId,\n\t\t\t\t\tproviderEndpoint,\n\t\t\t\t\terrorCode: catalogResult.code\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst rawOffers = this.getCatalogDatasetPolicies(catalogResult);\n\n\t\tif (!Is.arrayValue(rawOffers)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"datasetHasNoOffers\", {\n\t\t\t\tofferId,\n\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\"\n\t\t\t});\n\t\t}\n\n\t\tconst catalogOffers = rawOffers.filter(offer => Is.object<IDataspaceProtocolPolicy>(offer));\n\n\t\tif (!Is.arrayValue(catalogOffers)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"datasetHasNoValidOffers\", {\n\t\t\t\tofferId,\n\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\"\n\t\t\t});\n\t\t}\n\n\t\tconst matchingOffer = catalogOffers.find((offer: IDataspaceProtocolPolicy) => {\n\t\t\tconst offerUid = OdrlPolicyHelper.getUid(offer);\n\t\t\treturn offerUid === offerId;\n\t\t});\n\n\t\tif (!matchingOffer) {\n\t\t\tconst availableOffers = catalogOffers\n\t\t\t\t.map((o: IDataspaceProtocolPolicy) => OdrlPolicyHelper.getUid(o) ?? \"unknown\")\n\t\t\t\t.join(\", \");\n\n\t\t\tthrow new NotFoundError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"offerNotFoundInDataset\",\n\t\t\t\tofferId,\n\t\t\t\t{\n\t\t\t\t\tofferId,\n\t\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\",\n\t\t\t\t\tavailableOffers\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"offerFoundInCatalog\",\n\t\t\tdata: {\n\t\t\t\tofferId,\n\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\",\n\t\t\t\tofferType: getJsonLdType(matchingOffer)\n\t\t\t}\n\t\t});\n\n\t\tconst negotiationId = await this._policyNegotiationPointComponent.sendRequestToProvider(\n\t\t\tproviderEndpoint,\n\t\t\tDataspaceControlPlaneService._REQUESTER_TYPE,\n\t\t\tofferId,\n\t\t\tpublicOrigin\n\t\t);\n\n\t\tif (!negotiationId) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"negotiationInitiationFailed\",\n\t\t\t\t{\n\t\t\t\t\tofferId,\n\t\t\t\t\tproviderEndpoint\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tthis._policyRequester.trackNegotiation(negotiationId);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationInitiated\",\n\t\t\tdata: { negotiationId, offerId }\n\t\t});\n\n\t\treturn { negotiationId };\n\t}\n\n\t/**\n\t * Get the current state of a contract negotiation.\n\t * @param negotiationId The unique identifier of the negotiation.\n\t * @param trustPayload The trust payload for authentication.\n\t * @returns Current state of the negotiation.\n\t */\n\tpublic async getNegotiation(\n\t\tnegotiationId: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolContractNegotiation | IDataspaceProtocolContractNegotiationError> {\n\t\tGuards.stringValue(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(negotiationId),\n\t\t\tnegotiationId\n\t\t);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"getNegotiation\",\n\t\t\tdata: { negotiationId }\n\t\t});\n\n\t\tconst result = await this._policyNegotiationPointComponent.getNegotiation(\n\t\t\tnegotiationId,\n\t\t\ttrustPayload\n\t\t);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationStateRetrieved\",\n\t\t\tdata: {\n\t\t\t\tnegotiationId,\n\t\t\t\ttype: getJsonLdType(result),\n\t\t\t\tstate: (result as IDataspaceProtocolContractNegotiation).state\n\t\t\t}\n\t\t});\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Get negotiation history.\n\t * @param state Optional filter by negotiation state.\n\t * @param cursor Optional pagination cursor.\n\t * @param trustPayload Trust payload for authentication.\n\t * @returns List of negotiation history entries with pagination.\n\t */\n\tpublic async getNegotiationHistory(\n\t\tstate: string | undefined,\n\t\tcursor: string | undefined,\n\t\ttrustPayload: unknown\n\t): Promise<{\n\t\tnegotiations: {\n\t\t\tnegotiation:\n\t\t\t\t| IDataspaceProtocolContractNegotiation\n\t\t\t\t| IDataspaceProtocolContractNegotiationError;\n\t\t\tcreatedAt: string;\n\t\t\tofferId?: string;\n\t\t\tagreementId?: string;\n\t\t}[];\n\t\tcursor?: string;\n\t\tcount: number;\n\t}> {\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"getNegotiationHistory\",\n\t\t\tdata: { state, cursor }\n\t\t});\n\n\t\tif (!this._policyNegotiationAdminPointComponent) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"pnapNotConfigured\", {\n\t\t\t\tmessage:\n\t\t\t\t\t\"Policy Negotiation Admin Point not configured. \" +\n\t\t\t\t\t\"Set policyNegotiationAdminPointComponentType in constructor options.\"\n\t\t\t});\n\t\t}\n\n\t\tconst { items: pnapNegotiations, cursor: nextCursor } =\n\t\t\tawait this._policyNegotiationAdminPointComponent.query(\n\t\t\t\tstate as DataspaceProtocolContractNegotiationStateType | undefined,\n\t\t\t\tcursor\n\t\t\t);\n\n\t\tconst negotiations = pnapNegotiations.map(pnapNeg => {\n\t\t\tconst dspNegotiation: IDataspaceProtocolContractNegotiation = {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractNegotiation,\n\t\t\t\tconsumerPid: pnapNeg.id,\n\t\t\t\tproviderPid: pnapNeg.correlationId,\n\t\t\t\tstate: pnapNeg.state\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tnegotiation: dspNegotiation,\n\t\t\t\tcreatedAt: pnapNeg.dateCreated,\n\t\t\t\tofferId: OdrlPolicyHelper.getUid(pnapNeg.offer),\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(pnapNeg.agreement)\n\t\t\t};\n\t\t});\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationHistoryRetrieved\",\n\t\t\tdata: {\n\t\t\t\tcount: negotiations.length,\n\t\t\t\tstate,\n\t\t\t\thasCursor: Boolean(nextCursor)\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tnegotiations,\n\t\t\tcursor: nextCursor,\n\t\t\tcount: negotiations.length\n\t\t};\n\t}\n\n\t// ============================================================================\n\t// RESOLVER METHODS - IDataspaceControlPlaneResolverComponent\n\t// ============================================================================\n\n\t/**\n\t * Resolve consumerPid to Transfer Context.\n\t * @param consumerPid Consumer Process ID.\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Context with Agreement, datasetId, and Transfer Process metadata.\n\t */\n\tpublic async resolveConsumerPid(\n\t\tconsumerPid: string,\n\t\ttrustPayload: unknown\n\t): Promise<ITransferContext> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(consumerPid), consumerPid);\n\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"resolveConsumerPid\");\n\n\t\tconst storageEntity = await this._transferProcessStorage.get(consumerPid);\n\n\t\tif (!storageEntity) {\n\t\t\tthrow new NotFoundError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"transferProcessNotFound\",\n\t\t\t\tundefined,\n\t\t\t\t{ consumerPid }\n\t\t\t);\n\t\t}\n\n\t\tconst entity = this.storageEntityToModel(storageEntity);\n\n\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.TERMINATED) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"transferProcessTerminated\", {\n\t\t\t\tconsumerPid\n\t\t\t});\n\t\t}\n\n\t\tconst agreement = await this.lookupAgreement(entity.agreementId);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst currentOrgId = contextIds?.[ContextIdKeys.Organization];\n\n\t\tif (!currentOrgId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"organizationContextMissing\",\n\t\t\t\t{\n\t\t\t\t\tconsumerPid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerId = Is.array(assignerIdentity) ? assignerIdentity[0] : assignerIdentity;\n\n\t\tif (assignerId !== currentOrgId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementAssignerMismatch\",\n\t\t\t\t{\n\t\t\t\t\tconsumerPid,\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\t\texpectedOrgId: currentOrgId,\n\t\t\t\t\tactualAssigner: assignerId\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"resolvedConsumerPid\",\n\t\t\tdata: {\n\t\t\t\tconsumerPid,\n\t\t\t\tdatasetId: entity.datasetId,\n\t\t\t\tstate: entity.state,\n\t\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\torganizationId: currentOrgId\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tagreement,\n\t\t\tdatasetId: entity.datasetId,\n\t\t\tofferId: entity.offerId,\n\t\t\tstate: entity.state,\n\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\tdataAddress: entity.dataAddress\n\t\t};\n\t}\n\n\t/**\n\t * Resolve providerPid to Transfer Context.\n\t * @param providerPid Provider Process ID.\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Context with Agreement, datasetId, and Transfer Process metadata.\n\t */\n\tpublic async resolveProviderPid(\n\t\tproviderPid: string,\n\t\ttrustPayload: unknown\n\t): Promise<ITransferContext> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(providerPid), providerPid);\n\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"resolveProviderPid\");\n\n\t\tconst { entity } = await this.lookupTransferByPid(providerPid);\n\n\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.TERMINATED) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"transferProcessTerminatedProvider\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst agreement = await this.lookupAgreement(entity.agreementId);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst currentOrgId = contextIds?.[ContextIdKeys.Organization];\n\n\t\tif (!currentOrgId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"organizationContextMissingProvider\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Extract assigner UID (can be string, array, or IOdrlParty object)\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerId = Is.array(assignerIdentity) ? assignerIdentity[0] : assignerIdentity;\n\n\t\tif (assignerId !== currentOrgId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementAssignerMismatchProvider\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid,\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\t\texpectedOrgId: currentOrgId,\n\t\t\t\t\tactualAssigner: assignerId\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Validate that Agreement assignee matches expected consumer identity\n\t\t// This ensures we're pushing to the correct consumer\n\t\t// If assignee is undefined but consumerIdentity has a value, this is also a mismatch\n\t\tconst assigneeIdentity = OdrlPolicyHelper.extractAssigneeIdentity(agreement);\n\t\tconst assigneeId = Is.array(assigneeIdentity) ? assigneeIdentity[0] : assigneeIdentity;\n\n\t\tif (assigneeId !== entity.consumerIdentity) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementAssigneeMismatch\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid,\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\t\texpectedConsumerIdentity: entity.consumerIdentity,\n\t\t\t\t\tactualAssignee: assigneeId\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"resolvedProviderPid\",\n\t\t\tdata: {\n\t\t\t\tproviderPid,\n\t\t\t\tdatasetId: entity.datasetId,\n\t\t\t\tstate: entity.state,\n\t\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\torganizationId: currentOrgId\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tagreement,\n\t\t\tdatasetId: entity.datasetId,\n\t\t\tofferId: entity.offerId,\n\t\t\tstate: entity.state,\n\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\tdataAddress: entity.dataAddress\n\t\t};\n\t}\n\n\t// ============================================================================\n\t// PRIVATE HELPER METHODS\n\t// ============================================================================\n\n\t/**\n\t * Cleanup stalled negotiations.\n\t * Called periodically by the task scheduler.\n\t * @internal\n\t */\n\tprivate async cleanupStalledNegotiations(): Promise<void> {\n\t\tconst now = Date.now();\n\t\tconst stalled: string[] = [];\n\n\t\tfor (const [negotiationId, state] of this._policyRequester.getActiveNegotiations()) {\n\t\t\tif (now - state.updatedAt > STALLED_NEGOTIATION_THRESHOLD_MS) {\n\t\t\t\tstalled.push(negotiationId);\n\t\t\t}\n\t\t}\n\n\t\tfor (const negotiationId of stalled) {\n\t\t\tthis._policyRequester.removeNegotiation(negotiationId);\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"stalledNegotiationCleanedUp\",\n\t\t\t\tdata: { negotiationId }\n\t\t\t});\n\n\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\ttry {\n\t\t\t\t\tawait cb.onFailed(negotiationId, \"negotiationStalled\");\n\t\t\t\t} catch (error) {\n\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\t\tdata: { key, negotiationId, method: \"onFailed\", error }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (stalled.length > 0) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"stalledNegotiationsCleanupComplete\",\n\t\t\t\tdata: { cleanedUp: stalled.length }\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Convert a storage entity to model.\n\t * @param storageEntity The entity from storage.\n\t * @returns The model representation.\n\t * @internal\n\t */\n\tprivate storageEntityToModel(storageEntity: TransferProcess): ITransferProcess {\n\t\treturn {\n\t\t\tid: storageEntity.id,\n\t\t\tconsumerPid: storageEntity.consumerPid,\n\t\t\tproviderPid: storageEntity.providerPid,\n\t\t\tstate: storageEntity.state,\n\t\t\tagreementId: storageEntity.agreementId,\n\t\t\tdatasetId: storageEntity.datasetId,\n\t\t\tofferId: storageEntity.offerId,\n\t\t\tconsumerIdentity: storageEntity.consumerIdentity,\n\t\t\tproviderIdentity: storageEntity.providerIdentity,\n\t\t\tformat: storageEntity.format,\n\t\t\tcallbackAddress: storageEntity.callbackAddress,\n\t\t\tdateCreated: new Date(storageEntity.dateCreated),\n\t\t\tdateModified: new Date(storageEntity.dateModified),\n\t\t\tpolicies: storageEntity.policies,\n\t\t\tdataAddress: storageEntity.dataAddress\n\t\t};\n\t}\n\n\t/**\n\t * Convert a model to storage entity.\n\t * @param entity The model representation.\n\t * @returns The entity for storage.\n\t * @internal\n\t */\n\tprivate modelToStorageEntity(entity: ITransferProcess): TransferProcess {\n\t\treturn {\n\t\t\tid: entity.id,\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tstate: entity.state,\n\t\t\tagreementId: entity.agreementId,\n\t\t\tdatasetId: entity.datasetId,\n\t\t\tofferId: entity.offerId,\n\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\tformat: entity.format,\n\t\t\tcallbackAddress: entity.callbackAddress,\n\t\t\tdateCreated: entity.dateCreated.toISOString(),\n\t\t\tdateModified: entity.dateModified.toISOString(),\n\t\t\tpolicies: entity.policies,\n\t\t\tdataAddress: entity.dataAddress\n\t\t};\n\t}\n\n\t/**\n\t * Look up Agreement from PAP.\n\t * @param agreementId Agreement ID.\n\t * @returns Agreement.\n\t * @internal\n\t */\n\tprivate async lookupAgreement(agreementId: string): Promise<IDataspaceProtocolAgreement> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(agreementId), agreementId);\n\n\t\tlet agreement;\n\t\ttry {\n\t\t\tagreement = await this._policyAdministrationPointComponent.getAgreement(agreementId);\n\t\t} catch (error) {\n\t\t\tif (BaseError.isErrorName(error, NotFoundError.CLASS_NAME)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementLookupFailed\",\n\t\t\t\t{ agreementId },\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\n\t\treturn agreement;\n\t}\n\n\t/**\n\t * Extract dataset ID from Agreement target.\n\t * @param agreement Agreement.\n\t * @returns Dataset ID.\n\t * @internal\n\t */\n\tprivate extractDatasetId(agreement: IDataspaceProtocolAgreement): string {\n\t\tif (Is.empty(agreement.target)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"agreementMissingTarget\", {\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement)\n\t\t\t});\n\t\t}\n\n\t\tconst targetIds = OdrlPolicyHelper.getTargets(agreement);\n\n\t\tif (targetIds.length === 0) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"agreementTargetMissingUid\", {\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement)\n\t\t\t});\n\t\t}\n\n\t\t// Validate single target, multiple targets are not currently supported\n\t\tif (targetIds.length > 1) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementMultipleTargetsNotSupported\",\n\t\t\t\t{\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\t\ttargetCount: targetIds.length\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\treturn targetIds[0];\n\t}\n\n\t/**\n\t * Validate that the dataset exists in the Federated Catalogue.\n\t * @param datasetId Dataset identifier extracted from Agreement.\n\t * @param agreement The Agreement being validated.\n\t * @internal\n\t */\n\tprivate async validateCatalogDataset(\n\t\tdatasetId: string,\n\t\tagreement: IDataspaceProtocolAgreement\n\t): Promise<void> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(datasetId), datasetId);\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\n\t\t// Lookup dataset in catalog\n\t\tconst catalogResult = await this._federatedCatalogueComponent.get(datasetId);\n\n\t\tif (isCatalogError(catalogResult)) {\n\t\t\tif (isCatalogErrorName(catalogResult, NotFoundError.CLASS_NAME)) {\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"datasetNotInCatalog\",\n\t\t\t\t\tdatasetId,\n\t\t\t\t\t{\n\t\t\t\t\t\tdatasetId,\n\t\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement)\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"catalogLookupFailed\", {\n\t\t\t\tdatasetId,\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\",\n\t\t\t\terrorCode: catalogResult.code\n\t\t\t});\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"catalogDatasetFound\",\n\t\t\tdata: {\n\t\t\t\tdatasetId,\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\",\n\t\t\t\tdatasetTitle: catalogResult[\"dcterms:title\"]\n\t\t\t}\n\t\t});\n\n\t\tawait this.validateAgreementMatchesOffer(agreement, catalogResult);\n\t}\n\n\t/**\n\t * Extract PID from DSP message and lookup Transfer Process with role detection.\n\t * @param message DSP protocol message with consumerPid and/or providerPid fields.\n\t * @returns Transfer Process entity and our role in this transfer.\n\t * @internal\n\t */\n\tprivate async lookupTransferByMessage(message: {\n\t\tconsumerPid?: string;\n\t\tproviderPid?: string;\n\t}): Promise<{\n\t\tentity: ITransferProcess;\n\t\trole: TransferProcessRole;\n\t}> {\n\t\tconst pid = message.consumerPid ?? message.providerPid;\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, \"pid\", pid);\n\n\t\treturn this.lookupTransferByPid(pid);\n\t}\n\n\t/**\n\t * Lookup Transfer Process by PID and determine our role.\n\t * @param pid Either consumerPid or providerPid.\n\t * @returns Transfer Process entity and our role in this transfer.\n\t * @internal\n\t */\n\tprivate async lookupTransferByPid(pid: string): Promise<{\n\t\tentity: ITransferProcess;\n\t\trole: TransferProcessRole;\n\t}> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(pid), pid);\n\n\t\t// Check if pid is a consumerPid (primary key lookup)\n\t\tconst storageEntity = await this._transferProcessStorage.get(pid);\n\n\t\tif (storageEntity) {\n\t\t\treturn {\n\t\t\t\tentity: this.storageEntityToModel(storageEntity),\n\t\t\t\trole: TransferProcessRole.Consumer\n\t\t\t};\n\t\t}\n\n\t\t// Check if pid is a providerPid (secondary key lookup)\n\t\tconst providerPidEntity = await this._transferProcessStorage.get(pid, \"providerPid\");\n\t\tif (providerPidEntity) {\n\t\t\treturn {\n\t\t\t\tentity: this.storageEntityToModel(providerPidEntity),\n\t\t\t\trole: TransferProcessRole.Provider\n\t\t\t};\n\t\t}\n\n\t\tthrow new NotFoundError(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\"transferProcessNotFound\",\n\t\t\tpid,\n\t\t\t{\n\t\t\t\tpid\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Get raw policy entries from a catalog dataset.\n\t * @param catalogDataset Catalog dataset.\n\t * @returns Raw policy entries.\n\t * @internal\n\t */\n\tprivate getCatalogDatasetPolicies(\n\t\tcatalogDataset: IDcatDataset | IDataspaceProtocolDataset\n\t): JsonLdObjectWithNoContext<IDataspaceProtocolPolicy>[] {\n\t\t// Support both \"odrl:hasPolicy\" and \"hasPolicy\" to accommodate different catalog implementations\n\t\tif (Is.object<IDcatDataset>(catalogDataset) && !Is.empty(catalogDataset[\"odrl:hasPolicy\"])) {\n\t\t\tconst items = ArrayHelper.fromObjectOrArray(catalogDataset[\"odrl:hasPolicy\"]) ?? [];\n\t\t\treturn items.map(item => ({\n\t\t\t\t...item,\n\t\t\t\t\"@id\": OdrlPolicyHelper.getUid(item) ?? \"\"\n\t\t\t}));\n\t\t}\n\n\t\tif (\n\t\t\tIs.object<IDataspaceProtocolDataset>(catalogDataset) &&\n\t\t\t!Is.empty(catalogDataset.hasPolicy)\n\t\t) {\n\t\t\treturn ArrayHelper.fromObjectOrArray(catalogDataset.hasPolicy) ?? [];\n\t\t}\n\n\t\treturn [];\n\t}\n\n\t/**\n\t * Validate that the Agreement policies match at least one Catalog Offer.\n\t * @param agreement Agreement to validate.\n\t * @param catalogDataset Catalog dataset containing Offers.\n\t * @internal\n\t */\n\tprivate async validateAgreementMatchesOffer(\n\t\tagreement: IDataspaceProtocolAgreement,\n\t\tcatalogDataset: IDcatDataset\n\t): Promise<void> {\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\t\tGuards.object<IDcatDataset>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(catalogDataset),\n\t\t\tcatalogDataset\n\t\t);\n\n\t\tconst rawOffers = this.getCatalogDatasetPolicies(catalogDataset);\n\n\t\tif (!Is.arrayValue(rawOffers)) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"catalogDatasetHasNoOffers\",\n\t\t\t\tdata: {\n\t\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\",\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\"\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst catalogOffers = rawOffers.filter(offer => Is.object<IDataspaceProtocolPolicy>(offer));\n\n\t\tif (!Is.arrayValue(catalogOffers)) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"catalogDatasetHasNoOffers\",\n\t\t\t\tdata: {\n\t\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\",\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\"\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst matchingOffer = catalogOffers.find(\n\t\t\t(offer: IDataspaceProtocolPolicy) =>\n\t\t\t\tOdrlPolicyHelper.getUid(offer) === OdrlPolicyHelper.getUid(agreement) ||\n\t\t\t\tthis.isPolicyDerivedFrom(agreement, offer)\n\t\t);\n\n\t\tif (!matchingOffer) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"agreementNotMatchingOffer\", {\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\",\n\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\",\n\t\t\t\tavailableOffers: catalogOffers\n\t\t\t\t\t.map((o: IDataspaceProtocolPolicy) => OdrlPolicyHelper.getUid(o) ?? \"unknown\")\n\t\t\t\t\t.join(\", \")\n\t\t\t});\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"agreementMatchedOffer\",\n\t\t\tdata: {\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\",\n\t\t\t\tofferId: OdrlPolicyHelper.getUid(matchingOffer) ?? \"\",\n\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\"\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Check if an Agreement is derived from an Offer.\n\t * @param agreement Agreement to check.\n\t * @param offer Offer to compare against.\n\t * @returns True if Agreement appears derived from Offer.\n\t * @internal\n\t */\n\tprivate isPolicyDerivedFrom(\n\t\tagreement: IDataspaceProtocolAgreement,\n\t\toffer: IDataspaceProtocolPolicy\n\t): boolean {\n\t\tconst agreementTargets = OdrlPolicyHelper.getTargets(agreement);\n\t\tconst offerTargets = OdrlPolicyHelper.getTargets(offer);\n\n\t\tif (\n\t\t\tagreementTargets.length === 0 ||\n\t\t\tofferTargets.length === 0 ||\n\t\t\t!agreementTargets.some((agreementTarget: string) => offerTargets.includes(agreementTarget))\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst agreementAssignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst offerAssignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(offer);\n\n\t\tconst agreementAssigner = ArrayHelper.fromObjectOrArray(agreementAssignerIdentity);\n\t\tconst offerAssigner = ArrayHelper.fromObjectOrArray(offerAssignerIdentity);\n\n\t\tif (!agreementAssigner.some(assigner => offerAssigner.includes(assigner))) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!Is.array(agreement.permission) || !Is.array(offer.permission)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Ensure the dataset has a publisher set.\n\t * @param dataset The dataset.\n\t * @returns The dataset with publisher set.\n\t * @internal\n\t */\n\tprivate async ensurePublisher(\n\t\tdataset: IDataspaceProtocolDataset\n\t): Promise<IDataspaceProtocolDataset> {\n\t\tif (dataset[\"dcterms:publisher\"]) {\n\t\t\treturn dataset;\n\t\t}\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst orgId = contextIds?.[ContextIdKeys.Organization];\n\n\t\tif (orgId) {\n\t\t\treturn {\n\t\t\t\t...dataset,\n\t\t\t\t\"dcterms:publisher\": orgId\n\t\t\t};\n\t\t}\n\n\t\treturn dataset;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"INegotiationState.js","sourceRoot":"","sources":["../../../src/models/INegotiationState.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"INegotiationState.js","sourceRoot":"","sources":["../../../src/models/INegotiationState.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tDataspaceProtocolContractNegotiationStateType,\n\tIDataspaceProtocolAgreement\n} from \"@twin.org/standards-dataspace-protocol\";\n\n/**\n * Negotiation state tracked internally for callback routing.\n */\nexport interface INegotiationState {\n\t/**\n\t * The negotiation ID (self-reference for lookup).\n\t */\n\tnegotiationId: string;\n\n\t/**\n\t * Current negotiation state.\n\t */\n\tstate: DataspaceProtocolContractNegotiationStateType;\n\n\t/**\n\t * Agreement received from provider (stored until finalized).\n\t */\n\tagreement?: IDataspaceProtocolAgreement;\n\n\t/**\n\t * Timestamp when negotiation started.\n\t */\n\tstartedAt: number;\n\n\t/**\n\t * Timestamp when negotiation state was last updated.\n\t */\n\tupdatedAt: number;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { INegotiationCallback } from "@twin.org/dataspace-models";
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
2
|
+
import { type IPolicyRequester } from "@twin.org/rights-management-models";
|
|
3
|
+
import { type IDataspaceProtocolAgreement, type IDataspaceProtocolOffer } from "@twin.org/standards-dataspace-protocol";
|
|
4
4
|
import type { INegotiationState } from "./models/INegotiationState.js";
|
|
5
5
|
/**
|
|
6
6
|
* Policy Requester for Dataspace Control Plane.
|
|
@@ -54,7 +54,7 @@ export declare class DataspaceControlPlanePolicyRequester implements IPolicyRequ
|
|
|
54
54
|
* @param offer The offer sent by the provider.
|
|
55
55
|
* @returns True if the offer was accepted, false otherwise.
|
|
56
56
|
*/
|
|
57
|
-
offer(negotiationId: string, offer:
|
|
57
|
+
offer(negotiationId: string, offer: IDataspaceProtocolOffer): Promise<boolean>;
|
|
58
58
|
/**
|
|
59
59
|
* A policy agreement has been sent by a provider.
|
|
60
60
|
* Called by PNP when provider sends an AgreementMessage.
|
|
@@ -62,7 +62,7 @@ export declare class DataspaceControlPlanePolicyRequester implements IPolicyRequ
|
|
|
62
62
|
* @param agreement The agreement sent by the provider.
|
|
63
63
|
* @returns True if the agreement was accepted, false otherwise.
|
|
64
64
|
*/
|
|
65
|
-
agreement(negotiationId: string, agreement:
|
|
65
|
+
agreement(negotiationId: string, agreement: IDataspaceProtocolAgreement): Promise<boolean>;
|
|
66
66
|
/**
|
|
67
67
|
* A policy finalisation has been sent by a provider.
|
|
68
68
|
* Called by PNP when provider sends a FinalizedEvent.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { DataspaceProtocolContractNegotiationStateType } from "@twin.org/standards-dataspace-protocol";
|
|
2
|
-
import type { IOdrlAgreement } from "@twin.org/standards-w3c-odrl";
|
|
1
|
+
import type { DataspaceProtocolContractNegotiationStateType, IDataspaceProtocolAgreement } from "@twin.org/standards-dataspace-protocol";
|
|
3
2
|
/**
|
|
4
3
|
* Negotiation state tracked internally for callback routing.
|
|
5
4
|
*/
|
|
@@ -15,7 +14,7 @@ export interface INegotiationState {
|
|
|
15
14
|
/**
|
|
16
15
|
* Agreement received from provider (stored until finalized).
|
|
17
16
|
*/
|
|
18
|
-
agreement?:
|
|
17
|
+
agreement?: IDataspaceProtocolAgreement;
|
|
19
18
|
/**
|
|
20
19
|
* Timestamp when negotiation started.
|
|
21
20
|
*/
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.17](https://github.com/twinfoundation/dataspace/compare/dataspace-control-plane-service-v0.0.3-next.16...dataspace-control-plane-service-v0.0.3-next.17) (2026-03-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* docs update ([8b44c7a](https://github.com/twinfoundation/dataspace/commit/8b44c7a75afb8d377a6f606616f8a78d58439ab4))
|
|
9
|
+
* types update ([77c338e](https://github.com/twinfoundation/dataspace/commit/77c338e9244dcc7e3d597fdb06229513b1f13eac))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* avoid compaction of incoming activities ([#77](https://github.com/twinfoundation/dataspace/issues/77)) ([ff43d6a](https://github.com/twinfoundation/dataspace/commit/ff43d6a3e1563eb9cb185501134b2a53ae88787c))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Dependencies
|
|
18
|
+
|
|
19
|
+
* The following workspace dependencies were updated
|
|
20
|
+
* dependencies
|
|
21
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.16 to 0.0.3-next.17
|
|
22
|
+
|
|
3
23
|
## [0.0.3-next.16](https://github.com/twinfoundation/dataspace/compare/dataspace-control-plane-service-v0.0.3-next.15...dataspace-control-plane-service-v0.0.3-next.16) (2026-03-02)
|
|
4
24
|
|
|
5
25
|
|
|
@@ -142,7 +142,7 @@ The id of the negotiation.
|
|
|
142
142
|
|
|
143
143
|
##### offer
|
|
144
144
|
|
|
145
|
-
`
|
|
145
|
+
`IDataspaceProtocolOffer`
|
|
146
146
|
|
|
147
147
|
The offer sent by the provider.
|
|
148
148
|
|
|
@@ -175,7 +175,7 @@ The id of the negotiation.
|
|
|
175
175
|
|
|
176
176
|
##### agreement
|
|
177
177
|
|
|
178
|
-
`
|
|
178
|
+
`IDataspaceProtocolAgreement`
|
|
179
179
|
|
|
180
180
|
The agreement sent by the provider.
|
|
181
181
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/dataspace-control-plane-service",
|
|
3
|
-
"version": "0.0.3-next.
|
|
3
|
+
"version": "0.0.3-next.17",
|
|
4
4
|
"description": "Dataspace Control Plane service implementation for Eclipse Dataspace Protocol Transfer Process Protocol",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@twin.org/api-models": "next",
|
|
18
18
|
"@twin.org/context": "next",
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
|
-
"@twin.org/dataspace-models": "0.0.3-next.
|
|
20
|
+
"@twin.org/dataspace-models": "0.0.3-next.17",
|
|
21
21
|
"@twin.org/entity": "next",
|
|
22
22
|
"@twin.org/entity-storage-models": "next",
|
|
23
23
|
"@twin.org/federated-catalogue-models": "next",
|