basyx-typescript-sdk 0.0.1
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/LICENSE +21 -0
- package/README.md +44 -0
- package/dist/clients/AasRepositoryClient.d.ts +158 -0
- package/dist/clients/AasRepositoryClient.js +474 -0
- package/dist/clients/index.d.ts +1 -0
- package/dist/clients/index.js +5 -0
- package/dist/generated/aas-repository/index.d.ts +2 -0
- package/dist/generated/aas-repository/index.js +19 -0
- package/dist/generated/aas-repository/sdk.gen.d.ts +210 -0
- package/dist/generated/aas-repository/sdk.gen.js +430 -0
- package/dist/generated/aas-repository/types.gen.d.ts +3380 -0
- package/dist/generated/aas-repository/types.gen.js +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -0
- package/dist/lib/convertAasTypes.d.ts +50 -0
- package/dist/lib/convertAasTypes.js +111 -0
- package/dist/lib/createAasRepoClient.d.ts +9 -0
- package/dist/lib/createAasRepoClient.js +18 -0
- package/dist/models/aas-repository.d.ts +10 -0
- package/dist/models/aas-repository.js +2 -0
- package/package.json +47 -0
- package/src/clients/AasRepositoryClient.ts +501 -0
- package/src/clients/index.ts +1 -0
- package/src/generated/aas-repository/index.ts +3 -0
- package/src/generated/aas-repository/sdk.gen.ts +620 -0
- package/src/generated/aas-repository/types.gen.ts +3786 -0
- package/src/index.ts +1 -0
- package/src/lib/convertAasTypes.ts +123 -0
- package/src/lib/createAasRepoClient.ts +16 -0
- package/src/models/aas-repository.ts +12 -0
- package/src/tests/clients/AasRepositoryClient.test.ts +270 -0
- package/src/tests/lib/convertAasTypes.test.ts +201 -0
- package/src/tests/lib/createAasRepoClient.test.ts +55 -0
- package/src/tests/models/.gitkeep +0 -0
- package/src/tests/utils/.gitkeep +0 -0
- package/src/utils/.gitkeep +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2025 the Eclipse BaSyx Authors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# basyx-typescript-sdk
|
|
2
|
+
|
|
3
|
+
BaSyx TypeScript SDK for developing applications and components for the Asset Administration Shell (AAS)
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
Clients for the AAS API components:
|
|
8
|
+
- AAS Repository
|
|
9
|
+
- Submodel Repository (coming soon)
|
|
10
|
+
- Concept Description Repository (coming soon)
|
|
11
|
+
- AAS Registry (coming soon)
|
|
12
|
+
- Submodel Registry (coming soon)
|
|
13
|
+
- AAS Discovery Service (coming soon)
|
|
14
|
+
- AASX File Service (coming soon)
|
|
15
|
+
|
|
16
|
+
Utility functions for working with AAS data:
|
|
17
|
+
- Coming soon
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install basyx-typescript-sdk
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { AasRepositoryClient } from 'basyx-typescript-sdk';
|
|
29
|
+
|
|
30
|
+
async function getAllShells() {
|
|
31
|
+
const baseURL = 'http://localhost:8081';
|
|
32
|
+
const client = new AasRepositoryClient();
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
const response = await client.getAllAssetAdministrationShells(baseURL);
|
|
36
|
+
console.log('Asset Administration Shells fetched successfully:', response);
|
|
37
|
+
// You can now use the response as needed
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error('Error fetching Asset Administration Shells:', error);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
getAllShells();
|
|
44
|
+
```
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { AssetAdministrationShell, AssetInformation, Reference } from '@aas-core-works/aas-core3.0-typescript/types';
|
|
2
|
+
import { AssetinformationThumbnailBody } from '@/generated/aas-repository/types.gen';
|
|
3
|
+
import { GetAllAssetAdministrationShellsResponse, getAllSubmodelReferencesResponse } from '@/models/aas-repository';
|
|
4
|
+
export declare class AasRepositoryClient {
|
|
5
|
+
/**
|
|
6
|
+
* Returns all Asset Administration Shells
|
|
7
|
+
*
|
|
8
|
+
* @async
|
|
9
|
+
* @function getAllAssetAdministrationShells
|
|
10
|
+
* @param baseURL The API base URL
|
|
11
|
+
* @param headers Request headers
|
|
12
|
+
* @param assetIds A list of specific Asset identifiers. Every single value asset identifier is a base64-url-encoded
|
|
13
|
+
* @param idShort The Asset Administration Shell’s IdShort
|
|
14
|
+
* @param limit The maximum number of elements in the response array
|
|
15
|
+
* @param cursor A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
|
|
16
|
+
* @returns {Promise<GetAllAssetAdministrationShellsResponse>} Requested Asset Administration Shells
|
|
17
|
+
*/
|
|
18
|
+
getAllAssetAdministrationShells(baseURL: string, headers?: Headers, assetIds?: string[], idShort?: string, limit?: number, cursor?: string): Promise<GetAllAssetAdministrationShellsResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new Asset Administration Shell
|
|
21
|
+
*
|
|
22
|
+
* @async
|
|
23
|
+
* @function postAssetAdministrationShell
|
|
24
|
+
* @param baseURL The API base URL
|
|
25
|
+
* @param assetAdministrationShell Asset Administration Shell object
|
|
26
|
+
* @param headers Request headers
|
|
27
|
+
* @returns {Promise<AssetAdministrationShell>} Asset Administration Shell created successfully
|
|
28
|
+
*/
|
|
29
|
+
postAssetAdministrationShell(baseURL: string, assetAdministrationShell: AssetAdministrationShell, headers?: Headers): Promise<AssetAdministrationShell>;
|
|
30
|
+
/**
|
|
31
|
+
* Deletes an Asset Administration Shell
|
|
32
|
+
*
|
|
33
|
+
* @async
|
|
34
|
+
* @function deleteAssetAdministrationShellById
|
|
35
|
+
* @param baseURL The API base URL
|
|
36
|
+
* @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
37
|
+
* @param headers Request headers
|
|
38
|
+
* @returns {Promise<void>} Asset Administration Shell deleted successfully
|
|
39
|
+
*/
|
|
40
|
+
deleteAssetAdministrationShellById(baseURL: string, aasIdentifier: string, headers?: Headers): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Returns a specific Asset Administration Shell
|
|
43
|
+
*
|
|
44
|
+
* @async
|
|
45
|
+
* @function getAssetAdministrationShellById
|
|
46
|
+
* @param baseURL The API base URL
|
|
47
|
+
* @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
48
|
+
* @param headers Request headers
|
|
49
|
+
* @returns {Promise<AssetAdministrationShell>} Requested Asset Administration Shell
|
|
50
|
+
*/
|
|
51
|
+
getAssetAdministrationShellById(baseURL: string, aasIdentifier: string, headers?: Headers): Promise<AssetAdministrationShell>;
|
|
52
|
+
/**
|
|
53
|
+
* Updates an existing Asset Administration Shell
|
|
54
|
+
*
|
|
55
|
+
* @async
|
|
56
|
+
* @function putAssetAdministrationShellById
|
|
57
|
+
* @param baseURL The API base URL
|
|
58
|
+
* @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
59
|
+
* @param assetAdministrationShell Asset Administration Shell object
|
|
60
|
+
* @param headers Request headers
|
|
61
|
+
* @returns {Promise<void>} Asset Administration Shell updated successfully
|
|
62
|
+
*/
|
|
63
|
+
putAssetAdministrationShellById(baseURL: string, aasIdentifier: string, assetAdministrationShell: AssetAdministrationShell, headers?: Headers): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Returns the Asset Information
|
|
66
|
+
*
|
|
67
|
+
* @async
|
|
68
|
+
* @function getAssetInformation
|
|
69
|
+
* @param baseURL The API base URL
|
|
70
|
+
* @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
71
|
+
* @param headers Request headers
|
|
72
|
+
* @returns {Promise<AssetInformation>} Requested Asset Information
|
|
73
|
+
*/
|
|
74
|
+
getAssetInformation(baseURL: string, aasIdentifier: string, headers?: Headers): Promise<AssetInformation>;
|
|
75
|
+
/**
|
|
76
|
+
* Updates the Asset Information
|
|
77
|
+
*
|
|
78
|
+
* @async
|
|
79
|
+
* @function putAssetInformation
|
|
80
|
+
* @param baseURL The API base URL
|
|
81
|
+
* @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
82
|
+
* @param assetInformation Asset Information object
|
|
83
|
+
* @param headers Request headers
|
|
84
|
+
* @returns {Promise<void>} Asset Information updated successfully
|
|
85
|
+
*/
|
|
86
|
+
putAssetInformation(baseURL: string, aasIdentifier: string, assetInformation: AssetInformation, headers?: Headers): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Deletes the Thumbnail
|
|
89
|
+
*
|
|
90
|
+
* @async
|
|
91
|
+
* @function deleteThumbnail
|
|
92
|
+
* @param baseURL The API base URL
|
|
93
|
+
* @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
94
|
+
* @param headers Request headers
|
|
95
|
+
* @returns {Promise<void>} Thumbnail deletion successful
|
|
96
|
+
*/
|
|
97
|
+
deleteThumbnail(baseURL: string, aasIdentifier: string, headers?: Headers): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Returns the Thumbnail
|
|
100
|
+
*
|
|
101
|
+
* @async
|
|
102
|
+
* @function getThumbnail
|
|
103
|
+
* @param baseURL The API base URL
|
|
104
|
+
* @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
105
|
+
* @param headers Request headers
|
|
106
|
+
* @returns {Promise<Blob | File>} The thumbnail of the Asset Information.
|
|
107
|
+
*/
|
|
108
|
+
getThumbnail(baseURL: string, aasIdentifier: string, headers?: Headers): Promise<Blob | File>;
|
|
109
|
+
/**
|
|
110
|
+
* Updates the Thumbnail
|
|
111
|
+
*
|
|
112
|
+
* @async
|
|
113
|
+
* @function putThumbnail
|
|
114
|
+
* @param baseURL The API base URL
|
|
115
|
+
* @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
116
|
+
* @param thumbnail Thumbnail to upload
|
|
117
|
+
* @param headers Request headers
|
|
118
|
+
* @returns {Promise<void>} Thumbnail updated successfully
|
|
119
|
+
*/
|
|
120
|
+
putThumbnail(baseURL: string, aasIdentifier: string, thumbnail: AssetinformationThumbnailBody, headers?: Headers): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Returns all submodel references
|
|
123
|
+
*
|
|
124
|
+
* @async
|
|
125
|
+
* @function getAllSubmodelReferences
|
|
126
|
+
* @param baseURL The API base URL
|
|
127
|
+
* @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
128
|
+
* @param limit The maximum number of elements in the response array
|
|
129
|
+
* @param cursor A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
|
|
130
|
+
* @param headers Request headers
|
|
131
|
+
* @returns {Promise<getAllSubmodelReferencesResponse>} Requested submodel references
|
|
132
|
+
*/
|
|
133
|
+
getAllSubmodelReferences(baseURL: string, aasIdentifier: string, limit?: number, cursor?: string, headers?: Headers): Promise<getAllSubmodelReferencesResponse>;
|
|
134
|
+
/**
|
|
135
|
+
* Creates a submodel reference at the Asset Administration Shell
|
|
136
|
+
*
|
|
137
|
+
* @async
|
|
138
|
+
* @function postSubmodelReference
|
|
139
|
+
* @param baseURL The API base URL
|
|
140
|
+
* @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
141
|
+
* @param submodelReference Reference to the Submodel
|
|
142
|
+
* @param headers Request headers
|
|
143
|
+
* @returns {promise<Reference>} Submodel reference created successfully
|
|
144
|
+
*/
|
|
145
|
+
postSubmodelReference(baseURL: string, aasIdentifier: string, submodelReference: Reference, headers?: Headers): Promise<Reference>;
|
|
146
|
+
/**
|
|
147
|
+
* Deletes the submodel reference from the Asset Administration Shell. Does not delete the submodel itself!
|
|
148
|
+
*
|
|
149
|
+
* @async
|
|
150
|
+
* @function deleteSubmodelReferenceById
|
|
151
|
+
* @param baseURL The API base URL
|
|
152
|
+
* @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
153
|
+
* @param submodelIdentifier The Submodel’s unique id (UTF8-BASE64-URL-encoded)
|
|
154
|
+
* @param headers Request headers
|
|
155
|
+
* @returns {Promise<void>} Submodel reference deleted successfully
|
|
156
|
+
*/
|
|
157
|
+
deleteSubmodelReferenceById(baseURL: string, aasIdentifier: string, submodelIdentifier: string, headers?: Headers): Promise<void>;
|
|
158
|
+
}
|