@twin.org/dataspace-control-plane-service 0.0.3-next.50 → 0.0.3-next.52
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.
|
@@ -10,7 +10,7 @@ import { ComparisonOperator } from "@twin.org/entity";
|
|
|
10
10
|
import { EntityStorageConnectorFactory } from "@twin.org/entity-storage-models";
|
|
11
11
|
import { OdrlPolicyHelper, PolicyRequesterFactory } from "@twin.org/rights-management-models";
|
|
12
12
|
import { DataspaceProtocolContexts, DataspaceProtocolContractNegotiationTypes, DataspaceProtocolEndpointType, DataspaceProtocolHelper, DataspaceProtocolTransferProcessStateType, DataspaceProtocolTransferProcessTypes } from "@twin.org/standards-dataspace-protocol";
|
|
13
|
-
import { OdrlPolicyType } from "@twin.org/standards-w3c-odrl";
|
|
13
|
+
import { OdrlActionType, OdrlContexts, OdrlPolicyType } from "@twin.org/standards-w3c-odrl";
|
|
14
14
|
import { MetricHelper } from "@twin.org/telemetry-models";
|
|
15
15
|
import { TrustHelper } from "@twin.org/trust-models";
|
|
16
16
|
import { DataspaceControlPlanePolicyRequester } from "./dataspaceControlPlanePolicyRequester.js";
|
|
@@ -175,7 +175,7 @@ export class DataspaceControlPlaneService {
|
|
|
175
175
|
? StringHelper.trimLeadingAndTrailingSlashes(options.config.callbackPath)
|
|
176
176
|
: undefined;
|
|
177
177
|
this._taskScheduler = ComponentFactory.getIfExists(options?.taskSchedulerComponentType ?? "task-scheduler");
|
|
178
|
-
this._platformComponent = ComponentFactory.
|
|
178
|
+
this._platformComponent = ComponentFactory.get(options?.platformComponentType ?? "platform");
|
|
179
179
|
this._telemetryComponent = ComponentFactory.getIfExists(options?.telemetryComponentType);
|
|
180
180
|
// Data plane component is optional and resolved lazily. The control plane is initialised
|
|
181
181
|
// BEFORE the data plane in engine startup order, so `getRegisteredInstanceTypeOptional`
|
|
@@ -266,7 +266,7 @@ export class DataspaceControlPlaneService {
|
|
|
266
266
|
let totalDatasets = 0;
|
|
267
267
|
// The platform component execute is used so that the dataset publication runs in the
|
|
268
268
|
// tenant context, also works in single tenant mode
|
|
269
|
-
await this._platformComponent
|
|
269
|
+
await this._platformComponent.execute(async () => {
|
|
270
270
|
// The tenant context id is set here for each system tenant
|
|
271
271
|
let cursor;
|
|
272
272
|
do {
|
|
@@ -1376,7 +1376,11 @@ export class DataspaceControlPlaneService {
|
|
|
1376
1376
|
offerType: getJsonLdType(matchingOffer)
|
|
1377
1377
|
}
|
|
1378
1378
|
});
|
|
1379
|
-
|
|
1379
|
+
// Implicit-trust shortcut: create a local agreement without an external round-trip when
|
|
1380
|
+
// the consumer and provider are the same organisation on the same node.
|
|
1381
|
+
const localProviderContext = await this._platformComponent.getLocalOriginContext(providerEndpoint);
|
|
1382
|
+
if (localProviderContext?.[ContextIdKeys.Organization] === organizationId &&
|
|
1383
|
+
trustInfo.identity === organizationId) {
|
|
1380
1384
|
return this.negotiateImplicitTrustAgreement(organizationId, datasetId);
|
|
1381
1385
|
}
|
|
1382
1386
|
const negotiationId = await this._policyNegotiationPointComponent.sendRequestToProvider(providerEndpoint, DataspaceControlPlaneService._REQUESTER_TYPE, offerId, publicOrigin);
|
|
@@ -1870,6 +1874,29 @@ export class DataspaceControlPlaneService {
|
|
|
1870
1874
|
});
|
|
1871
1875
|
}
|
|
1872
1876
|
}
|
|
1877
|
+
/**
|
|
1878
|
+
* Resolve the control-plane component for the given URL and invoke an action with it. When the
|
|
1879
|
+
* URL maps to a local origin the action runs against this instance inside that origin's context
|
|
1880
|
+
* (avoiding HTTP serialisation). Otherwise the action runs against a remote REST client. Falls
|
|
1881
|
+
* back to remote when no platform component is available or the locality check throws.
|
|
1882
|
+
* @param url The endpoint URL to resolve.
|
|
1883
|
+
* @param action The action to run with the resolved component.
|
|
1884
|
+
* @returns The result of the action.
|
|
1885
|
+
* @internal
|
|
1886
|
+
*/
|
|
1887
|
+
async withControlPlaneComponent(url, action) {
|
|
1888
|
+
try {
|
|
1889
|
+
const localContext = await this._platformComponent.getLocalOriginContext(url);
|
|
1890
|
+
if (!Is.empty(localContext)) {
|
|
1891
|
+
return await ContextIdStore.run(localContext, async () => action(this));
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
catch {
|
|
1895
|
+
// Fall back to remote component if locality check throws
|
|
1896
|
+
}
|
|
1897
|
+
const remoteComponent = ComponentFactory.create(this._remoteControlPlaneComponentType, { endpoint: url, pathPrefix: "" });
|
|
1898
|
+
return action(remoteComponent);
|
|
1899
|
+
}
|
|
1873
1900
|
/**
|
|
1874
1901
|
* Deliver a transfer state-change DSP message to the consumer's callback (provider → consumer), via a
|
|
1875
1902
|
* remote control-plane client and the supplied sender. Mirrors negotiation's sendOfferToConsumer.
|
|
@@ -1895,8 +1922,7 @@ export class DataspaceControlPlaneService {
|
|
|
1895
1922
|
agreementId: entity.agreementId
|
|
1896
1923
|
}
|
|
1897
1924
|
});
|
|
1898
|
-
const
|
|
1899
|
-
const result = await send(remoteControlPlane, outboundToken);
|
|
1925
|
+
const result = await this.withControlPlaneComponent(entity.callbackAddress, async (component) => send(component, outboundToken));
|
|
1900
1926
|
if (getJsonLdType(result) === DataspaceProtocolTransferProcessTypes.TransferError) {
|
|
1901
1927
|
await this._loggingComponent?.log({
|
|
1902
1928
|
level: "error",
|
|
@@ -2521,12 +2547,12 @@ export class DataspaceControlPlaneService {
|
|
|
2521
2547
|
}
|
|
2522
2548
|
else {
|
|
2523
2549
|
const implicitAgreement = {
|
|
2524
|
-
"@context":
|
|
2525
|
-
"@type":
|
|
2550
|
+
"@context": OdrlContexts.Context,
|
|
2551
|
+
"@type": OdrlPolicyType.Agreement,
|
|
2526
2552
|
assigner: organizationId,
|
|
2527
2553
|
assignee: organizationId,
|
|
2528
2554
|
target: datasetId,
|
|
2529
|
-
permission: [{ action:
|
|
2555
|
+
permission: [{ action: OdrlActionType.Use }]
|
|
2530
2556
|
};
|
|
2531
2557
|
agreementId = await this._policyAdministrationPointComponent.create(implicitAgreement);
|
|
2532
2558
|
await MetricHelper.metricIncrement(this._telemetryComponent, DataspaceControlPlaneMetricIds.NegotiationsInitiated);
|
|
@@ -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,EAItB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,yBAAyB,EACzB,yCAAyC,EACzC,6BAA6B,EAC7B,uBAAuB,EACvB,yCAAyC,EACzC,qCAAqC,EAcrC,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAA4B,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAE,W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AAC,mCAAmC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;YAEvF,MAAM,YAAY,CAAC,eAAe,CACjC,IAAI,CAAC,mBAAmB,EACxB,8BAA8B,CAAC,qBAAqB,CACpD,CAAC;YAEF,MAAM,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC;gBACjC,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,4BAA4B,CAAC,UAAU;gBAC/C,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;gBACd,OAAO,EAAE,+BAA+B;gBACxC,IAAI,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE;aAChD,CAAC,CAAC;QACJ,CAAC;QAED,KAAK,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,EAAE,CAAC;YAC9D,IAAI,CAAC;gBACJ,MAAM,EAAE,CAAC,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;YAC9C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,MAAM,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC;oBACjC,KAAK,EAAE,OAAO;oBACd,MAAM,EAAE,4BAA4B,CAAC,UAAU;oBAC/C,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;oBACd,OAAO,EAAE,0BAA0B;oBACnC,IAAI,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,WAAW,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} from \"@twin.org/rights-management-models\";\nimport {\n\tDataspaceProtocolContexts,\n\tDataspaceProtocolContractNegotiationTypes,\n\tDataspaceProtocolEndpointType,\n\tDataspaceProtocolHelper,\n\tDataspaceProtocolTransferProcessStateType,\n\tDataspaceProtocolTransferProcessTypes,\n\ttype DataspaceProtocolContractNegotiationStateType,\n\ttype IDataspaceProtocolAgreement,\n\ttype IDataspaceProtocolContractNegotiation,\n\ttype IDataspaceProtocolContractNegotiationError,\n\ttype IDataspaceProtocolDataset,\n\ttype IDataspaceProtocolPolicy,\n\ttype IDataspaceProtocolTransferCompletionMessage,\n\ttype IDataspaceProtocolTransferError,\n\ttype IDataspaceProtocolTransferProcess,\n\ttype IDataspaceProtocolTransferRequestMessage,\n\ttype IDataspaceProtocolTransferStartMessage,\n\ttype IDataspaceProtocolTransferSuspensionMessage,\n\ttype IDataspaceProtocolTransferTerminationMessage\n} from \"@twin.org/standards-dataspace-protocol\";\nimport type { IDcatDataset } from \"@twin.org/standards-w3c-dcat\";\nimport { 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 { EndpointProperties } from \"./models/endpointProperties.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 * 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 * Factory key used to look up the data plane component. Resolved lazily at push-time\n\t * (not at construction) so the data plane may register after the control plane is built.\n\t * @internal\n\t */\n\tprivate readonly _dataPlaneComponentType: string;\n\n\t/**\n\t * Policy requester instance for handling negotiation callbacks.\n\t * @internal\n\t */\n\tprivate readonly _policyRequester: DataspaceControlPlanePolicyRequester;\n\n\t/**\n\t * Task scheduler for periodic stalled negotiation cleanup.\n\t * @internal\n\t */\n\tprivate readonly _taskScheduler?: ITaskSchedulerComponent;\n\n\t/**\n\t * 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 * 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.trimTrailingSlashes(\n\t\t\t\t\tStringHelper.trimLeadingSlashes(options.config.dataPlanePath)\n\t\t\t\t)\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: undefined;\n\n\t\tthis._taskScheduler = ComponentFactory.getIfExists<ITaskSchedulerComponent>(\n\t\t\toptions?.taskSchedulerComponentType ?? \"task-scheduler\"\n\t\t);\n\n\t\tthis._platformComponent = ComponentFactory.getIfExists<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\t// Data plane component is optional and resolved lazily. The control plane is initialised\n\t\t// BEFORE the data plane in engine startup order, so `getRegisteredInstanceTypeOptional`\n\t\t// returns undefined when the engine constructs us — the wiring override can't fire here.\n\t\t// The default therefore matches the engine's actual factory key\n\t\t// (`nameofKebabCase(DataspaceDataPlaneService)`) so the late-bound `requireDataPlane()`\n\t\t// lookup at push time finds it regardless of init order.\n\t\tthis._dataPlaneComponentType =\n\t\t\toptions?.dataPlaneComponentType ?? \"dataspace-data-plane-service\";\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\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\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tts: Date.now(),\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tmessage: \"populatingFederatedCatalogue\"\n\t\t});\n\n\t\tlet registeredCount = 0;\n\t\tlet errorCount = 0;\n\t\tlet totalDatasets = 0;\n\n\t\t// The platform component execute is used so that the dataset publication runs in the\n\t\t// tenant context, also works in single tenant mode\n\t\tawait this._platformComponent?.execute(async () => {\n\t\t\t// The tenant context id is set here for each system tenant\n\t\t\tlet cursor: string | undefined;\n\t\t\tdo {\n\t\t\t\tconst page = await this._dataspaceAppDatasetStorage.query(\n\t\t\t\t\tundefined,\n\t\t\t\t\tundefined,\n\t\t\t\t\tundefined,\n\t\t\t\t\tcursor\n\t\t\t\t);\n\t\t\t\tif (Is.arrayValue(page.entities)) {\n\t\t\t\t\tfor (const entity of page.entities) {\n\t\t\t\t\t\tconst appDataset = entity as DataspaceAppDataset;\n\t\t\t\t\t\ttotalDatasets++;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tawait this.publishAppDataset(appDataset);\n\t\t\t\t\t\t\tregisteredCount++;\n\n\t\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\t\tlevel: \"debug\",\n\t\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\t\tmessage: \"datasetRegistered\",\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\tdatasetId: appDataset.id,\n\t\t\t\t\t\t\t\t\tappId: appDataset.appId,\n\t\t\t\t\t\t\t\t\ttenantId: appDataset.tenantId\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\terrorCount++;\n\t\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\t\tmessage: \"datasetPublishFailed\",\n\t\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\tdatasetId: appDataset.id,\n\t\t\t\t\t\t\t\t\tappId: appDataset.appId,\n\t\t\t\t\t\t\t\t\ttenantId: appDataset.tenantId\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcursor = page.cursor;\n\t\t\t} while (Is.stringValue(cursor));\n\t\t});\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tts: Date.now(),\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tmessage: \"federatedCataloguePopulated\",\n\t\t\tdata: {\n\t\t\t\tregisteredCount,\n\t\t\t\terrorCount,\n\t\t\t\ttotalDatasets\n\t\t\t}\n\t\t});\n\n\t\tif (this._taskScheduler) {\n\t\t\tawait this._taskScheduler.addTask(\n\t\t\t\t\"control-plane-negotiation-cleanup\",\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tnextTriggerTime: Date.now(),\n\t\t\t\t\t\tintervalMinutes: 5\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tasync () => {\n\t\t\t\t\tawait this.cleanupStalledNegotiations();\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Stop the service.\n\t * Removes the stalled negotiation cleanup task.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t * @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}\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// CONSUMER SIDE OPERATIONS\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Request a Transfer Process.\n\t * Creates a new Transfer Process in REQUESTED state.\n\t * @param request Transfer request message (DSP compliant).\n\t * @param options Request options.\n\t * @param options.autoStart When true, the provider immediately starts the requested transfer (scheduled\n\t * on the next tick); when omitted/false the provider start must be triggered explicitly.\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\toptions: { autoStart?: boolean } | undefined,\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: IDataspaceProtocolPolicy[];\n\n\t\ttry {\n\t\t\tconst agreement = await this.lookupAgreement(request.agreementId);\n\n\t\t\tif (!agreement) {\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"agreementNotFound\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\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// When auto-start is requested, 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 (options?.autoStart) {\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\tlet callbackAddress = Is.stringValue(this._callbackPath)\n\t\t\t? `${origin}/${this._callbackPath}`\n\t\t\t: origin;\n\t\tif (Is.stringValue(organizationIdentity)) {\n\t\t\tcallbackAddress = HttpUrlHelper.addQueryStringParam(\n\t\t\t\tcallbackAddress,\n\t\t\t\tContextIdKeys.Organization,\n\t\t\t\torganizationIdentity\n\t\t\t);\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// For consumer-initiated PUSH transfers the consumer must supply its /inbox endpoint as\n\t\t// dataAddress so the provider knows where to push ActivityStreams objects. Without it the\n\t\t// provider silently falls through to PULL mode on startTransfer.\n\t\tif (format === DataspaceTransferFormat.HttpDataPush) {\n\t\t\tif (!Is.stringValue(this._dataPlanePath)) {\n\t\t\t\tthrow new GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"pushTransferDataPathNotConfigured\",\n\t\t\t\t\t{ consumerPid }\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet inboxEndpoint = `${origin}/${this._dataPlanePath}/inbox`;\n\t\t\tif (Is.stringValue(organizationIdentity)) {\n\t\t\t\tinboxEndpoint = HttpUrlHelper.addQueryStringParam(\n\t\t\t\t\tinboxEndpoint,\n\t\t\t\t\tContextIdKeys.Organization,\n\t\t\t\t\torganizationIdentity\n\t\t\t\t);\n\t\t\t}\n\t\t\ttransferRequestMessage.dataAddress = {\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.DataAddress,\n\t\t\t\tendpointType: DataspaceProtocolEndpointType.HttpsActivityStreamEndpoint,\n\t\t\t\tendpoint: inboxEndpoint\n\t\t\t};\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(\n\t\t\ttransferRequestMessage,\n\t\t\tundefined,\n\t\t\toutboundToken\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// ============================================================================\n\t\t\t// PULL vs PUSH Transfer Mode Detection (DSP Protocol)\n\t\t\t// ============================================================================\n\t\t\t// The transfer mode is determined by whether the consumer provided a dataAddress\n\t\t\t// in the original TransferRequestMessage:\n\t\t\t//\n\t\t\t// PULL Mode (dataAddress NOT provided by consumer):\n\t\t\t// - Consumer requests data but doesn't specify where to receive it\n\t\t\t// - Provider generates access token and returns dataAddress in TransferStartMessage\n\t\t\t// - Consumer uses the returned endpoint + token to PULL data from provider\n\t\t\t// - Flow: Consumer → GET /entities?consumerPid=X (with Bearer token) → Provider\n\t\t\t//\n\t\t\t// PUSH Mode (dataAddress PROVIDED by consumer):\n\t\t\t// - Consumer specifies endpoint where they want data sent (e.g., webhook URL)\n\t\t\t// - Provider will PUSH data to the consumer's specified endpoint\n\t\t\t// - Flow: Provider → POST to consumer's dataAddress endpoint → Consumer\n\t\t\t//\n\t\t\t// See: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1-err1/#transfer-start-message\n\t\t\t// ============================================================================\n\n\t\t\tif (Is.empty(entity.dataAddress) && entity.format === DataspaceTransferFormat.HttpDataPost) {\n\t\t\t\t// PROVIDER-INITIATED PUSH: Consumer requested push but did not supply an /inbox.\n\t\t\t\t// Provider returns its own /inbox URL + a signed JWT so the consumer can verify\n\t\t\t\t// the incoming activities (HttpData-POST / DataspaceTransferFormat.HttpDataPost).\n\t\t\t\tif (!Is.stringValue(this._dataPlanePath)) {\n\t\t\t\t\treturn transformToTransferError(\n\t\t\t\t\t\tnew GeneralError(\n\t\t\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\t\"pushTransferDataPathNotConfigured\",\n\t\t\t\t\t\t\t{ consumerPid: entity.consumerPid }\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmessage\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (!Is.stringValue(entity.providerIdentity)) {\n\t\t\t\t\tthrow new GeneralError(\n\t\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\"providerIdentityMissing\"\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst pushProviderId = entity.providerIdentity;\n\t\t\t\tconst accessToken = await this._trustComponent.generate(\n\t\t\t\t\tpushProviderId,\n\t\t\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t\t\t{\n\t\t\t\t\t\tsubject: {\n\t\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\t\tagreementId: entity.agreementId,\n\t\t\t\t\t\t\tdatasetId: entity.datasetId\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, \"accessToken\", accessToken);\n\t\t\t\tconst tokenString = accessToken;\n\t\t\t\tlet fullEndpoint = `${publicOrigin}/${this._dataPlanePath}/inbox`;\n\n\t\t\t\t// Bake the provider's organization identity into the /inbox URL so the consumer's\n\t\t\t\t// inbound POST routes to the right organization via TenantProcessor — mirrors the\n\t\t\t\t// pull-mode endpoint baking below.\n\t\t\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\t\t\t\tfullEndpoint = HttpUrlHelper.addQueryStringParam(\n\t\t\t\t\tfullEndpoint,\n\t\t\t\t\tContextIdKeys.Organization,\n\t\t\t\t\torganizationIdentity\n\t\t\t\t);\n\n\t\t\t\tresponse.dataAddress = {\n\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.DataAddress,\n\t\t\t\t\tendpointType: DataspaceProtocolEndpointType.HttpsActivityStreamEndpoint,\n\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\tendpointProperties: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.EndpointProperty,\n\t\t\t\t\t\t\tname: EndpointProperties.Authorization,\n\t\t\t\t\t\t\tvalue: tokenString\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.EndpointProperty,\n\t\t\t\t\t\t\tname: EndpointProperties.AuthType,\n\t\t\t\t\t\t\tvalue: \"bearer\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t};\n\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"pushTransferStarted\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\t\ttransferMode: DataspaceTransferFormat.HttpDataPost\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (Is.empty(entity.dataAddress)) {\n\t\t\t\tif (!Is.stringValue(this._dataPlanePath)) {\n\t\t\t\t\treturn transformToTransferError(\n\t\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"pullTransfersNotSupported\", {\n\t\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\t\tproviderPid: entity.providerPid\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tmessage\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Provider signs the data access token with its own identity.\n\t\t\t\t// The subject contains the transfer context claims that the data plane\n\t\t\t\t// will verify when the consumer presents this token\n\t\t\t\tif (!Is.stringValue(entity.providerIdentity)) {\n\t\t\t\t\tthrow new GeneralError(\n\t\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\"providerIdentityMissing\"\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst pullProviderId = entity.providerIdentity;\n\t\t\t\tconst accessToken = await this._trustComponent.generate(\n\t\t\t\t\tpullProviderId,\n\t\t\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t\t\t{\n\t\t\t\t\t\tsubject: {\n\t\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\t\tagreementId: entity.agreementId,\n\t\t\t\t\t\t\tdatasetId: entity.datasetId\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, \"accessToken\", accessToken);\n\t\t\t\tconst tokenString = accessToken;\n\t\t\t\tlet fullEndpoint = `${publicOrigin}/${this._dataPlanePath}`;\n\n\t\t\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\t\t\t\tfullEndpoint = HttpUrlHelper.addQueryStringParam(\n\t\t\t\t\tfullEndpoint,\n\t\t\t\t\tContextIdKeys.Organization,\n\t\t\t\t\torganizationIdentity\n\t\t\t\t);\n\n\t\t\t\tresponse.dataAddress = {\n\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.DataAddress,\n\t\t\t\t\tendpointType: DataspaceProtocolEndpointType.HttpsQueryEndpoint,\n\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\tendpointProperties: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.EndpointProperty,\n\t\t\t\t\t\t\tname: EndpointProperties.Authorization,\n\t\t\t\t\t\t\tvalue: tokenString\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.EndpointProperty,\n\t\t\t\t\t\t\tname: EndpointProperties.AuthType,\n\t\t\t\t\t\t\tvalue: \"bearer\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t};\n\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"dataAccessTokenGenerated\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\t\ttransferMode: \"PULL\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// PUSH MODE (consumer-initiated): Consumer provided their /inbox endpoint in\n\t\t\t\t// the TransferRequestMessage.dataAddress. Provider responds with its own /inbox\n\t\t\t\t// URL so the consumer knows where to route data notifications.\n\t\t\t\tif (\n\t\t\t\t\t!Is.stringValue(entity.dataAddress?.endpoint) ||\n\t\t\t\t\t!Is.stringValue(entity.dataAddress?.endpointType)\n\t\t\t\t) {\n\t\t\t\t\treturn transformToTransferError(\n\t\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidPushDataAddress\", {\n\t\t\t\t\t\t\tconsumerPid: entity.consumerPid\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tmessage\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (!Is.stringValue(this._dataPlanePath)) {\n\t\t\t\t\treturn transformToTransferError(\n\t\t\t\t\t\tnew GeneralError(\n\t\t\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\t\"pushTransferDataPathNotConfigured\",\n\t\t\t\t\t\t\t{ consumerPid: entity.consumerPid }\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmessage\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tlet fullEndpoint = `${publicOrigin}/${this._dataPlanePath}/inbox`;\n\n\t\t\t\t// Bake the provider's organization identity into the /inbox URL so the consumer's\n\t\t\t\t// inbound POST routes to the right organization via TenantProcessor — mirrors the\n\t\t\t\t// pull-mode endpoint baking.\n\t\t\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\t\t\t\tfullEndpoint = HttpUrlHelper.addQueryStringParam(\n\t\t\t\t\tfullEndpoint,\n\t\t\t\t\tContextIdKeys.Organization,\n\t\t\t\t\torganizationIdentity\n\t\t\t\t);\n\n\t\t\t\tresponse.dataAddress = {\n\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.DataAddress,\n\t\t\t\t\tendpointType: DataspaceProtocolEndpointType.HttpsActivityStreamEndpoint,\n\t\t\t\t\tendpoint: fullEndpoint\n\t\t\t\t};\n\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"pushTransferStarted\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\t\ttransferMode: DataspaceTransferFormat.HttpDataPush\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tconst dataPlane = this.requireDataPlane();\n\n\t\t\t\t// Push subscription setup reads the entity from storage and requires state=STARTED.\n\t\t\t\t// Persist STARTED before the data-plane call, and roll back if subscription setup\n\t\t\t\t// fails so the row doesn't leak to STARTED on a setup-time error.\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\ttry {\n\t\t\t\t\tif (previousState === DataspaceProtocolTransferProcessStateType.REQUESTED) {\n\t\t\t\t\t\tawait dataPlane.setupPushSubscription(entity.consumerPid);\n\t\t\t\t\t} else if (previousState === DataspaceProtocolTransferProcessStateType.SUSPENDED) {\n\t\t\t\t\t\tawait dataPlane.resumePushSubscription(entity.consumerPid);\n\t\t\t\t\t}\n\t\t\t\t} catch (subscriptionError) {\n\t\t\t\t\tentity.state = previousState;\n\t\t\t\t\tentity.dateModified = new Date();\n\t\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\t\tthrow subscriptionError;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.STARTED;\n\t\t\tentity.dateModified = new Date();\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessStarted\",\n\t\t\t\tdata: {\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\trole\n\t\t\t\t}\n\t\t\t});\n\n\t\t\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\tif (this.isPushFormat(entity.format)) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.requireDataPlane().teardownPushSubscription(entity.consumerPid);\n\t\t\t\t} catch (teardownError) {\n\t\t\t\t\t// Symmetric rollback: data-plane teardown failed, revert the transfer state\n\t\t\t\t\t// so the client can retry. Without this the storage row is COMPLETED but\n\t\t\t\t\t// the subscription is still flowing, and a retry hits invalidStateForComplete.\n\t\t\t\t\tentity.state = previousState;\n\t\t\t\t\tentity.dateModified = new Date();\n\t\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\t\tthrow teardownError;\n\t\t\t\t}\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\tif (this.isPushFormat(entity.format)) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.requireDataPlane().suspendPushSubscription(entity.consumerPid);\n\t\t\t\t} catch (suspendError) {\n\t\t\t\t\t// Symmetric rollback: data-plane suspend failed, revert transfer state so\n\t\t\t\t\t// a retry can repair the subscription instead of failing invalidStateForSuspend.\n\t\t\t\t\tentity.state = previousState;\n\t\t\t\t\tentity.dateModified = new Date();\n\t\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\t\tthrow suspendError;\n\t\t\t\t}\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\tif (this.isPushFormat(entity.format)) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.requireDataPlane().teardownPushSubscription(entity.consumerPid);\n\t\t\t\t} catch (teardownError) {\n\t\t\t\t\t// Symmetric rollback: data-plane teardown failed, revert transfer state so\n\t\t\t\t\t// a retry can repair the subscription. Terminate is reachable from multiple\n\t\t\t\t\t// states (REQUESTED/STARTED/SUSPENDED), so restore the actual previous one.\n\t\t\t\t\tentity.state = previousState;\n\t\t\t\t\tentity.dateModified = new Date();\n\t\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\t\tthrow teardownError;\n\t\t\t\t}\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<IDataspaceProtocolPolicy>(offer));\n\n\t\tif (!Is.arrayValue(catalogOffers)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"datasetHasNoValidOffers\", {\n\t\t\t\tofferId,\n\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\"\n\t\t\t});\n\t\t}\n\n\t\tconst matchingOffer = catalogOffers.find((offer: IDataspaceProtocolPolicy) => {\n\t\t\tconst offerUid = OdrlPolicyHelper.getUid(offer);\n\t\t\treturn offerUid === offerId;\n\t\t});\n\n\t\tif (!matchingOffer) {\n\t\t\tconst availableOffers = catalogOffers\n\t\t\t\t.map((o: IDataspaceProtocolPolicy) => OdrlPolicyHelper.getUid(o) ?? \"unknown\")\n\t\t\t\t.join(\", \");\n\n\t\t\tthrow new NotFoundError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"offerNotFoundInDataset\",\n\t\t\t\tofferId,\n\t\t\t\t{\n\t\t\t\t\tofferId,\n\t\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\",\n\t\t\t\t\tavailableOffers\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"offerFoundInCatalog\",\n\t\t\tdata: {\n\t\t\t\tofferId,\n\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\",\n\t\t\t\tofferType: getJsonLdType(matchingOffer)\n\t\t\t}\n\t\t});\n\n\t\tif (trustInfo.identity === organizationId) {\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(DataspaceControlPlaneService.CLASS_NAME, \"datasetRemoveFailed\", {\n\t\t\t\tdatasetId: id,\n\t\t\t\ttenantId: existing.tenantId ?? \"\",\n\t\t\t\tcatalogErrorCode: removeResult.code\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// 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 > DataspaceControlPlaneService._STALLED_NEGOTIATION_THRESHOLD_MS) {\n\t\t\t\tstalled.push(negotiationId);\n\t\t\t}\n\t\t}\n\n\t\tfor (const negotiationId of stalled) {\n\t\t\tthis._policyRequester.removeNegotiation(negotiationId);\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"stalledNegotiationCleanedUp\",\n\t\t\t\tdata: { negotiationId }\n\t\t\t});\n\n\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\ttry {\n\t\t\t\t\tawait cb.onFailed(negotiationId, \"negotiationStalled\");\n\t\t\t\t} catch (error) {\n\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\t\tdata: { key, negotiationId, method: \"onFailed\", error }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (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 * 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 * 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 remoteControlPlane = ComponentFactory.create<IDataspaceControlPlaneComponent>(\n\t\t\t\tthis._remoteControlPlaneComponentType,\n\t\t\t\t{ endpoint: entity.callbackAddress, pathPrefix: \"\" }\n\t\t\t);\n\n\t\t\tconst result = await send(remoteControlPlane, outboundToken);\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<IDataspaceProtocolAgreement> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(agreementId), agreementId);\n\n\t\tlet agreement;\n\t\ttry {\n\t\t\tagreement = await this._policyAdministrationPointComponent.getAgreement(agreementId);\n\t\t} catch (error) {\n\t\t\tif (BaseError.isErrorName(error, NotFoundError.CLASS_NAME)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementLookupFailed\",\n\t\t\t\t{ agreementId },\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\n\t\treturn agreement;\n\t}\n\n\t/**\n\t * Check whether a transfer format string represents a push-mode delivery.\n\t * @param format The transfer format string from the TransferProcess entity.\n\t * @returns True if the format is a push variant (HttpData-PUSH or HttpData-POST).\n\t * @internal\n\t */\n\tprivate isPushFormat(format: string | undefined): boolean {\n\t\treturn (\n\t\t\tformat === DataspaceTransferFormat.HttpDataPush ||\n\t\t\tformat === DataspaceTransferFormat.HttpDataPost\n\t\t);\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: IDataspaceProtocolAgreement): string {\n\t\tif (Is.empty(agreement.target)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"agreementMissingTarget\", {\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement)\n\t\t\t});\n\t\t}\n\n\t\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: IDataspaceProtocolAgreement\n\t): Promise<void> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(datasetId), datasetId);\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\n\t\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<IDataspaceProtocolPolicy>[] {\n\t\t// Support both \"odrl:hasPolicy\" and \"hasPolicy\" to accommodate different catalog implementations\n\t\tif (Is.object<IDcatDataset>(catalogDataset) && !Is.empty(catalogDataset[\"odrl:hasPolicy\"])) {\n\t\t\tconst items = ArrayHelper.fromObjectOrArray(catalogDataset[\"odrl:hasPolicy\"]) ?? [];\n\t\t\treturn items.map(item => ({\n\t\t\t\t...item,\n\t\t\t\t\"@id\": OdrlPolicyHelper.getUid(item) ?? \"\"\n\t\t\t}));\n\t\t}\n\n\t\tif (\n\t\t\tIs.object<IDataspaceProtocolDataset>(catalogDataset) &&\n\t\t\t!Is.empty(catalogDataset.hasPolicy)\n\t\t) {\n\t\t\treturn ArrayHelper.fromObjectOrArray(catalogDataset.hasPolicy) ?? [];\n\t\t}\n\n\t\treturn [];\n\t}\n\n\t/**\n\t * Validate that the Agreement policies match at least one Catalog Offer.\n\t * @param agreement Agreement to validate.\n\t * @param catalogDataset Catalog dataset containing Offers.\n\t * @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: IDataspaceProtocolAgreement,\n\t\tcatalogDataset: IDcatDataset\n\t): Promise<void> {\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\t\tGuards.object<IDcatDataset>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(catalogDataset),\n\t\t\tcatalogDataset\n\t\t);\n\n\t\tconst 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<IDataspaceProtocolPolicy>(offer));\n\n\t\tif (!Is.arrayValue(catalogOffers)) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"catalogDatasetHasNoOffers\",\n\t\t\t\tdata: {\n\t\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\",\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\"\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst matchingOffer = catalogOffers.find(\n\t\t\t(offer: IDataspaceProtocolPolicy) =>\n\t\t\t\tOdrlPolicyHelper.getUid(offer) === OdrlPolicyHelper.getUid(agreement) ||\n\t\t\t\tthis.isPolicyDerivedFrom(agreement, offer)\n\t\t);\n\n\t\tif (!matchingOffer) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"agreementNotMatchingOffer\", {\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\",\n\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\",\n\t\t\t\tavailableOffers: catalogOffers\n\t\t\t\t\t.map((o: IDataspaceProtocolPolicy) => OdrlPolicyHelper.getUid(o) ?? \"unknown\")\n\t\t\t\t\t.join(\", \")\n\t\t\t});\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"agreementMatchedOffer\",\n\t\t\tdata: {\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\",\n\t\t\t\tofferId: OdrlPolicyHelper.getUid(matchingOffer) ?? \"\",\n\t\t\t\tdatasetId\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: IDataspaceProtocolAgreement,\n\t\toffer: IDataspaceProtocolPolicy\n\t): boolean {\n\t\tconst agreementTargets = OdrlPolicyHelper.getTargets(agreement);\n\t\tconst offerTargets = OdrlPolicyHelper.getTargets(offer);\n\n\t\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 * Resolve the data plane component or throw if it isn't registered. Push-mode transfers\n\t * require the data plane; pull-only deployments may run without it.\n\t * @returns The data plane component.\n\t * @throws GeneralError if the data plane component is not registered.\n\t * @internal\n\t */\n\tprivate requireDataPlane(): IDataspaceDataPlaneComponent {\n\t\tconst dataPlane = ComponentFactory.getIfExists<IDataspaceDataPlaneComponent>(\n\t\t\tthis._dataPlaneComponentType\n\t\t);\n\t\tif (!dataPlane) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"dataPlaneNotRegistered\");\n\t\t}\n\t\treturn dataPlane;\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 rawDatasets: IDataspaceProtocolDataset[] = [datasetPayload];\n\n\t\t\tconst datasets = await Promise.all(rawDatasets.map(async d => this.populateDefaults(d)));\n\n\t\t\tfor (const dataset of datasets) {\n\t\t\t\tconst publishResult = await this._federatedCatalogueComponent.set(\n\t\t\t\t\tdataset as unknown as IDcatDataset,\n\t\t\t\t\tlocalTrustPayload\n\t\t\t\t);\n\t\t\t\tif (isCatalogError(publishResult)) {\n\t\t\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"datasetPublishFailed\", {\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}\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 * 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<IDataspaceProtocolAgreement> = {\n\t\t\t\t\"@context\": \"http://www.w3.org/ns/odrl.jsonld\",\n\t\t\t\t\"@type\": \"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: \"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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qB,CACpD,CAAC;YAEF,MAAM,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC;gBACjC,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,4BAA4B,CAAC,UAAU;gBAC/C,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;gBACd,OAAO,EAAE,+BAA+B;gBACxC,IAAI,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE;aAChD,CAAC,CAAC;QACJ,CAAC;QAED,KAAK,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,EAAE,CAAC;YAC9D,IAAI,CAAC;gBACJ,MAAM,EAAE,CAAC,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;YAC9C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,MAAM,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC;oBACjC,KAAK,EAAE,OAAO;oBACd,MAAM,EAAE,4BAA4B,CAAC,UAAU;oBAC/C,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;oBACd,OAAO,EAAE,0BAA0B;oBACnC,IAAI,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,WAAW,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} from \"@twin.org/rights-management-models\";\nimport {\n\tDataspaceProtocolContexts,\n\tDataspaceProtocolContractNegotiationTypes,\n\tDataspaceProtocolEndpointType,\n\tDataspaceProtocolHelper,\n\tDataspaceProtocolTransferProcessStateType,\n\tDataspaceProtocolTransferProcessTypes,\n\ttype DataspaceProtocolContractNegotiationStateType,\n\ttype IDataspaceProtocolAgreement,\n\ttype IDataspaceProtocolContractNegotiation,\n\ttype IDataspaceProtocolContractNegotiationError,\n\ttype IDataspaceProtocolDataset,\n\ttype IDataspaceProtocolPolicy,\n\ttype IDataspaceProtocolTransferCompletionMessage,\n\ttype IDataspaceProtocolTransferError,\n\ttype IDataspaceProtocolTransferProcess,\n\ttype IDataspaceProtocolTransferRequestMessage,\n\ttype IDataspaceProtocolTransferStartMessage,\n\ttype IDataspaceProtocolTransferSuspensionMessage,\n\ttype IDataspaceProtocolTransferTerminationMessage\n} from \"@twin.org/standards-dataspace-protocol\";\nimport type { IDcatDataset } from \"@twin.org/standards-w3c-dcat\";\nimport { 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 { EndpointProperties } from \"./models/endpointProperties.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 * 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 * Factory key used to look up the data plane component. Resolved lazily at push-time\n\t * (not at construction) so the data plane may register after the control plane is built.\n\t * @internal\n\t */\n\tprivate readonly _dataPlaneComponentType: string;\n\n\t/**\n\t * Policy requester instance for handling negotiation callbacks.\n\t * @internal\n\t */\n\tprivate readonly _policyRequester: DataspaceControlPlanePolicyRequester;\n\n\t/**\n\t * Task scheduler for periodic stalled negotiation cleanup.\n\t * @internal\n\t */\n\tprivate readonly _taskScheduler?: ITaskSchedulerComponent;\n\n\t/**\n\t * 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 * 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.trimTrailingSlashes(\n\t\t\t\t\tStringHelper.trimLeadingSlashes(options.config.dataPlanePath)\n\t\t\t\t)\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: undefined;\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\t// Data plane component is optional and resolved lazily. The control plane is initialised\n\t\t// BEFORE the data plane in engine startup order, so `getRegisteredInstanceTypeOptional`\n\t\t// returns undefined when the engine constructs us — the wiring override can't fire here.\n\t\t// The default therefore matches the engine's actual factory key\n\t\t// (`nameofKebabCase(DataspaceDataPlaneService)`) so the late-bound `requireDataPlane()`\n\t\t// lookup at push time finds it regardless of init order.\n\t\tthis._dataPlaneComponentType =\n\t\t\toptions?.dataPlaneComponentType ?? \"dataspace-data-plane-service\";\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\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\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tts: Date.now(),\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tmessage: \"populatingFederatedCatalogue\"\n\t\t});\n\n\t\tlet registeredCount = 0;\n\t\tlet errorCount = 0;\n\t\tlet totalDatasets = 0;\n\n\t\t// The platform component execute is used so that the dataset publication runs in the\n\t\t// tenant context, also works in single tenant mode\n\t\tawait this._platformComponent.execute(async () => {\n\t\t\t// The tenant context id is set here for each system tenant\n\t\t\tlet cursor: string | undefined;\n\t\t\tdo {\n\t\t\t\tconst page = await this._dataspaceAppDatasetStorage.query(\n\t\t\t\t\tundefined,\n\t\t\t\t\tundefined,\n\t\t\t\t\tundefined,\n\t\t\t\t\tcursor\n\t\t\t\t);\n\t\t\t\tif (Is.arrayValue(page.entities)) {\n\t\t\t\t\tfor (const entity of page.entities) {\n\t\t\t\t\t\tconst appDataset = entity as DataspaceAppDataset;\n\t\t\t\t\t\ttotalDatasets++;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tawait this.publishAppDataset(appDataset);\n\t\t\t\t\t\t\tregisteredCount++;\n\n\t\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\t\tlevel: \"debug\",\n\t\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\t\tmessage: \"datasetRegistered\",\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\tdatasetId: appDataset.id,\n\t\t\t\t\t\t\t\t\tappId: appDataset.appId,\n\t\t\t\t\t\t\t\t\ttenantId: appDataset.tenantId\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\terrorCount++;\n\t\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\t\tmessage: \"datasetPublishFailed\",\n\t\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\tdatasetId: appDataset.id,\n\t\t\t\t\t\t\t\t\tappId: appDataset.appId,\n\t\t\t\t\t\t\t\t\ttenantId: appDataset.tenantId\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcursor = page.cursor;\n\t\t\t} while (Is.stringValue(cursor));\n\t\t});\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tts: Date.now(),\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tmessage: \"federatedCataloguePopulated\",\n\t\t\tdata: {\n\t\t\t\tregisteredCount,\n\t\t\t\terrorCount,\n\t\t\t\ttotalDatasets\n\t\t\t}\n\t\t});\n\n\t\tif (this._taskScheduler) {\n\t\t\tawait this._taskScheduler.addTask(\n\t\t\t\t\"control-plane-negotiation-cleanup\",\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tnextTriggerTime: Date.now(),\n\t\t\t\t\t\tintervalMinutes: 5\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tasync () => {\n\t\t\t\t\tawait this.cleanupStalledNegotiations();\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Stop the service.\n\t * Removes the stalled negotiation cleanup task.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t * @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}\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// CONSUMER SIDE OPERATIONS\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Request a Transfer Process.\n\t * Creates a new Transfer Process in REQUESTED state.\n\t * @param request Transfer request message (DSP compliant).\n\t * @param options Request options.\n\t * @param options.autoStart When true, the provider immediately starts the requested transfer (scheduled\n\t * on the next tick); when omitted/false the provider start must be triggered explicitly.\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\toptions: { autoStart?: boolean } | undefined,\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: IDataspaceProtocolPolicy[];\n\n\t\ttry {\n\t\t\tconst agreement = await this.lookupAgreement(request.agreementId);\n\n\t\t\tif (!agreement) {\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"agreementNotFound\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\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// When auto-start is requested, 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 (options?.autoStart) {\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\tlet callbackAddress = Is.stringValue(this._callbackPath)\n\t\t\t? `${origin}/${this._callbackPath}`\n\t\t\t: origin;\n\t\tif (Is.stringValue(organizationIdentity)) {\n\t\t\tcallbackAddress = HttpUrlHelper.addQueryStringParam(\n\t\t\t\tcallbackAddress,\n\t\t\t\tContextIdKeys.Organization,\n\t\t\t\torganizationIdentity\n\t\t\t);\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// For consumer-initiated PUSH transfers the consumer must supply its /inbox endpoint as\n\t\t// dataAddress so the provider knows where to push ActivityStreams objects. Without it the\n\t\t// provider silently falls through to PULL mode on startTransfer.\n\t\tif (format === DataspaceTransferFormat.HttpDataPush) {\n\t\t\tif (!Is.stringValue(this._dataPlanePath)) {\n\t\t\t\tthrow new GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"pushTransferDataPathNotConfigured\",\n\t\t\t\t\t{ consumerPid }\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet inboxEndpoint = `${origin}/${this._dataPlanePath}/inbox`;\n\t\t\tif (Is.stringValue(organizationIdentity)) {\n\t\t\t\tinboxEndpoint = HttpUrlHelper.addQueryStringParam(\n\t\t\t\t\tinboxEndpoint,\n\t\t\t\t\tContextIdKeys.Organization,\n\t\t\t\t\torganizationIdentity\n\t\t\t\t);\n\t\t\t}\n\t\t\ttransferRequestMessage.dataAddress = {\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.DataAddress,\n\t\t\t\tendpointType: DataspaceProtocolEndpointType.HttpsActivityStreamEndpoint,\n\t\t\t\tendpoint: inboxEndpoint\n\t\t\t};\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(\n\t\t\ttransferRequestMessage,\n\t\t\tundefined,\n\t\t\toutboundToken\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// ============================================================================\n\t\t\t// PULL vs PUSH Transfer Mode Detection (DSP Protocol)\n\t\t\t// ============================================================================\n\t\t\t// The transfer mode is determined by whether the consumer provided a dataAddress\n\t\t\t// in the original TransferRequestMessage:\n\t\t\t//\n\t\t\t// PULL Mode (dataAddress NOT provided by consumer):\n\t\t\t// - Consumer requests data but doesn't specify where to receive it\n\t\t\t// - Provider generates access token and returns dataAddress in TransferStartMessage\n\t\t\t// - Consumer uses the returned endpoint + token to PULL data from provider\n\t\t\t// - Flow: Consumer → GET /entities?consumerPid=X (with Bearer token) → Provider\n\t\t\t//\n\t\t\t// PUSH Mode (dataAddress PROVIDED by consumer):\n\t\t\t// - Consumer specifies endpoint where they want data sent (e.g., webhook URL)\n\t\t\t// - Provider will PUSH data to the consumer's specified endpoint\n\t\t\t// - Flow: Provider → POST to consumer's dataAddress endpoint → Consumer\n\t\t\t//\n\t\t\t// See: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1-err1/#transfer-start-message\n\t\t\t// ============================================================================\n\n\t\t\tif (Is.empty(entity.dataAddress) && entity.format === DataspaceTransferFormat.HttpDataPost) {\n\t\t\t\t// PROVIDER-INITIATED PUSH: Consumer requested push but did not supply an /inbox.\n\t\t\t\t// Provider returns its own /inbox URL + a signed JWT so the consumer can verify\n\t\t\t\t// the incoming activities (HttpData-POST / DataspaceTransferFormat.HttpDataPost).\n\t\t\t\tif (!Is.stringValue(this._dataPlanePath)) {\n\t\t\t\t\treturn transformToTransferError(\n\t\t\t\t\t\tnew GeneralError(\n\t\t\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\t\"pushTransferDataPathNotConfigured\",\n\t\t\t\t\t\t\t{ consumerPid: entity.consumerPid }\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmessage\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (!Is.stringValue(entity.providerIdentity)) {\n\t\t\t\t\tthrow new GeneralError(\n\t\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\"providerIdentityMissing\"\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst pushProviderId = entity.providerIdentity;\n\t\t\t\tconst accessToken = await this._trustComponent.generate(\n\t\t\t\t\tpushProviderId,\n\t\t\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t\t\t{\n\t\t\t\t\t\tsubject: {\n\t\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\t\tagreementId: entity.agreementId,\n\t\t\t\t\t\t\tdatasetId: entity.datasetId\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, \"accessToken\", accessToken);\n\t\t\t\tconst tokenString = accessToken;\n\t\t\t\tlet fullEndpoint = `${publicOrigin}/${this._dataPlanePath}/inbox`;\n\n\t\t\t\t// Bake the provider's organization identity into the /inbox URL so the consumer's\n\t\t\t\t// inbound POST routes to the right organization via TenantProcessor — mirrors the\n\t\t\t\t// pull-mode endpoint baking below.\n\t\t\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\t\t\t\tfullEndpoint = HttpUrlHelper.addQueryStringParam(\n\t\t\t\t\tfullEndpoint,\n\t\t\t\t\tContextIdKeys.Organization,\n\t\t\t\t\torganizationIdentity\n\t\t\t\t);\n\n\t\t\t\tresponse.dataAddress = {\n\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.DataAddress,\n\t\t\t\t\tendpointType: DataspaceProtocolEndpointType.HttpsActivityStreamEndpoint,\n\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\tendpointProperties: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.EndpointProperty,\n\t\t\t\t\t\t\tname: EndpointProperties.Authorization,\n\t\t\t\t\t\t\tvalue: tokenString\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.EndpointProperty,\n\t\t\t\t\t\t\tname: EndpointProperties.AuthType,\n\t\t\t\t\t\t\tvalue: \"bearer\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t};\n\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"pushTransferStarted\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\t\ttransferMode: DataspaceTransferFormat.HttpDataPost\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (Is.empty(entity.dataAddress)) {\n\t\t\t\tif (!Is.stringValue(this._dataPlanePath)) {\n\t\t\t\t\treturn transformToTransferError(\n\t\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"pullTransfersNotSupported\", {\n\t\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\t\tproviderPid: entity.providerPid\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tmessage\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Provider signs the data access token with its own identity.\n\t\t\t\t// The subject contains the transfer context claims that the data plane\n\t\t\t\t// will verify when the consumer presents this token\n\t\t\t\tif (!Is.stringValue(entity.providerIdentity)) {\n\t\t\t\t\tthrow new GeneralError(\n\t\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\"providerIdentityMissing\"\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst pullProviderId = entity.providerIdentity;\n\t\t\t\tconst accessToken = await this._trustComponent.generate(\n\t\t\t\t\tpullProviderId,\n\t\t\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t\t\t{\n\t\t\t\t\t\tsubject: {\n\t\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\t\tagreementId: entity.agreementId,\n\t\t\t\t\t\t\tdatasetId: entity.datasetId\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, \"accessToken\", accessToken);\n\t\t\t\tconst tokenString = accessToken;\n\t\t\t\tlet fullEndpoint = `${publicOrigin}/${this._dataPlanePath}`;\n\n\t\t\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\t\t\t\tfullEndpoint = HttpUrlHelper.addQueryStringParam(\n\t\t\t\t\tfullEndpoint,\n\t\t\t\t\tContextIdKeys.Organization,\n\t\t\t\t\torganizationIdentity\n\t\t\t\t);\n\n\t\t\t\tresponse.dataAddress = {\n\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.DataAddress,\n\t\t\t\t\tendpointType: DataspaceProtocolEndpointType.HttpsQueryEndpoint,\n\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\tendpointProperties: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.EndpointProperty,\n\t\t\t\t\t\t\tname: EndpointProperties.Authorization,\n\t\t\t\t\t\t\tvalue: tokenString\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.EndpointProperty,\n\t\t\t\t\t\t\tname: EndpointProperties.AuthType,\n\t\t\t\t\t\t\tvalue: \"bearer\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t};\n\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"dataAccessTokenGenerated\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\t\ttransferMode: \"PULL\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// PUSH MODE (consumer-initiated): Consumer provided their /inbox endpoint in\n\t\t\t\t// the TransferRequestMessage.dataAddress. Provider responds with its own /inbox\n\t\t\t\t// URL so the consumer knows where to route data notifications.\n\t\t\t\tif (\n\t\t\t\t\t!Is.stringValue(entity.dataAddress?.endpoint) ||\n\t\t\t\t\t!Is.stringValue(entity.dataAddress?.endpointType)\n\t\t\t\t) {\n\t\t\t\t\treturn transformToTransferError(\n\t\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidPushDataAddress\", {\n\t\t\t\t\t\t\tconsumerPid: entity.consumerPid\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tmessage\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (!Is.stringValue(this._dataPlanePath)) {\n\t\t\t\t\treturn transformToTransferError(\n\t\t\t\t\t\tnew GeneralError(\n\t\t\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\t\"pushTransferDataPathNotConfigured\",\n\t\t\t\t\t\t\t{ consumerPid: entity.consumerPid }\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmessage\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tlet fullEndpoint = `${publicOrigin}/${this._dataPlanePath}/inbox`;\n\n\t\t\t\t// Bake the provider's organization identity into the /inbox URL so the consumer's\n\t\t\t\t// inbound POST routes to the right organization via TenantProcessor — mirrors the\n\t\t\t\t// pull-mode endpoint baking.\n\t\t\t\tconst organizationIdentity = await this.resolveContextOrganizationId();\n\t\t\t\tfullEndpoint = HttpUrlHelper.addQueryStringParam(\n\t\t\t\t\tfullEndpoint,\n\t\t\t\t\tContextIdKeys.Organization,\n\t\t\t\t\torganizationIdentity\n\t\t\t\t);\n\n\t\t\t\tresponse.dataAddress = {\n\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.DataAddress,\n\t\t\t\t\tendpointType: DataspaceProtocolEndpointType.HttpsActivityStreamEndpoint,\n\t\t\t\t\tendpoint: fullEndpoint\n\t\t\t\t};\n\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"pushTransferStarted\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\t\ttransferMode: DataspaceTransferFormat.HttpDataPush\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tconst dataPlane = this.requireDataPlane();\n\n\t\t\t\t// Push subscription setup reads the entity from storage and requires state=STARTED.\n\t\t\t\t// Persist STARTED before the data-plane call, and roll back if subscription setup\n\t\t\t\t// fails so the row doesn't leak to STARTED on a setup-time error.\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\ttry {\n\t\t\t\t\tif (previousState === DataspaceProtocolTransferProcessStateType.REQUESTED) {\n\t\t\t\t\t\tawait dataPlane.setupPushSubscription(entity.consumerPid);\n\t\t\t\t\t} else if (previousState === DataspaceProtocolTransferProcessStateType.SUSPENDED) {\n\t\t\t\t\t\tawait dataPlane.resumePushSubscription(entity.consumerPid);\n\t\t\t\t\t}\n\t\t\t\t} catch (subscriptionError) {\n\t\t\t\t\tentity.state = previousState;\n\t\t\t\t\tentity.dateModified = new Date();\n\t\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\t\tthrow subscriptionError;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.STARTED;\n\t\t\tentity.dateModified = new Date();\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessStarted\",\n\t\t\t\tdata: {\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\trole\n\t\t\t\t}\n\t\t\t});\n\n\t\t\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\tif (this.isPushFormat(entity.format)) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.requireDataPlane().teardownPushSubscription(entity.consumerPid);\n\t\t\t\t} catch (teardownError) {\n\t\t\t\t\t// Symmetric rollback: data-plane teardown failed, revert the transfer state\n\t\t\t\t\t// so the client can retry. Without this the storage row is COMPLETED but\n\t\t\t\t\t// the subscription is still flowing, and a retry hits invalidStateForComplete.\n\t\t\t\t\tentity.state = previousState;\n\t\t\t\t\tentity.dateModified = new Date();\n\t\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\t\tthrow teardownError;\n\t\t\t\t}\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\tif (this.isPushFormat(entity.format)) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.requireDataPlane().suspendPushSubscription(entity.consumerPid);\n\t\t\t\t} catch (suspendError) {\n\t\t\t\t\t// Symmetric rollback: data-plane suspend failed, revert transfer state so\n\t\t\t\t\t// a retry can repair the subscription instead of failing invalidStateForSuspend.\n\t\t\t\t\tentity.state = previousState;\n\t\t\t\t\tentity.dateModified = new Date();\n\t\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\t\tthrow suspendError;\n\t\t\t\t}\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\tif (this.isPushFormat(entity.format)) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.requireDataPlane().teardownPushSubscription(entity.consumerPid);\n\t\t\t\t} catch (teardownError) {\n\t\t\t\t\t// Symmetric rollback: data-plane teardown failed, revert transfer state so\n\t\t\t\t\t// a retry can repair the subscription. Terminate is reachable from multiple\n\t\t\t\t\t// states (REQUESTED/STARTED/SUSPENDED), so restore the actual previous one.\n\t\t\t\t\tentity.state = previousState;\n\t\t\t\t\tentity.dateModified = new Date();\n\t\t\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\t\t\t\t\tthrow teardownError;\n\t\t\t\t}\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<IDataspaceProtocolPolicy>(offer));\n\n\t\tif (!Is.arrayValue(catalogOffers)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"datasetHasNoValidOffers\", {\n\t\t\t\tofferId,\n\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\"\n\t\t\t});\n\t\t}\n\n\t\tconst matchingOffer = catalogOffers.find((offer: IDataspaceProtocolPolicy) => {\n\t\t\tconst offerUid = OdrlPolicyHelper.getUid(offer);\n\t\t\treturn offerUid === offerId;\n\t\t});\n\n\t\tif (!matchingOffer) {\n\t\t\tconst availableOffers = catalogOffers\n\t\t\t\t.map((o: IDataspaceProtocolPolicy) => OdrlPolicyHelper.getUid(o) ?? \"unknown\")\n\t\t\t\t.join(\", \");\n\n\t\t\tthrow new NotFoundError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"offerNotFoundInDataset\",\n\t\t\t\tofferId,\n\t\t\t\t{\n\t\t\t\t\tofferId,\n\t\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\",\n\t\t\t\t\tavailableOffers\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"offerFoundInCatalog\",\n\t\t\tdata: {\n\t\t\t\tofferId,\n\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\",\n\t\t\t\tofferType: getJsonLdType(matchingOffer)\n\t\t\t}\n\t\t});\n\n\t\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(DataspaceControlPlaneService.CLASS_NAME, \"datasetRemoveFailed\", {\n\t\t\t\tdatasetId: id,\n\t\t\t\ttenantId: existing.tenantId ?? \"\",\n\t\t\t\tcatalogErrorCode: removeResult.code\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// 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 > DataspaceControlPlaneService._STALLED_NEGOTIATION_THRESHOLD_MS) {\n\t\t\t\tstalled.push(negotiationId);\n\t\t\t}\n\t\t}\n\n\t\tfor (const negotiationId of stalled) {\n\t\t\tthis._policyRequester.removeNegotiation(negotiationId);\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"stalledNegotiationCleanedUp\",\n\t\t\t\tdata: { negotiationId }\n\t\t\t});\n\n\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\ttry {\n\t\t\t\t\tawait cb.onFailed(negotiationId, \"negotiationStalled\");\n\t\t\t\t} catch (error) {\n\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\t\tdata: { key, negotiationId, method: \"onFailed\", error }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (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 * 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<IDataspaceProtocolAgreement> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(agreementId), agreementId);\n\n\t\tlet agreement;\n\t\ttry {\n\t\t\tagreement = await this._policyAdministrationPointComponent.getAgreement(agreementId);\n\t\t} catch (error) {\n\t\t\tif (BaseError.isErrorName(error, NotFoundError.CLASS_NAME)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementLookupFailed\",\n\t\t\t\t{ agreementId },\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\n\t\treturn agreement;\n\t}\n\n\t/**\n\t * Check whether a transfer format string represents a push-mode delivery.\n\t * @param format The transfer format string from the TransferProcess entity.\n\t * @returns True if the format is a push variant (HttpData-PUSH or HttpData-POST).\n\t * @internal\n\t */\n\tprivate isPushFormat(format: string | undefined): boolean {\n\t\treturn (\n\t\t\tformat === DataspaceTransferFormat.HttpDataPush ||\n\t\t\tformat === DataspaceTransferFormat.HttpDataPost\n\t\t);\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: IDataspaceProtocolAgreement): string {\n\t\tif (Is.empty(agreement.target)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"agreementMissingTarget\", {\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement)\n\t\t\t});\n\t\t}\n\n\t\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: IDataspaceProtocolAgreement\n\t): Promise<void> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(datasetId), datasetId);\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\n\t\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<IDataspaceProtocolPolicy>[] {\n\t\t// Support both \"odrl:hasPolicy\" and \"hasPolicy\" to accommodate different catalog implementations\n\t\tif (Is.object<IDcatDataset>(catalogDataset) && !Is.empty(catalogDataset[\"odrl:hasPolicy\"])) {\n\t\t\tconst items = ArrayHelper.fromObjectOrArray(catalogDataset[\"odrl:hasPolicy\"]) ?? [];\n\t\t\treturn items.map(item => ({\n\t\t\t\t...item,\n\t\t\t\t\"@id\": OdrlPolicyHelper.getUid(item) ?? \"\"\n\t\t\t}));\n\t\t}\n\n\t\tif (\n\t\t\tIs.object<IDataspaceProtocolDataset>(catalogDataset) &&\n\t\t\t!Is.empty(catalogDataset.hasPolicy)\n\t\t) {\n\t\t\treturn ArrayHelper.fromObjectOrArray(catalogDataset.hasPolicy) ?? [];\n\t\t}\n\n\t\treturn [];\n\t}\n\n\t/**\n\t * Validate that the Agreement policies match at least one Catalog Offer.\n\t * @param agreement Agreement to validate.\n\t * @param catalogDataset Catalog dataset containing Offers.\n\t * @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: IDataspaceProtocolAgreement,\n\t\tcatalogDataset: IDcatDataset\n\t): Promise<void> {\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\t\tGuards.object<IDcatDataset>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(catalogDataset),\n\t\t\tcatalogDataset\n\t\t);\n\n\t\tconst 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<IDataspaceProtocolPolicy>(offer));\n\n\t\tif (!Is.arrayValue(catalogOffers)) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"catalogDatasetHasNoOffers\",\n\t\t\t\tdata: {\n\t\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\",\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\"\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst matchingOffer = catalogOffers.find(\n\t\t\t(offer: IDataspaceProtocolPolicy) =>\n\t\t\t\tOdrlPolicyHelper.getUid(offer) === OdrlPolicyHelper.getUid(agreement) ||\n\t\t\t\tthis.isPolicyDerivedFrom(agreement, offer)\n\t\t);\n\n\t\tif (!matchingOffer) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"agreementNotMatchingOffer\", {\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\",\n\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\",\n\t\t\t\tavailableOffers: catalogOffers\n\t\t\t\t\t.map((o: IDataspaceProtocolPolicy) => OdrlPolicyHelper.getUid(o) ?? \"unknown\")\n\t\t\t\t\t.join(\", \")\n\t\t\t});\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"agreementMatchedOffer\",\n\t\t\tdata: {\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\",\n\t\t\t\tofferId: OdrlPolicyHelper.getUid(matchingOffer) ?? \"\",\n\t\t\t\tdatasetId\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: IDataspaceProtocolAgreement,\n\t\toffer: IDataspaceProtocolPolicy\n\t): boolean {\n\t\tconst agreementTargets = OdrlPolicyHelper.getTargets(agreement);\n\t\tconst offerTargets = OdrlPolicyHelper.getTargets(offer);\n\n\t\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 * Resolve the data plane component or throw if it isn't registered. Push-mode transfers\n\t * require the data plane; pull-only deployments may run without it.\n\t * @returns The data plane component.\n\t * @throws GeneralError if the data plane component is not registered.\n\t * @internal\n\t */\n\tprivate requireDataPlane(): IDataspaceDataPlaneComponent {\n\t\tconst dataPlane = ComponentFactory.getIfExists<IDataspaceDataPlaneComponent>(\n\t\t\tthis._dataPlaneComponentType\n\t\t);\n\t\tif (!dataPlane) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"dataPlaneNotRegistered\");\n\t\t}\n\t\treturn dataPlane;\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 rawDatasets: IDataspaceProtocolDataset[] = [datasetPayload];\n\n\t\t\tconst datasets = await Promise.all(rawDatasets.map(async d => this.populateDefaults(d)));\n\n\t\t\tfor (const dataset of datasets) {\n\t\t\t\tconst publishResult = await this._federatedCatalogueComponent.set(\n\t\t\t\t\tdataset as unknown as IDcatDataset,\n\t\t\t\t\tlocalTrustPayload\n\t\t\t\t);\n\t\t\t\tif (isCatalogError(publishResult)) {\n\t\t\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"datasetPublishFailed\", {\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}\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 * 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<IDataspaceProtocolAgreement> = {\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"]}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.52](https://github.com/iotaledger/twin-dataspace/compare/dataspace-control-plane-service-v0.0.3-next.51...dataspace-control-plane-service-v0.0.3-next.52) (2026-06-21)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* use inbuilt constants ([256bc03](https://github.com/iotaledger/twin-dataspace/commit/256bc0332bf439fcc16022e0b984b9035e9b0100))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* gate implicit-trust shortcut on local provider endpoint ([#221](https://github.com/iotaledger/twin-dataspace/issues/221)) ([1167c53](https://github.com/iotaledger/twin-dataspace/commit/1167c53d2a94d4672191d278fed69b4f2d607a3c))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Dependencies
|
|
17
|
+
|
|
18
|
+
* The following workspace dependencies were updated
|
|
19
|
+
* dependencies
|
|
20
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.51 to 0.0.3-next.52
|
|
21
|
+
|
|
22
|
+
## [0.0.3-next.51](https://github.com/iotaledger/twin-dataspace/compare/dataspace-control-plane-service-v0.0.3-next.50...dataspace-control-plane-service-v0.0.3-next.51) (2026-06-19)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* local optimization ([#218](https://github.com/iotaledger/twin-dataspace/issues/218)) ([1daae6b](https://github.com/iotaledger/twin-dataspace/commit/1daae6be8be44abdbe2b4c883c35938506cdd34a))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Dependencies
|
|
31
|
+
|
|
32
|
+
* The following workspace dependencies were updated
|
|
33
|
+
* dependencies
|
|
34
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.50 to 0.0.3-next.51
|
|
35
|
+
|
|
3
36
|
## [0.0.3-next.50](https://github.com/iotaledger/twin-dataspace/compare/dataspace-control-plane-service-v0.0.3-next.49...dataspace-control-plane-service-v0.0.3-next.50) (2026-06-19)
|
|
4
37
|
|
|
5
38
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/dataspace-control-plane-service",
|
|
3
|
-
"version": "0.0.3-next.
|
|
3
|
+
"version": "0.0.3-next.52",
|
|
4
4
|
"description": "Implements agreement negotiation and transfer process lifecycle management for control plane operations.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -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.0.3-next.
|
|
22
|
+
"@twin.org/dataspace-models": "0.0.3-next.52",
|
|
23
23
|
"@twin.org/entity": "next",
|
|
24
24
|
"@twin.org/entity-storage-models": "next",
|
|
25
25
|
"@twin.org/federated-catalogue-models": "next",
|