@mulmoclaude/core 0.24.0 → 0.25.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/assets/helps/collection-skills.md +51 -0
- package/assets/helps/custom-view.md +37 -3
- package/assets/helps/error-recovery.md +30 -0
- package/assets/helps/google-calendar-collection.md +79 -0
- package/assets/helps/index.md +1 -0
- package/dist/collection/core/project.d.ts +3 -0
- package/dist/collection/core/schema.d.ts +13 -1
- package/dist/collection/core/schemaZ.d.ts +45 -0
- package/dist/collection/index.cjs +18 -14
- package/dist/collection/index.cjs.map +1 -1
- package/dist/collection/index.d.ts +1 -0
- package/dist/collection/index.js +4 -2
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/paths.cjs +5 -55
- package/dist/collection/paths.js +1 -51
- package/dist/collection/registry/server/index.cjs +20 -19
- package/dist/collection/registry/server/index.cjs.map +1 -1
- package/dist/collection/registry/server/index.js +3 -2
- package/dist/collection/registry/server/index.js.map +1 -1
- package/dist/collection/server/csvStore.d.ts +8 -1
- package/dist/collection/server/discoveredCollection.d.ts +4 -0
- package/dist/collection/server/discovery.d.ts +1 -0
- package/dist/collection/server/index.cjs +58 -54
- package/dist/collection/server/index.d.ts +1 -0
- package/dist/collection/server/index.js +5 -4
- package/dist/collection/server/queryRunner.d.ts +4 -0
- package/dist/collection/server/spawn.d.ts +2 -1
- package/dist/collection/server/sqliteStore.d.ts +14 -0
- package/dist/collection/server/store.d.ts +43 -8
- package/dist/collection/server/storePage.d.ts +32 -0
- package/dist/collection-watchers/index.cjs +131 -44
- package/dist/collection-watchers/index.cjs.map +1 -1
- package/dist/collection-watchers/index.d.ts +1 -1
- package/dist/collection-watchers/index.js +125 -39
- package/dist/collection-watchers/index.js.map +1 -1
- package/dist/collection-watchers/reconciler.d.ts +13 -11
- package/dist/collection-watchers/watcher.d.ts +4 -3
- package/dist/{server-BpEo0FOd.js → discovery-QUi_7aNG.js} +414 -1495
- package/dist/discovery-QUi_7aNG.js.map +1 -0
- package/dist/{server-CkysfLh4.cjs → discovery-cwtfyDxl.cjs} +463 -1658
- package/dist/discovery-cwtfyDxl.cjs.map +1 -0
- package/dist/feeds/index.cjs +4 -4
- package/dist/feeds/index.js +2 -2
- package/dist/feeds/server/index.cjs +35 -22
- package/dist/feeds/server/index.cjs.map +1 -1
- package/dist/feeds/server/index.js +26 -13
- package/dist/feeds/server/index.js.map +1 -1
- package/dist/google/apiClient.d.ts +8 -1
- package/dist/google/calendar.d.ts +35 -0
- package/dist/google/calendarSyncStore.d.ts +7 -0
- package/dist/google/collectionSync.d.ts +70 -0
- package/dist/google/index.cjs +294 -4
- package/dist/google/index.cjs.map +1 -1
- package/dist/google/index.d.ts +4 -2
- package/dist/google/index.js +279 -5
- package/dist/google/index.js.map +1 -1
- package/dist/ids-Dl9Ij63K.cjs +163 -0
- package/dist/ids-Dl9Ij63K.cjs.map +1 -0
- package/dist/ids-P2T89Gou.js +92 -0
- package/dist/ids-P2T89Gou.js.map +1 -0
- package/dist/{ingestTypes-CFEgTItj.js → ingestTypes-C-IQB4nw.js} +2 -2
- package/dist/{ingestTypes-CFEgTItj.js.map → ingestTypes-C-IQB4nw.js.map} +1 -1
- package/dist/{ingestTypes-Stc7iQyA.cjs → ingestTypes-DZpAC3N_.cjs} +3 -3
- package/dist/{ingestTypes-Stc7iQyA.cjs.map → ingestTypes-DZpAC3N_.cjs.map} +1 -1
- package/dist/project-BWI5w_BT.cjs +17 -0
- package/dist/project-BWI5w_BT.cjs.map +1 -0
- package/dist/project-bU98ycsy.js +12 -0
- package/dist/project-bU98ycsy.js.map +1 -0
- package/dist/{promptSafety-BLUcImzd.js → promptSafety-Boz5qOs-.js} +2 -84
- package/dist/promptSafety-Boz5qOs-.js.map +1 -0
- package/dist/{promptSafety-DI_1Rvhk.cjs → promptSafety-Co4cYQ_Z.cjs} +1 -149
- package/dist/promptSafety-Co4cYQ_Z.cjs.map +1 -0
- package/dist/remote-host/server/index.cjs +6 -4
- package/dist/remote-host/server/index.cjs.map +1 -1
- package/dist/remote-host/server/index.js +6 -4
- package/dist/remote-host/server/index.js.map +1 -1
- package/dist/remote-view/index.cjs +5 -3
- package/dist/remote-view/index.cjs.map +1 -1
- package/dist/remote-view/index.d.ts +3 -1
- package/dist/remote-view/index.js +5 -3
- package/dist/remote-view/index.js.map +1 -1
- package/dist/scheduler/index.cjs +3 -1
- package/dist/scheduler/index.cjs.map +1 -1
- package/dist/scheduler/index.js +3 -1
- package/dist/scheduler/index.js.map +1 -1
- package/dist/server-BI3wnTwl.js +1529 -0
- package/dist/server-BI3wnTwl.js.map +1 -0
- package/dist/server-CKdWENZ-.cjs +1704 -0
- package/dist/server-CKdWENZ-.cjs.map +1 -0
- package/dist/skill-bridge/index.cjs +2 -2
- package/dist/skill-bridge/index.cjs.map +1 -1
- package/dist/skill-bridge/index.js +1 -1
- package/dist/templatePath-27vUZowm.cjs +75 -0
- package/dist/templatePath-27vUZowm.cjs.map +1 -0
- package/dist/templatePath-k_WNbL_Q.js +52 -0
- package/dist/templatePath-k_WNbL_Q.js.map +1 -0
- package/package.json +1 -1
- package/dist/collection/paths.cjs.map +0 -1
- package/dist/collection/paths.js.map +0 -1
- package/dist/promptSafety-BLUcImzd.js.map +0 -1
- package/dist/promptSafety-DI_1Rvhk.cjs.map +0 -1
- package/dist/server-BpEo0FOd.js.map +0 -1
- package/dist/server-CkysfLh4.cjs.map +0 -1
|
@@ -128,6 +128,7 @@ skipped, never crashes the host):
|
|
|
128
128
|
| `icon` | A **Material Symbols** name (`receipt_long`, `people`, `schedule`, `menu_book`). Required. |
|
|
129
129
|
| `dataPath` | Workspace-relative records folder, e.g. `data/recipes/items`. Must stay under the workspace. Required — unless `dataSource` is set (declare exactly ONE of the two). |
|
|
130
130
|
| `dataSource` | Optional. `{ "type": "csv", "path": "data/students.csv" }` — the records ARE the rows of an external data file (workspace-relative, containment-checked like `dataPath`). Makes the collection **read-only** in every UI/tool write path; see "External data (CSV) collections" below. Mutually exclusive with `dataPath`, `singleton`, `ingest`, `spawn`, and `mutate` actions. |
|
|
131
|
+
| `storage` | Optional. `{ "type": "sqlite", "path": "data/<name>.db" }` — records live in a single SQLite database file instead of per-record JSON files; the collection stays **writable** and behaves identically everywhere else. Declare exactly ONE of `dataPath` / `dataSource` / `storage`. Cannot combine with `spawn`, `completionField`, or `triggerField` (v1). See "Alternative storage (sqlite)" below. |
|
|
131
132
|
| `primaryKey` | The field name whose value is the filename. That field MUST set `primary: true`. The value must be a valid record id (see the **Records** section's id-charset rule). Required. |
|
|
132
133
|
| `singleton` | Optional. When set, at most one record exists, pinned to this exact id (e.g. `me`). Host pre-fills + locks the create form and hides Add once it exists. |
|
|
133
134
|
| `fields` | Ordered map of field-name → field spec. **Insertion order = column order** in the table. Required. |
|
|
@@ -227,6 +228,9 @@ Every field spec needs a `type` and a `label`. Extra keys by type:
|
|
|
227
228
|
collection). No extra keys. Great for photos like a business card: read the
|
|
228
229
|
details off the attached image and write its path into the image field.
|
|
229
230
|
Write the bare workspace-relative path — never an `/api/files/raw?...` URL.
|
|
231
|
+
A **custom view** renders these via `GET <dataUrl>/image` (see
|
|
232
|
+
`config/helps/custom-view.md` "Displaying images"; remote views declare
|
|
233
|
+
`imageFields` instead) — never by base64-embedding them into the view HTML.
|
|
230
234
|
- **`file`** — stores a **workspace-relative file path** as a plain string (e.g.
|
|
231
235
|
`artifacts/html/the-solar-system-1777158558023.html`). Rendered as a
|
|
232
236
|
**clickable link** in both the list table and the detail view (unlike `image`,
|
|
@@ -1038,6 +1042,53 @@ Minimal example (Japanese roster, Shift_JIS file dropped at
|
|
|
1038
1042
|
}
|
|
1039
1043
|
```
|
|
1040
1044
|
|
|
1045
|
+
## Alternative storage (sqlite) — `storage`
|
|
1046
|
+
|
|
1047
|
+
A collection can keep its records in a single SQLite database file instead of
|
|
1048
|
+
per-record JSON files: declare `storage` instead of `dataPath`. Unlike
|
|
1049
|
+
`dataSource` (read-only, user-owned file), a `storage` collection is a normal
|
|
1050
|
+
WRITABLE collection — every UI, tool, custom view (desktop and remote), and
|
|
1051
|
+
API surface works identically; only where the rows live changes. The db file
|
|
1052
|
+
is collection-owned and managed by the host (`records` table, one JSON record
|
|
1053
|
+
per row keyed by `primaryKey`).
|
|
1054
|
+
|
|
1055
|
+
When to use: only when the user explicitly asks for it, or a collection is
|
|
1056
|
+
expected to grow far beyond what a folder of JSON files handles comfortably
|
|
1057
|
+
(thousands of records). For everything else prefer `dataPath` — record files
|
|
1058
|
+
are transparent, diffable, and every feature supports them.
|
|
1059
|
+
|
|
1060
|
+
Notes:
|
|
1061
|
+
|
|
1062
|
+
- Requires **Node.js >= 22.5** (built-in `node:sqlite`); on an older runtime
|
|
1063
|
+
only sqlite collections fail, with a clear error (see
|
|
1064
|
+
`config/helps/error-recovery.md`).
|
|
1065
|
+
- The full write machinery works: `spawn`, `completionField` /
|
|
1066
|
+
`triggerField` bells, `singleton`, `ingest`, and mutate actions all go
|
|
1067
|
+
through the storage layer, and a watcher on the db file drives bell
|
|
1068
|
+
reconciliation + live view refreshes — including after EXTERNAL edits to
|
|
1069
|
+
the `.db`.
|
|
1070
|
+
- The Repair pass validates records through the storage backend (schema
|
|
1071
|
+
violations are reported by record id); a row so corrupt the backend
|
|
1072
|
+
can't parse it is skipped silently, unlike a malformed record FILE.
|
|
1073
|
+
- Deleting the collection archives the `.db` alongside the skill under
|
|
1074
|
+
`archive/…` and removes the live file.
|
|
1075
|
+
|
|
1076
|
+
Minimal example:
|
|
1077
|
+
|
|
1078
|
+
```json
|
|
1079
|
+
{
|
|
1080
|
+
"title": "Order History",
|
|
1081
|
+
"icon": "receipt_long",
|
|
1082
|
+
"storage": { "type": "sqlite", "path": "data/orders.db" },
|
|
1083
|
+
"primaryKey": "id",
|
|
1084
|
+
"fields": {
|
|
1085
|
+
"id": { "type": "string", "label": "ID", "primary": true },
|
|
1086
|
+
"item": { "type": "string", "label": "Item" },
|
|
1087
|
+
"total": { "type": "number", "label": "Total" }
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
```
|
|
1091
|
+
|
|
1041
1092
|
## End-to-end: creating a new collection skill
|
|
1042
1093
|
|
|
1043
1094
|
1. Pick a `<slug>` (lowercase-hyphen, no `mc-` prefix) and a `dataPath`
|
|
@@ -106,9 +106,9 @@ toggles, embeds) — the same numbers the user sees elsewhere.
|
|
|
106
106
|
A view can run structured aggregations over the collection — on a
|
|
107
107
|
`dataSource` (CSV) collection this scans the WHOLE file (the record read
|
|
108
108
|
above is row-capped at 5,000 there, so an aggregate computed from it would
|
|
109
|
-
be silently wrong); on
|
|
110
|
-
records, so computed fields
|
|
111
|
-
columns:
|
|
109
|
+
be silently wrong); on any other collection (file-backed or sqlite
|
|
110
|
+
`storage`) it aggregates the ENRICHED records, so computed fields
|
|
111
|
+
(`derived` / `rollup` / `toggle`) are queryable columns:
|
|
112
112
|
|
|
113
113
|
```js
|
|
114
114
|
const res = await fetch(dataUrl + "/query", {
|
|
@@ -189,6 +189,40 @@ if (res.ok) {
|
|
|
189
189
|
- A 409 means the record's current state fails the action's `require` — treat
|
|
190
190
|
it as "button disabled", not an error to retry.
|
|
191
191
|
|
|
192
|
+
### Displaying images — `GET <dataUrl>/image`
|
|
193
|
+
|
|
194
|
+
An `image`-type field stores a **workspace path** (`data/attachments/…`,
|
|
195
|
+
`data/<name>/logos/…`) that a sandboxed view cannot load directly — the
|
|
196
|
+
iframe has an opaque origin and `<img>` can't attach the bearer token. To
|
|
197
|
+
render one, ask the host to resolve it into a downscaled thumbnail:
|
|
198
|
+
|
|
199
|
+
```js
|
|
200
|
+
// Request the image field in your projection so you have its path,
|
|
201
|
+
// then resolve each path into a data: URL and assign it to the <img>.
|
|
202
|
+
const res = await fetch(dataUrl + "/image?path=" + encodeURIComponent(item.photo) + "&maxEdge=256", {
|
|
203
|
+
headers: { Authorization: "Bearer " + token },
|
|
204
|
+
});
|
|
205
|
+
if (res.ok) {
|
|
206
|
+
const { dataUrl: src } = await res.json();
|
|
207
|
+
img.src = src; // "data:image/jpeg;base64,…"
|
|
208
|
+
} // non-ok: leave the placeholder — 404 = not an image-field value / unresolvable
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
- **Only current image-field values resolve.** The host checks `path`
|
|
212
|
+
against the collection's records: it must be the CURRENT value of a
|
|
213
|
+
schema `image`-type field — the token cannot read arbitrary workspace
|
|
214
|
+
files. A stale or hand-built path answers 404.
|
|
215
|
+
- `maxEdge` clamps to 64–1024 (default 512) — request the size you render.
|
|
216
|
+
- Cache the resolved `data:` URLs per path in your view (a simple `Map`)
|
|
217
|
+
and re-resolve inside your `onChange` callback only for paths you haven't
|
|
218
|
+
seen — each request re-scans the records server-side.
|
|
219
|
+
- A record field holding a public **`https:` URL needs none of this** —
|
|
220
|
+
`<img src>` may load any https host directly (see the sandbox rules).
|
|
221
|
+
- **Do NOT base64-embed images into the view HTML itself.** It bloats the
|
|
222
|
+
file, goes stale the moment a record's image changes, and needs manual
|
|
223
|
+
regeneration — this endpoint (or an https URL field) is always the
|
|
224
|
+
better answer.
|
|
225
|
+
|
|
192
226
|
### Staying live — `onChange`
|
|
193
227
|
|
|
194
228
|
By default a view paints once, on load. To keep it fresh, register a callback —
|
|
@@ -213,6 +213,36 @@ Related, not an error: a dataSource CSV in Shift_JIS / UTF-16 is decoded
|
|
|
213
213
|
automatically to a cache copy under the OS temp dir — never "fix" the
|
|
214
214
|
user's file by re-encoding it.
|
|
215
215
|
|
|
216
|
+
## storage (sqlite) collection fails — "sqlite storage needs the node:sqlite module"
|
|
217
|
+
|
|
218
|
+
A collection whose schema declares `storage: { type: "sqlite", path: … }`
|
|
219
|
+
keeps its records in a single SQLite database file, read/written through
|
|
220
|
+
Node's BUILT-IN `node:sqlite` module — no npm dependency. That module
|
|
221
|
+
exists only in **Node.js >= 22.5**, while the app itself runs on >= 20.12,
|
|
222
|
+
so on an older runtime ONLY sqlite-backed collections break (file and
|
|
223
|
+
dataSource collections keep working) and every operation fails with
|
|
224
|
+
`sqlite storage needs the node:sqlite module (Node.js >= 22.5) — this
|
|
225
|
+
runtime cannot load it`.
|
|
226
|
+
|
|
227
|
+
Diagnosis + fixes, in order:
|
|
228
|
+
|
|
229
|
+
1. **Check the Node version** — `node --version`. Below 22.5 there is no
|
|
230
|
+
local fix except upgrading Node; tell the user which version they run
|
|
231
|
+
and that their other collections are unaffected.
|
|
232
|
+
2. **`ExperimentalWarning: SQLite is an experimental feature`** printed
|
|
233
|
+
once on first use is EXPECTED on Node 22.x — it is a warning, not an
|
|
234
|
+
error; do not chase it.
|
|
235
|
+
3. **Do not "repair" by converting the collection to `dataPath`** unless
|
|
236
|
+
the user asks — the records live inside the `.db` file, not as
|
|
237
|
+
`<id>.json` files; a schema flip alone would make the collection look
|
|
238
|
+
empty, not migrate it.
|
|
239
|
+
|
|
240
|
+
Known limits of sqlite storage (by design, not bugs to fix in place):
|
|
241
|
+
a db row so corrupt the backend can't parse it is skipped silently (the
|
|
242
|
+
Repair pass reports schema violations by record id, but has no
|
|
243
|
+
"malformed file" classification), and the completion/spawn watcher
|
|
244
|
+
reconciles the WHOLE collection per db change (no per-record events).
|
|
245
|
+
|
|
216
246
|
## Fallback
|
|
217
247
|
|
|
218
248
|
If none of the above matches the failing tool output:
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Google Calendar sync — mirror a Google calendar into a collection
|
|
2
|
+
|
|
3
|
+
A collection can keep itself in sync with one of the user's Google calendars.
|
|
4
|
+
Add a `googleCalendar` block to its `schema.json` and the host pulls changed
|
|
5
|
+
events on a schedule and writes them as records — **without calling you**. No
|
|
6
|
+
tool call, no tokens spent per sync, so hourly syncing is free.
|
|
7
|
+
|
|
8
|
+
This is the only calendar mechanism: there is no calendar tool and no bundled
|
|
9
|
+
calendar collection. You author the schema when the user asks for one.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
The user's Google account must be linked (`google` tool, `kind: "status"`). If
|
|
14
|
+
it isn't, sync silently does nothing until they link it in settings.
|
|
15
|
+
|
|
16
|
+
## The block
|
|
17
|
+
|
|
18
|
+
```jsonc
|
|
19
|
+
{
|
|
20
|
+
"fields": {
|
|
21
|
+
"gid": { "type": "string", "label": "ID", "primary": true },
|
|
22
|
+
"title": { "type": "string", "label": "Event" },
|
|
23
|
+
"on": { "type": "datetime", "label": "Start" },
|
|
24
|
+
"until": { "type": "datetime", "label": "End" }
|
|
25
|
+
},
|
|
26
|
+
"primaryKey": "gid",
|
|
27
|
+
"displayField": "title",
|
|
28
|
+
"calendarField": "on",
|
|
29
|
+
"calendarEndField": "until",
|
|
30
|
+
"dataPath": "data/collections/my-schedule/items",
|
|
31
|
+
|
|
32
|
+
"googleCalendar": {
|
|
33
|
+
"calendarId": "primary",
|
|
34
|
+
"map": { "title": "summary", "on": "start", "until": "end" }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- `calendarId` — the calendar to read. `"primary"` (as in the example) and
|
|
40
|
+
omitting the key entirely both mean the user's primary calendar. For any
|
|
41
|
+
other calendar, get its id from the `google` tool
|
|
42
|
+
(`kind: "calendarListCalendars"`).
|
|
43
|
+
- `map` — **your field name → the Google event field**. Pick whatever field
|
|
44
|
+
names suit the collection; the map absorbs the difference. Map at least one
|
|
45
|
+
field: an empty map syncs records that carry only the event id, so the user
|
|
46
|
+
would see rows with no content.
|
|
47
|
+
|
|
48
|
+
Mappable event fields: `summary`, `start`, `end`, `htmlLink`, `colorId`,
|
|
49
|
+
`status`.
|
|
50
|
+
|
|
51
|
+
## The primary field is the event id
|
|
52
|
+
|
|
53
|
+
Do **not** map the primary field. It always receives the Google event id, which
|
|
54
|
+
is what lets a re-sync update an existing record instead of duplicating it.
|
|
55
|
+
Declaring it in `map` is a schema error.
|
|
56
|
+
|
|
57
|
+
Use `datetime` (not `date`) for start/end when events have real clock times —
|
|
58
|
+
the calendar day view then draws each record as a proportional time block.
|
|
59
|
+
|
|
60
|
+
## What sync does
|
|
61
|
+
|
|
62
|
+
- New or edited events are written, keyed by event id (existing records are
|
|
63
|
+
replaced in place).
|
|
64
|
+
- Events deleted in Google are **deleted** from the collection.
|
|
65
|
+
- Only what changed since the last run is fetched, so a big calendar stays
|
|
66
|
+
cheap after the first sync.
|
|
67
|
+
- The first run walks the whole calendar to establish a starting point. Note
|
|
68
|
+
this covers **all** dates — Google does not allow a date window together with
|
|
69
|
+
incremental sync — so a calendar with years of history produces a lot of
|
|
70
|
+
records on that first pass.
|
|
71
|
+
|
|
72
|
+
Records are ordinary collection records: the user can open, filter, and view
|
|
73
|
+
them like any other. Edits they make locally are overwritten the next time
|
|
74
|
+
Google reports a change to that event.
|
|
75
|
+
|
|
76
|
+
## Not for this
|
|
77
|
+
|
|
78
|
+
A `dataSource` (CSV-backed) collection is read-only and cannot declare
|
|
79
|
+
`googleCalendar`. Use a normal `dataPath` collection.
|
package/assets/helps/index.md
CHANGED
|
@@ -71,6 +71,7 @@ See [Wiki](config/helps/wiki.md) for details on how it works.
|
|
|
71
71
|
- [Telegram Bridge](config/helps/telegram.md) — how to talk to MulmoClaude from the Telegram app: creating a bot, starting the bridge, allowlisting chat IDs, commands, and troubleshooting
|
|
72
72
|
- [Remote host](config/helps/remote-host.md) — drive MulmoClaude from a phone at mulmoserver.web.app: Google sign-in connect, host online vs. offline (queued chats, 7-day expiry), photo attachments, and the security model
|
|
73
73
|
- [Feeds](config/helps/feeds.md) — register a self-refreshing data feed (RSS/Atom/JSON) by authoring `feeds/<slug>/schema.json`: schema shape, the `ingest` block, raw-item field mapping, and `maxItems` retention
|
|
74
|
+
- [Google Calendar sync](config/helps/google-calendar-collection.md) — mirror a Google calendar into a collection with a `googleCalendar` block: field mapping, why the primary field holds the event id, and how deletions propagate
|
|
74
75
|
- [GitHub repositories in the workspace](config/helps/github.md) — clone-destination rules under `github/<name>/` and how to handle existing directories with matching or different remotes
|
|
75
76
|
- [Collection skills](config/helps/collection-skills.md) — build a data app (model + UI + relations + computed fields + action buttons) by authoring a `schema.json` collection skill: the DSL, field types, derived formulas, actions, records
|
|
76
77
|
- [Custom views](config/helps/custom-view.md) — give a collection a view the built-ins don't cover (year/quarter overview, Gantt): an HTML file under `views/`, registered in `schema.json`, rendered in a sandboxed iframe over the records
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ActionSpecZ, CollectionSchemaZ, CustomViewZ, DataSourceZ, DynamicIconRuleZ, DynamicIconSourceZ, DynamicIconSpecZ, EveryFieldDrivenZ, EveryLiteralZ, EveryZ, FieldSpecZ, IngestZ, SpawnZ, SubFieldSpecZ, WhenZ } from './schemaZ';
|
|
2
|
+
import { ActionSpecZ, CollectionSchemaZ, CustomViewZ, DataSourceZ, DynamicIconRuleZ, DynamicIconSourceZ, DynamicIconSpecZ, EveryFieldDrivenZ, EveryLiteralZ, EveryZ, FieldSpecZ, IngestZ, SpawnZ, StorageZ, SubFieldSpecZ, WhenZ } from './schemaZ';
|
|
3
3
|
/** Minimal "this collection is a feed" descriptor carried on the schema.
|
|
4
4
|
* Deliberately narrow — the canonical collection contract stays
|
|
5
5
|
* independent of the host's feeds subsystem. The host's richer retrieval
|
|
@@ -146,6 +146,18 @@ export type CollectionIngestSpec = z.infer<typeof IngestZ>;
|
|
|
146
146
|
/** The `dataSource` block: this collection's records are the rows of an
|
|
147
147
|
* external read-only data file (v1: CSV). See `DataSourceZ`. */
|
|
148
148
|
export type CollectionDataSource = z.infer<typeof DataSourceZ>;
|
|
149
|
+
/** The `storage` block: an alternative WRITABLE record backend (v1:
|
|
150
|
+
* sqlite). See `StorageZ`. */
|
|
151
|
+
export type CollectionStorage = z.infer<typeof StorageZ>;
|
|
152
|
+
/** Every storage backend a schema can select. `file` is the implicit
|
|
153
|
+
* default (`dataPath`); `csv` is implied by `dataSource`; other kinds are
|
|
154
|
+
* named explicitly via `storage.type`. The server's store factory registry
|
|
155
|
+
* (`server/store.ts`) is keyed by this. */
|
|
156
|
+
export type CollectionStorageKind = "file" | "csv" | "sqlite";
|
|
157
|
+
/** Which storage backend serves this schema's records. Derived, not stored:
|
|
158
|
+
* existing schemas carry no `storage` key and must keep resolving exactly
|
|
159
|
+
* as before (`dataSource` ⇒ csv, else file). */
|
|
160
|
+
export declare function storageKindFor(schema: Pick<CollectionSchema, "dataSource" | "storage">): CollectionStorageKind;
|
|
149
161
|
/** The whole `schema.json` contract. Key-level docs live on
|
|
150
162
|
* `CollectionSchemaZ` in `./schemaZ`. */
|
|
151
163
|
export type CollectionSchema = z.infer<typeof CollectionSchemaZ>;
|
|
@@ -501,6 +501,24 @@ export declare const AgentIngestZ: z.ZodObject<{
|
|
|
501
501
|
role: z.ZodString;
|
|
502
502
|
template: z.ZodString;
|
|
503
503
|
}, z.core.$strip>;
|
|
504
|
+
/** The Google event fields a collection may pull from. `id` is absent on
|
|
505
|
+
* purpose — it always lands in the primary field, since upsert-by-event-id
|
|
506
|
+
* is what makes the sync idempotent. */
|
|
507
|
+
export declare const GOOGLE_CALENDAR_SOURCE_FIELDS: readonly ["summary", "start", "end", "htmlLink", "colorId", "status"];
|
|
508
|
+
/** Marks a collection as the destination of the LLM-free Google Calendar
|
|
509
|
+
* sync (#2095). `map` is collectionField → Google event field, so the user's
|
|
510
|
+
* collection keeps whatever field names it already uses. */
|
|
511
|
+
export declare const GoogleCalendarSyncZ: z.ZodObject<{
|
|
512
|
+
calendarId: z.ZodOptional<z.ZodString>;
|
|
513
|
+
map: z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
514
|
+
summary: "summary";
|
|
515
|
+
start: "start";
|
|
516
|
+
end: "end";
|
|
517
|
+
htmlLink: "htmlLink";
|
|
518
|
+
colorId: "colorId";
|
|
519
|
+
status: "status";
|
|
520
|
+
}>>;
|
|
521
|
+
}, z.core.$strip>;
|
|
504
522
|
/** `ingest` is a discriminated union on `kind`: the three declarative
|
|
505
523
|
* retrievers fetch-and-map; `agent` dispatches a hidden worker. Optional on
|
|
506
524
|
* every schema — skill-backed collections usually omit it; only feeds
|
|
@@ -648,6 +666,18 @@ export declare const DataSourceZ: z.ZodObject<{
|
|
|
648
666
|
type: z.ZodLiteral<"csv">;
|
|
649
667
|
path: z.ZodString;
|
|
650
668
|
}, z.core.$strip>;
|
|
669
|
+
/** Alternative WRITABLE storage backend for a collection's records —
|
|
670
|
+
* unlike `dataSource` (external read-only file), a `storage` collection
|
|
671
|
+
* behaves like a normal writable collection; only where the rows live
|
|
672
|
+
* changes. v1: `sqlite` — records in a single SQLite database file
|
|
673
|
+
* (`node:sqlite`, one JSON record per row keyed by the primaryKey).
|
|
674
|
+
* `path` is workspace-relative and containment-checked exactly like
|
|
675
|
+
* `dataPath`. The store factory registry (`server/store.ts`) picks the
|
|
676
|
+
* implementation by `type` (plans/refactor-storage-virtualization.md). */
|
|
677
|
+
export declare const StorageZ: z.ZodObject<{
|
|
678
|
+
type: z.ZodLiteral<"sqlite">;
|
|
679
|
+
path: z.ZodString;
|
|
680
|
+
}, z.core.$strip>;
|
|
651
681
|
export declare const CollectionSchemaZ: z.ZodPreprocess<z.ZodObject<{
|
|
652
682
|
title: z.ZodString;
|
|
653
683
|
icon: z.ZodString;
|
|
@@ -656,6 +686,10 @@ export declare const CollectionSchemaZ: z.ZodPreprocess<z.ZodObject<{
|
|
|
656
686
|
type: z.ZodLiteral<"csv">;
|
|
657
687
|
path: z.ZodString;
|
|
658
688
|
}, z.core.$strip>>;
|
|
689
|
+
storage: z.ZodOptional<z.ZodObject<{
|
|
690
|
+
type: z.ZodLiteral<"sqlite">;
|
|
691
|
+
path: z.ZodString;
|
|
692
|
+
}, z.core.$strip>>;
|
|
659
693
|
primaryKey: z.ZodString;
|
|
660
694
|
singleton: z.ZodOptional<z.ZodString>;
|
|
661
695
|
fields: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -1056,6 +1090,17 @@ export declare const CollectionSchemaZ: z.ZodPreprocess<z.ZodObject<{
|
|
|
1056
1090
|
role: z.ZodString;
|
|
1057
1091
|
template: z.ZodString;
|
|
1058
1092
|
}, z.core.$strip>], "kind">>;
|
|
1093
|
+
googleCalendar: z.ZodOptional<z.ZodObject<{
|
|
1094
|
+
calendarId: z.ZodOptional<z.ZodString>;
|
|
1095
|
+
map: z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
1096
|
+
summary: "summary";
|
|
1097
|
+
start: "start";
|
|
1098
|
+
end: "end";
|
|
1099
|
+
htmlLink: "htmlLink";
|
|
1100
|
+
colorId: "colorId";
|
|
1101
|
+
status: "status";
|
|
1102
|
+
}>>;
|
|
1103
|
+
}, z.core.$strip>>;
|
|
1059
1104
|
dynamicIcon: z.ZodOptional<z.ZodObject<{
|
|
1060
1105
|
source: z.ZodObject<{
|
|
1061
1106
|
collection: z.ZodString;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_ids = require("../ids-Dl9Ij63K.cjs");
|
|
3
|
+
const require_project = require("../project-BWI5w_BT.cjs");
|
|
4
|
+
const require_promptSafety = require("../promptSafety-Co4cYQ_Z.cjs");
|
|
3
5
|
const require_errorMessage = require("../errorMessage--LvXe_Jx.cjs");
|
|
4
6
|
//#region src/collection/core/presentCollection.ts
|
|
5
7
|
var TOOL_NAME = "presentCollection";
|
|
@@ -225,7 +227,7 @@ function rowDraftToRecord(rowDraft, subFields) {
|
|
|
225
227
|
function draftToRecord(state, schema) {
|
|
226
228
|
const record = {};
|
|
227
229
|
for (const [key, field] of Object.entries(schema.fields)) {
|
|
228
|
-
if (
|
|
230
|
+
if (require_ids.COMPUTED_TYPES.has(field.type)) continue;
|
|
229
231
|
if (field.type === "boolean") {
|
|
230
232
|
if (shouldEmitBoolean(state, key, field)) record[key] = state.bool[key] === true;
|
|
231
233
|
continue;
|
|
@@ -281,7 +283,7 @@ function firstMissingTableSubField(field, rows) {
|
|
|
281
283
|
* value, and the computed/projected kinds (COMPUTED_TYPES — the shared
|
|
282
284
|
* set, so a future computed type can't drift past this check) have no
|
|
283
285
|
* draft input at all. */
|
|
284
|
-
var NEVER_MISSING_TYPES = /* @__PURE__ */ new Set(["boolean", ...
|
|
286
|
+
var NEVER_MISSING_TYPES = /* @__PURE__ */ new Set(["boolean", ...require_ids.COMPUTED_TYPES]);
|
|
285
287
|
function validateOneField(key, field, draft, record) {
|
|
286
288
|
if (!require_promptSafety.fieldVisible(field, record)) return null;
|
|
287
289
|
if (field.type === "table" && field.of) {
|
|
@@ -436,16 +438,16 @@ function shortHexId() {
|
|
|
436
438
|
return crypto.randomUUID().replace(/-/g, "").slice(0, 8);
|
|
437
439
|
}
|
|
438
440
|
//#endregion
|
|
439
|
-
exports.AGENT_INGEST_KIND =
|
|
440
|
-
exports.COMPUTED_TYPES =
|
|
441
|
+
exports.AGENT_INGEST_KIND = require_ids.AGENT_INGEST_KIND;
|
|
442
|
+
exports.COMPUTED_TYPES = require_ids.COMPUTED_TYPES;
|
|
441
443
|
exports.ENUM_ALERT = ENUM_ALERT;
|
|
442
444
|
exports.ENUM_NEUTRAL = ENUM_NEUTRAL;
|
|
443
445
|
exports.ENUM_NUDGE = ENUM_NUDGE;
|
|
444
|
-
exports.FEED_SCHEDULES =
|
|
445
|
-
exports.INGEST_KINDS =
|
|
446
|
+
exports.FEED_SCHEDULES = require_ids.FEED_SCHEDULES;
|
|
447
|
+
exports.INGEST_KINDS = require_ids.INGEST_KINDS;
|
|
446
448
|
exports.MINUTES_PER_DAY = require_promptSafety.MINUTES_PER_DAY;
|
|
447
|
-
exports.SAFE_RECORD_ID_PATTERN =
|
|
448
|
-
exports.SAFE_SLUG_PATTERN =
|
|
449
|
+
exports.SAFE_RECORD_ID_PATTERN = require_ids.SAFE_RECORD_ID_PATTERN;
|
|
450
|
+
exports.SAFE_SLUG_PATTERN = require_ids.SAFE_SLUG_PATTERN;
|
|
449
451
|
exports.TOOL_DEFINITION = TOOL_DEFINITION;
|
|
450
452
|
exports.TOOL_NAME = TOOL_NAME;
|
|
451
453
|
exports.actionVisible = require_promptSafety.actionVisible;
|
|
@@ -466,7 +468,7 @@ exports.daySlice = require_promptSafety.daySlice;
|
|
|
466
468
|
exports.defangForPrompt = require_promptSafety.defangForPrompt;
|
|
467
469
|
exports.deriveAll = require_promptSafety.deriveAll;
|
|
468
470
|
exports.draftToRecord = draftToRecord;
|
|
469
|
-
exports.embedTargetId =
|
|
471
|
+
exports.embedTargetId = require_ids.embedTargetId;
|
|
470
472
|
exports.emptyRow = emptyRow;
|
|
471
473
|
exports.enumColorClasses = enumColorClasses;
|
|
472
474
|
exports.enumSortValue = enumSortValue;
|
|
@@ -477,10 +479,10 @@ exports.executePresentCollection = executePresentCollection;
|
|
|
477
479
|
exports.fieldVisible = require_promptSafety.fieldVisible;
|
|
478
480
|
exports.firstDateField = require_promptSafety.firstDateField;
|
|
479
481
|
exports.firstMissingRequiredField = firstMissingRequiredField;
|
|
480
|
-
exports.isFieldDrivenEvery =
|
|
481
|
-
exports.isReadOnlySchema =
|
|
482
|
-
exports.isSafeRecordId =
|
|
483
|
-
exports.isSafeSlug =
|
|
482
|
+
exports.isFieldDrivenEvery = require_ids.isFieldDrivenEvery;
|
|
483
|
+
exports.isReadOnlySchema = require_ids.isReadOnlySchema;
|
|
484
|
+
exports.isSafeRecordId = require_ids.isSafeRecordId;
|
|
485
|
+
exports.isSafeSlug = require_ids.isSafeSlug;
|
|
484
486
|
exports.isSortableField = isSortableField;
|
|
485
487
|
exports.itemIdOf = itemIdOf;
|
|
486
488
|
exports.itemIsDone = require_promptSafety.itemIsDone;
|
|
@@ -494,6 +496,7 @@ exports.parseIsoDate = require_promptSafety.parseIsoDate;
|
|
|
494
496
|
exports.parseIsoDateTime = require_promptSafety.parseIsoDateTime;
|
|
495
497
|
exports.parseTimeRange = require_promptSafety.parseTimeRange;
|
|
496
498
|
exports.projectBacklinkRow = require_promptSafety.projectBacklinkRow;
|
|
499
|
+
exports.projectRecordFields = require_project.projectRecordFields;
|
|
497
500
|
exports.recordSpan = require_promptSafety.recordSpan;
|
|
498
501
|
exports.resolveEnumColor = resolveEnumColor;
|
|
499
502
|
exports.resolveIcon = require_promptSafety.resolveIcon;
|
|
@@ -504,6 +507,7 @@ exports.selectDynamicRecord = require_promptSafety.selectDynamicRecord;
|
|
|
504
507
|
exports.shortHexId = shortHexId;
|
|
505
508
|
exports.sortItems = sortItems;
|
|
506
509
|
exports.spanCoversDay = require_promptSafety.spanCoversDay;
|
|
510
|
+
exports.storageKindFor = require_ids.storageKindFor;
|
|
507
511
|
exports.stringSortValue = stringSortValue;
|
|
508
512
|
exports.whenMatches = require_promptSafety.whenMatches;
|
|
509
513
|
exports.ymdKey = require_promptSafety.ymdKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/collection/core/presentCollection.ts","../../src/collection/core/enumColors.ts","../../src/collection/core/draft.ts","../../src/collection/core/sortItems.ts","../../src/collection/core/itemLabel.ts","../../src/collection/core/shortHexId.ts"],"sourcesContent":["// presentCollection tool — definition + pure server-side executor.\n//\n// Isomorphic (no Vue, no Node): bundled to the browser as the plugin's\n// `execute`, and run server-side via the host's plugin dispatch route. The\n// executor only validates + echoes the addressing; the live schema + items\n// are fetched client-side by the View through the host's /api/collections\n// routes, so a bad slug surfaces as the View's \"not found\" state.\n\nimport type { ToolContext, ToolDefinition, ToolResult } from \"gui-chat-protocol\";\n\nexport const TOOL_NAME = \"presentCollection\";\n\n/** Render payload carried in the tool result's `data` field; the View mounts\n * off these. Same shape as the tool args. */\nexport interface PresentCollectionData {\n /** Slug of the collection to display (e.g. \"clients\", \"invoices\"). */\n collectionSlug: string;\n /** Optional primary-key value of a single item to open on mount. */\n itemId?: string;\n}\n\nexport type PresentCollectionArgs = PresentCollectionData;\n\nexport const TOOL_DEFINITION: ToolDefinition = {\n type: \"function\",\n name: TOOL_NAME,\n description:\n \"Display a schema-driven collection inline in the chat as an interactive, editable card. Shows the collection's list of records. Pass `itemId` to open one specific record on mount.\",\n parameters: {\n type: \"object\",\n properties: {\n collectionSlug: {\n type: \"string\",\n description: \"The slug of the collection to display (e.g. 'clients', 'invoices', 'contacts').\",\n },\n itemId: {\n type: \"string\",\n description: \"Optional primary-key value of a single record to open in detail view on mount. Omit to show the full list.\",\n },\n },\n required: [\"collectionSlug\"],\n },\n prompt: `After making changes to schema-driven collections, use ${TOOL_NAME} to present either the collection or the item`,\n};\n\nexport const executePresentCollection = async (\n _context: ToolContext,\n args: PresentCollectionArgs,\n): Promise<ToolResult<PresentCollectionData, PresentCollectionData>> => {\n const collectionSlug = typeof args?.collectionSlug === \"string\" ? args.collectionSlug.trim() : \"\";\n if (!collectionSlug) {\n return {\n message: \"presentCollection error: collectionSlug is required\",\n instructions: \"Tell the user you couldn't display the collection because no collection was specified, and ask which collection they mean.\",\n };\n }\n const itemId = typeof args.itemId === \"string\" && args.itemId.trim().length > 0 ? args.itemId.trim() : undefined;\n const data: PresentCollectionData = itemId ? { collectionSlug, itemId } : { collectionSlug };\n const target = itemId ? `${collectionSlug} / ${itemId}` : collectionSlug;\n return {\n message: `Presented collection ${target}`,\n // `data` is the view's source (also the host's render-eligibility signal);\n // `jsonData` is what the LLM sees. Same payload, two audiences.\n data,\n jsonData: data,\n // Phrased to stay correct for BOTH storage kinds without loading the\n // schema (this executor is deliberately pure/isomorphic): a writable\n // collection offers edit/create/delete in the card; a read-only\n // `dataSource` collection hides those and changes flow through its\n // data file instead.\n instructions:\n \"The collection has been presented to the user as an interactive card. They can browse and open records directly; on a writable collection they can also edit, create, and delete (a read-only dataSource collection shows no edit controls — its records change by editing the backing data file). No further action is needed unless they ask.\",\n };\n};\n","// A standard, ordered colour palette for `enum` field values, shared by every\n// collection surface (list, calendar, kanban). Each value in an\n// enum's `values` array is assigned the palette entry at its index — cycling\n// when an enum declares more values than the palette holds — so colouring is\n// automatic and consistent without any per-value schema config.\n//\n// Tailwind only detects class names that appear as complete string literals,\n// so every surface's classes are spelled out per colour below rather than\n// built from a colour name at runtime.\n//\n// One enum is special: the field a schema's `notifyWhen` targets (the\n// \"notification enum\"). Its flagged values read the notification severity\n// colours — the first flagged value (most urgent) red, the rest amber — and\n// every other value reads neutral grey, mirroring the notification bell\n// (red = urgent, amber = nudge) rather than the rotating palette.\n// `resolveEnumColor` encapsulates that rule.\n\nimport type { CollectionSchema } from \"./schema\";\n\nexport interface EnumColorClasses {\n /** Stat-card style: border + fill + text + hover. */\n card: string;\n /** Small status dot (kanban column header). */\n dot: string;\n /** Pill / badge / inline `<select>` fill + text (no border width). */\n badge: string;\n /** Border colour, paired with a `border` width class by the caller. */\n border: string;\n}\n\n// The palette deliberately EXCLUDES the warm warning band (red / orange /\n// amber): those are reserved for the notification-enum severity colours\n// (`ENUM_ALERT` red, `ENUM_NUDGE` amber), so a normal enum value can never\n// draw a colour that reads like a notification. Eight well-separated cool /\n// green / magenta hues keep enough variety for wide enums.\nconst PALETTE: readonly EnumColorClasses[] = [\n {\n card: \"border-indigo-200 bg-indigo-50 text-indigo-600 hover:bg-indigo-100\",\n dot: \"bg-indigo-500\",\n badge: \"bg-indigo-100 text-indigo-700\",\n border: \"border-indigo-200\",\n },\n { card: \"border-sky-200 bg-sky-50 text-sky-600 hover:bg-sky-100\", dot: \"bg-sky-500\", badge: \"bg-sky-100 text-sky-700\", border: \"border-sky-200\" },\n { card: \"border-cyan-200 bg-cyan-50 text-cyan-600 hover:bg-cyan-100\", dot: \"bg-cyan-500\", badge: \"bg-cyan-100 text-cyan-700\", border: \"border-cyan-200\" },\n { card: \"border-teal-200 bg-teal-50 text-teal-600 hover:bg-teal-100\", dot: \"bg-teal-500\", badge: \"bg-teal-100 text-teal-700\", border: \"border-teal-200\" },\n {\n card: \"border-emerald-200 bg-emerald-50 text-emerald-600 hover:bg-emerald-100\",\n dot: \"bg-emerald-500\",\n badge: \"bg-emerald-100 text-emerald-700\",\n border: \"border-emerald-200\",\n },\n { card: \"border-lime-200 bg-lime-50 text-lime-600 hover:bg-lime-100\", dot: \"bg-lime-500\", badge: \"bg-lime-100 text-lime-700\", border: \"border-lime-200\" },\n {\n card: \"border-violet-200 bg-violet-50 text-violet-600 hover:bg-violet-100\",\n dot: \"bg-violet-500\",\n badge: \"bg-violet-100 text-violet-700\",\n border: \"border-violet-200\",\n },\n {\n card: \"border-fuchsia-200 bg-fuchsia-50 text-fuchsia-600 hover:bg-fuchsia-100\",\n dot: \"bg-fuchsia-500\",\n badge: \"bg-fuchsia-100 text-fuchsia-700\",\n border: \"border-fuchsia-200\",\n },\n];\n\n/** Neutral styling for the empty / Uncategorized bucket — never a palette\n * colour, so an unset or unknown value reads grey across every surface. */\nexport const ENUM_NEUTRAL: EnumColorClasses = {\n card: \"border-slate-200 bg-slate-50 text-slate-500 hover:bg-slate-100\",\n dot: \"bg-slate-300\",\n badge: \"bg-slate-100 text-slate-500\",\n border: \"border-slate-200\",\n};\n\n/** The urgent notification colour (red), matching the bell's `urgent`\n * severity. The first value a schema's `notifyWhen` flags reads this. */\nexport const ENUM_ALERT: EnumColorClasses = {\n card: \"border-red-200 bg-red-50 text-red-600 hover:bg-red-100\",\n dot: \"bg-red-500\",\n badge: \"bg-red-100 text-red-700\",\n border: \"border-red-200\",\n};\n\n/** The nudge notification colour (amber), matching the bell's `nudge`\n * severity. Flagged `notifyWhen` values after the first read this. */\nexport const ENUM_NUDGE: EnumColorClasses = {\n card: \"border-amber-200 bg-amber-50 text-amber-600 hover:bg-amber-100\",\n dot: \"bg-amber-500\",\n badge: \"bg-amber-100 text-amber-700\",\n border: \"border-amber-200\",\n};\n\n/** Classes for the enum value at `index` in its field's `values` array. A\n * negative index (value unset or not among the declared values) reads\n * neutral. */\nexport function enumColorClasses(index: number): EnumColorClasses {\n if (index < 0) return ENUM_NEUTRAL;\n return PALETTE[index % PALETTE.length] ?? ENUM_NEUTRAL;\n}\n\n/** Index of `value` within an enum field's declared `values`, or -1 when the\n * value is empty / unknown (→ neutral). */\nexport function enumValueIndex(values: readonly string[] | undefined, value: unknown): number {\n if (value === undefined || value === null || value === \"\") return -1;\n return values?.indexOf(String(value)) ?? -1;\n}\n\n/** The flagged values when `fieldKey` is the schema's `notifyWhen` target (the\n * \"notification enum\"); undefined for every other field. */\nfunction notifyValuesFor(schema: CollectionSchema, fieldKey: string): readonly string[] | undefined {\n const spec = schema.notifyWhen;\n return spec && spec.field === fieldKey ? spec.in : undefined;\n}\n\n/** Resolve a value's colour for enum field `fieldKey`:\n * - Notification enum (`notifyWhen` targets it): the first flagged value (in\n * `notifyWhen.in` order, the most urgent) reads notification red, the rest\n * amber, and every non-flagged value neutral grey.\n * - Any other enum: the standard palette by the value's declared index. */\nexport function resolveEnumColor(schema: CollectionSchema, fieldKey: string, value: unknown): EnumColorClasses {\n const notifyValues = notifyValuesFor(schema, fieldKey);\n if (notifyValues) {\n const str = value === undefined || value === null ? \"\" : String(value);\n const rank = notifyValues.indexOf(str);\n if (rank < 0) return ENUM_NEUTRAL;\n return rank === 0 ? ENUM_ALERT : ENUM_NUDGE;\n }\n const spec = schema.fields[fieldKey];\n return enumColorClasses(enumValueIndex(spec?.type === \"enum\" ? spec.values : undefined, value));\n}\n","// Pure edit-draft logic for the collection record form, extracted from\n// CollectionView.vue so the parent (build draft / save / validate) and\n// the extracted CollectionRecordPanel (per-row table mutators) share one\n// implementation. No Vue, no I/O — every function maps a draft + schema\n// to a value, so the omission/validation semantics are unit-testable.\n\nimport { fieldVisible } from \"./actionVisible\";\nimport { COMPUTED_TYPES } from \"./schema\";\nimport type { CollectionFieldSpec as FieldSpec, CollectionFieldType as FieldType, CollectionItem, CollectionSchema } from \"./schema\";\nimport type { EditState, TableRowDraft } from \"./uiTypes\";\n\n/** A fresh, empty row draft for a `table` field's sub-schema. */\nexport function emptyRow(subFields: Record<string, FieldSpec>): TableRowDraft {\n const text: Record<string, string> = {};\n const bool: Record<string, boolean> = {};\n const boolOriginallyPresent: Record<string, boolean> = {};\n const boolTouched: Record<string, boolean> = {};\n for (const [subKey, subField] of Object.entries(subFields)) {\n if (subField.type === \"boolean\") {\n bool[subKey] = false;\n boolOriginallyPresent[subKey] = false; // brand-new row\n boolTouched[subKey] = false;\n } else {\n text[subKey] = \"\";\n }\n }\n return { text, bool, boolOriginallyPresent, boolTouched };\n}\n\n/** Build a row draft from an existing persisted row. */\nexport function rowFromItem(item: Record<string, unknown>, subFields: Record<string, FieldSpec>): TableRowDraft {\n const text: Record<string, string> = {};\n const bool: Record<string, boolean> = {};\n const boolOriginallyPresent: Record<string, boolean> = {};\n const boolTouched: Record<string, boolean> = {};\n for (const [subKey, subField] of Object.entries(subFields)) {\n const raw = item[subKey];\n if (subField.type === \"boolean\") {\n bool[subKey] = raw === true;\n // `typeof raw === \"boolean\"` so an existing explicit `false` is\n // recorded as present and round-trips on a no-op save.\n boolOriginallyPresent[subKey] = typeof raw === \"boolean\";\n boolTouched[subKey] = false;\n } else {\n text[subKey] = raw === undefined || raw === null ? \"\" : String(raw);\n }\n }\n return { text, bool, boolOriginallyPresent, boolTouched };\n}\n\n/** Decide whether a boolean field's draft value should be emitted (vs.\n * omitted so a downstream default applies). */\nfunction shouldEmitBoolean(state: EditState, key: string, field: FieldSpec): boolean {\n return Boolean(state.boolOriginallyPresent[key] || state.boolTouched[key] || field.required);\n}\n\n/** Convert a scalar draft slot to its persisted form. `undefined` = omit. */\nfunction scalarDraftToValue(raw: string | undefined, fieldType: FieldType): unknown {\n if (raw === undefined || raw === \"\") return undefined;\n if (fieldType === \"number\" || fieldType === \"money\") {\n const num = Number(raw);\n return Number.isFinite(num) ? num : raw;\n }\n return raw;\n}\n\n/** Convert one table row draft to its persisted record. */\nfunction rowDraftToRecord(rowDraft: TableRowDraft, subFields: Record<string, FieldSpec>): Record<string, unknown> {\n const row: Record<string, unknown> = {};\n for (const [subKey, subField] of Object.entries(subFields)) {\n if (subField.type === \"boolean\") {\n const value = rowDraft.bool[subKey] === true;\n if (rowDraft.boolOriginallyPresent[subKey] || rowDraft.boolTouched[subKey] || value || subField.required) row[subKey] = value;\n continue;\n }\n const value = scalarDraftToValue(rowDraft.text[subKey], subField.type);\n if (value !== undefined) row[subKey] = value;\n }\n return row;\n}\n\n/** Convert a full edit draft to the record to persist. */\nexport function draftToRecord(state: EditState, schema: CollectionSchema): CollectionItem {\n const record: CollectionItem = {};\n for (const [key, field] of Object.entries(schema.fields)) {\n if (COMPUTED_TYPES.has(field.type)) continue; // never persisted (toggle projects an enum field)\n if (field.type === \"boolean\") {\n if (shouldEmitBoolean(state, key, field)) record[key] = state.bool[key] === true;\n continue;\n }\n if (field.type === \"table\" && field.of) {\n const subFields = field.of;\n record[key] = (state.table[key] ?? []).map((rowDraft) => rowDraftToRecord(rowDraft, subFields));\n continue;\n }\n const value = scalarDraftToValue(state.text[key], field.type);\n if (value !== undefined) record[key] = value;\n }\n return record;\n}\n\n/** Normalise a raw inline-edit input (table-cell checkbox/select) to its\n * persisted form. Mirrors `draftToRecord`'s boolean strictness; an empty\n * enum selection (the placeholder option) clears the field via `undefined`. */\nexport function coerceInlineValue(field: FieldSpec, raw: boolean | string): unknown {\n if (field.type === \"boolean\") return raw === true;\n return raw === \"\" ? undefined : raw;\n}\n\n/** Build the full record to PUT for a single-cell inline edit, without\n * mutating `item`. A `undefined` value omits the key (enum cleared),\n * matching `draftToRecord`'s omission semantics. */\nexport function buildUpdatedRecord(item: CollectionItem, key: string, value: unknown): CollectionItem {\n if (value === undefined) {\n const { [key]: __omit, ...rest } = item;\n return rest;\n }\n return { ...item, [key]: value };\n}\n\n/** Empty for required-field validation — NOT a truthiness check (a\n * numeric `0` is a filled value). */\nfunction isMissingDraftValue(value: unknown): boolean {\n return value === undefined || value === null || value === \"\";\n}\n\n/** Label of the first required table sub-field empty in any row, else null. */\nfunction firstMissingTableSubField(field: FieldSpec, rows: TableRowDraft[] | undefined): string | null {\n if (field.type !== \"table\" || !rows) return null;\n for (let rowIdx = 0; rowIdx < rows.length; rowIdx++) {\n const row = rows[rowIdx];\n for (const [subKey, subField] of Object.entries(field.of)) {\n if (!subField.required || subField.type === \"boolean\") continue;\n if (isMissingDraftValue(row.text[subKey])) return `${field.label} #${rowIdx + 1}: ${subField.label}`;\n }\n }\n return null;\n}\n\n/** Field types the required check never flags: booleans always hold a\n * value, and the computed/projected kinds (COMPUTED_TYPES — the shared\n * set, so a future computed type can't drift past this check) have no\n * draft input at all. */\nconst NEVER_MISSING_TYPES: ReadonlySet<FieldType> = new Set<FieldType>([\"boolean\", ...COMPUTED_TYPES]);\n\nfunction validateOneField(key: string, field: FieldSpec, draft: EditState, record: CollectionItem): string | null {\n // A `when`-hidden field has no input the user can fill — never missing.\n if (!fieldVisible(field, record)) return null;\n if (field.type === \"table\" && field.of) {\n const rows = draft.table[key];\n if (field.required && (!rows || rows.length === 0)) return field.label;\n return firstMissingTableSubField(field, rows);\n }\n if (!field.required) return null;\n if (draft.mode === \"create\" && field.primary === true) return null; // server auto-generates id\n if (NEVER_MISSING_TYPES.has(field.type)) return null;\n return isMissingDraftValue(draft.text[key]) ? field.label : null;\n}\n\n/** Human-readable label of the first missing required field, or null. */\nexport function firstMissingRequiredField(draft: EditState, schema: CollectionSchema): string | null {\n const record = draftToRecord(draft, schema);\n for (const [key, field] of Object.entries(schema.fields)) {\n const missing = validateOneField(key, field, draft, record);\n if (missing) return missing;\n }\n return null;\n}\n","// Sorting for the collection list table. The header sort toggle (next to\n// each field title) cycles a single active column through none → asc →\n// desc → none; this module turns that state plus a per-field value\n// extractor into an ordered copy of the rows.\n//\n// Two invariants the comparator guarantees:\n// 1. Rows with an empty/missing value for the sorted field always sink\n// to the bottom, regardless of direction.\n// 2. Ties (and the empty group) keep their original order — the sort is\n// stable via the captured source index.\n//\n// Field-type → comparable mapping (see `isSortableField`):\n// string/text/email → string · number/money → numeric ·\n// date/datetime → epoch-ms · enum → declared-index · boolean/toggle/flag →\n// false<true · ref → display label · derived → its display type.\n// markdown/table/image/file/embed get no sort button.\n\nimport type { CollectionItem, CollectionFieldSpec, CollectionFieldType } from \"./schema\";\n\nexport type SortDirection = \"asc\" | \"desc\";\n\nexport interface SortState {\n /** Field key of the single active sort column. */\n field: string;\n direction: SortDirection;\n}\n\n/** A row's comparable value for the active field. Exactly one of `num` /\n * `str` is set when not empty; `empty` rows always sort last. */\nexport interface SortValue {\n empty: boolean;\n num?: number;\n str?: string;\n}\n\nconst EMPTY: SortValue = { empty: true };\n\n/** Field types that render no value text in the table, so offer no sort. */\nconst NON_SORTABLE: ReadonlySet<CollectionFieldType> = new Set<CollectionFieldType>([\"markdown\", \"table\", \"image\", \"file\", \"embed\", \"backlinks\", \"rollup\"]);\n\nexport function isSortableField(field: CollectionFieldSpec): boolean {\n return !NON_SORTABLE.has(field.type);\n}\n\n/** Cycle one column's state: none → asc → desc → none. */\nexport function nextSortDirection(current: SortDirection | null): SortDirection | null {\n if (current === null) return \"asc\";\n if (current === \"asc\") return \"desc\";\n return null;\n}\n\n// ── SortValue constructors (one per comparable kind) ────────────────\n\nexport function numericSortValue(raw: unknown): SortValue {\n if (raw == null || raw === \"\") return EMPTY;\n const num = typeof raw === \"number\" ? raw : Number(raw);\n return Number.isFinite(num) ? { empty: false, num } : EMPTY;\n}\n\nexport function stringSortValue(raw: unknown): SortValue {\n if (raw == null) return EMPTY;\n const str = String(raw);\n return str.trim() === \"\" ? EMPTY : { empty: false, str };\n}\n\nexport function dateSortValue(raw: unknown): SortValue {\n if (raw == null || raw === \"\") return EMPTY;\n const epoch = Date.parse(String(raw));\n // Unparseable dates fall back to a lexical compare rather than vanishing.\n return Number.isNaN(epoch) ? stringSortValue(raw) : { empty: false, num: epoch };\n}\n\n/** Enum sorts by the value's index in the declared `values` list. A value\n * outside the list (or unset) is treated as empty → last. */\nexport function enumSortValue(values: readonly string[] | undefined, raw: unknown): SortValue {\n if (raw == null || raw === \"\") return EMPTY;\n const idx = values ? values.indexOf(String(raw)) : -1;\n return idx < 0 ? EMPTY : { empty: false, num: idx };\n}\n\n/** Boolean / toggle: false < true, never empty (unset reads as false). */\nexport function boolSortValue(checked: boolean): SortValue {\n return { empty: false, num: checked ? 1 : 0 };\n}\n\n// ── Comparator + driver ─────────────────────────────────────────────\n\nexport function compareSortValues(left: SortValue, right: SortValue): number {\n if (left.num !== undefined && right.num !== undefined) return left.num - right.num;\n const leftStr = left.str ?? String(left.num ?? \"\");\n const rightStr = right.str ?? String(right.num ?? \"\");\n return leftStr.localeCompare(rightStr);\n}\n\n/** Stable sort of `items` by `valueOf`. Empties always last; ties hold\n * source order. Returns a new array (does not mutate `items`). */\nexport function sortItems(items: readonly CollectionItem[], direction: SortDirection, valueOf: (item: CollectionItem) => SortValue): CollectionItem[] {\n const dir = direction === \"asc\" ? 1 : -1;\n return items\n .map((item, index) => ({ item, index, sv: valueOf(item) }))\n .sort((left, right) => {\n if (left.sv.empty || right.sv.empty) {\n if (left.sv.empty && right.sv.empty) return left.index - right.index;\n return left.sv.empty ? 1 : -1;\n }\n const base = compareSortValues(left.sv, right.sv);\n return base !== 0 ? base * dir : left.index - right.index;\n })\n .map((decorated) => decorated.item);\n}\n","// Shared chip/label resolution for the collection calendar surfaces (month\n// grid + day view), so both label a record identically. Pure, type-only\n// dependency on the schema shape.\n\nimport type { CollectionItem, CollectionSchema } from \"./schema\";\n\n// Text-like field types that make a sensible human-readable label.\nconst LABEL_FIELD_TYPES = new Set([\"string\", \"text\", \"markdown\", \"email\"]);\n\n/** Which field labels a record: the schema's explicit `displayField`, else the\n * first non-primary text-like field (so a collection without a displayField\n * shows e.g. the title rather than the opaque primaryKey), else null → the\n * caller falls back to the primary-key value. */\nexport function labelFieldFor(schema: CollectionSchema): string | null {\n if (schema.displayField) return schema.displayField;\n for (const [key, spec] of Object.entries(schema.fields)) {\n if (key !== schema.primaryKey && LABEL_FIELD_TYPES.has(spec.type)) return key;\n }\n return null;\n}\n\n/** A record's primary-key value as a string. */\nexport function itemIdOf(item: CollectionItem, schema: CollectionSchema): string {\n return String(item[schema.primaryKey] ?? \"\");\n}\n\n/** A record's display label: the resolved `labelField` value, else the\n * primary key. Pass the result of `labelFieldFor(schema)` as `labelField`\n * (compute it once per render rather than per item). */\nexport function itemLabelOf(item: CollectionItem, schema: CollectionSchema, labelField: string | null): string {\n if (labelField) {\n const value = item[labelField];\n // Accept any primitive (string / number / boolean) so a numeric or boolean\n // display field still labels the record; objects/arrays fall through to the\n // id rather than rendering as \"[object Object]\".\n if (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") {\n const text = String(value);\n if (text.length > 0) return text;\n }\n }\n return itemIdOf(item, schema);\n}\n","/**\n * 8-char hex id — short, slug-safe, and editable. Produces the same id *shape*\n * as the server's `generateItemId()` (8 hex chars) so a UI-created collection\n * record looks like one the server would have generated for a form submitted\n * with a blank primary key. The source of randomness differs (UUID-derived here\n * vs `randomBytes` on the server); only the shape is intentionally shared.\n */\nexport function shortHexId(): string {\n return crypto.randomUUID().replace(/-/g, \"\").slice(0, 8);\n}\n"],"mappings":";;;;AAUA,IAAa,YAAY;AAazB,IAAa,kBAAkC;CAC7C,MAAM;CACN,MAAM;CACN,aACE;CACF,YAAY;EACV,MAAM;EACN,YAAY;GACV,gBAAgB;IACd,MAAM;IACN,aAAa;GACf;GACA,QAAQ;IACN,MAAM;IACN,aAAa;GACf;EACF;EACA,UAAU,CAAC,gBAAgB;CAC7B;CACA,QAAQ,0DAA0D,UAAU;AAC9E;AAEA,IAAa,2BAA2B,OACtC,UACA,SACsE;CACtE,MAAM,iBAAiB,OAAO,MAAM,mBAAmB,WAAW,KAAK,eAAe,KAAK,IAAI;CAC/F,IAAI,CAAC,gBACH,OAAO;EACL,SAAS;EACT,cAAc;CAChB;CAEF,MAAM,SAAS,OAAO,KAAK,WAAW,YAAY,KAAK,OAAO,KAAK,CAAC,CAAC,SAAS,IAAI,KAAK,OAAO,KAAK,IAAI,KAAA;CACvG,MAAM,OAA8B,SAAS;EAAE;EAAgB;CAAO,IAAI,EAAE,eAAe;CAE3F,OAAO;EACL,SAAS,wBAFI,SAAS,GAAG,eAAe,KAAK,WAAW;EAKxD;EACA,UAAU;EAMV,cACE;CACJ;AACF;;;ACtCA,IAA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O,cAAc,OAAO,OAAO;CACvC,KAAK,MAAM,CAAC,KAAK,SAAS,OAAO,QAAQ,OAAO,MAAM,GACpD,IAAI,QAAQ,OAAO,cAAc,kBAAkB,IAAI,KAAK,IAAI,GAAG,OAAO;CAE5E,OAAO;AACT;;AAGA,SAAgB,SAAS,MAAsB,QAAkC;CAC/E,OAAO,OAAO,KAAK,OAAO,eAAe,EAAE;AAC7C;;;;AAKA,SAAgB,YAAY,MAAsB,QAA0B,YAAmC;CAC7G,IAAI,YAAY;EACd,MAAM,QAAQ,KAAK;EAInB,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW;GACxF,MAAM,OAAO,OAAO,KAAK;GACzB,IAAI,KAAK,SAAS,GAAG,OAAO;EAC9B;CACF;CACA,OAAO,SAAS,MAAM,MAAM;AAC9B;;;;;;;;;;AClCA,SAAgB,aAAqB;CACnC,OAAO,OAAO,WAAW,CAAC,CAAC,QAAQ,MAAM,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;AACzD"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/collection/core/presentCollection.ts","../../src/collection/core/enumColors.ts","../../src/collection/core/draft.ts","../../src/collection/core/sortItems.ts","../../src/collection/core/itemLabel.ts","../../src/collection/core/shortHexId.ts"],"sourcesContent":["// presentCollection tool — definition + pure server-side executor.\n//\n// Isomorphic (no Vue, no Node): bundled to the browser as the plugin's\n// `execute`, and run server-side via the host's plugin dispatch route. The\n// executor only validates + echoes the addressing; the live schema + items\n// are fetched client-side by the View through the host's /api/collections\n// routes, so a bad slug surfaces as the View's \"not found\" state.\n\nimport type { ToolContext, ToolDefinition, ToolResult } from \"gui-chat-protocol\";\n\nexport const TOOL_NAME = \"presentCollection\";\n\n/** Render payload carried in the tool result's `data` field; the View mounts\n * off these. Same shape as the tool args. */\nexport interface PresentCollectionData {\n /** Slug of the collection to display (e.g. \"clients\", \"invoices\"). */\n collectionSlug: string;\n /** Optional primary-key value of a single item to open on mount. */\n itemId?: string;\n}\n\nexport type PresentCollectionArgs = PresentCollectionData;\n\nexport const TOOL_DEFINITION: ToolDefinition = {\n type: \"function\",\n name: TOOL_NAME,\n description:\n \"Display a schema-driven collection inline in the chat as an interactive, editable card. Shows the collection's list of records. Pass `itemId` to open one specific record on mount.\",\n parameters: {\n type: \"object\",\n properties: {\n collectionSlug: {\n type: \"string\",\n description: \"The slug of the collection to display (e.g. 'clients', 'invoices', 'contacts').\",\n },\n itemId: {\n type: \"string\",\n description: \"Optional primary-key value of a single record to open in detail view on mount. Omit to show the full list.\",\n },\n },\n required: [\"collectionSlug\"],\n },\n prompt: `After making changes to schema-driven collections, use ${TOOL_NAME} to present either the collection or the item`,\n};\n\nexport const executePresentCollection = async (\n _context: ToolContext,\n args: PresentCollectionArgs,\n): Promise<ToolResult<PresentCollectionData, PresentCollectionData>> => {\n const collectionSlug = typeof args?.collectionSlug === \"string\" ? args.collectionSlug.trim() : \"\";\n if (!collectionSlug) {\n return {\n message: \"presentCollection error: collectionSlug is required\",\n instructions: \"Tell the user you couldn't display the collection because no collection was specified, and ask which collection they mean.\",\n };\n }\n const itemId = typeof args.itemId === \"string\" && args.itemId.trim().length > 0 ? args.itemId.trim() : undefined;\n const data: PresentCollectionData = itemId ? { collectionSlug, itemId } : { collectionSlug };\n const target = itemId ? `${collectionSlug} / ${itemId}` : collectionSlug;\n return {\n message: `Presented collection ${target}`,\n // `data` is the view's source (also the host's render-eligibility signal);\n // `jsonData` is what the LLM sees. Same payload, two audiences.\n data,\n jsonData: data,\n // Phrased to stay correct for BOTH storage kinds without loading the\n // schema (this executor is deliberately pure/isomorphic): a writable\n // collection offers edit/create/delete in the card; a read-only\n // `dataSource` collection hides those and changes flow through its\n // data file instead.\n instructions:\n \"The collection has been presented to the user as an interactive card. They can browse and open records directly; on a writable collection they can also edit, create, and delete (a read-only dataSource collection shows no edit controls — its records change by editing the backing data file). No further action is needed unless they ask.\",\n };\n};\n","// A standard, ordered colour palette for `enum` field values, shared by every\n// collection surface (list, calendar, kanban). Each value in an\n// enum's `values` array is assigned the palette entry at its index — cycling\n// when an enum declares more values than the palette holds — so colouring is\n// automatic and consistent without any per-value schema config.\n//\n// Tailwind only detects class names that appear as complete string literals,\n// so every surface's classes are spelled out per colour below rather than\n// built from a colour name at runtime.\n//\n// One enum is special: the field a schema's `notifyWhen` targets (the\n// \"notification enum\"). Its flagged values read the notification severity\n// colours — the first flagged value (most urgent) red, the rest amber — and\n// every other value reads neutral grey, mirroring the notification bell\n// (red = urgent, amber = nudge) rather than the rotating palette.\n// `resolveEnumColor` encapsulates that rule.\n\nimport type { CollectionSchema } from \"./schema\";\n\nexport interface EnumColorClasses {\n /** Stat-card style: border + fill + text + hover. */\n card: string;\n /** Small status dot (kanban column header). */\n dot: string;\n /** Pill / badge / inline `<select>` fill + text (no border width). */\n badge: string;\n /** Border colour, paired with a `border` width class by the caller. */\n border: string;\n}\n\n// The palette deliberately EXCLUDES the warm warning band (red / orange /\n// amber): those are reserved for the notification-enum severity colours\n// (`ENUM_ALERT` red, `ENUM_NUDGE` amber), so a normal enum value can never\n// draw a colour that reads like a notification. Eight well-separated cool /\n// green / magenta hues keep enough variety for wide enums.\nconst PALETTE: readonly EnumColorClasses[] = [\n {\n card: \"border-indigo-200 bg-indigo-50 text-indigo-600 hover:bg-indigo-100\",\n dot: \"bg-indigo-500\",\n badge: \"bg-indigo-100 text-indigo-700\",\n border: \"border-indigo-200\",\n },\n { card: \"border-sky-200 bg-sky-50 text-sky-600 hover:bg-sky-100\", dot: \"bg-sky-500\", badge: \"bg-sky-100 text-sky-700\", border: \"border-sky-200\" },\n { card: \"border-cyan-200 bg-cyan-50 text-cyan-600 hover:bg-cyan-100\", dot: \"bg-cyan-500\", badge: \"bg-cyan-100 text-cyan-700\", border: \"border-cyan-200\" },\n { card: \"border-teal-200 bg-teal-50 text-teal-600 hover:bg-teal-100\", dot: \"bg-teal-500\", badge: \"bg-teal-100 text-teal-700\", border: \"border-teal-200\" },\n {\n card: \"border-emerald-200 bg-emerald-50 text-emerald-600 hover:bg-emerald-100\",\n dot: \"bg-emerald-500\",\n badge: \"bg-emerald-100 text-emerald-700\",\n border: \"border-emerald-200\",\n },\n { card: \"border-lime-200 bg-lime-50 text-lime-600 hover:bg-lime-100\", dot: \"bg-lime-500\", badge: \"bg-lime-100 text-lime-700\", border: \"border-lime-200\" },\n {\n card: \"border-violet-200 bg-violet-50 text-violet-600 hover:bg-violet-100\",\n dot: \"bg-violet-500\",\n badge: \"bg-violet-100 text-violet-700\",\n border: \"border-violet-200\",\n },\n {\n card: \"border-fuchsia-200 bg-fuchsia-50 text-fuchsia-600 hover:bg-fuchsia-100\",\n dot: \"bg-fuchsia-500\",\n badge: \"bg-fuchsia-100 text-fuchsia-700\",\n border: \"border-fuchsia-200\",\n },\n];\n\n/** Neutral styling for the empty / Uncategorized bucket — never a palette\n * colour, so an unset or unknown value reads grey across every surface. */\nexport const ENUM_NEUTRAL: EnumColorClasses = {\n card: \"border-slate-200 bg-slate-50 text-slate-500 hover:bg-slate-100\",\n dot: \"bg-slate-300\",\n badge: \"bg-slate-100 text-slate-500\",\n border: \"border-slate-200\",\n};\n\n/** The urgent notification colour (red), matching the bell's `urgent`\n * severity. The first value a schema's `notifyWhen` flags reads this. */\nexport const ENUM_ALERT: EnumColorClasses = {\n card: \"border-red-200 bg-red-50 text-red-600 hover:bg-red-100\",\n dot: \"bg-red-500\",\n badge: \"bg-red-100 text-red-700\",\n border: \"border-red-200\",\n};\n\n/** The nudge notification colour (amber), matching the bell's `nudge`\n * severity. Flagged `notifyWhen` values after the first read this. */\nexport const ENUM_NUDGE: EnumColorClasses = {\n card: \"border-amber-200 bg-amber-50 text-amber-600 hover:bg-amber-100\",\n dot: \"bg-amber-500\",\n badge: \"bg-amber-100 text-amber-700\",\n border: \"border-amber-200\",\n};\n\n/** Classes for the enum value at `index` in its field's `values` array. A\n * negative index (value unset or not among the declared values) reads\n * neutral. */\nexport function enumColorClasses(index: number): EnumColorClasses {\n if (index < 0) return ENUM_NEUTRAL;\n return PALETTE[index % PALETTE.length] ?? ENUM_NEUTRAL;\n}\n\n/** Index of `value` within an enum field's declared `values`, or -1 when the\n * value is empty / unknown (→ neutral). */\nexport function enumValueIndex(values: readonly string[] | undefined, value: unknown): number {\n if (value === undefined || value === null || value === \"\") return -1;\n return values?.indexOf(String(value)) ?? -1;\n}\n\n/** The flagged values when `fieldKey` is the schema's `notifyWhen` target (the\n * \"notification enum\"); undefined for every other field. */\nfunction notifyValuesFor(schema: CollectionSchema, fieldKey: string): readonly string[] | undefined {\n const spec = schema.notifyWhen;\n return spec && spec.field === fieldKey ? spec.in : undefined;\n}\n\n/** Resolve a value's colour for enum field `fieldKey`:\n * - Notification enum (`notifyWhen` targets it): the first flagged value (in\n * `notifyWhen.in` order, the most urgent) reads notification red, the rest\n * amber, and every non-flagged value neutral grey.\n * - Any other enum: the standard palette by the value's declared index. */\nexport function resolveEnumColor(schema: CollectionSchema, fieldKey: string, value: unknown): EnumColorClasses {\n const notifyValues = notifyValuesFor(schema, fieldKey);\n if (notifyValues) {\n const str = value === undefined || value === null ? \"\" : String(value);\n const rank = notifyValues.indexOf(str);\n if (rank < 0) return ENUM_NEUTRAL;\n return rank === 0 ? ENUM_ALERT : ENUM_NUDGE;\n }\n const spec = schema.fields[fieldKey];\n return enumColorClasses(enumValueIndex(spec?.type === \"enum\" ? spec.values : undefined, value));\n}\n","// Pure edit-draft logic for the collection record form, extracted from\n// CollectionView.vue so the parent (build draft / save / validate) and\n// the extracted CollectionRecordPanel (per-row table mutators) share one\n// implementation. No Vue, no I/O — every function maps a draft + schema\n// to a value, so the omission/validation semantics are unit-testable.\n\nimport { fieldVisible } from \"./actionVisible\";\nimport { COMPUTED_TYPES } from \"./schema\";\nimport type { CollectionFieldSpec as FieldSpec, CollectionFieldType as FieldType, CollectionItem, CollectionSchema } from \"./schema\";\nimport type { EditState, TableRowDraft } from \"./uiTypes\";\n\n/** A fresh, empty row draft for a `table` field's sub-schema. */\nexport function emptyRow(subFields: Record<string, FieldSpec>): TableRowDraft {\n const text: Record<string, string> = {};\n const bool: Record<string, boolean> = {};\n const boolOriginallyPresent: Record<string, boolean> = {};\n const boolTouched: Record<string, boolean> = {};\n for (const [subKey, subField] of Object.entries(subFields)) {\n if (subField.type === \"boolean\") {\n bool[subKey] = false;\n boolOriginallyPresent[subKey] = false; // brand-new row\n boolTouched[subKey] = false;\n } else {\n text[subKey] = \"\";\n }\n }\n return { text, bool, boolOriginallyPresent, boolTouched };\n}\n\n/** Build a row draft from an existing persisted row. */\nexport function rowFromItem(item: Record<string, unknown>, subFields: Record<string, FieldSpec>): TableRowDraft {\n const text: Record<string, string> = {};\n const bool: Record<string, boolean> = {};\n const boolOriginallyPresent: Record<string, boolean> = {};\n const boolTouched: Record<string, boolean> = {};\n for (const [subKey, subField] of Object.entries(subFields)) {\n const raw = item[subKey];\n if (subField.type === \"boolean\") {\n bool[subKey] = raw === true;\n // `typeof raw === \"boolean\"` so an existing explicit `false` is\n // recorded as present and round-trips on a no-op save.\n boolOriginallyPresent[subKey] = typeof raw === \"boolean\";\n boolTouched[subKey] = false;\n } else {\n text[subKey] = raw === undefined || raw === null ? \"\" : String(raw);\n }\n }\n return { text, bool, boolOriginallyPresent, boolTouched };\n}\n\n/** Decide whether a boolean field's draft value should be emitted (vs.\n * omitted so a downstream default applies). */\nfunction shouldEmitBoolean(state: EditState, key: string, field: FieldSpec): boolean {\n return Boolean(state.boolOriginallyPresent[key] || state.boolTouched[key] || field.required);\n}\n\n/** Convert a scalar draft slot to its persisted form. `undefined` = omit. */\nfunction scalarDraftToValue(raw: string | undefined, fieldType: FieldType): unknown {\n if (raw === undefined || raw === \"\") return undefined;\n if (fieldType === \"number\" || fieldType === \"money\") {\n const num = Number(raw);\n return Number.isFinite(num) ? num : raw;\n }\n return raw;\n}\n\n/** Convert one table row draft to its persisted record. */\nfunction rowDraftToRecord(rowDraft: TableRowDraft, subFields: Record<string, FieldSpec>): Record<string, unknown> {\n const row: Record<string, unknown> = {};\n for (const [subKey, subField] of Object.entries(subFields)) {\n if (subField.type === \"boolean\") {\n const value = rowDraft.bool[subKey] === true;\n if (rowDraft.boolOriginallyPresent[subKey] || rowDraft.boolTouched[subKey] || value || subField.required) row[subKey] = value;\n continue;\n }\n const value = scalarDraftToValue(rowDraft.text[subKey], subField.type);\n if (value !== undefined) row[subKey] = value;\n }\n return row;\n}\n\n/** Convert a full edit draft to the record to persist. */\nexport function draftToRecord(state: EditState, schema: CollectionSchema): CollectionItem {\n const record: CollectionItem = {};\n for (const [key, field] of Object.entries(schema.fields)) {\n if (COMPUTED_TYPES.has(field.type)) continue; // never persisted (toggle projects an enum field)\n if (field.type === \"boolean\") {\n if (shouldEmitBoolean(state, key, field)) record[key] = state.bool[key] === true;\n continue;\n }\n if (field.type === \"table\" && field.of) {\n const subFields = field.of;\n record[key] = (state.table[key] ?? []).map((rowDraft) => rowDraftToRecord(rowDraft, subFields));\n continue;\n }\n const value = scalarDraftToValue(state.text[key], field.type);\n if (value !== undefined) record[key] = value;\n }\n return record;\n}\n\n/** Normalise a raw inline-edit input (table-cell checkbox/select) to its\n * persisted form. Mirrors `draftToRecord`'s boolean strictness; an empty\n * enum selection (the placeholder option) clears the field via `undefined`. */\nexport function coerceInlineValue(field: FieldSpec, raw: boolean | string): unknown {\n if (field.type === \"boolean\") return raw === true;\n return raw === \"\" ? undefined : raw;\n}\n\n/** Build the full record to PUT for a single-cell inline edit, without\n * mutating `item`. A `undefined` value omits the key (enum cleared),\n * matching `draftToRecord`'s omission semantics. */\nexport function buildUpdatedRecord(item: CollectionItem, key: string, value: unknown): CollectionItem {\n if (value === undefined) {\n const { [key]: __omit, ...rest } = item;\n return rest;\n }\n return { ...item, [key]: value };\n}\n\n/** Empty for required-field validation — NOT a truthiness check (a\n * numeric `0` is a filled value). */\nfunction isMissingDraftValue(value: unknown): boolean {\n return value === undefined || value === null || value === \"\";\n}\n\n/** Label of the first required table sub-field empty in any row, else null. */\nfunction firstMissingTableSubField(field: FieldSpec, rows: TableRowDraft[] | undefined): string | null {\n if (field.type !== \"table\" || !rows) return null;\n for (let rowIdx = 0; rowIdx < rows.length; rowIdx++) {\n const row = rows[rowIdx];\n for (const [subKey, subField] of Object.entries(field.of)) {\n if (!subField.required || subField.type === \"boolean\") continue;\n if (isMissingDraftValue(row.text[subKey])) return `${field.label} #${rowIdx + 1}: ${subField.label}`;\n }\n }\n return null;\n}\n\n/** Field types the required check never flags: booleans always hold a\n * value, and the computed/projected kinds (COMPUTED_TYPES — the shared\n * set, so a future computed type can't drift past this check) have no\n * draft input at all. */\nconst NEVER_MISSING_TYPES: ReadonlySet<FieldType> = new Set<FieldType>([\"boolean\", ...COMPUTED_TYPES]);\n\nfunction validateOneField(key: string, field: FieldSpec, draft: EditState, record: CollectionItem): string | null {\n // A `when`-hidden field has no input the user can fill — never missing.\n if (!fieldVisible(field, record)) return null;\n if (field.type === \"table\" && field.of) {\n const rows = draft.table[key];\n if (field.required && (!rows || rows.length === 0)) return field.label;\n return firstMissingTableSubField(field, rows);\n }\n if (!field.required) return null;\n if (draft.mode === \"create\" && field.primary === true) return null; // server auto-generates id\n if (NEVER_MISSING_TYPES.has(field.type)) return null;\n return isMissingDraftValue(draft.text[key]) ? field.label : null;\n}\n\n/** Human-readable label of the first missing required field, or null. */\nexport function firstMissingRequiredField(draft: EditState, schema: CollectionSchema): string | null {\n const record = draftToRecord(draft, schema);\n for (const [key, field] of Object.entries(schema.fields)) {\n const missing = validateOneField(key, field, draft, record);\n if (missing) return missing;\n }\n return null;\n}\n","// Sorting for the collection list table. The header sort toggle (next to\n// each field title) cycles a single active column through none → asc →\n// desc → none; this module turns that state plus a per-field value\n// extractor into an ordered copy of the rows.\n//\n// Two invariants the comparator guarantees:\n// 1. Rows with an empty/missing value for the sorted field always sink\n// to the bottom, regardless of direction.\n// 2. Ties (and the empty group) keep their original order — the sort is\n// stable via the captured source index.\n//\n// Field-type → comparable mapping (see `isSortableField`):\n// string/text/email → string · number/money → numeric ·\n// date/datetime → epoch-ms · enum → declared-index · boolean/toggle/flag →\n// false<true · ref → display label · derived → its display type.\n// markdown/table/image/file/embed get no sort button.\n\nimport type { CollectionItem, CollectionFieldSpec, CollectionFieldType } from \"./schema\";\n\nexport type SortDirection = \"asc\" | \"desc\";\n\nexport interface SortState {\n /** Field key of the single active sort column. */\n field: string;\n direction: SortDirection;\n}\n\n/** A row's comparable value for the active field. Exactly one of `num` /\n * `str` is set when not empty; `empty` rows always sort last. */\nexport interface SortValue {\n empty: boolean;\n num?: number;\n str?: string;\n}\n\nconst EMPTY: SortValue = { empty: true };\n\n/** Field types that render no value text in the table, so offer no sort. */\nconst NON_SORTABLE: ReadonlySet<CollectionFieldType> = new Set<CollectionFieldType>([\"markdown\", \"table\", \"image\", \"file\", \"embed\", \"backlinks\", \"rollup\"]);\n\nexport function isSortableField(field: CollectionFieldSpec): boolean {\n return !NON_SORTABLE.has(field.type);\n}\n\n/** Cycle one column's state: none → asc → desc → none. */\nexport function nextSortDirection(current: SortDirection | null): SortDirection | null {\n if (current === null) return \"asc\";\n if (current === \"asc\") return \"desc\";\n return null;\n}\n\n// ── SortValue constructors (one per comparable kind) ────────────────\n\nexport function numericSortValue(raw: unknown): SortValue {\n if (raw == null || raw === \"\") return EMPTY;\n const num = typeof raw === \"number\" ? raw : Number(raw);\n return Number.isFinite(num) ? { empty: false, num } : EMPTY;\n}\n\nexport function stringSortValue(raw: unknown): SortValue {\n if (raw == null) return EMPTY;\n const str = String(raw);\n return str.trim() === \"\" ? EMPTY : { empty: false, str };\n}\n\nexport function dateSortValue(raw: unknown): SortValue {\n if (raw == null || raw === \"\") return EMPTY;\n const epoch = Date.parse(String(raw));\n // Unparseable dates fall back to a lexical compare rather than vanishing.\n return Number.isNaN(epoch) ? stringSortValue(raw) : { empty: false, num: epoch };\n}\n\n/** Enum sorts by the value's index in the declared `values` list. A value\n * outside the list (or unset) is treated as empty → last. */\nexport function enumSortValue(values: readonly string[] | undefined, raw: unknown): SortValue {\n if (raw == null || raw === \"\") return EMPTY;\n const idx = values ? values.indexOf(String(raw)) : -1;\n return idx < 0 ? EMPTY : { empty: false, num: idx };\n}\n\n/** Boolean / toggle: false < true, never empty (unset reads as false). */\nexport function boolSortValue(checked: boolean): SortValue {\n return { empty: false, num: checked ? 1 : 0 };\n}\n\n// ── Comparator + driver ─────────────────────────────────────────────\n\nexport function compareSortValues(left: SortValue, right: SortValue): number {\n if (left.num !== undefined && right.num !== undefined) return left.num - right.num;\n const leftStr = left.str ?? String(left.num ?? \"\");\n const rightStr = right.str ?? String(right.num ?? \"\");\n return leftStr.localeCompare(rightStr);\n}\n\n/** Stable sort of `items` by `valueOf`. Empties always last; ties hold\n * source order. Returns a new array (does not mutate `items`). */\nexport function sortItems(items: readonly CollectionItem[], direction: SortDirection, valueOf: (item: CollectionItem) => SortValue): CollectionItem[] {\n const dir = direction === \"asc\" ? 1 : -1;\n return items\n .map((item, index) => ({ item, index, sv: valueOf(item) }))\n .sort((left, right) => {\n if (left.sv.empty || right.sv.empty) {\n if (left.sv.empty && right.sv.empty) return left.index - right.index;\n return left.sv.empty ? 1 : -1;\n }\n const base = compareSortValues(left.sv, right.sv);\n return base !== 0 ? base * dir : left.index - right.index;\n })\n .map((decorated) => decorated.item);\n}\n","// Shared chip/label resolution for the collection calendar surfaces (month\n// grid + day view), so both label a record identically. Pure, type-only\n// dependency on the schema shape.\n\nimport type { CollectionItem, CollectionSchema } from \"./schema\";\n\n// Text-like field types that make a sensible human-readable label.\nconst LABEL_FIELD_TYPES = new Set([\"string\", \"text\", \"markdown\", \"email\"]);\n\n/** Which field labels a record: the schema's explicit `displayField`, else the\n * first non-primary text-like field (so a collection without a displayField\n * shows e.g. the title rather than the opaque primaryKey), else null → the\n * caller falls back to the primary-key value. */\nexport function labelFieldFor(schema: CollectionSchema): string | null {\n if (schema.displayField) return schema.displayField;\n for (const [key, spec] of Object.entries(schema.fields)) {\n if (key !== schema.primaryKey && LABEL_FIELD_TYPES.has(spec.type)) return key;\n }\n return null;\n}\n\n/** A record's primary-key value as a string. */\nexport function itemIdOf(item: CollectionItem, schema: CollectionSchema): string {\n return String(item[schema.primaryKey] ?? \"\");\n}\n\n/** A record's display label: the resolved `labelField` value, else the\n * primary key. Pass the result of `labelFieldFor(schema)` as `labelField`\n * (compute it once per render rather than per item). */\nexport function itemLabelOf(item: CollectionItem, schema: CollectionSchema, labelField: string | null): string {\n if (labelField) {\n const value = item[labelField];\n // Accept any primitive (string / number / boolean) so a numeric or boolean\n // display field still labels the record; objects/arrays fall through to the\n // id rather than rendering as \"[object Object]\".\n if (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") {\n const text = String(value);\n if (text.length > 0) return text;\n }\n }\n return itemIdOf(item, schema);\n}\n","/**\n * 8-char hex id — short, slug-safe, and editable. Produces the same id *shape*\n * as the server's `generateItemId()` (8 hex chars) so a UI-created collection\n * record looks like one the server would have generated for a form submitted\n * with a blank primary key. The source of randomness differs (UUID-derived here\n * vs `randomBytes` on the server); only the shape is intentionally shared.\n */\nexport function shortHexId(): string {\n return crypto.randomUUID().replace(/-/g, \"\").slice(0, 8);\n}\n"],"mappings":";;;;;;AAUA,IAAa,YAAY;AAazB,IAAa,kBAAkC;CAC7C,MAAM;CACN,MAAM;CACN,aACE;CACF,YAAY;EACV,MAAM;EACN,YAAY;GACV,gBAAgB;IACd,MAAM;IACN,aAAa;GACf;GACA,QAAQ;IACN,MAAM;IACN,aAAa;GACf;EACF;EACA,UAAU,CAAC,gBAAgB;CAC7B;CACA,QAAQ,0DAA0D,UAAU;AAC9E;AAEA,IAAa,2BAA2B,OACtC,UACA,SACsE;CACtE,MAAM,iBAAiB,OAAO,MAAM,mBAAmB,WAAW,KAAK,eAAe,KAAK,IAAI;CAC/F,IAAI,CAAC,gBACH,OAAO;EACL,SAAS;EACT,cAAc;CAChB;CAEF,MAAM,SAAS,OAAO,KAAK,WAAW,YAAY,KAAK,OAAO,KAAK,CAAC,CAAC,SAAS,IA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I,OAAO,MAAM,KAAK,QAAQ,MAAM;CACtD,CAAC,CAAC,CACD,KAAK,cAAc,UAAU,IAAI;AACtC;;;ACtGA,IAAM,oCAAoB,IAAI,IAAI;CAAC;CAAU;CAAQ;CAAY;AAAO,CAAC;;;;;AAMzE,SAAgB,cAAc,QAAyC;CACrE,IAAI,OAAO,cAAc,OAAO,OAAO;CACvC,KAAK,MAAM,CAAC,KAAK,SAAS,OAAO,QAAQ,OAAO,MAAM,GACpD,IAAI,QAAQ,OAAO,cAAc,kBAAkB,IAAI,KAAK,IAAI,GAAG,OAAO;CAE5E,OAAO;AACT;;AAGA,SAAgB,SAAS,MAAsB,QAAkC;CAC/E,OAAO,OAAO,KAAK,OAAO,eAAe,EAAE;AAC7C;;;;AAKA,SAAgB,YAAY,MAAsB,QAA0B,YAAmC;CAC7G,IAAI,YAAY;EACd,MAAM,QAAQ,KAAK;EAInB,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW;GACxF,MAAM,OAAO,OAAO,KAAK;GACzB,IAAI,KAAK,SAAS,GAAG,OAAO;EAC9B;CACF;CACA,OAAO,SAAS,MAAM,MAAM;AAC9B;;;;;;;;;;AClCA,SAAgB,aAAqB;CACnC,OAAO,OAAO,WAAW,CAAC,CAAC,QAAQ,MAAM,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;AACzD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './core/schema';
|
|
2
2
|
export type { CollectionQuery, CollectionQueryAggregate, CollectionQueryOrder, CollectionQueryWhere } from './core/queryZ';
|
|
3
3
|
export * from './core/ids';
|
|
4
|
+
export * from './core/project';
|
|
4
5
|
export * from './core/uiTypes';
|
|
5
6
|
export * from './core/presentCollection';
|
|
6
7
|
export * from './core/enumColors';
|