mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-24 18:07:17 +01:00
3e2d28f233
* fix(insights): HogQL calculation of saved legacy insights v2
This reverts commit a6314c6bb7
.
* Only use cached results in `process_query` for insight serializer
* Fix type of results
* Rename `RecalculationMode` to `ExecutionMode`
* Fix typing more
* Properly support dashboard filters
* Hacky fix for schema.py
* Don't test legacy `generate_insight_cache_key` with `query`
* Fix importing & typing
* Fix typo
* Update test_query_runner.py
* Account for property filter groups in dashboard filters
* Do return stale result in CACHE_ONLY case
* Fix `execute_hogql_query` espionage
Wow, this was a pain to figure out, only was an issue in CI, because the trigger was `TestCohort::test_creating_update_and_calculating_with_new_cohort_query` running prior to `TestInsight:: test_insight_refreshing_query` – had to use trial and error.
* Fix typing even more
* Don't require `pnpm` for `schema:build:python`
Matters in CI.
* Fix `schema:build:python`
* Fix sed usage
* Move `schema:build:python` to a bash script
* Validate cache properly
Clarifies the `cached_response.is_cached = True` situation.
* Fix Python formatting
* Update UI snapshots for `webkit` (2)
* Add test to ensure /query/ and /inisghts/ use the same cache
* Update mypy-baseline.txt
---------
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
29 lines
911 B
JavaScript
29 lines
911 B
JavaScript
#!/usr/bin/env node
|
|
|
|
// replaces ts-json-schema-generator -f tsconfig.json --path 'frontend/src/queries/schema.ts' --no-type-check > frontend/src/queries/schema.json
|
|
|
|
import fs from 'fs'
|
|
import stableStringify from 'safe-stable-stringify'
|
|
import tsj from 'ts-json-schema-generator'
|
|
|
|
/** @type {import('ts-json-schema-generator/dist/src/Config').Config} */
|
|
const config = {
|
|
...tsj.DEFAULT_CONFIG,
|
|
path: 'frontend/src/queries/schema.ts',
|
|
tsconfig: 'tsconfig.json',
|
|
discriminatorType: 'open-api',
|
|
skipTypeCheck: true,
|
|
}
|
|
|
|
const output_path = 'frontend/src/queries/schema.json'
|
|
|
|
const schema = tsj.createGenerator(config).createSchema(config.type)
|
|
const stringify = config.sortProps ? stableStringify : JSON.stringify
|
|
const schemaString = config.minify ? stringify(schema) : stringify(schema, null, 2)
|
|
|
|
fs.writeFile(output_path, schemaString, (err) => {
|
|
if (err) {
|
|
throw err
|
|
}
|
|
})
|