@twin.org/dataspace-control-plane-service 0.0.3-next.32 → 0.0.3-next.34

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.
@@ -1 +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 * @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 * Entity storage type for Dataspace App Dataset entities.\n\t * @default dataspace-app-dataset\n\t */\n\tdataspaceAppDatasetEntityStorageType?: 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 * Data Plane component type, used to invoke push subscription lifecycle methods.\n\t * @default dataspace-data-plane\n\t */\n\tdataPlaneComponentType?: string;\n\n\t/**\n\t * URL Transformer component type used to encrypt the tenant token into the data-plane.\n\t * @default url-transformer\n\t */\n\turlTransformerComponentType?: string;\n\n\t/**\n\t * The configuration of the Dataspace Control Plane Service.\n\t */\n\tconfig?: IDataspaceControlPlaneServiceConfig;\n}\n"]}
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 * @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 * Entity storage type for Dataspace App Dataset entities.\n\t * @default dataspace-app-dataset\n\t */\n\tdataspaceAppDatasetEntityStorageType?: 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 * Data Plane component type, used to invoke push subscription lifecycle methods.\n\t * @default dataspace-data-plane\n\t */\n\tdataPlaneComponentType?: string;\n\n\t/**\n\t * URL Transformer component type used to encrypt the tenant token into the data-plane.\n\t * @default url-transformer\n\t */\n\turlTransformerComponentType?: string;\n\n\t/**\n\t * Remote control plane component type used to make outbound DSP transfer requests.\n\t * Created dynamically via ComponentFactory.create() with the provider endpoint as config.\n\t * @default dataspace-control-plane-rest-client\n\t */\n\tremoteControlPlaneComponentType?: string;\n\n\t/**\n\t * The configuration of the Dataspace Control Plane Service.\n\t */\n\tconfig?: IDataspaceControlPlaneServiceConfig;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { type IDataspaceControlPlaneComponent, type IDataspaceControlPlaneResolverComponent, type INegotiationCallback, type IDataspaceAppDataset, type ITransferContext } from "@twin.org/dataspace-models";
1
+ import { type IDataspaceControlPlaneComponent, type IDataspaceControlPlaneResolverComponent, type INegotiationCallback, type ITransferCallback, type IDataspaceAppDataset, type ITransferContext } from "@twin.org/dataspace-models";
2
2
  import { type IDataspaceProtocolContractNegotiation, type IDataspaceProtocolContractNegotiationError, type IDataspaceProtocolDataset, type IDataspaceProtocolTransferCompletionMessage, type IDataspaceProtocolTransferError, type IDataspaceProtocolTransferProcess, type IDataspaceProtocolTransferRequestMessage, type IDataspaceProtocolTransferStartMessage, type IDataspaceProtocolTransferSuspensionMessage, type IDataspaceProtocolTransferTerminationMessage } from "@twin.org/standards-dataspace-protocol";
3
3
  import type { IDataspaceControlPlaneServiceConstructorOptions } from "./models/IDataspaceControlPlaneServiceConstructorOptions.js";
4
4
  /**
@@ -35,6 +35,17 @@ export declare class DataspaceControlPlaneService implements IDataspaceControlPl
35
35
  * @param key The key used when registering the callback.
36
36
  */
37
37
  unregisterNegotiationCallback(key: string): void;
38
+ /**
39
+ * Register a callback to receive transfer process state change notifications.
40
+ * @param key A unique key identifying this callback registration.
41
+ * @param callback The callback interface to register.
42
+ */
43
+ registerTransferCallback(key: string, callback: ITransferCallback): void;
44
+ /**
45
+ * Unregister a previously registered transfer callback.
46
+ * @param key The key used when registering the callback.
47
+ */
48
+ unregisterTransferCallback(key: string): void;
38
49
  /**
39
50
  * The service needs to be started when the application is initialized.
40
51
  * Populates the Federated Catalogue with datasets from registered apps
@@ -61,6 +72,28 @@ export declare class DataspaceControlPlaneService implements IDataspaceControlPl
61
72
  * Called by: Consumer when it wants to request a new Transfer Process
62
73
  */
63
74
  requestTransfer(request: IDataspaceProtocolTransferRequestMessage, trustPayload: unknown): Promise<IDataspaceProtocolTransferProcess | IDataspaceProtocolTransferError>;
75
+ /**
76
+ * Start a data transfer as a Consumer.
77
+ * Generates a consumerPid, POSTs a TransferRequestMessage to the provider's DSP endpoint,
78
+ * and (only if the provider accepts) persists a local TransferProcess in REQUESTED state.
79
+ * @param agreementId The finalized agreement ID from contract negotiation.
80
+ * @param providerEndpoint The provider's DSP control plane base URL.
81
+ * @param publicOrigin The public origin URL of this control plane (used as callbackAddress).
82
+ * @param format The transfer format (e.g. "HttpProxy-PULL", "HttpProxy-PUSH").
83
+ * @param trustPayload Trust payload for authenticating this call.
84
+ * @returns The consumerPid of the newly created TransferProcess.
85
+ *
86
+ * **Engine configuration requirement:** The outbound call to the provider uses
87
+ * `ComponentFactory.create(remoteControlPlaneComponentType, { endpoint, pathPrefix })`.
88
+ * For the runtime `providerEndpoint` to be forwarded correctly, the engine **must** register
89
+ * the component type (default: `dataspace-control-plane-rest-client`) as a
90
+ * **multi-instance** component (`isMultiInstance: true` in engine config). A singleton
91
+ * registration ignores the runtime `endpoint` arg and silently POSTs to its
92
+ * static endpoint instead.
93
+ */
94
+ startDataTransfer(agreementId: string, providerEndpoint: string, publicOrigin: string, format: string, trustPayload: unknown): Promise<{
95
+ consumerPid: string;
96
+ }>;
64
97
  /**
65
98
  * Start a Transfer Process.
66
99
  * Transitions Transfer Process from REQUESTED to STARTED state or resumes from SUSPENDED state.
@@ -202,4 +235,11 @@ export declare class DataspaceControlPlaneService implements IDataspaceControlPl
202
235
  * @returns The internal negotiation callback.
203
236
  */
204
237
  private createInternalCallback;
238
+ /**
239
+ * Creates the internal ITransferCallback that fans out to all registered transfer callbacks.
240
+ * Errors thrown by individual callbacks are logged and swallowed so they cannot affect
241
+ * the DSP protocol state machine or other registrants.
242
+ * @returns The internal transfer callback.
243
+ */
244
+ private createInternalTransferCallback;
205
245
  }
@@ -76,6 +76,12 @@ export interface IDataspaceControlPlaneServiceConstructorOptions {
76
76
  * @default url-transformer
77
77
  */
78
78
  urlTransformerComponentType?: string;
79
+ /**
80
+ * Remote control plane component type used to make outbound DSP transfer requests.
81
+ * Created dynamically via ComponentFactory.create() with the provider endpoint as config.
82
+ * @default dataspace-control-plane-rest-client
83
+ */
84
+ remoteControlPlaneComponentType?: string;
79
85
  /**
80
86
  * The configuration of the Dataspace Control Plane Service.
81
87
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.34](https://github.com/iotaledger/twin-dataspace/compare/dataspace-control-plane-service-v0.0.3-next.33...dataspace-control-plane-service-v0.0.3-next.34) (2026-06-01)
4
+
5
+
6
+ ### Features
7
+
8
+ * add consumer transfer callbacks and startDataTransfer convenience method ([#151](https://github.com/iotaledger/twin-dataspace/issues/151)) ([0ab66c3](https://github.com/iotaledger/twin-dataspace/commit/0ab66c3636fd1f98f89baca1e99764d77c6f91d9))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/dataspace-models bumped from 0.0.3-next.33 to 0.0.3-next.34
16
+
17
+ ## [0.0.3-next.33](https://github.com/iotaledger/twin-dataspace/compare/dataspace-control-plane-service-v0.0.3-next.32...dataspace-control-plane-service-v0.0.3-next.33) (2026-06-01)
18
+
19
+
20
+ ### Features
21
+
22
+ * rename completed callback ([#147](https://github.com/iotaledger/twin-dataspace/issues/147)) ([f62baad](https://github.com/iotaledger/twin-dataspace/commit/f62baad0ff444e2913439b12dcd06d20c9a4f6a4))
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * implement missing trust check on negotiateAgreement ([#136](https://github.com/iotaledger/twin-dataspace/issues/136)) ([a3589c2](https://github.com/iotaledger/twin-dataspace/commit/a3589c279476d5450b68ea7c2790be7e3125bfe2))
28
+
29
+
30
+ ### Dependencies
31
+
32
+ * The following workspace dependencies were updated
33
+ * dependencies
34
+ * @twin.org/dataspace-models bumped from 0.0.3-next.32 to 0.0.3-next.33
35
+
3
36
  ## [0.0.3-next.32](https://github.com/iotaledger/twin-dataspace/compare/dataspace-control-plane-service-v0.0.3-next.31...dataspace-control-plane-service-v0.0.3-next.32) (2026-05-29)
4
37
 
5
38
 
@@ -114,6 +114,60 @@ The key used when registering the callback.
114
114
 
115
115
  ***
116
116
 
117
+ ### registerTransferCallback() {#registertransfercallback}
118
+
119
+ > **registerTransferCallback**(`key`, `callback`): `void`
120
+
121
+ Register a callback to receive transfer process state change notifications.
122
+
123
+ #### Parameters
124
+
125
+ ##### key
126
+
127
+ `string`
128
+
129
+ A unique key identifying this callback registration.
130
+
131
+ ##### callback
132
+
133
+ `ITransferCallback`
134
+
135
+ The callback interface to register.
136
+
137
+ #### Returns
138
+
139
+ `void`
140
+
141
+ #### Implementation of
142
+
143
+ `IDataspaceControlPlaneComponent.registerTransferCallback`
144
+
145
+ ***
146
+
147
+ ### unregisterTransferCallback() {#unregistertransfercallback}
148
+
149
+ > **unregisterTransferCallback**(`key`): `void`
150
+
151
+ Unregister a previously registered transfer callback.
152
+
153
+ #### Parameters
154
+
155
+ ##### key
156
+
157
+ `string`
158
+
159
+ The key used when registering the callback.
160
+
161
+ #### Returns
162
+
163
+ `void`
164
+
165
+ #### Implementation of
166
+
167
+ `IDataspaceControlPlaneComponent.unregisterTransferCallback`
168
+
169
+ ***
170
+
117
171
  ### start() {#start}
118
172
 
119
173
  > **start**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
@@ -203,6 +257,66 @@ Called by: Consumer when it wants to request a new Transfer Process
203
257
 
204
258
  ***
205
259
 
260
+ ### startDataTransfer() {#startdatatransfer}
261
+
262
+ > **startDataTransfer**(`agreementId`, `providerEndpoint`, `publicOrigin`, `format`, `trustPayload`): `Promise`\<\{ `consumerPid`: `string`; \}\>
263
+
264
+ Start a data transfer as a Consumer.
265
+ Generates a consumerPid, POSTs a TransferRequestMessage to the provider's DSP endpoint,
266
+ and (only if the provider accepts) persists a local TransferProcess in REQUESTED state.
267
+
268
+ #### Parameters
269
+
270
+ ##### agreementId
271
+
272
+ `string`
273
+
274
+ The finalized agreement ID from contract negotiation.
275
+
276
+ ##### providerEndpoint
277
+
278
+ `string`
279
+
280
+ The provider's DSP control plane base URL.
281
+
282
+ ##### publicOrigin
283
+
284
+ `string`
285
+
286
+ The public origin URL of this control plane (used as callbackAddress).
287
+
288
+ ##### format
289
+
290
+ `string`
291
+
292
+ The transfer format (e.g. "HttpProxy-PULL", "HttpProxy-PUSH").
293
+
294
+ ##### trustPayload
295
+
296
+ `unknown`
297
+
298
+ Trust payload for authenticating this call.
299
+
300
+ #### Returns
301
+
302
+ `Promise`\<\{ `consumerPid`: `string`; \}\>
303
+
304
+ The consumerPid of the newly created TransferProcess.
305
+
306
+ **Engine configuration requirement:** The outbound call to the provider uses
307
+ `ComponentFactory.create(remoteControlPlaneComponentType, { endpoint, pathPrefix })`.
308
+ For the runtime `providerEndpoint` to be forwarded correctly, the engine **must** register
309
+ the component type (default: `dataspace-control-plane-rest-client`) as a
310
+ **multi-instance** component (`isMultiInstance: true` in engine config). A singleton
311
+ registration ignores the runtime `endpoint` arg and silently POSTs to its
312
+ static endpoint instead.
313
+
314
+ #### Implementation of
315
+
316
+ `IDataspaceControlPlaneComponent.startDataTransfer`
317
+
318
+ ***
319
+
206
320
  ### startTransfer() {#starttransfer}
207
321
 
208
322
  > **startTransfer**(`message`, `publicOrigin`, `trustPayload`): `Promise`\<`IDataspaceProtocolTransferError` \| `IDataspaceProtocolTransferStartMessage`\>
@@ -194,6 +194,21 @@ url-transformer
194
194
 
195
195
  ***
196
196
 
197
+ ### remoteControlPlaneComponentType? {#remotecontrolplanecomponenttype}
198
+
199
+ > `optional` **remoteControlPlaneComponentType?**: `string`
200
+
201
+ Remote control plane component type used to make outbound DSP transfer requests.
202
+ Created dynamically via ComponentFactory.create() with the provider endpoint as config.
203
+
204
+ #### Default
205
+
206
+ ```ts
207
+ dataspace-control-plane-rest-client
208
+ ```
209
+
210
+ ***
211
+
197
212
  ### config? {#config}
198
213
 
199
214
  > `optional` **config?**: [`IDataspaceControlPlaneServiceConfig`](IDataspaceControlPlaneServiceConfig.md)
package/locales/en.json CHANGED
@@ -22,7 +22,9 @@
22
22
  "getNegotiationHistory": "Retrieving negotiation history",
23
23
  "negotiationHistoryRetrieved": "Negotiation history retrieved successfully",
24
24
  "stalledNegotiationsCleanupComplete": "Stalled negotiations cleanup completed (cleanedUp: {cleanedUp})",
25
- "pushTransferStarted": "PUSH transfer started (consumerPid: {consumerPid}, providerPid: {providerPid}, endpoint: {endpoint})"
25
+ "pushTransferStarted": "PUSH transfer started (consumerPid: {consumerPid}, providerPid: {providerPid}, endpoint: {endpoint})",
26
+ "startingDataTransfer": "Starting consumer-initiated data transfer (agreementId: {agreementId}, providerEndpoint: {providerEndpoint}, format: {format})",
27
+ "dataTransferStarted": "Consumer data transfer started successfully (consumerPid: {consumerPid}, providerPid: {providerPid}, agreementId: {agreementId}, format: {format})"
26
28
  },
27
29
  "dataspaceControlPlanePolicyRequester": {
28
30
  "offerReceived": "Offer received from provider (negotiationId: {negotiationId}, offerId: {offerId})",
@@ -84,6 +86,10 @@
84
86
  "datasetHasNoValidOffers": "Dataset \"{datasetId}\" has no valid ODRL offer objects. Cannot negotiate without a valid offer.",
85
87
  "offerNotFoundInDataset": "Offer \"{offerId}\" not found in dataset \"{datasetId}\". Available offers: {availableOffers}",
86
88
  "negotiationCallbackError": "Negotiation callback \"{key}\" threw an error during {method} for negotiation {negotiationId}",
89
+ "transferCallbackError": "Transfer callback \"{key}\" threw an error during {method} for consumerPid {consumerPid}",
90
+ "transferRequestRejectedByProvider": "Provider rejected transfer request for agreement {agreementId} at {providerEndpoint} (code: {code})",
91
+ "providerPidMissingInResponse": "Provider accepted transfer request for {consumerPid} but returned no providerPid",
92
+ "unsupportedTransferFormat": "Transfer format \"{format}\" is not supported. Supported formats: {supported}",
87
93
  "catalogDatasetMissingId": "Catalog dataset is missing a required @id identifier",
88
94
  "providerIdentityMissing": "Provider identity (DID) is required to sign data access tokens but was not set on the Transfer Process",
89
95
  "callerNotAuthorizedForAgreement": "The caller's verified identity does not match the agreement assignee (consumer)",
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@twin.org/dataspace-control-plane-service",
3
- "version": "0.0.3-next.32",
3
+ "version": "0.0.3-next.34",
4
4
  "description": "Implements agreement negotiation and transfer process lifecycle management for control plane operations.",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/iotaledger/dataspace.git",
7
+ "url": "git+https://github.com/iotaledger/twin-dataspace.git",
8
8
  "directory": "packages/dataspace-control-plane-service"
9
9
  },
10
10
  "author": "martyn.janes@iota.org",
@@ -19,7 +19,7 @@
19
19
  "@twin.org/context": "next",
20
20
  "@twin.org/core": "next",
21
21
  "@twin.org/crypto": "next",
22
- "@twin.org/dataspace-models": "0.0.3-next.32",
22
+ "@twin.org/dataspace-models": "0.0.3-next.34",
23
23
  "@twin.org/entity": "next",
24
24
  "@twin.org/entity-storage-models": "next",
25
25
  "@twin.org/federated-catalogue-models": "next",
@@ -67,7 +67,7 @@
67
67
  "business-logic"
68
68
  ],
69
69
  "bugs": {
70
- "url": "git+https://github.com/iotaledger/dataspace/issues"
70
+ "url": "git+https://github.com/iotaledger/twin-dataspace/issues"
71
71
  },
72
72
  "homepage": "https://twindev.org"
73
73
  }