@dnv-plant/typescriptpws 1.0.86 → 1.0.88

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.
@@ -0,0 +1,16 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "type": "node",
6
+ "request": "launch",
7
+ "name": "Debug Current Test File with Vitest",
8
+ "autoAttachChildProcesses": true,
9
+ "skipFiles": ["<node_internals>/**", "**/node_modules/**"],
10
+ "program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
11
+ "args": ["run", "--test-timeout=0", "${relativeFile}"],
12
+ "smartStep": true,
13
+ "console": "integratedTerminal"
14
+ }
15
+ ]
16
+ }
@@ -11,7 +11,7 @@ jobs:
11
11
  - checkout: self
12
12
  - task: NodeTool@0
13
13
  inputs:
14
- versionSpec: "16.x"
14
+ versionSpec: "18.x"
15
15
  displayName: "Install Node.js"
16
16
 
17
17
  - script: |
@@ -23,7 +23,7 @@ jobs:
23
23
  displayName: "Compile TypeScript"
24
24
 
25
25
  - script: |
26
- npm run test -- tests/${{ parameters.testFolder }} --ci --coverage --passWithNoTests
26
+ npm run test -- tests/${{ parameters.testFolder }}
27
27
  displayName: "Run unit tests"
28
28
  env:
29
29
  PWS_ACCESS_TOKEN: $(PWS_ACCESS_TOKEN)
package/index.ts CHANGED
@@ -6,10 +6,10 @@
6
6
  * Editing it may lead to inconsistent results and limit DNV's ability to provide support.
7
7
  * Please contact DNV if you believe changes are required.
8
8
  *
9
- * Version: 1.0.86
10
- * Date/time: 10 Jul 2025 09:49:06
9
+ * Version: 1.0.89
10
+ * Date/time: 29 Jul 2025 17:59:12
11
11
  * Template: templates/typescriptpws/index.razor.
12
- ***********************************************************************/
12
+ ***********************************************************************/
13
13
 
14
14
  export * from "./src/constants";
15
15
  export * from "./src/entities";
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@dnv-plant/typescriptpws",
3
- "version": "1.0.86",
3
+ "version": "1.0.88",
4
4
  "description": "Integrate Phast models with our versatile APIs for enhanced customization and efficiency.",
5
5
  "main": "index.ts",
6
6
  "scripts": {
7
- "test": "jest"
7
+ "test": "vitest",
8
+ "test:ui": "vitest --ui"
8
9
  },
9
10
  "keywords": [],
10
11
  "author": "DNV <software.support@dnv.com> (www.dnv.com)",
@@ -13,12 +14,12 @@
13
14
  "axios": "^1.7.9",
14
15
  "joi": "^17.13.3",
15
16
  "jsonwebtoken": "^9.0.2",
17
+ "p-limit": "^6.2.0",
16
18
  "typescript": "^5.7.3"
17
19
  },
18
20
  "devDependencies": {
19
- "@types/jsonwebtoken": "^9.0.8",
20
- "@types/jest": "^29.5.14",
21
- "jest": "^29.7.0",
22
- "ts-jest": "^29.3.0"
21
+ "@types/jsonwebtoken": "^9.0.8",
22
+ "@vitest/ui": "^3.2.4",
23
+ "vitest": "^3.2.4"
23
24
  }
24
25
  }
@@ -6,12 +6,10 @@
6
6
  * Editing it may lead to inconsistent results and limit DNV's ability to provide support.
7
7
  * Please contact DNV if you believe changes are required.
8
8
  *
9
- * Version: 1.0.86
10
- * Date/time: 10 Jul 2025 09:49:06
9
+ * Version: 1.0.89
10
+ * Date/time: 29 Jul 2025 17:59:11
11
11
  * Template: templates/typescriptpws/calculations.razor.
12
- ***********************************************************************/
13
-
14
-
12
+ ***********************************************************************/
15
13
 
16
14
  import * as Enums from "../enums";
17
15
  import * as Entities from "../entities";
@@ -36,12 +34,17 @@ class CalculationBase {
36
34
  messages: string[] = [];
37
35
  calculationElapsedTime?: number = 0.0;
38
36
  operationId?: string = "";
37
+ controller?: AbortController;
38
+
39
+ constructor(controller?: AbortController) {
40
+ this.controller = controller;
41
+ }
39
42
 
40
43
  /**
41
44
  * Post JSON to URL and time the call
42
45
  */
43
46
  async postRequest(url: string, data: string): Promise<AxiosResponse> {
44
- return postRequest(url, data);
47
+ return postRequest(url, data, this.controller);
45
48
  }
46
49
 
47
50
  /**
@@ -163,13 +166,12 @@ class MixtureConstantPropertiesCalculationRequest extends CalculationRequestBase
163
166
  /**
164
167
  * MixtureConstantProperties calculation request class.
165
168
  *
166
- * @param {Entities.Material} material - a material entity representing a mixture.
167
169
  */
168
- constructor(
170
+ constructor(data: {
169
171
  material: Entities.Material
170
- ) {
172
+ }) {
171
173
  super();
172
- this.material = material;
174
+ this.material = data.material;
173
175
  }
174
176
  }
175
177
 
@@ -199,9 +201,7 @@ export class MixtureConstantPropertiesCalculationRequestSchema {
199
201
  }
200
202
 
201
203
  makeCalculationRequest(data: MixtureConstantPropertiesCalculationRequestSchemaData): MixtureConstantPropertiesCalculationRequest {
202
- return new MixtureConstantPropertiesCalculationRequest(
203
- data.material
204
- );
204
+ return new MixtureConstantPropertiesCalculationRequest(data);
205
205
  }
206
206
  }
207
207
 
@@ -212,20 +212,20 @@ export class MixtureConstantPropertiesCalculation extends CalculationBase {
212
212
  /**
213
213
  * Calculates constant fluid properties for a mixture.
214
214
  *
215
- * @param {Entities.Material} material - a material entity representing a mixture.
216
215
  */
217
- constructor(
216
+ constructor(data: {
218
217
  material: Entities.Material
219
- ) {
220
- super();
221
- this.material = material;
218
+ controller?: AbortController;
219
+ }) {
220
+ super(data.controller);
221
+ this.material = data.material;
222
222
  }
223
223
 
224
224
  async run() {
225
225
  try {
226
- const request = new MixtureConstantPropertiesCalculationRequest(
227
- this.material
228
- );
226
+ const request = new MixtureConstantPropertiesCalculationRequest({
227
+ material: this.material
228
+ });
229
229
 
230
230
  const schema = new MixtureConstantPropertiesCalculationRequestSchema();
231
231
  const validatedRequest = schema.validate(request);
@@ -284,21 +284,20 @@ export class MixtureConstantPropertiesCalculationResponse extends CalculationRes
284
284
  /**
285
285
  * MixtureConstantProperties calculation response class.
286
286
  *
287
- * @param {Entities.MixtureConstantPropertiesResult} mixConstantPropResult - Constant properties of the mixture.
288
287
  */
289
- constructor(
288
+ constructor(data: {
290
289
  mixConstantPropResult: Entities.MixtureConstantPropertiesResult,
291
290
  resultCode: Enums.ResultCode,
292
291
  messages: string[],
293
292
  calculationElapsedTime: number,
294
293
  operationId: string
295
- ) {
294
+ }) {
296
295
  super();
297
- this.mixConstantPropResult = mixConstantPropResult;
298
- this.resultCode = resultCode;
299
- this.messages = messages;
300
- this.calculationElapsedTime = calculationElapsedTime;
301
- this.operationId = operationId;
296
+ this.mixConstantPropResult = data.mixConstantPropResult;
297
+ this.resultCode = data.resultCode;
298
+ this.messages = data.messages;
299
+ this.calculationElapsedTime = data.calculationElapsedTime;
300
+ this.operationId = data.operationId;
302
301
  }
303
302
 
304
303
  initialiseFromDictionary(data: { [key: string]: unknown }) {
@@ -360,12 +359,6 @@ export class MixtureConstantPropertiesCalculationResponseSchema {
360
359
  }
361
360
 
362
361
  makeCalculationResponse(data: MixtureConstantPropertiesCalculationResponseSchemaData): MixtureConstantPropertiesCalculationResponse {
363
- return new MixtureConstantPropertiesCalculationResponse(
364
- data.mixConstantPropResult,
365
- data.resultCode,
366
- data.messages,
367
- data.calculationElapsedTime,
368
- data.operationId
369
- );
362
+ return new MixtureConstantPropertiesCalculationResponse(data);
370
363
  }
371
364
  }