@twin.org/dataspace-models 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 CHANGED
@@ -1,6 +1,8 @@
1
- # TWIN Dataspace Models
1
+ # Dataspace Models
2
2
 
3
- Models which define the structure of the dataspace contracts and connectors.
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, DataspaceContexts.JsonSchemaNamespace, types);
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,iBAAiB,CAAC,mBAAmB,EACrC,KAAK,CACL,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\tDataspaceContexts.JsonSchemaNamespace,\n\t\t\ttypes\n\t\t);\n\t}\n}\n"]}
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"]}
@@ -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"]}
@@ -2,6 +2,9 @@
2
2
  * The contexts related to Dataspace
3
3
  */
4
4
  export declare const DataspaceContexts: {
5
+ /**
6
+ * The namespace location of the hosted version of the JSON Schema.
7
+ */
5
8
  readonly JsonSchemaNamespace: "https://schema.twindev.org/dataspace/";
6
9
  };
7
10
  /**
package/docs/changelog.md CHANGED
@@ -1,5 +1,12 @@
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
+
3
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)
4
11
 
5
12
 
package/docs/examples.md CHANGED
@@ -1 +1,33 @@
1
- # @twin.org/dataspace-models - Examples
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
+ ```
@@ -9,3 +9,5 @@ The contexts related to Dataspace
9
9
  ### JsonSchemaNamespace
10
10
 
11
11
  > `readonly` **JsonSchemaNamespace**: `"https://schema.twindev.org/dataspace/"` = `"https://schema.twindev.org/dataspace/"`
12
+
13
+ The namespace location of the hosted version of the JSON Schema.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@twin.org/dataspace-models",
3
- "version": "0.0.3-next.18",
4
- "description": "Models which define the structure of the Dataspace (Control Plane and Data Plane)",
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",