@dnv-plant/typescriptpws 1.0.64 → 1.0.65

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  /***********************************************************************
2
2
  * This file has been auto-generated by a code generation tool.
3
- * Version: 1.0.64
4
- * Date/time: 04 Apr 2025 15:02:06
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:45
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.64",
3
+ "version": "1.0.65",
4
4
  "description": "Integrate Phast models with our versatile APIs for enhanced customization and efficiency.",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  /***********************************************************************
2
2
  * This file has been auto-generated by a code generation tool.
3
- * Version: 1.0.64
4
- * Date/time: 04 Apr 2025 15:02:06
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:45
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.64
4
- * Date/time: 04 Apr 2025 15:02:06
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:45
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.64
4
- * Date/time: 04 Apr 2025 15:02:06
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:45
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.64
4
- * Date/time: 04 Apr 2025 15:02:06
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:45
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.64
4
- * Date/time: 04 Apr 2025 15:02:06
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:45
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.64
4
- * Date/time: 04 Apr 2025 15:02:06
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:45
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.64
4
- * Date/time: 04 Apr 2025 15:02:06
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:45
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.64
4
- * Date/time: 04 Apr 2025 15:02:06
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:45
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.64
4
- * Date/time: 04 Apr 2025 15:02:06
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:45
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.64
4
- * Date/time: 04 Apr 2025 15:02:06
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:45
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.64
4
- * Date/time: 04 Apr 2025 15:02:06
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:45
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.64
4
- * Date/time: 04 Apr 2025 15:02:06
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:45
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.64
4
- * Date/time: 04 Apr 2025 15:02:06
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:45
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.64
4
- * Date/time: 04 Apr 2025 15:02:06
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:45
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.64
4
- * Date/time: 04 Apr 2025 15:02:03
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:42
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.64
4
- * Date/time: 04 Apr 2025 15:02:04
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:44
5
5
  * Template: templates/typescriptpws/entities.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.64
4
- * Date/time: 04 Apr 2025 15:02:05
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:44
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.64
4
- * Date/time: 04 Apr 2025 15:02:04
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:43
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.64
4
- * Date/time: 04 Apr 2025 15:02:03
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:42
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.64
4
- * Date/time: 04 Apr 2025 15:02:02
3
+ * Version: 1.0.65
4
+ * Date/time: 04 Apr 2025 16:39:41
5
5
  * Template: templates/typescriptpws/utilities.razor.
6
6
  ***********************************************************************/
7
7
 
@@ -10,15 +10,28 @@ 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] || "";
13
+ const accessTokenKey = "__pwsAccessToken";
14
+ const usedInDnvKey = "__pwsUsedInDnvKey";
15
+
16
+ (globalThis as any)[accessTokenKey] = (globalThis as any)[accessTokenKey] || "";
17
+ (globalThis as any)[usedInDnvKey] = (globalThis as any)[usedInDnvKey] || false;
15
18
 
16
19
  export function getAccessToken(): string {
17
- return (globalThis as any)[globalKey];
20
+ return (globalThis as any)[accessTokenKey];
18
21
  }
19
22
 
20
23
  export function setAccessToken(token: string) {
21
- (globalThis as any)[globalKey] = token;
24
+ (globalThis as any)[accessTokenKey] = token;
25
+ }
26
+
27
+ // For DNV use only
28
+ function isUsedInDnvProduct(): boolean {
29
+ return (globalThis as any)[usedInDnvKey];
30
+ }
31
+
32
+ // For DNV use only
33
+ export function setUsedInDnvProduct(value: boolean) {
34
+ (globalThis as any)[usedInDnvKey] = value;
22
35
  }
23
36
 
24
37
  // Get headers for requests
@@ -143,6 +156,11 @@ function getAccessTokenInfo(accessToken: string): [string, string, boolean] {
143
156
  function getApiRoot() {
144
157
  const accessToken = getAccessToken();
145
158
  const devMode = process.env.DEV_MODE || false;
159
+ const isDnvProduct = isUsedInDnvProduct();
160
+
161
+ if (isDnvProduct) {
162
+ return "/api/";
163
+ }
146
164
 
147
165
  if (accessToken) {
148
166
  const [platform] = getAccessTokenInfo(accessToken);
@@ -150,8 +168,6 @@ function getApiRoot() {
150
168
  // Determine API root based on devMode
151
169
  const apiTarget = devMode ? "/api/" : `${platform}/api/`;
152
170
 
153
- console.log("apiTarget:", apiTarget)
154
-
155
171
  return apiTarget;
156
172
  }
157
173