@absolutejs/dbml 0.0.0-stage → 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.
@@ -0,0 +1,91 @@
1
+ type Raw = Record<string, unknown>;
2
+ export type RelationRow = {
3
+ comment?: string;
4
+ definition?: string;
5
+ forceRls: boolean;
6
+ id: number;
7
+ kind: string;
8
+ name: string;
9
+ partitionKey?: string;
10
+ partitions: number;
11
+ rls: boolean;
12
+ schema: string;
13
+ };
14
+ export declare const relationRow: (row: Raw) => RelationRow;
15
+ export type ColumnRow = {
16
+ comment?: string;
17
+ default?: string;
18
+ enumSchema?: string;
19
+ enumType?: string;
20
+ generated?: string;
21
+ identity?: string;
22
+ name: string;
23
+ notNull: boolean;
24
+ position: number;
25
+ serialSequence?: string;
26
+ tableId: number;
27
+ type: string;
28
+ };
29
+ export declare const columnRow: (row: Raw) => ColumnRow;
30
+ export type ConstraintRow = {
31
+ checkExpression?: string;
32
+ columns: number[];
33
+ comment?: string;
34
+ deferrable: boolean;
35
+ deferred: boolean;
36
+ definition: string;
37
+ foreignColumns: number[];
38
+ foreignTableId: number;
39
+ kind: string;
40
+ name: string;
41
+ nullsNotDistinct: boolean;
42
+ onDelete: string;
43
+ onUpdate: string;
44
+ tableId: number;
45
+ };
46
+ export declare const constraintRow: (row: Raw) => ConstraintRow;
47
+ export type IndexRow = {
48
+ attnums: number[];
49
+ comment?: string;
50
+ descending: boolean[];
51
+ keyCount: number;
52
+ method: string;
53
+ name: string;
54
+ parts: string[];
55
+ predicate?: string;
56
+ tableId: number;
57
+ unique: boolean;
58
+ };
59
+ export declare const indexRow: (row: Raw) => IndexRow;
60
+ export type PolicyRow = {
61
+ command: string;
62
+ name: string;
63
+ permissive: boolean;
64
+ roles: string[];
65
+ tableId: number;
66
+ using?: string;
67
+ withCheck?: string;
68
+ };
69
+ export declare const policyRow: (row: Raw) => PolicyRow;
70
+ export type NamedRow = {
71
+ comment?: string;
72
+ name: string;
73
+ schema: string;
74
+ };
75
+ export declare const namedRow: (row: Raw) => NamedRow;
76
+ export declare const enumRow: (row: Raw) => {
77
+ name: string;
78
+ schema: string;
79
+ values: string[];
80
+ };
81
+ export declare const sequenceRow: (row: Raw) => {
82
+ increment: string;
83
+ name: string;
84
+ schema: string;
85
+ start: string;
86
+ };
87
+ export declare const viewSourceRow: (row: Raw) => {
88
+ sourceId: number;
89
+ viewId: number;
90
+ };
91
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { DbmlModel } from './model';
2
+ /** A name in double quotes, a quote inside it escaped. */
3
+ export declare const quoteName: (name: string) => string;
4
+ /** Text in single quotes, or triple quotes when it runs over lines. */
5
+ export declare const quoteText: (text: string) => string;
6
+ /** An expression in backticks. DBML has no escape for a backtick inside
7
+ * one, so a stray one becomes a double quote, which is what an
8
+ * identifier quoted the other way means. */
9
+ export declare const quoteExpression: (expression: string) => string;
10
+ /** The model as DBML text. */
11
+ export declare const printDbml: (model: DbmlModel) => string;
package/package.json CHANGED
@@ -1,6 +1,90 @@
1
1
  {
2
- "name": "@absolutejs/dbml",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "author": "Alex Kahn",
3
+ "bin": {
4
+ "absolute-dbml": "./dist/cli.js"
5
+ },
6
+ "bugs": {
7
+ "url": "https://github.com/absolutejs/dbml/issues"
8
+ },
9
+ "description": "Turn any Drizzle schema, or a live Postgres database, into DBML: tables, enums, keys, indexes, checks, relations and notes, with one model behind both.",
10
+ "devDependencies": {
11
+ "@absolutejs/changelog": "^0.6.0",
12
+ "@dbml/core": "12.1.0",
13
+ "@electric-sql/pglite": "0.5.15",
14
+ "@stylistic/eslint-plugin-ts": "4.2.0",
15
+ "@types/bun": "latest",
16
+ "drizzle-orm": "1.0.0-rc.4",
17
+ "eslint": "9.26.0",
18
+ "eslint-plugin-absolute": "0.0.3",
19
+ "eslint-plugin-import": "2.31.0",
20
+ "eslint-plugin-promise": "7.2.1",
21
+ "eslint-plugin-security": "3.0.1",
22
+ "prettier": "3.5.3",
23
+ "typescript": "5.9.3",
24
+ "typescript-eslint": "8.32.0"
25
+ },
26
+ "exports": {
27
+ ".": {
28
+ "default": "./dist/index.js",
29
+ "import": "./dist/index.js",
30
+ "types": "./dist/index.d.ts"
31
+ },
32
+ "./drizzle": {
33
+ "default": "./dist/drizzle/index.js",
34
+ "import": "./dist/drizzle/index.js",
35
+ "types": "./dist/drizzle/index.d.ts"
36
+ },
37
+ "./postgres": {
38
+ "default": "./dist/postgres/index.js",
39
+ "import": "./dist/postgres/index.js",
40
+ "types": "./dist/postgres/index.d.ts"
41
+ }
42
+ },
43
+ "files": [
44
+ "CHANGELOG.md",
45
+ "LICENSE",
46
+ "README.md",
47
+ "changelog.json",
48
+ "dist"
49
+ ],
50
+ "homepage": "https://github.com/absolutejs/dbml",
51
+ "keywords": [
52
+ "dbml",
53
+ "drizzle",
54
+ "drizzle-orm",
55
+ "postgres",
56
+ "schema",
57
+ "erd",
58
+ "diagram"
59
+ ],
60
+ "license": "MIT",
61
+ "main": "./dist/index.js",
62
+ "name": "@absolutejs/dbml",
63
+ "peerDependencies": {
64
+ "drizzle-orm": ">=1.0.0-rc.4 <2"
65
+ },
66
+ "peerDependenciesMeta": {
67
+ "drizzle-orm": {
68
+ "optional": true
69
+ }
70
+ },
71
+ "publishConfig": {
72
+ "access": "public"
73
+ },
74
+ "repository": {
75
+ "type": "git",
76
+ "url": "https://github.com/absolutejs/dbml.git"
77
+ },
78
+ "scripts": {
79
+ "build": "rm -rf dist && bun build src/index.ts src/drizzle/index.ts src/postgres/index.ts src/cli.ts --outdir dist --root ./src --target=bun --external drizzle-orm && tsc --emitDeclarationOnly --project tsconfig.build.json",
80
+ "check:package": "bun run typecheck && bun run lint && bun run build && bun run test && absolute-changelog check",
81
+ "format": "prettier --write \"./**/*.{ts,json,mjs,md}\"",
82
+ "lint": "eslint ./",
83
+ "prepublishOnly": "bun run check:package",
84
+ "test": "bun test",
85
+ "typecheck": "tsc --noEmit"
86
+ },
87
+ "type": "module",
88
+ "types": "./dist/index.d.ts",
89
+ "version": "0.1.0"
90
+ }