@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.
@@ -1,6 +1,23 @@
1
1
  # Field Types
2
2
 
3
- Every column in a TaylorDB table is represented by a strongly-typed column type. These types encode what value you can write on insert/update, what value you read back on select, and which filter operators are valid for that field.
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 — `SingleSelectColumnType<Options, IsRequired>`
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 `typeof YourTableFieldOptions` const generated by the CLI
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 — `MultiSelectColumnType<Options, IsRequired>`
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 the `TaylorDatabase` type is generated by `@taylordb/cli`.
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
- All column types (`TextColumnType`, `NumberColumnType`, `DateColumnType`, `CheckboxColumnType`, `SingleSelectColumnType`, `MultiSelectColumnType`, `LinkColumnType`, `AttachmentColumnType`, `SearchColumnType`, auto-generated variants). What value each type accepts on insert/update, what is returned on select, and which filter operators are available per type.
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.17.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.17.0"
34
+ "@taylordb/shared": "0.18.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/eventemitter3": "^2.0.4",