@datagrok/hit-triage 1.10.3 → 1.10.5

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/hit-triage",
3
3
  "friendlyName": "Hit Triage",
4
- "version": "1.10.3",
4
+ "version": "1.10.5",
5
5
  "author": {
6
6
  "name": "Davit Rizhinashvili",
7
7
  "email": "drizhinashvili@datagrok.ai"
@@ -16,8 +16,10 @@
16
16
  "directory": "packages/HitTriage"
17
17
  },
18
18
  "dependencies": {
19
+ "@datagrok-libraries/bio": "^5.63.6",
19
20
  "@datagrok-libraries/compute-utils": "^1.44.9",
20
21
  "@datagrok-libraries/statistics": "^1.12.4",
22
+ "@datagrok-libraries/test": "^1.1.0",
21
23
  "@datagrok-libraries/utils": "^4.6.5",
22
24
  "cash-dom": "^8.1.5",
23
25
  "css-loader": "^6.5.1",
@@ -28,9 +30,7 @@
28
30
  "ts-loader": "^9.5.1",
29
31
  "typeahead-standalone": "4.14.1",
30
32
  "typescript": "^5.6.3",
31
- "uuid": "^9.0.0",
32
- "@datagrok-libraries/test": "^1.1.0",
33
- "@datagrok-libraries/bio": "^5.63.6"
33
+ "uuid": "^11.1.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/uuid": "^9.0.2",
@@ -99,6 +99,7 @@
99
99
  "sok": "HD_OBSFUS__k7#mP9@zL2$qR5!nX8"
100
100
  },
101
101
  "overrides": {
102
- "datagrok-api": "$datagrok-api"
102
+ "datagrok-api": "$datagrok-api",
103
+ "uuid": "^11.1.1"
103
104
  }
104
105
  }
package/queries/vid.sql CHANGED
@@ -1,10 +1,11 @@
1
1
  --name: addMolecule
2
+ --friendlyName: Add Molecule
2
3
  --description: Add a molecule to the dictionary. Returns VID for new or existing molecule.
3
4
  --connection: HitTriage:hitdesign
4
- --input: string canonicalSmiles
5
- --input: string appName
6
- --input: string campaignId
7
- --input: string createdBy
5
+ --input: string canonicalSmiles [Canonical SMILES of the molecule to register]
6
+ --input: string appName [Application the campaign belongs to]
7
+ --input: string campaignId [Campaign the molecule is added to]
8
+ --input: string createdBy [User registering the molecule]
8
9
  WITH existing AS (
9
10
  SELECT vid FROM hitdesign.vid_dictionary WHERE mh_string = @canonicalSmiles
10
11
  ),
@@ -26,12 +27,13 @@ SELECT vid FROM all_vids;
26
27
  --end
27
28
 
28
29
  --name: addMolecules
30
+ --friendlyName: Add Molecules
29
31
  --description: Add multiple molecules to the dictionary. Returns VIDs for new or existing molecules.
30
32
  --connection: HitTriage:hitdesign
31
- --input: list<string> smiles
32
- --input: string appName
33
- --input: string campaignId
34
- --input: string createdBy
33
+ --input: list<string> smiles [Canonical SMILES of the molecules to register]
34
+ --input: string appName [Application the campaign belongs to]
35
+ --input: string campaignId [Campaign the molecules are added to]
36
+ --input: string createdBy [User registering the molecules]
35
37
  WITH input_order AS (
36
38
  SELECT s AS mh_string, ROW_NUMBER() OVER () AS ord
37
39
  FROM UNNEST(@smiles) AS s
@@ -69,19 +71,21 @@ ORDER BY i.ord;
69
71
  --end
70
72
 
71
73
  --name: getMoleculeByVid
74
+ --friendlyName: Get Molecule by VID
72
75
  --description: Get a molecule's canonical SMILES by its VID.
73
76
  --connection: HitTriage:hitdesign
74
- --input: string vid
77
+ --input: string vid [Virtual ID (e.g. V000001) to look up]
75
78
  SELECT mh_string
76
79
  FROM hitdesign.vid_dictionary
77
80
  WHERE vid = @vid;
78
81
  --end
79
82
 
80
83
  --name: getCampaignsByVid
84
+ --friendlyName: Get Campaigns by VID
81
85
  --description: Get all campaigns and creators for a given VID.
82
86
  --connection: HitTriage:hitdesign
83
- --input: string vid
84
- --input: string appName {optional: true; nullable: true;}
87
+ --input: string vid [Virtual ID (e.g. V000001) to look up]
88
+ --input: string appName {optional: true; nullable: true;} [Restrict results to this application]
85
89
  SELECT campaign_id, created_by, app_name
86
90
  FROM hitdesign.campaign_vids
87
91
  WHERE
package/src/app/utils.ts CHANGED
@@ -186,24 +186,28 @@ export async function loadCampaigns<T extends AppName>(
186
186
  }
187
187
 
188
188
  async function checkPermissions(authorId: string, groupIdList: string[]): Promise<boolean> {
189
- const userId = DG.User.current().id;
190
- const userGroupId = DG.User.current().group?.id;
191
- if (authorId === userId)
192
- return true;
193
- for (const groupId of groupIdList) {
194
- const group = await grok.dapi.groups.find(groupId);
195
- if (!group)
196
- continue;
197
- if (group.personal) {
198
- const user = await grok.dapi.groups.getUser(group);
199
- if (user?.id === userId)
200
- return true;
201
- } else if (userGroupId) {
202
- if ((group.members?.length ?? 0) > 0 && group.members.some((memberGroup) => memberGroup.id === userGroupId))
203
- return true;
204
- if ((group.adminMembers?.length ?? 0) > 0 && group.adminMembers.some((memberGroup) => memberGroup.id === userGroupId))
205
- return true;
189
+ try {
190
+ const userId = DG.User.current().id;
191
+ const userGroupId = DG.User.current().group?.id;
192
+ if (authorId === userId)
193
+ return true;
194
+ for (const groupId of groupIdList) {
195
+ const group = await grok.dapi.groups.find(groupId);
196
+ if (!group)
197
+ continue;
198
+ if (group.personal) {
199
+ const user = await grok.dapi.groups.getUser(group);
200
+ if (user?.id === userId)
201
+ return true;
202
+ } else if (userGroupId) {
203
+ if ((group.members?.length ?? 0) > 0 && group.members.some((memberGroup) => memberGroup?.id === userGroupId))
204
+ return true;
205
+ if ((group.adminMembers?.length ?? 0) > 0 && group.adminMembers.some((memberGroup) => memberGroup?.id === userGroupId))
206
+ return true;
207
+ }
206
208
  }
209
+ } catch (e) {
210
+ _package.logger.error(e);
207
211
  }
208
212
  return false;
209
213
  }
@@ -1,10 +1,6 @@
1
1
  import * as DG from 'datagrok-api/dg';
2
2
  import * as grok from 'datagrok-api/grok';
3
3
 
4
- // Do not import anything from JsDrawLite or HelmWebEditor, only to the main Helm package
5
- // import {JSDraw2ModuleType} from '@datagrok/js-draw-lite/src/types/jsdraw2';
6
- // import {HelmType, OrgHelmModuleType} from '@datagrok/helm-web-editor/src/types/org-helm';
7
-
8
4
  import {runTests, tests, TestContext, initAutoTests as initTests } from '@datagrok-libraries/test/src/test';
9
5
 
10
6
  export const _package = new DG.Package();