@dnv-plant/typescriptpws 1.0.95 → 1.0.96

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
@@ -6,8 +6,8 @@
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.95
10
- * Date/time: 19 Jan 2026 12:11:52
9
+ * Version: 1.0.96
10
+ * Date/time: 4 Apr 2026 08:17:52
11
11
  * Template: templates/typescriptpws/index.razor.
12
12
  ***********************************************************************/
13
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnv-plant/typescriptpws",
3
- "version": "1.0.95",
3
+ "version": "1.0.96",
4
4
  "description": "Integrate Phast models with our versatile APIs for enhanced customization and efficiency.",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -1,23 +1,23 @@
1
1
  /***********************************************************************
2
- * This file has been auto-generated by a code generation tool.
3
- *
4
- * DO NOT MODIFY THIS FILE
5
- * This file is maintained by DNV.
6
- * Editing it may lead to inconsistent results and limit DNV's ability to provide support.
7
- * Please contact DNV if you believe changes are required.
8
- *
9
- * Version: 1.0.95
10
- * Date/time: 19 Jan 2026 12:11:52
11
- * Template: templates/typescriptpws/calculations.razor.
12
- ***********************************************************************/
13
-
14
- import * as Enums from "../enums";
15
- import * as Entities from "../entities";
16
- import * as EntitySchemas from "../entity-schemas";
17
- import { getAnalyticsApiTarget, getClientAliasId } from "../utilities";
18
- import { CalculationRequestBase, CalculationBase, CalculationResponseBase } from "./calculationBase"
19
-
20
- import Joi from "joi";
2
+ * This file has been auto-generated by a code generation tool.
3
+ *
4
+ * DO NOT MODIFY THIS FILE
5
+ * This file is maintained by DNV.
6
+ * Editing it may lead to inconsistent results and limit DNV's ability to provide support.
7
+ * Please contact DNV if you believe changes are required.
8
+ *
9
+ * Version: 1.0.96
10
+ * Date/time: 4 Apr 2026 08:17:52
11
+ * Template: templates/typescriptpws/calculations.razor.
12
+ ***********************************************************************/
13
+
14
+ import * as Enums from '../enums';
15
+ import * as Entities from '../entities';
16
+ import * as EntitySchemas from '../entity-schemas';
17
+ import { getAnalyticsApiTarget, getClientAliasId } from '../utilities';
18
+ import { CalculationRequestBase, CalculationBase, CalculationResponseBase } from './calculationBase';
19
+
20
+ import Joi from 'joi';
21
21
 
22
22
  export interface MixtureConstantPropertiesCalculationRequestSchemaData {
23
23
  material: Entities.Material;
@@ -30,9 +30,7 @@ class MixtureConstantPropertiesCalculationRequest extends CalculationRequestBase
30
30
  * MixtureConstantProperties calculation request class.
31
31
  *
32
32
  */
33
- constructor(data: {
34
- material: Entities.Material
35
- }) {
33
+ constructor(data: { material: Entities.Material }) {
36
34
  super();
37
35
  this.material = data.material;
38
36
  }
@@ -51,14 +49,14 @@ export class MixtureConstantPropertiesCalculationRequestSchema {
51
49
  }).unknown(true);
52
50
 
53
51
  this.propertyTypes = {
54
- material: "Entities.Material",
52
+ material: 'Entities.Material',
55
53
  };
56
54
  }
57
55
 
58
56
  validate(data: MixtureConstantPropertiesCalculationRequestSchemaData): MixtureConstantPropertiesCalculationRequest {
59
57
  const { error, value } = this.schema.validate(data, { abortEarly: false });
60
58
  if (error) {
61
- throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
59
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
62
60
  }
63
61
  return this.makeCalculationRequest(value);
64
62
  }
@@ -76,10 +74,7 @@ export class MixtureConstantPropertiesCalculation extends CalculationBase {
76
74
  * Calculates constant fluid properties for a mixture.
77
75
  *
78
76
  */
79
- constructor(data: {
80
- material: Entities.Material
81
- controller?: AbortController;
82
- }) {
77
+ constructor(data: { material: Entities.Material; controller?: AbortController }) {
83
78
  super(data.controller);
84
79
  this.material = data.material;
85
80
  }
@@ -87,7 +82,7 @@ export class MixtureConstantPropertiesCalculation extends CalculationBase {
87
82
  async run() {
88
83
  try {
89
84
  const request = new MixtureConstantPropertiesCalculationRequest({
90
- material: this.material
85
+ material: this.material,
91
86
  });
92
87
 
93
88
  const schema = new MixtureConstantPropertiesCalculationRequestSchema();
@@ -128,16 +123,16 @@ export class MixtureConstantPropertiesCalculation extends CalculationBase {
128
123
  }
129
124
 
130
125
  toString() {
131
- const parts = ["* MixtureConstantProperties"];
126
+ const parts = ['* MixtureConstantProperties'];
132
127
 
133
128
  parts.push(`mixConstantPropResult: ${String(this.mixConstantPropResult)}`);
134
129
  parts.push(`resultCode: ${String(this.resultCode)}`);
135
- parts.push("*** messages:");
136
- parts.push(`messages: ${this.messages !== undefined ? this.messages : "(None)"}`);
137
- parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : "(None)"}`);
138
- parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : "(None)"}`);
130
+ parts.push('*** messages:');
131
+ parts.push(`messages: ${this.messages !== undefined ? this.messages : '(None)'}`);
132
+ parts.push(`calculationElapsedTime: ${this.calculationElapsedTime !== undefined ? this.calculationElapsedTime : '(None)'}`);
133
+ parts.push(`operationId: ${this.operationId !== undefined ? this.operationId : '(None)'}`);
139
134
 
140
- return parts.join("\n");
135
+ return parts.join('\n');
141
136
  }
142
137
  }
143
138
 
@@ -148,13 +143,7 @@ export class MixtureConstantPropertiesCalculationResponse extends CalculationRes
148
143
  * MixtureConstantProperties calculation response class.
149
144
  *
150
145
  */
151
- constructor(data: {
152
- mixConstantPropResult: Entities.MixtureConstantPropertiesResult,
153
- resultCode: Enums.ResultCode,
154
- messages: string[],
155
- calculationElapsedTime: number,
156
- operationId: string
157
- }) {
146
+ constructor(data: { mixConstantPropResult: Entities.MixtureConstantPropertiesResult; resultCode: Enums.ResultCode; messages: string[]; calculationElapsedTime: number; operationId: string }) {
158
147
  super();
159
148
  this.mixConstantPropResult = data.mixConstantPropResult;
160
149
  this.resultCode = data.resultCode;
@@ -168,17 +157,17 @@ export class MixtureConstantPropertiesCalculationResponse extends CalculationRes
168
157
  this.mixConstantPropResult = new Entities.MixtureConstantPropertiesResult();
169
158
  this.mixConstantPropResult.initialiseFromDictionary(data.mixConstantPropResult as { [key: string]: unknown });
170
159
  }
171
- if (data.resultCode !== undefined && (typeof data.resultCode === "string" || typeof data.resultCode === "number")) {
160
+ if (data.resultCode !== undefined && (typeof data.resultCode === 'string' || typeof data.resultCode === 'number')) {
172
161
  this.resultCode = data.resultCode as Enums.ResultCode;
173
162
  }
174
163
  this.messages = this.messages ?? [];
175
164
  if (data.messages && Array.isArray(data.messages)) {
176
165
  this.messages.push(...data.messages);
177
166
  }
178
- if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === "number") {
167
+ if (data.calculationElapsedTime !== undefined && typeof data.calculationElapsedTime === 'number') {
179
168
  this.calculationElapsedTime = data.calculationElapsedTime as number;
180
169
  }
181
- if (data.operationId !== undefined && typeof data.operationId === "string") {
170
+ if (data.operationId !== undefined && typeof data.operationId === 'string') {
182
171
  this.operationId = data.operationId as string;
183
172
  }
184
173
  }
@@ -209,14 +198,14 @@ export class MixtureConstantPropertiesCalculationResponseSchema {
209
198
  }).unknown(true);
210
199
 
211
200
  this.propertyTypes = {
212
- mixConstantPropResult: "Entities.MixtureConstantPropertiesResult",
201
+ mixConstantPropResult: 'Entities.MixtureConstantPropertiesResult',
213
202
  };
214
203
  }
215
204
 
216
205
  validate(data: MixtureConstantPropertiesCalculationResponseSchemaData): MixtureConstantPropertiesCalculationResponse {
217
206
  const { error, value } = this.schema.validate(data, { abortEarly: false });
218
207
  if (error) {
219
- throw new Error(`Validation error: ${error.details.map((x) => x.message).join(", ")}`);
208
+ throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
220
209
  }
221
210
  return this.makeCalculationResponse(value);
222
211
  }
@@ -1,20 +1,20 @@
1
1
  /***********************************************************************
2
- * This file has been auto-generated by a code generation tool.
3
- *
4
- * DO NOT MODIFY THIS FILE
5
- * This file is maintained by DNV.
6
- * Editing it may lead to inconsistent results and limit DNV's ability to provide support.
7
- * Please contact DNV if you believe changes are required.
8
- *
9
- * Version: 1.0.95
10
- * Date/time: 19 Jan 2026 12:11:52
11
- * Template: templates/typescriptpws/calculationbase.razor.
12
- ***********************************************************************/
2
+ * This file has been auto-generated by a code generation tool.
3
+ *
4
+ * DO NOT MODIFY THIS FILE
5
+ * This file is maintained by DNV.
6
+ * Editing it may lead to inconsistent results and limit DNV's ability to provide support.
7
+ * Please contact DNV if you believe changes are required.
8
+ *
9
+ * Version: 1.0.96
10
+ * Date/time: 4 Apr 2026 08:17:52
11
+ * Template: templates/typescriptpws/calculationbase.razor.
12
+ ***********************************************************************/
13
13
 
14
- import { ResultCode } from "../enums";
15
- import { postRequest } from "../utilities";
16
- import Joi from "joi";
17
- import { AxiosResponse } from "axios";
14
+ import { ResultCode } from '../enums';
15
+ import { postRequest } from '../utilities';
16
+ import Joi from 'joi';
17
+ import { AxiosResponse } from 'axios';
18
18
 
19
19
  export class CalculationRequestBase {
20
20
  /**
@@ -29,7 +29,7 @@ export class CalculationBase {
29
29
  resultCode?: ResultCode = ResultCode.SUCCESS;
30
30
  messages: string[] = [];
31
31
  calculationElapsedTime?: number = 0.0;
32
- operationId?: string = "";
32
+ operationId?: string = '';
33
33
  controller?: AbortController;
34
34
 
35
35
  constructor(controller?: AbortController) {
@@ -50,7 +50,7 @@ export class CalculationBase {
50
50
  if (this.messages && this.messages.length > 0) {
51
51
  this.messages.forEach((message) => console.log(message));
52
52
  } else {
53
- console.log("No messages");
53
+ console.log('No messages');
54
54
  }
55
55
  }
56
56
 
@@ -59,26 +59,20 @@ export class CalculationBase {
59
59
  */
60
60
  handleFailedResponse(response: AxiosResponse): void {
61
61
  try {
62
- const validatedFailedResponse =
63
- new CalculationFailedResponseSchema().validate(response.data);
62
+ const validatedFailedResponse = new CalculationFailedResponseSchema().validate(response.data);
64
63
 
65
64
  this.resultCode = validatedFailedResponse.resultCode;
66
65
  this.messages.push(...(validatedFailedResponse.messages ?? []));
67
- this.calculationElapsedTime =
68
- validatedFailedResponse.calculationElapsedTime;
66
+ this.calculationElapsedTime = validatedFailedResponse.calculationElapsedTime;
69
67
  this.operationId = validatedFailedResponse.operationId;
70
68
  } catch (error) {
71
69
  if (error instanceof Error) {
72
70
  this.messages.push(`Failed to parse response: ${error.message}`);
73
71
  } else {
74
- this.messages.push(
75
- "An unknown error occurred during response parsing."
76
- );
72
+ this.messages.push('An unknown error occurred during response parsing.');
77
73
  }
78
74
  } finally {
79
- this.messages.push(
80
- `${response.statusText} (Status code: ${response.status})`
81
- );
75
+ this.messages.push(`${response.statusText} (Status code: ${response.status})`);
82
76
  }
83
77
  }
84
78
  }
@@ -92,12 +86,7 @@ export class CalculationResponseBase {
92
86
  /**
93
87
  * Calculation response base class.
94
88
  */
95
- constructor(
96
- resultCode?: ResultCode,
97
- messages?: string[],
98
- calculationElapsedTime?: number,
99
- operationId?: string
100
- ) {
89
+ constructor(resultCode?: ResultCode, messages?: string[], calculationElapsedTime?: number, operationId?: string) {
101
90
  this.resultCode = resultCode;
102
91
  this.messages = messages;
103
92
  this.calculationElapsedTime = calculationElapsedTime;
@@ -109,12 +98,7 @@ class CalculationFailedResponse extends CalculationResponseBase {
109
98
  /**
110
99
  * Calculation failed response class.
111
100
  */
112
- constructor(
113
- resultCode?: ResultCode,
114
- messages: string[] = [],
115
- calculationElapsedTime: number = 0,
116
- operationId: string = ""
117
- ) {
101
+ constructor(resultCode?: ResultCode, messages: string[] = [], calculationElapsedTime: number = 0, operationId: string = '') {
118
102
  super(resultCode, messages, calculationElapsedTime, operationId);
119
103
  }
120
104
  }
@@ -136,31 +120,13 @@ class CalculationFailedResponseSchema {
136
120
  }).unknown(true);
137
121
  }
138
122
 
139
- validate(data: {
140
- resultCode: ResultCode;
141
- messages: string[];
142
- calculationElapsedTime: number;
143
- operationId: string;
144
- }) {
123
+ validate(data: { resultCode: ResultCode; messages: string[]; calculationElapsedTime: number; operationId: string }) {
145
124
  const { error, value } = this.schema.validate(data);
146
- if (error)
147
- throw new Error(
148
- `Validation error: ${error.details.map((x) => x.message).join(", ")}`
149
- );
125
+ if (error) throw new Error(`Validation error: ${error.details.map((x) => x.message).join(', ')}`);
150
126
  return this.makeCalculationFailedResponse(value);
151
127
  }
152
128
 
153
- makeCalculationFailedResponse(data: {
154
- resultCode: ResultCode;
155
- messages: string[];
156
- calculationElapsedTime: number;
157
- operationId: string;
158
- }) {
159
- return new CalculationFailedResponse(
160
- data.resultCode,
161
- data.messages,
162
- data.calculationElapsedTime,
163
- data.operationId
164
- );
129
+ makeCalculationFailedResponse(data: { resultCode: ResultCode; messages: string[]; calculationElapsedTime: number; operationId: string }) {
130
+ return new CalculationFailedResponse(data.resultCode, data.messages, data.calculationElapsedTime, data.operationId);
165
131
  }
166
132
  }