@lakeql/query-builder 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/dist/index.d.mts +19 -1
  2. package/package.json +2 -2
package/dist/index.d.mts CHANGED
@@ -36,15 +36,21 @@ interface FieldOptions {
36
36
  * @template TableDefinition - The table type used to constrain the `field` to valid column names.
37
37
  */
38
38
  interface SortInput<TableDefinition> {
39
+ /** Column name to sort by. Constrained to valid column names from the table type. */
39
40
  field: SelectExpression<KyselyDatabase<TableDefinition>, keyof KyselyDatabase<TableDefinition>>;
41
+ /** Sort direction — `"asc"` for ascending, `"desc"` for descending. */
40
42
  direction: string;
41
43
  }
42
44
  /**
43
45
  * Controls offset-based pagination.
44
- * When `limit` is not specified, defaults to 100 rows.
45
46
  */
46
47
  interface PagingInput {
48
+ /**
49
+ * Maximum number of rows to return.
50
+ * @default 100
51
+ */
47
52
  limit?: number;
53
+ /** Number of rows to skip before fetching. */
48
54
  offset?: number;
49
55
  }
50
56
  /**
@@ -134,6 +140,18 @@ declare function normalizeFilter(filter: Where): Where;
134
140
  * @returns A normalized query with a logical operator at the root.
135
141
  */
136
142
  declare function normalizeUserQuery(userQuery: Where): Where;
143
+ /**
144
+ * Generates a compiled SQL query with pagination metadata for Trino.
145
+ *
146
+ * Returns a Kysely `CompiledQuery` containing the generated SQL and parameters.
147
+ * The query uses two CTEs internally:
148
+ * - `total_count` — provides `total_records` (total matching rows before paging)
149
+ * - `records` — the actual rows based on `selectFields`, filtering, sorting, and paging
150
+ *
151
+ * The compiled query is executed by the Trino client which returns the row data.
152
+ *
153
+ * @returns A compiled SQL query ready for execution via the Trino client.
154
+ */
137
155
  declare function generateQuery<TableDefinition>({
138
156
  catalog,
139
157
  schema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lakeql/query-builder",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Kysely-based SQL query builder that translates GraphQL queries into Trino SQL",
5
5
  "keywords": [
6
6
  "graphql",
@@ -48,7 +48,7 @@
48
48
  "@pothos/core": "4.12.0",
49
49
  "@types/node": "24.13.2",
50
50
  "graphql": "16.14.2",
51
- "tsdown": "0.22.2",
51
+ "tsdown": "0.22.3",
52
52
  "typescript": "6.0.3",
53
53
  "vitest": "4.1.9",
54
54
  "@lakeql/tsconfig": "0.1.0"