TWIN Dataspace Data Plane Service
Dataspace Data Plane contract implementation and REST endpoint definitions.
Installation
npm install @twin.org/dataspace-data-plane-service
Overview
The Data Plane handles data access requests, delegating to Dataspace Apps for actual data retrieval while enforcing policies from transfer agreements.
Key Features
- consumerPid Flow: Supports
consumerPidparameter for transfer-based access - Shared Storage Integration: Reads
TransferProcessEntityfrom Control Plane storage - Policy Enforcement: Applies ODRL prohibitions and constraints from agreements
- App Delegation: Delegates data retrieval to registered Dataspace Apps
- Backward Compatibility: Still supports direct
datasetIdparameter (deprecated)
Constructor Options
loggingComponentType(default:logging) - Logging component typebackgroundTaskComponentType(default:background-task) - Background task componenttaskSchedulerComponentType(default:task-scheduler) - Task scheduler componentactivityLogEntityStorageType(default:activity-log-details) - Activity log storageactivityTaskEntityStorageType(default:activity-task) - Activity task storagetransferProcessEntityStorageType(required) - Entity storage for reading transfer processestrustComponentType(default:trust) - Trust validation component
consumerPid Flow
When consumerPid is provided, the Data Plane:
- Validates the transfer token from Authorization header
- Looks up
TransferProcessEntitybyconsumerPid - Validates transfer state is
STARTED - Extracts
datasetIdfrom the transfer process - Finds the App registered for that dataset
- Delegates query to the App
- Applies policy filters from the agreement
- Returns filtered results
Policy Enforcement
The service applies ODRL policies from agreements:
- Prohibitions: Removes fields targeted by prohibition rules
- Permissions with Constraints:
countconstraint: Limits number of resultsdateTimeconstraint: Filters by temporal boundaries (lt, lteq, gt, gteq)
- Obligations: Logged for audit purposes
Error Responses
400 Bad Request- Syntactically incorrect request (GuardError)401 Unauthorized- Invalid or expired transfer token404 Not Found-consumerPidnot found422 Unprocessable Entity- Query type not supported or invalid transfer state
Examples
Usage of the APIs is shown in the examples docs/examples.md
Reference
Detailed reference documentation for the API can be found in docs/reference/index.md
Changelog
The changes between each version can be found in docs/changelog.md