dzql 0.1.0-alpha.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/package.json +65 -0
- package/src/client/ui-configs/sample-2.js +207 -0
- package/src/client/ui-loader.js +618 -0
- package/src/client/ui.js +990 -0
- package/src/client/ws.js +352 -0
- package/src/client.js +9 -0
- package/src/database/migrations/001_schema.sql +59 -0
- package/src/database/migrations/002_functions.sql +742 -0
- package/src/database/migrations/003_operations.sql +725 -0
- package/src/database/migrations/004_search.sql +505 -0
- package/src/database/migrations/005_entities.sql +511 -0
- package/src/database/migrations/006_auth.sql +83 -0
- package/src/database/migrations/007_events.sql +136 -0
- package/src/database/migrations/008_hello.sql +18 -0
- package/src/database/migrations/008a_meta.sql +165 -0
- package/src/index.js +19 -0
- package/src/server/api.js +9 -0
- package/src/server/db.js +261 -0
- package/src/server/index.js +141 -0
- package/src/server/logger.js +246 -0
- package/src/server/mcp.js +594 -0
- package/src/server/meta-route.js +251 -0
- package/src/server/ws.js +464 -0
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dzql",
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"description": "PostgreSQL-powered framework with zero boilerplate CRUD operations and real-time WebSocket synchronization",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/server/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/server/index.js",
|
|
9
|
+
"./client": "./src/client/ws.js",
|
|
10
|
+
"./server": "./src/server/index.js",
|
|
11
|
+
"./db": "./src/server/db.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"src/**/*.js",
|
|
15
|
+
"src/database/migrations/**/*.sql",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "bun test",
|
|
21
|
+
"prepublishOnly": "echo '⚠️ Publishing DZQL alpha release...'"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"jose": "^6.1.0",
|
|
25
|
+
"postgres": "^3.4.7"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"postgresql",
|
|
29
|
+
"postgres",
|
|
30
|
+
"websocket",
|
|
31
|
+
"real-time",
|
|
32
|
+
"realtime",
|
|
33
|
+
"crud",
|
|
34
|
+
"api",
|
|
35
|
+
"framework",
|
|
36
|
+
"zero-boilerplate",
|
|
37
|
+
"database",
|
|
38
|
+
"bun",
|
|
39
|
+
"graph-rules",
|
|
40
|
+
"permissions",
|
|
41
|
+
"row-level-security",
|
|
42
|
+
"rls",
|
|
43
|
+
"notify",
|
|
44
|
+
"listen",
|
|
45
|
+
"subscriptions"
|
|
46
|
+
],
|
|
47
|
+
"author": "Peter Bunyan",
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "https://github.com/blueshed/dzql",
|
|
52
|
+
"directory": "packages/dzql"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/blueshed/dzql/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/blueshed/dzql#readme",
|
|
58
|
+
"engines": {
|
|
59
|
+
"bun": ">=1.0.0"
|
|
60
|
+
},
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public",
|
|
63
|
+
"tag": "alpha"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
// Rights Management UI Configuration
|
|
2
|
+
export const uiConfig = {
|
|
3
|
+
type: 'container',
|
|
4
|
+
class: 'app',
|
|
5
|
+
children: [
|
|
6
|
+
// Header
|
|
7
|
+
{
|
|
8
|
+
type: 'div',
|
|
9
|
+
class: 'header',
|
|
10
|
+
children: [
|
|
11
|
+
{ type: 'h1', text: '🏛️ Rights Management' },
|
|
12
|
+
{ type: 'p', text: 'Manage venues, packages, and contractor rights' },
|
|
13
|
+
{
|
|
14
|
+
type: 'span',
|
|
15
|
+
class: '${state.wsStatus === "connected" ? "status connected" : "status disconnected"}',
|
|
16
|
+
text: '${state.wsStatus || "disconnected"}'
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
// Navigation tabs
|
|
22
|
+
{
|
|
23
|
+
type: 'div',
|
|
24
|
+
class: 'nav-bar',
|
|
25
|
+
children: [{
|
|
26
|
+
type: 'div',
|
|
27
|
+
class: 'nav-tabs',
|
|
28
|
+
children: [
|
|
29
|
+
'dashboard', 'organisations', 'venues', 'packages', 'allocations', 'rights'
|
|
30
|
+
].map(tab => ({
|
|
31
|
+
type: 'button',
|
|
32
|
+
class: '${state.activeTab === "' + tab + '" ? "tab active" : "tab"}',
|
|
33
|
+
text: tab.charAt(0).toUpperCase() + tab.slice(1),
|
|
34
|
+
onClick: {
|
|
35
|
+
actions: [
|
|
36
|
+
{ type: 'setState', path: 'activeTab', value: tab },
|
|
37
|
+
tab !== 'dashboard' ? {
|
|
38
|
+
type: 'call',
|
|
39
|
+
operation: 'search',
|
|
40
|
+
entity: tab === 'rights' ? 'contractor_rights' : tab,
|
|
41
|
+
params: { limit: 25 },
|
|
42
|
+
resultPath: tab + '.list'
|
|
43
|
+
} : null
|
|
44
|
+
].filter(Boolean)
|
|
45
|
+
}
|
|
46
|
+
}))
|
|
47
|
+
}]
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
// Content area
|
|
51
|
+
{
|
|
52
|
+
type: 'div',
|
|
53
|
+
class: 'content',
|
|
54
|
+
children: [
|
|
55
|
+
// Dashboard
|
|
56
|
+
{
|
|
57
|
+
type: 'if',
|
|
58
|
+
condition: "${state.activeTab === 'dashboard'}",
|
|
59
|
+
then: {
|
|
60
|
+
type: 'section',
|
|
61
|
+
children: [
|
|
62
|
+
{ type: 'h2', text: 'Dashboard' },
|
|
63
|
+
{
|
|
64
|
+
type: 'div',
|
|
65
|
+
class: 'grid',
|
|
66
|
+
children: ['venues', 'packages', 'allocations', 'organisations'].map(entity => ({
|
|
67
|
+
type: 'div',
|
|
68
|
+
class: 'card',
|
|
69
|
+
children: [
|
|
70
|
+
{ type: 'h3', text: entity.charAt(0).toUpperCase() + entity.slice(1) },
|
|
71
|
+
{ type: 'div', class: 'stat-value', text: '${state.stats?.' + entity + ' || "..."}' },
|
|
72
|
+
{ type: 'div', class: 'stat-label', text: 'Total ' + entity }
|
|
73
|
+
]
|
|
74
|
+
}))
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
// Entity views (organisations, venues, packages, allocations)
|
|
81
|
+
...['organisations', 'venues', 'packages', 'allocations'].map(entity => ({
|
|
82
|
+
type: 'if',
|
|
83
|
+
condition: "${state.activeTab === '" + entity + "'}",
|
|
84
|
+
then: {
|
|
85
|
+
type: 'section',
|
|
86
|
+
children: [
|
|
87
|
+
{ type: 'h2', text: entity.charAt(0).toUpperCase() + entity.slice(1) },
|
|
88
|
+
{
|
|
89
|
+
type: 'div',
|
|
90
|
+
class: 'search-bar',
|
|
91
|
+
children: [
|
|
92
|
+
{
|
|
93
|
+
type: 'input',
|
|
94
|
+
bind: '${state.' + entity + '.search}',
|
|
95
|
+
attributes: { placeholder: 'Search ' + entity + '...' }
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
type: 'button',
|
|
99
|
+
text: 'Search',
|
|
100
|
+
onClick: {
|
|
101
|
+
actions: [{
|
|
102
|
+
type: 'call',
|
|
103
|
+
operation: 'search',
|
|
104
|
+
entity: entity,
|
|
105
|
+
params: {
|
|
106
|
+
filters: { _search: '${state.' + entity + '.search}' },
|
|
107
|
+
limit: 25
|
|
108
|
+
},
|
|
109
|
+
resultPath: entity + '.list'
|
|
110
|
+
}]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
type: 'if',
|
|
117
|
+
condition: '${state.' + entity + '.list}',
|
|
118
|
+
then: {
|
|
119
|
+
type: 'table',
|
|
120
|
+
data: '${state.' + entity + '.list.data}',
|
|
121
|
+
columns: getColumnsForEntity(entity)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
})),
|
|
127
|
+
|
|
128
|
+
// Rights view
|
|
129
|
+
{
|
|
130
|
+
type: 'if',
|
|
131
|
+
condition: "${state.activeTab === 'rights'}",
|
|
132
|
+
then: {
|
|
133
|
+
type: 'section',
|
|
134
|
+
children: [
|
|
135
|
+
{ type: 'h2', text: 'Rights Management' },
|
|
136
|
+
{
|
|
137
|
+
type: 'div',
|
|
138
|
+
class: 'pill-nav',
|
|
139
|
+
children: ['contractor', 'promotion'].map(type => ({
|
|
140
|
+
type: 'button',
|
|
141
|
+
class: '${state.rightsType === "' + type + '" ? "pill active" : "pill"}',
|
|
142
|
+
text: type.charAt(0).toUpperCase() + type.slice(1) + ' Rights',
|
|
143
|
+
onClick: {
|
|
144
|
+
actions: [
|
|
145
|
+
{ type: 'setState', path: 'rightsType', value: type },
|
|
146
|
+
{
|
|
147
|
+
type: 'call',
|
|
148
|
+
operation: 'search',
|
|
149
|
+
entity: type + '_rights',
|
|
150
|
+
params: { limit: 25 },
|
|
151
|
+
resultPath: 'rights.' + type
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
}))
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
type: 'if',
|
|
159
|
+
condition: '${state.rights.contractor}',
|
|
160
|
+
then: {
|
|
161
|
+
type: 'table',
|
|
162
|
+
data: '${state.rights.contractor.data}',
|
|
163
|
+
columns: [
|
|
164
|
+
{ field: 'contractor_org.name', label: 'Contractor' },
|
|
165
|
+
{ field: 'venue.name', label: 'Venue' },
|
|
166
|
+
{ field: 'valid_from', label: 'From' },
|
|
167
|
+
{ field: 'valid_to', label: 'To' }
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
// Helper function for table columns
|
|
180
|
+
function getColumnsForEntity(entity) {
|
|
181
|
+
const columnSets = {
|
|
182
|
+
organisations: [
|
|
183
|
+
{ field: 'id', label: 'ID' },
|
|
184
|
+
{ field: 'name', label: 'Name' },
|
|
185
|
+
{ field: 'description', label: 'Description' }
|
|
186
|
+
],
|
|
187
|
+
venues: [
|
|
188
|
+
{ field: 'id', label: 'ID' },
|
|
189
|
+
{ field: 'name', label: 'Name' },
|
|
190
|
+
{ field: 'address', label: 'Address' },
|
|
191
|
+
{ field: 'org.name', label: 'Organisation' }
|
|
192
|
+
],
|
|
193
|
+
packages: [
|
|
194
|
+
{ field: 'id', label: 'ID' },
|
|
195
|
+
{ field: 'name', label: 'Name' },
|
|
196
|
+
{ field: 'owner.name', label: 'Owner' },
|
|
197
|
+
{ field: 'sponsor.name', label: 'Sponsor' }
|
|
198
|
+
],
|
|
199
|
+
allocations: [
|
|
200
|
+
{ field: 'id', label: 'ID' },
|
|
201
|
+
{ field: 'package.name', label: 'Package' },
|
|
202
|
+
{ field: 'site.name', label: 'Site' },
|
|
203
|
+
{ field: 'from_datetime', label: 'From' }
|
|
204
|
+
]
|
|
205
|
+
};
|
|
206
|
+
return columnSets[entity] || [];
|
|
207
|
+
}
|