react-autoql 8.36.1 → 8.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/autoql-index-c49fcae0.esm.js +3 -0
- package/dist/autoql-index-c49fcae0.esm.js.gz +0 -0
- package/dist/autoql-index-eaa25212.cjs.js +3 -0
- package/dist/autoql-index-eaa25212.cjs.js.gz +0 -0
- package/dist/autoql-onDemandCode-1ae64cef.cjs.js +1 -0
- package/dist/autoql-onDemandCode-1ae64cef.cjs.js.gz +0 -0
- package/dist/autoql-onDemandCode-bb20d9e6.esm.js +1 -0
- package/dist/autoql-onDemandCode-bb20d9e6.esm.js.gz +0 -0
- package/dist/autoql.cjs.js +1 -3
- package/dist/autoql.cjs.js.gz +0 -0
- package/dist/autoql.esm.css +1 -1
- package/dist/autoql.esm.css.gz +0 -0
- package/dist/autoql.esm.js +1 -3
- package/dist/autoql.esm.js.gz +0 -0
- package/package.json +8 -7
- package/src/index.d.ts +618 -2
package/dist/autoql.esm.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-autoql",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.37.0",
|
|
4
4
|
"description": "React Widget Library",
|
|
5
5
|
"main": "dist/autoql.cjs.js",
|
|
6
6
|
"module": "dist/autoql.esm.js",
|
|
@@ -42,11 +42,6 @@
|
|
|
42
42
|
"cz": "npx git-cz"
|
|
43
43
|
},
|
|
44
44
|
"style": "dist/autoql.esm.css",
|
|
45
|
-
"husky": {
|
|
46
|
-
"hooks": {
|
|
47
|
-
"pre-push": "cross-env NODE_OPTIONS= npx jest --clearCache && cross-env NODE_OPTIONS= npm run test"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
45
|
"lint-staged": {
|
|
51
46
|
"*.js": [
|
|
52
47
|
"npm run test:staged"
|
|
@@ -64,13 +59,14 @@
|
|
|
64
59
|
},
|
|
65
60
|
"dependencies": {
|
|
66
61
|
"@react-icons/all-files": "4.1.0",
|
|
67
|
-
"autoql-fe-utils": "1.
|
|
62
|
+
"autoql-fe-utils": "1.13.2",
|
|
68
63
|
"axios": "^1.16.0",
|
|
69
64
|
"caniuse-lite": "1.0.30001692",
|
|
70
65
|
"classnames": "2.5.1",
|
|
71
66
|
"d3-array": "2.3.3",
|
|
72
67
|
"d3-axis": "1.0.12",
|
|
73
68
|
"d3-force": "^3.0.0",
|
|
69
|
+
"d3-hierarchy": "^3.1.2",
|
|
74
70
|
"d3-sankey": "^0.12.3",
|
|
75
71
|
"d3-scale": "4.0.2",
|
|
76
72
|
"d3-selection": "3.0.0",
|
|
@@ -139,6 +135,11 @@
|
|
|
139
135
|
"@rollup/plugin-terser": "^1.0.0",
|
|
140
136
|
"@testing-library/jest-dom": "6.4.2",
|
|
141
137
|
"@testing-library/react": "12.1.2",
|
|
138
|
+
"@tiptap/core": "3.32.0",
|
|
139
|
+
"@tiptap/extensions": "3.32.0",
|
|
140
|
+
"@tiptap/markdown": "3.32.0",
|
|
141
|
+
"@tiptap/pm": "3.32.0",
|
|
142
|
+
"@tiptap/starter-kit": "3.32.0",
|
|
142
143
|
"ajv": "^8.20.0",
|
|
143
144
|
"autoprefixer": "10.4.16",
|
|
144
145
|
"axios-mock-adapter": "1.18.1",
|
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
-
import type { Authentication } from 'autoql-fe-utils'
|
|
2
|
+
import type { Authentication, PushMessageData } from 'autoql-fe-utils'
|
|
3
3
|
|
|
4
4
|
export * from 'autoql-fe-utils'
|
|
5
5
|
|
|
@@ -256,7 +256,26 @@ export interface DashboardProps {
|
|
|
256
256
|
[key: string]: any
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
export declare class Dashboard extends React.Component<DashboardProps> {
|
|
259
|
+
export declare class Dashboard extends React.Component<DashboardProps> {
|
|
260
|
+
// What the chosen tiles show now, for a report: each tile captured as "Add to Report…" captures it
|
|
261
|
+
// (QueryOutput.captureForReport). Without tileKeys, every tile in reading order.
|
|
262
|
+
captureTilesForReport(options?: {
|
|
263
|
+
tileKeys?: Array<string | number>
|
|
264
|
+
maxTableRows?: number
|
|
265
|
+
maxChartRows?: number
|
|
266
|
+
}): DashboardTileCapture[]
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// One tile's capture from Dashboard.captureTilesForReport. `result` is { ok: false, reason: 'loading' }
|
|
270
|
+
// while the tile has no finished answer on screen, and 'not-found' for a key the dashboard has no tile for.
|
|
271
|
+
export interface DashboardTileCapture {
|
|
272
|
+
tileKey: string | number
|
|
273
|
+
dashboardId?: string
|
|
274
|
+
title: string
|
|
275
|
+
query: string
|
|
276
|
+
displayType?: string
|
|
277
|
+
result: ReportCaptureResult | { ok: false; reason: 'loading' | 'not-found' }
|
|
278
|
+
}
|
|
260
279
|
|
|
261
280
|
// ─── DataMessenger ───────────────────────────────────────────────────────────
|
|
262
281
|
|
|
@@ -366,6 +385,8 @@ export interface QueryOutputProps {
|
|
|
366
385
|
}
|
|
367
386
|
|
|
368
387
|
export declare class QueryOutput extends React.Component<QueryOutputProps> {
|
|
388
|
+
// What the answer shows now, as plain JSON, for a report to keep (a report's Data block `capture`).
|
|
389
|
+
captureForReport(options?: { maxTableRows?: number; maxChartRows?: number }): ReportCaptureResult
|
|
369
390
|
changeDisplayType(displayType: string): void
|
|
370
391
|
getCurrentSupportedDisplayTypes(): string[]
|
|
371
392
|
readonly state: { displayType: string; [key: string]: any }
|
|
@@ -411,6 +432,601 @@ export interface DataExplorerProps {
|
|
|
411
432
|
|
|
412
433
|
export declare class DataExplorer extends React.Component<DataExplorerProps> {}
|
|
413
434
|
|
|
435
|
+
// ─── ReportBuilder ───────────────────────────────────────────────────────────
|
|
436
|
+
|
|
437
|
+
// A report is a template: plain, versioned JSON that says what to show, never the data itself. The
|
|
438
|
+
// builder keeps blocks and fields it doesn't know (from a newer version) through a save.
|
|
439
|
+
//
|
|
440
|
+
// ReportBuilder and Reports fetch their code (a file of its own beside the package's main one) the first time one
|
|
441
|
+
// is shown, saying they're loading meanwhile; a ref to either is null until then.
|
|
442
|
+
|
|
443
|
+
export type ReportBlockWidth = 'full' | 'half'
|
|
444
|
+
export type ReportHeadingLevel = 1 | 2 | 3
|
|
445
|
+
export type ReportTableRows = 10 | 25 | 50 | 100
|
|
446
|
+
export type ReportTypeface = 'theme' | 'archivo' | 'newsreader' | 'plex-mono'
|
|
447
|
+
|
|
448
|
+
export interface ReportTextStyle {
|
|
449
|
+
font?: Exclude<ReportTypeface, 'theme'>
|
|
450
|
+
size?: 'small' | 'normal' | 'large' | 'xlarge' | 'huge'
|
|
451
|
+
weight?: 'regular' | 'medium' | 'semibold' | 'bold'
|
|
452
|
+
color?: string
|
|
453
|
+
background?: string
|
|
454
|
+
align?: 'center' | 'right'
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export interface ReportHeadingBlock {
|
|
458
|
+
id: string
|
|
459
|
+
type: 'heading'
|
|
460
|
+
text: string
|
|
461
|
+
level: ReportHeadingLevel
|
|
462
|
+
width?: ReportBlockWidth
|
|
463
|
+
style?: ReportTextStyle
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export interface ReportTextBlock {
|
|
467
|
+
id: string
|
|
468
|
+
type: 'text'
|
|
469
|
+
// Markdown: **bold**, *italic*, ++underline++, ~~strikethrough~~, [links](https://…), lists and ### headings.
|
|
470
|
+
// A single line break is a line break, so plain text reads as typed.
|
|
471
|
+
text: string
|
|
472
|
+
width?: ReportBlockWidth
|
|
473
|
+
style?: ReportTextStyle
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
export interface ReportTileSource {
|
|
477
|
+
type: 'tile'
|
|
478
|
+
dashboardId: string
|
|
479
|
+
tileKey: string
|
|
480
|
+
// Labels for when the tile can't be found; never executed.
|
|
481
|
+
snapshot?: { dashboardName?: string; tileTitle?: string; query?: string; displayType?: string }
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
export interface ReportQuestionSource {
|
|
485
|
+
type: 'query'
|
|
486
|
+
query: string
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// What an answer showed when it was added to a report ("Add to Report…"): its data and the settings that
|
|
490
|
+
// shaped it, shaped like a dashboard tile's saved view. Made by QueryOutput.captureForReport.
|
|
491
|
+
export interface ReportCapture {
|
|
492
|
+
version: number
|
|
493
|
+
capturedAt: string
|
|
494
|
+
displayType: string
|
|
495
|
+
data: {
|
|
496
|
+
columns: Array<Record<string, any>>
|
|
497
|
+
rows: any[][]
|
|
498
|
+
count_rows: number
|
|
499
|
+
text?: string
|
|
500
|
+
query_id?: string
|
|
501
|
+
interpretation?: string
|
|
502
|
+
parsed_interpretation?: any
|
|
503
|
+
}
|
|
504
|
+
// Tables only: the columns shown, in display order (indices into `columns`), the sort shown, and the
|
|
505
|
+
// header filters as typed (optional: older captures have none).
|
|
506
|
+
table?: {
|
|
507
|
+
columnIndices?: number[]
|
|
508
|
+
sort: Array<{ name: string; sort: string }>
|
|
509
|
+
filters?: Array<{ name: string; value: string }>
|
|
510
|
+
filtered: boolean
|
|
511
|
+
}
|
|
512
|
+
config: Record<string, any>
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export type ReportCaptureResult =
|
|
516
|
+
| { ok: true; capture: ReportCapture }
|
|
517
|
+
| { ok: false; reason: 'no-data' | 'unsupported' | 'too-large'; rowCount?: number }
|
|
518
|
+
|
|
519
|
+
export interface ReportDataBlock {
|
|
520
|
+
id: string
|
|
521
|
+
type: 'data'
|
|
522
|
+
source: ReportTileSource | ReportQuestionSource | null
|
|
523
|
+
// Table rows to print; a chart shows its tile as the dashboard does.
|
|
524
|
+
rows: ReportTableRows
|
|
525
|
+
width?: ReportBlockWidth
|
|
526
|
+
// What the block shows until a run replaces it (always, while enableRunReport is off).
|
|
527
|
+
capture?: ReportCapture
|
|
528
|
+
// How it's shown, when not as captured: 'table' or a chart type its data supports ('bar', 'line', …).
|
|
529
|
+
// Chosen in the properties panel; a choice the data can't be drawn as is ignored.
|
|
530
|
+
displayType?: string
|
|
531
|
+
// A question asked in the builder (enableDataBlocks), which its Rerun button can ask again.
|
|
532
|
+
askedHere?: boolean
|
|
533
|
+
// Its chart's axes and aggregation, when chosen in the builder with the chart's own axis selectors: what
|
|
534
|
+
// QueryOutput reports (onTableConfigChange, onAggConfigChange). Kept across Rerun; set right when drawn if the
|
|
535
|
+
// data no longer fits.
|
|
536
|
+
dataConfig?: {
|
|
537
|
+
tableConfig?: Record<string, unknown>
|
|
538
|
+
pivotTableConfig?: Record<string, unknown>
|
|
539
|
+
columnOverrides?: Record<string, unknown>
|
|
540
|
+
}
|
|
541
|
+
aggConfig?: Record<string, string>
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export interface ReportPageBreakBlock {
|
|
545
|
+
id: string
|
|
546
|
+
type: 'pagebreak'
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// Auto Analyze's wording about one Data block (`target`), as written — Markdown — and edited since.
|
|
550
|
+
export interface ReportAnalysisBlock {
|
|
551
|
+
id: string
|
|
552
|
+
type: 'analysis'
|
|
553
|
+
target: string | null
|
|
554
|
+
// Asked for next time it's written (Analyze again).
|
|
555
|
+
focus?: string
|
|
556
|
+
text: string
|
|
557
|
+
width?: ReportBlockWidth
|
|
558
|
+
style?: ReportTextStyle
|
|
559
|
+
// What it was written from: when, the target's capturedAt then, its title, the focus used, the rows read.
|
|
560
|
+
writtenAt?: string
|
|
561
|
+
targetAsOf?: string
|
|
562
|
+
targetTitle?: string
|
|
563
|
+
focusUsed?: string
|
|
564
|
+
rowsAnalyzed?: number
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
export type ReportBlock =
|
|
568
|
+
| ReportHeadingBlock
|
|
569
|
+
| ReportTextBlock
|
|
570
|
+
| ReportDataBlock
|
|
571
|
+
| ReportAnalysisBlock
|
|
572
|
+
| ReportPageBreakBlock
|
|
573
|
+
|
|
574
|
+
// Paper is always US Letter.
|
|
575
|
+
export interface ReportPageSetup {
|
|
576
|
+
orientation: 'portrait' | 'landscape'
|
|
577
|
+
margins: 'narrow' | 'normal' | 'wide'
|
|
578
|
+
typeface: ReportTypeface
|
|
579
|
+
header: boolean
|
|
580
|
+
footer: boolean
|
|
581
|
+
pageNumbers: boolean
|
|
582
|
+
repeatTableHeaders: boolean
|
|
583
|
+
showInterpretation: boolean
|
|
584
|
+
coverPage: boolean
|
|
585
|
+
tableOfContents: boolean
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
export interface Report {
|
|
589
|
+
schemaVersion: number
|
|
590
|
+
title: string
|
|
591
|
+
page: ReportPageSetup
|
|
592
|
+
blocks: ReportBlock[]
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
export interface ReportDashboard {
|
|
596
|
+
id: string | number
|
|
597
|
+
name?: string
|
|
598
|
+
// 'PROJECT' for a dashboard the whole project shares, as AutoQL lists it.
|
|
599
|
+
type?: string
|
|
600
|
+
tiles?: DashboardTile[]
|
|
601
|
+
slicers?: Array<{ type?: string; data: any }>
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
// A font the organisation uploaded: its name as shown, and the file as a data: URL.
|
|
605
|
+
export interface ReportBrandFont {
|
|
606
|
+
name?: string
|
|
607
|
+
url: string
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export interface ReportBranding {
|
|
611
|
+
name?: string
|
|
612
|
+
// The organisation's mark (shown before the name, which stands alone without one) and its name set as an image
|
|
613
|
+
// (it takes the place of the name); URLs, or data: URLs as uploaded.
|
|
614
|
+
logoUrl?: string
|
|
615
|
+
wordmarkUrl?: string
|
|
616
|
+
// Where the logo and wordmark sit, in each page's header and on the cover. Left by default.
|
|
617
|
+
position?: 'left' | 'center' | 'right'
|
|
618
|
+
// Brand colours, '#rrggbb', up to 6: offered in the colour pickers.
|
|
619
|
+
colors?: string[]
|
|
620
|
+
// Set in by reports on the theme's typeface, on screen and in print.
|
|
621
|
+
headingFont?: ReportBrandFont
|
|
622
|
+
bodyFont?: ReportBrandFont
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export interface ReportRunSummary {
|
|
626
|
+
status: 'success' | 'partial' | 'error' | 'cancelled'
|
|
627
|
+
// One timestamp for the whole run (ISO 8601).
|
|
628
|
+
runAt: string
|
|
629
|
+
blocks: Array<{
|
|
630
|
+
blockId: string
|
|
631
|
+
status: 'success' | 'error' | 'cancelled' | 'skipped'
|
|
632
|
+
rowCount?: number
|
|
633
|
+
countRows?: number | null
|
|
634
|
+
error?: { message: string; referenceId?: string }
|
|
635
|
+
}>
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export interface ReportBuilderProps {
|
|
639
|
+
authentication?: Authentication
|
|
640
|
+
autoQLConfig?: AutoQLConfig
|
|
641
|
+
dataFormatting?: DataFormatting
|
|
642
|
+
// Fetched by the host; data blocks read their tiles from these.
|
|
643
|
+
dashboards?: ReportDashboard[]
|
|
644
|
+
// Controlled: the builder stores nothing itself.
|
|
645
|
+
report?: Report
|
|
646
|
+
onChange?: (report: Report) => void
|
|
647
|
+
// The branding the pages are drawn with. With enableBranding, what the organisation set in AutoQL wins and this
|
|
648
|
+
// fills in the rest (the organisation's name, say).
|
|
649
|
+
branding?: ReportBranding
|
|
650
|
+
// The organisation's branding is kept by AutoQL (/autoql/api/v1/reports/branding): the builder loads it and
|
|
651
|
+
// draws it over `branding`. Off by default.
|
|
652
|
+
enableBranding?: boolean
|
|
653
|
+
// With enableBranding: adds "Branding…" to the report options menu (⋮) once AutoQL has answered, to change the
|
|
654
|
+
// organisation's branding. Saving takes AutoQL's organisation-admin grant, so say who may.
|
|
655
|
+
canEditBranding?: boolean
|
|
656
|
+
onRunComplete?: (summary: ReportRunSummary) => void
|
|
657
|
+
onErrorCallback?: (error: any) => void
|
|
658
|
+
getAuthenticationForProject?: (projectId: string | number) => Authentication | undefined
|
|
659
|
+
// A stylesheet that loads the typefaces the report can use. None is loaded by default.
|
|
660
|
+
fontStylesheetUrl?: string | null
|
|
661
|
+
// Run report: the builder fetches every data block itself. Off by default: blocks show what was
|
|
662
|
+
// captured when they were added, and runReport() resolves null.
|
|
663
|
+
enableRunReport?: boolean
|
|
664
|
+
// Data blocks can be made in the builder, not only arrive with "Add to Report…". Off by default.
|
|
665
|
+
enableDataBlocks?: boolean
|
|
666
|
+
// With enableDataBlocks: an empty Data block offers "Pick dashboard tiles…", which calls this. Show your own
|
|
667
|
+
// picker and resolve with the blocks to put in the empty block's place, in order, or null to leave it.
|
|
668
|
+
pickDashboardTiles?: () => Promise<ReportBlock[] | null | undefined> | ReportBlock[] | null | undefined
|
|
669
|
+
// Analysis blocks can be made and written: Auto Analyze's wording about one result, one Auto Analyze credit
|
|
670
|
+
// per run. Off by default; analyses already in a report always show and print.
|
|
671
|
+
enableAnalysis?: boolean
|
|
672
|
+
// Adds "New report · Get started…" to the palette, which calls this. The host starts the report.
|
|
673
|
+
onGetStarted?: () => void
|
|
674
|
+
// Your own element for the toolbar, shown just before Preview (and in the preview): whether the report is
|
|
675
|
+
// saved, say. None by default.
|
|
676
|
+
toolbarStatus?: React.ReactNode
|
|
677
|
+
className?: string
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
export declare class ReportBuilder extends React.Component<ReportBuilderProps> {
|
|
681
|
+
// Runs every data block as one run with one timestamp; null if superseded, or if enableRunReport is off.
|
|
682
|
+
runReport(): Promise<ReportRunSummary | null>
|
|
683
|
+
openPrintPreview(): Promise<void>
|
|
684
|
+
closePrintPreview(): Promise<void>
|
|
685
|
+
// Waits for the preview's pages and charts, then opens the browser's print dialog; true once it has.
|
|
686
|
+
print(): Promise<boolean>
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
export declare const REPORT_SCHEMA_VERSION: number
|
|
690
|
+
export declare function createEmptyReport(
|
|
691
|
+
overrides?: Partial<Omit<Report, 'page'>> & { page?: Partial<ReportPageSetup> },
|
|
692
|
+
): Report
|
|
693
|
+
|
|
694
|
+
// A question asked once, its answer kept as a Data block's capture (shown the way AutoQL shows it by default),
|
|
695
|
+
// with the table rows the block should print. Never rejects.
|
|
696
|
+
export type CaptureQuestionResult =
|
|
697
|
+
| { ok: true; capture: ReportCapture; rows: ReportTableRows }
|
|
698
|
+
| {
|
|
699
|
+
ok: false
|
|
700
|
+
reason: 'cancelled' | 'error' | 'no-data' | 'unsupported'
|
|
701
|
+
// For 'error': why the question didn't run or didn't answer with data.
|
|
702
|
+
error?: { message: string; referenceId?: string }
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
export declare function captureQuestion(options: {
|
|
706
|
+
query: string
|
|
707
|
+
authentication?: Authentication
|
|
708
|
+
autoQLConfig?: AutoQLConfig
|
|
709
|
+
// Stops the request; the result is then { ok: false, reason: 'cancelled' }.
|
|
710
|
+
signal?: AbortSignal
|
|
711
|
+
cancelToken?: any
|
|
712
|
+
}): Promise<CaptureQuestionResult>
|
|
713
|
+
|
|
714
|
+
// How many table rows a new block for this capture prints: all of a table that 10, 25, 50 or 100 holds,
|
|
715
|
+
// else 25.
|
|
716
|
+
export declare function rowsForCapture(capture: ReportCapture | null | undefined): ReportTableRows
|
|
717
|
+
|
|
718
|
+
// ─── Reports, kept by AutoQL ─────────────────────────────────────────────────
|
|
719
|
+
// A user's own reports on the token's data source, through AutoQL's report service
|
|
720
|
+
// (/autoql/api/v1/reports), with their folders and tags.
|
|
721
|
+
|
|
722
|
+
// The service's message ids (the number its reference_id ends with) by name.
|
|
723
|
+
export declare const REPORT_ERROR_CODES: Record<number, string>
|
|
724
|
+
|
|
725
|
+
export declare class ReportsApiError extends Error {
|
|
726
|
+
// 0 when the service couldn't be reached.
|
|
727
|
+
status: number
|
|
728
|
+
// The message id's name, e.g. 'REPORT_VERSION_CONFLICT', when the service sent one.
|
|
729
|
+
code?: string
|
|
730
|
+
messageId?: number
|
|
731
|
+
referenceId?: string
|
|
732
|
+
// The answer's data in camelCase: { version, updatedAt } on a version conflict, { reason } on an invalid
|
|
733
|
+
// report or block, { id } of the folder or tag that holds a name.
|
|
734
|
+
details?: Record<string, any>
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
export interface StoredReportSummary {
|
|
738
|
+
id: string
|
|
739
|
+
title: string
|
|
740
|
+
sizeBytes: number
|
|
741
|
+
version: number
|
|
742
|
+
folderId: string | null
|
|
743
|
+
tagIds: string[]
|
|
744
|
+
createdAt: string
|
|
745
|
+
updatedAt: string
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
export interface StoredReport extends StoredReportSummary {
|
|
749
|
+
projectId: string
|
|
750
|
+
report: Report
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
export interface StoredReportStamp {
|
|
754
|
+
id: string
|
|
755
|
+
version: number
|
|
756
|
+
updatedAt: string
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
export interface ReportFolder {
|
|
760
|
+
id: string
|
|
761
|
+
name: string
|
|
762
|
+
reportCount: number
|
|
763
|
+
createdAt: string
|
|
764
|
+
updatedAt: string
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
export interface ReportTag extends ReportFolder {
|
|
768
|
+
color: string
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
export interface ReportPlacement {
|
|
772
|
+
id: string
|
|
773
|
+
folderId: string | null
|
|
774
|
+
tagIds: string[]
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
interface ReportsCall {
|
|
778
|
+
authentication: Authentication
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
export declare function fetchReports(
|
|
782
|
+
options: ReportsCall & {
|
|
783
|
+
page?: number
|
|
784
|
+
pageSize?: number
|
|
785
|
+
q?: string
|
|
786
|
+
folderId?: string
|
|
787
|
+
tagIds?: string[]
|
|
788
|
+
orderBy?: 'updated_at' | 'created_at' | 'title'
|
|
789
|
+
order?: 'asc' | 'desc'
|
|
790
|
+
signal?: AbortSignal
|
|
791
|
+
},
|
|
792
|
+
): Promise<{ reports: StoredReportSummary[]; page: number; pageSize: number; totalPages: number; totalItems: number }>
|
|
793
|
+
export declare function fetchReport(options: ReportsCall & { id: string; signal?: AbortSignal }): Promise<StoredReport>
|
|
794
|
+
export declare function createReport(
|
|
795
|
+
options: ReportsCall & { id: string; report: Report; folderId?: string; tagIds?: string[]; keepalive?: boolean },
|
|
796
|
+
): Promise<StoredReport & { created: boolean }>
|
|
797
|
+
export declare function saveReport(
|
|
798
|
+
options: ReportsCall & { id: string; report: Report; version: number; keepalive?: boolean },
|
|
799
|
+
): Promise<StoredReportStamp>
|
|
800
|
+
export declare function deleteReport(options: ReportsCall & { id: string }): Promise<void>
|
|
801
|
+
export declare function deleteReports(
|
|
802
|
+
options: ReportsCall & { ids: string[] },
|
|
803
|
+
): Promise<{ deleted: string[]; notFound: string[] }>
|
|
804
|
+
export declare function appendReportBlock(
|
|
805
|
+
options: ReportsCall & { id: string; block: ReportBlock },
|
|
806
|
+
): Promise<StoredReportStamp & { appended: boolean }>
|
|
807
|
+
export declare function organizeReports(
|
|
808
|
+
options: ReportsCall & {
|
|
809
|
+
reportIds: string[]
|
|
810
|
+
// null unfiles; leaving it out leaves the reports' folders as they are.
|
|
811
|
+
folderId?: string | null
|
|
812
|
+
addTagIds?: string[]
|
|
813
|
+
removeTagIds?: string[]
|
|
814
|
+
},
|
|
815
|
+
): Promise<ReportPlacement[]>
|
|
816
|
+
|
|
817
|
+
export declare function fetchReportFolders(options: ReportsCall & { signal?: AbortSignal }): Promise<ReportFolder[]>
|
|
818
|
+
export declare function createReportFolder(
|
|
819
|
+
options: ReportsCall & { id: string; name: string },
|
|
820
|
+
): Promise<ReportFolder & { created: boolean }>
|
|
821
|
+
export declare function renameReportFolder(options: ReportsCall & { id: string; name: string }): Promise<ReportFolder>
|
|
822
|
+
export declare function deleteReportFolder(options: ReportsCall & { id: string }): Promise<void>
|
|
823
|
+
|
|
824
|
+
export declare function fetchReportTags(options: ReportsCall & { signal?: AbortSignal }): Promise<ReportTag[]>
|
|
825
|
+
export declare function createReportTag(
|
|
826
|
+
options: ReportsCall & { id: string; name: string; color: string },
|
|
827
|
+
): Promise<ReportTag & { created: boolean }>
|
|
828
|
+
export declare function updateReportTag(
|
|
829
|
+
options: ReportsCall & { id: string; name?: string; color?: string },
|
|
830
|
+
): Promise<ReportTag>
|
|
831
|
+
export declare function deleteReportTag(options: ReportsCall & { id: string }): Promise<void>
|
|
832
|
+
|
|
833
|
+
// ─── Reports workspace ───────────────────────────────────────────────────────
|
|
834
|
+
// A user's reports on the token's data source, each open in a tab with its own ReportBuilder and saved to AutoQL
|
|
835
|
+
// as it's edited: the tab strip, New report (from a question, a dashboard or a blank page), autosave with its
|
|
836
|
+
// save control, and the dashboard-tiles picker. The host draws the home page.
|
|
837
|
+
|
|
838
|
+
export interface ReportsNotice {
|
|
839
|
+
tone: 'error' | 'info'
|
|
840
|
+
text: string
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
// What renderHome draws the home page from.
|
|
844
|
+
export interface ReportsHomeProps {
|
|
845
|
+
// The user's reports on the data source, most recently saved first; null while they load.
|
|
846
|
+
reports: StoredReportSummary[] | null
|
|
847
|
+
// Why they couldn't be listed.
|
|
848
|
+
listError: string | null
|
|
849
|
+
retryList: () => void
|
|
850
|
+
// Shows the report in its tab (opening one if it isn't open).
|
|
851
|
+
openReport: (id: string) => void
|
|
852
|
+
// Deletes the report for good (ask first); its tab closes. Resolves with whether it was deleted — why not is in
|
|
853
|
+
// notices.
|
|
854
|
+
deleteReport: (id: string) => Promise<boolean>
|
|
855
|
+
// Deletes several, one after another as deleteReport does each. Resolves with whether every one was deleted.
|
|
856
|
+
deleteReports: (ids: string[]) => Promise<boolean>
|
|
857
|
+
deletingId: string | null
|
|
858
|
+
// What happened meanwhile: a report deleted in another tab, a delete that failed.
|
|
859
|
+
notices: ReportsNotice[]
|
|
860
|
+
// Opens New report.
|
|
861
|
+
newReport: () => void
|
|
862
|
+
|
|
863
|
+
// The user's folders and tags on the data source, A to Z; null while they load. Each report in `reports` says its
|
|
864
|
+
// folder (folderId, null for none) and its tags (tagIds).
|
|
865
|
+
folders: ReportFolder[] | null
|
|
866
|
+
tags: ReportTag[] | null
|
|
867
|
+
// Why they couldn't be loaded.
|
|
868
|
+
organizersError: string | null
|
|
869
|
+
retryOrganizers: () => void
|
|
870
|
+
// The changes below resolve once AutoQL has them, the lists following, and reject with an Error whose message is
|
|
871
|
+
// the line to show (`code` and `status` are the service's).
|
|
872
|
+
// A new folder or tag, or the one with that name already, whatever its case. Names are 1 to 80 characters.
|
|
873
|
+
createFolder: (name: string) => Promise<ReportFolder>
|
|
874
|
+
renameFolder: (id: string, name: string) => Promise<ReportFolder>
|
|
875
|
+
// Its reports become unfiled; none is deleted.
|
|
876
|
+
deleteFolder: (id: string) => Promise<void>
|
|
877
|
+
// `color` is a short key the host picks (`blue`, `amber`…), kept as it's sent.
|
|
878
|
+
createTag: (name: string, color: string) => Promise<ReportTag>
|
|
879
|
+
updateTag: (id: string, change: { name?: string; color?: string }) => Promise<ReportTag>
|
|
880
|
+
// Taken off every report that had it; none is deleted.
|
|
881
|
+
deleteTag: (id: string) => Promise<void>
|
|
882
|
+
// Files reports in a folder (null: none; left out: as they are) and adds or takes off tags, all at once or not at
|
|
883
|
+
// all. Resolves with where each report now is.
|
|
884
|
+
organizeReports: (change: {
|
|
885
|
+
reportIds: string[]
|
|
886
|
+
folderId?: string | null
|
|
887
|
+
addTagIds?: string[]
|
|
888
|
+
removeTagIds?: string[]
|
|
889
|
+
}) => Promise<ReportPlacement[]>
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
export interface ReportsProps {
|
|
893
|
+
authentication?: Authentication
|
|
894
|
+
autoQLConfig?: AutoQLConfig
|
|
895
|
+
dataFormatting?: DataFormatting
|
|
896
|
+
// Which data source the reports are on. The token's project by default.
|
|
897
|
+
dataSourceId?: string | number
|
|
898
|
+
// The dashboards a report can take tiles from (New report from a dashboard, an empty Data block's "Pick
|
|
899
|
+
// dashboard tiles…"). Null while they load; leave it out where there are none. Tiles may carry their answers.
|
|
900
|
+
dashboards?: ReportDashboard[] | null
|
|
901
|
+
// Why the dashboards couldn't be loaded, said over the open report.
|
|
902
|
+
dashboardsError?: string | null
|
|
903
|
+
// A dashboard's tiles as the tiles picker answered them, for a host that keeps answers between views.
|
|
904
|
+
onDashboardTilesChange?: (dashboardId: string, tiles: DashboardTile[]) => void
|
|
905
|
+
// The report shown (null: the home page), for a host that keeps it in its address: when it changes, that report
|
|
906
|
+
// shows (once the list is in, and if it's there). onShowReport hears every change made in the workspace.
|
|
907
|
+
shownReportId?: string | null
|
|
908
|
+
onShowReport?: (id: string | null) => void
|
|
909
|
+
// Draws the home page. A plain list of the reports by default.
|
|
910
|
+
renderHome?: (home: ReportsHomeProps) => React.ReactNode
|
|
911
|
+
// Where the open tabs are remembered in this browser (localStorage keys start with it); null remembers nothing.
|
|
912
|
+
// 'react-autoql.' by default.
|
|
913
|
+
storageKeyPrefix?: string | null
|
|
914
|
+
// AutoQL turned the token away (401): pass in a new authentication, and what failed is tried again with it.
|
|
915
|
+
onUnauthorized?: () => void
|
|
916
|
+
// How long a pause in editing is before a report saves (ms). 2000 by default.
|
|
917
|
+
saveDelay?: number
|
|
918
|
+
// The folder New report makes reports in, while it's one of the user's: the one the host's home page shows, say.
|
|
919
|
+
newReportFolderId?: string | null
|
|
920
|
+
// Passed on to each report's ReportBuilder.
|
|
921
|
+
branding?: ReportBranding
|
|
922
|
+
enableBranding?: boolean
|
|
923
|
+
canEditBranding?: boolean
|
|
924
|
+
enableDataBlocks?: boolean
|
|
925
|
+
enableAnalysis?: boolean
|
|
926
|
+
enableRunReport?: boolean
|
|
927
|
+
fontStylesheetUrl?: string | null
|
|
928
|
+
getAuthenticationForProject?: (projectId: string | number) => Authentication | undefined
|
|
929
|
+
onRunComplete?: (summary: ReportRunSummary) => void
|
|
930
|
+
onErrorCallback?: (error: any) => void
|
|
931
|
+
className?: string
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
export declare class Reports extends React.Component<ReportsProps> {
|
|
935
|
+
// Saves everything waiting, now (before signing out, say); keepalive when the page is going away. Resolves with
|
|
936
|
+
// whether each report reached the server.
|
|
937
|
+
flushAll(options?: { keepalive?: boolean }): Promise<boolean[]>
|
|
938
|
+
// Whether any report has edits AutoQL doesn't have yet.
|
|
939
|
+
hasUnsavedChanges(): boolean
|
|
940
|
+
// Saves the report shown, now.
|
|
941
|
+
saveNow(): void
|
|
942
|
+
// Lists the reports again.
|
|
943
|
+
reload(): void
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// What a toolbar's custom option hands its callback: the answer's payload, and from react-autoql's toolbars a
|
|
947
|
+
// capture of what it shows now.
|
|
948
|
+
export interface ReportToolbarOptionData {
|
|
949
|
+
query?: string
|
|
950
|
+
tileKey?: string | number
|
|
951
|
+
dashboardId?: string | number
|
|
952
|
+
[key: string]: unknown
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
export interface ReportToolbarOptionExtra {
|
|
956
|
+
captureForReport?: (options?: { maxTableRows?: number; maxChartRows?: number }) => ReportCaptureResult
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
// The Data block "Add to Report…" adds: the answer or tile as it's shown now, and where it came from (the tile,
|
|
960
|
+
// when there is one, else the question). A message to show when it can't be kept.
|
|
961
|
+
export declare function captureReportBlock(options: {
|
|
962
|
+
data: ReportToolbarOptionData | null | undefined
|
|
963
|
+
extra: ReportToolbarOptionExtra | null | undefined
|
|
964
|
+
dashboard?: { id: string; name?: string; tiles?: DashboardTile[] } | null
|
|
965
|
+
}): { ok: true; block: ReportDataBlock } | { ok: false; message: string }
|
|
966
|
+
|
|
967
|
+
export interface AddToReportDialogProps {
|
|
968
|
+
authentication?: Authentication
|
|
969
|
+
// The block to add at the end of the chosen report (captureReportBlock).
|
|
970
|
+
block: ReportBlock
|
|
971
|
+
onClose: () => void
|
|
972
|
+
// After it's added (before onClose): which report, and whether it was made for this.
|
|
973
|
+
onAdded?: (added: { id: string; title: string; created: boolean }) => void
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
// "Add to Report…": adds a block to the end of one of the user's reports, or to a new one.
|
|
977
|
+
export declare class AddToReportDialog extends React.Component<AddToReportDialogProps> {}
|
|
978
|
+
|
|
979
|
+
// ─── Push notifications ───────────────────────────────────────────────────────
|
|
980
|
+
|
|
981
|
+
export type PushNotificationStatus = 'unsupported' | 'checking' | 'on' | 'off' | 'blocked'
|
|
982
|
+
|
|
983
|
+
export declare const PUSH_NOTIFICATION_STATUS: {
|
|
984
|
+
UNSUPPORTED: 'unsupported'
|
|
985
|
+
CHECKING: 'checking'
|
|
986
|
+
ON: 'on'
|
|
987
|
+
OFF: 'off'
|
|
988
|
+
BLOCKED: 'blocked'
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
export interface PushNotificationsProviderProps {
|
|
992
|
+
authentication?: Authentication
|
|
993
|
+
/** Where the app serves push-sw.js. Defaults to '/push-sw.js'. Pass null when the app's own service worker imports it. */
|
|
994
|
+
serviceWorkerUrl?: string | null
|
|
995
|
+
/** Service worker scope. Defaults to the scope of the current page. */
|
|
996
|
+
scope?: string
|
|
997
|
+
/** Called with the notification's URL when the user clicks a notification. Defaults to a full page load. */
|
|
998
|
+
onNotificationClick?: (url: string, data: PushMessageData) => void
|
|
999
|
+
/** Called when an alert arrives while the app is open. */
|
|
1000
|
+
onPushReceived?: (data: PushMessageData) => void
|
|
1001
|
+
children?: React.ReactNode
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
export interface UsePushNotificationsResult {
|
|
1005
|
+
isSupported: boolean
|
|
1006
|
+
status: PushNotificationStatus
|
|
1007
|
+
isEnabled: boolean
|
|
1008
|
+
isBusy: boolean
|
|
1009
|
+
error: unknown
|
|
1010
|
+
/** Asks for permission if needed and subscribes. Call it from a click. Resolves true when push is on. */
|
|
1011
|
+
enable: () => Promise<boolean>
|
|
1012
|
+
/** Unsubscribes this browser. Call it on logout too. */
|
|
1013
|
+
disable: () => Promise<void>
|
|
1014
|
+
/** Saves this browser's subscription to the server again. */
|
|
1015
|
+
sync: () => Promise<void>
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
export interface PushNotificationsToggleProps {
|
|
1019
|
+
label?: string
|
|
1020
|
+
description?: string
|
|
1021
|
+
blockedMessage?: string
|
|
1022
|
+
errorMessage?: string
|
|
1023
|
+
className?: string
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
export declare const PushNotificationsProvider: React.FC<PushNotificationsProviderProps>
|
|
1027
|
+
export declare function usePushNotifications(): UsePushNotificationsResult
|
|
1028
|
+
export declare const PushNotificationsToggle: React.FC<PushNotificationsToggleProps>
|
|
1029
|
+
|
|
414
1030
|
// ─── Miscellaneous components ─────────────────────────────────────────────────
|
|
415
1031
|
|
|
416
1032
|
export declare const Icon: React.FC<{ type: string; className?: string; [key: string]: any }>
|