@pythia-software/query-table-core 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +76 -3
- package/dist/index.js +840 -325
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -278,7 +278,26 @@ interface MetricDateGrouping {
|
|
|
278
278
|
range: "query" | "observed" | "custom";
|
|
279
279
|
start?: string;
|
|
280
280
|
end?: string;
|
|
281
|
-
|
|
281
|
+
/** "exclude" leaves out intervals the query's bounds cut, and intervals that
|
|
282
|
+
* have not ended by the evaluation time; omitted includes them. */
|
|
283
|
+
partialIntervals?: "include" | "exclude";
|
|
284
|
+
}
|
|
285
|
+
/** A trailing window over a calendar metric's intervals. */
|
|
286
|
+
interface MetricWindow {
|
|
287
|
+
/** Intervals per point, its own included (2–1,000), or "all" for a running
|
|
288
|
+
* value from the first interval. */
|
|
289
|
+
periods: number | "all";
|
|
290
|
+
/** "total" (default) evaluates the metric over every row in the window, so
|
|
291
|
+
* ratios pool their parts. "mean" averages the per-interval values of a
|
|
292
|
+
* single SUM, COUNT or COUNT_DISTINCT. */
|
|
293
|
+
reduce?: "total" | "mean";
|
|
294
|
+
/** Points whose window starts before the first interval have no value
|
|
295
|
+
* ("omit", default) or use the intervals available ("include"). */
|
|
296
|
+
partial?: "omit" | "include";
|
|
297
|
+
}
|
|
298
|
+
/** Divide each bucket by the total of all groups ("total") or of its first
|
|
299
|
+
* grouping key ("group0"), such as one calendar interval. */
|
|
300
|
+
type MetricShare = "total" | "group0";
|
|
282
301
|
interface MetricValueFormat {
|
|
283
302
|
kind: "number" | "percent" | "duration" | "date" | "time" | "datetime";
|
|
284
303
|
decimals?: number;
|
|
@@ -795,6 +814,11 @@ interface AggregationClause {
|
|
|
795
814
|
* sorting, `groupLimit` and Other. Requires at least one grouping field;
|
|
796
815
|
* integer 1–1,000,000. Removed groups are reported as `hiddenGroups`. */
|
|
797
816
|
minCount?: number;
|
|
817
|
+
/** A trailing window or running value over the calendar intervals of
|
|
818
|
+
* `dateGrouping`. Computed from ordinary metrics, so every engine supports it. */
|
|
819
|
+
window?: MetricWindow;
|
|
820
|
+
/** Express each bucket as a fraction of a total of the same measure. */
|
|
821
|
+
share?: MetricShare;
|
|
798
822
|
}
|
|
799
823
|
/** Detail affordances are presentation state, never backend SELECT fields. */
|
|
800
824
|
type ItemPropertyMode = "hover" | "modal" | "expand";
|
|
@@ -995,6 +1019,9 @@ interface AggregationBucket {
|
|
|
995
1019
|
* cohort is inspected (`count`/`value` are then the bin's count). Never part
|
|
996
1020
|
* of a transport result. */
|
|
997
1021
|
bin?: MetricHistogramBin;
|
|
1022
|
+
/** Calendar intervals combined into a windowed point (`AggregationClause.window`);
|
|
1023
|
+
* fewer than its periods where the window starts before the first interval. */
|
|
1024
|
+
intervals?: number;
|
|
998
1025
|
/** The metric: a number for count/sum/avg, or the column's value for min/max
|
|
999
1026
|
* (which may be a string for text/datetime). null when undefined (e.g. avg of
|
|
1000
1027
|
* an all-null column). */
|
|
@@ -1228,6 +1255,9 @@ interface MetricEvaluationOptions<Row = unknown> extends QueryEvaluationOptions,
|
|
|
1228
1255
|
}
|
|
1229
1256
|
/** Typed lexicographic ordering with null placement independent of direction. */
|
|
1230
1257
|
declare function compareMetricValues(a: MetricValue, b: MetricValue): number;
|
|
1258
|
+
/** Order buckets as a metric result: errors last, then `clause.sort`
|
|
1259
|
+
* (chronological for calendar groups, largest value first otherwise), then keys. */
|
|
1260
|
+
declare function sortMetricBuckets(buckets: AggregationBucket[], c: Pick<AggregationClause, "sort" | "dateGrouping">): AggregationBucket[];
|
|
1231
1261
|
declare function evaluateMetrics<Row>(rows: Row[], q: QueryState, schema: FieldSchema<Row>, options?: MetricEvaluationOptions<Row>): AggregationResult;
|
|
1232
1262
|
|
|
1233
1263
|
interface ApplyResult<Row> {
|
|
@@ -1481,10 +1511,52 @@ declare const METRIC_DATE_INTERVALS: readonly ["hour", "day", "week", "month", "
|
|
|
1481
1511
|
declare function metricDateTime(value: MetricValue, timeZone?: string): number;
|
|
1482
1512
|
declare function metricDateFloor(time: number, interval: MetricDateGrouping["interval"], timeZone?: string): number;
|
|
1483
1513
|
declare function metricDateNext(time: number, interval: MetricDateGrouping["interval"], timeZone?: string): number;
|
|
1514
|
+
/** A date-only Through value includes the whole local day, even for hourly groups. */
|
|
1515
|
+
declare function metricCustomEndTime(value: string, timeZone?: string): number;
|
|
1484
1516
|
declare function validateDateGrouping(config: MetricDateGrouping): void;
|
|
1485
1517
|
/** Only conjunctive bounds prove a domain; OR alternatives are not bounds. */
|
|
1486
1518
|
declare function metricDateRange(config: MetricDateGrouping, query: QueryState, observed: readonly number[], now: number, canonical: (field: string) => string): [number, number] | undefined;
|
|
1487
1519
|
|
|
1520
|
+
declare const MAX_METRIC_WINDOW_PERIODS = 1000;
|
|
1521
|
+
/** Whether a clause needs planMetricSeries before an engine can run it. */
|
|
1522
|
+
declare function hasMetricSeries(c: AggregationClause): boolean;
|
|
1523
|
+
/** Throws when a clause's window or share cannot be computed exactly. */
|
|
1524
|
+
declare function validateMetricSeries(c: AggregationClause, plan: FormulaPlan): void;
|
|
1525
|
+
/** The whole intervals inside the conjunctive bounds on the date field (the
|
|
1526
|
+
* query's and the metric's own), ending by `now`: [start, end). */
|
|
1527
|
+
declare function wholeIntervalSpan(c: AggregationClause, query: QueryState, schema: FieldSchema, now: number): {
|
|
1528
|
+
start?: number;
|
|
1529
|
+
end: number;
|
|
1530
|
+
};
|
|
1531
|
+
interface MetricSeriesOptions {
|
|
1532
|
+
/** The evaluation clock: intervals ending after it are partial. */
|
|
1533
|
+
now?: number;
|
|
1534
|
+
resolveComputed?: (name: string) => FormulaPlan | undefined;
|
|
1535
|
+
}
|
|
1536
|
+
interface MetricSeriesPlan {
|
|
1537
|
+
/** Plain metric queries within the metric budget. A clause's parts always
|
|
1538
|
+
* share one query, so they read one population. */
|
|
1539
|
+
queries: QueryState[];
|
|
1540
|
+
/** The requested clauses' results, in request order, from the metric
|
|
1541
|
+
* results of every query. */
|
|
1542
|
+
combine(results: readonly AggregationResultEntry[]): AggregationResultEntry[];
|
|
1543
|
+
}
|
|
1544
|
+
/** Expand clauses with a window, a share or whole intervals into plain
|
|
1545
|
+
* metrics, or return undefined when no clause has them.
|
|
1546
|
+
*
|
|
1547
|
+
* - **Window.** Each point is the metric over the rows of its trailing
|
|
1548
|
+
* intervals (`reduce: "total"`), or the mean of their per-interval values
|
|
1549
|
+
* (`reduce: "mean"`), with the window's row count. Points whose window starts
|
|
1550
|
+
* before the first interval have no value unless `partial: "include"`.
|
|
1551
|
+
* - **Share.** Each bucket divided by the total of its first grouping key, or
|
|
1552
|
+
* of every group. With a window, both are windowed first.
|
|
1553
|
+
* - **Whole intervals.** `partialIntervals: "exclude"` narrows the metric to
|
|
1554
|
+
* the intervals the query bounds and `now` leave whole.
|
|
1555
|
+
*
|
|
1556
|
+
* `sort`, `groupLimit` and `minCount` (counting a window's rows) apply to the
|
|
1557
|
+
* combined buckets. Windowed and share results have no Other remainder. */
|
|
1558
|
+
declare function planMetricSeries(query: QueryState, schema: FieldSchema, options?: MetricSeriesOptions): MetricSeriesPlan | undefined;
|
|
1559
|
+
|
|
1488
1560
|
interface SavedPropertyView {
|
|
1489
1561
|
id: string;
|
|
1490
1562
|
name: string;
|
|
@@ -1522,7 +1594,8 @@ declare function sourceDependencies<Row>(query: QueryState, schema: FieldSchema<
|
|
|
1522
1594
|
* - Each `clause.groupBy` key adds `=`; a null key adds `is_null` (legacy
|
|
1523
1595
|
* aggregates already place empty text in that bucket).
|
|
1524
1596
|
* - A date-grouped key becomes `>= start` and `< next`, using the clause's
|
|
1525
|
-
* interval and timezone.
|
|
1597
|
+
* interval and timezone. A windowed point starts at its window's first
|
|
1598
|
+
* interval, or has no lower bound for a running value.
|
|
1526
1599
|
* - A histogram bin (`bucket.bin`) adds `>= min` and `< max` (`<= max` for
|
|
1527
1600
|
* the final bin) on the distribution input, which must be a field reference.
|
|
1528
1601
|
* Box cohorts are their group keys.
|
|
@@ -1567,4 +1640,4 @@ declare function groupLinkQuery(query: QueryState, value: GroupLinkValue): Query
|
|
|
1567
1640
|
* routes and unresolvable values return `href: null` with a `problem`. */
|
|
1568
1641
|
declare function resolveGroupLink(query: QueryState, value: GroupLinkValue, targets?: LinkTargets): ResolvedGroupLink;
|
|
1569
1642
|
|
|
1570
|
-
export { AGG_OPS_BY_TYPE, AGG_OPS_NEEDING_FIELD, type AggOp, type AggregateConfig, type AggregationBucket, type AggregationClause, type AggregationRequest, type AggregationResult, type AggregationResultEntry, type Align, type ApplyPatchOptions, type ApplyResult, type BackendField, COMPUTED_PREFIX, type CellDisplay, type CellRenderer, type ColumnPreview, type ComputedCellError, type ComputedColumn, type ComputedColumnDraft, type ComputedColumnStore, type ComputedExecution, type ComputedFieldCapabilities, type DerivedField, type DistinctValuesQuery, type DistinctValuesResult, EMPTY_QUERY, FORMULA_FUNCTIONS, type FetchRowsResult, type FetchRowsResultV2, type FieldDef, type FieldOrigin, type FieldRelationship, type FieldSchema, type FieldSource, type FieldStats, type FieldType, type FilterConfig, type FilterOp, type FilterValues, type ForeignKey, type FormulaDiagnostic, FormulaError, type FormulaFunction, type FormulaNode, type FormulaPlan, type FormulaResult, type FormulaType, type FormulaValue, GROUP_ID_FIELD, GROUP_LINK_RENDER, type GroupLinkValue, type GroupedRow, type GroupingDefinition, type GroupingModel, type GroupingState, type GroupingView, ITEM_DETAILS_COLUMN, type ItemDetailMode, type ItemDetailsState, type ItemPageOptions, type ItemPropertyMode, type JsonCellDisplay, type LinkDestination, type LinkSpec, type LinkTargets, MAX_AGGREGATIONS, MAX_GROUP_BY_FIELDS, MAX_ORDER_BY_TERMS, MAX_PROPERTIES, MAX_QUERY_LIMIT, MAX_QUERY_OFFSET, MAX_QUERY_STATE_BYTES, MAX_QUERY_TOKEN_LENGTH, MAX_RELATIVE_TIME_MS, MAX_REPRESENTATIVE_SORTS, MAX_RESULT_GROUPS, MAX_SELECT_COLUMNS, MAX_SUMMARY_COLUMNS, MAX_WHERE_CLAUSES, METRIC_DATE_INTERVALS, METRIC_FUNCTIONS, type MetricAxisScale, type MetricBoxSummary, type MetricCapabilities, type MetricDateGrouping, type MetricDiagnostic, type MetricDisplay, type MetricDistribution, type MetricDistributionResult, type MetricEvaluationOptions, type MetricHistogramBin, type MetricKey, type MetricLayout, type MetricPlan, type MetricPopulationSupport, type MetricQuery, type MetricReductionOptions, type MetricScope, type MetricSort, type MetricValue, type MetricValueFormat, NULLARY_OPS, OPS_BY_TYPE, OP_LABEL, type ObjectReference, type ObjectTypeDefinition, type OpChoice, type OpPair, type OrGroup, type OrderByClause, type PreviewGroup, type PropertyFieldConfig, type PropertyFormat, type PropertySelection, type PropertyViewState, type PropertyViewStorage, type QueryCapabilitiesV3, QueryDecodeError, type QueryEvaluationOptions, type QueryFacet, type QueryLink, type QueryLinkOptions, type QueryLinkService, type QueryPatch, type QueryPatchMatch, type QueryRequestV3, type QueryResultV3, type QuerySnapshot, type QuerySnapshotCache, QuerySnapshotHttpError, type QuerySnapshotHttpErrorCode, type QuerySnapshotStore, type QueryState, type RegexInspection, type RelationshipAdapter, type RepresentativeOrder, type RepresentativeRow, type ResolvedGroupLink, type ResolvedObjectReference, type RowComputedValues, type RowId, type SavedPropertyView, type SavedQuery, type SelectColumn, type SelectConfig, type ServerQuery, type ServerQueryV2, type SetFilterMetadata, type SetFilterMode, type SetFilterTarget, type SortConfig, type SourceDependencies, type StorageAdapter, type SummaryColumn, type SummaryOp, type Transport, type WhereClause, type WhereTerm, aggOpAllowedForType, aggOpNeedsField, aggOpsForField, applyAggregations, applyPatch, applyQuery, boxSummary, coerceValue, compareMetricValues, compileFormula, compileMetric, computedFieldName, createGroupingModel, createPropertyView, createQueryLinkService, createSetFilter, decodeQuery, decodeQueryStrict, discoverFieldRelationships, encodeQuery, evaluateMetricReductions, evaluateMetrics, exitGrouping, filterValues, formulaRuntime, groupLinkQuery, groupPreview, groupSourceQuery, hasRegex, histogramCounts, histogramEdges, httpComputedColumnStore, httpQuerySnapshotStore, indexFields, inspectBucketQuery, isComputedCellError, isComputedField, isFilterable, isGroupLinkField, isGroupLinkValue, isGroupable, isMeasurable, isNegativePredicate, isOrGroup, isPushdownFilter, isSelectable, isSortable, itemPageFields, jsonPropertyViewStorage, loadSchema, localPropertyViewStorage, localQuerySnapshotCache, localStorageAdapter, mapSetFilterValues, matchPatch, matchesClause, memoryComputedColumnStore, memoryPropertyViewStorage, memoryQuerySnapshotCache, memoryStorageAdapter, metricAggregatePlans, metricComputationKey, metricDateFloor, metricDateNext, metricDateRange, metricDateTime, metricDependencies, metricExpression, metricPlans, metricPopulationError, negateClause, normalizePropertyFormat, normalizePropertyView, normalizeQueryState, objectReferenceKey, opAllowedForType, opPairsForField, opsForField, parseRelativeDuration, percentile, predicatesOf, prepareGrouping, queriesEqual, readFieldValue, readObjectReference, readSetFilter, reduceMetricValues, removePatch, renderItemPageTemplate, resolveFieldName, resolveGroupLink, selectMetricShownRows, selectedFields, setFilterModes, setFilterTarget, sourceDependencies, sourceExecutionSchema, stripSetFilter, toAggregationQuery, toMetricQuery, toQueryRequestV3, toServerQuery, toServerQueryV2, validateComputedColumn, validateDateGrouping, validateItemPageTemplate, validateMetric, validateQueryResultV3, validateQuerySnapshot, withGroupingKeys, withoutGrouping, withoutLinkSummaries };
|
|
1643
|
+
export { AGG_OPS_BY_TYPE, AGG_OPS_NEEDING_FIELD, type AggOp, type AggregateConfig, type AggregationBucket, type AggregationClause, type AggregationRequest, type AggregationResult, type AggregationResultEntry, type Align, type ApplyPatchOptions, type ApplyResult, type BackendField, COMPUTED_PREFIX, type CellDisplay, type CellRenderer, type ColumnPreview, type ComputedCellError, type ComputedColumn, type ComputedColumnDraft, type ComputedColumnStore, type ComputedExecution, type ComputedFieldCapabilities, type DerivedField, type DistinctValuesQuery, type DistinctValuesResult, EMPTY_QUERY, FORMULA_FUNCTIONS, type FetchRowsResult, type FetchRowsResultV2, type FieldDef, type FieldOrigin, type FieldRelationship, type FieldSchema, type FieldSource, type FieldStats, type FieldType, type FilterConfig, type FilterOp, type FilterValues, type ForeignKey, type FormulaDiagnostic, FormulaError, type FormulaFunction, type FormulaNode, type FormulaPlan, type FormulaResult, type FormulaType, type FormulaValue, GROUP_ID_FIELD, GROUP_LINK_RENDER, type GroupLinkValue, type GroupedRow, type GroupingDefinition, type GroupingModel, type GroupingState, type GroupingView, ITEM_DETAILS_COLUMN, type ItemDetailMode, type ItemDetailsState, type ItemPageOptions, type ItemPropertyMode, type JsonCellDisplay, type LinkDestination, type LinkSpec, type LinkTargets, MAX_AGGREGATIONS, MAX_GROUP_BY_FIELDS, MAX_METRIC_WINDOW_PERIODS, MAX_ORDER_BY_TERMS, MAX_PROPERTIES, MAX_QUERY_LIMIT, MAX_QUERY_OFFSET, MAX_QUERY_STATE_BYTES, MAX_QUERY_TOKEN_LENGTH, MAX_RELATIVE_TIME_MS, MAX_REPRESENTATIVE_SORTS, MAX_RESULT_GROUPS, MAX_SELECT_COLUMNS, MAX_SUMMARY_COLUMNS, MAX_WHERE_CLAUSES, METRIC_DATE_INTERVALS, METRIC_FUNCTIONS, type MetricAxisScale, type MetricBoxSummary, type MetricCapabilities, type MetricDateGrouping, type MetricDiagnostic, type MetricDisplay, type MetricDistribution, type MetricDistributionResult, type MetricEvaluationOptions, type MetricHistogramBin, type MetricKey, type MetricLayout, type MetricPlan, type MetricPopulationSupport, type MetricQuery, type MetricReductionOptions, type MetricScope, type MetricSeriesOptions, type MetricSeriesPlan, type MetricShare, type MetricSort, type MetricValue, type MetricValueFormat, type MetricWindow, NULLARY_OPS, OPS_BY_TYPE, OP_LABEL, type ObjectReference, type ObjectTypeDefinition, type OpChoice, type OpPair, type OrGroup, type OrderByClause, type PreviewGroup, type PropertyFieldConfig, type PropertyFormat, type PropertySelection, type PropertyViewState, type PropertyViewStorage, type QueryCapabilitiesV3, QueryDecodeError, type QueryEvaluationOptions, type QueryFacet, type QueryLink, type QueryLinkOptions, type QueryLinkService, type QueryPatch, type QueryPatchMatch, type QueryRequestV3, type QueryResultV3, type QuerySnapshot, type QuerySnapshotCache, QuerySnapshotHttpError, type QuerySnapshotHttpErrorCode, type QuerySnapshotStore, type QueryState, type RegexInspection, type RelationshipAdapter, type RepresentativeOrder, type RepresentativeRow, type ResolvedGroupLink, type ResolvedObjectReference, type RowComputedValues, type RowId, type SavedPropertyView, type SavedQuery, type SelectColumn, type SelectConfig, type ServerQuery, type ServerQueryV2, type SetFilterMetadata, type SetFilterMode, type SetFilterTarget, type SortConfig, type SourceDependencies, type StorageAdapter, type SummaryColumn, type SummaryOp, type Transport, type WhereClause, type WhereTerm, aggOpAllowedForType, aggOpNeedsField, aggOpsForField, applyAggregations, applyPatch, applyQuery, boxSummary, coerceValue, compareMetricValues, compileFormula, compileMetric, computedFieldName, createGroupingModel, createPropertyView, createQueryLinkService, createSetFilter, decodeQuery, decodeQueryStrict, discoverFieldRelationships, encodeQuery, evaluateMetricReductions, evaluateMetrics, exitGrouping, filterValues, formulaRuntime, groupLinkQuery, groupPreview, groupSourceQuery, hasMetricSeries, hasRegex, histogramCounts, histogramEdges, httpComputedColumnStore, httpQuerySnapshotStore, indexFields, inspectBucketQuery, isComputedCellError, isComputedField, isFilterable, isGroupLinkField, isGroupLinkValue, isGroupable, isMeasurable, isNegativePredicate, isOrGroup, isPushdownFilter, isSelectable, isSortable, itemPageFields, jsonPropertyViewStorage, loadSchema, localPropertyViewStorage, localQuerySnapshotCache, localStorageAdapter, mapSetFilterValues, matchPatch, matchesClause, memoryComputedColumnStore, memoryPropertyViewStorage, memoryQuerySnapshotCache, memoryStorageAdapter, metricAggregatePlans, metricComputationKey, metricCustomEndTime, metricDateFloor, metricDateNext, metricDateRange, metricDateTime, metricDependencies, metricExpression, metricPlans, metricPopulationError, negateClause, normalizePropertyFormat, normalizePropertyView, normalizeQueryState, objectReferenceKey, opAllowedForType, opPairsForField, opsForField, parseRelativeDuration, percentile, planMetricSeries, predicatesOf, prepareGrouping, queriesEqual, readFieldValue, readObjectReference, readSetFilter, reduceMetricValues, removePatch, renderItemPageTemplate, resolveFieldName, resolveGroupLink, selectMetricShownRows, selectedFields, setFilterModes, setFilterTarget, sortMetricBuckets, sourceDependencies, sourceExecutionSchema, stripSetFilter, toAggregationQuery, toMetricQuery, toQueryRequestV3, toServerQuery, toServerQueryV2, validateComputedColumn, validateDateGrouping, validateItemPageTemplate, validateMetric, validateMetricSeries, validateQueryResultV3, validateQuerySnapshot, wholeIntervalSpan, withGroupingKeys, withoutGrouping, withoutLinkSummaries };
|