@famgia/omnify-atlas 0.0.110 → 0.0.112
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 +366 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +255 -1
- package/dist/index.d.ts +255 -1
- package/dist/index.js +347 -12
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -368,6 +368,260 @@ declare function getMigrationsToRegenerate(lockFile: LockFile, missingFiles: rea
|
|
|
368
368
|
schemas: readonly string[];
|
|
369
369
|
}>;
|
|
370
370
|
|
|
371
|
+
/**
|
|
372
|
+
* @famgia/omnify-atlas - Version Chain Types
|
|
373
|
+
*
|
|
374
|
+
* Blockchain-like immutable version tracking for production deployments.
|
|
375
|
+
* 一度ロックされたスキーマは変更・削除不可能
|
|
376
|
+
*/
|
|
377
|
+
/**
|
|
378
|
+
* スキーマファイルのハッシュ情報(ブロック内)
|
|
379
|
+
*/
|
|
380
|
+
interface ChainSchemaEntry {
|
|
381
|
+
/** スキーマ名 */
|
|
382
|
+
readonly name: string;
|
|
383
|
+
/** ファイルの相対パス */
|
|
384
|
+
readonly relativePath: string;
|
|
385
|
+
/** コンテンツのSHA-256ハッシュ */
|
|
386
|
+
readonly contentHash: string;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* バージョンブロック - チェーン内の1つのロック状態
|
|
390
|
+
*/
|
|
391
|
+
interface VersionBlock {
|
|
392
|
+
/** バージョン識別子(semantic version または timestamp) */
|
|
393
|
+
readonly version: string;
|
|
394
|
+
/** このブロックのハッシュ(全コンテンツのSHA-256) */
|
|
395
|
+
readonly blockHash: string;
|
|
396
|
+
/** 前のブロックのハッシュ(genesis blockはnull) */
|
|
397
|
+
readonly previousHash: string | null;
|
|
398
|
+
/** ロック時刻(ISO 8601) */
|
|
399
|
+
readonly lockedAt: string;
|
|
400
|
+
/** デプロイ環境(production, staging等) */
|
|
401
|
+
readonly environment: string;
|
|
402
|
+
/** デプロイ者(オプション) */
|
|
403
|
+
readonly deployedBy?: string | undefined;
|
|
404
|
+
/** ロック時点のスキーマ一覧 */
|
|
405
|
+
readonly schemas: readonly ChainSchemaEntry[];
|
|
406
|
+
/** デプロイコメント(オプション) */
|
|
407
|
+
readonly comment?: string | undefined;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* バージョンチェーン - ブロックチェーンライクな不変性管理
|
|
411
|
+
*/
|
|
412
|
+
interface VersionChain {
|
|
413
|
+
/** フォーマットバージョン */
|
|
414
|
+
readonly version: 1;
|
|
415
|
+
/** チェーンのタイプ識別子 */
|
|
416
|
+
readonly type: 'omnify-version-chain';
|
|
417
|
+
/** 最初のブロックのハッシュ(genesis) */
|
|
418
|
+
readonly genesisHash: string | null;
|
|
419
|
+
/** 最新ブロックのハッシュ */
|
|
420
|
+
readonly latestHash: string | null;
|
|
421
|
+
/** 全てのブロック */
|
|
422
|
+
readonly blocks: readonly VersionBlock[];
|
|
423
|
+
/** チェーン作成日時 */
|
|
424
|
+
readonly createdAt: string;
|
|
425
|
+
/** 最終更新日時 */
|
|
426
|
+
readonly updatedAt: string;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* チェーン検証結果
|
|
430
|
+
*/
|
|
431
|
+
interface ChainVerificationResult {
|
|
432
|
+
/** チェーン全体が有効か */
|
|
433
|
+
readonly valid: boolean;
|
|
434
|
+
/** ブロック数 */
|
|
435
|
+
readonly blockCount: number;
|
|
436
|
+
/** 検証したブロック */
|
|
437
|
+
readonly verifiedBlocks: readonly string[];
|
|
438
|
+
/** 破損したブロック(もしあれば) */
|
|
439
|
+
readonly corruptedBlocks: readonly CorruptedBlockInfo[];
|
|
440
|
+
/** 不正に変更されたスキーマ */
|
|
441
|
+
readonly tamperedSchemas: readonly TamperedSchemaInfo[];
|
|
442
|
+
/** 削除されたがロック済みのスキーマ */
|
|
443
|
+
readonly deletedLockedSchemas: readonly DeletedSchemaInfo[];
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* 破損ブロック情報
|
|
447
|
+
*/
|
|
448
|
+
interface CorruptedBlockInfo {
|
|
449
|
+
/** ブロックのバージョン */
|
|
450
|
+
readonly version: string;
|
|
451
|
+
/** 期待されるハッシュ */
|
|
452
|
+
readonly expectedHash: string;
|
|
453
|
+
/** 実際のハッシュ */
|
|
454
|
+
readonly actualHash: string;
|
|
455
|
+
/** 問題の詳細 */
|
|
456
|
+
readonly reason: string;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* 改ざんされたスキーマ情報
|
|
460
|
+
*/
|
|
461
|
+
interface TamperedSchemaInfo {
|
|
462
|
+
/** スキーマ名 */
|
|
463
|
+
readonly schemaName: string;
|
|
464
|
+
/** ファイルパス */
|
|
465
|
+
readonly filePath: string;
|
|
466
|
+
/** ロック時のハッシュ */
|
|
467
|
+
readonly lockedHash: string;
|
|
468
|
+
/** 現在のハッシュ */
|
|
469
|
+
readonly currentHash: string;
|
|
470
|
+
/** どのバージョンでロックされたか */
|
|
471
|
+
readonly lockedInVersion: string;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* 削除されたロック済みスキーマ情報
|
|
475
|
+
*/
|
|
476
|
+
interface DeletedSchemaInfo {
|
|
477
|
+
/** スキーマ名 */
|
|
478
|
+
readonly schemaName: string;
|
|
479
|
+
/** ファイルパス */
|
|
480
|
+
readonly filePath: string;
|
|
481
|
+
/** どのバージョンでロックされたか */
|
|
482
|
+
readonly lockedInVersion: string;
|
|
483
|
+
/** ロック時のハッシュ */
|
|
484
|
+
readonly lockedHash: string;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* デプロイオプション
|
|
488
|
+
*/
|
|
489
|
+
interface DeployOptions {
|
|
490
|
+
/** バージョン名(省略時は自動生成) */
|
|
491
|
+
readonly version?: string | undefined;
|
|
492
|
+
/** 環境名 */
|
|
493
|
+
readonly environment: string;
|
|
494
|
+
/** デプロイ者 */
|
|
495
|
+
readonly deployedBy?: string | undefined;
|
|
496
|
+
/** コメント */
|
|
497
|
+
readonly comment?: string | undefined;
|
|
498
|
+
/** 確認をスキップ(CI用) */
|
|
499
|
+
readonly skipConfirmation?: boolean | undefined;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* デプロイ結果
|
|
503
|
+
*/
|
|
504
|
+
interface DeployResult {
|
|
505
|
+
/** 成功したか */
|
|
506
|
+
readonly success: boolean;
|
|
507
|
+
/** 作成されたブロック(成功時) */
|
|
508
|
+
readonly block?: VersionBlock | undefined;
|
|
509
|
+
/** エラーメッセージ(失敗時) */
|
|
510
|
+
readonly error?: string | undefined;
|
|
511
|
+
/** 新しく追加されたスキーマ */
|
|
512
|
+
readonly addedSchemas: readonly string[];
|
|
513
|
+
/** 変更されたスキーマ(警告) */
|
|
514
|
+
readonly modifiedSchemas: readonly string[];
|
|
515
|
+
/** バージョン変更は警告だが許可される */
|
|
516
|
+
readonly warnings: readonly string[];
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* ロック状態チェック結果
|
|
520
|
+
*/
|
|
521
|
+
interface LockCheckResult {
|
|
522
|
+
/** 操作が許可されるか */
|
|
523
|
+
readonly allowed: boolean;
|
|
524
|
+
/** ブロックされた理由(allowed=falseの場合) */
|
|
525
|
+
readonly reason?: string | undefined;
|
|
526
|
+
/** 影響を受けるロック済みスキーマ */
|
|
527
|
+
readonly affectedSchemas: readonly string[];
|
|
528
|
+
/** ロックを実行したバージョン */
|
|
529
|
+
readonly lockedInVersions: readonly string[];
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* @famgia/omnify-atlas - Version Chain Management
|
|
534
|
+
*
|
|
535
|
+
* Blockchain-like immutable version tracking for production deployments.
|
|
536
|
+
* ブロックチェーン風の不変性管理システム
|
|
537
|
+
*/
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* チェーンファイル名
|
|
541
|
+
*/
|
|
542
|
+
declare const VERSION_CHAIN_FILE = ".omnify.chain";
|
|
543
|
+
/**
|
|
544
|
+
* SHA-256ハッシュを計算
|
|
545
|
+
*/
|
|
546
|
+
declare function computeSha256(content: string): string;
|
|
547
|
+
/**
|
|
548
|
+
* ブロックのハッシュを計算
|
|
549
|
+
* previousHash + version + lockedAt + schemas を含む
|
|
550
|
+
*/
|
|
551
|
+
declare function computeBlockHash(previousHash: string | null, version: string, lockedAt: string, environment: string, schemas: readonly ChainSchemaEntry[]): string;
|
|
552
|
+
/**
|
|
553
|
+
* 空のチェーンを作成
|
|
554
|
+
*/
|
|
555
|
+
declare function createEmptyChain(): VersionChain;
|
|
556
|
+
/**
|
|
557
|
+
* チェーンファイルを読み込む
|
|
558
|
+
*/
|
|
559
|
+
declare function readVersionChain(chainFilePath: string): Promise<VersionChain | null>;
|
|
560
|
+
/**
|
|
561
|
+
* チェーンファイルを書き込む
|
|
562
|
+
*/
|
|
563
|
+
declare function writeVersionChain(chainFilePath: string, chain: VersionChain): Promise<void>;
|
|
564
|
+
/**
|
|
565
|
+
* スキーマディレクトリから現在のスキーマエントリを構築
|
|
566
|
+
*/
|
|
567
|
+
declare function buildCurrentSchemaEntries(schemasDir: string, schemaFiles: readonly {
|
|
568
|
+
name: string;
|
|
569
|
+
relativePath: string;
|
|
570
|
+
filePath: string;
|
|
571
|
+
}[]): Promise<ChainSchemaEntry[]>;
|
|
572
|
+
/**
|
|
573
|
+
* 自動バージョン名を生成
|
|
574
|
+
*/
|
|
575
|
+
declare function generateVersionName(): string;
|
|
576
|
+
/**
|
|
577
|
+
* チェーン整合性を検証
|
|
578
|
+
*/
|
|
579
|
+
declare function verifyChain(chain: VersionChain, schemasDir: string): Promise<ChainVerificationResult>;
|
|
580
|
+
/**
|
|
581
|
+
* スキーマ削除/変更がロックに違反するかチェック
|
|
582
|
+
*/
|
|
583
|
+
declare function checkLockViolation(chain: VersionChain, schemaName: string, action: 'delete' | 'modify'): LockCheckResult;
|
|
584
|
+
/**
|
|
585
|
+
* 複数スキーマのロック違反を一括チェック
|
|
586
|
+
*/
|
|
587
|
+
declare function checkBulkLockViolation(chain: VersionChain, schemas: readonly {
|
|
588
|
+
name: string;
|
|
589
|
+
action: 'delete' | 'modify';
|
|
590
|
+
}[]): LockCheckResult;
|
|
591
|
+
/**
|
|
592
|
+
* 新しいブロックを作成してチェーンに追加
|
|
593
|
+
*/
|
|
594
|
+
declare function createDeployBlock(chain: VersionChain, schemas: readonly ChainSchemaEntry[], options: DeployOptions): {
|
|
595
|
+
chain: VersionChain;
|
|
596
|
+
block: VersionBlock;
|
|
597
|
+
};
|
|
598
|
+
/**
|
|
599
|
+
* デプロイ実行(スキーマをロック)
|
|
600
|
+
*/
|
|
601
|
+
declare function deployVersion(chainFilePath: string, schemasDir: string, schemaFiles: readonly {
|
|
602
|
+
name: string;
|
|
603
|
+
relativePath: string;
|
|
604
|
+
filePath: string;
|
|
605
|
+
}[], options: DeployOptions): Promise<DeployResult>;
|
|
606
|
+
/**
|
|
607
|
+
* ロック済みスキーマ一覧を取得
|
|
608
|
+
*/
|
|
609
|
+
declare function getLockedSchemas(chain: VersionChain): Map<string, {
|
|
610
|
+
hash: string;
|
|
611
|
+
version: string;
|
|
612
|
+
relativePath: string;
|
|
613
|
+
}>;
|
|
614
|
+
/**
|
|
615
|
+
* チェーンのサマリーを取得
|
|
616
|
+
*/
|
|
617
|
+
declare function getChainSummary(chain: VersionChain): {
|
|
618
|
+
blockCount: number;
|
|
619
|
+
schemaCount: number;
|
|
620
|
+
firstVersion: string | null;
|
|
621
|
+
latestVersion: string | null;
|
|
622
|
+
environments: string[];
|
|
623
|
+
};
|
|
624
|
+
|
|
371
625
|
/**
|
|
372
626
|
* @famgia/omnify-atlas - HCL Types
|
|
373
627
|
*
|
|
@@ -814,4 +1068,4 @@ declare function formatPreview(preview: ChangePreview, format?: PreviewFormat):
|
|
|
814
1068
|
*/
|
|
815
1069
|
declare function hasBlockingIssues(_preview: ChangePreview): boolean;
|
|
816
1070
|
|
|
817
|
-
export { type AtlasConfig, type AtlasDiffOptions, type AtlasDiffResult, type AtlasInspectResult, type AtlasResult, type AtlasVersion, type ChangePreview, type ChangeSeverity, type ChangeType, type ColumnChange, type DiffResult, type DiffSummary, type GeneratedMigration, type HclColumn, type HclEnum, type HclForeignKey, type HclGenerationOptions, type HclIndex, type HclSchema, type HclTable, type IndexChange, type IndexSnapshot, LOCK_FILE_NAME, LOCK_FILE_VERSION, type LockFile, type LockFileComparison, type LockFileV1, type LockFileV2, type MigrationValidation, type ParsedStatement, type PreviewFormat, type PreviewOptions, type PropertySnapshot, type SchemaChange, type SchemaHash, type SchemaSnapshot, type SqlColumnType, type SqlOperationType, type TableChange, addEnhancedMigrationRecord, addMigrationRecord, applySchema, buildSchemaHashes, buildSchemaSnapshots, checkAtlasVersion, compareSchemas, compareSchemasDeep, computeHash, computeSchemaHash, createEmptyLockFile, diffHclSchemas, extractTableNameFromFilename, extractTimestampFromFilename, findMigrationByTable, formatDiffSummary, formatPreview, generateHclSchema, generateHclTable, generatePreview, getMigrationsToRegenerate, getPrimaryKeyType, getTimestampType, hasBlockingIssues, isLockFileV2, mapPropertyToSql, parseDiffOutput, previewSchemaChanges, propertyNameToColumnName, propertyToSnapshot, readLockFile, renderHcl, runAtlasDiff, schemaNameToTableName, schemaToSnapshot, updateLockFile, updateLockFileV1, validateHcl, validateMigrations, writeLockFile };
|
|
1071
|
+
export { type AtlasConfig, type AtlasDiffOptions, type AtlasDiffResult, type AtlasInspectResult, type AtlasResult, type AtlasVersion, type ChainSchemaEntry, type ChainVerificationResult, type ChangePreview, type ChangeSeverity, type ChangeType, type ColumnChange, type CorruptedBlockInfo, type DeletedSchemaInfo, type DeployOptions, type DeployResult, type DiffResult, type DiffSummary, type GeneratedMigration, type HclColumn, type HclEnum, type HclForeignKey, type HclGenerationOptions, type HclIndex, type HclSchema, type HclTable, type IndexChange, type IndexSnapshot, LOCK_FILE_NAME, LOCK_FILE_VERSION, type LockCheckResult, type LockFile, type LockFileComparison, type LockFileV1, type LockFileV2, type MigrationValidation, type ParsedStatement, type PreviewFormat, type PreviewOptions, type PropertySnapshot, type SchemaChange, type SchemaHash, type SchemaSnapshot, type SqlColumnType, type SqlOperationType, type TableChange, type TamperedSchemaInfo, VERSION_CHAIN_FILE, type VersionBlock, type VersionChain, addEnhancedMigrationRecord, addMigrationRecord, applySchema, buildCurrentSchemaEntries, buildSchemaHashes, buildSchemaSnapshots, checkAtlasVersion, checkBulkLockViolation, checkLockViolation, compareSchemas, compareSchemasDeep, computeBlockHash, computeHash, computeSchemaHash, computeSha256, createDeployBlock, createEmptyChain, createEmptyLockFile, deployVersion, diffHclSchemas, extractTableNameFromFilename, extractTimestampFromFilename, findMigrationByTable, formatDiffSummary, formatPreview, generateHclSchema, generateHclTable, generatePreview, generateVersionName, getChainSummary, getLockedSchemas, getMigrationsToRegenerate, getPrimaryKeyType, getTimestampType, hasBlockingIssues, isLockFileV2, mapPropertyToSql, parseDiffOutput, previewSchemaChanges, propertyNameToColumnName, propertyToSnapshot, readLockFile, readVersionChain, renderHcl, runAtlasDiff, schemaNameToTableName, schemaToSnapshot, updateLockFile, updateLockFileV1, validateHcl, validateMigrations, verifyChain, writeLockFile, writeVersionChain };
|
package/dist/index.d.ts
CHANGED
|
@@ -368,6 +368,260 @@ declare function getMigrationsToRegenerate(lockFile: LockFile, missingFiles: rea
|
|
|
368
368
|
schemas: readonly string[];
|
|
369
369
|
}>;
|
|
370
370
|
|
|
371
|
+
/**
|
|
372
|
+
* @famgia/omnify-atlas - Version Chain Types
|
|
373
|
+
*
|
|
374
|
+
* Blockchain-like immutable version tracking for production deployments.
|
|
375
|
+
* 一度ロックされたスキーマは変更・削除不可能
|
|
376
|
+
*/
|
|
377
|
+
/**
|
|
378
|
+
* スキーマファイルのハッシュ情報(ブロック内)
|
|
379
|
+
*/
|
|
380
|
+
interface ChainSchemaEntry {
|
|
381
|
+
/** スキーマ名 */
|
|
382
|
+
readonly name: string;
|
|
383
|
+
/** ファイルの相対パス */
|
|
384
|
+
readonly relativePath: string;
|
|
385
|
+
/** コンテンツのSHA-256ハッシュ */
|
|
386
|
+
readonly contentHash: string;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* バージョンブロック - チェーン内の1つのロック状態
|
|
390
|
+
*/
|
|
391
|
+
interface VersionBlock {
|
|
392
|
+
/** バージョン識別子(semantic version または timestamp) */
|
|
393
|
+
readonly version: string;
|
|
394
|
+
/** このブロックのハッシュ(全コンテンツのSHA-256) */
|
|
395
|
+
readonly blockHash: string;
|
|
396
|
+
/** 前のブロックのハッシュ(genesis blockはnull) */
|
|
397
|
+
readonly previousHash: string | null;
|
|
398
|
+
/** ロック時刻(ISO 8601) */
|
|
399
|
+
readonly lockedAt: string;
|
|
400
|
+
/** デプロイ環境(production, staging等) */
|
|
401
|
+
readonly environment: string;
|
|
402
|
+
/** デプロイ者(オプション) */
|
|
403
|
+
readonly deployedBy?: string | undefined;
|
|
404
|
+
/** ロック時点のスキーマ一覧 */
|
|
405
|
+
readonly schemas: readonly ChainSchemaEntry[];
|
|
406
|
+
/** デプロイコメント(オプション) */
|
|
407
|
+
readonly comment?: string | undefined;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* バージョンチェーン - ブロックチェーンライクな不変性管理
|
|
411
|
+
*/
|
|
412
|
+
interface VersionChain {
|
|
413
|
+
/** フォーマットバージョン */
|
|
414
|
+
readonly version: 1;
|
|
415
|
+
/** チェーンのタイプ識別子 */
|
|
416
|
+
readonly type: 'omnify-version-chain';
|
|
417
|
+
/** 最初のブロックのハッシュ(genesis) */
|
|
418
|
+
readonly genesisHash: string | null;
|
|
419
|
+
/** 最新ブロックのハッシュ */
|
|
420
|
+
readonly latestHash: string | null;
|
|
421
|
+
/** 全てのブロック */
|
|
422
|
+
readonly blocks: readonly VersionBlock[];
|
|
423
|
+
/** チェーン作成日時 */
|
|
424
|
+
readonly createdAt: string;
|
|
425
|
+
/** 最終更新日時 */
|
|
426
|
+
readonly updatedAt: string;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* チェーン検証結果
|
|
430
|
+
*/
|
|
431
|
+
interface ChainVerificationResult {
|
|
432
|
+
/** チェーン全体が有効か */
|
|
433
|
+
readonly valid: boolean;
|
|
434
|
+
/** ブロック数 */
|
|
435
|
+
readonly blockCount: number;
|
|
436
|
+
/** 検証したブロック */
|
|
437
|
+
readonly verifiedBlocks: readonly string[];
|
|
438
|
+
/** 破損したブロック(もしあれば) */
|
|
439
|
+
readonly corruptedBlocks: readonly CorruptedBlockInfo[];
|
|
440
|
+
/** 不正に変更されたスキーマ */
|
|
441
|
+
readonly tamperedSchemas: readonly TamperedSchemaInfo[];
|
|
442
|
+
/** 削除されたがロック済みのスキーマ */
|
|
443
|
+
readonly deletedLockedSchemas: readonly DeletedSchemaInfo[];
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* 破損ブロック情報
|
|
447
|
+
*/
|
|
448
|
+
interface CorruptedBlockInfo {
|
|
449
|
+
/** ブロックのバージョン */
|
|
450
|
+
readonly version: string;
|
|
451
|
+
/** 期待されるハッシュ */
|
|
452
|
+
readonly expectedHash: string;
|
|
453
|
+
/** 実際のハッシュ */
|
|
454
|
+
readonly actualHash: string;
|
|
455
|
+
/** 問題の詳細 */
|
|
456
|
+
readonly reason: string;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* 改ざんされたスキーマ情報
|
|
460
|
+
*/
|
|
461
|
+
interface TamperedSchemaInfo {
|
|
462
|
+
/** スキーマ名 */
|
|
463
|
+
readonly schemaName: string;
|
|
464
|
+
/** ファイルパス */
|
|
465
|
+
readonly filePath: string;
|
|
466
|
+
/** ロック時のハッシュ */
|
|
467
|
+
readonly lockedHash: string;
|
|
468
|
+
/** 現在のハッシュ */
|
|
469
|
+
readonly currentHash: string;
|
|
470
|
+
/** どのバージョンでロックされたか */
|
|
471
|
+
readonly lockedInVersion: string;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* 削除されたロック済みスキーマ情報
|
|
475
|
+
*/
|
|
476
|
+
interface DeletedSchemaInfo {
|
|
477
|
+
/** スキーマ名 */
|
|
478
|
+
readonly schemaName: string;
|
|
479
|
+
/** ファイルパス */
|
|
480
|
+
readonly filePath: string;
|
|
481
|
+
/** どのバージョンでロックされたか */
|
|
482
|
+
readonly lockedInVersion: string;
|
|
483
|
+
/** ロック時のハッシュ */
|
|
484
|
+
readonly lockedHash: string;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* デプロイオプション
|
|
488
|
+
*/
|
|
489
|
+
interface DeployOptions {
|
|
490
|
+
/** バージョン名(省略時は自動生成) */
|
|
491
|
+
readonly version?: string | undefined;
|
|
492
|
+
/** 環境名 */
|
|
493
|
+
readonly environment: string;
|
|
494
|
+
/** デプロイ者 */
|
|
495
|
+
readonly deployedBy?: string | undefined;
|
|
496
|
+
/** コメント */
|
|
497
|
+
readonly comment?: string | undefined;
|
|
498
|
+
/** 確認をスキップ(CI用) */
|
|
499
|
+
readonly skipConfirmation?: boolean | undefined;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* デプロイ結果
|
|
503
|
+
*/
|
|
504
|
+
interface DeployResult {
|
|
505
|
+
/** 成功したか */
|
|
506
|
+
readonly success: boolean;
|
|
507
|
+
/** 作成されたブロック(成功時) */
|
|
508
|
+
readonly block?: VersionBlock | undefined;
|
|
509
|
+
/** エラーメッセージ(失敗時) */
|
|
510
|
+
readonly error?: string | undefined;
|
|
511
|
+
/** 新しく追加されたスキーマ */
|
|
512
|
+
readonly addedSchemas: readonly string[];
|
|
513
|
+
/** 変更されたスキーマ(警告) */
|
|
514
|
+
readonly modifiedSchemas: readonly string[];
|
|
515
|
+
/** バージョン変更は警告だが許可される */
|
|
516
|
+
readonly warnings: readonly string[];
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* ロック状態チェック結果
|
|
520
|
+
*/
|
|
521
|
+
interface LockCheckResult {
|
|
522
|
+
/** 操作が許可されるか */
|
|
523
|
+
readonly allowed: boolean;
|
|
524
|
+
/** ブロックされた理由(allowed=falseの場合) */
|
|
525
|
+
readonly reason?: string | undefined;
|
|
526
|
+
/** 影響を受けるロック済みスキーマ */
|
|
527
|
+
readonly affectedSchemas: readonly string[];
|
|
528
|
+
/** ロックを実行したバージョン */
|
|
529
|
+
readonly lockedInVersions: readonly string[];
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* @famgia/omnify-atlas - Version Chain Management
|
|
534
|
+
*
|
|
535
|
+
* Blockchain-like immutable version tracking for production deployments.
|
|
536
|
+
* ブロックチェーン風の不変性管理システム
|
|
537
|
+
*/
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* チェーンファイル名
|
|
541
|
+
*/
|
|
542
|
+
declare const VERSION_CHAIN_FILE = ".omnify.chain";
|
|
543
|
+
/**
|
|
544
|
+
* SHA-256ハッシュを計算
|
|
545
|
+
*/
|
|
546
|
+
declare function computeSha256(content: string): string;
|
|
547
|
+
/**
|
|
548
|
+
* ブロックのハッシュを計算
|
|
549
|
+
* previousHash + version + lockedAt + schemas を含む
|
|
550
|
+
*/
|
|
551
|
+
declare function computeBlockHash(previousHash: string | null, version: string, lockedAt: string, environment: string, schemas: readonly ChainSchemaEntry[]): string;
|
|
552
|
+
/**
|
|
553
|
+
* 空のチェーンを作成
|
|
554
|
+
*/
|
|
555
|
+
declare function createEmptyChain(): VersionChain;
|
|
556
|
+
/**
|
|
557
|
+
* チェーンファイルを読み込む
|
|
558
|
+
*/
|
|
559
|
+
declare function readVersionChain(chainFilePath: string): Promise<VersionChain | null>;
|
|
560
|
+
/**
|
|
561
|
+
* チェーンファイルを書き込む
|
|
562
|
+
*/
|
|
563
|
+
declare function writeVersionChain(chainFilePath: string, chain: VersionChain): Promise<void>;
|
|
564
|
+
/**
|
|
565
|
+
* スキーマディレクトリから現在のスキーマエントリを構築
|
|
566
|
+
*/
|
|
567
|
+
declare function buildCurrentSchemaEntries(schemasDir: string, schemaFiles: readonly {
|
|
568
|
+
name: string;
|
|
569
|
+
relativePath: string;
|
|
570
|
+
filePath: string;
|
|
571
|
+
}[]): Promise<ChainSchemaEntry[]>;
|
|
572
|
+
/**
|
|
573
|
+
* 自動バージョン名を生成
|
|
574
|
+
*/
|
|
575
|
+
declare function generateVersionName(): string;
|
|
576
|
+
/**
|
|
577
|
+
* チェーン整合性を検証
|
|
578
|
+
*/
|
|
579
|
+
declare function verifyChain(chain: VersionChain, schemasDir: string): Promise<ChainVerificationResult>;
|
|
580
|
+
/**
|
|
581
|
+
* スキーマ削除/変更がロックに違反するかチェック
|
|
582
|
+
*/
|
|
583
|
+
declare function checkLockViolation(chain: VersionChain, schemaName: string, action: 'delete' | 'modify'): LockCheckResult;
|
|
584
|
+
/**
|
|
585
|
+
* 複数スキーマのロック違反を一括チェック
|
|
586
|
+
*/
|
|
587
|
+
declare function checkBulkLockViolation(chain: VersionChain, schemas: readonly {
|
|
588
|
+
name: string;
|
|
589
|
+
action: 'delete' | 'modify';
|
|
590
|
+
}[]): LockCheckResult;
|
|
591
|
+
/**
|
|
592
|
+
* 新しいブロックを作成してチェーンに追加
|
|
593
|
+
*/
|
|
594
|
+
declare function createDeployBlock(chain: VersionChain, schemas: readonly ChainSchemaEntry[], options: DeployOptions): {
|
|
595
|
+
chain: VersionChain;
|
|
596
|
+
block: VersionBlock;
|
|
597
|
+
};
|
|
598
|
+
/**
|
|
599
|
+
* デプロイ実行(スキーマをロック)
|
|
600
|
+
*/
|
|
601
|
+
declare function deployVersion(chainFilePath: string, schemasDir: string, schemaFiles: readonly {
|
|
602
|
+
name: string;
|
|
603
|
+
relativePath: string;
|
|
604
|
+
filePath: string;
|
|
605
|
+
}[], options: DeployOptions): Promise<DeployResult>;
|
|
606
|
+
/**
|
|
607
|
+
* ロック済みスキーマ一覧を取得
|
|
608
|
+
*/
|
|
609
|
+
declare function getLockedSchemas(chain: VersionChain): Map<string, {
|
|
610
|
+
hash: string;
|
|
611
|
+
version: string;
|
|
612
|
+
relativePath: string;
|
|
613
|
+
}>;
|
|
614
|
+
/**
|
|
615
|
+
* チェーンのサマリーを取得
|
|
616
|
+
*/
|
|
617
|
+
declare function getChainSummary(chain: VersionChain): {
|
|
618
|
+
blockCount: number;
|
|
619
|
+
schemaCount: number;
|
|
620
|
+
firstVersion: string | null;
|
|
621
|
+
latestVersion: string | null;
|
|
622
|
+
environments: string[];
|
|
623
|
+
};
|
|
624
|
+
|
|
371
625
|
/**
|
|
372
626
|
* @famgia/omnify-atlas - HCL Types
|
|
373
627
|
*
|
|
@@ -814,4 +1068,4 @@ declare function formatPreview(preview: ChangePreview, format?: PreviewFormat):
|
|
|
814
1068
|
*/
|
|
815
1069
|
declare function hasBlockingIssues(_preview: ChangePreview): boolean;
|
|
816
1070
|
|
|
817
|
-
export { type AtlasConfig, type AtlasDiffOptions, type AtlasDiffResult, type AtlasInspectResult, type AtlasResult, type AtlasVersion, type ChangePreview, type ChangeSeverity, type ChangeType, type ColumnChange, type DiffResult, type DiffSummary, type GeneratedMigration, type HclColumn, type HclEnum, type HclForeignKey, type HclGenerationOptions, type HclIndex, type HclSchema, type HclTable, type IndexChange, type IndexSnapshot, LOCK_FILE_NAME, LOCK_FILE_VERSION, type LockFile, type LockFileComparison, type LockFileV1, type LockFileV2, type MigrationValidation, type ParsedStatement, type PreviewFormat, type PreviewOptions, type PropertySnapshot, type SchemaChange, type SchemaHash, type SchemaSnapshot, type SqlColumnType, type SqlOperationType, type TableChange, addEnhancedMigrationRecord, addMigrationRecord, applySchema, buildSchemaHashes, buildSchemaSnapshots, checkAtlasVersion, compareSchemas, compareSchemasDeep, computeHash, computeSchemaHash, createEmptyLockFile, diffHclSchemas, extractTableNameFromFilename, extractTimestampFromFilename, findMigrationByTable, formatDiffSummary, formatPreview, generateHclSchema, generateHclTable, generatePreview, getMigrationsToRegenerate, getPrimaryKeyType, getTimestampType, hasBlockingIssues, isLockFileV2, mapPropertyToSql, parseDiffOutput, previewSchemaChanges, propertyNameToColumnName, propertyToSnapshot, readLockFile, renderHcl, runAtlasDiff, schemaNameToTableName, schemaToSnapshot, updateLockFile, updateLockFileV1, validateHcl, validateMigrations, writeLockFile };
|
|
1071
|
+
export { type AtlasConfig, type AtlasDiffOptions, type AtlasDiffResult, type AtlasInspectResult, type AtlasResult, type AtlasVersion, type ChainSchemaEntry, type ChainVerificationResult, type ChangePreview, type ChangeSeverity, type ChangeType, type ColumnChange, type CorruptedBlockInfo, type DeletedSchemaInfo, type DeployOptions, type DeployResult, type DiffResult, type DiffSummary, type GeneratedMigration, type HclColumn, type HclEnum, type HclForeignKey, type HclGenerationOptions, type HclIndex, type HclSchema, type HclTable, type IndexChange, type IndexSnapshot, LOCK_FILE_NAME, LOCK_FILE_VERSION, type LockCheckResult, type LockFile, type LockFileComparison, type LockFileV1, type LockFileV2, type MigrationValidation, type ParsedStatement, type PreviewFormat, type PreviewOptions, type PropertySnapshot, type SchemaChange, type SchemaHash, type SchemaSnapshot, type SqlColumnType, type SqlOperationType, type TableChange, type TamperedSchemaInfo, VERSION_CHAIN_FILE, type VersionBlock, type VersionChain, addEnhancedMigrationRecord, addMigrationRecord, applySchema, buildCurrentSchemaEntries, buildSchemaHashes, buildSchemaSnapshots, checkAtlasVersion, checkBulkLockViolation, checkLockViolation, compareSchemas, compareSchemasDeep, computeBlockHash, computeHash, computeSchemaHash, computeSha256, createDeployBlock, createEmptyChain, createEmptyLockFile, deployVersion, diffHclSchemas, extractTableNameFromFilename, extractTimestampFromFilename, findMigrationByTable, formatDiffSummary, formatPreview, generateHclSchema, generateHclTable, generatePreview, generateVersionName, getChainSummary, getLockedSchemas, getMigrationsToRegenerate, getPrimaryKeyType, getTimestampType, hasBlockingIssues, isLockFileV2, mapPropertyToSql, parseDiffOutput, previewSchemaChanges, propertyNameToColumnName, propertyToSnapshot, readLockFile, readVersionChain, renderHcl, runAtlasDiff, schemaNameToTableName, schemaToSnapshot, updateLockFile, updateLockFileV1, validateHcl, validateMigrations, verifyChain, writeLockFile, writeVersionChain };
|