dbdiagram 0.1.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.
- package/COPYRIGHT.md +3 -0
- package/README.md +189 -0
- package/dist/actions/auth/auth-login.action.js +44 -0
- package/dist/actions/auth/auth-logout.action.js +13 -0
- package/dist/actions/auth/auth-status.action.js +38 -0
- package/dist/actions/build/build-document.action.js +142 -0
- package/dist/actions/delete.action.js +67 -0
- package/dist/actions/init.action.js +105 -0
- package/dist/actions/list/list-document.action.js +130 -0
- package/dist/actions/list/list.action.js +103 -0
- package/dist/actions/pull.action.js +58 -0
- package/dist/actions/push.action.js +91 -0
- package/dist/actions/tokens/token-delete.action.js +50 -0
- package/dist/actions/tokens/token-generate.action.js +52 -0
- package/dist/actions/tokens/token-list.action.js +52 -0
- package/dist/assets/callback-error.html +109 -0
- package/dist/assets/callback-success.html +73 -0
- package/dist/commands/auth/auth-login.command.js +7 -0
- package/dist/commands/auth/auth-logout.command.js +7 -0
- package/dist/commands/auth/auth-status.command.js +8 -0
- package/dist/commands/auth/auth.command.js +16 -0
- package/dist/commands/build/build-document.command.js +23 -0
- package/dist/commands/build/build.command.js +10 -0
- package/dist/commands/command.loader.js +18 -0
- package/dist/commands/delete.command.js +12 -0
- package/dist/commands/init.command.js +14 -0
- package/dist/commands/list/list-document.command.js +11 -0
- package/dist/commands/list/list.command.js +15 -0
- package/dist/commands/pull.command.js +11 -0
- package/dist/commands/push.command.js +15 -0
- package/dist/commands/tokens/token-delete.command.js +9 -0
- package/dist/commands/tokens/token-generate.command.js +9 -0
- package/dist/commands/tokens/token-list.command.js +8 -0
- package/dist/commands/tokens/tokens.command.js +15 -0
- package/dist/config/credential-manager.js +52 -0
- package/dist/config/settings-manager.js +44 -0
- package/dist/config.js +14 -0
- package/dist/config.staging.js +14 -0
- package/dist/constants/auth-message.constant.js +1 -0
- package/dist/constants/document.constant.js +8 -0
- package/dist/constants/dot-dbdiagram-dir.constant.js +9 -0
- package/dist/constants/viz-read-error.constant.js +6 -0
- package/dist/errors/portal-api.error.js +37 -0
- package/dist/errors/portal-error-codes.js +23 -0
- package/dist/hooks/build-document.hook.js +30 -0
- package/dist/hooks/delete.hook.js +12 -0
- package/dist/hooks/global.hook.js +6 -0
- package/dist/hooks/list.hook.js +23 -0
- package/dist/hooks/pull.hook.js +15 -0
- package/dist/hooks/push.hook.js +19 -0
- package/dist/index.js +12 -0
- package/dist/integrations/portal/portal-http.integration.js +27 -0
- package/dist/integrations/portal/portal.integration.js +68 -0
- package/dist/libs/portal/client.js +114 -0
- package/dist/libs/portal/errors.js +20 -0
- package/dist/libs/portal/index.js +2 -0
- package/dist/libs/portal/server.js +70 -0
- package/dist/program.js +16 -0
- package/dist/services/dbml/dbml.service.js +30 -0
- package/dist/services/dbml/dbml.worker.js +40 -0
- package/dist/services/file.service.js +6 -0
- package/dist/services/viz/diagram-viz-converter.service.js +67 -0
- package/dist/services/viz/diagram-viz-file.service.js +43 -0
- package/dist/types/config.type.js +1 -0
- package/dist/types/diagram-viz.type.js +6 -0
- package/dist/types/integrations/portal.type.js +1 -0
- package/dist/utils/dbml.util.js +30 -0
- package/dist/utils/diagram-viz-error.util.js +11 -0
- package/dist/utils/logger.util.js +3 -0
- package/dist/utils/output.util.js +18 -0
- package/dist/utils/portal-error.util.js +18 -0
- package/dist/utils/table.util.js +10 -0
- package/dist/utils/validation.util.js +32 -0
- package/package.json +56 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PROJECT_URL_NAME_PATTERN, URL_NAME_MAX_LENGTH, VERSION_NAME_MAX_LENGTH, WORKSPACE_URL_NAME_PATTERN, } from '../constants/document.constant.js';
|
|
2
|
+
const INVALID_URL_NAME_MESSAGE = 'Invalid name. Must contain only letters, numbers, spaces, and _ - @ . characters.';
|
|
3
|
+
export function validateProjectUrlName(value) {
|
|
4
|
+
if (value.trim() === '') {
|
|
5
|
+
return 'Project name must not be empty.';
|
|
6
|
+
}
|
|
7
|
+
if (!PROJECT_URL_NAME_PATTERN.test(value)) {
|
|
8
|
+
return INVALID_URL_NAME_MESSAGE;
|
|
9
|
+
}
|
|
10
|
+
if (value.length > URL_NAME_MAX_LENGTH) {
|
|
11
|
+
return `Project name must be at most ${URL_NAME_MAX_LENGTH} characters.`;
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
export function validateWorkspaceUrlName(value) {
|
|
16
|
+
if (value.trim() === '') {
|
|
17
|
+
return 'Workspace name must not be empty.';
|
|
18
|
+
}
|
|
19
|
+
if (!WORKSPACE_URL_NAME_PATTERN.test(value)) {
|
|
20
|
+
return INVALID_URL_NAME_MESSAGE;
|
|
21
|
+
}
|
|
22
|
+
if (value.length > URL_NAME_MAX_LENGTH) {
|
|
23
|
+
return `Workspace name must be at most ${URL_NAME_MAX_LENGTH} characters.`;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
export function validateVersionName(value) {
|
|
28
|
+
if (value.length > VERSION_NAME_MAX_LENGTH) {
|
|
29
|
+
return `Version name must be at most ${VERSION_NAME_MAX_LENGTH} characters.`;
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dbdiagram",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"bin": {
|
|
6
|
+
"dbdiagram": "dist/index.js"
|
|
7
|
+
},
|
|
8
|
+
"repository": "git@github.com:holistics/dbdiagram-cli.git",
|
|
9
|
+
"author": "@holistics",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"COPYRIGHT.md"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=22.14"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"prebuild": "rm -rf ./dist",
|
|
21
|
+
"build": "tsc -p tsconfig.build.json",
|
|
22
|
+
"postbuild": "cp -r src/assets dist/assets",
|
|
23
|
+
"test": "vitest run --coverage --changed master",
|
|
24
|
+
"test:ci": "vitest run --coverage --config vitest.config.ci.ts --changed master",
|
|
25
|
+
"test:all": "vitest run --coverage",
|
|
26
|
+
"dev": "tsx src/index.ts",
|
|
27
|
+
"start": "node dist/index.js",
|
|
28
|
+
"lint": "eslint .",
|
|
29
|
+
"lint:fix": "eslint . --fix"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@clack/prompts": "^1.4.0",
|
|
33
|
+
"@dbml/core": "8.2.5",
|
|
34
|
+
"axios": "^1.16.1",
|
|
35
|
+
"cli-table3": "^0.6.5",
|
|
36
|
+
"commander": "^15.0.0",
|
|
37
|
+
"dotenv": "^16.4.0",
|
|
38
|
+
"luxon": "^3.7.2",
|
|
39
|
+
"open": "^11.0.0",
|
|
40
|
+
"remove-markdown": "^0.6.4"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@eslint/js": "^10.0.1",
|
|
44
|
+
"@types/luxon": "^3.7.1",
|
|
45
|
+
"@types/node": "^25.7.0",
|
|
46
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
47
|
+
"eslint": "^10.3.0",
|
|
48
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
49
|
+
"eslint-plugin-import-x": "^4.16.2",
|
|
50
|
+
"globals": "^17.6.0",
|
|
51
|
+
"tsx": "^4.21.0",
|
|
52
|
+
"typescript": "^5.7.0",
|
|
53
|
+
"typescript-eslint": "^8.59.3",
|
|
54
|
+
"vitest": "^4.1.0"
|
|
55
|
+
}
|
|
56
|
+
}
|