@dnv-plant/typescriptpws 1.0.26-alpha.1838115 → 1.0.27
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 +2 -2
- package/src/calculations.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 +13 -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.27
|
|
4
|
+
* Date/time: 19 Mar 2025 11:43:44
|
|
5
5
|
* Template: templates/typescriptpws/index.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dnv-plant/typescriptpws",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"description": "Integrate Phast models with our versatile APIs for enhanced customization and efficiency.",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/jsonwebtoken": "^9.0.8"
|
|
20
20
|
}
|
|
21
|
-
}
|
|
21
|
+
}
|
package/src/calculations.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.27
|
|
4
|
+
* Date/time: 19 Mar 2025 11:43:44
|
|
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.27
|
|
4
|
+
* Date/time: 19 Mar 2025 11:43:41
|
|
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.27
|
|
4
|
+
* Date/time: 19 Mar 2025 11:43:43
|
|
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.27
|
|
4
|
+
* Date/time: 19 Mar 2025 11:43:43
|
|
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.27
|
|
4
|
+
* Date/time: 19 Mar 2025 11:43:42
|
|
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.27
|
|
4
|
+
* Date/time: 19 Mar 2025 11:43:41
|
|
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.27
|
|
4
|
+
* Date/time: 19 Mar 2025 11:43:40
|
|
5
5
|
* Template: templates/typescriptpws/utilities.razor.
|
|
6
6
|
***********************************************************************/
|
|
7
7
|
|
|
@@ -10,6 +10,17 @@ import axios, { AxiosResponse } from "axios";
|
|
|
10
10
|
|
|
11
11
|
import { REST_API_URI, PWS_CLIENT_ID, REST_API_VERSION } from "./constants";
|
|
12
12
|
|
|
13
|
+
const globalKey = "__pwsAccessToken";
|
|
14
|
+
(globalThis as any)[globalKey] = (globalThis as any)[globalKey] || "";
|
|
15
|
+
|
|
16
|
+
export function getAccessToken(): string {
|
|
17
|
+
return (globalThis as any)[globalKey];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function setAccessToken(token: string) {
|
|
21
|
+
(globalThis as any)[globalKey] = token;
|
|
22
|
+
}
|
|
23
|
+
|
|
13
24
|
// Get headers for requests
|
|
14
25
|
function getHeaders(accessToken: string) {
|
|
15
26
|
return {
|
|
@@ -105,20 +116,6 @@ export async function getRequest(url: string) {
|
|
|
105
116
|
}
|
|
106
117
|
}
|
|
107
118
|
|
|
108
|
-
// Get access token from environment variables
|
|
109
|
-
function getAccessToken() {
|
|
110
|
-
let accessToken = process.env.PWS_ACCESS_TOKEN;
|
|
111
|
-
|
|
112
|
-
if (!accessToken) {
|
|
113
|
-
console.log(
|
|
114
|
-
"Access token not found. Please define an environment variable called PWS_ACCESS_TOKEN and set its value to your access token (downloaded from the Plant Web Services web site)."
|
|
115
|
-
);
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return accessToken;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
119
|
// Get platform, expiry date and token expiration status
|
|
123
120
|
function getAccessTokenInfo(accessToken: string): [string, string, boolean] {
|
|
124
121
|
const decoded = jwt.decode(accessToken);
|