Skip to content

Commit 787b519

Browse files
authored
Merge pull request #67 from funktechno/dev
update main for release v0.0.7
2 parents 33edc63 + 7331814 commit 787b519

23 files changed

+1872
-2792
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ assignees: ''
1010
**Describe the bug**
1111
A clear and concise description of what the bug is.
1212

13+
**Notify authors**
14+
* @lastlink
15+
1316
**To Reproduce**
1417
Steps to reproduce the behavior:
1518
1. Go to '...'

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ assignees: ''
77

88
---
99

10+
**Notify authors**
11+
* @lastlink
12+
1013
**Is your feature request related to a problem? Please describe.**
1114
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
1215

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
submodules: true
1717
- uses: actions/setup-node@v3
1818
with:
19-
node-version: current
19+
node-version: 22
2020
- run: npm ci
2121
- run: npm run lint
2222
- run: npm test

README.md

Lines changed: 127 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,134 @@
1-
# sqltooling-drawio
2-
* 3rd party plugins for sql tooling in drawio
3-
* contributions welcome
4-
5-
## Getting Started
6-
* see https://github.com/ariel-bentu/tam-drawio for multiple install options
7-
* download plugin file
8-
* [sql.js](https://raw.githubusercontent.com/funktechno/sqltooling-drawio/main/dist/sql.js) - import/export SQL DLLS
9-
* [nosql.js](https://raw.githubusercontent.com/funktechno/sqltooling-drawio/main/dist/nosql.js) - import/export openapi jsons
10-
* or [nosql.min.js](https://raw.githubusercontent.com/funktechno/sqltooling-drawio/main/dist/nosql.min.js)
11-
* you can then use the openapi.json spec to generate classes/interfaces in the language of your choosing
12-
* [nosql-ts.js](https://raw.githubusercontent.com/funktechno/sqltooling-drawio/main/dist/nosql-ts.js) - import/export typescript interfaces and openapi jsons (NOT vscode compatible)
13-
* or [nosql-ts.min.js](https://raw.githubusercontent.com/funktechno/sqltooling-drawio/main/dist/nosql-ts.min.js)
14-
* or clone project `git clone --branch main [email protected]:funktechno/sqltooling-drawio.git` and check `dist folder`
15-
* vscode [Draw.io Integration](https://marketplace.visualstudio.com/items?itemName=hediet.vscode-drawio)
16-
* settings.json
17-
```json
18-
"hediet.vscode-drawio.plugins": [
1+
# SQL Tooling for Draw.io
2+
3+
Third-party plugins for SQL tooling in Draw.io. Contributions are welcome!
4+
5+
## Overview
6+
7+
This project provides plugins that extend Draw.io with SQL and NoSQL capabilities, allowing you to:
8+
- Import/export SQL DDLs
9+
- Import/export OpenAPI JSONs
10+
- Generate TypeScript interfaces
11+
- Work with various database schemas
12+
13+
## Download
14+
15+
### Option 1: Direct Download
16+
17+
Download the plugin files directly from the [releases page](https://github.com/funktechno/sqltooling-drawio/releases) or use the direct links below:
18+
19+
- **[sql.js](https://raw.githubusercontent.com/funktechno/sqltooling-drawio/main/dist/sql.js)** - Import/export SQL DDLs
20+
- **[nosql.js](https://raw.githubusercontent.com/funktechno/sqltooling-drawio/main/dist/nosql.js)** - Import/export OpenAPI JSONs
21+
- Alternative: [nosql.min.js](https://raw.githubusercontent.com/funktechno/sqltooling-drawio/main/dist/nosql.min.js) (minified version)
22+
- **[nosql-ts.js](https://raw.githubusercontent.com/funktechno/sqltooling-drawio/main/dist/nosql-ts.js)** - Import/export TypeScript interfaces and OpenAPI JSONs
23+
- Alternative: [nosql-ts.min.js](https://raw.githubusercontent.com/funktechno/sqltooling-drawio/main/dist/nosql-ts.min.js) (minified version)
24+
- ⚠️ **Note**: Not VSCode compatible
25+
26+
### Option 2: Clone Repository
27+
28+
```bash
29+
git clone --branch main [email protected]:funktechno/sqltooling-drawio.git
30+
```
31+
32+
Then use the files from the `dist` folder.
33+
34+
## Installation
35+
36+
### VSCode Integration
37+
38+
For VSCode users with the [Draw.io Integration](https://marketplace.visualstudio.com/items?itemName=hediet.vscode-drawio) extension:
39+
40+
1. Download the plugin files from the [Download](#download) section above
41+
2. Add to your `settings.json`:
42+
43+
```json
44+
{
45+
"hediet.vscode-drawio.plugins": [
1946
{
20-
"file": "xxx\\sqltooling-drawio\\dist\\sql.js"
47+
"file": "path\\to\\sqltooling-drawio\\dist\\sql.js"
2148
},
2249
{
23-
"file": "xxx\\sqltooling-drawio\\dist\\nosql.js"
24-
},
25-
```
50+
"file": "path\\to\\sqltooling-drawio\\dist\\nosql.js"
51+
}
52+
]
53+
}
54+
```
55+
56+
### Desktop App Integration
57+
58+
It's easiest to setup in the Draw.io Desktop to use the plugin. Follow these steps:
59+
60+
#### Prerequisites
61+
- Download and install [Node.js](https://nodejs.org/)
62+
63+
#### Setup Steps
64+
65+
1. **Clone or Download Draw.io Desktop**
66+
- **Option A (Git Clone)**: `git clone --recursive https://github.com/jgraph/drawio-desktop.git` (1 GB clone)
67+
- **Option B (Download ZIP)**: Download from [dev.zip](https://github.com/jgraph/drawio-desktop/archive/refs/heads/dev.zip) and unzip
68+
- ⚠️ **Note**: Don't download precompiled from Releases as you can't modify the plugins
69+
70+
2. **Install Dependencies**
71+
- Open command line (PowerShell, Command Prompt, Bash, Terminal)
72+
- Navigate to the drawio-desktop folder: `cd <path>/drawio-desktop`
73+
- Run: `npm install`
74+
75+
3. **Update SQL Plugin**
76+
- Update `drawio/src/main/webapp/plugins/sql.js` with changes from [this branch](https://raw.githubusercontent.com/funktechno/sqltooling-drawio/main/dist/sql.js)
77+
78+
4. **Run Application**
79+
- Execute: `npm start`
80+
81+
5. **Add Plugin**
82+
- In the running application, go to **Extras****Plugins****Add**
83+
- Select `sql` plugin
84+
- Close application and reopen
85+
- Plugin is now installed and ready to use
86+
87+
## Features
88+
89+
### SQL Plugin (`sql.js`)
90+
- Import SQL DDLs into Draw.io diagrams
91+
- Export diagrams as SQL DDLs
92+
- Database schema visualization
93+
94+
### NoSQL Plugin (`nosql.js`)
95+
- Import/export OpenAPI JSON specifications
96+
- Generate classes/interfaces in your preferred language using OpenAPI specs
97+
- API documentation visualization
98+
99+
### TypeScript Plugin (`nosql-ts.js`)
100+
- Import/export TypeScript interfaces
101+
- Import/export OpenAPI JSONs
102+
- Type-safe development workflows
26103

27104
## Examples
28-
* ![menu_from_sql](./assets/menu_from_sql.png)
29-
* ![menu_from_sql](./assets/menu_export_as_to_sql.png)
105+
106+
### SQL Import/Export
107+
![SQL Import Menu](./assets/menu_from_sql.png)
108+
109+
### Export Options
110+
![Export Menu](./assets/menu_export_as_to_sql.png)
30111

31112
## Development
32-
* `npm install`
33-
* `npm build:client` to update `dist/sql.js`
34-
* `npm build:client:nosql` to update `dist/nosql.js`
113+
114+
### Prerequisites
115+
- Node.js
116+
- npm
117+
118+
### Setup
119+
```bash
120+
npm install
121+
```
122+
123+
### Build Commands
124+
- `npm run build:client:sql` - Update `dist/sql.js`
125+
- `npm run build:client:nosql` - Update `dist/nosql.js`
126+
- `npm run build:client:all` - Update all files in `dist/*`
127+
128+
## Contributing
129+
130+
Contributions are welcome! Please feel free to submit issues and pull requests.
131+
132+
## License
133+
134+
See [LICENSE](LICENSE) file for details.

build/updateVersion.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,37 @@ const files = fs.readdirSync(directoryPath);
66
console.log("Files in the directory:", files);
77

88
const oldText = "<VERSION>";
9-
const newText = package.VERSION;
9+
const version = package.version;
1010

11-
console.log("Updating to version " + package.version);
11+
console.log("Updating to version " + version);
12+
13+
// Get current daytime in ISO format 2025-10-24
14+
const timestamp = new Date().toISOString().split('T')[0];
1215

1316
files.forEach((file) => {
1417
const filePath = `${directoryPath}/${file}`;
1518
let content = fs.readFileSync(filePath, "utf8");
1619
let updated = false;
1720
while(content.includes(oldText)) {
1821
updated = true
19-
content = content.replace(oldText, package.version);
22+
content = content.replace(oldText, version);
2023
}
2124
if(updated) {
2225
// content = content.replace(new RegExp(oldText, "g"), newText);
2326
fs.writeFileSync(filePath, content, "utf8");
2427
console.log(`Replaced text in ${file}`);
28+
}
29+
// Minified files won't have the placeholder in a readable format, so we them to first line
30+
// also check that the version is not already there
31+
const banner = `/**\n` +
32+
` * File: ${file}\n` +
33+
` * Version: ${version}\n` +
34+
` * Generated: ${timestamp}\n` +
35+
` */\n`;
36+
if(content.startsWith(banner)) {
37+
return;
2538
}
39+
content = banner + content
40+
fs.writeFileSync(filePath, content, "utf8");
41+
console.log(`Added banner to ${file}`);
2642
});

dist/nosql-ts.js

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* File: nosql-ts.js
3+
* Version: 0.0.7
4+
* Generated: 2025-10-24
5+
*/
16
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
27

38
},{}],2:[function(require,module,exports){
@@ -8300,7 +8305,7 @@ module.exports = __toCommonJS(typescript_exports);
83008305

83018306
// src/compiler/corePublic.ts
83028307
var versionMajorMinor = "5.5";
8303-
var version = "5.5.2";
8308+
var version = "5.5.3";
83048309
var Comparison = /* @__PURE__ */ ((Comparison3) => {
83058310
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
83068311
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -58746,7 +58751,7 @@ function createTypeChecker(host) {
5874658751
}
5874758752
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
5874858753
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
58749-
const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
58754+
const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l) || isJSDocImportTag(l));
5875058755
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
5875158756
if (findAncestor(location, isImportEqualsDeclaration)) {
5875258757
error2(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
@@ -129534,7 +129539,7 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
129534129539
}
129535129540
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
129536129541
var _a;
129537-
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
129542+
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent) || isJSDocImportTag(usage.parent)) {
129538129543
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
129539129544
if (isTypeOnly) {
129540129545
const override = getResolutionModeOverride(usage.parent.attributes);
@@ -200856,7 +200861,7 @@ const nosqlUtils_1 = require("./utils/nosqlUtils");
200856200861
const constants_nosql_1 = require("./utils/constants-nosql");
200857200862
/**
200858200863
* SQL Tools Plugin for importing and exporting typescript interfaces.
200859-
* Version: 0.0.6
200864+
* Version: 0.0.7
200860200865
*/
200861200866
Draw.loadPlugin(function (ui) {
200862200867
//Create Base div
@@ -201187,7 +201192,7 @@ exports.validJSONSchemaTypes = JSONSchemaTypes;
201187201192
Object.defineProperty(exports, "__esModule", { value: true });
201188201193
exports.objectKeyword = exports.arrayKeyword = exports.nullableKeyword = exports.enumKeyword = exports.formatKeyword = exports.commentColumnQuantifiers = exports.pluginVersion = void 0;
201189201194
// export sql methods
201190-
exports.pluginVersion = "0.0.6";
201195+
exports.pluginVersion = "0.0.7";
201191201196
exports.commentColumnQuantifiers = {
201192201197
Start: "/**",
201193201198
End: "*/",
@@ -201675,7 +201680,7 @@ function dbTypeEnds(label) {
201675201680
* @returns
201676201681
*/
201677201682
function RemoveNameQuantifiers(name) {
201678-
return name.replace(/\[|\]|\(|\"|\'|\`/g, "").trim();
201683+
return name.replace(/\[|\]|\(|\)|\"|\'|\`/g, "").trim();
201679201684
}
201680201685
/**
201681201686
* extract row column attributes
@@ -201691,11 +201696,18 @@ function getDbLabel(label, columnQuantifiers) {
201691201696
result.indexOf(columnQuantifiers.End + " ") !== -1
201692201697
? result.indexOf(columnQuantifiers.End + " ")
201693201698
: result.indexOf(" ");
201694-
const attributeType = result.substring(firstSpaceIndex + 1).trim();
201699+
let attributeType = result.substring(firstSpaceIndex + 1).trim();
201695201700
const attributeName = RemoveNameQuantifiers(result.substring(0, firstSpaceIndex + 1));
201701+
const attributesTypes = attributeType.split(" ");
201702+
let attributeComment = null;
201703+
if (attributesTypes.length > 1) {
201704+
attributeComment = attributesTypes.slice(1).join(' ');
201705+
attributeType = attributesTypes[0];
201706+
}
201696201707
const attribute = {
201697201708
attributeName,
201698201709
attributeType,
201710+
attributeComment,
201699201711
};
201700201712
return attribute;
201701201713
}
@@ -202099,18 +202111,18 @@ function CreateTableUI(ui, wndFromInput, tableList, cells, rowCell, tableCell, f
202099202111
// add foreign key edges
202100202112
const model = graph.getModel();
202101202113
const columnQuantifiers = GetColumnQuantifiers(type);
202114+
const insertEdge = mxUtils.bind(this, function (targetCell, sourceCell, edge) {
202115+
const label = "";
202116+
const edgeStyle = "edgeStyle=entityRelationEdgeStyle;html=1;endArrow=ERzeroToMany;startArrow=ERzeroToOne;labelBackgroundColor=none;fontFamily=Verdana;fontSize=14;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=-0.018;entryY=0.608;entryDx=0;entryDy=0;entryPerimeter=0;";
202117+
const edgeCell = graph.insertEdge(null, null, label || "", edge.invert ? sourceCell : targetCell, edge.invert ? targetCell : sourceCell, edgeStyle);
202118+
});
202102202119
// const pt = graph.getFreeInsertPoint();
202103202120
foreignKeyList.forEach(function (fk) {
202104202121
if (fk.IsDestination &&
202105202122
fk.PrimaryKeyName &&
202106202123
fk.ReferencesPropertyName &&
202107202124
fk.PrimaryKeyTableName &&
202108202125
fk.ReferencesTableName) {
202109-
const insertEdge = mxUtils.bind(this, function (targetCell, sourceCell, edge) {
202110-
const label = "";
202111-
const edgeStyle = "edgeStyle=entityRelationEdgeStyle;html=1;endArrow=ERzeroToMany;startArrow=ERzeroToOne;labelBackgroundColor=none;fontFamily=Verdana;fontSize=14;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=-0.018;entryY=0.608;entryDx=0;entryDy=0;entryPerimeter=0;";
202112-
const edgeCell = graph.insertEdge(null, null, label || "", edge.invert ? sourceCell : targetCell, edge.invert ? targetCell : sourceCell, edgeStyle);
202113-
});
202114202126
const edge = {
202115202127
invert: true,
202116202128
};
@@ -202139,13 +202151,13 @@ function CreateTableUI(ui, wndFromInput, tableList, cells, rowCell, tableCell, f
202139202151
col.style.trim().startsWith("shape=partialRectangle")) {
202140202152
const attribute = getDbLabel(col.value, columnQuantifiers);
202141202153
if (isPrimaryTable &&
202142-
dbTypeEnds(attribute.attributeName) == fk.PrimaryKeyName) {
202154+
RemoveNameQuantifiers(attribute.attributeName) == RemoveNameQuantifiers(fk.PrimaryKeyName)) {
202143202155
targetCell = col;
202144202156
// allow recursion
202145202157
}
202146202158
if (isForeignTable &&
202147-
dbTypeEnds(attribute.attributeName) ==
202148-
fk.ReferencesPropertyName) {
202159+
RemoveNameQuantifiers(attribute.attributeName) ==
202160+
RemoveNameQuantifiers(fk.ReferencesPropertyName)) {
202149202161
sourceCell = col;
202150202162
}
202151202163
if (targetCell && sourceCell)

dist/nosql-ts.min.js

Lines changed: 23 additions & 446 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)