@twin.org/dataspace-test-app 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.
- package/README.md +21 -0
- package/dist/es/ITestAppConstructorOptions.js +4 -0
- package/dist/es/ITestAppConstructorOptions.js.map +1 -0
- package/dist/es/extension.js +65 -0
- package/dist/es/extension.js.map +1 -0
- package/dist/es/index.js +6 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/testDataspaceDataPlaneApp.js +191 -0
- package/dist/es/testDataspaceDataPlaneApp.js.map +1 -0
- package/dist/types/ITestAppConstructorOptions.d.ts +10 -0
- package/dist/types/extension.d.ts +44 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/testDataspaceDataPlaneApp.d.ts +65 -0
- package/docs/changelog.md +274 -0
- package/docs/examples.md +1 -0
- package/docs/reference/classes/TestDataspaceDataPlaneApp.md +209 -0
- package/docs/reference/functions/extensionInitialise.md +21 -0
- package/docs/reference/functions/extensionInitialiseEngine.md +17 -0
- package/docs/reference/functions/extensionInitialiseEngineServer.md +23 -0
- package/docs/reference/functions/generateRestRoutes.md +25 -0
- package/docs/reference/functions/testAppInitialiser.md +41 -0
- package/docs/reference/index.md +17 -0
- package/docs/reference/interfaces/ITestAppConstructorOptions.md +17 -0
- package/package.json +60 -0
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Dataspace Test App
|
|
2
|
+
|
|
3
|
+
Dataspace test app.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
npm install @twin.org/dataspace-test-app
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
Usage of the APIs is shown in the examples [docs/examples.md](docs/examples.md)
|
|
14
|
+
|
|
15
|
+
## Reference
|
|
16
|
+
|
|
17
|
+
Detailed reference documentation for the API can be found in [docs/reference/index.md](docs/reference/index.md)
|
|
18
|
+
|
|
19
|
+
## Changelog
|
|
20
|
+
|
|
21
|
+
The changes between each version can be found in [docs/changelog.md](docs/changelog.md)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ITestAppConstructorOptions.js","sourceRoot":"","sources":["../../src/ITestAppConstructorOptions.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Test App Constructor options.\n */\nexport interface ITestAppConstructorOptions {\n\t/**\n\t * Logging component type.\n\t * @default logging\n\t */\n\tloggingComponentType?: string;\n}\n"]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { DataspaceAppFactory } from "@twin.org/dataspace-models";
|
|
2
|
+
import { EngineTypeHelper } from "@twin.org/engine-types";
|
|
3
|
+
import { TestDataspaceDataPlaneApp } from "./testDataspaceDataPlaneApp.js";
|
|
4
|
+
/**
|
|
5
|
+
* Initialise the extension.
|
|
6
|
+
* @param envVars The environment variables for the node.
|
|
7
|
+
* @param nodeEngineConfig The node engine config.
|
|
8
|
+
*/
|
|
9
|
+
export async function extensionInitialise(envVars, nodeEngineConfig) {
|
|
10
|
+
nodeEngineConfig.types.testAppComponent = [
|
|
11
|
+
{
|
|
12
|
+
type: "service",
|
|
13
|
+
options: {}
|
|
14
|
+
}
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Initialise the engine for the extension.
|
|
19
|
+
* @param engineCore The engine core instance.
|
|
20
|
+
*/
|
|
21
|
+
export async function extensionInitialiseEngine(engineCore) {
|
|
22
|
+
engineCore.addTypeInitialiser("testAppComponent", "@twin.org/dataspace-test-app", "testAppInitialiser");
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Initialise the engine server for the extension.
|
|
26
|
+
* @param engineCore The engine core instance.
|
|
27
|
+
* @param engineServer The engine server instance.
|
|
28
|
+
*/
|
|
29
|
+
export async function extensionInitialiseEngineServer(engineCore, engineServer) {
|
|
30
|
+
engineServer.addRestRouteGenerator("testAppComponent", "@twin.org/dataspace-test-app", "generateRestRoutes");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Test Dataspace Data Plane App initializer.
|
|
34
|
+
* @param engineCore The engine core.
|
|
35
|
+
* @param context The context for the engine.
|
|
36
|
+
* @param instanceConfig The instance config.
|
|
37
|
+
* @param instanceConfig.options The instance config options.
|
|
38
|
+
* @param instanceConfig.type The instance type.
|
|
39
|
+
* @returns The instance created and the factory for it.
|
|
40
|
+
*/
|
|
41
|
+
export function testAppInitialiser(engineCore, context, instanceConfig) {
|
|
42
|
+
let instanceTypeName;
|
|
43
|
+
let createComponent;
|
|
44
|
+
if (instanceConfig.type === "service") {
|
|
45
|
+
createComponent = (createConfig) => new TestDataspaceDataPlaneApp(EngineTypeHelper.mergeConfig({
|
|
46
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent")
|
|
47
|
+
}, createConfig.options));
|
|
48
|
+
instanceTypeName = TestDataspaceDataPlaneApp.APP_ID;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
instanceTypeName,
|
|
52
|
+
factory: DataspaceAppFactory,
|
|
53
|
+
createComponent: createComponent
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Generate the rest routes for the component.
|
|
58
|
+
* @param baseRouteName The base route name.
|
|
59
|
+
* @param componentName The component name.
|
|
60
|
+
* @returns The rest routes.
|
|
61
|
+
*/
|
|
62
|
+
export function generateRestRoutes(baseRouteName, componentName) {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../../src/extension.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAQjE,OAAO,EAAsB,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACxC,OAAiC,EACjC,gBAAmC;IAEnC,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,GAAG;QACzC;YACC,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,EAAE;SACX;KACD,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,UAAuB;IACtE,UAAU,CAAC,kBAAkB,CAC5B,kBAAkB,EAClB,8BAA8B,EAC9B,oBAAoB,CACpB,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACpD,UAAuB,EACvB,YAA2B;IAE3B,YAAY,CAAC,qBAAqB,CACjC,kBAAkB,EAClB,8BAA8B,EAC9B,oBAAoB,CACpB,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CACjC,UAAsC,EACtC,OAA2B,EAC3B,cAAwE;IAExE,IAAI,gBAAoC,CAAC;IACzC,IAAI,eAAe,CAAC;IAEpB,IAAI,cAAc,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACvC,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE,CACzD,IAAI,yBAAyB,CAC5B,gBAAgB,CAAC,WAAW,CAC3B;YACC,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;SAC9E,EACD,YAAY,CAAC,OAAO,CACpB,CACD,CAAC;QACH,gBAAgB,GAAG,yBAAyB,CAAC,MAAM,CAAC;IACrD,CAAC;IAED,OAAO;QACN,gBAAgB;QAChB,OAAO,EAAE,mBAAmB;QAC5B,eAAe,EAAE,eAAsE;KACvF,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,aAAqB,EAAE,aAAqB;IAC9E,OAAO,EAAE,CAAC;AACX,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IRestRoute } from \"@twin.org/api-models\";\nimport type { IComponent } from \"@twin.org/core\";\nimport { DataspaceAppFactory } from \"@twin.org/dataspace-models\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreConfig,\n\tIEngineCoreContext,\n\tIEngineServer\n} from \"@twin.org/engine-models\";\nimport { type IEngineConfig, EngineTypeHelper } from \"@twin.org/engine-types\";\nimport type { ITestAppConstructorOptions } from \"./ITestAppConstructorOptions.js\";\nimport { TestDataspaceDataPlaneApp } from \"./testDataspaceDataPlaneApp.js\";\n\n/**\n * Initialise the extension.\n * @param envVars The environment variables for the node.\n * @param nodeEngineConfig The node engine config.\n */\nexport async function extensionInitialise(\n\tenvVars: { [id: string]: string },\n\tnodeEngineConfig: IEngineCoreConfig\n): Promise<void> {\n\tnodeEngineConfig.types.testAppComponent = [\n\t\t{\n\t\t\ttype: \"service\",\n\t\t\toptions: {}\n\t\t}\n\t];\n}\n\n/**\n * Initialise the engine for the extension.\n * @param engineCore The engine core instance.\n */\nexport async function extensionInitialiseEngine(engineCore: IEngineCore): Promise<void> {\n\tengineCore.addTypeInitialiser(\n\t\t\"testAppComponent\",\n\t\t\"@twin.org/dataspace-test-app\",\n\t\t\"testAppInitialiser\"\n\t);\n}\n\n/**\n * Initialise the engine server for the extension.\n * @param engineCore The engine core instance.\n * @param engineServer The engine server instance.\n */\nexport async function extensionInitialiseEngineServer(\n\tengineCore: IEngineCore,\n\tengineServer: IEngineServer\n): Promise<void> {\n\tengineServer.addRestRouteGenerator(\n\t\t\"testAppComponent\",\n\t\t\"@twin.org/dataspace-test-app\",\n\t\t\"generateRestRoutes\"\n\t);\n}\n\n/**\n * Test Dataspace Data Plane App initializer.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @param instanceConfig.options The instance config options.\n * @param instanceConfig.type The instance type.\n * @returns The instance created and the factory for it.\n */\nexport function testAppInitialiser(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext,\n\tinstanceConfig: { type: \"service\"; options: ITestAppConstructorOptions }\n): EngineTypeInitialiserReturn<typeof instanceConfig, typeof DataspaceAppFactory> {\n\tlet instanceTypeName: string | undefined;\n\tlet createComponent;\n\n\tif (instanceConfig.type === \"service\") {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew TestDataspaceDataPlaneApp(\n\t\t\t\tEngineTypeHelper.mergeConfig<ITestAppConstructorOptions>(\n\t\t\t\t\t{\n\t\t\t\t\t\tloggingComponentType: engineCore.getRegisteredInstanceType(\"loggingComponent\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\tinstanceTypeName = TestDataspaceDataPlaneApp.APP_ID;\n\t}\n\n\treturn {\n\t\tinstanceTypeName,\n\t\tfactory: DataspaceAppFactory,\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent\n\t};\n}\n\n/**\n * Generate the rest routes for the component.\n * @param baseRouteName The base route name.\n * @param componentName The component name.\n * @returns The rest routes.\n */\nexport function generateRestRoutes(baseRouteName: string, componentName: string): IRestRoute[] {\n\treturn [];\n}\n"]}
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./extension.js\";\nexport * from \"./ITestAppConstructorOptions.js\";\nexport * from \"./testDataspaceDataPlaneApp.js\";\n"]}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// Copyright 2025 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { ContextIdHelper, ContextIdKeys, ContextIdStore } from "@twin.org/context";
|
|
4
|
+
import { ComponentFactory, Guards } from "@twin.org/core";
|
|
5
|
+
import { DataTypeHandlerFactory } from "@twin.org/data-core";
|
|
6
|
+
import { DataRequestType } from "@twin.org/dataspace-models";
|
|
7
|
+
import { DataspaceProtocolContexts } from "@twin.org/standards-dataspace-protocol";
|
|
8
|
+
import { DublinCoreContexts } from "@twin.org/standards-dublin-core";
|
|
9
|
+
// Dummy Data
|
|
10
|
+
const id = "urn:ucr:24PLP051219453I002610799053311";
|
|
11
|
+
const entities = [
|
|
12
|
+
{
|
|
13
|
+
"@context": "https://vocabulary.uncefact.org/unece-context-D23B.jsonld",
|
|
14
|
+
type: "Consignment",
|
|
15
|
+
id,
|
|
16
|
+
destinationCountry: {
|
|
17
|
+
type: "Country",
|
|
18
|
+
countryId: "unece:CountryId#GB"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"@context": "https://vocabulary.uncefact.org/unece-context-D23B.jsonld",
|
|
23
|
+
type: "Document",
|
|
24
|
+
id: "urn:document:a3456fddaa56",
|
|
25
|
+
documentTypeCode: "unece:DocumentCodeList#853"
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* Test App Activity Handler.
|
|
30
|
+
*/
|
|
31
|
+
export class TestDataspaceDataPlaneApp {
|
|
32
|
+
/**
|
|
33
|
+
* App Name.
|
|
34
|
+
*/
|
|
35
|
+
static APP_ID = "https://twin.example.org/app1";
|
|
36
|
+
/**
|
|
37
|
+
* Runtime name for the class.
|
|
38
|
+
*/
|
|
39
|
+
static CLASS_NAME = "TestDataspaceDataPlaneApp";
|
|
40
|
+
/**
|
|
41
|
+
* Logging component.
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
_logging;
|
|
45
|
+
/**
|
|
46
|
+
* Node Identity
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
_nodeId;
|
|
50
|
+
/**
|
|
51
|
+
* Create a new instance of TestDataspaceDataPlaneApp.
|
|
52
|
+
* @param options The constructor options.
|
|
53
|
+
*/
|
|
54
|
+
constructor(options) {
|
|
55
|
+
this._logging = ComponentFactory.getIfExists(options?.loggingComponentType ?? "logging");
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns the class name of the component.
|
|
59
|
+
* @returns The class name of the component.
|
|
60
|
+
*/
|
|
61
|
+
className() {
|
|
62
|
+
return TestDataspaceDataPlaneApp.CLASS_NAME;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Datasets handled by the App.
|
|
66
|
+
* @returns Dataspace Protocol compliant datasets
|
|
67
|
+
*/
|
|
68
|
+
async datasetsHandled() {
|
|
69
|
+
const contextIds = await ContextIdStore.getContextIds();
|
|
70
|
+
const organizationId = contextIds?.[ContextIdKeys.Organization] ?? contextIds?.[ContextIdKeys.Node] ?? "";
|
|
71
|
+
return [
|
|
72
|
+
{
|
|
73
|
+
"@context": [
|
|
74
|
+
DataspaceProtocolContexts.Context,
|
|
75
|
+
{
|
|
76
|
+
dcterms: DublinCoreContexts.NamespaceTerms
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"@id": "https://twin.example.org/data-service-1",
|
|
80
|
+
"@type": "Dataset",
|
|
81
|
+
"dcterms:publisher": organizationId,
|
|
82
|
+
hasPolicy: [
|
|
83
|
+
{
|
|
84
|
+
"@type": "Offer",
|
|
85
|
+
uid: "urn:uuid:test-policy-offer-1",
|
|
86
|
+
assigner: organizationId,
|
|
87
|
+
permission: [
|
|
88
|
+
{
|
|
89
|
+
action: "read"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
distribution: {
|
|
95
|
+
"@id": "https://twin.example.org/distribution-1",
|
|
96
|
+
"@type": "Distribution",
|
|
97
|
+
accessService: "https://twin.example.org/data-service-1",
|
|
98
|
+
format: "Http-Pull-Query-Format"
|
|
99
|
+
},
|
|
100
|
+
"dcterms:type": "https://vocabulary.uncefact.org/Consignment"
|
|
101
|
+
}
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Supported query types.
|
|
106
|
+
* @returns Types.
|
|
107
|
+
*/
|
|
108
|
+
supportedQueryTypes() {
|
|
109
|
+
return ["TestQueryType"];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Start method.
|
|
113
|
+
* @param nodeLoggingComponentType the logging component type of such a node.
|
|
114
|
+
*/
|
|
115
|
+
async start(nodeLoggingComponentType) {
|
|
116
|
+
const contextIds = await ContextIdStore.getContextIds();
|
|
117
|
+
ContextIdHelper.guard(contextIds, ContextIdKeys.Node);
|
|
118
|
+
this._nodeId = contextIds[ContextIdKeys.Node];
|
|
119
|
+
DataTypeHandlerFactory.register("https://twin.example.org/MyCreate", () => ({
|
|
120
|
+
namespace: "https://twin.example.org/",
|
|
121
|
+
type: "MyCreate",
|
|
122
|
+
defaultValue: {},
|
|
123
|
+
jsonSchema: async () => ({
|
|
124
|
+
type: "object"
|
|
125
|
+
})
|
|
126
|
+
}));
|
|
127
|
+
DataTypeHandlerFactory.register("https://vocabulary.uncefact.org/Consignment", () => ({
|
|
128
|
+
namespace: "https://vocabulary.uncefact.org/",
|
|
129
|
+
type: "Consignment",
|
|
130
|
+
defaultValue: {},
|
|
131
|
+
jsonSchema: async () => ({
|
|
132
|
+
type: "object"
|
|
133
|
+
})
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The activities handled by the App.
|
|
138
|
+
* @returns The activities handled by the App.
|
|
139
|
+
*/
|
|
140
|
+
activitiesHandled() {
|
|
141
|
+
return [{ objectType: "https://vocabulary.uncefact.org/Consignment" }];
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Handle Activity.
|
|
145
|
+
* @param activity Activity
|
|
146
|
+
* @returns Activity processing result
|
|
147
|
+
*/
|
|
148
|
+
async handleActivity(activity) {
|
|
149
|
+
Guards.object(TestDataspaceDataPlaneApp.CLASS_NAME, "activity", activity);
|
|
150
|
+
await this._logging?.log({
|
|
151
|
+
level: "info",
|
|
152
|
+
source: TestDataspaceDataPlaneApp.CLASS_NAME,
|
|
153
|
+
message: `App Called: ${TestDataspaceDataPlaneApp.APP_ID}`
|
|
154
|
+
});
|
|
155
|
+
await this._logging?.log({
|
|
156
|
+
level: "info",
|
|
157
|
+
source: TestDataspaceDataPlaneApp.CLASS_NAME,
|
|
158
|
+
message: `Node Identity: ${this._nodeId ?? ""}`
|
|
159
|
+
});
|
|
160
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
161
|
+
return "1234";
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Handles the Data Request.
|
|
165
|
+
* @param dataRequest The data request
|
|
166
|
+
* @param cursor Cursor that points to the next item in the result set.
|
|
167
|
+
* @param limit Maximum number of entries retrieved or to be retrieved.
|
|
168
|
+
* @returns the Data.
|
|
169
|
+
*/
|
|
170
|
+
async handleDataRequest(dataRequest, cursor, limit) {
|
|
171
|
+
Guards.object(TestDataspaceDataPlaneApp.CLASS_NAME, "dataRequest", dataRequest);
|
|
172
|
+
switch (dataRequest.type) {
|
|
173
|
+
case DataRequestType.DataAssetEntities: {
|
|
174
|
+
if (dataRequest.entitySet.entityType === "https://vocabulary.uncefact.org/Consignment") {
|
|
175
|
+
return {
|
|
176
|
+
data: [entities[0]]
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
if (dataRequest.entitySet.entityId?.includes(id)) {
|
|
180
|
+
return {
|
|
181
|
+
data: entities[0]
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
return { data: [] };
|
|
185
|
+
}
|
|
186
|
+
case DataRequestType.QueryDataAsset:
|
|
187
|
+
return { data: entities };
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=testDataspaceDataPlaneApp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testDataspaceDataPlaneApp.js","sourceRoot":"","sources":["../../src/testDataspaceDataPlaneApp.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ContextIdHelper, ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport { ComponentFactory, Guards } from \"@twin.org/core\";\nimport { DataTypeHandlerFactory } from \"@twin.org/data-core\";\nimport type { IJsonLdDocument } from \"@twin.org/data-json-ld\";\nimport {\n\tDataRequestType,\n\ttype IActivityQuery,\n\ttype IDataRequest,\n\ttype IDataspaceApp\n} from \"@twin.org/dataspace-models\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tDataspaceProtocolContexts,\n\ttype IDataspaceProtocolDataset\n} from \"@twin.org/standards-dataspace-protocol\";\nimport { DublinCoreContexts } from \"@twin.org/standards-dublin-core\";\nimport type { IActivityStreamsActivity } from \"@twin.org/standards-w3c-activity-streams\";\nimport type { ITestAppConstructorOptions } from \"./ITestAppConstructorOptions.js\";\n\n// Dummy Data\nconst id = \"urn:ucr:24PLP051219453I002610799053311\";\nconst entities = [\n\t{\n\t\t\"@context\": \"https://vocabulary.uncefact.org/unece-context-D23B.jsonld\",\n\t\ttype: \"Consignment\",\n\t\tid,\n\t\tdestinationCountry: {\n\t\t\ttype: \"Country\",\n\t\t\tcountryId: \"unece:CountryId#GB\"\n\t\t}\n\t},\n\t{\n\t\t\"@context\": \"https://vocabulary.uncefact.org/unece-context-D23B.jsonld\",\n\t\ttype: \"Document\",\n\t\tid: \"urn:document:a3456fddaa56\",\n\t\tdocumentTypeCode: \"unece:DocumentCodeList#853\"\n\t}\n];\n\n/**\n * Test App Activity Handler.\n */\nexport class TestDataspaceDataPlaneApp implements IDataspaceApp {\n\t/**\n\t * App Name.\n\t */\n\tpublic static readonly APP_ID = \"https://twin.example.org/app1\";\n\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<TestDataspaceDataPlaneApp>();\n\n\t/**\n\t * Logging component.\n\t * @internal\n\t */\n\tprivate readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * Node Identity\n\t * @internal\n\t */\n\tprivate _nodeId?: string;\n\n\t/**\n\t * Create a new instance of TestDataspaceDataPlaneApp.\n\t * @param options The constructor options.\n\t */\n\tconstructor(options?: ITestAppConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists<ILoggingComponent>(\n\t\t\toptions?.loggingComponentType ?? \"logging\"\n\t\t);\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn TestDataspaceDataPlaneApp.CLASS_NAME;\n\t}\n\n\t/**\n\t * Datasets handled by the App.\n\t * @returns Dataspace Protocol compliant datasets\n\t */\n\tpublic async datasetsHandled(): Promise<IDataspaceProtocolDataset[]> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst organizationId =\n\t\t\tcontextIds?.[ContextIdKeys.Organization] ?? contextIds?.[ContextIdKeys.Node] ?? \"\";\n\t\treturn [\n\t\t\t{\n\t\t\t\t\"@context\": [\n\t\t\t\t\tDataspaceProtocolContexts.Context,\n\t\t\t\t\t{\n\t\t\t\t\t\tdcterms: DublinCoreContexts.NamespaceTerms\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\t\"@id\": \"https://twin.example.org/data-service-1\",\n\t\t\t\t\"@type\": \"Dataset\",\n\t\t\t\t\"dcterms:publisher\": organizationId,\n\t\t\t\thasPolicy: [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"@type\": \"Offer\",\n\t\t\t\t\t\tuid: \"urn:uuid:test-policy-offer-1\",\n\t\t\t\t\t\tassigner: organizationId,\n\t\t\t\t\t\tpermission: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\taction: \"read\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tdistribution: {\n\t\t\t\t\t\"@id\": \"https://twin.example.org/distribution-1\",\n\t\t\t\t\t\"@type\": \"Distribution\",\n\t\t\t\t\taccessService: \"https://twin.example.org/data-service-1\",\n\t\t\t\t\tformat: \"Http-Pull-Query-Format\"\n\t\t\t\t},\n\t\t\t\t\"dcterms:type\": \"https://vocabulary.uncefact.org/Consignment\"\n\t\t\t}\n\t\t];\n\t}\n\n\t/**\n\t * Supported query types.\n\t * @returns Types.\n\t */\n\tpublic supportedQueryTypes(): string[] {\n\t\treturn [\"TestQueryType\"];\n\t}\n\n\t/**\n\t * Start method.\n\t * @param nodeLoggingComponentType the logging component type of such a node.\n\t */\n\tpublic async start(nodeLoggingComponentType?: string): Promise<void> {\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tContextIdHelper.guard(contextIds, ContextIdKeys.Node);\n\t\tthis._nodeId = contextIds[ContextIdKeys.Node];\n\n\t\tDataTypeHandlerFactory.register(\"https://twin.example.org/MyCreate\", () => ({\n\t\t\tnamespace: \"https://twin.example.org/\",\n\t\t\ttype: \"MyCreate\",\n\t\t\tdefaultValue: {},\n\t\t\tjsonSchema: async () => ({\n\t\t\t\ttype: \"object\"\n\t\t\t})\n\t\t}));\n\n\t\tDataTypeHandlerFactory.register(\"https://vocabulary.uncefact.org/Consignment\", () => ({\n\t\t\tnamespace: \"https://vocabulary.uncefact.org/\",\n\t\t\ttype: \"Consignment\",\n\t\t\tdefaultValue: {},\n\t\t\tjsonSchema: async () => ({\n\t\t\t\ttype: \"object\"\n\t\t\t})\n\t\t}));\n\t}\n\n\t/**\n\t * The activities handled by the App.\n\t * @returns The activities handled by the App.\n\t */\n\tpublic activitiesHandled(): IActivityQuery[] {\n\t\treturn [{ objectType: \"https://vocabulary.uncefact.org/Consignment\" }];\n\t}\n\n\t/**\n\t * Handle Activity.\n\t * @param activity Activity\n\t * @returns Activity processing result\n\t */\n\tpublic async handleActivity<T>(activity: IActivityStreamsActivity): Promise<T> {\n\t\tGuards.object<IActivityStreamsActivity>(\n\t\t\tTestDataspaceDataPlaneApp.CLASS_NAME,\n\t\t\tnameof(activity),\n\t\t\tactivity\n\t\t);\n\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: TestDataspaceDataPlaneApp.CLASS_NAME,\n\t\t\tmessage: `App Called: ${TestDataspaceDataPlaneApp.APP_ID}`\n\t\t});\n\n\t\tawait this._logging?.log({\n\t\t\tlevel: \"info\",\n\t\t\tsource: TestDataspaceDataPlaneApp.CLASS_NAME,\n\t\t\tmessage: `Node Identity: ${this._nodeId ?? \"\"}`\n\t\t});\n\n\t\tawait new Promise(resolve => setTimeout(resolve, 500));\n\t\treturn \"1234\" as T;\n\t}\n\n\t/**\n\t * Handles the Data Request.\n\t * @param dataRequest The data request\n\t * @param cursor Cursor that points to the next item in the result set.\n\t * @param limit Maximum number of entries retrieved or to be retrieved.\n\t * @returns the Data.\n\t */\n\tpublic async handleDataRequest(\n\t\tdataRequest: IDataRequest,\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{ data: IJsonLdDocument; cursor?: string }> {\n\t\tGuards.object<IDataRequest>(\n\t\t\tTestDataspaceDataPlaneApp.CLASS_NAME,\n\t\t\tnameof(dataRequest),\n\t\t\tdataRequest\n\t\t);\n\n\t\tswitch (dataRequest.type) {\n\t\t\tcase DataRequestType.DataAssetEntities: {\n\t\t\t\tif (dataRequest.entitySet.entityType === \"https://vocabulary.uncefact.org/Consignment\") {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: [entities[0]]\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif (dataRequest.entitySet.entityId?.includes(id)) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: entities[0]\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn { data: [] };\n\t\t\t}\n\n\t\t\tcase DataRequestType.QueryDataAsset:\n\t\t\t\treturn { data: entities };\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { IRestRoute } from "@twin.org/api-models";
|
|
2
|
+
import { DataspaceAppFactory } from "@twin.org/dataspace-models";
|
|
3
|
+
import type { EngineTypeInitialiserReturn, IEngineCore, IEngineCoreConfig, IEngineCoreContext, IEngineServer } from "@twin.org/engine-models";
|
|
4
|
+
import { type IEngineConfig } from "@twin.org/engine-types";
|
|
5
|
+
import type { ITestAppConstructorOptions } from "./ITestAppConstructorOptions.js";
|
|
6
|
+
/**
|
|
7
|
+
* Initialise the extension.
|
|
8
|
+
* @param envVars The environment variables for the node.
|
|
9
|
+
* @param nodeEngineConfig The node engine config.
|
|
10
|
+
*/
|
|
11
|
+
export declare function extensionInitialise(envVars: {
|
|
12
|
+
[id: string]: string;
|
|
13
|
+
}, nodeEngineConfig: IEngineCoreConfig): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Initialise the engine for the extension.
|
|
16
|
+
* @param engineCore The engine core instance.
|
|
17
|
+
*/
|
|
18
|
+
export declare function extensionInitialiseEngine(engineCore: IEngineCore): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Initialise the engine server for the extension.
|
|
21
|
+
* @param engineCore The engine core instance.
|
|
22
|
+
* @param engineServer The engine server instance.
|
|
23
|
+
*/
|
|
24
|
+
export declare function extensionInitialiseEngineServer(engineCore: IEngineCore, engineServer: IEngineServer): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Test Dataspace Data Plane App initializer.
|
|
27
|
+
* @param engineCore The engine core.
|
|
28
|
+
* @param context The context for the engine.
|
|
29
|
+
* @param instanceConfig The instance config.
|
|
30
|
+
* @param instanceConfig.options The instance config options.
|
|
31
|
+
* @param instanceConfig.type The instance type.
|
|
32
|
+
* @returns The instance created and the factory for it.
|
|
33
|
+
*/
|
|
34
|
+
export declare function testAppInitialiser(engineCore: IEngineCore<IEngineConfig>, context: IEngineCoreContext, instanceConfig: {
|
|
35
|
+
type: "service";
|
|
36
|
+
options: ITestAppConstructorOptions;
|
|
37
|
+
}): EngineTypeInitialiserReturn<typeof instanceConfig, typeof DataspaceAppFactory>;
|
|
38
|
+
/**
|
|
39
|
+
* Generate the rest routes for the component.
|
|
40
|
+
* @param baseRouteName The base route name.
|
|
41
|
+
* @param componentName The component name.
|
|
42
|
+
* @returns The rest routes.
|
|
43
|
+
*/
|
|
44
|
+
export declare function generateRestRoutes(baseRouteName: string, componentName: string): IRestRoute[];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { IJsonLdDocument } from "@twin.org/data-json-ld";
|
|
2
|
+
import { type IActivityQuery, type IDataRequest, type IDataspaceApp } from "@twin.org/dataspace-models";
|
|
3
|
+
import { type IDataspaceProtocolDataset } from "@twin.org/standards-dataspace-protocol";
|
|
4
|
+
import type { IActivityStreamsActivity } from "@twin.org/standards-w3c-activity-streams";
|
|
5
|
+
import type { ITestAppConstructorOptions } from "./ITestAppConstructorOptions.js";
|
|
6
|
+
/**
|
|
7
|
+
* Test App Activity Handler.
|
|
8
|
+
*/
|
|
9
|
+
export declare class TestDataspaceDataPlaneApp implements IDataspaceApp {
|
|
10
|
+
/**
|
|
11
|
+
* App Name.
|
|
12
|
+
*/
|
|
13
|
+
static readonly APP_ID = "https://twin.example.org/app1";
|
|
14
|
+
/**
|
|
15
|
+
* Runtime name for the class.
|
|
16
|
+
*/
|
|
17
|
+
static readonly CLASS_NAME: string;
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of TestDataspaceDataPlaneApp.
|
|
20
|
+
* @param options The constructor options.
|
|
21
|
+
*/
|
|
22
|
+
constructor(options?: ITestAppConstructorOptions);
|
|
23
|
+
/**
|
|
24
|
+
* Returns the class name of the component.
|
|
25
|
+
* @returns The class name of the component.
|
|
26
|
+
*/
|
|
27
|
+
className(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Datasets handled by the App.
|
|
30
|
+
* @returns Dataspace Protocol compliant datasets
|
|
31
|
+
*/
|
|
32
|
+
datasetsHandled(): Promise<IDataspaceProtocolDataset[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Supported query types.
|
|
35
|
+
* @returns Types.
|
|
36
|
+
*/
|
|
37
|
+
supportedQueryTypes(): string[];
|
|
38
|
+
/**
|
|
39
|
+
* Start method.
|
|
40
|
+
* @param nodeLoggingComponentType the logging component type of such a node.
|
|
41
|
+
*/
|
|
42
|
+
start(nodeLoggingComponentType?: string): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* The activities handled by the App.
|
|
45
|
+
* @returns The activities handled by the App.
|
|
46
|
+
*/
|
|
47
|
+
activitiesHandled(): IActivityQuery[];
|
|
48
|
+
/**
|
|
49
|
+
* Handle Activity.
|
|
50
|
+
* @param activity Activity
|
|
51
|
+
* @returns Activity processing result
|
|
52
|
+
*/
|
|
53
|
+
handleActivity<T>(activity: IActivityStreamsActivity): Promise<T>;
|
|
54
|
+
/**
|
|
55
|
+
* Handles the Data Request.
|
|
56
|
+
* @param dataRequest The data request
|
|
57
|
+
* @param cursor Cursor that points to the next item in the result set.
|
|
58
|
+
* @param limit Maximum number of entries retrieved or to be retrieved.
|
|
59
|
+
* @returns the Data.
|
|
60
|
+
*/
|
|
61
|
+
handleDataRequest(dataRequest: IDataRequest, cursor?: string, limit?: number): Promise<{
|
|
62
|
+
data: IJsonLdDocument;
|
|
63
|
+
cursor?: string;
|
|
64
|
+
}>;
|
|
65
|
+
}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.3-next.15](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.3-next.14...dataspace-test-app-v0.0.3-next.15) (2026-03-02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* unification of the data exchange and the data space connector ([#57](https://github.com/twinfoundation/dataspace/issues/57)) ([df2644d](https://github.com/twinfoundation/dataspace/commit/df2644d989471e07dadd83d27bef736179e31bf4))
|
|
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.14 to 0.0.3-next.15
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.12](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.3-next.11...dataspace-test-app-v0.0.3-next.12) (2026-01-22)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Miscellaneous Chores
|
|
21
|
+
|
|
22
|
+
* **dataspace-test-app:** Synchronize repo versions
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.11 to 0.0.3-next.12
|
|
30
|
+
|
|
31
|
+
## [0.0.3-next.11](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.3-next.10...dataspace-test-app-v0.0.3-next.11) (2026-01-22)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* update contexts ([1c9a169](https://github.com/twinfoundation/dataspace/commit/1c9a169ebc44af59df890eb29dd5cb4274940ebe))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Dependencies
|
|
40
|
+
|
|
41
|
+
* The following workspace dependencies were updated
|
|
42
|
+
* dependencies
|
|
43
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.10 to 0.0.3-next.11
|
|
44
|
+
|
|
45
|
+
## [0.0.3-next.10](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.3-next.9...dataspace-test-app-v0.0.3-next.10) (2026-01-19)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Features
|
|
49
|
+
|
|
50
|
+
* replace registerApp with factory pattern ([#51](https://github.com/twinfoundation/dataspace/issues/51)) ([a7ef328](https://github.com/twinfoundation/dataspace/commit/a7ef32873f5781f7b1f8aa3670f5fb612dd17018))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Dependencies
|
|
54
|
+
|
|
55
|
+
* The following workspace dependencies were updated
|
|
56
|
+
* dependencies
|
|
57
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.9 to 0.0.3-next.10
|
|
58
|
+
|
|
59
|
+
## [0.0.3-next.9](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.3-next.8...dataspace-test-app-v0.0.3-next.9) (2026-01-19)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Miscellaneous Chores
|
|
63
|
+
|
|
64
|
+
* **dataspace-test-app:** Synchronize repo versions
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Dependencies
|
|
68
|
+
|
|
69
|
+
* The following workspace dependencies were updated
|
|
70
|
+
* dependencies
|
|
71
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.8 to 0.0.3-next.9
|
|
72
|
+
|
|
73
|
+
## [0.0.3-next.8](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.3-next.7...dataspace-test-app-v0.0.3-next.8) (2026-01-16)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Miscellaneous Chores
|
|
77
|
+
|
|
78
|
+
* **dataspace-test-app:** Synchronize repo versions
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Dependencies
|
|
82
|
+
|
|
83
|
+
* The following workspace dependencies were updated
|
|
84
|
+
* dependencies
|
|
85
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.7 to 0.0.3-next.8
|
|
86
|
+
|
|
87
|
+
## [0.0.3-next.7](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.3-next.6...dataspace-test-app-v0.0.3-next.7) (2026-01-16)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### Features
|
|
91
|
+
|
|
92
|
+
* implement Link headers for pagination ([#43](https://github.com/twinfoundation/dataspace/issues/43)) ([ce2a31f](https://github.com/twinfoundation/dataspace/commit/ce2a31fab1b5a1338d34b8514e96a203705c68d1))
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
### Dependencies
|
|
96
|
+
|
|
97
|
+
* The following workspace dependencies were updated
|
|
98
|
+
* dependencies
|
|
99
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
100
|
+
|
|
101
|
+
## [0.0.3-next.6](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.3-next.5...dataspace-test-app-v0.0.3-next.6) (2026-01-15)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### Features
|
|
105
|
+
|
|
106
|
+
* update contexts and namespaces ([#41](https://github.com/twinfoundation/dataspace/issues/41)) ([cad79f9](https://github.com/twinfoundation/dataspace/commit/cad79f9f18c0b1bc4a4604a951c28db1d1068f5e))
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
### Dependencies
|
|
110
|
+
|
|
111
|
+
* The following workspace dependencies were updated
|
|
112
|
+
* dependencies
|
|
113
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.5 to 0.0.3-next.6
|
|
114
|
+
|
|
115
|
+
## [0.0.3-next.5](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.3-next.4...dataspace-test-app-v0.0.3-next.5) (2026-01-07)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### Miscellaneous Chores
|
|
119
|
+
|
|
120
|
+
* **dataspace-test-app:** Synchronize repo versions
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### Dependencies
|
|
124
|
+
|
|
125
|
+
* The following workspace dependencies were updated
|
|
126
|
+
* dependencies
|
|
127
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.4 to 0.0.3-next.5
|
|
128
|
+
|
|
129
|
+
## [0.0.3-next.4](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.3-next.3...dataspace-test-app-v0.0.3-next.4) (2026-01-06)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### Features
|
|
133
|
+
|
|
134
|
+
* rfc 004 implementation ([#34](https://github.com/twinfoundation/dataspace/issues/34)) ([3920a45](https://github.com/twinfoundation/dataspace/commit/3920a456f744610885c33cb0960e0448aea71a44))
|
|
135
|
+
* update standards dependencies ([8534ad7](https://github.com/twinfoundation/dataspace/commit/8534ad74b996610ed5994b5213c857989c2bf57a))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
### Dependencies
|
|
139
|
+
|
|
140
|
+
* The following workspace dependencies were updated
|
|
141
|
+
* dependencies
|
|
142
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.3 to 0.0.3-next.4
|
|
143
|
+
|
|
144
|
+
## [0.0.3-next.3](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.3-next.2...dataspace-test-app-v0.0.3-next.3) (2025-12-01)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
### Miscellaneous Chores
|
|
148
|
+
|
|
149
|
+
* **dataspace-test-app:** Synchronize repo versions
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
### Dependencies
|
|
153
|
+
|
|
154
|
+
* The following workspace dependencies were updated
|
|
155
|
+
* dependencies
|
|
156
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.2 to 0.0.3-next.3
|
|
157
|
+
|
|
158
|
+
## [0.0.3-next.2](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.3-next.1...dataspace-test-app-v0.0.3-next.2) (2025-11-28)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
### Miscellaneous Chores
|
|
162
|
+
|
|
163
|
+
* **dataspace-test-app:** Synchronize repo versions
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
### Dependencies
|
|
167
|
+
|
|
168
|
+
* The following workspace dependencies were updated
|
|
169
|
+
* dependencies
|
|
170
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.1 to 0.0.3-next.2
|
|
171
|
+
|
|
172
|
+
## [0.0.3-next.1](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.3-next.0...dataspace-test-app-v0.0.3-next.1) (2025-11-12)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
### Features
|
|
176
|
+
|
|
177
|
+
* add context id features ([#26](https://github.com/twinfoundation/dataspace/issues/26)) ([6429a16](https://github.com/twinfoundation/dataspace/commit/6429a160dac9499304fdfb93a9dbdce37277ca7d))
|
|
178
|
+
* add rest and socket clients ([950bf70](https://github.com/twinfoundation/dataspace/commit/950bf705e6df4e709bbbe58e93968510067b9ddc))
|
|
179
|
+
* add validate-locales ([c0b08a7](https://github.com/twinfoundation/dataspace/commit/c0b08a73268f9fd3eb6ac3079b49d1ab0c01f118))
|
|
180
|
+
* dataspace ([#2](https://github.com/twinfoundation/dataspace/issues/2)) ([c2ac651](https://github.com/twinfoundation/dataspace/commit/c2ac651ceb6f35e46bd5eac97ac648bb1ee9dc0c))
|
|
181
|
+
* eslint migration to flat config ([b84e875](https://github.com/twinfoundation/dataspace/commit/b84e87530aa249891618096ab6e072b21ff9f63a))
|
|
182
|
+
* query interface data space connector ([#18](https://github.com/twinfoundation/dataspace/issues/18)) ([b12eca1](https://github.com/twinfoundation/dataspace/commit/b12eca124a8f46d290c168e364b7ed4bf72001d8))
|
|
183
|
+
* update framework components ([4d9ca95](https://github.com/twinfoundation/dataspace/commit/4d9ca95879bd6cae9d031595292b6a872bf5b5fd))
|
|
184
|
+
* use new engine extensions config ([80bdb5b](https://github.com/twinfoundation/dataspace/commit/80bdb5b298b65b5b22fa9927a0ad031cb9a3534d))
|
|
185
|
+
* use new start signature ([4064d19](https://github.com/twinfoundation/dataspace/commit/4064d19676b183e7162e667a701a24c4b1f48504))
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
### Bug Fixes
|
|
189
|
+
|
|
190
|
+
* the Dataspace Connector App receives Node Identity ([#14](https://github.com/twinfoundation/dataspace/issues/14)) ([a71ad44](https://github.com/twinfoundation/dataspace/commit/a71ad44539d9c2b55e13d865af58eeb9eb14e4ea))
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
### Dependencies
|
|
194
|
+
|
|
195
|
+
* The following workspace dependencies were updated
|
|
196
|
+
* dependencies
|
|
197
|
+
* @twin.org/dataspace-models bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
198
|
+
|
|
199
|
+
## [0.0.1-next.8](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.1-next.7...dataspace-test-app-v0.0.1-next.8) (2025-10-09)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
### Features
|
|
203
|
+
|
|
204
|
+
* add validate-locales ([c0b08a7](https://github.com/twinfoundation/dataspace/commit/c0b08a73268f9fd3eb6ac3079b49d1ab0c01f118))
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
### Dependencies
|
|
208
|
+
|
|
209
|
+
* The following workspace dependencies were updated
|
|
210
|
+
* dependencies
|
|
211
|
+
* @twin.org/dataspace-models bumped from 0.0.1-next.7 to 0.0.1-next.8
|
|
212
|
+
|
|
213
|
+
## [0.0.1-next.7](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.1-next.6...dataspace-test-app-v0.0.1-next.7) (2025-10-02)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
### Features
|
|
217
|
+
|
|
218
|
+
* use new engine extensions config ([80bdb5b](https://github.com/twinfoundation/dataspace/commit/80bdb5b298b65b5b22fa9927a0ad031cb9a3534d))
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
### Dependencies
|
|
222
|
+
|
|
223
|
+
* The following workspace dependencies were updated
|
|
224
|
+
* dependencies
|
|
225
|
+
* @twin.org/dataspace-models bumped from 0.0.1-next.6 to 0.0.1-next.7
|
|
226
|
+
|
|
227
|
+
## [0.0.1-next.6](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.1-next.5...dataspace-test-app-v0.0.1-next.6) (2025-09-29)
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
### Features
|
|
231
|
+
|
|
232
|
+
* use new start signature ([4064d19](https://github.com/twinfoundation/dataspace/commit/4064d19676b183e7162e667a701a24c4b1f48504))
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
### Dependencies
|
|
236
|
+
|
|
237
|
+
* The following workspace dependencies were updated
|
|
238
|
+
* dependencies
|
|
239
|
+
* @twin.org/dataspace-models bumped from 0.0.1-next.5 to 0.0.1-next.6
|
|
240
|
+
|
|
241
|
+
## [0.0.1-next.5](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.1-next.4...dataspace-test-app-v0.0.1-next.5) (2025-09-29)
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
### Features
|
|
245
|
+
|
|
246
|
+
* update framework components ([4d9ca95](https://github.com/twinfoundation/dataspace/commit/4d9ca95879bd6cae9d031595292b6a872bf5b5fd))
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
### Bug Fixes
|
|
250
|
+
|
|
251
|
+
* the Dataspace Connector App receives Node Identity ([#14](https://github.com/twinfoundation/dataspace/issues/14)) ([a71ad44](https://github.com/twinfoundation/dataspace/commit/a71ad44539d9c2b55e13d865af58eeb9eb14e4ea))
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
### Dependencies
|
|
255
|
+
|
|
256
|
+
* The following workspace dependencies were updated
|
|
257
|
+
* dependencies
|
|
258
|
+
* @twin.org/dataspace-models bumped from 0.0.1-next.4 to 0.0.1-next.5
|
|
259
|
+
|
|
260
|
+
## [0.0.1-next.4](https://github.com/twinfoundation/dataspace/compare/dataspace-test-app-v0.0.1-next.3...dataspace-test-app-v0.0.1-next.4) (2025-08-29)
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
### Features
|
|
264
|
+
|
|
265
|
+
* eslint migration to flat config ([b84e875](https://github.com/twinfoundation/dataspace/commit/b84e87530aa249891618096ab6e072b21ff9f63a))
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
### Dependencies
|
|
269
|
+
|
|
270
|
+
* The following workspace dependencies were updated
|
|
271
|
+
* dependencies
|
|
272
|
+
* @twin.org/dataspace-models bumped from 0.0.1-next.3 to 0.0.1-next.4
|
|
273
|
+
|
|
274
|
+
## Changelog
|
package/docs/examples.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @twin.org/dataspace-test-app - Examples
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Class: TestDataspaceDataPlaneApp
|
|
2
|
+
|
|
3
|
+
Test App Activity Handler.
|
|
4
|
+
|
|
5
|
+
## Implements
|
|
6
|
+
|
|
7
|
+
- `IDataspaceApp`
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### Constructor
|
|
12
|
+
|
|
13
|
+
> **new TestDataspaceDataPlaneApp**(`options?`): `TestDataspaceDataPlaneApp`
|
|
14
|
+
|
|
15
|
+
Create a new instance of TestDataspaceDataPlaneApp.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### options?
|
|
20
|
+
|
|
21
|
+
[`ITestAppConstructorOptions`](../interfaces/ITestAppConstructorOptions.md)
|
|
22
|
+
|
|
23
|
+
The constructor options.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
`TestDataspaceDataPlaneApp`
|
|
28
|
+
|
|
29
|
+
## Properties
|
|
30
|
+
|
|
31
|
+
### APP\_ID
|
|
32
|
+
|
|
33
|
+
> `readonly` `static` **APP\_ID**: `"https://twin.example.org/app1"` = `"https://twin.example.org/app1"`
|
|
34
|
+
|
|
35
|
+
App Name.
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
39
|
+
### CLASS\_NAME
|
|
40
|
+
|
|
41
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
42
|
+
|
|
43
|
+
Runtime name for the class.
|
|
44
|
+
|
|
45
|
+
## Methods
|
|
46
|
+
|
|
47
|
+
### className()
|
|
48
|
+
|
|
49
|
+
> **className**(): `string`
|
|
50
|
+
|
|
51
|
+
Returns the class name of the component.
|
|
52
|
+
|
|
53
|
+
#### Returns
|
|
54
|
+
|
|
55
|
+
`string`
|
|
56
|
+
|
|
57
|
+
The class name of the component.
|
|
58
|
+
|
|
59
|
+
#### Implementation of
|
|
60
|
+
|
|
61
|
+
`IDataspaceApp.className`
|
|
62
|
+
|
|
63
|
+
***
|
|
64
|
+
|
|
65
|
+
### datasetsHandled()
|
|
66
|
+
|
|
67
|
+
> **datasetsHandled**(): `Promise`\<`IDataspaceProtocolDataset`[]\>
|
|
68
|
+
|
|
69
|
+
Datasets handled by the App.
|
|
70
|
+
|
|
71
|
+
#### Returns
|
|
72
|
+
|
|
73
|
+
`Promise`\<`IDataspaceProtocolDataset`[]\>
|
|
74
|
+
|
|
75
|
+
Dataspace Protocol compliant datasets
|
|
76
|
+
|
|
77
|
+
#### Implementation of
|
|
78
|
+
|
|
79
|
+
`IDataspaceApp.datasetsHandled`
|
|
80
|
+
|
|
81
|
+
***
|
|
82
|
+
|
|
83
|
+
### supportedQueryTypes()
|
|
84
|
+
|
|
85
|
+
> **supportedQueryTypes**(): `string`[]
|
|
86
|
+
|
|
87
|
+
Supported query types.
|
|
88
|
+
|
|
89
|
+
#### Returns
|
|
90
|
+
|
|
91
|
+
`string`[]
|
|
92
|
+
|
|
93
|
+
Types.
|
|
94
|
+
|
|
95
|
+
#### Implementation of
|
|
96
|
+
|
|
97
|
+
`IDataspaceApp.supportedQueryTypes`
|
|
98
|
+
|
|
99
|
+
***
|
|
100
|
+
|
|
101
|
+
### start()
|
|
102
|
+
|
|
103
|
+
> **start**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
|
|
104
|
+
|
|
105
|
+
Start method.
|
|
106
|
+
|
|
107
|
+
#### Parameters
|
|
108
|
+
|
|
109
|
+
##### nodeLoggingComponentType?
|
|
110
|
+
|
|
111
|
+
`string`
|
|
112
|
+
|
|
113
|
+
the logging component type of such a node.
|
|
114
|
+
|
|
115
|
+
#### Returns
|
|
116
|
+
|
|
117
|
+
`Promise`\<`void`\>
|
|
118
|
+
|
|
119
|
+
#### Implementation of
|
|
120
|
+
|
|
121
|
+
`IDataspaceApp.start`
|
|
122
|
+
|
|
123
|
+
***
|
|
124
|
+
|
|
125
|
+
### activitiesHandled()
|
|
126
|
+
|
|
127
|
+
> **activitiesHandled**(): `IActivityQuery`[]
|
|
128
|
+
|
|
129
|
+
The activities handled by the App.
|
|
130
|
+
|
|
131
|
+
#### Returns
|
|
132
|
+
|
|
133
|
+
`IActivityQuery`[]
|
|
134
|
+
|
|
135
|
+
The activities handled by the App.
|
|
136
|
+
|
|
137
|
+
#### Implementation of
|
|
138
|
+
|
|
139
|
+
`IDataspaceApp.activitiesHandled`
|
|
140
|
+
|
|
141
|
+
***
|
|
142
|
+
|
|
143
|
+
### handleActivity()
|
|
144
|
+
|
|
145
|
+
> **handleActivity**\<`T`\>(`activity`): `Promise`\<`T`\>
|
|
146
|
+
|
|
147
|
+
Handle Activity.
|
|
148
|
+
|
|
149
|
+
#### Type Parameters
|
|
150
|
+
|
|
151
|
+
##### T
|
|
152
|
+
|
|
153
|
+
`T`
|
|
154
|
+
|
|
155
|
+
#### Parameters
|
|
156
|
+
|
|
157
|
+
##### activity
|
|
158
|
+
|
|
159
|
+
`IActivityStreamsActivity`
|
|
160
|
+
|
|
161
|
+
Activity
|
|
162
|
+
|
|
163
|
+
#### Returns
|
|
164
|
+
|
|
165
|
+
`Promise`\<`T`\>
|
|
166
|
+
|
|
167
|
+
Activity processing result
|
|
168
|
+
|
|
169
|
+
#### Implementation of
|
|
170
|
+
|
|
171
|
+
`IDataspaceApp.handleActivity`
|
|
172
|
+
|
|
173
|
+
***
|
|
174
|
+
|
|
175
|
+
### handleDataRequest()
|
|
176
|
+
|
|
177
|
+
> **handleDataRequest**(`dataRequest`, `cursor?`, `limit?`): `Promise`\<\{ `data`: `IJsonLdDocument`; `cursor?`: `string`; \}\>
|
|
178
|
+
|
|
179
|
+
Handles the Data Request.
|
|
180
|
+
|
|
181
|
+
#### Parameters
|
|
182
|
+
|
|
183
|
+
##### dataRequest
|
|
184
|
+
|
|
185
|
+
`IDataRequest`
|
|
186
|
+
|
|
187
|
+
The data request
|
|
188
|
+
|
|
189
|
+
##### cursor?
|
|
190
|
+
|
|
191
|
+
`string`
|
|
192
|
+
|
|
193
|
+
Cursor that points to the next item in the result set.
|
|
194
|
+
|
|
195
|
+
##### limit?
|
|
196
|
+
|
|
197
|
+
`number`
|
|
198
|
+
|
|
199
|
+
Maximum number of entries retrieved or to be retrieved.
|
|
200
|
+
|
|
201
|
+
#### Returns
|
|
202
|
+
|
|
203
|
+
`Promise`\<\{ `data`: `IJsonLdDocument`; `cursor?`: `string`; \}\>
|
|
204
|
+
|
|
205
|
+
the Data.
|
|
206
|
+
|
|
207
|
+
#### Implementation of
|
|
208
|
+
|
|
209
|
+
`IDataspaceApp.handleDataRequest`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Function: extensionInitialise()
|
|
2
|
+
|
|
3
|
+
> **extensionInitialise**(`envVars`, `nodeEngineConfig`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Initialise the extension.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### envVars
|
|
10
|
+
|
|
11
|
+
The environment variables for the node.
|
|
12
|
+
|
|
13
|
+
### nodeEngineConfig
|
|
14
|
+
|
|
15
|
+
`IEngineCoreConfig`
|
|
16
|
+
|
|
17
|
+
The node engine config.
|
|
18
|
+
|
|
19
|
+
## Returns
|
|
20
|
+
|
|
21
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Function: extensionInitialiseEngine()
|
|
2
|
+
|
|
3
|
+
> **extensionInitialiseEngine**(`engineCore`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Initialise the engine for the extension.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### engineCore
|
|
10
|
+
|
|
11
|
+
`IEngineCore`
|
|
12
|
+
|
|
13
|
+
The engine core instance.
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Function: extensionInitialiseEngineServer()
|
|
2
|
+
|
|
3
|
+
> **extensionInitialiseEngineServer**(`engineCore`, `engineServer`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Initialise the engine server for the extension.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### engineCore
|
|
10
|
+
|
|
11
|
+
`IEngineCore`
|
|
12
|
+
|
|
13
|
+
The engine core instance.
|
|
14
|
+
|
|
15
|
+
### engineServer
|
|
16
|
+
|
|
17
|
+
`IEngineServer`
|
|
18
|
+
|
|
19
|
+
The engine server instance.
|
|
20
|
+
|
|
21
|
+
## Returns
|
|
22
|
+
|
|
23
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Function: generateRestRoutes()
|
|
2
|
+
|
|
3
|
+
> **generateRestRoutes**(`baseRouteName`, `componentName`): `IRestRoute`\<`any`, `any`\>[]
|
|
4
|
+
|
|
5
|
+
Generate the rest routes for the component.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### baseRouteName
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
The base route name.
|
|
14
|
+
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The component name.
|
|
20
|
+
|
|
21
|
+
## Returns
|
|
22
|
+
|
|
23
|
+
`IRestRoute`\<`any`, `any`\>[]
|
|
24
|
+
|
|
25
|
+
The rest routes.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Function: testAppInitialiser()
|
|
2
|
+
|
|
3
|
+
> **testAppInitialiser**(`engineCore`, `context`, `instanceConfig`): `EngineTypeInitialiserReturn`\<\{ `type`: `"service"`; `options`: [`ITestAppConstructorOptions`](../interfaces/ITestAppConstructorOptions.md); \}, `Factory`\<`IDataspaceApp`\>\>
|
|
4
|
+
|
|
5
|
+
Test Dataspace Data Plane App initializer.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### engineCore
|
|
10
|
+
|
|
11
|
+
`IEngineCore`\<`IEngineConfig`\>
|
|
12
|
+
|
|
13
|
+
The engine core.
|
|
14
|
+
|
|
15
|
+
### context
|
|
16
|
+
|
|
17
|
+
`IEngineCoreContext`
|
|
18
|
+
|
|
19
|
+
The context for the engine.
|
|
20
|
+
|
|
21
|
+
### instanceConfig
|
|
22
|
+
|
|
23
|
+
The instance config.
|
|
24
|
+
|
|
25
|
+
#### type
|
|
26
|
+
|
|
27
|
+
`"service"`
|
|
28
|
+
|
|
29
|
+
The instance type.
|
|
30
|
+
|
|
31
|
+
#### options
|
|
32
|
+
|
|
33
|
+
[`ITestAppConstructorOptions`](../interfaces/ITestAppConstructorOptions.md)
|
|
34
|
+
|
|
35
|
+
The instance config options.
|
|
36
|
+
|
|
37
|
+
## Returns
|
|
38
|
+
|
|
39
|
+
`EngineTypeInitialiserReturn`\<\{ `type`: `"service"`; `options`: [`ITestAppConstructorOptions`](../interfaces/ITestAppConstructorOptions.md); \}, `Factory`\<`IDataspaceApp`\>\>
|
|
40
|
+
|
|
41
|
+
The instance created and the factory for it.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @twin.org/dataspace-test-app
|
|
2
|
+
|
|
3
|
+
## Classes
|
|
4
|
+
|
|
5
|
+
- [TestDataspaceDataPlaneApp](classes/TestDataspaceDataPlaneApp.md)
|
|
6
|
+
|
|
7
|
+
## Interfaces
|
|
8
|
+
|
|
9
|
+
- [ITestAppConstructorOptions](interfaces/ITestAppConstructorOptions.md)
|
|
10
|
+
|
|
11
|
+
## Functions
|
|
12
|
+
|
|
13
|
+
- [extensionInitialise](functions/extensionInitialise.md)
|
|
14
|
+
- [extensionInitialiseEngine](functions/extensionInitialiseEngine.md)
|
|
15
|
+
- [extensionInitialiseEngineServer](functions/extensionInitialiseEngineServer.md)
|
|
16
|
+
- [testAppInitialiser](functions/testAppInitialiser.md)
|
|
17
|
+
- [generateRestRoutes](functions/generateRestRoutes.md)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Interface: ITestAppConstructorOptions
|
|
2
|
+
|
|
3
|
+
Test App Constructor options.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### loggingComponentType?
|
|
8
|
+
|
|
9
|
+
> `optional` **loggingComponentType**: `string`
|
|
10
|
+
|
|
11
|
+
Logging component type.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
logging
|
|
17
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@twin.org/dataspace-test-app",
|
|
3
|
+
"version": "0.0.3-next.15",
|
|
4
|
+
"description": "Dataspace Test App",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/twinfoundation/dataspace.git",
|
|
8
|
+
"directory": "packages/dataspace-test-app"
|
|
9
|
+
},
|
|
10
|
+
"author": "jose.cantera@iota.org",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20.0.0"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@twin.org/api-models": "next",
|
|
18
|
+
"@twin.org/context": "next",
|
|
19
|
+
"@twin.org/core": "next",
|
|
20
|
+
"@twin.org/data-core": "next",
|
|
21
|
+
"@twin.org/dataspace-models": "0.0.3-next.15",
|
|
22
|
+
"@twin.org/engine-models": "next",
|
|
23
|
+
"@twin.org/engine-types": "next",
|
|
24
|
+
"@twin.org/logging-models": "next",
|
|
25
|
+
"@twin.org/nameof": "next",
|
|
26
|
+
"@twin.org/standards-dataspace-protocol": "next",
|
|
27
|
+
"@twin.org/standards-dublin-core": "next",
|
|
28
|
+
"@twin.org/standards-w3c-activity-streams": "next"
|
|
29
|
+
},
|
|
30
|
+
"main": "./dist/es/index.js",
|
|
31
|
+
"types": "./dist/types/index.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/types/index.d.ts",
|
|
35
|
+
"import": "./dist/es/index.js",
|
|
36
|
+
"default": "./dist/es/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./locales/*.json": "./locales/*.json"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist/es",
|
|
42
|
+
"dist/types",
|
|
43
|
+
"locales",
|
|
44
|
+
"docs"
|
|
45
|
+
],
|
|
46
|
+
"keywords": [
|
|
47
|
+
"twin",
|
|
48
|
+
"trade",
|
|
49
|
+
"iota",
|
|
50
|
+
"framework",
|
|
51
|
+
"blockchain",
|
|
52
|
+
"dataspace",
|
|
53
|
+
"adapter",
|
|
54
|
+
"integration"
|
|
55
|
+
],
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "git+https://github.com/twinfoundation/dataspace/issues"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://twindev.org"
|
|
60
|
+
}
|