(filters = [], variables = {})
| 147 | } |
| 148 | |
| 149 | function classifyRuntimePayload(filters = [], variables = {}) { |
| 150 | const normalizedPayload = buildRuntimePayload(filters, variables); |
| 151 | const sourceAffectingFilters = []; |
| 152 | const serverParseAffectingFilters = []; |
| 153 | const clientOnlyFilters = []; |
| 154 | |
| 155 | normalizedPayload.filters.forEach((filter) => { |
| 156 | if (filter.clientOnly) { |
| 157 | clientOnlyFilters.push(filter); |
| 158 | return; |
| 159 | } |
| 160 | |
| 161 | if ((filter.type === "date" && filter.startDate && filter.endDate) || filter.forceSourceRefresh) { |
| 162 | sourceAffectingFilters.push(filter); |
| 163 | return; |
| 164 | } |
| 165 | |
| 166 | serverParseAffectingFilters.push(filter); |
| 167 | }); |
| 168 | |
| 169 | const sourceAffecting = buildRuntimePayload(sourceAffectingFilters, normalizedPayload.variables); |
| 170 | const serverParseAffecting = buildRuntimePayload(serverParseAffectingFilters, {}); |
| 171 | const clientOnly = buildRuntimePayload(clientOnlyFilters, {}); |
| 172 | const cacheableChartPayload = buildRuntimePayload( |
| 173 | sourceAffecting.filters.concat(serverParseAffecting.filters), |
| 174 | sourceAffecting.variables, |
| 175 | ); |
| 176 | |
| 177 | return { |
| 178 | normalizedPayload, |
| 179 | sourceAffecting, |
| 180 | serverParseAffecting, |
| 181 | clientOnly, |
| 182 | cacheableChartPayload, |
| 183 | }; |
| 184 | } |
| 185 | |
| 186 | function createPayloadHash(payload = {}) { |
| 187 | return crypto |
no test coverage detected