derive-dashboards 0.8.0 → 0.9.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/CHANGELOG.md +513 -0
- package/README.md +8 -2
- package/dist/adapter/statement.mjs +9 -7
- package/dist/authorize.mjs +27 -6
- package/dist/body.mjs +28 -25
- package/dist/cache.d.mts +2 -2
- package/dist/charts/data/buckets.d.mts +25 -7
- package/dist/charts/data/buckets.mjs +92 -15
- package/dist/charts/data/clean.mjs +254 -12
- package/dist/charts/data/format.d.mts +7 -2
- package/dist/charts/data/format.mjs +68 -70
- package/dist/charts/data/input-error.d.mts +2 -0
- package/dist/charts/data/input-error.mjs +2 -0
- package/dist/charts/data/rows.d.mts +3 -1
- package/dist/charts/data/rows.mjs +4 -2
- package/dist/charts/data/types.d.mts +50 -7
- package/dist/charts/data/words.d.mts +13 -0
- package/dist/charts/data/words.mjs +8 -1
- package/dist/charts/describe.mjs +6 -6
- package/dist/charts/index.d.mts +14 -14
- package/dist/charts/index.mjs +4 -1
- package/dist/charts/kinds/area-marks.mjs +67 -26
- package/dist/charts/kinds/area.d.mts +3 -3
- package/dist/charts/kinds/area.mjs +32 -11
- package/dist/charts/kinds/bars-data.d.mts +3 -3
- package/dist/charts/kinds/bars-data.mjs +12 -6
- package/dist/charts/kinds/bars-layout.mjs +60 -6
- package/dist/charts/kinds/bars-marks.mjs +6 -6
- package/dist/charts/kinds/bars.d.mts +5 -3
- package/dist/charts/kinds/bars.mjs +39 -6
- package/dist/charts/kinds/columns-data.mjs +14 -5
- package/dist/charts/kinds/columns-marks.mjs +52 -23
- package/dist/charts/kinds/columns.d.mts +2 -2
- package/dist/charts/kinds/columns.mjs +36 -10
- package/dist/charts/kinds/course-data.mjs +44 -0
- package/dist/charts/kinds/course-layout.mjs +77 -0
- package/dist/charts/kinds/course-marks.mjs +52 -0
- package/dist/charts/kinds/course-words.mjs +64 -0
- package/dist/charts/kinds/course.d.mts +10 -0
- package/dist/charts/kinds/course.mjs +55 -0
- package/dist/charts/kinds/dumbbell-data.d.mts +4 -4
- package/dist/charts/kinds/dumbbell-data.mjs +3 -3
- package/dist/charts/kinds/dumbbell-layout.mjs +17 -8
- package/dist/charts/kinds/dumbbell.d.mts +5 -3
- package/dist/charts/kinds/dumbbell.mjs +35 -4
- package/dist/charts/kinds/funnel-data.d.mts +3 -3
- package/dist/charts/kinds/funnel-data.mjs +11 -16
- package/dist/charts/kinds/funnel-layout.mjs +7 -6
- package/dist/charts/kinds/funnel.d.mts +5 -4
- package/dist/charts/kinds/funnel.mjs +33 -6
- package/dist/charts/kinds/grid-data.d.mts +3 -3
- package/dist/charts/kinds/grid-data.mjs +55 -13
- package/dist/charts/kinds/grid-layout.mjs +88 -13
- package/dist/charts/kinds/grid-legend.mjs +60 -0
- package/dist/charts/kinds/grid-marks.mjs +81 -30
- package/dist/charts/kinds/grid-time.mjs +19 -5
- package/dist/charts/kinds/grid-words.mjs +57 -35
- package/dist/charts/kinds/grid.d.mts +7 -4
- package/dist/charts/kinds/grid.mjs +49 -8
- package/dist/charts/kinds/histogram-data.mjs +68 -26
- package/dist/charts/kinds/histogram-layout.mjs +4 -3
- package/dist/charts/kinds/histogram-words.mjs +2 -3
- package/dist/charts/kinds/histogram.d.mts +2 -2
- package/dist/charts/kinds/histogram.mjs +17 -1
- package/dist/charts/kinds/line-marks.mjs +19 -11
- package/dist/charts/kinds/line.d.mts +2 -2
- package/dist/charts/kinds/line.mjs +21 -3
- package/dist/charts/kinds/multiples-grid.mjs +57 -27
- package/dist/charts/kinds/multiples-head.mjs +52 -22
- package/dist/charts/kinds/multiples-layout.mjs +106 -52
- package/dist/charts/kinds/multiples-marks.mjs +6 -5
- package/dist/charts/kinds/multiples-words.mjs +53 -38
- package/dist/charts/kinds/multiples.d.mts +2 -2
- package/dist/charts/kinds/multiples.mjs +35 -7
- package/dist/charts/kinds/row-chart.d.mts +7 -0
- package/dist/charts/kinds/row-chart.mjs +47 -10
- package/dist/charts/kinds/row-marks.mjs +5 -5
- package/dist/charts/kinds/scatter-data.d.mts +5 -5
- package/dist/charts/kinds/scatter-data.mjs +6 -6
- package/dist/charts/kinds/scatter-marks.mjs +46 -19
- package/dist/charts/kinds/scatter-words.mjs +8 -8
- package/dist/charts/kinds/scatter.d.mts +5 -3
- package/dist/charts/kinds/scatter.mjs +18 -0
- package/dist/charts/kinds/stat-data.mjs +7 -7
- package/dist/charts/kinds/stat-marks.mjs +2 -2
- package/dist/charts/kinds/stat.d.mts +4 -4
- package/dist/charts/kinds/stat.mjs +19 -0
- package/dist/charts/kinds/time-chart.mjs +13 -4
- package/dist/charts/kinds/time-frame.mjs +50 -19
- package/dist/charts/kinds/time-plan.mjs +29 -2
- package/dist/charts/kinds/time-plot.mjs +1 -1
- package/dist/charts/kinds/time-stops.mjs +58 -29
- package/dist/charts/kinds/waterfall-data.d.mts +3 -3
- package/dist/charts/kinds/waterfall-data.mjs +2 -2
- package/dist/charts/kinds/waterfall.d.mts +5 -4
- package/dist/charts/kinds/waterfall.mjs +29 -2
- package/dist/charts/layout/frame.mjs +5 -3
- package/dist/charts/layout/stack.mjs +43 -22
- package/dist/charts/marks/axes.mjs +10 -5
- package/dist/charts/marks/budget.mjs +14 -0
- package/dist/charts/marks/end-labels.mjs +24 -10
- package/dist/charts/marks/legend.mjs +19 -8
- package/dist/charts/marks/lines.mjs +3 -3
- package/dist/charts/marks/more.mjs +79 -13
- package/dist/charts/marks/notes.mjs +12 -6
- package/dist/charts/marks/series-line.mjs +14 -10
- package/dist/charts/marks/thin.mjs +16 -33
- package/dist/charts/scale/calendar.mjs +41 -26
- package/dist/charts/scale/linear.mjs +58 -0
- package/dist/charts/scale/value.d.mts +21 -0
- package/dist/charts/scale/value.mjs +67 -9
- package/dist/charts/scene/lazy.mjs +27 -0
- package/dist/charts/scene/markup.mjs +2 -1
- package/dist/charts/scene/svg.mjs +20 -8
- package/dist/charts/scene/types.d.mts +34 -0
- package/dist/charts/text/measure.mjs +33 -3
- package/dist/charts/theme.mjs +13 -4
- package/dist/charts-react/Chart.d.mts +20 -0
- package/dist/charts-react/Chart.mjs +9 -67
- package/dist/charts-react/Reader.mjs +50 -96
- package/dist/charts-react/box.mjs +106 -0
- package/dist/charts-react/bucket-names.mjs +9 -24
- package/dist/charts-react/columns-picture.mjs +12 -0
- package/dist/charts-react/exact-sum.mjs +4 -7
- package/dist/charts-react/from-answer.mjs +9 -4
- package/dist/charts-react/index.d.mts +9 -2
- package/dist/charts-react/index.mjs +9 -2
- package/dist/charts-react/kinds/area.d.mts +4 -0
- package/dist/charts-react/kinds/area.mjs +38 -0
- package/dist/charts-react/kinds/bar.d.mts +4 -0
- package/dist/charts-react/kinds/bar.mjs +15 -0
- package/dist/charts-react/kinds/funnel.d.mts +4 -0
- package/dist/charts-react/kinds/funnel.mjs +13 -0
- package/dist/charts-react/kinds/heatmap.d.mts +4 -0
- package/dist/charts-react/kinds/heatmap.mjs +13 -0
- package/dist/charts-react/kinds/line.d.mts +4 -0
- package/dist/charts-react/kinds/line.mjs +20 -0
- package/dist/charts-react/kinds/multiples.d.mts +4 -0
- package/dist/charts-react/kinds/multiples.mjs +33 -0
- package/dist/charts-react/kinds/number.d.mts +5 -0
- package/dist/charts-react/kinds/number.mjs +86 -0
- package/dist/charts-react/plan-bars.mjs +15 -8
- package/dist/charts-react/plan-funnel.mjs +3 -1
- package/dist/charts-react/plan-grid.mjs +14 -5
- package/dist/charts-react/plan-of.mjs +17 -0
- package/dist/charts-react/plan-parts.mjs +16 -5
- package/dist/charts-react/plan-time.mjs +4 -53
- package/dist/charts-react/reader-page.d.mts +1 -1
- package/dist/charts-react/reader-page.mjs +19 -9
- package/dist/charts-react/renderers.d.mts +14 -0
- package/dist/charts-react/renderers.mjs +22 -0
- package/dist/charts-react/table.d.mts +1 -0
- package/dist/charts-react/table.mjs +108 -0
- package/dist/charts-react/tiles.mjs +21 -49
- package/dist/charts-react/useScene.mjs +45 -17
- package/dist/charts-react/words.mjs +19 -0
- package/dist/checks.mjs +97 -19
- package/dist/cli/add.mjs +4 -3
- package/dist/cli/doctor.mjs +2 -2
- package/dist/core/conformance/index.d.mts +5 -2
- package/dist/core/conformance/index.mjs +5 -2
- package/dist/core/conformance/memory/aggregate.mjs +11 -6
- package/dist/core/conformance/memory/rows.d.mts +7 -3
- package/dist/core/conformance/memory/rows.mjs +19 -13
- package/dist/core/conformance/memory/source.mjs +4 -4
- package/dist/core/document/control-fields.d.mts +20 -0
- package/dist/core/document/control-fields.mjs +117 -0
- package/dist/core/document/display-comparisons.d.mts +17 -0
- package/dist/core/document/display-comparisons.mjs +15 -4
- package/dist/core/document/display-entries.d.mts +14 -0
- package/dist/core/document/display-entries.mjs +25 -9
- package/dist/core/document/display-validation.d.mts +5 -1
- package/dist/core/document/display-validation.mjs +14 -7
- package/dist/core/document/display.d.mts +10 -8
- package/dist/core/document/display.mjs +25 -4
- package/dist/core/document/layout.d.mts +8 -9
- package/dist/core/document/layout.mjs +23 -6
- package/dist/core/document/stacked.d.mts +0 -7
- package/dist/core/document/types.mjs +8 -6
- package/dist/core/document/upgrade.d.mts +1 -0
- package/dist/core/document/upgrade.mjs +4 -2
- package/dist/core/engine/access.mjs +3 -3
- package/dist/core/engine/assert.mjs +4 -2
- package/dist/core/engine/bucket.mjs +2 -2
- package/dist/core/engine/checks.mjs +6 -7
- package/dist/core/engine/custom/ask.mjs +22 -2
- package/dist/core/engine/custom/cells.mjs +22 -22
- package/dist/core/engine/custom/level.mjs +12 -13
- package/dist/core/engine/custom/measures.mjs +12 -9
- package/dist/core/engine/custom/reader.mjs +3 -1
- package/dist/core/engine/custom/records.mjs +8 -7
- package/dist/core/engine/custom/unread.mjs +78 -0
- package/dist/core/engine/custom/where.mjs +15 -10
- package/dist/core/engine/index.d.mts +2 -13
- package/dist/core/engine/index.mjs +2 -12
- package/dist/core/engine/measure.mjs +1 -0
- package/dist/core/engine/members.mjs +7 -3
- package/dist/core/engine/nan.mjs +10 -1
- package/dist/core/engine/native.mjs +2 -20
- package/dist/core/engine/numbers.mjs +26 -14
- package/dist/core/engine/postgres.mjs +9 -5
- package/dist/core/engine/prepare.mjs +4 -4
- package/dist/core/engine/rank-sets.mjs +1 -1
- package/dist/core/engine/read.mjs +5 -4
- package/dist/core/engine/reader.d.mts +6 -0
- package/dist/core/engine/record-layout.mjs +3 -3
- package/dist/core/engine/run.mjs +77 -20
- package/dist/core/engine/segmented.d.mts +2 -1
- package/dist/core/engine/segmented.mjs +19 -12
- package/dist/core/engine/series.mjs +1 -1
- package/dist/core/engine/shape.mjs +8 -8
- package/dist/core/engine/sql-partition.mjs +2 -2
- package/dist/core/engine/sql-pass.mjs +3 -2
- package/dist/core/engine/sql-reader.mjs +13 -5
- package/dist/core/engine/sql-reads.mjs +2 -1
- package/dist/core/engine/sql-records.mjs +2 -2
- package/dist/core/engine/sql-split.mjs +1 -1
- package/dist/core/engine/sql-unread.mjs +70 -0
- package/dist/core/engine/time.mjs +2 -1
- package/dist/core/engine/types.d.mts +17 -0
- package/dist/core/engine/version.d.mts +1 -1
- package/dist/core/engine/version.mjs +1 -1
- package/dist/core/error/codes.d.mts +24 -1
- package/dist/core/error/codes.mjs +23 -3
- package/dist/core/error/refusal.d.mts +8 -3
- package/dist/core/error/refusal.mjs +6 -1
- package/dist/core/exact/decimal.d.mts +1 -14
- package/dist/core/exact/decimal.mjs +9 -19
- package/dist/core/exact/stored.d.mts +9 -0
- package/dist/core/exact/stored.mjs +38 -0
- package/dist/core/exact/text.d.mts +16 -1
- package/dist/core/exact/text.mjs +50 -1
- package/dist/core/format/digits.mjs +55 -0
- package/dist/core/format/index.d.mts +16 -0
- package/dist/core/format/index.mjs +27 -0
- package/dist/core/format/number.d.mts +27 -0
- package/dist/core/format/number.mjs +158 -0
- package/dist/core/format/write.d.mts +6 -0
- package/dist/core/format/write.mjs +57 -0
- package/dist/core/index.d.mts +43 -33
- package/dist/core/index.mjs +31 -28
- package/dist/core/model/defaults.d.mts +18 -1
- package/dist/core/model/defaults.mjs +19 -1
- package/dist/core/model/define.d.mts +17 -8
- package/dist/core/model/define.mjs +2 -0
- package/dist/core/model/member.d.mts +5 -3
- package/dist/core/model/member.mjs +33 -6
- package/dist/core/model/storage.mjs +40 -12
- package/dist/core/model/types.d.mts +17 -1
- package/dist/core/model/types.mjs +5 -0
- package/dist/core/model/validate/expr.d.mts +1 -7
- package/dist/core/model/validate/fields.d.mts +2 -0
- package/dist/core/model/validate/fields.mjs +14 -7
- package/dist/core/model/validate/issues.mjs +5 -1
- package/dist/core/model/validate/known-members.mjs +6 -5
- package/dist/core/model/validate/shape.mjs +36 -3
- package/dist/core/model/validate/source.mjs +2 -2
- package/dist/core/oracle/data.d.mts +4 -2
- package/dist/core/oracle/evaluate.d.mts +19 -1
- package/dist/core/oracle/evaluate.mjs +56 -10
- package/dist/core/oracle/expr.mjs +1 -1
- package/dist/core/oracle/facts.mjs +12 -5
- package/dist/core/oracle/measure.mjs +1 -1
- package/dist/core/oracle/request.mjs +39 -4
- package/dist/core/oracle/segmented.d.mts +3 -1
- package/dist/core/oracle/segmented.mjs +19 -13
- package/dist/core/oracle/unread.mjs +32 -0
- package/dist/core/oracle/visibility.mjs +4 -3
- package/dist/core/policy/bind.d.mts +2 -11
- package/dist/core/policy/bind.mjs +1 -1
- package/dist/core/policy/match.mjs +1 -1
- package/dist/core/query/closure.d.mts +7 -2
- package/dist/core/query/closure.mjs +29 -12
- package/dist/core/query/compose-tile.d.mts +3 -2
- package/dist/core/query/compose-tile.mjs +32 -13
- package/dist/core/query/compose.d.mts +0 -5
- package/dist/core/query/drill/internal.d.mts +5 -5
- package/dist/core/query/drill/internal.mjs +11 -0
- package/dist/core/query/drill/links.d.mts +2 -3
- package/dist/core/query/drill/links.mjs +18 -4
- package/dist/core/query/drill/selection.d.mts +8 -2
- package/dist/core/query/drill/selection.mjs +14 -3
- package/dist/core/query/drill/synthetic.mjs +1 -1
- package/dist/core/query/drill/time.mjs +11 -10
- package/dist/core/query/filter.d.mts +1 -6
- package/dist/core/query/filter.mjs +1 -4
- package/dist/core/query/fold.mjs +23 -0
- package/dist/core/query/segments.mjs +42 -3
- package/dist/core/query/to-wire.d.mts +7 -0
- package/dist/core/query/to-wire.mjs +14 -2
- package/dist/core/query/types.d.mts +30 -13
- package/dist/core/result/columns.mjs +23 -13
- package/dist/core/result/number.mjs +3 -3
- package/dist/core/result/status.d.mts +13 -0
- package/dist/core/result/status.mjs +18 -0
- package/dist/core/result/time-axis.d.mts +14 -13
- package/dist/core/result/time-axis.mjs +20 -2
- package/dist/core/result/types.d.mts +33 -3
- package/dist/core/result/whole.d.mts +23 -0
- package/dist/core/result/whole.mjs +27 -0
- package/dist/core/schema/agent-query.d.mts +89 -0
- package/dist/core/schema/agent-query.mjs +115 -0
- package/dist/core/schema/aliases.mjs +1 -52
- package/dist/core/schema/answer-parts.mjs +17 -13
- package/dist/core/schema/answers.d.mts +787 -319
- package/dist/core/schema/commands.d.mts +33 -23
- package/dist/core/schema/commands.mjs +26 -18
- package/dist/core/schema/custom.mjs +46 -45
- package/dist/core/schema/document.d.mts +32 -27
- package/dist/core/schema/document.mjs +61 -81
- package/dist/core/schema/drill-answers.mjs +4 -1
- package/dist/core/schema/drill.d.mts +14 -9
- package/dist/core/schema/drill.mjs +23 -22
- package/dist/core/schema/index.d.mts +5 -3
- package/dist/core/schema/index.mjs +5 -3
- package/dist/core/schema/options.d.mts +92 -0
- package/dist/core/schema/options.mjs +104 -0
- package/dist/core/schema/picks.d.mts +2 -2
- package/dist/core/schema/picks.mjs +7 -6
- package/dist/core/schema/query.d.mts +9 -83
- package/dist/core/schema/query.mjs +49 -73
- package/dist/core/schema/strict.d.mts +3 -0
- package/dist/core/schema/strict.mjs +91 -0
- package/dist/core/schema/union-error.mjs +30 -7
- package/dist/core/schema/view.d.mts +4 -3
- package/dist/core/schema/view.mjs +16 -11
- package/dist/core/store/ddl.d.mts +0 -2
- package/dist/core/store/ddl.mjs +1 -5
- package/dist/core/time/bucket.d.mts +1 -19
- package/dist/core/time/bucket.mjs +6 -6
- package/dist/core/time/compare.mjs +3 -2
- package/dist/core/time/index.d.mts +7 -8
- package/dist/core/time/instant.d.mts +15 -9
- package/dist/core/time/instant.mjs +23 -9
- package/dist/core/time/range.d.mts +3 -15
- package/dist/core/time/range.mjs +17 -7
- package/dist/core/time/stored.d.mts +8 -5
- package/dist/core/time/stored.mjs +51 -15
- package/dist/core/time/temporal.d.mts +1 -5
- package/dist/core/time/temporal.mjs +9 -4
- package/dist/core/time/text-time.d.mts +31 -2
- package/dist/core/time/text-time.mjs +139 -22
- package/dist/core/time/zone.mjs +2 -2
- package/dist/core/types/api.d.mts +1 -1
- package/dist/core/types/api.mjs +1 -1
- package/dist/core/types/dashboard.d.mts +185 -0
- package/dist/core/types/dashboard.mjs +26 -0
- package/dist/core/types/drill-api.d.mts +14 -2
- package/dist/core/types/infer.d.mts +0 -4
- package/dist/core/types/options-check.d.mts +42 -0
- package/dist/core/types/options-check.mjs +90 -0
- package/dist/core/types/options.d.mts +14 -8
- package/dist/core/value/casefold.d.mts +1 -3
- package/dist/core/value/stored.d.mts +26 -0
- package/dist/core/value/stored.mjs +28 -0
- package/dist/cursor-seal.mjs +37 -9
- package/dist/dashboard-documents.d.mts +14 -6
- package/dist/dashboard-documents.mjs +32 -12
- package/dist/dashboards.mjs +10 -9
- package/dist/drill-access.mjs +6 -6
- package/dist/drill-change.mjs +18 -20
- package/dist/drill-comparison.mjs +2 -1
- package/dist/drill-crumbs.mjs +63 -28
- package/dist/drill-distinct.mjs +2 -1
- package/dist/drill-explain.mjs +1 -1
- package/dist/drill-items.mjs +1 -1
- package/dist/drill-open.mjs +39 -23
- package/dist/drill-seal.mjs +41 -13
- package/dist/drill-share.mjs +1 -1
- package/dist/drill-summary.mjs +2 -1
- package/dist/drill-targets.mjs +4 -4
- package/dist/drill-views.mjs +4 -3
- package/dist/drill.mjs +1 -1
- package/dist/editing.mjs +5 -3
- package/dist/endpoints/index.d.mts +29 -8
- package/dist/endpoints/index.mjs +4 -1
- package/dist/endpoints/meta.mjs +4 -3
- package/dist/endpoints/query.mjs +5 -2
- package/dist/endpoints/read.mjs +7 -6
- package/dist/endpoints/versions.mjs +2 -1
- package/dist/execute.d.mts +3 -0
- package/dist/execute.mjs +23 -12
- package/dist/grant.d.mts +9 -0
- package/dist/grant.mjs +43 -0
- package/dist/handler.mjs +8 -13
- package/dist/http.d.mts +6 -2
- package/dist/http.mjs +6 -2
- package/dist/index.d.mts +25 -4
- package/dist/index.mjs +91 -40
- package/dist/llms.txt +3 -3
- package/dist/mcp/api.mjs +2 -1
- package/dist/mcp/query.mjs +3 -8
- package/dist/mcp/resolve.mjs +9 -2
- package/dist/node/index.d.mts +36 -0
- package/dist/node/index.mjs +89 -0
- package/dist/node/request.d.mts +12 -0
- package/dist/node/request.mjs +119 -0
- package/dist/node/response.mjs +58 -0
- package/dist/principal.mjs +15 -7
- package/dist/react/Canvas.mjs +88 -67
- package/dist/react/Cell.mjs +2 -1
- package/dist/react/Dashboard.d.mts +9 -1
- package/dist/react/Dashboard.mjs +42 -42
- package/dist/react/DashboardList.mjs +9 -4
- package/dist/react/Editing.d.mts +9 -0
- package/dist/react/Editing.mjs +8 -3
- package/dist/react/Grid.mjs +1 -1
- package/dist/react/Header.mjs +4 -35
- package/dist/react/History.mjs +3 -2
- package/dist/react/LoadFailed.mjs +59 -0
- package/dist/react/Panel.d.mts +1 -1
- package/dist/react/Panel.mjs +1 -1
- package/dist/react/Parts.d.mts +34 -0
- package/dist/react/Parts.mjs +9 -6
- package/dist/react/ReviewPanel.mjs +1 -1
- package/dist/react/RowBody.d.mts +2 -0
- package/dist/react/RowBody.mjs +5 -1
- package/dist/react/Share.mjs +153 -0
- package/dist/react/TabStrip.mjs +37 -0
- package/dist/react/Tile.d.mts +3 -1
- package/dist/react/Tile.mjs +89 -92
- package/dist/react/TileState.mjs +117 -0
- package/dist/react/ago.mjs +45 -0
- package/dist/react/arrange.mjs +1 -1
- package/dist/react/board.mjs +2 -2
- package/dist/react/bucket-name.d.mts +8 -0
- package/dist/react/bucket-name.mjs +13 -0
- package/dist/react/builder/DisplayOptions.mjs +219 -0
- package/dist/react/builder/Preview.mjs +13 -13
- package/dist/react/builder/RangeEditor.mjs +4 -3
- package/dist/react/builder/WidgetBuilder.d.mts +1 -7
- package/dist/react/builder/WidgetBuilder.mjs +12 -3
- package/dist/react/builder/base.d.mts +13 -2
- package/dist/react/builder/base.mjs +70 -12
- package/dist/react/builder/display.d.mts +3 -0
- package/dist/react/builder/display.mjs +256 -0
- package/dist/react/builder/labels.mjs +19 -5
- package/dist/react/builder/options.mjs +11 -6
- package/dist/react/builder/state.mjs +25 -3
- package/dist/react/builder/useBuilder.d.mts +7 -1
- package/dist/react/builder/useBuilder.mjs +6 -9
- package/dist/react/builder/usePreview.mjs +3 -2
- package/dist/react/builder/words.d.mts +16 -1
- package/dist/react/builder/words.mjs +41 -1
- package/dist/react/change-text.mjs +149 -0
- package/dist/react/client.d.mts +9 -0
- package/dist/react/client.mjs +105 -14
- package/dist/react/context.d.mts +24 -3
- package/dist/react/context.mjs +23 -7
- package/dist/react/dates-shown.mjs +76 -0
- package/dist/react/draft.mjs +3 -2
- package/dist/react/drill/Bars.mjs +12 -16
- package/dist/react/drill/Comparison.mjs +1 -1
- package/dist/react/drill/DrillPanel.d.mts +1 -1
- package/dist/react/drill/DrillPanel.mjs +2 -1
- package/dist/react/drill/Header.mjs +65 -12
- package/dist/react/drill/Items.d.mts +1 -1
- package/dist/react/drill/Notes.mjs +10 -7
- package/dist/react/drill/PanelStates.mjs +8 -1
- package/dist/react/drill/Trend.mjs +10 -5
- package/dist/react/drill/board.d.mts +1 -1
- package/dist/react/drill/host.mjs +4 -1
- package/dist/react/drill/lazy.mjs +2 -27
- package/dist/react/drill/props.d.mts +17 -7
- package/dist/react/drill/props.mjs +55 -14
- package/dist/react/drill/state.d.mts +15 -5
- package/dist/react/drill/state.mjs +12 -3
- package/dist/react/drill/words.d.mts +46 -3
- package/dist/react/drill/words.mjs +30 -5
- package/dist/react/english.mjs +33 -8
- package/dist/react/export/ExportButton.mjs +4 -1
- package/dist/react/export/csv.d.mts +7 -2
- package/dist/react/export/csv.mjs +24 -7
- package/dist/react/failure-words.mjs +60 -0
- package/dist/react/filters/bar.d.mts +1 -1
- package/dist/react/filters/bar.mjs +4 -1
- package/dist/react/filters/calendar.mjs +23 -8
- package/dist/react/filters/chip.mjs +7 -3
- package/dist/react/filters/context.d.mts +13 -1
- package/dist/react/filters/context.mjs +1 -1
- package/dist/react/filters/dates-said.mjs +57 -0
- package/dist/react/filters/days.d.mts +3 -4
- package/dist/react/filters/days.mjs +10 -17
- package/dist/react/filters/hooks.d.mts +11 -0
- package/dist/react/filters/hooks.mjs +10 -6
- package/dist/react/filters/menu-search.mjs +17 -9
- package/dist/react/filters/menu.mjs +10 -8
- package/dist/react/filters/phone.mjs +41 -16
- package/dist/react/filters/place.mjs +40 -0
- package/dist/react/filters/popover.mjs +18 -13
- package/dist/react/filters/rules.d.mts +4 -3
- package/dist/react/filters/rules.mjs +3 -3
- package/dist/react/filters/sheet.mjs +7 -3
- package/dist/react/filters/state.mjs +6 -1
- package/dist/react/filters/values.mjs +24 -7
- package/dist/react/filters/words.d.mts +13 -0
- package/dist/react/filters/words.mjs +5 -0
- package/dist/react/format-time.d.mts +17 -6
- package/dist/react/format-time.mjs +152 -33
- package/dist/react/format.d.mts +3 -3
- package/dist/react/format.mjs +27 -133
- package/dist/react/headline.d.mts +6 -3
- package/dist/react/headline.mjs +81 -25
- package/dist/react/index.d.mts +19 -17
- package/dist/react/index.mjs +12 -10
- package/dist/react/lazy.mjs +38 -0
- package/dist/react/messages.d.mts +78 -2
- package/dist/react/now.mjs +38 -0
- package/dist/react/read.d.mts +1 -0
- package/dist/react/read.mjs +140 -9
- package/dist/react/renderers/exact.mjs +31 -59
- package/dist/react/renderers/index.d.mts +27 -6
- package/dist/react/renderers/index.mjs +141 -102
- package/dist/react/renderers/list-parts.mjs +24 -0
- package/dist/react/renderers/list.d.mts +1 -0
- package/dist/react/renderers/list.mjs +99 -43
- package/dist/react/renderers/more-rows.mjs +75 -0
- package/dist/react/renderers/number-before.mjs +320 -0
- package/dist/react/renderers/number-period.mjs +54 -0
- package/dist/react/renderers/number-whole.mjs +29 -0
- package/dist/react/renderers/props.d.mts +24 -1
- package/dist/react/renderers/props.mjs +8 -0
- package/dist/react/renderers/table-cells.mjs +137 -31
- package/dist/react/renderers/table-fit.mjs +55 -10
- package/dist/react/renderers/table-measure.mjs +29 -9
- package/dist/react/renderers/table-row.mjs +14 -9
- package/dist/react/renderers/table-scale.mjs +2 -3
- package/dist/react/renderers/table-sort.mjs +3 -2
- package/dist/react/renderers/table-whole.mjs +37 -0
- package/dist/react/renderers/table.mjs +73 -53
- package/dist/react/review.d.mts +7 -0
- package/dist/react/review.mjs +35 -8
- package/dist/react/roving.d.mts +6 -0
- package/dist/react/roving.mjs +123 -0
- package/dist/react/says-dates.d.mts +7 -0
- package/dist/react/says-dates.mjs +51 -0
- package/dist/react/series.mjs +5 -6
- package/dist/react/stable.mjs +1 -1
- package/dist/react/tabs/EditTabs.mjs +125 -0
- package/dist/react/tabs/NameField.mjs +72 -0
- package/dist/react/tabs/TabMenu.mjs +175 -0
- package/dist/react/tabs/actions.mjs +37 -0
- package/dist/react/tabs/commands.mjs +76 -0
- package/dist/react/tabs/focus.mjs +22 -0
- package/dist/react/tabs/keys.mjs +28 -0
- package/dist/react/theme-unlayered.css +1 -1
- package/dist/react/theme.css +1 -1
- package/dist/react/tile-store.d.mts +4 -0
- package/dist/react/tile-store.mjs +93 -13
- package/dist/react/touch.d.mts +16 -0
- package/dist/react/touch.mjs +39 -0
- package/dist/react/useBoard.d.mts +6 -0
- package/dist/react/useBoard.mjs +1 -0
- package/dist/react/useDashboard.d.mts +2 -0
- package/dist/react/useDashboard.mjs +5 -2
- package/dist/react/useTiles.d.mts +3 -0
- package/dist/react/useTiles.mjs +73 -17
- package/dist/react/view-grid.mjs +2 -2
- package/dist/react/view.mjs +1 -1
- package/dist/recharts/axes.mjs +1 -1
- package/dist/recharts/axis.mjs +23 -73
- package/dist/recharts/bar.d.mts +2 -1
- package/dist/recharts/bar.mjs +140 -64
- package/dist/recharts/fit.mjs +33 -0
- package/dist/recharts/line.mjs +21 -15
- package/dist/recharts/marks.mjs +2 -1
- package/dist/recharts/parts.mjs +16 -13
- package/dist/recharts/table.mjs +8 -3
- package/dist/refusal.mjs +46 -0
- package/dist/registry/filter-bar.json +1 -1
- package/dist/skills/derive-dashboards/SKILL.md +23 -8
- package/dist/tile-doc.mjs +1 -1
- package/package.json +21 -6
- package/dist/charts-react/plan.d.mts +0 -3
- package/dist/charts-react/plan.mjs +0 -37
- package/dist/charts-react/tiles.d.mts +0 -24
- package/dist/core/policy/match.d.mts +0 -16
- package/dist/core/schema/aliases.d.mts +0 -7
- package/dist/core/time/compare.d.mts +0 -30
- package/dist/react/EditBar.d.mts +0 -16
- package/dist/react/History.d.mts +0 -30
- package/dist/react/ReviewPanel.d.mts +0 -15
- package/dist/react/digits.mjs +0 -46
- package/dist/react/drill/trend-touch.mjs +0 -33
- package/dist/react/renderers/exact.d.mts +0 -6
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { missingTenantKey, untiedSource } from "../model/defaults.mjs";
|
|
2
2
|
import { decimalColumns } from "../model/storage.mjs";
|
|
3
|
+
import { parseWireQuery } from "../schema/query.mjs";
|
|
3
4
|
import { isZone } from "../time/temporal.mjs";
|
|
4
5
|
import { principalTenant } from "../types/viewer.mjs";
|
|
5
6
|
import { OracleError } from "./data.mjs";
|
|
@@ -17,10 +18,44 @@ function checkCalendar(calendar) {
|
|
|
17
18
|
function checkTenant(input) {
|
|
18
19
|
const untied = untiedSource(input.model);
|
|
19
20
|
if (untied !== void 0) throw new OracleError("PLAN_ASSERTION", `"${untied}" is not tied to the model's tenant keys, so no query reads the model. Check it with defineModel.`);
|
|
20
|
-
const
|
|
21
|
-
const missing = tenantKeys(input.model).find((key) => (values[key] ?? "") === "");
|
|
21
|
+
const missing = missingTenantKey(input.model, principalTenant(input.principal));
|
|
22
22
|
if (missing !== void 0) throw new OracleError("TENANT_MISSING", `The request has no value for the tenant key "${missing}": viewer() must return it in the viewer's tenant.`);
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Each data key that names no source of the model (a typo would otherwise read as no rows, and
|
|
26
|
+
* answer 0), each source whose data is not a list of rows, or the data itself when it is not
|
|
27
|
+
* rows by source.
|
|
28
|
+
*/
|
|
29
|
+
function dataProblems({ data, model }) {
|
|
30
|
+
if (typeof data !== "object" || data === null) return ["data: rows by source, as an object."];
|
|
31
|
+
return Object.entries(data).flatMap(([source, rows]) => {
|
|
32
|
+
if (!Object.hasOwn(model.sources, source)) return [`data.${source}: no source of the model is "${source}".`];
|
|
33
|
+
return Array.isArray(rows) ? [] : [`data.${source}: a source's data is a list of rows.`];
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/** What a field every query needs takes, said when it is left out, where the schema names only a type. */
|
|
37
|
+
const NEEDS = {
|
|
38
|
+
kind: "A query needs `kind: \"aggregate\"`.",
|
|
39
|
+
source: "A query needs `source`: the name of a source of the model.",
|
|
40
|
+
measures: "A query needs `measures`: a list of `{ id, measure }`."
|
|
41
|
+
};
|
|
42
|
+
/** A schema issue as it is said: what to write for a needed field left out, else the schema's words. */
|
|
43
|
+
function issueText(query, issue) {
|
|
44
|
+
const [field, ...under] = issue.path;
|
|
45
|
+
const left = typeof field === "string" && under.length === 0 && typeof query === "object" && query !== null && Reflect.get(query, field) === void 0;
|
|
46
|
+
return `${issue.path.join(".")}: ${(left ? NEEDS[field] : void 0) ?? issue.message}`;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Refuses a query `/query/run` would refuse, with the same schema and the same code
|
|
50
|
+
* (QUERY_INVALID), and data that is not a list of rows per source. The oracle is called from a
|
|
51
|
+
* host's JavaScript and from tests, where a wrong shape would otherwise be a TypeError from
|
|
52
|
+
* inside or an empty answer.
|
|
53
|
+
*/
|
|
54
|
+
function checkInput(input) {
|
|
55
|
+
const parsed = parseWireQuery(input.query);
|
|
56
|
+
const problems = [...parsed.ok ? [] : parsed.issues.map((i) => issueText(input.query, i)), ...dataProblems(input)];
|
|
57
|
+
if (problems.length > 0) throw new OracleError("QUERY_INVALID", problems.join("; "));
|
|
58
|
+
}
|
|
24
59
|
/** Refuses a request the engine would refuse before planning: a missing tenant, a bad calendar. */
|
|
25
60
|
function checkRequest(input) {
|
|
26
61
|
checkTenant(input);
|
|
@@ -35,4 +70,4 @@ function checkStorage(input, rows) {
|
|
|
35
70
|
const bad = decimalColumns(input.model, input.query).find((column) => rows.some((row) => notFinite(row.data[column])));
|
|
36
71
|
if (bad !== void 0) throw new OracleError("NUMERIC_STORAGE", `The column "${bad}" holds NaN, which is not an exact number.`);
|
|
37
72
|
}
|
|
38
|
-
export { checkRequest, checkStorage };
|
|
73
|
+
export { checkInput, checkRequest, checkStorage };
|
|
@@ -2,6 +2,8 @@ import { OracleInput } from "./data.mjs";
|
|
|
2
2
|
import { OracleResult } from "./evaluate.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* The reference answer to a query over plain rows. Every engine must give the same answer.
|
|
5
|
-
* A dimension with a limit of its own runs as the queries `query/segments` defines.
|
|
5
|
+
* A dimension with a limit of its own runs as the queries `query/segments` defines. Stored
|
|
6
|
+
* values that do not read are left out and counted (`unread`). A query `/query/run` would
|
|
7
|
+
* refuse is refused the same way, as QUERY_INVALID.
|
|
6
8
|
*/
|
|
7
9
|
export declare function evaluate(input: OracleInput): OracleResult;
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
import { hasSegments, keptQuery, limitedDimensions, rankQuery, segmentOtherQuery,
|
|
1
|
+
import { hasSegments, keptQuery, limitedDimensions, rankQuery, segmentOtherQuery, uncutQuery, withSegmentOthers } from "../query/segments.mjs";
|
|
2
2
|
import { evaluatePlain } from "./evaluate.mjs";
|
|
3
3
|
import { unreadable } from "./facts.mjs";
|
|
4
|
+
import { checkInput } from "./request.mjs";
|
|
5
|
+
import { unreadOf } from "./unread.mjs";
|
|
4
6
|
// src/oracle/segmented.ts
|
|
5
7
|
/**
|
|
6
8
|
* The reference answer to a query over plain rows. Every engine must give the same answer.
|
|
7
|
-
* A dimension with a limit of its own runs as the queries `query/segments` defines.
|
|
9
|
+
* A dimension with a limit of its own runs as the queries `query/segments` defines. Stored
|
|
10
|
+
* values that do not read are left out and counted (`unread`). A query `/query/run` would
|
|
11
|
+
* refuse is refused the same way, as QUERY_INVALID.
|
|
8
12
|
*/
|
|
9
13
|
function evaluate(input) {
|
|
14
|
+
checkInput(input);
|
|
15
|
+
const result = evaluateRows(input);
|
|
16
|
+
if (result.unreadable === true) return result;
|
|
17
|
+
const unread = unreadOf(input);
|
|
18
|
+
return unread.length === 0 ? result : {
|
|
19
|
+
...result,
|
|
20
|
+
unread
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function evaluateRows(input) {
|
|
10
24
|
if (!hasSegments(input.query) || unreadable(input)) return evaluatePlain(input);
|
|
11
25
|
const { query } = input;
|
|
12
26
|
const kept = new Map(limitedDimensions(query).map((i) => [i, evaluatePlain({
|
|
@@ -18,18 +32,10 @@ function evaluate(input) {
|
|
|
18
32
|
...input,
|
|
19
33
|
query: keptQuery(query, kept)
|
|
20
34
|
}, whole);
|
|
21
|
-
const
|
|
22
|
-
|
|
35
|
+
const other = segmentOtherQuery(query, kept);
|
|
36
|
+
return withSegmentOthers(query, main, other && evaluatePlain({
|
|
23
37
|
...input,
|
|
24
|
-
query:
|
|
38
|
+
query: other
|
|
25
39
|
}, whole));
|
|
26
|
-
return {
|
|
27
|
-
...main,
|
|
28
|
-
...now === void 0 ? {} : { segmentOther: now },
|
|
29
|
-
...main.compare === void 0 || before === void 0 ? {} : { compare: {
|
|
30
|
-
...main.compare,
|
|
31
|
-
segmentOther: before
|
|
32
|
-
} }
|
|
33
|
-
};
|
|
34
40
|
}
|
|
35
41
|
export { evaluate };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { readExact } from "../exact/stored.mjs";
|
|
2
|
+
import { readColumns } from "../model/storage.mjs";
|
|
3
|
+
import { readTime } from "../time/stored.mjs";
|
|
4
|
+
import { isUnread } from "../value/stored.mjs";
|
|
5
|
+
import { factRows, scopedRows } from "./facts.mjs";
|
|
6
|
+
// src/oracle/unread.ts
|
|
7
|
+
/** Whether a row's value of a column does not read as the column's storage. */
|
|
8
|
+
function unreadOn(input, row, c) {
|
|
9
|
+
const raw = row.data[c.column];
|
|
10
|
+
return c.kind === "time" ? isUnread(readTime(c.storage, raw, input.calendar)) : isUnread(readExact(raw, c.numeric.stored, c.numeric.scale));
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The values the answer leaves out because they do not read as their column's storage, by
|
|
14
|
+
* column, those of no column left out. A time is counted over the rows the query reads without
|
|
15
|
+
* its range (an unread time is in no range); an exact value over the rows it aggregates.
|
|
16
|
+
*/
|
|
17
|
+
function unreadOf(input) {
|
|
18
|
+
const columns = readColumns(input.model, input.query);
|
|
19
|
+
if (columns.length === 0) return [];
|
|
20
|
+
const facts = factRows(input);
|
|
21
|
+
const scoped = columns.some((c) => c.kind === "time") ? scopedRows(input, false) : facts;
|
|
22
|
+
const source = input.query.source;
|
|
23
|
+
return columns.flatMap((c) => {
|
|
24
|
+
const count = (c.kind === "time" ? scoped : facts).filter((row) => unreadOn(input, row, c)).length;
|
|
25
|
+
return count === 0 ? [] : [{
|
|
26
|
+
source,
|
|
27
|
+
column: c.column,
|
|
28
|
+
count
|
|
29
|
+
}];
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export { unreadOf };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { policyBinding, tenantBinding, tenantKeys } from "../model/defaults.mjs";
|
|
1
|
+
import { policyBinding, tenantBinding, tenantEntry, tenantKeys } from "../model/defaults.mjs";
|
|
2
2
|
import { bindPolicy, grantsNothingYet, namedPolicy } from "../policy/bind.mjs";
|
|
3
3
|
import { principalTenant } from "../types/viewer.mjs";
|
|
4
4
|
import { joined, sourceOf } from "./data.mjs";
|
|
@@ -25,8 +25,9 @@ const inTenant = (input, row) => {
|
|
|
25
25
|
if ("via" in tenant) return viaParent(input, row, tenant.via, inTenant);
|
|
26
26
|
const values = principalTenant(input.principal);
|
|
27
27
|
return tenantKeys(input.model).every((key) => {
|
|
28
|
-
const column = tenant.columns
|
|
29
|
-
|
|
28
|
+
const column = tenantEntry(tenant.columns, key);
|
|
29
|
+
const value = tenantEntry(values, key);
|
|
30
|
+
return column !== void 0 && value !== void 0 && row.data[column] === value;
|
|
30
31
|
});
|
|
31
32
|
};
|
|
32
33
|
/** The principal's row policy allows the row. No rule that applies means no rows. */
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import { Model,
|
|
1
|
+
import { Model, RowPolicy } from "../model/types.mjs";
|
|
2
2
|
import { BoundPolicyFilter } from "../query/compose.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { Principal, Viewer } from "../types/viewer.mjs";
|
|
3
|
+
import { Principal } from "../types/viewer.mjs";
|
|
5
4
|
export type BoundRule = "all" | "none" | BoundPolicyFilter;
|
|
6
|
-
/** The viewer's values for a reference. Empty when the viewer does not have it. */
|
|
7
|
-
export declare function viewerValues(viewer: Viewer, ref: ViewerRef): readonly string[];
|
|
8
|
-
/**
|
|
9
|
-
* Replaces every viewer reference by the viewer's values. Returns undefined when any
|
|
10
|
-
* reference has no value: a missing value must never make a negated leaf true, so the whole
|
|
11
|
-
* rule is refused instead.
|
|
12
|
-
*/
|
|
13
|
-
export declare function bindFilter(filter: PolicyFilter, viewer: Viewer | undefined): BoundPolicyFilter | undefined;
|
|
14
5
|
/**
|
|
15
6
|
* What a row policy allows one principal to read.
|
|
16
7
|
*
|
|
@@ -89,4 +89,4 @@ function grantsNothingYet(policy, principal) {
|
|
|
89
89
|
if (viewer === void 0 || bindFilter(allow, viewer) !== void 0) return false;
|
|
90
90
|
return refsOf(allow).every((ref) => holds(viewer, ref));
|
|
91
91
|
}
|
|
92
|
-
export {
|
|
92
|
+
export { bindPolicy, grantsNothingYet, namedPolicy, viewerValues };
|
|
@@ -11,7 +11,12 @@ export type Closure = {
|
|
|
11
11
|
sources: SourceName[];
|
|
12
12
|
members: string[];
|
|
13
13
|
};
|
|
14
|
-
/**
|
|
15
|
-
export
|
|
14
|
+
/** Which members a typo may be offered as: those the asker may read. None unless the caller says. */
|
|
15
|
+
export type Offer = (memberId: string) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The closure of a query, and every reference in it that does not resolve. A mistyped member is
|
|
18
|
+
* offered its nearest name only among members `offer` allows: none by default.
|
|
19
|
+
*/
|
|
20
|
+
export declare function queryClosure(model: Model, query: WireQuery, offer?: Offer): Closure & {
|
|
16
21
|
issues: Issue[];
|
|
17
22
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { parseMemberId, resolveDimension, resolveMeasure } from "../model/member.mjs";
|
|
1
|
+
import { ownEntry, parseMemberId, resolveDimension, resolveMeasure, sourceOf } from "../model/member.mjs";
|
|
2
|
+
import { didYouMean } from "../model/validate/fields.mjs";
|
|
2
3
|
import { derivedIssues } from "./derived-rules.mjs";
|
|
3
4
|
import { formulaRefs } from "./formulas.mjs";
|
|
4
5
|
// src/query/closure.ts
|
|
@@ -9,11 +10,20 @@ function issue(w, message, path) {
|
|
|
9
10
|
path
|
|
10
11
|
});
|
|
11
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* The member a mistyped id most likely meant, among the source's own members of that kind that
|
|
15
|
+
* the model shows (never a hidden or sensitive one) and the asker may read (`offer`): a typo
|
|
16
|
+
* never names a member the asker could not see.
|
|
17
|
+
*/
|
|
18
|
+
function shownMeant(w, id, source, defs = {}) {
|
|
19
|
+
const shown = Object.entries(defs).filter(([name, d]) => d.hidden !== true && d.sensitive !== true && w.offer(`${source}.${name}`));
|
|
20
|
+
return didYouMean(id, shown.map(([name]) => `${source}.${name}`));
|
|
21
|
+
}
|
|
12
22
|
/** A dimension id seen from `source`: own or one join away, recorded as its target's own member. */
|
|
13
23
|
function dimension(w, source, id, path) {
|
|
14
24
|
const resolved = resolveDimension(w.model, source, id);
|
|
15
25
|
if (resolved === void 0) {
|
|
16
|
-
issue(w, `"${id}" is not a dimension of "${source}"
|
|
26
|
+
issue(w, `"${id}" is not a dimension of "${source}".${shownMeant(w, id, source, sourceOf(w.model, source)?.dimensions)}`, path);
|
|
17
27
|
return resolved;
|
|
18
28
|
}
|
|
19
29
|
const name = parseMemberId(id)?.name ?? id;
|
|
@@ -24,7 +34,7 @@ function dimension(w, source, id, path) {
|
|
|
24
34
|
function measure(w, source, id, path) {
|
|
25
35
|
const def = resolveMeasure(w.model, source, id);
|
|
26
36
|
if (def === void 0) {
|
|
27
|
-
issue(w, `"${id}" is not a measure of "${source}"
|
|
37
|
+
issue(w, `"${id}" is not a measure of "${source}".${shownMeant(w, id, source, sourceOf(w.model, source)?.measures)}`, path);
|
|
28
38
|
return;
|
|
29
39
|
}
|
|
30
40
|
w.members.add(id);
|
|
@@ -35,7 +45,7 @@ function operands(def) {
|
|
|
35
45
|
}
|
|
36
46
|
/** A `some` or `none` node reads the child source through a one-to-many join. */
|
|
37
47
|
function childFilter(w, source, node, path) {
|
|
38
|
-
const target = w.model
|
|
48
|
+
const target = ownEntry(sourceOf(w.model, source)?.joins, node.join);
|
|
39
49
|
if (target?.relationship !== "one_to_many") {
|
|
40
50
|
issue(w, `"${node.join}" is not a one-to-many join of "${source}".`, path);
|
|
41
51
|
return;
|
|
@@ -80,16 +90,26 @@ function aliases(w, query) {
|
|
|
80
90
|
for (const [i, o] of (query.order ?? []).entries()) if (!known.has(o.by)) issue(w, `The order refers to "${o.by}", which the query does not have.`, ["order", i]);
|
|
81
91
|
rankings(w, query, known);
|
|
82
92
|
}
|
|
83
|
-
/** The
|
|
84
|
-
function
|
|
93
|
+
/** The query's time axis, when it has one: a dimension of the source, and a time one. */
|
|
94
|
+
function timeAxis(w, source, query) {
|
|
95
|
+
if (query.time === void 0) return;
|
|
96
|
+
const time = dimension(w, source, query.time.dimension, ["time", "dimension"]);
|
|
97
|
+
if (time !== void 0 && time.dimension.kind !== "time") issue(w, `"${query.time.dimension}" is not a time dimension.`, ["time", "dimension"]);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The closure of a query, and every reference in it that does not resolve. A mistyped member is
|
|
101
|
+
* offered its nearest name only among members `offer` allows: none by default.
|
|
102
|
+
*/
|
|
103
|
+
function queryClosure(model, query, offer = () => false) {
|
|
85
104
|
const w = {
|
|
86
105
|
model,
|
|
87
106
|
sources: /* @__PURE__ */ new Set(),
|
|
88
107
|
members: /* @__PURE__ */ new Set(),
|
|
89
|
-
issues: []
|
|
108
|
+
issues: [],
|
|
109
|
+
offer
|
|
90
110
|
};
|
|
91
111
|
const { source } = query;
|
|
92
|
-
if (model
|
|
112
|
+
if (sourceOf(model, source) === void 0) {
|
|
93
113
|
issue(w, `There is no source "${source}".`, ["source"]);
|
|
94
114
|
return {
|
|
95
115
|
sources: [],
|
|
@@ -116,10 +136,7 @@ function queryClosure(model, query) {
|
|
|
116
136
|
"member"
|
|
117
137
|
]);
|
|
118
138
|
if (query.filters !== void 0) filter(w, source, query.filters, ["filters"]);
|
|
119
|
-
|
|
120
|
-
const time = dimension(w, source, query.time.dimension, ["time", "dimension"]);
|
|
121
|
-
if (time !== void 0 && time.dimension.kind !== "time") issue(w, `"${query.time.dimension}" is not a time dimension.`, ["time", "dimension"]);
|
|
122
|
-
}
|
|
139
|
+
timeAxis(w, source, query);
|
|
123
140
|
aliases(w, query);
|
|
124
141
|
w.issues.push(...derivedIssues(model, query));
|
|
125
142
|
return {
|
|
@@ -41,8 +41,9 @@ export declare function documentLock(doc: Doc): LockEntry[];
|
|
|
41
41
|
*
|
|
42
42
|
* - The dashboard's scope filter for the tile's source is ANDed in; one the source cannot
|
|
43
43
|
* take is refused (SCOPE_UNFIT).
|
|
44
|
-
* - A filter pick applies to the tiles that can read its
|
|
45
|
-
* on the
|
|
44
|
+
* - A filter pick applies to the tiles that can read its control's field, the first of the
|
|
45
|
+
* fields the control names that the tile's source reads, and is reported as dropped on the
|
|
46
|
+
* others.
|
|
46
47
|
* - The date range is the first present of: the widget keeping its own, the viewer's pick,
|
|
47
48
|
* the dashboard's, the query's.
|
|
48
49
|
* - The lock is returned apart from the query, so nothing that edits the query can remove it.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EngineError } from "../error/refusal.mjs";
|
|
2
|
-
import { resolveDimension } from "../model/member.mjs";
|
|
2
|
+
import { isOnSource, resolveDimension } from "../model/member.mjs";
|
|
3
3
|
import { DEFAULT_COMPOSITION_POLICY } from "./compose.mjs";
|
|
4
4
|
import { stripIds } from "./filter.mjs";
|
|
5
5
|
import { isDateRange, pickProblem } from "./picks.mjs";
|
|
@@ -8,14 +8,15 @@ import { toWire } from "./to-wire.mjs";
|
|
|
8
8
|
const refuse = (code, message) => {
|
|
9
9
|
throw new EngineError(code, message);
|
|
10
10
|
};
|
|
11
|
-
/** A filter control's pick as the filter it adds; one that does not fit the control is refused. */
|
|
12
11
|
function filterPick(control, pick) {
|
|
13
12
|
const problem = pickProblem(control, pick);
|
|
14
13
|
if (problem !== void 0 || typeof pick !== "object" || pick === null || !("op" in pick)) return refuse("PICK_INVALID", problem ?? `The pick for "${control.id}" is not a filter.`);
|
|
14
|
+
const { op, values } = pick;
|
|
15
15
|
return {
|
|
16
|
-
|
|
17
|
-
op
|
|
18
|
-
values
|
|
16
|
+
id: control.id,
|
|
17
|
+
op,
|
|
18
|
+
values,
|
|
19
|
+
fields: [control.member, ...control.also ?? []]
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
/** Every pick checked against the document's controls; an unknown control is refused. */
|
|
@@ -26,13 +27,23 @@ function readPicks(doc, picks) {
|
|
|
26
27
|
const problem = pickProblem(control, pick);
|
|
27
28
|
if (problem !== void 0) refuse("PICK_INVALID", problem);
|
|
28
29
|
if (control.kind === "date_range" && isDateRange(pick)) out.range = pick;
|
|
29
|
-
else if (control.kind === "filter") out.filters.push(
|
|
30
|
-
id,
|
|
31
|
-
filter: filterPick(control, pick)
|
|
32
|
-
});
|
|
30
|
+
else if (control.kind === "filter") out.filters.push(filterPick(control, pick));
|
|
33
31
|
}
|
|
34
32
|
return out;
|
|
35
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* The filter a pick adds to a tile on `source`: on the first of its fields the source reads.
|
|
36
|
+
* None when the source reads none of them. A field of another source is passed over by its
|
|
37
|
+
* name alone, so a control over many sources costs a tile one lookup, not one for each.
|
|
38
|
+
*/
|
|
39
|
+
function pickFilter(model, source, pick) {
|
|
40
|
+
const member = pick.fields.find((id) => isOnSource(id, source) && resolveDimension(model, source, id) !== void 0);
|
|
41
|
+
return member === void 0 ? void 0 : {
|
|
42
|
+
member,
|
|
43
|
+
op: pick.op,
|
|
44
|
+
values: pick.values
|
|
45
|
+
};
|
|
46
|
+
}
|
|
36
47
|
function rangeFor(widget, doc, picked, policy) {
|
|
37
48
|
const order = policy.datePrecedence ?? DEFAULT_COMPOSITION_POLICY.datePrecedence;
|
|
38
49
|
const candidates = {
|
|
@@ -106,8 +117,9 @@ function documentLock(doc) {
|
|
|
106
117
|
*
|
|
107
118
|
* - The dashboard's scope filter for the tile's source is ANDed in; one the source cannot
|
|
108
119
|
* take is refused (SCOPE_UNFIT).
|
|
109
|
-
* - A filter pick applies to the tiles that can read its
|
|
110
|
-
* on the
|
|
120
|
+
* - A filter pick applies to the tiles that can read its control's field, the first of the
|
|
121
|
+
* fields the control names that the tile's source reads, and is reported as dropped on the
|
|
122
|
+
* others.
|
|
111
123
|
* - The date range is the first present of: the widget keeping its own, the viewer's pick,
|
|
112
124
|
* the dashboard's, the query's.
|
|
113
125
|
* - The lock is returned apart from the query, so nothing that edits the query can remove it.
|
|
@@ -117,7 +129,14 @@ function composeTile(input) {
|
|
|
117
129
|
const { widget, stored } = tileOf(doc, input.widgetId, input.queryName ?? "main");
|
|
118
130
|
const { wire, aliasToId } = toWire(stored);
|
|
119
131
|
const picked = readPicks(doc, input.picks ?? {});
|
|
120
|
-
const fits = picked.filters.
|
|
132
|
+
const fits = picked.filters.flatMap((p) => {
|
|
133
|
+
const filter = pickFilter(model, wire.source, p);
|
|
134
|
+
return filter === void 0 ? [] : [{
|
|
135
|
+
id: p.id,
|
|
136
|
+
filter
|
|
137
|
+
}];
|
|
138
|
+
});
|
|
139
|
+
const applied = new Set(fits.map((p) => p.id));
|
|
121
140
|
const parts = [
|
|
122
141
|
...wire.filters === void 0 ? [] : [wire.filters],
|
|
123
142
|
...scopeFilters(model, doc, wire.source),
|
|
@@ -125,7 +144,7 @@ function composeTile(input) {
|
|
|
125
144
|
];
|
|
126
145
|
const range = wire.time === void 0 ? void 0 : rangeFor(widget, doc, picked, input.policy ?? {});
|
|
127
146
|
const lock = documentLock(doc);
|
|
128
|
-
const dropped = picked.filters.filter((p) => !
|
|
147
|
+
const dropped = picked.filters.filter((p) => !applied.has(p.id)).map((p) => p.id);
|
|
129
148
|
return {
|
|
130
149
|
widget,
|
|
131
150
|
query: withParts(wire, parts, range),
|
|
@@ -69,11 +69,6 @@ export type CompositionPolicy = {
|
|
|
69
69
|
unfit?: "refuse" | "drop_and_report";
|
|
70
70
|
required?: (ctx: ComposeCtx) => readonly RequiredEntry[];
|
|
71
71
|
};
|
|
72
|
-
export declare const DEFAULT_COMPOSITION_POLICY: {
|
|
73
|
-
readonly optOutDrops: readonly ["dashboard"];
|
|
74
|
-
readonly datePrecedence: readonly ["widget_keep", "viewer", "scope", "query"];
|
|
75
|
-
readonly unfit: "refuse";
|
|
76
|
-
};
|
|
77
72
|
/** A bound policy speaks about physical columns, not members. */
|
|
78
73
|
export type BoundPolicyFilter = {
|
|
79
74
|
all: readonly BoundPolicyFilter[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { composeDrill } from "./compose.mjs";
|
|
1
2
|
import { Readable, offeredMembers, trendDimension } from "./fields.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { Drawn, Picked, rowSelection } from "./selection.mjs";
|
|
3
|
+
import { itemsShape } from "./items.mjs";
|
|
4
4
|
import { LineSemantics, drillMeasure, lineSemantics } from "./line.mjs";
|
|
5
|
-
import { ItemsOrder, itemsShape } from "./items.mjs";
|
|
6
5
|
import { Scope, formulaParts, lineScopes, measuresOnly, scopeSteps, scopedLines } from "./scopes.mjs";
|
|
7
|
-
import {
|
|
6
|
+
import { Drawn, rowSelection } from "./selection.mjs";
|
|
8
7
|
import { keptPath, pathFields, stepMembers } from "./steps.mjs";
|
|
9
8
|
import { KEY_FIELD, ROW_COUNT, drillModel, drillOwner, flagCell, storedCell } from "./synthetic.mjs";
|
|
9
|
+
import { DrillClock, trendQuery } from "./time.mjs";
|
|
10
10
|
import { breakdownQuery, countQuery, distinctQuery, lineFilter, parentQuery, population, summaryQuery } from "./views.mjs";
|
|
11
|
-
export { type Drawn, type DrillClock,
|
|
11
|
+
export { type Drawn, type DrillClock, KEY_FIELD, type LineSemantics, ROW_COUNT, type Readable, type Scope, breakdownQuery, composeDrill, countQuery, distinctQuery, drillMeasure, drillModel, drillOwner, flagCell, formulaParts, itemsShape, keptPath, lineFilter, lineScopes, lineSemantics, measuresOnly, offeredMembers, parentQuery, pathFields, population, rowSelection, scopeSteps, scopedLines, stepMembers, storedCell, summaryQuery, trendDimension, trendQuery };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { composeDrill } from "./compose.mjs";
|
|
2
|
+
import { offeredMembers, trendDimension } from "./fields.mjs";
|
|
3
|
+
import { itemsShape } from "./items.mjs";
|
|
4
|
+
import { drillMeasure, lineSemantics } from "./line.mjs";
|
|
5
|
+
import { formulaParts, lineScopes, measuresOnly, scopeSteps, scopedLines } from "./scopes.mjs";
|
|
6
|
+
import { rowSelection } from "./selection.mjs";
|
|
7
|
+
import { keptPath, pathFields, stepMembers } from "./steps.mjs";
|
|
8
|
+
import { KEY_FIELD, ROW_COUNT, drillModel, drillOwner, flagCell, storedCell } from "./synthetic.mjs";
|
|
9
|
+
import { trendQuery } from "./time.mjs";
|
|
10
|
+
import { breakdownQuery, countQuery, distinctQuery, lineFilter, parentQuery, population, summaryQuery } from "./views.mjs";
|
|
11
|
+
export { KEY_FIELD, ROW_COUNT, breakdownQuery, composeDrill, countQuery, distinctQuery, drillMeasure, drillModel, drillOwner, flagCell, formulaParts, itemsShape, keptPath, lineFilter, lineScopes, lineSemantics, measuresOnly, offeredMembers, parentQuery, pathFields, population, rowSelection, scopeSteps, scopedLines, stepMembers, storedCell, summaryQuery, trendDimension, trendQuery };
|
|
@@ -17,11 +17,10 @@ type SourcesOf<M> = M extends {
|
|
|
17
17
|
* a misspelled one does not compile.
|
|
18
18
|
*/
|
|
19
19
|
export type ItemLinksFor<M, L = unknown> = Readonly<Partial<Record<SourcesOf<M>, string>>> & { readonly [K in Exclude<keyof L, SourcesOf<M>>]: never; };
|
|
20
|
-
/** The parts a link template may name: `{id}` and `{key.<column>}`. */
|
|
21
|
-
export declare const LINK_PART: RegExp;
|
|
22
20
|
/**
|
|
23
21
|
* What is wrong with a link template for a source with this key, in words; none when it is right.
|
|
24
|
-
* A template
|
|
22
|
+
* A template is a path on the host's site ("/orders/{id}") or an http(s) URL with its host written
|
|
23
|
+
* out ("https://crm.example.com/o/{id}"), and names only {id} and {key.<column>} of that key.
|
|
25
24
|
*/
|
|
26
25
|
export declare function linkTemplateIssues(template: string, key: readonly string[]): string[];
|
|
27
26
|
/** The link to one item, or undefined when its source has no template, its key is hidden, or a part is missing. */
|
|
@@ -2,13 +2,27 @@
|
|
|
2
2
|
/** The parts a link template may name: `{id}` and `{key.<column>}`. */
|
|
3
3
|
const LINK_PART = /\{(id|key\.[^{}]+)\}/gu;
|
|
4
4
|
/**
|
|
5
|
+
* Where a link may go: a path on the host's own site (one "/", then not a second "/" or "\",
|
|
6
|
+
* which a browser reads as another host), or an http(s) URL whose host is written out in the
|
|
7
|
+
* template. Every part an item fills in comes after it and is encoded, so no item can choose
|
|
8
|
+
* where its link goes, and no link runs script (`javascript:`) or carries inline data (`data:`).
|
|
9
|
+
*/
|
|
10
|
+
const SAFE_START = /^(?:\/(?![/\\])|https?:\/\/[^/\\?#{}\s@]+(?:[/?#]|$))/iu;
|
|
11
|
+
/**
|
|
12
|
+
* What the URL parser strips or reads as a break before it reads a link: whitespace and control
|
|
13
|
+
* characters. Text checked with one inside is not the link a browser follows (`"/\t/evil.example"`
|
|
14
|
+
* is `//evil.example`), so a template holds none.
|
|
15
|
+
*/
|
|
16
|
+
const UNWRITTEN = /[\s\p{Cc}]/u;
|
|
17
|
+
/**
|
|
5
18
|
* What is wrong with a link template for a source with this key, in words; none when it is right.
|
|
6
|
-
* A template
|
|
19
|
+
* A template is a path on the host's site ("/orders/{id}") or an http(s) URL with its host written
|
|
20
|
+
* out ("https://crm.example.com/o/{id}"), and names only {id} and {key.<column>} of that key.
|
|
7
21
|
*/
|
|
8
22
|
function linkTemplateIssues(template, key) {
|
|
9
23
|
const issues = [];
|
|
10
|
-
if (
|
|
11
|
-
if (
|
|
24
|
+
if (UNWRITTEN.test(template)) issues.push(`${JSON.stringify(template)}: a link holds no space or control character, which a browser drops or reads as a break ("/\\t/evil.example" goes to evil.example); encode one as %20 or %09.`);
|
|
25
|
+
else if (!SAFE_START.test(template)) issues.push(`"${template}": a link is a path starting with one "/" ("/orders/{id}") or an http(s) URL with its host written out ("https://crm.example.com/o/{id}").`);
|
|
12
26
|
for (const [, part = ""] of template.matchAll(/\{([^{}]*)\}/gu)) {
|
|
13
27
|
const column = part.startsWith("key.") ? part.slice(4) : void 0;
|
|
14
28
|
if (part !== "id" && column === void 0) issues.push(`names {${part}}: a template names {id} or {key.<column>} only.`);
|
|
@@ -28,4 +42,4 @@ function itemLink(links, item) {
|
|
|
28
42
|
});
|
|
29
43
|
return missing ? void 0 : link;
|
|
30
44
|
}
|
|
31
|
-
export {
|
|
45
|
+
export { itemLink, linkTemplateIssues };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DrillReason } from "../../error/codes.mjs";
|
|
2
2
|
import { ResultCell, ResultColumn, ResultRows } from "../../result/types.mjs";
|
|
3
|
-
import { Span } from "../../time/range.mjs";
|
|
4
3
|
import { Calendar } from "../types.mjs";
|
|
5
4
|
import { Cuts, Selection } from "./types.mjs";
|
|
6
5
|
/** A drawn answer's column. One sealed by an earlier release has no `role`, only its id. */
|
|
@@ -11,7 +10,14 @@ type DrawnColumn = Omit<ResultColumn, "role"> & {
|
|
|
11
10
|
export type Drawn = {
|
|
12
11
|
columns: readonly DrawnColumn[];
|
|
13
12
|
rows: ResultRows;
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* The answer's resolved range (its receipt's), as text time: sealed into a drill token as
|
|
15
|
+
* text, so an instant keeps every microsecond through JSON.
|
|
16
|
+
*/
|
|
17
|
+
range?: {
|
|
18
|
+
from: string;
|
|
19
|
+
to: string;
|
|
20
|
+
};
|
|
15
21
|
calendar: Calendar;
|
|
16
22
|
/** The query has a limit of its own with Other: an all-Other row is that limit's Other. */
|
|
17
23
|
limited?: boolean;
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { roleOf } from "../../result/columns.mjs";
|
|
2
2
|
import { isMark } from "../../result/marks.mjs";
|
|
3
|
+
import { parseTextTime } from "../../time/text-time.mjs";
|
|
3
4
|
import { labelStart, nextBucketStart } from "../../time/bucket.mjs";
|
|
4
|
-
import { formatTextTime } from "../../time/instant.mjs";
|
|
5
|
+
import { earliest, formatTextTime, latest } from "../../time/instant.mjs";
|
|
5
6
|
// src/query/drill/selection.ts
|
|
7
|
+
/** A resolved range's instants; none when it is absent or does not read. */
|
|
8
|
+
function spanOf(range) {
|
|
9
|
+
const from = range === void 0 ? void 0 : parseTextTime(range.from);
|
|
10
|
+
const to = range === void 0 ? void 0 : parseTextTime(range.to);
|
|
11
|
+
return from === void 0 || to === void 0 ? void 0 : {
|
|
12
|
+
from,
|
|
13
|
+
to
|
|
14
|
+
};
|
|
15
|
+
}
|
|
6
16
|
/** A drawn column with its role: its own, or for one an earlier release sealed, its id's. */
|
|
7
17
|
const withRole = (c) => ({
|
|
8
18
|
...c,
|
|
@@ -14,8 +24,9 @@ function bucketStep(drawn, column, cell) {
|
|
|
14
24
|
const start = labelStart(cell, column.grain, drawn.calendar);
|
|
15
25
|
if (start === void 0) return void 0;
|
|
16
26
|
const end = nextBucketStart(start, column.grain, drawn.calendar);
|
|
17
|
-
const
|
|
18
|
-
const
|
|
27
|
+
const span = spanOf(drawn.range);
|
|
28
|
+
const from = latest(start, span?.from ?? start);
|
|
29
|
+
const to = earliest(end, span?.to ?? end);
|
|
19
30
|
return { bucket: {
|
|
20
31
|
member: column.member,
|
|
21
32
|
from: formatTextTime(from),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { storedExact } from "../../exact/
|
|
1
|
+
import { storedExact } from "../../exact/stored.mjs";
|
|
2
2
|
import { formatExact } from "../../exact/text.mjs";
|
|
3
3
|
import { parseMemberId } from "../../model/member.mjs";
|
|
4
4
|
import { memberLabel } from "../../result/columns.mjs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EngineError } from "../../error/refusal.mjs";
|
|
2
2
|
import { resolveDimension } from "../../model/member.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { earliest, formatTextTime, latest } from "../../time/instant.mjs";
|
|
4
|
+
import { MICROS_PER_DAY } from "../../time/text-time.mjs";
|
|
5
|
+
import { requestInstant, resolveRange } from "../../time/range.mjs";
|
|
6
6
|
import { trendDimension } from "./fields.mjs";
|
|
7
7
|
// src/query/drill/time.ts
|
|
8
8
|
const refuse = (message) => {
|
|
@@ -10,7 +10,7 @@ const refuse = (message) => {
|
|
|
10
10
|
};
|
|
11
11
|
/** A window's instants; refused unless both ends read and `from` is before `to`. */
|
|
12
12
|
function windowSpan(step, calendar) {
|
|
13
|
-
const span = resolveRange(step,
|
|
13
|
+
const span = resolveRange(step, 0n, calendar);
|
|
14
14
|
if (span === void 0 || span.from >= span.to) return refuse("A time step has no span.");
|
|
15
15
|
return span;
|
|
16
16
|
}
|
|
@@ -27,10 +27,11 @@ function drilledTime(model, query, steps, clock) {
|
|
|
27
27
|
};
|
|
28
28
|
const dimension = trendDimension(model, query) ?? refuse("This source has no time field.");
|
|
29
29
|
if (buckets.some((b) => b.member !== dimension)) refuse(`A time step is on "${dimension}".`);
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
30
|
+
const tile = own === void 0 ? void 0 : resolveRange(own.range, requestInstant(clock.now, clock.quantumSeconds), clock.calendar);
|
|
31
|
+
const windows = buckets.map((b) => windowSpan(b, clock.calendar));
|
|
32
|
+
const spans = tile === void 0 ? windows : [tile, ...windows];
|
|
33
|
+
const from = spans.map((s) => s.from).reduce((a, b) => latest(a, b));
|
|
34
|
+
const to = latest(from, spans.map((s) => s.to).reduce((a, b) => earliest(a, b)));
|
|
34
35
|
return {
|
|
35
36
|
dimension,
|
|
36
37
|
range: {
|
|
@@ -54,8 +55,8 @@ function trendQuery(model, set, clock, grain) {
|
|
|
54
55
|
unit: "month",
|
|
55
56
|
includeCurrent: true
|
|
56
57
|
};
|
|
57
|
-
const span = resolveRange(range,
|
|
58
|
-
const days = span === void 0 ? 0 : (span.to - span.from) / MICROS_PER_DAY;
|
|
58
|
+
const span = resolveRange(range, requestInstant(clock.now, clock.quantumSeconds), clock.calendar);
|
|
59
|
+
const days = span === void 0 ? 0 : Number(span.to - span.from) / Number(MICROS_PER_DAY);
|
|
59
60
|
const def = resolveDimension(model, set.source, dimension)?.dimension;
|
|
60
61
|
const dateOnly = def?.kind === "time" && def.storage === "date";
|
|
61
62
|
return {
|