@twin.org/dataspace-data-plane-socket-client 0.0.3-next.18 → 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 -2
- package/docs/changelog.md +15 -1
- package/docs/examples.md +92 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Dataspace Data Plane Socket Client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package provides a WebSocket client for subscribing to activity log status notifications. It enables event-driven integrations that require timely status updates as activities progress through processing stages.
|
|
4
|
+
|
|
5
|
+
It complements request-response clients by covering real-time notification scenarios.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
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-data-plane-socket-client-v0.0.3-next.18...dataspace-data-plane-socket-client-v0.0.3-next.19) (2026-03-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **dataspace-data-plane-socket-client:** Synchronize repo versions
|
|
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.18 to 0.0.3-next.19
|
|
16
|
+
|
|
3
17
|
## [0.0.3-next.18](https://github.com/twinfoundation/dataspace/compare/dataspace-data-plane-socket-client-v0.0.3-next.17...dataspace-data-plane-socket-client-v0.0.3-next.18) (2026-03-09)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -345,4 +359,4 @@
|
|
|
345
359
|
* dependencies
|
|
346
360
|
* @twin.org/dataspace-models bumped from 0.0.1-next.0 to 0.0.1-next.1
|
|
347
361
|
|
|
348
|
-
##
|
|
362
|
+
## Changelog
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,92 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Data Plane Socket Client Examples
|
|
2
|
+
|
|
3
|
+
Use these snippets to consume activity updates over sockets and manage local subscription callbacks.
|
|
4
|
+
|
|
5
|
+
## DataspaceDataPlaneSocketClient
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { DataspaceDataPlaneSocketClient } from '@twin.org/dataspace-data-plane-socket-client';
|
|
9
|
+
|
|
10
|
+
const client = new DataspaceDataPlaneSocketClient({
|
|
11
|
+
config: {
|
|
12
|
+
endpoint: 'ws://localhost:8090'
|
|
13
|
+
},
|
|
14
|
+
loggingComponentType: 'logging'
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
console.log(client.className()); // DataspaceDataPlaneSocketClient
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { DataspaceDataPlaneSocketClient } from '@twin.org/dataspace-data-plane-socket-client';
|
|
22
|
+
|
|
23
|
+
const client = new DataspaceDataPlaneSocketClient({
|
|
24
|
+
config: {
|
|
25
|
+
endpoint: 'ws://localhost:8090'
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const subscriptionId = await client.subscribeToActivityLog(async notification => {
|
|
30
|
+
console.log(notification.id); // urn:activity-log:2001
|
|
31
|
+
console.log(notification.status); // completed
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
await client.unSubscribeToActivityLog(subscriptionId);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { DataspaceDataPlaneSocketClient } from '@twin.org/dataspace-data-plane-socket-client';
|
|
39
|
+
|
|
40
|
+
const client = new DataspaceDataPlaneSocketClient({
|
|
41
|
+
config: {
|
|
42
|
+
endpoint: 'ws://localhost:8090'
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
await client.getActivityLogEntry('urn:activity-log:2001');
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.log(error instanceof Error); // true
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
await client.getDataAssetEntities(
|
|
54
|
+
{ entityType: 'https://vocabulary.uncefact.org/Consignment' },
|
|
55
|
+
'consumer-process-id',
|
|
56
|
+
undefined,
|
|
57
|
+
10,
|
|
58
|
+
'eyJhbGciOi...'
|
|
59
|
+
);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.log(error instanceof Error); // true
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
await client.queryDataAsset('consumer-process-id', { query: {} }, undefined, 10, 'eyJhbGciOi...');
|
|
66
|
+
} catch (error) {
|
|
67
|
+
console.log(error instanceof Error); // true
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { DataspaceDataPlaneSocketClient } from '@twin.org/dataspace-data-plane-socket-client';
|
|
73
|
+
import type { IActivityStreamsActivity } from '@twin.org/standards-w3c-activity-streams';
|
|
74
|
+
|
|
75
|
+
const client = new DataspaceDataPlaneSocketClient({
|
|
76
|
+
config: {
|
|
77
|
+
endpoint: 'ws://localhost:8090'
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const activity: IActivityStreamsActivity = {
|
|
82
|
+
'@context': 'https://www.w3.org/ns/activitystreams',
|
|
83
|
+
id: 'urn:activity:2001',
|
|
84
|
+
type: 'Create'
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
await client.notifyActivity(activity);
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.log(error instanceof Error); // true
|
|
91
|
+
}
|
|
92
|
+
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/dataspace-data-plane-socket-client",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.19",
|
|
4
|
+
"description": "Provides a WebSocket client for subscribing to activity log status notifications.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/twinfoundation/dataspace.git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@twin.org/api-models": "next",
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
20
|
"@twin.org/data-json-ld": "next",
|
|
21
|
-
"@twin.org/dataspace-models": "0.0.3-next.
|
|
21
|
+
"@twin.org/dataspace-models": "0.0.3-next.19",
|
|
22
22
|
"@twin.org/logging-models": "next",
|
|
23
23
|
"@twin.org/nameof": "next"
|
|
24
24
|
},
|