basyx-typescript-sdk 2.3.0 → 2.3.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.
@@ -10,6 +10,13 @@ function isResponseErrorLike(err) {
10
10
  function isRequiredErrorLike(err) {
11
11
  return err instanceof RequiredError || err?.name === 'RequiredError';
12
12
  }
13
+ /**
14
+ * Returns the current time as a UTC date-time string matching the timestamp
15
+ * pattern of the AAS API Message schema.
16
+ */
17
+ function currentTimestamp() {
18
+ return new Date().toISOString();
19
+ }
13
20
  /**
14
21
  * Processes errors from API calls and standardizes them to a Result object
15
22
  * with a consistent messages array following the API spec guidelines.
@@ -24,8 +31,7 @@ export async function handleApiError(err) {
24
31
  if (errorAny?.messages && Array.isArray(errorAny.messages)) {
25
32
  return { messages: errorAny.messages };
26
33
  }
27
- // Get current timestamp with millisecond precision as a string
28
- const timestamp = (new Date().getTime() / 1000).toString();
34
+ const timestamp = currentTimestamp();
29
35
  let message = {
30
36
  code: '500',
31
37
  messageType: 'Exception',
@@ -89,8 +95,7 @@ export async function handleApiError(err) {
89
95
  catch (handlerError) {
90
96
  // If our error handler throws an error, capture that and return a fallback error
91
97
  console.error('Error in error handler:', handlerError);
92
- // Get current timestamp with millisecond precision as a string for the fallback error
93
- const timestamp = (new Date().getTime() / 1000).toString();
98
+ const timestamp = currentTimestamp();
94
99
  return {
95
100
  messages: [
96
101
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "basyx-typescript-sdk",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "BaSyx TypeScript SDK for developing applications and components for the Asset Administration Shell (AAS)",
5
5
  "main": "bundle/index.cjs",
6
6
  "module": "bundle/index.mjs",