@taylordb/query-builder 0.17.0 → 0.18.1
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/README.md +39 -2
- package/dist/cjs/@types/query-builder.d.ts +4 -0
- package/dist/cjs/__tests__/query-builder.spec.js +191 -0
- package/dist/cjs/__tests__/query-builder.spec.js.map +1 -1
- package/dist/cjs/__tests__/taylorclient.types.d.ts +21 -223
- package/dist/cjs/__tests__/taylorclient.types.js +25 -31
- package/dist/cjs/__tests__/taylorclient.types.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +13 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/query-builder.d.ts +9 -11
- package/dist/cjs/query-builder.js +3 -19
- package/dist/cjs/query-builder.js.map +1 -1
- package/dist/esm/@types/query-builder.d.ts +4 -0
- package/dist/esm/__tests__/query-builder.spec.js +192 -1
- package/dist/esm/__tests__/query-builder.spec.js.map +1 -1
- package/dist/esm/__tests__/taylorclient.types.d.ts +21 -223
- package/dist/esm/__tests__/taylorclient.types.js +24 -29
- package/dist/esm/__tests__/taylorclient.types.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/query-builder.d.ts +9 -11
- package/dist/esm/query-builder.js +3 -19
- package/dist/esm/query-builder.js.map +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/docs/field-types.md +43 -4
- package/llm.txt +2 -2
- package/package.json +2 -2
package/docs/field-types.md
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
# Field Types
|
|
2
2
|
|
|
3
|
-
Every column in a TaylorDB table is represented by a
|
|
3
|
+
Every column in a TaylorDB table is represented by a runtime field descriptor and an inferred TypeScript column type. The runtime descriptor is emitted in `taylorSchema` and can be inspected by applications for validation or UI. `InferTaylorDatabase<typeof taylorSchema>` maps those descriptors to the strongly-typed column types used by the query builder.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
export const taylorSchema = defineTaylorSchema({
|
|
7
|
+
tasks: {
|
|
8
|
+
title: textField({ required: true }),
|
|
9
|
+
status: selectField({
|
|
10
|
+
required: false,
|
|
11
|
+
mode: 'single',
|
|
12
|
+
options: ['Todo', 'Done'] as const,
|
|
13
|
+
}),
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type TaylorDatabase = InferTaylorDatabase<typeof taylorSchema>;
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Available runtime helpers: `textField`, `numberField`, `checkboxField`, `dateField`, `searchField`, `linkField`, `attachmentField`, `selectField`, `autoNumberField`, and `autoDateField`.
|
|
4
21
|
|
|
5
22
|
## Column type anatomy
|
|
6
23
|
|
|
@@ -130,10 +147,11 @@ Same filter operators and aggregations as `DateColumnType`.
|
|
|
130
147
|
|
|
131
148
|
---
|
|
132
149
|
|
|
133
|
-
## Single select — `
|
|
150
|
+
## Single select — `selectField({ mode: 'single' })`
|
|
134
151
|
|
|
135
152
|
- **Select / Insert / Update**: `Options[number]` — one of the allowed string values
|
|
136
|
-
- `Options` is the
|
|
153
|
+
- `Options` is the literal `options` array on the runtime field descriptor
|
|
154
|
+
- Inferred column type: `SingleSelectColumnType<Options, IsRequired>`
|
|
137
155
|
|
|
138
156
|
**Available filter operators**
|
|
139
157
|
|
|
@@ -151,9 +169,10 @@ Same filter operators and aggregations as `DateColumnType`.
|
|
|
151
169
|
|
|
152
170
|
---
|
|
153
171
|
|
|
154
|
-
## Multi select — `
|
|
172
|
+
## Multi select — `selectField({ mode: 'multi' })`
|
|
155
173
|
|
|
156
174
|
- **Select / Insert / Update**: `Options[number][]` — array of allowed string values
|
|
175
|
+
- Inferred column type: `MultiSelectColumnType<Options, IsRequired>`
|
|
157
176
|
|
|
158
177
|
Same filter operators as `SingleSelectColumnType`.
|
|
159
178
|
|
|
@@ -213,3 +232,23 @@ Read-only computed field.
|
|
|
213
232
|
| `containsStrict` | `string` |
|
|
214
233
|
| `isEmpty` | _(no value)_ |
|
|
215
234
|
| `isNotEmpty` | _(no value)_ |
|
|
235
|
+
|
|
236
|
+
## Runtime Descriptor Shape
|
|
237
|
+
|
|
238
|
+
All field helpers return plain objects with at least:
|
|
239
|
+
|
|
240
|
+
| Property | Meaning |
|
|
241
|
+
|----------|---------|
|
|
242
|
+
| `type` | Runtime field kind such as `'text'`, `'number'`, `'select'`, `'link'` |
|
|
243
|
+
| `required` | Whether the field is required by the TaylorDB schema |
|
|
244
|
+
| `insertable` | Whether application code may write the field on insert |
|
|
245
|
+
| `updatable` | Whether application code may write the field on update |
|
|
246
|
+
|
|
247
|
+
Additional metadata is included where useful:
|
|
248
|
+
|
|
249
|
+
| Field helper | Extra metadata |
|
|
250
|
+
|--------------|----------------|
|
|
251
|
+
| `selectField` | `mode: 'single' \| 'multi'`, `options: readonly string[]` |
|
|
252
|
+
| `linkField` | `linkedTo: string` |
|
|
253
|
+
| `attachmentField` | `linkedTo: 'attachmentTable'` |
|
|
254
|
+
| `autoNumberField`, `autoDateField` | `insertable: false`, `updatable: false` |
|
package/llm.txt
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @taylordb/query-builder — LLM Documentation Index
|
|
2
2
|
|
|
3
|
-
This package is the TypeScript query builder for TaylorDB. It provides a fluent, type-safe API for reading and writing data. Use `createQueryBuilder<TaylorDatabase>(config)` as the entry point
|
|
3
|
+
This package is the TypeScript query builder for TaylorDB. It provides a fluent, type-safe API for reading and writing data. Use `createQueryBuilder<TaylorDatabase>(config)` as the entry point. `@taylordb/cli` generates a runtime `taylorSchema` object and `export type TaylorDatabase = InferTaylorDatabase<typeof taylorSchema>`.
|
|
4
4
|
|
|
5
5
|
## Documentation
|
|
6
6
|
|
|
7
7
|
- [Field Types](./docs/field-types.md)
|
|
8
|
-
|
|
8
|
+
Runtime field helpers (`textField`, `numberField`, `checkboxField`, `dateField`, `searchField`, `linkField`, `attachmentField`, `selectField`, `autoNumberField`, `autoDateField`), how `InferTaylorDatabase` maps descriptors to column types, what value each type accepts on insert/update, what is returned on select, and which filter operators are available per type.
|
|
9
9
|
|
|
10
10
|
- [Insert](./docs/insert.md)
|
|
11
11
|
How to create records using `insertInto().values().returning().execute()`. Single and batch inserts, the default return value, how attachment and link fields are handled on insert, and which tables cannot be inserted into.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taylordb/query-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "A type-safe query builder for TaylorDB",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"lodash": "^4.17.21",
|
|
32
32
|
"socket.io-client": "^4.8.1",
|
|
33
33
|
"zod": "^4.1.12",
|
|
34
|
-
"@taylordb/shared": "0.
|
|
34
|
+
"@taylordb/shared": "0.18.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/eventemitter3": "^2.0.4",
|