Skip to content

Commit fb1f231

Browse files
committed
llm friendly docs: add FAQs
1 parent c4b66e4 commit fb1f231

File tree

4 files changed

+415
-2
lines changed

4 files changed

+415
-2
lines changed

dashjoin-docs/docs/appendix-configurations.md

Lines changed: 128 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ a query on database 'dj/northwind' called 'group', executable for the 'authentic
1111
}
1212
```
1313
## query catalog
14-
a query on database 'dj/northwind' called 'list'. Parameters limit and offset can be passed to the query
14+
a query on database 'northwind' called 'list'. Parameters limit and offset can be passed to the query
1515
```json
1616
{
1717
"ID" : "list",
@@ -30,6 +30,16 @@ a query on database 'dj/northwind' called 'list'. Parameters limit and offset ca
3030
}
3131
}
3232
```
33+
## query catalog: stored procedure
34+
stored procedure 'sp' on database 'postgres' called with parameter 'test'
35+
```json
36+
{
37+
"ID" : "sp",
38+
"database" : "dj/postgres",
39+
"query" : "CALL my_sp('test')",
40+
"type" : "read"
41+
}
42+
```
3343
## database definition
3444
postgres database connection information with encrypted password
3545
```json
@@ -42,6 +52,94 @@ postgres database connection information with encrypted password
4252
"password" : "DJ1#\b/gbzX8DDZa1lVaiLat0HdX9cDST2KHJk"
4353
}
4454
```
55+
## database definition with audit log
56+
sqlite database definition. The before-update trigger is called accordingly and logs an audit record to the table audit
57+
```json
58+
{
59+
"name" : "sqlite",
60+
"ID" : "dj/sqlite",
61+
"djClassName" : "org.dashjoin.service.SQLDatabase",
62+
"url" : "jdbc:sqlite:dashjoin-demo.db",
63+
"tables" : {
64+
"REQUESTS" : {
65+
"before-update" : "$create('db', 'audit', {'timestamp': $now(), 'user': user, 'operation': command, 'payload': object})"
66+
}
67+
}
68+
}
69+
```
70+
## database definition with initial create table
71+
sqlite database definition with init script that contains: CREATE TABLE IF NOT EXISTS MY_TABLE(ID INT PRIMARY KEY, NAME VARCHAR(255))
72+
```json
73+
{
74+
"name" : "sqlite",
75+
"ID" : "dj/sqlite",
76+
"djClassName" : "org.dashjoin.service.SQLDatabase",
77+
"url" : "jdbc:sqlite:dashjoin-demo.db",
78+
"initScripts" : [ "upload/init.sql" ]
79+
}
80+
```
81+
## database definition with foreign key
82+
sqlite database definition with a foreign key pointing to the CUSTOMERS table in the northwind database
83+
```json
84+
{
85+
"name" : "sqlite",
86+
"ID" : "dj/sqlite",
87+
"djClassName" : "org.dashjoin.service.SQLDatabase",
88+
"url" : "jdbc:sqlite:dashjoin-demo.db",
89+
"tables" : {
90+
"REQUESTS" : {
91+
"properties" : {
92+
"customer" : {
93+
"ref" : "dj/northwind/CUSTOMERS/CUSTOMER_ID",
94+
"displayWith" : "fk"
95+
}
96+
}
97+
}
98+
}
99+
}
100+
```
101+
## database definition with foreign key array
102+
postgres database definition with an array of foreign keys pointing to the CUSTOMERS table in the northwind database
103+
```json
104+
{
105+
"name" : "postgres",
106+
"djClassName" : "org.dashjoin.service.SQLDatabase",
107+
"username" : "postgres",
108+
"password" : "DJ1#\bApQHRIfZwu6WSIJrlI2aBqbMhnLRPlsg",
109+
"url" : "jdbc:postgresql://localhost:5432/postgres",
110+
"ID" : "dj/postgres",
111+
"tables" : {
112+
"test" : {
113+
"properties" : {
114+
"arr" : {
115+
"type" : "array",
116+
"items" : {
117+
"ref" : "dj/northwind/CUSTOMERS/CUSTOMER_ID",
118+
"type" : "string",
119+
"displayWith" : "fk"
120+
}
121+
}
122+
}
123+
}
124+
}
125+
}
126+
```
127+
## database definition with record label
128+
EMPLOYEES table defines the record label to be the LAST_NAME. All links and page titles for EMPLOYEE records use the LAST_NAME column as labels
129+
```json
130+
{
131+
"ID" : "dj/northwind",
132+
"name" : "northwind",
133+
"parent" : "dj",
134+
"djClassName" : "org.dashjoin.service.SQLDatabase",
135+
"url" : "jdbc:h2:mem:northwind",
136+
"tables" : {
137+
"EMPLOYEES" : {
138+
"dj-label" : "${LAST_NAME}"
139+
}
140+
}
141+
}
142+
```
45143
## Function catalog: Invoke
46144
Function that adds two numbers passed in the argument object. It can be called via $call('add') or via REST
47145
```json
@@ -280,3 +378,32 @@ Query timeout in milliseconds for queries issued when browsing data. To disable
280378
"integer" : 1000
281379
}
282380
```
381+
## tenantusers
382+
user@example.org is allowed (active) on the platform and is in the role 'authenticated'
383+
```json
384+
{
385+
"ID" : "user@example.org",
386+
"active" : true,
387+
"roles" : [ "authenticated" ]
388+
}
389+
```
390+
## tenantusers
391+
Sets the 'homepage' variable (the initial page after login) to '/page/test' for user@example.org (overrides the global and role setting for 'homepage')
392+
```json
393+
{
394+
"ID" : "user@example.org",
395+
"properties" : {
396+
"homepage" : "/page/test"
397+
}
398+
}
399+
```
400+
## dj-role
401+
defines the role 'admin'. Sets the 'homepage' variable (the initial page after login) is set to '/page/Info' for all users in this role (overrides the global setting 'homepage')
402+
```json
403+
{
404+
"ID" : "admin",
405+
"properties" : {
406+
"homepage" : "/page/Info"
407+
}
408+
}
409+
```

dashjoin-docs/docs/appendix-widgets.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,14 @@ shows how a display widget is added on a table page
111111
}
112112
}
113113
```
114+
## display widget with JSON keys containing special characters
115+
SQL queries create JSON with field names 'table.column'. In JSONata, enclose the field name in backticks (`)
116+
```json
117+
{
118+
"display" : "$adHocQuery('sqlite', 'select ID from REQUESTS').`REQUESTS.ID`",
119+
"widget" : "display"
120+
}
121+
```
114122
## card widget
115123
The card widget shows its children within a card
116124
```json
@@ -199,6 +207,68 @@ shows a button to trigger an action with an optional set of inputs. This example
199207
}
200208
}
201209
```
210+
## button widget: Dynamically compute form fields
211+
schemaExpression is an expression that computes JSON Schema which in turn defines the form fields dynamically
212+
```json
213+
{
214+
"schemaExpression" : "{'properties':{'name': {'type':'string'}}}",
215+
"print" : "form.name",
216+
"widget" : "button"
217+
}
218+
```
219+
## button widget: show a form field conditionally
220+
schemaExpression is an expression that computes JSON Schema which in turn defines the form fields dynamically: The 'type' field is defined as the switch. Other fields can specify 'case' with the type value of when they are shown
221+
```json
222+
{
223+
"widget" : "button",
224+
"print" : "form",
225+
"schemaExpression" : "{'switch':'type', 'properties': {'type': {'widget': 'select', 'options':'[\"circle\"]'}, 'radius': {'case': 'circle'}}}"
226+
}
227+
```
228+
## button widget: computing select options
229+
The button form has a select field to input 'id'. The select options are computed from the database
230+
```json
231+
{
232+
"widget" : "button",
233+
"print" : "form.field",
234+
"schema" : {
235+
"type" : "object",
236+
"properties" : {
237+
"id" : {
238+
"widget" : "select",
239+
"options" : "$all('northwind', 'EMPLOYEES').{'value':EMPLOYEE_ID, 'name': LAST_NAME}"
240+
}
241+
}
242+
}
243+
}
244+
```
245+
## button widget: JavaScript expressions
246+
Expressions that start with // JavaScript can use JavaScript. This example triggers a file download
247+
```json
248+
{
249+
"widget" : "button",
250+
"print" : "// JavaScript\nvar blob = new Blob(['Hello, world!'], {type: 'text/plain;charset=utf-8'});\nsaveAs(blob, 'hello world.txt');"
251+
}
252+
```
253+
print
254+
```
255+
// JavaScript
256+
var blob = new Blob(['Hello, world!'], {type: 'text/plain;charset=utf-8'});
257+
saveAs(blob, 'hello world.txt');
258+
```
259+
## button widget: JavaScript expressions
260+
Expressions that start with // JavaScript can use JavaScript. This example calls the $read() function and returns the result
261+
```json
262+
{
263+
"widget" : "button",
264+
"print" : "// JavaScript\nreturn await read('sqlite', 'REQUESTS', 1)"
265+
}
266+
```
267+
print
268+
```
269+
// JavaScript
270+
return await read('sqlite', 'REQUESTS', 1)
271+
```
202272
## create widget
203273
Shows a form on the database table page to create a new database record
204274
```json

dashjoin-docs/llms/widget.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@
120120
}
121121
}
122122
}
123+
},
124+
{
125+
"title": "display widget with JSON keys containing special characters",
126+
"description": "SQL queries create JSON with field names 'table.column'. In JSONata, enclose the field name in backticks (`)",
127+
"code": {
128+
"display": "$adHocQuery('sqlite', 'select ID from REQUESTS').`REQUESTS.ID`",
129+
"widget": "display"
130+
}
123131
}
124132
],
125133
"card": [
@@ -456,6 +464,24 @@
456464
"arguments": "",
457465
"widget": "chart"
458466
}
467+
},
468+
{
469+
"title": "chart widget",
470+
"description": "chart with style options (see ChartJS)",
471+
"code": {
472+
"widget": "chart",
473+
"query": "orders-over-time",
474+
"database": "northwind",
475+
"chart": "bar",
476+
"style": {
477+
"elements.bar.backgroundColor": "green",
478+
"plugins.title.text": "Orders in February",
479+
"plugins.title.display": "true",
480+
"scales.x.type": "time",
481+
"scales.x.min": "1998-02-01",
482+
"scales.x.max": "1998-02-28"
483+
}
484+
}
459485
}
460486
],
461487
"datagrid": [

0 commit comments

Comments
 (0)