(directoryPath, isValidFile)
| 4019 | return cond[0] || '1'; |
| 4020 | } |
| 4021 | if (tok.kind === 'license') { |
| 4022 | const cond = []; |
| 4023 | pushEqualityListCondition(cond, params, 'license', tok.values.slice(), combine, !!filters.licenseInverted, false); |
| 4024 | return cond[0] || '1'; |
| 4025 | } |
| 4026 | if (tok.kind === 'parentModel') { |
| 4027 | const cond = []; |
| 4028 | pushEqualityListCondition(cond, params, 'parentModel', tok.values.slice(), combine, !!filters.parentModelInverted, false); |
| 4029 | return cond[0] || '1'; |
| 4030 | } |
| 4031 | if (tok.kind === 'tag') { |
| 4032 | const names = tok.values.slice(); |
| 4033 | const f = { |
| 4034 | tags: names, |
| 4035 | tagCombine: combine, |
| 4036 | tagInverted: !!filters.tagInverted, |
| 4037 | }; |
| 4038 | const cond = []; |
| 4039 | pushTagListSQL(cond, params, f); |
| 4040 | return cond[0] || '1'; |
| 4041 | } |
| 4042 | return null; |
| 4043 | } |
| 4044 | if (tok.t !== 'filter') return null; |
| 4045 | if (tok.kind === 'designer' || tok.kind === 'license' || tok.kind === 'parentModel') { |
| 4046 | const cond = []; |
| 4047 | const col = tok.kind === 'designer' ? 'designer' : tok.kind === 'license' ? 'license' : 'parentModel'; |
| 4048 | const inverted = !!(tok.kind === 'designer' ? filters.designerInverted : tok.kind === 'license' ? filters.licenseInverted : filters.parentModelInverted); |
| 4049 | const useLowerTrim = tok.kind === 'designer'; |
| 4050 | pushEqualityListCondition(cond, params, col, [tok.value], 'OR', inverted, useLowerTrim); |
| 4051 | return cond[0] || '1'; |
| 4052 | } |
| 4053 | if (tok.kind === 'tag') { |
| 4054 | const f = { tags: [tok.value], tagCombine: 'OR', tagInverted: !!filters.tagInverted }; |
| 4055 | const cond = []; |
| 4056 | pushTagListSQL(cond, params, f); |
| 4057 | return cond[0] || '1'; |
| 4058 | } |
| 4059 | if (tok.kind === 'fileType') { |
| 4060 | const ftVal = tok.value; |
| 4061 | if (!ftVal) return null; |
| 4062 | if (ftVal.toLowerCase() === 'zip') { |
| 4063 | params.push('%::%'); |
| 4064 | return '(filePath LIKE ?)'; |
| 4065 | } |
| 4066 | const exts = getExtensionsForFileTypeFilter(ftVal); |
| 4067 | if (!exts || exts.length === 0) { |
| 4068 | params.push(`%.${String(ftVal).toLowerCase()}`); |
| 4069 | return '(LOWER(fileName) LIKE ?)'; |
| 4070 | } |
| 4071 | if (exts.length === 1) { |
| 4072 | params.push(`%${exts[0]}`); |
| 4073 | return '(LOWER(fileName) LIKE ?)'; |
| 4074 | } |
| 4075 | const ph = exts.map(() => 'LOWER(fileName) LIKE ?').join(' OR '); |
| 4076 | params.push(...exts.map(ext => `%${ext}`)); |
| 4077 | return `(${ph})`; |
| 4078 | } |
nothing calls this directly
no test coverage detected