(id, user, {
noSource,
skipParsing,
filters,
isExport,
getCache,
cacheOnly = false,
variables,
skipSave,
runtimeOnly = false,
traceContext,
finalizeRun = true,
})
| 361 | } |
| 362 | |
| 363 | updateChartData(id, user, { |
| 364 | noSource, |
| 365 | skipParsing, |
| 366 | filters, |
| 367 | isExport, |
| 368 | getCache, |
| 369 | cacheOnly = false, |
| 370 | variables, |
| 371 | skipSave, |
| 372 | runtimeOnly = false, |
| 373 | traceContext, |
| 374 | finalizeRun = true, |
| 375 | }) { |
| 376 | let gChart; |
| 377 | let gCache; |
| 378 | let gChartData; |
| 379 | let skipCache = false; |
| 380 | let project; |
| 381 | let runtimeContext; |
| 382 | let effectiveFilters = Array.isArray(filters) ? filters : []; |
| 383 | let effectiveVariables = variables || {}; |
| 384 | const chartTraceContext = traceContext || null; |
| 385 | const shouldFinalizeAuditRun = Boolean(chartTraceContext) && finalizeRun !== false; |
| 386 | let chartPersistEvent; |
| 387 | let effectiveNoSource = noSource; |
| 388 | let effectiveSkipParsing = skipParsing; |
| 389 | let effectiveGetCache = getCache; |
| 390 | const requestedGetCache = Boolean(getCache); |
| 391 | const shouldReadRuntimeCache = requestedGetCache; |
| 392 | let runtimeChartCacheEntry; |
| 393 | let runtimeChartCacheParams; |
| 394 | let runtimeChartVersion; |
| 395 | let runtimeViewerScope = user ? "authenticated" : "anonymous"; |
| 396 | |
| 397 | return this.findById(id) |
| 398 | .then(async (chart) => { |
| 399 | gChart = chart; |
| 400 | if (!chart || !chart.ChartDatasetConfigs || chart.ChartDatasetConfigs.length === 0) { |
| 401 | return new Promise((_resolve, reject) => reject(toAuditError("The chart doesn't have any datasets"))); |
| 402 | } |
| 403 | |
| 404 | if (chart.project_id) { |
| 405 | project = await db.Project.findByPk(chart.project_id); |
| 406 | } |
| 407 | |
| 408 | runtimeContext = buildChartRuntimeContext(chart, filters, variables, project?.timezone); |
| 409 | effectiveFilters = runtimeContext.filters; |
| 410 | effectiveVariables = runtimeContext.variables; |
| 411 | |
| 412 | runtimeCache.debugLog("chart_runtime_context", { |
| 413 | chartId: id, |
| 414 | viewerScope: runtimeViewerScope, |
| 415 | getCache: requestedGetCache, |
| 416 | isExport: Boolean(isExport), |
| 417 | hasRuntimeFilters: Boolean(runtimeContext?.hasRuntimeFilters), |
| 418 | cacheable: Boolean(runtimeContext?.cacheableChartPayload?.hasRuntimeFilters), |
| 419 | needsSourceRefresh: Boolean(runtimeContext?.needsSourceRefresh), |
| 420 | sourceVariantHash: runtimeContext?.sourceVariantHash || null, |
no test coverage detected