@antelopejs/dms-database 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -11
- package/dist/service/browse.js +34 -5
- package/dist/service/browse.js.map +1 -1
- package/dist/service/declaredFields.d.ts +14 -0
- package/dist/service/declaredFields.js +106 -0
- package/dist/service/declaredFields.js.map +1 -0
- package/dist/service/introspect.js +19 -75
- package/dist/service/introspect.js.map +1 -1
- package/dist/service/queryInspection.js +1 -1
- package/dist/service/queryInspection.js.map +1 -1
- package/frontend-vue/app/build/diagram/graphModel.ts +4 -5
- package/frontend-vue/app/build/diagram/layout.ts +8 -7
- package/frontend-vue/app/build/diagram/packing.ts +0 -24
- package/frontend-vue/app/build/utils/fieldTypes.ts +18 -4
- package/frontend-vue/app/components/ConnectionStatus.vue +1 -1
- package/frontend-vue/app/components/DiagramTableNode.vue +2 -4
- package/frontend-vue/app/components/JsonCellPanel.vue +3 -1
- package/frontend-vue/app/components/QueryConsole.vue +11 -64
- package/frontend-vue/app/components/QueryResultPanel.vue +2 -17
- package/frontend-vue/app/components/SchemaDiagram.vue +12 -4
- package/frontend-vue/app/components/TableInspector.vue +2 -2
- package/frontend-vue/i18n/locales/database-en-GB.json +1 -4
- package/frontend-vue/i18n/locales/database-fr-FR.json +1 -4
- package/frontend-vue/package.json +1 -1
- package/frontend-vue/pnpm-lock.yaml +5 -5
- package/frontend-vue/tests/connectionStatus.test.ts +36 -0
- package/frontend-vue/tests/dataBrowser.test.ts +31 -1
- package/frontend-vue/tests/diagramLayout.test.ts +75 -41
- package/frontend-vue/tests/queryResultPanel.test.ts +38 -0
- package/frontend-vue/tests/serverRender.test.ts +31 -1
- package/frontend-vue/vitest.config.ts +9 -1
- package/package.json +7 -7
- package/skills/dms-database/SKILL.md +1 -1
|
@@ -227,30 +227,6 @@ export function linkedGroups(
|
|
|
227
227
|
return [...groups.values()]
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
/** What a table name starts with before `__` (`dms-core__users`), or ''. */
|
|
231
|
-
export function namePrefix(name: string): string {
|
|
232
|
-
const at = name.indexOf('__')
|
|
233
|
-
return at > 0 ? name.slice(0, at) : ''
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Isolated tables in the order they are placed: by name prefix, the tables
|
|
238
|
-
* without one in their own group, then by name within a group.
|
|
239
|
-
*/
|
|
240
|
-
export function prefixOrder(names: string[]): string[] {
|
|
241
|
-
return [...names].sort((a, b) => {
|
|
242
|
-
const pa = namePrefix(a)
|
|
243
|
-
const pb = namePrefix(b)
|
|
244
|
-
if (pa !== pb) {
|
|
245
|
-
// The tables without a prefix come after the prefixed groups.
|
|
246
|
-
if (!pa) return 1
|
|
247
|
-
if (!pb) return -1
|
|
248
|
-
return pa.localeCompare(pb)
|
|
249
|
-
}
|
|
250
|
-
return a.localeCompare(b)
|
|
251
|
-
})
|
|
252
|
-
}
|
|
253
|
-
|
|
254
230
|
/**
|
|
255
231
|
* The zoom Vue Flow's `fitView` gives `bounds` in a canvas of `size` with
|
|
256
232
|
* `padding` (a share of the canvas), before its own zoom limits.
|
|
@@ -100,7 +100,7 @@ function isDescriptor(value: unknown): value is FieldDescriptor {
|
|
|
100
100
|
value !== null &&
|
|
101
101
|
typeof value === 'object' &&
|
|
102
102
|
typeof (value as { kind?: unknown }).kind === 'string' &&
|
|
103
|
-
(value as { kind: string }).kind
|
|
103
|
+
Object.hasOwn(VIEWS, (value as { kind: string }).kind)
|
|
104
104
|
)
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -109,8 +109,8 @@ export function describeField(
|
|
|
109
109
|
descriptor: unknown,
|
|
110
110
|
fieldName = '',
|
|
111
111
|
): FieldTypeView {
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
112
|
+
const name = fieldName.toLowerCase()
|
|
113
|
+
if (Object.hasOwn(NAMED_FIELDS, name)) return NAMED_FIELDS[name]
|
|
114
114
|
if (!isDescriptor(descriptor)) return UNKNOWN
|
|
115
115
|
const view = VIEWS[descriptor.kind] as (d: FieldDescriptor) => FieldTypeView
|
|
116
116
|
return view(descriptor)
|
|
@@ -209,5 +209,19 @@ const MODIFIERS: Record<string, Omit<ModifierView, 'id'>> = {
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
export function describeModifier(id: string): ModifierView {
|
|
212
|
-
return {
|
|
212
|
+
return {
|
|
213
|
+
id,
|
|
214
|
+
...(Object.hasOwn(MODIFIERS, id)
|
|
215
|
+
? MODIFIERS[id]
|
|
216
|
+
: { icon: 'i-ph-sliders' }),
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** The modifiers a table declares on one of its columns, by own key only. */
|
|
221
|
+
export function columnModifiers(
|
|
222
|
+
modifiers: Record<string, string[]> | undefined,
|
|
223
|
+
column: string,
|
|
224
|
+
): ModifierView[] {
|
|
225
|
+
if (!modifiers || !Object.hasOwn(modifiers, column)) return []
|
|
226
|
+
return (modifiers[column] ?? []).map(describeModifier)
|
|
213
227
|
}
|
|
@@ -41,7 +41,7 @@ const checkedAgo = computed(() => {
|
|
|
41
41
|
})
|
|
42
42
|
|
|
43
43
|
const since = computed(() => {
|
|
44
|
-
const parts = [health.value.driver, checkedAgo.value].filter(Boolean)
|
|
44
|
+
const parts = [health.value.driver ?? '—', checkedAgo.value].filter(Boolean)
|
|
45
45
|
return parts.join(' · ')
|
|
46
46
|
})
|
|
47
47
|
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
COLUMN_ROLE_CLASSES,
|
|
6
6
|
type ColumnRole,
|
|
7
7
|
describeField,
|
|
8
|
-
|
|
8
|
+
columnModifiers,
|
|
9
9
|
isPrimaryKey,
|
|
10
10
|
} from '../build/utils/fieldTypes'
|
|
11
11
|
|
|
@@ -46,9 +46,7 @@ const rows = computed(() =>
|
|
|
46
46
|
role,
|
|
47
47
|
icon: key ? 'i-ph-key' : relation ? 'i-ph-arrow-right' : type.icon,
|
|
48
48
|
type: relation ? relation.toTable : type.label,
|
|
49
|
-
modifiers: (props.data.table.modifiers
|
|
50
|
-
describeModifier,
|
|
51
|
-
),
|
|
49
|
+
modifiers: columnModifiers(props.data.table.modifiers, name),
|
|
52
50
|
highlighted: props.data.highlighted.includes(name),
|
|
53
51
|
}
|
|
54
52
|
}),
|
|
@@ -21,7 +21,9 @@ const { t } = useI18n()
|
|
|
21
21
|
|
|
22
22
|
const MIN_LINES = 12
|
|
23
23
|
// The form field hands the drawer's height down to the editor.
|
|
24
|
-
const FILL = {
|
|
24
|
+
const FILL = {
|
|
25
|
+
root: 'flex flex-1 flex-col *:last:flex *:last:flex-1 *:last:flex-col',
|
|
26
|
+
}
|
|
25
27
|
|
|
26
28
|
const draft = ref(jsonDraftText(props.value))
|
|
27
29
|
|
|
@@ -30,13 +30,11 @@ import QueryResultPanel, { type QueryFailure } from './QueryResultPanel.vue'
|
|
|
30
30
|
|
|
31
31
|
// The query console: the library rail, the editor and the result. A query
|
|
32
32
|
// that changes data runs only after a dry run told what it touches (D-03):
|
|
33
|
-
//
|
|
34
|
-
// can be let through without asking until the browser tab is closed.
|
|
33
|
+
// every write asks for the table name, as the docs say.
|
|
35
34
|
|
|
36
35
|
// The query being written, kept for the browser tab: a reload, or a row link
|
|
37
36
|
// followed by Back, brings it back (Q-9). A link that names a query wins.
|
|
38
37
|
const DRAFT_KEY = 'dms-database:query:draft'
|
|
39
|
-
const SKIP_SINGLE_UPDATES_KEY = 'dms-database:query:skip-single-row-updates'
|
|
40
38
|
const PREFILL_ROWS = 50
|
|
41
39
|
const OPERATION_ICONS: Record<string, string> = {
|
|
42
40
|
insert: 'i-ph-plus-circle',
|
|
@@ -213,20 +211,6 @@ function failBeforeRun(text: string, problem: QueryFailure) {
|
|
|
213
211
|
activeHistoryId.value = null
|
|
214
212
|
}
|
|
215
213
|
|
|
216
|
-
function skipsSingleUpdates(): boolean {
|
|
217
|
-
return (
|
|
218
|
-
typeof window !== 'undefined' &&
|
|
219
|
-
window.sessionStorage.getItem(SKIP_SINGLE_UPDATES_KEY) === 'true'
|
|
220
|
-
)
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function isSingleRowUpdate(dry: DryRunResult): boolean {
|
|
224
|
-
return (
|
|
225
|
-
(dry.operation === 'update' || dry.operation === 'replace') &&
|
|
226
|
-
dry.rows === 1
|
|
227
|
-
)
|
|
228
|
-
}
|
|
229
|
-
|
|
230
214
|
function guardTexts(dry: DryRunResult) {
|
|
231
215
|
const rows = dry.rows ?? 0
|
|
232
216
|
// The whole target, schema and instance included: `demo.tags @eu`.
|
|
@@ -263,11 +247,6 @@ async function guard(query: Record<string, unknown>, text: string) {
|
|
|
263
247
|
return
|
|
264
248
|
}
|
|
265
249
|
if (dry.operation === 'read') return execute(query, text)
|
|
266
|
-
if (isSingleRowUpdate(dry) && skipsSingleUpdates())
|
|
267
|
-
return execute(query, text)
|
|
268
|
-
const skipNextTime = ref(false)
|
|
269
|
-
const typed =
|
|
270
|
-
dry.operation === 'delete' || dry.rows === null || (dry.rows ?? 0) > 1
|
|
271
250
|
const targetLabel = describeTarget(dry)
|
|
272
251
|
const texts = guardTexts(dry)
|
|
273
252
|
await confirm({
|
|
@@ -276,7 +255,7 @@ async function guard(query: Record<string, unknown>, text: string) {
|
|
|
276
255
|
color: dry.operation === 'delete' ? 'error' : 'warning',
|
|
277
256
|
icon: OPERATION_ICONS[dry.operation] ?? 'i-ph-warning',
|
|
278
257
|
initialFocus: 'cancel',
|
|
279
|
-
confirmText:
|
|
258
|
+
confirmText: dry.table ?? dry.schema,
|
|
280
259
|
impact: [
|
|
281
260
|
{
|
|
282
261
|
icon: OPERATION_ICONS[dry.operation] ?? 'i-ph-lightning',
|
|
@@ -295,47 +274,15 @@ async function guard(query: Record<string, unknown>, text: string) {
|
|
|
295
274
|
},
|
|
296
275
|
],
|
|
297
276
|
body: () =>
|
|
298
|
-
h(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
isSingleRowUpdate(dry)
|
|
308
|
-
? h('label', { class: 'flex items-start gap-2 text-sm' }, [
|
|
309
|
-
h('input', {
|
|
310
|
-
type: 'checkbox',
|
|
311
|
-
class: 'mt-1',
|
|
312
|
-
checked: skipNextTime.value,
|
|
313
|
-
onChange: (event: Event) => {
|
|
314
|
-
skipNextTime.value = (
|
|
315
|
-
event.target as HTMLInputElement
|
|
316
|
-
).checked
|
|
317
|
-
},
|
|
318
|
-
}),
|
|
319
|
-
h('span', [
|
|
320
|
-
h(
|
|
321
|
-
'span',
|
|
322
|
-
{ class: 'text-toned' },
|
|
323
|
-
t('dms_database.query.guard.skip'),
|
|
324
|
-
),
|
|
325
|
-
h(
|
|
326
|
-
'span',
|
|
327
|
-
{ class: 'text-dimmed block text-xs' },
|
|
328
|
-
t('dms_database.query.guard.skip_detail'),
|
|
329
|
-
),
|
|
330
|
-
]),
|
|
331
|
-
])
|
|
332
|
-
: null,
|
|
333
|
-
]),
|
|
334
|
-
onConfirm: async () => {
|
|
335
|
-
if (skipNextTime.value)
|
|
336
|
-
window.sessionStorage.setItem(SKIP_SINGLE_UPDATES_KEY, 'true')
|
|
337
|
-
await execute(query, text)
|
|
338
|
-
},
|
|
277
|
+
h(
|
|
278
|
+
'pre',
|
|
279
|
+
{
|
|
280
|
+
class:
|
|
281
|
+
'border-default bg-elevated/50 max-h-40 overflow-auto rounded-md border p-3 font-mono text-xs whitespace-pre-wrap [overflow-wrap:anywhere]',
|
|
282
|
+
},
|
|
283
|
+
text,
|
|
284
|
+
),
|
|
285
|
+
onConfirm: () => execute(query, text),
|
|
339
286
|
})
|
|
340
287
|
}
|
|
341
288
|
|
|
@@ -66,7 +66,6 @@ const emit = defineEmits<{
|
|
|
66
66
|
'use-instance': [instance: string]
|
|
67
67
|
}>()
|
|
68
68
|
|
|
69
|
-
const MAX_TABLE_ROWS = 200
|
|
70
69
|
const EXAMPLE_ROWS = 10
|
|
71
70
|
const CHART_ROWS = 50
|
|
72
71
|
// Bars past this many are drawn sideways, a fixed height each, so their
|
|
@@ -104,11 +103,7 @@ const tableColumns = computed(() => filledColumns(rows.value, columns.value))
|
|
|
104
103
|
const rightAligned = computed(
|
|
105
104
|
() => new Set(numericOnly(rows.value, tableColumns.value)),
|
|
106
105
|
)
|
|
107
|
-
const shownRows = computed(() => rows.value.slice(0, MAX_TABLE_ROWS))
|
|
108
106
|
const targetLabel = computed(() => describeTarget(props.target))
|
|
109
|
-
const tableCut = computed(
|
|
110
|
-
() => mode.value === 'table' && rows.value.length > MAX_TABLE_ROWS,
|
|
111
|
-
)
|
|
112
107
|
|
|
113
108
|
function renderCell(value: unknown): string {
|
|
114
109
|
if (value === null || value === undefined) return 'null'
|
|
@@ -482,7 +477,7 @@ const suggestion = computed(() => {
|
|
|
482
477
|
</thead>
|
|
483
478
|
<tbody>
|
|
484
479
|
<tr
|
|
485
|
-
v-for="(row, rowIndex) in
|
|
480
|
+
v-for="(row, rowIndex) in rows"
|
|
486
481
|
:key="rowIndex"
|
|
487
482
|
class="group/result border-default/60 hover:bg-elevated/40 border-b last:border-0"
|
|
488
483
|
>
|
|
@@ -590,8 +585,6 @@ const suggestion = computed(() => {
|
|
|
590
585
|
:class="result.truncated ? 'text-warning' : ''"
|
|
591
586
|
class="size-3.5"
|
|
592
587
|
/>
|
|
593
|
-
<!-- The server cut the result and the table shows fewer still: both
|
|
594
|
-
limits are said. -->
|
|
595
588
|
<span v-if="result.truncated">
|
|
596
589
|
{{
|
|
597
590
|
t('dms_database.query.result.truncated', {
|
|
@@ -600,15 +593,7 @@ const suggestion = computed(() => {
|
|
|
600
593
|
})
|
|
601
594
|
}}
|
|
602
595
|
</span>
|
|
603
|
-
<span v-
|
|
604
|
-
{{
|
|
605
|
-
t('dms_database.query.result.table_first', {
|
|
606
|
-
shown: n(MAX_TABLE_ROWS),
|
|
607
|
-
total: n(rows.length),
|
|
608
|
-
})
|
|
609
|
-
}}
|
|
610
|
-
</span>
|
|
611
|
-
<span v-if="!result.truncated && !tableCut">
|
|
596
|
+
<span v-else>
|
|
612
597
|
{{
|
|
613
598
|
t(
|
|
614
599
|
'dms_database.query.result.all_shown',
|
|
@@ -92,7 +92,10 @@ const expandedBySchema = new Map<string, Set<string>>()
|
|
|
92
92
|
// read when the schema loads and when auto layout runs, so a note moved
|
|
93
93
|
// later does not move them.
|
|
94
94
|
const layoutBasis = shallowRef<LayoutOptions>({})
|
|
95
|
-
const
|
|
95
|
+
const loadedId = ref<string | null>(null)
|
|
96
|
+
const loaded = computed(
|
|
97
|
+
() => loadedId.value !== null && loadedId.value === schemaId.value,
|
|
98
|
+
)
|
|
96
99
|
// The note just created, opened ready to write until its edit ends.
|
|
97
100
|
const editNoteId = ref<string | null>(null)
|
|
98
101
|
let sync: DiagramSync | null = null
|
|
@@ -235,7 +238,12 @@ function setExpanded(next: Set<string>) {
|
|
|
235
238
|
}
|
|
236
239
|
|
|
237
240
|
function render() {
|
|
238
|
-
if (!canvas.value
|
|
241
|
+
if (!canvas.value) return
|
|
242
|
+
if (!schema.value || !loaded.value) {
|
|
243
|
+
canvas.value.setNodes([])
|
|
244
|
+
canvas.value.setEdges([])
|
|
245
|
+
return
|
|
246
|
+
}
|
|
239
247
|
const built = buildGraph({
|
|
240
248
|
schema: schema.value,
|
|
241
249
|
positions: state.positions,
|
|
@@ -295,7 +303,7 @@ async function load(id: string) {
|
|
|
295
303
|
// under its own id before the next schema loads (D-2).
|
|
296
304
|
const leaving = autosave?.flush()
|
|
297
305
|
autosave = null
|
|
298
|
-
|
|
306
|
+
loadedId.value = null
|
|
299
307
|
routing.clear()
|
|
300
308
|
history.clear()
|
|
301
309
|
historyRevision.value++
|
|
@@ -330,7 +338,7 @@ async function load(id: string) {
|
|
|
330
338
|
saveState.value = 'idle'
|
|
331
339
|
savedAt.value = null
|
|
332
340
|
requestFit()
|
|
333
|
-
|
|
341
|
+
loadedId.value = id
|
|
334
342
|
}
|
|
335
343
|
|
|
336
344
|
// The canvas is drawn in the browser, from a working copy of the layout and
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
COLUMN_ROLE_CLASSES,
|
|
23
23
|
type ColumnRole,
|
|
24
24
|
describeField,
|
|
25
|
-
|
|
25
|
+
columnModifiers,
|
|
26
26
|
isPrimaryKey,
|
|
27
27
|
valueDescriptor,
|
|
28
28
|
} from '../build/utils/fieldTypes'
|
|
@@ -153,7 +153,7 @@ const columns = computed(() => {
|
|
|
153
153
|
? relation.toTable
|
|
154
154
|
: type.label,
|
|
155
155
|
nullable: !key && isNullable(descriptor),
|
|
156
|
-
modifiers: (current.modifiers
|
|
156
|
+
modifiers: columnModifiers(current.modifiers, name),
|
|
157
157
|
}
|
|
158
158
|
})
|
|
159
159
|
})
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"schemas": {
|
|
66
66
|
"title": "Schemas",
|
|
67
|
-
"description": "Every table registered by your modules, its rows counted
|
|
67
|
+
"description": "Every table registered by your modules, its rows counted in the picked instance. Open one to inspect its columns, indexes and relations.",
|
|
68
68
|
"cols": {
|
|
69
69
|
"relations": "Relations",
|
|
70
70
|
"table": "Table",
|
|
@@ -389,7 +389,6 @@
|
|
|
389
389
|
"chart_unavailable": "No numeric column to plot.",
|
|
390
390
|
"all_shown": "{count} row shown. | All {count} rows shown. Results over 1,000 rows are cut; add .slice() to page through them.",
|
|
391
391
|
"truncated": "Showing {shown} of {total} rows: results are cut at 1,000. Add .slice() to page through them.",
|
|
392
|
-
"table_first": "The table shows the first {shown} of {total} rows; JSON and the CSV export hold them all.",
|
|
393
392
|
"running": "Running…",
|
|
394
393
|
"failed_local": "The query was not sent · nothing was changed",
|
|
395
394
|
"example_first": "First 10 rows of {table}"
|
|
@@ -409,8 +408,6 @@
|
|
|
409
408
|
"confirm_replace": "Replace {count} row | Replace {count} rows",
|
|
410
409
|
"confirm_delete": "Delete {count} row | Delete {count} rows",
|
|
411
410
|
"confirm_unknown": "Run query",
|
|
412
|
-
"skip": "Don't ask again for single-row updates",
|
|
413
|
-
"skip_detail": "Until you close this browser tab. Deletes and changes to more than one row always ask.",
|
|
414
411
|
"op_insert": "insert",
|
|
415
412
|
"op_update": "update",
|
|
416
413
|
"op_replace": "replace",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"schemas": {
|
|
66
66
|
"title": "Schémas",
|
|
67
|
-
"description": "Toutes les tables déclarées par vos modules, avec leurs lignes comptées dans
|
|
67
|
+
"description": "Toutes les tables déclarées par vos modules, avec leurs lignes comptées dans l'instance choisie. Ouvrez-en une pour voir ses colonnes, index et relations.",
|
|
68
68
|
"cols": {
|
|
69
69
|
"relations": "Relations",
|
|
70
70
|
"table": "Table",
|
|
@@ -389,7 +389,6 @@
|
|
|
389
389
|
"chart_unavailable": "Aucune colonne numérique à tracer.",
|
|
390
390
|
"all_shown": "{count} ligne affichée. | Les {count} lignes sont affichées. Au-delà de 1 000 lignes le résultat est coupé ; ajoutez .slice() pour paginer.",
|
|
391
391
|
"truncated": "{shown} lignes affichées sur {total} : le résultat est coupé à 1 000. Ajoutez .slice() pour paginer.",
|
|
392
|
-
"table_first": "Le tableau montre les {shown} premières lignes sur {total} ; le JSON et l'export CSV les contiennent toutes.",
|
|
393
392
|
"running": "Exécution…",
|
|
394
393
|
"failed_local": "La requête n'a pas été envoyée · rien n'a été modifié",
|
|
395
394
|
"example_first": "Les 10 premières lignes de {table}"
|
|
@@ -409,8 +408,6 @@
|
|
|
409
408
|
"confirm_replace": "Remplacer {count} ligne | Remplacer {count} lignes",
|
|
410
409
|
"confirm_delete": "Supprimer {count} ligne | Supprimer {count} lignes",
|
|
411
410
|
"confirm_unknown": "Lancer la requête",
|
|
412
|
-
"skip": "Ne plus demander pour les modifications d'une seule ligne",
|
|
413
|
-
"skip_detail": "Jusqu'à la fermeture de cet onglet. Les suppressions et les modifications de plusieurs lignes demandent toujours.",
|
|
414
411
|
"op_insert": "insertion",
|
|
415
412
|
"op_update": "modification",
|
|
416
413
|
"op_replace": "remplacement",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@antelopejs/interface-core": ">=0.4.0 <1.0.0",
|
|
22
|
-
"@antelopejs/interface-database": ">=0.3.
|
|
22
|
+
"@antelopejs/interface-database": ">=0.3.1 <1.0.0",
|
|
23
23
|
"@codemirror/autocomplete": "^6.18.6",
|
|
24
24
|
"@codemirror/commands": "^6.8.1",
|
|
25
25
|
"@codemirror/lang-javascript": "^6.2.4",
|
|
@@ -12,8 +12,8 @@ importers:
|
|
|
12
12
|
specifier: '>=0.4.0 <1.0.0'
|
|
13
13
|
version: 0.4.0
|
|
14
14
|
'@antelopejs/interface-database':
|
|
15
|
-
specifier: '>=0.3.
|
|
16
|
-
version: 0.3.
|
|
15
|
+
specifier: '>=0.3.1 <1.0.0'
|
|
16
|
+
version: 0.3.1(@antelopejs/interface-core@0.4.0)
|
|
17
17
|
'@codemirror/autocomplete':
|
|
18
18
|
specifier: ^6.18.6
|
|
19
19
|
version: 6.20.3
|
|
@@ -91,8 +91,8 @@ packages:
|
|
|
91
91
|
'@antelopejs/interface-core@0.4.0':
|
|
92
92
|
resolution: {integrity: sha512-IPX6dtt3KHknclN4mLOYeRYL2Odz1Pts+dtaZul62NghsBUX/0OFHD4Qhoaf+Beva4hjInbaF918ajr4Z5HVWQ==}
|
|
93
93
|
|
|
94
|
-
'@antelopejs/interface-database@0.3.
|
|
95
|
-
resolution: {integrity: sha512-
|
|
94
|
+
'@antelopejs/interface-database@0.3.1':
|
|
95
|
+
resolution: {integrity: sha512-UNROciHOa5537lis/cUMTgr2J6bvYCyXrSdiIqdvG+CV9OZzf2TeKR6U5SBTYTjtnq47bIlVzFfz7gjOP4gmSA==}
|
|
96
96
|
peerDependencies:
|
|
97
97
|
'@antelopejs/interface-core': '>=0.2.4 <1.0.0'
|
|
98
98
|
|
|
@@ -3119,7 +3119,7 @@ snapshots:
|
|
|
3119
3119
|
dependencies:
|
|
3120
3120
|
reflect-metadata: 0.2.2
|
|
3121
3121
|
|
|
3122
|
-
'@antelopejs/interface-database@0.3.
|
|
3122
|
+
'@antelopejs/interface-database@0.3.1(@antelopejs/interface-core@0.4.0)':
|
|
3123
3123
|
dependencies:
|
|
3124
3124
|
'@antelopejs/interface-core': 0.4.0
|
|
3125
3125
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { browserMount, type BackendRead } from './fixtures/serverRender'
|
|
3
|
+
import ConnectionStatus from '../app/components/ConnectionStatus.vue'
|
|
4
|
+
|
|
5
|
+
function healthWith(driver: string | null) {
|
|
6
|
+
return ({ url }: BackendRead): unknown =>
|
|
7
|
+
url === '/api/database/health'
|
|
8
|
+
? {
|
|
9
|
+
status: 'ok',
|
|
10
|
+
latencyMs: 3,
|
|
11
|
+
driver,
|
|
12
|
+
checkedAt: '2026-10-18T10:00:00.000Z',
|
|
13
|
+
storage: [],
|
|
14
|
+
}
|
|
15
|
+
: { items: [] }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
describe('overview connection card: the database name before the probe age', () => {
|
|
19
|
+
it('shows a dash when driverLabel is unset', async () => {
|
|
20
|
+
const page = browserMount(ConnectionStatus, healthWith(null))
|
|
21
|
+
await page.shown
|
|
22
|
+
expect(page.text()).toMatch(
|
|
23
|
+
/since="— · dms_database\.overview\.connection\.checked_/,
|
|
24
|
+
)
|
|
25
|
+
expect(page.errors).toEqual([])
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it('shows the configured driverLabel', async () => {
|
|
29
|
+
const page = browserMount(ConnectionStatus, healthWith('MongoDB 8.0'))
|
|
30
|
+
await page.shown
|
|
31
|
+
expect(page.text()).toMatch(
|
|
32
|
+
/since="MongoDB 8\.0 · dms_database\.overview\.connection\.checked_/,
|
|
33
|
+
)
|
|
34
|
+
expect(page.errors).toEqual([])
|
|
35
|
+
})
|
|
36
|
+
})
|
|
@@ -25,7 +25,12 @@ import {
|
|
|
25
25
|
instanceToUrl,
|
|
26
26
|
tableLink,
|
|
27
27
|
} from '../app/build/utils/databaseLinks'
|
|
28
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
columnModifiers,
|
|
30
|
+
describeField,
|
|
31
|
+
describeModifier,
|
|
32
|
+
valueDescriptor,
|
|
33
|
+
} from '../app/build/utils/fieldTypes'
|
|
29
34
|
|
|
30
35
|
describe('cell drafts: null', () => {
|
|
31
36
|
it('empties a cell of any type with null', () => {
|
|
@@ -351,4 +356,29 @@ describe('column types', () => {
|
|
|
351
356
|
}).icon,
|
|
352
357
|
).toBe('i-ph-arrows-split')
|
|
353
358
|
})
|
|
359
|
+
|
|
360
|
+
it('reads a column named like an Object member by its declared type', () => {
|
|
361
|
+
for (const name of ['constructor', 'toString', '__proto__']) {
|
|
362
|
+
expect(describeField({ kind: 'string' }, name)).toEqual({
|
|
363
|
+
icon: 'i-ph-text-aa',
|
|
364
|
+
label: 'string',
|
|
365
|
+
})
|
|
366
|
+
expect(columnModifiers({}, name)).toEqual([])
|
|
367
|
+
}
|
|
368
|
+
expect(describeField({ kind: 'constructor' })).toEqual({
|
|
369
|
+
icon: 'i-ph-question',
|
|
370
|
+
label: 'unknown',
|
|
371
|
+
})
|
|
372
|
+
expect(describeModifier('constructor')).toEqual({
|
|
373
|
+
id: 'constructor',
|
|
374
|
+
icon: 'i-ph-sliders',
|
|
375
|
+
})
|
|
376
|
+
})
|
|
377
|
+
|
|
378
|
+
it('names the modifiers declared on a column', () => {
|
|
379
|
+
expect(columnModifiers({ secret: ['HashModifier'] }, 'secret')).toEqual([
|
|
380
|
+
describeModifier('HashModifier'),
|
|
381
|
+
])
|
|
382
|
+
expect(columnModifiers(undefined, 'secret')).toEqual([])
|
|
383
|
+
})
|
|
354
384
|
})
|