@datagrok/compute 1.34.3 → 1.35.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@datagrok/compute",
3
3
  "friendlyName": "Compute",
4
- "version": "1.34.3",
4
+ "version": "1.35.0",
5
5
  "author": {
6
6
  "name": "Aufar Zakiev",
7
7
  "email": "aufar.zakiev@softwarecountry.com"
@@ -13,7 +13,7 @@
13
13
  "directory": "packages/Compute"
14
14
  },
15
15
  "dependencies": {
16
- "@datagrok-libraries/compute-utils": "^1.34.3",
16
+ "@datagrok-libraries/compute-utils": "^1.35.0",
17
17
  "cash-dom": "latest",
18
18
  "datagrok-api": "^1.18.6",
19
19
  "rxjs": "^6.6.7",
package/src/package.ts CHANGED
@@ -4,8 +4,19 @@ import * as ui from 'datagrok-api/ui';
4
4
  import * as DG from 'datagrok-api/dg';
5
5
  import {filter} from 'rxjs/operators';
6
6
  import {OutliersSelectionViewer} from './outliers-selection/outliers-selection-viewer';
7
- import {RichFunctionView, UiUtils} from "@datagrok-libraries/compute-utils";
8
- import { ValidationInfo, makeAdvice, makeValidationResult } from '@datagrok-libraries/compute-utils/shared-utils/validation';
7
+ import {
8
+ ComputationView as ComputationViewInst,
9
+ RichFunctionView as RichFunctionViewInst,
10
+ PipelineView as PipelineViewInst,
11
+ CompositionPipeline as CompositionPipelineViewInst,
12
+ UiUtils,
13
+ } from "@datagrok-libraries/compute-utils";
14
+ import {
15
+ ValidationInfo,
16
+ makeAdvice as makeAdviceInst,
17
+ makeValidationResult as makeValidationResultInst,
18
+ makeRevalidation as makeRevalidationInst,
19
+ } from '@datagrok-libraries/compute-utils/shared-utils/validation';
9
20
  import {ModelCatalogView, ModelHandler} from '@datagrok-libraries/compute-utils/model-catalog';
10
21
 
11
22
  let initCompleted: boolean = false;
@@ -30,7 +41,7 @@ export function OutliersSelection() {
30
41
  //input: funccall call
31
42
  //output: view result
32
43
  export function RichFunctionViewEditor(call: DG.FuncCall) {
33
- return RichFunctionView.fromFuncCall(call, {historyEnabled: true, isTabbed: false});
44
+ return RichFunctionViewInst.fromFuncCall(call, {historyEnabled: true, isTabbed: false});
34
45
  }
35
46
 
36
47
  //name: PipelineStepEditor
@@ -38,7 +49,7 @@ export function RichFunctionViewEditor(call: DG.FuncCall) {
38
49
  //input: funccall call
39
50
  //output: view result
40
51
  export function PipelineStepEditor(call: DG.FuncCall) {
41
- return RichFunctionView.fromFuncCall(call, {historyEnabled: false, isTabbed: true});
52
+ return RichFunctionViewInst.fromFuncCall(call, {historyEnabled: false, isTabbed: true});
42
53
  }
43
54
 
44
55
  //name: renderRestPanel
@@ -232,7 +243,7 @@ export function modelCatalog() {
232
243
  export function SimTimeValidator(params: any) {
233
244
  const {reasonableMin, reasonableMax} = params;
234
245
  return (val: number) => {
235
- return makeValidationResult({
246
+ return makeValidationResultInst({
236
247
  warnings: val < reasonableMin || val > reasonableMax ? [`Minimum reasonable time is ${reasonableMin}. Maximum reasonable time is ${reasonableMax}`]: undefined,
237
248
  errors: val < 0 ? [`Time should be strictly positive`]: undefined,
238
249
  });
@@ -246,9 +257,9 @@ export function DesiredTempValidator(params: any) {
246
257
  return (val: number, info: ValidationInfo) => {
247
258
  const ambTemp = info.funcCall.inputs['ambTemp'];
248
259
  const initTemp = info.funcCall.inputs['initTemp'];
249
- return makeValidationResult({
260
+ return makeValidationResultInst({
250
261
  errors: [
251
- ...(val < ambTemp) ? [makeAdvice(`Desired temperature cannot be less than ambient temperature (${ambTemp}). \n`, [
262
+ ...(val < ambTemp) ? [makeAdviceInst(`Desired temperature cannot be less than ambient temperature (${ambTemp}). \n`, [
252
263
  {actionName: 'Set desired equal to ambient', action: () => info.funcCall.inputs['desiredTemp'] = ambTemp }
253
264
  ])]: [],
254
265
  ...(val > initTemp) ? [`Desired temperature cannot be higher than initial temperature (${initTemp})`]: [],
@@ -263,7 +274,7 @@ export function DesiredTempValidator(params: any) {
263
274
  export function InitialTempValidator(params: any) {
264
275
  return (val: number, info: ValidationInfo) => {
265
276
  const ambTemp = info.funcCall.inputs['ambTemp'];
266
- return makeValidationResult({
277
+ return makeValidationResultInst({
267
278
  errors: [
268
279
  ...(val < ambTemp) ? [`Initial temperature cannot be less than ambient temperature (${ambTemp}).`]: [],
269
280
  ]
@@ -277,7 +288,7 @@ export function InitialTempValidator(params: any) {
277
288
  export function AmbTempValidator(params: any) {
278
289
  return (val: number, info: ValidationInfo) => {
279
290
  const initTemp = info.funcCall.inputs['initTemp'];
280
- return makeValidationResult({
291
+ return makeValidationResultInst({
281
292
  errors: [
282
293
  ...(val > initTemp) ? [`Ambient temperature cannot be higher than initial temperature (${initTemp})`]: [],
283
294
  ]
@@ -290,12 +301,12 @@ export function AmbTempValidator(params: any) {
290
301
  //output: object validator
291
302
  export function HeatCapValidator(params: any) {
292
303
  return (val: number, info: ValidationInfo) => {
293
- return makeValidationResult({
304
+ return makeValidationResultInst({
294
305
  errors: [
295
306
  ...val <= 0 ? ['Heat capacity must be greater than zero.']: []
296
307
  ],
297
308
  notifications: [
298
- makeAdvice(`Heat capacity is only dependent on the object material.`, [
309
+ makeAdviceInst(`Heat capacity is only dependent on the object material.`, [
299
310
  {actionName: 'Google it', action: () => { window.open(`http://google.com`)}}
300
311
  ]),
301
312
  ]
@@ -321,4 +332,18 @@ export function ObjectCoolingSelector(params: any) {
321
332
  'Previous run',
322
333
  'ObjectCooling',
323
334
  );
324
- }
335
+ }
336
+
337
+ //// Compute-utils API section
338
+
339
+ export const CompView = ComputationViewInst;
340
+ export const RFV = RichFunctionViewInst;
341
+ export const Pipeline = PipelineViewInst;
342
+ export const CompositionPipeline = CompositionPipelineViewInst;
343
+ export const makeValidationResult = makeValidationResultInst;
344
+ export const makeAdvice = makeAdviceInst;
345
+ export const makeRevalidation = makeRevalidationInst;
346
+ export const fileInput = UiUtils.fileInput;
347
+ export const historyInput = UiUtils.historyInput;
348
+ export const historyInputJSON = UiUtils.historyInputJSON;
349
+ export const historyPanel = UiUtils.historyPanel;