basyx-typescript-sdk 0.1.10 → 0.1.11
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/dist/clients/AasRepositoryClient.d.ts +158 -0
- package/dist/clients/AasRepositoryClient.js +400 -0
- package/dist/clients/index.d.ts +1 -0
- package/dist/clients/index.js +1 -0
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/index.js +3 -0
- package/dist/generated/schemas.gen.d.ts +2357 -0
- package/dist/generated/schemas.gen.js +2789 -0
- package/dist/generated/sdk.gen.d.ts +822 -0
- package/dist/generated/sdk.gen.js +2225 -0
- package/dist/generated/types.gen.d.ts +10829 -0
- package/dist/generated/types.gen.js +2 -0
- package/dist/index.js +1 -0
- package/dist/lib/convertAasTypes.d.ts +50 -0
- package/dist/lib/convertAasTypes.js +113 -0
- package/dist/lib/createAasRepoClient.d.ts +9 -0
- package/dist/lib/createAasRepoClient.js +15 -0
- package/dist/models/aas-repository.d.ts +10 -0
- package/dist/models/aas-repository.js +1 -0
- package/package.json +2 -2
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './clients';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { AssetAdministrationShell as CoreAssetAdministrationShell, AssetInformation as CoreAssetInformation, Reference as CoreReference } from '@aas-core-works/aas-core3.0-typescript/types';
|
|
2
|
+
import { AssetAdministrationShell as ApiAssetAdministrationShell, AssetInformation as ApiAssetInformation, Reference as ApiReference } from '../generated/types.gen';
|
|
3
|
+
/**
|
|
4
|
+
* Convert an API AssetAdministrationShell to a Core Works AssetAdministrationShell
|
|
5
|
+
*
|
|
6
|
+
* @function convertApiAasToCoreAas
|
|
7
|
+
* @param {ApiAssetAdministrationShell} aas - The API AssetAdministrationShell to convert
|
|
8
|
+
* @returns {CoreAssetAdministrationShell} The Core Works AssetAdministrationShell
|
|
9
|
+
*/
|
|
10
|
+
export declare function convertApiAasToCoreAas(aas: ApiAssetAdministrationShell): CoreAssetAdministrationShell;
|
|
11
|
+
/**
|
|
12
|
+
* Convert a Core Works AssetAdministrationShell to an API AssetAdministrationShell
|
|
13
|
+
*
|
|
14
|
+
* @function convertCoreAasToApiAas
|
|
15
|
+
* @param {CoreAssetAdministrationShell} aas - The Core Works AssetAdministrationShell to convert
|
|
16
|
+
* @returns {ApiAssetAdministrationShell} The API AssetAdministrationShell
|
|
17
|
+
*/
|
|
18
|
+
export declare function convertCoreAasToApiAas(aas: CoreAssetAdministrationShell): ApiAssetAdministrationShell;
|
|
19
|
+
/**
|
|
20
|
+
* Convert an API AssetInformation to a Core Works AssetInformation
|
|
21
|
+
*
|
|
22
|
+
* @function convertApiAssetInformationToCoreAssetInformation
|
|
23
|
+
* @param {ApiAssetInformation} assetInformation - The API AssetInformation to convert
|
|
24
|
+
* @returns {CoreAssetInformation} The Core Works AssetInformation
|
|
25
|
+
*/
|
|
26
|
+
export declare function convertApiAssetInformationToCoreAssetInformation(assetInformation: ApiAssetInformation): CoreAssetInformation;
|
|
27
|
+
/**
|
|
28
|
+
* Convert a Core Works AssetInformation to an API AssetInformation
|
|
29
|
+
*
|
|
30
|
+
* @function convertCoreAssetInformationToApiAssetInformation
|
|
31
|
+
* @param {CoreAssetInformation} assetInformation - The Core Works AssetInformation to convert
|
|
32
|
+
* @returns {ApiAssetInformation} The API AssetInformation
|
|
33
|
+
*/
|
|
34
|
+
export declare function convertCoreAssetInformationToApiAssetInformation(assetInformation: CoreAssetInformation): ApiAssetInformation;
|
|
35
|
+
/**
|
|
36
|
+
* Convert an API Reference to a Core Works Reference
|
|
37
|
+
*
|
|
38
|
+
* @function convertApiReferenceToCoreReference
|
|
39
|
+
* @param {ApiReference} reference - The API Reference to convert
|
|
40
|
+
* @returns {CoreReference} The Core Works Reference
|
|
41
|
+
*/
|
|
42
|
+
export declare function convertApiReferenceToCoreReference(reference: ApiReference): CoreReference;
|
|
43
|
+
/**
|
|
44
|
+
* Convert a Core Works Reference to an API Reference
|
|
45
|
+
*
|
|
46
|
+
* @function convertCoreReferenceToApiReference
|
|
47
|
+
* @param {CoreReference} reference - The Core Works Reference to convert
|
|
48
|
+
* @returns {ApiReference} The API Reference
|
|
49
|
+
*/
|
|
50
|
+
export declare function convertCoreReferenceToApiReference(reference: CoreReference): ApiReference;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsonization } from '@aas-core-works/aas-core3.0-typescript';
|
|
2
|
+
import { AssetAdministrationShell as CoreAssetAdministrationShell, AssetInformation as CoreAssetInformation, Reference as CoreReference, } from '@aas-core-works/aas-core3.0-typescript/types';
|
|
3
|
+
/**
|
|
4
|
+
* Convert an API AssetAdministrationShell to a Core Works AssetAdministrationShell
|
|
5
|
+
*
|
|
6
|
+
* @function convertApiAasToCoreAas
|
|
7
|
+
* @param {ApiAssetAdministrationShell} aas - The API AssetAdministrationShell to convert
|
|
8
|
+
* @returns {CoreAssetAdministrationShell} The Core Works AssetAdministrationShell
|
|
9
|
+
*/
|
|
10
|
+
export function convertApiAasToCoreAas(aas) {
|
|
11
|
+
// first stringify
|
|
12
|
+
let shell = JSON.stringify(aas);
|
|
13
|
+
// then parse
|
|
14
|
+
shell = JSON.parse(shell);
|
|
15
|
+
// then jsonize
|
|
16
|
+
const instanceOrError = jsonization.assetAdministrationShellFromJsonable(shell);
|
|
17
|
+
if (instanceOrError.error !== null) {
|
|
18
|
+
throw instanceOrError.error;
|
|
19
|
+
}
|
|
20
|
+
const instance = instanceOrError.mustValue();
|
|
21
|
+
// set the prototype
|
|
22
|
+
Object.setPrototypeOf(instance, CoreAssetAdministrationShell.prototype);
|
|
23
|
+
return instance;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Convert a Core Works AssetAdministrationShell to an API AssetAdministrationShell
|
|
27
|
+
*
|
|
28
|
+
* @function convertCoreAasToApiAas
|
|
29
|
+
* @param {CoreAssetAdministrationShell} aas - The Core Works AssetAdministrationShell to convert
|
|
30
|
+
* @returns {ApiAssetAdministrationShell} The API AssetAdministrationShell
|
|
31
|
+
*/
|
|
32
|
+
export function convertCoreAasToApiAas(aas) {
|
|
33
|
+
// first jsonize
|
|
34
|
+
const jsonableAas = jsonization.toJsonable(aas);
|
|
35
|
+
// then stringify
|
|
36
|
+
const shell = JSON.stringify(jsonableAas);
|
|
37
|
+
// then parse
|
|
38
|
+
return JSON.parse(shell);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Convert an API AssetInformation to a Core Works AssetInformation
|
|
42
|
+
*
|
|
43
|
+
* @function convertApiAssetInformationToCoreAssetInformation
|
|
44
|
+
* @param {ApiAssetInformation} assetInformation - The API AssetInformation to convert
|
|
45
|
+
* @returns {CoreAssetInformation} The Core Works AssetInformation
|
|
46
|
+
*/
|
|
47
|
+
export function convertApiAssetInformationToCoreAssetInformation(assetInformation) {
|
|
48
|
+
// first stringify
|
|
49
|
+
let asset = JSON.stringify(assetInformation);
|
|
50
|
+
// then parse
|
|
51
|
+
asset = JSON.parse(asset);
|
|
52
|
+
// then jsonize
|
|
53
|
+
const instanceOrError = jsonization.assetInformationFromJsonable(asset);
|
|
54
|
+
if (instanceOrError.error !== null) {
|
|
55
|
+
throw instanceOrError.error;
|
|
56
|
+
}
|
|
57
|
+
const instance = instanceOrError.mustValue();
|
|
58
|
+
// set the prototype
|
|
59
|
+
Object.setPrototypeOf(instance, CoreAssetInformation.prototype);
|
|
60
|
+
return instance;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Convert a Core Works AssetInformation to an API AssetInformation
|
|
64
|
+
*
|
|
65
|
+
* @function convertCoreAssetInformationToApiAssetInformation
|
|
66
|
+
* @param {CoreAssetInformation} assetInformation - The Core Works AssetInformation to convert
|
|
67
|
+
* @returns {ApiAssetInformation} The API AssetInformation
|
|
68
|
+
*/
|
|
69
|
+
export function convertCoreAssetInformationToApiAssetInformation(assetInformation) {
|
|
70
|
+
// first jsonize
|
|
71
|
+
const jsonableAsset = jsonization.toJsonable(assetInformation);
|
|
72
|
+
// then stringify
|
|
73
|
+
const asset = JSON.stringify(jsonableAsset);
|
|
74
|
+
// then parse
|
|
75
|
+
return JSON.parse(asset);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Convert an API Reference to a Core Works Reference
|
|
79
|
+
*
|
|
80
|
+
* @function convertApiReferenceToCoreReference
|
|
81
|
+
* @param {ApiReference} reference - The API Reference to convert
|
|
82
|
+
* @returns {CoreReference} The Core Works Reference
|
|
83
|
+
*/
|
|
84
|
+
export function convertApiReferenceToCoreReference(reference) {
|
|
85
|
+
// first stringify
|
|
86
|
+
let ref = JSON.stringify(reference);
|
|
87
|
+
// then parse
|
|
88
|
+
ref = JSON.parse(ref);
|
|
89
|
+
// then jsonize
|
|
90
|
+
const instanceOrError = jsonization.referenceFromJsonable(ref);
|
|
91
|
+
if (instanceOrError.error !== null) {
|
|
92
|
+
throw instanceOrError.error;
|
|
93
|
+
}
|
|
94
|
+
const instance = instanceOrError.mustValue();
|
|
95
|
+
// set the prototype
|
|
96
|
+
Object.setPrototypeOf(instance, CoreReference.prototype);
|
|
97
|
+
return instance;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Convert a Core Works Reference to an API Reference
|
|
101
|
+
*
|
|
102
|
+
* @function convertCoreReferenceToApiReference
|
|
103
|
+
* @param {CoreReference} reference - The Core Works Reference to convert
|
|
104
|
+
* @returns {ApiReference} The API Reference
|
|
105
|
+
*/
|
|
106
|
+
export function convertCoreReferenceToApiReference(reference) {
|
|
107
|
+
// first jsonize
|
|
108
|
+
const jsonableRef = jsonization.toJsonable(reference);
|
|
109
|
+
// then stringify
|
|
110
|
+
const ref = JSON.stringify(jsonableRef);
|
|
111
|
+
// then parse
|
|
112
|
+
return JSON.parse(ref);
|
|
113
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a custom client configuration
|
|
3
|
+
*
|
|
4
|
+
* @function createCustomClient
|
|
5
|
+
* @param baseURL The base URL of the API
|
|
6
|
+
* @param headers The headers to be included in the request
|
|
7
|
+
* @returns {Client} The custom client
|
|
8
|
+
*/
|
|
9
|
+
export declare function createCustomClient(baseURL: string, headers?: Headers): import("@hey-api/client-fetch").Client;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createClient } from '@hey-api/client-fetch';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a custom client configuration
|
|
4
|
+
*
|
|
5
|
+
* @function createCustomClient
|
|
6
|
+
* @param baseURL The base URL of the API
|
|
7
|
+
* @param headers The headers to be included in the request
|
|
8
|
+
* @returns {Client} The custom client
|
|
9
|
+
*/
|
|
10
|
+
export function createCustomClient(baseURL, headers = new Headers()) {
|
|
11
|
+
return createClient({
|
|
12
|
+
baseUrl: baseURL,
|
|
13
|
+
headers,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AssetAdministrationShell, Reference } from '@aas-core-works/aas-core3.0-typescript/types';
|
|
2
|
+
import type { PagedResultPagingMetadata } from '../generated/types.gen';
|
|
3
|
+
export interface GetAllAssetAdministrationShellsResponse {
|
|
4
|
+
pagedResult: PagedResultPagingMetadata | undefined;
|
|
5
|
+
result: AssetAdministrationShell[] | undefined;
|
|
6
|
+
}
|
|
7
|
+
export interface getAllSubmodelReferencesResponse {
|
|
8
|
+
pagedResult: PagedResultPagingMetadata | undefined;
|
|
9
|
+
result: Reference[] | undefined;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "basyx-typescript-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "BaSyx TypeScript SDK for developing applications and components for the Asset Administration Shell (AAS)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bundle/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"files": [
|
|
18
18
|
"bundle",
|
|
19
|
-
"dist
|
|
19
|
+
"dist",
|
|
20
20
|
"README.md",
|
|
21
21
|
"LICENSE"
|
|
22
22
|
],
|