@famgia/omnify-atlas 0.0.1
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/dist/index.cjs +1389 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +585 -0
- package/dist/index.d.ts +585 -0
- package/dist/index.js +1333 -0
- package/dist/index.js.map +1 -0
- package/package.json +31 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
import { SchemaCollection, DatabaseDriver, PropertyDefinition, LoadedSchema } from '@famgia/omnify-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @famgia/omnify-atlas - Lock File Types
|
|
5
|
+
*
|
|
6
|
+
* Types for the .omnify.lock file that tracks schema state.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Hash of a schema for change detection.
|
|
10
|
+
*/
|
|
11
|
+
interface SchemaHash {
|
|
12
|
+
/** Schema name */
|
|
13
|
+
readonly name: string;
|
|
14
|
+
/** Content hash (SHA-256) */
|
|
15
|
+
readonly hash: string;
|
|
16
|
+
/** File path relative to schemas directory */
|
|
17
|
+
readonly relativePath: string;
|
|
18
|
+
/** Last modified timestamp (ISO 8601) */
|
|
19
|
+
readonly modifiedAt: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generated migration record.
|
|
23
|
+
*/
|
|
24
|
+
interface GeneratedMigration {
|
|
25
|
+
/** Migration file name */
|
|
26
|
+
readonly fileName: string;
|
|
27
|
+
/** Timestamp when generated */
|
|
28
|
+
readonly generatedAt: string;
|
|
29
|
+
/** Schemas involved in this migration */
|
|
30
|
+
readonly schemas: readonly string[];
|
|
31
|
+
/** Migration checksum for integrity */
|
|
32
|
+
readonly checksum: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Lock file structure for tracking schema state.
|
|
36
|
+
*/
|
|
37
|
+
interface LockFile {
|
|
38
|
+
/** Lock file format version */
|
|
39
|
+
readonly version: 1;
|
|
40
|
+
/** When the lock file was last updated */
|
|
41
|
+
readonly updatedAt: string;
|
|
42
|
+
/** Database driver used */
|
|
43
|
+
readonly driver: string;
|
|
44
|
+
/** Hash of each schema */
|
|
45
|
+
readonly schemas: Record<string, SchemaHash>;
|
|
46
|
+
/** Record of generated migrations */
|
|
47
|
+
readonly migrations: readonly GeneratedMigration[];
|
|
48
|
+
/** HCL checksum for Atlas comparison */
|
|
49
|
+
readonly hclChecksum?: string | undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Schema change type.
|
|
53
|
+
*/
|
|
54
|
+
type ChangeType = 'added' | 'modified' | 'removed';
|
|
55
|
+
/**
|
|
56
|
+
* Detected schema change.
|
|
57
|
+
*/
|
|
58
|
+
interface SchemaChange {
|
|
59
|
+
/** Schema name */
|
|
60
|
+
readonly schemaName: string;
|
|
61
|
+
/** Type of change */
|
|
62
|
+
readonly changeType: ChangeType;
|
|
63
|
+
/** Previous hash (for modified/removed) */
|
|
64
|
+
readonly previousHash?: string;
|
|
65
|
+
/** Current hash (for added/modified) */
|
|
66
|
+
readonly currentHash?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Result of comparing current schemas to lock file.
|
|
70
|
+
*/
|
|
71
|
+
interface LockFileComparison {
|
|
72
|
+
/** Whether any changes were detected */
|
|
73
|
+
readonly hasChanges: boolean;
|
|
74
|
+
/** List of detected changes */
|
|
75
|
+
readonly changes: readonly SchemaChange[];
|
|
76
|
+
/** Schemas that are unchanged */
|
|
77
|
+
readonly unchanged: readonly string[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @famgia/omnify-atlas - Lock File Management
|
|
82
|
+
*
|
|
83
|
+
* Manages the .omnify.lock file for tracking schema state.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Default lock file name.
|
|
88
|
+
*/
|
|
89
|
+
declare const LOCK_FILE_NAME = ".omnify.lock";
|
|
90
|
+
/**
|
|
91
|
+
* Current lock file format version.
|
|
92
|
+
*/
|
|
93
|
+
declare const LOCK_FILE_VERSION: 1;
|
|
94
|
+
/**
|
|
95
|
+
* Computes SHA-256 hash of content.
|
|
96
|
+
*/
|
|
97
|
+
declare function computeHash(content: string): string;
|
|
98
|
+
/**
|
|
99
|
+
* Computes hash for a schema.
|
|
100
|
+
*/
|
|
101
|
+
declare function computeSchemaHash(schema: {
|
|
102
|
+
name: string;
|
|
103
|
+
relativePath: string;
|
|
104
|
+
properties?: unknown;
|
|
105
|
+
options?: unknown;
|
|
106
|
+
values?: readonly string[];
|
|
107
|
+
kind?: string;
|
|
108
|
+
}): string;
|
|
109
|
+
/**
|
|
110
|
+
* Creates a new empty lock file.
|
|
111
|
+
*/
|
|
112
|
+
declare function createEmptyLockFile(driver: string): LockFile;
|
|
113
|
+
/**
|
|
114
|
+
* Reads lock file from disk.
|
|
115
|
+
* Returns null if file doesn't exist.
|
|
116
|
+
*/
|
|
117
|
+
declare function readLockFile(lockFilePath: string): Promise<LockFile | null>;
|
|
118
|
+
/**
|
|
119
|
+
* Writes lock file to disk.
|
|
120
|
+
*/
|
|
121
|
+
declare function writeLockFile(lockFilePath: string, lockFile: LockFile): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Builds schema hashes from a schema collection.
|
|
124
|
+
*/
|
|
125
|
+
declare function buildSchemaHashes(schemas: SchemaCollection): Promise<Record<string, SchemaHash>>;
|
|
126
|
+
/**
|
|
127
|
+
* Compares current schemas to lock file and detects changes.
|
|
128
|
+
*/
|
|
129
|
+
declare function compareSchemas(currentHashes: Record<string, SchemaHash>, lockFile: LockFile | null): LockFileComparison;
|
|
130
|
+
/**
|
|
131
|
+
* Updates lock file with current schema state.
|
|
132
|
+
*/
|
|
133
|
+
declare function updateLockFile(existingLockFile: LockFile | null, currentHashes: Record<string, SchemaHash>, driver: string): LockFile;
|
|
134
|
+
/**
|
|
135
|
+
* Adds a migration record to the lock file.
|
|
136
|
+
*/
|
|
137
|
+
declare function addMigrationRecord(lockFile: LockFile, fileName: string, schemas: readonly string[], migrationContent: string): LockFile;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @famgia/omnify-atlas - HCL Types
|
|
141
|
+
*
|
|
142
|
+
* Types for Atlas HCL schema generation.
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* SQL column type for a specific database driver.
|
|
147
|
+
*/
|
|
148
|
+
interface SqlColumnType {
|
|
149
|
+
/** The SQL type (e.g., 'varchar(255)', 'int', 'text') */
|
|
150
|
+
readonly type: string;
|
|
151
|
+
/** Whether the column is nullable */
|
|
152
|
+
readonly nullable: boolean;
|
|
153
|
+
/** Default value (if any) */
|
|
154
|
+
readonly default?: string | undefined;
|
|
155
|
+
/** Whether this is an auto-increment column */
|
|
156
|
+
readonly autoIncrement?: boolean | undefined;
|
|
157
|
+
/** Whether this column is unsigned (for numeric types) */
|
|
158
|
+
readonly unsigned?: boolean | undefined;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* HCL column definition.
|
|
162
|
+
*/
|
|
163
|
+
interface HclColumn {
|
|
164
|
+
/** Column name */
|
|
165
|
+
readonly name: string;
|
|
166
|
+
/** SQL type info */
|
|
167
|
+
readonly type: SqlColumnType;
|
|
168
|
+
/** Whether this is a primary key */
|
|
169
|
+
readonly primaryKey?: boolean;
|
|
170
|
+
/** Whether this column has a unique constraint */
|
|
171
|
+
readonly unique?: boolean;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* HCL index definition.
|
|
175
|
+
*/
|
|
176
|
+
interface HclIndex {
|
|
177
|
+
/** Index name */
|
|
178
|
+
readonly name: string;
|
|
179
|
+
/** Columns in the index */
|
|
180
|
+
readonly columns: readonly string[];
|
|
181
|
+
/** Whether this is a unique index */
|
|
182
|
+
readonly unique?: boolean;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* HCL foreign key definition.
|
|
186
|
+
*/
|
|
187
|
+
interface HclForeignKey {
|
|
188
|
+
/** Foreign key constraint name */
|
|
189
|
+
readonly name: string;
|
|
190
|
+
/** Local column(s) */
|
|
191
|
+
readonly columns: readonly string[];
|
|
192
|
+
/** Referenced table */
|
|
193
|
+
readonly refTable: string;
|
|
194
|
+
/** Referenced column(s) */
|
|
195
|
+
readonly refColumns: readonly string[];
|
|
196
|
+
/** ON DELETE action */
|
|
197
|
+
readonly onDelete?: string;
|
|
198
|
+
/** ON UPDATE action */
|
|
199
|
+
readonly onUpdate?: string;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* HCL table definition.
|
|
203
|
+
*/
|
|
204
|
+
interface HclTable {
|
|
205
|
+
/** Table name */
|
|
206
|
+
readonly name: string;
|
|
207
|
+
/** Table columns */
|
|
208
|
+
readonly columns: readonly HclColumn[];
|
|
209
|
+
/** Table indexes */
|
|
210
|
+
readonly indexes: readonly HclIndex[];
|
|
211
|
+
/** Foreign key constraints */
|
|
212
|
+
readonly foreignKeys: readonly HclForeignKey[];
|
|
213
|
+
/** Primary key columns (if composite) */
|
|
214
|
+
readonly primaryKey?: readonly string[];
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* HCL enum definition.
|
|
218
|
+
*/
|
|
219
|
+
interface HclEnum {
|
|
220
|
+
/** Enum name */
|
|
221
|
+
readonly name: string;
|
|
222
|
+
/** Enum values */
|
|
223
|
+
readonly values: readonly string[];
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Complete HCL schema.
|
|
227
|
+
*/
|
|
228
|
+
interface HclSchema {
|
|
229
|
+
/** Database driver */
|
|
230
|
+
readonly driver: DatabaseDriver;
|
|
231
|
+
/** Schema/database name */
|
|
232
|
+
readonly schemaName?: string | undefined;
|
|
233
|
+
/** Tables in the schema */
|
|
234
|
+
readonly tables: readonly HclTable[];
|
|
235
|
+
/** Enums in the schema (PostgreSQL) */
|
|
236
|
+
readonly enums: readonly HclEnum[];
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Options for HCL generation.
|
|
240
|
+
*/
|
|
241
|
+
interface HclGenerationOptions {
|
|
242
|
+
/** Database driver */
|
|
243
|
+
readonly driver: DatabaseDriver;
|
|
244
|
+
/** Schema/database name */
|
|
245
|
+
readonly schemaName?: string;
|
|
246
|
+
/** Whether to include soft delete column */
|
|
247
|
+
readonly includeSoftDelete?: boolean;
|
|
248
|
+
/** Whether to include timestamps */
|
|
249
|
+
readonly includeTimestamps?: boolean;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* @famgia/omnify-atlas - Type Mapper
|
|
254
|
+
*
|
|
255
|
+
* Maps Omnify property types to SQL types for different database drivers.
|
|
256
|
+
*/
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Maps a property type to SQL column type.
|
|
260
|
+
*/
|
|
261
|
+
declare function mapPropertyToSql(property: PropertyDefinition, driver: DatabaseDriver): SqlColumnType;
|
|
262
|
+
/**
|
|
263
|
+
* Gets the SQL type for a primary key.
|
|
264
|
+
*/
|
|
265
|
+
declare function getPrimaryKeyType(pkType: 'Int' | 'BigInt' | 'Uuid' | 'String', driver: DatabaseDriver): SqlColumnType;
|
|
266
|
+
/**
|
|
267
|
+
* Gets the SQL type for timestamp columns.
|
|
268
|
+
*/
|
|
269
|
+
declare function getTimestampType(driver: DatabaseDriver): SqlColumnType;
|
|
270
|
+
/**
|
|
271
|
+
* Converts table name from PascalCase schema name.
|
|
272
|
+
*/
|
|
273
|
+
declare function schemaNameToTableName(schemaName: string): string;
|
|
274
|
+
/**
|
|
275
|
+
* Converts property name to column name.
|
|
276
|
+
*/
|
|
277
|
+
declare function propertyNameToColumnName(propertyName: string): string;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* @famgia/omnify-atlas - HCL Generator
|
|
281
|
+
*
|
|
282
|
+
* Generates Atlas HCL schema from Omnify schemas.
|
|
283
|
+
*/
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Generates HCL table from a schema.
|
|
287
|
+
*/
|
|
288
|
+
declare function generateHclTable(schema: LoadedSchema, allSchemas: SchemaCollection, driver: DatabaseDriver): HclTable;
|
|
289
|
+
/**
|
|
290
|
+
* Generates complete HCL schema from schema collection.
|
|
291
|
+
*/
|
|
292
|
+
declare function generateHclSchema(schemas: SchemaCollection, options: HclGenerationOptions): HclSchema;
|
|
293
|
+
/**
|
|
294
|
+
* Renders HCL schema to string.
|
|
295
|
+
*/
|
|
296
|
+
declare function renderHcl(schema: HclSchema): string;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* @famgia/omnify-atlas - Atlas Types
|
|
300
|
+
*
|
|
301
|
+
* Types for Atlas CLI integration.
|
|
302
|
+
*/
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Atlas CLI configuration.
|
|
306
|
+
*/
|
|
307
|
+
interface AtlasConfig {
|
|
308
|
+
/** Path to Atlas CLI binary (default: 'atlas') */
|
|
309
|
+
readonly binaryPath?: string;
|
|
310
|
+
/** Database driver */
|
|
311
|
+
readonly driver: DatabaseDriver;
|
|
312
|
+
/** Development database URL for diff operations */
|
|
313
|
+
readonly devUrl: string;
|
|
314
|
+
/** Working directory for Atlas operations */
|
|
315
|
+
readonly workDir?: string;
|
|
316
|
+
/** Timeout for Atlas commands in milliseconds */
|
|
317
|
+
readonly timeout?: number;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Atlas diff operation options.
|
|
321
|
+
*/
|
|
322
|
+
interface AtlasDiffOptions {
|
|
323
|
+
/** Path to the "from" schema (previous state) */
|
|
324
|
+
readonly fromPath?: string | undefined;
|
|
325
|
+
/** Path to the "to" schema (current state) */
|
|
326
|
+
readonly toPath: string;
|
|
327
|
+
/** Output format */
|
|
328
|
+
readonly format?: 'sql' | 'hcl' | undefined;
|
|
329
|
+
/** Whether to include drop statements */
|
|
330
|
+
readonly allowDestructive?: boolean | undefined;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Atlas command result.
|
|
334
|
+
*/
|
|
335
|
+
interface AtlasResult {
|
|
336
|
+
/** Whether the command succeeded */
|
|
337
|
+
readonly success: boolean;
|
|
338
|
+
/** Standard output */
|
|
339
|
+
readonly stdout: string;
|
|
340
|
+
/** Standard error */
|
|
341
|
+
readonly stderr: string;
|
|
342
|
+
/** Exit code */
|
|
343
|
+
readonly exitCode: number;
|
|
344
|
+
/** Execution time in milliseconds */
|
|
345
|
+
readonly duration: number;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Atlas diff result.
|
|
349
|
+
*/
|
|
350
|
+
interface AtlasDiffResult extends AtlasResult {
|
|
351
|
+
/** Whether there are schema changes */
|
|
352
|
+
readonly hasChanges: boolean;
|
|
353
|
+
/** SQL statements for changes */
|
|
354
|
+
readonly sql: string;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Atlas schema inspect result.
|
|
358
|
+
*/
|
|
359
|
+
interface AtlasInspectResult extends AtlasResult {
|
|
360
|
+
/** HCL schema content */
|
|
361
|
+
readonly hcl: string;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Atlas version info.
|
|
365
|
+
*/
|
|
366
|
+
interface AtlasVersion {
|
|
367
|
+
/** Atlas version string */
|
|
368
|
+
readonly version: string;
|
|
369
|
+
/** Whether Atlas is available */
|
|
370
|
+
readonly available: boolean;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* @famgia/omnify-atlas - Atlas Runner
|
|
375
|
+
*
|
|
376
|
+
* Executes Atlas CLI commands via subprocess.
|
|
377
|
+
*/
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Checks Atlas version and availability.
|
|
381
|
+
*/
|
|
382
|
+
declare function checkAtlasVersion(config?: Partial<AtlasConfig>): Promise<AtlasVersion>;
|
|
383
|
+
/**
|
|
384
|
+
* Runs Atlas schema diff.
|
|
385
|
+
*/
|
|
386
|
+
declare function runAtlasDiff(config: AtlasConfig, options: AtlasDiffOptions): Promise<AtlasDiffResult>;
|
|
387
|
+
/**
|
|
388
|
+
* Runs Atlas schema diff comparing two HCL strings.
|
|
389
|
+
*/
|
|
390
|
+
declare function diffHclSchemas(config: AtlasConfig, fromHcl: string | null, toHcl: string): Promise<AtlasDiffResult>;
|
|
391
|
+
/**
|
|
392
|
+
* Validates Atlas HCL schema.
|
|
393
|
+
*/
|
|
394
|
+
declare function validateHcl(config: AtlasConfig, hclPath: string): Promise<AtlasResult>;
|
|
395
|
+
/**
|
|
396
|
+
* Applies schema changes to the dev database (for testing).
|
|
397
|
+
*/
|
|
398
|
+
declare function applySchema(config: AtlasConfig, hclPath: string): Promise<AtlasResult>;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* @famgia/omnify-atlas - Diff Types
|
|
402
|
+
*
|
|
403
|
+
* Types for parsed schema diff results.
|
|
404
|
+
*/
|
|
405
|
+
/**
|
|
406
|
+
* Type of SQL operation.
|
|
407
|
+
*/
|
|
408
|
+
type SqlOperationType = 'CREATE_TABLE' | 'DROP_TABLE' | 'ALTER_TABLE' | 'CREATE_INDEX' | 'DROP_INDEX' | 'ADD_COLUMN' | 'DROP_COLUMN' | 'MODIFY_COLUMN' | 'ADD_FOREIGN_KEY' | 'DROP_FOREIGN_KEY' | 'ADD_CONSTRAINT' | 'DROP_CONSTRAINT' | 'UNKNOWN';
|
|
409
|
+
/**
|
|
410
|
+
* Severity of a change.
|
|
411
|
+
*/
|
|
412
|
+
type ChangeSeverity = 'safe' | 'warning' | 'destructive';
|
|
413
|
+
/**
|
|
414
|
+
* A single parsed SQL statement.
|
|
415
|
+
*/
|
|
416
|
+
interface ParsedStatement {
|
|
417
|
+
/** Original SQL statement */
|
|
418
|
+
readonly sql: string;
|
|
419
|
+
/** Type of operation */
|
|
420
|
+
readonly type: SqlOperationType;
|
|
421
|
+
/** Table name affected */
|
|
422
|
+
readonly tableName: string;
|
|
423
|
+
/** Column name (if applicable) */
|
|
424
|
+
readonly columnName?: string;
|
|
425
|
+
/** Index name (if applicable) */
|
|
426
|
+
readonly indexName?: string;
|
|
427
|
+
/** Constraint name (if applicable) */
|
|
428
|
+
readonly constraintName?: string;
|
|
429
|
+
/** Severity of the change */
|
|
430
|
+
readonly severity: ChangeSeverity;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Table change summary.
|
|
434
|
+
*/
|
|
435
|
+
interface TableChange {
|
|
436
|
+
/** Table name */
|
|
437
|
+
readonly tableName: string;
|
|
438
|
+
/** Whether the table is new */
|
|
439
|
+
readonly isNew: boolean;
|
|
440
|
+
/** Whether the table is being dropped */
|
|
441
|
+
readonly isDropped: boolean;
|
|
442
|
+
/** Columns being added */
|
|
443
|
+
readonly addedColumns: readonly string[];
|
|
444
|
+
/** Columns being dropped */
|
|
445
|
+
readonly droppedColumns: readonly string[];
|
|
446
|
+
/** Columns being modified */
|
|
447
|
+
readonly modifiedColumns: readonly string[];
|
|
448
|
+
/** Indexes being added */
|
|
449
|
+
readonly addedIndexes: readonly string[];
|
|
450
|
+
/** Indexes being dropped */
|
|
451
|
+
readonly droppedIndexes: readonly string[];
|
|
452
|
+
/** Foreign keys being added */
|
|
453
|
+
readonly addedForeignKeys: readonly string[];
|
|
454
|
+
/** Foreign keys being dropped */
|
|
455
|
+
readonly droppedForeignKeys: readonly string[];
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Complete diff result.
|
|
459
|
+
*/
|
|
460
|
+
interface DiffResult {
|
|
461
|
+
/** Whether there are any changes */
|
|
462
|
+
readonly hasChanges: boolean;
|
|
463
|
+
/** Whether there are destructive changes */
|
|
464
|
+
readonly hasDestructiveChanges: boolean;
|
|
465
|
+
/** All parsed statements */
|
|
466
|
+
readonly statements: readonly ParsedStatement[];
|
|
467
|
+
/** Changes grouped by table */
|
|
468
|
+
readonly tableChanges: Record<string, TableChange>;
|
|
469
|
+
/** Summary counts */
|
|
470
|
+
readonly summary: DiffSummary;
|
|
471
|
+
/** Raw SQL output */
|
|
472
|
+
readonly rawSql: string;
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Summary of changes.
|
|
476
|
+
*/
|
|
477
|
+
interface DiffSummary {
|
|
478
|
+
/** Total statement count */
|
|
479
|
+
readonly totalStatements: number;
|
|
480
|
+
/** Tables created */
|
|
481
|
+
readonly tablesCreated: number;
|
|
482
|
+
/** Tables dropped */
|
|
483
|
+
readonly tablesDropped: number;
|
|
484
|
+
/** Tables altered */
|
|
485
|
+
readonly tablesAltered: number;
|
|
486
|
+
/** Columns added */
|
|
487
|
+
readonly columnsAdded: number;
|
|
488
|
+
/** Columns dropped */
|
|
489
|
+
readonly columnsDropped: number;
|
|
490
|
+
/** Columns modified */
|
|
491
|
+
readonly columnsModified: number;
|
|
492
|
+
/** Indexes added */
|
|
493
|
+
readonly indexesAdded: number;
|
|
494
|
+
/** Indexes dropped */
|
|
495
|
+
readonly indexesDropped: number;
|
|
496
|
+
/** Foreign keys added */
|
|
497
|
+
readonly foreignKeysAdded: number;
|
|
498
|
+
/** Foreign keys dropped */
|
|
499
|
+
readonly foreignKeysDropped: number;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* @famgia/omnify-atlas - Diff Parser
|
|
504
|
+
*
|
|
505
|
+
* Parses Atlas SQL diff output into structured format.
|
|
506
|
+
*/
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Parses Atlas SQL diff output.
|
|
510
|
+
*/
|
|
511
|
+
declare function parseDiffOutput(sql: string): DiffResult;
|
|
512
|
+
/**
|
|
513
|
+
* Formats diff result for display.
|
|
514
|
+
*/
|
|
515
|
+
declare function formatDiffSummary(result: DiffResult): string;
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* @famgia/omnify-atlas - Preview Types
|
|
519
|
+
*
|
|
520
|
+
* Types for schema change preview.
|
|
521
|
+
*/
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Options for change preview.
|
|
525
|
+
*/
|
|
526
|
+
interface PreviewOptions {
|
|
527
|
+
/** Whether to show raw SQL output */
|
|
528
|
+
readonly showSql?: boolean;
|
|
529
|
+
/** Whether to show detailed table changes */
|
|
530
|
+
readonly showDetails?: boolean;
|
|
531
|
+
/** Whether to include warnings for destructive changes */
|
|
532
|
+
readonly warnDestructive?: boolean;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Complete change preview result.
|
|
536
|
+
*/
|
|
537
|
+
interface ChangePreview {
|
|
538
|
+
/** Whether any changes were detected */
|
|
539
|
+
readonly hasChanges: boolean;
|
|
540
|
+
/** Whether there are destructive changes */
|
|
541
|
+
readonly hasDestructiveChanges: boolean;
|
|
542
|
+
/** Schema file changes (from lock file comparison) */
|
|
543
|
+
readonly schemaChanges: LockFileComparison;
|
|
544
|
+
/** Database schema changes (from Atlas diff) */
|
|
545
|
+
readonly databaseChanges: DiffResult;
|
|
546
|
+
/** Human-readable summary */
|
|
547
|
+
readonly summary: string;
|
|
548
|
+
/** Raw SQL for changes */
|
|
549
|
+
readonly sql: string;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Preview display format.
|
|
553
|
+
*/
|
|
554
|
+
type PreviewFormat = 'text' | 'json' | 'minimal';
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* @famgia/omnify-atlas - Change Preview
|
|
558
|
+
*
|
|
559
|
+
* Generates human-readable change previews.
|
|
560
|
+
*/
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Generates a change preview for schemas.
|
|
564
|
+
*/
|
|
565
|
+
declare function generatePreview(schemas: SchemaCollection, atlasConfig: AtlasConfig, options?: PreviewOptions): Promise<ChangePreview>;
|
|
566
|
+
/**
|
|
567
|
+
* Previews changes without running Atlas (schema files only).
|
|
568
|
+
*/
|
|
569
|
+
declare function previewSchemaChanges(schemas: SchemaCollection, lockFilePath: string): Promise<{
|
|
570
|
+
hasChanges: boolean;
|
|
571
|
+
changes: readonly {
|
|
572
|
+
schemaName: string;
|
|
573
|
+
changeType: string;
|
|
574
|
+
}[];
|
|
575
|
+
}>;
|
|
576
|
+
/**
|
|
577
|
+
* Formats preview for display.
|
|
578
|
+
*/
|
|
579
|
+
declare function formatPreview(preview: ChangePreview, format?: PreviewFormat): string;
|
|
580
|
+
/**
|
|
581
|
+
* Checks if preview has blocking issues.
|
|
582
|
+
*/
|
|
583
|
+
declare function hasBlockingIssues(_preview: ChangePreview): boolean;
|
|
584
|
+
|
|
585
|
+
export { type AtlasConfig, type AtlasDiffOptions, type AtlasDiffResult, type AtlasInspectResult, type AtlasResult, type AtlasVersion, type ChangePreview, type ChangeSeverity, type ChangeType, type DiffResult, type DiffSummary, type GeneratedMigration, type HclColumn, type HclEnum, type HclForeignKey, type HclGenerationOptions, type HclIndex, type HclSchema, type HclTable, LOCK_FILE_NAME, LOCK_FILE_VERSION, type LockFile, type LockFileComparison, type ParsedStatement, type PreviewFormat, type PreviewOptions, type SchemaChange, type SchemaHash, type SqlColumnType, type SqlOperationType, type TableChange, addMigrationRecord, applySchema, buildSchemaHashes, checkAtlasVersion, compareSchemas, computeHash, computeSchemaHash, createEmptyLockFile, diffHclSchemas, formatDiffSummary, formatPreview, generateHclSchema, generateHclTable, generatePreview, getPrimaryKeyType, getTimestampType, hasBlockingIssues, mapPropertyToSql, parseDiffOutput, previewSchemaChanges, propertyNameToColumnName, readLockFile, renderHcl, runAtlasDiff, schemaNameToTableName, updateLockFile, validateHcl, writeLockFile };
|