-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#40] Consistent column order for MBCUSTOMQUERY #50
base: main
Are you sure you want to change the base?
Changes from 2 commits
2584826
dd8442c
6442a65
0116d8b
f728067
7df1255
d9176bc
5419935
478cc01
b7517dd
5c1b460
94c243f
773be3a
15bfb63
e29fe41
7cc7360
e68529a
ddb7a4f
99968b9
402f50d
cb1dde6
54088a3
a9d7e17
ef71cfe
64e3843
e26397d
8faf50a
821dd6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -469,7 +469,12 @@ function MBCUSTOMQUERY(events, groupBy, orderBy, limit, offset) { | |
|
||
// turn the array of objects into a flat array | ||
const objArr = results.result.rows; | ||
return objectArrayToArray(objArr); | ||
const headersPreset = Array(payload.events[0].select.length); | ||
// eslint-disable-next-line no-restricted-syntax, guard-for-in | ||
for (const s of payload.events[0].select) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that it's not a requirement that each event row is the same event, nor that it has the same aliases. Therefore, I don't think we can just use Which generates the following query: {
"events": [
{
"eventName": "Transfer",
"select": [
{
"alias": "abc",
"inputIndex": 0,
"type": "input"
},
{
"alias": "ghi",
"inputIndex": 2,
"type": "input"
}
],
"filter": {
"rule": "and",
"children": [
{
"operator": "equal",
"value": "autotoken",
"fieldType": "contract_address_label"
}
]
}
},
{
"eventName": "Mint",
"select": [
{
"alias": "def",
"inputIndex": 1,
"type": "input"
},
{
"alias": "jkl",
"inputIndex": 2,
"type": "input"
}
],
"filter": {
"rule": "and",
"children": [
{
"operator": "equal",
"value": "autotoken",
"fieldType": "contract_address_label"
}
]
}
}
]
} With the following result:
I tested this PR by merging #35 into this branch, and indeed, the output is broken: |
||
headersPreset[s.inputIndex] = s.alias; | ||
} | ||
return objectArrayToArray(objArr, headersPreset); | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could
events[0]
ever benull
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it could be null but
throw new Error()
will happen beforemultibaas-for-google-sheets/src/library/Build.js
Lines 136 to 151 in 15bfb63