@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.
Files changed (50) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +119 -0
  3. package/dist/es/dataspaceControlPlanePolicyRequester.js +228 -0
  4. package/dist/es/dataspaceControlPlanePolicyRequester.js.map +1 -0
  5. package/dist/es/dataspaceControlPlaneRoutes.js +202 -0
  6. package/dist/es/dataspaceControlPlaneRoutes.js.map +1 -0
  7. package/dist/es/dataspaceControlPlaneService.js +1420 -0
  8. package/dist/es/dataspaceControlPlaneService.js.map +1 -0
  9. package/dist/es/index.js +11 -0
  10. package/dist/es/index.js.map +1 -0
  11. package/dist/es/models/IDataspaceControlPlaneServiceConfig.js +4 -0
  12. package/dist/es/models/IDataspaceControlPlaneServiceConfig.js.map +1 -0
  13. package/dist/es/models/IDataspaceControlPlaneServiceConstructorOptions.js +2 -0
  14. package/dist/es/models/IDataspaceControlPlaneServiceConstructorOptions.js.map +1 -0
  15. package/dist/es/models/INegotiationState.js +4 -0
  16. package/dist/es/models/INegotiationState.js.map +1 -0
  17. package/dist/es/restEntryPoints.js +15 -0
  18. package/dist/es/restEntryPoints.js.map +1 -0
  19. package/dist/es/schema.js +11 -0
  20. package/dist/es/schema.js.map +1 -0
  21. package/dist/es/utils/dataHelpers.js +22 -0
  22. package/dist/es/utils/dataHelpers.js.map +1 -0
  23. package/dist/es/utils/transferErrorUtils.js +78 -0
  24. package/dist/es/utils/transferErrorUtils.js.map +1 -0
  25. package/dist/types/dataspaceControlPlanePolicyRequester.d.ts +80 -0
  26. package/dist/types/dataspaceControlPlaneRoutes.d.ts +17 -0
  27. package/dist/types/dataspaceControlPlaneService.d.ts +153 -0
  28. package/dist/types/index.d.ts +8 -0
  29. package/dist/types/models/IDataspaceControlPlaneServiceConfig.d.ts +20 -0
  30. package/dist/types/models/IDataspaceControlPlaneServiceConstructorOptions.d.ts +69 -0
  31. package/dist/types/models/INegotiationState.d.ts +27 -0
  32. package/dist/types/restEntryPoints.d.ts +7 -0
  33. package/dist/types/schema.d.ts +4 -0
  34. package/dist/types/utils/dataHelpers.d.ts +1 -0
  35. package/dist/types/utils/transferErrorUtils.d.ts +39 -0
  36. package/docs/API.md +341 -0
  37. package/docs/changelog.md +31 -0
  38. package/docs/examples.md +1 -0
  39. package/docs/reference/classes/DataspaceControlPlanePolicyRequester.md +244 -0
  40. package/docs/reference/classes/DataspaceControlPlaneService.md +549 -0
  41. package/docs/reference/functions/generateRestRoutesDataspaceControlPlane.md +29 -0
  42. package/docs/reference/functions/initSchema.md +9 -0
  43. package/docs/reference/index.md +22 -0
  44. package/docs/reference/interfaces/IDataspaceControlPlaneServiceConfig.md +26 -0
  45. package/docs/reference/interfaces/IDataspaceControlPlaneServiceConstructorOptions.md +160 -0
  46. package/docs/reference/interfaces/INegotiationState.md +43 -0
  47. package/docs/reference/variables/restEntryPoints.md +7 -0
  48. package/docs/reference/variables/tagsDataspaceControlPlane.md +5 -0
  49. package/locales/en.json +93 -0
  50. package/package.json +70 -0
@@ -0,0 +1,549 @@
1
+ # Class: DataspaceControlPlaneService
2
+
3
+ Dataspace Control Plane Service implementation.
4
+
5
+ Handles contract negotiation (via PNP callbacks) and transfer process management.
6
+ Negotiation is fully callback-driven: negotiateAgreement() returns immediately with
7
+ a negotiationId, and the caller is notified via INegotiationCallback when complete.
8
+
9
+ ## Implements
10
+
11
+ - `IDataspaceControlPlaneComponent`
12
+ - `IDataspaceControlPlaneResolverComponent`
13
+
14
+ ## Constructors
15
+
16
+ ### Constructor
17
+
18
+ > **new DataspaceControlPlaneService**(`options?`): `DataspaceControlPlaneService`
19
+
20
+ Create a new instance of DataspaceControlPlaneService.
21
+
22
+ #### Parameters
23
+
24
+ ##### options?
25
+
26
+ [`IDataspaceControlPlaneServiceConstructorOptions`](../interfaces/IDataspaceControlPlaneServiceConstructorOptions.md)
27
+
28
+ The options for the service.
29
+
30
+ #### Returns
31
+
32
+ `DataspaceControlPlaneService`
33
+
34
+ ## Properties
35
+
36
+ ### CLASS\_NAME
37
+
38
+ > `readonly` `static` **CLASS\_NAME**: `string`
39
+
40
+ Runtime name for the class.
41
+
42
+ ## Methods
43
+
44
+ ### className()
45
+
46
+ > **className**(): `string`
47
+
48
+ Returns the class name of the component.
49
+
50
+ #### Returns
51
+
52
+ `string`
53
+
54
+ The class name of the component.
55
+
56
+ #### Implementation of
57
+
58
+ `IDataspaceControlPlaneComponent.className`
59
+
60
+ ***
61
+
62
+ ### registerNegotiationCallback()
63
+
64
+ > **registerNegotiationCallback**(`key`, `callback`): `void`
65
+
66
+ Register a callback to receive negotiation state change notifications.
67
+ Upstream modules (e.g. supply-chain) register their callback here.
68
+
69
+ #### Parameters
70
+
71
+ ##### key
72
+
73
+ `string`
74
+
75
+ A unique key identifying this callback registration.
76
+
77
+ ##### callback
78
+
79
+ `INegotiationCallback`
80
+
81
+ The callback interface to register.
82
+
83
+ #### Returns
84
+
85
+ `void`
86
+
87
+ #### Implementation of
88
+
89
+ `IDataspaceControlPlaneComponent.registerNegotiationCallback`
90
+
91
+ ***
92
+
93
+ ### unregisterNegotiationCallback()
94
+
95
+ > **unregisterNegotiationCallback**(`key`): `void`
96
+
97
+ Unregister a previously registered negotiation callback.
98
+
99
+ #### Parameters
100
+
101
+ ##### key
102
+
103
+ `string`
104
+
105
+ The key used when registering the callback.
106
+
107
+ #### Returns
108
+
109
+ `void`
110
+
111
+ #### Implementation of
112
+
113
+ `IDataspaceControlPlaneComponent.unregisterNegotiationCallback`
114
+
115
+ ***
116
+
117
+ ### start()
118
+
119
+ > **start**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
120
+
121
+ The service needs to be started when the application is initialized.
122
+ Populates the Federated Catalogue with datasets from registered apps
123
+ and starts the stalled negotiation cleanup task.
124
+
125
+ #### Parameters
126
+
127
+ ##### nodeLoggingComponentType?
128
+
129
+ `string`
130
+
131
+ The node logging component type.
132
+
133
+ #### Returns
134
+
135
+ `Promise`\<`void`\>
136
+
137
+ #### Implementation of
138
+
139
+ `IDataspaceControlPlaneComponent.start`
140
+
141
+ ***
142
+
143
+ ### stop()
144
+
145
+ > **stop**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
146
+
147
+ Stop the service.
148
+ Removes the stalled negotiation cleanup task.
149
+
150
+ #### Parameters
151
+
152
+ ##### nodeLoggingComponentType?
153
+
154
+ `string`
155
+
156
+ The node logging component type.
157
+
158
+ #### Returns
159
+
160
+ `Promise`\<`void`\>
161
+
162
+ #### Implementation of
163
+
164
+ `IDataspaceControlPlaneComponent.stop`
165
+
166
+ ***
167
+
168
+ ### requestTransfer()
169
+
170
+ > **requestTransfer**(`request`, `trustPayload`): `Promise`\<`IDataspaceProtocolTransferError` \| `IDataspaceProtocolTransferProcess`\>
171
+
172
+ Request a Transfer Process.
173
+ Creates a new Transfer Process in REQUESTED state.
174
+
175
+ #### Parameters
176
+
177
+ ##### request
178
+
179
+ `IDataspaceProtocolTransferRequestMessage`
180
+
181
+ Transfer request message (DSP compliant).
182
+
183
+ ##### trustPayload
184
+
185
+ `unknown`
186
+
187
+ Trust payload containing authorization information (Base64-encoded token).
188
+
189
+ #### Returns
190
+
191
+ `Promise`\<`IDataspaceProtocolTransferError` \| `IDataspaceProtocolTransferProcess`\>
192
+
193
+ Transfer Process (DSP compliant) with state REQUESTED, or TransferError if the operation fails.
194
+
195
+ Role Performed: Provider
196
+ Called by: Consumer when it wants to request a new Transfer Process
197
+
198
+ #### Implementation of
199
+
200
+ `IDataspaceControlPlaneComponent.requestTransfer`
201
+
202
+ ***
203
+
204
+ ### startTransfer()
205
+
206
+ > **startTransfer**(`message`, `publicOrigin`, `trustPayload`): `Promise`\<`IDataspaceProtocolTransferError` \| `IDataspaceProtocolTransferStartMessage`\>
207
+
208
+ Start a Transfer Process.
209
+ Transitions Transfer Process from REQUESTED to STARTED state or resumes from SUSPENDED state.
210
+
211
+ #### Parameters
212
+
213
+ ##### message
214
+
215
+ `IDataspaceProtocolTransferStartMessage`
216
+
217
+ Transfer start message (DSP compliant).
218
+
219
+ ##### publicOrigin
220
+
221
+ `string`
222
+
223
+ The public origin URL of this service.
224
+
225
+ ##### trustPayload
226
+
227
+ `unknown`
228
+
229
+ Trust payload containing authorization information (Base64-encoded token).
230
+
231
+ #### Returns
232
+
233
+ `Promise`\<`IDataspaceProtocolTransferError` \| `IDataspaceProtocolTransferStartMessage`\>
234
+
235
+ Transfer Start Message (DSP compliant) with dataAddress for PULL transfers, or TransferError if the operation fails.
236
+
237
+ Role Performed: Provider / Consumer
238
+
239
+ #### Implementation of
240
+
241
+ `IDataspaceControlPlaneComponent.startTransfer`
242
+
243
+ ***
244
+
245
+ ### completeTransfer()
246
+
247
+ > **completeTransfer**(`message`, `trustPayload`): `Promise`\<`IDataspaceProtocolTransferError` \| `IDataspaceProtocolTransferProcess`\>
248
+
249
+ Complete a Transfer Process.
250
+
251
+ #### Parameters
252
+
253
+ ##### message
254
+
255
+ `IDataspaceProtocolTransferCompletionMessage`
256
+
257
+ Transfer completion message (DSP compliant).
258
+
259
+ ##### trustPayload
260
+
261
+ `unknown`
262
+
263
+ Trust payload containing authorization information (Base64-encoded token).
264
+
265
+ #### Returns
266
+
267
+ `Promise`\<`IDataspaceProtocolTransferError` \| `IDataspaceProtocolTransferProcess`\>
268
+
269
+ Transfer Process (DSP compliant) with state COMPLETED, or TransferError if the operation fails.
270
+
271
+ #### Implementation of
272
+
273
+ `IDataspaceControlPlaneComponent.completeTransfer`
274
+
275
+ ***
276
+
277
+ ### suspendTransfer()
278
+
279
+ > **suspendTransfer**(`message`, `trustPayload`): `Promise`\<`IDataspaceProtocolTransferError` \| `IDataspaceProtocolTransferProcess`\>
280
+
281
+ Suspend a Transfer Process.
282
+
283
+ #### Parameters
284
+
285
+ ##### message
286
+
287
+ `IDataspaceProtocolTransferSuspensionMessage`
288
+
289
+ Transfer suspension message (DSP compliant).
290
+
291
+ ##### trustPayload
292
+
293
+ `unknown`
294
+
295
+ Trust payload containing authorization information (Base64-encoded token).
296
+
297
+ #### Returns
298
+
299
+ `Promise`\<`IDataspaceProtocolTransferError` \| `IDataspaceProtocolTransferProcess`\>
300
+
301
+ Transfer Process (DSP compliant) with state SUSPENDED, or TransferError if the operation fails.
302
+
303
+ #### Implementation of
304
+
305
+ `IDataspaceControlPlaneComponent.suspendTransfer`
306
+
307
+ ***
308
+
309
+ ### terminateTransfer()
310
+
311
+ > **terminateTransfer**(`message`, `trustPayload`): `Promise`\<`IDataspaceProtocolTransferError` \| `IDataspaceProtocolTransferProcess`\>
312
+
313
+ Terminate a Transfer Process.
314
+
315
+ #### Parameters
316
+
317
+ ##### message
318
+
319
+ `IDataspaceProtocolTransferTerminationMessage`
320
+
321
+ Transfer termination message (DSP compliant).
322
+
323
+ ##### trustPayload
324
+
325
+ `unknown`
326
+
327
+ Trust payload containing authorization information (Base64-encoded token).
328
+
329
+ #### Returns
330
+
331
+ `Promise`\<`IDataspaceProtocolTransferError` \| `IDataspaceProtocolTransferProcess`\>
332
+
333
+ Transfer Process (DSP compliant) with state TERMINATED, or TransferError if the operation fails.
334
+
335
+ #### Implementation of
336
+
337
+ `IDataspaceControlPlaneComponent.terminateTransfer`
338
+
339
+ ***
340
+
341
+ ### getTransferProcess()
342
+
343
+ > **getTransferProcess**(`pid`, `trustPayload`): `Promise`\<`IDataspaceProtocolTransferError` \| `IDataspaceProtocolTransferProcess`\>
344
+
345
+ Get Transfer Process state.
346
+
347
+ #### Parameters
348
+
349
+ ##### pid
350
+
351
+ `string`
352
+
353
+ Process ID (consumerPid or providerPid).
354
+
355
+ ##### trustPayload
356
+
357
+ `unknown`
358
+
359
+ Trust payload containing authorization information (Base64-encoded token).
360
+
361
+ #### Returns
362
+
363
+ `Promise`\<`IDataspaceProtocolTransferError` \| `IDataspaceProtocolTransferProcess`\>
364
+
365
+ Transfer Process (DSP compliant) with current state, or TransferError if the operation fails.
366
+
367
+ #### Implementation of
368
+
369
+ `IDataspaceControlPlaneComponent.getTransferProcess`
370
+
371
+ ***
372
+
373
+ ### negotiateAgreement()
374
+
375
+ > **negotiateAgreement**(`offerId`, `providerEndpoint`, `publicOrigin`, `trustPayload`): `Promise`\<\{ `negotiationId`: `string`; \}\>
376
+
377
+ Negotiate a contract agreement with a provider.
378
+ Returns immediately with a negotiationId. The caller is notified
379
+ via the registered INegotiationCallback when the negotiation completes.
380
+
381
+ #### Parameters
382
+
383
+ ##### offerId
384
+
385
+ `string`
386
+
387
+ The offer ID from the provider's catalog.
388
+
389
+ ##### providerEndpoint
390
+
391
+ `string`
392
+
393
+ The provider's contract negotiation endpoint URL.
394
+
395
+ ##### publicOrigin
396
+
397
+ `string`
398
+
399
+ The public origin URL of this control plane (for callbacks).
400
+
401
+ ##### trustPayload
402
+
403
+ `unknown`
404
+
405
+ The trust payload for authentication.
406
+
407
+ #### Returns
408
+
409
+ `Promise`\<\{ `negotiationId`: `string`; \}\>
410
+
411
+ The negotiation ID. Use the registered callback for completion notification.
412
+
413
+ #### Implementation of
414
+
415
+ `IDataspaceControlPlaneComponent.negotiateAgreement`
416
+
417
+ ***
418
+
419
+ ### getNegotiation()
420
+
421
+ > **getNegotiation**(`negotiationId`, `trustPayload`): `Promise`\<`IDataspaceProtocolContractNegotiation` \| `IDataspaceProtocolContractNegotiationError`\>
422
+
423
+ Get the current state of a contract negotiation.
424
+
425
+ #### Parameters
426
+
427
+ ##### negotiationId
428
+
429
+ `string`
430
+
431
+ The unique identifier of the negotiation.
432
+
433
+ ##### trustPayload
434
+
435
+ `unknown`
436
+
437
+ The trust payload for authentication.
438
+
439
+ #### Returns
440
+
441
+ `Promise`\<`IDataspaceProtocolContractNegotiation` \| `IDataspaceProtocolContractNegotiationError`\>
442
+
443
+ Current state of the negotiation.
444
+
445
+ #### Implementation of
446
+
447
+ `IDataspaceControlPlaneComponent.getNegotiation`
448
+
449
+ ***
450
+
451
+ ### getNegotiationHistory()
452
+
453
+ > **getNegotiationHistory**(`state`, `cursor`, `trustPayload`): `Promise`\<\{ `negotiations`: `object`[]; `cursor?`: `string`; `count`: `number`; \}\>
454
+
455
+ Get negotiation history.
456
+
457
+ #### Parameters
458
+
459
+ ##### state
460
+
461
+ Optional filter by negotiation state.
462
+
463
+ `string` | `undefined`
464
+
465
+ ##### cursor
466
+
467
+ Optional pagination cursor.
468
+
469
+ `string` | `undefined`
470
+
471
+ ##### trustPayload
472
+
473
+ `unknown`
474
+
475
+ Trust payload for authentication.
476
+
477
+ #### Returns
478
+
479
+ `Promise`\<\{ `negotiations`: `object`[]; `cursor?`: `string`; `count`: `number`; \}\>
480
+
481
+ List of negotiation history entries with pagination.
482
+
483
+ #### Implementation of
484
+
485
+ `IDataspaceControlPlaneComponent.getNegotiationHistory`
486
+
487
+ ***
488
+
489
+ ### resolveConsumerPid()
490
+
491
+ > **resolveConsumerPid**(`consumerPid`, `trustPayload`): `Promise`\<`ITransferContext`\>
492
+
493
+ Resolve consumerPid to Transfer Context.
494
+
495
+ #### Parameters
496
+
497
+ ##### consumerPid
498
+
499
+ `string`
500
+
501
+ Consumer Process ID.
502
+
503
+ ##### trustPayload
504
+
505
+ `unknown`
506
+
507
+ Trust payload containing authorization information (Base64-encoded token).
508
+
509
+ #### Returns
510
+
511
+ `Promise`\<`ITransferContext`\>
512
+
513
+ Transfer Context with Agreement, datasetId, and Transfer Process metadata.
514
+
515
+ #### Implementation of
516
+
517
+ `IDataspaceControlPlaneResolverComponent.resolveConsumerPid`
518
+
519
+ ***
520
+
521
+ ### resolveProviderPid()
522
+
523
+ > **resolveProviderPid**(`providerPid`, `trustPayload`): `Promise`\<`ITransferContext`\>
524
+
525
+ Resolve providerPid to Transfer Context.
526
+
527
+ #### Parameters
528
+
529
+ ##### providerPid
530
+
531
+ `string`
532
+
533
+ Provider Process ID.
534
+
535
+ ##### trustPayload
536
+
537
+ `unknown`
538
+
539
+ Trust payload containing authorization information (Base64-encoded token).
540
+
541
+ #### Returns
542
+
543
+ `Promise`\<`ITransferContext`\>
544
+
545
+ Transfer Context with Agreement, datasetId, and Transfer Process metadata.
546
+
547
+ #### Implementation of
548
+
549
+ `IDataspaceControlPlaneResolverComponent.resolveProviderPid`
@@ -0,0 +1,29 @@
1
+ # Function: generateRestRoutesDataspaceControlPlane()
2
+
3
+ > **generateRestRoutesDataspaceControlPlane**(`baseRouteName`, `componentName`): `IRestRoute`\<`any`, `any`\>[]
4
+
5
+ The REST routes for dataspace control plane (DSP Protocol only).
6
+ These routes implement the Eclipse Dataspace Protocol Transfer Process Protocol.
7
+
8
+ Contract Negotiation is handled internally via PNP callbacks — no REST endpoints needed.
9
+ PNP registers its own inbound callback routes for negotiation messages from providers.
10
+
11
+ ## Parameters
12
+
13
+ ### baseRouteName
14
+
15
+ `string`
16
+
17
+ Prefix to prepend to the paths.
18
+
19
+ ### componentName
20
+
21
+ `string`
22
+
23
+ The name of the component to use in the routes stored in the ComponentFactory.
24
+
25
+ ## Returns
26
+
27
+ `IRestRoute`\<`any`, `any`\>[]
28
+
29
+ The generated DSP protocol routes.
@@ -0,0 +1,9 @@
1
+ # Function: initSchema()
2
+
3
+ > **initSchema**(): `void`
4
+
5
+ Inits schemas for Control Plane entities.
6
+
7
+ ## Returns
8
+
9
+ `void`
@@ -0,0 +1,22 @@
1
+ # @twin.org/dataspace-control-plane-service
2
+
3
+ ## Classes
4
+
5
+ - [DataspaceControlPlanePolicyRequester](classes/DataspaceControlPlanePolicyRequester.md)
6
+ - [DataspaceControlPlaneService](classes/DataspaceControlPlaneService.md)
7
+
8
+ ## Interfaces
9
+
10
+ - [IDataspaceControlPlaneServiceConfig](interfaces/IDataspaceControlPlaneServiceConfig.md)
11
+ - [IDataspaceControlPlaneServiceConstructorOptions](interfaces/IDataspaceControlPlaneServiceConstructorOptions.md)
12
+ - [INegotiationState](interfaces/INegotiationState.md)
13
+
14
+ ## Variables
15
+
16
+ - [tagsDataspaceControlPlane](variables/tagsDataspaceControlPlane.md)
17
+ - [restEntryPoints](variables/restEntryPoints.md)
18
+
19
+ ## Functions
20
+
21
+ - [generateRestRoutesDataspaceControlPlane](functions/generateRestRoutesDataspaceControlPlane.md)
22
+ - [initSchema](functions/initSchema.md)
@@ -0,0 +1,26 @@
1
+ # Interface: IDataspaceControlPlaneServiceConfig
2
+
3
+ Dataspace Control Plane service configuration.
4
+
5
+ ## Properties
6
+
7
+ ### overrideTrustGeneratorType?
8
+
9
+ > `optional` **overrideTrustGeneratorType**: `string`
10
+
11
+ Override the default trust generator type for token generation.
12
+ If not specified, the default trust generator configured in the trust component will be used.
13
+
14
+ ***
15
+
16
+ ### dataPlanePath?
17
+
18
+ > `optional` **dataPlanePath**: `string`
19
+
20
+ Data plane endpoint path for PULL transfers (path only, not full URL).
21
+ Will be combined with the public origin from the hosting component.
22
+
23
+ REQUIRED if PULL transfers are supported.
24
+ If not specified, PULL transfers will not be available.
25
+
26
+ Example: "data-plane/data" or "api/data-plane/data"