pgkiln 0.48.0 → 0.50.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.
Files changed (63) hide show
  1. package/SECURITY.md +3 -2
  2. package/db/migrations/116_dump_jobs.sql +41 -0
  3. package/db/migrations/117_rest_handlers.sql +63 -0
  4. package/db/migrations/118_change_log.sql +54 -0
  5. package/docs/apex-feature-parity.md +9 -9
  6. package/docs/guide/01-installation.md +7 -0
  7. package/docs/guide/03-builder.md +227 -10
  8. package/docs/guide/08-security.md +11 -0
  9. package/docs/guide/12-development.md +64 -13
  10. package/docs/guide/13-rest-api.md +59 -1
  11. package/docs/guide/15-extensions.md +1 -1
  12. package/examples/hr/hr_62_rest_module.sql +39 -0
  13. package/package.json +1 -1
  14. package/public/app.css +1 -1
  15. package/public/builder-icons.svg +2 -0
  16. package/public/builder.css +478 -173
  17. package/public/builder.js +48 -0
  18. package/public/code-editor.css +32 -79
  19. package/public/code-editor.js +58 -3
  20. package/public/data-modeler.css +17 -14
  21. package/public/sql-monitor.js +73 -0
  22. package/public/worksheet.css +14 -7
  23. package/public/worksheet.js +119 -3
  24. package/src/app.ts +6 -0
  25. package/src/automations.ts +6 -0
  26. package/src/binds.ts +2 -1
  27. package/src/builder/advisor.ts +24 -2
  28. package/src/builder/autorest.ts +3 -2
  29. package/src/builder/changelog.ts +240 -0
  30. package/src/builder/components.ts +1 -1
  31. package/src/builder/data-modeler.ts +1 -1
  32. package/src/builder/datapump.ts +364 -0
  33. package/src/builder/db-users.ts +2 -2
  34. package/src/builder/ddl-tools.ts +13 -4
  35. package/src/builder/find-workspace.ts +2 -2
  36. package/src/builder/object-browser.ts +4 -4
  37. package/src/builder/plan-view.ts +25 -0
  38. package/src/builder/querybuilder.ts +1 -1
  39. package/src/builder/quicksql.ts +1 -1
  40. package/src/builder/rest-modules.ts +629 -0
  41. package/src/builder/rest.ts +1 -0
  42. package/src/builder/routes.ts +4 -2
  43. package/src/builder/scheduling.ts +495 -0
  44. package/src/builder/scripts.ts +1 -1
  45. package/src/builder/sql-charts.ts +1 -1
  46. package/src/builder/sql-monitor.ts +397 -0
  47. package/src/builder/sql-tools.ts +6 -2
  48. package/src/builder/sql-utilities.ts +7 -39
  49. package/src/builder/sql.ts +6 -0
  50. package/src/builder/table-editor.ts +6 -3
  51. package/src/builder/top-sql.ts +24 -6
  52. package/src/builder/ui.ts +6 -4
  53. package/src/builder/worksheet.ts +173 -41
  54. package/src/changelog.ts +109 -0
  55. package/src/cron-schedule.ts +282 -0
  56. package/src/datapump.ts +546 -0
  57. package/src/dumpscript.ts +407 -0
  58. package/src/pgcron.ts +225 -0
  59. package/src/runtime/rest-handlers.ts +75 -0
  60. package/src/runtime/rest.ts +116 -22
  61. package/src/session.ts +5 -0
  62. package/src/sqlworksheet.ts +9 -6
  63. package/src/worksheet-txn.ts +270 -0
@@ -0,0 +1,39 @@
1
+ -- =====================================================================
2
+ -- HR example, part 62: a REST module built in SQL Workshop › RESTful
3
+ -- Services (sprint 104; docs/guide/13-rest-api.md → Modules, templates
4
+ -- and handlers). Module "hr" at /a/hr/rest/hr/, with a token from
5
+ -- App › REST API:
6
+ --
7
+ -- emp/ GET collection query: the active employees
8
+ -- emp/:id GET single row: one employee
9
+ -- emp/:id/photo GET media: the employee's photo
10
+ -- leave POST PL/pgSQL: request leave with
11
+ -- {"start_date": "…", "end_date": "…", "reason": "…"}
12
+ -- payroll/:deptno GET collection query; managers and administrators only
13
+ -- =====================================================================
14
+ insert into meta.rest_module (app_id, name, title, description, templates, handlers)
15
+ select id, 'hr', 'HR (RESTful Services)', 'Employees and leave requests: a module of templates and handlers.',
16
+ $t$[
17
+ {"uri": "emp", "description": "The employees"},
18
+ {"uri": "emp/:id", "description": "One employee by number"},
19
+ {"uri": "emp/:id/photo", "description": "An employee's photo"},
20
+ {"uri": "leave", "description": "Leave requests of the caller"},
21
+ {"uri": "payroll/:deptno", "description": "Payroll of a department"}
22
+ ]$t$::jsonb,
23
+ $h$[
24
+ {"method": "GET", "path": "emp", "type": "collection", "description": "The active employees",
25
+ "source": "select empno, initcap(ename) as name, initcap(job) as job, deptno from hr.emp where active order by empno"},
26
+ {"method": "GET", "path": "emp/:id", "type": "item", "description": "One employee",
27
+ "source": "select empno, initcap(ename) as name, initcap(job) as job, deptno, hiredate, mgr from hr.emp where empno = :ID::int"},
28
+ {"method": "GET", "path": "emp/:id/photo", "type": "media", "description": "The employee's photo",
29
+ "source": "select photo_mime as content_type, photo as content, photo_name as filename from hr.emp where empno = :ID::int and photo is not null"},
30
+ {"method": "POST", "path": "leave", "type": "plpgsql", "description": "Request leave (as the caller)",
31
+ "params": [{"name": "start_date", "in": "body", "type": "string", "required": true, "description": "First day (YYYY-MM-DD)"},
32
+ {"name": "end_date", "in": "body", "type": "string", "required": true, "description": "Last day (YYYY-MM-DD)"},
33
+ {"name": "reason", "in": "body", "type": "string"}],
34
+ "source": "declare\n v_id int;\nbegin\n v_id := hr.request_leave(:START_DATE::date, :END_DATE::date, :REASON);\n perform meta.rest_reply(jsonb_build_object('id', v_id, 'status', 'requested'), 201);\nend"},
35
+ {"method": "GET", "path": "payroll/:deptno", "type": "collection", "roles": ["manager", "admin"], "description": "Salaries of a department",
36
+ "source": "select empno, initcap(ename) as name, sal from hr.emp where deptno = :DEPTNO::int and active order by empno"}
37
+ ]$h$::jsonb
38
+ from meta.app where alias = 'hr'
39
+ on conflict (app_id, name) do nothing;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgkiln",
3
- "version": "0.48.0",
3
+ "version": "0.50.0",
4
4
  "description": "Open source low-code, SQL-driven application builder for PostgreSQL, inspired by Oracle APEX",
5
5
  "keywords": [
6
6
  "postgresql",
package/public/app.css CHANGED
@@ -416,7 +416,7 @@ dialog.region-inline_drawer:target { inset: 0 0 0 auto; }
416
416
  .req { color: var(--danger); margin-left: 0.2em; }
417
417
  input:not([type=checkbox]):not([type=radio]), select, textarea {
418
418
  font: inherit; color: var(--text); background: var(--surface);
419
- border: 1px solid var(--border); border-radius: calc(var(--radius) * 0.75); padding: 0.45rem 0.6rem; width: 100%; min-width: 0;
419
+ border: 1px solid var(--field-border, var(--border)); border-radius: calc(var(--radius) * 0.75); padding: 0.45rem 0.6rem; width: 100%; min-width: 0;
420
420
  }
421
421
  input:disabled, select:disabled, textarea:disabled { opacity: 0.6; }
422
422
  textarea.code { font-family: var(--mono); font-size: 0.84rem; line-height: 1.45; tab-size: 2; }
@@ -30,4 +30,6 @@
30
30
  <symbol id="b-save" viewBox="0 0 24 24"><path d="M5 4h11l3 3v13H5z"/><path d="M8 4v5h7V4M8 20v-6h8v6"/></symbol>
31
31
  <symbol id="b-dots" viewBox="0 0 24 24"><path d="M5 12h.01M12 12h.01M19 12h.01" stroke-width="3.2"/></symbol>
32
32
  <symbol id="b-pages" viewBox="0 0 24 24"><path d="M8 3h8l4 4v11H8z"/><path d="M16 3v4h4"/><path d="M4 7v14h11"/></symbol>
33
+ <!-- (sprint 105) the pgkiln brand mark: an ember flame with a hollow core; filled, unlike the stroke icons -->
34
+ <symbol id="b-kiln" viewBox="0 0 24 24"><path fill="currentColor" stroke="none" fill-rule="evenodd" d="M12.3 1.8c.6 3.1 2.5 4.7 4.2 6.6 1.8 1.9 3.1 4 3.1 6.7a7.6 7.6 0 0 1-15.2 0c0-2.6 1.1-4.6 2.8-6.1.2 1.6 1 2.8 2.2 3.4C9.2 8.6 10.5 4.7 12.3 1.8zM12 20.4a2.9 2.9 0 0 0 2.9-2.9c0-1.4-.5-2.9-1.4-4-.8.8-1.3 1.8-1.4 3-.7-.3-1.1-.9-1.3-1.6-.9.9-1.8 1.9-1.8 3.3a3 3 0 0 0 3 2.2z"/></symbol>
33
35
  </svg>