@mariiodegen/seed-db 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.
- package/README.md +261 -2
- package/dist/bin.d.ts +2 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +11918 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/inspect.d.ts +4 -0
- package/dist/commands/run.d.ts +3 -0
- package/dist/config/define.d.ts +15 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/load.d.ts +5 -0
- package/dist/config/merge.d.ts +15 -0
- package/dist/config/types.d.ts +45 -0
- package/dist/config/validate.d.ts +2 -0
- package/dist/errors.d.ts +17 -0
- package/dist/execute/batch.d.ts +12 -0
- package/dist/execute/dry-run.d.ts +15 -0
- package/dist/execute/file-mode.d.ts +18 -0
- package/dist/execute/format.d.ts +2 -0
- package/dist/execute/guard.d.ts +16 -0
- package/dist/execute/live.d.ts +18 -0
- package/dist/execute/sql-format.d.ts +31 -0
- package/dist/execute/types.d.ts +18 -0
- package/dist/generate/generate.d.ts +17 -0
- package/dist/generate/semantic.d.ts +13 -0
- package/dist/generate/types-map.d.ts +10 -0
- package/dist/generate/types.d.ts +42 -0
- package/dist/graph/cycles.d.ts +9 -0
- package/dist/graph/order.d.ts +17 -0
- package/dist/graph/types.d.ts +10 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +11922 -0
- package/dist/introspect/assemble.d.ts +2 -0
- package/dist/introspect/index.d.ts +4 -0
- package/dist/introspect/introspect.d.ts +7 -0
- package/dist/introspect/queries.d.ts +5 -0
- package/dist/introspect/types.d.ts +60 -0
- package/dist/main.d.ts +1 -0
- package/dist/types.d.ts +26 -0
- package/package.json +68 -4
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Sql } from "postgres";
|
|
2
|
+
import type { RawColumnRow, RawConstraintRow, RawEnumRow } from "./types";
|
|
3
|
+
export declare function queryColumns(sql: Sql, schemaName: string): Promise<RawColumnRow[]>;
|
|
4
|
+
export declare function queryConstraints(sql: Sql, schemaName: string): Promise<RawConstraintRow[]>;
|
|
5
|
+
export declare function queryEnums(sql: Sql, schemaName: string): Promise<RawEnumRow[]>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export interface Schema {
|
|
2
|
+
name: string;
|
|
3
|
+
tables: Table[];
|
|
4
|
+
enums: Record<string, string[]>;
|
|
5
|
+
}
|
|
6
|
+
export interface Table {
|
|
7
|
+
name: string;
|
|
8
|
+
columns: Column[];
|
|
9
|
+
primaryKey: string[];
|
|
10
|
+
uniques: string[][];
|
|
11
|
+
foreignKeys: ForeignKey[];
|
|
12
|
+
}
|
|
13
|
+
export interface Column {
|
|
14
|
+
name: string;
|
|
15
|
+
position: number;
|
|
16
|
+
dataType: string;
|
|
17
|
+
udtName: string;
|
|
18
|
+
nullable: boolean;
|
|
19
|
+
hasDefault: boolean;
|
|
20
|
+
identity: "always" | "by_default" | null;
|
|
21
|
+
generated: boolean;
|
|
22
|
+
maxLength?: number;
|
|
23
|
+
precision?: number;
|
|
24
|
+
scale?: number;
|
|
25
|
+
isArray: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface ForeignKey {
|
|
28
|
+
name: string;
|
|
29
|
+
columns: string[];
|
|
30
|
+
refTable: string;
|
|
31
|
+
refColumns: string[];
|
|
32
|
+
nullable: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface RawColumnRow {
|
|
35
|
+
table_name: string;
|
|
36
|
+
column_name: string;
|
|
37
|
+
ordinal_position: number;
|
|
38
|
+
data_type: string;
|
|
39
|
+
udt_name: string;
|
|
40
|
+
nullable: boolean;
|
|
41
|
+
column_default: string | null;
|
|
42
|
+
character_maximum_length: number | null;
|
|
43
|
+
numeric_precision: number | null;
|
|
44
|
+
numeric_scale: number | null;
|
|
45
|
+
is_identity: boolean;
|
|
46
|
+
identity_generation: string | null;
|
|
47
|
+
is_generated: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface RawConstraintRow {
|
|
50
|
+
name: string;
|
|
51
|
+
type: "p" | "u" | "f";
|
|
52
|
+
table_name: string;
|
|
53
|
+
columns: string[];
|
|
54
|
+
ref_table: string | null;
|
|
55
|
+
ref_columns: string[] | null;
|
|
56
|
+
}
|
|
57
|
+
export interface RawEnumRow {
|
|
58
|
+
typname: string;
|
|
59
|
+
labels: string[];
|
|
60
|
+
}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function main(argv?: string[]): Promise<void>;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type OutputFormat = "text" | "json";
|
|
2
|
+
export interface GlobalOptions {
|
|
3
|
+
config: string;
|
|
4
|
+
databaseUrl?: string;
|
|
5
|
+
schema: string;
|
|
6
|
+
format: OutputFormat;
|
|
7
|
+
json?: boolean;
|
|
8
|
+
verbose?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface InitCommandOptions {
|
|
11
|
+
force?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface InspectCommandOptions extends GlobalOptions {
|
|
14
|
+
snapshot?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface RunCommandOptions extends GlobalOptions {
|
|
17
|
+
tables?: string;
|
|
18
|
+
rows?: number;
|
|
19
|
+
seed?: number;
|
|
20
|
+
dryRun?: boolean;
|
|
21
|
+
check?: boolean;
|
|
22
|
+
out?: string;
|
|
23
|
+
startId?: number;
|
|
24
|
+
snapshot?: string;
|
|
25
|
+
yes?: boolean;
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mariiodegen/seed-db",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Deterministic, relationally consistent database seeding for PostgreSQL in CI and local dev",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"seed-db": "./dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"test": "bun test",
|
|
20
|
+
"build:binary": "bun build --compile --minify --outfile dist/seed-db src/bin.ts",
|
|
21
|
+
"build:cli": "bun build src/bin.ts --target=node --outfile dist/cli.js",
|
|
22
|
+
"build:lib": "bun build src/index.ts --target=node --outfile dist/index.js",
|
|
23
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
24
|
+
"build": "bun run build:binary && bun run build:cli && bun run build:lib && bun run build:types",
|
|
25
|
+
"build:website": "bun run --cwd website build",
|
|
26
|
+
"prepack": "bun run build:cli && bun run build:lib && bun run build:types"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist/cli.js",
|
|
30
|
+
"dist/index.js",
|
|
31
|
+
"dist/index.d.ts",
|
|
32
|
+
"dist/**/*.d.ts",
|
|
33
|
+
"README.md",
|
|
34
|
+
"package.json"
|
|
35
|
+
],
|
|
36
|
+
"keywords": [
|
|
37
|
+
"postgres",
|
|
38
|
+
"postgresql",
|
|
39
|
+
"seed",
|
|
40
|
+
"database-seeding",
|
|
41
|
+
"mock-data",
|
|
42
|
+
"faker",
|
|
43
|
+
"ci",
|
|
44
|
+
"testing",
|
|
45
|
+
"kahn-algorithm",
|
|
46
|
+
"topological-sort"
|
|
47
|
+
],
|
|
48
|
+
"author": "Mario Degen",
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/mariiodegen/seed-db.git"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/mariiodegen/seed-db/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/mariiodegen/seed-db#readme",
|
|
58
|
+
"type": "module",
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@clack/prompts": "^1.9.0",
|
|
61
|
+
"@faker-js/faker": "^10.6.0",
|
|
62
|
+
"commander": "^15.1.0",
|
|
63
|
+
"picocolors": "^1.1.1",
|
|
64
|
+
"postgres": "^4.1.1"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@types/bun": "^1.4.5",
|
|
68
|
+
"@types/node": "^26.6.6"
|
|
69
|
+
}
|
|
70
|
+
}
|