@protobase/cli 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/db/keys.js +11 -2
- package/dist/infer/proposal.js +10 -6
- package/dist/package.js +1 -1
- package/package.json +6 -6
package/dist/db/keys.js
CHANGED
|
@@ -10,6 +10,15 @@ const isUniqueSet = (table, columns) => table.indexes.some((index) => {
|
|
|
10
10
|
const indexed = plainColumns(index.columns);
|
|
11
11
|
return index.unique && !index.partial && indexed && indexed.every((column) => columns.includes(column));
|
|
12
12
|
});
|
|
13
|
-
const
|
|
13
|
+
const coverageIndexes = (table) => table.indexes.map((index) => ({
|
|
14
|
+
name: index.name,
|
|
15
|
+
method: index.method,
|
|
16
|
+
partial: index.partial,
|
|
17
|
+
keys: index.columns.map((column, position) => ({
|
|
18
|
+
column,
|
|
19
|
+
definition: "",
|
|
20
|
+
opclass: index.opclasses[position] ?? ""
|
|
21
|
+
}))
|
|
22
|
+
}));
|
|
14
23
|
//#endregion
|
|
15
|
-
export { isUniqueSet, keyColumns
|
|
24
|
+
export { coverageIndexes, isUniqueSet, keyColumns };
|
package/dist/infer/proposal.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { coverageIndexes } from "../db/keys.js";
|
|
2
2
|
import { checkEnumValues } from "./check-values.js";
|
|
3
3
|
import { columnDefault } from "./defaults.js";
|
|
4
4
|
import { inferKind } from "./type-map.js";
|
|
5
5
|
import { defaultColumn } from "./default-column.js";
|
|
6
6
|
import { snakeName } from "./names.js";
|
|
7
7
|
import { isTenantColumn } from "./tenant.js";
|
|
8
|
+
import { indexServes } from "@protobase/query";
|
|
8
9
|
//#region src/infer/proposal.ts
|
|
9
|
-
const columnIndexing = (table, column) => {
|
|
10
|
+
const columnIndexing = (table, column, type) => {
|
|
10
11
|
const tenant = table.columns.find((c) => isTenantColumn(c.name))?.name;
|
|
11
|
-
const
|
|
12
|
+
const pinned = new Set(tenant ? [tenant] : []);
|
|
13
|
+
const indexes = coverageIndexes(table);
|
|
14
|
+
const sortable = indexes.some((index) => indexServes(index, column, "btree", pinned));
|
|
15
|
+
const trigram = type === "text" && indexes.some((index) => indexServes(index, column, "trigram", pinned));
|
|
12
16
|
return {
|
|
13
|
-
filterable:
|
|
14
|
-
sortable
|
|
17
|
+
filterable: sortable || trigram,
|
|
18
|
+
sortable
|
|
15
19
|
};
|
|
16
20
|
};
|
|
17
21
|
const relationOf = (table, column, context) => {
|
|
@@ -60,7 +64,7 @@ const proposeField = (table, column, context) => {
|
|
|
60
64
|
...kind.type === "json" ? {
|
|
61
65
|
filterable: false,
|
|
62
66
|
sortable: false
|
|
63
|
-
} : columnIndexing(table, column.name)
|
|
67
|
+
} : columnIndexing(table, column.name, kind.type)
|
|
64
68
|
};
|
|
65
69
|
};
|
|
66
70
|
const needsColumnCall = (proposal) => defaultColumn(proposal.name) !== proposal.column;
|
package/dist/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.2",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@hono/node-server": "^2.1.3",
|
|
37
37
|
"@hono/vite-dev-server": "^0.26.1",
|
|
38
|
-
"@protobase/layout": "0.25.
|
|
39
|
-
"@protobase/query": "0.25.
|
|
40
|
-
"@protobase/schema": "0.25.
|
|
41
|
-
"@protobase/server": "0.25.
|
|
42
|
-
"@protobase/ui": "0.25.
|
|
38
|
+
"@protobase/layout": "0.25.2",
|
|
39
|
+
"@protobase/query": "0.25.2",
|
|
40
|
+
"@protobase/schema": "0.25.2",
|
|
41
|
+
"@protobase/server": "0.25.2",
|
|
42
|
+
"@protobase/ui": "0.25.2",
|
|
43
43
|
"@react-email/render": "^2.1.0",
|
|
44
44
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
45
45
|
"@tailwindcss/vite": "^4.3.3",
|