@datagrok/compute 1.34.3 → 1.35.1

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.1",
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,9 +4,23 @@ 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';
21
+ import {
22
+ testPipeline as testPipelineInst
23
+ } from '@datagrok-libraries/compute-utils/shared-utils/function-views-testing';
10
24
 
11
25
  let initCompleted: boolean = false;
12
26
  export const _package = new DG.Package();
@@ -30,7 +44,7 @@ export function OutliersSelection() {
30
44
  //input: funccall call
31
45
  //output: view result
32
46
  export function RichFunctionViewEditor(call: DG.FuncCall) {
33
- return RichFunctionView.fromFuncCall(call, {historyEnabled: true, isTabbed: false});
47
+ return RichFunctionViewInst.fromFuncCall(call, {historyEnabled: true, isTabbed: false});
34
48
  }
35
49
 
36
50
  //name: PipelineStepEditor
@@ -38,7 +52,7 @@ export function RichFunctionViewEditor(call: DG.FuncCall) {
38
52
  //input: funccall call
39
53
  //output: view result
40
54
  export function PipelineStepEditor(call: DG.FuncCall) {
41
- return RichFunctionView.fromFuncCall(call, {historyEnabled: false, isTabbed: true});
55
+ return RichFunctionViewInst.fromFuncCall(call, {historyEnabled: false, isTabbed: true});
42
56
  }
43
57
 
44
58
  //name: renderRestPanel
@@ -232,7 +246,7 @@ export function modelCatalog() {
232
246
  export function SimTimeValidator(params: any) {
233
247
  const {reasonableMin, reasonableMax} = params;
234
248
  return (val: number) => {
235
- return makeValidationResult({
249
+ return makeValidationResultInst({
236
250
  warnings: val < reasonableMin || val > reasonableMax ? [`Minimum reasonable time is ${reasonableMin}. Maximum reasonable time is ${reasonableMax}`]: undefined,
237
251
  errors: val < 0 ? [`Time should be strictly positive`]: undefined,
238
252
  });
@@ -246,9 +260,9 @@ export function DesiredTempValidator(params: any) {
246
260
  return (val: number, info: ValidationInfo) => {
247
261
  const ambTemp = info.funcCall.inputs['ambTemp'];
248
262
  const initTemp = info.funcCall.inputs['initTemp'];
249
- return makeValidationResult({
263
+ return makeValidationResultInst({
250
264
  errors: [
251
- ...(val < ambTemp) ? [makeAdvice(`Desired temperature cannot be less than ambient temperature (${ambTemp}). \n`, [
265
+ ...(val < ambTemp) ? [makeAdviceInst(`Desired temperature cannot be less than ambient temperature (${ambTemp}). \n`, [
252
266
  {actionName: 'Set desired equal to ambient', action: () => info.funcCall.inputs['desiredTemp'] = ambTemp }
253
267
  ])]: [],
254
268
  ...(val > initTemp) ? [`Desired temperature cannot be higher than initial temperature (${initTemp})`]: [],
@@ -263,7 +277,7 @@ export function DesiredTempValidator(params: any) {
263
277
  export function InitialTempValidator(params: any) {
264
278
  return (val: number, info: ValidationInfo) => {
265
279
  const ambTemp = info.funcCall.inputs['ambTemp'];
266
- return makeValidationResult({
280
+ return makeValidationResultInst({
267
281
  errors: [
268
282
  ...(val < ambTemp) ? [`Initial temperature cannot be less than ambient temperature (${ambTemp}).`]: [],
269
283
  ]
@@ -277,7 +291,7 @@ export function InitialTempValidator(params: any) {
277
291
  export function AmbTempValidator(params: any) {
278
292
  return (val: number, info: ValidationInfo) => {
279
293
  const initTemp = info.funcCall.inputs['initTemp'];
280
- return makeValidationResult({
294
+ return makeValidationResultInst({
281
295
  errors: [
282
296
  ...(val > initTemp) ? [`Ambient temperature cannot be higher than initial temperature (${initTemp})`]: [],
283
297
  ]
@@ -290,12 +304,12 @@ export function AmbTempValidator(params: any) {
290
304
  //output: object validator
291
305
  export function HeatCapValidator(params: any) {
292
306
  return (val: number, info: ValidationInfo) => {
293
- return makeValidationResult({
307
+ return makeValidationResultInst({
294
308
  errors: [
295
309
  ...val <= 0 ? ['Heat capacity must be greater than zero.']: []
296
310
  ],
297
311
  notifications: [
298
- makeAdvice(`Heat capacity is only dependent on the object material.`, [
312
+ makeAdviceInst(`Heat capacity is only dependent on the object material.`, [
299
313
  {actionName: 'Google it', action: () => { window.open(`http://google.com`)}}
300
314
  ]),
301
315
  ]
@@ -321,4 +335,19 @@ export function ObjectCoolingSelector(params: any) {
321
335
  'Previous run',
322
336
  'ObjectCooling',
323
337
  );
324
- }
338
+ }
339
+
340
+ //// Compute-utils API section
341
+
342
+ export const testPipeline = testPipelineInst;
343
+ export const CompView = ComputationViewInst;
344
+ export const RFV = RichFunctionViewInst;
345
+ export const Pipeline = PipelineViewInst;
346
+ export const CompositionPipeline = CompositionPipelineViewInst;
347
+ export const makeValidationResult = makeValidationResultInst;
348
+ export const makeAdvice = makeAdviceInst;
349
+ export const makeRevalidation = makeRevalidationInst;
350
+ export const fileInput = UiUtils.fileInput;
351
+ export const historyInput = UiUtils.historyInput;
352
+ export const historyInputJSON = UiUtils.historyInputJSON;
353
+ export const historyPanel = UiUtils.historyPanel;