@datagrok/hit-triage 1.10.6 → 1.10.8

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.
@@ -1,7 +1,7 @@
1
1
  import * as DG from 'datagrok-api/dg';
2
2
  import {AppName, HitDesignTemplate, HitTriageTemplate, PeptiHitTemplate} from './types';
3
- import {HitDesignApp} from './hit-design-app';
4
- import {HitTriageApp} from './hit-triage-app';
3
+ import type {HitDesignApp} from './hit-design-app';
4
+ import type {HitTriageApp} from './hit-triage-app';
5
5
  import {_package} from '../package';
6
6
 
7
7
  export class HitBaseView<Ttemplate extends HitDesignTemplate | HitTriageTemplate | PeptiHitTemplate,
@@ -16,6 +16,9 @@ export class HitBaseView<Ttemplate extends HitDesignTemplate | HitTriageTemplate
16
16
 
17
17
  get template(): Ttemplate {return this.app.template! as Ttemplate;}
18
18
 
19
+ /** Info views implement this to rebuild their content. */
20
+ init?(presetTemplate?: any): Promise<void>;
21
+
19
22
  /** Override to initialize the view based on the session. */
20
23
  onActivated(): void {
21
24
  }
@@ -29,5 +32,14 @@ export class HitBaseView<Ttemplate extends HitDesignTemplate | HitTriageTemplate
29
32
 
30
33
  async deleteCampaign(appName: AppName, campaignId: string): Promise<void> {
31
34
  await _package.files.delete(`${appName}/campaigns/${campaignId}`);
35
+ delete (_package.campaignsCache[appName] as {[name: string]: unknown} | undefined)?.[campaignId];
36
+ }
37
+
38
+ /** The full campaign-deletion flow the UI and the AI share: delete the files,
39
+ * hide the campaign from the cached list, and rebuild the view. */
40
+ async deleteCampaignAndRefresh(appName: AppName, campaignId: string): Promise<void> {
41
+ await this.deleteCampaign(appName, campaignId);
42
+ this.deletedCampaigns.push(campaignId);
43
+ await this.init?.();
32
44
  }
33
45
  }
@@ -16,6 +16,7 @@ export abstract class HitAppBase<T> {
16
16
  public computeFunctions: ComputeFunctions;
17
17
  public isJoining = false;
18
18
  protected hasEditPermission = false;
19
+ public get canEdit(): boolean {return this.hasEditPermission;}
19
20
  private _appName: AppName;
20
21
  public get appName(): AppName {return this._appName;}
21
22
  public static molFileExtReaders: { ext: string; handlerFunc: DG.Func }[] = ['sdf', 'mol', 'smi', 'mol2']
@@ -25,6 +25,7 @@ import * as api from '../package-api';
25
25
  import {registerMol} from './utils/molreg';
26
26
  import {autoMergeOnCampaignOpen, mergeIntoCampaign} from './utils/merge-table';
27
27
  import {openMergeTableDialog} from './dialogs/merge-table-dialog';
28
+ import {attachHitInfoAi, attachHitCampaignAi} from './ai/view-functions';
28
29
 
29
30
  export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> extends HitAppBase<T> {
30
31
  multiView: DG.MultiView;
@@ -32,6 +33,7 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
32
33
  get infoView(): HitDesignInfoView {return this._infoView;}
33
34
  protected _designView?: DG.TableView;
34
35
  public _submitView?: HitDesignSubmitView;
36
+ get submitView(): HitDesignSubmitView | undefined {return this._submitView;}
35
37
  protected _designViewName = 'Design';
36
38
  protected _filePath = `System.AppData/HitTriage/${this.appName}/campaigns`;
37
39
  protected _campaignId?: string;
@@ -54,6 +56,7 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
54
56
  }));
55
57
 
56
58
  this.multiView.parentCall = c;
59
+ attachHitInfoAi(this.multiView, this);
57
60
 
58
61
  this.mainView = this.multiView;
59
62
  this._initViewSubs();
@@ -388,7 +391,11 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
388
391
 
389
392
  get campaignId(): string | undefined {return this._campaignId;}
390
393
 
391
- get designView(): DG.TableView {return this._designView = this.getDesignView();}
394
+ get designView(): DG.TableView {
395
+ const view = this.getDesignView();
396
+ attachHitCampaignAi(view, this, 'design');
397
+ return this._designView = view;
398
+ }
392
399
 
393
400
  get designViewName(): string {return this._designViewName;}
394
401
 
@@ -20,6 +20,7 @@ import {newHitDesignCampaignAccordeon} from '../accordeons/new-hit-design-campai
20
20
  import {newHitDesignTemplateAccordeon} from '../accordeons/new-hit-design-template-accordeon';
21
21
  import {HitBaseView} from '../base-view';
22
22
  import {defaultPermissions, PermissionsDialog} from '../dialogs/permissions-dialog';
23
+ import {hitInfoAiDescription} from '../ai/view-functions';
23
24
 
24
25
  export class HitDesignInfoView
25
26
  <T extends HitDesignTemplate = HitDesignTemplate, K extends HitDesignApp = HitDesignApp>
@@ -30,6 +31,8 @@ export class HitDesignInfoView
30
31
  constructor(app: K) {
31
32
  super(app);
32
33
  this.name = 'Hit Design';
34
+ // TODO: Remove before api release
35
+ (this as any).aiDescription = hitInfoAiDescription(app.appName);
33
36
  this._appHeader = this.getAppHeader();
34
37
  this.root.appendChild(ui.div([this._appHeader], {style: {marginLeft: '10px'}}));
35
38
  this.root.appendChild(this._contentRoot);
@@ -307,9 +310,7 @@ export class HitDesignInfoView
307
310
  ui.dialog('Delete campaign')
308
311
  .add(ui.divText(`Are you sure you want to delete campaign ${info.name}?`))
309
312
  .onOK(async () => {
310
- await this.deleteCampaign(this.app.appName, info.name);
311
- this.deletedCampaigns.push(info.name);
312
- await this.init();
313
+ await this.deleteCampaignAndRefresh(this.app.appName, info.name);
313
314
  })
314
315
  .show();
315
316
  }, 'Delete campaign');
@@ -48,6 +48,13 @@ export class HitDesignSubmitView extends HitBaseView<HitDesignTemplate, HitDesig
48
48
  return this.statusInput.value ?? this.app.campaign?.status ?? 'No Status';
49
49
  }
50
50
 
51
+ /** Programmatic submit (used by the AI view functions): seeds the status the same
52
+ * way the dialog does, then runs the regular submit flow. */
53
+ public async submitWithStatus(status?: string): Promise<boolean> {
54
+ this.statusInput.value = status?.trim() ? status.trim() : (this.app.campaign?.status ?? 'Submitted');
55
+ return await this.submit();
56
+ }
57
+
51
58
  render() {
52
59
  this.statusInput.value = this.app.campaign?.status ?? '';
53
60
  ui.empty(this.content);
@@ -106,22 +113,24 @@ export class HitDesignSubmitView extends HitBaseView<HitDesignTemplate, HitDesig
106
113
  onActivated(): void {
107
114
  }
108
115
 
109
- async submit(): Promise<any> {
116
+ /** Resolves to whether the submit function ran and the campaign was saved. */
117
+ async submit(): Promise<boolean> {
110
118
  const submitParams= this.app.submitParams;
111
119
  if (!submitParams) {
112
120
  grok.shell.error('No submit function selected. Please select a function to submit the campaign.');
113
- return;
121
+ return false;
114
122
  }
115
123
 
116
124
  const submitFn = DG.Func.find({name: submitParams.fName, package: submitParams.package})[0];
117
125
  if (!submitFn) {
118
126
  grok.shell.error(`Function ${submitParams.fName} not found.`);
119
- return;
127
+ return false;
120
128
  }
121
129
  const filteredDf = DG.DataFrame.fromCsv(this.app.dataFrame!.toCsv({filteredRowsOnly: true}));
122
130
  await submitFn.apply({df: filteredDf, molecules: this.app.molColName});
123
131
  this.app.campaign!.status = this.getStatus();
124
- this.app.saveCampaign();
132
+ await this.app.saveCampaign();
125
133
  grok.shell.info('Submitted successfully.');
134
+ return true;
126
135
  }
127
136
  }
@@ -16,6 +16,7 @@ import {HitBaseView} from './base-view';
16
16
  import {saveCampaignDialog} from './dialogs/save-campaign-dialog';
17
17
  import {calculateColumns} from './utils/calculate-single-cell';
18
18
  import {defaultPermissions, PermissionsDialog} from './dialogs/permissions-dialog';
19
+ import {attachHitInfoAi, attachHitCampaignAi} from './ai/view-functions';
19
20
  // @ts-ignore
20
21
  import '../../css/hit-triage.css';
21
22
 
@@ -26,6 +27,7 @@ export class HitTriageApp extends HitAppBase<HitTriageTemplate> {
26
27
  get infoView(): InfoView {return this._infoView;}
27
28
  private _pickView?: DG.TableView;
28
29
  private _submitView?: SubmitView;
30
+ get submitView(): SubmitView | undefined {return this._submitView;}
29
31
 
30
32
  private _filterViewName = 'Hit Triage | Pick';
31
33
  private _friendlyName?: string;
@@ -51,6 +53,7 @@ export class HitTriageApp extends HitAppBase<HitTriageTemplate> {
51
53
  (this.multiView.currentView as HitBaseView<HitTriageTemplate, HitTriageApp>).onActivated();
52
54
  });
53
55
  this.multiView.parentCall = c;
56
+ attachHitInfoAi(this.multiView, this);
54
57
  //grok.shell.addView(this.multiView);
55
58
 
56
59
  grok.events.onCurrentViewChanged.subscribe(() => {
@@ -177,7 +180,11 @@ export class HitTriageApp extends HitAppBase<HitTriageTemplate> {
177
180
 
178
181
  get campaignId(): string | undefined {return this._campaignId;}
179
182
 
180
- get pickView(): DG.TableView {return this._pickView = this.getFilterView();}
183
+ get pickView(): DG.TableView {
184
+ const view = this.getFilterView();
185
+ attachHitCampaignAi(view, this, 'pick');
186
+ return this._pickView = view;
187
+ }
181
188
 
182
189
  get molColName() {return this._molColName ??= this.dataFrame?.columns.bySemType(DG.SEMTYPE.MOLECULE)?.name;}
183
190
 
@@ -21,6 +21,7 @@ import {createTemplateAccordeon} from '../accordeons/new-template-accordeon';
21
21
  import {HitBaseView} from '../base-view';
22
22
  import {u2} from '@datagrok-libraries/utils/src/u2';
23
23
  import {defaultPermissions, PermissionsDialog} from '../dialogs/permissions-dialog';
24
+ import {hitInfoAiDescription} from '../ai/view-functions';
24
25
 
25
26
  export class InfoView extends HitBaseView<HitTriageTemplate, HitTriageApp> {
26
27
  public readmePath = _package.webRoot + 'README_HT.md';
@@ -31,6 +32,8 @@ export class InfoView extends HitBaseView<HitTriageTemplate, HitTriageApp> {
31
32
  constructor(app: HitTriageApp) {
32
33
  super(app);
33
34
  this.name = 'Hit Triage';
35
+ // TODO: Remove before api release
36
+ (this as any).aiDescription = hitInfoAiDescription(app.appName);
34
37
  this._appHeader = this.getAppHeader();
35
38
  this.root.appendChild(ui.div([this._appHeader], {style: {marginLeft: '10px'}}));
36
39
  this.root.appendChild(this._contentRoot);
@@ -324,9 +327,7 @@ export class InfoView extends HitBaseView<HitTriageTemplate, HitTriageApp> {
324
327
  ui.dialog('Delete campaign')
325
328
  .add(ui.divText(`Are you sure you want to delete campaign ${info.friendlyName ?? info.name}?`))
326
329
  .onOK(async () => {
327
- await this.deleteCampaign(this.app.appName, info.name);
328
- this.deletedCampaigns.push(info.name);
329
- await this.init();
330
+ await this.deleteCampaignAndRefresh(this.app.appName, info.name);
330
331
  })
331
332
  .show();
332
333
  }, 'Delete campaign');
@@ -26,19 +26,21 @@ export class SubmitView extends HitBaseView<HitTriageTemplate, HitTriageApp> {
26
26
  this.render();
27
27
  }
28
28
 
29
- public async submit(): Promise<any> {
29
+ /** Resolves to whether the submit function ran and the campaign was saved. */
30
+ public async submit(): Promise<boolean> {
30
31
  const submitParams= this.app.submitParams;
31
32
  if (!submitParams)
32
- return;
33
+ return false;
33
34
  const submitFn = DG.Func.find({name: submitParams.fName, package: submitParams.package})[0];
34
35
  if (!submitFn) {
35
36
  grok.shell.error(`Function ${submitParams.fName} not found.`);
36
- return;
37
+ return false;
37
38
  }
38
39
  const filteredDf = DG.DataFrame.fromCsv(this.app.dataFrame!.toCsv({filteredRowsOnly: true}));
39
40
  await submitFn.apply({df: filteredDf, molecules: this.app.molColName});
40
41
  this.app.campaign && (this.app.campaign.status = 'Submitted');
41
- this.app.saveCampaign('Submitted');
42
+ await this.app.saveCampaign('Submitted');
42
43
  grok.shell.info('Submitted successfully.');
44
+ return true;
43
45
  }
44
46
  }
@@ -9,50 +9,50 @@ import * as DG from 'datagrok-api/dg';
9
9
 
10
10
  export namespace queries {
11
11
  /**
12
- Acquire a lock for a campaign. If the lock is expired, it will be removed and a new lock will be created.
13
- */
12
+ * Acquire a lock for a campaign. If the lock is expired, it will be removed and a new lock will be created.
13
+ */
14
14
  export async function acquireCampaignLock(appName: string , campaignId: string , lockedBy?: string | null): Promise<DG.DataFrame> {
15
15
  return await grok.data.query('HitTriage:AcquireCampaignLock', { appName, campaignId, lockedBy });
16
16
  }
17
17
 
18
18
  /**
19
- Release a lock for a campaign.
20
- */
19
+ * Release a lock for a campaign.
20
+ */
21
21
  export async function releaseCampaignLock(appName: string , campaignId: string ): Promise<DG.DataFrame> {
22
22
  return await grok.data.query('HitTriage:ReleaseCampaignLock', { appName, campaignId });
23
23
  }
24
24
 
25
25
  /**
26
- Get the last modified time of a campaign lock release (same as save).
27
- */
26
+ * Get the last modified time of a campaign lock release (same as save).
27
+ */
28
28
  export async function getLastModified(appName: string , campaignId: string ): Promise<DG.DataFrame> {
29
29
  return await grok.data.query('HitTriage:GetLastModified', { appName, campaignId });
30
30
  }
31
31
 
32
32
  /**
33
- Add a molecule to the dictionary. Returns VID for new or existing molecule.
34
- */
33
+ * Add a molecule to the dictionary. Returns VID for new or existing molecule.
34
+ */
35
35
  export async function addMolecule(canonicalSmiles: string , appName: string , campaignId: string , createdBy: string ): Promise<DG.DataFrame> {
36
36
  return await grok.data.query('HitTriage:AddMolecule', { canonicalSmiles, appName, campaignId, createdBy });
37
37
  }
38
38
 
39
39
  /**
40
- Add multiple molecules to the dictionary. Returns VIDs for new or existing molecules.
41
- */
40
+ * Add multiple molecules to the dictionary. Returns VIDs for new or existing molecules.
41
+ */
42
42
  export async function addMolecules(smiles: any , appName: string , campaignId: string , createdBy: string ): Promise<DG.DataFrame> {
43
43
  return await grok.data.query('HitTriage:AddMolecules', { smiles, appName, campaignId, createdBy });
44
44
  }
45
45
 
46
46
  /**
47
- Get a molecule's canonical SMILES by its VID.
48
- */
47
+ * Get a molecule's canonical SMILES by its VID.
48
+ */
49
49
  export async function getMoleculeByVid(vid: string ): Promise<DG.DataFrame> {
50
50
  return await grok.data.query('HitTriage:GetMoleculeByVid', { vid });
51
51
  }
52
52
 
53
53
  /**
54
- Get all campaigns and creators for a given VID.
55
- */
54
+ * Get all campaigns and creators for a given VID.
55
+ */
56
56
  export async function getCampaignsByVid(vid: string , appName?: string | null): Promise<DG.DataFrame> {
57
57
  return await grok.data.query('HitTriage:GetCampaignsByVid', { vid, appName });
58
58
  }
@@ -103,6 +103,9 @@ export namespace funcs {
103
103
  return await grok.functions.call('HitTriage:DemoFileIngest1', {});
104
104
  }
105
105
 
106
+ /**
107
+ * @param {number} numberOfMolecules - Molecules counts
108
+ */
106
109
  export async function demoFileIngest2(numberOfMolecules: number ): Promise<DG.DataFrame> {
107
110
  return await grok.functions.call('HitTriage:DemoFileIngest2', { numberOfMolecules });
108
111
  }
@@ -111,6 +114,10 @@ export namespace funcs {
111
114
  return await grok.functions.call('HitTriage:DemoPeptideSequences', { peptideCount });
112
115
  }
113
116
 
117
+ /**
118
+ * @param {DG.DataFrame} df - Dataframe
119
+ * @param {string} molecules - Molecules column name
120
+ */
114
121
  export async function demoFileSubmit(df: DG.DataFrame , molecules: string ): Promise<void> {
115
122
  return await grok.functions.call('HitTriage:DemoFileSubmit', { df, molecules });
116
123
  }
@@ -119,6 +126,10 @@ export namespace funcs {
119
126
  return await grok.functions.call('HitTriage:RegisterMoleculesToViD', {});
120
127
  }
121
128
 
129
+ /**
130
+ * @param {any} vid
131
+ * semType: HIT_DESIGN_VID
132
+ */
122
133
  export async function hitDesignVidPanel(vid: any ): Promise<any> {
123
134
  return await grok.functions.call('HitTriage:HitDesignVidPanel', { vid });
124
135
  }
package/src/package.ts CHANGED
@@ -134,7 +134,11 @@ async function hitAppTB(treeNode: DG.TreeViewGroup, name: AppName) {
134
134
  export class PackageFunctions {
135
135
  @grok.decorators.init()
136
136
  static async initHT() {
137
- await grok.functions.call('Chem:init', {});
137
+ try {
138
+ await grok.functions.call('Chem:init', {});
139
+ } catch (e) {
140
+ console.error('error initializing chem package', e);
141
+ }
138
142
  }
139
143
  @grok.decorators.treeBrowser({meta: {app: 'Hit Triage'}})
140
144
  static async hitTriageAppTreeBrowser(treeNode: DG.TreeViewGroup) {
@@ -32,18 +32,12 @@ export async function parseUserGroupString(s: string | null) {
32
32
 
33
33
  export async function getDefaultSharingSettings(): Promise<HTDefaultCampaignSharing> {
34
34
  try {
35
- const ps = (_package.settings ?? await _package.getSettings()) as unknown as Map<string, any> | Record<string, any>;
35
+ const ps = _package.settings;
36
36
  const settings: HTDefaultCampaignSharing = {view: [], edit: []};
37
37
  if (!ps)
38
38
  return settings;
39
- // this hack is needed because api says it will return Map, but it actually returns object...
40
- if (ps instanceof Map) {
41
- settings.view = await parseUserGroupString(ps.get('view') ?? '');
42
- settings.edit = await parseUserGroupString(ps.get('edit') ?? '');
43
- } else {
44
- settings.view = await parseUserGroupString(ps.view ?? '');
45
- settings.edit = await parseUserGroupString(ps.edit ?? '');
46
- }
39
+ settings.view = await parseUserGroupString(ps.view ?? '');
40
+ settings.edit = await parseUserGroupString(ps.edit ?? '');
47
41
  return settings;
48
42
  } catch (e) {
49
43
  console.error(e);
@@ -52,10 +46,10 @@ export async function getDefaultSharingSettings(): Promise<HTDefaultCampaignShar
52
46
  }
53
47
 
54
48
  export async function getDefaultCampaignStorageSettings(): Promise<string> {
55
- const ps = (_package.settings ?? await _package.getSettings()) as unknown as Map<string, any> | Record<string, any>;
49
+ const ps = _package.settings;
56
50
  if (!ps)
57
51
  return defaultCampaignStorage;
58
- const res = (ps instanceof Map ? ps.get(defaultCampaignStoragePropName) : ps[defaultCampaignStoragePropName]) ?? defaultCampaignStorage;
52
+ const res = ps[defaultCampaignStoragePropName] ?? defaultCampaignStorage;
59
53
  // check if it exists
60
54
  if (!(await grok.dapi.files.exists(res)))
61
55
  return defaultCampaignStorage;
package/tsconfig.json CHANGED
@@ -1,71 +1,6 @@
1
1
  {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
-
5
- /* Basic Options */
6
- // "incremental": true, /* Enable incremental compilation */
7
- "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8
- "module": "es2020", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
9
- "lib": ["ES2022", "dom"], /* Specify library files to be included in the compilation. */
10
- // "allowJs": true, /* Allow javascript files to be compiled. */
11
- // "checkJs": true, /* Report errors in .js files. */
12
- // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
13
- // "declaration": true, /* Generates corresponding '.d.ts' file. */
14
- // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15
- "sourceMap": true, /* Generates corresponding '.map' file. */
16
- // "outFile": "./", /* Concatenate and emit output to single file. */
17
- // "outDir": "./", /* Redirect output structure to the directory. */
18
- // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
19
- // "composite": true, /* Enable project compilation */
20
- // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
21
- // "removeComments": true, /* Do not emit comments to output. */
22
- // "noEmit": true, /* Do not emit outputs. */
23
- // "importHelpers": true, /* Import emit helpers from 'tslib'. */
24
- // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
25
- // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
26
-
27
- /* Strict Type-Checking Options */
28
- "strict": true, /* Enable all strict type-checking options. */
29
- // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
30
- // "strictNullChecks": true, /* Enable strict null checks. */
31
- // "strictFunctionTypes": true, /* Enable strict checking of function types. */
32
- // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
33
- // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
34
- // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
35
- // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
36
-
37
- /* Additional Checks */
38
- // "noUnusedLocals": true, /* Report errors on unused locals. */
39
- // "noUnusedParameters": true, /* Report errors on unused parameters. */
40
- // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
41
- // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
42
- // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
43
- // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
44
-
45
- /* Module Resolution Options */
46
- "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
47
- // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
48
- // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
49
- // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
50
- // "typeRoots": [], /* List of folders to include type definitions from. */
51
- // "types": [], /* Type declaration files to be included in compilation. */
52
- // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
53
- "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
54
- // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
55
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
56
-
57
- /* Source Map Options */
58
- // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
59
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
60
- // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
61
- // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
62
-
63
- /* Experimental Options */
64
- "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
65
- "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
66
-
67
- /* Advanced Options */
68
- "skipLibCheck": true, /* Skip type checking of declaration files. */
69
- "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
70
- }
2
+ "extends": "@datagrok/build-config/tsconfig.base.json",
3
+ "include": [
4
+ "src"
5
+ ]
71
6
  }
package/webpack.config.js CHANGED
@@ -1,46 +1,3 @@
1
- const path = require('path');
2
- const packageName = path.parse(require('./package.json').name).name.toLowerCase().replace(/-/g, '');
3
- const FuncGeneratorPlugin = require('datagrok-tools/plugins/func-gen-plugin');
4
-
5
- module.exports = {
6
- cache: {
7
- type: 'filesystem',
8
- },
9
- mode: 'production',
10
- entry: {
11
- package: './src/package.ts',
12
- test: {
13
- filename: 'package-test.js',
14
- library: {type: 'var', name: `${packageName}_test`},
15
- import: './src/package-test.ts',
16
- },
17
- },
18
- resolve: {
19
- extensions: ['.wasm', '.mjs', '.ts', '.json', '.tsx', '.js'],
20
- },
21
- module: {
22
- rules: [
23
- {test: /\.js$/, enforce: 'pre', use: ['source-map-loader'], exclude: /node_modules/},
24
- {test: /\.ts(x?)$/, use: {loader: 'ts-loader', options: {allowTsInNodeModules: true}}},
25
- {test: /\.css$/, use: ['style-loader', 'css-loader']},
26
- ],
27
- },
28
- devtool: 'source-map',
29
- externals: {
30
- 'datagrok-api/dg': 'DG',
31
- 'datagrok-api/grok': 'grok',
32
- 'datagrok-api/ui': 'ui',
33
- 'openchemlib/full.js': 'OCL',
34
- 'rxjs': 'rxjs',
35
- 'rxjs/operators': 'rxjs.operators',
36
- },
37
- output: {
38
- filename: '[name].js',
39
- library: 'hittriage',
40
- libraryTarget: 'var',
41
- path: path.resolve(__dirname, 'dist'),
42
- },
43
- plugins: [
44
- new FuncGeneratorPlugin({outputPath: './src/package.g.ts'}),
45
- ],
46
- };
1
+ // Generated at npm publish for servers before 1.28.0, which detect a bundled
2
+ // package by this file. The bundle itself is built by @datagrok/build-config.
3
+ module.exports = {};
package/.eslintignore DELETED
@@ -1 +0,0 @@
1
- src/**/*.d.ts*
package/.eslintrc.json DELETED
@@ -1,45 +0,0 @@
1
- {
2
- "env": {
3
- "browser": true,
4
- "es2022": true
5
- },
6
- "extends": [
7
- "google"
8
- ],
9
- "parser": "@typescript-eslint/parser",
10
- "parserOptions": {
11
- "ecmaVersion": 12,
12
- "sourceType": "module"
13
- },
14
- "plugins": [
15
- "@typescript-eslint"
16
- ],
17
- "rules": {
18
- "no-unused-vars": "off",
19
- "@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^(_|ui$|grok$|DG$)", "argsIgnorePattern": "^_"}],
20
- "indent": [
21
- "error",
22
- 2
23
- ],
24
- "max-len": [
25
- "error",
26
- 120
27
- ],
28
- "require-jsdoc": "off",
29
- "valid-jsdoc": "off",
30
- "spaced-comment": "off",
31
- "linebreak-style": "off",
32
- "curly": [
33
- "error",
34
- "multi-or-nest"
35
- ],
36
- "brace-style": [
37
- "error",
38
- "1tbs",
39
- {
40
- "allowSingleLine": true
41
- }
42
- ],
43
- "block-spacing": 2
44
- }
45
- }