@twin.org/dataspace-control-plane-service 0.9.1-next.11 → 0.9.1-next.12
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.
|
@@ -445,13 +445,14 @@ export class DataspaceControlPlaneService {
|
|
|
445
445
|
* @param trustPayload Trust payload for authenticating this call.
|
|
446
446
|
* @returns The consumerPid of the newly created TransferProcess.
|
|
447
447
|
*
|
|
448
|
-
* **Engine configuration requirement
|
|
448
|
+
* **Engine configuration requirement (remote transfers only):** when `providerEndpoint` is a
|
|
449
|
+
* remote origin the outbound call uses
|
|
449
450
|
* `ComponentFactory.create(remoteControlPlaneComponentType, { endpoint, pathPrefix })`.
|
|
450
451
|
* For the runtime `providerEndpoint` to be forwarded correctly, the engine **must** register
|
|
451
452
|
* the component type (default: `dataspace-control-plane-rest-client`) as a
|
|
452
453
|
* **multi-instance** component (`isMultiInstance: true` in engine config). A singleton
|
|
453
454
|
* registration ignores the runtime `endpoint` arg and silently POSTs to its
|
|
454
|
-
* static endpoint instead.
|
|
455
|
+
* static endpoint instead. Local-origin (same-node) transfers run in-process and are unaffected.
|
|
455
456
|
*/
|
|
456
457
|
async prepareTransfer(agreementId, providerEndpoint, format, trustPayload) {
|
|
457
458
|
Guards.stringValue(DataspaceControlPlaneService.CLASS_NAME, "agreementId", agreementId);
|
|
@@ -514,9 +515,10 @@ export class DataspaceControlPlaneService {
|
|
|
514
515
|
});
|
|
515
516
|
// Generate outbound trust token to authenticate this node to the provider.
|
|
516
517
|
const outboundToken = await this._trustComponent.generate(organizationIdentity, this._overrideTrustGeneratorType, { subject: { consumerPid, agreementId } });
|
|
517
|
-
//
|
|
518
|
-
|
|
519
|
-
|
|
518
|
+
// Call the provider's requestTransfer. When providerEndpoint resolves to a local origin this
|
|
519
|
+
// runs in-process (no loopback HTTP, no multi-instance client required); otherwise it uses a
|
|
520
|
+
// remote REST client. Mirrors how state-change deliveries route via withControlPlaneComponent.
|
|
521
|
+
const result = await this.withControlPlaneComponent(providerEndpoint, async (component) => component.requestTransfer(transferRequestMessage, outboundToken));
|
|
520
522
|
if (getJsonLdType(result) === DataspaceProtocolTransferProcessTypes.TransferError) {
|
|
521
523
|
const transferError = result;
|
|
522
524
|
throw new GeneralError(DataspaceControlPlaneService.CLASS_NAME, "transferRequestRejectedByProvider", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataspaceControlPlaneService.js","sourceRoot":"","sources":["../../src/dataspaceControlPlaneService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAA2B,MAAM,sBAAsB,CAAC;AAEjG,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EACN,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,MAAM,EACN,EAAE,EACF,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,GAAG,EACH,GAAG,EACH,eAAe,EACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,YAAY,EAGZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,8BAA8B,EAC9B,4BAA4B,EAC5B,uBAAuB,EACvB,mBAAmB,EACnB,WAAW,EACX,aAAa,EAWb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EACN,6BAA6B,EAE7B,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EACN,gBAAgB,EAChB,sBAAsB,EAMtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,yBAAyB,EACzB,yCAAyC,EACzC,uBAAuB,EACvB,yCAAyC,EACzC,qCAAqC,EACrC,mCAAmC,EAanC,MAA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,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE;iBACvE,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;QAED,OAAO,EAAE,WAAW,EAAE,CAAC;IACxB,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { HttpContextIdKeys, HttpUrlHelper, type IPlatformComponent } from \"@twin.org/api-models\";\nimport type { ITaskSchedulerComponent } from \"@twin.org/background-task-models\";\nimport { ContextIdHelper, ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport {\n\tAlreadyExistsError,\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\tUrl,\n\tUrn,\n\tValidationError\n} from \"@twin.org/core\";\nimport {\n\tJsonLdHelper,\n\ttype JsonLdObjectWithOptionalAtId,\n\ttype JsonLdObjectWithNoContext\n} from \"@twin.org/data-json-ld\";\nimport {\n\tDataspaceControlPlaneMetricIds,\n\tDataspaceControlPlaneMetrics,\n\tDataspaceTransferFormat,\n\tTransferProcessRole,\n\tgetJsonLdId,\n\tgetJsonLdType,\n\ttype DataspaceAppDataset,\n\ttype IDataspaceAppDataset,\n\ttype IDataspaceControlPlaneComponent,\n\ttype IDataspaceControlPlaneResolverComponent,\n\ttype IDataspaceDataPlaneComponent,\n\ttype INegotiationCallback,\n\ttype ITransferCallback,\n\ttype ITransferContext,\n\ttype ITransferProcess,\n\ttype TransferProcess\n} from \"@twin.org/dataspace-models\";\nimport { EngineCoreFactory } from \"@twin.org/engine-models\";\nimport { ComparisonOperator } from \"@twin.org/entity\";\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\ttype IRightsManagementAgreement,\n\ttype IRightsManagementPolicy\n} from \"@twin.org/rights-management-models\";\nimport {\n\tDataspaceProtocolContexts,\n\tDataspaceProtocolContractNegotiationTypes,\n\tDataspaceProtocolHelper,\n\tDataspaceProtocolTransferProcessStateType,\n\tDataspaceProtocolTransferProcessTypes,\n\tDataspaceProtocolVersionBindingType,\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\ttype IDataspaceProtocolVersionResponse\n} from \"@twin.org/standards-dataspace-protocol\";\nimport type { IDcatDataset } from \"@twin.org/standards-w3c-dcat\";\nimport { OdrlActionType, OdrlContexts, OdrlPolicyType } from \"@twin.org/standards-w3c-odrl\";\nimport { MetricHelper, type ITelemetryComponent } from \"@twin.org/telemetry-models\";\nimport { TrustHelper, type ITrustComponent } from \"@twin.org/trust-models\";\nimport { DataspaceControlPlanePolicyRequester } from \"./dataspaceControlPlanePolicyRequester.js\";\nimport { TransferHandlerFactory } from \"./factories/transferHandlerFactory.js\";\nimport { HttpDataPostTransferHandler } from \"./handlers/httpDataPostTransferHandler.js\";\nimport { HttpDataPullTransferHandler } from \"./handlers/httpDataPullTransferHandler.js\";\nimport { HttpDataPushTransferHandler } from \"./handlers/httpDataPushTransferHandler.js\";\nimport type { IDataspaceControlPlaneServiceConstructorOptions } from \"./models/IDataspaceControlPlaneServiceConstructorOptions.js\";\nimport {\n\tisCatalogError,\n\tisCatalogErrorName,\n\ttransformToTransferError\n} from \"./utils/transferErrorUtils.js\";\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 * Stalled negotiation threshold in milliseconds (30 minutes).\n\t * Negotiations that haven't received a state update within this time are considered stalled.\n\t * @internal\n\t */\n\tprivate static readonly _STALLED_NEGOTIATION_THRESHOLD_MS = 30 * 60 * 1000;\n\n\t/**\n\t * Stalled transfer threshold in milliseconds (30 minutes).\n\t * Consumer-initiated transfers left in REQUESTED beyond this time are considered timed out.\n\t * @internal\n\t */\n\tprivate static readonly _STALLED_TRANSFER_THRESHOLD_MS = 30 * 60 * 1000;\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\t * @internal\n\t */\n\tprivate readonly _policyNegotiationPointComponent: IPolicyNegotiationPointComponent;\n\n\t/**\n\t * Policy Negotiation Admin Point component for negotiation history.\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 * Entity storage for Dataspace App Dataset entities.\n\t * @internal\n\t */\n\tprivate readonly _dataspaceAppDatasetStorage: IEntityStorageConnector<DataspaceAppDataset>;\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.\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 * Control plane callback mount path (path only, not full URL). Combined with this node's public\n\t * origin to form the consumer callbackAddress the provider POSTs DSP transfer messages back to.\n\t * @internal\n\t */\n\tprivate readonly _callbackPath?: string;\n\n\t/**\n\t * Data plane component.\n\t * @internal\n\t */\n\tprivate readonly _dataPlaneComponent: IDataspaceDataPlaneComponent;\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 * Platform component.\n\t * @internal\n\t */\n\tprivate readonly _platformComponent: IPlatformComponent;\n\n\t/**\n\t * The optional telemetry component for metrics.\n\t * @internal\n\t */\n\tprivate readonly _telemetryComponent?: ITelemetryComponent;\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 * Registered transfer callbacks from upstream callers, keyed by registration key.\n\t * @internal\n\t */\n\tprivate readonly _transferCallbacks: Map<string, ITransferCallback>;\n\n\t/**\n\t * Internal transfer callback that fans out to all registered transfer callbacks.\n\t * @internal\n\t */\n\tprivate readonly _internalTransferCallback: ITransferCallback;\n\n\t/**\n\t * Factory key used to create remote control plane REST client instances for outbound\n\t * DSP transfer requests. Resolved via ComponentFactory.create() at call time.\n\t * @internal\n\t */\n\tprivate readonly _remoteControlPlaneComponentType: string;\n\n\t/**\n\t * Whether the provider auto-starts a transfer once requested (provider-side decision, never the consumer's).\n\t * @internal\n\t */\n\tprivate readonly _autoStartTransfers: boolean;\n\n\t/**\n\t * How long (ms) a negotiation may sit without progress before the periodic cleanup times it out.\n\t * @internal\n\t */\n\tprivate readonly _stalledNegotiationTimeoutMs: number;\n\n\t/**\n\t * How long (ms) a consumer-initiated transfer may sit in REQUESTED before the periodic cleanup times it out.\n\t * @internal\n\t */\n\tprivate readonly _stalledTransferTimeoutMs: number;\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\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 for negotiation history\n\t\tthis._policyNegotiationAdminPointComponent =\n\t\t\tComponentFactory.get<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._dataspaceAppDatasetStorage = EntityStorageConnectorFactory.get<\n\t\t\tIEntityStorageConnector<DataspaceAppDataset>\n\t\t>(options?.dataspaceAppDatasetEntityStorageType ?? nameofKebabCase<DataspaceAppDataset>());\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.trimLeadingAndTrailingSlashes(options.config.dataPlanePath)\n\t\t\t: undefined;\n\n\t\tthis._callbackPath = Is.stringValue(options?.config?.callbackPath)\n\t\t\t? StringHelper.trimLeadingAndTrailingSlashes(options.config.callbackPath)\n\t\t\t: \"dataspace-control-plane\";\n\n\t\tthis._autoStartTransfers = options?.config?.autoStartTransfers ?? false;\n\n\t\tthis._stalledNegotiationTimeoutMs =\n\t\t\toptions?.config?.stalledNegotiationTimeoutMs ??\n\t\t\tDataspaceControlPlaneService._STALLED_NEGOTIATION_THRESHOLD_MS;\n\n\t\tthis._stalledTransferTimeoutMs =\n\t\t\toptions?.config?.stalledTransferTimeoutMs ??\n\t\t\tDataspaceControlPlaneService._STALLED_TRANSFER_THRESHOLD_MS;\n\n\t\tthis._taskScheduler = ComponentFactory.getIfExists<ITaskSchedulerComponent>(\n\t\t\toptions?.taskSchedulerComponentType ?? \"task-scheduler\"\n\t\t);\n\n\t\tthis._platformComponent = ComponentFactory.get<IPlatformComponent>(\n\t\t\toptions?.platformComponentType ?? \"platform\"\n\t\t);\n\n\t\tthis._telemetryComponent = ComponentFactory.getIfExists<ITelemetryComponent>(\n\t\t\toptions?.telemetryComponentType\n\t\t);\n\n\t\tthis._dataPlaneComponent = ComponentFactory.get<IDataspaceDataPlaneComponent>(\n\t\t\toptions?.dataPlaneComponentType ?? \"dataspace-data-plane-service\"\n\t\t);\n\n\t\tthis._negotiationCallbacks = new Map();\n\t\tthis._transferCallbacks = new Map();\n\t\tthis._internalTransferCallback = this.createInternalTransferCallback();\n\t\tthis._remoteControlPlaneComponentType =\n\t\t\toptions?.remoteControlPlaneComponentType ?? \"dataspace-control-plane-rest-client\";\n\n\t\tconst internalCallback = this.createInternalCallback();\n\n\t\tthis._policyRequester = new DataspaceControlPlanePolicyRequester(\n\t\t\toptions?.loggingComponentType,\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\n\t\tTransferHandlerFactory.register(\n\t\t\tDataspaceTransferFormat.HttpDataPull,\n\t\t\t() => new HttpDataPullTransferHandler()\n\t\t);\n\t\tTransferHandlerFactory.register(\n\t\t\tDataspaceTransferFormat.HttpDataPush,\n\t\t\t() => new HttpDataPushTransferHandler()\n\t\t);\n\t\tTransferHandlerFactory.register(\n\t\t\tDataspaceTransferFormat.HttpDataPost,\n\t\t\t() => new HttpDataPostTransferHandler()\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 * Register a callback to receive transfer process state change notifications.\n\t * @param key A unique key identifying this callback registration.\n\t * @param callback The callback interface to register.\n\t */\n\tpublic registerTransferCallback(key: string, callback: ITransferCallback): void {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(key), key);\n\t\tGuards.object(DataspaceControlPlaneService.CLASS_NAME, nameof(callback), callback);\n\t\tthis._transferCallbacks.set(key, callback);\n\t}\n\n\t/**\n\t * Unregister a previously registered transfer callback.\n\t * @param key The key used when registering the callback.\n\t */\n\tpublic unregisterTransferCallback(key: string): void {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(key), key);\n\t\tthis._transferCallbacks.delete(key);\n\t}\n\n\t/**\n\t * The service needs to be started when the application is initialized.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t * @returns A promise that resolves when the federated catalogue is populated and the cleanup task is scheduled.\n\t */\n\tpublic async start(nodeLoggingComponentType?: string): Promise<void> {\n\t\tawait MetricHelper.createMetrics(this._telemetryComponent, DataspaceControlPlaneMetrics);\n\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\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\n\t\t\tawait this._taskScheduler.addTask(\n\t\t\t\t\"control-plane-transfer-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.cleanupStalledTransfers();\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 * @returns A promise that resolves when the cleanup task has been removed.\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\tawait this._taskScheduler.removeTask(\"control-plane-transfer-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. Whether it auto-starts is a provider-side\n\t * decision (the `autoStartTransfers` service config), never something the consumer can request.\n\t * @param request Transfer request message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information.\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\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"requestTransfer\"\n\t\t);\n\n\t\tconst validationFailures = await DataspaceProtocolHelper.validate(\n\t\t\tJsonLdHelper.toNodeObject(request)\n\t\t);\n\n\t\tif (Is.arrayValue(validationFailures)) {\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\treturn transformToTransferError(\n\t\t\t\tnew ValidationError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tnameof(request),\n\t\t\t\t\tvalidationFailures\n\t\t\t\t),\n\t\t\t\trequest\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: string;\n\t\tlet providerIdentity: string;\n\t\tlet policies: IRightsManagementPolicy[];\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\tnotFoundId: request.agreementId\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);\n\t\t\t}\n\n\t\t\tconst assigneeIdentity = OdrlPolicyHelper.extractAssigneeIdentity(agreement);\n\t\t\tconst assigneeIds = ArrayHelper.fromObjectOrArray<string>(assigneeIdentity);\n\n\t\t\t// The agreement's assignee is stamped by the provider as the consumer's organization identity.\n\t\t\tif (!assigneeIds.includes(trustInfo.identity)) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"callerNotAuthorizedForAgreement\"\n\t\t\t\t);\n\t\t\t}\n\t\t\tconsumerIdentity = trustInfo.identity;\n\n\t\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\t\tconst assignerIds = ArrayHelper.fromObjectOrArray<string>(assignerIdentity);\n\t\t\tif (assignerIds.length > 1) {\n\t\t\t\tthrow new GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"multipleAssignersNotSupported\"\n\t\t\t\t);\n\t\t\t}\n\t\t\tproviderIdentity = assignerIds[0];\n\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\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\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,\n\t\t\tproviderIdentity,\n\t\t\tlocalRole: TransferProcessRole.Provider,\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\torganizationIdentity,\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\t// Auto-start is a provider-side decision (the autoStartTransfers config), never the consumer's.\n\t\t// When the provider opts in, schedule the provider start asynchronously (mirrors negotiation's\n\t\t// setTimeout follow-up). The timer runs inside the request's ALS context, so the [Node, Tenant] + org\n\t\t// partition propagates to the deferred start.\n\t\tif (this._autoStartTransfers) {\n\t\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\t\tconst consumerPid = request.consumerPid;\n\t\t\tsetTimeout(async () => {\n\t\t\t\t// runProviderStart catches internally and can't reject; awaiting satisfies no-floating-promises.\n\t\t\t\tawait this.runProviderStart(consumerPid, contextIds?.[HttpContextIdKeys.PublicOrigin]);\n\t\t\t}, 0);\n\t\t}\n\n\t\tawait MetricHelper.metricIncrement(\n\t\t\tthis._telemetryComponent,\n\t\t\tDataspaceControlPlaneMetricIds.TransfersRequested\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 * Prepare a data transfer as a Consumer.\n\t * Generates a consumerPid, POSTs a TransferRequestMessage to the provider's DSP endpoint,\n\t * and (only if the provider accepts) persists a local TransferProcess in REQUESTED state.\n\t * @param agreementId The finalized agreement ID from contract negotiation.\n\t * @param providerEndpoint The provider's DSP control plane base URL.\n\t * @param format The transfer format (e.g. \"HttpData-PULL\", \"HttpData-PUSH\").\n\t * @param trustPayload Trust payload for authenticating this call.\n\t * @returns The consumerPid of the newly created TransferProcess.\n\t *\n\t * **Engine configuration requirement:** The outbound call to the provider uses\n\t * `ComponentFactory.create(remoteControlPlaneComponentType, { endpoint, pathPrefix })`.\n\t * For the runtime `providerEndpoint` to be forwarded correctly, the engine **must** register\n\t * the component type (default: `dataspace-control-plane-rest-client`) as a\n\t * **multi-instance** component (`isMultiInstance: true` in engine config). A singleton\n\t * registration ignores the runtime `endpoint` arg and silently POSTs to its\n\t * static endpoint instead.\n\t */\n\tpublic async prepareTransfer(\n\t\tagreementId: string,\n\t\tproviderEndpoint: string,\n\t\tformat: string,\n\t\ttrustPayload: unknown\n\t): Promise<{ consumerPid: string }> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(agreementId), agreementId);\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(format), format);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tContextIdHelper.guard(contextIds, HttpContextIdKeys.PublicOrigin);\n\t\tconst publicOrigin = contextIds[HttpContextIdKeys.PublicOrigin];\n\n\t\tif (!(Object.values(DataspaceTransferFormat) as string[]).includes(format)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"unsupportedTransferFormat\", {\n\t\t\t\tformat,\n\t\t\t\tsupported: Object.values(DataspaceTransferFormat)\n\t\t\t});\n\t\t}\n\n\t\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"prepareTransfer\"\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: \"preparingTransfer\",\n\t\t\tdata: { agreementId, providerEndpoint, format, identity: trustInfo.identity }\n\t\t});\n\n\t\tconst agreement = await this.lookupAgreement(agreementId);\n\n\t\tconst assigneeIdentity = OdrlPolicyHelper.extractAssigneeIdentity(agreement);\n\t\tconst assigneeIds = ArrayHelper.fromObjectOrArray<string>(assigneeIdentity);\n\t\tif (!assigneeIds.includes(trustInfo.identity)) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"callerNotAuthorizedForAgreement\"\n\t\t\t);\n\t\t}\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerIds = ArrayHelper.fromObjectOrArray<string>(assignerIdentity);\n\t\tif (assignerIds.length > 1) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"multipleAssignersNotSupported\"\n\t\t\t);\n\t\t}\n\t\tconst providerIdentity = assignerIds[0];\n\n\t\tconst datasetId = this.extractDatasetId(agreement);\n\n\t\tconst consumerPid = `urn:uuid:${RandomHelper.generateUuidV7()}`;\n\t\tconst origin = StringHelper.trimTrailingSlashes(publicOrigin);\n\n\t\t// Fetch context once and reuse across the callback, PUSH dataAddress, trust token, and storage.\n\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\n\t\t// Callback the provider POSTs DSP messages back to: mount path + `?organization=` so the inbound\n\t\t// POST routes to the right consumer tenant (mirrors buildCallbackUrl). The bare `origin` is kept for\n\t\t// the PUSH-inbox base below (a different mount).\n\t\tconst callbackAddress = HttpUrlHelper.addQueryStringParam(\n\t\t\tIs.stringValue(this._callbackPath) ? `${origin}/${this._callbackPath}` : origin,\n\t\t\tContextIdKeys.Organization,\n\t\t\torganizationIdentity\n\t\t);\n\n\t\tconst transferRequestMessage: IDataspaceProtocolTransferRequestMessage = {\n\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferRequestMessage,\n\t\t\tconsumerPid,\n\t\t\tagreementId,\n\t\t\tcallbackAddress,\n\t\t\tformat\n\t\t};\n\n\t\t// Delegate consumer dataAddress construction to the format-specific handler.\n\t\t// PUSH supplies its /inbox; PULL and POST return undefined (no consumer address needed).\n\t\tconst transferHandler = TransferHandlerFactory.get(format);\n\t\ttransferRequestMessage.dataAddress = transferHandler.buildConsumerDataAddress({\n\t\t\tconsumerPid,\n\t\t\torigin,\n\t\t\tdataPlanePath: this._dataPlanePath,\n\t\t\torganizationIdentity\n\t\t});\n\n\t\t// Generate outbound trust token to authenticate this node to the provider.\n\t\tconst outboundToken = await this._trustComponent.generate(\n\t\t\torganizationIdentity,\n\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t{ subject: { consumerPid, agreementId } }\n\t\t);\n\n\t\t// Create a remote REST client pointed at the provider endpoint and call requestTransfer.\n\t\tconst remoteControlPlane = ComponentFactory.create<IDataspaceControlPlaneComponent>(\n\t\t\tthis._remoteControlPlaneComponentType,\n\t\t\t{ endpoint: providerEndpoint, pathPrefix: \"\" }\n\t\t);\n\n\t\tconst result = await remoteControlPlane.requestTransfer(transferRequestMessage, outboundToken);\n\n\t\tif (getJsonLdType(result) === DataspaceProtocolTransferProcessTypes.TransferError) {\n\t\t\tconst transferError = result as { code?: string };\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"transferRequestRejectedByProvider\",\n\t\t\t\t{\n\t\t\t\t\tagreementId,\n\t\t\t\t\tproviderEndpoint,\n\t\t\t\t\tcode: transferError.code\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst transferProcess = result as { providerPid?: string };\n\n\t\tif (!Is.stringValue(transferProcess.providerPid)) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"providerPidMissingInResponse\",\n\t\t\t\t{ consumerPid }\n\t\t\t);\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,\n\t\t\tproviderPid: transferProcess.providerPid,\n\t\t\tstate: DataspaceProtocolTransferProcessStateType.REQUESTED,\n\t\t\tagreementId,\n\t\t\tdatasetId,\n\t\t\tconsumerIdentity: trustInfo.identity,\n\t\t\tproviderIdentity,\n\t\t\tlocalRole: TransferProcessRole.Consumer,\n\t\t\tofferId: agreementId,\n\t\t\tpolicies: [agreement],\n\t\t\tcallbackAddress,\n\t\t\tformat,\n\t\t\tdataAddress: transferRequestMessage.dataAddress,\n\t\t\torganizationIdentity,\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\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: \"transferPrepared\",\n\t\t\tdata: {\n\t\t\t\tconsumerPid,\n\t\t\t\tproviderPid: storageEntity.providerPid,\n\t\t\t\tagreementId,\n\t\t\t\tformat\n\t\t\t}\n\t\t});\n\n\t\tawait MetricHelper.metricIncrement(\n\t\t\tthis._telemetryComponent,\n\t\t\tDataspaceControlPlaneMetricIds.TransfersPrepared\n\t\t);\n\n\t\treturn { consumerPid };\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 trustPayload Trust payload containing authorization information.\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\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferStartMessage | IDataspaceProtocolTransferError> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tContextIdHelper.guard(contextIds, HttpContextIdKeys.PublicOrigin);\n\t\tconst publicOrigin = contextIds[HttpContextIdKeys.PublicOrigin];\n\n\t\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"startTransfer\"\n\t\t);\n\n\t\tconst validationFailures = await DataspaceProtocolHelper.validate(\n\t\t\tJsonLdHelper.toNodeObject(message)\n\t\t);\n\n\t\tif (Is.arrayValue(validationFailures)) {\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: \"invalidTransferStartMessage\",\n\t\t\t\tdata: { validationFailures }\n\t\t\t});\n\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew ValidationError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tnameof(message),\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 (trustInfo.identity !== entity.providerIdentity) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"callerNotAuthorizedAsProvider\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Only the organization that owns this transfer can mutate it.\n\t\t\tconst callingOrganizationIdentity = await this.resolveContextOrganizationId();\n\t\t\tif (entity.organizationIdentity !== callingOrganizationIdentity) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"transferWrongOrganization\"\n\t\t\t\t);\n\t\t\t}\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\t// CONSUMER-RECEIVE: the provider POSTed a TransferStart to our callback. Use the dataAddress\n\t\t\t// from the message (rebuilding it is provider work), mark our record STARTED, and notify.\n\t\t\tif (role === TransferProcessRole.Consumer) {\n\t\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.STARTED;\n\t\t\t\tentity.dateModified = new Date();\n\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\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: \"transferProcessStarted\",\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\trole\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tawait this._internalTransferCallback.onStateChanged(\n\t\t\t\t\tentity.consumerPid,\n\t\t\t\t\tDataspaceProtocolTransferProcessStateType.STARTED\n\t\t\t\t);\n\t\t\t\tawait this._internalTransferCallback.onStarted(entity.consumerPid, message);\n\n\t\t\t\tawait MetricHelper.metricIncrement(\n\t\t\t\t\tthis._telemetryComponent,\n\t\t\t\t\tDataspaceControlPlaneMetricIds.TransfersStarted\n\t\t\t\t);\n\n\t\t\t\treturn message;\n\t\t\t}\n\n\t\t\t// PROVIDER-ACT (role === Provider): build the dataAddress, transition to STARTED, deliver below.\n\t\t\t// The previous (pre-transition) state drives the push-subscription branch below\n\t\t\t// (setup vs resume). Do NOT mutate entity.state here as the persisted transition\n\t\t\t// to STARTED happens after the dispatch block succeeds, so any validation or\n\t\t\t// token-generation failure leaves the row in its prior state.\n\t\t\tconst previousState = entity.state;\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// Delegate dataAddress construction and post-start actions to the format-specific handler.\n\t\t\t// Push subscription setup reads the entity from storage and requires state=STARTED,\n\t\t\t// so STARTED is persisted before calling onProviderStart. If subscription setup fails,\n\t\t\t// the state is rolled back so the client can retry.\n\t\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\t\t\tconst transferHandler = TransferHandlerFactory.get(this.inferTransferFormat(entity));\n\t\t\tresponse.dataAddress = await transferHandler.buildProviderStartDataAddress({\n\t\t\t\tentity,\n\t\t\t\tpublicOrigin,\n\t\t\t\tdataPlanePath: this._dataPlanePath,\n\t\t\t\torganizationIdentity,\n\t\t\t\ttrustComponent: this._trustComponent,\n\t\t\t\toverrideTrustGeneratorType: this._overrideTrustGeneratorType\n\t\t\t});\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.STARTED;\n\t\t\tentity.dateModified = new Date();\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\ttry {\n\t\t\t\tawait transferHandler.onProviderStart(\n\t\t\t\t\tthis._dataPlaneComponent,\n\t\t\t\t\tentity.consumerPid,\n\t\t\t\t\tpreviousState\n\t\t\t\t);\n\t\t\t} catch (subscriptionError) {\n\t\t\t\tentity.state = previousState;\n\t\t\t\tentity.dateModified = new Date();\n\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\tthrow subscriptionError;\n\t\t\t}\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\t// Notify the consumer by POSTing the TransferStart (with its dataAddress) to the callback.\n\t\t\t// Best-effort: a delivery failure must not roll back the STARTED transition.\n\t\t\tawait this.deliverToConsumerCallback(entity, \"start\", async (remoteControlPlane, token) =>\n\t\t\t\tremoteControlPlane.startTransfer(response, token)\n\t\t\t);\n\n\t\t\tawait MetricHelper.metricIncrement(\n\t\t\t\tthis._telemetryComponent,\n\t\t\t\tDataspaceControlPlaneMetricIds.TransfersStarted\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 * Start a Transfer Process as the Provider.\n\t * Builds a TransferStartMessage for a transfer already accepted by this node (REQUESTED, or\n\t * SUSPENDED to resume), transitions it to STARTED, and POSTs the message to the consumer callback.\n\t * consumerPid/providerPid/callbackAddress are resolved from the stored record; the call is then\n\t * forwarded to startTransfer, the single owner of the start state machine (it verifies the caller is\n\t * the provider, builds the dataAddress for PULL, persists STARTED, and delivers to the consumer).\n\t * This is the provider-side mirror of prepareTransfer.\n\t * @param pid The Process ID (consumerPid or providerPid) identifying the transfer to start.\n\t * @param trustPayload Trust payload proving the caller is the provider.\n\t * @returns Transfer Start Message (DSP compliant) with dataAddress for PULL transfers, or TransferError if the operation fails.\n\t */\n\tpublic async transferStarted(\n\t\tpid: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferStartMessage | IDataspaceProtocolTransferError> {\n\t\tlet consumerPid: string | undefined;\n\t\tlet providerPid: string | undefined;\n\t\ttry {\n\t\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(pid), pid);\n\n\t\t\tconst { entity, role } = await this.lookupTransferByPid(pid);\n\t\t\tconsumerPid = entity.consumerPid;\n\t\t\tproviderPid = entity.providerPid;\n\n\t\t\t// Only the provider initiates a start. startTransfer branches on role, so guard here to give a\n\t\t\t// clear error instead of silently running the consumer-receive path on a consumer-role record.\n\t\t\tif (role !== TransferProcessRole.Provider) {\n\t\t\t\tthrow new GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"transferStartNotProvider\",\n\t\t\t\t\t{\n\t\t\t\t\t\tpid,\n\t\t\t\t\t\trole\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst startMessage: 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// startTransfer verifies trustPayload is the provider, checks org ownership, applies the\n\t\t\t// REQUESTED|SUSPENDED state guard, builds the dataAddress, persists STARTED, and delivers the\n\t\t\t// TransferStartMessage to the consumer callback.\n\t\t\treturn await this.startTransfer(startMessage, trustPayload);\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, { consumerPid, providerPid });\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.\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\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"completeTransfer\"\n\t\t);\n\n\t\tconst validationFailures = await DataspaceProtocolHelper.validate(\n\t\t\tJsonLdHelper.toNodeObject(message)\n\t\t);\n\n\t\tif (Is.arrayValue(validationFailures)) {\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: \"invalidTransferCompletionMessage\",\n\t\t\t\tdata: { validationFailures }\n\t\t\t});\n\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew ValidationError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tnameof(message),\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 (trustInfo.identity !== entity.consumerIdentity) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"callerNotAuthorizedAsConsumer\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Only the organization that owns this transfer can mutate it.\n\t\t\tconst callingOrganizationId = await this.resolveContextOrganizationId();\n\t\t\tif (entity.organizationIdentity !== callingOrganizationId) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"transferWrongOrganization\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// DSP idempotency: re-receiving TransferCompletionMessage for a transfer already\n\t\t\t// in COMPLETED should return the same success response, not invalidStateForComplete.\n\t\t\t// Data-plane teardown already ran on the first attempt.\n\t\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.COMPLETED) {\n\t\t\t\treturn {\n\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\tstate: entity.state\n\t\t\t\t};\n\t\t\t}\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\tconst previousState = entity.state;\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\tconst transferHandler = TransferHandlerFactory.get(this.inferTransferFormat(entity));\n\t\t\ttry {\n\t\t\t\tawait transferHandler.onComplete(this._dataPlaneComponent, entity.consumerPid);\n\t\t\t} catch (teardownError) {\n\t\t\t\t// Symmetric rollback: data-plane teardown failed, revert the transfer state\n\t\t\t\t// so the client can retry. Without this the storage row is COMPLETED but\n\t\t\t\t// the subscription is still flowing, and a retry hits invalidStateForComplete.\n\t\t\t\tentity.state = previousState;\n\t\t\t\tentity.dateModified = new Date();\n\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\tthrow teardownError;\n\t\t\t}\n\n\t\t\t// Completion is consumer-initiated (the auth above accepts only the consumer): a consumer→provider\n\t\t\t// notification, so no provider→consumer delivery here — unlike suspend/terminate (either party).\n\t\t\tif (role === TransferProcessRole.Consumer) {\n\t\t\t\tawait this._internalTransferCallback.onStateChanged(\n\t\t\t\t\tentity.consumerPid,\n\t\t\t\t\tDataspaceProtocolTransferProcessStateType.COMPLETED\n\t\t\t\t);\n\t\t\t\tawait this._internalTransferCallback.onCompleted(entity.consumerPid);\n\t\t\t}\n\n\t\t\tawait MetricHelper.metricIncrement(\n\t\t\t\tthis._telemetryComponent,\n\t\t\t\tDataspaceControlPlaneMetricIds.TransfersCompleted\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.\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\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"suspendTransfer\"\n\t\t);\n\n\t\tconst validationFailures = await DataspaceProtocolHelper.validate(\n\t\t\tJsonLdHelper.toNodeObject(message)\n\t\t);\n\n\t\tif (Is.arrayValue(validationFailures)) {\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: \"invalidTransferSuspensionMessage\",\n\t\t\t\tdata: { validationFailures }\n\t\t\t});\n\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew ValidationError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tnameof(message),\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\ttrustInfo.identity !== entity.consumerIdentity &&\n\t\t\t\ttrustInfo.identity !== entity.providerIdentity\n\t\t\t) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"callerNotAuthorizedForTransfer\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// S2 belt-and-braces: only the organization that owns this transfer can mutate it.\n\t\t\tconst callingOrganizationId = await this.resolveContextOrganizationId();\n\t\t\tif (entity.organizationIdentity !== callingOrganizationId) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"transferWrongOrganization\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// DSP idempotency: re-receiving TransferSuspensionMessage for a transfer already\n\t\t\t// in SUSPENDED should return success. Data-plane suspend already ran.\n\t\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.SUSPENDED) {\n\t\t\t\treturn {\n\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\tstate: entity.state\n\t\t\t\t};\n\t\t\t}\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\tconst previousState = entity.state;\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\tconst transferHandler = TransferHandlerFactory.get(this.inferTransferFormat(entity));\n\t\t\ttry {\n\t\t\t\tawait transferHandler.onSuspend(this._dataPlaneComponent, entity.consumerPid);\n\t\t\t} catch (suspendError) {\n\t\t\t\t// Symmetric rollback: data-plane suspend failed, revert transfer state so\n\t\t\t\t// a retry can repair the subscription instead of failing invalidStateForSuspend.\n\t\t\t\tentity.state = previousState;\n\t\t\t\tentity.dateModified = new Date();\n\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\tthrow suspendError;\n\t\t\t}\n\n\t\t\tif (role === TransferProcessRole.Consumer) {\n\t\t\t\tawait this._internalTransferCallback.onStateChanged(\n\t\t\t\t\tentity.consumerPid,\n\t\t\t\t\tDataspaceProtocolTransferProcessStateType.SUSPENDED\n\t\t\t\t);\n\t\t\t\t// DSP reason is typed any[] — forward only the first entry since the callback\n\t\t\t\t// contract is reason?: string. Additional entries are intentionally dropped.\n\t\t\t\tconst suspendReason = Array.isArray(message.reason)\n\t\t\t\t\t? (message.reason[0] as string | undefined)\n\t\t\t\t\t: (message.reason as string | undefined);\n\t\t\t\tawait this._internalTransferCallback.onSuspended(entity.consumerPid, suspendReason);\n\t\t\t} else {\n\t\t\t\t// PROVIDER-ACT: forward the suspension (with its reason) to the consumer callback.\n\t\t\t\tawait this.deliverToConsumerCallback(\n\t\t\t\t\tentity,\n\t\t\t\t\t\"suspension\",\n\t\t\t\t\tasync (remoteControlPlane, token) => remoteControlPlane.suspendTransfer(message, token)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tawait MetricHelper.metricIncrement(\n\t\t\t\tthis._telemetryComponent,\n\t\t\t\tDataspaceControlPlaneMetricIds.TransfersSuspended\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.\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\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"terminateTransfer\"\n\t\t);\n\n\t\tconst validationFailures = await DataspaceProtocolHelper.validate(\n\t\t\tJsonLdHelper.toNodeObject(message)\n\t\t);\n\n\t\tif (Is.arrayValue(validationFailures)) {\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: \"invalidTransferTerminationMessage\",\n\t\t\t\tdata: { validationFailures }\n\t\t\t});\n\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew ValidationError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tnameof(message),\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\ttrustInfo.identity !== entity.consumerIdentity &&\n\t\t\t\ttrustInfo.identity !== entity.providerIdentity\n\t\t\t) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"callerNotAuthorizedForTransfer\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Only the organization that owns this transfer can mutate it.\n\t\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\t\t\tif (entity.organizationIdentity !== organizationIdentity) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"transferWrongOrganization\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// DSP idempotency: re-receiving TransferTerminationMessage for a transfer already\n\t\t\t// in TERMINATED should return success. Data-plane teardown already ran.\n\t\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.TERMINATED) {\n\t\t\t\treturn {\n\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\tstate: entity.state\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst previousState = entity.state;\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\tconst transferHandler = TransferHandlerFactory.get(this.inferTransferFormat(entity));\n\t\t\ttry {\n\t\t\t\tawait transferHandler.onTerminate(this._dataPlaneComponent, entity.consumerPid);\n\t\t\t} catch (teardownError) {\n\t\t\t\t// Symmetric rollback: data-plane teardown failed, revert transfer state so\n\t\t\t\t// a retry can repair the subscription. Terminate is reachable from multiple\n\t\t\t\t// states (REQUESTED/STARTED/SUSPENDED), so restore the actual previous one.\n\t\t\t\tentity.state = previousState;\n\t\t\t\tentity.dateModified = new Date();\n\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\tthrow teardownError;\n\t\t\t}\n\n\t\t\tif (role === TransferProcessRole.Consumer) {\n\t\t\t\tawait this._internalTransferCallback.onStateChanged(\n\t\t\t\t\tentity.consumerPid,\n\t\t\t\t\tDataspaceProtocolTransferProcessStateType.TERMINATED\n\t\t\t\t);\n\t\t\t\t// DSP reason is typed any[] — forward only the first entry since the callback\n\t\t\t\t// contract is reason?: string. Additional entries are intentionally dropped.\n\t\t\t\tconst terminateReason = Array.isArray(message.reason)\n\t\t\t\t\t? (message.reason[0] as string | undefined)\n\t\t\t\t\t: (message.reason as string | undefined);\n\t\t\t\tawait this._internalTransferCallback.onTerminated(entity.consumerPid, terminateReason);\n\t\t\t} else {\n\t\t\t\t// PROVIDER-ACT: forward the termination (with its reason) to the consumer callback.\n\t\t\t\tawait this.deliverToConsumerCallback(\n\t\t\t\t\tentity,\n\t\t\t\t\t\"termination\",\n\t\t\t\t\tasync (remoteControlPlane, token) => remoteControlPlane.terminateTransfer(message, token)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tawait MetricHelper.metricIncrement(\n\t\t\t\tthis._telemetryComponent,\n\t\t\t\tDataspaceControlPlaneMetricIds.TransfersTerminated\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.\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\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"getTransferProcess\"\n\t\t);\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByPid(pid);\n\n\t\t\tif (\n\t\t\t\ttrustInfo.identity !== entity.consumerIdentity &&\n\t\t\t\ttrustInfo.identity !== entity.providerIdentity\n\t\t\t) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"callerNotAuthorizedForTransfer\"\n\t\t\t\t);\n\t\t\t}\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 datasetId The dataset ID from the provider's catalog.\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 trustPayload The trust payload for authentication.\n\t * @returns For implicit trust: `{ agreementId }`. For external negotiation: `{ negotiationId }`.\n\t */\n\tpublic async negotiateAgreement(\n\t\tdatasetId: string,\n\t\tofferId: string,\n\t\tproviderEndpoint: string,\n\t\ttrustPayload: unknown\n\t): Promise<{ negotiationId?: string; agreementId?: string }> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(datasetId), datasetId);\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\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tContextIdHelper.guard(contextIds, HttpContextIdKeys.PublicOrigin);\n\t\tconst publicOrigin = contextIds[HttpContextIdKeys.PublicOrigin];\n\n\t\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"negotiateAgreement\"\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: \"startingContractNegotiation\",\n\t\t\tdata: {\n\t\t\t\tdatasetId,\n\t\t\t\tofferId,\n\t\t\t\tproviderEndpoint,\n\t\t\t\tpublicOrigin,\n\t\t\t\tverifiedIdentity: trustInfo.identity\n\t\t\t}\n\t\t});\n\n\t\tconst organizationId = await this.resolveContextOrganizationId();\n\n\t\tconst localTrustPayload = await this._trustComponent.generate(\n\t\t\torganizationId,\n\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t{}\n\t\t);\n\t\tconst catalogResult = await this._federatedCatalogueComponent.get(datasetId, localTrustPayload);\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\tdatasetId,\n\t\t\t\t\t{\n\t\t\t\t\t\tdatasetId,\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\tdatasetId,\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<IRightsManagementPolicy>(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: IRightsManagementPolicy) => {\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: IRightsManagementPolicy) => 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\t// Implicit-trust shortcut: create a local agreement without an external round-trip when\n\t\t// the consumer and provider are the same organisation on the same node.\n\t\tconst localProviderContext =\n\t\t\tawait this._platformComponent.getLocalOriginContext(providerEndpoint);\n\t\tif (\n\t\t\tlocalProviderContext?.[ContextIdKeys.Organization] === organizationId &&\n\t\t\ttrustInfo.identity === organizationId\n\t\t) {\n\t\t\treturn this.negotiateImplicitTrustAgreement(organizationId, datasetId);\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 MetricHelper.metricIncrement(\n\t\t\tthis._telemetryComponent,\n\t\t\tDataspaceControlPlaneMetricIds.NegotiationsInitiated\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: \"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\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.\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 organizationIdentity = await this.resolveContextOrganizationId();\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerIds = ArrayHelper.fromObjectOrArray<string>(assignerIdentity);\n\n\t\tif (!assignerIds.includes(organizationIdentity)) {\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\torganizationIdentity,\n\t\t\t\t\tactualAssigner: assignerIds.join(\", \")\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: organizationIdentity\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.\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 organizationIdentity = await this.resolveContextOrganizationId();\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerIds = ArrayHelper.fromObjectOrArray<string>(assignerIdentity);\n\n\t\tif (!assignerIds.includes(organizationIdentity)) {\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\torganizationIdentity,\n\t\t\t\t\tactualAssigner: assignerIds.join(\", \")\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 assigneeIds = ArrayHelper.fromObjectOrArray<string>(assigneeIdentity);\n\n\t\tif (\n\t\t\t!Is.stringValue(entity.consumerIdentity) ||\n\t\t\t!assigneeIds.includes(entity.consumerIdentity)\n\t\t) {\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: assigneeIds.join(\", \")\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: organizationIdentity\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 * Register a dataset for a dataspace app, owned by the calling organization.\n\t * @param id Optional explicit id. If omitted, derived from `dataset[\"@id\"]`\n\t * or generated.\n\t * @param appId The dataspace app this dataset belongs to.\n\t * @param dataset The dataset payload.\n\t * @returns The resolved dataset id.\n\t */\n\tpublic async createAppDataset(\n\t\tid: string | undefined,\n\t\tappId: string,\n\t\tdataset: IDataspaceProtocolDataset\n\t): Promise<string> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(appId), appId);\n\t\tGuards.object<IDataspaceProtocolDataset>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(dataset),\n\t\t\tdataset\n\t\t);\n\n\t\tlet resolvedId;\n\n\t\tif (Is.stringValue(id)) {\n\t\t\tresolvedId = id;\n\t\t} else if (Is.stringValue(dataset[\"@id\"])) {\n\t\t\tresolvedId = dataset[\"@id\"];\n\t\t} else {\n\t\t\tresolvedId = `dataset:${RandomHelper.generateUuidV7(\"compact\")}`;\n\t\t}\n\n\t\tif (!Urn.tryParseExact(resolvedId) || !Url.tryParseExact(resolvedId)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidDatasetId\", {\n\t\t\t\tid: resolvedId\n\t\t\t});\n\t\t}\n\n\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\t\tconst existing = await this._dataspaceAppDatasetStorage.get(resolvedId);\n\t\tif (!Is.empty(existing)) {\n\t\t\tthrow new AlreadyExistsError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"datasetAlreadyExists\",\n\t\t\t\tresolvedId\n\t\t\t);\n\t\t}\n\n\t\tconst now = new Date().toISOString();\n\t\tconst entity: DataspaceAppDataset = {\n\t\t\tid: resolvedId,\n\t\t\torganizationIdentity,\n\t\t\t// Required for out of bound dataset operations that need to correlate back to the owning tenant\n\t\t\ttenantId: await this.resolveContextTenantId(),\n\t\t\tappId,\n\t\t\tdataset: ObjectHelper.omit(dataset, [\"@id\"]),\n\t\t\tdateCreated: now,\n\t\t\tdateModified: now\n\t\t};\n\n\t\t// Side effect first, primary storage last\n\t\tawait this.publishAppDataset(entity);\n\t\tawait this._dataspaceAppDatasetStorage.set(entity);\n\n\t\tawait MetricHelper.metricIncrement(\n\t\t\tthis._telemetryComponent,\n\t\t\tDataspaceControlPlaneMetricIds.AppDatasetsCreated\n\t\t);\n\n\t\treturn resolvedId;\n\t}\n\n\t/**\n\t * Get a dataset record owned by the calling organization.\n\t * @param id The stored dataset id.\n\t * @returns The stored dataset record.\n\t */\n\tpublic async getAppDataset(id: string): Promise<IDataspaceAppDataset> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(id), id);\n\n\t\tconst organizationId = await this.resolveContextOrganizationId();\n\t\tconst entity = await this._dataspaceAppDatasetStorage.get(id);\n\t\tif (Is.empty(entity)) {\n\t\t\tthrow new NotFoundError(DataspaceControlPlaneService.CLASS_NAME, \"datasetNotFound\", id);\n\t\t}\n\t\tif (entity.organizationIdentity !== organizationId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"datasetWrongOrganization\"\n\t\t\t);\n\t\t}\n\n\t\treturn {\n\t\t\tid: entity.id,\n\t\t\tappId: entity.appId,\n\t\t\tdataset: this.restampDatasetId(entity.dataset, entity.id),\n\t\t\tdateCreated: entity.dateCreated,\n\t\t\tdateModified: entity.dateModified\n\t\t};\n\t}\n\n\t/**\n\t * List the dataspace app datasets owned by the calling organization.\n\t * @param cursor Optional pagination cursor.\n\t * @param limit Optional maximum number of entries to return.\n\t * @returns The stored datasets and the next-page cursor if more exist.\n\t */\n\tpublic async listAppDatasets(\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\tentities: IDataspaceAppDataset[];\n\t\tcursor?: string;\n\t}> {\n\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\t\tconst page = await this._dataspaceAppDatasetStorage.query(\n\t\t\t{\n\t\t\t\tproperty: \"organizationIdentity\",\n\t\t\t\tvalue: organizationIdentity,\n\t\t\t\tcomparison: ComparisonOperator.Equals\n\t\t\t},\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t\tcursor,\n\t\t\tlimit\n\t\t);\n\n\t\tconst entities: IDataspaceAppDataset[] = (page.entities ?? []).map(entity => ({\n\t\t\tid: entity.id,\n\t\t\tappId: entity.appId,\n\t\t\tdataset: this.restampDatasetId(entity.dataset ?? {}, entity.id ?? \"\"),\n\t\t\tdateCreated: entity.dateCreated,\n\t\t\tdateModified: entity.dateModified\n\t\t})) as IDataspaceAppDataset[];\n\n\t\treturn {\n\t\t\tentities,\n\t\t\tcursor: page.cursor\n\t\t};\n\t}\n\n\t/**\n\t * Update a dataset record owned by the calling organization.\n\t * @param id The stored dataset id.\n\t * @param appId The dataspace app this dataset belongs to.\n\t * @param dataset The dataset payload.\n\t * @returns A promise that resolves when the dataset has been updated in storage and the catalogue.\n\t */\n\tpublic async updateAppDataset(\n\t\tid: string,\n\t\tappId: string,\n\t\tdataset: IDataspaceProtocolDataset\n\t): Promise<void> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(appId), appId);\n\t\tGuards.object<IDataspaceProtocolDataset>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(dataset),\n\t\t\tdataset\n\t\t);\n\n\t\tconst organizationId = await this.resolveContextOrganizationId();\n\t\tconst existing = await this._dataspaceAppDatasetStorage.get(id);\n\t\tif (Is.empty(existing)) {\n\t\t\tthrow new NotFoundError(DataspaceControlPlaneService.CLASS_NAME, \"datasetNotFound\", id);\n\t\t}\n\t\tif (existing.organizationIdentity !== organizationId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"datasetWrongOrganization\"\n\t\t\t);\n\t\t}\n\n\t\tconst updated: DataspaceAppDataset = {\n\t\t\t...existing,\n\t\t\tappId,\n\t\t\tdataset: ObjectHelper.omit(dataset, [\"@id\"]),\n\t\t\tdateModified: new Date().toISOString()\n\t\t};\n\n\t\t// Side effect first, primary storage last\n\t\tawait this.publishAppDataset(updated);\n\t\tawait this._dataspaceAppDatasetStorage.set(updated);\n\n\t\tawait MetricHelper.metricIncrement(\n\t\t\tthis._telemetryComponent,\n\t\t\tDataspaceControlPlaneMetricIds.AppDatasetsUpdated\n\t\t);\n\t}\n\n\t/**\n\t * Delete a dataspace app dataset owned by the calling organization.\n\t * @param id The stored app dataset id.\n\t * @returns A promise that resolves when the dataset has been removed from storage and the catalogue.\n\t */\n\tpublic async deleteAppDataset(id: string): Promise<void> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(id), id);\n\n\t\tconst organizationId = await this.resolveContextOrganizationId();\n\t\tconst existing = await this._dataspaceAppDatasetStorage.get(id);\n\t\tif (Is.empty(existing)) {\n\t\t\tthrow new NotFoundError(DataspaceControlPlaneService.CLASS_NAME, \"datasetNotFound\", id);\n\t\t}\n\t\tif (existing.organizationIdentity !== organizationId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"datasetWrongOrganization\"\n\t\t\t);\n\t\t}\n\n\t\tconst localTrustPayload = await this._trustComponent.generate(\n\t\t\texisting.organizationIdentity,\n\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t{}\n\t\t);\n\t\tconst removeResult = await this._federatedCatalogueComponent.remove(id, localTrustPayload);\n\n\t\tif (isCatalogError(removeResult)) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"datasetRemoveFailed\",\n\t\t\t\t{\n\t\t\t\t\tdatasetId: id,\n\t\t\t\t\ttenantId: existing.tenantId ?? \"\",\n\t\t\t\t\tcatalogErrorCode: removeResult.code\n\t\t\t\t},\n\t\t\t\tBaseError.expand(removeResult.reason)\n\t\t\t);\n\t\t}\n\n\t\tawait this._dataspaceAppDatasetStorage.remove(id);\n\n\t\tawait MetricHelper.metricIncrement(\n\t\t\tthis._telemetryComponent,\n\t\t\tDataspaceControlPlaneMetricIds.AppDatasetsDeleted\n\t\t);\n\t}\n\t// ============================================================================\n\t// DSP VERSION DISCOVERY\n\t// ============================================================================\n\n\t/**\n\t * Return the Dataspace Protocol versions supported by this connector.\n\t * @returns The protocol version response listing all supported DSP versions.\n\t */\n\tpublic async getProtocolVersions(): Promise<IDataspaceProtocolVersionResponse> {\n\t\treturn {\n\t\t\tprotocolVersions: [\n\t\t\t\t{\n\t\t\t\t\tversion: \"2025-1\",\n\t\t\t\t\tpath: `/${this._callbackPath}`,\n\t\t\t\t\tbinding: DataspaceProtocolVersionBindingType.HTTPS,\n\t\t\t\t\tserviceId: \"twin-connector\"\n\t\t\t\t}\n\t\t\t]\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 * @returns A promise that resolves when all stalled negotiations have been removed and their callbacks notified.\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 > this._stalledNegotiationTimeoutMs) {\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\t// Notify each registered callback that the negotiation timed out. Prefer the dedicated\n\t\t\t// onTimeout hook; fall back to onFailed(reason: \"negotiationStalled\") for callbacks that\n\t\t\t// predate onTimeout.\n\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\tconst onTimeout = cb.onTimeout?.bind(cb);\n\t\t\t\ttry {\n\t\t\t\t\tif (onTimeout) {\n\t\t\t\t\t\tawait onTimeout(negotiationId);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tawait cb.onFailed(negotiationId, \"negotiationStalled\");\n\t\t\t\t\t}\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: onTimeout ? \"onTimeout\" : \"onFailed\", error }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (Is.arrayValue(stalled)) {\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 * Cleanup stalled consumer-initiated transfers.\n\t * Called periodically by the task scheduler. A consumer transfer left in REQUESTED beyond the\n\t * configured window means the provider never progressed it; remove it and notify the registered\n\t * transfer callbacks (onTimeout, falling back to onFailed with reason \"transferStalled\").\n\t * @returns A promise that resolves when stalled transfers have been removed and callbacks notified.\n\t * @internal\n\t */\n\tprivate async cleanupStalledTransfers(): Promise<void> {\n\t\tconst now = Date.now();\n\n\t\t// Runs per tenant so the storage access inherits the correct [Node, Tenant] + org partition.\n\t\tawait this._platformComponent.execute(async () => {\n\t\t\t// consumerPid is the primary key of TransferProcess, so it is used for both removal and callbacks.\n\t\t\tconst stalled: string[] = [];\n\t\t\tlet cursor: string | undefined;\n\n\t\t\tdo {\n\t\t\t\tconst page = await this._transferProcessStorage.query(\n\t\t\t\t\t{\n\t\t\t\t\t\tproperty: \"state\",\n\t\t\t\t\t\tvalue: DataspaceProtocolTransferProcessStateType.REQUESTED,\n\t\t\t\t\t\tcomparison: ComparisonOperator.Equals\n\t\t\t\t\t},\n\t\t\t\t\tundefined,\n\t\t\t\t\tundefined,\n\t\t\t\t\tcursor\n\t\t\t\t);\n\n\t\t\t\tfor (const entity of page.entities) {\n\t\t\t\t\tconst transfer = entity as TransferProcess;\n\t\t\t\t\t// Only the initiating (consumer) side times out waiting for the provider; a provider-side\n\t\t\t\t\t// REQUESTED transfer is awaiting the provider's own start decision, not a non-response.\n\t\t\t\t\tif (\n\t\t\t\t\t\ttransfer.localRole === TransferProcessRole.Consumer &&\n\t\t\t\t\t\tnow - new Date(transfer.dateModified).getTime() > this._stalledTransferTimeoutMs\n\t\t\t\t\t) {\n\t\t\t\t\t\tstalled.push(transfer.consumerPid);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcursor = page.cursor;\n\t\t\t} while (Is.stringValue(cursor));\n\n\t\t\tfor (const consumerPid of stalled) {\n\t\t\t\tawait this._transferProcessStorage.remove(consumerPid);\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: \"stalledTransferCleanedUp\",\n\t\t\t\t\tdata: { consumerPid }\n\t\t\t\t});\n\n\t\t\t\t// Prefer the dedicated onTimeout hook; fall back to onFailed(reason: \"transferStalled\") for\n\t\t\t\t// callbacks that implement it. Both are optional, so a callback may receive neither.\n\t\t\t\tfor (const [key, cb] of this._transferCallbacks.entries()) {\n\t\t\t\t\tconst onTimeout = cb.onTimeout?.bind(cb);\n\t\t\t\t\tconst onFailed = cb.onFailed?.bind(cb);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (onTimeout) {\n\t\t\t\t\t\t\tawait onTimeout(consumerPid);\n\t\t\t\t\t\t} else if (onFailed) {\n\t\t\t\t\t\t\tawait onFailed(consumerPid, \"transferStalled\");\n\t\t\t\t\t\t}\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: \"transferCallbackError\",\n\t\t\t\t\t\t\tdata: { key, consumerPid, method: onTimeout ? \"onTimeout\" : \"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\n\t\t\tif (Is.arrayValue(stalled)) {\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: \"stalledTransfersCleanupComplete\",\n\t\t\t\t\tdata: { cleanedUp: stalled.length }\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Perform the provider-side start of a just-requested transfer (build dataAddress, transition to\n\t * STARTED, deliver to the consumer). Only invoked when the request opted into auto-start, so there is no\n\t * approval step. Self-contained: failures are logged, never thrown. Runs inside the request's ALS\n\t * context, so the deferred storage access inherits the [Node, Tenant] + org partition.\n\t * @param consumerPid The consumerPid of the requested transfer.\n\t * @param publicOrigin This provider node's public origin, used to build the data-plane endpoint.\n\t * @internal\n\t */\n\tprivate async runProviderStart(consumerPid: string, publicOrigin?: string): Promise<void> {\n\t\ttry {\n\t\t\tconst { entity } = await this.lookupTransferByPid(consumerPid);\n\t\t\tif (entity.state !== DataspaceProtocolTransferProcessStateType.REQUESTED) {\n\t\t\t\t// Already advanced (e.g. an explicit start raced the auto-start). Nothing to do.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!Is.stringValue(entity.providerIdentity)) {\n\t\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"providerIdentityMissing\");\n\t\t\t}\n\n\t\t\t// Fail closed: without a public origin the data-plane endpoint in the dataAddress would be\n\t\t\t// broken, so hold the transfer rather than ship a relative/empty endpoint to the consumer.\n\t\t\tif (!Is.stringValue(publicOrigin)) {\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: \"autoStartPublicOriginMissing\",\n\t\t\t\t\tdata: { consumerPid }\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Self-token issued as the provider so startTransfer's provider-auth check passes. Auto-start's\n\t\t\t// caller auth already happened upstream at requestTransfer, so minting the proof here (rather than\n\t\t\t// requiring an inbound token) is the boundary-correct place for it; transferStarted forwards it as\n\t\t\t// the trustPayload.\n\t\t\tconst selfToken = await this._trustComponent.generate(\n\t\t\t\tentity.providerIdentity,\n\t\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t\t{\n\t\t\t\t\tsubject: {\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}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst result = await this.transferStarted(consumerPid, selfToken);\n\t\t\tif (getJsonLdType(result) === DataspaceProtocolTransferProcessTypes.TransferError) {\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: \"autoStartFailed\",\n\t\t\t\t\tdata: { consumerPid }\n\t\t\t\t});\n\t\t\t}\n\t\t} catch (error) {\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: \"autoStartFailed\",\n\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\tdata: { consumerPid }\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Resolve the control-plane component for the given URL and invoke an action with it. When the\n\t * URL maps to a local origin the action runs against this instance inside that origin's context\n\t * (avoiding HTTP serialisation). Otherwise the action runs against a remote REST client. Falls\n\t * back to remote when no platform component is available or the locality check throws.\n\t * @param url The endpoint URL to resolve.\n\t * @param action The action to run with the resolved component.\n\t * @returns The result of the action.\n\t * @internal\n\t */\n\tprivate async withControlPlaneComponent<T>(\n\t\turl: string,\n\t\taction: (component: IDataspaceControlPlaneComponent) => Promise<T>\n\t): Promise<T> {\n\t\ttry {\n\t\t\tconst localContext = await this._platformComponent.getLocalOriginContext(url);\n\t\t\tif (!Is.empty(localContext)) {\n\t\t\t\treturn await ContextIdStore.run(localContext, async () => action(this));\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fall back to remote component if locality check throws\n\t\t}\n\t\tconst remoteComponent = ComponentFactory.create<IDataspaceControlPlaneComponent>(\n\t\t\tthis._remoteControlPlaneComponentType,\n\t\t\t{ endpoint: url, pathPrefix: \"\" }\n\t\t);\n\t\treturn action(remoteComponent);\n\t}\n\n\t/**\n\t * Deliver a transfer state-change DSP message to the consumer's callback (provider → consumer), via a\n\t * remote control-plane client and the supplied sender. Mirrors negotiation's sendOfferToConsumer.\n\t * Best-effort: failures are logged, not thrown, so delivery problems don't roll back the transition.\n\t * @param entity The transfer process (provider side).\n\t * @param messageKind Short label for logging (e.g. \"start\", \"suspension\", \"termination\").\n\t * @param send Performs the remote POST given the remote client and an outbound trust token.\n\t * @internal\n\t */\n\tprivate async deliverToConsumerCallback(\n\t\tentity: ITransferProcess,\n\t\tmessageKind: string,\n\t\tsend: (\n\t\t\tremoteControlPlane: IDataspaceControlPlaneComponent,\n\t\t\toutboundToken: unknown\n\t\t) => Promise<\n\t\t\t| IDataspaceProtocolTransferStartMessage\n\t\t\t| IDataspaceProtocolTransferProcess\n\t\t\t| IDataspaceProtocolTransferError\n\t\t>\n\t): Promise<void> {\n\t\tif (!Is.stringValue(entity.callbackAddress) || !Is.stringValue(entity.providerIdentity)) {\n\t\t\t// Spec-allowed: no callback supplied → the consumer polls GET /transfers/:pid instead.\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Issue the token as the provider party (the agreement assigner) — the identity the consumer's\n\t\t\t// receive gate checks (`!== providerIdentity`), not the tenant-routing org. Keeps the two\n\t\t\t// identity spaces separate and works whether or not a node's org == its assigner DID.\n\t\t\tconst outboundToken = await this._trustComponent.generate(\n\t\t\t\tentity.providerIdentity,\n\t\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t\t{\n\t\t\t\t\tsubject: {\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}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst result = await this.withControlPlaneComponent(entity.callbackAddress, async component =>\n\t\t\t\tsend(component, outboundToken)\n\t\t\t);\n\n\t\t\tif (getJsonLdType(result) === DataspaceProtocolTransferProcessTypes.TransferError) {\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: \"transferCallbackRejected\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tmessageKind,\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tcallbackAddress: entity.callbackAddress\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t} catch (error) {\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: \"transferCallbackFailed\",\n\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\tdata: {\n\t\t\t\t\tmessageKind,\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\tcallbackAddress: entity.callbackAddress\n\t\t\t\t}\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\tlocalRole: storageEntity.localRole,\n\t\t\tformat: storageEntity.format,\n\t\t\tcallbackAddress: storageEntity.callbackAddress,\n\t\t\torganizationIdentity: storageEntity.organizationIdentity,\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\tlocalRole: entity.localRole,\n\t\t\tformat: entity.format,\n\t\t\tcallbackAddress: entity.callbackAddress,\n\t\t\torganizationIdentity: entity.organizationIdentity,\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<IRightsManagementAgreement> {\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 the dataset ID from an ODRL agreement's target.\n\t * @param agreement The ODRL agreement containing the target.\n\t * @returns The dataset ID extracted from the target URN.\n\t * @throws GeneralError if the agreement target is missing, has no UID, or has multiple targets.\n\t * @internal\n\t */\n\tprivate extractDatasetId(agreement: IRightsManagementAgreement): 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\t// Top-level target identifies the dataset; rule-level targets are constraint\n\t\t// scopes (refinements, JSONPath filters, AssetCollections) and aren't datasets.\n\t\tconst datasetTargets = OdrlPolicyHelper.getDatasetTargets(agreement);\n\n\t\tif (!Is.arrayValue(datasetTargets)) {\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\tif (datasetTargets.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: datasetTargets.length\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\treturn datasetTargets[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 * @returns A promise that resolves when the dataset has been confirmed in the catalogue and the offer has been validated.\n\t * @internal\n\t */\n\tprivate async validateCatalogDataset(\n\t\tdatasetId: string,\n\t\tagreement: IRightsManagementAgreement\n\t): Promise<void> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(datasetId), datasetId);\n\t\tGuards.object<IRightsManagementAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\n\t\tconst organizationId = await this.resolveContextOrganizationId();\n\t\tconst localTrustPayload = await this._trustComponent.generate(\n\t\t\torganizationId,\n\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t{}\n\t\t);\n\t\tconst catalogResult = await this._federatedCatalogueComponent.get(datasetId, localTrustPayload);\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 * @param message.consumerPid The consumer-side PID from the DSP message.\n\t * @param message.providerPid The provider-side PID from the DSP message.\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// consumerPid is the primary key on BOTH nodes, so the matched key alone is not a reliable role\n\t\t// signal; locate the record by primary, then the providerPid secondary index.\n\t\tlet storageEntity = await this._transferProcessStorage.get(pid);\n\t\tlet matchedByConsumerPid = true;\n\n\t\tif (!storageEntity) {\n\t\t\tstorageEntity = await this._transferProcessStorage.get(pid, \"providerPid\");\n\t\t\tmatchedByConsumerPid = false;\n\t\t}\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\tpid,\n\t\t\t\t{\n\t\t\t\t\tpid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Prefer the role persisted at write time (set in prepareTransfer / requestTransfer). Fall back\n\t\t// to the matched-key heuristic only for legacy records written before localRole existed.\n\t\tconst role =\n\t\t\tstorageEntity.localRole ??\n\t\t\t(matchedByConsumerPid ? TransferProcessRole.Consumer : TransferProcessRole.Provider);\n\n\t\treturn {\n\t\t\tentity: this.storageEntityToModel(storageEntity),\n\t\t\trole\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<IRightsManagementPolicy>[] {\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 * @returns A promise that resolves when the agreement has been matched against a catalogue offer.\n\t * @internal\n\t */\n\tprivate async validateAgreementMatchesOffer(\n\t\tagreement: IRightsManagementAgreement,\n\t\tcatalogDataset: IDcatDataset\n\t): Promise<void> {\n\t\tGuards.object<IRightsManagementAgreement>(\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 datasetId = getJsonLdId(catalogDataset);\n\t\tif (!Is.stringValue(datasetId)) {\n\t\t\tthrow new NotFoundError(DataspaceControlPlaneService.CLASS_NAME, \"catalogDatasetMissingId\");\n\t\t}\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<IRightsManagementPolicy>(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: IRightsManagementPolicy) =>\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: IRightsManagementPolicy) => 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\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 * Per the DS Protocol spec, Offers within a Dataset's hasPolicy array must NOT\n\t * include an explicit \"target\" property — the target is implicitly the Dataset itself.\n\t * When the offer has no explicit targets, we use the datasetId as the implicit target\n\t * so that the comparison with the agreement's target can succeed.\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 * @see https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1-err1/#lower-level-types\n\t * @internal\n\t */\n\tprivate isPolicyDerivedFrom(\n\t\tagreement: IRightsManagementAgreement,\n\t\toffer: IRightsManagementPolicy\n\t): boolean {\n\t\tconst agreementTargets = OdrlPolicyHelper.getTargets(agreement);\n\t\tconst offerTargets = OdrlPolicyHelper.getTargets(offer);\n\n\t\t// Per DSP spec, offers in a Dataset's hasPolicy MUST NOT include explicit targets —\n\t\t// the target is implicitly the Dataset. When the catalogue offer has no targets,\n\t\t// skip the target comparison entirely (the agreement's target is the dataset itself).\n\t\t// Only reject if both have explicit targets that don't overlap.\n\t\tif (Is.arrayValue(offerTargets) && Is.arrayValue(agreementTargets)) {\n\t\t\tif (\n\t\t\t\t!agreementTargets.some((agreementTarget: string) => offerTargets.includes(agreementTarget))\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else if (Is.arrayValue(offerTargets) && !Is.arrayValue(agreementTargets)) {\n\t\t\t// Offer has targets but agreement doesn't — mismatch\n\t\t\treturn false;\n\t\t}\n\t\t// If offer has no targets (catalogue offer), accept any agreement targets\n\t\t// since the implicit target is the dataset the offer belongs to\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 * Populate the system-controlled fields of a dataset payload.\n\t * @param dataset The user-supplied dataset payload.\n\t * @returns The populated dataset.\n\t * @internal\n\t */\n\tprivate async populateDefaults(\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\tif (contextIds?.[ContextIdKeys.Organization]) {\n\t\t\treturn { ...dataset, \"dcterms:publisher\": contextIds[ContextIdKeys.Organization] };\n\t\t}\n\n\t\treturn dataset;\n\t}\n\n\t/**\n\t * Creates the internal INegotiationCallback that fans out to all registered callbacks.\n\t * @returns The internal negotiation callback.\n\t * @internal\n\t */\n\tprivate createInternalCallback(): INegotiationCallback {\n\t\treturn {\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\tonFinalized: 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.onFinalized(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\t}\n\n\t/**\n\t * Creates the internal ITransferCallback that fans out to all registered transfer callbacks.\n\t * Errors thrown by individual callbacks are logged and swallowed so they cannot affect\n\t * the DSP protocol state machine or other registrants.\n\t * @returns The internal transfer callback.\n\t * @internal\n\t */\n\tprivate createInternalTransferCallback(): ITransferCallback {\n\t\treturn {\n\t\t\tonStateChanged: async (consumerPid, state) => {\n\t\t\t\tfor (const [key, cb] of this._transferCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onStateChanged(consumerPid, state);\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: \"transferCallbackError\",\n\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\tdata: { key, consumerPid, state, method: \"onStateChanged\" }\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\tonStarted: async (consumerPid, message) => {\n\t\t\t\tfor (const [key, cb] of this._transferCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onStarted(consumerPid, message);\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: \"transferCallbackError\",\n\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\tdata: { key, consumerPid, method: \"onStarted\" }\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 consumerPid => {\n\t\t\t\tfor (const [key, cb] of this._transferCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onCompleted(consumerPid);\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: \"transferCallbackError\",\n\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\tdata: { key, consumerPid, method: \"onCompleted\" }\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\tonSuspended: async (consumerPid, reason) => {\n\t\t\t\tfor (const [key, cb] of this._transferCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onSuspended(consumerPid, 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: \"transferCallbackError\",\n\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\tdata: { key, consumerPid, method: \"onSuspended\" }\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\tonTerminated: async (consumerPid, reason) => {\n\t\t\t\tfor (const [key, cb] of this._transferCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onTerminated(consumerPid, 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: \"transferCallbackError\",\n\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\tdata: { key, consumerPid, method: \"onTerminated\" }\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Re-stamp `@id` onto a stored payload blob using the entity primary key.\n\t * @param payload The stored payload blob (without `@id`).\n\t * @param id The entity id (becomes the dataset's `@id`).\n\t * @returns The dataset payload with `@id` populated.\n\t * @internal\n\t */\n\tprivate restampDatasetId(\n\t\tpayload: { [key: string]: unknown },\n\t\tid: string\n\t): IDataspaceProtocolDataset {\n\t\treturn { ...payload, \"@id\": id } as IDataspaceProtocolDataset;\n\t}\n\n\t// DATASPACE APP DATASET HANDLERS\n\n\t/**\n\t * Publish a single dataspace app dataset to the federated catalogue.\n\t * @param appDataset The stored dataspace app dataset entity.\n\t * @internal\n\t */\n\tprivate async publishAppDataset(appDataset: DataspaceAppDataset): Promise<void> {\n\t\tconst localTrustPayload = await this._trustComponent.generate(\n\t\t\tappDataset.organizationIdentity,\n\t\t\tthis._overrideTrustGeneratorType\n\t\t);\n\n\t\t// Ensure that any dataspace app operations are run with the tenant id\n\t\t// of the dataset owner, so that propagates to any operations it performs\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst tenantContextIds = { ...contextIds, [ContextIdKeys.Tenant]: appDataset.tenantId };\n\n\t\tawait ContextIdStore.run(tenantContextIds, async () => {\n\t\t\tconst datasetPayload = this.restampDatasetId(appDataset.dataset, appDataset.id);\n\n\t\t\tconst dataset = await this.populateDefaults(datasetPayload);\n\n\t\t\tconst publishResult = await this._federatedCatalogueComponent.set(\n\t\t\t\tdataset as unknown as IDcatDataset,\n\t\t\t\tlocalTrustPayload\n\t\t\t);\n\t\t\tif (isCatalogError(publishResult)) {\n\t\t\t\tthrow new GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"datasetPublishFailed\",\n\t\t\t\t\t{\n\t\t\t\t\t\tdatasetId: appDataset.id,\n\t\t\t\t\t\tappId: appDataset.appId,\n\t\t\t\t\t\ttenantId: appDataset.tenantId ?? \"\",\n\t\t\t\t\t\tcatalogErrorCode: publishResult.code\n\t\t\t\t\t},\n\t\t\t\t\tBaseError.expand(publishResult.reason)\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Resolve the calling organization from the request context.\n\t * @returns The owning organization identity.\n\t * @internal\n\t */\n\tprivate async resolveContextOrganizationId(): Promise<string> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\t\treturn contextIds[ContextIdKeys.Organization];\n\t}\n\n\t/**\n\t * Resolve the tenant identity from the current context.\n\t * @returns The owning tenant identity.\n\t * @internal\n\t */\n\tprivate async resolveContextTenantId(): Promise<string | undefined> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\treturn contextIds?.[ContextIdKeys.Tenant];\n\t}\n\n\t/**\n\t * Resolve the transfer format for handler dispatch. When the entity already carries a\n\t * format string (all transfers created by requestTransfer), that value is used directly.\n\t * For entities seeded without a format (e.g. older storage records), the format is inferred\n\t * from the presence of a consumer-supplied dataAddress — matching the pre-factory dispatch\n\t * logic so existing records continue to work correctly.\n\t * @param entity The transfer process entity.\n\t * @returns The effective DataspaceTransferFormat for handler lookup.\n\t * @internal\n\t */\n\tprivate inferTransferFormat(entity: ITransferProcess): DataspaceTransferFormat {\n\t\tconst knownFormats = Object.values(DataspaceTransferFormat) as string[];\n\t\tif (Is.stringValue(entity.format) && knownFormats.includes(entity.format)) {\n\t\t\treturn entity.format as DataspaceTransferFormat;\n\t\t}\n\t\t// Backward-compat: entities without a recognized format string (e.g. stored before\n\t\t// the factory was introduced, or using a non-standard format value) fall back to\n\t\t// dataAddress-based dispatch matching the pre-factory logic.\n\t\treturn Is.empty(entity.dataAddress)\n\t\t\t? DataspaceTransferFormat.HttpDataPull\n\t\t\t: DataspaceTransferFormat.HttpDataPush;\n\t}\n\n\t/**\n\t * Return an existing full-access agreement for the same-organization (implicit trust) case,\n\t * or create and store one if none exists. Fires onFinalized on all registered callbacks in\n\t * both cases.\n\t * @param organizationId The local organization ID (both assigner and assignee).\n\t * @param datasetId The dataset being granted access to.\n\t * @returns The agreement ID.\n\t * @internal\n\t */\n\tprivate async negotiateImplicitTrustAgreement(\n\t\torganizationId: string,\n\t\tdatasetId: string\n\t): Promise<{ agreementId: string }> {\n\t\tconst { policies } = await this._policyAdministrationPointComponent.query({\n\t\t\ttype: OdrlPolicyType.Agreement,\n\t\t\tassigner: organizationId,\n\t\t\tassignee: organizationId,\n\t\t\ttarget: datasetId\n\t\t});\n\n\t\tlet agreementId: string;\n\n\t\tif (policies.length > 0) {\n\t\t\tagreementId = OdrlPolicyHelper.getUid(policies[0]) as string;\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: \"implicitTrustAgreementReused\",\n\t\t\t\tdata: { agreementId, datasetId, organizationId }\n\t\t\t});\n\t\t} else {\n\t\t\tconst implicitAgreement: JsonLdObjectWithOptionalAtId<IRightsManagementAgreement> = {\n\t\t\t\t\"@context\": OdrlContexts.Context,\n\t\t\t\t\"@type\": OdrlPolicyType.Agreement,\n\t\t\t\tassigner: organizationId,\n\t\t\t\tassignee: organizationId,\n\t\t\t\ttarget: datasetId,\n\t\t\t\tpermission: [{ action: OdrlActionType.Use }]\n\t\t\t};\n\n\t\t\tagreementId = await this._policyAdministrationPointComponent.create(implicitAgreement);\n\n\t\t\tawait MetricHelper.metricIncrement(\n\t\t\t\tthis._telemetryComponent,\n\t\t\t\tDataspaceControlPlaneMetricIds.NegotiationsInitiated\n\t\t\t);\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: \"implicitTrustAgreementCreated\",\n\t\t\t\tdata: { agreementId, datasetId, organizationId }\n\t\t\t});\n\t\t}\n\n\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\ttry {\n\t\t\t\tawait cb.onFinalized(undefined, agreementId);\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\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\tdata: { key, negotiationId: agreementId, method: \"onFinalized\", error }\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn { agreementId };\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dataspaceControlPlaneService.js","sourceRoot":"","sources":["../../src/dataspaceControlPlaneService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAA2B,MAAM,sBAAsB,CAAC;AAEjG,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EACN,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,MAAM,EACN,EAAE,EACF,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,GAAG,EACH,GAAG,EACH,eAAe,EACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,YAAY,EAGZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,8BAA8B,EAC9B,4BAA4B,EAC5B,uBAAuB,EACvB,mBAAmB,EACnB,WAAW,EACX,aAAa,EAWb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EACN,6BAA6B,EAE7B,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EACN,gBAAgB,EAChB,sBAAsB,EAMtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,yBAAyB,EACzB,yCAAyC,EACzC,uBAAuB,EACvB,yCAAyC,EACzC,qCAAqC,EACrC,mCAAmC,EAanC,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AA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","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { HttpContextIdKeys, HttpUrlHelper, type IPlatformComponent } from \"@twin.org/api-models\";\nimport type { ITaskSchedulerComponent } from \"@twin.org/background-task-models\";\nimport { ContextIdHelper, ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport {\n\tAlreadyExistsError,\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\tUrl,\n\tUrn,\n\tValidationError\n} from \"@twin.org/core\";\nimport {\n\tJsonLdHelper,\n\ttype JsonLdObjectWithOptionalAtId,\n\ttype JsonLdObjectWithNoContext\n} from \"@twin.org/data-json-ld\";\nimport {\n\tDataspaceControlPlaneMetricIds,\n\tDataspaceControlPlaneMetrics,\n\tDataspaceTransferFormat,\n\tTransferProcessRole,\n\tgetJsonLdId,\n\tgetJsonLdType,\n\ttype DataspaceAppDataset,\n\ttype IDataspaceAppDataset,\n\ttype IDataspaceControlPlaneComponent,\n\ttype IDataspaceControlPlaneResolverComponent,\n\ttype IDataspaceDataPlaneComponent,\n\ttype INegotiationCallback,\n\ttype ITransferCallback,\n\ttype ITransferContext,\n\ttype ITransferProcess,\n\ttype TransferProcess\n} from \"@twin.org/dataspace-models\";\nimport { EngineCoreFactory } from \"@twin.org/engine-models\";\nimport { ComparisonOperator } from \"@twin.org/entity\";\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\ttype IRightsManagementAgreement,\n\ttype IRightsManagementPolicy\n} from \"@twin.org/rights-management-models\";\nimport {\n\tDataspaceProtocolContexts,\n\tDataspaceProtocolContractNegotiationTypes,\n\tDataspaceProtocolHelper,\n\tDataspaceProtocolTransferProcessStateType,\n\tDataspaceProtocolTransferProcessTypes,\n\tDataspaceProtocolVersionBindingType,\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\ttype IDataspaceProtocolVersionResponse\n} from \"@twin.org/standards-dataspace-protocol\";\nimport type { IDcatDataset } from \"@twin.org/standards-w3c-dcat\";\nimport { OdrlActionType, OdrlContexts, OdrlPolicyType } from \"@twin.org/standards-w3c-odrl\";\nimport { MetricHelper, type ITelemetryComponent } from \"@twin.org/telemetry-models\";\nimport { TrustHelper, type ITrustComponent } from \"@twin.org/trust-models\";\nimport { DataspaceControlPlanePolicyRequester } from \"./dataspaceControlPlanePolicyRequester.js\";\nimport { TransferHandlerFactory } from \"./factories/transferHandlerFactory.js\";\nimport { HttpDataPostTransferHandler } from \"./handlers/httpDataPostTransferHandler.js\";\nimport { HttpDataPullTransferHandler } from \"./handlers/httpDataPullTransferHandler.js\";\nimport { HttpDataPushTransferHandler } from \"./handlers/httpDataPushTransferHandler.js\";\nimport type { IDataspaceControlPlaneServiceConstructorOptions } from \"./models/IDataspaceControlPlaneServiceConstructorOptions.js\";\nimport {\n\tisCatalogError,\n\tisCatalogErrorName,\n\ttransformToTransferError\n} from \"./utils/transferErrorUtils.js\";\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 * Stalled negotiation threshold in milliseconds (30 minutes).\n\t * Negotiations that haven't received a state update within this time are considered stalled.\n\t * @internal\n\t */\n\tprivate static readonly _STALLED_NEGOTIATION_THRESHOLD_MS = 30 * 60 * 1000;\n\n\t/**\n\t * Stalled transfer threshold in milliseconds (30 minutes).\n\t * Consumer-initiated transfers left in REQUESTED beyond this time are considered timed out.\n\t * @internal\n\t */\n\tprivate static readonly _STALLED_TRANSFER_THRESHOLD_MS = 30 * 60 * 1000;\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\t * @internal\n\t */\n\tprivate readonly _policyNegotiationPointComponent: IPolicyNegotiationPointComponent;\n\n\t/**\n\t * Policy Negotiation Admin Point component for negotiation history.\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 * Entity storage for Dataspace App Dataset entities.\n\t * @internal\n\t */\n\tprivate readonly _dataspaceAppDatasetStorage: IEntityStorageConnector<DataspaceAppDataset>;\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.\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 * Control plane callback mount path (path only, not full URL). Combined with this node's public\n\t * origin to form the consumer callbackAddress the provider POSTs DSP transfer messages back to.\n\t * @internal\n\t */\n\tprivate readonly _callbackPath?: string;\n\n\t/**\n\t * Data plane component.\n\t * @internal\n\t */\n\tprivate readonly _dataPlaneComponent: IDataspaceDataPlaneComponent;\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 * Platform component.\n\t * @internal\n\t */\n\tprivate readonly _platformComponent: IPlatformComponent;\n\n\t/**\n\t * The optional telemetry component for metrics.\n\t * @internal\n\t */\n\tprivate readonly _telemetryComponent?: ITelemetryComponent;\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 * Registered transfer callbacks from upstream callers, keyed by registration key.\n\t * @internal\n\t */\n\tprivate readonly _transferCallbacks: Map<string, ITransferCallback>;\n\n\t/**\n\t * Internal transfer callback that fans out to all registered transfer callbacks.\n\t * @internal\n\t */\n\tprivate readonly _internalTransferCallback: ITransferCallback;\n\n\t/**\n\t * Factory key used to create remote control plane REST client instances for outbound\n\t * DSP transfer requests. Resolved via ComponentFactory.create() at call time.\n\t * @internal\n\t */\n\tprivate readonly _remoteControlPlaneComponentType: string;\n\n\t/**\n\t * Whether the provider auto-starts a transfer once requested (provider-side decision, never the consumer's).\n\t * @internal\n\t */\n\tprivate readonly _autoStartTransfers: boolean;\n\n\t/**\n\t * How long (ms) a negotiation may sit without progress before the periodic cleanup times it out.\n\t * @internal\n\t */\n\tprivate readonly _stalledNegotiationTimeoutMs: number;\n\n\t/**\n\t * How long (ms) a consumer-initiated transfer may sit in REQUESTED before the periodic cleanup times it out.\n\t * @internal\n\t */\n\tprivate readonly _stalledTransferTimeoutMs: number;\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\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 for negotiation history\n\t\tthis._policyNegotiationAdminPointComponent =\n\t\t\tComponentFactory.get<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._dataspaceAppDatasetStorage = EntityStorageConnectorFactory.get<\n\t\t\tIEntityStorageConnector<DataspaceAppDataset>\n\t\t>(options?.dataspaceAppDatasetEntityStorageType ?? nameofKebabCase<DataspaceAppDataset>());\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.trimLeadingAndTrailingSlashes(options.config.dataPlanePath)\n\t\t\t: undefined;\n\n\t\tthis._callbackPath = Is.stringValue(options?.config?.callbackPath)\n\t\t\t? StringHelper.trimLeadingAndTrailingSlashes(options.config.callbackPath)\n\t\t\t: \"dataspace-control-plane\";\n\n\t\tthis._autoStartTransfers = options?.config?.autoStartTransfers ?? false;\n\n\t\tthis._stalledNegotiationTimeoutMs =\n\t\t\toptions?.config?.stalledNegotiationTimeoutMs ??\n\t\t\tDataspaceControlPlaneService._STALLED_NEGOTIATION_THRESHOLD_MS;\n\n\t\tthis._stalledTransferTimeoutMs =\n\t\t\toptions?.config?.stalledTransferTimeoutMs ??\n\t\t\tDataspaceControlPlaneService._STALLED_TRANSFER_THRESHOLD_MS;\n\n\t\tthis._taskScheduler = ComponentFactory.getIfExists<ITaskSchedulerComponent>(\n\t\t\toptions?.taskSchedulerComponentType ?? \"task-scheduler\"\n\t\t);\n\n\t\tthis._platformComponent = ComponentFactory.get<IPlatformComponent>(\n\t\t\toptions?.platformComponentType ?? \"platform\"\n\t\t);\n\n\t\tthis._telemetryComponent = ComponentFactory.getIfExists<ITelemetryComponent>(\n\t\t\toptions?.telemetryComponentType\n\t\t);\n\n\t\tthis._dataPlaneComponent = ComponentFactory.get<IDataspaceDataPlaneComponent>(\n\t\t\toptions?.dataPlaneComponentType ?? \"dataspace-data-plane-service\"\n\t\t);\n\n\t\tthis._negotiationCallbacks = new Map();\n\t\tthis._transferCallbacks = new Map();\n\t\tthis._internalTransferCallback = this.createInternalTransferCallback();\n\t\tthis._remoteControlPlaneComponentType =\n\t\t\toptions?.remoteControlPlaneComponentType ?? \"dataspace-control-plane-rest-client\";\n\n\t\tconst internalCallback = this.createInternalCallback();\n\n\t\tthis._policyRequester = new DataspaceControlPlanePolicyRequester(\n\t\t\toptions?.loggingComponentType,\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\n\t\tTransferHandlerFactory.register(\n\t\t\tDataspaceTransferFormat.HttpDataPull,\n\t\t\t() => new HttpDataPullTransferHandler()\n\t\t);\n\t\tTransferHandlerFactory.register(\n\t\t\tDataspaceTransferFormat.HttpDataPush,\n\t\t\t() => new HttpDataPushTransferHandler()\n\t\t);\n\t\tTransferHandlerFactory.register(\n\t\t\tDataspaceTransferFormat.HttpDataPost,\n\t\t\t() => new HttpDataPostTransferHandler()\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 * Register a callback to receive transfer process state change notifications.\n\t * @param key A unique key identifying this callback registration.\n\t * @param callback The callback interface to register.\n\t */\n\tpublic registerTransferCallback(key: string, callback: ITransferCallback): void {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(key), key);\n\t\tGuards.object(DataspaceControlPlaneService.CLASS_NAME, nameof(callback), callback);\n\t\tthis._transferCallbacks.set(key, callback);\n\t}\n\n\t/**\n\t * Unregister a previously registered transfer callback.\n\t * @param key The key used when registering the callback.\n\t */\n\tpublic unregisterTransferCallback(key: string): void {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(key), key);\n\t\tthis._transferCallbacks.delete(key);\n\t}\n\n\t/**\n\t * The service needs to be started when the application is initialized.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t * @returns A promise that resolves when the federated catalogue is populated and the cleanup task is scheduled.\n\t */\n\tpublic async start(nodeLoggingComponentType?: string): Promise<void> {\n\t\tawait MetricHelper.createMetrics(this._telemetryComponent, DataspaceControlPlaneMetrics);\n\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\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\n\t\t\tawait this._taskScheduler.addTask(\n\t\t\t\t\"control-plane-transfer-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.cleanupStalledTransfers();\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 * @returns A promise that resolves when the cleanup task has been removed.\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\tawait this._taskScheduler.removeTask(\"control-plane-transfer-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. Whether it auto-starts is a provider-side\n\t * decision (the `autoStartTransfers` service config), never something the consumer can request.\n\t * @param request Transfer request message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information.\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\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"requestTransfer\"\n\t\t);\n\n\t\tconst validationFailures = await DataspaceProtocolHelper.validate(\n\t\t\tJsonLdHelper.toNodeObject(request)\n\t\t);\n\n\t\tif (Is.arrayValue(validationFailures)) {\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\treturn transformToTransferError(\n\t\t\t\tnew ValidationError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tnameof(request),\n\t\t\t\t\tvalidationFailures\n\t\t\t\t),\n\t\t\t\trequest\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: string;\n\t\tlet providerIdentity: string;\n\t\tlet policies: IRightsManagementPolicy[];\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\tnotFoundId: request.agreementId\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);\n\t\t\t}\n\n\t\t\tconst assigneeIdentity = OdrlPolicyHelper.extractAssigneeIdentity(agreement);\n\t\t\tconst assigneeIds = ArrayHelper.fromObjectOrArray<string>(assigneeIdentity);\n\n\t\t\t// The agreement's assignee is stamped by the provider as the consumer's organization identity.\n\t\t\tif (!assigneeIds.includes(trustInfo.identity)) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"callerNotAuthorizedForAgreement\"\n\t\t\t\t);\n\t\t\t}\n\t\t\tconsumerIdentity = trustInfo.identity;\n\n\t\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\t\tconst assignerIds = ArrayHelper.fromObjectOrArray<string>(assignerIdentity);\n\t\t\tif (assignerIds.length > 1) {\n\t\t\t\tthrow new GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"multipleAssignersNotSupported\"\n\t\t\t\t);\n\t\t\t}\n\t\t\tproviderIdentity = assignerIds[0];\n\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\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\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,\n\t\t\tproviderIdentity,\n\t\t\tlocalRole: TransferProcessRole.Provider,\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\torganizationIdentity,\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\t// Auto-start is a provider-side decision (the autoStartTransfers config), never the consumer's.\n\t\t// When the provider opts in, schedule the provider start asynchronously (mirrors negotiation's\n\t\t// setTimeout follow-up). The timer runs inside the request's ALS context, so the [Node, Tenant] + org\n\t\t// partition propagates to the deferred start.\n\t\tif (this._autoStartTransfers) {\n\t\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\t\tconst consumerPid = request.consumerPid;\n\t\t\tsetTimeout(async () => {\n\t\t\t\t// runProviderStart catches internally and can't reject; awaiting satisfies no-floating-promises.\n\t\t\t\tawait this.runProviderStart(consumerPid, contextIds?.[HttpContextIdKeys.PublicOrigin]);\n\t\t\t}, 0);\n\t\t}\n\n\t\tawait MetricHelper.metricIncrement(\n\t\t\tthis._telemetryComponent,\n\t\t\tDataspaceControlPlaneMetricIds.TransfersRequested\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 * Prepare a data transfer as a Consumer.\n\t * Generates a consumerPid, POSTs a TransferRequestMessage to the provider's DSP endpoint,\n\t * and (only if the provider accepts) persists a local TransferProcess in REQUESTED state.\n\t * @param agreementId The finalized agreement ID from contract negotiation.\n\t * @param providerEndpoint The provider's DSP control plane base URL.\n\t * @param format The transfer format (e.g. \"HttpData-PULL\", \"HttpData-PUSH\").\n\t * @param trustPayload Trust payload for authenticating this call.\n\t * @returns The consumerPid of the newly created TransferProcess.\n\t *\n\t * **Engine configuration requirement (remote transfers only):** when `providerEndpoint` is a\n\t * remote origin the outbound call uses\n\t * `ComponentFactory.create(remoteControlPlaneComponentType, { endpoint, pathPrefix })`.\n\t * For the runtime `providerEndpoint` to be forwarded correctly, the engine **must** register\n\t * the component type (default: `dataspace-control-plane-rest-client`) as a\n\t * **multi-instance** component (`isMultiInstance: true` in engine config). A singleton\n\t * registration ignores the runtime `endpoint` arg and silently POSTs to its\n\t * static endpoint instead. Local-origin (same-node) transfers run in-process and are unaffected.\n\t */\n\tpublic async prepareTransfer(\n\t\tagreementId: string,\n\t\tproviderEndpoint: string,\n\t\tformat: string,\n\t\ttrustPayload: unknown\n\t): Promise<{ consumerPid: string }> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(agreementId), agreementId);\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(format), format);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tContextIdHelper.guard(contextIds, HttpContextIdKeys.PublicOrigin);\n\t\tconst publicOrigin = contextIds[HttpContextIdKeys.PublicOrigin];\n\n\t\tif (!(Object.values(DataspaceTransferFormat) as string[]).includes(format)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"unsupportedTransferFormat\", {\n\t\t\t\tformat,\n\t\t\t\tsupported: Object.values(DataspaceTransferFormat)\n\t\t\t});\n\t\t}\n\n\t\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"prepareTransfer\"\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: \"preparingTransfer\",\n\t\t\tdata: { agreementId, providerEndpoint, format, identity: trustInfo.identity }\n\t\t});\n\n\t\tconst agreement = await this.lookupAgreement(agreementId);\n\n\t\tconst assigneeIdentity = OdrlPolicyHelper.extractAssigneeIdentity(agreement);\n\t\tconst assigneeIds = ArrayHelper.fromObjectOrArray<string>(assigneeIdentity);\n\t\tif (!assigneeIds.includes(trustInfo.identity)) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"callerNotAuthorizedForAgreement\"\n\t\t\t);\n\t\t}\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerIds = ArrayHelper.fromObjectOrArray<string>(assignerIdentity);\n\t\tif (assignerIds.length > 1) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"multipleAssignersNotSupported\"\n\t\t\t);\n\t\t}\n\t\tconst providerIdentity = assignerIds[0];\n\n\t\tconst datasetId = this.extractDatasetId(agreement);\n\n\t\tconst consumerPid = `urn:uuid:${RandomHelper.generateUuidV7()}`;\n\t\tconst origin = StringHelper.trimTrailingSlashes(publicOrigin);\n\n\t\t// Fetch context once and reuse across the callback, PUSH dataAddress, trust token, and storage.\n\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\n\t\t// Callback the provider POSTs DSP messages back to: mount path + `?organization=` so the inbound\n\t\t// POST routes to the right consumer tenant (mirrors buildCallbackUrl). The bare `origin` is kept for\n\t\t// the PUSH-inbox base below (a different mount).\n\t\tconst callbackAddress = HttpUrlHelper.addQueryStringParam(\n\t\t\tIs.stringValue(this._callbackPath) ? `${origin}/${this._callbackPath}` : origin,\n\t\t\tContextIdKeys.Organization,\n\t\t\torganizationIdentity\n\t\t);\n\n\t\tconst transferRequestMessage: IDataspaceProtocolTransferRequestMessage = {\n\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferRequestMessage,\n\t\t\tconsumerPid,\n\t\t\tagreementId,\n\t\t\tcallbackAddress,\n\t\t\tformat\n\t\t};\n\n\t\t// Delegate consumer dataAddress construction to the format-specific handler.\n\t\t// PUSH supplies its /inbox; PULL and POST return undefined (no consumer address needed).\n\t\tconst transferHandler = TransferHandlerFactory.get(format);\n\t\ttransferRequestMessage.dataAddress = transferHandler.buildConsumerDataAddress({\n\t\t\tconsumerPid,\n\t\t\torigin,\n\t\t\tdataPlanePath: this._dataPlanePath,\n\t\t\torganizationIdentity\n\t\t});\n\n\t\t// Generate outbound trust token to authenticate this node to the provider.\n\t\tconst outboundToken = await this._trustComponent.generate(\n\t\t\torganizationIdentity,\n\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t{ subject: { consumerPid, agreementId } }\n\t\t);\n\n\t\t// Call the provider's requestTransfer. When providerEndpoint resolves to a local origin this\n\t\t// runs in-process (no loopback HTTP, no multi-instance client required); otherwise it uses a\n\t\t// remote REST client. Mirrors how state-change deliveries route via withControlPlaneComponent.\n\t\tconst result = await this.withControlPlaneComponent(providerEndpoint, async component =>\n\t\t\tcomponent.requestTransfer(transferRequestMessage, outboundToken)\n\t\t);\n\n\t\tif (getJsonLdType(result) === DataspaceProtocolTransferProcessTypes.TransferError) {\n\t\t\tconst transferError = result as { code?: string };\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"transferRequestRejectedByProvider\",\n\t\t\t\t{\n\t\t\t\t\tagreementId,\n\t\t\t\t\tproviderEndpoint,\n\t\t\t\t\tcode: transferError.code\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst transferProcess = result as { providerPid?: string };\n\n\t\tif (!Is.stringValue(transferProcess.providerPid)) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"providerPidMissingInResponse\",\n\t\t\t\t{ consumerPid }\n\t\t\t);\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,\n\t\t\tproviderPid: transferProcess.providerPid,\n\t\t\tstate: DataspaceProtocolTransferProcessStateType.REQUESTED,\n\t\t\tagreementId,\n\t\t\tdatasetId,\n\t\t\tconsumerIdentity: trustInfo.identity,\n\t\t\tproviderIdentity,\n\t\t\tlocalRole: TransferProcessRole.Consumer,\n\t\t\tofferId: agreementId,\n\t\t\tpolicies: [agreement],\n\t\t\tcallbackAddress,\n\t\t\tformat,\n\t\t\tdataAddress: transferRequestMessage.dataAddress,\n\t\t\torganizationIdentity,\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\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: \"transferPrepared\",\n\t\t\tdata: {\n\t\t\t\tconsumerPid,\n\t\t\t\tproviderPid: storageEntity.providerPid,\n\t\t\t\tagreementId,\n\t\t\t\tformat\n\t\t\t}\n\t\t});\n\n\t\tawait MetricHelper.metricIncrement(\n\t\t\tthis._telemetryComponent,\n\t\t\tDataspaceControlPlaneMetricIds.TransfersPrepared\n\t\t);\n\n\t\treturn { consumerPid };\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 trustPayload Trust payload containing authorization information.\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\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferStartMessage | IDataspaceProtocolTransferError> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tContextIdHelper.guard(contextIds, HttpContextIdKeys.PublicOrigin);\n\t\tconst publicOrigin = contextIds[HttpContextIdKeys.PublicOrigin];\n\n\t\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"startTransfer\"\n\t\t);\n\n\t\tconst validationFailures = await DataspaceProtocolHelper.validate(\n\t\t\tJsonLdHelper.toNodeObject(message)\n\t\t);\n\n\t\tif (Is.arrayValue(validationFailures)) {\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: \"invalidTransferStartMessage\",\n\t\t\t\tdata: { validationFailures }\n\t\t\t});\n\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew ValidationError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tnameof(message),\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 (trustInfo.identity !== entity.providerIdentity) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"callerNotAuthorizedAsProvider\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Only the organization that owns this transfer can mutate it.\n\t\t\tconst callingOrganizationIdentity = await this.resolveContextOrganizationId();\n\t\t\tif (entity.organizationIdentity !== callingOrganizationIdentity) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"transferWrongOrganization\"\n\t\t\t\t);\n\t\t\t}\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\t// CONSUMER-RECEIVE: the provider POSTed a TransferStart to our callback. Use the dataAddress\n\t\t\t// from the message (rebuilding it is provider work), mark our record STARTED, and notify.\n\t\t\tif (role === TransferProcessRole.Consumer) {\n\t\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.STARTED;\n\t\t\t\tentity.dateModified = new Date();\n\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\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: \"transferProcessStarted\",\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\trole\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tawait this._internalTransferCallback.onStateChanged(\n\t\t\t\t\tentity.consumerPid,\n\t\t\t\t\tDataspaceProtocolTransferProcessStateType.STARTED\n\t\t\t\t);\n\t\t\t\tawait this._internalTransferCallback.onStarted(entity.consumerPid, message);\n\n\t\t\t\tawait MetricHelper.metricIncrement(\n\t\t\t\t\tthis._telemetryComponent,\n\t\t\t\t\tDataspaceControlPlaneMetricIds.TransfersStarted\n\t\t\t\t);\n\n\t\t\t\treturn message;\n\t\t\t}\n\n\t\t\t// PROVIDER-ACT (role === Provider): build the dataAddress, transition to STARTED, deliver below.\n\t\t\t// The previous (pre-transition) state drives the push-subscription branch below\n\t\t\t// (setup vs resume). Do NOT mutate entity.state here as the persisted transition\n\t\t\t// to STARTED happens after the dispatch block succeeds, so any validation or\n\t\t\t// token-generation failure leaves the row in its prior state.\n\t\t\tconst previousState = entity.state;\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// Delegate dataAddress construction and post-start actions to the format-specific handler.\n\t\t\t// Push subscription setup reads the entity from storage and requires state=STARTED,\n\t\t\t// so STARTED is persisted before calling onProviderStart. If subscription setup fails,\n\t\t\t// the state is rolled back so the client can retry.\n\t\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\t\t\tconst transferHandler = TransferHandlerFactory.get(this.inferTransferFormat(entity));\n\t\t\tresponse.dataAddress = await transferHandler.buildProviderStartDataAddress({\n\t\t\t\tentity,\n\t\t\t\tpublicOrigin,\n\t\t\t\tdataPlanePath: this._dataPlanePath,\n\t\t\t\torganizationIdentity,\n\t\t\t\ttrustComponent: this._trustComponent,\n\t\t\t\toverrideTrustGeneratorType: this._overrideTrustGeneratorType\n\t\t\t});\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.STARTED;\n\t\t\tentity.dateModified = new Date();\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\ttry {\n\t\t\t\tawait transferHandler.onProviderStart(\n\t\t\t\t\tthis._dataPlaneComponent,\n\t\t\t\t\tentity.consumerPid,\n\t\t\t\t\tpreviousState\n\t\t\t\t);\n\t\t\t} catch (subscriptionError) {\n\t\t\t\tentity.state = previousState;\n\t\t\t\tentity.dateModified = new Date();\n\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\tthrow subscriptionError;\n\t\t\t}\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\t// Notify the consumer by POSTing the TransferStart (with its dataAddress) to the callback.\n\t\t\t// Best-effort: a delivery failure must not roll back the STARTED transition.\n\t\t\tawait this.deliverToConsumerCallback(entity, \"start\", async (remoteControlPlane, token) =>\n\t\t\t\tremoteControlPlane.startTransfer(response, token)\n\t\t\t);\n\n\t\t\tawait MetricHelper.metricIncrement(\n\t\t\t\tthis._telemetryComponent,\n\t\t\t\tDataspaceControlPlaneMetricIds.TransfersStarted\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 * Start a Transfer Process as the Provider.\n\t * Builds a TransferStartMessage for a transfer already accepted by this node (REQUESTED, or\n\t * SUSPENDED to resume), transitions it to STARTED, and POSTs the message to the consumer callback.\n\t * consumerPid/providerPid/callbackAddress are resolved from the stored record; the call is then\n\t * forwarded to startTransfer, the single owner of the start state machine (it verifies the caller is\n\t * the provider, builds the dataAddress for PULL, persists STARTED, and delivers to the consumer).\n\t * This is the provider-side mirror of prepareTransfer.\n\t * @param pid The Process ID (consumerPid or providerPid) identifying the transfer to start.\n\t * @param trustPayload Trust payload proving the caller is the provider.\n\t * @returns Transfer Start Message (DSP compliant) with dataAddress for PULL transfers, or TransferError if the operation fails.\n\t */\n\tpublic async transferStarted(\n\t\tpid: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferStartMessage | IDataspaceProtocolTransferError> {\n\t\tlet consumerPid: string | undefined;\n\t\tlet providerPid: string | undefined;\n\t\ttry {\n\t\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(pid), pid);\n\n\t\t\tconst { entity, role } = await this.lookupTransferByPid(pid);\n\t\t\tconsumerPid = entity.consumerPid;\n\t\t\tproviderPid = entity.providerPid;\n\n\t\t\t// Only the provider initiates a start. startTransfer branches on role, so guard here to give a\n\t\t\t// clear error instead of silently running the consumer-receive path on a consumer-role record.\n\t\t\tif (role !== TransferProcessRole.Provider) {\n\t\t\t\tthrow new GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"transferStartNotProvider\",\n\t\t\t\t\t{\n\t\t\t\t\t\tpid,\n\t\t\t\t\t\trole\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst startMessage: 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// startTransfer verifies trustPayload is the provider, checks org ownership, applies the\n\t\t\t// REQUESTED|SUSPENDED state guard, builds the dataAddress, persists STARTED, and delivers the\n\t\t\t// TransferStartMessage to the consumer callback.\n\t\t\treturn await this.startTransfer(startMessage, trustPayload);\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, { consumerPid, providerPid });\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.\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\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"completeTransfer\"\n\t\t);\n\n\t\tconst validationFailures = await DataspaceProtocolHelper.validate(\n\t\t\tJsonLdHelper.toNodeObject(message)\n\t\t);\n\n\t\tif (Is.arrayValue(validationFailures)) {\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: \"invalidTransferCompletionMessage\",\n\t\t\t\tdata: { validationFailures }\n\t\t\t});\n\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew ValidationError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tnameof(message),\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 (trustInfo.identity !== entity.consumerIdentity) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"callerNotAuthorizedAsConsumer\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Only the organization that owns this transfer can mutate it.\n\t\t\tconst callingOrganizationId = await this.resolveContextOrganizationId();\n\t\t\tif (entity.organizationIdentity !== callingOrganizationId) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"transferWrongOrganization\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// DSP idempotency: re-receiving TransferCompletionMessage for a transfer already\n\t\t\t// in COMPLETED should return the same success response, not invalidStateForComplete.\n\t\t\t// Data-plane teardown already ran on the first attempt.\n\t\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.COMPLETED) {\n\t\t\t\treturn {\n\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\tstate: entity.state\n\t\t\t\t};\n\t\t\t}\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\tconst previousState = entity.state;\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\tconst transferHandler = TransferHandlerFactory.get(this.inferTransferFormat(entity));\n\t\t\ttry {\n\t\t\t\tawait transferHandler.onComplete(this._dataPlaneComponent, entity.consumerPid);\n\t\t\t} catch (teardownError) {\n\t\t\t\t// Symmetric rollback: data-plane teardown failed, revert the transfer state\n\t\t\t\t// so the client can retry. Without this the storage row is COMPLETED but\n\t\t\t\t// the subscription is still flowing, and a retry hits invalidStateForComplete.\n\t\t\t\tentity.state = previousState;\n\t\t\t\tentity.dateModified = new Date();\n\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\tthrow teardownError;\n\t\t\t}\n\n\t\t\t// Completion is consumer-initiated (the auth above accepts only the consumer): a consumer→provider\n\t\t\t// notification, so no provider→consumer delivery here — unlike suspend/terminate (either party).\n\t\t\tif (role === TransferProcessRole.Consumer) {\n\t\t\t\tawait this._internalTransferCallback.onStateChanged(\n\t\t\t\t\tentity.consumerPid,\n\t\t\t\t\tDataspaceProtocolTransferProcessStateType.COMPLETED\n\t\t\t\t);\n\t\t\t\tawait this._internalTransferCallback.onCompleted(entity.consumerPid);\n\t\t\t}\n\n\t\t\tawait MetricHelper.metricIncrement(\n\t\t\t\tthis._telemetryComponent,\n\t\t\t\tDataspaceControlPlaneMetricIds.TransfersCompleted\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.\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\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"suspendTransfer\"\n\t\t);\n\n\t\tconst validationFailures = await DataspaceProtocolHelper.validate(\n\t\t\tJsonLdHelper.toNodeObject(message)\n\t\t);\n\n\t\tif (Is.arrayValue(validationFailures)) {\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: \"invalidTransferSuspensionMessage\",\n\t\t\t\tdata: { validationFailures }\n\t\t\t});\n\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew ValidationError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tnameof(message),\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\ttrustInfo.identity !== entity.consumerIdentity &&\n\t\t\t\ttrustInfo.identity !== entity.providerIdentity\n\t\t\t) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"callerNotAuthorizedForTransfer\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// S2 belt-and-braces: only the organization that owns this transfer can mutate it.\n\t\t\tconst callingOrganizationId = await this.resolveContextOrganizationId();\n\t\t\tif (entity.organizationIdentity !== callingOrganizationId) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"transferWrongOrganization\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// DSP idempotency: re-receiving TransferSuspensionMessage for a transfer already\n\t\t\t// in SUSPENDED should return success. Data-plane suspend already ran.\n\t\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.SUSPENDED) {\n\t\t\t\treturn {\n\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\tstate: entity.state\n\t\t\t\t};\n\t\t\t}\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\tconst previousState = entity.state;\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\tconst transferHandler = TransferHandlerFactory.get(this.inferTransferFormat(entity));\n\t\t\ttry {\n\t\t\t\tawait transferHandler.onSuspend(this._dataPlaneComponent, entity.consumerPid);\n\t\t\t} catch (suspendError) {\n\t\t\t\t// Symmetric rollback: data-plane suspend failed, revert transfer state so\n\t\t\t\t// a retry can repair the subscription instead of failing invalidStateForSuspend.\n\t\t\t\tentity.state = previousState;\n\t\t\t\tentity.dateModified = new Date();\n\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\tthrow suspendError;\n\t\t\t}\n\n\t\t\tif (role === TransferProcessRole.Consumer) {\n\t\t\t\tawait this._internalTransferCallback.onStateChanged(\n\t\t\t\t\tentity.consumerPid,\n\t\t\t\t\tDataspaceProtocolTransferProcessStateType.SUSPENDED\n\t\t\t\t);\n\t\t\t\t// DSP reason is typed any[] — forward only the first entry since the callback\n\t\t\t\t// contract is reason?: string. Additional entries are intentionally dropped.\n\t\t\t\tconst suspendReason = Array.isArray(message.reason)\n\t\t\t\t\t? (message.reason[0] as string | undefined)\n\t\t\t\t\t: (message.reason as string | undefined);\n\t\t\t\tawait this._internalTransferCallback.onSuspended(entity.consumerPid, suspendReason);\n\t\t\t} else {\n\t\t\t\t// PROVIDER-ACT: forward the suspension (with its reason) to the consumer callback.\n\t\t\t\tawait this.deliverToConsumerCallback(\n\t\t\t\t\tentity,\n\t\t\t\t\t\"suspension\",\n\t\t\t\t\tasync (remoteControlPlane, token) => remoteControlPlane.suspendTransfer(message, token)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tawait MetricHelper.metricIncrement(\n\t\t\t\tthis._telemetryComponent,\n\t\t\t\tDataspaceControlPlaneMetricIds.TransfersSuspended\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.\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\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"terminateTransfer\"\n\t\t);\n\n\t\tconst validationFailures = await DataspaceProtocolHelper.validate(\n\t\t\tJsonLdHelper.toNodeObject(message)\n\t\t);\n\n\t\tif (Is.arrayValue(validationFailures)) {\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: \"invalidTransferTerminationMessage\",\n\t\t\t\tdata: { validationFailures }\n\t\t\t});\n\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew ValidationError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tnameof(message),\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\ttrustInfo.identity !== entity.consumerIdentity &&\n\t\t\t\ttrustInfo.identity !== entity.providerIdentity\n\t\t\t) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"callerNotAuthorizedForTransfer\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Only the organization that owns this transfer can mutate it.\n\t\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\t\t\tif (entity.organizationIdentity !== organizationIdentity) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"transferWrongOrganization\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// DSP idempotency: re-receiving TransferTerminationMessage for a transfer already\n\t\t\t// in TERMINATED should return success. Data-plane teardown already ran.\n\t\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.TERMINATED) {\n\t\t\t\treturn {\n\t\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\tstate: entity.state\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst previousState = entity.state;\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\tconst transferHandler = TransferHandlerFactory.get(this.inferTransferFormat(entity));\n\t\t\ttry {\n\t\t\t\tawait transferHandler.onTerminate(this._dataPlaneComponent, entity.consumerPid);\n\t\t\t} catch (teardownError) {\n\t\t\t\t// Symmetric rollback: data-plane teardown failed, revert transfer state so\n\t\t\t\t// a retry can repair the subscription. Terminate is reachable from multiple\n\t\t\t\t// states (REQUESTED/STARTED/SUSPENDED), so restore the actual previous one.\n\t\t\t\tentity.state = previousState;\n\t\t\t\tentity.dateModified = new Date();\n\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\tthrow teardownError;\n\t\t\t}\n\n\t\t\tif (role === TransferProcessRole.Consumer) {\n\t\t\t\tawait this._internalTransferCallback.onStateChanged(\n\t\t\t\t\tentity.consumerPid,\n\t\t\t\t\tDataspaceProtocolTransferProcessStateType.TERMINATED\n\t\t\t\t);\n\t\t\t\t// DSP reason is typed any[] — forward only the first entry since the callback\n\t\t\t\t// contract is reason?: string. Additional entries are intentionally dropped.\n\t\t\t\tconst terminateReason = Array.isArray(message.reason)\n\t\t\t\t\t? (message.reason[0] as string | undefined)\n\t\t\t\t\t: (message.reason as string | undefined);\n\t\t\t\tawait this._internalTransferCallback.onTerminated(entity.consumerPid, terminateReason);\n\t\t\t} else {\n\t\t\t\t// PROVIDER-ACT: forward the termination (with its reason) to the consumer callback.\n\t\t\t\tawait this.deliverToConsumerCallback(\n\t\t\t\t\tentity,\n\t\t\t\t\t\"termination\",\n\t\t\t\t\tasync (remoteControlPlane, token) => remoteControlPlane.terminateTransfer(message, token)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tawait MetricHelper.metricIncrement(\n\t\t\t\tthis._telemetryComponent,\n\t\t\t\tDataspaceControlPlaneMetricIds.TransfersTerminated\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.\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\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"getTransferProcess\"\n\t\t);\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByPid(pid);\n\n\t\t\tif (\n\t\t\t\ttrustInfo.identity !== entity.consumerIdentity &&\n\t\t\t\ttrustInfo.identity !== entity.providerIdentity\n\t\t\t) {\n\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"callerNotAuthorizedForTransfer\"\n\t\t\t\t);\n\t\t\t}\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 datasetId The dataset ID from the provider's catalog.\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 trustPayload The trust payload for authentication.\n\t * @returns For implicit trust: `{ agreementId }`. For external negotiation: `{ negotiationId }`.\n\t */\n\tpublic async negotiateAgreement(\n\t\tdatasetId: string,\n\t\tofferId: string,\n\t\tproviderEndpoint: string,\n\t\ttrustPayload: unknown\n\t): Promise<{ negotiationId?: string; agreementId?: string }> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(datasetId), datasetId);\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\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tContextIdHelper.guard(contextIds, HttpContextIdKeys.PublicOrigin);\n\t\tconst publicOrigin = contextIds[HttpContextIdKeys.PublicOrigin];\n\n\t\tconst trustInfo = await TrustHelper.verifyTrust(\n\t\t\tthis._trustComponent,\n\t\t\ttrustPayload,\n\t\t\t\"negotiateAgreement\"\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: \"startingContractNegotiation\",\n\t\t\tdata: {\n\t\t\t\tdatasetId,\n\t\t\t\tofferId,\n\t\t\t\tproviderEndpoint,\n\t\t\t\tpublicOrigin,\n\t\t\t\tverifiedIdentity: trustInfo.identity\n\t\t\t}\n\t\t});\n\n\t\tconst organizationId = await this.resolveContextOrganizationId();\n\n\t\tconst localTrustPayload = await this._trustComponent.generate(\n\t\t\torganizationId,\n\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t{}\n\t\t);\n\t\tconst catalogResult = await this._federatedCatalogueComponent.get(datasetId, localTrustPayload);\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\tdatasetId,\n\t\t\t\t\t{\n\t\t\t\t\t\tdatasetId,\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\tdatasetId,\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<IRightsManagementPolicy>(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: IRightsManagementPolicy) => {\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: IRightsManagementPolicy) => 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\t// Implicit-trust shortcut: create a local agreement without an external round-trip when\n\t\t// the consumer and provider are the same organisation on the same node.\n\t\tconst localProviderContext =\n\t\t\tawait this._platformComponent.getLocalOriginContext(providerEndpoint);\n\t\tif (\n\t\t\tlocalProviderContext?.[ContextIdKeys.Organization] === organizationId &&\n\t\t\ttrustInfo.identity === organizationId\n\t\t) {\n\t\t\treturn this.negotiateImplicitTrustAgreement(organizationId, datasetId);\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 MetricHelper.metricIncrement(\n\t\t\tthis._telemetryComponent,\n\t\t\tDataspaceControlPlaneMetricIds.NegotiationsInitiated\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: \"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\tIDataspaceProtocolContractNegotiation | 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\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.\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 organizationIdentity = await this.resolveContextOrganizationId();\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerIds = ArrayHelper.fromObjectOrArray<string>(assignerIdentity);\n\n\t\tif (!assignerIds.includes(organizationIdentity)) {\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\torganizationIdentity,\n\t\t\t\t\tactualAssigner: assignerIds.join(\", \")\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: organizationIdentity\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.\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 organizationIdentity = await this.resolveContextOrganizationId();\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerIds = ArrayHelper.fromObjectOrArray<string>(assignerIdentity);\n\n\t\tif (!assignerIds.includes(organizationIdentity)) {\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\torganizationIdentity,\n\t\t\t\t\tactualAssigner: assignerIds.join(\", \")\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 assigneeIds = ArrayHelper.fromObjectOrArray<string>(assigneeIdentity);\n\n\t\tif (\n\t\t\t!Is.stringValue(entity.consumerIdentity) ||\n\t\t\t!assigneeIds.includes(entity.consumerIdentity)\n\t\t) {\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: assigneeIds.join(\", \")\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: organizationIdentity\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 * Register a dataset for a dataspace app, owned by the calling organization.\n\t * @param id Optional explicit id. If omitted, derived from `dataset[\"@id\"]`\n\t * or generated.\n\t * @param appId The dataspace app this dataset belongs to.\n\t * @param dataset The dataset payload.\n\t * @returns The resolved dataset id.\n\t */\n\tpublic async createAppDataset(\n\t\tid: string | undefined,\n\t\tappId: string,\n\t\tdataset: IDataspaceProtocolDataset\n\t): Promise<string> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(appId), appId);\n\t\tGuards.object<IDataspaceProtocolDataset>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(dataset),\n\t\t\tdataset\n\t\t);\n\n\t\tlet resolvedId;\n\n\t\tif (Is.stringValue(id)) {\n\t\t\tresolvedId = id;\n\t\t} else if (Is.stringValue(dataset[\"@id\"])) {\n\t\t\tresolvedId = dataset[\"@id\"];\n\t\t} else {\n\t\t\tresolvedId = `dataset:${RandomHelper.generateUuidV7(\"compact\")}`;\n\t\t}\n\n\t\tif (!Urn.tryParseExact(resolvedId) || !Url.tryParseExact(resolvedId)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidDatasetId\", {\n\t\t\t\tid: resolvedId\n\t\t\t});\n\t\t}\n\n\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\t\tconst existing = await this._dataspaceAppDatasetStorage.get(resolvedId);\n\t\tif (!Is.empty(existing)) {\n\t\t\tthrow new AlreadyExistsError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"datasetAlreadyExists\",\n\t\t\t\tresolvedId\n\t\t\t);\n\t\t}\n\n\t\tconst now = new Date().toISOString();\n\t\tconst entity: DataspaceAppDataset = {\n\t\t\tid: resolvedId,\n\t\t\torganizationIdentity,\n\t\t\t// Required for out of bound dataset operations that need to correlate back to the owning tenant\n\t\t\ttenantId: await this.resolveContextTenantId(),\n\t\t\tappId,\n\t\t\tdataset: ObjectHelper.omit(dataset, [\"@id\"]),\n\t\t\tdateCreated: now,\n\t\t\tdateModified: now\n\t\t};\n\n\t\t// Side effect first, primary storage last\n\t\tawait this.publishAppDataset(entity);\n\t\tawait this._dataspaceAppDatasetStorage.set(entity);\n\n\t\tawait MetricHelper.metricIncrement(\n\t\t\tthis._telemetryComponent,\n\t\t\tDataspaceControlPlaneMetricIds.AppDatasetsCreated\n\t\t);\n\n\t\treturn resolvedId;\n\t}\n\n\t/**\n\t * Get a dataset record owned by the calling organization.\n\t * @param id The stored dataset id.\n\t * @returns The stored dataset record.\n\t */\n\tpublic async getAppDataset(id: string): Promise<IDataspaceAppDataset> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(id), id);\n\n\t\tconst organizationId = await this.resolveContextOrganizationId();\n\t\tconst entity = await this._dataspaceAppDatasetStorage.get(id);\n\t\tif (Is.empty(entity)) {\n\t\t\tthrow new NotFoundError(DataspaceControlPlaneService.CLASS_NAME, \"datasetNotFound\", id);\n\t\t}\n\t\tif (entity.organizationIdentity !== organizationId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"datasetWrongOrganization\"\n\t\t\t);\n\t\t}\n\n\t\treturn {\n\t\t\tid: entity.id,\n\t\t\tappId: entity.appId,\n\t\t\tdataset: this.restampDatasetId(entity.dataset, entity.id),\n\t\t\tdateCreated: entity.dateCreated,\n\t\t\tdateModified: entity.dateModified\n\t\t};\n\t}\n\n\t/**\n\t * List the dataspace app datasets owned by the calling organization.\n\t * @param cursor Optional pagination cursor.\n\t * @param limit Optional maximum number of entries to return.\n\t * @returns The stored datasets and the next-page cursor if more exist.\n\t */\n\tpublic async listAppDatasets(\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\tentities: IDataspaceAppDataset[];\n\t\tcursor?: string;\n\t}> {\n\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\t\tconst page = await this._dataspaceAppDatasetStorage.query(\n\t\t\t{\n\t\t\t\tproperty: \"organizationIdentity\",\n\t\t\t\tvalue: organizationIdentity,\n\t\t\t\tcomparison: ComparisonOperator.Equals\n\t\t\t},\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t\tcursor,\n\t\t\tlimit\n\t\t);\n\n\t\tconst entities: IDataspaceAppDataset[] = (page.entities ?? []).map(entity => ({\n\t\t\tid: entity.id,\n\t\t\tappId: entity.appId,\n\t\t\tdataset: this.restampDatasetId(entity.dataset ?? {}, entity.id ?? \"\"),\n\t\t\tdateCreated: entity.dateCreated,\n\t\t\tdateModified: entity.dateModified\n\t\t})) as IDataspaceAppDataset[];\n\n\t\treturn {\n\t\t\tentities,\n\t\t\tcursor: page.cursor\n\t\t};\n\t}\n\n\t/**\n\t * Update a dataset record owned by the calling organization.\n\t * @param id The stored dataset id.\n\t * @param appId The dataspace app this dataset belongs to.\n\t * @param dataset The dataset payload.\n\t * @returns A promise that resolves when the dataset has been updated in storage and the catalogue.\n\t */\n\tpublic async updateAppDataset(\n\t\tid: string,\n\t\tappId: string,\n\t\tdataset: IDataspaceProtocolDataset\n\t): Promise<void> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(appId), appId);\n\t\tGuards.object<IDataspaceProtocolDataset>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(dataset),\n\t\t\tdataset\n\t\t);\n\n\t\tconst organizationId = await this.resolveContextOrganizationId();\n\t\tconst existing = await this._dataspaceAppDatasetStorage.get(id);\n\t\tif (Is.empty(existing)) {\n\t\t\tthrow new NotFoundError(DataspaceControlPlaneService.CLASS_NAME, \"datasetNotFound\", id);\n\t\t}\n\t\tif (existing.organizationIdentity !== organizationId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"datasetWrongOrganization\"\n\t\t\t);\n\t\t}\n\n\t\tconst updated: DataspaceAppDataset = {\n\t\t\t...existing,\n\t\t\tappId,\n\t\t\tdataset: ObjectHelper.omit(dataset, [\"@id\"]),\n\t\t\tdateModified: new Date().toISOString()\n\t\t};\n\n\t\t// Side effect first, primary storage last\n\t\tawait this.publishAppDataset(updated);\n\t\tawait this._dataspaceAppDatasetStorage.set(updated);\n\n\t\tawait MetricHelper.metricIncrement(\n\t\t\tthis._telemetryComponent,\n\t\t\tDataspaceControlPlaneMetricIds.AppDatasetsUpdated\n\t\t);\n\t}\n\n\t/**\n\t * Delete a dataspace app dataset owned by the calling organization.\n\t * @param id The stored app dataset id.\n\t * @returns A promise that resolves when the dataset has been removed from storage and the catalogue.\n\t */\n\tpublic async deleteAppDataset(id: string): Promise<void> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(id), id);\n\n\t\tconst organizationId = await this.resolveContextOrganizationId();\n\t\tconst existing = await this._dataspaceAppDatasetStorage.get(id);\n\t\tif (Is.empty(existing)) {\n\t\t\tthrow new NotFoundError(DataspaceControlPlaneService.CLASS_NAME, \"datasetNotFound\", id);\n\t\t}\n\t\tif (existing.organizationIdentity !== organizationId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"datasetWrongOrganization\"\n\t\t\t);\n\t\t}\n\n\t\tconst localTrustPayload = await this._trustComponent.generate(\n\t\t\texisting.organizationIdentity,\n\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t{}\n\t\t);\n\t\tconst removeResult = await this._federatedCatalogueComponent.remove(id, localTrustPayload);\n\n\t\tif (isCatalogError(removeResult)) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"datasetRemoveFailed\",\n\t\t\t\t{\n\t\t\t\t\tdatasetId: id,\n\t\t\t\t\ttenantId: existing.tenantId ?? \"\",\n\t\t\t\t\tcatalogErrorCode: removeResult.code\n\t\t\t\t},\n\t\t\t\tBaseError.expand(removeResult.reason)\n\t\t\t);\n\t\t}\n\n\t\tawait this._dataspaceAppDatasetStorage.remove(id);\n\n\t\tawait MetricHelper.metricIncrement(\n\t\t\tthis._telemetryComponent,\n\t\t\tDataspaceControlPlaneMetricIds.AppDatasetsDeleted\n\t\t);\n\t}\n\t// ============================================================================\n\t// DSP VERSION DISCOVERY\n\t// ============================================================================\n\n\t/**\n\t * Return the Dataspace Protocol versions supported by this connector.\n\t * @returns The protocol version response listing all supported DSP versions.\n\t */\n\tpublic async getProtocolVersions(): Promise<IDataspaceProtocolVersionResponse> {\n\t\treturn {\n\t\t\tprotocolVersions: [\n\t\t\t\t{\n\t\t\t\t\tversion: \"2025-1\",\n\t\t\t\t\tpath: `/${this._callbackPath}`,\n\t\t\t\t\tbinding: DataspaceProtocolVersionBindingType.HTTPS,\n\t\t\t\t\tserviceId: \"twin-connector\"\n\t\t\t\t}\n\t\t\t]\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 * @returns A promise that resolves when all stalled negotiations have been removed and their callbacks notified.\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 > this._stalledNegotiationTimeoutMs) {\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\t// Notify each registered callback that the negotiation timed out. Prefer the dedicated\n\t\t\t// onTimeout hook; fall back to onFailed(reason: \"negotiationStalled\") for callbacks that\n\t\t\t// predate onTimeout.\n\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\tconst onTimeout = cb.onTimeout?.bind(cb);\n\t\t\t\ttry {\n\t\t\t\t\tif (onTimeout) {\n\t\t\t\t\t\tawait onTimeout(negotiationId);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tawait cb.onFailed(negotiationId, \"negotiationStalled\");\n\t\t\t\t\t}\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: onTimeout ? \"onTimeout\" : \"onFailed\", error }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (Is.arrayValue(stalled)) {\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 * Cleanup stalled consumer-initiated transfers.\n\t * Called periodically by the task scheduler. A consumer transfer left in REQUESTED beyond the\n\t * configured window means the provider never progressed it; remove it and notify the registered\n\t * transfer callbacks (onTimeout, falling back to onFailed with reason \"transferStalled\").\n\t * @returns A promise that resolves when stalled transfers have been removed and callbacks notified.\n\t * @internal\n\t */\n\tprivate async cleanupStalledTransfers(): Promise<void> {\n\t\tconst now = Date.now();\n\n\t\t// Runs per tenant so the storage access inherits the correct [Node, Tenant] + org partition.\n\t\tawait this._platformComponent.execute(async () => {\n\t\t\t// consumerPid is the primary key of TransferProcess, so it is used for both removal and callbacks.\n\t\t\tconst stalled: string[] = [];\n\t\t\tlet cursor: string | undefined;\n\n\t\t\tdo {\n\t\t\t\tconst page = await this._transferProcessStorage.query(\n\t\t\t\t\t{\n\t\t\t\t\t\tproperty: \"state\",\n\t\t\t\t\t\tvalue: DataspaceProtocolTransferProcessStateType.REQUESTED,\n\t\t\t\t\t\tcomparison: ComparisonOperator.Equals\n\t\t\t\t\t},\n\t\t\t\t\tundefined,\n\t\t\t\t\tundefined,\n\t\t\t\t\tcursor\n\t\t\t\t);\n\n\t\t\t\tfor (const entity of page.entities) {\n\t\t\t\t\tconst transfer = entity as TransferProcess;\n\t\t\t\t\t// Only the initiating (consumer) side times out waiting for the provider; a provider-side\n\t\t\t\t\t// REQUESTED transfer is awaiting the provider's own start decision, not a non-response.\n\t\t\t\t\tif (\n\t\t\t\t\t\ttransfer.localRole === TransferProcessRole.Consumer &&\n\t\t\t\t\t\tnow - new Date(transfer.dateModified).getTime() > this._stalledTransferTimeoutMs\n\t\t\t\t\t) {\n\t\t\t\t\t\tstalled.push(transfer.consumerPid);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcursor = page.cursor;\n\t\t\t} while (Is.stringValue(cursor));\n\n\t\t\tfor (const consumerPid of stalled) {\n\t\t\t\tawait this._transferProcessStorage.remove(consumerPid);\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: \"stalledTransferCleanedUp\",\n\t\t\t\t\tdata: { consumerPid }\n\t\t\t\t});\n\n\t\t\t\t// Prefer the dedicated onTimeout hook; fall back to onFailed(reason: \"transferStalled\") for\n\t\t\t\t// callbacks that implement it. Both are optional, so a callback may receive neither.\n\t\t\t\tfor (const [key, cb] of this._transferCallbacks.entries()) {\n\t\t\t\t\tconst onTimeout = cb.onTimeout?.bind(cb);\n\t\t\t\t\tconst onFailed = cb.onFailed?.bind(cb);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (onTimeout) {\n\t\t\t\t\t\t\tawait onTimeout(consumerPid);\n\t\t\t\t\t\t} else if (onFailed) {\n\t\t\t\t\t\t\tawait onFailed(consumerPid, \"transferStalled\");\n\t\t\t\t\t\t}\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: \"transferCallbackError\",\n\t\t\t\t\t\t\tdata: { key, consumerPid, method: onTimeout ? \"onTimeout\" : \"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\n\t\t\tif (Is.arrayValue(stalled)) {\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: \"stalledTransfersCleanupComplete\",\n\t\t\t\t\tdata: { cleanedUp: stalled.length }\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Perform the provider-side start of a just-requested transfer (build dataAddress, transition to\n\t * STARTED, deliver to the consumer). Only invoked when the request opted into auto-start, so there is no\n\t * approval step. Self-contained: failures are logged, never thrown. Runs inside the request's ALS\n\t * context, so the deferred storage access inherits the [Node, Tenant] + org partition.\n\t * @param consumerPid The consumerPid of the requested transfer.\n\t * @param publicOrigin This provider node's public origin, used to build the data-plane endpoint.\n\t * @internal\n\t */\n\tprivate async runProviderStart(consumerPid: string, publicOrigin?: string): Promise<void> {\n\t\ttry {\n\t\t\tconst { entity } = await this.lookupTransferByPid(consumerPid);\n\t\t\tif (entity.state !== DataspaceProtocolTransferProcessStateType.REQUESTED) {\n\t\t\t\t// Already advanced (e.g. an explicit start raced the auto-start). Nothing to do.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!Is.stringValue(entity.providerIdentity)) {\n\t\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"providerIdentityMissing\");\n\t\t\t}\n\n\t\t\t// Fail closed: without a public origin the data-plane endpoint in the dataAddress would be\n\t\t\t// broken, so hold the transfer rather than ship a relative/empty endpoint to the consumer.\n\t\t\tif (!Is.stringValue(publicOrigin)) {\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: \"autoStartPublicOriginMissing\",\n\t\t\t\t\tdata: { consumerPid }\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Self-token issued as the provider so startTransfer's provider-auth check passes. Auto-start's\n\t\t\t// caller auth already happened upstream at requestTransfer, so minting the proof here (rather than\n\t\t\t// requiring an inbound token) is the boundary-correct place for it; transferStarted forwards it as\n\t\t\t// the trustPayload.\n\t\t\tconst selfToken = await this._trustComponent.generate(\n\t\t\t\tentity.providerIdentity,\n\t\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t\t{\n\t\t\t\t\tsubject: {\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}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst result = await this.transferStarted(consumerPid, selfToken);\n\t\t\tif (getJsonLdType(result) === DataspaceProtocolTransferProcessTypes.TransferError) {\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: \"autoStartFailed\",\n\t\t\t\t\tdata: { consumerPid }\n\t\t\t\t});\n\t\t\t}\n\t\t} catch (error) {\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: \"autoStartFailed\",\n\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\tdata: { consumerPid }\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Resolve the control-plane component for the given URL and invoke an action with it. When the\n\t * URL maps to a local origin the action runs against this instance inside that origin's context\n\t * (avoiding HTTP serialisation). Otherwise the action runs against a remote REST client. Falls\n\t * back to remote when no platform component is available or the locality check throws.\n\t * @param url The endpoint URL to resolve.\n\t * @param action The action to run with the resolved component.\n\t * @returns The result of the action.\n\t * @internal\n\t */\n\tprivate async withControlPlaneComponent<T>(\n\t\turl: string,\n\t\taction: (component: IDataspaceControlPlaneComponent) => Promise<T>\n\t): Promise<T> {\n\t\ttry {\n\t\t\tconst localContext = await this._platformComponent.getLocalOriginContext(url);\n\t\t\tif (!Is.empty(localContext)) {\n\t\t\t\treturn await ContextIdStore.run(localContext, async () => action(this));\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fall back to remote component if locality check throws\n\t\t}\n\t\tconst remoteComponent = ComponentFactory.create<IDataspaceControlPlaneComponent>(\n\t\t\tthis._remoteControlPlaneComponentType,\n\t\t\t{ endpoint: url, pathPrefix: \"\" }\n\t\t);\n\t\treturn action(remoteComponent);\n\t}\n\n\t/**\n\t * Deliver a transfer state-change DSP message to the consumer's callback (provider → consumer), via a\n\t * remote control-plane client and the supplied sender. Mirrors negotiation's sendOfferToConsumer.\n\t * Best-effort: failures are logged, not thrown, so delivery problems don't roll back the transition.\n\t * @param entity The transfer process (provider side).\n\t * @param messageKind Short label for logging (e.g. \"start\", \"suspension\", \"termination\").\n\t * @param send Performs the remote POST given the remote client and an outbound trust token.\n\t * @internal\n\t */\n\tprivate async deliverToConsumerCallback(\n\t\tentity: ITransferProcess,\n\t\tmessageKind: string,\n\t\tsend: (\n\t\t\tremoteControlPlane: IDataspaceControlPlaneComponent,\n\t\t\toutboundToken: unknown\n\t\t) => Promise<\n\t\t\t| IDataspaceProtocolTransferStartMessage\n\t\t\t| IDataspaceProtocolTransferProcess\n\t\t\t| IDataspaceProtocolTransferError\n\t\t>\n\t): Promise<void> {\n\t\tif (!Is.stringValue(entity.callbackAddress) || !Is.stringValue(entity.providerIdentity)) {\n\t\t\t// Spec-allowed: no callback supplied → the consumer polls GET /transfers/:pid instead.\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Issue the token as the provider party (the agreement assigner) — the identity the consumer's\n\t\t\t// receive gate checks (`!== providerIdentity`), not the tenant-routing org. Keeps the two\n\t\t\t// identity spaces separate and works whether or not a node's org == its assigner DID.\n\t\t\tconst outboundToken = await this._trustComponent.generate(\n\t\t\t\tentity.providerIdentity,\n\t\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t\t{\n\t\t\t\t\tsubject: {\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}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst result = await this.withControlPlaneComponent(entity.callbackAddress, async component =>\n\t\t\t\tsend(component, outboundToken)\n\t\t\t);\n\n\t\t\tif (getJsonLdType(result) === DataspaceProtocolTransferProcessTypes.TransferError) {\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: \"transferCallbackRejected\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tmessageKind,\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tcallbackAddress: entity.callbackAddress\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t} catch (error) {\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: \"transferCallbackFailed\",\n\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\tdata: {\n\t\t\t\t\tmessageKind,\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\tcallbackAddress: entity.callbackAddress\n\t\t\t\t}\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\tlocalRole: storageEntity.localRole,\n\t\t\tformat: storageEntity.format,\n\t\t\tcallbackAddress: storageEntity.callbackAddress,\n\t\t\torganizationIdentity: storageEntity.organizationIdentity,\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\tlocalRole: entity.localRole,\n\t\t\tformat: entity.format,\n\t\t\tcallbackAddress: entity.callbackAddress,\n\t\t\torganizationIdentity: entity.organizationIdentity,\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<IRightsManagementAgreement> {\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 the dataset ID from an ODRL agreement's target.\n\t * @param agreement The ODRL agreement containing the target.\n\t * @returns The dataset ID extracted from the target URN.\n\t * @throws GeneralError if the agreement target is missing, has no UID, or has multiple targets.\n\t * @internal\n\t */\n\tprivate extractDatasetId(agreement: IRightsManagementAgreement): 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\t// Top-level target identifies the dataset; rule-level targets are constraint\n\t\t// scopes (refinements, JSONPath filters, AssetCollections) and aren't datasets.\n\t\tconst datasetTargets = OdrlPolicyHelper.getDatasetTargets(agreement);\n\n\t\tif (!Is.arrayValue(datasetTargets)) {\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\tif (datasetTargets.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: datasetTargets.length\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\treturn datasetTargets[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 * @returns A promise that resolves when the dataset has been confirmed in the catalogue and the offer has been validated.\n\t * @internal\n\t */\n\tprivate async validateCatalogDataset(\n\t\tdatasetId: string,\n\t\tagreement: IRightsManagementAgreement\n\t): Promise<void> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(datasetId), datasetId);\n\t\tGuards.object<IRightsManagementAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\n\t\tconst organizationId = await this.resolveContextOrganizationId();\n\t\tconst localTrustPayload = await this._trustComponent.generate(\n\t\t\torganizationId,\n\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t{}\n\t\t);\n\t\tconst catalogResult = await this._federatedCatalogueComponent.get(datasetId, localTrustPayload);\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 * @param message.consumerPid The consumer-side PID from the DSP message.\n\t * @param message.providerPid The provider-side PID from the DSP message.\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// consumerPid is the primary key on BOTH nodes, so the matched key alone is not a reliable role\n\t\t// signal; locate the record by primary, then the providerPid secondary index.\n\t\tlet storageEntity = await this._transferProcessStorage.get(pid);\n\t\tlet matchedByConsumerPid = true;\n\n\t\tif (!storageEntity) {\n\t\t\tstorageEntity = await this._transferProcessStorage.get(pid, \"providerPid\");\n\t\t\tmatchedByConsumerPid = false;\n\t\t}\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\tpid,\n\t\t\t\t{\n\t\t\t\t\tpid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Prefer the role persisted at write time (set in prepareTransfer / requestTransfer). Fall back\n\t\t// to the matched-key heuristic only for legacy records written before localRole existed.\n\t\tconst role =\n\t\t\tstorageEntity.localRole ??\n\t\t\t(matchedByConsumerPid ? TransferProcessRole.Consumer : TransferProcessRole.Provider);\n\n\t\treturn {\n\t\t\tentity: this.storageEntityToModel(storageEntity),\n\t\t\trole\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<IRightsManagementPolicy>[] {\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 * @returns A promise that resolves when the agreement has been matched against a catalogue offer.\n\t * @internal\n\t */\n\tprivate async validateAgreementMatchesOffer(\n\t\tagreement: IRightsManagementAgreement,\n\t\tcatalogDataset: IDcatDataset\n\t): Promise<void> {\n\t\tGuards.object<IRightsManagementAgreement>(\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 datasetId = getJsonLdId(catalogDataset);\n\t\tif (!Is.stringValue(datasetId)) {\n\t\t\tthrow new NotFoundError(DataspaceControlPlaneService.CLASS_NAME, \"catalogDatasetMissingId\");\n\t\t}\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<IRightsManagementPolicy>(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: IRightsManagementPolicy) =>\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: IRightsManagementPolicy) => 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\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 * Per the DS Protocol spec, Offers within a Dataset's hasPolicy array must NOT\n\t * include an explicit \"target\" property — the target is implicitly the Dataset itself.\n\t * When the offer has no explicit targets, we use the datasetId as the implicit target\n\t * so that the comparison with the agreement's target can succeed.\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 * @see https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1-err1/#lower-level-types\n\t * @internal\n\t */\n\tprivate isPolicyDerivedFrom(\n\t\tagreement: IRightsManagementAgreement,\n\t\toffer: IRightsManagementPolicy\n\t): boolean {\n\t\tconst agreementTargets = OdrlPolicyHelper.getTargets(agreement);\n\t\tconst offerTargets = OdrlPolicyHelper.getTargets(offer);\n\n\t\t// Per DSP spec, offers in a Dataset's hasPolicy MUST NOT include explicit targets —\n\t\t// the target is implicitly the Dataset. When the catalogue offer has no targets,\n\t\t// skip the target comparison entirely (the agreement's target is the dataset itself).\n\t\t// Only reject if both have explicit targets that don't overlap.\n\t\tif (Is.arrayValue(offerTargets) && Is.arrayValue(agreementTargets)) {\n\t\t\tif (\n\t\t\t\t!agreementTargets.some((agreementTarget: string) => offerTargets.includes(agreementTarget))\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else if (Is.arrayValue(offerTargets) && !Is.arrayValue(agreementTargets)) {\n\t\t\t// Offer has targets but agreement doesn't — mismatch\n\t\t\treturn false;\n\t\t}\n\t\t// If offer has no targets (catalogue offer), accept any agreement targets\n\t\t// since the implicit target is the dataset the offer belongs to\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 * Populate the system-controlled fields of a dataset payload.\n\t * @param dataset The user-supplied dataset payload.\n\t * @returns The populated dataset.\n\t * @internal\n\t */\n\tprivate async populateDefaults(\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\tif (contextIds?.[ContextIdKeys.Organization]) {\n\t\t\treturn { ...dataset, \"dcterms:publisher\": contextIds[ContextIdKeys.Organization] };\n\t\t}\n\n\t\treturn dataset;\n\t}\n\n\t/**\n\t * Creates the internal INegotiationCallback that fans out to all registered callbacks.\n\t * @returns The internal negotiation callback.\n\t * @internal\n\t */\n\tprivate createInternalCallback(): INegotiationCallback {\n\t\treturn {\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\tonFinalized: 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.onFinalized(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\t}\n\n\t/**\n\t * Creates the internal ITransferCallback that fans out to all registered transfer callbacks.\n\t * Errors thrown by individual callbacks are logged and swallowed so they cannot affect\n\t * the DSP protocol state machine or other registrants.\n\t * @returns The internal transfer callback.\n\t * @internal\n\t */\n\tprivate createInternalTransferCallback(): ITransferCallback {\n\t\treturn {\n\t\t\tonStateChanged: async (consumerPid, state) => {\n\t\t\t\tfor (const [key, cb] of this._transferCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onStateChanged(consumerPid, state);\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: \"transferCallbackError\",\n\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\tdata: { key, consumerPid, state, method: \"onStateChanged\" }\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\tonStarted: async (consumerPid, message) => {\n\t\t\t\tfor (const [key, cb] of this._transferCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onStarted(consumerPid, message);\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: \"transferCallbackError\",\n\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\tdata: { key, consumerPid, method: \"onStarted\" }\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 consumerPid => {\n\t\t\t\tfor (const [key, cb] of this._transferCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onCompleted(consumerPid);\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: \"transferCallbackError\",\n\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\tdata: { key, consumerPid, method: \"onCompleted\" }\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\tonSuspended: async (consumerPid, reason) => {\n\t\t\t\tfor (const [key, cb] of this._transferCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onSuspended(consumerPid, 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: \"transferCallbackError\",\n\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\tdata: { key, consumerPid, method: \"onSuspended\" }\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\tonTerminated: async (consumerPid, reason) => {\n\t\t\t\tfor (const [key, cb] of this._transferCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onTerminated(consumerPid, 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: \"transferCallbackError\",\n\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\tdata: { key, consumerPid, method: \"onTerminated\" }\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Re-stamp `@id` onto a stored payload blob using the entity primary key.\n\t * @param payload The stored payload blob (without `@id`).\n\t * @param id The entity id (becomes the dataset's `@id`).\n\t * @returns The dataset payload with `@id` populated.\n\t * @internal\n\t */\n\tprivate restampDatasetId(\n\t\tpayload: { [key: string]: unknown },\n\t\tid: string\n\t): IDataspaceProtocolDataset {\n\t\treturn { ...payload, \"@id\": id } as IDataspaceProtocolDataset;\n\t}\n\n\t// DATASPACE APP DATASET HANDLERS\n\n\t/**\n\t * Publish a single dataspace app dataset to the federated catalogue.\n\t * @param appDataset The stored dataspace app dataset entity.\n\t * @internal\n\t */\n\tprivate async publishAppDataset(appDataset: DataspaceAppDataset): Promise<void> {\n\t\tconst localTrustPayload = await this._trustComponent.generate(\n\t\t\tappDataset.organizationIdentity,\n\t\t\tthis._overrideTrustGeneratorType\n\t\t);\n\n\t\t// Ensure that any dataspace app operations are run with the tenant id\n\t\t// of the dataset owner, so that propagates to any operations it performs\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst tenantContextIds = { ...contextIds, [ContextIdKeys.Tenant]: appDataset.tenantId };\n\n\t\tawait ContextIdStore.run(tenantContextIds, async () => {\n\t\t\tconst datasetPayload = this.restampDatasetId(appDataset.dataset, appDataset.id);\n\n\t\t\tconst dataset = await this.populateDefaults(datasetPayload);\n\n\t\t\tconst publishResult = await this._federatedCatalogueComponent.set(\n\t\t\t\tdataset as unknown as IDcatDataset,\n\t\t\t\tlocalTrustPayload\n\t\t\t);\n\t\t\tif (isCatalogError(publishResult)) {\n\t\t\t\tthrow new GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"datasetPublishFailed\",\n\t\t\t\t\t{\n\t\t\t\t\t\tdatasetId: appDataset.id,\n\t\t\t\t\t\tappId: appDataset.appId,\n\t\t\t\t\t\ttenantId: appDataset.tenantId ?? \"\",\n\t\t\t\t\t\tcatalogErrorCode: publishResult.code\n\t\t\t\t\t},\n\t\t\t\t\tBaseError.expand(publishResult.reason)\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Resolve the calling organization from the request context.\n\t * @returns The owning organization identity.\n\t * @internal\n\t */\n\tprivate async resolveContextOrganizationId(): Promise<string> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\t\treturn contextIds[ContextIdKeys.Organization];\n\t}\n\n\t/**\n\t * Resolve the tenant identity from the current context.\n\t * @returns The owning tenant identity.\n\t * @internal\n\t */\n\tprivate async resolveContextTenantId(): Promise<string | undefined> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\treturn contextIds?.[ContextIdKeys.Tenant];\n\t}\n\n\t/**\n\t * Resolve the transfer format for handler dispatch. When the entity already carries a\n\t * format string (all transfers created by requestTransfer), that value is used directly.\n\t * For entities seeded without a format (e.g. older storage records), the format is inferred\n\t * from the presence of a consumer-supplied dataAddress — matching the pre-factory dispatch\n\t * logic so existing records continue to work correctly.\n\t * @param entity The transfer process entity.\n\t * @returns The effective DataspaceTransferFormat for handler lookup.\n\t * @internal\n\t */\n\tprivate inferTransferFormat(entity: ITransferProcess): DataspaceTransferFormat {\n\t\tconst knownFormats = Object.values(DataspaceTransferFormat) as string[];\n\t\tif (Is.stringValue(entity.format) && knownFormats.includes(entity.format)) {\n\t\t\treturn entity.format as DataspaceTransferFormat;\n\t\t}\n\t\t// Backward-compat: entities without a recognized format string (e.g. stored before\n\t\t// the factory was introduced, or using a non-standard format value) fall back to\n\t\t// dataAddress-based dispatch matching the pre-factory logic.\n\t\treturn Is.empty(entity.dataAddress)\n\t\t\t? DataspaceTransferFormat.HttpDataPull\n\t\t\t: DataspaceTransferFormat.HttpDataPush;\n\t}\n\n\t/**\n\t * Return an existing full-access agreement for the same-organization (implicit trust) case,\n\t * or create and store one if none exists. Fires onFinalized on all registered callbacks in\n\t * both cases.\n\t * @param organizationId The local organization ID (both assigner and assignee).\n\t * @param datasetId The dataset being granted access to.\n\t * @returns The agreement ID.\n\t * @internal\n\t */\n\tprivate async negotiateImplicitTrustAgreement(\n\t\torganizationId: string,\n\t\tdatasetId: string\n\t): Promise<{ agreementId: string }> {\n\t\tconst { policies } = await this._policyAdministrationPointComponent.query({\n\t\t\ttype: OdrlPolicyType.Agreement,\n\t\t\tassigner: organizationId,\n\t\t\tassignee: organizationId,\n\t\t\ttarget: datasetId\n\t\t});\n\n\t\tlet agreementId: string;\n\n\t\tif (policies.length > 0) {\n\t\t\tagreementId = OdrlPolicyHelper.getUid(policies[0]) as string;\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: \"implicitTrustAgreementReused\",\n\t\t\t\tdata: { agreementId, datasetId, organizationId }\n\t\t\t});\n\t\t} else {\n\t\t\tconst implicitAgreement: JsonLdObjectWithOptionalAtId<IRightsManagementAgreement> = {\n\t\t\t\t\"@context\": OdrlContexts.Context,\n\t\t\t\t\"@type\": OdrlPolicyType.Agreement,\n\t\t\t\tassigner: organizationId,\n\t\t\t\tassignee: organizationId,\n\t\t\t\ttarget: datasetId,\n\t\t\t\tpermission: [{ action: OdrlActionType.Use }]\n\t\t\t};\n\n\t\t\tagreementId = await this._policyAdministrationPointComponent.create(implicitAgreement);\n\n\t\t\tawait MetricHelper.metricIncrement(\n\t\t\t\tthis._telemetryComponent,\n\t\t\t\tDataspaceControlPlaneMetricIds.NegotiationsInitiated\n\t\t\t);\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: \"implicitTrustAgreementCreated\",\n\t\t\t\tdata: { agreementId, datasetId, organizationId }\n\t\t\t});\n\t\t}\n\n\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\ttry {\n\t\t\t\tawait cb.onFinalized(undefined, agreementId);\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\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\tdata: { key, negotiationId: agreementId, method: \"onFinalized\", error }\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn { agreementId };\n\t}\n}\n"]}
|
|
@@ -81,13 +81,14 @@ export declare class DataspaceControlPlaneService implements IDataspaceControlPl
|
|
|
81
81
|
* @param trustPayload Trust payload for authenticating this call.
|
|
82
82
|
* @returns The consumerPid of the newly created TransferProcess.
|
|
83
83
|
*
|
|
84
|
-
* **Engine configuration requirement
|
|
84
|
+
* **Engine configuration requirement (remote transfers only):** when `providerEndpoint` is a
|
|
85
|
+
* remote origin the outbound call uses
|
|
85
86
|
* `ComponentFactory.create(remoteControlPlaneComponentType, { endpoint, pathPrefix })`.
|
|
86
87
|
* For the runtime `providerEndpoint` to be forwarded correctly, the engine **must** register
|
|
87
88
|
* the component type (default: `dataspace-control-plane-rest-client`) as a
|
|
88
89
|
* **multi-instance** component (`isMultiInstance: true` in engine config). A singleton
|
|
89
90
|
* registration ignores the runtime `endpoint` arg and silently POSTs to its
|
|
90
|
-
* static endpoint instead.
|
|
91
|
+
* static endpoint instead. Local-origin (same-node) transfers run in-process and are unaffected.
|
|
91
92
|
*/
|
|
92
93
|
prepareTransfer(agreementId: string, providerEndpoint: string, format: string, trustPayload: unknown): Promise<{
|
|
93
94
|
consumerPid: string;
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.9.1-next.12](https://github.com/iotaledger/twin-dataspace/compare/dataspace-control-plane-service-v0.9.1-next.11...dataspace-control-plane-service-v0.9.1-next.12) (2026-07-26)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* run prepareTransfer request in-process for local-origin providers ([#291](https://github.com/iotaledger/twin-dataspace/issues/291)) ([eb8cc40](https://github.com/iotaledger/twin-dataspace/commit/eb8cc408df5ce5394fbeb30897595dab2d555840)), refs [#287](https://github.com/iotaledger/twin-dataspace/issues/287)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/dataspace-models bumped from 0.9.1-next.11 to 0.9.1-next.12
|
|
16
|
+
|
|
3
17
|
## [0.9.1-next.11](https://github.com/iotaledger/twin-dataspace/compare/dataspace-control-plane-service-v0.9.1-next.10...dataspace-control-plane-service-v0.9.1-next.11) (2026-07-21)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -298,13 +298,14 @@ Trust payload for authenticating this call.
|
|
|
298
298
|
|
|
299
299
|
The consumerPid of the newly created TransferProcess.
|
|
300
300
|
|
|
301
|
-
**Engine configuration requirement
|
|
301
|
+
**Engine configuration requirement (remote transfers only):** when `providerEndpoint` is a
|
|
302
|
+
remote origin the outbound call uses
|
|
302
303
|
`ComponentFactory.create(remoteControlPlaneComponentType, { endpoint, pathPrefix })`.
|
|
303
304
|
For the runtime `providerEndpoint` to be forwarded correctly, the engine **must** register
|
|
304
305
|
the component type (default: `dataspace-control-plane-rest-client`) as a
|
|
305
306
|
**multi-instance** component (`isMultiInstance: true` in engine config). A singleton
|
|
306
307
|
registration ignores the runtime `endpoint` arg and silently POSTs to its
|
|
307
|
-
static endpoint instead.
|
|
308
|
+
static endpoint instead. Local-origin (same-node) transfers run in-process and are unaffected.
|
|
308
309
|
|
|
309
310
|
#### Implementation of
|
|
310
311
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/dataspace-control-plane-service",
|
|
3
|
-
"version": "0.9.1-next.
|
|
3
|
+
"version": "0.9.1-next.12",
|
|
4
4
|
"description": "Implements agreement negotiation and transfer process lifecycle management for control plane operations.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"engines": {
|
|
14
|
-
"node": ">=
|
|
14
|
+
"node": ">=24.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@twin.org/api-models": "next",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@twin.org/context": "next",
|
|
20
20
|
"@twin.org/core": "next",
|
|
21
21
|
"@twin.org/crypto": "next",
|
|
22
|
-
"@twin.org/dataspace-models": "0.9.1-next.
|
|
22
|
+
"@twin.org/dataspace-models": "0.9.1-next.12",
|
|
23
23
|
"@twin.org/entity": "next",
|
|
24
24
|
"@twin.org/entity-storage-models": "next",
|
|
25
25
|
"@twin.org/federated-catalogue-models": "next",
|