@skaile/forge-layer-data-browser 0.1.0 → 0.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @skaile/forge-layer-data-browser
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0454102: Paper look from forge-template-app: `/data` is now a tool (`appShell.tools`, reached through ⌘K and the user menu) instead of a sidebar entry, and a new ⌘K group "Data" lists every entity for owners. The entity overview is a calm list with quiet row counts and access words instead of cards and badges, entity tables drop the primary-key column, show booleans and enums without colour badges, put "New <entity>" in the header's primary action and show `ListEmpty` when there are no rows. Icons switch from Lucide to Tabler. Hosts need the matching forge-template-app core: `appShell.tools`, the `app-shell:extend` hook, `AppHeader`'s `count`/`primary` props, `ListEmpty`, the `calm-row` classes and the Tabler icon set (see the README's host contract).
8
+
3
9
  ## 0.1.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -33,10 +33,13 @@ has all of them; an app that renamed or removed one overrides the layer file tha
33
33
  | Kind | Used | Where in the template |
34
34
  |---|---|---|
35
35
  | Explicit imports | `~/utils/format` (`fromDateTimeInput`, `toDateTimeInput`), `~/utils/jsonSchema` (`labelOfKey`, `JsonSchema`) | `app/utils/` |
36
- | Composables | `useDataApi`, `useMe`, `useDates`, `useConfirm`, `useDiscardGuard`, `useFormDirty` | `app/composables/` |
36
+ | Composables | `useDataApi`, `useMe`, `useDates`, `useConfirm`, `useDiscardGuard`, `useFormDirty`; the `me` payload under the `useNuxtData` key `'me'` (as `useMe` stores it) | `app/composables/` |
37
37
  | Utils | `applyServerError`, `actionErrorMessage` | `app/utils/formErrors.ts`, `app/composables/useActions.ts` |
38
- | Components | `AppHeader`, `SchemaForm`, `FormDiscardPrompt`, `FormSaveHint` | `app/components/` |
39
- | App config | `appShell.nav` entries with `roles` (read by `useAppShell`) | `app/utils/appShell.ts` |
38
+ | Components | `AppHeader` with the `count`, `back`, `back-label` and `primary` (`{ label, icon, onClick }`) props, `ListEmpty` (`title`, `description`), `SchemaForm`, `FormDiscardPrompt`, `FormSaveHint` | `app/components/` |
39
+ | CSS | the calm-list row classes `calm-list`, `calm-row`, `calm-row-target` (`/data`'s entity list) | `app/assets/css/main.css` |
40
+ | Icons | the Tabler set (`i-tabler-*`, `@iconify-json/tabler`) | `package.json` |
41
+ | App config | `appShell.tools` entries with `roles` (read by `useAppShell`; ⌘K and the user menu) | `app/utils/appShell.ts`, `app/components/UserMenu.vue` |
42
+ | Shell hook | `app-shell:extend` with `shell.commands` (⌘K groups), called after `me` loaded | `app/layouts/default.vue`, `app/types/app-shell.d.ts` |
40
43
  | Modules | `@vueuse/nuxt` (auto-imports `refDebounced`, `watchDebounced`) | `nuxt.config.ts` `modules` |
41
44
  | Actions | `data.describe`, `data.list`, `data.get`, `data.aggregate`, `data.create`, `data.update`, `data.delete`, `me.get` | `server/utils/actions/` |
42
45
 
@@ -44,20 +47,34 @@ Peers: `nuxt ^4`, `@nuxt/ui ^4.11`, `vue ^3.5`, `@skaile/forge-data ^0.2.1` (typ
44
47
 
45
48
  ## Overrides
46
49
 
47
- A Nuxt layer is overridden file by file: a file at the same path in the app wins. Copy the one file you need to change
48
- (e.g. `app/components/DataValue.vue` to render a field type differently, or `app/app.config.ts` to move the nav entry)
49
- into the app and keep the rest from the package, so fixes in the other files still arrive with updates.
50
+ A Nuxt layer is overridden piece by piece; the app's piece wins, the rest keeps coming from the package, so fixes in
51
+ the other files still arrive with updates:
52
+
53
+ - a component: a file with the same name in the app's `app/components/` (e.g. `DataValue.vue` to render a field type differently)
54
+ - a page: a page at the same route in the app's `app/pages/`
55
+ - an auto-imported composable or util: an export with the same name in the app's `app/composables/` or `app/utils/`
56
+ (override the whole file: the app's file replaces every export of that name)
57
+ - `app/app.config.ts`: the app's own `app.config.ts` is merged over the layer's, so set only the keys you change.
58
+ Arrays such as `appShell.tools` are joined, the app's entries first, so an app entry with the same `to` shows next
59
+ to the layer's unless the app's `useAppShell` keeps one entry per route, e.g. for
60
+ `{ label: 'Daten', icon: 'i-tabler-database', to: '/data', order: 80, roles: ['owner'] }`
61
+
62
+ The layer has no server code: it reads and writes only through the host's `data.*` actions.
50
63
 
51
64
  ## What you get
52
65
 
53
- - `/data` (nav order 80, owners only): the entities with their description, row count (`data.aggregate`) and whether
54
- they are read-only or owner-only.
55
- - `/data/<entity>`: a table with one column per described field (computed ones included, hidden ones never described;
66
+ - `/data` (a tool: ⌘K "Tools" and the user menu, order 80, owners only): a calm list of the entities with their
67
+ description, row count (`data.aggregate`) and, as quiet words, whether they are read-only or owner-only; `ListEmpty`
68
+ when the app exposes none. The header counts the entities.
69
+ - ⌘K group "Data" (owners only, `app/plugins/data-browser.ts`): one entry per entity, `Data › <Entity>` →
70
+ `/data/<entity>`, filled once `data.describe` answers in the browser.
71
+ - `/data/<entity>`: a table with one column per described field except the primary key (shown in the row's slideover;
56
72
  foreign keys show the related row's label via `expand`), search over the entity's search fields, sort by clicking a
57
73
  sortable column (asc, desc, default), pages of 25 with the total, and a filter builder: rows of field (own fields and
58
- one-level relation paths such as `project.name`), operator (by field type; datetimes get ranges, not equality) and
74
+ one-level relation paths such as `folder.name`), operator (by field type; datetimes get ranges, not equality) and
59
75
  value, ANDed into `where`. "Is any of" on a foreign key picks rows of the target; on numbers it keeps only the tags
60
- that are numbers.
76
+ that are numbers. Booleans show as a check or a dash, enums as plain text; without rows the table shows `ListEmpty`
77
+ ("No rows match" under a search or filter, else "No <entity> rows yet"). "New <entity>" is the header's primary action.
61
78
  - A slideover per row and "New <entity>": the core's `SchemaForm` with a schema built from the field descriptors
62
79
  (`rowSchemaOf`). Foreign keys pick a row of the target by its `labelField` (searchable once there are more than 10),
63
80
  datetimes are entered and shown on the app's clock (`app.timezone`, `useDates().timeZone`) and sent as ISO, nullable
@@ -68,8 +85,9 @@ into the app and keep the rest from the package, so fixes in the other files sti
68
85
 
69
86
  ## Owners only
70
87
 
71
- - UI: the nav entry carries `roles: ['owner']` (`useAppShell` hides it from everyone else) and both pages use the
72
- `owner-only` route middleware, which sends non-owners to the dashboard (`me.get` › `principal.roles`).
88
+ - UI: the tool entry carries `roles: ['owner']` (`useAppShell` hides it from everyone else), the ⌘K group is added only
89
+ for owners, and both pages use the `owner-only` route middleware, which sends non-owners to the dashboard (`me.get` ›
90
+ `principal.roles`).
73
91
  - Server: the browser is a UI convenience, a client like any other. Members reach the same rows of every entity the app
74
92
  exposes through `data.*` (HTTP, CLI, MCP, the curated pages); hiding `/data` from them restricts nothing. An entity
75
93
  meant for owners only says so in its `defineEntity`: `ops: { ownerOnly: true }`; forge-data's service then answers 403
@@ -84,10 +102,10 @@ into the app and keep the rest from the package, so fixes in the other files sti
84
102
  | The shared model (`data.describe`); rows via the core's `useDataApi()` | `app/composables/useDataBrowser.ts` |
85
103
  | Operators per type, filter rows → `where`, form schema, changed values | `app/utils/dataBrowser.ts` |
86
104
  | Route guard | `app/middleware/owner-only.ts` |
105
+ | ⌘K group "Data" | `app/plugins/data-browser.ts` |
87
106
 
88
107
  ## Tests
89
108
 
90
- The logic needs the host's model, so its tests run in the template against the installed package: today in
91
- `templates/app/layers/data-browser/test/`, moving to `templates/app/test/app/data-browser.test.ts` when the template
92
- switches to this package. `bun scripts/check-templates.ts --local app` checks an unpublished change of this
109
+ The logic needs the host's model, so its tests live in the template (`templates/app/test/app/data-browser.test.ts`) and run
110
+ against the installed package. `bun scripts/check-templates.ts --local app` checks an unpublished change of this
93
111
  package against the template.
package/app/app.config.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export default defineAppConfig({
2
2
  appShell: {
3
- nav: [{ label: 'Data', icon: 'i-lucide-database', to: '/data', order: 80, roles: ['owner'] }],
3
+ // A tool, not a nav entry: reached through ⌘K and the user menu (forge-template-app's APP-DESIGN.md SHELL-2).
4
+ tools: [{ label: 'Data', icon: 'i-tabler-database', to: '/data', order: 80, roles: ['owner'] }],
4
5
  },
5
6
  })
@@ -178,7 +178,7 @@ watchDebounced(
178
178
  />
179
179
  </template>
180
180
  <UButton
181
- icon="i-lucide-x"
181
+ icon="i-tabler-x"
182
182
  color="neutral"
183
183
  variant="ghost"
184
184
  aria-label="Remove condition"
@@ -186,7 +186,7 @@ watchDebounced(
186
186
  />
187
187
  </div>
188
188
  <UButton
189
- icon="i-lucide-plus"
189
+ icon="i-tabler-plus"
190
190
  label="Add condition"
191
191
  color="neutral"
192
192
  variant="soft"
@@ -148,7 +148,7 @@ async function remove() {
148
148
  <UButton
149
149
  v-if="row && entity.ops.delete"
150
150
  label="Delete"
151
- icon="i-lucide-trash-2"
151
+ icon="i-tabler-trash"
152
152
  color="error"
153
153
  variant="ghost"
154
154
  :loading="deleting"
@@ -27,15 +27,14 @@ const text = computed(() => {
27
27
  >—</span>
28
28
  <UIcon
29
29
  v-else-if="field.type === 'boolean'"
30
- :name="value ? 'i-lucide-check' : 'i-lucide-minus'"
31
- :class="value ? 'size-4 text-success' : 'size-4 text-dimmed'"
30
+ :name="value ? 'i-tabler-check' : 'i-tabler-minus'"
31
+ :class="value ? 'size-4 text-default' : 'size-4 text-dimmed'"
32
+ :aria-label="value ? 'Yes' : 'No'"
32
33
  />
33
- <UBadge
34
+ <span
34
35
  v-else-if="field.enum"
35
- color="neutral"
36
- variant="subtle"
37
- :label="text"
38
- />
36
+ class="text-default"
37
+ >{{ text }}</span>
39
38
  <code
40
39
  v-else-if="field.type === 'json'"
41
40
  class="block max-w-xs truncate text-xs"
@@ -63,31 +63,35 @@ function headerOf(field: FieldDescriptor, label: string) {
63
63
  class: '-mx-2.5',
64
64
  trailingIcon:
65
65
  order === 'asc'
66
- ? 'i-lucide-arrow-up-narrow-wide'
66
+ ? 'i-tabler-sort-ascending'
67
67
  : order === 'desc'
68
- ? 'i-lucide-arrow-down-wide-narrow'
69
- : 'i-lucide-arrow-up-down',
68
+ ? 'i-tabler-sort-descending'
69
+ : 'i-tabler-arrows-sort',
70
70
  'aria-label': `Sort by ${label}`,
71
71
  onClick: () => toggleSort(field.key),
72
72
  })
73
73
  }
74
74
 
75
+ // A generated id says nothing in a list: primary keys stay in the row's slideover, not as the
76
+ // leading column.
75
77
  const columns = computed<TableColumn<Row>[]>(() =>
76
- entity.fields.map(field => {
77
- const relation = relationOfField(entity, field.key)
78
- const label = relation ? relationLabelOf(entity, relation) : field.label
79
- return {
80
- id: field.key,
81
- accessorFn: row => row[field.key],
82
- header: () => headerOf(field, label),
83
- cell: ({ row }) =>
84
- h(DataValue, {
85
- field,
86
- value: row.original[field.key],
87
- relation: relation ? row.original[relation.name] : undefined,
88
- }),
89
- }
90
- }),
78
+ entity.fields
79
+ .filter(field => !field.primaryKey)
80
+ .map(field => {
81
+ const relation = relationOfField(entity, field.key)
82
+ const label = relation ? relationLabelOf(entity, relation) : field.label
83
+ return {
84
+ id: field.key,
85
+ accessorFn: row => row[field.key],
86
+ header: () => headerOf(field, label),
87
+ cell: ({ row }) =>
88
+ h(DataValue, {
89
+ field,
90
+ value: row.original[field.key],
91
+ relation: relation ? row.original[relation.name] : undefined,
92
+ }),
93
+ }
94
+ }),
91
95
  )
92
96
 
93
97
  const selected = ref<Row | null>(null)
@@ -110,34 +114,23 @@ const range = computed(() => {
110
114
  <template #header>
111
115
  <AppHeader
112
116
  :title="entityTitleOf(entity)"
113
- :badge="data?.total"
117
+ :count="data?.total"
114
118
  back="/data"
115
119
  back-label="All entities"
116
- >
117
- <template
118
- v-if="entity.ops.create"
119
- #actions
120
- >
121
- <UButton
122
- icon="i-lucide-plus"
123
- :label="`New ${entity.label.toLowerCase()}`"
124
- data-testid="data-new"
125
- @click="openRow(null)"
126
- />
127
- </template>
128
- </AppHeader>
120
+ :primary="entity.ops.create ? { label: `New ${entity.label.toLowerCase()}`, icon: 'i-tabler-plus', onClick: () => openRow(null) } : undefined"
121
+ />
129
122
  <UDashboardToolbar>
130
123
  <template #left>
131
124
  <UInput
132
125
  v-if="entity.search.length > 0"
133
126
  v-model="q"
134
- icon="i-lucide-search"
127
+ icon="i-tabler-search"
135
128
  :placeholder="`Search ${entity.search.join(', ')}…`"
136
- class="w-64"
129
+ class="min-w-0 flex-1 sm:w-64 sm:flex-none"
137
130
  data-testid="data-search"
138
131
  />
139
132
  <UButton
140
- icon="i-lucide-list-filter"
133
+ icon="i-tabler-filter"
141
134
  :label="where.length > 0 ? `Filter (${where.length})` : 'Filter'"
142
135
  color="neutral"
143
136
  :variant="showFilters ? 'soft' : 'ghost'"
@@ -146,13 +139,16 @@ const range = computed(() => {
146
139
  />
147
140
  </template>
148
141
  <template #right>
149
- <span class="text-sm text-muted">{{ range }}</span>
142
+ <span class="text-sm text-muted tabular-nums">{{ range }}</span>
150
143
  </template>
151
144
  </UDashboardToolbar>
152
145
  </template>
153
146
 
154
147
  <template #body>
155
- <p class="text-sm text-muted">
148
+ <p
149
+ v-if="entity.description"
150
+ class="max-w-prose text-sm text-muted"
151
+ >
156
152
  {{ entity.description }}
157
153
  </p>
158
154
  <DataFilterBuilder
@@ -165,19 +161,25 @@ const range = computed(() => {
165
161
  v-if="error"
166
162
  color="error"
167
163
  variant="subtle"
168
- icon="i-lucide-circle-alert"
164
+ icon="i-tabler-alert-circle"
169
165
  :title="actionErrorMessage(error)"
170
166
  />
171
167
  <UTable
172
168
  :data="data?.items ?? []"
173
169
  :columns="columns"
174
170
  :loading="status === 'pending'"
175
- empty="No rows match."
176
171
  class="flex-1"
177
172
  :ui="{ tr: 'cursor-pointer' }"
178
173
  data-testid="data-table"
179
174
  @select="(_event, row) => openRow(row.original)"
180
- />
175
+ >
176
+ <template #empty>
177
+ <ListEmpty
178
+ :title="where.length || search ? 'No rows match' : `No ${entity.label.toLowerCase()} rows yet`"
179
+ :description="where.length || search ? 'Change the search or the filter.' : undefined"
180
+ />
181
+ </template>
182
+ </UTable>
181
183
  <div
182
184
  v-if="(data?.total ?? 0) > PAGE_SIZE"
183
185
  class="flex justify-end"
@@ -1,4 +1,6 @@
1
1
  <script setup lang="ts">
2
+ import type { DataModel } from '@skaile/forge-data'
3
+
2
4
  definePageMeta({ middleware: 'owner-only' })
3
5
  useHead({ title: 'Data' })
4
6
 
@@ -17,52 +19,81 @@ const { data: counts } = await useAsyncData(
17
19
  },
18
20
  { watch: [model] },
19
21
  )
22
+
23
+ type Entity = DataModel['entities'][number]
24
+
25
+ /** "read-only · owner only": what the entity allows, as quiet words (no badges). */
26
+ function accessOf(entity: Entity) {
27
+ return [
28
+ !entity.ops.create && !entity.ops.update && !entity.ops.delete ? 'read-only' : null,
29
+ entity.ops.ownerOnly ? 'owner only' : null,
30
+ ]
31
+ .filter(Boolean)
32
+ .join(' · ')
33
+ }
34
+
35
+ function countOf(name: string) {
36
+ if (!counts.value) return '…'
37
+ const count = counts.value[name] ?? 0
38
+ return `${count} ${count === 1 ? 'row' : 'rows'}`
39
+ }
20
40
  </script>
21
41
 
22
42
  <template>
23
43
  <UDashboardPanel id="data">
24
44
  <template #header>
25
- <AppHeader title="Data" />
45
+ <AppHeader
46
+ title="Data"
47
+ :count="model?.entities.length"
48
+ />
26
49
  </template>
27
50
 
28
51
  <template #body>
29
- <p class="text-sm text-muted">
30
- Every entity the app exposes through the <code>data.*</code> actions, with the same checks as the API and the agents.
31
- </p>
32
- <UPageGrid class="lg:grid-cols-3">
33
- <UPageCard
34
- v-for="entity in model?.entities ?? []"
35
- :key="entity.name"
36
- :to="`/data/${entity.name}`"
37
- :title="entityTitleOf(entity)"
38
- :description="entity.description"
39
- icon="i-lucide-table-2"
40
- variant="subtle"
41
- :data-testid="`data-entity-${entity.name}`"
52
+ <div class="mx-auto flex w-full flex-col gap-3 lg:max-w-3xl">
53
+ <p class="max-w-prose text-sm text-muted">
54
+ Every entity the app exposes through the <code>data.*</code> actions, with the same checks as the API and the agents.
55
+ </p>
56
+ <ul
57
+ v-if="model?.entities.length"
58
+ class="calm-list -mx-3 flex flex-col"
42
59
  >
43
- <template #footer>
44
- <div class="flex flex-wrap items-center gap-2">
45
- <UBadge
46
- color="neutral"
47
- variant="outline"
48
- :label="counts ? `${counts[entity.name]} ${counts[entity.name] === 1 ? 'row' : 'rows'}` : '… rows'"
49
- />
50
- <UBadge
51
- v-if="!entity.ops.create && !entity.ops.update && !entity.ops.delete"
52
- color="neutral"
53
- variant="subtle"
54
- label="read-only"
55
- />
56
- <UBadge
57
- v-if="entity.ops.ownerOnly"
58
- color="warning"
59
- variant="subtle"
60
- label="owner only"
61
- />
60
+ <li
61
+ v-for="entity in model.entities"
62
+ :key="entity.name"
63
+ class="calm-row relative"
64
+ :data-testid="`data-entity-${entity.name}`"
65
+ >
66
+ <UIcon
67
+ name="i-tabler-table"
68
+ class="size-4 shrink-0 text-dimmed"
69
+ />
70
+ <div class="min-w-0 flex-1">
71
+ <NuxtLink
72
+ :to="`/data/${entity.name}`"
73
+ class="calm-row-target block truncate text-sm font-medium text-highlighted after:absolute after:inset-0"
74
+ >
75
+ {{ entityTitleOf(entity) }}
76
+ </NuxtLink>
77
+ <p
78
+ v-if="entity.description"
79
+ class="truncate text-xs text-muted"
80
+ >
81
+ {{ entity.description }}
82
+ </p>
62
83
  </div>
63
- </template>
64
- </UPageCard>
65
- </UPageGrid>
84
+ <span
85
+ v-if="accessOf(entity)"
86
+ class="hidden shrink-0 text-xs text-muted sm:block"
87
+ >{{ accessOf(entity) }}</span>
88
+ <span class="w-20 shrink-0 text-right text-xs text-muted tabular-nums">{{ countOf(entity.name) }}</span>
89
+ </li>
90
+ </ul>
91
+ <ListEmpty
92
+ v-else
93
+ title="No entities"
94
+ description="Entities appear here once a layer defines them with defineEntity."
95
+ />
96
+ </div>
66
97
  </template>
67
98
  </UDashboardPanel>
68
99
  </template>
@@ -0,0 +1,32 @@
1
+ import type { CommandPaletteGroup, CommandPaletteItem } from '@nuxt/ui'
2
+
3
+ /**
4
+ * ⌘K group "Data": one entry per exposed entity (`/data/<entity>`), for owners only (the
5
+ * pages guard themselves with `owner-only`). `/data` itself is the layer's tool entry
6
+ * (`app.config.ts`). The entities come from `data.describe`, loaded in the browser; the
7
+ * group fills when they arrive.
8
+ */
9
+ export default defineNuxtPlugin(nuxtApp => {
10
+ // The layout loads `me` before it calls `app-shell:extend`.
11
+ const { data: me } = useNuxtData<{ principal: { roles: string[] } }>('me')
12
+ const api = useDataApi()
13
+
14
+ nuxtApp.hook('app-shell:extend', shell => {
15
+ if (!me.value?.principal.roles.includes('owner')) return
16
+ // Only the item list is reactive: the palette re-renders when it fills.
17
+ const items = shallowReactive<CommandPaletteItem[]>([])
18
+ const group: CommandPaletteGroup<CommandPaletteItem> = { id: 'data', label: 'Data', items }
19
+ shell.commands.push(group)
20
+ if (import.meta.server) return
21
+ void api.describe().then(model => {
22
+ items.push(
23
+ ...model.entities.map(entity => ({
24
+ id: `data:${entity.name}`,
25
+ label: `Data › ${entityTitleOf(entity)}`,
26
+ icon: 'i-tabler-table',
27
+ to: `/data/${entity.name}`,
28
+ })),
29
+ )
30
+ })
31
+ })
32
+ })
@@ -8,7 +8,7 @@ import type {
8
8
  RelationDescriptor,
9
9
  Row,
10
10
  } from '@skaile/forge-data'
11
- // Explicit imports (Nuxt would auto-import them) so the template's unit tests can run this file without Nuxt.
11
+ // Explicit imports (Nuxt would auto-import them) so the layer's unit tests run without Nuxt.
12
12
  import { fromDateTimeInput, toDateTimeInput } from '~/utils/format'
13
13
  import type { JsonSchema } from '~/utils/jsonSchema'
14
14
  import { labelOfKey } from '~/utils/jsonSchema'
@@ -53,7 +53,7 @@ export function filterOpsOf(field: FieldDescriptor): FilterOp[] {
53
53
  return ops.filter(op => op !== 'isNull' && op !== 'notNull')
54
54
  }
55
55
 
56
- /** One choice of the filter builder's field select: an own field or a one-level relation path (`project.name`). */
56
+ /** One choice of the filter builder's field select: an own field or a one-level relation path (`folder.name`). */
57
57
  export interface FilterPath {
58
58
  path: string
59
59
  label: string
@@ -62,7 +62,7 @@ export interface FilterPath {
62
62
  target?: EntityDescriptor
63
63
  }
64
64
 
65
- /** A relation's heading: its foreign key's label without the id (`Project id` → `Project`, `Created by` stays). */
65
+ /** A relation's heading: its foreign key's label without the id (`Folder id` → `Folder`, `Created by` stays). */
66
66
  export function relationLabelOf(entity: EntityDescriptor, relation: RelationDescriptor): string {
67
67
  const label = entity.fields.find(field => field.key === relation.field)?.label ?? labelOfKey(relation.name)
68
68
  return label.replace(/ id$/i, '')
@@ -145,7 +145,7 @@ export function filterRowOf(cond: Cond, path: FilterPath | undefined, timeZone:
145
145
  return { path: cond.field, op: cond.op, value: local ? toDateTimeInput(cond.value as string, timeZone) : cond.value }
146
146
  }
147
147
 
148
- /** Plural title of an entity for headings (`tasks` → `Tasks`). */
148
+ /** Plural title of an entity for headings (`notes` → `Notes`). */
149
149
  export const entityTitleOf = (entity: EntityDescriptor) => labelOfKey(entity.name)
150
150
 
151
151
  /** The own to-one relation whose foreign key is `field`, if any. */
@@ -184,7 +184,7 @@ function jsonTypeOf(field: FieldDescriptor): JsonSchema {
184
184
  * the writable ones, the rest has no value yet),
185
185
  * nullable where the column is, read-only where the form may not write,
186
186
  * required where it has neither a default nor `null`. Foreign keys are titled
187
- * after their relation (`Project`, not `Project id`).
187
+ * after their relation (`Folder`, not `Folder id`).
188
188
  */
189
189
  export function rowSchemaOf(entity: EntityDescriptor, mode: FormMode): JsonSchema {
190
190
  const properties: Record<string, JsonSchema> = {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skaile/forge-layer-data-browser",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Nuxt layer for apps built on forge-template-app: the owner's view of every entity data.describe exposes (/data), with a filterable table, a filter builder and a generic row form.",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",