zenstack-kit 0.1.1 → 0.1.2

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.
Files changed (49) hide show
  1. package/dist/cli/app.d.ts.map +1 -1
  2. package/dist/cli/app.js +9 -28
  3. package/dist/cli/commands.d.ts +3 -1
  4. package/dist/cli/commands.d.ts.map +1 -1
  5. package/dist/cli/commands.js +17 -1
  6. package/dist/cli/index.js +0 -0
  7. package/dist/cli/prompts.d.ts +9 -0
  8. package/dist/cli/prompts.d.ts.map +1 -1
  9. package/dist/cli/prompts.js +57 -1
  10. package/package.json +1 -5
  11. package/dist/cli.d.ts +0 -12
  12. package/dist/cli.d.ts.map +0 -1
  13. package/dist/cli.js +0 -240
  14. package/dist/config-loader.d.ts +0 -6
  15. package/dist/config-loader.d.ts.map +0 -1
  16. package/dist/config-loader.js +0 -36
  17. package/dist/config.d.ts +0 -62
  18. package/dist/config.d.ts.map +0 -1
  19. package/dist/config.js +0 -44
  20. package/dist/init-prompts.d.ts +0 -13
  21. package/dist/init-prompts.d.ts.map +0 -1
  22. package/dist/init-prompts.js +0 -64
  23. package/dist/introspect.d.ts +0 -54
  24. package/dist/introspect.d.ts.map +0 -1
  25. package/dist/introspect.js +0 -75
  26. package/dist/kysely-adapter.d.ts +0 -49
  27. package/dist/kysely-adapter.d.ts.map +0 -1
  28. package/dist/kysely-adapter.js +0 -74
  29. package/dist/migrate-apply.d.ts +0 -18
  30. package/dist/migrate-apply.d.ts.map +0 -1
  31. package/dist/migrate-apply.js +0 -61
  32. package/dist/migrations.d.ts +0 -161
  33. package/dist/migrations.d.ts.map +0 -1
  34. package/dist/migrations.js +0 -620
  35. package/dist/prisma-migrations.d.ts +0 -160
  36. package/dist/prisma-migrations.d.ts.map +0 -1
  37. package/dist/prisma-migrations.js +0 -789
  38. package/dist/prompts.d.ts +0 -10
  39. package/dist/prompts.d.ts.map +0 -1
  40. package/dist/prompts.js +0 -41
  41. package/dist/pull.d.ts +0 -23
  42. package/dist/pull.d.ts.map +0 -1
  43. package/dist/pull.js +0 -424
  44. package/dist/schema-snapshot.d.ts +0 -45
  45. package/dist/schema-snapshot.d.ts.map +0 -1
  46. package/dist/schema-snapshot.js +0 -265
  47. package/dist/sql-compiler.d.ts +0 -74
  48. package/dist/sql-compiler.d.ts.map +0 -1
  49. package/dist/sql-compiler.js +0 -243
@@ -1,160 +0,0 @@
1
- /**
2
- * Prisma-compatible migrations
3
- *
4
- * Generates migrations in Prisma format:
5
- * - Folder structure: migrations/<timestamp>_<name>/migration.sql
6
- * - Tracks migrations in _prisma_migrations table
7
- * - Compatible with `prisma migrate deploy`
8
- */
9
- import type { KyselyDialect } from "./kysely-adapter.js";
10
- import type { SchemaSnapshot } from "./schema-snapshot.js";
11
- export interface PrismaMigrationOptions {
12
- /** Migration name */
13
- name: string;
14
- /** Path to ZenStack schema file */
15
- schemaPath: string;
16
- /** Output directory for migration files */
17
- outputPath: string;
18
- /** Database dialect for SQL generation */
19
- dialect: KyselyDialect;
20
- /** Table rename mappings */
21
- renameTables?: Array<{
22
- from: string;
23
- to: string;
24
- }>;
25
- /** Column rename mappings */
26
- renameColumns?: Array<{
27
- table: string;
28
- from: string;
29
- to: string;
30
- }>;
31
- }
32
- export interface PrismaMigration {
33
- /** Migration folder name (timestamp_name) */
34
- folderName: string;
35
- /** Full path to migration folder */
36
- folderPath: string;
37
- /** SQL content */
38
- sql: string;
39
- /** Timestamp */
40
- timestamp: number;
41
- }
42
- export interface ApplyPrismaMigrationsOptions {
43
- /** Migrations folder path */
44
- migrationsFolder: string;
45
- /** Database dialect */
46
- dialect: KyselyDialect;
47
- /** Database connection URL */
48
- connectionUrl?: string;
49
- /** SQLite database path */
50
- databasePath?: string;
51
- /** Migrations table name (default: _prisma_migrations) */
52
- migrationsTable?: string;
53
- /** Migrations schema (PostgreSQL only, default: public) */
54
- migrationsSchema?: string;
55
- }
56
- export interface ApplyPrismaMigrationsResult {
57
- applied: Array<{
58
- migrationName: string;
59
- duration: number;
60
- }>;
61
- alreadyApplied: string[];
62
- failed?: {
63
- migrationName: string;
64
- error: string;
65
- };
66
- }
67
- /**
68
- * Generate timestamp string for migration folder name
69
- */
70
- export declare function generateTimestamp(): string;
71
- /**
72
- * Get paths for snapshot file
73
- */
74
- declare function getSnapshotPaths(outputPath: string): {
75
- metaDir: string;
76
- snapshotPath: string;
77
- };
78
- /**
79
- * Write snapshot to file
80
- */
81
- export declare function writeSnapshot(snapshotPath: string, schema: SchemaSnapshot): Promise<void>;
82
- /**
83
- * Create a Prisma-compatible migration
84
- */
85
- export declare function createPrismaMigration(options: PrismaMigrationOptions): Promise<PrismaMigration | null>;
86
- export interface CreateInitialMigrationOptions {
87
- /** Migration name (default: "init") */
88
- name?: string;
89
- /** Path to ZenStack schema file */
90
- schemaPath: string;
91
- /** Output directory for migration files */
92
- outputPath: string;
93
- /** Database dialect for SQL generation */
94
- dialect: KyselyDialect;
95
- }
96
- /**
97
- * Create an initial migration that creates all tables from scratch.
98
- * This is used when initializing a project where the database is empty.
99
- */
100
- export declare function createInitialMigration(options: CreateInitialMigrationOptions): Promise<PrismaMigration>;
101
- /**
102
- * Calculate SHA256 checksum of migration SQL
103
- */
104
- export declare function calculateChecksum(sql: string): string;
105
- /**
106
- * Apply pending Prisma migrations
107
- */
108
- export declare function applyPrismaMigrations(options: ApplyPrismaMigrationsOptions): Promise<ApplyPrismaMigrationsResult>;
109
- /**
110
- * Check if there are schema changes
111
- */
112
- export declare function hasPrismaSchemaChanges(options: {
113
- schemaPath: string;
114
- outputPath: string;
115
- }): Promise<boolean>;
116
- export interface MigrationLogEntry {
117
- /** Migration folder name e.g. "20260108120000_init" */
118
- name: string;
119
- /** SHA256 checksum of migration.sql content (64 hex chars) */
120
- checksum: string;
121
- }
122
- /**
123
- * Get the path to the migration log file
124
- */
125
- export declare function getMigrationLogPath(outputPath: string): string;
126
- /**
127
- * Read migration log file
128
- */
129
- export declare function readMigrationLog(outputPath: string): Promise<MigrationLogEntry[]>;
130
- /**
131
- * Write migration log file
132
- */
133
- export declare function writeMigrationLog(outputPath: string, entries: MigrationLogEntry[]): Promise<void>;
134
- /**
135
- * Append a single entry to the migration log
136
- */
137
- export declare function appendToMigrationLog(outputPath: string, entry: MigrationLogEntry): Promise<void>;
138
- /**
139
- * Scan migration folders and compute checksums for each
140
- */
141
- export declare function scanMigrationFolders(outputPath: string): Promise<MigrationLogEntry[]>;
142
- /**
143
- * Check if snapshot exists
144
- */
145
- export declare function hasSnapshot(outputPath: string): Promise<boolean>;
146
- /**
147
- * Initialize snapshot from schema without generating migration
148
- */
149
- export declare function initializeSnapshot(options: {
150
- schemaPath: string;
151
- outputPath: string;
152
- }): Promise<{
153
- snapshotPath: string;
154
- tableCount: number;
155
- }>;
156
- /**
157
- * Export getSnapshotPaths for external use
158
- */
159
- export { getSnapshotPaths };
160
- //# sourceMappingURL=prisma-migrations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prisma-migrations.d.ts","sourceRoot":"","sources":["../src/prisma-migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAA6B,MAAM,sBAAsB,CAAC;AAkBtF,MAAM,WAAW,sBAAsB;IACrC,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,OAAO,EAAE,aAAa,CAAC;IACvB,4BAA4B;IAC5B,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,6BAA6B;IAC7B,aAAa,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MA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