@antelopejs/dms-database 0.0.14 → 0.1.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/README.md +30 -5
- package/dist/db/models/query_history.model.d.ts +1 -0
- package/dist/db/models/query_history.model.js +6 -0
- package/dist/db/models/query_history.model.js.map +1 -1
- package/dist/db/tables/query_history.table.d.ts +3 -0
- package/dist/db/tables/query_history.table.js +12 -0
- package/dist/db/tables/query_history.table.js.map +1 -1
- package/dist/db/tables/saved_queries.table.d.ts +1 -0
- package/dist/db/tables/saved_queries.table.js +4 -0
- package/dist/db/tables/saved_queries.table.js.map +1 -1
- package/dist/i18n/messages.d.ts +39 -0
- package/dist/i18n/messages.js +64 -0
- package/dist/i18n/messages.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -7
- package/dist/index.js.map +1 -1
- package/dist/module.d.ts +11 -0
- package/dist/module.js +55 -0
- package/dist/module.js.map +1 -0
- package/dist/pages/data.d.ts +1 -1
- package/dist/pages/data.js +9 -6
- package/dist/pages/data.js.map +1 -1
- package/dist/pages/diagram.d.ts +9 -0
- package/dist/pages/diagram.js +45 -0
- package/dist/pages/diagram.js.map +1 -0
- package/dist/pages/index.d.ts +1 -0
- package/dist/pages/index.js +1 -0
- package/dist/pages/index.js.map +1 -1
- package/dist/pages/overview.d.ts +4 -1
- package/dist/pages/overview.js +113 -6
- package/dist/pages/overview.js.map +1 -1
- package/dist/pages/query.d.ts +1 -1
- package/dist/pages/query.js +22 -6
- package/dist/pages/query.js.map +1 -1
- package/dist/pages/schemas.d.ts +2 -1
- package/dist/pages/schemas.js +143 -6
- package/dist/pages/schemas.js.map +1 -1
- package/dist/routes/data.d.ts +8 -0
- package/dist/routes/data.js +84 -21
- package/dist/routes/data.js.map +1 -1
- package/dist/routes/index.d.ts +1 -0
- package/dist/routes/index.js +1 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/overview.d.ts +12 -0
- package/dist/routes/overview.js +55 -0
- package/dist/routes/overview.js.map +1 -0
- package/dist/routes/query.d.ts +5 -1
- package/dist/routes/query.js +162 -27
- package/dist/routes/query.js.map +1 -1
- package/dist/routes/tables.d.ts +15 -12
- package/dist/routes/tables.js +95 -55
- package/dist/routes/tables.js.map +1 -1
- package/dist/service/catalog.d.ts +3 -0
- package/dist/service/catalog.js +26 -0
- package/dist/service/catalog.js.map +1 -0
- package/dist/service/health.d.ts +3 -3
- package/dist/service/health.js +17 -14
- package/dist/service/health.js.map +1 -1
- package/dist/service/introspect.d.ts +3 -1
- package/dist/service/introspect.js +131 -43
- package/dist/service/introspect.js.map +1 -1
- package/dist/service/overview.d.ts +9 -0
- package/dist/service/overview.js +113 -0
- package/dist/service/overview.js.map +1 -0
- package/dist/service/queryInspection.d.ts +15 -0
- package/dist/service/queryInspection.js +107 -0
- package/dist/service/queryInspection.js.map +1 -0
- package/dist/service/references.d.ts +9 -0
- package/dist/service/references.js +52 -0
- package/dist/service/references.js.map +1 -0
- package/dist/service/schemaFilters.d.ts +26 -0
- package/dist/service/schemaFilters.js +42 -0
- package/dist/service/schemaFilters.js.map +1 -0
- package/dist/service/stagedSerialization.d.ts +2 -0
- package/dist/service/stagedSerialization.js +38 -10
- package/dist/service/stagedSerialization.js.map +1 -1
- package/dist/service/types.d.ts +11 -1
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/constants.js +3 -1
- package/dist/types/constants.js.map +1 -1
- package/dist/utils/query.d.ts +0 -2
- package/dist/utils/query.js +0 -20
- package/dist/utils/query.js.map +1 -1
- package/frontend-vue/app/{composables → build/composables}/useDataBrowserGrid.ts +65 -50
- package/frontend-vue/app/build/composables/useDataBrowserTabs.ts +366 -0
- package/frontend-vue/app/build/composables/useDatabaseHealth.ts +50 -0
- package/frontend-vue/app/build/composables/useDatabaseSchemas.ts +140 -0
- package/frontend-vue/app/{composables → build/composables}/useDiagramPersistence.ts +47 -39
- package/frontend-vue/app/build/composables/useQueryRuntime.ts +217 -0
- package/frontend-vue/app/build/composables/useQueryStore.ts +162 -0
- package/frontend-vue/app/build/data/cellValues.ts +132 -0
- package/frontend-vue/app/build/data/instanceOptions.ts +36 -0
- package/frontend-vue/app/build/data/pickerMenus.ts +175 -0
- package/frontend-vue/app/build/data/recentTables.ts +48 -0
- package/frontend-vue/app/build/data/stagedEdits.ts +117 -0
- package/frontend-vue/app/build/data/stagedWrites.ts +64 -0
- package/frontend-vue/app/build/data/useStagedSave.ts +298 -0
- package/frontend-vue/app/build/diagram/autosave.ts +72 -0
- package/frontend-vue/app/build/diagram/graph.ts +585 -0
- package/frontend-vue/app/build/diagram/history.ts +178 -0
- package/frontend-vue/app/build/diagram/shortcuts.ts +62 -0
- package/frontend-vue/app/build/diagram/sync.ts +137 -0
- package/frontend-vue/app/build/query/completion.ts +100 -0
- package/frontend-vue/app/build/query/csv.ts +32 -0
- package/frontend-vue/app/build/query/examples.ts +38 -0
- package/frontend-vue/app/build/query/runs.ts +168 -0
- package/frontend-vue/app/build/query/tableColumns.ts +35 -0
- package/frontend-vue/app/build/query/target.ts +143 -0
- package/frontend-vue/app/build/schemas/filterState.ts +128 -0
- package/frontend-vue/app/build/schemas/useSchemasListing.ts +62 -0
- package/frontend-vue/app/build/utils/databaseLinks.ts +98 -0
- package/frontend-vue/app/build/utils/fieldTypes.ts +198 -0
- package/frontend-vue/app/build/utils/relativeTime.ts +19 -0
- package/frontend-vue/app/{utils → build/utils}/stagedSerialization.ts +7 -1
- package/frontend-vue/app/components/ConnectionStatus.vue +122 -0
- package/frontend-vue/app/components/DataBrowser.vue +126 -0
- package/frontend-vue/app/components/DataBrowserSidebar.vue +293 -210
- package/frontend-vue/app/components/DataBrowserTabBar.vue +185 -93
- package/frontend-vue/app/components/DataFilterBar.vue +163 -0
- package/frontend-vue/app/components/DataGrid.vue +737 -499
- package/frontend-vue/app/components/DataGridCell.vue +125 -77
- package/frontend-vue/app/components/DataGridHeaderCell.vue +119 -81
- package/frontend-vue/app/components/DiagramNoteNode.vue +81 -63
- package/frontend-vue/app/components/DiagramRelationEdge.vue +57 -27
- package/frontend-vue/app/components/DiagramStubNode.vue +16 -17
- package/frontend-vue/app/components/DiagramTableNode.vue +106 -68
- package/frontend-vue/app/components/InstancePicker.vue +195 -0
- package/frontend-vue/app/components/JsonCellPanel.vue +30 -29
- package/frontend-vue/app/components/QueryBuilderPanel.vue +290 -238
- package/frontend-vue/app/components/QueryConsole.vue +726 -0
- package/frontend-vue/app/components/QueryLibrary.vue +314 -0
- package/frontend-vue/app/components/QueryResultPanel.vue +556 -126
- package/frontend-vue/app/components/RowDrawer.vue +520 -0
- package/frontend-vue/app/components/SchemaDiagram.vue +1016 -1051
- package/frontend-vue/app/components/SchemaPicker.vue +86 -0
- package/frontend-vue/app/components/SchemasFilterBar.vue +201 -0
- package/frontend-vue/app/components/TableInspector.vue +741 -0
- package/frontend-vue/app/config/shortcuts-registry.ts +65 -0
- package/frontend-vue/dms.frontend.ts +5 -14
- package/frontend-vue/i18n/locales/database-en-GB.json +526 -193
- package/frontend-vue/i18n/locales/database-fr-FR.json +528 -195
- package/frontend-vue/package.json +2 -1
- package/frontend-vue/pnpm-lock.yaml +2601 -858
- package/frontend-vue/pnpm-workspace.yaml +1 -1
- package/frontend-vue/tests/dataBrowser.test.ts +206 -0
- package/frontend-vue/tests/diagram.test.ts +516 -0
- package/frontend-vue/tests/helpers.test.ts +205 -0
- package/frontend-vue/tests/instanceOptions.test.ts +53 -0
- package/frontend-vue/tests/locales.test.ts +56 -0
- package/frontend-vue/tests/persistence.test.ts +106 -5
- package/frontend-vue/tests/pickerMenus.test.ts +254 -0
- package/frontend-vue/tests/queryConsole.test.ts +282 -0
- package/frontend-vue/tests/queryRuntime.test.ts +2 -2
- package/frontend-vue/tests/registration.test.ts +36 -25
- package/frontend-vue/tests/schemasFilters.test.ts +115 -0
- package/package.json +7 -7
- package/frontend-vue/app/components/QueryFavoritesPanel.vue +0 -127
- package/frontend-vue/app/components/QueryHistoryPanel.vue +0 -134
- package/frontend-vue/app/components/SchemaTableInspector.vue +0 -278
- package/frontend-vue/app/composables/useDataBrowserTabs.ts +0 -255
- package/frontend-vue/app/composables/useDatabaseHealth.ts +0 -50
- package/frontend-vue/app/composables/useDatabaseSchemas.ts +0 -92
- package/frontend-vue/app/composables/useQueryRuntime.ts +0 -118
- package/frontend-vue/app/composables/useQueryStore.ts +0 -117
- package/frontend-vue/app/composables/useTableViewRowClick.ts +0 -22
- package/frontend-vue/app/custom-pages/database/data.vue +0 -41
- package/frontend-vue/app/custom-pages/database/overview.vue +0 -367
- package/frontend-vue/app/custom-pages/database/query.vue +0 -436
- package/frontend-vue/app/custom-pages/database/schemas.vue +0 -218
- package/frontend-vue/app/utils/databaseFieldModifiers.ts +0 -33
- package/frontend-vue/app/utils/databaseFieldTypeIcons.ts +0 -224
- package/frontend-vue/app/utils/dmsTableView.ts +0 -83
- package/frontend-vue/app/utils/relativeTime.ts +0 -18
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
packages:
|
|
2
|
-
-
|
|
2
|
+
- '.'
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import {
|
|
3
|
+
CROSS_INSTANCE_VALUE,
|
|
4
|
+
DEFAULT_INSTANCE_VALUE,
|
|
5
|
+
instanceBadge,
|
|
6
|
+
instanceChoiceOf,
|
|
7
|
+
tabInstanceOf,
|
|
8
|
+
} from '../app/build/composables/useDataBrowserTabs'
|
|
9
|
+
import { cellLabel, draftText, parseDraft } from '../app/build/data/cellValues'
|
|
10
|
+
import { changesOf, writeRows } from '../app/build/data/stagedWrites'
|
|
11
|
+
import {
|
|
12
|
+
instanceFromUrl,
|
|
13
|
+
instanceToUrl,
|
|
14
|
+
tableLink,
|
|
15
|
+
} from '../app/build/utils/databaseLinks'
|
|
16
|
+
|
|
17
|
+
describe('cell drafts: null', () => {
|
|
18
|
+
it('empties a cell of any type with null', () => {
|
|
19
|
+
expect(parseDraft('null', 'Ada', 'string')).toEqual({
|
|
20
|
+
ok: true,
|
|
21
|
+
value: null,
|
|
22
|
+
unchanged: false,
|
|
23
|
+
})
|
|
24
|
+
expect(parseDraft(' null ', 42, 'number')).toMatchObject({
|
|
25
|
+
ok: true,
|
|
26
|
+
value: null,
|
|
27
|
+
})
|
|
28
|
+
expect(
|
|
29
|
+
parseDraft('null', '2026-10-01T10:00:00.000Z', 'date'),
|
|
30
|
+
).toMatchObject({ ok: true, value: null })
|
|
31
|
+
expect(parseDraft('null', null, 'string')).toMatchObject({
|
|
32
|
+
unchanged: true,
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('types the text null escaped, one backslash more', () => {
|
|
37
|
+
expect(parseDraft('\\null', null, 'string')).toMatchObject({
|
|
38
|
+
ok: true,
|
|
39
|
+
value: 'null',
|
|
40
|
+
})
|
|
41
|
+
expect(parseDraft('\\\\null', 'x', 'string')).toMatchObject({
|
|
42
|
+
value: '\\null',
|
|
43
|
+
})
|
|
44
|
+
expect(draftText('null')).toBe('\\null')
|
|
45
|
+
expect(draftText('\\null')).toBe('\\\\null')
|
|
46
|
+
expect(draftText('nullable')).toBe('nullable')
|
|
47
|
+
// Opened then committed as it is, the text stays.
|
|
48
|
+
expect(parseDraft(draftText('null'), 'null', 'string')).toMatchObject({
|
|
49
|
+
value: 'null',
|
|
50
|
+
unchanged: true,
|
|
51
|
+
})
|
|
52
|
+
expect(parseDraft('\\null', 1, 'number')).toEqual({
|
|
53
|
+
ok: false,
|
|
54
|
+
reason: 'number',
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('tells an empty text from an empty cell', () => {
|
|
59
|
+
expect(parseDraft('', 'Ada', 'string')).toMatchObject({
|
|
60
|
+
ok: true,
|
|
61
|
+
value: '',
|
|
62
|
+
unchanged: false,
|
|
63
|
+
})
|
|
64
|
+
expect(cellLabel('')).toBe('""')
|
|
65
|
+
expect(cellLabel(null)).toBe('null')
|
|
66
|
+
expect(cellLabel(undefined)).toBe('null')
|
|
67
|
+
expect(cellLabel('null')).toBe('"null"')
|
|
68
|
+
expect(cellLabel('nullable')).toBe('nullable')
|
|
69
|
+
expect(cellLabel({ a: 1 })).toBe('{"a":1}')
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
describe('cell drafts: dates', () => {
|
|
74
|
+
const stored = '2026-10-01T10:00:00.000Z'
|
|
75
|
+
|
|
76
|
+
it('refuses what is not a date', () => {
|
|
77
|
+
for (const draft of ['not a date', '42', '', '2026-13-01', '2026-02-30'])
|
|
78
|
+
expect(parseDraft(draft, stored, 'date')).toEqual({
|
|
79
|
+
ok: false,
|
|
80
|
+
reason: 'date',
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it('stores a date as ISO text, and an echo as unchanged', () => {
|
|
85
|
+
expect(parseDraft('2026-10-05', stored, 'date')).toEqual({
|
|
86
|
+
ok: true,
|
|
87
|
+
value: '2026-10-05T00:00:00.000Z',
|
|
88
|
+
unchanged: false,
|
|
89
|
+
})
|
|
90
|
+
expect(parseDraft('2026-10-05T08:30:00Z', null, 'date')).toMatchObject({
|
|
91
|
+
value: '2026-10-05T08:30:00.000Z',
|
|
92
|
+
})
|
|
93
|
+
expect(parseDraft(stored, stored, 'date')).toMatchObject({
|
|
94
|
+
unchanged: true,
|
|
95
|
+
})
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
describe('staged writes', () => {
|
|
100
|
+
const rows: [string, Record<string, unknown>][] = [
|
|
101
|
+
['a', { name: 'A' }],
|
|
102
|
+
['b', { name: 'B' }],
|
|
103
|
+
['c', { name: 'C' }],
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
it('writes every row and settles each', async () => {
|
|
107
|
+
const settled: string[] = []
|
|
108
|
+
const outcome = await writeRows(
|
|
109
|
+
rows,
|
|
110
|
+
async () => undefined,
|
|
111
|
+
(id) => settled.push(id),
|
|
112
|
+
)
|
|
113
|
+
expect(outcome).toEqual({
|
|
114
|
+
written: ['a', 'b', 'c'],
|
|
115
|
+
gone: [],
|
|
116
|
+
error: null,
|
|
117
|
+
left: [],
|
|
118
|
+
})
|
|
119
|
+
expect(settled).toEqual(['a', 'b', 'c'])
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
it('counts a row gone meanwhile apart, and goes on', async () => {
|
|
123
|
+
const outcome = await writeRows(rows, async (id) => {
|
|
124
|
+
if (id === 'b')
|
|
125
|
+
throw Object.assign(new Error('gone'), { statusCode: 404 })
|
|
126
|
+
})
|
|
127
|
+
expect(outcome.written).toEqual(['a', 'c'])
|
|
128
|
+
expect(outcome.gone).toEqual(['b'])
|
|
129
|
+
expect(outcome.error).toBeNull()
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
it('stops at another failure, leaving the rows after it unsettled', async () => {
|
|
133
|
+
const failure = Object.assign(new Error('boom'), { statusCode: 500 })
|
|
134
|
+
const settled: string[] = []
|
|
135
|
+
const outcome = await writeRows(
|
|
136
|
+
rows,
|
|
137
|
+
async (id) => {
|
|
138
|
+
if (id === 'b') throw failure
|
|
139
|
+
},
|
|
140
|
+
(id) => settled.push(id),
|
|
141
|
+
)
|
|
142
|
+
expect(outcome).toEqual({
|
|
143
|
+
written: ['a'],
|
|
144
|
+
gone: [],
|
|
145
|
+
error: failure,
|
|
146
|
+
left: ['b', 'c'],
|
|
147
|
+
})
|
|
148
|
+
expect(settled).toEqual(['a'])
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
it('picks the changes of the rows written', () => {
|
|
152
|
+
const changes = [
|
|
153
|
+
{ rowId: 'a', field: 'x' },
|
|
154
|
+
{ rowId: 'b', field: 'x' },
|
|
155
|
+
{ rowId: 'a', field: 'y' },
|
|
156
|
+
]
|
|
157
|
+
expect(changesOf(changes, ['a'])).toEqual([
|
|
158
|
+
{ rowId: 'a', field: 'x' },
|
|
159
|
+
{ rowId: 'a', field: 'y' },
|
|
160
|
+
])
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
describe('instance URL parameter', () => {
|
|
165
|
+
it('reads none as the default instance, all as every instance', () => {
|
|
166
|
+
expect(instanceFromUrl(undefined)).toEqual({ kind: 'default' })
|
|
167
|
+
expect(instanceFromUrl('')).toEqual({ kind: 'default' })
|
|
168
|
+
expect(instanceFromUrl('all')).toEqual({ kind: 'all' })
|
|
169
|
+
expect(instanceFromUrl('eu')).toEqual({ kind: 'named', id: 'eu' })
|
|
170
|
+
expect(instanceFromUrl(['eu', 'us'])).toEqual({ kind: 'named', id: 'eu' })
|
|
171
|
+
// No escaping, and the 0.0.14 cross-instance value is a name now.
|
|
172
|
+
expect(instanceFromUrl('~all')).toEqual({ kind: 'named', id: '~all' })
|
|
173
|
+
expect(instanceFromUrl('__CROSS_INSTANCE__')).toEqual({
|
|
174
|
+
kind: 'named',
|
|
175
|
+
id: '__CROSS_INSTANCE__',
|
|
176
|
+
})
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
it('writes the default instance as none, every instance as all', () => {
|
|
180
|
+
expect(instanceToUrl({ kind: 'default' })).toBeUndefined()
|
|
181
|
+
expect(instanceToUrl({ kind: 'all' })).toBe('all')
|
|
182
|
+
expect(instanceToUrl({ kind: 'named', id: 'eu' })).toBe('eu')
|
|
183
|
+
expect(
|
|
184
|
+
tableLink('data', { schema: 's', table: 't', instance: 'all' }),
|
|
185
|
+
).toBe('/modules/database/data?schema=s&table=t&instance=all')
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
it('maps a tab instance to the URL and back', () => {
|
|
189
|
+
expect(instanceToUrl(instanceChoiceOf(DEFAULT_INSTANCE_VALUE))).toBe(
|
|
190
|
+
undefined,
|
|
191
|
+
)
|
|
192
|
+
expect(instanceToUrl(instanceChoiceOf(CROSS_INSTANCE_VALUE))).toBe('all')
|
|
193
|
+
for (const instance of [DEFAULT_INSTANCE_VALUE, CROSS_INSTANCE_VALUE, 'eu'])
|
|
194
|
+
expect(
|
|
195
|
+
tabInstanceOf(
|
|
196
|
+
instanceFromUrl(instanceToUrl(instanceChoiceOf(instance))),
|
|
197
|
+
),
|
|
198
|
+
).toBe(instance)
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
it('names the instance of a tab', () => {
|
|
202
|
+
expect(instanceBadge(DEFAULT_INSTANCE_VALUE, 'all')).toBeNull()
|
|
203
|
+
expect(instanceBadge(CROSS_INSTANCE_VALUE, 'toutes')).toBe('@toutes')
|
|
204
|
+
expect(instanceBadge('eu', 'all')).toBe('@eu')
|
|
205
|
+
})
|
|
206
|
+
})
|