@twin.org/dataspace-models 0.0.3-next.17 → 0.0.3-next.19
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/README.md +4 -44
- package/dist/es/dataTypes/dataspaceDataTypes.js +4 -1
- package/dist/es/dataTypes/dataspaceDataTypes.js.map +1 -1
- package/dist/es/models/control-plane/IDataspaceControlPlaneComponent.js.map +1 -1
- package/dist/es/models/dataspaceContexts.js +3 -0
- package/dist/es/models/dataspaceContexts.js.map +1 -1
- package/dist/types/models/control-plane/IDataspaceControlPlaneComponent.d.ts +2 -1
- package/dist/types/models/dataspaceContexts.d.ts +3 -0
- package/docs/changelog.md +14 -0
- package/docs/examples.md +33 -1
- package/docs/reference/interfaces/IDataspaceControlPlaneComponent.md +7 -1
- package/docs/reference/variables/DataspaceContexts.md +2 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Dataspace Models
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package defines the shared contracts and data types used across control plane and data plane components. It provides the common language that keeps request payloads, transfer records, and activity structures aligned between services and clients.
|
|
4
|
+
|
|
5
|
+
The exported interfaces and entities are designed to support consistent integration behaviour across the repository, reducing mismatch risks when components evolve.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
@@ -8,48 +10,6 @@ Models which define the structure of the dataspace contracts and connectors.
|
|
|
8
10
|
npm install @twin.org/dataspace-models
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
## Overview
|
|
12
|
-
|
|
13
|
-
This package provides the core interfaces and entities for the TWIN Dataspace Connector, implementing the Eclipse Dataspace Protocol (DSP) specification.
|
|
14
|
-
|
|
15
|
-
### Key Components
|
|
16
|
-
|
|
17
|
-
#### Control Plane
|
|
18
|
-
|
|
19
|
-
- `IDataspaceControlPlaneComponent` - Interface for DSP protocol operations (negotiation, transfer management)
|
|
20
|
-
- `IDataspaceControlPlaneResolverComponent` - Interface for resolving `consumerPid` to transfer context
|
|
21
|
-
- `ITransferContext` - Transfer context containing datasetId, agreement, and policies
|
|
22
|
-
- `TransferProcessEntity` - Entity storage model for transfer processes
|
|
23
|
-
|
|
24
|
-
#### Data Plane
|
|
25
|
-
|
|
26
|
-
- `IDataspaceDataPlaneComponent` - Interface for data access operations (GET/query entities)
|
|
27
|
-
- `IDataspaceApp` - Interface for Dataspace Apps that handle specific datasets
|
|
28
|
-
|
|
29
|
-
#### Shared Entities
|
|
30
|
-
|
|
31
|
-
- `TransferProcessEntity` - Shared between Control Plane and Data Plane via entity storage
|
|
32
|
-
- Primary key: `id` (consumerPid)
|
|
33
|
-
- Stores: state, datasetId, agreement, dataAddress, token expiration
|
|
34
|
-
- Used for `consumerPid` flow
|
|
35
|
-
|
|
36
|
-
### Architecture
|
|
37
|
-
|
|
38
|
-
```text
|
|
39
|
-
Control Plane Data Plane
|
|
40
|
-
│ │
|
|
41
|
-
│ Creates/Updates │ Reads
|
|
42
|
-
│ │
|
|
43
|
-
└───── TransferProcessEntity ───┘
|
|
44
|
-
(shared storage)
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
The unified architecture enables:
|
|
48
|
-
|
|
49
|
-
- Transfer-based access via `consumerPid` parameter
|
|
50
|
-
- Shared state without resolver API calls
|
|
51
|
-
- Policy enforcement from agreements
|
|
52
|
-
|
|
53
13
|
## Examples
|
|
54
14
|
|
|
55
15
|
Usage of the APIs is shown in the examples [docs/examples.md](docs/examples.md)
|
|
@@ -21,7 +21,10 @@ export class DataspaceDataTypes {
|
|
|
21
21
|
schema: DataspaceActivitySchema
|
|
22
22
|
}
|
|
23
23
|
];
|
|
24
|
-
DataTypeHelper.registerTypes(DataspaceContexts.JsonSchemaNamespace,
|
|
24
|
+
DataTypeHelper.registerTypes(DataspaceContexts.JsonSchemaNamespace, undefined, types.map(t => ({
|
|
25
|
+
type: `Dataspace${t.type}`,
|
|
26
|
+
schema: t.schema
|
|
27
|
+
})));
|
|
25
28
|
}
|
|
26
29
|
}
|
|
27
30
|
//# sourceMappingURL=dataspaceDataTypes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataspaceDataTypes.js","sourceRoot":"","sources":["../../../src/dataTypes/dataspaceDataTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,uBAAuB,MAAM,mCAAmC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAE9F;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC9B;;OAEG;IACI,MAAM,CAAC,aAAa;QAC1B,wBAAwB,CAAC,iBAAiB,EAAE,CAAC;QAC7C,wBAAwB,CAAC,aAAa,EAAE,CAAC;QAEzC,MAAM,KAAK,GAAG;YACb;gBACC,IAAI,EAAE,cAAc,CAAC,QAAQ;gBAC7B,MAAM,EAAE,uBAAuB;aAC/B;SACD,CAAC;QAEF,cAAc,CAAC,aAAa,CAC3B,iBAAiB,CAAC,mBAAmB,EACrC,
|
|
1
|
+
{"version":3,"file":"dataspaceDataTypes.js","sourceRoot":"","sources":["../../../src/dataTypes/dataspaceDataTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,uBAAuB,MAAM,mCAAmC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAE9F;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC9B;;OAEG;IACI,MAAM,CAAC,aAAa;QAC1B,wBAAwB,CAAC,iBAAiB,EAAE,CAAC;QAC7C,wBAAwB,CAAC,aAAa,EAAE,CAAC;QAEzC,MAAM,KAAK,GAAG;YACb;gBACC,IAAI,EAAE,cAAc,CAAC,QAAQ;gBAC7B,MAAM,EAAE,uBAAuB;aAC/B;SACD,CAAC;QAEF,cAAc,CAAC,aAAa,CAC3B,iBAAiB,CAAC,mBAAmB,EACrC,SAAS,EACT,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACf,IAAI,EAAE,YAAY,CAAC,CAAC,IAAI,EAAE;YAC1B,MAAM,EAAE,CAAC,CAAC,MAAM;SAChB,CAAC,CAAC,CACH,CAAC;IACH,CAAC;CACD","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\nimport { DataTypeHelper } from \"@twin.org/data-core\";\nimport { ActivityStreamsDataTypes } from \"@twin.org/standards-w3c-activity-streams\";\nimport { DataspaceContexts } from \"../models/dataspaceContexts.js\";\nimport { DataspaceTypes } from \"../models/dataspaceTypes.js\";\nimport DataspaceActivitySchema from \"../schemas/DataspaceActivity.json\" with { type: \"json\" };\n\n/**\n * Dataspace datatypes.\n */\nexport class DataspaceDataTypes {\n\t/**\n\t * Register all the data types.\n\t */\n\tpublic static registerTypes(): void {\n\t\tActivityStreamsDataTypes.registerRedirects();\n\t\tActivityStreamsDataTypes.registerTypes();\n\n\t\tconst types = [\n\t\t\t{\n\t\t\t\ttype: DataspaceTypes.Activity,\n\t\t\t\tschema: DataspaceActivitySchema\n\t\t\t}\n\t\t];\n\n\t\tDataTypeHelper.registerTypes(\n\t\t\tDataspaceContexts.JsonSchemaNamespace,\n\t\t\tundefined,\n\t\t\ttypes.map(t => ({\n\t\t\t\ttype: `Dataspace${t.type}`,\n\t\t\t\tschema: t.schema\n\t\t\t}))\n\t\t);\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDataspaceControlPlaneComponent.js","sourceRoot":"","sources":["../../../../src/models/control-plane/IDataspaceControlPlaneComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type {\n\tIDataspaceProtocolContractNegotiation,\n\tIDataspaceProtocolContractNegotiationError,\n\tIDataspaceProtocolTransferCompletionMessage,\n\tIDataspaceProtocolTransferError,\n\tIDataspaceProtocolTransferProcess,\n\tIDataspaceProtocolTransferRequestMessage,\n\tIDataspaceProtocolTransferStartMessage,\n\tIDataspaceProtocolTransferSuspensionMessage,\n\tIDataspaceProtocolTransferTerminationMessage\n} from \"@twin.org/standards-dataspace-protocol\";\nimport type { INegotiationCallback } from \"./INegotiationCallback.js\";\n\n/**\n * Dataspace Control Plane Component interface.\n * Implements Eclipse Dataspace Protocol (DSP) specifications:\n * - Contract Negotiation Protocol\n * - Transfer Process Protocol\n *\n * This component acts as the Control Plane for contract negotiation and\n * data transfers between nodes in a dataspace.\n *\n * DSP 2025-1 Specification: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/\n */\nexport interface IDataspaceControlPlaneComponent extends IComponent {\n\t// ============================================================================\n\t// CONTRACT NEGOTIATION PROTOCOL (DSP)\n\t// Methods for negotiating agreements before transfers\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 * to be notified when negotiations complete, fail, or change state.\n\t * @param key A unique key identifying this callback registration.\n\t * @param callback The callback interface to register.\n\t */\n\tregisterNegotiationCallback(key: string, callback: INegotiationCallback): void;\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\tunregisterNegotiationCallback(key: string): void;\n\n\t/**\n\t * Negotiate a contract agreement with a provider.\n\t * Implements DSP Contract Negotiation Protocol.\n\t *\n\t * Returns immediately with a negotiationId. The caller is notified\n\t * via the registered INegotiationCallback when the negotiation completes.\n\t * The negotiation follows DSP state machine: REQUESTED → OFFERED → AGREED → VERIFIED → FINALIZED.\n\t *\n\t * This method has NO REST client implementation — it is only accessible via ComponentFactory.get().\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiation-protocol\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 Trust payload for authentication (JWT or Verifiable Credential).\n\t * @returns The negotiation ID for tracking. Use registered callback for completion.\n\t */\n\tnegotiateAgreement(\n\t\tofferId: string,\n\t\tproviderEndpoint: string,\n\t\tpublicOrigin: string,\n\t\ttrustPayload: unknown\n\t): Promise<{ negotiationId: string }>;\n\n\t/**\n\t * Get the current state of a contract negotiation.\n\t * Implements DSP Contract Negotiation Protocol.\n\t *\n\t * Queries the current state of an ongoing or completed negotiation.\n\t * Use this to monitor negotiation progress.\n\t * Returns the DSP-compliant negotiation state or error.\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiation-protocol\n\t *\n\t * @param negotiationId The unique identifier of the negotiation.\n\t * @param trustPayload Trust payload for authentication.\n\t * @returns DSP ContractNegotiation with current state, or error.\n\t */\n\tgetNegotiation(\n\t\tnegotiationId: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolContractNegotiation | IDataspaceProtocolContractNegotiationError>;\n\n\t/**\n\t * Get negotiation history.\n\t * Queries past contract negotiations for audit trails and debugging.\n\t *\n\t * Returns a list of past negotiations with their states and metadata.\n\t * Supports optional filtering by state and pagination via cursor.\n\t *\n\t * @param state Optional filter by negotiation state (e.g., \"FINALIZED\", \"TERMINATED\").\n\t * @param cursor Optional pagination cursor for fetching next page.\n\t * @param trustPayload Trust payload for authentication.\n\t * @returns List of negotiation history entries with pagination cursor.\n\t */\n\tgetNegotiationHistory(\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\n\t// ============================================================================\n\t// TRANSFER PROCESS PROTOCOL (DSP)\n\t// Methods for managing data transfers after agreements are established\n\t// ============================================================================\n\n\t// ----------------------------------------------------------------------------\n\t// CONSUMER SIDE OPERATIONS\n\t// Methods called by the Data Consumer to initiate transfers\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Request a Transfer Process.\n\t * Creates a new Transfer Process in REQUESTED state.\n\t *\n\t * Role Performed: Provider\n\t * Called by: Consumer when it wants to request a new Transfer Process\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/#transfer-request-message\n\t *\n\t * @param request Transfer request message (DSP compliant) containing agreementId,\n\t * consumerPid, callbackAddress, and format.\n\t * @param trustPayload Trust payload containing authorization information (JWT, VC, etc.).\n\t * The consumer must prove their identity by providing a valid trust payload.\n\t * @returns Transfer Process (DSP compliant) with state REQUESTED, including\n\t * both consumerPid and providerPid, or TransferError if the operation fails.\n\t */\n\trequestTransfer(\n\t\trequest: IDataspaceProtocolTransferRequestMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError>;\n\n\t// ============================================================================\n\t// PROVIDER SIDE OPERATIONS\n\t// Methods called by the Data Provider to respond to transfer requests\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 *\n\t * Role Performed: Provider / Consumer\n\t * Called by: Provider when a Transfer Process starts, or Consumer to attempt to start a Transfer Process after it has been suspended\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/#transfer-start-message\n\t *\n\t * @param message Transfer start message (DSP compliant).\n\t * @param publicOrigin The public origin URL of this service (used to construct data plane endpoint for PULL transfers).\n\t * @param trustPayload Trust payload containing authorization information (JWT, VC, etc.).\n\t * @returns Transfer Start Message (DSP compliant) with dataAddress for PULL transfers, or TransferError if the operation fails.\n\t */\n\tstartTransfer(\n\t\tmessage: IDataspaceProtocolTransferStartMessage,\n\t\tpublicOrigin: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferStartMessage | IDataspaceProtocolTransferError>;\n\n\t// ============================================================================\n\t// SHARED STATE MANAGEMENT OPERATIONS\n\t// Methods that can be called by either Consumer or Provider\n\t// ============================================================================\n\n\t/**\n\t * Complete a Transfer Process.\n\t * Transitions Transfer Process to COMPLETED state.\n\t *\n\t * Role Performed: Consumer / Provider\n\t * Called by: Provider or Consumer when a Transfer process is completed on their side\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/#transfer-completion-message\n\t *\n\t * @param message Transfer completion message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (JWT, VC, etc.).\n\t * @returns Transfer Process (DSP compliant) with state COMPLETED, or TransferError if the operation fails.\n\t */\n\tcompleteTransfer(\n\t\tmessage: IDataspaceProtocolTransferCompletionMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError>;\n\n\t/**\n\t * Suspend a Transfer Process.\n\t * Transitions Transfer Process to SUSPENDED state.\n\t *\n\t * Role Performed: Consumer / Provider\n\t * Called by: Provider or Consumer when a Transfer process needs to be temporarily suspended on their side\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/#transfer-suspension-message\n\t *\n\t * @param message Transfer suspension message (DSP compliant) with optional reason.\n\t * @param trustPayload Trust payload containing authorization information (JWT, VC, etc.).\n\t * @returns Transfer Process (DSP compliant) with state SUSPENDED, or TransferError if the operation fails.\n\t */\n\tsuspendTransfer(\n\t\tmessage: IDataspaceProtocolTransferSuspensionMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError>;\n\n\t/**\n\t * Terminate a Transfer Process.\n\t * Transitions Transfer Process to TERMINATED state.\n\t *\n\t * Role Performed: Consumer / Provider\n\t * Called by: Provider or Consumer when a Transfer process needs to be terminated on their side (e.g., due to error)\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/#transfer-termination-message\n\t *\n\t * @param message Transfer termination message (DSP compliant) with optional reason.\n\t * @param trustPayload Trust payload containing authorization information (JWT, VC, etc.).\n\t * @returns Transfer Process (DSP compliant) with state TERMINATED, or TransferError if the operation fails.\n\t */\n\tterminateTransfer(\n\t\tmessage: IDataspaceProtocolTransferTerminationMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError>;\n\n\t/**\n\t * Get Transfer Process State.\n\t * Query the current state of a Transfer Process.\n\t *\n\t * Role Performed: Consumer / Provider\n\t * Called by: Provider or Consumer when they need to check the status of a Transfer process on their side\n\t *\n\t * Supports role-agnostic lookup using either consumerPid or providerPid.\n\t * The service will automatically detect which role the caller is acting as\n\t * (Consumer or Provider) based on the PID provided.\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/#ack-transfer-process\n\t *\n\t * @param pid The Process ID (consumerPid or providerPid) used to identify the transfer.\n\t * @param trustPayload Trust payload containing authorization information (JWT, VC, etc.).\n\t * @returns Transfer Process (DSP compliant) with current state, or TransferError if the operation fails.\n\t */\n\tgetTransferProcess(\n\t\tpid: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IDataspaceControlPlaneComponent.js","sourceRoot":"","sources":["../../../../src/models/control-plane/IDataspaceControlPlaneComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type {\n\tIDataspaceProtocolContractNegotiation,\n\tIDataspaceProtocolContractNegotiationError,\n\tIDataspaceProtocolTransferCompletionMessage,\n\tIDataspaceProtocolTransferError,\n\tIDataspaceProtocolTransferProcess,\n\tIDataspaceProtocolTransferRequestMessage,\n\tIDataspaceProtocolTransferStartMessage,\n\tIDataspaceProtocolTransferSuspensionMessage,\n\tIDataspaceProtocolTransferTerminationMessage\n} from \"@twin.org/standards-dataspace-protocol\";\nimport type { INegotiationCallback } from \"./INegotiationCallback.js\";\n\n/**\n * Dataspace Control Plane Component interface.\n * Implements Eclipse Dataspace Protocol (DSP) specifications:\n * - Contract Negotiation Protocol\n * - Transfer Process Protocol\n *\n * This component acts as the Control Plane for contract negotiation and\n * data transfers between nodes in a dataspace.\n *\n * DSP 2025-1 Specification: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/\n */\nexport interface IDataspaceControlPlaneComponent extends IComponent {\n\t// ============================================================================\n\t// CONTRACT NEGOTIATION PROTOCOL (DSP)\n\t// Methods for negotiating agreements before transfers\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 * to be notified when negotiations complete, fail, or change state.\n\t * @param key A unique key identifying this callback registration.\n\t * @param callback The callback interface to register.\n\t */\n\tregisterNegotiationCallback(key: string, callback: INegotiationCallback): void;\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\tunregisterNegotiationCallback(key: string): void;\n\n\t/**\n\t * Negotiate a contract agreement with a provider.\n\t * Implements DSP Contract Negotiation Protocol.\n\t *\n\t * Returns immediately with a negotiationId. The caller is notified\n\t * via the registered INegotiationCallback when the negotiation completes.\n\t * The negotiation follows DSP state machine: REQUESTED → OFFERED → AGREED → VERIFIED → FINALIZED.\n\t *\n\t * This method has NO REST client implementation — it is only accessible via ComponentFactory.get().\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiation-protocol\n\t *\n\t * @param datasetId The dataset ID from the provider's catalog.\n\t * @param offerId The offer ID from the provider's catalog.\n\t * @param providerEndpoint The provider's contract negotiation endpoint URL.\n\t * @param publicOrigin The public origin URL of this control plane (for callbacks).\n\t * @param trustPayload Trust payload for authentication (JWT or Verifiable Credential).\n\t * @returns The negotiation ID for tracking. Use registered callback for completion.\n\t */\n\tnegotiateAgreement(\n\t\tdatasetId: string,\n\t\tofferId: string,\n\t\tproviderEndpoint: string,\n\t\tpublicOrigin: string,\n\t\ttrustPayload: unknown\n\t): Promise<{ negotiationId: string }>;\n\n\t/**\n\t * Get the current state of a contract negotiation.\n\t * Implements DSP Contract Negotiation Protocol.\n\t *\n\t * Queries the current state of an ongoing or completed negotiation.\n\t * Use this to monitor negotiation progress.\n\t * Returns the DSP-compliant negotiation state or error.\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiation-protocol\n\t *\n\t * @param negotiationId The unique identifier of the negotiation.\n\t * @param trustPayload Trust payload for authentication.\n\t * @returns DSP ContractNegotiation with current state, or error.\n\t */\n\tgetNegotiation(\n\t\tnegotiationId: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolContractNegotiation | IDataspaceProtocolContractNegotiationError>;\n\n\t/**\n\t * Get negotiation history.\n\t * Queries past contract negotiations for audit trails and debugging.\n\t *\n\t * Returns a list of past negotiations with their states and metadata.\n\t * Supports optional filtering by state and pagination via cursor.\n\t *\n\t * @param state Optional filter by negotiation state (e.g., \"FINALIZED\", \"TERMINATED\").\n\t * @param cursor Optional pagination cursor for fetching next page.\n\t * @param trustPayload Trust payload for authentication.\n\t * @returns List of negotiation history entries with pagination cursor.\n\t */\n\tgetNegotiationHistory(\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\n\t// ============================================================================\n\t// TRANSFER PROCESS PROTOCOL (DSP)\n\t// Methods for managing data transfers after agreements are established\n\t// ============================================================================\n\n\t// ----------------------------------------------------------------------------\n\t// CONSUMER SIDE OPERATIONS\n\t// Methods called by the Data Consumer to initiate transfers\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Request a Transfer Process.\n\t * Creates a new Transfer Process in REQUESTED state.\n\t *\n\t * Role Performed: Provider\n\t * Called by: Consumer when it wants to request a new Transfer Process\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/#transfer-request-message\n\t *\n\t * @param request Transfer request message (DSP compliant) containing agreementId,\n\t * consumerPid, callbackAddress, and format.\n\t * @param trustPayload Trust payload containing authorization information (JWT, VC, etc.).\n\t * The consumer must prove their identity by providing a valid trust payload.\n\t * @returns Transfer Process (DSP compliant) with state REQUESTED, including\n\t * both consumerPid and providerPid, or TransferError if the operation fails.\n\t */\n\trequestTransfer(\n\t\trequest: IDataspaceProtocolTransferRequestMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError>;\n\n\t// ============================================================================\n\t// PROVIDER SIDE OPERATIONS\n\t// Methods called by the Data Provider to respond to transfer requests\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 *\n\t * Role Performed: Provider / Consumer\n\t * Called by: Provider when a Transfer Process starts, or Consumer to attempt to start a Transfer Process after it has been suspended\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/#transfer-start-message\n\t *\n\t * @param message Transfer start message (DSP compliant).\n\t * @param publicOrigin The public origin URL of this service (used to construct data plane endpoint for PULL transfers).\n\t * @param trustPayload Trust payload containing authorization information (JWT, VC, etc.).\n\t * @returns Transfer Start Message (DSP compliant) with dataAddress for PULL transfers, or TransferError if the operation fails.\n\t */\n\tstartTransfer(\n\t\tmessage: IDataspaceProtocolTransferStartMessage,\n\t\tpublicOrigin: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferStartMessage | IDataspaceProtocolTransferError>;\n\n\t// ============================================================================\n\t// SHARED STATE MANAGEMENT OPERATIONS\n\t// Methods that can be called by either Consumer or Provider\n\t// ============================================================================\n\n\t/**\n\t * Complete a Transfer Process.\n\t * Transitions Transfer Process to COMPLETED state.\n\t *\n\t * Role Performed: Consumer / Provider\n\t * Called by: Provider or Consumer when a Transfer process is completed on their side\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/#transfer-completion-message\n\t *\n\t * @param message Transfer completion message (DSP compliant).\n\t * @param trustPayload Trust payload containing authorization information (JWT, VC, etc.).\n\t * @returns Transfer Process (DSP compliant) with state COMPLETED, or TransferError if the operation fails.\n\t */\n\tcompleteTransfer(\n\t\tmessage: IDataspaceProtocolTransferCompletionMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError>;\n\n\t/**\n\t * Suspend a Transfer Process.\n\t * Transitions Transfer Process to SUSPENDED state.\n\t *\n\t * Role Performed: Consumer / Provider\n\t * Called by: Provider or Consumer when a Transfer process needs to be temporarily suspended on their side\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/#transfer-suspension-message\n\t *\n\t * @param message Transfer suspension message (DSP compliant) with optional reason.\n\t * @param trustPayload Trust payload containing authorization information (JWT, VC, etc.).\n\t * @returns Transfer Process (DSP compliant) with state SUSPENDED, or TransferError if the operation fails.\n\t */\n\tsuspendTransfer(\n\t\tmessage: IDataspaceProtocolTransferSuspensionMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError>;\n\n\t/**\n\t * Terminate a Transfer Process.\n\t * Transitions Transfer Process to TERMINATED state.\n\t *\n\t * Role Performed: Consumer / Provider\n\t * Called by: Provider or Consumer when a Transfer process needs to be terminated on their side (e.g., due to error)\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/#transfer-termination-message\n\t *\n\t * @param message Transfer termination message (DSP compliant) with optional reason.\n\t * @param trustPayload Trust payload containing authorization information (JWT, VC, etc.).\n\t * @returns Transfer Process (DSP compliant) with state TERMINATED, or TransferError if the operation fails.\n\t */\n\tterminateTransfer(\n\t\tmessage: IDataspaceProtocolTransferTerminationMessage,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError>;\n\n\t/**\n\t * Get Transfer Process State.\n\t * Query the current state of a Transfer Process.\n\t *\n\t * Role Performed: Consumer / Provider\n\t * Called by: Provider or Consumer when they need to check the status of a Transfer process on their side\n\t *\n\t * Supports role-agnostic lookup using either consumerPid or providerPid.\n\t * The service will automatically detect which role the caller is acting as\n\t * (Consumer or Provider) based on the PID provided.\n\t *\n\t * DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/#ack-transfer-process\n\t *\n\t * @param pid The Process ID (consumerPid or providerPid) used to identify the transfer.\n\t * @param trustPayload Trust payload containing authorization information (JWT, VC, etc.).\n\t * @returns Transfer Process (DSP compliant) with current state, or TransferError if the operation fails.\n\t */\n\tgetTransferProcess(\n\t\tpid: string,\n\t\ttrustPayload: unknown\n\t): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError>;\n}\n"]}
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
7
|
export const DataspaceContexts = {
|
|
8
|
+
/**
|
|
9
|
+
* The namespace location of the hosted version of the JSON Schema.
|
|
10
|
+
*/
|
|
8
11
|
JsonSchemaNamespace: "https://schema.twindev.org/dataspace/"
|
|
9
12
|
};
|
|
10
13
|
//# sourceMappingURL=dataspaceContexts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataspaceContexts.js","sourceRoot":"","sources":["../../../src/models/dataspaceContexts.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC,mBAAmB,EAAE,uCAAuC;CACnD,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The contexts related to Dataspace\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const DataspaceContexts = {\n\tJsonSchemaNamespace: \"https://schema.twindev.org/dataspace/\"\n} as const;\n\n/**\n * The types concerning dataspace.\n */\nexport type DataspaceContexts = (typeof DataspaceContexts)[keyof typeof DataspaceContexts];\n"]}
|
|
1
|
+
{"version":3,"file":"dataspaceContexts.js","sourceRoot":"","sources":["../../../src/models/dataspaceContexts.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC;;OAEG;IACH,mBAAmB,EAAE,uCAAuC;CACnD,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The contexts related to Dataspace\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const DataspaceContexts = {\n\t/**\n\t * The namespace location of the hosted version of the JSON Schema.\n\t */\n\tJsonSchemaNamespace: \"https://schema.twindev.org/dataspace/\"\n} as const;\n\n/**\n * The types concerning dataspace.\n */\nexport type DataspaceContexts = (typeof DataspaceContexts)[keyof typeof DataspaceContexts];\n"]}
|
|
@@ -38,13 +38,14 @@ export interface IDataspaceControlPlaneComponent extends IComponent {
|
|
|
38
38
|
*
|
|
39
39
|
* DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/2025-1/#negotiation-protocol
|
|
40
40
|
*
|
|
41
|
+
* @param datasetId The dataset ID from the provider's catalog.
|
|
41
42
|
* @param offerId The offer ID from the provider's catalog.
|
|
42
43
|
* @param providerEndpoint The provider's contract negotiation endpoint URL.
|
|
43
44
|
* @param publicOrigin The public origin URL of this control plane (for callbacks).
|
|
44
45
|
* @param trustPayload Trust payload for authentication (JWT or Verifiable Credential).
|
|
45
46
|
* @returns The negotiation ID for tracking. Use registered callback for completion.
|
|
46
47
|
*/
|
|
47
|
-
negotiateAgreement(offerId: string, providerEndpoint: string, publicOrigin: string, trustPayload: unknown): Promise<{
|
|
48
|
+
negotiateAgreement(datasetId: string, offerId: string, providerEndpoint: string, publicOrigin: string, trustPayload: unknown): Promise<{
|
|
48
49
|
negotiationId: string;
|
|
49
50
|
}>;
|
|
50
51
|
/**
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.19](https://github.com/twinfoundation/dataspace/compare/dataspace-models-v0.0.3-next.18...dataspace-models-v0.0.3-next.19) (2026-03-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* improve validation ([#82](https://github.com/twinfoundation/dataspace/issues/82)) ([8bfaf7b](https://github.com/twinfoundation/dataspace/commit/8bfaf7b830f89b63575f8a51ee96bd8ac4da02f4))
|
|
9
|
+
|
|
10
|
+
## [0.0.3-next.18](https://github.com/twinfoundation/dataspace/compare/dataspace-models-v0.0.3-next.17...dataspace-models-v0.0.3-next.18) (2026-03-09)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* resolve DSP transfer flow bugs for cross-node communication ([#76](https://github.com/twinfoundation/dataspace/issues/76)) ([506a45c](https://github.com/twinfoundation/dataspace/commit/506a45c94e63d5f958b1fc7131adfe452c3e2974))
|
|
16
|
+
|
|
3
17
|
## [0.0.3-next.17](https://github.com/twinfoundation/dataspace/compare/dataspace-models-v0.0.3-next.16...dataspace-models-v0.0.3-next.17) (2026-03-06)
|
|
4
18
|
|
|
5
19
|
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Models Examples
|
|
2
|
+
|
|
3
|
+
Use these snippets to register dataspace data types and shape transfer process records for shared persistence.
|
|
4
|
+
|
|
5
|
+
## DataspaceDataTypes
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { DataspaceDataTypes } from '@twin.org/dataspace-models';
|
|
9
|
+
|
|
10
|
+
DataspaceDataTypes.registerTypes();
|
|
11
|
+
console.log('registered'); // registered
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## TransferProcess
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { TransferProcess } from '@twin.org/dataspace-models';
|
|
18
|
+
|
|
19
|
+
const process = new TransferProcess();
|
|
20
|
+
process.id = 'tp-001';
|
|
21
|
+
process.consumerPid = 'consumer-process-id';
|
|
22
|
+
process.providerPid = 'provider-process-id';
|
|
23
|
+
process.agreementId = 'urn:agreement:001';
|
|
24
|
+
process.datasetId = 'https://twin.example.org/data-service-1';
|
|
25
|
+
process.offerId = 'urn:policy:test-offer-read-consignment';
|
|
26
|
+
process.state = 'REQUESTED';
|
|
27
|
+
process.dateCreated = new Date().toISOString();
|
|
28
|
+
process.dateModified = process.dateCreated;
|
|
29
|
+
process.callbackAddress = 'https://consumer.example/dsp/callback';
|
|
30
|
+
|
|
31
|
+
console.log(process.consumerPid); // consumer-process-id
|
|
32
|
+
console.log(process.state); // REQUESTED
|
|
33
|
+
```
|
|
@@ -66,7 +66,7 @@ The key used when registering the callback.
|
|
|
66
66
|
|
|
67
67
|
### negotiateAgreement()
|
|
68
68
|
|
|
69
|
-
> **negotiateAgreement**(`offerId`, `providerEndpoint`, `publicOrigin`, `trustPayload`): `Promise`\<\{ `negotiationId`: `string`; \}\>
|
|
69
|
+
> **negotiateAgreement**(`datasetId`, `offerId`, `providerEndpoint`, `publicOrigin`, `trustPayload`): `Promise`\<\{ `negotiationId`: `string`; \}\>
|
|
70
70
|
|
|
71
71
|
Negotiate a contract agreement with a provider.
|
|
72
72
|
Implements DSP Contract Negotiation Protocol.
|
|
@@ -81,6 +81,12 @@ DSP Spec: https://eclipse-dataspace-protocol-base.github.io/DataspaceProtocol/20
|
|
|
81
81
|
|
|
82
82
|
#### Parameters
|
|
83
83
|
|
|
84
|
+
##### datasetId
|
|
85
|
+
|
|
86
|
+
`string`
|
|
87
|
+
|
|
88
|
+
The dataset ID from the provider's catalog.
|
|
89
|
+
|
|
84
90
|
##### offerId
|
|
85
91
|
|
|
86
92
|
`string`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/dataspace-models",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.19",
|
|
4
|
+
"description": "Defines shared entities, interfaces, and data types used by control plane and data plane components.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/twinfoundation/dataspace.git",
|