|
| 1 | +import type { DataSourceMeta, FilterOptions, Query, SavedQuery } from '../../engine' |
| 2 | + |
| 3 | +// Shared, static sample data so the presentational components render in |
| 4 | +// isolation without a live RPC connection to a server-side data source. |
| 5 | + |
| 6 | +export const sampleSources: DataSourceMeta[] = [ |
| 7 | + { |
| 8 | + id: 'devframe', |
| 9 | + title: 'Devframe Context', |
| 10 | + description: 'Runtime context, OS and process info, plus a playground graph.', |
| 11 | + icon: 'i-ph:cube-duotone', |
| 12 | + static: false, |
| 13 | + queries: [ |
| 14 | + { query: 'playground.requests.entries.mapEntries().value.sort(hits desc)', title: 'Top requests' }, |
| 15 | + { query: 'playground.build.modules.[sizeKb > 80].({ id, sizeKb })', title: 'Heavy modules' }, |
| 16 | + ], |
| 17 | + }, |
| 18 | + { |
| 19 | + id: 'build', |
| 20 | + title: 'Build Modules', |
| 21 | + description: 'The production module graph from the last build.', |
| 22 | + icon: 'i-ph:package-duotone', |
| 23 | + static: true, |
| 24 | + }, |
| 25 | +] |
| 26 | + |
| 27 | +/** A one-level type skeleton, as the shape panel receives from the backend. */ |
| 28 | +export const sampleSkeleton: Record<string, unknown> = { |
| 29 | + requests: 'Map(3)', |
| 30 | + middlewares: 'array', |
| 31 | + build: 'object', |
| 32 | + os: 'object', |
| 33 | + uptimeMs: 'number', |
| 34 | + startedAt: 'Date', |
| 35 | +} |
| 36 | + |
| 37 | +export const sampleFilters: Required<FilterOptions> = { |
| 38 | + excludeFunctions: true, |
| 39 | + excludeUnderscoreProps: false, |
| 40 | + excludeDollarProps: false, |
| 41 | +} |
| 42 | + |
| 43 | +export const sampleSuggested: Query[] = [ |
| 44 | + { query: 'playground.requests.size()', title: 'Request count' }, |
| 45 | + { query: 'os.({ platform, arch, release })', title: 'OS summary' }, |
| 46 | +] |
| 47 | + |
| 48 | +export const sampleSaved: SavedQuery[] = [ |
| 49 | + { |
| 50 | + id: 'heavy-modules', |
| 51 | + query: 'build.modules.[sizeKb > 80].({ id, sizeKb }).sort(sizeKb desc)', |
| 52 | + title: 'Heavy modules', |
| 53 | + description: 'Modules over 80 kB, largest first.', |
| 54 | + scope: 'project', |
| 55 | + updatedAt: Date.now() - 1000 * 60 * 12, |
| 56 | + }, |
| 57 | + { |
| 58 | + id: 'slow-requests', |
| 59 | + query: 'playground.requests.entries.mapEntries().value.[ms > 100]', |
| 60 | + title: 'Slow requests', |
| 61 | + scope: 'workspace', |
| 62 | + updatedAt: Date.now() - 1000 * 60 * 60 * 26, |
| 63 | + }, |
| 64 | +] |
0 commit comments