Merge branch 'staging' into develop

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2025-02-21 00:24:33 +07:00
14 changed files with 167 additions and 113 deletions
+5 -2
View File
@@ -127,6 +127,9 @@ export async function getSinceRaw (
export function gqlp (params: Record<string, string | number | string[] | undefined>): string {
let result = ''
let first = true
function escape (str: string): string {
return str.replace(/"/g, '\\"')
}
for (const [k, v] of Object.entries(params)) {
if (v !== undefined) {
if (!first) {
@@ -136,9 +139,9 @@ export function gqlp (params: Record<string, string | number | string[] | undefi
if (typeof v === 'number') {
result += `${k}: ${v}`
} else if (Array.isArray(v)) {
result += `${k}: [${v.map((it) => `"${it}"`).join(', ')}]`
result += `${k}: [${v.map((it) => `"${escape(it)}"`).join(', ')}]`
} else {
result += `${k}: "${v}"`
result += `${k}: "${escape(v)}"`
}
}
}