derive-dashboards 0.7.1 → 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 +86 -44
- 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 -32
- 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 +51 -9
- 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 +12 -6
- 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/marks/x-axis.mjs +3 -2
- 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.d.mts +25 -25
- package/dist/charts/theme.mjs +47 -30
- 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 +11 -8
- package/dist/core/document/display.mjs +26 -3
- 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 -18
- package/dist/core/time/bucket.mjs +12 -8
- 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.d.mts +6 -1
- package/dist/core/time/zone.mjs +13 -4
- 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 +90 -69
- package/dist/react/Cell.mjs +2 -1
- package/dist/react/Dashboard.d.mts +15 -1
- package/dist/react/Dashboard.mjs +43 -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 +25 -52
- 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/columns.mjs +9 -1
- 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/board.mjs +1 -0
- package/dist/react/drill/host.mjs +4 -1
- package/dist/react/drill/lazy.mjs +2 -27
- package/dist/react/drill/props.d.mts +19 -8
- package/dist/react/drill/props.mjs +62 -18
- 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 +35 -122
- package/dist/react/headline.d.mts +12 -0
- package/dist/react/headline.mjs +107 -0
- package/dist/react/index.d.mts +20 -17
- package/dist/react/index.mjs +13 -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/place.mjs +4 -2
- 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 +154 -92
- 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 +23 -17
- package/dist/recharts/marks.mjs +2 -1
- package/dist/recharts/parts.mjs +19 -14
- 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 +25 -9
- 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,11 +1,11 @@
|
|
|
1
1
|
import { Chart } from "./Chart.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { rowOf } from "./plan-parts.mjs";
|
|
3
3
|
import { itemText } from "./Reader.mjs";
|
|
4
|
+
import { noteOf } from "./words.mjs";
|
|
4
5
|
import { useMemo } from "react";
|
|
5
6
|
import { ENGLISH } from "derive-dashboards/charts";
|
|
6
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import { sharedDisplay } from "derive-dashboards/core";
|
|
8
|
-
import { ENGLISH as ENGLISH$1 } from "derive-dashboards/react";
|
|
9
9
|
// src/tiles.tsx
|
|
10
10
|
/**
|
|
11
11
|
* A click or Enter opens the row behind the value chosen, when values stand for rows and the
|
|
@@ -49,35 +49,45 @@ const chartWords = (messages) => ({
|
|
|
49
49
|
averaged: messages.chartAveraged ?? ENGLISH.averaged,
|
|
50
50
|
merged: messages.chartMerged ?? ENGLISH.merged,
|
|
51
51
|
more: messages.moreRows,
|
|
52
|
+
notShown: (named, more) => messages.notDrawn([...named, ...more > 0 ? [messages.moreRows(more)] : []]),
|
|
52
53
|
funnel: messages.chartFunnel ?? ENGLISH.funnel,
|
|
53
54
|
waterfall: ENGLISH.waterfall,
|
|
54
55
|
histogram: ENGLISH.histogram
|
|
55
56
|
});
|
|
56
57
|
/**
|
|
58
|
+
* Whether a tile's chart is as tall as its picture asks: the tile is told to fit, and the chart
|
|
59
|
+
* is rows lying down or small multiples, the kinds that say how tall they are.
|
|
60
|
+
*/
|
|
61
|
+
const fits = (props, plan) => props.fit === true && (plan.lying === true || plan.panels === true);
|
|
62
|
+
/**
|
|
57
63
|
* A tile's chart, filling its box, with what it does not draw named under the picture, inside
|
|
58
64
|
* the chart's box. The chart lays the picture over the note inline, so it holds without any
|
|
59
65
|
* stylesheet; its look (the tooltip, the focus ring) is in `chart.css`, and its reader table stays out of layout even without the theme.
|
|
60
66
|
*/
|
|
61
|
-
function Tile({ props,
|
|
67
|
+
function Tile({ props, plan: planned }) {
|
|
62
68
|
const { answer, slots, locale, messages, widget } = props;
|
|
63
|
-
const plan = useMemo(() =>
|
|
69
|
+
const plan = useMemo(() => planned({
|
|
64
70
|
answer,
|
|
65
71
|
messages,
|
|
66
72
|
widget,
|
|
67
73
|
...slots === void 0 ? {} : { slots },
|
|
68
74
|
...locale === void 0 ? {} : { locale }
|
|
69
|
-
}
|
|
75
|
+
}), [
|
|
70
76
|
answer,
|
|
71
77
|
slots,
|
|
72
78
|
locale,
|
|
73
79
|
messages,
|
|
74
80
|
widget,
|
|
75
|
-
|
|
81
|
+
planned
|
|
76
82
|
]);
|
|
77
83
|
const words = useMemo(() => chartWords(messages), [messages]);
|
|
78
|
-
const
|
|
84
|
+
const said = plan === void 0 ? "" : noteOf({
|
|
85
|
+
summed: plan.summed ?? [],
|
|
86
|
+
notDrawn: plan.notDrawn
|
|
87
|
+
}, messages);
|
|
88
|
+
const note = said === "" ? null : /* @__PURE__ */ jsx("p", {
|
|
79
89
|
className: "dd-chart-note",
|
|
80
|
-
children:
|
|
90
|
+
children: said
|
|
81
91
|
});
|
|
82
92
|
if (plan === void 0 || plan.empty) return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
83
93
|
className: "dd-tile-state",
|
|
@@ -85,9 +95,10 @@ function Tile({ props, kind }) {
|
|
|
85
95
|
}), note] });
|
|
86
96
|
return /* @__PURE__ */ jsx(Chart, {
|
|
87
97
|
draw: plan.draw,
|
|
98
|
+
fit: fits(props, plan),
|
|
88
99
|
markKeys: false,
|
|
89
100
|
...messages.chartTablePages === void 0 ? {} : { tablePages: messages.chartTablePages },
|
|
90
|
-
noPlot: messages.chartTooSmall
|
|
101
|
+
...messages.chartTooSmall === void 0 ? {} : { noPlot: messages.chartTooSmall },
|
|
91
102
|
words,
|
|
92
103
|
caption: messages.chartTable({
|
|
93
104
|
title: widget.title,
|
|
@@ -100,43 +111,4 @@ function Tile({ props, kind }) {
|
|
|
100
111
|
children: note
|
|
101
112
|
});
|
|
102
113
|
}
|
|
103
|
-
|
|
104
|
-
const LineTile = (props) => /* @__PURE__ */ jsx(Tile, {
|
|
105
|
-
props,
|
|
106
|
-
kind: "line"
|
|
107
|
-
});
|
|
108
|
-
/** Values over time as columns; by category, ranked bars, each with a tick where the widget names what it is read against. */
|
|
109
|
-
const BarTile = (props) => /* @__PURE__ */ jsx(Tile, {
|
|
110
|
-
props,
|
|
111
|
-
kind: "bar"
|
|
112
|
-
});
|
|
113
|
-
/** Values over time as a stacked area where they add up, lines where they do not; by category, bars. */
|
|
114
|
-
const AreaTile = (props) => /* @__PURE__ */ jsx(Tile, {
|
|
115
|
-
props,
|
|
116
|
-
kind: "area"
|
|
117
|
-
});
|
|
118
|
-
/** A small chart for each series over time, on one scale; by category, bars. */
|
|
119
|
-
const MultiplesTile = (props) => /* @__PURE__ */ jsx(Tile, {
|
|
120
|
-
props,
|
|
121
|
-
kind: "multiples"
|
|
122
|
-
});
|
|
123
|
-
/** One value by two fields, each cell shaded by its value. */
|
|
124
|
-
const HeatmapTile = (props) => /* @__PURE__ */ jsx(Tile, {
|
|
125
|
-
props,
|
|
126
|
-
kind: "heatmap"
|
|
127
|
-
});
|
|
128
|
-
/** Steps in order, each read against the first and the one before it. */
|
|
129
|
-
const FunnelTile = (props) => /* @__PURE__ */ jsx(Tile, {
|
|
130
|
-
props,
|
|
131
|
-
kind: "funnel"
|
|
132
|
-
});
|
|
133
|
-
/** The tiles drawn by the charts package: `<DashboardsProvider renderers={CHARTS_RENDERERS}>`. */
|
|
134
|
-
const CHARTS_RENDERERS = {
|
|
135
|
-
line: LineTile,
|
|
136
|
-
bar: BarTile,
|
|
137
|
-
area: AreaTile,
|
|
138
|
-
multiples: MultiplesTile,
|
|
139
|
-
heatmap: HeatmapTile,
|
|
140
|
-
funnel: FunnelTile
|
|
141
|
-
};
|
|
142
|
-
export { AreaTile, BarTile, CHARTS_RENDERERS, FunnelTile, HeatmapTile, LineTile, MultiplesTile, chartWords, selectOf };
|
|
114
|
+
export { Tile, chartWords, selectOf };
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
+
import { useSize } from "./useSize.mjs";
|
|
1
2
|
import { useId, useMemo, useState, useSyncExternalStore } from "react";
|
|
2
3
|
import { renderSvg, tableMeasure } from "derive-dashboards/charts";
|
|
3
4
|
// src/useScene.ts
|
|
4
5
|
/** The scene for a size, none for no size; made again only when the size, `draw` or how text is read changes. */
|
|
5
|
-
function useDrawn(props,
|
|
6
|
+
function useDrawn(props, room) {
|
|
6
7
|
const { draw, measure = tableMeasure, locale, words } = props;
|
|
7
|
-
const width =
|
|
8
|
-
const height =
|
|
8
|
+
const width = room?.width;
|
|
9
|
+
const height = room?.height;
|
|
10
|
+
const sizing = room?.sizing === true;
|
|
9
11
|
return useMemo(() => width === void 0 || height === void 0 ? void 0 : draw({
|
|
10
12
|
width,
|
|
11
13
|
height,
|
|
12
14
|
measure,
|
|
13
15
|
...locale === void 0 ? {} : { locale },
|
|
14
|
-
...words === void 0 ? {} : { words }
|
|
16
|
+
...words === void 0 ? {} : { words },
|
|
17
|
+
...sizing ? { sizing } : {}
|
|
15
18
|
}), [
|
|
16
19
|
draw,
|
|
17
20
|
width,
|
|
18
21
|
height,
|
|
19
22
|
measure,
|
|
20
23
|
locale,
|
|
21
|
-
words
|
|
24
|
+
words,
|
|
25
|
+
sizing
|
|
22
26
|
]);
|
|
23
27
|
}
|
|
24
28
|
/** The room a chart's words are written for where its box is not measured yet: a usual tile's. */
|
|
@@ -41,24 +45,48 @@ function useServerMarkup() {
|
|
|
41
45
|
return first;
|
|
42
46
|
}
|
|
43
47
|
const positiveOr = (value, fallback) => value !== void 0 && value > 0 ? value : fallback;
|
|
48
|
+
/** The room a chart is laid out for before its box is measured: the size given, a usual tile's for what was not. */
|
|
49
|
+
const roomOf = (props) => ({
|
|
50
|
+
width: positiveOr(props.width, USUAL.width),
|
|
51
|
+
height: positiveOr(props.height, USUAL.height)
|
|
52
|
+
});
|
|
53
|
+
/** Whether a box was measured to have no room: a chart in a hidden tab. */
|
|
54
|
+
const isCollapsed = (size) => size !== void 0 && (size.width <= 0 || size.height <= 0);
|
|
44
55
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
56
|
+
* The height a chart told to fit asks for before it has a scene to read it off: its kind is
|
|
57
|
+
* asked only how tall it would be (`Env.sizing`), which lays no row out.
|
|
47
58
|
*/
|
|
48
|
-
function
|
|
49
|
-
const
|
|
59
|
+
function useAsked(props, said) {
|
|
60
|
+
const sized = useDrawn(props, props.fit === true && said === void 0 ? {
|
|
61
|
+
...roomOf(props),
|
|
62
|
+
sizing: true
|
|
63
|
+
} : void 0);
|
|
64
|
+
return (said ?? sized)?.natural;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A chart's scene for the size its stage is measured at; the scene whose words it says: its
|
|
68
|
+
* own, or before its box is measured, on a server and over a server's markup, one laid out only
|
|
69
|
+
* to be read; and the height its picture asks for (`Scene.natural`), when its kind says one.
|
|
70
|
+
*
|
|
71
|
+
* A chart told to fit is as tall as its picture asks from its first paint, so the page does not
|
|
72
|
+
* jump when the picture comes. Mounted in a browser, it has no scene to read that height off
|
|
73
|
+
* before its box is measured, so it asks its kind for the height alone. Its stage is then that
|
|
74
|
+
* tall when it is measured, and the one scene laid out is the one drawn.
|
|
75
|
+
*/
|
|
76
|
+
function useScenes(props, stage) {
|
|
77
|
+
const size = useSize(stage, {
|
|
78
|
+
width: props.width,
|
|
79
|
+
height: props.height
|
|
80
|
+
});
|
|
81
|
+
const collapsed = isCollapsed(size);
|
|
50
82
|
const scene = useDrawn(props, collapsed ? void 0 : size);
|
|
51
83
|
const served = useServerMarkup();
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const height = positiveOr(props.height, USUAL.height);
|
|
55
|
-
const read = useDrawn(props, unread ? {
|
|
56
|
-
width,
|
|
57
|
-
height
|
|
58
|
-
} : void 0);
|
|
84
|
+
const read = useDrawn(props, scene === void 0 && (served || collapsed) ? roomOf(props) : void 0);
|
|
85
|
+
const said = scene ?? read;
|
|
59
86
|
return {
|
|
60
87
|
scene,
|
|
61
|
-
said
|
|
88
|
+
said,
|
|
89
|
+
asked: useAsked(props, said)
|
|
62
90
|
};
|
|
63
91
|
}
|
|
64
92
|
/** The picture as SVG text, its ids named under this chart's own, so two never share one. */
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/words.ts
|
|
2
|
+
/** How many of the things a note lists it names; the rest it counts. */
|
|
3
|
+
const NAMED = 3;
|
|
4
|
+
/** Names the first few of a list and counts the rest, the count always last. */
|
|
5
|
+
function namedFew(labels, messages) {
|
|
6
|
+
if (labels.length <= NAMED) return [...labels];
|
|
7
|
+
return [...labels.slice(0, NAMED), messages.moreRows(labels.length - NAMED)];
|
|
8
|
+
}
|
|
9
|
+
/** A list in a sentence: "low", "low and high", "low, high and Other". */
|
|
10
|
+
const listed = (labels) => labels.length < 2 ? labels.join("") : `${labels.slice(0, -1).join(", ")} and ${labels.at(-1)}`;
|
|
11
|
+
/** Under a bar tile that sums a split, in English: what each bar adds up. */
|
|
12
|
+
const englishSummed = (parts) => `Each bar adds up ${listed(parts)}. Show it as a table to see each.`;
|
|
13
|
+
/** Under a bar tile that sums a split: what each bar adds up, in the host's words when it gives them. */
|
|
14
|
+
const summedNote = (parts, messages) => (messages.chartSummed ?? englishSummed)(namedFew(parts, messages));
|
|
15
|
+
/** The note under a chart, from what its plan tells; empty when everything is drawn as one series. */
|
|
16
|
+
function noteOf(told, messages) {
|
|
17
|
+
return [...told.summed.length > 0 ? [summedNote(told.summed, messages)] : [], ...told.notDrawn.length > 0 ? [messages.notDrawn(told.notDrawn)] : []].join(" ");
|
|
18
|
+
}
|
|
19
|
+
export { namedFew, noteOf, summedNote };
|
package/dist/checks.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { authorizeFree } from "./authorize.mjs";
|
|
2
2
|
import { editorOf, storeFor, storedId } from "./editing.mjs";
|
|
3
|
+
import { allows, allowsEach } from "./grant.mjs";
|
|
3
4
|
import { HttpError } from "./http.mjs";
|
|
4
5
|
import { dashboardResource } from "./owner.mjs";
|
|
5
|
-
import { QueryReferenceError, lockChanged, parseMemberId, resolveDimension, toWire } from "derive-dashboards/core";
|
|
6
|
+
import { QueryReferenceError, controlFieldIssues, controlFieldOffers, lockChanged, parseMemberId, resolveDimension, toWire } from "derive-dashboards/core";
|
|
6
7
|
// src/checks.ts
|
|
7
8
|
/** A stored query as the engine reads it; one that names a missing formula part is refused. */
|
|
8
9
|
function wireOf(query) {
|
|
@@ -20,25 +21,99 @@ function wireOf(query) {
|
|
|
20
21
|
async function checkCommands(rt, viewer, dashboard, commands) {
|
|
21
22
|
const queries = commands.flatMap((c) => c.type === "widget.setQuery" ? [c.query] : c.type === "widget.add" ? Object.values(c.widget.queries) : []);
|
|
22
23
|
for (const query of queries) await authorizeFree(rt.options, viewer, wireOf(query));
|
|
23
|
-
await checkFilters(rt, viewer, commands.flatMap((c) => c.type === "control.add" ? [
|
|
24
|
+
await checkFilters(rt, viewer, commands.flatMap((c, at) => c.type === "control.add" ? [{
|
|
25
|
+
control: c.control,
|
|
26
|
+
path: [
|
|
27
|
+
"commands",
|
|
28
|
+
at,
|
|
29
|
+
"control"
|
|
30
|
+
]
|
|
31
|
+
}] : []));
|
|
24
32
|
if (commands.some((c) => c.type === "lock.set" || c.type === "lock.remove")) {
|
|
25
|
-
if (!await rt.options.access
|
|
33
|
+
if (!await allows(rt.options.access, viewer, "manage", dashboard)) throw new HttpError(403, "FORBIDDEN", "Changing a dashboard's lock needs manage.");
|
|
26
34
|
}
|
|
27
35
|
}
|
|
36
|
+
/** Every field the filters among `placed` name. */
|
|
37
|
+
const filterFields = (placed) => placed.flatMap(({ control: c }) => c.kind === "filter" ? [c.member, ...c.also ?? []] : []);
|
|
28
38
|
/**
|
|
29
|
-
*
|
|
30
|
-
* a
|
|
39
|
+
* The members a refusal of these controls may name that this editor may read: the field a typo
|
|
40
|
+
* most likely meant, or a name that is a measure. The host is asked only when a filter has a
|
|
41
|
+
* problem, and only about the few members such a refusal could name (`controlFieldOffers`),
|
|
42
|
+
* never about every member of the model, nor again about one it has answered for (`granted`):
|
|
43
|
+
* a valid edit costs no extra grants, and a mistyped one a handful.
|
|
31
44
|
*/
|
|
32
|
-
async function
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
async function readableOffers(rt, viewer, at) {
|
|
46
|
+
const { model, access } = rt.options;
|
|
47
|
+
const asked = {
|
|
48
|
+
access,
|
|
49
|
+
viewer,
|
|
50
|
+
verb: "view"
|
|
51
|
+
};
|
|
52
|
+
const controls = at.placed.map(({ control }) => control);
|
|
53
|
+
const offers = controlFieldOffers(controls, model).filter((id) => !at.granted.has(id));
|
|
54
|
+
const sources = [...new Set(offers.flatMap((id) => parseMemberId(id)?.source ?? []))];
|
|
55
|
+
const seen = await allowsEach(asked, sources.map((id) => ({
|
|
56
|
+
kind: "source",
|
|
57
|
+
id
|
|
58
|
+
})));
|
|
59
|
+
const open = new Set(sources.filter((_name, i) => seen[i] === true));
|
|
60
|
+
const ids = offers.filter((id) => open.has(parseMemberId(id)?.source ?? ""));
|
|
61
|
+
const answers = await allowsEach(asked, ids.map((id) => ({
|
|
62
|
+
kind: "member",
|
|
63
|
+
id
|
|
64
|
+
})));
|
|
65
|
+
const readable = new Set(ids.filter((_id, i) => answers[i] === true));
|
|
66
|
+
return (id) => readable.has(id) || at.granted.get(id) === true;
|
|
67
|
+
}
|
|
68
|
+
/** What is wrong with each placed control's fields, at its place in the edit. */
|
|
69
|
+
function placedIssues(rt, placed, offer) {
|
|
70
|
+
return placed.flatMap(({ control, path }) => controlFieldIssues([control], rt.options.model, offer).map((found) => ({
|
|
71
|
+
...found,
|
|
72
|
+
path: [...path, ...found.path.slice(1)]
|
|
73
|
+
})));
|
|
74
|
+
}
|
|
75
|
+
/** The fields among `fields` the model has, each once, in the order first named. */
|
|
76
|
+
const knownFields = (rt, fields) => [...new Set(fields)].filter((member) => {
|
|
77
|
+
const source = parseMemberId(member)?.source;
|
|
78
|
+
return source !== void 0 && resolveDimension(rt.options.model, source, member) !== void 0;
|
|
79
|
+
});
|
|
80
|
+
/**
|
|
81
|
+
* Whether the editor may read each field named, by id. The host is asked about the fields
|
|
82
|
+
* together (`allowsEach`): its check may read its own database, and a document names many
|
|
83
|
+
* fields, so asked in turn a save waited for each answer.
|
|
84
|
+
*/
|
|
85
|
+
async function grantsOf(rt, viewer, fields) {
|
|
86
|
+
const known = knownFields(rt, fields);
|
|
87
|
+
const answers = await allowsEach({
|
|
88
|
+
access: rt.options.access,
|
|
89
|
+
viewer,
|
|
90
|
+
verb: "view"
|
|
91
|
+
}, known.map((id) => ({
|
|
92
|
+
kind: "member",
|
|
93
|
+
id
|
|
94
|
+
})));
|
|
95
|
+
return new Map(known.map((id, i) => [id, answers[i] === true]));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Every filter an edit adds narrows a field the model has, that the editor may read, and that
|
|
99
|
+
* could ever apply (`controlFieldIssues`): a filter on a field that does not exist would never
|
|
100
|
+
* apply, and one on a hidden field would show its values. Read access is asked first, so a
|
|
101
|
+
* refusal never describes a field the editor may not read. The first field refused in the
|
|
102
|
+
* order named is the one reported, whichever answer came first, so the same edit is always
|
|
103
|
+
* refused for the same field. A wrong field refuses the edit as EDIT_REFUSED, each issue
|
|
104
|
+
* CONTROL_FIELD at its place, as a code dashboard is refused at start.
|
|
105
|
+
*/
|
|
106
|
+
async function checkFilters(rt, viewer, placed) {
|
|
107
|
+
const granted = await grantsOf(rt, viewer, filterFields(placed));
|
|
108
|
+
const refused = [...granted].find(([, may]) => !may)?.[0];
|
|
109
|
+
if (refused !== void 0) throw new HttpError(403, "FORBIDDEN", `A filter on "${refused}" needs view on it.`);
|
|
110
|
+
if (placedIssues(rt, placed).length === 0) return;
|
|
111
|
+
const issues = placedIssues(rt, placed, await readableOffers(rt, viewer, {
|
|
112
|
+
placed,
|
|
113
|
+
granted
|
|
114
|
+
}));
|
|
115
|
+
const [first] = issues;
|
|
116
|
+
if (first !== void 0) throw new HttpError(400, "EDIT_REFUSED", first.message, { issues });
|
|
42
117
|
}
|
|
43
118
|
/** Widgets brought back whole (a put-back on review): every query in them must be one the editor may read. */
|
|
44
119
|
async function checkWidgets(rt, viewer, dashboard, widgets) {
|
|
@@ -65,9 +140,12 @@ async function checkDocument(rt, viewer, dashboard, docs) {
|
|
|
65
140
|
const { restored: doc, current } = docs;
|
|
66
141
|
const queries = Object.values(doc.widgets).flatMap((w) => Object.values(w.queries));
|
|
67
142
|
for (const query of queries) await authorizeFree(rt.options, viewer, wireOf(query));
|
|
68
|
-
await checkFilters(rt, viewer, doc.controls)
|
|
143
|
+
await checkFilters(rt, viewer, doc.controls.map((control, at) => ({
|
|
144
|
+
control,
|
|
145
|
+
path: ["controls", at]
|
|
146
|
+
})));
|
|
69
147
|
if (current !== void 0 && lockChanged(current, doc)) {
|
|
70
|
-
if (!await rt.options.access
|
|
148
|
+
if (!await allows(rt.options.access, viewer, "manage", dashboard)) throw new HttpError(403, "FORBIDDEN", "That version has a different lock; restoring it needs manage.");
|
|
71
149
|
}
|
|
72
150
|
}
|
|
73
151
|
/**
|
|
@@ -77,7 +155,7 @@ async function checkDocument(rt, viewer, dashboard, docs) {
|
|
|
77
155
|
*/
|
|
78
156
|
async function versionDoc(rt, request, user, ref) {
|
|
79
157
|
const resource = await dashboardResource(rt.options, request, user, ref.dashboardId);
|
|
80
|
-
if (!await rt.options.access
|
|
158
|
+
if (!await allows(rt.options.access, user.viewer, "edit", resource)) throw new HttpError(403, "FORBIDDEN", "Reading an earlier version needs edit.");
|
|
81
159
|
const id = await storedId(rt, request, user, ref.dashboardId);
|
|
82
160
|
const store = storeFor(rt, request);
|
|
83
161
|
const { tenant } = editorOf(user);
|
|
@@ -92,7 +170,7 @@ async function versionDoc(rt, request, user, ref) {
|
|
|
92
170
|
tenant,
|
|
93
171
|
ref: { id }
|
|
94
172
|
});
|
|
95
|
-
if (current !== null && lockChanged(current.doc, old.doc) && !await rt.options.access
|
|
173
|
+
if (current !== null && lockChanged(current.doc, old.doc) && !await allows(rt.options.access, user.viewer, "manage", resource)) throw new HttpError(403, "FORBIDDEN", "That version has a different lock; seeing it needs manage.");
|
|
96
174
|
return old;
|
|
97
175
|
}
|
|
98
176
|
export { checkCommands, checkDocument, checkWidgets, versionDoc };
|
package/dist/cli/add.mjs
CHANGED
|
@@ -41,13 +41,14 @@ function notAnApp(cwd) {
|
|
|
41
41
|
/** The shadcn bases the copied bar is written for: its triggers render as plain buttons on both. */
|
|
42
42
|
const BASES = /* @__PURE__ */ new Set(["radix", "base"]);
|
|
43
43
|
/**
|
|
44
|
-
* Which primitive library a shadcn app is on, from components.json: its `base`, else
|
|
45
|
-
*
|
|
44
|
+
* Which primitive library a shadcn app is on, from components.json: its `base`, else a style's
|
|
45
|
+
* base prefix ("radix-nova", "base-nova", "aria-nova"), else Radix: every other style
|
|
46
|
+
* ("default", "new-york", "new-york-v4") is on Radix.
|
|
46
47
|
*/
|
|
47
48
|
function shadcnBase(cwd) {
|
|
48
49
|
try {
|
|
49
50
|
const config = readJson(join(cwd, "components.json"), ComponentsJson);
|
|
50
|
-
return config.base ?? /^(
|
|
51
|
+
return config.base ?? /^(radix|base|aria)-/u.exec(config.style ?? "")?.[1] ?? "radix";
|
|
51
52
|
} catch {
|
|
52
53
|
return "radix";
|
|
53
54
|
}
|
package/dist/cli/doctor.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { LAYER_LINE, layerOrder } from "./layers.mjs";
|
|
|
6
6
|
import { schemaDiff } from "derive-dashboards";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
8
|
import { join, resolve } from "node:path";
|
|
9
|
-
import { validateModel } from "derive-dashboards/core";
|
|
9
|
+
import { MIN_SECRET_BYTES, validateModel } from "derive-dashboards/core";
|
|
10
10
|
// src/doctor.ts
|
|
11
11
|
const ok = (what) => ({
|
|
12
12
|
ok: true,
|
|
@@ -98,7 +98,7 @@ function layers(cwd) {
|
|
|
98
98
|
function secret(env) {
|
|
99
99
|
const value = env["DASHBOARDS_SECRET"];
|
|
100
100
|
if (value === void 0 || value === "") return bad("DASHBOARDS_SECRET is not set", "Set it to the same long random value on every instance (openssl rand -base64 32), and pass it as deriveDashboards({ secret }).");
|
|
101
|
-
return value.length >=
|
|
101
|
+
return new TextEncoder().encode(value).length >= MIN_SECRET_BYTES ? ok("DASHBOARDS_SECRET is set") : bad(`DASHBOARDS_SECRET is shorter than ${MIN_SECRET_BYTES} bytes`, "Use openssl rand -base64 32.");
|
|
102
102
|
}
|
|
103
103
|
const messageOf = (error) => error instanceof Error ? error.message : String(error);
|
|
104
104
|
/** Whether the connection answers: it reads the database's catalog, as check does. */
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { readExact } from "../exact/stored.mjs";
|
|
1
2
|
import { evaluateLeaf } from "../oracle/filter.mjs";
|
|
2
3
|
import { bucketLabel } from "../time/bucket.mjs";
|
|
3
|
-
import {
|
|
4
|
+
import { parseDate, parseNaiveTime } from "../time/instant.mjs";
|
|
5
|
+
import { readTime, timeValue } from "../time/stored.mjs";
|
|
6
|
+
import { offsetSegments, resolveNaive, startOfDate } from "../time/zone.mjs";
|
|
4
7
|
import { fold } from "../value/casefold.mjs";
|
|
5
8
|
import { compareValues } from "../value/compare.mjs";
|
|
6
9
|
import { KitCase } from "./cases.mjs";
|
|
7
10
|
import { ConformanceHost, ConformanceReport, Mismatch, checkConformance } from "./check.mjs";
|
|
8
11
|
import { DATASET, tablesOf } from "./dataset.mjs";
|
|
9
12
|
import { memorySource } from "./memory/source.mjs";
|
|
10
|
-
export { type ConformanceHost, type ConformanceReport, DATASET, type KitCase, type Mismatch, bucketLabel, checkConformance, compareValues, fold as foldCase, evaluateLeaf as leafHolds, memorySource, tablesOf, timeValue };
|
|
13
|
+
export { type ConformanceHost, type ConformanceReport, DATASET, type KitCase, type Mismatch, bucketLabel, checkConformance, compareValues, fold as foldCase, evaluateLeaf as leafHolds, memorySource, offsetSegments, parseDate, parseNaiveTime, readExact, readTime, resolveNaive, startOfDate, tablesOf, timeValue };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { readExact } from "../exact/stored.mjs";
|
|
1
2
|
import { evaluateLeaf } from "../oracle/filter.mjs";
|
|
2
3
|
import { bucketLabel } from "../time/bucket.mjs";
|
|
3
|
-
import {
|
|
4
|
+
import { parseDate, parseNaiveTime } from "../time/instant.mjs";
|
|
5
|
+
import { readTime, timeValue } from "../time/stored.mjs";
|
|
6
|
+
import { offsetSegments, resolveNaive, startOfDate } from "../time/zone.mjs";
|
|
4
7
|
import { fold } from "../value/casefold.mjs";
|
|
5
8
|
import { compareValues } from "../value/compare.mjs";
|
|
6
9
|
import { checkConformance } from "./check.mjs";
|
|
7
10
|
import { DATASET, tablesOf } from "./dataset.mjs";
|
|
8
11
|
import { memorySource } from "./memory/source.mjs";
|
|
9
|
-
export { DATASET, bucketLabel, checkConformance, compareValues, fold as foldCase, evaluateLeaf as leafHolds, memorySource, tablesOf, timeValue };
|
|
12
|
+
export { DATASET, bucketLabel, checkConformance, compareValues, fold as foldCase, evaluateLeaf as leafHolds, memorySource, offsetSegments, parseDate, parseNaiveTime, readExact, readTime, resolveNaive, startOfDate, tablesOf, timeValue };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { storedExact } from "../../exact/
|
|
1
|
+
import { storedExact } from "../../exact/stored.mjs";
|
|
2
2
|
import { formatExact } from "../../exact/text.mjs";
|
|
3
3
|
import { canonical } from "../../value/canonical.mjs";
|
|
4
|
-
import { evalExpr, holds } from "./rows.mjs";
|
|
4
|
+
import { columnOf, evalExpr, holds } from "./rows.mjs";
|
|
5
5
|
// src/conformance/memory/aggregate.ts
|
|
6
6
|
/** An exact operand on a row, as minor units: null when any term has no exact value. */
|
|
7
7
|
function exactValue(row, of, numeric) {
|
|
@@ -11,15 +11,17 @@ function exactValue(row, of, numeric) {
|
|
|
11
11
|
}] : [];
|
|
12
12
|
let total = 0n;
|
|
13
13
|
for (const t of terms) {
|
|
14
|
-
const v = storedExact(row[t.column]
|
|
14
|
+
const v = storedExact(row[t.column], numeric.stored, numeric.scale);
|
|
15
15
|
if (v === null) return null;
|
|
16
16
|
total += BigInt(t.coefficient) * v;
|
|
17
17
|
}
|
|
18
18
|
return terms.length === 0 ? null : total;
|
|
19
19
|
}
|
|
20
|
-
/** A float operand on a row: a finite number, else null. */
|
|
20
|
+
/** A float operand on a row: a finite number (an `int8` read as a `bigint` too), else null. */
|
|
21
21
|
function floatValue(store, row, of) {
|
|
22
|
-
const
|
|
22
|
+
const stored = "column" in of ? row[of.column] : void 0;
|
|
23
|
+
if (typeof stored === "bigint") return Number(stored);
|
|
24
|
+
const v = "column" in of ? columnOf(row, of.column) : "expr" in of ? evalExpr(store, row, of.expr) : null;
|
|
23
25
|
return typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
24
26
|
}
|
|
25
27
|
/** Continuous percentile by linear interpolation between the sorted values. */
|
|
@@ -38,7 +40,10 @@ const int = (n) => ({
|
|
|
38
40
|
function counted(store, rows, m) {
|
|
39
41
|
if (m.distinct !== void 0) {
|
|
40
42
|
const column = m.distinct;
|
|
41
|
-
const seen = new Set(rows.flatMap((r) =>
|
|
43
|
+
const seen = new Set(rows.flatMap((r) => {
|
|
44
|
+
const value = columnOf(r, column);
|
|
45
|
+
return value === null ? [] : [canonical(value)];
|
|
46
|
+
}));
|
|
42
47
|
return int(seen.size);
|
|
43
48
|
}
|
|
44
49
|
const { of } = m;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Calendar } from "../../query/types.mjs";
|
|
2
2
|
import "../../time/instant.mjs";
|
|
3
|
-
import {
|
|
4
|
-
/**
|
|
5
|
-
|
|
3
|
+
import { StoredValue } from "../../value/stored.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* A stored row: its columns, by name, as a driver gives them: plain values, a `bigint` (an
|
|
6
|
+
* `int8`) or a `Date` (a `timestamptz`). Time and exact columns are read by their storage
|
|
7
|
+
* (`readTime`, `readExact`); any other column as its plain value (`plainStored`).
|
|
8
|
+
*/
|
|
9
|
+
export type Row = Readonly<Record<string, StoredValue>>;
|
|
6
10
|
/** What reading a row needs: every table's rows, and the request's calendar. */
|
|
7
11
|
export type Store = {
|
|
8
12
|
tables: Readonly<Record<string, readonly Row[]>>;
|
|
@@ -3,16 +3,19 @@ import { evaluateLeaf } from "../../oracle/filter.mjs";
|
|
|
3
3
|
import { parseTextTime } from "../../time/text-time.mjs";
|
|
4
4
|
import { timeValue } from "../../time/stored.mjs";
|
|
5
5
|
import { fold } from "../../value/casefold.mjs";
|
|
6
|
+
import { plainStored } from "../../value/stored.mjs";
|
|
6
7
|
// src/conformance/memory/rows.ts
|
|
8
|
+
/** A stored column's plain value on a row. */
|
|
9
|
+
const columnOf = (row, column) => plainStored(row[column]);
|
|
7
10
|
/** The stored rows a join reaches from `row`: every `on` pair equal and not null. */
|
|
8
11
|
function reached(store, row, join) {
|
|
9
12
|
return (store.tables[join.table ?? join.to] ?? []).filter((target) => join.on.every(([local, foreign]) => {
|
|
10
|
-
const value = row
|
|
11
|
-
return value !== null && value === (target
|
|
13
|
+
const value = columnOf(row, local);
|
|
14
|
+
return value !== null && value === columnOf(target, foreign);
|
|
12
15
|
}));
|
|
13
16
|
}
|
|
14
|
-
/** A time column's instant on a row
|
|
15
|
-
const instant = (store, row, time) => timeValue(time.storage, row[time.column]
|
|
17
|
+
/** A time column's instant on a row: null when stored null or unread (counted by `unread`). */
|
|
18
|
+
const instant = (store, row, time) => timeValue(time.storage, row[time.column], store.calendar);
|
|
16
19
|
const num = (v) => typeof v === "number" ? v : null;
|
|
17
20
|
const FUNCTIONS = {
|
|
18
21
|
coalesce: (args) => args.find((a) => a !== null) ?? null,
|
|
@@ -34,7 +37,7 @@ function timeExpr(store, row, expr) {
|
|
|
34
37
|
}
|
|
35
38
|
const start = instant(store, row, expr.elapsed.start);
|
|
36
39
|
const end = instant(store, row, expr.elapsed.end);
|
|
37
|
-
return start === null || end === null ? null : end - start;
|
|
40
|
+
return start === null || end === null ? null : Number(end - start);
|
|
38
41
|
}
|
|
39
42
|
/** The first branch whose condition holds, else the expression's `else`. */
|
|
40
43
|
function caseValue(store, row, expr) {
|
|
@@ -46,7 +49,7 @@ function caseValue(store, row, expr) {
|
|
|
46
49
|
/** An expression on one row; null in, null out. */
|
|
47
50
|
function evalExpr(store, row, expr) {
|
|
48
51
|
const of = (e) => evalExpr(store, row, e);
|
|
49
|
-
if ("col" in expr) return row
|
|
52
|
+
if ("col" in expr) return columnOf(row, expr.col);
|
|
50
53
|
if ("lit" in expr) return expr.lit;
|
|
51
54
|
if ("op" in expr) return arithmetic(expr.op, of(expr.args[0]), of(expr.args[1]));
|
|
52
55
|
if ("fn" in expr) return FUNCTIONS[expr.fn](expr.args.map((arg) => of(arg)));
|
|
@@ -60,9 +63,9 @@ function bucketValue(value, raw) {
|
|
|
60
63
|
}
|
|
61
64
|
/** A value read from a row of its own source. */
|
|
62
65
|
function ownValue(store, row, value) {
|
|
63
|
-
if (value.kind === "bucket") return bucketValue(value, row
|
|
66
|
+
if (value.kind === "bucket") return bucketValue(value, columnOf(row, value.of));
|
|
64
67
|
if (value.kind === "expr") return evalExpr(store, row, value.expr);
|
|
65
|
-
return row
|
|
68
|
+
return columnOf(row, value.column);
|
|
66
69
|
}
|
|
67
70
|
/** A field's value on a row: through its join, the one seen row it reaches, or null. */
|
|
68
71
|
function fieldValue(store, row, field) {
|
|
@@ -76,11 +79,14 @@ const isCi = (field) => field.value.kind === "string" && field.value.collation =
|
|
|
76
79
|
function leaf(store, row, filter) {
|
|
77
80
|
if ("range" in filter) {
|
|
78
81
|
const { time, from, to } = filter.range;
|
|
79
|
-
const at
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
const [at, start, end] = [
|
|
83
|
+
instant(store, row, time),
|
|
84
|
+
parseTextTime(from),
|
|
85
|
+
parseTextTime(to)
|
|
86
|
+
];
|
|
87
|
+
return at !== null && start !== void 0 && end !== void 0 && at >= start && at < end;
|
|
82
88
|
}
|
|
83
|
-
if ("column" in filter) return evaluateLeaf(row
|
|
89
|
+
if ("column" in filter) return evaluateLeaf(columnOf(row, filter.column), filter.op, filter.values);
|
|
84
90
|
const collation = isCi(filter.field) ? "ci" : "binary";
|
|
85
91
|
return evaluateLeaf(fieldValue(store, row, filter.field), filter.op, filter.values, collation);
|
|
86
92
|
}
|
|
@@ -95,4 +101,4 @@ function holds(store, row, filter) {
|
|
|
95
101
|
}
|
|
96
102
|
return leaf(store, row, filter);
|
|
97
103
|
}
|
|
98
|
-
export { evalExpr, fieldValue, holds, instant, isCi };
|
|
104
|
+
export { columnOf, evalExpr, fieldValue, holds, instant, isCi };
|
|
@@ -6,7 +6,7 @@ import { canonical } from "../../value/canonical.mjs";
|
|
|
6
6
|
import { fold } from "../../value/casefold.mjs";
|
|
7
7
|
import { compareValues } from "../../value/compare.mjs";
|
|
8
8
|
import { aggregate } from "./aggregate.mjs";
|
|
9
|
-
import { fieldValue, holds, instant, isCi } from "./rows.mjs";
|
|
9
|
+
import { columnOf, fieldValue, holds, instant, isCi } from "./rows.mjs";
|
|
10
10
|
// src/conformance/memory/source.ts
|
|
11
11
|
/** A field's value as a group key: folded when it compares without case. */
|
|
12
12
|
function keyValue(store, row, field) {
|
|
@@ -94,8 +94,8 @@ function answerFrom(tables, request) {
|
|
|
94
94
|
]);
|
|
95
95
|
}
|
|
96
96
|
/** A records place's value as answered: an instant as ISO text, anything else as it is. */
|
|
97
|
-
const shown = (field, v) =>
|
|
98
|
-
/** A place as given back in `after`, its instants read again as
|
|
97
|
+
const shown = (field, v) => typeof v === "bigint" ? field?.value.kind === "time" ? formatTextTime(v) : String(v) : v;
|
|
98
|
+
/** A place as given back in `after`, its instants read again as exact instants to compare. */
|
|
99
99
|
const placeOf = (request, after) => after.map((v, i) => request.order[i]?.field.value.kind === "time" && typeof v === "string" ? parseTextTime(v) ?? null : v);
|
|
100
100
|
/** Records over every table's rows: ordered, then by key, then from the place after `after`. */
|
|
101
101
|
function recordsFrom(tables, request) {
|
|
@@ -110,7 +110,7 @@ function recordsFrom(tables, request) {
|
|
|
110
110
|
storage: field.value.storage
|
|
111
111
|
});
|
|
112
112
|
};
|
|
113
|
-
const place = (row) => [...request.order.map((o) => value(row, o.field)), ...request.key.map((k) => row
|
|
113
|
+
const place = (row) => [...request.order.map((o) => value(row, o.field)), ...request.key.map((k) => columnOf(row, k))];
|
|
114
114
|
const dirs = [...request.order.map((o) => o.dir), ...request.key.map(() => "asc")];
|
|
115
115
|
const compare = (a, b) => dirs.reduce((c, dir, i) => c || ordered(a[i] ?? null, b[i] ?? null, dir), 0);
|
|
116
116
|
const after = request.after === void 0 ? void 0 : placeOf(request, request.after);
|