@dnv-plant/typescriptpws 1.0.76 → 1.0.77
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/index.ts +2 -2
- package/package.json +1 -1
- package/src/calculations/applicationTools.ts +2 -2
- package/src/calculations/discharge.ts +2 -2
- package/src/calculations/dispersion.ts +2 -2
- package/src/calculations/dispersionView.ts +2 -2
- package/src/calculations/fireball.ts +2 -2
- package/src/calculations/jetFire.ts +2 -2
- package/src/calculations/lateExplosion.ts +2 -2
- package/src/calculations/linkedRunners.ts +2 -2
- package/src/calculations/poolFire.ts +2 -2
- package/src/calculations/properties.ts +2 -2
- package/src/calculations/radiation.ts +2 -2
- package/src/calculations/standalones.ts +2 -2
- package/src/calculations/toxics.ts +2 -2
- package/src/calculations/utilities.ts +2 -2
- package/src/constants.ts +2 -2
- package/src/entities.ts +2 -2
- package/src/entity-schemas.ts +2 -2
- package/src/enums.ts +2 -2
- package/src/materials.ts +2 -2
- package/src/utilities.ts +42 -16
package/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:48
|
|
5
5
|
* Template: templates/typescriptpws/index.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:48
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:48
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:48
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:48
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:48
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:48
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:48
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:48
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:48
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:48
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:48
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:48
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:48
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:48
|
|
5
5
|
* Template: templates/typescriptpws/calculations.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
package/src/constants.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:45
|
|
5
5
|
* Template: templates/typescriptpws/constants.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
package/src/entities.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:46
|
|
5
5
|
* Template: templates/typescriptpws/entities.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
package/src/entity-schemas.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:47
|
|
5
5
|
* Template: templates/typescriptpws/entityschemas.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
package/src/enums.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:46
|
|
5
5
|
* Template: templates/typescriptpws/enums.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
package/src/materials.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:45
|
|
5
5
|
* Template: templates/typescriptpws/materials.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
package/src/utilities.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/***********************************************************************
|
|
2
2
|
* This file has been auto-generated by a code generation tool.
|
|
3
|
-
* Version: 1.0.
|
|
4
|
-
* Date/time:
|
|
3
|
+
* Version: 1.0.77
|
|
4
|
+
* Date/time: 18 Jun 2025 15:16:44
|
|
5
5
|
* Template: templates/typescriptpws/utilities.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -12,9 +12,12 @@ import { REST_API_URI, PWS_CLIENT_ID, REST_API_VERSION } from "./constants";
|
|
|
12
12
|
|
|
13
13
|
const accessTokenKey = "__pwsAccessToken";
|
|
14
14
|
const usedInDnvKey = "__pwsUsedInDnvKey";
|
|
15
|
+
const clientAliasKey = "__pwsClientAliasId";
|
|
15
16
|
|
|
16
|
-
(globalThis as any)[accessTokenKey] = (globalThis as any)[accessTokenKey]
|
|
17
|
-
(globalThis as any)[usedInDnvKey] = (globalThis as any)[usedInDnvKey]
|
|
17
|
+
(globalThis as any)[accessTokenKey] = (globalThis as any)[accessTokenKey] ?? "";
|
|
18
|
+
(globalThis as any)[usedInDnvKey] = (globalThis as any)[usedInDnvKey] ?? false;
|
|
19
|
+
(globalThis as any)[clientAliasKey] =
|
|
20
|
+
(globalThis as any)[clientAliasKey] ?? PWS_CLIENT_ID;
|
|
18
21
|
|
|
19
22
|
export function getAccessToken(): string {
|
|
20
23
|
return (globalThis as any)[accessTokenKey];
|
|
@@ -34,6 +37,16 @@ export function setUsedInDnvProduct(value: boolean) {
|
|
|
34
37
|
(globalThis as any)[usedInDnvKey] = value;
|
|
35
38
|
}
|
|
36
39
|
|
|
40
|
+
// Get client alias ID
|
|
41
|
+
export function getClientAliasId() {
|
|
42
|
+
return (globalThis as any)[clientAliasKey];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Set client alias ID
|
|
46
|
+
export function setClientAliasId(clientAliasId: string) {
|
|
47
|
+
(globalThis as any)[clientAliasKey] = clientAliasId;
|
|
48
|
+
}
|
|
49
|
+
|
|
37
50
|
// Get headers for requests
|
|
38
51
|
function getHeaders(accessToken: string) {
|
|
39
52
|
return {
|
|
@@ -43,7 +56,10 @@ function getHeaders(accessToken: string) {
|
|
|
43
56
|
}
|
|
44
57
|
|
|
45
58
|
// Post JSON to URL and time the call
|
|
46
|
-
export async function postRequest(
|
|
59
|
+
export async function postRequest(
|
|
60
|
+
url: string,
|
|
61
|
+
data: string
|
|
62
|
+
): Promise<AxiosResponse> {
|
|
47
63
|
try {
|
|
48
64
|
const accessToken = getAccessToken();
|
|
49
65
|
|
|
@@ -54,7 +70,9 @@ export async function postRequest(url: string, data: string): Promise<AxiosRespo
|
|
|
54
70
|
const [, expiryDate, hasExpired] = getAccessTokenInfo(accessToken);
|
|
55
71
|
|
|
56
72
|
if (!hasExpired) {
|
|
57
|
-
const response = await axios.post(url, data, {
|
|
73
|
+
const response = await axios.post(url, data, {
|
|
74
|
+
headers: getHeaders(accessToken),
|
|
75
|
+
});
|
|
58
76
|
return response;
|
|
59
77
|
} else {
|
|
60
78
|
console.log(`Your access token has expired: ${expiryDate}`);
|
|
@@ -62,7 +80,10 @@ export async function postRequest(url: string, data: string): Promise<AxiosRespo
|
|
|
62
80
|
}
|
|
63
81
|
} catch (error: unknown) {
|
|
64
82
|
if (axios.isAxiosError(error)) {
|
|
65
|
-
console.error(
|
|
83
|
+
console.error(
|
|
84
|
+
"Error during HTTP request:",
|
|
85
|
+
error.response?.data || error.message
|
|
86
|
+
);
|
|
66
87
|
throw error;
|
|
67
88
|
} else {
|
|
68
89
|
console.error("Unexpected error:", error);
|
|
@@ -83,7 +104,9 @@ export async function putRequest(url: string, data: string) {
|
|
|
83
104
|
const [, expiryDate, hasExpired] = getAccessTokenInfo(accessToken);
|
|
84
105
|
|
|
85
106
|
if (!hasExpired) {
|
|
86
|
-
const response = await axios.put(url, data, {
|
|
107
|
+
const response = await axios.put(url, data, {
|
|
108
|
+
headers: getHeaders(accessToken),
|
|
109
|
+
});
|
|
87
110
|
return response;
|
|
88
111
|
} else {
|
|
89
112
|
console.log(`Your access token has expired: ${expiryDate}`);
|
|
@@ -91,7 +114,10 @@ export async function putRequest(url: string, data: string) {
|
|
|
91
114
|
}
|
|
92
115
|
} catch (error: unknown) {
|
|
93
116
|
if (axios.isAxiosError(error)) {
|
|
94
|
-
console.error(
|
|
117
|
+
console.error(
|
|
118
|
+
"Error during HTTP request:",
|
|
119
|
+
error.response?.data || error.message
|
|
120
|
+
);
|
|
95
121
|
throw error;
|
|
96
122
|
} else {
|
|
97
123
|
console.error("Unexpected error:", error);
|
|
@@ -112,7 +138,9 @@ export async function getRequest(url: string) {
|
|
|
112
138
|
const [, expiryDate, hasExpired] = getAccessTokenInfo(accessToken);
|
|
113
139
|
|
|
114
140
|
if (!hasExpired) {
|
|
115
|
-
const response = await axios.get(url, {
|
|
141
|
+
const response = await axios.get(url, {
|
|
142
|
+
headers: getHeaders(accessToken),
|
|
143
|
+
});
|
|
116
144
|
return response;
|
|
117
145
|
} else {
|
|
118
146
|
console.log(`Your access token has expired: ${expiryDate}`);
|
|
@@ -120,7 +148,10 @@ export async function getRequest(url: string) {
|
|
|
120
148
|
}
|
|
121
149
|
} catch (error: unknown) {
|
|
122
150
|
if (axios.isAxiosError(error)) {
|
|
123
|
-
console.error(
|
|
151
|
+
console.error(
|
|
152
|
+
"Error during HTTP request:",
|
|
153
|
+
error.response?.data || error.message
|
|
154
|
+
);
|
|
124
155
|
throw error;
|
|
125
156
|
} else {
|
|
126
157
|
console.error("Unexpected error:", error);
|
|
@@ -189,11 +220,6 @@ export function getMaterialsApiTarget() {
|
|
|
189
220
|
return `${getApiRoot()}materials-storage/v${getApiVersion()}/`;
|
|
190
221
|
}
|
|
191
222
|
|
|
192
|
-
// Get client alias ID
|
|
193
|
-
export function getClientAliasId() {
|
|
194
|
-
return PWS_CLIENT_ID;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
223
|
// Convert snake_case to camelCase
|
|
198
224
|
export function convertSnakeCaseToCamelCase(snakeStr: string) {
|
|
199
225
|
return snakeStr.replace(/_./g, (s) => s.charAt(1).toUpperCase());
|