@twin.org/dataspace-control-plane-service 0.0.3-next.39 → 0.0.3-next.40

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.
@@ -56,7 +56,6 @@ export class DataspaceControlPlaneService {
56
56
  /**
57
57
  * Policy Negotiation Point component for contract negotiation.
58
58
  * Used to negotiate agreements with providers before creating transfer processes.
59
-
60
59
  * @internal
61
60
  */
62
61
  _policyNegotiationPointComponent;
@@ -288,7 +287,7 @@ export class DataspaceControlPlaneService {
288
287
  message: "datasetPublishFailed",
289
288
  error: BaseError.fromError(error),
290
289
  data: {
291
- datasetRecordId: appDataset.id,
290
+ datasetId: appDataset.id,
292
291
  appId: appDataset.appId,
293
292
  tenantId: appDataset.tenantId
294
293
  }
@@ -1219,7 +1218,8 @@ export class DataspaceControlPlaneService {
1219
1218
  verifiedIdentity: trustInfo.identity
1220
1219
  }
1221
1220
  });
1222
- const catalogResult = await this._federatedCatalogueComponent.get(datasetId);
1221
+ const localTrustPayload = await this.generateLocalTrustPayload();
1222
+ const catalogResult = await this._federatedCatalogueComponent.get(datasetId, localTrustPayload);
1223
1223
  if (isCatalogError(catalogResult)) {
1224
1224
  if (isCatalogErrorName(catalogResult, NotFoundError.CLASS_NAME)) {
1225
1225
  throw new NotFoundError(DataspaceControlPlaneService.CLASS_NAME, "datasetNotFoundInCatalog", datasetId, {
@@ -1650,14 +1650,15 @@ export class DataspaceControlPlaneService {
1650
1650
  if (existing.tenantId !== tenantId) {
1651
1651
  throw new UnauthorizedError(DataspaceControlPlaneService.CLASS_NAME, "datasetWrongTenant");
1652
1652
  }
1653
- // Side effect first, primary storage last
1654
- const wrappedContextIds = {
1655
- ...((await ContextIdStore.getContextIds()) ?? {}),
1656
- [ContextIdKeys.Tenant]: existing.tenantId
1657
- };
1658
- await ContextIdStore.run(wrappedContextIds, async () => {
1659
- await this._federatedCatalogueComponent.remove(id);
1660
- });
1653
+ const localTrustPayload = await this.generateLocalTrustPayload(existing.tenantId);
1654
+ const removeResult = await this._federatedCatalogueComponent.remove(id, localTrustPayload);
1655
+ if (isCatalogError(removeResult)) {
1656
+ throw new GeneralError(DataspaceControlPlaneService.CLASS_NAME, "datasetRemoveFailed", {
1657
+ datasetId: id,
1658
+ tenantId: existing.tenantId ?? "",
1659
+ catalogErrorCode: removeResult.code
1660
+ });
1661
+ }
1661
1662
  await this._dataspaceAppDatasetStorage.remove(id);
1662
1663
  }
1663
1664
  // ============================================================================
@@ -1835,7 +1836,7 @@ export class DataspaceControlPlaneService {
1835
1836
  }
1836
1837
  /**
1837
1838
  * Extract dataset ID from Agreement target.
1838
- * @param agreement Agreement.
1839
+ * @param format Agreement.
1839
1840
  * @returns Dataset ID.
1840
1841
  * @internal
1841
1842
  */
@@ -1848,6 +1849,7 @@ export class DataspaceControlPlaneService {
1848
1849
  * @param agreement The ODRL agreement containing the target.
1849
1850
  * @returns The dataset ID extracted from the target URN.
1850
1851
  * @throws GeneralError if the agreement target is missing, has no UID, or has multiple targets.
1852
+ * @internal
1851
1853
  */
1852
1854
  extractDatasetId(agreement) {
1853
1855
  if (Is.empty(agreement.target)) {
@@ -1881,7 +1883,8 @@ export class DataspaceControlPlaneService {
1881
1883
  Guards.stringValue(DataspaceControlPlaneService.CLASS_NAME, "datasetId", datasetId);
1882
1884
  Guards.object(DataspaceControlPlaneService.CLASS_NAME, "agreement", agreement);
1883
1885
  // Lookup dataset in catalog
1884
- const catalogResult = await this._federatedCatalogueComponent.get(datasetId);
1886
+ const localTrustPayload = await this.generateLocalTrustPayload();
1887
+ const catalogResult = await this._federatedCatalogueComponent.get(datasetId, localTrustPayload);
1885
1888
  if (isCatalogError(catalogResult)) {
1886
1889
  if (isCatalogErrorName(catalogResult, NotFoundError.CLASS_NAME)) {
1887
1890
  throw new NotFoundError(DataspaceControlPlaneService.CLASS_NAME, "datasetNotInCatalog", datasetId, {
@@ -1911,6 +1914,8 @@ export class DataspaceControlPlaneService {
1911
1914
  /**
1912
1915
  * Extract PID from DSP message and lookup Transfer Process with role detection.
1913
1916
  * @param message DSP protocol message with consumerPid and/or providerPid fields.
1917
+ * @param message.consumerPid The consumer-side PID from the DSP message.
1918
+ * @param message.providerPid The provider-side PID from the DSP message.
1914
1919
  * @returns Transfer Process entity and our role in this transfer.
1915
1920
  * @internal
1916
1921
  */
@@ -2095,8 +2100,7 @@ export class DataspaceControlPlaneService {
2095
2100
  /**
2096
2101
  * Build the tenant-attributed identifier.
2097
2102
  * @param nodeId The node identity (from `ContextIdKeys.Node`).
2098
- * @param tenantId The plaintext tenant id (from `ContextIdKeys.Tenant`), if
2099
- * any. Hashed before insertion into the composite.
2103
+ * @param tenantId The plaintext tenant id (from `ContextIdKeys.Tenant`), if any. Hashed before insertion into the composite.
2100
2104
  * @returns Composite identifier, or undefined if nodeId is missing.
2101
2105
  * @internal
2102
2106
  */
@@ -2109,11 +2113,9 @@ export class DataspaceControlPlaneService {
2109
2113
  /**
2110
2114
  * Parse a composite tenant identifier into its node and tenant-hash portions.
2111
2115
  * @param composite The composite identifier (`nodeDid` or `nodeDid:hash`).
2112
- * @returns The parsed parts. `tenantIdHash` is undefined when the composite
2113
- * has no tenant portion (single-tenant node form).
2116
+ * @returns The parsed parts. `tenantIdHash` is undefined when the composite has no tenant portion (single-tenant node form).
2114
2117
  * @throws GuardError if the input is not a non-empty string.
2115
- * @throws GeneralError if the input does not start with `did:` — the only
2116
- * valid composite identifier shapes carry a DID as the leading portion.
2118
+ * @throws GeneralError if the input does not start with `did:` — the only valid composite identifier shapes carry a DID as the leading portion.
2117
2119
  * @internal
2118
2120
  */
2119
2121
  parseTenantIdentifier(composite) {
@@ -2151,6 +2153,7 @@ export class DataspaceControlPlaneService {
2151
2153
  /**
2152
2154
  * Creates the internal INegotiationCallback that fans out to all registered callbacks.
2153
2155
  * @returns The internal negotiation callback.
2156
+ * @internal
2154
2157
  */
2155
2158
  createInternalCallback() {
2156
2159
  return {
@@ -2209,6 +2212,7 @@ export class DataspaceControlPlaneService {
2209
2212
  * Errors thrown by individual callbacks are logged and swallowed so they cannot affect
2210
2213
  * the DSP protocol state machine or other registrants.
2211
2214
  * @returns The internal transfer callback.
2215
+ * @internal
2212
2216
  */
2213
2217
  createInternalTransferCallback() {
2214
2218
  return {
@@ -2320,6 +2324,7 @@ export class DataspaceControlPlaneService {
2320
2324
  // appDataset's owning tenant. On single-tenant nodes the appDataset has no tenantId,
2321
2325
  // so the assignment writes `Tenant: undefined` — equivalent to no override.
2322
2326
  const contextIds = (await ContextIdStore.getContextIds()) ?? {};
2327
+ const localTrustPayload = await this.generateLocalTrustPayload(appDataset.tenantId);
2323
2328
  const wrappedContextIds = {
2324
2329
  ...contextIds,
2325
2330
  [ContextIdKeys.Tenant]: appDataset.tenantId
@@ -2333,7 +2338,15 @@ export class DataspaceControlPlaneService {
2333
2338
  : [datasetPayload];
2334
2339
  const datasets = await Promise.all(rawDatasets.map(async (d) => this.populateDefaults(d)));
2335
2340
  for (const dataset of datasets) {
2336
- await this._federatedCatalogueComponent.set(dataset);
2341
+ const publishResult = await this._federatedCatalogueComponent.set(dataset, localTrustPayload);
2342
+ if (isCatalogError(publishResult)) {
2343
+ throw new GeneralError(DataspaceControlPlaneService.CLASS_NAME, "datasetPublishFailed", {
2344
+ datasetId: appDataset.id,
2345
+ appId: appDataset.appId,
2346
+ tenantId: appDataset.tenantId ?? "",
2347
+ catalogErrorCode: publishResult.code
2348
+ });
2349
+ }
2337
2350
  }
2338
2351
  });
2339
2352
  }
@@ -2360,5 +2373,16 @@ export class DataspaceControlPlaneService {
2360
2373
  }
2361
2374
  return nodeId;
2362
2375
  }
2376
+ /**
2377
+ * Generate a trust payload representing this node for internal FederatedCatalogue calls.
2378
+ * @param tenantId Optional tenant ID to embed in the token.
2379
+ * @returns The generated trust payload.
2380
+ * @internal
2381
+ */
2382
+ async generateLocalTrustPayload(tenantId) {
2383
+ const nodeId = await this.resolveNodeIdentity();
2384
+ const contextIds = (await ContextIdStore.getContextIds()) ?? {};
2385
+ return this._trustComponent.generate(nodeId, this._overrideTrustGeneratorType, {}, Is.stringValue(tenantId) ? TrustHelper.hashTenantId(tenantId) : undefined, contextIds[ContextIdKeys.Organization]);
2386
+ }
2363
2387
  }
2364
2388
  //# sourceMappingURL=dataspaceControlPlaneService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dataspaceControlPlaneService.js","sourceRoot":"","sources":["../../src/dataspaceControlPlaneService.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EACN,WAAW,EACX,kBAAkB,EAClB,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,EAAE,YAAY,EAAkC,MAAM,wBAAwB,CAAC;AACtF,OAAO,EACN,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,WAAW,EACX,aAAa,EAYb,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,EACN,WAAW,EAGX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oCAAoC,EAAE,MAAM,2CAA2C,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;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,IAAI,YAAY,CAAC,4BAA4B,CAAC,UAAU,EAAE,4BAA4B,CAAC,CAAC;QAC/F,CAAC;QACD,OAAO,MAAM,CAAC;IACf,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IUrlTransformerComponent } from \"@twin.org/api-models\";\nimport type { ITaskSchedulerComponent } from \"@twin.org/background-task-models\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport {\n\tArrayHelper,\n\tAlreadyExistsError,\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 { JsonLdHelper, type JsonLdObjectWithNoContext } from \"@twin.org/data-json-ld\";\nimport {\n\tDataspaceAppFactory,\n\tDataspaceTransferFormat,\n\tTransferProcessRole,\n\tgetJsonLdId,\n\tgetJsonLdType,\n\ttype IDataspaceApp,\n\ttype IDataspaceControlPlaneComponent,\n\ttype IDataspaceControlPlaneResolverComponent,\n\ttype IDataspaceDataPlaneComponent,\n\ttype INegotiationCallback,\n\ttype ITransferCallback,\n\ttype IDataspaceAppDataset,\n\ttype ITransferContext,\n\ttype ITransferProcess,\n\ttype DataspaceAppDataset,\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 {\n\tTrustHelper,\n\ttype ITrustComponent,\n\ttype ITrustVerificationInfo\n} 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 * Matches the base64url encoding of a BLAKE2b-256 hash (32 bytes → 43 base64url\n\t * chars, no padding). Used to discriminate the tenant-hash portion of a\n\t * composite tenant identifier from a bare IOTA DID, whose `<id>` segment is\n\t * always `0x<64-hex>` (66 chars) and cannot match.\n\t * @internal\n\t */\n\tprivate static readonly _TENANT_HASH_PATTERN = /^[\\w-]{43}$/;\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _loggingComponent?: ILoggingComponent;\n\n\t/**\n\t * Policy Administration Point component for Agreement lookup.\n\t * @internal\n\t */\n\tprivate readonly _policyAdministrationPointComponent: IPolicyAdministrationPointComponent;\n\n\t/**\n\t * Policy Negotiation Point component for contract negotiation.\n\t * Used to negotiate agreements with providers before creating transfer processes.\n\n\t * @internal\n\t */\n\tprivate readonly _policyNegotiationPointComponent: IPolicyNegotiationPointComponent;\n\n\t/**\n\t * Policy Negotiation Admin Point component for negotiation history.\n\t * @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 tenant-supplied 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 from hosting component.\n\t * If not configured, PULL transfers are not supported.\n\t * @internal\n\t */\n\tprivate readonly _dataPlanePath?: string;\n\n\t/**\n\t * 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 * 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 * The component type name for the hosting component.\n\t * @internal\n\t */\n\tprivate readonly _urlTransformerComponent: IUrlTransformerComponent;\n\n\t/**\n\t * Create a new instance of DataspaceControlPlaneService.\n\t * @param options The options for the service.\n\t */\n\tconstructor(options?: IDataspaceControlPlaneServiceConstructorOptions) {\n\t\tthis._loggingComponent = ComponentFactory.getIfExists<ILoggingComponent>(\n\t\t\toptions?.loggingComponentType ?? \"logging\"\n\t\t);\n\n\t\t// Retrieve PAP component with default\n\t\tthis._policyAdministrationPointComponent =\n\t\t\tComponentFactory.get<IPolicyAdministrationPointComponent>(\n\t\t\t\toptions?.policyAdministrationPointComponentType ?? \"policy-administration-point\"\n\t\t\t);\n\n\t\t// Retrieve PNP component with default\n\t\tthis._policyNegotiationPointComponent = ComponentFactory.get<IPolicyNegotiationPointComponent>(\n\t\t\toptions?.policyNegotiationPointComponentType ?? \"policy-negotiation-point\"\n\t\t);\n\n\t\t// Retrieve PNAP component 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._taskScheduler = ComponentFactory.getIfExists<ITaskSchedulerComponent>(\n\t\t\toptions?.taskSchedulerComponentType ?? \"task-scheduler\"\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._urlTransformerComponent = ComponentFactory.get<IUrlTransformerComponent>(\n\t\t\toptions?.urlTransformerComponentType ?? \"url-transformer\"\n\t\t);\n\n\t\tthis._negotiationCallbacks = new Map();\n\t\tthis._transferCallbacks = new Map();\n\t\tthis._internalTransferCallback = this.createInternalTransferCallback();\n\t\tthis._remoteControlPlaneComponentType =\n\t\t\toptions?.remoteControlPlaneComponentType ?? \"dataspace-control-plane-rest-client\";\n\n\t\tconst internalCallback = this.createInternalCallback();\n\n\t\tthis._policyRequester = new DataspaceControlPlanePolicyRequester(\n\t\t\toptions?.loggingComponentType ?? \"logging\",\n\t\t\tinternalCallback\n\t\t);\n\n\t\tPolicyRequesterFactory.register(\n\t\t\tDataspaceControlPlaneService._REQUESTER_TYPE,\n\t\t\t() => this._policyRequester\n\t\t);\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn DataspaceControlPlaneService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Register a callback to receive negotiation state change notifications.\n\t * Upstream modules (e.g. supply-chain) register their callback here.\n\t * @param key A unique key identifying this callback registration.\n\t * @param callback The callback interface to register.\n\t */\n\tpublic registerNegotiationCallback(key: string, callback: INegotiationCallback): void {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(key), key);\n\t\tthis._negotiationCallbacks.set(key, callback);\n\t}\n\n\t/**\n\t * Unregister a previously registered negotiation callback.\n\t * @param key The key used when registering the callback.\n\t */\n\tpublic unregisterNegotiationCallback(key: string): void {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(key), key);\n\t\tthis._negotiationCallbacks.delete(key);\n\t}\n\n\t/**\n\t * 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 * Populates the Federated Catalogue with datasets from registered apps\n\t * and starts the stalled negotiation cleanup task. Also captures the node\n\t * identity from ContextIdStore when tenant-token encryption is configured\n\t * (required to derive the vault key name `${nodeId}/${signingKeyName}`).\n\t * @param nodeLoggingComponentType The node logging component type.\n\t */\n\tpublic async start(nodeLoggingComponentType?: string): Promise<void> {\n\t\tconst engine = EngineCoreFactory.getIfExists(\"engine\");\n\t\t// Skip if no engine exists OR if this is a clone instance\n\t\tif (Is.empty(engine) || engine.isClone()) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"debug\",\n\t\t\t\tts: Date.now(),\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tmessage: \"engineCloneStart\"\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tts: Date.now(),\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tmessage: \"populatingFederatedCatalogue\"\n\t\t});\n\n\t\tlet registeredCount = 0;\n\t\tlet errorCount = 0;\n\t\tlet totalDatasets = 0;\n\n\t\t// Walk stored dataspace app datasets one page at a time and publish each in its\n\t\t// owning tenant's context. Memory stays bounded to one page.\n\t\tlet cursor: string | undefined;\n\t\tdo {\n\t\t\tconst page = await this._dataspaceAppDatasetStorage.query(\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t\tcursor\n\t\t\t);\n\t\t\tif (Is.arrayValue(page.entities)) {\n\t\t\t\tfor (const entity of page.entities) {\n\t\t\t\t\tconst appDataset = entity as DataspaceAppDataset;\n\t\t\t\t\ttotalDatasets++;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.publishAppDataset(appDataset);\n\t\t\t\t\t\tregisteredCount++;\n\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"debug\",\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tmessage: \"datasetRegistered\",\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tdatasetId: appDataset.id,\n\t\t\t\t\t\t\t\tappId: appDataset.appId,\n\t\t\t\t\t\t\t\ttenantId: appDataset.tenantId\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\terrorCount++;\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tmessage: \"datasetPublishFailed\",\n\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tdatasetRecordId: appDataset.id,\n\t\t\t\t\t\t\t\tappId: appDataset.appId,\n\t\t\t\t\t\t\t\ttenantId: appDataset.tenantId\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcursor = page.cursor;\n\t\t} while (Is.stringValue(cursor));\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 */\n\tpublic async stop(nodeLoggingComponentType?: string): Promise<void> {\n\t\tif (this._taskScheduler) {\n\t\t\tawait this._taskScheduler.removeTask(\"control-plane-negotiation-cleanup\");\n\t\t}\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// CONSUMER SIDE OPERATIONS\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Request a Transfer Process.\n\t * Creates a new Transfer Process in REQUESTED state.\n\t * @param request Transfer request message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state REQUESTED, or TransferError if the operation fails.\n\t *\n\t * Role Performed: Provider\n\t * Called by: Consumer when it wants to request a new Transfer Process\n\t */\n\tpublic async requestTransfer(\n\t\trequest: IDataspaceProtocolTransferRequestMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\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\tagreementId: request.agreementId,\n\t\t\t\t\t\thint: \"Agreement must exist before transfer. Use contract negotiation to create agreement first.\"\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"agreementNotFound\",\n\t\t\t\t\trequest.agreementId,\n\t\t\t\t\t{\n\t\t\t\t\t\tagreementId: request.agreementId,\n\t\t\t\t\t\thint: \"Perform contract negotiation first to create an agreement\"\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst assigneeIdentity = OdrlPolicyHelper.extractAssigneeIdentity(agreement);\n\t\t\tconst assigneeIds = ArrayHelper.fromObjectOrArray<string>(assigneeIdentity);\n\n\t\t\t// The agreement's assignee is stamped by the provider as the consumer's composite identity (`consumerNodeDid:hash(consumerTenantId)`).\n\t\t\tconst callerComposite = this.buildCallerComposite(trustInfo);\n\t\t\tif (!assigneeIds.includes(callerComposite)) {\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 = callerComposite;\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 requestContextIds = await ContextIdStore.getContextIds();\n\t\tconst requestTenantId = requestContextIds?.[ContextIdKeys.Tenant];\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\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\ttenantId: Is.stringValue(requestTenantId) ? requestTenantId : undefined,\n\t\t\tdataAddress: request.dataAddress,\n\t\t\tdateCreated: now.toISOString(),\n\t\t\tdateModified: now.toISOString()\n\t\t};\n\n\t\tawait this._transferProcessStorage.set(storageEntity);\n\n\t\tconst entity: ITransferProcess = this.storageEntityToModel(storageEntity);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"transferProcessInitiated\",\n\t\t\tdata: {\n\t\t\t\tconsumerPid: request.consumerPid,\n\t\t\t\tproviderPid,\n\t\t\t\tagreementId: request.agreementId\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tstate: entity.state\n\t\t};\n\t}\n\n\t/**\n\t * Start 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 publicOrigin The public origin URL of this control plane (used as callbackAddress).\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 startDataTransfer(\n\t\tagreementId: string,\n\t\tproviderEndpoint: string,\n\t\tpublicOrigin: 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(publicOrigin), publicOrigin);\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(format), format);\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\"startDataTransfer\"\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: \"startingDataTransfer\",\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\tconst callerComposite = this.buildCallerComposite(trustInfo);\n\t\tif (!assigneeIds.includes(callerComposite)) {\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 callbackAddress = StringHelper.trimTrailingSlashes(publicOrigin);\n\n\t\t// Fetch context once and reuse across the PUSH dataAddress, trust token, and storage entity.\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst nodeIdentity = contextIds?.[ContextIdKeys.Node];\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, \"nodeIdentity\", nodeIdentity);\n\t\tconst tenantId = contextIds?.[ContextIdKeys.Tenant];\n\t\tconst organizationIdentity = contextIds?.[ContextIdKeys.Organization];\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 = `${callbackAddress}/${this._dataPlanePath}/inbox`;\n\t\t\tif (Is.stringValue(tenantId)) {\n\t\t\t\tinboxEndpoint = await this._urlTransformerComponent.addEncryptedQueryParamToUrl(\n\t\t\t\t\tinboxEndpoint,\n\t\t\t\t\t\"tenant\",\n\t\t\t\t\ttenantId\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\tnodeIdentity,\n\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t{ subject: { consumerPid, agreementId } },\n\t\t\tIs.stringValue(tenantId) ? TrustHelper.hashTenantId(tenantId) : undefined,\n\t\t\torganizationIdentity\n\t\t);\n\n\t\t// Create a remote REST client pointed at the provider endpoint and call requestTransfer.\n\t\tconst remoteControlPlane = ComponentFactory.create<IDataspaceControlPlaneComponent>(\n\t\t\tthis._remoteControlPlaneComponentType,\n\t\t\t{ endpoint: providerEndpoint, pathPrefix: \"\" }\n\t\t);\n\n\t\tconst result = await remoteControlPlane.requestTransfer(transferRequestMessage, outboundToken);\n\n\t\tif (getJsonLdType(result) === DataspaceProtocolTransferProcessTypes.TransferError) {\n\t\t\tconst transferError = result as { code?: string };\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"transferRequestRejectedByProvider\",\n\t\t\t\t{\n\t\t\t\t\tagreementId,\n\t\t\t\t\tproviderEndpoint,\n\t\t\t\t\tcode: transferError.code\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst transferProcess = result as { providerPid?: string };\n\n\t\tif (!Is.stringValue(transferProcess.providerPid)) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"providerPidMissingInResponse\",\n\t\t\t\t{ consumerPid }\n\t\t\t);\n\t\t}\n\n\t\tconst now = new Date();\n\n\t\tconst storageEntity: TransferProcess = {\n\t\t\tid: Converter.bytesToHex(RandomHelper.generate(32)),\n\t\t\tconsumerPid,\n\t\t\tproviderPid: transferProcess.providerPid,\n\t\t\tstate: DataspaceProtocolTransferProcessStateType.REQUESTED,\n\t\t\tagreementId,\n\t\t\tdatasetId,\n\t\t\tconsumerIdentity: callerComposite,\n\t\t\tproviderIdentity,\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\ttenantId: Is.stringValue(tenantId) ? tenantId : undefined,\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: \"dataTransferStarted\",\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\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 publicOrigin The public origin URL of this service.\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Start Message (DSP compliant) with dataAddress for PULL transfers, or TransferError if the operation fails.\n\t *\n\t * Role Performed: Provider / Consumer\n\t */\n\tpublic async startTransfer(\n\t\tmessage: IDataspaceProtocolTransferStartMessage,\n\t\tpublicOrigin: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferStartMessage | IDataspaceProtocolTransferError> {\n\t\tpublicOrigin = StringHelper.trimTrailingSlashes(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\tthis.validateCallerIsProvider(this.buildCallerComposite(trustInfo), entity);\n\n\t\t\t// Only the tenant that owns this transfer can mutate it.\n\t\t\t// Skipped on single-tenant nodes (entity.tenantId undefined).\n\t\t\tconst callingTenantId = await this.resolveCallingTenantId();\n\t\t\tif (\n\t\t\t\tIs.stringValue(entity.tenantId) &&\n\t\t\t\tIs.stringValue(callingTenantId) &&\n\t\t\t\tentity.tenantId !== callingTenantId\n\t\t\t) {\n\t\t\t\tthrow new UnauthorizedError(DataspaceControlPlaneService.CLASS_NAME, \"transferWrongTenant\");\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// 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\t// providerIdentity is a composite `nodeDid:hash(tenantId)`\n\t\t\t\tconst pushProviderId = this.parseTenantIdentifier(entity.providerIdentity);\n\t\t\t\tconst accessToken = await this._trustComponent.generate(\n\t\t\t\t\tpushProviderId.nodeDid,\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\tpushProviderId.tenantIdHash\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 tenant token into the /inbox URL so the consumer's\n\t\t\t\t// inbound POST routes to the right tenant via TenantProcessor — mirrors the\n\t\t\t\t// pull-mode endpoint baking below.\n\t\t\t\tconst inboxContextIds1 = await ContextIdStore.getContextIds();\n\t\t\t\tconst inboxTenantId1 = inboxContextIds1?.[ContextIdKeys.Tenant];\n\t\t\t\tif (Is.stringValue(inboxTenantId1)) {\n\t\t\t\t\tfullEndpoint = await this._urlTransformerComponent.addEncryptedQueryParamToUrl(\n\t\t\t\t\t\tfullEndpoint,\n\t\t\t\t\t\t\"tenant\",\n\t\t\t\t\t\tinboxTenantId1\n\t\t\t\t\t);\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. Parse\n\t\t\t\t// the composite providerIdentity to extract the signing nodeDid and\n\t\t\t\t// the tenant-hash to embed as `tid`.\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 = this.parseTenantIdentifier(entity.providerIdentity);\n\t\t\t\tconst accessToken = await this._trustComponent.generate(\n\t\t\t\t\tpullProviderId.nodeDid,\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\tpullProviderId.tenantIdHash\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 contextIds = await ContextIdStore.getContextIds();\n\t\t\t\tconst tenantId = contextIds?.[ContextIdKeys.Tenant];\n\n\t\t\t\tif (Is.stringValue(tenantId)) {\n\t\t\t\t\tfullEndpoint = await this._urlTransformerComponent.addEncryptedQueryParamToUrl(\n\t\t\t\t\t\tfullEndpoint,\n\t\t\t\t\t\t\"tenant\",\n\t\t\t\t\t\ttenantId\n\t\t\t\t\t);\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 tenant token into the /inbox URL so the consumer's\n\t\t\t\t// inbound POST routes to the right tenant via TenantProcessor — mirrors the\n\t\t\t\t// pull-mode endpoint baking.\n\t\t\t\tconst inboxContextIds2 = await ContextIdStore.getContextIds();\n\t\t\t\tconst inboxTenantId2 = inboxContextIds2?.[ContextIdKeys.Tenant];\n\t\t\t\tif (Is.stringValue(inboxTenantId2)) {\n\t\t\t\t\tfullEndpoint = await this._urlTransformerComponent.addEncryptedQueryParamToUrl(\n\t\t\t\t\t\tfullEndpoint,\n\t\t\t\t\t\t\"tenant\",\n\t\t\t\t\t\tinboxTenantId2\n\t\t\t\t\t);\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\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.STARTED\n\t\t\t\t);\n\t\t\t\tawait this._internalTransferCallback.onStarted(entity.consumerPid, response);\n\t\t\t}\n\n\t\t\treturn response;\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// SHARED STATE MANAGEMENT OPERATIONS (Either Side)\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Complete a Transfer Process.\n\t * @param message Transfer completion message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state COMPLETED, or TransferError if the operation fails.\n\t */\n\tpublic async completeTransfer(\n\t\tmessage: IDataspaceProtocolTransferCompletionMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\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\tthis.validateCallerIsConsumer(this.buildCallerComposite(trustInfo), entity);\n\n\t\t\t// Only the tenant that owns this transfer can mutate it.\n\t\t\t// Skipped on single-tenant nodes (entity.tenantId undefined).\n\t\t\tconst callingTenantId = await this.resolveCallingTenantId();\n\t\t\tif (\n\t\t\t\tIs.stringValue(entity.tenantId) &&\n\t\t\t\tIs.stringValue(callingTenantId) &&\n\t\t\t\tentity.tenantId !== callingTenantId\n\t\t\t) {\n\t\t\t\tthrow new UnauthorizedError(DataspaceControlPlaneService.CLASS_NAME, \"transferWrongTenant\");\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\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\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t/**\n\t * Suspend a Transfer Process.\n\t * @param message Transfer suspension message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state SUSPENDED, or TransferError if the operation fails.\n\t */\n\tpublic async suspendTransfer(\n\t\tmessage: IDataspaceProtocolTransferSuspensionMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\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\tthis.validateCallerIsTransferParty(this.buildCallerComposite(trustInfo), entity);\n\n\t\t\t// S2 belt-and-braces: only the tenant that owns this transfer can mutate it.\n\t\t\t// Skipped on single-tenant nodes (entity.tenantId undefined).\n\t\t\tconst callingTenantId = await this.resolveCallingTenantId();\n\t\t\tif (\n\t\t\t\tIs.stringValue(entity.tenantId) &&\n\t\t\t\tIs.stringValue(callingTenantId) &&\n\t\t\t\tentity.tenantId !== callingTenantId\n\t\t\t) {\n\t\t\t\tthrow new UnauthorizedError(DataspaceControlPlaneService.CLASS_NAME, \"transferWrongTenant\");\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}\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t/**\n\t * Terminate a Transfer Process.\n\t * @param message Transfer termination message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state TERMINATED, or TransferError if the operation fails.\n\t */\n\tpublic async terminateTransfer(\n\t\tmessage: IDataspaceProtocolTransferTerminationMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\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\tthis.validateCallerIsTransferParty(this.buildCallerComposite(trustInfo), entity);\n\n\t\t\t// Only the tenant that owns this transfer can mutate it.\n\t\t\t// Skipped on single-tenant nodes (entity.tenantId undefined).\n\t\t\tconst callingTenantId = await this.resolveCallingTenantId();\n\t\t\tif (\n\t\t\t\tIs.stringValue(entity.tenantId) &&\n\t\t\t\tIs.stringValue(callingTenantId) &&\n\t\t\t\tentity.tenantId !== callingTenantId\n\t\t\t) {\n\t\t\t\tthrow new UnauthorizedError(DataspaceControlPlaneService.CLASS_NAME, \"transferWrongTenant\");\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}\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t/**\n\t * Get Transfer Process state.\n\t * @param pid Process ID (consumerPid or providerPid).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with current state, or TransferError if the operation fails.\n\t */\n\tpublic async getTransferProcess(\n\t\tpid: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\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\tthis.validateCallerIsTransferParty(this.buildCallerComposite(trustInfo), 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: \"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 publicOrigin The public origin URL of this control plane (for callbacks).\n\t * @param trustPayload The trust payload for authentication.\n\t * @returns The negotiation ID. Use the registered callback for completion notification.\n\t */\n\tpublic async negotiateAgreement(\n\t\tdatasetId: string,\n\t\tofferId: string,\n\t\tproviderEndpoint: string,\n\t\tpublicOrigin: string,\n\t\ttrustPayload: unknown\n\t): Promise<{ negotiationId: string }> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(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\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(publicOrigin), 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 catalogResult = await this._federatedCatalogueComponent.get(datasetId);\n\n\t\tif (isCatalogError(catalogResult)) {\n\t\t\tif (isCatalogErrorName(catalogResult, NotFoundError.CLASS_NAME)) {\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"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\tconst negotiationId = await this._policyNegotiationPointComponent.sendRequestToProvider(\n\t\t\tproviderEndpoint,\n\t\t\tDataspaceControlPlaneService._REQUESTER_TYPE,\n\t\t\tofferId,\n\t\t\tpublicOrigin\n\t\t);\n\n\t\tif (!negotiationId) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"negotiationInitiationFailed\",\n\t\t\t\t{\n\t\t\t\t\tofferId,\n\t\t\t\t\tproviderEndpoint\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tthis._policyRequester.trackNegotiation(negotiationId);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationInitiated\",\n\t\t\tdata: { negotiationId, offerId }\n\t\t});\n\n\t\treturn { negotiationId };\n\t}\n\n\t/**\n\t * Get the current state of a contract negotiation.\n\t * @param negotiationId The unique identifier of the negotiation.\n\t * @param trustPayload The trust payload for authentication.\n\t * @returns Current state of the negotiation.\n\t */\n\tpublic async getNegotiation(\n\t\tnegotiationId: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolContractNegotiation | IDataspaceProtocolContractNegotiationError> {\n\t\tGuards.stringValue(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(negotiationId),\n\t\t\tnegotiationId\n\t\t);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"getNegotiation\",\n\t\t\tdata: { negotiationId }\n\t\t});\n\n\t\tconst result = await this._policyNegotiationPointComponent.getNegotiation(\n\t\t\tnegotiationId,\n\t\t\ttrustPayload\n\t\t);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationStateRetrieved\",\n\t\t\tdata: {\n\t\t\t\tnegotiationId,\n\t\t\t\ttype: getJsonLdType(result),\n\t\t\t\tstate: (result as IDataspaceProtocolContractNegotiation).state\n\t\t\t}\n\t\t});\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Get negotiation history.\n\t * @param state Optional filter by negotiation state.\n\t * @param cursor Optional pagination cursor.\n\t * @param trustPayload Trust payload for authentication.\n\t * @returns List of negotiation history entries with pagination.\n\t */\n\tpublic async getNegotiationHistory(\n\t\tstate: string | undefined,\n\t\tcursor: string | undefined,\n\t\ttrustPayload: unknown\n\t): Promise<{\n\t\tnegotiations: {\n\t\t\tnegotiation:\n\t\t\t\t| IDataspaceProtocolContractNegotiation\n\t\t\t\t| IDataspaceProtocolContractNegotiationError;\n\t\t\tcreatedAt: string;\n\t\t\tofferId?: string;\n\t\t\tagreementId?: string;\n\t\t}[];\n\t\tcursor?: string;\n\t\tcount: number;\n\t}> {\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"getNegotiationHistory\",\n\t\t\tdata: { state, cursor }\n\t\t});\n\n\t\tconst { items: pnapNegotiations, cursor: nextCursor } =\n\t\t\tawait this._policyNegotiationAdminPointComponent.query(\n\t\t\t\tstate as DataspaceProtocolContractNegotiationStateType | undefined,\n\t\t\t\tcursor\n\t\t\t);\n\n\t\tconst negotiations = pnapNegotiations.map(pnapNeg => {\n\t\t\tconst dspNegotiation: IDataspaceProtocolContractNegotiation = {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractNegotiation,\n\t\t\t\tconsumerPid: pnapNeg.id,\n\t\t\t\tproviderPid: pnapNeg.correlationId,\n\t\t\t\tstate: pnapNeg.state\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tnegotiation: dspNegotiation,\n\t\t\t\tcreatedAt: pnapNeg.dateCreated,\n\t\t\t\tofferId: OdrlPolicyHelper.getUid(pnapNeg.offer),\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(pnapNeg.agreement)\n\t\t\t};\n\t\t});\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationHistoryRetrieved\",\n\t\t\tdata: {\n\t\t\t\tcount: negotiations.length,\n\t\t\t\tstate,\n\t\t\t\thasCursor: Boolean(nextCursor)\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tnegotiations,\n\t\t\tcursor: nextCursor,\n\t\t\tcount: negotiations.length\n\t\t};\n\t}\n\n\t// ============================================================================\n\t// RESOLVER METHODS - IDataspaceControlPlaneResolverComponent\n\t// ============================================================================\n\n\t/**\n\t * Resolve consumerPid to Transfer Context.\n\t * @param consumerPid Consumer Process ID.\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Context with Agreement, datasetId, and Transfer Process metadata.\n\t */\n\tpublic async resolveConsumerPid(\n\t\tconsumerPid: string,\n\t\ttrustPayload: unknown\n\t): Promise<ITransferContext> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(consumerPid), consumerPid);\n\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"resolveConsumerPid\");\n\n\t\tconst storageEntity = await this._transferProcessStorage.get(consumerPid);\n\n\t\tif (!storageEntity) {\n\t\t\tthrow new NotFoundError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"transferProcessNotFound\",\n\t\t\t\tundefined,\n\t\t\t\t{ consumerPid }\n\t\t\t);\n\t\t}\n\n\t\tconst entity = this.storageEntityToModel(storageEntity);\n\n\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.TERMINATED) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"transferProcessTerminated\", {\n\t\t\t\tconsumerPid\n\t\t\t});\n\t\t}\n\n\t\tconst agreement = await this.lookupAgreement(entity.agreementId);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst currentComposite = this.buildTenantIdentifier(\n\t\t\tcontextIds?.[ContextIdKeys.Node],\n\t\t\tcontextIds?.[ContextIdKeys.Tenant]\n\t\t);\n\n\t\t// Identity is `nodeDid:hash(tenantId)` (or just `nodeDid` in\n\t\t// single-tenant). Without a node DID in context we cannot derive any\n\t\t// caller identity at all.\n\t\tif (!Is.stringValue(currentComposite)) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"organizationContextMissing\",\n\t\t\t\t{\n\t\t\t\t\tconsumerPid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerIds = ArrayHelper.fromObjectOrArray<string>(assignerIdentity);\n\n\t\tif (!assignerIds.includes(currentComposite)) {\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\texpectedComposite: currentComposite,\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: contextIds?.[ContextIdKeys.Organization]\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tagreement,\n\t\t\tdatasetId: entity.datasetId,\n\t\t\tofferId: entity.offerId,\n\t\t\tstate: entity.state,\n\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\tdataAddress: entity.dataAddress\n\t\t};\n\t}\n\n\t/**\n\t * Resolve providerPid to Transfer Context.\n\t * @param providerPid Provider Process ID.\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Context with Agreement, datasetId, and Transfer Process metadata.\n\t */\n\tpublic async resolveProviderPid(\n\t\tproviderPid: string,\n\t\ttrustPayload: unknown\n\t): Promise<ITransferContext> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(providerPid), providerPid);\n\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"resolveProviderPid\");\n\n\t\tconst { entity } = await this.lookupTransferByPid(providerPid);\n\n\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.TERMINATED) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"transferProcessTerminatedProvider\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst agreement = await this.lookupAgreement(entity.agreementId);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst currentComposite = this.buildTenantIdentifier(\n\t\t\tcontextIds?.[ContextIdKeys.Node],\n\t\t\tcontextIds?.[ContextIdKeys.Tenant]\n\t\t);\n\n\t\tif (!Is.stringValue(currentComposite)) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"organizationContextMissingProvider\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerIds = ArrayHelper.fromObjectOrArray<string>(assignerIdentity);\n\n\t\tif (!assignerIds.includes(currentComposite)) {\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\texpectedComposite: currentComposite,\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: contextIds?.[ContextIdKeys.Organization]\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 tenant.\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 tenantId = await this.resolveCallingTenantId();\n\t\tconst nodeIdentity = await this.resolveNodeIdentity();\n\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\tnodeIdentity,\n\t\t\ttenantId,\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\treturn resolvedId;\n\t}\n\n\t/**\n\t * Get a dataset record owned by the calling tenant.\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 tenantId = await this.resolveCallingTenantId();\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.tenantId !== tenantId) {\n\t\t\tthrow new UnauthorizedError(DataspaceControlPlaneService.CLASS_NAME, \"datasetWrongTenant\");\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 tenant.\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 tenantId = await this.resolveCallingTenantId();\n\t\tconst page = await this._dataspaceAppDatasetStorage.query(\n\t\t\tIs.stringValue(tenantId)\n\t\t\t\t? {\n\t\t\t\t\t\tproperty: \"tenantId\",\n\t\t\t\t\t\tvalue: tenantId,\n\t\t\t\t\t\tcomparison: ComparisonOperator.Equals\n\t\t\t\t\t}\n\t\t\t\t: undefined,\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 tenant.\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 */\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 tenantId = await this.resolveCallingTenantId();\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.tenantId !== tenantId) {\n\t\t\tthrow new UnauthorizedError(DataspaceControlPlaneService.CLASS_NAME, \"datasetWrongTenant\");\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\t}\n\n\t/**\n\t * Delete a dataspace app dataset owned by the calling tenant.\n\t * @param id The stored app dataset id.\n\t */\n\tpublic async deleteAppDataset(id: string): Promise<void> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(id), id);\n\n\t\tconst tenantId = await this.resolveCallingTenantId();\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.tenantId !== tenantId) {\n\t\t\tthrow new UnauthorizedError(DataspaceControlPlaneService.CLASS_NAME, \"datasetWrongTenant\");\n\t\t}\n\n\t\t// Side effect first, primary storage last\n\t\tconst wrappedContextIds = {\n\t\t\t...((await ContextIdStore.getContextIds()) ?? {}),\n\t\t\t[ContextIdKeys.Tenant]: existing.tenantId\n\t\t};\n\t\tawait ContextIdStore.run(wrappedContextIds, async () => {\n\t\t\tawait this._federatedCatalogueComponent.remove(id);\n\t\t});\n\n\t\tawait this._dataspaceAppDatasetStorage.remove(id);\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 * @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 * Convert a storage entity to model.\n\t * @param storageEntity The entity from storage.\n\t * @returns The model representation.\n\t * @internal\n\t */\n\tprivate storageEntityToModel(storageEntity: TransferProcess): ITransferProcess {\n\t\treturn {\n\t\t\tid: storageEntity.id,\n\t\t\tconsumerPid: storageEntity.consumerPid,\n\t\t\tproviderPid: storageEntity.providerPid,\n\t\t\tstate: storageEntity.state,\n\t\t\tagreementId: storageEntity.agreementId,\n\t\t\tdatasetId: storageEntity.datasetId,\n\t\t\tofferId: storageEntity.offerId,\n\t\t\tconsumerIdentity: storageEntity.consumerIdentity,\n\t\t\tproviderIdentity: storageEntity.providerIdentity,\n\t\t\tformat: storageEntity.format,\n\t\t\tcallbackAddress: storageEntity.callbackAddress,\n\t\t\ttenantId: storageEntity.tenantId,\n\t\t\tdateCreated: new Date(storageEntity.dateCreated),\n\t\t\tdateModified: new Date(storageEntity.dateModified),\n\t\t\tpolicies: storageEntity.policies,\n\t\t\tdataAddress: storageEntity.dataAddress\n\t\t};\n\t}\n\n\t/**\n\t * Convert a model to storage entity.\n\t * @param entity The model representation.\n\t * @returns The entity for storage.\n\t * @internal\n\t */\n\tprivate modelToStorageEntity(entity: ITransferProcess): TransferProcess {\n\t\treturn {\n\t\t\tid: entity.id,\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tstate: entity.state,\n\t\t\tagreementId: entity.agreementId,\n\t\t\tdatasetId: entity.datasetId,\n\t\t\tofferId: entity.offerId,\n\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\tformat: entity.format,\n\t\t\tcallbackAddress: entity.callbackAddress,\n\t\t\ttenantId: entity.tenantId,\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 * Build the caller's composite identity (`nodeDid:tenantIdHash`) from a\n\t * verified trust payload.\n\t * @param trustInfo The verification info from `TrustHelper.verifyTrust`.\n\t * @returns The composite identity.\n\t * @internal\n\t */\n\tprivate buildCallerComposite(trustInfo: ITrustVerificationInfo): string {\n\t\tGuards.object<ITrustVerificationInfo>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(trustInfo),\n\t\t\ttrustInfo\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(trustInfo.identity),\n\t\t\ttrustInfo.identity\n\t\t);\n\t\treturn Is.stringValue(trustInfo.tenantId)\n\t\t\t? `${trustInfo.identity}:${trustInfo.tenantId}`\n\t\t\t: trustInfo.identity;\n\t}\n\n\t/**\n\t * Validate that the caller's verified identity matches the consumer of a transfer process.\n\t * @param callerComposite The caller's composite identity (`nodeDid:tenantIdHash`).\n\t * @param entity The transfer process entity.\n\t * @throws UnauthorizedError if the caller is not the consumer.\n\t * @internal\n\t */\n\tprivate validateCallerIsConsumer(callerComposite: string, entity: ITransferProcess): void {\n\t\tif (callerComposite !== entity.consumerIdentity) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"callerNotAuthorizedAsConsumer\"\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Validate that the caller's verified identity matches the provider of a transfer process.\n\t * @param callerComposite The caller's composite identity (`nodeDid:tenantIdHash`).\n\t * @param entity The transfer process entity.\n\t * @throws UnauthorizedError if the caller is not the provider.\n\t * @internal\n\t */\n\tprivate validateCallerIsProvider(callerComposite: string, entity: ITransferProcess): void {\n\t\tif (callerComposite !== entity.providerIdentity) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"callerNotAuthorizedAsProvider\"\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Validate that the caller's verified identity matches either the consumer or provider of a transfer process.\n\t * @param callerComposite The caller's composite identity (`nodeDid:tenantIdHash`).\n\t * @param entity The transfer process entity.\n\t * @throws UnauthorizedError if the caller is not a party to the transfer.\n\t * @internal\n\t */\n\tprivate validateCallerIsTransferParty(callerComposite: string, entity: ITransferProcess): void {\n\t\tif (\n\t\t\tcallerComposite !== entity.consumerIdentity &&\n\t\t\tcallerComposite !== entity.providerIdentity\n\t\t) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"callerNotAuthorizedForTransfer\"\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Extract dataset ID from Agreement target.\n\t * @param agreement Agreement.\n\t * @returns Dataset ID.\n\t * @internal\n\t */\n\tprivate 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 */\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 * @internal\n\t */\n\tprivate async validateCatalogDataset(\n\t\tdatasetId: string,\n\t\tagreement: IDataspaceProtocolAgreement\n\t): Promise<void> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(datasetId), datasetId);\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\n\t\t// Lookup dataset in catalog\n\t\tconst catalogResult = await this._federatedCatalogueComponent.get(datasetId);\n\n\t\tif (isCatalogError(catalogResult)) {\n\t\t\tif (isCatalogErrorName(catalogResult, NotFoundError.CLASS_NAME)) {\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"datasetNotInCatalog\",\n\t\t\t\t\tdatasetId,\n\t\t\t\t\t{\n\t\t\t\t\t\tdatasetId,\n\t\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement)\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"catalogLookupFailed\", {\n\t\t\t\tdatasetId,\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\",\n\t\t\t\terrorCode: catalogResult.code\n\t\t\t});\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"catalogDatasetFound\",\n\t\t\tdata: {\n\t\t\t\tdatasetId,\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement) ?? \"\",\n\t\t\t\tdatasetTitle: catalogResult[\"dcterms:title\"]\n\t\t\t}\n\t\t});\n\n\t\tawait this.validateAgreementMatchesOffer(agreement, catalogResult);\n\t}\n\n\t/**\n\t * Extract PID from DSP message and lookup Transfer Process with role detection.\n\t * @param message DSP protocol message with consumerPid and/or providerPid fields.\n\t * @returns Transfer Process entity and our role in this transfer.\n\t * @internal\n\t */\n\tprivate async lookupTransferByMessage(message: {\n\t\tconsumerPid?: string;\n\t\tproviderPid?: string;\n\t}): Promise<{\n\t\tentity: ITransferProcess;\n\t\trole: TransferProcessRole;\n\t}> {\n\t\tconst pid = message.consumerPid ?? message.providerPid;\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, \"pid\", pid);\n\n\t\treturn this.lookupTransferByPid(pid);\n\t}\n\n\t/**\n\t * Lookup Transfer Process by PID and determine our role.\n\t * @param pid Either consumerPid or providerPid.\n\t * @returns Transfer Process entity and our role in this transfer.\n\t * @internal\n\t */\n\tprivate async lookupTransferByPid(pid: string): Promise<{\n\t\tentity: ITransferProcess;\n\t\trole: TransferProcessRole;\n\t}> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(pid), pid);\n\n\t\t// Check if pid is a consumerPid (primary key lookup)\n\t\tconst storageEntity = await this._transferProcessStorage.get(pid);\n\n\t\tif (storageEntity) {\n\t\t\treturn {\n\t\t\t\tentity: this.storageEntityToModel(storageEntity),\n\t\t\t\trole: TransferProcessRole.Consumer\n\t\t\t};\n\t\t}\n\n\t\t// Check if pid is a providerPid (secondary key lookup)\n\t\tconst providerPidEntity = await this._transferProcessStorage.get(pid, \"providerPid\");\n\t\tif (providerPidEntity) {\n\t\t\treturn {\n\t\t\t\tentity: this.storageEntityToModel(providerPidEntity),\n\t\t\t\trole: TransferProcessRole.Provider\n\t\t\t};\n\t\t}\n\n\t\tthrow new NotFoundError(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\"transferProcessNotFound\",\n\t\t\tpid,\n\t\t\t{\n\t\t\t\tpid\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Get raw policy entries from a catalog dataset.\n\t * @param catalogDataset Catalog dataset.\n\t * @returns Raw policy entries.\n\t * @internal\n\t */\n\tprivate getCatalogDatasetPolicies(\n\t\tcatalogDataset: IDcatDataset | IDataspaceProtocolDataset\n\t): JsonLdObjectWithNoContext<IDataspaceProtocolPolicy>[] {\n\t\t// Support both \"odrl:hasPolicy\" and \"hasPolicy\" to accommodate different catalog implementations\n\t\tif (Is.object<IDcatDataset>(catalogDataset) && !Is.empty(catalogDataset[\"odrl:hasPolicy\"])) {\n\t\t\tconst items = ArrayHelper.fromObjectOrArray(catalogDataset[\"odrl:hasPolicy\"]) ?? [];\n\t\t\treturn items.map(item => ({\n\t\t\t\t...item,\n\t\t\t\t\"@id\": OdrlPolicyHelper.getUid(item) ?? \"\"\n\t\t\t}));\n\t\t}\n\n\t\tif (\n\t\t\tIs.object<IDataspaceProtocolDataset>(catalogDataset) &&\n\t\t\t!Is.empty(catalogDataset.hasPolicy)\n\t\t) {\n\t\t\treturn ArrayHelper.fromObjectOrArray(catalogDataset.hasPolicy) ?? [];\n\t\t}\n\n\t\treturn [];\n\t}\n\n\t/**\n\t * Validate that the Agreement policies match at least one Catalog Offer.\n\t * @param agreement Agreement to validate.\n\t * @param catalogDataset Catalog dataset containing Offers.\n\t * @internal\n\t */\n\tprivate async validateAgreementMatchesOffer(\n\t\tagreement: IDataspaceProtocolAgreement,\n\t\tcatalogDataset: IDcatDataset\n\t): Promise<void> {\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\t\tGuards.object<IDcatDataset>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(catalogDataset),\n\t\t\tcatalogDataset\n\t\t);\n\n\t\tconst 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\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\t// The publisher attribution is always the composite identifier\n\t\tconst compositePublisher = this.buildTenantIdentifier(\n\t\t\tcontextIds?.[ContextIdKeys.Node],\n\t\t\tcontextIds?.[ContextIdKeys.Tenant]\n\t\t);\n\t\tif (compositePublisher) {\n\t\t\treturn { ...dataset, \"dcterms:publisher\": compositePublisher };\n\t\t}\n\t\treturn dataset;\n\t}\n\n\t/**\n\t * Build the tenant-attributed identifier.\n\t * @param nodeId The node identity (from `ContextIdKeys.Node`).\n\t * @param tenantId The plaintext tenant id (from `ContextIdKeys.Tenant`), if\n\t * any. Hashed before insertion into the composite.\n\t * @returns Composite identifier, or undefined if nodeId is missing.\n\t * @internal\n\t */\n\tprivate buildTenantIdentifier(\n\t\tnodeId: string | undefined,\n\t\ttenantId: string | undefined\n\t): string | undefined {\n\t\tif (!Is.stringValue(nodeId)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn Is.stringValue(tenantId) ? `${nodeId}:${TrustHelper.hashTenantId(tenantId)}` : nodeId;\n\t}\n\n\t/**\n\t * Parse a composite tenant identifier into its node and tenant-hash portions.\n\t * @param composite The composite identifier (`nodeDid` or `nodeDid:hash`).\n\t * @returns The parsed parts. `tenantIdHash` is undefined when the composite\n\t * has no tenant portion (single-tenant node form).\n\t * @throws GuardError if the input is not a non-empty string.\n\t * @throws GeneralError if the input does not start with `did:` — the only\n\t * valid composite identifier shapes carry a DID as the leading portion.\n\t * @internal\n\t */\n\tprivate parseTenantIdentifier(composite: string): {\n\t\tnodeDid: string;\n\t\ttenantIdHash?: string;\n\t} {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(composite), composite);\n\t\tif (!composite.startsWith(\"did:\")) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"invalidCompositeIdentifier\",\n\t\t\t\t{ composite }\n\t\t\t);\n\t\t}\n\t\tconst lastColon = composite.lastIndexOf(\":\");\n\t\tif (lastColon === -1) {\n\t\t\treturn { nodeDid: composite };\n\t\t}\n\t\tconst candidateHash = composite.slice(lastColon + 1);\n\t\tif (DataspaceControlPlaneService._TENANT_HASH_PATTERN.test(candidateHash)) {\n\t\t\treturn {\n\t\t\t\tnodeDid: composite.slice(0, lastColon),\n\t\t\t\ttenantIdHash: candidateHash\n\t\t\t};\n\t\t}\n\t\treturn { nodeDid: composite };\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 */\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 */\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 in its owning tenant's context.\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\t// Override `Tenant` in the context wrap so federated catalogue captures the\n\t\t// appDataset's owning tenant. On single-tenant nodes the appDataset has no tenantId,\n\t\t// so the assignment writes `Tenant: undefined` — equivalent to no override.\n\t\tconst contextIds = (await ContextIdStore.getContextIds()) ?? {};\n\t\tconst wrappedContextIds = {\n\t\t\t...contextIds,\n\t\t\t[ContextIdKeys.Tenant]: appDataset.tenantId\n\t\t};\n\t\tawait ContextIdStore.run(wrappedContextIds, async () => {\n\t\t\tconst app = DataspaceAppFactory.get<IDataspaceApp>(appDataset.appId);\n\t\t\tconst datasetPayload = this.restampDatasetId(appDataset.dataset, appDataset.id);\n\t\t\tconst overrideHandler = app.datasetsHandled?.bind(app);\n\t\t\tconst rawDatasets: IDataspaceProtocolDataset[] = overrideHandler\n\t\t\t\t? await overrideHandler(datasetPayload, appDataset.tenantId ?? \"\")\n\t\t\t\t: [datasetPayload];\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\tawait this._federatedCatalogueComponent.set(dataset as unknown as IDcatDataset);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Resolve the calling tenant from the request context.\n\t * @returns The owning tenant id, or undefined for single-tenant nodes.\n\t * @internal\n\t */\n\tprivate async resolveCallingTenantId(): Promise<string | undefined> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst tenantId = contextIds?.[ContextIdKeys.Tenant];\n\t\treturn Is.stringValue(tenantId) ? tenantId : undefined;\n\t}\n\n\t/**\n\t * Resolve the node identity from the current context, throwing if absent.\n\t * @returns The owning node identity.\n\t * @internal\n\t */\n\tprivate async resolveNodeIdentity(): Promise<string> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst nodeId = contextIds?.[ContextIdKeys.Node];\n\t\tif (!Is.stringValue(nodeId)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"datasetNodeContextRequired\");\n\t\t}\n\t\treturn nodeId;\n\t}\n}\n"]}
1
+ {"version":3,"file":"dataspaceControlPlaneService.js","sourceRoot":"","sources":["../../src/dataspaceControlPlaneService.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EACN,WAAW,EACX,kBAAkB,EAClB,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,EAAE,YAAY,EAAkC,MAAM,wBAAwB,CAAC;AACtF,OAAO,EACN,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,WAAW,EACX,aAAa,EAYb,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,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CACnC,MAAM,EACN,IAAI,CAAC,2BAA2B,EAChC,EAAE,EACF,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,EACzE,UAAU,CAAC,aAAa,CAAC,YAAY,CAAC,CACtC,CAAC;IACH,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IUrlTransformerComponent } from \"@twin.org/api-models\";\nimport type { ITaskSchedulerComponent } from \"@twin.org/background-task-models\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport {\n\tArrayHelper,\n\tAlreadyExistsError,\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 { JsonLdHelper, type JsonLdObjectWithNoContext } from \"@twin.org/data-json-ld\";\nimport {\n\tDataspaceAppFactory,\n\tDataspaceTransferFormat,\n\tTransferProcessRole,\n\tgetJsonLdId,\n\tgetJsonLdType,\n\ttype IDataspaceApp,\n\ttype IDataspaceControlPlaneComponent,\n\ttype IDataspaceControlPlaneResolverComponent,\n\ttype IDataspaceDataPlaneComponent,\n\ttype INegotiationCallback,\n\ttype ITransferCallback,\n\ttype IDataspaceAppDataset,\n\ttype ITransferContext,\n\ttype ITransferProcess,\n\ttype DataspaceAppDataset,\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 {\n\tTrustHelper,\n\ttype ITrustComponent,\n\ttype ITrustVerificationInfo\n} 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 * Matches the base64url encoding of a BLAKE2b-256 hash (32 bytes → 43 base64url\n\t * chars, no padding). Used to discriminate the tenant-hash portion of a\n\t * composite tenant identifier from a bare IOTA DID, whose `<id>` segment is\n\t * always `0x<64-hex>` (66 chars) and cannot match.\n\t * @internal\n\t */\n\tprivate static readonly _TENANT_HASH_PATTERN = /^[\\w-]{43}$/;\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 tenant-supplied 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 from hosting component.\n\t * If not configured, PULL transfers are not supported.\n\t * @internal\n\t */\n\tprivate readonly _dataPlanePath?: string;\n\n\t/**\n\t * 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 * 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 * The component type name for the hosting component.\n\t * @internal\n\t */\n\tprivate readonly _urlTransformerComponent: IUrlTransformerComponent;\n\n\t/**\n\t * Create a new instance of DataspaceControlPlaneService.\n\t * @param options The options for the service.\n\t */\n\tconstructor(options?: IDataspaceControlPlaneServiceConstructorOptions) {\n\t\tthis._loggingComponent = ComponentFactory.getIfExists<ILoggingComponent>(\n\t\t\toptions?.loggingComponentType ?? \"logging\"\n\t\t);\n\n\t\t// Retrieve PAP component with default\n\t\tthis._policyAdministrationPointComponent =\n\t\t\tComponentFactory.get<IPolicyAdministrationPointComponent>(\n\t\t\t\toptions?.policyAdministrationPointComponentType ?? \"policy-administration-point\"\n\t\t\t);\n\n\t\t// Retrieve PNP component with default\n\t\tthis._policyNegotiationPointComponent = ComponentFactory.get<IPolicyNegotiationPointComponent>(\n\t\t\toptions?.policyNegotiationPointComponentType ?? \"policy-negotiation-point\"\n\t\t);\n\n\t\t// Retrieve PNAP component 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._taskScheduler = ComponentFactory.getIfExists<ITaskSchedulerComponent>(\n\t\t\toptions?.taskSchedulerComponentType ?? \"task-scheduler\"\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._urlTransformerComponent = ComponentFactory.get<IUrlTransformerComponent>(\n\t\t\toptions?.urlTransformerComponentType ?? \"url-transformer\"\n\t\t);\n\n\t\tthis._negotiationCallbacks = new Map();\n\t\tthis._transferCallbacks = new Map();\n\t\tthis._internalTransferCallback = this.createInternalTransferCallback();\n\t\tthis._remoteControlPlaneComponentType =\n\t\t\toptions?.remoteControlPlaneComponentType ?? \"dataspace-control-plane-rest-client\";\n\n\t\tconst internalCallback = this.createInternalCallback();\n\n\t\tthis._policyRequester = new DataspaceControlPlanePolicyRequester(\n\t\t\toptions?.loggingComponentType ?? \"logging\",\n\t\t\tinternalCallback\n\t\t);\n\n\t\tPolicyRequesterFactory.register(\n\t\t\tDataspaceControlPlaneService._REQUESTER_TYPE,\n\t\t\t() => this._policyRequester\n\t\t);\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn DataspaceControlPlaneService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Register a callback to receive negotiation state change notifications.\n\t * Upstream modules (e.g. supply-chain) register their callback here.\n\t * @param key A unique key identifying this callback registration.\n\t * @param callback The callback interface to register.\n\t */\n\tpublic registerNegotiationCallback(key: string, callback: INegotiationCallback): void {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(key), key);\n\t\tthis._negotiationCallbacks.set(key, callback);\n\t}\n\n\t/**\n\t * Unregister a previously registered negotiation callback.\n\t * @param key The key used when registering the callback.\n\t */\n\tpublic unregisterNegotiationCallback(key: string): void {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(key), key);\n\t\tthis._negotiationCallbacks.delete(key);\n\t}\n\n\t/**\n\t * 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 * Populates the Federated Catalogue with datasets from registered apps\n\t * and starts the stalled negotiation cleanup task. Also captures the node\n\t * identity from ContextIdStore when tenant-token encryption is configured\n\t * (required to derive the vault key name `${nodeId}/${signingKeyName}`).\n\t * @param nodeLoggingComponentType The node logging component type.\n\t */\n\tpublic async start(nodeLoggingComponentType?: string): Promise<void> {\n\t\tconst engine = EngineCoreFactory.getIfExists(\"engine\");\n\t\t// Skip if no engine exists OR if this is a clone instance\n\t\tif (Is.empty(engine) || engine.isClone()) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"debug\",\n\t\t\t\tts: Date.now(),\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tmessage: \"engineCloneStart\"\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tts: Date.now(),\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tmessage: \"populatingFederatedCatalogue\"\n\t\t});\n\n\t\tlet registeredCount = 0;\n\t\tlet errorCount = 0;\n\t\tlet totalDatasets = 0;\n\n\t\t// Walk stored dataspace app datasets one page at a time and publish each in its\n\t\t// owning tenant's context. Memory stays bounded to one page.\n\t\tlet cursor: string | undefined;\n\t\tdo {\n\t\t\tconst page = await this._dataspaceAppDatasetStorage.query(\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t\tcursor\n\t\t\t);\n\t\t\tif (Is.arrayValue(page.entities)) {\n\t\t\t\tfor (const entity of page.entities) {\n\t\t\t\t\tconst appDataset = entity as DataspaceAppDataset;\n\t\t\t\t\ttotalDatasets++;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.publishAppDataset(appDataset);\n\t\t\t\t\t\tregisteredCount++;\n\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"debug\",\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tmessage: \"datasetRegistered\",\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tdatasetId: appDataset.id,\n\t\t\t\t\t\t\t\tappId: appDataset.appId,\n\t\t\t\t\t\t\t\ttenantId: appDataset.tenantId\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\terrorCount++;\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tmessage: \"datasetPublishFailed\",\n\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tdatasetId: appDataset.id,\n\t\t\t\t\t\t\t\tappId: appDataset.appId,\n\t\t\t\t\t\t\t\ttenantId: appDataset.tenantId\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcursor = page.cursor;\n\t\t} while (Is.stringValue(cursor));\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 */\n\tpublic async stop(nodeLoggingComponentType?: string): Promise<void> {\n\t\tif (this._taskScheduler) {\n\t\t\tawait this._taskScheduler.removeTask(\"control-plane-negotiation-cleanup\");\n\t\t}\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// CONSUMER SIDE OPERATIONS\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Request a Transfer Process.\n\t * Creates a new Transfer Process in REQUESTED state.\n\t * @param request Transfer request message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state REQUESTED, or TransferError if the operation fails.\n\t *\n\t * Role Performed: Provider\n\t * Called by: Consumer when it wants to request a new Transfer Process\n\t */\n\tpublic async requestTransfer(\n\t\trequest: IDataspaceProtocolTransferRequestMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\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\tagreementId: request.agreementId,\n\t\t\t\t\t\thint: \"Agreement must exist before transfer. Use contract negotiation to create agreement first.\"\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"agreementNotFound\",\n\t\t\t\t\trequest.agreementId,\n\t\t\t\t\t{\n\t\t\t\t\t\tagreementId: request.agreementId,\n\t\t\t\t\t\thint: \"Perform contract negotiation first to create an agreement\"\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst assigneeIdentity = OdrlPolicyHelper.extractAssigneeIdentity(agreement);\n\t\t\tconst assigneeIds = ArrayHelper.fromObjectOrArray<string>(assigneeIdentity);\n\n\t\t\t// The agreement's assignee is stamped by the provider as the consumer's composite identity (`consumerNodeDid:hash(consumerTenantId)`).\n\t\t\tconst callerComposite = this.buildCallerComposite(trustInfo);\n\t\t\tif (!assigneeIds.includes(callerComposite)) {\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 = callerComposite;\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 requestContextIds = await ContextIdStore.getContextIds();\n\t\tconst requestTenantId = requestContextIds?.[ContextIdKeys.Tenant];\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\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\ttenantId: Is.stringValue(requestTenantId) ? requestTenantId : undefined,\n\t\t\tdataAddress: request.dataAddress,\n\t\t\tdateCreated: now.toISOString(),\n\t\t\tdateModified: now.toISOString()\n\t\t};\n\n\t\tawait this._transferProcessStorage.set(storageEntity);\n\n\t\tconst entity: ITransferProcess = this.storageEntityToModel(storageEntity);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"transferProcessInitiated\",\n\t\t\tdata: {\n\t\t\t\tconsumerPid: request.consumerPid,\n\t\t\t\tproviderPid,\n\t\t\t\tagreementId: request.agreementId\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tstate: entity.state\n\t\t};\n\t}\n\n\t/**\n\t * Start 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 publicOrigin The public origin URL of this control plane (used as callbackAddress).\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 startDataTransfer(\n\t\tagreementId: string,\n\t\tproviderEndpoint: string,\n\t\tpublicOrigin: 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(publicOrigin), publicOrigin);\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(format), format);\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\"startDataTransfer\"\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: \"startingDataTransfer\",\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\tconst callerComposite = this.buildCallerComposite(trustInfo);\n\t\tif (!assigneeIds.includes(callerComposite)) {\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 callbackAddress = StringHelper.trimTrailingSlashes(publicOrigin);\n\n\t\t// Fetch context once and reuse across the PUSH dataAddress, trust token, and storage entity.\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst nodeIdentity = contextIds?.[ContextIdKeys.Node];\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, \"nodeIdentity\", nodeIdentity);\n\t\tconst tenantId = contextIds?.[ContextIdKeys.Tenant];\n\t\tconst organizationIdentity = contextIds?.[ContextIdKeys.Organization];\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 = `${callbackAddress}/${this._dataPlanePath}/inbox`;\n\t\t\tif (Is.stringValue(tenantId)) {\n\t\t\t\tinboxEndpoint = await this._urlTransformerComponent.addEncryptedQueryParamToUrl(\n\t\t\t\t\tinboxEndpoint,\n\t\t\t\t\t\"tenant\",\n\t\t\t\t\ttenantId\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\tnodeIdentity,\n\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t{ subject: { consumerPid, agreementId } },\n\t\t\tIs.stringValue(tenantId) ? TrustHelper.hashTenantId(tenantId) : undefined,\n\t\t\torganizationIdentity\n\t\t);\n\n\t\t// Create a remote REST client pointed at the provider endpoint and call requestTransfer.\n\t\tconst remoteControlPlane = ComponentFactory.create<IDataspaceControlPlaneComponent>(\n\t\t\tthis._remoteControlPlaneComponentType,\n\t\t\t{ endpoint: providerEndpoint, pathPrefix: \"\" }\n\t\t);\n\n\t\tconst result = await remoteControlPlane.requestTransfer(transferRequestMessage, outboundToken);\n\n\t\tif (getJsonLdType(result) === DataspaceProtocolTransferProcessTypes.TransferError) {\n\t\t\tconst transferError = result as { code?: string };\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"transferRequestRejectedByProvider\",\n\t\t\t\t{\n\t\t\t\t\tagreementId,\n\t\t\t\t\tproviderEndpoint,\n\t\t\t\t\tcode: transferError.code\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst transferProcess = result as { providerPid?: string };\n\n\t\tif (!Is.stringValue(transferProcess.providerPid)) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"providerPidMissingInResponse\",\n\t\t\t\t{ consumerPid }\n\t\t\t);\n\t\t}\n\n\t\tconst now = new Date();\n\n\t\tconst storageEntity: TransferProcess = {\n\t\t\tid: Converter.bytesToHex(RandomHelper.generate(32)),\n\t\t\tconsumerPid,\n\t\t\tproviderPid: transferProcess.providerPid,\n\t\t\tstate: DataspaceProtocolTransferProcessStateType.REQUESTED,\n\t\t\tagreementId,\n\t\t\tdatasetId,\n\t\t\tconsumerIdentity: callerComposite,\n\t\t\tproviderIdentity,\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\ttenantId: Is.stringValue(tenantId) ? tenantId : undefined,\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: \"dataTransferStarted\",\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\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 publicOrigin The public origin URL of this service.\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Start Message (DSP compliant) with dataAddress for PULL transfers, or TransferError if the operation fails.\n\t *\n\t * Role Performed: Provider / Consumer\n\t */\n\tpublic async startTransfer(\n\t\tmessage: IDataspaceProtocolTransferStartMessage,\n\t\tpublicOrigin: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferStartMessage | IDataspaceProtocolTransferError> {\n\t\tpublicOrigin = StringHelper.trimTrailingSlashes(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\tthis.validateCallerIsProvider(this.buildCallerComposite(trustInfo), entity);\n\n\t\t\t// Only the tenant that owns this transfer can mutate it.\n\t\t\t// Skipped on single-tenant nodes (entity.tenantId undefined).\n\t\t\tconst callingTenantId = await this.resolveCallingTenantId();\n\t\t\tif (\n\t\t\t\tIs.stringValue(entity.tenantId) &&\n\t\t\t\tIs.stringValue(callingTenantId) &&\n\t\t\t\tentity.tenantId !== callingTenantId\n\t\t\t) {\n\t\t\t\tthrow new UnauthorizedError(DataspaceControlPlaneService.CLASS_NAME, \"transferWrongTenant\");\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// 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\t// providerIdentity is a composite `nodeDid:hash(tenantId)`\n\t\t\t\tconst pushProviderId = this.parseTenantIdentifier(entity.providerIdentity);\n\t\t\t\tconst accessToken = await this._trustComponent.generate(\n\t\t\t\t\tpushProviderId.nodeDid,\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\tpushProviderId.tenantIdHash\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 tenant token into the /inbox URL so the consumer's\n\t\t\t\t// inbound POST routes to the right tenant via TenantProcessor — mirrors the\n\t\t\t\t// pull-mode endpoint baking below.\n\t\t\t\tconst inboxContextIds1 = await ContextIdStore.getContextIds();\n\t\t\t\tconst inboxTenantId1 = inboxContextIds1?.[ContextIdKeys.Tenant];\n\t\t\t\tif (Is.stringValue(inboxTenantId1)) {\n\t\t\t\t\tfullEndpoint = await this._urlTransformerComponent.addEncryptedQueryParamToUrl(\n\t\t\t\t\t\tfullEndpoint,\n\t\t\t\t\t\t\"tenant\",\n\t\t\t\t\t\tinboxTenantId1\n\t\t\t\t\t);\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. Parse\n\t\t\t\t// the composite providerIdentity to extract the signing nodeDid and\n\t\t\t\t// the tenant-hash to embed as `tid`.\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 = this.parseTenantIdentifier(entity.providerIdentity);\n\t\t\t\tconst accessToken = await this._trustComponent.generate(\n\t\t\t\t\tpullProviderId.nodeDid,\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\tpullProviderId.tenantIdHash\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 contextIds = await ContextIdStore.getContextIds();\n\t\t\t\tconst tenantId = contextIds?.[ContextIdKeys.Tenant];\n\n\t\t\t\tif (Is.stringValue(tenantId)) {\n\t\t\t\t\tfullEndpoint = await this._urlTransformerComponent.addEncryptedQueryParamToUrl(\n\t\t\t\t\t\tfullEndpoint,\n\t\t\t\t\t\t\"tenant\",\n\t\t\t\t\t\ttenantId\n\t\t\t\t\t);\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 tenant token into the /inbox URL so the consumer's\n\t\t\t\t// inbound POST routes to the right tenant via TenantProcessor — mirrors the\n\t\t\t\t// pull-mode endpoint baking.\n\t\t\t\tconst inboxContextIds2 = await ContextIdStore.getContextIds();\n\t\t\t\tconst inboxTenantId2 = inboxContextIds2?.[ContextIdKeys.Tenant];\n\t\t\t\tif (Is.stringValue(inboxTenantId2)) {\n\t\t\t\t\tfullEndpoint = await this._urlTransformerComponent.addEncryptedQueryParamToUrl(\n\t\t\t\t\t\tfullEndpoint,\n\t\t\t\t\t\t\"tenant\",\n\t\t\t\t\t\tinboxTenantId2\n\t\t\t\t\t);\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\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.STARTED\n\t\t\t\t);\n\t\t\t\tawait this._internalTransferCallback.onStarted(entity.consumerPid, response);\n\t\t\t}\n\n\t\t\treturn response;\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// SHARED STATE MANAGEMENT OPERATIONS (Either Side)\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Complete a Transfer Process.\n\t * @param message Transfer completion message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state COMPLETED, or TransferError if the operation fails.\n\t */\n\tpublic async completeTransfer(\n\t\tmessage: IDataspaceProtocolTransferCompletionMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\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\tthis.validateCallerIsConsumer(this.buildCallerComposite(trustInfo), entity);\n\n\t\t\t// Only the tenant that owns this transfer can mutate it.\n\t\t\t// Skipped on single-tenant nodes (entity.tenantId undefined).\n\t\t\tconst callingTenantId = await this.resolveCallingTenantId();\n\t\t\tif (\n\t\t\t\tIs.stringValue(entity.tenantId) &&\n\t\t\t\tIs.stringValue(callingTenantId) &&\n\t\t\t\tentity.tenantId !== callingTenantId\n\t\t\t) {\n\t\t\t\tthrow new UnauthorizedError(DataspaceControlPlaneService.CLASS_NAME, \"transferWrongTenant\");\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\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\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t/**\n\t * Suspend a Transfer Process.\n\t * @param message Transfer suspension message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state SUSPENDED, or TransferError if the operation fails.\n\t */\n\tpublic async suspendTransfer(\n\t\tmessage: IDataspaceProtocolTransferSuspensionMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\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\tthis.validateCallerIsTransferParty(this.buildCallerComposite(trustInfo), entity);\n\n\t\t\t// S2 belt-and-braces: only the tenant that owns this transfer can mutate it.\n\t\t\t// Skipped on single-tenant nodes (entity.tenantId undefined).\n\t\t\tconst callingTenantId = await this.resolveCallingTenantId();\n\t\t\tif (\n\t\t\t\tIs.stringValue(entity.tenantId) &&\n\t\t\t\tIs.stringValue(callingTenantId) &&\n\t\t\t\tentity.tenantId !== callingTenantId\n\t\t\t) {\n\t\t\t\tthrow new UnauthorizedError(DataspaceControlPlaneService.CLASS_NAME, \"transferWrongTenant\");\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}\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t/**\n\t * Terminate a Transfer Process.\n\t * @param message Transfer termination message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state TERMINATED, or TransferError if the operation fails.\n\t */\n\tpublic async terminateTransfer(\n\t\tmessage: IDataspaceProtocolTransferTerminationMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\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\tthis.validateCallerIsTransferParty(this.buildCallerComposite(trustInfo), entity);\n\n\t\t\t// Only the tenant that owns this transfer can mutate it.\n\t\t\t// Skipped on single-tenant nodes (entity.tenantId undefined).\n\t\t\tconst callingTenantId = await this.resolveCallingTenantId();\n\t\t\tif (\n\t\t\t\tIs.stringValue(entity.tenantId) &&\n\t\t\t\tIs.stringValue(callingTenantId) &&\n\t\t\t\tentity.tenantId !== callingTenantId\n\t\t\t) {\n\t\t\t\tthrow new UnauthorizedError(DataspaceControlPlaneService.CLASS_NAME, \"transferWrongTenant\");\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}\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t/**\n\t * Get Transfer Process state.\n\t * @param pid Process ID (consumerPid or providerPid).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with current state, or TransferError if the operation fails.\n\t */\n\tpublic async getTransferProcess(\n\t\tpid: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\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\tthis.validateCallerIsTransferParty(this.buildCallerComposite(trustInfo), 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: \"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 publicOrigin The public origin URL of this control plane (for callbacks).\n\t * @param trustPayload The trust payload for authentication.\n\t * @returns The negotiation ID. Use the registered callback for completion notification.\n\t */\n\tpublic async negotiateAgreement(\n\t\tdatasetId: string,\n\t\tofferId: string,\n\t\tproviderEndpoint: string,\n\t\tpublicOrigin: string,\n\t\ttrustPayload: unknown\n\t): Promise<{ negotiationId: string }> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(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\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(publicOrigin), 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 localTrustPayload = await this.generateLocalTrustPayload();\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\tconst negotiationId = await this._policyNegotiationPointComponent.sendRequestToProvider(\n\t\t\tproviderEndpoint,\n\t\t\tDataspaceControlPlaneService._REQUESTER_TYPE,\n\t\t\tofferId,\n\t\t\tpublicOrigin\n\t\t);\n\n\t\tif (!negotiationId) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"negotiationInitiationFailed\",\n\t\t\t\t{\n\t\t\t\t\tofferId,\n\t\t\t\t\tproviderEndpoint\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tthis._policyRequester.trackNegotiation(negotiationId);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationInitiated\",\n\t\t\tdata: { negotiationId, offerId }\n\t\t});\n\n\t\treturn { negotiationId };\n\t}\n\n\t/**\n\t * Get the current state of a contract negotiation.\n\t * @param negotiationId The unique identifier of the negotiation.\n\t * @param trustPayload The trust payload for authentication.\n\t * @returns Current state of the negotiation.\n\t */\n\tpublic async getNegotiation(\n\t\tnegotiationId: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolContractNegotiation | IDataspaceProtocolContractNegotiationError> {\n\t\tGuards.stringValue(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(negotiationId),\n\t\t\tnegotiationId\n\t\t);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"getNegotiation\",\n\t\t\tdata: { negotiationId }\n\t\t});\n\n\t\tconst result = await this._policyNegotiationPointComponent.getNegotiation(\n\t\t\tnegotiationId,\n\t\t\ttrustPayload\n\t\t);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationStateRetrieved\",\n\t\t\tdata: {\n\t\t\t\tnegotiationId,\n\t\t\t\ttype: getJsonLdType(result),\n\t\t\t\tstate: (result as IDataspaceProtocolContractNegotiation).state\n\t\t\t}\n\t\t});\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Get negotiation history.\n\t * @param state Optional filter by negotiation state.\n\t * @param cursor Optional pagination cursor.\n\t * @param trustPayload Trust payload for authentication.\n\t * @returns List of negotiation history entries with pagination.\n\t */\n\tpublic async getNegotiationHistory(\n\t\tstate: string | undefined,\n\t\tcursor: string | undefined,\n\t\ttrustPayload: unknown\n\t): Promise<{\n\t\tnegotiations: {\n\t\t\tnegotiation:\n\t\t\t\t| IDataspaceProtocolContractNegotiation\n\t\t\t\t| IDataspaceProtocolContractNegotiationError;\n\t\t\tcreatedAt: string;\n\t\t\tofferId?: string;\n\t\t\tagreementId?: string;\n\t\t}[];\n\t\tcursor?: string;\n\t\tcount: number;\n\t}> {\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"getNegotiationHistory\",\n\t\t\tdata: { state, cursor }\n\t\t});\n\n\t\tconst { items: pnapNegotiations, cursor: nextCursor } =\n\t\t\tawait this._policyNegotiationAdminPointComponent.query(\n\t\t\t\tstate as DataspaceProtocolContractNegotiationStateType | undefined,\n\t\t\t\tcursor\n\t\t\t);\n\n\t\tconst negotiations = pnapNegotiations.map(pnapNeg => {\n\t\t\tconst dspNegotiation: IDataspaceProtocolContractNegotiation = {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractNegotiation,\n\t\t\t\tconsumerPid: pnapNeg.id,\n\t\t\t\tproviderPid: pnapNeg.correlationId,\n\t\t\t\tstate: pnapNeg.state\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tnegotiation: dspNegotiation,\n\t\t\t\tcreatedAt: pnapNeg.dateCreated,\n\t\t\t\tofferId: OdrlPolicyHelper.getUid(pnapNeg.offer),\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(pnapNeg.agreement)\n\t\t\t};\n\t\t});\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationHistoryRetrieved\",\n\t\t\tdata: {\n\t\t\t\tcount: negotiations.length,\n\t\t\t\tstate,\n\t\t\t\thasCursor: Boolean(nextCursor)\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tnegotiations,\n\t\t\tcursor: nextCursor,\n\t\t\tcount: negotiations.length\n\t\t};\n\t}\n\n\t// ============================================================================\n\t// RESOLVER METHODS - IDataspaceControlPlaneResolverComponent\n\t// ============================================================================\n\n\t/**\n\t * Resolve consumerPid to Transfer Context.\n\t * @param consumerPid Consumer Process ID.\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Context with Agreement, datasetId, and Transfer Process metadata.\n\t */\n\tpublic async resolveConsumerPid(\n\t\tconsumerPid: string,\n\t\ttrustPayload: unknown\n\t): Promise<ITransferContext> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(consumerPid), consumerPid);\n\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"resolveConsumerPid\");\n\n\t\tconst storageEntity = await this._transferProcessStorage.get(consumerPid);\n\n\t\tif (!storageEntity) {\n\t\t\tthrow new NotFoundError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"transferProcessNotFound\",\n\t\t\t\tundefined,\n\t\t\t\t{ consumerPid }\n\t\t\t);\n\t\t}\n\n\t\tconst entity = this.storageEntityToModel(storageEntity);\n\n\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.TERMINATED) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"transferProcessTerminated\", {\n\t\t\t\tconsumerPid\n\t\t\t});\n\t\t}\n\n\t\tconst agreement = await this.lookupAgreement(entity.agreementId);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst currentComposite = this.buildTenantIdentifier(\n\t\t\tcontextIds?.[ContextIdKeys.Node],\n\t\t\tcontextIds?.[ContextIdKeys.Tenant]\n\t\t);\n\n\t\t// Identity is `nodeDid:hash(tenantId)` (or just `nodeDid` in\n\t\t// single-tenant). Without a node DID in context we cannot derive any\n\t\t// caller identity at all.\n\t\tif (!Is.stringValue(currentComposite)) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"organizationContextMissing\",\n\t\t\t\t{\n\t\t\t\t\tconsumerPid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerIds = ArrayHelper.fromObjectOrArray<string>(assignerIdentity);\n\n\t\tif (!assignerIds.includes(currentComposite)) {\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\texpectedComposite: currentComposite,\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: contextIds?.[ContextIdKeys.Organization]\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tagreement,\n\t\t\tdatasetId: entity.datasetId,\n\t\t\tofferId: entity.offerId,\n\t\t\tstate: entity.state,\n\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\tdataAddress: entity.dataAddress\n\t\t};\n\t}\n\n\t/**\n\t * Resolve providerPid to Transfer Context.\n\t * @param providerPid Provider Process ID.\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Context with Agreement, datasetId, and Transfer Process metadata.\n\t */\n\tpublic async resolveProviderPid(\n\t\tproviderPid: string,\n\t\ttrustPayload: unknown\n\t): Promise<ITransferContext> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(providerPid), providerPid);\n\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"resolveProviderPid\");\n\n\t\tconst { entity } = await this.lookupTransferByPid(providerPid);\n\n\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.TERMINATED) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"transferProcessTerminatedProvider\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst agreement = await this.lookupAgreement(entity.agreementId);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst currentComposite = this.buildTenantIdentifier(\n\t\t\tcontextIds?.[ContextIdKeys.Node],\n\t\t\tcontextIds?.[ContextIdKeys.Tenant]\n\t\t);\n\n\t\tif (!Is.stringValue(currentComposite)) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"organizationContextMissingProvider\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerIds = ArrayHelper.fromObjectOrArray<string>(assignerIdentity);\n\n\t\tif (!assignerIds.includes(currentComposite)) {\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\texpectedComposite: currentComposite,\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: contextIds?.[ContextIdKeys.Organization]\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 tenant.\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 tenantId = await this.resolveCallingTenantId();\n\t\tconst nodeIdentity = await this.resolveNodeIdentity();\n\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\tnodeIdentity,\n\t\t\ttenantId,\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\treturn resolvedId;\n\t}\n\n\t/**\n\t * Get a dataset record owned by the calling tenant.\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 tenantId = await this.resolveCallingTenantId();\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.tenantId !== tenantId) {\n\t\t\tthrow new UnauthorizedError(DataspaceControlPlaneService.CLASS_NAME, \"datasetWrongTenant\");\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 tenant.\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 tenantId = await this.resolveCallingTenantId();\n\t\tconst page = await this._dataspaceAppDatasetStorage.query(\n\t\t\tIs.stringValue(tenantId)\n\t\t\t\t? {\n\t\t\t\t\t\tproperty: \"tenantId\",\n\t\t\t\t\t\tvalue: tenantId,\n\t\t\t\t\t\tcomparison: ComparisonOperator.Equals\n\t\t\t\t\t}\n\t\t\t\t: undefined,\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 tenant.\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 */\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 tenantId = await this.resolveCallingTenantId();\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.tenantId !== tenantId) {\n\t\t\tthrow new UnauthorizedError(DataspaceControlPlaneService.CLASS_NAME, \"datasetWrongTenant\");\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\t}\n\n\t/**\n\t * Delete a dataspace app dataset owned by the calling tenant.\n\t * @param id The stored app dataset id.\n\t */\n\tpublic async deleteAppDataset(id: string): Promise<void> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(id), id);\n\n\t\tconst tenantId = await this.resolveCallingTenantId();\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.tenantId !== tenantId) {\n\t\t\tthrow new UnauthorizedError(DataspaceControlPlaneService.CLASS_NAME, \"datasetWrongTenant\");\n\t\t}\n\n\t\tconst localTrustPayload = await this.generateLocalTrustPayload(existing.tenantId);\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\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 * @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 * Convert a storage entity to model.\n\t * @param storageEntity The entity from storage.\n\t * @returns The model representation.\n\t * @internal\n\t */\n\tprivate storageEntityToModel(storageEntity: TransferProcess): ITransferProcess {\n\t\treturn {\n\t\t\tid: storageEntity.id,\n\t\t\tconsumerPid: storageEntity.consumerPid,\n\t\t\tproviderPid: storageEntity.providerPid,\n\t\t\tstate: storageEntity.state,\n\t\t\tagreementId: storageEntity.agreementId,\n\t\t\tdatasetId: storageEntity.datasetId,\n\t\t\tofferId: storageEntity.offerId,\n\t\t\tconsumerIdentity: storageEntity.consumerIdentity,\n\t\t\tproviderIdentity: storageEntity.providerIdentity,\n\t\t\tformat: storageEntity.format,\n\t\t\tcallbackAddress: storageEntity.callbackAddress,\n\t\t\ttenantId: storageEntity.tenantId,\n\t\t\tdateCreated: new Date(storageEntity.dateCreated),\n\t\t\tdateModified: new Date(storageEntity.dateModified),\n\t\t\tpolicies: storageEntity.policies,\n\t\t\tdataAddress: storageEntity.dataAddress\n\t\t};\n\t}\n\n\t/**\n\t * Convert a model to storage entity.\n\t * @param entity The model representation.\n\t * @returns The entity for storage.\n\t * @internal\n\t */\n\tprivate modelToStorageEntity(entity: ITransferProcess): TransferProcess {\n\t\treturn {\n\t\t\tid: entity.id,\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tstate: entity.state,\n\t\t\tagreementId: entity.agreementId,\n\t\t\tdatasetId: entity.datasetId,\n\t\t\tofferId: entity.offerId,\n\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\tformat: entity.format,\n\t\t\tcallbackAddress: entity.callbackAddress,\n\t\t\ttenantId: entity.tenantId,\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 * Build the caller's composite identity (`nodeDid:tenantIdHash`) from a\n\t * verified trust payload.\n\t * @param trustInfo The verification info from `TrustHelper.verifyTrust`.\n\t * @returns The composite identity.\n\t * @internal\n\t */\n\tprivate buildCallerComposite(trustInfo: ITrustVerificationInfo): string {\n\t\tGuards.object<ITrustVerificationInfo>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(trustInfo),\n\t\t\ttrustInfo\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(trustInfo.identity),\n\t\t\ttrustInfo.identity\n\t\t);\n\t\treturn Is.stringValue(trustInfo.tenantId)\n\t\t\t? `${trustInfo.identity}:${trustInfo.tenantId}`\n\t\t\t: trustInfo.identity;\n\t}\n\n\t/**\n\t * Validate that the caller's verified identity matches the consumer of a transfer process.\n\t * @param callerComposite The caller's composite identity (`nodeDid:tenantIdHash`).\n\t * @param entity The transfer process entity.\n\t * @throws UnauthorizedError if the caller is not the consumer.\n\t * @internal\n\t */\n\tprivate validateCallerIsConsumer(callerComposite: string, entity: ITransferProcess): void {\n\t\tif (callerComposite !== entity.consumerIdentity) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"callerNotAuthorizedAsConsumer\"\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Validate that the caller's verified identity matches the provider of a transfer process.\n\t * @param callerComposite The caller's composite identity (`nodeDid:tenantIdHash`).\n\t * @param entity The transfer process entity.\n\t * @throws UnauthorizedError if the caller is not the provider.\n\t * @internal\n\t */\n\tprivate validateCallerIsProvider(callerComposite: string, entity: ITransferProcess): void {\n\t\tif (callerComposite !== entity.providerIdentity) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"callerNotAuthorizedAsProvider\"\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Validate that the caller's verified identity matches either the consumer or provider of a transfer process.\n\t * @param callerComposite The caller's composite identity (`nodeDid:tenantIdHash`).\n\t * @param entity The transfer process entity.\n\t * @throws UnauthorizedError if the caller is not a party to the transfer.\n\t * @internal\n\t */\n\tprivate validateCallerIsTransferParty(callerComposite: string, entity: ITransferProcess): void {\n\t\tif (\n\t\t\tcallerComposite !== entity.consumerIdentity &&\n\t\t\tcallerComposite !== entity.providerIdentity\n\t\t) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"callerNotAuthorizedForTransfer\"\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Extract dataset ID from Agreement target.\n\t * @param format Agreement.\n\t * @returns Dataset ID.\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 * @internal\n\t */\n\tprivate async validateCatalogDataset(\n\t\tdatasetId: string,\n\t\tagreement: IDataspaceProtocolAgreement\n\t): Promise<void> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(datasetId), datasetId);\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\n\t\t// Lookup dataset in catalog\n\t\tconst localTrustPayload = await this.generateLocalTrustPayload();\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// Check if pid is a consumerPid (primary key lookup)\n\t\tconst storageEntity = await this._transferProcessStorage.get(pid);\n\n\t\tif (storageEntity) {\n\t\t\treturn {\n\t\t\t\tentity: this.storageEntityToModel(storageEntity),\n\t\t\t\trole: TransferProcessRole.Consumer\n\t\t\t};\n\t\t}\n\n\t\t// Check if pid is a providerPid (secondary key lookup)\n\t\tconst providerPidEntity = await this._transferProcessStorage.get(pid, \"providerPid\");\n\t\tif (providerPidEntity) {\n\t\t\treturn {\n\t\t\t\tentity: this.storageEntityToModel(providerPidEntity),\n\t\t\t\trole: TransferProcessRole.Provider\n\t\t\t};\n\t\t}\n\n\t\tthrow new NotFoundError(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\"transferProcessNotFound\",\n\t\t\tpid,\n\t\t\t{\n\t\t\t\tpid\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Get raw policy entries from a catalog dataset.\n\t * @param catalogDataset Catalog dataset.\n\t * @returns Raw policy entries.\n\t * @internal\n\t */\n\tprivate getCatalogDatasetPolicies(\n\t\tcatalogDataset: IDcatDataset | IDataspaceProtocolDataset\n\t): JsonLdObjectWithNoContext<IDataspaceProtocolPolicy>[] {\n\t\t// Support both \"odrl:hasPolicy\" and \"hasPolicy\" to accommodate different catalog implementations\n\t\tif (Is.object<IDcatDataset>(catalogDataset) && !Is.empty(catalogDataset[\"odrl:hasPolicy\"])) {\n\t\t\tconst items = ArrayHelper.fromObjectOrArray(catalogDataset[\"odrl:hasPolicy\"]) ?? [];\n\t\t\treturn items.map(item => ({\n\t\t\t\t...item,\n\t\t\t\t\"@id\": OdrlPolicyHelper.getUid(item) ?? \"\"\n\t\t\t}));\n\t\t}\n\n\t\tif (\n\t\t\tIs.object<IDataspaceProtocolDataset>(catalogDataset) &&\n\t\t\t!Is.empty(catalogDataset.hasPolicy)\n\t\t) {\n\t\t\treturn ArrayHelper.fromObjectOrArray(catalogDataset.hasPolicy) ?? [];\n\t\t}\n\n\t\treturn [];\n\t}\n\n\t/**\n\t * Validate that the Agreement policies match at least one Catalog Offer.\n\t * @param agreement Agreement to validate.\n\t * @param catalogDataset Catalog dataset containing Offers.\n\t * @internal\n\t */\n\tprivate async validateAgreementMatchesOffer(\n\t\tagreement: IDataspaceProtocolAgreement,\n\t\tcatalogDataset: IDcatDataset\n\t): Promise<void> {\n\t\tGuards.object<IDataspaceProtocolAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\t\tGuards.object<IDcatDataset>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(catalogDataset),\n\t\t\tcatalogDataset\n\t\t);\n\n\t\tconst 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\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\t// The publisher attribution is always the composite identifier\n\t\tconst compositePublisher = this.buildTenantIdentifier(\n\t\t\tcontextIds?.[ContextIdKeys.Node],\n\t\t\tcontextIds?.[ContextIdKeys.Tenant]\n\t\t);\n\t\tif (compositePublisher) {\n\t\t\treturn { ...dataset, \"dcterms:publisher\": compositePublisher };\n\t\t}\n\t\treturn dataset;\n\t}\n\n\t/**\n\t * Build the tenant-attributed identifier.\n\t * @param nodeId The node identity (from `ContextIdKeys.Node`).\n\t * @param tenantId The plaintext tenant id (from `ContextIdKeys.Tenant`), if any. Hashed before insertion into the composite.\n\t * @returns Composite identifier, or undefined if nodeId is missing.\n\t * @internal\n\t */\n\tprivate buildTenantIdentifier(\n\t\tnodeId: string | undefined,\n\t\ttenantId: string | undefined\n\t): string | undefined {\n\t\tif (!Is.stringValue(nodeId)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn Is.stringValue(tenantId) ? `${nodeId}:${TrustHelper.hashTenantId(tenantId)}` : nodeId;\n\t}\n\n\t/**\n\t * Parse a composite tenant identifier into its node and tenant-hash portions.\n\t * @param composite The composite identifier (`nodeDid` or `nodeDid:hash`).\n\t * @returns The parsed parts. `tenantIdHash` is undefined when the composite has no tenant portion (single-tenant node form).\n\t * @throws GuardError if the input is not a non-empty string.\n\t * @throws GeneralError if the input does not start with `did:` — the only valid composite identifier shapes carry a DID as the leading portion.\n\t * @internal\n\t */\n\tprivate parseTenantIdentifier(composite: string): {\n\t\tnodeDid: string;\n\t\ttenantIdHash?: string;\n\t} {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(composite), composite);\n\t\tif (!composite.startsWith(\"did:\")) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"invalidCompositeIdentifier\",\n\t\t\t\t{ composite }\n\t\t\t);\n\t\t}\n\t\tconst lastColon = composite.lastIndexOf(\":\");\n\t\tif (lastColon === -1) {\n\t\t\treturn { nodeDid: composite };\n\t\t}\n\t\tconst candidateHash = composite.slice(lastColon + 1);\n\t\tif (DataspaceControlPlaneService._TENANT_HASH_PATTERN.test(candidateHash)) {\n\t\t\treturn {\n\t\t\t\tnodeDid: composite.slice(0, lastColon),\n\t\t\t\ttenantIdHash: candidateHash\n\t\t\t};\n\t\t}\n\t\treturn { nodeDid: composite };\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 in its owning tenant's context.\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\t// Override `Tenant` in the context wrap so federated catalogue captures the\n\t\t// appDataset's owning tenant. On single-tenant nodes the appDataset has no tenantId,\n\t\t// so the assignment writes `Tenant: undefined` — equivalent to no override.\n\t\tconst contextIds = (await ContextIdStore.getContextIds()) ?? {};\n\t\tconst localTrustPayload = await this.generateLocalTrustPayload(appDataset.tenantId);\n\t\tconst wrappedContextIds = {\n\t\t\t...contextIds,\n\t\t\t[ContextIdKeys.Tenant]: appDataset.tenantId\n\t\t};\n\t\tawait ContextIdStore.run(wrappedContextIds, async () => {\n\t\t\tconst app = DataspaceAppFactory.get<IDataspaceApp>(appDataset.appId);\n\t\t\tconst datasetPayload = this.restampDatasetId(appDataset.dataset, appDataset.id);\n\t\t\tconst overrideHandler = app.datasetsHandled?.bind(app);\n\t\t\tconst rawDatasets: IDataspaceProtocolDataset[] = overrideHandler\n\t\t\t\t? await overrideHandler(datasetPayload, appDataset.tenantId ?? \"\")\n\t\t\t\t: [datasetPayload];\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 tenant from the request context.\n\t * @returns The owning tenant id, or undefined for single-tenant nodes.\n\t * @internal\n\t */\n\tprivate async resolveCallingTenantId(): Promise<string | undefined> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst tenantId = contextIds?.[ContextIdKeys.Tenant];\n\t\treturn Is.stringValue(tenantId) ? tenantId : undefined;\n\t}\n\n\t/**\n\t * Resolve the node identity from the current context, throwing if absent.\n\t * @returns The owning node identity.\n\t * @internal\n\t */\n\tprivate async resolveNodeIdentity(): Promise<string> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst nodeId = contextIds?.[ContextIdKeys.Node];\n\t\tif (!Is.stringValue(nodeId)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"datasetNodeContextRequired\");\n\t\t}\n\t\treturn nodeId;\n\t}\n\n\t/**\n\t * Generate a trust payload representing this node for internal FederatedCatalogue calls.\n\t * @param tenantId Optional tenant ID to embed in the token.\n\t * @returns The generated trust payload.\n\t * @internal\n\t */\n\tprivate async generateLocalTrustPayload(tenantId?: string): Promise<unknown> {\n\t\tconst nodeId = await this.resolveNodeIdentity();\n\t\tconst contextIds = (await ContextIdStore.getContextIds()) ?? {};\n\t\treturn this._trustComponent.generate(\n\t\t\tnodeId,\n\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t{},\n\t\t\tIs.stringValue(tenantId) ? TrustHelper.hashTenantId(tenantId) : undefined,\n\t\t\tcontextIds[ContextIdKeys.Organization]\n\t\t);\n\t}\n}\n"]}
@@ -223,23 +223,4 @@ export declare class DataspaceControlPlaneService implements IDataspaceControlPl
223
223
  * @param id The stored app dataset id.
224
224
  */
225
225
  deleteAppDataset(id: string): Promise<void>;
226
- /**
227
- * Extract the dataset ID from an ODRL agreement's target.
228
- * @param agreement The ODRL agreement containing the target.
229
- * @returns The dataset ID extracted from the target URN.
230
- * @throws GeneralError if the agreement target is missing, has no UID, or has multiple targets.
231
- */
232
- private extractDatasetId;
233
- /**
234
- * Creates the internal INegotiationCallback that fans out to all registered callbacks.
235
- * @returns The internal negotiation callback.
236
- */
237
- private createInternalCallback;
238
- /**
239
- * Creates the internal ITransferCallback that fans out to all registered transfer callbacks.
240
- * Errors thrown by individual callbacks are logged and swallowed so they cannot affect
241
- * the DSP protocol state machine or other registrants.
242
- * @returns The internal transfer callback.
243
- */
244
- private createInternalTransferCallback;
245
226
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.40](https://github.com/iotaledger/twin-dataspace/compare/dataspace-control-plane-service-v0.0.3-next.39...dataspace-control-plane-service-v0.0.3-next.40) (2026-06-08)
4
+
5
+
6
+ ### Features
7
+
8
+ * add support for the new federated catalogue trust model ([#179](https://github.com/iotaledger/twin-dataspace/issues/179)) ([0d99a93](https://github.com/iotaledger/twin-dataspace/commit/0d99a9331e259e3efe5250e390fdfb1a2f0983b1))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/dataspace-models bumped from 0.0.3-next.39 to 0.0.3-next.40
16
+
3
17
  ## [0.0.3-next.39](https://github.com/iotaledger/twin-dataspace/compare/dataspace-control-plane-service-v0.0.3-next.38...dataspace-control-plane-service-v0.0.3-next.39) (2026-06-04)
4
18
 
5
19
 
package/locales/en.json CHANGED
@@ -100,7 +100,8 @@
100
100
  "invalidPushDataAddress": "PUSH transfer cannot start: consumer dataAddress is missing endpoint or endpointType (consumerPid: {consumerPid})",
101
101
  "pushTransferDataPathNotConfigured": "PUSH transfer cannot start: dataPlanePath is not configured (consumerPid: {consumerPid})",
102
102
  "dataPlaneNotRegistered": "Push-mode transfer requires the data plane component to be registered (factory key: \"dataspace-data-plane\"). This deployment was configured without a data plane — register one to enable push, or use pull-mode transfers only.",
103
- "datasetPublishFailed": "Failed to publish dataset {datasetRecordId} for app {appId} (tenant: {tenantId})",
103
+ "datasetPublishFailed": "Failed to publish dataset \"{datasetId}\" for app \"{appId}\" (tenant: \"{tenantId}\")",
104
+ "datasetRemoveFailed": "Failed to remove dataset \"{datasetId}\" from the Federated Catalogue (tenant: \"{tenantId}\")",
104
105
  "datasetNodeContextRequired": "A node context is required to register a dataset.",
105
106
  "datasetAlreadyExists": "A dataset with id \"{existingId}\" already exists.",
106
107
  "datasetNotFound": "Dataset not found",
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.39",
3
+ "version": "0.0.3-next.40",
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.39",
22
+ "@twin.org/dataspace-models": "0.0.3-next.40",
23
23
  "@twin.org/entity": "next",
24
24
  "@twin.org/entity-storage-models": "next",
25
25
  "@twin.org/federated-catalogue-models": "next",