@protobase/query 0.25.1 → 0.25.2
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-coverage.d.ts +3 -1
- package/dist/index-coverage.js +4 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +2 -2
package/dist/index-coverage.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Scope } from "./scope.js";
|
|
2
|
-
import { TableIndexes } from "./table-indexes.js";
|
|
2
|
+
import { TableIndex, TableIndexes } from "./table-indexes.js";
|
|
3
3
|
import { CheckedFilter, ResourceModel, SortSpec } from "@protobase/schema";
|
|
4
4
|
//#region src/index-coverage.d.ts
|
|
5
5
|
/**
|
|
@@ -24,6 +24,8 @@ export type CoverageQuery = {
|
|
|
24
24
|
sort?: SortSpec;
|
|
25
25
|
groupBy?: string;
|
|
26
26
|
};
|
|
27
|
+
/** Whether the index serves reading the column with the given need, while the query pins the `pinned` columns. */
|
|
28
|
+
export declare const indexServes: (index: TableIndex, column: string, need: IndexNeed, pinned: ReadonlySet<string>) => boolean;
|
|
27
29
|
/**
|
|
28
30
|
* The columns a read of the resource would read without an index serving them; empty when every one is served. The
|
|
29
31
|
* filter's and the access row filter's columns each need an index of the kind their operator uses, the sort's first
|
package/dist/index-coverage.js
CHANGED
|
@@ -31,7 +31,8 @@ const mentions = (definition, column) => {
|
|
|
31
31
|
const name = column.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
32
32
|
return new RegExp(`(^|[^\\w"])("${name}"|${name})([^\\w"]|$)`).test(definition);
|
|
33
33
|
};
|
|
34
|
-
|
|
34
|
+
/** Whether the index serves reading the column with the given need, while the query pins the `pinned` columns. */
|
|
35
|
+
const indexServes = (index, column, need, pinned) => {
|
|
35
36
|
if (index.partial) return false;
|
|
36
37
|
switch (need) {
|
|
37
38
|
case "btree": return btreeServes(index, column, pinned);
|
|
@@ -40,7 +41,7 @@ const serves = (index, column, need, pinned) => {
|
|
|
40
41
|
case "gin": return index.method === "gin" && index.keys.some((key) => key.column === column);
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
|
-
const need = (ctx, field, kind, pinned, also) => ctx.indexes.some((index) =>
|
|
44
|
+
const need = (ctx, field, kind, pinned, also) => ctx.indexes.some((index) => indexServes(index, field.column, kind, pinned) || also !== void 0 && indexServes(index, field.column, also, pinned)) ? [] : [{
|
|
44
45
|
field: field.name,
|
|
45
46
|
column: field.column,
|
|
46
47
|
use: ctx.use,
|
|
@@ -103,4 +104,4 @@ const uncoveredColumns = (model, table, query, scope) => {
|
|
|
103
104
|
]);
|
|
104
105
|
};
|
|
105
106
|
//#endregion
|
|
106
|
-
export { uncoveredColumns };
|
|
107
|
+
export { indexServes, uncoveredColumns };
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { MapBounds, MapBucket, MapBuckets, MapPosition, cellsAcross, checkMapPos
|
|
|
17
17
|
import { withoutField } from "./prune-filter.js";
|
|
18
18
|
import { ScrollMode, scrollMode } from "./scroll-mode.js";
|
|
19
19
|
import { IndexKey, TableIndex, TableIndexes, tableIndexes } from "./table-indexes.js";
|
|
20
|
-
import { ColumnUse, CoverageQuery, IndexNeed, UncoveredColumn, uncoveredColumns } from "./index-coverage.js";
|
|
20
|
+
import { ColumnUse, CoverageQuery, IndexNeed, UncoveredColumn, indexServes, uncoveredColumns } from "./index-coverage.js";
|
|
21
21
|
import { QueryError, QueryErrorCode } from "./fields/query-error.js";
|
|
22
22
|
import { SeekRequest, seekToPosition } from "./seek-to-position.js";
|
|
23
|
-
export { type ColumnUse, type CompileOptions, type CoverageQuery, type Db, type ExtraColumn, type FacetCount, type FacetOptions, type Granularity, type GroupTotal, type GroupTotalsOptions, type Histogram, type HistogramBucket, type IndexKey, type IndexNeed, type ListOptions, type ListPlan, type ListResult, type MapBounds, type MapBucket, type MapBuckets, type MapPosition, type Measure, QueryError, type QueryErrorCode, type RelatedRowsQuery, type Scope, type ScrollMode, type SeekRequest, type SeriesOptions, type SeriesPoint, type SplitPoint, type SplitSeriesOptions, type TableIndex, type TableIndexes, type UncoveredColumn, buildListQuery, buildRelatedRows, cellsAcross, checkMapPosition, compileFilter, countUpTo, estimateCount, exactCount, facetCounts, groupTotals, histogram, listQuery, mapBuckets, mapCellPixels, maxLimit, maxMapBuckets, maxMapZoom, relatedRows, scrollMode, seekToPosition, series, splitSeries, tableIndexes, uncoveredColumns, withoutField };
|
|
23
|
+
export { type ColumnUse, type CompileOptions, type CoverageQuery, type Db, type ExtraColumn, type FacetCount, type FacetOptions, type Granularity, type GroupTotal, type GroupTotalsOptions, type Histogram, type HistogramBucket, type IndexKey, type IndexNeed, type ListOptions, type ListPlan, type ListResult, type MapBounds, type MapBucket, type MapBuckets, type MapPosition, type Measure, QueryError, type QueryErrorCode, type RelatedRowsQuery, type Scope, type ScrollMode, type SeekRequest, type SeriesOptions, type SeriesPoint, type SplitPoint, type SplitSeriesOptions, type TableIndex, type TableIndexes, type UncoveredColumn, buildListQuery, buildRelatedRows, cellsAcross, checkMapPosition, compileFilter, countUpTo, estimateCount, exactCount, facetCounts, groupTotals, histogram, indexServes, listQuery, mapBuckets, mapCellPixels, maxLimit, maxMapBuckets, maxMapZoom, relatedRows, scrollMode, seekToPosition, series, splitSeries, tableIndexes, uncoveredColumns, withoutField };
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,6 @@ import { histogram } from "./histogram.js";
|
|
|
14
14
|
import { cellsAcross, checkMapPosition, mapBuckets, mapCellPixels, maxMapBuckets, maxMapZoom } from "./map-buckets.js";
|
|
15
15
|
import { scrollMode } from "./scroll-mode.js";
|
|
16
16
|
import { tableIndexes } from "./table-indexes.js";
|
|
17
|
-
import { uncoveredColumns } from "./index-coverage.js";
|
|
17
|
+
import { indexServes, uncoveredColumns } from "./index-coverage.js";
|
|
18
18
|
import { seekToPosition } from "./seek-to-position.js";
|
|
19
|
-
export { QueryError, buildListQuery, buildRelatedRows, cellsAcross, checkMapPosition, compileFilter, countUpTo, estimateCount, exactCount, facetCounts, groupTotals, histogram, listQuery, mapBuckets, mapCellPixels, maxLimit, maxMapBuckets, maxMapZoom, relatedRows, scrollMode, seekToPosition, series, splitSeries, tableIndexes, uncoveredColumns, withoutField };
|
|
19
|
+
export { QueryError, buildListQuery, buildRelatedRows, cellsAcross, checkMapPosition, compileFilter, countUpTo, estimateCount, exactCount, facetCounts, groupTotals, histogram, indexServes, listQuery, mapBuckets, mapCellPixels, maxLimit, maxMapBuckets, maxMapZoom, relatedRows, scrollMode, seekToPosition, series, splitSeries, tableIndexes, uncoveredColumns, withoutField };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/query",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.2",
|
|
4
4
|
"description": "Kysely list, filter, count and aggregate queries over Protobase resources.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@protobase/schema": "0.25.
|
|
32
|
+
"@protobase/schema": "0.25.2",
|
|
33
33
|
"kysely": "^0.29.6"
|
|
34
34
|
}
|
|
35
35
|
}
|