@uigraph/sdk 1.1.35 → 1.1.36
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 +101 -0
- package/README.md +105 -2
- package/dist/index.cjs +9 -5
- package/dist/index.d.cts +4 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +9 -5
- package/package.json +15 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
4
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
5
|
+
|
|
6
|
+
Parameters
|
|
7
|
+
|
|
8
|
+
Licensor: UiGraph, Inc.
|
|
9
|
+
Licensed Work: The software made available under this License in this
|
|
10
|
+
repository (the "Licensed Work"). The Licensed Work is
|
|
11
|
+
(c) UiGraph, Inc.
|
|
12
|
+
Additional Use Grant: You may make non-production use of the Licensed Work
|
|
13
|
+
free of charge, including for development, testing,
|
|
14
|
+
evaluation, and internal proof-of-concept purposes.
|
|
15
|
+
|
|
16
|
+
Any production use of the Licensed Work requires a
|
|
17
|
+
commercial license from Licensor. "Production use"
|
|
18
|
+
means any use that supports the ongoing operation of
|
|
19
|
+
your business or organization, including but not
|
|
20
|
+
limited to deploying the Licensed Work to serve
|
|
21
|
+
employees, customers, or end users.
|
|
22
|
+
|
|
23
|
+
This Additional Use Grant does not authorize offering
|
|
24
|
+
the Licensed Work, or any product incorporating it, to
|
|
25
|
+
third parties on a hosted, managed, or embedded basis
|
|
26
|
+
in competition with Licensor's commercial offerings.
|
|
27
|
+
Change Date: Four years from the date the specific version of the
|
|
28
|
+
Licensed Work is published.
|
|
29
|
+
Change License: Apache License 2.0
|
|
30
|
+
|
|
31
|
+
Notice
|
|
32
|
+
|
|
33
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
34
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
35
|
+
under an Open Source License, as stated in this License.
|
|
36
|
+
|
|
37
|
+
Terms
|
|
38
|
+
|
|
39
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
40
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
41
|
+
Licensor may make an Additional Use Grant, above, permitting limited production use.
|
|
42
|
+
|
|
43
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
44
|
+
available distribution of a specific version of the Licensed Work under this
|
|
45
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
46
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
47
|
+
above terminate.
|
|
48
|
+
|
|
49
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
50
|
+
currently in effect as described in this License, you must purchase a
|
|
51
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
52
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
53
|
+
|
|
54
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
55
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
56
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
57
|
+
for each version of the Licensed Work released by Licensor.
|
|
58
|
+
|
|
59
|
+
You must conspicuously display this License on each original or modified copy
|
|
60
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
61
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
62
|
+
License apply to your use of that work.
|
|
63
|
+
|
|
64
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
65
|
+
terminate your rights under this License for the current and all other
|
|
66
|
+
versions of the Licensed Work.
|
|
67
|
+
|
|
68
|
+
This License does not grant you any right in any trademark or logo of
|
|
69
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
70
|
+
Licensor as expressly required by this License).
|
|
71
|
+
|
|
72
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
73
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
74
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
75
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
76
|
+
TITLE.
|
|
77
|
+
|
|
78
|
+
MariaDB hereby grants you permission to use this License's text to license
|
|
79
|
+
your works, and to refer to it using the trademark "Business Source License",
|
|
80
|
+
as long as you comply with the Covenants of Licensor below.
|
|
81
|
+
|
|
82
|
+
Covenants of Licensor
|
|
83
|
+
|
|
84
|
+
In consideration of the right to use this License's text and the "Business
|
|
85
|
+
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
|
86
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
87
|
+
|
|
88
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
89
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
90
|
+
where "compatible" means that software provided under the Change License can
|
|
91
|
+
be included in a program with software provided under GPL Version 2.0 or a
|
|
92
|
+
later version. Licensor may specify additional Change Licenses without
|
|
93
|
+
limitation.
|
|
94
|
+
|
|
95
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
96
|
+
impose any additional restriction on the right granted in this License, as
|
|
97
|
+
the Additional Use Grant; or (b) insert the text "None".
|
|
98
|
+
|
|
99
|
+
3. To specify a Change Date.
|
|
100
|
+
|
|
101
|
+
4. Not to modify this License in any other way.
|
package/README.md
CHANGED
|
@@ -1,7 +1,110 @@
|
|
|
1
|
+
# @uigraph/sdk
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@uigraph/sdk)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
Official TypeScript SDK for [UiGraph](https://github.com/uigraph-oss). Parse SQL and NoSQL schemas, convert Mermaid diagrams, and produce [React Flow](https://reactflow.dev/) node and edge data for architecture and data-model diagrams.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- **Mermaid → React Flow** — flowcharts, sequence diagrams, and more
|
|
11
|
+
- **Context-aware conversion** — apply node, edge, and group overrides after parsing
|
|
12
|
+
- **SQL parsing** — MySQL, PostgreSQL, SQLite with dialect auto-detection
|
|
13
|
+
- **Schema → diagram** — convert SQL AST into diagram-ready structures
|
|
14
|
+
- **NoSQL schemas** — MongoDB, DynamoDB, and JSON schema support
|
|
15
|
+
- **Icon packs** — AWS, Azure, and animated node icon lists
|
|
16
|
+
- **Multiple runtimes** — full, browser, and headless entry points
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
1
20
|
```sh
|
|
2
|
-
|
|
21
|
+
npm install @uigraph/sdk
|
|
3
22
|
```
|
|
4
23
|
|
|
24
|
+
Peer dependencies (install if you do not already have them):
|
|
25
|
+
|
|
5
26
|
```sh
|
|
6
|
-
|
|
27
|
+
npm install @xyflow/react zod quill
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick start
|
|
31
|
+
|
|
32
|
+
Convert Mermaid source into React Flow data:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { convertMermaidToReactFlow } from '@uigraph/sdk'
|
|
36
|
+
|
|
37
|
+
const mermaid = `flowchart TD
|
|
38
|
+
A[Start] --> B{Decision}
|
|
39
|
+
B -->|Yes| C[Done]
|
|
40
|
+
B -->|No| D[Retry]
|
|
41
|
+
`
|
|
42
|
+
|
|
43
|
+
const { nodes, edges } = await convertMermaidToReactFlow(mermaid)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Parse SQL and work with the schema AST:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { SqlToAstParser } from '@uigraph/sdk'
|
|
50
|
+
|
|
51
|
+
const dialect = SqlToAstParser.detectDialect(sql)
|
|
52
|
+
const ast = new SqlToAstParser(dialect).parse(sql)
|
|
7
53
|
```
|
|
54
|
+
|
|
55
|
+
## Package entry points
|
|
56
|
+
|
|
57
|
+
| Import | Use when |
|
|
58
|
+
|--------|----------|
|
|
59
|
+
| `@uigraph/sdk` | Full SDK (Node.js or bundlers) |
|
|
60
|
+
| `@uigraph/sdk/browser` | Browser environments |
|
|
61
|
+
| `@uigraph/sdk/headless` | Server-side conversion without DOM APIs |
|
|
62
|
+
| `@uigraph/sdk/aws-icons` | AWS icon metadata |
|
|
63
|
+
| `@uigraph/sdk/azure-icons` | Azure icon metadata |
|
|
64
|
+
| `@uigraph/sdk/animated-nodes` | Animated node icon metadata |
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { convertMermaidToReactFlow } from '@uigraph/sdk/browser'
|
|
68
|
+
import { awsIcons } from '@uigraph/sdk/aws-icons'
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Documentation
|
|
72
|
+
|
|
73
|
+
- [Mermaid conversion guide](docs/mermaid.md)
|
|
74
|
+
- [SQL parsing guide](docs/sql.md)
|
|
75
|
+
|
|
76
|
+
## Development
|
|
77
|
+
|
|
78
|
+
Requires Node.js 20+ and [pnpm](https://pnpm.io/).
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
pnpm install
|
|
82
|
+
pnpm dev # watch build, typecheck, and tests
|
|
83
|
+
pnpm test
|
|
84
|
+
pnpm lint
|
|
85
|
+
pnpm run build
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Publishing a release
|
|
89
|
+
|
|
90
|
+
1. Bump the version in `package.json` and merge to `main`.
|
|
91
|
+
2. Create a [GitHub Release](https://github.com/uigraph-oss/uigraph-sdk/releases) with tag `vX.Y.Z` matching that version.
|
|
92
|
+
3. CI publishes to [npm](https://www.npmjs.com/package/@uigraph/sdk).
|
|
93
|
+
|
|
94
|
+
The repo needs an `NPM_TOKEN` secret (npm Automation token) configured before the first publish.
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
This project is licensed under the [Business Source License 1.1](LICENSE) (BUSL-1.1).
|
|
99
|
+
|
|
100
|
+
- **Source available today** — you can read, modify, and redistribute the code under the terms of the license.
|
|
101
|
+
- **Production use** — permitted for most use cases, including internal and product integration. You may not offer the SDK (or substantial portions of it) as a hosted or embedded competitive offering against UiGraph's commercial platform. See [LICENSE](LICENSE) for the full Additional Use Grant.
|
|
102
|
+
- **Future open source** — each version automatically converts to [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0) four years after it is first published under BUSL.
|
|
103
|
+
|
|
104
|
+
BUSL is not an OSI-approved open source license during the initial term. For questions about commercial licensing, open an issue or contact the maintainers.
|
|
105
|
+
|
|
106
|
+
## Related projects
|
|
107
|
+
|
|
108
|
+
- [uigraph-ui](https://github.com/uigraph-oss/uigraph-ui) — web application
|
|
109
|
+
- [uigraph-api](https://github.com/uigraph-oss/uigraph-api) — backend API
|
|
110
|
+
- [uigraph-graphql](https://github.com/uigraph-oss/uigraph-graphql) — GraphQL BFF
|
package/dist/index.cjs
CHANGED
|
@@ -3825,11 +3825,15 @@ function _convertMermaidToReactFlowWithContext() {
|
|
|
3825
3825
|
componentField.data = newComponentField.data;
|
|
3826
3826
|
}
|
|
3827
3827
|
}
|
|
3828
|
-
if (ctx.dbConfig)
|
|
3829
|
-
serviceId
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3828
|
+
if (ctx.dbConfig) {
|
|
3829
|
+
var _resolved$serviceId, _resolved$serviceDbId;
|
|
3830
|
+
const resolved = (options === null || options === void 0 ? void 0 : options.resolveDbConfig) ? yield options.resolveDbConfig(ctx.dbConfig.service, ctx.dbConfig.database) : void 0;
|
|
3831
|
+
clonedNode.data.serviceTable = {
|
|
3832
|
+
serviceId: (_resolved$serviceId = resolved === null || resolved === void 0 ? void 0 : resolved.serviceId) !== null && _resolved$serviceId !== void 0 ? _resolved$serviceId : ctx.dbConfig.service,
|
|
3833
|
+
serviceDbId: (_resolved$serviceDbId = resolved === null || resolved === void 0 ? void 0 : resolved.serviceDbId) !== null && _resolved$serviceDbId !== void 0 ? _resolved$serviceDbId : ctx.dbConfig.database,
|
|
3834
|
+
tableName: ctx.dbConfig.tableName
|
|
3835
|
+
};
|
|
3836
|
+
}
|
|
3833
3837
|
if ((_ctx$style = ctx.style) === null || _ctx$style === void 0 ? void 0 : _ctx$style.height) clonedNode.height = ctx.style.height;
|
|
3834
3838
|
if ((_ctx$style2 = ctx.style) === null || _ctx$style2 === void 0 ? void 0 : _ctx$style2.width) clonedNode.width = ctx.style.width;
|
|
3835
3839
|
clonedNode.data = _objectSpread2(_objectSpread2(_objectSpread2({}, clonedNode.data), (0, daily_code.objectPick)((_ctx$style3 = ctx.style) !== null && _ctx$style3 !== void 0 ? _ctx$style3 : {}, [
|
package/dist/index.d.cts
CHANGED
|
@@ -745,6 +745,10 @@ declare function buildMetaData(fields: ServerComponentField[], data: Record<stri
|
|
|
745
745
|
type ResolverOptions = {
|
|
746
746
|
repositionNodes?: boolean;
|
|
747
747
|
resolveCloudIcon?: (cloud: string | undefined, service: string) => Promise<string | undefined | null>;
|
|
748
|
+
resolveDbConfig?: (service: string, database: string) => Promise<{
|
|
749
|
+
serviceId?: string;
|
|
750
|
+
serviceDbId?: string;
|
|
751
|
+
} | undefined>;
|
|
748
752
|
};
|
|
749
753
|
declare function convertMermaidToReactFlowWithContext(mermaidCode: string, context: z$1.infer<typeof contextSchema>, options?: ResolverOptions): Promise<ReactFlowData>;
|
|
750
754
|
//#endregion
|
package/dist/index.d.mts
CHANGED
|
@@ -745,6 +745,10 @@ declare function buildMetaData(fields: ServerComponentField[], data: Record<stri
|
|
|
745
745
|
type ResolverOptions = {
|
|
746
746
|
repositionNodes?: boolean;
|
|
747
747
|
resolveCloudIcon?: (cloud: string | undefined, service: string) => Promise<string | undefined | null>;
|
|
748
|
+
resolveDbConfig?: (service: string, database: string) => Promise<{
|
|
749
|
+
serviceId?: string;
|
|
750
|
+
serviceDbId?: string;
|
|
751
|
+
} | undefined>;
|
|
748
752
|
};
|
|
749
753
|
declare function convertMermaidToReactFlowWithContext(mermaidCode: string, context: z$1.infer<typeof contextSchema>, options?: ResolverOptions): Promise<ReactFlowData>;
|
|
750
754
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -3818,11 +3818,15 @@ function _convertMermaidToReactFlowWithContext() {
|
|
|
3818
3818
|
componentField.data = newComponentField.data;
|
|
3819
3819
|
}
|
|
3820
3820
|
}
|
|
3821
|
-
if (ctx.dbConfig)
|
|
3822
|
-
serviceId
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3821
|
+
if (ctx.dbConfig) {
|
|
3822
|
+
var _resolved$serviceId, _resolved$serviceDbId;
|
|
3823
|
+
const resolved = (options === null || options === void 0 ? void 0 : options.resolveDbConfig) ? yield options.resolveDbConfig(ctx.dbConfig.service, ctx.dbConfig.database) : void 0;
|
|
3824
|
+
clonedNode.data.serviceTable = {
|
|
3825
|
+
serviceId: (_resolved$serviceId = resolved === null || resolved === void 0 ? void 0 : resolved.serviceId) !== null && _resolved$serviceId !== void 0 ? _resolved$serviceId : ctx.dbConfig.service,
|
|
3826
|
+
serviceDbId: (_resolved$serviceDbId = resolved === null || resolved === void 0 ? void 0 : resolved.serviceDbId) !== null && _resolved$serviceDbId !== void 0 ? _resolved$serviceDbId : ctx.dbConfig.database,
|
|
3827
|
+
tableName: ctx.dbConfig.tableName
|
|
3828
|
+
};
|
|
3829
|
+
}
|
|
3826
3830
|
if ((_ctx$style = ctx.style) === null || _ctx$style === void 0 ? void 0 : _ctx$style.height) clonedNode.height = ctx.style.height;
|
|
3827
3831
|
if ((_ctx$style2 = ctx.style) === null || _ctx$style2 === void 0 ? void 0 : _ctx$style2.width) clonedNode.width = ctx.style.width;
|
|
3828
3832
|
clonedNode.data = _objectSpread2(_objectSpread2(_objectSpread2({}, clonedNode.data), objectPick((_ctx$style3 = ctx.style) !== null && _ctx$style3 !== void 0 ? _ctx$style3 : {}, [
|
package/package.json
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uigraph/sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.36",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"license": "BUSL-1.1",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/uigraph-oss/uigraph-sdk.git"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public",
|
|
12
|
+
"registry": "https://registry.npmjs.org/"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
5
19
|
"scripts": {
|
|
6
20
|
"prepare": "husky",
|
|
7
21
|
"test": "vitest --run",
|