Skip to content

Commit 610e596

Browse files
Mitchell ShiellMitchell Shiell
Mitchell Shiell
authored and
Mitchell Shiell
committed
removed Ego logic
1 parent 110f496 commit 610e596

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+228
-295
lines changed

.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
.next
3+
build
4+
dist

.prettierrc

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"tabWidth": 2,
6+
"useTabs": false,
7+
"printWidth": 100,
8+
"bracketSpacing": true,
9+
"arrowParens": "avoid",
10+
"endOfLine": "auto",
11+
"proseWrap": "always",
12+
"embeddedLanguageFormatting": "auto",
13+
"overrides": [
14+
{
15+
"files": "*.md",
16+
"options": {
17+
"tabWidth": 2,
18+
"printWidth": 80,
19+
"proseWrap": "always",
20+
"singleQuote": false
21+
}
22+
}
23+
]
24+
}

.vscode/settings.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"editor.formatOnSave": true,
4+
"editor.codeActionsOnSave": {
5+
"source.fixAll.eslint": "always"
6+
},
7+
"[typescript]": {
8+
"editor.defaultFormatter": "esbenp.prettier-vscode"
9+
},
10+
"[typescriptreact]": {
11+
"editor.defaultFormatter": "esbenp.prettier-vscode"
12+
},
13+
"[markdown]": {
14+
"editor.defaultFormatter": "esbenp.prettier-vscode",
15+
"editor.formatOnSave": true
16+
}
17+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
1
22
/var/lib/postgresql/data
3-
1720109580
3+
1737514152
44
5432
55
/var/run/postgresql
66
*
7-
37 0
7+
12 0
88
ready
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

phaseTwo/persistentStorage/data-song-db/postmaster.pid

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
1
22
/var/lib/postgresql/data
3-
1720109585
3+
1737514154
44
5432
55
/var/run/postgresql
66
*
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (c) 2024 The Ontario Institute for Cancer Research. All rights reserved
3+
* Copyright (c) 2022 The Ontario Institute for Cancer Research. All rights reserved
44
*
55
* This program and the accompanying materials are made available under the terms of
66
* the GNU Affero General Public License v3.0. You should have received a copy of the
@@ -18,17 +18,16 @@
1818
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1919
*
2020
*/
21-
21+
import createArrangerFetcher from '@/components/utils/arrangerFetcher';
22+
import { getConfig } from '@/global/config';
2223
import { SQONType } from '@overture-stack/arranger-components/dist/DataContext/types';
2324
import SQON from '@overture-stack/sqon-builder';
2425
import { isEmpty } from 'lodash';
25-
import createArrangerFetcher from '@/components/utils/arrangerFetcher';
26-
import { getConfig } from '@/global/config';
2726

2827
const { NEXT_PUBLIC_ARRANGER_COMPOSITION_API } = getConfig();
2928

3029
export const arrangerFetcher = createArrangerFetcher({
31-
ARRANGER_API: NEXT_PUBLIC_ARRANGER_COMPOSITION_API,
30+
ARRANGER_API: NEXT_PUBLIC_ARRANGER_COMPOSITION_API,
3231
});
3332

3433
const saveSetMutation = `mutation ($sqon: JSON!) {
@@ -42,45 +41,49 @@ const saveSetMutation = `mutation ($sqon: JSON!) {
4241
}`;
4342

4443
export const saveSet = (sqon: SQONType): Promise<string> => {
45-
return arrangerFetcher({
46-
body: {
47-
query: saveSetMutation,
48-
variables: { sqon },
49-
},
50-
})
51-
.then(
52-
({
53-
data: {
54-
saveSet: { setId },
55-
},
56-
}) => {
57-
return setId;
58-
},
59-
)
60-
.catch((err: any) => {
61-
console.warn(err);
62-
Promise.reject(err);
63-
}) as Promise<string>;
44+
return arrangerFetcher({
45+
body: {
46+
query: saveSetMutation,
47+
variables: { sqon },
48+
},
49+
})
50+
.then(
51+
({
52+
data: {
53+
saveSet: { setId },
54+
},
55+
}) => {
56+
return setId;
57+
},
58+
)
59+
.catch((err: Error) => {
60+
console.warn(err);
61+
return Promise.reject(err);
62+
});
6463
};
6564

6665
// Type guard to check if SQON is not null
67-
function isSQON(sqon: SQONType | null): sqon is SQON {
68-
return sqon !== null && !isEmpty(sqon);
66+
function isSQON(sqon: SQONType | null): sqon is SQONType {
67+
return sqon !== null && !isEmpty(sqon);
6968
}
7069

7170
export function buildSqonWithObjectIds(currentSqon: SQONType, objectIds: string[]): SQONType {
72-
// Create object ID SQON only if we have IDs
73-
const objectsSqon = objectIds.length > 0
74-
? SQON.in('object_id', objectIds)
75-
: null;
71+
// Create object ID SQON only if we have IDs
72+
let objectsSqon: SQONType | null = null;
73+
if (objectIds.length > 0) {
74+
const builder = SQON.in('object_id', objectIds);
75+
objectsSqon = builder.toValue() as unknown as SQONType;
76+
}
7677

77-
// If both SQONs are valid, combine them
78-
if (isSQON(currentSqon) && isSQON(objectsSqon)) {
79-
return SQON.and([currentSqon, objectsSqon]);
80-
}
78+
// If both SQONs are valid, combine them
79+
if (isSQON(currentSqon) && isSQON(objectsSqon)) {
80+
const sqonArray = [currentSqon, objectsSqon].map((sqon) => sqon as any);
81+
const builder = SQON.and(sqonArray);
82+
return builder.toValue() as unknown as SQONType;
83+
}
8184

82-
// Return whichever SQON is valid, or null if neither is
83-
return isSQON(currentSqon) ? currentSqon :
84-
isSQON(objectsSqon) ? objectsSqon :
85-
null;
86-
}
85+
// Return whichever SQON is valid, or null if neither is
86+
if (isSQON(currentSqon)) return currentSqon;
87+
if (isSQON(objectsSqon)) return objectsSqon;
88+
return null;
89+
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (c) 2024 The Ontario Institute for Cancer Research. All rights reserved
3+
* Copyright (c) 2022 The Ontario Institute for Cancer Research. All rights reserved
44
*
55
* This program and the accompanying materials are made available under the terms of
66
* the GNU Affero General Public License v3.0. You should have received a copy of the
@@ -19,16 +19,16 @@
1919
*
2020
*/
2121

22+
import createArrangerFetcher from '@/components/utils/arrangerFetcher';
23+
import { getConfig } from '@/global/config';
2224
import { SQONType } from '@overture-stack/arranger-components/dist/DataContext/types';
2325
import SQON from '@overture-stack/sqon-builder';
2426
import { isEmpty } from 'lodash';
25-
import createArrangerFetcher from '@/components/utils/arrangerFetcher';
26-
import { getConfig } from '@/global/config';
2727

2828
const { NEXT_PUBLIC_ARRANGER_INSTRUMENT_API } = getConfig();
2929

3030
export const arrangerFetcher = createArrangerFetcher({
31-
ARRANGER_API: NEXT_PUBLIC_ARRANGER_INSTRUMENT_API,
31+
ARRANGER_API: NEXT_PUBLIC_ARRANGER_INSTRUMENT_API,
3232
});
3333

3434
const saveSetMutation = `mutation ($sqon: JSON!) {
@@ -42,45 +42,49 @@ const saveSetMutation = `mutation ($sqon: JSON!) {
4242
}`;
4343

4444
export const saveSet = (sqon: SQONType): Promise<string> => {
45-
return arrangerFetcher({
46-
body: {
47-
query: saveSetMutation,
48-
variables: { sqon },
49-
},
50-
})
51-
.then(
52-
({
53-
data: {
54-
saveSet: { setId },
55-
},
56-
}) => {
57-
return setId;
58-
},
59-
)
60-
.catch((err: any) => {
61-
console.warn(err);
62-
Promise.reject(err);
63-
}) as Promise<string>;
45+
return arrangerFetcher({
46+
body: {
47+
query: saveSetMutation,
48+
variables: { sqon },
49+
},
50+
})
51+
.then(
52+
({
53+
data: {
54+
saveSet: { setId },
55+
},
56+
}) => {
57+
return setId;
58+
},
59+
)
60+
.catch((err: Error) => {
61+
console.warn(err);
62+
return Promise.reject(err);
63+
});
6464
};
6565

6666
// Type guard to check if SQON is not null
67-
function isSQON(sqon: SQONType | null): sqon is SQON {
68-
return sqon !== null && !isEmpty(sqon);
67+
function isSQON(sqon: SQONType | null): sqon is SQONType {
68+
return sqon !== null && !isEmpty(sqon);
6969
}
7070

7171
export function buildSqonWithObjectIds(currentSqon: SQONType, objectIds: string[]): SQONType {
72-
// Create object ID SQON only if we have IDs
73-
const objectsSqon = objectIds.length > 0
74-
? SQON.in('object_id', objectIds)
75-
: null;
72+
// Create object ID SQON only if we have IDs
73+
let objectsSqon: SQONType | null = null;
74+
if (objectIds.length > 0) {
75+
const builder = SQON.in('object_id', objectIds);
76+
objectsSqon = builder.toValue() as unknown as SQONType;
77+
}
7678

77-
// If both SQONs are valid, combine them
78-
if (isSQON(currentSqon) && isSQON(objectsSqon)) {
79-
return SQON.and([currentSqon, objectsSqon]);
80-
}
79+
// If both SQONs are valid, combine them
80+
if (isSQON(currentSqon) && isSQON(objectsSqon)) {
81+
const sqonArray = [currentSqon, objectsSqon].map((sqon) => sqon as any);
82+
const builder = SQON.and(sqonArray);
83+
return builder.toValue() as unknown as SQONType;
84+
}
8185

82-
// Return whichever SQON is valid, or null if neither is
83-
return isSQON(currentSqon) ? currentSqon :
84-
isSQON(objectsSqon) ? objectsSqon :
85-
null;
86-
}
86+
// Return whichever SQON is valid, or null if neither is
87+
if (isSQON(currentSqon)) return currentSqon;
88+
if (isSQON(objectsSqon)) return objectsSqon;
89+
return null;
90+
}

0 commit comments

Comments
 (0)