@antelopejs/dms-database 0.0.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/LICENSE +190 -0
- package/README.md +53 -0
- package/dist/automation/index.d.ts +2 -0
- package/dist/automation/index.js +13 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/automation/tableWatch.d.ts +17 -0
- package/dist/automation/tableWatch.js +189 -0
- package/dist/automation/tableWatch.js.map +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.js +12 -0
- package/dist/config.js.map +1 -0
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.js +19 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/models/diagram_layouts.model.d.ts +25 -0
- package/dist/db/models/diagram_layouts.model.js +29 -0
- package/dist/db/models/diagram_layouts.model.js.map +1 -0
- package/dist/db/models/diagram_notes.model.d.ts +23 -0
- package/dist/db/models/diagram_notes.model.js +15 -0
- package/dist/db/models/diagram_notes.model.js.map +1 -0
- package/dist/db/models/index.d.ts +4 -0
- package/dist/db/models/index.js +21 -0
- package/dist/db/models/index.js.map +1 -0
- package/dist/db/models/query_history.model.d.ts +25 -0
- package/dist/db/models/query_history.model.js +33 -0
- package/dist/db/models/query_history.model.js.map +1 -0
- package/dist/db/models/saved_queries.model.d.ts +24 -0
- package/dist/db/models/saved_queries.model.js +21 -0
- package/dist/db/models/saved_queries.model.js.map +1 -0
- package/dist/db/tables/diagram_layouts.table.d.ts +7 -0
- package/dist/db/tables/diagram_layouts.table.js +35 -0
- package/dist/db/tables/diagram_layouts.table.js.map +1 -0
- package/dist/db/tables/diagram_notes.table.d.ts +13 -0
- package/dist/db/tables/diagram_notes.table.js +59 -0
- package/dist/db/tables/diagram_notes.table.js.map +1 -0
- package/dist/db/tables/index.d.ts +4 -0
- package/dist/db/tables/index.js +21 -0
- package/dist/db/tables/index.js.map +1 -0
- package/dist/db/tables/query_history.table.d.ts +11 -0
- package/dist/db/tables/query_history.table.js +54 -0
- package/dist/db/tables/query_history.table.js.map +1 -0
- package/dist/db/tables/saved_queries.table.d.ts +12 -0
- package/dist/db/tables/saved_queries.table.js +58 -0
- package/dist/db/tables/saved_queries.table.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/data.d.ts +9 -0
- package/dist/pages/data.js +29 -0
- package/dist/pages/data.js.map +1 -0
- package/dist/pages/index.d.ts +4 -0
- package/dist/pages/index.js +21 -0
- package/dist/pages/index.js.map +1 -0
- package/dist/pages/overview.d.ts +9 -0
- package/dist/pages/overview.js +29 -0
- package/dist/pages/overview.js.map +1 -0
- package/dist/pages/query.d.ts +9 -0
- package/dist/pages/query.js +29 -0
- package/dist/pages/query.js.map +1 -0
- package/dist/pages/schemas.d.ts +9 -0
- package/dist/pages/schemas.js +29 -0
- package/dist/pages/schemas.js.map +1 -0
- package/dist/routes/data.d.ts +25 -0
- package/dist/routes/data.js +324 -0
- package/dist/routes/data.js.map +1 -0
- package/dist/routes/diagram.d.ts +47 -0
- package/dist/routes/diagram.js +200 -0
- package/dist/routes/diagram.js.map +1 -0
- package/dist/routes/health.d.ts +6 -0
- package/dist/routes/health.js +35 -0
- package/dist/routes/health.js.map +1 -0
- package/dist/routes/index.d.ts +6 -0
- package/dist/routes/index.js +23 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/query.d.ts +26 -0
- package/dist/routes/query.js +245 -0
- package/dist/routes/query.js.map +1 -0
- package/dist/routes/schemas.d.ts +8 -0
- package/dist/routes/schemas.js +35 -0
- package/dist/routes/schemas.js.map +1 -0
- package/dist/routes/tables.d.ts +23 -0
- package/dist/routes/tables.js +94 -0
- package/dist/routes/tables.js.map +1 -0
- package/dist/service/fieldDescriptor.d.ts +66 -0
- package/dist/service/fieldDescriptor.js +156 -0
- package/dist/service/fieldDescriptor.js.map +1 -0
- package/dist/service/health.d.ts +20 -0
- package/dist/service/health.js +58 -0
- package/dist/service/health.js.map +1 -0
- package/dist/service/introspect.d.ts +6 -0
- package/dist/service/introspect.js +312 -0
- package/dist/service/introspect.js.map +1 -0
- package/dist/service/schemaLabels.d.ts +7 -0
- package/dist/service/schemaLabels.js +39 -0
- package/dist/service/schemaLabels.js.map +1 -0
- package/dist/service/schemaRegistry.d.ts +2 -0
- package/dist/service/schemaRegistry.js +8 -0
- package/dist/service/schemaRegistry.js.map +1 -0
- package/dist/service/stagedSerialization.d.ts +6 -0
- package/dist/service/stagedSerialization.js +54 -0
- package/dist/service/stagedSerialization.js.map +1 -0
- package/dist/service/types.d.ts +67 -0
- package/dist/service/types.js +3 -0
- package/dist/service/types.js.map +1 -0
- package/dist/types/constants.d.ts +3 -0
- package/dist/types/constants.js +7 -0
- package/dist/types/constants.js.map +1 -0
- package/dist/types/responses.d.ts +14 -0
- package/dist/types/responses.js +3 -0
- package/dist/types/responses.js.map +1 -0
- package/dist/utils/query.d.ts +17 -0
- package/dist/utils/query.js +116 -0
- package/dist/utils/query.js.map +1 -0
- package/dist/utils/requestValidation.d.ts +2 -0
- package/dist/utils/requestValidation.js +14 -0
- package/dist/utils/requestValidation.js.map +1 -0
- package/frontend-vue/.editorconfig +12 -0
- package/frontend-vue/.prettierrc +11 -0
- package/frontend-vue/app/components/DataBrowserSidebar.vue +254 -0
- package/frontend-vue/app/components/DataBrowserTabBar.vue +166 -0
- package/frontend-vue/app/components/DataGrid.vue +735 -0
- package/frontend-vue/app/components/DataGridCell.vue +147 -0
- package/frontend-vue/app/components/DataGridHeaderCell.vue +175 -0
- package/frontend-vue/app/components/DiagramNoteNode.vue +100 -0
- package/frontend-vue/app/components/DiagramRelationEdge.vue +62 -0
- package/frontend-vue/app/components/DiagramStubNode.vue +37 -0
- package/frontend-vue/app/components/DiagramTableNode.vue +94 -0
- package/frontend-vue/app/components/JsonCellPanel.vue +93 -0
- package/frontend-vue/app/components/QueryBuilderPanel.vue +501 -0
- package/frontend-vue/app/components/QueryFavoritesPanel.vue +127 -0
- package/frontend-vue/app/components/QueryHistoryPanel.vue +134 -0
- package/frontend-vue/app/components/QueryResultPanel.vue +204 -0
- package/frontend-vue/app/components/SchemaDiagram.vue +1150 -0
- package/frontend-vue/app/components/SchemaTableInspector.vue +278 -0
- package/frontend-vue/app/composables/useDataBrowserGrid.ts +162 -0
- package/frontend-vue/app/composables/useDataBrowserTabs.ts +255 -0
- package/frontend-vue/app/composables/useDatabaseHealth.ts +50 -0
- package/frontend-vue/app/composables/useDatabaseSchemas.ts +92 -0
- package/frontend-vue/app/composables/useDiagramPersistence.ts +99 -0
- package/frontend-vue/app/composables/useQueryRuntime.ts +118 -0
- package/frontend-vue/app/composables/useQueryStore.ts +117 -0
- package/frontend-vue/app/composables/useTableViewRowClick.ts +22 -0
- package/frontend-vue/app/custom-pages/database/data.vue +42 -0
- package/frontend-vue/app/custom-pages/database/overview.vue +367 -0
- package/frontend-vue/app/custom-pages/database/query.vue +432 -0
- package/frontend-vue/app/custom-pages/database/schemas.vue +216 -0
- package/frontend-vue/app/utils/databaseFieldModifiers.ts +33 -0
- package/frontend-vue/app/utils/databaseFieldTypeIcons.ts +224 -0
- package/frontend-vue/app/utils/dmsTableView.ts +83 -0
- package/frontend-vue/app/utils/relativeTime.ts +15 -0
- package/frontend-vue/app/utils/stagedSerialization.ts +91 -0
- package/frontend-vue/dms.frontend.ts +38 -0
- package/frontend-vue/eslint.config.mjs +16 -0
- package/frontend-vue/i18n/locales/database-en-GB.json +239 -0
- package/frontend-vue/i18n/locales/database-fr-FR.json +239 -0
- package/frontend-vue/package.json +42 -0
- package/frontend-vue/pnpm-lock.yaml +5819 -0
- package/frontend-vue/pnpm-workspace.yaml +2 -0
- package/frontend-vue/tests/persistence.test.ts +70 -0
- package/frontend-vue/tests/queryRuntime.test.ts +53 -0
- package/frontend-vue/tests/registration.test.ts +33 -0
- package/frontend-vue/tsconfig.json +13 -0
- package/frontend-vue/vitest.config.ts +5 -0
- package/package.json +78 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { afterEach, expect, it, vi } from 'vitest'
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
import { useDataBrowserTabs } from '../app/composables/useDataBrowserTabs'
|
|
4
|
+
|
|
5
|
+
afterEach(() => vi.unstubAllGlobals())
|
|
6
|
+
|
|
7
|
+
function setup() {
|
|
8
|
+
vi.stubGlobal('useDmsState', (_key: string, init: () => unknown) =>
|
|
9
|
+
ref(init()),
|
|
10
|
+
)
|
|
11
|
+
vi.stubGlobal('computed', computed)
|
|
12
|
+
vi.stubGlobal('useDmsRoute', () => ({ query: {} }))
|
|
13
|
+
vi.stubGlobal('useDmsRouter', () => ({ replace: vi.fn() }))
|
|
14
|
+
vi.stubGlobal('useDataBrowserGrid', () => ({ drop: vi.fn() }))
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
it('restores browser session tabs and persists a new permanent tab', () => {
|
|
18
|
+
setup()
|
|
19
|
+
const setItem = vi.fn()
|
|
20
|
+
vi.stubGlobal('window', {
|
|
21
|
+
sessionStorage: {
|
|
22
|
+
getItem: () =>
|
|
23
|
+
JSON.stringify({
|
|
24
|
+
tabs: [{ schema: 'sales', instance: 'eu', table: 'orders' }],
|
|
25
|
+
activeId: null,
|
|
26
|
+
}),
|
|
27
|
+
setItem,
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
const browser = useDataBrowserTabs()
|
|
31
|
+
browser.restore()
|
|
32
|
+
expect(browser.activeId.value).toBe('sales::eu::orders')
|
|
33
|
+
browser.openTab('audit', 'us', 'events', false)
|
|
34
|
+
expect(browser.tabs.value.map((tab) => tab.id)).toEqual([
|
|
35
|
+
'sales::eu::orders',
|
|
36
|
+
'audit::us::events',
|
|
37
|
+
])
|
|
38
|
+
const [key, payload] = setItem.mock.lastCall!
|
|
39
|
+
expect(key).toBe('dms-database:data-browser:tabs')
|
|
40
|
+
expect(JSON.parse(payload).activeId).toBe('audit::us::events')
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('retains usable tabs when session storage is unavailable', () => {
|
|
44
|
+
setup()
|
|
45
|
+
const deny = () => {
|
|
46
|
+
throw new Error('Storage denied')
|
|
47
|
+
}
|
|
48
|
+
vi.stubGlobal('window', { sessionStorage: { getItem: deny, setItem: deny } })
|
|
49
|
+
const browser = useDataBrowserTabs()
|
|
50
|
+
browser.restore()
|
|
51
|
+
browser.openTab('sales', 'eu', 'orders', false)
|
|
52
|
+
expect(browser.activeId.value).toBe('sales::eu::orders')
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('does not revisit an already selected deep link while restoring tabs', () => {
|
|
56
|
+
setup()
|
|
57
|
+
const replace = vi.fn()
|
|
58
|
+
vi.stubGlobal('useDmsRouter', () => ({ replace }))
|
|
59
|
+
vi.stubGlobal('useDmsRoute', () => ({
|
|
60
|
+
query: { schema: 'sales', table: 'orders', instance: 'eu', panel: 'detail' },
|
|
61
|
+
}))
|
|
62
|
+
const browser = useDataBrowserTabs()
|
|
63
|
+
browser.restore()
|
|
64
|
+
expect(browser.activeId.value).toBe('sales::eu::orders')
|
|
65
|
+
expect(replace).not.toHaveBeenCalled()
|
|
66
|
+
browser.openTab('sales', 'us', 'orders', false)
|
|
67
|
+
expect(replace).toHaveBeenCalledExactlyOnceWith({
|
|
68
|
+
query: { schema: 'sales', table: 'orders', instance: 'us', panel: 'detail' },
|
|
69
|
+
})
|
|
70
|
+
})
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { expect, it } from 'vitest'
|
|
2
|
+
import type { SchemaSummary } from '../app/composables/useDatabaseSchemas'
|
|
3
|
+
import { prepareQueryPayload } from '../app/composables/useQueryRuntime'
|
|
4
|
+
|
|
5
|
+
const schema: SchemaSummary = {
|
|
6
|
+
id: 'parity',
|
|
7
|
+
options: {},
|
|
8
|
+
tables: [
|
|
9
|
+
{
|
|
10
|
+
name: 'posts',
|
|
11
|
+
fields: {},
|
|
12
|
+
indexes: {},
|
|
13
|
+
relations: [],
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
stats: { tableCount: 1, elementCount: 57, instanceCount: 1 },
|
|
17
|
+
instances: ['default'],
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
it('serializes a staged browser query without execution methods', () => {
|
|
21
|
+
const prepared = prepareQueryPayload(
|
|
22
|
+
'schemas.parity.instance("default").table("posts").slice(0, 10)',
|
|
23
|
+
[schema],
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
expect(prepared).toEqual({
|
|
27
|
+
source: 'schemas.parity.instance("default").table("posts").slice(0, 10)',
|
|
28
|
+
hasMutations: false,
|
|
29
|
+
query: {
|
|
30
|
+
__cls: 'Table',
|
|
31
|
+
stages: [
|
|
32
|
+
{ stage: 'schema', options: { id: 'parity' }, args: [] },
|
|
33
|
+
{
|
|
34
|
+
stage: 'instance',
|
|
35
|
+
options: { id: 'default' },
|
|
36
|
+
args: [],
|
|
37
|
+
},
|
|
38
|
+
{ stage: 'table', options: { id: 'posts' }, args: [] },
|
|
39
|
+
{ stage: 'slice', args: [0, 10] },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it('marks staged mutations for confirmation', () => {
|
|
46
|
+
const prepared = prepareQueryPayload(
|
|
47
|
+
'schemas.parity.instance("default").table("posts").get("post-000").update({ title: "Changed" })',
|
|
48
|
+
[schema],
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
expect(prepared.hasMutations).toBe(true)
|
|
52
|
+
expect(prepared.query.__cls).toBe('Query')
|
|
53
|
+
})
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { expect, it, vi } from 'vitest'
|
|
2
|
+
import frontendModule from '../dms.frontend'
|
|
3
|
+
|
|
4
|
+
it('preserves all database page keys, component aliases and preloaders', async () => {
|
|
5
|
+
const registerComponent = vi.fn()
|
|
6
|
+
const registerPage = vi.fn()
|
|
7
|
+
await frontendModule.setup({
|
|
8
|
+
options: { public: {} },
|
|
9
|
+
registerComponent,
|
|
10
|
+
registerPage,
|
|
11
|
+
registerDynamicPage: vi.fn(),
|
|
12
|
+
registerLayout: vi.fn(),
|
|
13
|
+
registerErrorPage: vi.fn(),
|
|
14
|
+
registerPlugin: vi.fn(),
|
|
15
|
+
registerMiddleware: vi.fn(),
|
|
16
|
+
provide: vi.fn(),
|
|
17
|
+
use: vi.fn(),
|
|
18
|
+
})
|
|
19
|
+
expect(registerPage.mock.calls.map(([name]) => name)).toEqual([
|
|
20
|
+
'database/data',
|
|
21
|
+
'database/overview',
|
|
22
|
+
'database/query',
|
|
23
|
+
'database/schemas',
|
|
24
|
+
])
|
|
25
|
+
for (const [name, component, preload] of registerPage.mock.calls) {
|
|
26
|
+
const alias = `DmsDatabase${name.split('/')[1].replace(/^./, (character: string) => character.toUpperCase())}`
|
|
27
|
+
expect(registerComponent).toHaveBeenCalledWith(alias, component)
|
|
28
|
+
expect(preload).toBeTypeOf('function')
|
|
29
|
+
}
|
|
30
|
+
const names = registerComponent.mock.calls.map(([name]) => name)
|
|
31
|
+
expect(names).toContain('DmsDatabaseDataGrid')
|
|
32
|
+
expect(new Set(names).size).toBe(names.length)
|
|
33
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"types": ["vite/client"],
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"skipLibCheck": true
|
|
11
|
+
},
|
|
12
|
+
"include": ["**/*.ts", "**/*.vue"]
|
|
13
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@antelopejs/dms-database",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/AntelopeJS/dms-database.git"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"!dist/test",
|
|
12
|
+
"frontend-vue"
|
|
13
|
+
],
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"types": "dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public",
|
|
25
|
+
"provenance": true,
|
|
26
|
+
"registry": "https://registry.npmjs.org/"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@antelopejs/interface-api": ">=0.0.13 <1.0.0",
|
|
30
|
+
"@antelopejs/interface-api-util": ">=0.1.2 <1.0.0",
|
|
31
|
+
"@antelopejs/interface-core": ">=0.0.12 <1.0.0",
|
|
32
|
+
"@antelopejs/interface-database": ">=0.1.7 <1.0.0",
|
|
33
|
+
"@antelopejs/interface-database-decorators": ">=0.1.6 <1.0.0",
|
|
34
|
+
"@antelopejs/interface-dms": ">=0.0.1 <1.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@antelopejs/core": "^1.4.11",
|
|
38
|
+
"@antelopejs/tooling-configs": "^0.0.4",
|
|
39
|
+
"@types/chai": "^5.2.3",
|
|
40
|
+
"@types/mocha": "^10.0.10",
|
|
41
|
+
"@types/node": "^24.0.0",
|
|
42
|
+
"@types/semver": "^7.8.0",
|
|
43
|
+
"chai": "^6.2.2",
|
|
44
|
+
"knip": "^6.34.0",
|
|
45
|
+
"mocha": "^12.0.0",
|
|
46
|
+
"mongodb-memory-server-core": "^11.2.0",
|
|
47
|
+
"oxfmt": "^0.66.0",
|
|
48
|
+
"oxlint": "1.81.0",
|
|
49
|
+
"oxlint-tsgolint": "^7.0.2001",
|
|
50
|
+
"release-it": "^19.2.4",
|
|
51
|
+
"release-it-changelogen": "^0.1.0",
|
|
52
|
+
"rimraf": "^6.1.3",
|
|
53
|
+
"typescript": "^5.9.3"
|
|
54
|
+
},
|
|
55
|
+
"optionalDependencies": {
|
|
56
|
+
"@antelopejs/interface-dms-automation": ">=0.0.1 <1.0.0"
|
|
57
|
+
},
|
|
58
|
+
"antelopeJs": {
|
|
59
|
+
"baseUrl": "dist",
|
|
60
|
+
"implements": [],
|
|
61
|
+
"test": "src/test/harness.ts"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "rimraf dist && tsc -p tsconfig.build.json",
|
|
65
|
+
"dev:frontend": "pnpm frontend:dev",
|
|
66
|
+
"dev": "ajs project run -w -p playground",
|
|
67
|
+
"generate": "ajs module exports generate",
|
|
68
|
+
"lint:fix": "oxlint --fix --max-warnings=1000000 && oxfmt . && pnpm --dir frontend-vue lint:fix",
|
|
69
|
+
"lint": "oxlint && oxfmt --check . && pnpm --dir frontend-vue lint",
|
|
70
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
71
|
+
"format": "oxfmt . && pnpm --dir frontend-vue format",
|
|
72
|
+
"frontend:dev": "cd playground && pnpm frontend:dev",
|
|
73
|
+
"test": "pnpm run build && ajs module test .",
|
|
74
|
+
"release": "pnpm --dir frontend-vue install --frozen-lockfile && release-it",
|
|
75
|
+
"knip": "knip --dependencies",
|
|
76
|
+
"knip:all": "knip"
|
|
77
|
+
}
|
|
78
|
+
}
|