@twin.org/dataspace-control-plane-service 0.0.3-next.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +119 -0
- package/dist/es/dataspaceControlPlanePolicyRequester.js +228 -0
- package/dist/es/dataspaceControlPlanePolicyRequester.js.map +1 -0
- package/dist/es/dataspaceControlPlaneRoutes.js +202 -0
- package/dist/es/dataspaceControlPlaneRoutes.js.map +1 -0
- package/dist/es/dataspaceControlPlaneService.js +1420 -0
- package/dist/es/dataspaceControlPlaneService.js.map +1 -0
- package/dist/es/index.js +11 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IDataspaceControlPlaneServiceConfig.js +4 -0
- package/dist/es/models/IDataspaceControlPlaneServiceConfig.js.map +1 -0
- package/dist/es/models/IDataspaceControlPlaneServiceConstructorOptions.js +2 -0
- package/dist/es/models/IDataspaceControlPlaneServiceConstructorOptions.js.map +1 -0
- package/dist/es/models/INegotiationState.js +4 -0
- package/dist/es/models/INegotiationState.js.map +1 -0
- package/dist/es/restEntryPoints.js +15 -0
- package/dist/es/restEntryPoints.js.map +1 -0
- package/dist/es/schema.js +11 -0
- package/dist/es/schema.js.map +1 -0
- package/dist/es/utils/dataHelpers.js +22 -0
- package/dist/es/utils/dataHelpers.js.map +1 -0
- package/dist/es/utils/transferErrorUtils.js +78 -0
- package/dist/es/utils/transferErrorUtils.js.map +1 -0
- package/dist/types/dataspaceControlPlanePolicyRequester.d.ts +80 -0
- package/dist/types/dataspaceControlPlaneRoutes.d.ts +17 -0
- package/dist/types/dataspaceControlPlaneService.d.ts +153 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/models/IDataspaceControlPlaneServiceConfig.d.ts +20 -0
- package/dist/types/models/IDataspaceControlPlaneServiceConstructorOptions.d.ts +69 -0
- package/dist/types/models/INegotiationState.d.ts +27 -0
- package/dist/types/restEntryPoints.d.ts +7 -0
- package/dist/types/schema.d.ts +4 -0
- package/dist/types/utils/dataHelpers.d.ts +1 -0
- package/dist/types/utils/transferErrorUtils.d.ts +39 -0
- package/docs/API.md +341 -0
- package/docs/changelog.md +31 -0
- package/docs/examples.md +1 -0
- package/docs/reference/classes/DataspaceControlPlanePolicyRequester.md +244 -0
- package/docs/reference/classes/DataspaceControlPlaneService.md +549 -0
- package/docs/reference/functions/generateRestRoutesDataspaceControlPlane.md +29 -0
- package/docs/reference/functions/initSchema.md +9 -0
- package/docs/reference/index.md +22 -0
- package/docs/reference/interfaces/IDataspaceControlPlaneServiceConfig.md +26 -0
- package/docs/reference/interfaces/IDataspaceControlPlaneServiceConstructorOptions.md +160 -0
- package/docs/reference/interfaces/INegotiationState.md +43 -0
- package/docs/reference/variables/restEntryPoints.md +7 -0
- package/docs/reference/variables/tagsDataspaceControlPlane.md +5 -0
- package/locales/en.json +93 -0
- package/package.json +70 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataspaceControlPlaneService.js","sourceRoot":"","sources":["../../src/dataspaceControlPlaneService.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EACN,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,MAAM,EACN,EAAE,EACF,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,iBAAiB,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAkC,MAAM,wBAAwB,CAAC;AACtF,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EAQnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACN,6BAA6B,EAE7B,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EACN,gBAAgB,EAChB,sBAAsB,EAItB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,yBAAyB,E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,CAAC,CAAC,EAAE,CAAC;YAC3E,OAAO,KAAK,CAAC;QACd,CAAC;QAED,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;YACpE,OAAO,KAAK,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,eAAe,CAC5B,OAAkC;QAElC,IAAI,OAAO,CAAC,mBAAmB,CAAC,EAAE,CAAC;YAClC,OAAO,OAAO,CAAC;QAChB,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,aAAa,EAAE,CAAC;QACxD,MAAM,KAAK,GAAG,UAAU,EAAE,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAEvD,IAAI,KAAK,EAAE,CAAC;YACX,OAAO;gBACN,GAAG,OAAO;gBACV,mBAAmB,EAAE,KAAK;aAC1B,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ITaskSchedulerComponent } from \"@twin.org/background-task-models\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport {\n\tArrayHelper,\n\tBaseError,\n\tComponentFactory,\n\tConverter,\n\tGeneralError,\n\tGuards,\n\tIs,\n\tNotFoundError,\n\tObjectHelper,\n\tRandomHelper,\n\tStringHelper,\n\tUnauthorizedError,\n\ttype IValidationFailure,\n\ttype ObjectOrArray\n} from \"@twin.org/core\";\nimport { JsonLdHelper, type JsonLdObjectWithNoContext } from \"@twin.org/data-json-ld\";\nimport {\n\tDataspaceAppFactory,\n\tTransferProcessRole,\n\ttype IDataspaceApp,\n\ttype IDataspaceControlPlaneComponent,\n\ttype IDataspaceControlPlaneResolverComponent,\n\ttype INegotiationCallback,\n\ttype ITransferContext,\n\ttype ITransferProcess,\n\ttype TransferProcess\n} from \"@twin.org/dataspace-models\";\nimport { EngineCoreFactory } from \"@twin.org/engine-models\";\nimport {\n\tEntityStorageConnectorFactory,\n\ttype IEntityStorageConnector\n} from \"@twin.org/entity-storage-models\";\nimport type { IFederatedCatalogueComponent } from \"@twin.org/federated-catalogue-models\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport {\n\tOdrlPolicyHelper,\n\tPolicyRequesterFactory,\n\ttype IPolicyAdministrationPointComponent,\n\ttype IPolicyNegotiationAdminPointComponent,\n\ttype IPolicyNegotiationPointComponent\n} from \"@twin.org/rights-management-models\";\nimport {\n\tDataspaceProtocolContexts,\n\tDataspaceProtocolContractNegotiationTypes,\n\tDataspaceProtocolEndpointType,\n\tDataspaceProtocolHelper,\n\tDataspaceProtocolTransferProcessStateType,\n\tDataspaceProtocolTransferProcessTypes,\n\ttype DataspaceProtocolContractNegotiationStateType,\n\ttype IDataspaceProtocolContractNegotiation,\n\ttype IDataspaceProtocolContractNegotiationError,\n\ttype IDataspaceProtocolDataset,\n\ttype IDataspaceProtocolTransferCompletionMessage,\n\ttype IDataspaceProtocolTransferError,\n\ttype IDataspaceProtocolTransferProcess,\n\ttype IDataspaceProtocolTransferRequestMessage,\n\ttype IDataspaceProtocolTransferStartMessage,\n\ttype IDataspaceProtocolTransferSuspensionMessage,\n\ttype IDataspaceProtocolTransferTerminationMessage\n} from \"@twin.org/standards-dataspace-protocol\";\nimport type { IDcatDataset } from \"@twin.org/standards-w3c-dcat\";\nimport type { IOdrlAgreement, IOdrlPolicy } from \"@twin.org/standards-w3c-odrl\";\nimport { TrustHelper, type ITrustComponent } from \"@twin.org/trust-models\";\nimport { DataspaceControlPlanePolicyRequester } from \"./dataspaceControlPlanePolicyRequester.js\";\nimport type { IDataspaceControlPlaneServiceConstructorOptions } from \"./models/IDataspaceControlPlaneServiceConstructorOptions.js\";\nimport { getJsonLdId, getJsonLdType } from \"./utils/dataHelpers.js\";\nimport {\n\tisCatalogError,\n\tisCatalogErrorName,\n\ttransformToTransferError\n} from \"./utils/transferErrorUtils.js\";\n\n/**\n * Stalled negotiation threshold in milliseconds (30 minutes).\n * Negotiations that haven't received a state update within this time are considered stalled.\n */\nconst STALLED_NEGOTIATION_THRESHOLD_MS = 30 * 60 * 1000;\n\n/**\n * Dataspace Control Plane Service implementation.\n *\n * Handles contract negotiation (via PNP callbacks) and transfer process management.\n * Negotiation is fully callback-driven: negotiateAgreement() returns immediately with\n * a negotiationId, and the caller is notified via INegotiationCallback when complete.\n */\nexport class DataspaceControlPlaneService\n\timplements IDataspaceControlPlaneComponent, IDataspaceControlPlaneResolverComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<DataspaceControlPlaneService>();\n\n\t/**\n\t * Hardcoded requester type for PNP registration.\n\t * PNP uses this to route callbacks to our PolicyRequester.\n\t * @internal\n\t */\n\tprivate static readonly _REQUESTER_TYPE = \"dataspace-control-plane-requester\";\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprivate readonly _loggingComponent?: ILoggingComponent;\n\n\t/**\n\t * Policy Administration Point component for Agreement lookup.\n\t * @internal\n\t */\n\tprivate readonly _policyAdministrationPointComponent: IPolicyAdministrationPointComponent;\n\n\t/**\n\t * Policy Negotiation Point component for contract negotiation.\n\t * Used to negotiate agreements with providers before creating transfer processes.\n\n\t * @internal\n\t */\n\tprivate readonly _policyNegotiationPointComponent: IPolicyNegotiationPointComponent;\n\n\t/**\n\t * Policy Negotiation Admin Point component for negotiation history.\n\t * Optional - if not configured, history queries will fail gracefully.\n\t * @internal\n\t */\n\tprivate readonly _policyNegotiationAdminPointComponent?: IPolicyNegotiationAdminPointComponent;\n\n\t/**\n\t * Federated Catalogue component for dataset validation.\n\t * Used to validate that Agreements reference valid catalog datasets.\n\t * @internal\n\t */\n\tprivate readonly _federatedCatalogueComponent: IFederatedCatalogueComponent;\n\n\t/**\n\t * Entity storage for Transfer Process entities.\n\t * Shared between Control Plane and Data Plane.\n\t * @internal\n\t */\n\tprivate readonly _transferProcessStorage: IEntityStorageConnector<TransferProcess>;\n\n\t/**\n\t * The trust component for token verification and generation.\n\t * @internal\n\t */\n\tprivate readonly _trustComponent: ITrustComponent;\n\n\t/**\n\t * Override trust generator type for token generation.\n\t * @internal\n\t */\n\tprivate readonly _overrideTrustGeneratorType?: string;\n\n\t/**\n\t * Data plane endpoint path (path only, not full URL).\n\t * Will be combined with public origin from hosting component.\n\t * If not configured, PULL transfers are not supported.\n\t * @internal\n\t */\n\tprivate readonly _dataPlanePath?: string;\n\n\t/**\n\t * Policy requester instance for handling negotiation callbacks.\n\t * @internal\n\t */\n\tprivate readonly _policyRequester: DataspaceControlPlanePolicyRequester;\n\n\t/**\n\t * Task scheduler for periodic stalled negotiation cleanup.\n\t * @internal\n\t */\n\tprivate readonly _taskScheduler?: ITaskSchedulerComponent;\n\n\t/**\n\t * Registered negotiation callbacks from upstream callers, keyed by registration key.\n\t * @internal\n\t */\n\tprivate readonly _negotiationCallbacks: Map<string, INegotiationCallback>;\n\n\t/**\n\t * Create a new instance of DataspaceControlPlaneService.\n\t * @param options The options for the service.\n\t */\n\tconstructor(options?: IDataspaceControlPlaneServiceConstructorOptions) {\n\t\tthis._loggingComponent = ComponentFactory.getIfExists<ILoggingComponent>(\n\t\t\toptions?.loggingComponentType ?? \"logging\"\n\t\t);\n\n\t\t// Retrieve PAP component with default\n\t\tthis._policyAdministrationPointComponent =\n\t\t\tComponentFactory.get<IPolicyAdministrationPointComponent>(\n\t\t\t\toptions?.policyAdministrationPointComponentType ?? \"policy-administration-point\"\n\t\t\t);\n\n\t\t// Retrieve PNP component with default\n\t\tthis._policyNegotiationPointComponent = ComponentFactory.get<IPolicyNegotiationPointComponent>(\n\t\t\toptions?.policyNegotiationPointComponentType ?? \"policy-negotiation-point\"\n\t\t);\n\n\t\t// Retrieve PNAP component (optional) for negotiation history\n\t\tthis._policyNegotiationAdminPointComponent =\n\t\t\tComponentFactory.getIfExists<IPolicyNegotiationAdminPointComponent>(\n\t\t\t\toptions?.policyNegotiationAdminPointComponentType ?? \"policy-negotiation-admin-point\"\n\t\t\t);\n\n\t\t// Retrieve Federated Catalogue component with default\n\t\tthis._federatedCatalogueComponent = ComponentFactory.get<IFederatedCatalogueComponent>(\n\t\t\toptions?.federatedCatalogueComponentType ?? \"federated-catalogue\"\n\t\t);\n\n\t\tthis._transferProcessStorage = EntityStorageConnectorFactory.get<\n\t\t\tIEntityStorageConnector<TransferProcess>\n\t\t>(options?.transferProcessEntityStorageType ?? nameofKebabCase<TransferProcess>());\n\n\t\tthis._trustComponent = ComponentFactory.get<ITrustComponent>(\n\t\t\toptions?.trustComponentType ?? \"trust\"\n\t\t);\n\n\t\tthis._overrideTrustGeneratorType = options?.config?.overrideTrustGeneratorType;\n\n\t\tthis._dataPlanePath = Is.stringValue(options?.config?.dataPlanePath)\n\t\t\t? StringHelper.trimLeadingSlashes(options.config.dataPlanePath)\n\t\t\t: undefined;\n\n\t\tthis._taskScheduler = ComponentFactory.getIfExists<ITaskSchedulerComponent>(\n\t\t\toptions?.taskSchedulerComponentType ?? \"task-scheduler\"\n\t\t);\n\n\t\tthis._negotiationCallbacks = new Map();\n\n\t\tconst internalCallback: INegotiationCallback = {\n\t\t\tonStateChanged: async (negotiationId, state, data) => {\n\t\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onStateChanged(negotiationId, state, data);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\t\t\tdata: { key, negotiationId, method: \"onStateChanged\", error }\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tonCompleted: async (negotiationId, agreementId) => {\n\t\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onCompleted(negotiationId, agreementId);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\t\t\tdata: { key, negotiationId, method: \"onCompleted\", error }\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tonFailed: async (negotiationId, reason) => {\n\t\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cb.onFailed(negotiationId, reason);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\t\t\tdata: { key, negotiationId, method: \"onFailed\", error }\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis._policyRequester = new DataspaceControlPlanePolicyRequester(\n\t\t\toptions?.loggingComponentType ?? \"logging\",\n\t\t\tinternalCallback\n\t\t);\n\n\t\tPolicyRequesterFactory.register(\n\t\t\tDataspaceControlPlaneService._REQUESTER_TYPE,\n\t\t\t() => this._policyRequester\n\t\t);\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn DataspaceControlPlaneService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Register a callback to receive negotiation state change notifications.\n\t * Upstream modules (e.g. supply-chain) register their callback here.\n\t * @param key A unique key identifying this callback registration.\n\t * @param callback The callback interface to register.\n\t */\n\tpublic registerNegotiationCallback(key: string, callback: INegotiationCallback): void {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(key), key);\n\t\tthis._negotiationCallbacks.set(key, callback);\n\t}\n\n\t/**\n\t * Unregister a previously registered negotiation callback.\n\t * @param key The key used when registering the callback.\n\t */\n\tpublic unregisterNegotiationCallback(key: string): void {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(key), key);\n\t\tthis._negotiationCallbacks.delete(key);\n\t}\n\n\t/**\n\t * The service needs to be started when the application is initialized.\n\t * Populates the Federated Catalogue with datasets from registered apps\n\t * and starts the stalled negotiation cleanup task.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t */\n\tpublic async start(nodeLoggingComponentType?: string): Promise<void> {\n\t\tconst engine = EngineCoreFactory.getIfExists(\"engine\");\n\t\t// Skip if no engine exists OR if this is a clone instance\n\t\tif (Is.empty(engine) || engine.isClone()) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"debug\",\n\t\t\t\tts: Date.now(),\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tmessage: \"engineCloneStart\"\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tts: Date.now(),\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tmessage: \"populatingFederatedCatalogue\"\n\t\t});\n\n\t\t// Get all registered apps\n\t\tconst appNames = DataspaceAppFactory.names();\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"debug\",\n\t\t\tts: Date.now(),\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tmessage: \"discoveredApps\",\n\t\t\tdata: { count: appNames.length, apps: appNames }\n\t\t});\n\n\t\tlet registeredCount = 0;\n\t\tlet errorCount = 0;\n\n\t\t// Collect and register datasets from each app\n\t\tfor (const appName of appNames) {\n\t\t\ttry {\n\t\t\t\tconst app = DataspaceAppFactory.get<IDataspaceApp>(appName);\n\t\t\t\tconst datasets = await app.datasetsHandled();\n\n\t\t\t\tfor (const dataset of datasets) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// Ensure publisher is set (required for Federated Catalogue)\n\t\t\t\t\t\tconst datasetWithPublisher = await this.ensurePublisher(dataset);\n\n\t\t\t\t\t\t// Register with Federated Catalogue\n\t\t\t\t\t\tawait this._federatedCatalogueComponent.set(\n\t\t\t\t\t\t\tdatasetWithPublisher as unknown as IDcatDataset\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tregisteredCount++;\n\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"debug\",\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tmessage: \"datasetRegistered\",\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tdatasetId: getJsonLdId(datasetWithPublisher) ?? \"\",\n\t\t\t\t\t\t\t\tappName\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\terrorCount++;\n\t\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\t\tmessage: \"datasetRegistrationFailed\",\n\t\t\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tdatasetId: getJsonLdId(dataset) ?? \"\",\n\t\t\t\t\t\t\t\tappName\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tmessage: \"appDatasetsRetrievalFailed\",\n\t\t\t\t\terror: BaseError.fromError(error),\n\t\t\t\t\tdata: { appName }\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tts: Date.now(),\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tmessage: \"federatedCataloguePopulated\",\n\t\t\tdata: {\n\t\t\t\tregisteredCount,\n\t\t\t\terrorCount,\n\t\t\t\ttotalApps: appNames.length\n\t\t\t}\n\t\t});\n\n\t\tif (this._taskScheduler) {\n\t\t\tawait this._taskScheduler.addTask(\n\t\t\t\t\"control-plane-negotiation-cleanup\",\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tnextTriggerTime: Date.now(),\n\t\t\t\t\t\tintervalMinutes: 5\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tasync () => {\n\t\t\t\t\tawait this.cleanupStalledNegotiations();\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Stop the service.\n\t * Removes the stalled negotiation cleanup task.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t */\n\tpublic async stop(nodeLoggingComponentType?: string): Promise<void> {\n\t\tif (this._taskScheduler) {\n\t\t\tawait this._taskScheduler.removeTask(\"control-plane-negotiation-cleanup\");\n\t\t}\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// CONSUMER SIDE OPERATIONS\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Request a Transfer Process.\n\t * Creates a new Transfer Process in REQUESTED state.\n\t * @param request Transfer request message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state REQUESTED, or TransferError if the operation fails.\n\t *\n\t * Role Performed: Provider\n\t * Called by: Consumer when it wants to request a new Transfer Process\n\t */\n\tpublic async requestTransfer(\n\t\trequest: IDataspaceProtocolTransferRequestMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"requestTransfer\");\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tconst isConformant = await DataspaceProtocolHelper.checkConformance(\n\t\t\tJsonLdHelper.toNodeObject(request),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tif (!isConformant) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"error\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"invalidTransferRequest\",\n\t\t\t\tdata: { validationFailures }\n\t\t\t});\n\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidTransferRequest\", {\n\t\t\t\tvalidationFailures\n\t\t\t});\n\t\t}\n\n\t\tconst providerPid = `urn:uuid:${RandomHelper.generateUuidV7()}`;\n\n\t\tlet datasetId: string;\n\t\tlet consumerIdentity: ObjectOrArray<string>;\n\t\tlet providerIdentity: ObjectOrArray<string>;\n\t\tlet policies: IOdrlPolicy[] = [];\n\n\t\ttry {\n\t\t\tconst agreement = await this.lookupAgreement(request.agreementId);\n\n\t\t\tif (!agreement) {\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"agreementNotFound\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tagreementId: request.agreementId,\n\t\t\t\t\t\thint: \"Agreement must exist before transfer. Use contract negotiation to create agreement first.\"\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"agreementNotFound\",\n\t\t\t\t\trequest.agreementId,\n\t\t\t\t\t{\n\t\t\t\t\t\tagreementId: request.agreementId,\n\t\t\t\t\t\thint: \"Perform contract negotiation first to create an agreement\"\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst assigneeIdentity = OdrlPolicyHelper.extractAssigneeIdentity(agreement);\n\t\t\tconsumerIdentity = Is.array(assigneeIdentity) ? assigneeIdentity[0] : assigneeIdentity;\n\n\t\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\t\tproviderIdentity = Is.array(assignerIdentity) ? assignerIdentity[0] : assignerIdentity;\n\t\t\tdatasetId = this.extractDatasetId(agreement);\n\n\t\t\tawait this.validateCatalogDataset(datasetId, agreement);\n\n\t\t\tpolicies = [agreement];\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, { consumerPid: request.consumerPid, providerPid });\n\t\t}\n\n\t\tconst now = new Date();\n\n\t\tconst storageEntity: TransferProcess = {\n\t\t\tid: Converter.bytesToHex(RandomHelper.generate(32)),\n\t\t\tconsumerPid: request.consumerPid,\n\t\t\tproviderPid,\n\t\t\tstate: DataspaceProtocolTransferProcessStateType.REQUESTED,\n\t\t\tagreementId: request.agreementId,\n\t\t\tdatasetId,\n\t\t\tconsumerIdentity: ArrayHelper.fromObjectOrArray<string>(consumerIdentity)[0],\n\t\t\tproviderIdentity: ArrayHelper.fromObjectOrArray<string>(providerIdentity)[0],\n\t\t\t// offerId should reference Catalog Offer (via Agreement)\n\t\t\t// For now, use agreementId as reference (proper flow: Catalog → Negotiation → Agreement)\n\t\t\tofferId: request.agreementId,\n\t\t\tpolicies,\n\t\t\tcallbackAddress: request.callbackAddress,\n\t\t\tformat: request.format,\n\t\t\tdataAddress: request.dataAddress,\n\t\t\tdateCreated: now.toISOString(),\n\t\t\tdateModified: now.toISOString()\n\t\t};\n\n\t\tawait this._transferProcessStorage.set(storageEntity);\n\n\t\tconst entity: ITransferProcess = this.storageEntityToModel(storageEntity);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"transferProcessInitiated\",\n\t\t\tdata: {\n\t\t\t\tconsumerPid: request.consumerPid,\n\t\t\t\tproviderPid,\n\t\t\t\tagreementId: request.agreementId\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tstate: entity.state\n\t\t};\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// PROVIDER SIDE OPERATIONS\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Start a Transfer Process.\n\t * Transitions Transfer Process from REQUESTED to STARTED state or resumes from SUSPENDED state.\n\t * @param message Transfer start message (DSP compliant).\n\t * @param publicOrigin The public origin URL of this service.\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Start Message (DSP compliant) with dataAddress for PULL transfers, or TransferError if the operation fails.\n\t *\n\t * Role Performed: Provider / Consumer\n\t */\n\tpublic async startTransfer(\n\t\tmessage: IDataspaceProtocolTransferStartMessage,\n\t\tpublicOrigin: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferStartMessage | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"startTransfer\");\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tconst isConformant = await DataspaceProtocolHelper.checkConformance(\n\t\t\tJsonLdHelper.toNodeObject(message),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tif (!isConformant) {\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidTransferStartMessage\", {\n\t\t\t\t\tvalidationFailures\n\t\t\t\t}),\n\t\t\t\tmessage\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByMessage(message);\n\n\t\t\tif (\n\t\t\t\tentity.state !== DataspaceProtocolTransferProcessStateType.REQUESTED &&\n\t\t\t\tentity.state !== DataspaceProtocolTransferProcessStateType.SUSPENDED\n\t\t\t) {\n\t\t\t\treturn transformToTransferError(\n\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidStateForStart\", {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tcurrentState: entity.state\n\t\t\t\t\t}),\n\t\t\t\t\tmessage\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.STARTED;\n\t\t\tentity.dateModified = new Date();\n\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessStarted\",\n\t\t\t\tdata: {\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\trole\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tconst response: IDataspaceProtocolTransferStartMessage = {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferStartMessage,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid\n\t\t\t};\n\n\t\t\t// ============================================================================\n\t\t\t// PULL vs PUSH Transfer Mode Detection (DSP Protocol)\n\t\t\t// ============================================================================\n\t\t\t// The transfer mode is determined by whether the consumer provided a dataAddress\n\t\t\t// in the original TransferRequestMessage:\n\t\t\t//\n\t\t\t// PULL Mode (dataAddress NOT provided by consumer):\n\t\t\t// - Consumer requests data but doesn't specify where to receive it\n\t\t\t// - Provider generates access token and returns dataAddress in TransferStartMessage\n\t\t\t// - Consumer uses the returned endpoint + token to PULL data from provider\n\t\t\t// - Flow: Consumer → GET /entities?consumerPid=X (with Bearer token) → Provider\n\t\t\t//\n\t\t\t// PUSH Mode (dataAddress PROVIDED by consumer):\n\t\t\t// - Consumer specifies endpoint where they want data sent (e.g., webhook URL)\n\t\t\t// - Provider will PUSH data to the consumer's specified endpoint\n\t\t\t// - Flow: Provider → POST to consumer's dataAddress endpoint → Consumer\n\t\t\t//\n\t\t\t// See: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1-err1/#transfer-start-message\n\t\t\t// ============================================================================\n\n\t\t\tif (Is.empty(entity.dataAddress)) {\n\t\t\t\tif (!Is.stringValue(this._dataPlanePath)) {\n\t\t\t\t\treturn transformToTransferError(\n\t\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"pullTransfersNotSupported\", {\n\t\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\t\tproviderPid: entity.providerPid\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tmessage\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst accessToken = await this._trustComponent.generate(\n\t\t\t\t\tentity.consumerIdentity ?? entity.consumerPid,\n\t\t\t\t\tthis._overrideTrustGeneratorType,\n\t\t\t\t\t{\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tagreementId: entity.agreementId,\n\t\t\t\t\t\tdatasetId: entity.datasetId\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tconst tokenString = Converter.bytesToBase64(ObjectHelper.toBytes(accessToken));\n\t\t\t\tconst fullEndpoint = `${publicOrigin}/${this._dataPlanePath}`;\n\n\t\t\t\tresponse.dataAddress = {\n\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.DataAddress,\n\t\t\t\t\tendpointType: DataspaceProtocolEndpointType.HttpsQueryEndpoint,\n\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\tendpointProperties: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.EndpointProperty,\n\t\t\t\t\t\t\tname: \"authorization\",\n\t\t\t\t\t\t\tvalue: tokenString\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.EndpointProperty,\n\t\t\t\t\t\t\tname: \"authType\",\n\t\t\t\t\t\t\tvalue: \"bearer\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t};\n\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"dataAccessTokenGenerated\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tendpoint: fullEndpoint,\n\t\t\t\t\t\ttransferMode: \"PULL\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// PUSH MODE: Provider will push data to consumer's specified endpoint\n\t\t\t\t// The consumer provided dataAddress in TransferRequestMessage, indicating\n\t\t\t\t// where they want data sent. Provider acknowledges and will push data there.\n\t\t\t\t//\n\t\t\t\t// TODO: PUSH transfer implementation (RFC-007 future work)\n\t\t\t\t// Implementation would need to:\n\t\t\t\t// 1. Generate provider's own trust token to authenticate when pushing to consumer\n\t\t\t\t// 2. Validate consumer's dataAddress endpoint is reachable\n\t\t\t\t// 3. Extract any consumer-provided authorization from endpointProperties\n\t\t\t\t// 4. Schedule background task to push data to consumer's endpoint\n\t\t\t\t// 5. POST data to entity.dataAddress.endpoint with provider's trust token\n\t\t\t\t// 6. Implement retry logic with exponential backoff\n\t\t\t\t// 7. Send TransferCompletionMessage when push completes successfully\n\t\t\t\t//\n\t\t\t\t// Trust flow for PUSH (mirror of PULL):\n\t\t\t\t// - PULL: Provider generates token → Consumer uses to authenticate when pulling\n\t\t\t\t// - PUSH: Provider generates token → Provider uses to authenticate when pushing\n\n\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\tlevel: \"warn\",\n\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\tts: Date.now(),\n\t\t\t\t\tmessage: \"pushTransferModeNotImplemented\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tconsumerEndpoint: entity.dataAddress.endpoint,\n\t\t\t\t\t\ttransferMode: \"PUSH\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn response;\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// SHARED STATE MANAGEMENT OPERATIONS (Either Side)\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Complete a Transfer Process.\n\t * @param message Transfer completion message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state COMPLETED, or TransferError if the operation fails.\n\t */\n\tpublic async completeTransfer(\n\t\tmessage: IDataspaceProtocolTransferCompletionMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"completeTransfer\");\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tconst isConformant = await DataspaceProtocolHelper.checkConformance(\n\t\t\tJsonLdHelper.toNodeObject(message),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tif (!isConformant) {\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"invalidTransferCompletionMessage\",\n\t\t\t\t\t{ validationFailures }\n\t\t\t\t),\n\t\t\t\tmessage\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByMessage(message);\n\n\t\t\tif (entity.state !== DataspaceProtocolTransferProcessStateType.STARTED) {\n\t\t\t\treturn transformToTransferError(\n\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidStateForComplete\", {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tcurrentState: entity.state\n\t\t\t\t\t}),\n\t\t\t\t\tmessage\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.COMPLETED;\n\t\t\tentity.dateModified = new Date();\n\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessCompleted\",\n\t\t\t\tdata: {\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\trole\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t/**\n\t * Suspend a Transfer Process.\n\t * @param message Transfer suspension message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state SUSPENDED, or TransferError if the operation fails.\n\t */\n\tpublic async suspendTransfer(\n\t\tmessage: IDataspaceProtocolTransferSuspensionMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"suspendTransfer\");\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tconst isConformant = await DataspaceProtocolHelper.checkConformance(\n\t\t\tJsonLdHelper.toNodeObject(message),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tif (!isConformant) {\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"invalidTransferSuspensionMessage\",\n\t\t\t\t\t{ validationFailures }\n\t\t\t\t),\n\t\t\t\tmessage\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByMessage(message);\n\n\t\t\tif (entity.state !== DataspaceProtocolTransferProcessStateType.STARTED) {\n\t\t\t\treturn transformToTransferError(\n\t\t\t\t\tnew GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"invalidStateForSuspend\", {\n\t\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\t\tcurrentState: entity.state\n\t\t\t\t\t}),\n\t\t\t\t\tmessage\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.SUSPENDED;\n\t\t\tentity.dateModified = new Date();\n\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessSuspended\",\n\t\t\t\tdata: {\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\trole,\n\t\t\t\t\treason: message.reason\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t/**\n\t * Terminate a Transfer Process.\n\t * @param message Transfer termination message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with state TERMINATED, or TransferError if the operation fails.\n\t */\n\tpublic async terminateTransfer(\n\t\tmessage: IDataspaceProtocolTransferTerminationMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"terminateTransfer\");\n\n\t\tconst validationFailures: IValidationFailure[] = [];\n\t\tconst isConformant = await DataspaceProtocolHelper.checkConformance(\n\t\t\tJsonLdHelper.toNodeObject(message),\n\t\t\tvalidationFailures\n\t\t);\n\n\t\tif (!isConformant) {\n\t\t\treturn transformToTransferError(\n\t\t\t\tnew GeneralError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"invalidTransferTerminationMessage\",\n\t\t\t\t\t{ validationFailures }\n\t\t\t\t),\n\t\t\t\tmessage\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByMessage(message);\n\n\t\t\tentity.state = DataspaceProtocolTransferProcessStateType.TERMINATED;\n\t\t\tentity.dateModified = new Date();\n\n\t\t\tawait this._transferProcessStorage.set(this.modelToStorageEntity(entity));\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessTerminated\",\n\t\t\t\tdata: {\n\t\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\t\trole,\n\t\t\t\t\treason: message.reason\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, message);\n\t\t}\n\t}\n\n\t/**\n\t * Get Transfer Process state.\n\t * @param pid Process ID (consumerPid or providerPid).\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Process (DSP compliant) with current state, or TransferError if the operation fails.\n\t */\n\tpublic async getTransferProcess(\n\t\tpid: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError> {\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"getTransferProcess\");\n\n\t\ttry {\n\t\t\tconst { entity, role } = await this.lookupTransferByPid(pid);\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"transferProcessQueried\",\n\t\t\t\tdata: {\n\t\t\t\t\tpid,\n\t\t\t\t\trole,\n\t\t\t\t\tstate: entity.state\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferProcess,\n\t\t\t\tconsumerPid: entity.consumerPid,\n\t\t\t\tproviderPid: entity.providerPid,\n\t\t\t\tstate: entity.state\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn transformToTransferError(error, { consumerPid: pid, providerPid: pid });\n\t\t}\n\t}\n\n\t// ============================================================================\n\t// CONTRACT NEGOTIATION\n\t// ============================================================================\n\n\t/**\n\t * Negotiate a contract agreement with a provider.\n\t * Returns immediately with a negotiationId. The caller is notified\n\t * via the registered INegotiationCallback when the negotiation completes.\n\t *\n\t * @param offerId The offer ID from the provider's catalog.\n\t * @param providerEndpoint The provider's contract negotiation endpoint URL.\n\t * @param publicOrigin The public origin URL of this control plane (for callbacks).\n\t * @param trustPayload The trust payload for authentication.\n\t * @returns The negotiation ID. Use the registered callback for completion notification.\n\t */\n\tpublic async negotiateAgreement(\n\t\tofferId: string,\n\t\tproviderEndpoint: string,\n\t\tpublicOrigin: string,\n\t\ttrustPayload: unknown\n\t): Promise<{ negotiationId: string }> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(offerId), offerId);\n\t\tGuards.stringValue(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(providerEndpoint),\n\t\t\tproviderEndpoint\n\t\t);\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(publicOrigin), publicOrigin);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"startingContractNegotiation\",\n\t\t\tdata: { offerId, providerEndpoint, publicOrigin }\n\t\t});\n\n\t\tconst catalogResult = await this._federatedCatalogueComponent.get(offerId);\n\n\t\tif (isCatalogError(catalogResult)) {\n\t\t\tif (isCatalogErrorName(catalogResult, NotFoundError.CLASS_NAME)) {\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"datasetNotFoundInCatalog\",\n\t\t\t\t\tofferId,\n\t\t\t\t\t{\n\t\t\t\t\t\tofferId,\n\t\t\t\t\t\tproviderEndpoint\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"catalogLookupFailedForNegotiation\",\n\t\t\t\t{\n\t\t\t\t\tofferId,\n\t\t\t\t\tproviderEndpoint,\n\t\t\t\t\terrorCode: catalogResult.code\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst rawOffers = this.getCatalogDatasetPolicies(catalogResult);\n\n\t\tif (!Is.arrayValue(rawOffers)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"datasetHasNoOffers\", {\n\t\t\t\tofferId,\n\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\"\n\t\t\t});\n\t\t}\n\n\t\tconst catalogOffers = rawOffers.filter(offer => Is.object<IOdrlPolicy>(offer));\n\n\t\tif (!Is.arrayValue(catalogOffers)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"datasetHasNoValidOffers\", {\n\t\t\t\tofferId,\n\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\"\n\t\t\t});\n\t\t}\n\n\t\tconst matchingOffer = catalogOffers.find((offer: IOdrlPolicy) => {\n\t\t\tconst offerUid = OdrlPolicyHelper.getUid(offer);\n\t\t\treturn offerUid === offerId;\n\t\t});\n\n\t\tif (!matchingOffer) {\n\t\t\tconst availableOffers = catalogOffers\n\t\t\t\t.map((o: IOdrlPolicy) => OdrlPolicyHelper.getUid(o) ?? \"unknown\")\n\t\t\t\t.join(\", \");\n\n\t\t\tthrow new NotFoundError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"offerNotFoundInDataset\",\n\t\t\t\tofferId,\n\t\t\t\t{\n\t\t\t\t\tofferId,\n\t\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\",\n\t\t\t\t\tavailableOffers\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"offerFoundInCatalog\",\n\t\t\tdata: {\n\t\t\t\tofferId,\n\t\t\t\tdatasetId: getJsonLdId(catalogResult) ?? \"\",\n\t\t\t\tofferType: getJsonLdType(matchingOffer)\n\t\t\t}\n\t\t});\n\n\t\tconst negotiationId = await this._policyNegotiationPointComponent.sendRequestToProvider(\n\t\t\tproviderEndpoint,\n\t\t\tDataspaceControlPlaneService._REQUESTER_TYPE,\n\t\t\tofferId,\n\t\t\tpublicOrigin\n\t\t);\n\n\t\tif (!negotiationId) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"negotiationInitiationFailed\",\n\t\t\t\t{\n\t\t\t\t\tofferId,\n\t\t\t\t\tproviderEndpoint\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tthis._policyRequester.trackNegotiation(negotiationId);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationInitiated\",\n\t\t\tdata: { negotiationId, offerId }\n\t\t});\n\n\t\treturn { negotiationId };\n\t}\n\n\t/**\n\t * Get the current state of a contract negotiation.\n\t * @param negotiationId The unique identifier of the negotiation.\n\t * @param trustPayload The trust payload for authentication.\n\t * @returns Current state of the negotiation.\n\t */\n\tpublic async getNegotiation(\n\t\tnegotiationId: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolContractNegotiation | IDataspaceProtocolContractNegotiationError> {\n\t\tGuards.stringValue(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(negotiationId),\n\t\t\tnegotiationId\n\t\t);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"getNegotiation\",\n\t\t\tdata: { negotiationId }\n\t\t});\n\n\t\tconst result = await this._policyNegotiationPointComponent.getNegotiation(\n\t\t\tnegotiationId,\n\t\t\ttrustPayload\n\t\t);\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationStateRetrieved\",\n\t\t\tdata: {\n\t\t\t\tnegotiationId,\n\t\t\t\ttype: getJsonLdType(result),\n\t\t\t\tstate: (result as IDataspaceProtocolContractNegotiation).state\n\t\t\t}\n\t\t});\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Get negotiation history.\n\t * @param state Optional filter by negotiation state.\n\t * @param cursor Optional pagination cursor.\n\t * @param trustPayload Trust payload for authentication.\n\t * @returns List of negotiation history entries with pagination.\n\t */\n\tpublic async getNegotiationHistory(\n\t\tstate: string | undefined,\n\t\tcursor: string | undefined,\n\t\ttrustPayload: unknown\n\t): Promise<{\n\t\tnegotiations: {\n\t\t\tnegotiation:\n\t\t\t\t| IDataspaceProtocolContractNegotiation\n\t\t\t\t| IDataspaceProtocolContractNegotiationError;\n\t\t\tcreatedAt: string;\n\t\t\tofferId?: string;\n\t\t\tagreementId?: string;\n\t\t}[];\n\t\tcursor?: string;\n\t\tcount: number;\n\t}> {\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"getNegotiationHistory\",\n\t\t\tdata: { state, cursor }\n\t\t});\n\n\t\tif (!this._policyNegotiationAdminPointComponent) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"pnapNotConfigured\", {\n\t\t\t\tmessage:\n\t\t\t\t\t\"Policy Negotiation Admin Point not configured. \" +\n\t\t\t\t\t\"Set policyNegotiationAdminPointComponentType in constructor options.\"\n\t\t\t});\n\t\t}\n\n\t\tconst { items: pnapNegotiations, cursor: nextCursor } =\n\t\t\tawait this._policyNegotiationAdminPointComponent.query(\n\t\t\t\tstate as DataspaceProtocolContractNegotiationStateType | undefined,\n\t\t\t\tcursor\n\t\t\t);\n\n\t\tconst negotiations = pnapNegotiations.map(pnapNeg => {\n\t\t\tconst dspNegotiation: IDataspaceProtocolContractNegotiation = {\n\t\t\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\t\t\"@type\": DataspaceProtocolContractNegotiationTypes.ContractNegotiation,\n\t\t\t\tconsumerPid: pnapNeg.id,\n\t\t\t\tproviderPid: pnapNeg.correlationId,\n\t\t\t\tstate: pnapNeg.state\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tnegotiation: dspNegotiation,\n\t\t\t\tcreatedAt: pnapNeg.dateCreated,\n\t\t\t\tofferId: OdrlPolicyHelper.getUid(pnapNeg.offer),\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(pnapNeg.agreement)\n\t\t\t};\n\t\t});\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"negotiationHistoryRetrieved\",\n\t\t\tdata: {\n\t\t\t\tcount: negotiations.length,\n\t\t\t\tstate,\n\t\t\t\thasCursor: Boolean(nextCursor)\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tnegotiations,\n\t\t\tcursor: nextCursor,\n\t\t\tcount: negotiations.length\n\t\t};\n\t}\n\n\t// ============================================================================\n\t// RESOLVER METHODS - IDataspaceControlPlaneResolverComponent\n\t// ============================================================================\n\n\t/**\n\t * Resolve consumerPid to Transfer Context.\n\t * @param consumerPid Consumer Process ID.\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Context with Agreement, datasetId, and Transfer Process metadata.\n\t */\n\tpublic async resolveConsumerPid(\n\t\tconsumerPid: string,\n\t\ttrustPayload: unknown\n\t): Promise<ITransferContext> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(consumerPid), consumerPid);\n\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"resolveConsumerPid\");\n\n\t\tconst storageEntity = await this._transferProcessStorage.get(consumerPid);\n\n\t\tif (!storageEntity) {\n\t\t\tthrow new NotFoundError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"transferProcessNotFound\",\n\t\t\t\tundefined,\n\t\t\t\t{ consumerPid }\n\t\t\t);\n\t\t}\n\n\t\tconst entity = this.storageEntityToModel(storageEntity);\n\n\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.TERMINATED) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"transferProcessTerminated\", {\n\t\t\t\tconsumerPid\n\t\t\t});\n\t\t}\n\n\t\tconst agreement = await this.lookupAgreement(entity.agreementId);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst currentOrgId = contextIds?.[ContextIdKeys.Organization];\n\n\t\tif (!currentOrgId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"organizationContextMissing\",\n\t\t\t\t{\n\t\t\t\t\tconsumerPid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerId = Is.array(assignerIdentity) ? assignerIdentity[0] : assignerIdentity;\n\n\t\tif (assignerId !== currentOrgId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementAssignerMismatch\",\n\t\t\t\t{\n\t\t\t\t\tconsumerPid,\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\t\texpectedOrgId: currentOrgId,\n\t\t\t\t\tactualAssigner: assignerId\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"resolvedConsumerPid\",\n\t\t\tdata: {\n\t\t\t\tconsumerPid,\n\t\t\t\tdatasetId: entity.datasetId,\n\t\t\t\tstate: entity.state,\n\t\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\torganizationId: currentOrgId\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tagreement,\n\t\t\tdatasetId: entity.datasetId,\n\t\t\tofferId: entity.offerId,\n\t\t\tstate: entity.state,\n\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\tdataAddress: entity.dataAddress\n\t\t};\n\t}\n\n\t/**\n\t * Resolve providerPid to Transfer Context.\n\t * @param providerPid Provider Process ID.\n\t * @param trustPayload Trust payload containing authorization information (Base64-encoded token).\n\t * @returns Transfer Context with Agreement, datasetId, and Transfer Process metadata.\n\t */\n\tpublic async resolveProviderPid(\n\t\tproviderPid: string,\n\t\ttrustPayload: unknown\n\t): Promise<ITransferContext> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(providerPid), providerPid);\n\n\t\tawait TrustHelper.verifyTrust(this._trustComponent, trustPayload, \"resolveProviderPid\");\n\n\t\tconst { entity } = await this.lookupTransferByPid(providerPid);\n\n\t\tif (entity.state === DataspaceProtocolTransferProcessStateType.TERMINATED) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"transferProcessTerminatedProvider\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tconst agreement = await this.lookupAgreement(entity.agreementId);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst currentOrgId = contextIds?.[ContextIdKeys.Organization];\n\n\t\tif (!currentOrgId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"organizationContextMissingProvider\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Extract assigner UID (can be string, array, or IOdrlParty object)\n\n\t\tconst assignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst assignerId = Is.array(assignerIdentity) ? assignerIdentity[0] : assignerIdentity;\n\n\t\tif (assignerId !== currentOrgId) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementAssignerMismatchProvider\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid,\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\t\texpectedOrgId: currentOrgId,\n\t\t\t\t\tactualAssigner: assignerId\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Validate that Agreement assignee matches expected consumer identity\n\t\t// This ensures we're pushing to the correct consumer\n\t\t// If assignee is undefined but consumerIdentity has a value, this is also a mismatch\n\t\tconst assigneeIdentity = OdrlPolicyHelper.extractAssigneeIdentity(agreement);\n\t\tconst assigneeId = Is.array(assigneeIdentity) ? assigneeIdentity[0] : assigneeIdentity;\n\n\t\tif (assigneeId !== entity.consumerIdentity) {\n\t\t\tthrow new UnauthorizedError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementAssigneeMismatch\",\n\t\t\t\t{\n\t\t\t\t\tproviderPid,\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\t\texpectedConsumerIdentity: entity.consumerIdentity,\n\t\t\t\t\tactualAssignee: assigneeId\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"resolvedProviderPid\",\n\t\t\tdata: {\n\t\t\t\tproviderPid,\n\t\t\t\tdatasetId: entity.datasetId,\n\t\t\t\tstate: entity.state,\n\t\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\torganizationId: currentOrgId\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tagreement,\n\t\t\tdatasetId: entity.datasetId,\n\t\t\tofferId: entity.offerId,\n\t\t\tstate: entity.state,\n\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\tdataAddress: entity.dataAddress\n\t\t};\n\t}\n\n\t// ============================================================================\n\t// PRIVATE HELPER METHODS\n\t// ============================================================================\n\n\t/**\n\t * Cleanup stalled negotiations.\n\t * Called periodically by the task scheduler.\n\t * @internal\n\t */\n\tprivate async cleanupStalledNegotiations(): Promise<void> {\n\t\tconst now = Date.now();\n\t\tconst stalled: string[] = [];\n\n\t\tfor (const [negotiationId, state] of this._policyRequester.getActiveNegotiations()) {\n\t\t\tif (now - state.updatedAt > STALLED_NEGOTIATION_THRESHOLD_MS) {\n\t\t\t\tstalled.push(negotiationId);\n\t\t\t}\n\t\t}\n\n\t\tfor (const negotiationId of stalled) {\n\t\t\tthis._policyRequester.removeNegotiation(negotiationId);\n\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"stalledNegotiationCleanedUp\",\n\t\t\t\tdata: { negotiationId }\n\t\t\t});\n\n\t\t\tfor (const [key, cb] of this._negotiationCallbacks.entries()) {\n\t\t\t\ttry {\n\t\t\t\t\tawait cb.onFailed(negotiationId, \"negotiationStalled\");\n\t\t\t\t} catch (error) {\n\t\t\t\t\tawait this._loggingComponent?.log({\n\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\tts: Date.now(),\n\t\t\t\t\t\tmessage: \"negotiationCallbackError\",\n\t\t\t\t\t\tdata: { key, negotiationId, method: \"onFailed\", error }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (stalled.length > 0) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"stalledNegotiationsCleanupComplete\",\n\t\t\t\tdata: { cleanedUp: stalled.length }\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Convert a storage entity to model.\n\t * @param storageEntity The entity from storage.\n\t * @returns The model representation.\n\t * @internal\n\t */\n\tprivate storageEntityToModel(storageEntity: TransferProcess): ITransferProcess {\n\t\treturn {\n\t\t\tid: storageEntity.id,\n\t\t\tconsumerPid: storageEntity.consumerPid,\n\t\t\tproviderPid: storageEntity.providerPid,\n\t\t\tstate: storageEntity.state,\n\t\t\tagreementId: storageEntity.agreementId,\n\t\t\tdatasetId: storageEntity.datasetId,\n\t\t\tofferId: storageEntity.offerId,\n\t\t\tconsumerIdentity: storageEntity.consumerIdentity,\n\t\t\tproviderIdentity: storageEntity.providerIdentity,\n\t\t\tformat: storageEntity.format,\n\t\t\tcallbackAddress: storageEntity.callbackAddress,\n\t\t\tdateCreated: new Date(storageEntity.dateCreated),\n\t\t\tdateModified: new Date(storageEntity.dateModified),\n\t\t\tpolicies: storageEntity.policies,\n\t\t\tdataAddress: storageEntity.dataAddress\n\t\t};\n\t}\n\n\t/**\n\t * Convert a model to storage entity.\n\t * @param entity The model representation.\n\t * @returns The entity for storage.\n\t * @internal\n\t */\n\tprivate modelToStorageEntity(entity: ITransferProcess): TransferProcess {\n\t\treturn {\n\t\t\tid: entity.id,\n\t\t\tconsumerPid: entity.consumerPid,\n\t\t\tproviderPid: entity.providerPid,\n\t\t\tstate: entity.state,\n\t\t\tagreementId: entity.agreementId,\n\t\t\tdatasetId: entity.datasetId,\n\t\t\tofferId: entity.offerId,\n\t\t\tconsumerIdentity: entity.consumerIdentity,\n\t\t\tproviderIdentity: entity.providerIdentity,\n\t\t\tformat: entity.format,\n\t\t\tcallbackAddress: entity.callbackAddress,\n\t\t\tdateCreated: entity.dateCreated.toISOString(),\n\t\t\tdateModified: entity.dateModified.toISOString(),\n\t\t\tpolicies: entity.policies,\n\t\t\tdataAddress: entity.dataAddress\n\t\t};\n\t}\n\n\t/**\n\t * Look up Agreement from PAP.\n\t * @param agreementId Agreement ID.\n\t * @returns Agreement.\n\t * @internal\n\t */\n\tprivate async lookupAgreement(agreementId: string): Promise<IOdrlAgreement> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(agreementId), agreementId);\n\n\t\tlet agreement;\n\t\ttry {\n\t\t\tagreement = await this._policyAdministrationPointComponent.getAgreement(agreementId);\n\t\t} catch (error) {\n\t\t\tif (BaseError.isErrorName(error, NotFoundError.CLASS_NAME)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementLookupFailed\",\n\t\t\t\t{ agreementId },\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\n\t\treturn agreement;\n\t}\n\n\t/**\n\t * Extract dataset ID from Agreement target.\n\t * @param agreement Agreement.\n\t * @returns Dataset ID.\n\t * @internal\n\t */\n\tprivate extractDatasetId(agreement: IOdrlAgreement): string {\n\t\tif (Is.empty(agreement.target)) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"agreementMissingTarget\", {\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement)\n\t\t\t});\n\t\t}\n\n\t\tconst targetIds = OdrlPolicyHelper.getTargets(agreement);\n\n\t\tif (targetIds.length === 0) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"agreementTargetMissingUid\", {\n\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement)\n\t\t\t});\n\t\t}\n\n\t\t// Validate single target, multiple targets are not currently supported\n\t\tif (targetIds.length > 1) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\"agreementMultipleTargetsNotSupported\",\n\t\t\t\t{\n\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement),\n\t\t\t\t\ttargetCount: targetIds.length\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\treturn targetIds[0];\n\t}\n\n\t/**\n\t * Validate that the dataset exists in the Federated Catalogue.\n\t * @param datasetId Dataset identifier extracted from Agreement.\n\t * @param agreement The Agreement being validated.\n\t * @internal\n\t */\n\tprivate async validateCatalogDataset(\n\t\tdatasetId: string,\n\t\tagreement: IOdrlAgreement\n\t): Promise<void> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(datasetId), datasetId);\n\t\tGuards.object<IOdrlAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\n\t\t// Lookup dataset in catalog\n\t\tconst catalogResult = await this._federatedCatalogueComponent.get(datasetId);\n\n\t\tif (isCatalogError(catalogResult)) {\n\t\t\tif (isCatalogErrorName(catalogResult, NotFoundError.CLASS_NAME)) {\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\t\t\"datasetNotInCatalog\",\n\t\t\t\t\tdatasetId,\n\t\t\t\t\t{\n\t\t\t\t\t\tdatasetId,\n\t\t\t\t\t\tagreementId: OdrlPolicyHelper.getUid(agreement)\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"catalogLookupFailed\", {\n\t\t\t\tdatasetId,\n\t\t\t\tagreementId: agreement.uid,\n\t\t\t\terrorCode: catalogResult.code\n\t\t\t});\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"catalogDatasetFound\",\n\t\t\tdata: {\n\t\t\t\tdatasetId,\n\t\t\t\tagreementId: agreement.uid,\n\t\t\t\tdatasetTitle: catalogResult[\"dcterms:title\"]\n\t\t\t}\n\t\t});\n\n\t\tawait this.validateAgreementMatchesOffer(agreement, catalogResult);\n\t}\n\n\t/**\n\t * Extract PID from DSP message and lookup Transfer Process with role detection.\n\t * @param message DSP protocol message with consumerPid and/or providerPid fields.\n\t * @returns Transfer Process entity and our role in this transfer.\n\t * @internal\n\t */\n\tprivate async lookupTransferByMessage(message: {\n\t\tconsumerPid?: string;\n\t\tproviderPid?: string;\n\t}): Promise<{\n\t\tentity: ITransferProcess;\n\t\trole: TransferProcessRole;\n\t}> {\n\t\tconst pid = message.consumerPid ?? message.providerPid;\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, \"pid\", pid);\n\n\t\treturn this.lookupTransferByPid(pid);\n\t}\n\n\t/**\n\t * Lookup Transfer Process by PID and determine our role.\n\t * @param pid Either consumerPid or providerPid.\n\t * @returns Transfer Process entity and our role in this transfer.\n\t * @internal\n\t */\n\tprivate async lookupTransferByPid(pid: string): Promise<{\n\t\tentity: ITransferProcess;\n\t\trole: TransferProcessRole;\n\t}> {\n\t\tGuards.stringValue(DataspaceControlPlaneService.CLASS_NAME, nameof(pid), pid);\n\n\t\t// Check if pid is a consumerPid (primary key lookup)\n\t\tconst storageEntity = await this._transferProcessStorage.get(pid);\n\n\t\tif (storageEntity) {\n\t\t\treturn {\n\t\t\t\tentity: this.storageEntityToModel(storageEntity),\n\t\t\t\trole: TransferProcessRole.Consumer\n\t\t\t};\n\t\t}\n\n\t\t// Check if pid is a providerPid (secondary key lookup)\n\t\tconst providerPidEntity = await this._transferProcessStorage.get(pid, \"providerPid\");\n\t\tif (providerPidEntity) {\n\t\t\treturn {\n\t\t\t\tentity: this.storageEntityToModel(providerPidEntity),\n\t\t\t\trole: TransferProcessRole.Provider\n\t\t\t};\n\t\t}\n\n\t\tthrow new NotFoundError(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\"transferProcessNotFound\",\n\t\t\tpid,\n\t\t\t{\n\t\t\t\tpid\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Get raw policy entries from a catalog dataset.\n\t * @param catalogDataset Catalog dataset.\n\t * @returns Raw policy entries.\n\t * @internal\n\t */\n\tprivate getCatalogDatasetPolicies(\n\t\tcatalogDataset: IDcatDataset | IDataspaceProtocolDataset\n\t): JsonLdObjectWithNoContext<IOdrlPolicy>[] {\n\t\t// Support both \"odrl:hasPolicy\" and \"hasPolicy\" to accommodate different catalog implementations\n\t\tif (Is.object<IDcatDataset>(catalogDataset) && !Is.empty(catalogDataset[\"odrl:hasPolicy\"])) {\n\t\t\treturn (\n\t\t\t\tArrayHelper.fromObjectOrArray<JsonLdObjectWithNoContext<IOdrlPolicy>>(\n\t\t\t\t\tcatalogDataset[\"odrl:hasPolicy\"]\n\t\t\t\t) ?? []\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\tIs.object<IDataspaceProtocolDataset>(catalogDataset) &&\n\t\t\t!Is.empty(catalogDataset.hasPolicy)\n\t\t) {\n\t\t\treturn (\n\t\t\t\tArrayHelper.fromObjectOrArray<JsonLdObjectWithNoContext<IOdrlPolicy>>(\n\t\t\t\t\tcatalogDataset.hasPolicy\n\t\t\t\t) ?? []\n\t\t\t);\n\t\t}\n\n\t\treturn [];\n\t}\n\n\t/**\n\t * Validate that the Agreement policies match at least one Catalog Offer.\n\t * @param agreement Agreement to validate.\n\t * @param catalogDataset Catalog dataset containing Offers.\n\t * @internal\n\t */\n\tprivate async validateAgreementMatchesOffer(\n\t\tagreement: IOdrlAgreement,\n\t\tcatalogDataset: IDcatDataset\n\t): Promise<void> {\n\t\tGuards.object<IOdrlAgreement>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(agreement),\n\t\t\tagreement\n\t\t);\n\t\tGuards.object<IDcatDataset>(\n\t\t\tDataspaceControlPlaneService.CLASS_NAME,\n\t\t\tnameof(catalogDataset),\n\t\t\tcatalogDataset\n\t\t);\n\n\t\tconst rawOffers = this.getCatalogDatasetPolicies(catalogDataset);\n\n\t\tif (!Is.arrayValue(rawOffers)) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"catalogDatasetHasNoOffers\",\n\t\t\t\tdata: {\n\t\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\",\n\t\t\t\t\tagreementId: agreement.uid\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst catalogOffers = rawOffers.filter(offer => Is.object<IOdrlPolicy>(offer));\n\n\t\tif (!Is.arrayValue(catalogOffers)) {\n\t\t\tawait this._loggingComponent?.log({\n\t\t\t\tlevel: \"warn\",\n\t\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"catalogDatasetHasNoOffers\",\n\t\t\t\tdata: {\n\t\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\",\n\t\t\t\t\tagreementId: agreement.uid\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst matchingOffer = catalogOffers.find(\n\t\t\t(offer: IOdrlPolicy) =>\n\t\t\t\tOdrlPolicyHelper.getUid(offer) === agreement.uid ||\n\t\t\t\tthis.isPolicyDerivedFrom(agreement, offer)\n\t\t);\n\n\t\tif (!matchingOffer) {\n\t\t\tthrow new GeneralError(DataspaceControlPlaneService.CLASS_NAME, \"agreementNotMatchingOffer\", {\n\t\t\t\tagreementId: agreement.uid,\n\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\",\n\t\t\t\tavailableOffers: catalogOffers\n\t\t\t\t\t.map((o: IOdrlPolicy) => OdrlPolicyHelper.getUid(o) ?? \"unknown\")\n\t\t\t\t\t.join(\", \")\n\t\t\t});\n\t\t}\n\n\t\tawait this._loggingComponent?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: DataspaceControlPlaneService.CLASS_NAME,\n\t\t\tts: Date.now(),\n\t\t\tmessage: \"agreementMatchedOffer\",\n\t\t\tdata: {\n\t\t\t\tagreementId: agreement.uid,\n\t\t\t\tofferId: OdrlPolicyHelper.getUid(matchingOffer) ?? \"\",\n\t\t\t\tdatasetId: getJsonLdId(catalogDataset) ?? \"\"\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Check if an Agreement is derived from an Offer.\n\t * @param agreement Agreement to check.\n\t * @param offer Offer to compare against.\n\t * @returns True if Agreement appears derived from Offer.\n\t * @internal\n\t */\n\tprivate isPolicyDerivedFrom(agreement: IOdrlAgreement, offer: IOdrlPolicy): boolean {\n\t\tconst agreementTargets = OdrlPolicyHelper.getTargets(agreement);\n\t\tconst offerTargets = OdrlPolicyHelper.getTargets(offer);\n\n\t\tif (\n\t\t\tagreementTargets.length === 0 ||\n\t\t\tofferTargets.length === 0 ||\n\t\t\t!agreementTargets.some((agreementTarget: string) => offerTargets.includes(agreementTarget))\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst agreementAssignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(agreement);\n\t\tconst offerAssignerIdentity = OdrlPolicyHelper.extractAssignerIdentity(offer);\n\n\t\tconst agreementAssigner = ArrayHelper.fromObjectOrArray(agreementAssignerIdentity);\n\t\tconst offerAssigner = ArrayHelper.fromObjectOrArray(offerAssignerIdentity);\n\n\t\tif (!agreementAssigner.some(assigner => offerAssigner.includes(assigner))) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!Is.array(agreement.permission) || !Is.array(offer.permission)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Ensure the dataset has a publisher set.\n\t * @param dataset The dataset.\n\t * @returns The dataset with publisher set.\n\t * @internal\n\t */\n\tprivate async ensurePublisher(\n\t\tdataset: IDataspaceProtocolDataset\n\t): Promise<IDataspaceProtocolDataset> {\n\t\tif (dataset[\"dcterms:publisher\"]) {\n\t\t\treturn dataset;\n\t\t}\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst orgId = contextIds?.[ContextIdKeys.Organization];\n\n\t\tif (orgId) {\n\t\t\treturn {\n\t\t\t\t...dataset,\n\t\t\t\t\"dcterms:publisher\": orgId\n\t\t\t};\n\t\t}\n\n\t\treturn dataset;\n\t}\n}\n"]}
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright 2025 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
export * from "./dataspaceControlPlanePolicyRequester.js";
|
|
4
|
+
export * from "./dataspaceControlPlaneRoutes.js";
|
|
5
|
+
export * from "./dataspaceControlPlaneService.js";
|
|
6
|
+
export * from "./models/IDataspaceControlPlaneServiceConfig.js";
|
|
7
|
+
export * from "./models/IDataspaceControlPlaneServiceConstructorOptions.js";
|
|
8
|
+
export * from "./models/INegotiationState.js";
|
|
9
|
+
export * from "./restEntryPoints.js";
|
|
10
|
+
export * from "./schema.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,iDAAiD,CAAC;AAChE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./dataspaceControlPlanePolicyRequester.js\";\nexport * from \"./dataspaceControlPlaneRoutes.js\";\nexport * from \"./dataspaceControlPlaneService.js\";\nexport * from \"./models/IDataspaceControlPlaneServiceConfig.js\";\nexport * from \"./models/IDataspaceControlPlaneServiceConstructorOptions.js\";\nexport * from \"./models/INegotiationState.js\";\nexport * from \"./restEntryPoints.js\";\nexport * from \"./schema.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDataspaceControlPlaneServiceConfig.js","sourceRoot":"","sources":["../../../src/models/IDataspaceControlPlaneServiceConfig.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Dataspace Control Plane service configuration.\n */\nexport interface IDataspaceControlPlaneServiceConfig {\n\t/**\n\t * Override the default trust generator type for token generation.\n\t * If not specified, the default trust generator configured in the trust component will be used.\n\t */\n\toverrideTrustGeneratorType?: string;\n\n\t/**\n\t * Data plane endpoint path for PULL transfers (path only, not full URL).\n\t * Will be combined with the public origin from the hosting component.\n\t *\n\t * REQUIRED if PULL transfers are supported.\n\t * If not specified, PULL transfers will not be available.\n\t *\n\t * Example: \"data-plane/data\" or \"api/data-plane/data\"\n\t */\n\tdataPlanePath?: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDataspaceControlPlaneServiceConstructorOptions.js","sourceRoot":"","sources":["../../../src/models/IDataspaceControlPlaneServiceConstructorOptions.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IDataspaceControlPlaneServiceConfig } from \"./IDataspaceControlPlaneServiceConfig.js\";\n\n/**\n * Dataspace Control Plane service constructor options.\n */\nexport interface IDataspaceControlPlaneServiceConstructorOptions {\n\t/**\n\t * Policy Administration Point component type.\n\t * Used for Agreement lookup and validation during Transfer Process initiation.\n\t * @default policy-administration-point\n\t */\n\tpolicyAdministrationPointComponentType?: string;\n\n\t/**\n\t * Policy Negotiation Point component type.\n\t * Used for contract negotiation to create agreements before transfer processes.\n\t * @default policy-negotiation-point\n\t */\n\tpolicyNegotiationPointComponentType?: string;\n\n\t/**\n\t * Policy Negotiation Admin Point component type.\n\t * Used for querying negotiation history.\n\t * Optional - if not provided, negotiation history will not be available.\n\t * @default policy-negotiation-admin-point\n\t */\n\tpolicyNegotiationAdminPointComponentType?: string;\n\n\t/**\n\t * Federated Catalogue component type.\n\t * Used for dataset validation during Transfer Process initiation.\n\t * Validates that Agreements reference valid catalog datasets.\n\t * @default federated-catalogue\n\t */\n\tfederatedCatalogueComponentType?: string;\n\n\t/**\n\t * Logging component type.\n\t * @default logging\n\t */\n\tloggingComponentType?: string;\n\n\t/**\n\t * Identity component type (for token signing/verification).\n\t * @default identity\n\t */\n\tidentityComponentType?: string;\n\n\t/**\n\t * Identity Authentication component type (for token validation).\n\t * @default identity-authentication\n\t */\n\tidentityAuthenticationComponentType?: string;\n\n\t/**\n\t * Trust component type for trust verification.\n\t * Used to verify JWT/VC tokens and extract identity information.\n\t * @default trust\n\t */\n\ttrustComponentType?: string;\n\n\t/**\n\t * Entity storage type for Transfer Process entities.\n\t * Used to persist transfer state for the consumerPid flow.\n\t * Must match the Data Plane's transferProcessEntityStorageType for shared storage.\n\t * @default transfer-process\n\t */\n\ttransferProcessEntityStorageType?: string;\n\n\t/**\n\t * Task scheduler component type for periodic cleanup of stalled negotiations.\n\t * @default task-scheduler\n\t */\n\ttaskSchedulerComponentType?: string;\n\n\t/**\n\t * The configuration of the Dataspace Control Plane Service.\n\t */\n\tconfig?: IDataspaceControlPlaneServiceConfig;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"INegotiationState.js","sourceRoot":"","sources":["../../../src/models/INegotiationState.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\nimport type { DataspaceProtocolContractNegotiationStateType } from \"@twin.org/standards-dataspace-protocol\";\nimport type { IOdrlAgreement } from \"@twin.org/standards-w3c-odrl\";\n\n/**\n * Negotiation state tracked internally for callback routing.\n */\nexport interface INegotiationState {\n\t/**\n\t * The negotiation ID (self-reference for lookup).\n\t */\n\tnegotiationId: string;\n\n\t/**\n\t * Current negotiation state.\n\t */\n\tstate: DataspaceProtocolContractNegotiationStateType;\n\n\t/**\n\t * Agreement received from provider (stored until finalized).\n\t */\n\tagreement?: IOdrlAgreement;\n\n\t/**\n\t * Timestamp when negotiation started.\n\t */\n\tstartedAt: number;\n\n\t/**\n\t * Timestamp when negotiation state was last updated.\n\t */\n\tupdatedAt: number;\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { generateRestRoutesDataspaceControlPlane, tagsDataspaceControlPlane } from "./dataspaceControlPlaneRoutes.js";
|
|
2
|
+
/**
|
|
3
|
+
* Entry points for the REST API.
|
|
4
|
+
* Defines REST routes for DSP protocol only.
|
|
5
|
+
* Resolver methods (IDataspaceControlPlaneResolverComponent).
|
|
6
|
+
*/
|
|
7
|
+
export const restEntryPoints = [
|
|
8
|
+
{
|
|
9
|
+
name: "dataspace-control-plane",
|
|
10
|
+
defaultBaseRoute: "dataspace-control-plane",
|
|
11
|
+
tags: tagsDataspaceControlPlane,
|
|
12
|
+
generateRoutes: generateRestRoutesDataspaceControlPlane
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
//# sourceMappingURL=restEntryPoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restEntryPoints.js","sourceRoot":"","sources":["../../src/restEntryPoints.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,uCAAuC,EACvC,yBAAyB,EACzB,MAAM,kCAAkC,CAAC;AAE1C;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAA2B;IACtD;QACC,IAAI,EAAE,yBAAyB;QAC/B,gBAAgB,EAAE,yBAAyB;QAC3C,IAAI,EAAE,yBAAyB;QAC/B,cAAc,EAAE,uCAAuC;KACvD;CACD,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IRestRouteEntryPoint } from \"@twin.org/api-models\";\nimport {\n\tgenerateRestRoutesDataspaceControlPlane,\n\ttagsDataspaceControlPlane\n} from \"./dataspaceControlPlaneRoutes.js\";\n\n/**\n * Entry points for the REST API.\n * Defines REST routes for DSP protocol only.\n * Resolver methods (IDataspaceControlPlaneResolverComponent).\n */\nexport const restEntryPoints: IRestRouteEntryPoint[] = [\n\t{\n\t\tname: \"dataspace-control-plane\",\n\t\tdefaultBaseRoute: \"dataspace-control-plane\",\n\t\ttags: tagsDataspaceControlPlane,\n\t\tgenerateRoutes: generateRestRoutesDataspaceControlPlane\n\t}\n];\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright 2025 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { TransferProcess } from "@twin.org/dataspace-models";
|
|
4
|
+
import { EntitySchemaFactory, EntitySchemaHelper } from "@twin.org/entity";
|
|
5
|
+
/**
|
|
6
|
+
* Inits schemas for Control Plane entities.
|
|
7
|
+
*/
|
|
8
|
+
export function initSchema() {
|
|
9
|
+
EntitySchemaFactory.register("TransferProcess", () => EntitySchemaHelper.getSchema(TransferProcess));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG3E;;GAEG;AACH,MAAM,UAAU,UAAU;IACzB,mBAAmB,CAAC,QAAQ,oBAA4B,GAAG,EAAE,CAC5D,kBAAkB,CAAC,SAAS,CAAC,eAAe,CAAC,CAC7C,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { TransferProcess } from \"@twin.org/dataspace-models\";\nimport { EntitySchemaFactory, EntitySchemaHelper } from \"@twin.org/entity\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Inits schemas for Control Plane entities.\n */\nexport function initSchema(): void {\n\tEntitySchemaFactory.register(nameof<TransferProcess>(), () =>\n\t\tEntitySchemaHelper.getSchema(TransferProcess)\n\t);\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright 2025 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { ObjectHelper } from "@twin.org/core";
|
|
4
|
+
/**
|
|
5
|
+
* Get a JSON-LD id.
|
|
6
|
+
* @param object The object to get the id from.
|
|
7
|
+
* @returns The JSON-LD id.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export function getJsonLdId(object) {
|
|
11
|
+
return ObjectHelper.extractProperty(object, ["@id", "id"], false);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get a JSON-LD type.
|
|
15
|
+
* @param object The object to get the type from.
|
|
16
|
+
* @returns The JSON-LD type.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export function getJsonLdType(object) {
|
|
20
|
+
return ObjectHelper.extractProperty(object, ["@type", "type"], false);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=dataHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataHelpers.js","sourceRoot":"","sources":["../../../src/utils/dataHelpers.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,MAAe;IAC1C,OAAO,YAAY,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;AACnE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,MAAe;IAC5C,OAAO,YAAY,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC;AACvE,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\nimport { ObjectHelper } from \"@twin.org/core\";\n\n/**\n * Get a JSON-LD id.\n * @param object The object to get the id from.\n * @returns The JSON-LD id.\n * @internal\n */\nexport function getJsonLdId(object: unknown): string | undefined {\n\treturn ObjectHelper.extractProperty(object, [\"@id\", \"id\"], false);\n}\n\n/**\n * Get a JSON-LD type.\n * @param object The object to get the type from.\n * @returns The JSON-LD type.\n * @internal\n */\nexport function getJsonLdType(object: unknown): string | undefined {\n\treturn ObjectHelper.extractProperty(object, [\"@type\", \"type\"], false);\n}\n"]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Copyright 2025 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { HttpErrorHelper } from "@twin.org/api-models";
|
|
4
|
+
import { BaseError, Is } from "@twin.org/core";
|
|
5
|
+
import { DataspaceProtocolCatalogTypes, DataspaceProtocolContexts, DataspaceProtocolTransferProcessTypes } from "@twin.org/standards-dataspace-protocol";
|
|
6
|
+
import { HttpStatusCode } from "@twin.org/web";
|
|
7
|
+
import { getJsonLdType } from "./dataHelpers.js";
|
|
8
|
+
/**
|
|
9
|
+
* Fallback value used when PIDs cannot be extracted from a malformed message.
|
|
10
|
+
* DSP protocol requires consumerPid and providerPid in TransferError responses,
|
|
11
|
+
* so we must provide a value even when the request is completely malformed.
|
|
12
|
+
*/
|
|
13
|
+
const UNKNOWN_PID = "urn:dsp:unknown";
|
|
14
|
+
/**
|
|
15
|
+
* Transform an error to DS Protocol TransferError format.
|
|
16
|
+
* Used by both service and route layers to ensure consistent error responses.
|
|
17
|
+
* Following the same pattern as Federated Catalogue's catalogErrorUtils.ts.
|
|
18
|
+
* The code property uses semantic format "ErrorName:message".
|
|
19
|
+
* The reason property contains the full flattened error chain for debugging.
|
|
20
|
+
* @param error The error to transform.
|
|
21
|
+
* @param pids Optional object containing consumerPid and/or providerPid.
|
|
22
|
+
* @param pids.consumerPid Optional consumer process ID.
|
|
23
|
+
* @param pids.providerPid Optional provider process ID.
|
|
24
|
+
* @returns The TransferError.
|
|
25
|
+
*/
|
|
26
|
+
export function transformToTransferError(error, pids) {
|
|
27
|
+
const flattened = BaseError.flatten(error);
|
|
28
|
+
return {
|
|
29
|
+
"@context": [DataspaceProtocolContexts.Context],
|
|
30
|
+
"@type": DataspaceProtocolTransferProcessTypes.TransferError,
|
|
31
|
+
consumerPid: pids?.consumerPid ?? UNKNOWN_PID,
|
|
32
|
+
providerPid: pids?.providerPid ?? UNKNOWN_PID,
|
|
33
|
+
code: `${flattened[0].name}:${flattened[0].message}`,
|
|
34
|
+
reason: flattened
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Transform the DS Protocol result to an HTTP status code.
|
|
39
|
+
* Used by the routes layer to derive HTTP status from TransferError.
|
|
40
|
+
*
|
|
41
|
+
* @param result The result to transform.
|
|
42
|
+
* @returns The transformed status code or undefined if no transformation was found or not an error.
|
|
43
|
+
*/
|
|
44
|
+
export function transformErrorToStatusCode(result) {
|
|
45
|
+
// Is this a transfer error?
|
|
46
|
+
if (Is.object(result) &&
|
|
47
|
+
result["@type"] === DataspaceProtocolTransferProcessTypes.TransferError) {
|
|
48
|
+
// Extract the error name to map to status codes
|
|
49
|
+
if (result.code) {
|
|
50
|
+
const codePart = result.code.split(":")[0];
|
|
51
|
+
return HttpErrorHelper.ERROR_TYPE_MAP[codePart] ?? HttpStatusCode.badRequest;
|
|
52
|
+
}
|
|
53
|
+
return HttpStatusCode.badRequest;
|
|
54
|
+
}
|
|
55
|
+
// Regular error
|
|
56
|
+
if (Is.object(result) && !BaseError.isEmpty(result)) {
|
|
57
|
+
return HttpErrorHelper.ERROR_TYPE_MAP[result.name] ?? HttpStatusCode.badRequest;
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Check if a CatalogError contains a specific error name in its code.
|
|
63
|
+
* @param error The CatalogError to check.
|
|
64
|
+
* @param errorName The error name to check for (e.g., NotFoundError.CLASS_NAME).
|
|
65
|
+
* @returns True if the error code contains the specified error name.
|
|
66
|
+
*/
|
|
67
|
+
export function isCatalogErrorName(error, errorName) {
|
|
68
|
+
return error.code?.includes(errorName) ?? false;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Check if a CatalogError contains a specific error name in its code.
|
|
72
|
+
* @param error The CatalogError to check.
|
|
73
|
+
* @returns True if the error code contains the specified error name.
|
|
74
|
+
*/
|
|
75
|
+
export function isCatalogError(error) {
|
|
76
|
+
return getJsonLdType(error) === DataspaceProtocolCatalogTypes.CatalogError;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=transferErrorUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transferErrorUtils.js","sourceRoot":"","sources":["../../../src/utils/transferErrorUtils.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAe,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EACN,6BAA6B,EAC7B,yBAAyB,EACzB,qCAAqC,EAGrC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,wBAAwB,CACvC,KAAc,EACd,IAAqD;IAErD,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAE3C,OAAO;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AACjD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC5C,OAAO,aAAa,CAAC,KAAK,CAAC,KAAK,6BAA6B,CAAC,YAAY,CAAC;AAC5E,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { HttpErrorHelper } from \"@twin.org/api-models\";\nimport { BaseError, type IError, Is } from \"@twin.org/core\";\nimport {\n\tDataspaceProtocolCatalogTypes,\n\tDataspaceProtocolContexts,\n\tDataspaceProtocolTransferProcessTypes,\n\ttype IDataspaceProtocolCatalogError,\n\ttype IDataspaceProtocolTransferError\n} from \"@twin.org/standards-dataspace-protocol\";\nimport { HttpStatusCode } from \"@twin.org/web\";\nimport { getJsonLdType } from \"./dataHelpers.js\";\n\n/**\n * Fallback value used when PIDs cannot be extracted from a malformed message.\n * DSP protocol requires consumerPid and providerPid in TransferError responses,\n * so we must provide a value even when the request is completely malformed.\n */\nconst UNKNOWN_PID = \"urn:dsp:unknown\";\n\n/**\n * Transform an error to DS Protocol TransferError format.\n * Used by both service and route layers to ensure consistent error responses.\n * Following the same pattern as Federated Catalogue's catalogErrorUtils.ts.\n * The code property uses semantic format \"ErrorName:message\".\n * The reason property contains the full flattened error chain for debugging.\n * @param error The error to transform.\n * @param pids Optional object containing consumerPid and/or providerPid.\n * @param pids.consumerPid Optional consumer process ID.\n * @param pids.providerPid Optional provider process ID.\n * @returns The TransferError.\n */\nexport function transformToTransferError(\n\terror: unknown,\n\tpids?: { consumerPid?: string; providerPid?: string }\n): IDataspaceProtocolTransferError {\n\tconst flattened = BaseError.flatten(error);\n\n\treturn {\n\t\t\"@context\": [DataspaceProtocolContexts.Context],\n\t\t\"@type\": DataspaceProtocolTransferProcessTypes.TransferError,\n\t\tconsumerPid: pids?.consumerPid ?? UNKNOWN_PID,\n\t\tproviderPid: pids?.providerPid ?? UNKNOWN_PID,\n\t\tcode: `${flattened[0].name}:${flattened[0].message}`,\n\t\treason: flattened\n\t};\n}\n\n/**\n * Transform the DS Protocol result to an HTTP status code.\n * Used by the routes layer to derive HTTP status from TransferError.\n *\n * @param result The result to transform.\n * @returns The transformed status code or undefined if no transformation was found or not an error.\n */\nexport function transformErrorToStatusCode(result: unknown): HttpStatusCode | undefined {\n\t// Is this a transfer error?\n\tif (\n\t\tIs.object<IDataspaceProtocolTransferError>(result) &&\n\t\tresult[\"@type\"] === DataspaceProtocolTransferProcessTypes.TransferError\n\t) {\n\t\t// Extract the error name to map to status codes\n\t\tif (result.code) {\n\t\t\tconst codePart = result.code.split(\":\")[0];\n\t\t\treturn HttpErrorHelper.ERROR_TYPE_MAP[codePart] ?? HttpStatusCode.badRequest;\n\t\t}\n\t\treturn HttpStatusCode.badRequest;\n\t}\n\n\t// Regular error\n\tif (Is.object<IError>(result) && !BaseError.isEmpty(result)) {\n\t\treturn HttpErrorHelper.ERROR_TYPE_MAP[result.name] ?? HttpStatusCode.badRequest;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Check if a CatalogError contains a specific error name in its code.\n * @param error The CatalogError to check.\n * @param errorName The error name to check for (e.g., NotFoundError.CLASS_NAME).\n * @returns True if the error code contains the specified error name.\n */\nexport function isCatalogErrorName(\n\terror: IDataspaceProtocolCatalogError,\n\terrorName: string\n): boolean {\n\treturn error.code?.includes(errorName) ?? false;\n}\n\n/**\n * Check if a CatalogError contains a specific error name in its code.\n * @param error The CatalogError to check.\n * @returns True if the error code contains the specified error name.\n */\nexport function isCatalogError(error: unknown): error is IDataspaceProtocolCatalogError {\n\treturn getJsonLdType(error) === DataspaceProtocolCatalogTypes.CatalogError;\n}\n"]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { INegotiationCallback } from "@twin.org/dataspace-models";
|
|
2
|
+
import type { IPolicyRequester } from "@twin.org/rights-management-models";
|
|
3
|
+
import type { IOdrlAgreement, IOdrlOffer } from "@twin.org/standards-w3c-odrl";
|
|
4
|
+
import type { INegotiationState } from "./models/INegotiationState.js";
|
|
5
|
+
/**
|
|
6
|
+
* Policy Requester for Dataspace Control Plane.
|
|
7
|
+
*
|
|
8
|
+
* Handles contract negotiation callbacks from PNP and forwards state changes
|
|
9
|
+
* to the control plane service via the INegotiationCallback interface.
|
|
10
|
+
*
|
|
11
|
+
* Callback Flow:
|
|
12
|
+
* 1. Control Plane initiates negotiation via PNP.sendRequestToProvider()
|
|
13
|
+
* 2. PNP calls offer() → auto-accept, notify control plane
|
|
14
|
+
* 3. PNP calls agreement() → store agreement, notify control plane
|
|
15
|
+
* 4. PNP calls finalised() → notify control plane with agreementId
|
|
16
|
+
* 5. Control plane notifies upstream caller (e.g. supply-chain)
|
|
17
|
+
*/
|
|
18
|
+
export declare class DataspaceControlPlanePolicyRequester implements IPolicyRequester {
|
|
19
|
+
/**
|
|
20
|
+
* Runtime name for the class.
|
|
21
|
+
*/
|
|
22
|
+
static readonly CLASS_NAME: string;
|
|
23
|
+
/**
|
|
24
|
+
* Create a new instance of DataspaceControlPlanePolicyRequester.
|
|
25
|
+
* @param loggingComponentType Optional logging component type.
|
|
26
|
+
* @param callback Optional callback interface for state change notifications.
|
|
27
|
+
*/
|
|
28
|
+
constructor(loggingComponentType?: string, callback?: INegotiationCallback);
|
|
29
|
+
/**
|
|
30
|
+
* Returns the class name of the component.
|
|
31
|
+
* @returns The class name of the component.
|
|
32
|
+
*/
|
|
33
|
+
className(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Register a negotiation for tracking.
|
|
36
|
+
* Called by the control plane service after initiating a negotiation via PNP.
|
|
37
|
+
* @param negotiationId The negotiation ID returned by PNP.sendRequestToProvider().
|
|
38
|
+
*/
|
|
39
|
+
trackNegotiation(negotiationId: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Get all active negotiations (for stalled cleanup).
|
|
42
|
+
* @returns Map of negotiationId to negotiation state.
|
|
43
|
+
*/
|
|
44
|
+
getActiveNegotiations(): Map<string, INegotiationState>;
|
|
45
|
+
/**
|
|
46
|
+
* Remove a negotiation from tracking (for cleanup).
|
|
47
|
+
* @param negotiationId The negotiation ID to remove.
|
|
48
|
+
*/
|
|
49
|
+
removeNegotiation(negotiationId: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* A policy has been offered by a provider.
|
|
52
|
+
* Called by PNP when provider sends an OfferMessage.
|
|
53
|
+
* @param negotiationId The id of the negotiation.
|
|
54
|
+
* @param offer The offer sent by the provider.
|
|
55
|
+
* @returns True if the offer was accepted, false otherwise.
|
|
56
|
+
*/
|
|
57
|
+
offer(negotiationId: string, offer: IOdrlOffer): Promise<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* A policy agreement has been sent by a provider.
|
|
60
|
+
* Called by PNP when provider sends an AgreementMessage.
|
|
61
|
+
* @param negotiationId The id of the negotiation.
|
|
62
|
+
* @param agreement The agreement sent by the provider.
|
|
63
|
+
* @returns True if the agreement was accepted, false otherwise.
|
|
64
|
+
*/
|
|
65
|
+
agreement(negotiationId: string, agreement: IOdrlAgreement): Promise<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* A policy finalisation has been sent by a provider.
|
|
68
|
+
* Called by PNP when provider sends a FinalizedEvent.
|
|
69
|
+
* @param negotiationId The id of the negotiation.
|
|
70
|
+
* @returns Nothing.
|
|
71
|
+
*/
|
|
72
|
+
finalised(negotiationId: string): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* A policy termination has been sent by a provider.
|
|
75
|
+
* Called by PNP when provider sends a TerminatedMessage or negotiation fails.
|
|
76
|
+
* @param negotiationId The id of the negotiation.
|
|
77
|
+
* @returns Nothing.
|
|
78
|
+
*/
|
|
79
|
+
terminated(negotiationId: string): Promise<void>;
|
|
80
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IRestRoute, ITag } from "@twin.org/api-models";
|
|
2
|
+
/**
|
|
3
|
+
* The tags to associate with the DSP protocol routes.
|
|
4
|
+
*/
|
|
5
|
+
export declare const tagsDataspaceControlPlane: ITag[];
|
|
6
|
+
/**
|
|
7
|
+
* The REST routes for dataspace control plane (DSP Protocol only).
|
|
8
|
+
* These routes implement the Eclipse Dataspace Protocol Transfer Process Protocol.
|
|
9
|
+
*
|
|
10
|
+
* Contract Negotiation is handled internally via PNP callbacks — no REST endpoints needed.
|
|
11
|
+
* PNP registers its own inbound callback routes for negotiation messages from providers.
|
|
12
|
+
*
|
|
13
|
+
* @param baseRouteName Prefix to prepend to the paths.
|
|
14
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
15
|
+
* @returns The generated DSP protocol routes.
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateRestRoutesDataspaceControlPlane(baseRouteName: string, componentName: string): IRestRoute[];
|