libre-webui 0.21.2 → 0.22.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 +308 -328
- package/backend/dist/cli/migrateSqliteToPostgres.d.ts +2 -0
- package/backend/dist/cli/migrateSqliteToPostgres.d.ts.map +1 -0
- package/backend/dist/cli/migrateSqliteToPostgres.js +113 -0
- package/backend/dist/cli/migrateSqliteToPostgres.js.map +1 -0
- package/backend/dist/cli/recoveryBackup.d.ts +3 -0
- package/backend/dist/cli/recoveryBackup.d.ts.map +1 -0
- package/backend/dist/cli/recoveryBackup.js +251 -0
- package/backend/dist/cli/recoveryBackup.js.map +1 -0
- package/backend/dist/cli/recoveryInventory.d.ts +2 -0
- package/backend/dist/cli/recoveryInventory.d.ts.map +1 -0
- package/backend/dist/cli/recoveryInventory.js +109 -0
- package/backend/dist/cli/recoveryInventory.js.map +1 -0
- package/backend/dist/db.d.ts +27 -0
- package/backend/dist/db.d.ts.map +1 -1
- package/backend/dist/db.js +333 -16
- package/backend/dist/db.js.map +1 -1
- package/backend/dist/env.d.ts.map +1 -1
- package/backend/dist/env.js +12 -2
- package/backend/dist/env.js.map +1 -1
- package/backend/dist/index.d.ts.map +1 -1
- package/backend/dist/index.js +235 -47
- package/backend/dist/index.js.map +1 -1
- package/backend/dist/main.d.ts +2 -0
- package/backend/dist/main.d.ts.map +1 -0
- package/backend/dist/main.js +137 -0
- package/backend/dist/main.js.map +1 -0
- package/backend/dist/middleware/auth.d.ts.map +1 -1
- package/backend/dist/middleware/auth.js +7 -3
- package/backend/dist/middleware/auth.js.map +1 -1
- package/backend/dist/middleware/chatCancellationAdmission.d.ts +7 -0
- package/backend/dist/middleware/chatCancellationAdmission.d.ts.map +1 -0
- package/backend/dist/middleware/chatCancellationAdmission.js +17 -0
- package/backend/dist/middleware/chatCancellationAdmission.js.map +1 -0
- package/backend/dist/middleware/coordinatedRateLimit.d.ts +18 -0
- package/backend/dist/middleware/coordinatedRateLimit.d.ts.map +1 -0
- package/backend/dist/middleware/coordinatedRateLimit.js +52 -0
- package/backend/dist/middleware/coordinatedRateLimit.js.map +1 -0
- package/backend/dist/middleware/sharedRateLimit.d.ts +26 -0
- package/backend/dist/middleware/sharedRateLimit.d.ts.map +1 -0
- package/backend/dist/middleware/sharedRateLimit.js +99 -0
- package/backend/dist/middleware/sharedRateLimit.js.map +1 -0
- package/backend/dist/models/personaModel.d.ts +1 -26
- package/backend/dist/models/personaModel.d.ts.map +1 -1
- package/backend/dist/models/personaModel.js +54 -247
- package/backend/dist/models/personaModel.js.map +1 -1
- package/backend/dist/models/userModel.d.ts +23 -66
- package/backend/dist/models/userModel.d.ts.map +1 -1
- package/backend/dist/models/userModel.js +110 -187
- package/backend/dist/models/userModel.js.map +1 -1
- package/backend/dist/persistence/chatGenerationTypes.d.ts +24 -0
- package/backend/dist/persistence/chatGenerationTypes.d.ts.map +1 -0
- package/backend/dist/persistence/chatGenerationTypes.js +7 -0
- package/backend/dist/persistence/chatGenerationTypes.js.map +1 -0
- package/backend/dist/persistence/extensionTypes.d.ts +185 -0
- package/backend/dist/persistence/extensionTypes.d.ts.map +1 -0
- package/backend/dist/persistence/extensionTypes.js +13 -0
- package/backend/dist/persistence/extensionTypes.js.map +1 -0
- package/backend/dist/persistence/identityDeletionTypes.d.ts +16 -0
- package/backend/dist/persistence/identityDeletionTypes.d.ts.map +1 -0
- package/backend/dist/persistence/identityDeletionTypes.js +7 -0
- package/backend/dist/persistence/identityDeletionTypes.js.map +1 -0
- package/backend/dist/persistence/index.d.ts +48 -0
- package/backend/dist/persistence/index.d.ts.map +1 -0
- package/backend/dist/persistence/index.js +159 -0
- package/backend/dist/persistence/index.js.map +1 -0
- package/backend/dist/persistence/postgresConfig.d.ts +32 -0
- package/backend/dist/persistence/postgresConfig.d.ts.map +1 -0
- package/backend/dist/persistence/postgresConfig.js +91 -0
- package/backend/dist/persistence/postgresConfig.js.map +1 -0
- package/backend/dist/persistence/postgresCoreMigration.d.ts +8 -0
- package/backend/dist/persistence/postgresCoreMigration.d.ts.map +1 -0
- package/backend/dist/persistence/postgresCoreMigration.js +179 -0
- package/backend/dist/persistence/postgresCoreMigration.js.map +1 -0
- package/backend/dist/persistence/postgresDatabase.d.ts +40 -0
- package/backend/dist/persistence/postgresDatabase.d.ts.map +1 -0
- package/backend/dist/persistence/postgresDatabase.js +148 -0
- package/backend/dist/persistence/postgresDatabase.js.map +1 -0
- package/backend/dist/persistence/postgresExtensionMigration.d.ts +4 -0
- package/backend/dist/persistence/postgresExtensionMigration.d.ts.map +1 -0
- package/backend/dist/persistence/postgresExtensionMigration.js +143 -0
- package/backend/dist/persistence/postgresExtensionMigration.js.map +1 -0
- package/backend/dist/persistence/postgresExtensionRepositories.d.ts +6 -0
- package/backend/dist/persistence/postgresExtensionRepositories.d.ts.map +1 -0
- package/backend/dist/persistence/postgresExtensionRepositories.js +550 -0
- package/backend/dist/persistence/postgresExtensionRepositories.js.map +1 -0
- package/backend/dist/persistence/postgresImportState.d.ts +9 -0
- package/backend/dist/persistence/postgresImportState.d.ts.map +1 -0
- package/backend/dist/persistence/postgresImportState.js +64 -0
- package/backend/dist/persistence/postgresImportState.js.map +1 -0
- package/backend/dist/persistence/postgresMigrationRegistry.d.ts +4 -0
- package/backend/dist/persistence/postgresMigrationRegistry.d.ts.map +1 -0
- package/backend/dist/persistence/postgresMigrationRegistry.js +33 -0
- package/backend/dist/persistence/postgresMigrationRegistry.js.map +1 -0
- package/backend/dist/persistence/postgresMigrationTypes.d.ts +24 -0
- package/backend/dist/persistence/postgresMigrationTypes.d.ts.map +1 -0
- package/backend/dist/persistence/postgresMigrationTypes.js +7 -0
- package/backend/dist/persistence/postgresMigrationTypes.js.map +1 -0
- package/backend/dist/persistence/postgresMigrations.d.ts +15 -0
- package/backend/dist/persistence/postgresMigrations.d.ts.map +1 -0
- package/backend/dist/persistence/postgresMigrations.js +333 -0
- package/backend/dist/persistence/postgresMigrations.js.map +1 -0
- package/backend/dist/persistence/postgresPersistence.d.ts +17 -0
- package/backend/dist/persistence/postgresPersistence.d.ts.map +1 -0
- package/backend/dist/persistence/postgresPersistence.js +332 -0
- package/backend/dist/persistence/postgresPersistence.js.map +1 -0
- package/backend/dist/persistence/postgresPluginDefinitionMigration.d.ts +4 -0
- package/backend/dist/persistence/postgresPluginDefinitionMigration.d.ts.map +1 -0
- package/backend/dist/persistence/postgresPluginDefinitionMigration.js +40 -0
- package/backend/dist/persistence/postgresPluginDefinitionMigration.js.map +1 -0
- package/backend/dist/persistence/postgresResourceRepositories.d.ts +7 -0
- package/backend/dist/persistence/postgresResourceRepositories.d.ts.map +1 -0
- package/backend/dist/persistence/postgresResourceRepositories.js +776 -0
- package/backend/dist/persistence/postgresResourceRepositories.js.map +1 -0
- package/backend/dist/persistence/postgresSchemaInspector.d.ts +14 -0
- package/backend/dist/persistence/postgresSchemaInspector.d.ts.map +1 -0
- package/backend/dist/persistence/postgresSchemaInspector.js +817 -0
- package/backend/dist/persistence/postgresSchemaInspector.js.map +1 -0
- package/backend/dist/persistence/resourceTypes.d.ts +207 -0
- package/backend/dist/persistence/resourceTypes.d.ts.map +1 -0
- package/backend/dist/persistence/resourceTypes.js +38 -0
- package/backend/dist/persistence/resourceTypes.js.map +1 -0
- package/backend/dist/persistence/sqliteExtensionRepositories.d.ts +4 -0
- package/backend/dist/persistence/sqliteExtensionRepositories.d.ts.map +1 -0
- package/backend/dist/persistence/sqliteExtensionRepositories.js +494 -0
- package/backend/dist/persistence/sqliteExtensionRepositories.js.map +1 -0
- package/backend/dist/persistence/sqliteMigrations.d.ts +93 -0
- package/backend/dist/persistence/sqliteMigrations.d.ts.map +1 -0
- package/backend/dist/persistence/sqliteMigrations.js +2232 -0
- package/backend/dist/persistence/sqliteMigrations.js.map +1 -0
- package/backend/dist/persistence/sqlitePersistence.d.ts +23 -0
- package/backend/dist/persistence/sqlitePersistence.d.ts.map +1 -0
- package/backend/dist/persistence/sqlitePersistence.js +596 -0
- package/backend/dist/persistence/sqlitePersistence.js.map +1 -0
- package/backend/dist/persistence/sqliteResourceRepositories.d.ts +4 -0
- package/backend/dist/persistence/sqliteResourceRepositories.d.ts.map +1 -0
- package/backend/dist/persistence/sqliteResourceRepositories.js +663 -0
- package/backend/dist/persistence/sqliteResourceRepositories.js.map +1 -0
- package/backend/dist/persistence/sqliteSyncExecutor.d.ts +5 -0
- package/backend/dist/persistence/sqliteSyncExecutor.d.ts.map +1 -0
- package/backend/dist/persistence/sqliteSyncExecutor.js +19 -0
- package/backend/dist/persistence/sqliteSyncExecutor.js.map +1 -0
- package/backend/dist/persistence/sqliteToPostgresMigration.d.ts +80 -0
- package/backend/dist/persistence/sqliteToPostgresMigration.d.ts.map +1 -0
- package/backend/dist/persistence/sqliteToPostgresMigration.js +1543 -0
- package/backend/dist/persistence/sqliteToPostgresMigration.js.map +1 -0
- package/backend/dist/persistence/types.d.ts +131 -0
- package/backend/dist/persistence/types.d.ts.map +1 -0
- package/backend/dist/persistence/types.js +18 -0
- package/backend/dist/persistence/types.js.map +1 -0
- package/backend/dist/persistence/voiceProfileNameLookup.d.ts +9 -0
- package/backend/dist/persistence/voiceProfileNameLookup.d.ts.map +1 -0
- package/backend/dist/persistence/voiceProfileNameLookup.js +15 -0
- package/backend/dist/persistence/voiceProfileNameLookup.js.map +1 -0
- package/backend/dist/platform/coordination/index.d.ts +7 -0
- package/backend/dist/platform/coordination/index.d.ts.map +1 -0
- package/backend/dist/platform/coordination/index.js +24 -0
- package/backend/dist/platform/coordination/index.js.map +1 -0
- package/backend/dist/platform/coordination/localCoordinator.d.ts +49 -0
- package/backend/dist/platform/coordination/localCoordinator.d.ts.map +1 -0
- package/backend/dist/platform/coordination/localCoordinator.js +380 -0
- package/backend/dist/platform/coordination/localCoordinator.js.map +1 -0
- package/backend/dist/platform/coordination/redisCoordinator.d.ts +83 -0
- package/backend/dist/platform/coordination/redisCoordinator.d.ts.map +1 -0
- package/backend/dist/platform/coordination/redisCoordinator.js +726 -0
- package/backend/dist/platform/coordination/redisCoordinator.js.map +1 -0
- package/backend/dist/platform/coordination/service.d.ts +11 -0
- package/backend/dist/platform/coordination/service.d.ts.map +1 -0
- package/backend/dist/platform/coordination/service.js +55 -0
- package/backend/dist/platform/coordination/service.js.map +1 -0
- package/backend/dist/platform/coordination/sharedAdmission.d.ts +53 -0
- package/backend/dist/platform/coordination/sharedAdmission.d.ts.map +1 -0
- package/backend/dist/platform/coordination/sharedAdmission.js +194 -0
- package/backend/dist/platform/coordination/sharedAdmission.js.map +1 -0
- package/backend/dist/platform/coordination/types.d.ts +76 -0
- package/backend/dist/platform/coordination/types.d.ts.map +1 -0
- package/backend/dist/platform/coordination/types.js +32 -0
- package/backend/dist/platform/coordination/types.js.map +1 -0
- package/backend/dist/platform/events/durableEventGateway.d.ts +54 -0
- package/backend/dist/platform/events/durableEventGateway.d.ts.map +1 -0
- package/backend/dist/platform/events/durableEventGateway.js +262 -0
- package/backend/dist/platform/events/durableEventGateway.js.map +1 -0
- package/backend/dist/platform/events/index.d.ts +3 -0
- package/backend/dist/platform/events/index.d.ts.map +1 -0
- package/backend/dist/platform/events/index.js +8 -0
- package/backend/dist/platform/events/index.js.map +1 -0
- package/backend/dist/platform/events/service.d.ts +8 -0
- package/backend/dist/platform/events/service.d.ts.map +1 -0
- package/backend/dist/platform/events/service.js +25 -0
- package/backend/dist/platform/events/service.js.map +1 -0
- package/backend/dist/platform/jobs/chatGenerationEnqueuer.d.ts +3 -0
- package/backend/dist/platform/jobs/chatGenerationEnqueuer.d.ts.map +1 -0
- package/backend/dist/platform/jobs/chatGenerationEnqueuer.js +55 -0
- package/backend/dist/platform/jobs/chatGenerationEnqueuer.js.map +1 -0
- package/backend/dist/platform/jobs/documentIngestionEnqueuer.d.ts +3 -0
- package/backend/dist/platform/jobs/documentIngestionEnqueuer.d.ts.map +1 -0
- package/backend/dist/platform/jobs/documentIngestionEnqueuer.js +38 -0
- package/backend/dist/platform/jobs/documentIngestionEnqueuer.js.map +1 -0
- package/backend/dist/platform/jobs/domainJobContracts.d.ts +30 -0
- package/backend/dist/platform/jobs/domainJobContracts.d.ts.map +1 -0
- package/backend/dist/platform/jobs/domainJobContracts.js +53 -0
- package/backend/dist/platform/jobs/domainJobContracts.js.map +1 -0
- package/backend/dist/platform/jobs/domainJobHandlers.d.ts +11 -0
- package/backend/dist/platform/jobs/domainJobHandlers.d.ts.map +1 -0
- package/backend/dist/platform/jobs/domainJobHandlers.js +612 -0
- package/backend/dist/platform/jobs/domainJobHandlers.js.map +1 -0
- package/backend/dist/platform/jobs/durableEventIdentity.d.ts +8 -0
- package/backend/dist/platform/jobs/durableEventIdentity.d.ts.map +1 -0
- package/backend/dist/platform/jobs/durableEventIdentity.js +33 -0
- package/backend/dist/platform/jobs/durableEventIdentity.js.map +1 -0
- package/backend/dist/platform/jobs/durableJobRuntime.d.ts +57 -0
- package/backend/dist/platform/jobs/durableJobRuntime.d.ts.map +1 -0
- package/backend/dist/platform/jobs/durableJobRuntime.js +131 -0
- package/backend/dist/platform/jobs/durableJobRuntime.js.map +1 -0
- package/backend/dist/platform/jobs/durableJobRuntimeBackend.d.ts +28 -0
- package/backend/dist/platform/jobs/durableJobRuntimeBackend.d.ts.map +1 -0
- package/backend/dist/platform/jobs/durableJobRuntimeBackend.js +62 -0
- package/backend/dist/platform/jobs/durableJobRuntimeBackend.js.map +1 -0
- package/backend/dist/platform/jobs/durableJobService.d.ts +85 -0
- package/backend/dist/platform/jobs/durableJobService.d.ts.map +1 -0
- package/backend/dist/platform/jobs/durableJobService.js +726 -0
- package/backend/dist/platform/jobs/durableJobService.js.map +1 -0
- package/backend/dist/platform/jobs/durableJobTypes.d.ts +195 -0
- package/backend/dist/platform/jobs/durableJobTypes.d.ts.map +1 -0
- package/backend/dist/platform/jobs/durableJobTypes.js +72 -0
- package/backend/dist/platform/jobs/durableJobTypes.js.map +1 -0
- package/backend/dist/platform/jobs/embeddedDurableJobWorker.d.ts +87 -0
- package/backend/dist/platform/jobs/embeddedDurableJobWorker.d.ts.map +1 -0
- package/backend/dist/platform/jobs/embeddedDurableJobWorker.js +429 -0
- package/backend/dist/platform/jobs/embeddedDurableJobWorker.js.map +1 -0
- package/backend/dist/platform/jobs/identityDeletionEnqueuer.d.ts +3 -0
- package/backend/dist/platform/jobs/identityDeletionEnqueuer.d.ts.map +1 -0
- package/backend/dist/platform/jobs/identityDeletionEnqueuer.js +36 -0
- package/backend/dist/platform/jobs/identityDeletionEnqueuer.js.map +1 -0
- package/backend/dist/platform/jobs/index.d.ts +18 -0
- package/backend/dist/platform/jobs/index.d.ts.map +1 -0
- package/backend/dist/platform/jobs/index.js +34 -0
- package/backend/dist/platform/jobs/index.js.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.d.ts +4 -0
- package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.d.ts.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.js +25 -0
- package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.js.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.d.ts +4 -0
- package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.d.ts.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.js +23 -0
- package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.js.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobMigration.d.ts +11 -0
- package/backend/dist/platform/jobs/postgresDurableJobMigration.d.ts.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobMigration.js +106 -0
- package/backend/dist/platform/jobs/postgresDurableJobMigration.js.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobRepository.d.ts +88 -0
- package/backend/dist/platform/jobs/postgresDurableJobRepository.d.ts.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobRepository.js +1185 -0
- package/backend/dist/platform/jobs/postgresDurableJobRepository.js.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobService.d.ts +86 -0
- package/backend/dist/platform/jobs/postgresDurableJobService.d.ts.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobService.js +696 -0
- package/backend/dist/platform/jobs/postgresDurableJobService.js.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobWorker.d.ts +53 -0
- package/backend/dist/platform/jobs/postgresDurableJobWorker.d.ts.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobWorker.js +393 -0
- package/backend/dist/platform/jobs/postgresDurableJobWorker.js.map +1 -0
- package/backend/dist/platform/jobs/resourceDeletionEnqueuer.d.ts +3 -0
- package/backend/dist/platform/jobs/resourceDeletionEnqueuer.d.ts.map +1 -0
- package/backend/dist/platform/jobs/resourceDeletionEnqueuer.js +43 -0
- package/backend/dist/platform/jobs/resourceDeletionEnqueuer.js.map +1 -0
- package/backend/dist/platform/jobs/sqliteDurableJobRepository.d.ts +166 -0
- package/backend/dist/platform/jobs/sqliteDurableJobRepository.d.ts.map +1 -0
- package/backend/dist/platform/jobs/sqliteDurableJobRepository.js +1008 -0
- package/backend/dist/platform/jobs/sqliteDurableJobRepository.js.map +1 -0
- package/backend/dist/platform/jobs/videoGenerationEnqueuer.d.ts +4 -0
- package/backend/dist/platform/jobs/videoGenerationEnqueuer.d.ts.map +1 -0
- package/backend/dist/platform/jobs/videoGenerationEnqueuer.js +46 -0
- package/backend/dist/platform/jobs/videoGenerationEnqueuer.js.map +1 -0
- package/backend/dist/platform/jobs/workExecutionEnqueuer.d.ts +3 -0
- package/backend/dist/platform/jobs/workExecutionEnqueuer.d.ts.map +1 -0
- package/backend/dist/platform/jobs/workExecutionEnqueuer.js +38 -0
- package/backend/dist/platform/jobs/workExecutionEnqueuer.js.map +1 -0
- package/backend/dist/platform/ollamaRuntimeConfig.d.ts +40 -0
- package/backend/dist/platform/ollamaRuntimeConfig.d.ts.map +1 -0
- package/backend/dist/platform/ollamaRuntimeConfig.js +72 -0
- package/backend/dist/platform/ollamaRuntimeConfig.js.map +1 -0
- package/backend/dist/platform/recovery/backupArchive.d.ts +120 -0
- package/backend/dist/platform/recovery/backupArchive.d.ts.map +1 -0
- package/backend/dist/platform/recovery/backupArchive.js +842 -0
- package/backend/dist/platform/recovery/backupArchive.js.map +1 -0
- package/backend/dist/platform/recovery/index.d.ts +3 -0
- package/backend/dist/platform/recovery/index.d.ts.map +1 -0
- package/backend/dist/platform/recovery/index.js +8 -0
- package/backend/dist/platform/recovery/index.js.map +1 -0
- package/backend/dist/platform/recovery/teamBackupArchive.d.ts +98 -0
- package/backend/dist/platform/recovery/teamBackupArchive.d.ts.map +1 -0
- package/backend/dist/platform/recovery/teamBackupArchive.js +1203 -0
- package/backend/dist/platform/recovery/teamBackupArchive.js.map +1 -0
- package/backend/dist/platform/runtimeConfig.d.ts +70 -0
- package/backend/dist/platform/runtimeConfig.d.ts.map +1 -0
- package/backend/dist/platform/runtimeConfig.js +205 -0
- package/backend/dist/platform/runtimeConfig.js.map +1 -0
- package/backend/dist/platform/storage/aesGcmKeyring.d.ts +26 -0
- package/backend/dist/platform/storage/aesGcmKeyring.d.ts.map +1 -0
- package/backend/dist/platform/storage/aesGcmKeyring.js +135 -0
- package/backend/dist/platform/storage/aesGcmKeyring.js.map +1 -0
- package/backend/dist/platform/storage/blobReferenceRepository.d.ts +36 -0
- package/backend/dist/platform/storage/blobReferenceRepository.d.ts.map +1 -0
- package/backend/dist/platform/storage/blobReferenceRepository.js +117 -0
- package/backend/dist/platform/storage/blobReferenceRepository.js.map +1 -0
- package/backend/dist/platform/storage/blobStore.d.ts +111 -0
- package/backend/dist/platform/storage/blobStore.d.ts.map +1 -0
- package/backend/dist/platform/storage/blobStore.js +46 -0
- package/backend/dist/platform/storage/blobStore.js.map +1 -0
- package/backend/dist/platform/storage/documentVectorIndex.d.ts +44 -0
- package/backend/dist/platform/storage/documentVectorIndex.d.ts.map +1 -0
- package/backend/dist/platform/storage/documentVectorIndex.js +110 -0
- package/backend/dist/platform/storage/documentVectorIndex.js.map +1 -0
- package/backend/dist/platform/storage/durableBlobQuotaPolicy.d.ts +82 -0
- package/backend/dist/platform/storage/durableBlobQuotaPolicy.d.ts.map +1 -0
- package/backend/dist/platform/storage/durableBlobQuotaPolicy.js +583 -0
- package/backend/dist/platform/storage/durableBlobQuotaPolicy.js.map +1 -0
- package/backend/dist/platform/storage/index.d.ts +19 -0
- package/backend/dist/platform/storage/index.d.ts.map +1 -0
- package/backend/dist/platform/storage/index.js +35 -0
- package/backend/dist/platform/storage/index.js.map +1 -0
- package/backend/dist/platform/storage/localEncryptedBlobStore.d.ts +120 -0
- package/backend/dist/platform/storage/localEncryptedBlobStore.d.ts.map +1 -0
- package/backend/dist/platform/storage/localEncryptedBlobStore.js +1205 -0
- package/backend/dist/platform/storage/localEncryptedBlobStore.js.map +1 -0
- package/backend/dist/platform/storage/personaMemoryIndexing.d.ts +12 -0
- package/backend/dist/platform/storage/personaMemoryIndexing.d.ts.map +1 -0
- package/backend/dist/platform/storage/personaMemoryIndexing.js +25 -0
- package/backend/dist/platform/storage/personaMemoryIndexing.js.map +1 -0
- package/backend/dist/platform/storage/pgVectorStore.d.ts +37 -0
- package/backend/dist/platform/storage/pgVectorStore.d.ts.map +1 -0
- package/backend/dist/platform/storage/pgVectorStore.js +493 -0
- package/backend/dist/platform/storage/pgVectorStore.js.map +1 -0
- package/backend/dist/platform/storage/platformDomainRepositories.d.ts +244 -0
- package/backend/dist/platform/storage/platformDomainRepositories.d.ts.map +1 -0
- package/backend/dist/platform/storage/platformDomainRepositories.js +7 -0
- package/backend/dist/platform/storage/platformDomainRepositories.js.map +1 -0
- package/backend/dist/platform/storage/platformStorageRuntime.d.ts +35 -0
- package/backend/dist/platform/storage/platformStorageRuntime.d.ts.map +1 -0
- package/backend/dist/platform/storage/platformStorageRuntime.js +299 -0
- package/backend/dist/platform/storage/platformStorageRuntime.js.map +1 -0
- package/backend/dist/platform/storage/postgresPlatformDomainRepositories.d.ts +4 -0
- package/backend/dist/platform/storage/postgresPlatformDomainRepositories.d.ts.map +1 -0
- package/backend/dist/platform/storage/postgresPlatformDomainRepositories.js +1017 -0
- package/backend/dist/platform/storage/postgresPlatformDomainRepositories.js.map +1 -0
- package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.d.ts +4 -0
- package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.d.ts.map +1 -0
- package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.js +40 -0
- package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.js.map +1 -0
- package/backend/dist/platform/storage/resourceContentCleanup.d.ts +29 -0
- package/backend/dist/platform/storage/resourceContentCleanup.d.ts.map +1 -0
- package/backend/dist/platform/storage/resourceContentCleanup.js +100 -0
- package/backend/dist/platform/storage/resourceContentCleanup.js.map +1 -0
- package/backend/dist/platform/storage/resourceDeletionLifecycle.d.ts +14 -0
- package/backend/dist/platform/storage/resourceDeletionLifecycle.d.ts.map +1 -0
- package/backend/dist/platform/storage/resourceDeletionLifecycle.js +31 -0
- package/backend/dist/platform/storage/resourceDeletionLifecycle.js.map +1 -0
- package/backend/dist/platform/storage/s3EncryptedBlobStore.d.ts +140 -0
- package/backend/dist/platform/storage/s3EncryptedBlobStore.d.ts.map +1 -0
- package/backend/dist/platform/storage/s3EncryptedBlobStore.js +1309 -0
- package/backend/dist/platform/storage/s3EncryptedBlobStore.js.map +1 -0
- package/backend/dist/platform/storage/sqliteEncryptedVectorStore.d.ts +71 -0
- package/backend/dist/platform/storage/sqliteEncryptedVectorStore.d.ts.map +1 -0
- package/backend/dist/platform/storage/sqliteEncryptedVectorStore.js +766 -0
- package/backend/dist/platform/storage/sqliteEncryptedVectorStore.js.map +1 -0
- package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.d.ts +4 -0
- package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.d.ts.map +1 -0
- package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.js +1037 -0
- package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.js.map +1 -0
- package/backend/dist/platform/storage/sqliteToTeamStorageMigration.d.ts +25 -0
- package/backend/dist/platform/storage/sqliteToTeamStorageMigration.d.ts.map +1 -0
- package/backend/dist/platform/storage/sqliteToTeamStorageMigration.js +1292 -0
- package/backend/dist/platform/storage/sqliteToTeamStorageMigration.js.map +1 -0
- package/backend/dist/platform/storage/storageFactory.d.ts +81 -0
- package/backend/dist/platform/storage/storageFactory.d.ts.map +1 -0
- package/backend/dist/platform/storage/storageFactory.js +518 -0
- package/backend/dist/platform/storage/storageFactory.js.map +1 -0
- package/backend/dist/platform/storage/storageSchemaContracts.d.ts +22 -0
- package/backend/dist/platform/storage/storageSchemaContracts.d.ts.map +1 -0
- package/backend/dist/platform/storage/storageSchemaContracts.js +299 -0
- package/backend/dist/platform/storage/storageSchemaContracts.js.map +1 -0
- package/backend/dist/platform/storage/vectorStore.d.ts +117 -0
- package/backend/dist/platform/storage/vectorStore.d.ts.map +1 -0
- package/backend/dist/platform/storage/vectorStore.js +40 -0
- package/backend/dist/platform/storage/vectorStore.js.map +1 -0
- package/backend/dist/platform/workPersistence/index.d.ts +9 -0
- package/backend/dist/platform/workPersistence/index.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/index.js +14 -0
- package/backend/dist/platform/workPersistence/index.js.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.d.ts +9 -0
- package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.js +47 -0
- package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.js.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.d.ts +3 -0
- package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.js +28 -0
- package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.js.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkMigration.d.ts +3 -0
- package/backend/dist/platform/workPersistence/postgresWorkMigration.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkMigration.js +101 -0
- package/backend/dist/platform/workPersistence/postgresWorkMigration.js.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkPersistence.d.ts +79 -0
- package/backend/dist/platform/workPersistence/postgresWorkPersistence.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkPersistence.js +521 -0
- package/backend/dist/platform/workPersistence/postgresWorkPersistence.js.map +1 -0
- package/backend/dist/platform/workPersistence/service.d.ts +6 -0
- package/backend/dist/platform/workPersistence/service.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/service.js +27 -0
- package/backend/dist/platform/workPersistence/service.js.map +1 -0
- package/backend/dist/platform/workPersistence/sqliteWorkPersistence.d.ts +77 -0
- package/backend/dist/platform/workPersistence/sqliteWorkPersistence.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js +463 -0
- package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js.map +1 -0
- package/backend/dist/platform/workPersistence/types.d.ts +159 -0
- package/backend/dist/platform/workPersistence/types.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/types.js +13 -0
- package/backend/dist/platform/workPersistence/types.js.map +1 -0
- package/backend/dist/platform/workPersistence/workExecutionTypes.d.ts +13 -0
- package/backend/dist/platform/workPersistence/workExecutionTypes.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/workExecutionTypes.js +7 -0
- package/backend/dist/platform/workPersistence/workExecutionTypes.js.map +1 -0
- package/backend/dist/platform/workPersistence/workMessageContentCodec.d.ts +8 -0
- package/backend/dist/platform/workPersistence/workMessageContentCodec.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/workMessageContentCodec.js +25 -0
- package/backend/dist/platform/workPersistence/workMessageContentCodec.js.map +1 -0
- package/backend/dist/platform/workPersistence/workTextSafety.d.ts +3 -0
- package/backend/dist/platform/workPersistence/workTextSafety.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/workTextSafety.js +8 -0
- package/backend/dist/platform/workPersistence/workTextSafety.js.map +1 -0
- package/backend/dist/routes/agentCli.js +1 -1
- package/backend/dist/routes/agentCli.js.map +1 -1
- package/backend/dist/routes/artifacts.d.ts.map +1 -1
- package/backend/dist/routes/artifacts.js +2 -1
- package/backend/dist/routes/artifacts.js.map +1 -1
- package/backend/dist/routes/auth.d.ts.map +1 -1
- package/backend/dist/routes/auth.js +64 -18
- package/backend/dist/routes/auth.js.map +1 -1
- package/backend/dist/routes/chat.d.ts.map +1 -1
- package/backend/dist/routes/chat.js +519 -85
- package/backend/dist/routes/chat.js.map +1 -1
- package/backend/dist/routes/documents.d.ts.map +1 -1
- package/backend/dist/routes/documents.js +136 -28
- package/backend/dist/routes/documents.js.map +1 -1
- package/backend/dist/routes/embeddings.d.ts.map +1 -1
- package/backend/dist/routes/embeddings.js +2 -1
- package/backend/dist/routes/embeddings.js.map +1 -1
- package/backend/dist/routes/health.d.ts +3 -0
- package/backend/dist/routes/health.d.ts.map +1 -0
- package/backend/dist/routes/health.js +52 -0
- package/backend/dist/routes/health.js.map +1 -0
- package/backend/dist/routes/huggingfaceHub.d.ts.map +1 -1
- package/backend/dist/routes/huggingfaceHub.js +2 -1
- package/backend/dist/routes/huggingfaceHub.js.map +1 -1
- package/backend/dist/routes/imageGen.d.ts.map +1 -1
- package/backend/dist/routes/imageGen.js +42 -10
- package/backend/dist/routes/imageGen.js.map +1 -1
- package/backend/dist/routes/jobs.d.ts +3 -0
- package/backend/dist/routes/jobs.d.ts.map +1 -0
- package/backend/dist/routes/jobs.js +117 -0
- package/backend/dist/routes/jobs.js.map +1 -0
- package/backend/dist/routes/libreClaw.d.ts.map +1 -1
- package/backend/dist/routes/libreClaw.js +10 -7
- package/backend/dist/routes/libreClaw.js.map +1 -1
- package/backend/dist/routes/media.d.ts.map +1 -1
- package/backend/dist/routes/media.js +523 -77
- package/backend/dist/routes/media.js.map +1 -1
- package/backend/dist/routes/notes.d.ts.map +1 -1
- package/backend/dist/routes/notes.js +21 -21
- package/backend/dist/routes/notes.js.map +1 -1
- package/backend/dist/routes/ollama.d.ts.map +1 -1
- package/backend/dist/routes/ollama.js +40 -12
- package/backend/dist/routes/ollama.js.map +1 -1
- package/backend/dist/routes/personas.d.ts.map +1 -1
- package/backend/dist/routes/personas.js +4 -2
- package/backend/dist/routes/personas.js.map +1 -1
- package/backend/dist/routes/plugins.d.ts.map +1 -1
- package/backend/dist/routes/plugins.js +79 -51
- package/backend/dist/routes/plugins.js.map +1 -1
- package/backend/dist/routes/preferences.d.ts.map +1 -1
- package/backend/dist/routes/preferences.js +290 -25
- package/backend/dist/routes/preferences.js.map +1 -1
- package/backend/dist/routes/search.d.ts.map +1 -1
- package/backend/dist/routes/search.js +23 -14
- package/backend/dist/routes/search.js.map +1 -1
- package/backend/dist/routes/stt.d.ts +9 -0
- package/backend/dist/routes/stt.d.ts.map +1 -0
- package/backend/dist/routes/stt.js +217 -0
- package/backend/dist/routes/stt.js.map +1 -0
- package/backend/dist/routes/systemDiagnostics.d.ts.map +1 -1
- package/backend/dist/routes/systemDiagnostics.js +2 -1
- package/backend/dist/routes/systemDiagnostics.js.map +1 -1
- package/backend/dist/routes/tts.d.ts.map +1 -1
- package/backend/dist/routes/tts.js +577 -28
- package/backend/dist/routes/tts.js.map +1 -1
- package/backend/dist/routes/users.d.ts.map +1 -1
- package/backend/dist/routes/users.js +16 -25
- package/backend/dist/routes/users.js.map +1 -1
- package/backend/dist/routes/work.d.ts.map +1 -1
- package/backend/dist/routes/work.js +167 -113
- package/backend/dist/routes/work.js.map +1 -1
- package/backend/dist/services/agentAccessService.d.ts +2 -2
- package/backend/dist/services/agentAccessService.d.ts.map +1 -1
- package/backend/dist/services/agentAccessService.js +5 -14
- package/backend/dist/services/agentAccessService.js.map +1 -1
- package/backend/dist/services/agentCliService.d.ts +3 -2
- package/backend/dist/services/agentCliService.d.ts.map +1 -1
- package/backend/dist/services/agentCliService.js +44 -16
- package/backend/dist/services/agentCliService.js.map +1 -1
- package/backend/dist/services/assistantCompletionService.d.ts +2 -1
- package/backend/dist/services/assistantCompletionService.d.ts.map +1 -1
- package/backend/dist/services/assistantCompletionService.js +7 -3
- package/backend/dist/services/assistantCompletionService.js.map +1 -1
- package/backend/dist/services/authService.d.ts +7 -2
- package/backend/dist/services/authService.d.ts.map +1 -1
- package/backend/dist/services/authService.js +23 -10
- package/backend/dist/services/authService.js.map +1 -1
- package/backend/dist/services/chatGenerationService.d.ts +5 -4
- package/backend/dist/services/chatGenerationService.d.ts.map +1 -1
- package/backend/dist/services/chatGenerationService.js +23 -17
- package/backend/dist/services/chatGenerationService.js.map +1 -1
- package/backend/dist/services/chatRequestService.d.ts +4 -3
- package/backend/dist/services/chatRequestService.d.ts.map +1 -1
- package/backend/dist/services/chatRequestService.js +3 -3
- package/backend/dist/services/chatRequestService.js.map +1 -1
- package/backend/dist/services/chatService.d.ts +66 -16
- package/backend/dist/services/chatService.d.ts.map +1 -1
- package/backend/dist/services/chatService.js +402 -111
- package/backend/dist/services/chatService.js.map +1 -1
- package/backend/dist/services/codexOAuthService.d.ts +2 -2
- package/backend/dist/services/codexOAuthService.d.ts.map +1 -1
- package/backend/dist/services/codexOAuthService.js +63 -7
- package/backend/dist/services/codexOAuthService.js.map +1 -1
- package/backend/dist/services/dataArchiveService.d.ts +88 -0
- package/backend/dist/services/dataArchiveService.d.ts.map +1 -0
- package/backend/dist/services/dataArchiveService.js +1027 -0
- package/backend/dist/services/dataArchiveService.js.map +1 -0
- package/backend/dist/services/documentService.d.ts +67 -14
- package/backend/dist/services/documentService.d.ts.map +1 -1
- package/backend/dist/services/documentService.js +938 -193
- package/backend/dist/services/documentService.js.map +1 -1
- package/backend/dist/services/durableChatCompletion.d.ts +16 -0
- package/backend/dist/services/durableChatCompletion.d.ts.map +1 -0
- package/backend/dist/services/durableChatCompletion.js +34 -0
- package/backend/dist/services/durableChatCompletion.js.map +1 -0
- package/backend/dist/services/durableChatGenerationService.d.ts +19 -0
- package/backend/dist/services/durableChatGenerationService.d.ts.map +1 -0
- package/backend/dist/services/durableChatGenerationService.js +341 -0
- package/backend/dist/services/durableChatGenerationService.js.map +1 -0
- package/backend/dist/services/embeddingService.d.ts +1 -1
- package/backend/dist/services/embeddingService.d.ts.map +1 -1
- package/backend/dist/services/embeddingService.js +16 -13
- package/backend/dist/services/embeddingService.js.map +1 -1
- package/backend/dist/services/encryptionService.d.ts +28 -1
- package/backend/dist/services/encryptionService.d.ts.map +1 -1
- package/backend/dist/services/encryptionService.js +131 -51
- package/backend/dist/services/encryptionService.js.map +1 -1
- package/backend/dist/services/followUpService.d.ts +1 -1
- package/backend/dist/services/followUpService.d.ts.map +1 -1
- package/backend/dist/services/followUpService.js +1 -1
- package/backend/dist/services/followUpService.js.map +1 -1
- package/backend/dist/services/galleryService.d.ts +38 -37
- package/backend/dist/services/galleryService.d.ts.map +1 -1
- package/backend/dist/services/galleryService.js +356 -251
- package/backend/dist/services/galleryService.js.map +1 -1
- package/backend/dist/services/healthService.d.ts +65 -0
- package/backend/dist/services/healthService.d.ts.map +1 -0
- package/backend/dist/services/healthService.js +379 -0
- package/backend/dist/services/healthService.js.map +1 -0
- package/backend/dist/services/legacyCiphertextIntegrity.d.ts +40 -0
- package/backend/dist/services/legacyCiphertextIntegrity.d.ts.map +1 -0
- package/backend/dist/services/legacyCiphertextIntegrity.js +406 -0
- package/backend/dist/services/legacyCiphertextIntegrity.js.map +1 -0
- package/backend/dist/services/mediaGenerationJobService.d.ts +27 -5
- package/backend/dist/services/mediaGenerationJobService.d.ts.map +1 -1
- package/backend/dist/services/mediaGenerationJobService.js +185 -55
- package/backend/dist/services/mediaGenerationJobService.js.map +1 -1
- package/backend/dist/services/memoryService.d.ts +7 -83
- package/backend/dist/services/memoryService.d.ts.map +1 -1
- package/backend/dist/services/memoryService.js +428 -573
- package/backend/dist/services/memoryService.js.map +1 -1
- package/backend/dist/services/memoryUtils.d.ts.map +1 -1
- package/backend/dist/services/memoryUtils.js +8 -1
- package/backend/dist/services/memoryUtils.js.map +1 -1
- package/backend/dist/services/modelAccessService.d.ts +3 -3
- package/backend/dist/services/modelAccessService.d.ts.map +1 -1
- package/backend/dist/services/modelAccessService.js +8 -16
- package/backend/dist/services/modelAccessService.js.map +1 -1
- package/backend/dist/services/mutationEngineService.d.ts +0 -7
- package/backend/dist/services/mutationEngineService.d.ts.map +1 -1
- package/backend/dist/services/mutationEngineService.js +7 -78
- package/backend/dist/services/mutationEngineService.js.map +1 -1
- package/backend/dist/services/ollamaService.d.ts +4 -4
- package/backend/dist/services/ollamaService.d.ts.map +1 -1
- package/backend/dist/services/ollamaService.js +97 -34
- package/backend/dist/services/ollamaService.js.map +1 -1
- package/backend/dist/services/personaService.d.ts.map +1 -1
- package/backend/dist/services/personaService.js +19 -54
- package/backend/dist/services/personaService.js.map +1 -1
- package/backend/dist/services/pluginActivationService.d.ts +6 -5
- package/backend/dist/services/pluginActivationService.d.ts.map +1 -1
- package/backend/dist/services/pluginActivationService.js +36 -76
- package/backend/dist/services/pluginActivationService.js.map +1 -1
- package/backend/dist/services/pluginAudioGenerationService.d.ts +11 -6
- package/backend/dist/services/pluginAudioGenerationService.d.ts.map +1 -1
- package/backend/dist/services/pluginAudioGenerationService.js +74 -16
- package/backend/dist/services/pluginAudioGenerationService.js.map +1 -1
- package/backend/dist/services/pluginCacheInvalidation.d.ts +38 -0
- package/backend/dist/services/pluginCacheInvalidation.d.ts.map +1 -0
- package/backend/dist/services/pluginCacheInvalidation.js +198 -0
- package/backend/dist/services/pluginCacheInvalidation.js.map +1 -0
- package/backend/dist/services/pluginCapabilityRegistryService.d.ts +3 -3
- package/backend/dist/services/pluginCapabilityRegistryService.d.ts.map +1 -1
- package/backend/dist/services/pluginCapabilityRegistryService.js +11 -7
- package/backend/dist/services/pluginCapabilityRegistryService.js.map +1 -1
- package/backend/dist/services/pluginCredentialsService.d.ts +9 -8
- package/backend/dist/services/pluginCredentialsService.d.ts.map +1 -1
- package/backend/dist/services/pluginCredentialsService.js +48 -89
- package/backend/dist/services/pluginCredentialsService.js.map +1 -1
- package/backend/dist/services/pluginEmbeddingService.d.ts +8 -7
- package/backend/dist/services/pluginEmbeddingService.d.ts.map +1 -1
- package/backend/dist/services/pluginEmbeddingService.js +13 -11
- package/backend/dist/services/pluginEmbeddingService.js.map +1 -1
- package/backend/dist/services/pluginImageGenerationService.d.ts +10 -8
- package/backend/dist/services/pluginImageGenerationService.d.ts.map +1 -1
- package/backend/dist/services/pluginImageGenerationService.js +119 -14
- package/backend/dist/services/pluginImageGenerationService.js.map +1 -1
- package/backend/dist/services/pluginSTTService.d.ts +47 -0
- package/backend/dist/services/pluginSTTService.d.ts.map +1 -0
- package/backend/dist/services/pluginSTTService.js +199 -0
- package/backend/dist/services/pluginSTTService.js.map +1 -0
- package/backend/dist/services/pluginService.d.ts +94 -40
- package/backend/dist/services/pluginService.d.ts.map +1 -1
- package/backend/dist/services/pluginService.js +799 -274
- package/backend/dist/services/pluginService.js.map +1 -1
- package/backend/dist/services/pluginTTSService.d.ts +26 -8
- package/backend/dist/services/pluginTTSService.d.ts.map +1 -1
- package/backend/dist/services/pluginTTSService.js +277 -25
- package/backend/dist/services/pluginTTSService.js.map +1 -1
- package/backend/dist/services/pluginUsageService.d.ts +4 -4
- package/backend/dist/services/pluginUsageService.d.ts.map +1 -1
- package/backend/dist/services/pluginUsageService.js +44 -93
- package/backend/dist/services/pluginUsageService.js.map +1 -1
- package/backend/dist/services/pluginVariablesService.d.ts +14 -7
- package/backend/dist/services/pluginVariablesService.d.ts.map +1 -1
- package/backend/dist/services/pluginVariablesService.js +116 -81
- package/backend/dist/services/pluginVariablesService.js.map +1 -1
- package/backend/dist/services/pluginVideoGenerationService.d.ts +19 -8
- package/backend/dist/services/pluginVideoGenerationService.d.ts.map +1 -1
- package/backend/dist/services/pluginVideoGenerationService.js +116 -20
- package/backend/dist/services/pluginVideoGenerationService.js.map +1 -1
- package/backend/dist/services/preferencesService.d.ts +31 -21
- package/backend/dist/services/preferencesService.d.ts.map +1 -1
- package/backend/dist/services/preferencesService.js +104 -102
- package/backend/dist/services/preferencesService.js.map +1 -1
- package/backend/dist/services/recoveryInventoryService.d.ts +244 -0
- package/backend/dist/services/recoveryInventoryService.d.ts.map +1 -0
- package/backend/dist/services/recoveryInventoryService.js +1436 -0
- package/backend/dist/services/recoveryInventoryService.js.map +1 -0
- package/backend/dist/services/simpleGitHubOAuth.js +3 -3
- package/backend/dist/services/simpleGitHubOAuth.js.map +1 -1
- package/backend/dist/services/simpleHuggingFaceOAuth.d.ts.map +1 -1
- package/backend/dist/services/simpleHuggingFaceOAuth.js +3 -3
- package/backend/dist/services/simpleHuggingFaceOAuth.js.map +1 -1
- package/backend/dist/services/systemDiagnosticsService.d.ts.map +1 -1
- package/backend/dist/services/systemDiagnosticsService.js +2 -2
- package/backend/dist/services/systemDiagnosticsService.js.map +1 -1
- package/backend/dist/services/systemSettingsService.d.ts +5 -0
- package/backend/dist/services/systemSettingsService.d.ts.map +1 -0
- package/backend/dist/services/systemSettingsService.js +24 -0
- package/backend/dist/services/systemSettingsService.js.map +1 -0
- package/backend/dist/services/titleGenerationService.d.ts +1 -1
- package/backend/dist/services/titleGenerationService.d.ts.map +1 -1
- package/backend/dist/services/titleGenerationService.js +15 -4
- package/backend/dist/services/titleGenerationService.js.map +1 -1
- package/backend/dist/services/voiceProfileService.d.ts +44 -0
- package/backend/dist/services/voiceProfileService.d.ts.map +1 -0
- package/backend/dist/services/voiceProfileService.js +195 -0
- package/backend/dist/services/voiceProfileService.js.map +1 -0
- package/backend/dist/services/webSearchService.d.ts +7 -7
- package/backend/dist/services/webSearchService.d.ts.map +1 -1
- package/backend/dist/services/webSearchService.js +40 -35
- package/backend/dist/services/webSearchService.js.map +1 -1
- package/backend/dist/services/websocketTicketService.d.ts +39 -0
- package/backend/dist/services/websocketTicketService.d.ts.map +1 -0
- package/backend/dist/services/websocketTicketService.js +183 -0
- package/backend/dist/services/websocketTicketService.js.map +1 -0
- package/backend/dist/services/workAccessService.d.ts +3 -3
- package/backend/dist/services/workAccessService.d.ts.map +1 -1
- package/backend/dist/services/workAccessService.js +8 -16
- package/backend/dist/services/workAccessService.js.map +1 -1
- package/backend/dist/services/workAdminService.d.ts +3 -3
- package/backend/dist/services/workAdminService.d.ts.map +1 -1
- package/backend/dist/services/workAdminService.js +4 -4
- package/backend/dist/services/workAdminService.js.map +1 -1
- package/backend/dist/services/workAgentService.d.ts +25 -1
- package/backend/dist/services/workAgentService.d.ts.map +1 -1
- package/backend/dist/services/workAgentService.js +294 -126
- package/backend/dist/services/workAgentService.js.map +1 -1
- package/backend/dist/services/workEventService.d.ts +15 -2
- package/backend/dist/services/workEventService.d.ts.map +1 -1
- package/backend/dist/services/workEventService.js +201 -3
- package/backend/dist/services/workEventService.js.map +1 -1
- package/backend/dist/services/workKubernetesDriver.d.ts +8 -7
- package/backend/dist/services/workKubernetesDriver.d.ts.map +1 -1
- package/backend/dist/services/workKubernetesDriver.js +65 -21
- package/backend/dist/services/workKubernetesDriver.js.map +1 -1
- package/backend/dist/services/workModelProviderService.d.ts +2 -2
- package/backend/dist/services/workModelProviderService.d.ts.map +1 -1
- package/backend/dist/services/workModelProviderService.js +38 -34
- package/backend/dist/services/workModelProviderService.js.map +1 -1
- package/backend/dist/services/workPolicyService.d.ts +7 -7
- package/backend/dist/services/workPolicyService.d.ts.map +1 -1
- package/backend/dist/services/workPolicyService.js +50 -51
- package/backend/dist/services/workPolicyService.js.map +1 -1
- package/backend/dist/services/workPreviewProxyService.d.ts +8 -8
- package/backend/dist/services/workPreviewProxyService.d.ts.map +1 -1
- package/backend/dist/services/workPreviewProxyService.js +47 -44
- package/backend/dist/services/workPreviewProxyService.js.map +1 -1
- package/backend/dist/services/workRuntimeDriver.d.ts +21 -18
- package/backend/dist/services/workRuntimeDriver.d.ts.map +1 -1
- package/backend/dist/services/workRuntimeDriver.js +69 -20
- package/backend/dist/services/workRuntimeDriver.js.map +1 -1
- package/backend/dist/services/workRuntimeService.d.ts +18 -13
- package/backend/dist/services/workRuntimeService.d.ts.map +1 -1
- package/backend/dist/services/workRuntimeService.js +438 -194
- package/backend/dist/services/workRuntimeService.js.map +1 -1
- package/backend/dist/services/workRuntimeShared.d.ts +2 -0
- package/backend/dist/services/workRuntimeShared.d.ts.map +1 -1
- package/backend/dist/services/workRuntimeShared.js.map +1 -1
- package/backend/dist/services/workTaskService.d.ts +42 -36
- package/backend/dist/services/workTaskService.d.ts.map +1 -1
- package/backend/dist/services/workTaskService.js +445 -350
- package/backend/dist/services/workTaskService.js.map +1 -1
- package/backend/dist/services/workTerminalService.d.ts +1 -1
- package/backend/dist/services/workTerminalService.d.ts.map +1 -1
- package/backend/dist/services/workTerminalService.js +33 -6
- package/backend/dist/services/workTerminalService.js.map +1 -1
- package/backend/dist/storage.d.ts +72 -40
- package/backend/dist/storage.d.ts.map +1 -1
- package/backend/dist/storage.js +312 -660
- package/backend/dist/storage.js.map +1 -1
- package/backend/dist/types/index.d.ts +28 -0
- package/backend/dist/types/index.d.ts.map +1 -1
- package/backend/dist/types/index.js.map +1 -1
- package/backend/dist/types/work.d.ts +7 -2
- package/backend/dist/types/work.d.ts.map +1 -1
- package/backend/dist/utils/chatCancellation.d.ts +48 -0
- package/backend/dist/utils/chatCancellation.d.ts.map +1 -0
- package/backend/dist/utils/chatCancellation.js +152 -0
- package/backend/dist/utils/chatCancellation.js.map +1 -0
- package/backend/dist/utils/chatDocumentContext.d.ts +1 -1
- package/backend/dist/utils/chatDocumentContext.d.ts.map +1 -1
- package/backend/dist/utils/chatDocumentContext.js +11 -5
- package/backend/dist/utils/chatDocumentContext.js.map +1 -1
- package/backend/dist/utils/chatStreamCoalescer.d.ts +15 -0
- package/backend/dist/utils/chatStreamCoalescer.d.ts.map +1 -0
- package/backend/dist/utils/chatStreamCoalescer.js +59 -0
- package/backend/dist/utils/chatStreamCoalescer.js.map +1 -0
- package/backend/dist/utils/dataDirectory.d.ts +49 -0
- package/backend/dist/utils/dataDirectory.d.ts.map +1 -0
- package/backend/dist/utils/dataDirectory.js +291 -0
- package/backend/dist/utils/dataDirectory.js.map +1 -0
- package/backend/dist/utils/generationUtils.d.ts.map +1 -1
- package/backend/dist/utils/generationUtils.js +18 -6
- package/backend/dist/utils/generationUtils.js.map +1 -1
- package/backend/dist/utils/jwt.d.ts.map +1 -1
- package/backend/dist/utils/jwt.js +2 -3
- package/backend/dist/utils/jwt.js.map +1 -1
- package/backend/dist/utils/ollamaModelDefaults.d.ts.map +1 -1
- package/backend/dist/utils/ollamaModelDefaults.js +2 -7
- package/backend/dist/utils/ollamaModelDefaults.js.map +1 -1
- package/backend/dist/utils/ollamaStreaming.d.ts +2 -1
- package/backend/dist/utils/ollamaStreaming.d.ts.map +1 -1
- package/backend/dist/utils/ollamaStreaming.js +49 -11
- package/backend/dist/utils/ollamaStreaming.js.map +1 -1
- package/backend/dist/utils/pluginConnectionVariables.d.ts.map +1 -1
- package/backend/dist/utils/pluginConnectionVariables.js +11 -3
- package/backend/dist/utils/pluginConnectionVariables.js.map +1 -1
- package/backend/dist/utils/pluginDefinitionTrust.d.ts.map +1 -1
- package/backend/dist/utils/pluginDefinitionTrust.js +4 -3
- package/backend/dist/utils/pluginDefinitionTrust.js.map +1 -1
- package/backend/dist/utils/pluginStreaming.d.ts +2 -1
- package/backend/dist/utils/pluginStreaming.d.ts.map +1 -1
- package/backend/dist/utils/pluginStreaming.js +5 -1
- package/backend/dist/utils/pluginStreaming.js.map +1 -1
- package/backend/dist/utils/pluginUpload.d.ts +1 -0
- package/backend/dist/utils/pluginUpload.d.ts.map +1 -1
- package/backend/dist/utils/pluginUpload.js +9 -2
- package/backend/dist/utils/pluginUpload.js.map +1 -1
- package/backend/dist/utils/pluginValidation.d.ts.map +1 -1
- package/backend/dist/utils/pluginValidation.js +29 -1
- package/backend/dist/utils/pluginValidation.js.map +1 -1
- package/backend/dist/utils/sttAudioUpload.d.ts +24 -0
- package/backend/dist/utils/sttAudioUpload.d.ts.map +1 -0
- package/backend/dist/utils/sttAudioUpload.js +500 -0
- package/backend/dist/utils/sttAudioUpload.js.map +1 -0
- package/backend/dist/utils/ttsVoiceCloneUpload.d.ts +34 -0
- package/backend/dist/utils/ttsVoiceCloneUpload.d.ts.map +1 -0
- package/backend/dist/utils/ttsVoiceCloneUpload.js +224 -0
- package/backend/dist/utils/ttsVoiceCloneUpload.js.map +1 -0
- package/backend/dist/utils/websocketMessages.d.ts +2 -1
- package/backend/dist/utils/websocketMessages.d.ts.map +1 -1
- package/backend/dist/utils/websocketMessages.js +16 -2
- package/backend/dist/utils/websocketMessages.js.map +1 -1
- package/backend/dist/websocketServer.d.ts +4 -1
- package/backend/dist/websocketServer.d.ts.map +1 -1
- package/backend/dist/websocketServer.js +290 -44
- package/backend/dist/websocketServer.js.map +1 -1
- package/backend/dist/workTerminalServer.d.ts +9 -0
- package/backend/dist/workTerminalServer.d.ts.map +1 -1
- package/backend/dist/workTerminalServer.js +221 -52
- package/backend/dist/workTerminalServer.js.map +1 -1
- package/backend/dist/worker.d.ts +2 -0
- package/backend/dist/worker.d.ts.map +1 -0
- package/backend/dist/worker.js +250 -0
- package/backend/dist/worker.js.map +1 -0
- package/backend/package.json +19 -9
- package/bin/cli.js +126 -99
- package/bin/runtime-paths.js +108 -0
- package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
- package/frontend/dist/artifact-runtime/framer-motion.js +5 -5
- package/frontend/dist/artifact-runtime/lucide-react.js +1 -1
- package/frontend/dist/assets/index-CUhEG7E2.js +33 -0
- package/frontend/dist/assets/index-kxtZQLV6.css +1 -0
- package/frontend/dist/assets/{markdown-math-ClQbWekD.css → markdown-math-ClTedVi7.css} +1 -1
- package/frontend/dist/index.html +36 -18
- package/frontend/dist/js/{ArtifactContainer-C_UdeK4k.js → ArtifactContainer-BTEDhBnv.js} +1 -1
- package/frontend/dist/js/{ArtifactDemoPage-D3AuvuR5.js → ArtifactDemoPage-B0gN3YTl.js} +1 -1
- package/frontend/dist/js/{ArtifactSandboxFrame-BiXl9iGD.js → ArtifactSandboxFrame-CLBXQkZs.js} +3 -3
- package/frontend/dist/js/{ArtifactSlideOutPanel-CvgS3sfQ.js → ArtifactSlideOutPanel-CfqHPFdE.js} +1 -1
- package/frontend/dist/js/{Button-DcBM7gdH.js → Button-BV44cTnj.js} +1 -1
- package/frontend/dist/js/ChatPage-DIkAXZWA.js +23 -0
- package/frontend/dist/js/{FirstTimeSetup-B9742i3H.js → FirstTimeSetup-B8phXGNA.js} +1 -1
- package/frontend/dist/js/GalleryPage-W4uI043I.js +1 -0
- package/frontend/dist/js/HomePage-DlxehbyO.js +1 -0
- package/frontend/dist/js/{LibreClawPage-Ds6pqEyk.js → LibreClawPage-CgD0_G_F.js} +1 -1
- package/frontend/dist/js/{ModelManagerModals-BBNg2fxs.js → ModelManagerModals-D7jIT3v1.js} +1 -1
- package/frontend/dist/js/{ModelSelector-CJfJYwxh.js → ModelSelector-BYxJU1UV.js} +1 -1
- package/frontend/dist/js/ModelsPage-C4XdCKP5.js +2 -0
- package/frontend/dist/js/NotesPage-CDECOl4V.js +1 -0
- package/frontend/dist/js/{OptimizedSyntaxHighlighter-CWYUn9Oe.js → OptimizedSyntaxHighlighter-XwqZEoTf.js} +1 -1
- package/frontend/dist/js/{PersonasPage-CbQVv9OM.js → PersonasPage-CjSLPrgS.js} +2 -2
- package/frontend/dist/js/PluginUsagePage-DJOXJuH4.js +1 -0
- package/frontend/dist/js/RichMessageContent-Debeh6bi.js +3 -0
- package/frontend/dist/js/SettingsModal-cUqAeYUP.js +1 -0
- package/frontend/dist/js/{SettingsToggle-Uz2jvV64.js → SettingsToggle-WTa0rgvY.js} +1 -1
- package/frontend/dist/js/{SystemPage-CIBDZTWB.js → SystemPage-DxPw0GS7.js} +1 -1
- package/frontend/dist/js/UserManagementPage-CEdYFe_Z.js +1 -0
- package/frontend/dist/js/WorkPage-DDVeuG_9.js +6 -0
- package/frontend/dist/js/api-IzobHGND.js +14 -0
- package/frontend/dist/js/appStore-DKwC2vgn.js +2 -0
- package/frontend/dist/js/ar-xTSvTq05.js +2 -0
- package/frontend/dist/js/authStore-OaTuapL7.js +4 -0
- package/frontend/dist/js/{babel-CmENXdZw.js → babel-D24oDI9y.js} +1 -1
- package/frontend/dist/js/bn-iYAsohEA.js +2 -0
- package/frontend/dist/js/chatStore-DXGUVLXD.js +3 -0
- package/frontend/dist/js/{config-CV8L89A5.js → config-DPEEuTAe.js} +1 -1
- package/frontend/dist/js/cs-YBHN88Hb.js +2 -0
- package/frontend/dist/js/da-D7qlLy_k.js +2 -0
- package/frontend/dist/js/de-DV671k2c.js +2 -0
- package/frontend/dist/js/es-kyBgzNq-.js +2 -0
- package/frontend/dist/js/{estree-Lx6fK8Ug.js → estree-ChwJsD2w.js} +1 -1
- package/frontend/dist/js/fr-Cw1vut7I.js +2 -0
- package/frontend/dist/js/hi-DWEFC024.js +2 -0
- package/frontend/dist/js/{html-Dx5reqmV.js → html-DFrVjciF.js} +1 -1
- package/frontend/dist/js/id-DlMHjjy0.js +2 -0
- package/frontend/dist/js/is-B9E_a7dG.js +2 -0
- package/frontend/dist/js/it-DawmVbLC.js +2 -0
- package/frontend/dist/js/ja-DmVvwY3W.js +2 -0
- package/frontend/dist/js/ko-DzOPpkVs.js +2 -0
- package/frontend/dist/js/{markdown-Bd5G8zQB.js → markdown-FLLx7b67.js} +1 -1
- package/frontend/dist/js/markdown-core-BmPPZiuD.js +31 -0
- package/frontend/dist/js/{markdown-math-B7FlYsmr.js → markdown-math-mH7AZ_mb.js} +6 -6
- package/frontend/dist/js/{messageCodeStyles-CUWSpffv.js → messageCodeStyles-CBkkZY4n.js} +1 -1
- package/frontend/dist/js/ms-DpsaOPht.js +2 -0
- package/frontend/dist/js/nl-B1d8W22n.js +2 -0
- package/frontend/dist/js/pl-nCncRVgt.js +2 -0
- package/frontend/dist/js/{postcss-B5WIGhAY.js → postcss-Bx9CTcIc.js} +1 -1
- package/frontend/dist/js/pt-DHw8fGuu.js +2 -0
- package/frontend/dist/js/{react-vendor-DPNXrO-8.js → react-vendor-C5yShNlM.js} +1 -1
- package/frontend/dist/js/{router-vendor-Ca9zqOqT.js → router-vendor-CbPDks39.js} +1 -1
- package/frontend/dist/js/ru-Derl_YP_.js +2 -0
- package/frontend/dist/js/{standalone-DLNXiOUi.js → standalone-i8-5bg5p.js} +1 -1
- package/frontend/dist/js/sv-pJAfBVo0.js +2 -0
- package/frontend/dist/js/{syntax-highlight-Ca9bHsaz.js → syntax-highlight-3EEX6CGL.js} +3 -3
- package/frontend/dist/js/th-C_7fIGnk.js +2 -0
- package/frontend/dist/js/tr-CPqsJvaP.js +2 -0
- package/frontend/dist/js/{typescript-YKxslwSt.js → typescript-CQ3x-Uni.js} +1 -1
- package/frontend/dist/js/{ui-Dw6jDKxN.js → ui-BHhR3Vok.js} +2 -2
- package/frontend/dist/js/ui-vendor-D3Ahl1x5.js +177 -0
- package/frontend/dist/js/uk-3o8P_kFi.js +2 -0
- package/frontend/dist/js/{useTranslation-t1quV8ce.js → useTranslation-C3ei3mJq.js} +1 -1
- package/frontend/dist/js/{utils-iKndEgla.js → utils-CuC1beTY.js} +1 -1
- package/frontend/dist/js/{utils-vendor-1zob7nK9.js → utils-vendor-BBa8OxtB.js} +1 -1
- package/frontend/dist/js/vi-Dv6N7OVD.js +2 -0
- package/frontend/dist/js/{workApi-LrQmhNxb.js → workApi-Czu69yWS.js} +2 -2
- package/frontend/dist/js/{yaml-QD4znPfZ.js → yaml-DioTxVLA.js} +1 -1
- package/frontend/dist/js/zh-qg5iqtPi.js +2 -0
- package/package.json +16 -5
- package/plugins/huggingface.json +12 -3
- package/plugins/llama-cpp.json +18 -6
- package/plugins/longcat-audiodit.json +114 -0
- package/plugins/openai.json +18 -0
- package/frontend/dist/assets/index-CN7wpzUO.js +0 -26
- package/frontend/dist/assets/index-Dqkx5o2y.css +0 -1
- package/frontend/dist/js/ChatPage-DBEi-FSO.js +0 -16
- package/frontend/dist/js/GalleryPage-BL0x_xl7.js +0 -1
- package/frontend/dist/js/HomePage-Ukn2Y-BG.js +0 -1
- package/frontend/dist/js/ModelsPage-CDPJM-LA.js +0 -2
- package/frontend/dist/js/NotesPage-DJ-_MSI1.js +0 -1
- package/frontend/dist/js/PluginUsagePage-D69rQvFl.js +0 -1
- package/frontend/dist/js/RichMessageContent-DfuCu6PB.js +0 -3
- package/frontend/dist/js/SettingsModal-D87lWSx4.js +0 -1
- package/frontend/dist/js/UserManagementPage-DzMnFKDG.js +0 -1
- package/frontend/dist/js/WorkPage-D84JNdjS.js +0 -6
- package/frontend/dist/js/api-DhmVEJr2.js +0 -14
- package/frontend/dist/js/appStore-BsqeY2tS.js +0 -2
- package/frontend/dist/js/ar-BgCHB9_9.js +0 -2
- package/frontend/dist/js/authStore-DanfaPdm.js +0 -4
- package/frontend/dist/js/bn-Cr8_opuR.js +0 -2
- package/frontend/dist/js/chatStore-C25ywAXQ.js +0 -3
- package/frontend/dist/js/cs-Bb9gXpfH.js +0 -2
- package/frontend/dist/js/da-JfdGHjAw.js +0 -2
- package/frontend/dist/js/de-CczkCOVx.js +0 -2
- package/frontend/dist/js/es-n_0cjhn7.js +0 -2
- package/frontend/dist/js/fr-Pno128cn.js +0 -2
- package/frontend/dist/js/hi-DBCdcL4p.js +0 -2
- package/frontend/dist/js/id-85QDk-wA.js +0 -2
- package/frontend/dist/js/is-9MuKmBft.js +0 -2
- package/frontend/dist/js/it-C5mz9I3H.js +0 -2
- package/frontend/dist/js/ja-Cu90QTBd.js +0 -2
- package/frontend/dist/js/ko-CSdgcMgq.js +0 -2
- package/frontend/dist/js/markdown-core-DHnR5Hw8.js +0 -16
- package/frontend/dist/js/ms-IQMi6HBU.js +0 -2
- package/frontend/dist/js/nl-BwpdTgvn.js +0 -2
- package/frontend/dist/js/pl-zq8ctKrQ.js +0 -2
- package/frontend/dist/js/pt-BIQu7dBu.js +0 -2
- package/frontend/dist/js/ru-BT5-Z0F9.js +0 -2
- package/frontend/dist/js/sv-B1_q6-Uj.js +0 -2
- package/frontend/dist/js/th-BiLLwq0A.js +0 -2
- package/frontend/dist/js/tr-NZbkkeKs.js +0 -2
- package/frontend/dist/js/ui-vendor-xUzKqAXI.js +0 -177
- package/frontend/dist/js/uk-CGu1pg-F.js +0 -2
- package/frontend/dist/js/vi-ClvH5JZg.js +0 -2
- package/frontend/dist/js/zh-Jgjy3uAG.js +0 -2
|
@@ -0,0 +1,817 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Libre WebUI
|
|
3
|
+
* Copyright (C) 2025 Kroonen AI, Inc.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
*/
|
|
6
|
+
import { createHash } from 'node:crypto';
|
|
7
|
+
import { POSTGRES_SQLITE_IMPORT_SCHEMA_SQL, SQLITE_IMPORT_TABLE, SQLITE_IMPORT_TABLE_STATE, SQLITE_STORAGE_IMPORT_TABLE, } from './postgresImportState.js';
|
|
8
|
+
/**
|
|
9
|
+
* The migration ledger is application-owned schema too. Keep its DDL beside
|
|
10
|
+
* the inspector so fresh creation and exact-shape validation cannot drift.
|
|
11
|
+
*/
|
|
12
|
+
export const POSTGRES_COORDINATOR_SCHEMA_SQL = `
|
|
13
|
+
CREATE TABLE IF NOT EXISTS libre_schema_migrations (
|
|
14
|
+
version integer PRIMARY KEY CHECK (version > 0),
|
|
15
|
+
name text NOT NULL UNIQUE,
|
|
16
|
+
checksum char(64) NOT NULL CHECK (checksum ~ '^[0-9a-f]{64}$'),
|
|
17
|
+
minimum_compatible_version integer NOT NULL,
|
|
18
|
+
rollback_plan text NOT NULL,
|
|
19
|
+
applied_at bigint NOT NULL,
|
|
20
|
+
applied_by text NOT NULL
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
CREATE TABLE IF NOT EXISTS libre_schema_compatibility (
|
|
24
|
+
singleton smallint PRIMARY KEY DEFAULT 1 CHECK (singleton = 1),
|
|
25
|
+
status text NOT NULL CHECK (status IN ('migrating', 'compatible', 'incompatible')),
|
|
26
|
+
current_version integer NOT NULL CHECK (current_version >= 0),
|
|
27
|
+
target_version integer NOT NULL CHECK (target_version >= 0),
|
|
28
|
+
minimum_reader_version integer NOT NULL CHECK (minimum_reader_version >= 0),
|
|
29
|
+
migration_owner text,
|
|
30
|
+
failure_code text,
|
|
31
|
+
schema_fingerprint char(64)
|
|
32
|
+
CHECK (schema_fingerprint IS NULL OR schema_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
33
|
+
updated_at bigint NOT NULL
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
ALTER TABLE libre_schema_compatibility
|
|
37
|
+
ADD COLUMN IF NOT EXISTS schema_fingerprint char(64)
|
|
38
|
+
CHECK (schema_fingerprint IS NULL OR schema_fingerprint ~ '^[0-9a-f]{64}$');
|
|
39
|
+
`;
|
|
40
|
+
const POSTGRES_BOOTSTRAP_EXTENSIONS = ['plpgsql'];
|
|
41
|
+
const normalize = (value) => value
|
|
42
|
+
.toLowerCase()
|
|
43
|
+
.replace(/["`]/g, '')
|
|
44
|
+
.replace(/\s+/g, ' ')
|
|
45
|
+
.replace(/\s*([(),=<>])\s*/g, '$1')
|
|
46
|
+
.trim();
|
|
47
|
+
const stripRedundantBooleanGrouping = (value) => {
|
|
48
|
+
let current = value;
|
|
49
|
+
for (;;) {
|
|
50
|
+
const stack = [];
|
|
51
|
+
const pairs = [];
|
|
52
|
+
let quoted = false;
|
|
53
|
+
for (let index = 0; index < current.length; index += 1) {
|
|
54
|
+
if (current[index] === "'") {
|
|
55
|
+
if (quoted && current[index + 1] === "'") {
|
|
56
|
+
index += 1;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
quoted = !quoted;
|
|
60
|
+
}
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (quoted)
|
|
64
|
+
continue;
|
|
65
|
+
if (current[index] === '(')
|
|
66
|
+
stack.push(index);
|
|
67
|
+
else if (current[index] === ')') {
|
|
68
|
+
const openAt = stack.pop();
|
|
69
|
+
if (openAt !== undefined)
|
|
70
|
+
pairs.push({ openAt, closeAt: index });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const remove = new Set();
|
|
74
|
+
for (const { openAt, closeAt } of pairs) {
|
|
75
|
+
const precedingWord = current
|
|
76
|
+
.slice(0, openAt)
|
|
77
|
+
.match(/([a-z0-9_]+)$/)?.[1];
|
|
78
|
+
// Function calls, IN lists, casts, and type modifiers are structure.
|
|
79
|
+
if (precedingWord && !['and', 'or', 'not'].includes(precedingWord)) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
let depth = 0;
|
|
83
|
+
let innerQuoted = false;
|
|
84
|
+
let hasAnd = false;
|
|
85
|
+
let hasOr = false;
|
|
86
|
+
for (let index = openAt + 1; index < closeAt; index += 1) {
|
|
87
|
+
if (current[index] === "'") {
|
|
88
|
+
if (innerQuoted && current[index + 1] === "'")
|
|
89
|
+
index += 1;
|
|
90
|
+
else
|
|
91
|
+
innerQuoted = !innerQuoted;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (innerQuoted)
|
|
95
|
+
continue;
|
|
96
|
+
if (current[index] === '(') {
|
|
97
|
+
depth += 1;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (current[index] === ')') {
|
|
101
|
+
depth -= 1;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (depth !== 0)
|
|
105
|
+
continue;
|
|
106
|
+
const remainder = current.slice(index);
|
|
107
|
+
const operator = remainder.match(/^(and|or)\b/)?.[1];
|
|
108
|
+
if (operator === 'and')
|
|
109
|
+
hasAnd = true;
|
|
110
|
+
if (operator === 'or')
|
|
111
|
+
hasOr = true;
|
|
112
|
+
}
|
|
113
|
+
const wrapsExpression = openAt === 0 && closeAt === current.length - 1;
|
|
114
|
+
// AND binds more tightly than OR, so a parenthesized AND chain is
|
|
115
|
+
// redundant. An OR group nested in an AND chain is semantic and must be
|
|
116
|
+
// preserved. PostgreSQL also sometimes wraps one atom after AND/OR.
|
|
117
|
+
if (wrapsExpression ||
|
|
118
|
+
(hasAnd && !hasOr) ||
|
|
119
|
+
(!hasAnd &&
|
|
120
|
+
!hasOr &&
|
|
121
|
+
precedingWord !== undefined &&
|
|
122
|
+
['and', 'or', 'not'].includes(precedingWord))) {
|
|
123
|
+
remove.add(openAt);
|
|
124
|
+
remove.add(closeAt);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (remove.size === 0)
|
|
128
|
+
return current;
|
|
129
|
+
const next = [...current]
|
|
130
|
+
.map((character, index) => (remove.has(index) ? ' ' : character))
|
|
131
|
+
.join('')
|
|
132
|
+
.replace(/\s+/g, ' ')
|
|
133
|
+
.trim();
|
|
134
|
+
if (next === current)
|
|
135
|
+
return current;
|
|
136
|
+
current = next;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const normalizeExpression = (value) => {
|
|
140
|
+
const normalized = normalize(value)
|
|
141
|
+
.replace(/::(?:double precision|text|character varying|character|bigint|integer)\b/g, '')
|
|
142
|
+
.replace(/'(-?[0-9]+(?:\.[0-9]+)?)'/g, '$1')
|
|
143
|
+
.replace(/\s+asc\b/g, '')
|
|
144
|
+
.replace(/\b([a-z0-9_.]+) between (-?[0-9]+(?:\.[0-9]+)?) and (-?[0-9]+(?:\.[0-9]+)?)/g, '$1>=$2 and $1<=$3')
|
|
145
|
+
.replace(/([a-z0-9_.]+)=any\(array\[([^\]]*)\]\)/g, '$1 in($2)');
|
|
146
|
+
return stripRedundantBooleanGrouping(normalized);
|
|
147
|
+
};
|
|
148
|
+
const normalizeType = (value) => normalize(value)
|
|
149
|
+
.replace(/ generated always as identity$/, '')
|
|
150
|
+
.replace(/^char(?=\()/, 'character')
|
|
151
|
+
.replace(/^varchar(?=\()/, 'character varying');
|
|
152
|
+
const splitTopLevel = (value) => {
|
|
153
|
+
const parts = [];
|
|
154
|
+
let start = 0;
|
|
155
|
+
let depth = 0;
|
|
156
|
+
let quote;
|
|
157
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
158
|
+
const character = value[index];
|
|
159
|
+
if (quote) {
|
|
160
|
+
if (character === quote && value[index - 1] !== '\\')
|
|
161
|
+
quote = undefined;
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (character === "'" || character === '"') {
|
|
165
|
+
quote = character;
|
|
166
|
+
}
|
|
167
|
+
else if (character === '(') {
|
|
168
|
+
depth += 1;
|
|
169
|
+
}
|
|
170
|
+
else if (character === ')') {
|
|
171
|
+
depth -= 1;
|
|
172
|
+
}
|
|
173
|
+
else if (character === ',' && depth === 0) {
|
|
174
|
+
parts.push(value.slice(start, index).trim());
|
|
175
|
+
start = index + 1;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const final = value.slice(start).trim();
|
|
179
|
+
if (final)
|
|
180
|
+
parts.push(final);
|
|
181
|
+
return parts;
|
|
182
|
+
};
|
|
183
|
+
const matchingParenthesis = (value, openAt) => {
|
|
184
|
+
let depth = 0;
|
|
185
|
+
let quote;
|
|
186
|
+
for (let index = openAt; index < value.length; index += 1) {
|
|
187
|
+
const character = value[index];
|
|
188
|
+
if (quote) {
|
|
189
|
+
if (character === quote && value[index - 1] !== '\\')
|
|
190
|
+
quote = undefined;
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
if (character === "'" || character === '"')
|
|
194
|
+
quote = character;
|
|
195
|
+
else if (character === '(')
|
|
196
|
+
depth += 1;
|
|
197
|
+
else if (character === ')' && --depth === 0)
|
|
198
|
+
return index;
|
|
199
|
+
}
|
|
200
|
+
throw new Error('PostgreSQL migration contains an unbalanced definition');
|
|
201
|
+
};
|
|
202
|
+
const identifiers = (value) => splitTopLevel(value).map(identifier => normalize(identifier));
|
|
203
|
+
const deleteAction = (definition) => {
|
|
204
|
+
const match = definition.match(/\bon\s+delete\s+(cascade|set\s+null|set\s+default|restrict|no\s+action)\b/i);
|
|
205
|
+
return normalize(match?.[1] ?? 'no action');
|
|
206
|
+
};
|
|
207
|
+
const updateAction = (definition) => {
|
|
208
|
+
const match = definition.match(/\bon\s+update\s+(cascade|set\s+null|set\s+default|restrict|no\s+action)\b/i);
|
|
209
|
+
return normalize(match?.[1] ?? 'no action');
|
|
210
|
+
};
|
|
211
|
+
const foreignMatchType = (definition) => {
|
|
212
|
+
const match = definition.match(/\bmatch\s+(full|partial|simple)\b/i);
|
|
213
|
+
return normalize(match?.[1] ?? 'simple');
|
|
214
|
+
};
|
|
215
|
+
const defaultExpression = (definition) => {
|
|
216
|
+
const match = definition.match(/\bdefault\s+([\s\S]*?)(?=\s+(?:not\s+null|null|primary\s+key|unique|references|check|constraint)\b|$)/i);
|
|
217
|
+
return match ? normalizeExpression(match[1]) : null;
|
|
218
|
+
};
|
|
219
|
+
const checkExpressions = (definition) => {
|
|
220
|
+
const expressions = [];
|
|
221
|
+
const matcher = /\bcheck\s*\(/gi;
|
|
222
|
+
let match;
|
|
223
|
+
while ((match = matcher.exec(definition))) {
|
|
224
|
+
const openAt = definition.indexOf('(', match.index);
|
|
225
|
+
const closeAt = matchingParenthesis(definition, openAt);
|
|
226
|
+
expressions.push(normalizeExpression(definition.slice(openAt + 1, closeAt)));
|
|
227
|
+
matcher.lastIndex = closeAt + 1;
|
|
228
|
+
}
|
|
229
|
+
return expressions;
|
|
230
|
+
};
|
|
231
|
+
const parseTableDefinition = (table, body, structure) => {
|
|
232
|
+
for (const item of splitTopLevel(body)) {
|
|
233
|
+
const normalized = normalize(item);
|
|
234
|
+
for (const expression of checkExpressions(item)) {
|
|
235
|
+
structure.checks.push({ table, expression });
|
|
236
|
+
}
|
|
237
|
+
const primary = normalized.match(/^primary key\(([^)]+)\)/);
|
|
238
|
+
if (primary) {
|
|
239
|
+
structure.primaryKeys.push({ table, columns: identifiers(primary[1]) });
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
const unique = normalized.match(/^unique\(([^)]+)\)/);
|
|
243
|
+
if (unique) {
|
|
244
|
+
structure.uniqueKeys.push({ table, columns: identifiers(unique[1]) });
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
const foreign = normalized.match(/^foreign key\(([^)]+)\)references ([a-z0-9_]+)\(([^)]+)\)/);
|
|
248
|
+
if (foreign) {
|
|
249
|
+
structure.foreignKeys.push({
|
|
250
|
+
table,
|
|
251
|
+
columns: identifiers(foreign[1]),
|
|
252
|
+
referencedTable: foreign[2],
|
|
253
|
+
referencedColumns: identifiers(foreign[3]),
|
|
254
|
+
onDelete: deleteAction(normalized),
|
|
255
|
+
onUpdate: updateAction(normalized),
|
|
256
|
+
matchType: foreignMatchType(normalized),
|
|
257
|
+
});
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
if (/^(constraint\s+\S+\s+)?check\(/.test(normalized))
|
|
261
|
+
continue;
|
|
262
|
+
const column = item.match(/^"?([a-zA-Z_][a-zA-Z0-9_]*)"?\s+([\s\S]+)$/);
|
|
263
|
+
if (!column)
|
|
264
|
+
throw new Error(`Unsupported PostgreSQL column in ${table}`);
|
|
265
|
+
const name = normalize(column[1]);
|
|
266
|
+
const tail = column[2];
|
|
267
|
+
const constraintAt = tail.search(/\s+(?:not\s+null|null|default|primary\s+key|unique|references|check)\b/i);
|
|
268
|
+
const type = normalizeType(constraintAt === -1 ? tail : tail.slice(0, constraintAt));
|
|
269
|
+
const notNull = /\bnot\s+null\b|\bprimary\s+key\b/i.test(tail);
|
|
270
|
+
structure.columns.push({
|
|
271
|
+
table,
|
|
272
|
+
name,
|
|
273
|
+
type,
|
|
274
|
+
notNull,
|
|
275
|
+
defaultExpression: defaultExpression(tail),
|
|
276
|
+
identityKind: /\bgenerated\s+always\s+as\s+identity\b/i.test(tail)
|
|
277
|
+
? 'a'
|
|
278
|
+
: /\bgenerated\s+by\s+default\s+as\s+identity\b/i.test(tail)
|
|
279
|
+
? 'd'
|
|
280
|
+
: '',
|
|
281
|
+
generatedKind: /\bgenerated\s+always\s+as\s*\([\s\S]+\)\s+stored\b/i.test(tail)
|
|
282
|
+
? 's'
|
|
283
|
+
: '',
|
|
284
|
+
});
|
|
285
|
+
if (/\bprimary\s+key\b/i.test(tail)) {
|
|
286
|
+
structure.primaryKeys.push({ table, columns: [name] });
|
|
287
|
+
}
|
|
288
|
+
if (/\bunique\b/i.test(tail)) {
|
|
289
|
+
structure.uniqueKeys.push({ table, columns: [name] });
|
|
290
|
+
}
|
|
291
|
+
const inlineForeign = normalize(tail).match(/\breferences ([a-z0-9_]+)\(([^)]+)\)/);
|
|
292
|
+
if (inlineForeign) {
|
|
293
|
+
structure.foreignKeys.push({
|
|
294
|
+
table,
|
|
295
|
+
columns: [name],
|
|
296
|
+
referencedTable: inlineForeign[1],
|
|
297
|
+
referencedColumns: identifiers(inlineForeign[2]),
|
|
298
|
+
onDelete: deleteAction(tail),
|
|
299
|
+
onUpdate: updateAction(tail),
|
|
300
|
+
matchType: foreignMatchType(tail),
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
const extractBalancedStatements = (sql, expression) => {
|
|
306
|
+
const statements = [];
|
|
307
|
+
expression.lastIndex = 0;
|
|
308
|
+
let match;
|
|
309
|
+
while ((match = expression.exec(sql))) {
|
|
310
|
+
const openAt = sql.indexOf('(', match.index + match[0].length - 1);
|
|
311
|
+
const closeAt = matchingParenthesis(sql, openAt);
|
|
312
|
+
statements.push({
|
|
313
|
+
match,
|
|
314
|
+
body: sql.slice(openAt + 1, closeAt),
|
|
315
|
+
end: closeAt,
|
|
316
|
+
});
|
|
317
|
+
expression.lastIndex = closeAt + 1;
|
|
318
|
+
}
|
|
319
|
+
return statements;
|
|
320
|
+
};
|
|
321
|
+
const expectedStructure = (migrations) => {
|
|
322
|
+
const structure = {
|
|
323
|
+
tables: [],
|
|
324
|
+
optionalTableGroups: [
|
|
325
|
+
[
|
|
326
|
+
SQLITE_IMPORT_TABLE,
|
|
327
|
+
SQLITE_IMPORT_TABLE_STATE,
|
|
328
|
+
SQLITE_STORAGE_IMPORT_TABLE,
|
|
329
|
+
],
|
|
330
|
+
],
|
|
331
|
+
columns: [],
|
|
332
|
+
primaryKeys: [],
|
|
333
|
+
uniqueKeys: [],
|
|
334
|
+
foreignKeys: [],
|
|
335
|
+
checks: [],
|
|
336
|
+
indexes: [],
|
|
337
|
+
triggers: [],
|
|
338
|
+
extensions: [],
|
|
339
|
+
};
|
|
340
|
+
const schemaSources = [
|
|
341
|
+
POSTGRES_COORDINATOR_SCHEMA_SQL,
|
|
342
|
+
...migrations.map(migration => migration.sql),
|
|
343
|
+
POSTGRES_SQLITE_IMPORT_SCHEMA_SQL,
|
|
344
|
+
];
|
|
345
|
+
for (const sql of schemaSources) {
|
|
346
|
+
for (const statement of extractBalancedStatements(sql, /create\s+table(?:\s+if\s+not\s+exists)?\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*\(/gi)) {
|
|
347
|
+
const table = normalize(statement.match[1]);
|
|
348
|
+
if (structure.tables.includes(table))
|
|
349
|
+
continue;
|
|
350
|
+
structure.tables.push(table);
|
|
351
|
+
parseTableDefinition(table, statement.body, structure);
|
|
352
|
+
}
|
|
353
|
+
for (const statement of extractBalancedStatements(sql, /create\s+(unique\s+)?index(?:\s+if\s+not\s+exists)?\s+([a-zA-Z_][a-zA-Z0-9_]*)\s+on\s+([a-zA-Z_][a-zA-Z0-9_]*)(?:\s+using\s+([a-zA-Z_][a-zA-Z0-9_]*))?\s*\(/gi)) {
|
|
354
|
+
const suffix = sql.slice(statement.end + 1).match(/^\s*(where\s+[^;]+)/i);
|
|
355
|
+
structure.indexes.push({
|
|
356
|
+
name: normalize(statement.match[2]),
|
|
357
|
+
table: normalize(statement.match[3]),
|
|
358
|
+
unique: Boolean(statement.match[1]),
|
|
359
|
+
accessMethod: normalize(statement.match[4] ?? 'btree'),
|
|
360
|
+
columns: normalize(statement.body),
|
|
361
|
+
predicate: suffix
|
|
362
|
+
? normalize(suffix[1].replace(/^where\s+/i, ''))
|
|
363
|
+
: null,
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
for (const match of sql.matchAll(/create\s+extension(?:\s+if\s+not\s+exists)?\s+([a-zA-Z_][a-zA-Z0-9_]*)/gi)) {
|
|
367
|
+
structure.extensions.push(normalize(match[1]));
|
|
368
|
+
}
|
|
369
|
+
for (const match of sql.matchAll(/create\s+(?:constraint\s+)?trigger\s+([a-zA-Z_][a-zA-Z0-9_]*)[\s\S]*?\bon\s+([a-zA-Z_][a-zA-Z0-9_]*)/gi)) {
|
|
370
|
+
structure.triggers.push({
|
|
371
|
+
name: normalize(match[1]),
|
|
372
|
+
table: normalize(match[2]),
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
// Later immutable migrations evolve existing tables. Apply their simple
|
|
376
|
+
// ADD COLUMN / DROP CHECK / ADD CHECK declarations to the expected model
|
|
377
|
+
// after parsing CREATE TABLE statements; otherwise exact inspection would
|
|
378
|
+
// silently treat additive columns and replacement constraints as drift.
|
|
379
|
+
for (const match of sql.matchAll(/alter\s+table\s+([a-zA-Z_][a-zA-Z0-9_]*)\s+add\s+column\s+(?!if\s+not\s+exists)([a-zA-Z_][a-zA-Z0-9_]*)\s+([^;]+);/gi)) {
|
|
380
|
+
const table = normalize(match[1]);
|
|
381
|
+
const before = structure.columns.length;
|
|
382
|
+
parseTableDefinition(table, `${match[2]} ${match[3]}`, structure);
|
|
383
|
+
if (structure.columns.length !== before + 1) {
|
|
384
|
+
throw new Error(`Unsupported PostgreSQL ALTER COLUMN in ${table}`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
for (const match of sql.matchAll(/alter\s+table\s+([a-zA-Z_][a-zA-Z0-9_]*)\s+drop\s+constraint\s+([a-zA-Z_][a-zA-Z0-9_]*);/gi)) {
|
|
388
|
+
const table = normalize(match[1]);
|
|
389
|
+
const constraint = normalize(match[2]);
|
|
390
|
+
// PostgreSQL names an unnamed inline column CHECK
|
|
391
|
+
// <table>_<column>_check. Resolve that deterministic name so a later
|
|
392
|
+
// migration can replace the constraint without mutating its origin.
|
|
393
|
+
const prefix = `${table}_`;
|
|
394
|
+
const suffix = '_check';
|
|
395
|
+
if (constraint.startsWith(prefix) && constraint.endsWith(suffix)) {
|
|
396
|
+
const column = constraint.slice(prefix.length, -suffix.length);
|
|
397
|
+
structure.checks = structure.checks.filter(check => check.table !== table ||
|
|
398
|
+
!new RegExp(`\\b${column}\\b`).test(check.expression));
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
for (const statement of extractBalancedStatements(sql, /alter\s+table\s+([a-zA-Z_][a-zA-Z0-9_]*)\s+add\s+constraint\s+([a-zA-Z_][a-zA-Z0-9_]*)\s+check\s*\(/gi)) {
|
|
402
|
+
structure.checks.push({
|
|
403
|
+
table: normalize(statement.match[1]),
|
|
404
|
+
expression: normalizeExpression(statement.body),
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
const key = (value) => `${value.table}:${value.columns.join(',')}`;
|
|
409
|
+
structure.tables.sort();
|
|
410
|
+
structure.columns.sort((left, right) => `${left.table}:${left.name}`.localeCompare(`${right.table}:${right.name}`));
|
|
411
|
+
structure.primaryKeys.sort((left, right) => key(left).localeCompare(key(right)));
|
|
412
|
+
structure.uniqueKeys.sort((left, right) => key(left).localeCompare(key(right)));
|
|
413
|
+
structure.foreignKeys.sort((left, right) => key(left).localeCompare(key(right)));
|
|
414
|
+
structure.checks.sort((left, right) => `${left.table}:${left.expression}`.localeCompare(`${right.table}:${right.expression}`));
|
|
415
|
+
structure.indexes.sort((left, right) => left.name.localeCompare(right.name));
|
|
416
|
+
structure.triggers.sort((left, right) => left.name.localeCompare(right.name));
|
|
417
|
+
structure.extensions = [
|
|
418
|
+
...new Set([...POSTGRES_BOOTSTRAP_EXTENSIONS, ...structure.extensions]),
|
|
419
|
+
].sort();
|
|
420
|
+
return structure;
|
|
421
|
+
};
|
|
422
|
+
const postgresDeleteAction = (action) => ({
|
|
423
|
+
a: 'no action',
|
|
424
|
+
r: 'restrict',
|
|
425
|
+
c: 'cascade',
|
|
426
|
+
n: 'set null',
|
|
427
|
+
d: 'set default',
|
|
428
|
+
})[action ?? 'a'] ?? 'unknown';
|
|
429
|
+
const indexColumns = (definition) => {
|
|
430
|
+
const usingAt = definition.toLowerCase().indexOf(' using ');
|
|
431
|
+
const openAt = definition.indexOf('(', usingAt === -1 ? 0 : usingAt);
|
|
432
|
+
return normalizeExpression(definition.slice(openAt + 1, matchingParenthesis(definition, openAt)));
|
|
433
|
+
};
|
|
434
|
+
const reportExactMultiset = (problems, expected, actual, missingLabel, unexpectedLabel) => {
|
|
435
|
+
const expectedCounts = new Map();
|
|
436
|
+
const actualCounts = new Map();
|
|
437
|
+
for (const value of expected) {
|
|
438
|
+
expectedCounts.set(value, (expectedCounts.get(value) ?? 0) + 1);
|
|
439
|
+
}
|
|
440
|
+
for (const value of actual) {
|
|
441
|
+
actualCounts.set(value, (actualCounts.get(value) ?? 0) + 1);
|
|
442
|
+
}
|
|
443
|
+
for (const [value, count] of expectedCounts) {
|
|
444
|
+
for (let index = actualCounts.get(value) ?? 0; index < count; index += 1) {
|
|
445
|
+
problems.push(`${missingLabel} ${value}`);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
for (const [value, count] of actualCounts) {
|
|
449
|
+
for (let index = expectedCounts.get(value) ?? 0; index < count; index += 1) {
|
|
450
|
+
problems.push(`${unexpectedLabel} ${value}`);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
const keyColumns = (value) => `${value.table}(${value.columns.join(',')})`;
|
|
455
|
+
const foreignKey = (value, referencedSchema) => `${keyColumns(value)}->${referencedSchema}.${value.referencedTable}(${value.referencedColumns.join(',')}):delete=${value.onDelete}:update=${value.onUpdate}:match=${value.matchType}`;
|
|
456
|
+
const actualKeyColumns = (value) => `${value.table_name}(${(value.columns ?? []).map(normalize).join(',')})`;
|
|
457
|
+
const actualForeignKey = (value) => `${actualKeyColumns(value)}->${value.referenced_schema}.${value.referenced_table}(${(value.referenced_columns ?? []).map(normalize).join(',')}):delete=${postgresDeleteAction(value.delete_action)}:update=${postgresDeleteAction(value.update_action)}:match=${{ f: 'full', p: 'partial', s: 'simple' }[value.match_type ?? 's'] ?? 'unknown'}`;
|
|
458
|
+
export const inspectPostgresSchema = async (database, migrations) => {
|
|
459
|
+
const expected = expectedStructure(migrations);
|
|
460
|
+
const schemaResult = await database.query('SELECT current_schema() AS schema_name');
|
|
461
|
+
const schema = schemaResult.rows[0]?.schema_name;
|
|
462
|
+
if (!schema)
|
|
463
|
+
throw new Error('PostgreSQL current schema is unavailable');
|
|
464
|
+
const tableResult = await database.query(`SELECT relation.relname AS table_name,
|
|
465
|
+
relation.relkind AS relation_kind,
|
|
466
|
+
relation.relpersistence AS persistence,
|
|
467
|
+
relation.relrowsecurity AS row_security,
|
|
468
|
+
relation.relforcerowsecurity AS force_row_security,
|
|
469
|
+
extension.extname AS extension_name,
|
|
470
|
+
owned_relation.relname AS owned_table,
|
|
471
|
+
owned_attribute.attname AS owned_column,
|
|
472
|
+
sequence.seqstart AS sequence_start,
|
|
473
|
+
sequence.seqincrement AS sequence_increment,
|
|
474
|
+
sequence.seqmin AS sequence_minimum,
|
|
475
|
+
sequence.seqmax AS sequence_maximum,
|
|
476
|
+
sequence.seqcache AS sequence_cache,
|
|
477
|
+
sequence.seqcycle AS sequence_cycles
|
|
478
|
+
FROM pg_class relation
|
|
479
|
+
JOIN pg_namespace namespace ON namespace.oid = relation.relnamespace
|
|
480
|
+
LEFT JOIN pg_depend extension_dependency
|
|
481
|
+
ON extension_dependency.classid = 'pg_class'::regclass
|
|
482
|
+
AND extension_dependency.objid = relation.oid
|
|
483
|
+
AND extension_dependency.deptype = 'e'
|
|
484
|
+
LEFT JOIN pg_extension extension
|
|
485
|
+
ON extension.oid = extension_dependency.refobjid
|
|
486
|
+
LEFT JOIN pg_depend sequence_dependency
|
|
487
|
+
ON relation.relkind = 'S'
|
|
488
|
+
AND sequence_dependency.classid = 'pg_class'::regclass
|
|
489
|
+
AND sequence_dependency.objid = relation.oid
|
|
490
|
+
AND sequence_dependency.refclassid = 'pg_class'::regclass
|
|
491
|
+
AND sequence_dependency.deptype IN ('a', 'i')
|
|
492
|
+
LEFT JOIN pg_class owned_relation
|
|
493
|
+
ON owned_relation.oid = sequence_dependency.refobjid
|
|
494
|
+
LEFT JOIN pg_attribute owned_attribute
|
|
495
|
+
ON owned_attribute.attrelid = sequence_dependency.refobjid
|
|
496
|
+
AND owned_attribute.attnum = sequence_dependency.refobjsubid
|
|
497
|
+
LEFT JOIN pg_sequence sequence ON sequence.seqrelid = relation.oid
|
|
498
|
+
WHERE namespace.nspname = $1
|
|
499
|
+
AND relation.relkind IN ('r', 'p', 'v', 'm', 'f', 'S')`, [schema]);
|
|
500
|
+
const columns = await database.query(`SELECT relation.relname AS table_name, attribute.attname AS column_name,
|
|
501
|
+
format_type(attribute.atttypid, attribute.atttypmod) AS data_type,
|
|
502
|
+
attribute.attnotnull AS not_null,
|
|
503
|
+
pg_get_expr(default_value.adbin, default_value.adrelid, true)
|
|
504
|
+
AS default_expression,
|
|
505
|
+
attribute.attidentity AS identity_kind,
|
|
506
|
+
attribute.attgenerated AS generated_kind,
|
|
507
|
+
attribute.attcollation = data_type.typcollation
|
|
508
|
+
AS uses_default_collation
|
|
509
|
+
FROM pg_class relation
|
|
510
|
+
JOIN pg_namespace namespace ON namespace.oid = relation.relnamespace
|
|
511
|
+
JOIN pg_attribute attribute ON attribute.attrelid = relation.oid
|
|
512
|
+
JOIN pg_type data_type ON data_type.oid = attribute.atttypid
|
|
513
|
+
LEFT JOIN pg_attrdef default_value
|
|
514
|
+
ON default_value.adrelid = relation.oid
|
|
515
|
+
AND default_value.adnum = attribute.attnum
|
|
516
|
+
WHERE namespace.nspname = $1
|
|
517
|
+
AND relation.relname = ANY($2::text[])
|
|
518
|
+
AND attribute.attnum > 0 AND NOT attribute.attisdropped`, [schema, expected.tables]);
|
|
519
|
+
const constraints = await database.query(`SELECT schema_constraint.conname AS constraint_name,
|
|
520
|
+
relation.relname AS table_name,
|
|
521
|
+
schema_constraint.contype AS constraint_type,
|
|
522
|
+
ARRAY(
|
|
523
|
+
SELECT attribute.attname
|
|
524
|
+
FROM unnest(schema_constraint.conkey) WITH ORDINALITY key(attnum, position)
|
|
525
|
+
JOIN pg_attribute attribute
|
|
526
|
+
ON attribute.attrelid = relation.oid AND attribute.attnum = key.attnum
|
|
527
|
+
ORDER BY key.position
|
|
528
|
+
)::text[] AS columns,
|
|
529
|
+
referenced_namespace.nspname AS referenced_schema,
|
|
530
|
+
referenced.relname AS referenced_table,
|
|
531
|
+
CASE WHEN schema_constraint.confkey IS NULL THEN NULL ELSE ARRAY(
|
|
532
|
+
SELECT attribute.attname
|
|
533
|
+
FROM unnest(schema_constraint.confkey) WITH ORDINALITY key(attnum, position)
|
|
534
|
+
JOIN pg_attribute attribute
|
|
535
|
+
ON attribute.attrelid = referenced.oid AND attribute.attnum = key.attnum
|
|
536
|
+
ORDER BY key.position
|
|
537
|
+
)::text[] END AS referenced_columns,
|
|
538
|
+
schema_constraint.confdeltype AS delete_action,
|
|
539
|
+
schema_constraint.confupdtype AS update_action,
|
|
540
|
+
schema_constraint.confmatchtype AS match_type,
|
|
541
|
+
schema_constraint.condeferrable AS is_deferrable,
|
|
542
|
+
schema_constraint.condeferred AS is_initially_deferred,
|
|
543
|
+
schema_constraint.convalidated AS is_validated,
|
|
544
|
+
pg_get_expr(
|
|
545
|
+
schema_constraint.conbin,
|
|
546
|
+
schema_constraint.conrelid,
|
|
547
|
+
true
|
|
548
|
+
) AS check_expression
|
|
549
|
+
FROM pg_constraint schema_constraint
|
|
550
|
+
JOIN pg_class relation ON relation.oid = schema_constraint.conrelid
|
|
551
|
+
JOIN pg_namespace namespace ON namespace.oid = relation.relnamespace
|
|
552
|
+
LEFT JOIN pg_class referenced ON referenced.oid = schema_constraint.confrelid
|
|
553
|
+
LEFT JOIN pg_namespace referenced_namespace
|
|
554
|
+
ON referenced_namespace.oid = referenced.relnamespace
|
|
555
|
+
WHERE namespace.nspname = $1
|
|
556
|
+
AND schema_constraint.contype IN ('p', 'u', 'f', 'c', 'x')`, [schema]);
|
|
557
|
+
const indexes = await database.query(`SELECT index_relation.relname AS index_name,
|
|
558
|
+
table_relation.relname AS table_name,
|
|
559
|
+
index.indisunique AS is_unique,
|
|
560
|
+
index.indisvalid AS is_valid,
|
|
561
|
+
index.indisready AS is_ready,
|
|
562
|
+
index.indisclustered AS is_clustered,
|
|
563
|
+
index.indisreplident AS is_replica_identity,
|
|
564
|
+
index.indnullsnotdistinct AS nulls_not_distinct,
|
|
565
|
+
access_method.amname AS access_method,
|
|
566
|
+
pg_get_indexdef(index.indexrelid, 0, true) AS definition,
|
|
567
|
+
pg_get_expr(index.indpred, index.indrelid, true) AS predicate,
|
|
568
|
+
owned_constraint.oid IS NOT NULL AS constraint_owned,
|
|
569
|
+
extension.extname AS extension_name
|
|
570
|
+
FROM pg_index index
|
|
571
|
+
JOIN pg_class index_relation ON index_relation.oid = index.indexrelid
|
|
572
|
+
JOIN pg_class table_relation ON table_relation.oid = index.indrelid
|
|
573
|
+
JOIN pg_namespace namespace ON namespace.oid = table_relation.relnamespace
|
|
574
|
+
JOIN pg_am access_method ON access_method.oid = index_relation.relam
|
|
575
|
+
LEFT JOIN pg_constraint owned_constraint
|
|
576
|
+
ON owned_constraint.conindid = index.indexrelid
|
|
577
|
+
LEFT JOIN pg_depend extension_dependency
|
|
578
|
+
ON extension_dependency.classid = 'pg_class'::regclass
|
|
579
|
+
AND extension_dependency.objid = index.indexrelid
|
|
580
|
+
AND extension_dependency.deptype = 'e'
|
|
581
|
+
LEFT JOIN pg_extension extension
|
|
582
|
+
ON extension.oid = extension_dependency.refobjid
|
|
583
|
+
WHERE namespace.nspname = $1`, [schema]);
|
|
584
|
+
const triggers = await database.query(`SELECT trigger.tgname AS trigger_name,
|
|
585
|
+
relation.relname AS table_name,
|
|
586
|
+
pg_get_triggerdef(trigger.oid, true) AS definition,
|
|
587
|
+
extension.extname AS extension_name
|
|
588
|
+
FROM pg_trigger trigger
|
|
589
|
+
JOIN pg_class relation ON relation.oid = trigger.tgrelid
|
|
590
|
+
JOIN pg_namespace namespace ON namespace.oid = relation.relnamespace
|
|
591
|
+
LEFT JOIN pg_depend extension_dependency
|
|
592
|
+
ON extension_dependency.classid = 'pg_trigger'::regclass
|
|
593
|
+
AND extension_dependency.objid = trigger.oid
|
|
594
|
+
AND extension_dependency.deptype = 'e'
|
|
595
|
+
LEFT JOIN pg_extension extension
|
|
596
|
+
ON extension.oid = extension_dependency.refobjid
|
|
597
|
+
WHERE namespace.nspname = $1 AND NOT trigger.tgisinternal
|
|
598
|
+
ORDER BY trigger.tgname`, [schema]);
|
|
599
|
+
const extensions = await database.query('SELECT extname AS extension_name FROM pg_extension ORDER BY extname');
|
|
600
|
+
const problems = [];
|
|
601
|
+
const allowedExtensions = new Set(expected.extensions);
|
|
602
|
+
const applicationRelations = tableResult.rows.filter(row => !row.extension_name || !allowedExtensions.has(row.extension_name));
|
|
603
|
+
const applicationTables = applicationRelations.filter(row => row.relation_kind !== 'S');
|
|
604
|
+
const applicationSequences = applicationRelations.filter(row => row.relation_kind === 'S');
|
|
605
|
+
const presentApplicationTables = new Set(applicationTables.map(row => row.table_name));
|
|
606
|
+
const optionalTableNames = new Set(expected.optionalTableGroups.flat());
|
|
607
|
+
const activeExpectedTables = new Set(expected.tables.filter(table => !optionalTableNames.has(table)));
|
|
608
|
+
for (const group of expected.optionalTableGroups) {
|
|
609
|
+
if (group.some(table => presentApplicationTables.has(table))) {
|
|
610
|
+
for (const table of group)
|
|
611
|
+
activeExpectedTables.add(table);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
const expectedForActiveTable = (values) => values.filter(value => activeExpectedTables.has(value.table));
|
|
615
|
+
for (const table of activeExpectedTables) {
|
|
616
|
+
const relation = applicationTables.find(row => row.table_name === table);
|
|
617
|
+
if (!relation) {
|
|
618
|
+
problems.push(`missing table ${table}`);
|
|
619
|
+
}
|
|
620
|
+
else if (relation.relation_kind !== 'r' ||
|
|
621
|
+
relation.persistence !== 'p' ||
|
|
622
|
+
relation.row_security ||
|
|
623
|
+
relation.force_row_security) {
|
|
624
|
+
problems.push(`invalid table ${table}`);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
for (const relation of applicationTables) {
|
|
628
|
+
if (!expected.tables.includes(relation.table_name)) {
|
|
629
|
+
problems.push(`unexpected relation ${relation.table_name}`);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
const expectedIdentityColumns = expected.columns
|
|
633
|
+
.filter(column => activeExpectedTables.has(column.table))
|
|
634
|
+
.filter(column => column.identityKind !== '')
|
|
635
|
+
.map(column => `${column.table}.${column.name}`);
|
|
636
|
+
reportExactMultiset(problems, expectedIdentityColumns, applicationSequences.map(sequence => sequence.owned_table && sequence.owned_column
|
|
637
|
+
? `${sequence.owned_table}.${sequence.owned_column}`
|
|
638
|
+
: `unowned:${sequence.table_name}`), 'missing identity sequence for', 'unexpected sequence for');
|
|
639
|
+
for (const sequence of applicationSequences) {
|
|
640
|
+
const maximum = expected.columns.find(column => column.table === sequence.owned_table &&
|
|
641
|
+
column.name === sequence.owned_column)?.type === 'integer'
|
|
642
|
+
? 2147483647
|
|
643
|
+
: 9223372036854775807n;
|
|
644
|
+
if (BigInt(sequence.sequence_start ?? 0) !== 1n ||
|
|
645
|
+
BigInt(sequence.sequence_increment ?? 0) !== 1n ||
|
|
646
|
+
BigInt(sequence.sequence_minimum ?? 0) !== 1n ||
|
|
647
|
+
BigInt(sequence.sequence_maximum ?? 0) !== BigInt(maximum) ||
|
|
648
|
+
BigInt(sequence.sequence_cache ?? 0) !== 1n ||
|
|
649
|
+
sequence.sequence_cycles !== false) {
|
|
650
|
+
problems.push(`invalid sequence ${sequence.table_name}`);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
const columnByKey = new Map(columns.rows.map(row => [`${row.table_name}:${row.column_name}`, row]));
|
|
654
|
+
for (const column of expectedForActiveTable(expected.columns)) {
|
|
655
|
+
const actual = columnByKey.get(`${column.table}:${column.name}`);
|
|
656
|
+
if (!actual) {
|
|
657
|
+
problems.push(`missing column ${column.table}.${column.name}`);
|
|
658
|
+
}
|
|
659
|
+
else if (normalizeType(actual.data_type) !== column.type) {
|
|
660
|
+
problems.push(`wrong type ${column.table}.${column.name}`);
|
|
661
|
+
}
|
|
662
|
+
else if (actual.not_null !== column.notNull) {
|
|
663
|
+
problems.push(`wrong nullability ${column.table}.${column.name}`);
|
|
664
|
+
}
|
|
665
|
+
else if (normalizeExpression(actual.default_expression ?? '') !==
|
|
666
|
+
normalizeExpression(column.defaultExpression ?? '')) {
|
|
667
|
+
problems.push(`wrong default ${column.table}.${column.name}`);
|
|
668
|
+
}
|
|
669
|
+
else if (actual.identity_kind !== column.identityKind ||
|
|
670
|
+
actual.generated_kind !== column.generatedKind ||
|
|
671
|
+
!actual.uses_default_collation) {
|
|
672
|
+
problems.push(`invalid column ${column.table}.${column.name}`);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
const expectedColumnKeys = new Set(expectedForActiveTable(expected.columns).map(column => `${column.table}:${column.name}`));
|
|
676
|
+
for (const column of columns.rows) {
|
|
677
|
+
if (!expectedColumnKeys.has(`${column.table_name}:${column.column_name}`)) {
|
|
678
|
+
problems.push(`unexpected column ${column.table_name}.${column.column_name}`);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
const keys = (type) => constraints.rows.filter(row => row.constraint_type === type);
|
|
682
|
+
reportExactMultiset(problems, expectedForActiveTable(expected.primaryKeys).map(keyColumns), keys('p').map(actualKeyColumns), 'missing primary key', 'unexpected primary key');
|
|
683
|
+
reportExactMultiset(problems, expectedForActiveTable(expected.uniqueKeys).map(keyColumns), keys('u').map(actualKeyColumns), 'missing unique key', 'unexpected unique key');
|
|
684
|
+
reportExactMultiset(problems, expectedForActiveTable(expected.foreignKeys).map(value => foreignKey(value, schema)), keys('f').map(actualForeignKey), 'missing foreign key', 'unexpected foreign key');
|
|
685
|
+
reportExactMultiset(problems, expectedForActiveTable(expected.checks).map(value => `${value.table}:${value.expression}`), keys('c').map(value => `${value.table_name}:${normalizeExpression(value.check_expression ?? '')}`), 'missing check constraint', 'unexpected check constraint');
|
|
686
|
+
for (const constraint of constraints.rows) {
|
|
687
|
+
if (constraint.constraint_type === 'x' ||
|
|
688
|
+
constraint.is_deferrable ||
|
|
689
|
+
constraint.is_initially_deferred ||
|
|
690
|
+
!constraint.is_validated) {
|
|
691
|
+
problems.push(`invalid constraint ${constraint.table_name}.${constraint.constraint_name}`);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
const applicationIndexes = indexes.rows.filter(row => !row.constraint_owned &&
|
|
695
|
+
(!row.extension_name || !allowedExtensions.has(row.extension_name)));
|
|
696
|
+
const indexByName = new Map(applicationIndexes.map(row => [row.index_name, row]));
|
|
697
|
+
const activeExpectedIndexes = expectedForActiveTable(expected.indexes);
|
|
698
|
+
for (const expectedIndex of activeExpectedIndexes) {
|
|
699
|
+
const actual = indexByName.get(expectedIndex.name);
|
|
700
|
+
if (!actual) {
|
|
701
|
+
problems.push(`missing index ${expectedIndex.name}`);
|
|
702
|
+
continue;
|
|
703
|
+
}
|
|
704
|
+
if (actual.table_name !== expectedIndex.table ||
|
|
705
|
+
actual.is_unique !== expectedIndex.unique ||
|
|
706
|
+
actual.access_method !== expectedIndex.accessMethod ||
|
|
707
|
+
!actual.is_valid ||
|
|
708
|
+
!actual.is_ready ||
|
|
709
|
+
actual.is_clustered ||
|
|
710
|
+
actual.is_replica_identity ||
|
|
711
|
+
actual.nulls_not_distinct ||
|
|
712
|
+
indexColumns(actual.definition) !==
|
|
713
|
+
normalizeExpression(expectedIndex.columns) ||
|
|
714
|
+
normalizeExpression(actual.predicate ?? '') !==
|
|
715
|
+
normalizeExpression(expectedIndex.predicate ?? '')) {
|
|
716
|
+
problems.push(`invalid index ${expectedIndex.name}`);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
for (const index of applicationIndexes) {
|
|
720
|
+
if (!activeExpectedIndexes.some(value => value.name === index.index_name)) {
|
|
721
|
+
problems.push(`unexpected index ${index.index_name}`);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
const installedExtensions = new Set(extensions.rows.map(row => row.extension_name));
|
|
725
|
+
for (const extension of expected.extensions) {
|
|
726
|
+
if (!installedExtensions.has(extension)) {
|
|
727
|
+
problems.push(`missing extension ${extension}`);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
for (const extension of installedExtensions) {
|
|
731
|
+
if (!expected.extensions.includes(extension)) {
|
|
732
|
+
problems.push(`unexpected extension ${extension}`);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
const applicationTriggers = triggers.rows.filter(row => !row.extension_name || !allowedExtensions.has(row.extension_name));
|
|
736
|
+
reportExactMultiset(problems, expectedForActiveTable(expected.triggers).map(value => `${value.table}.${value.name}`), applicationTriggers.map(value => `${value.table_name}.${value.trigger_name}`), 'missing trigger', 'unexpected trigger');
|
|
737
|
+
const observed = {
|
|
738
|
+
tables: applicationRelations
|
|
739
|
+
.map(row => ({
|
|
740
|
+
name: row.table_name,
|
|
741
|
+
kind: row.relation_kind,
|
|
742
|
+
persistence: row.persistence,
|
|
743
|
+
rowSecurity: row.row_security,
|
|
744
|
+
forceRowSecurity: row.force_row_security,
|
|
745
|
+
ownedTable: row.owned_table,
|
|
746
|
+
ownedColumn: row.owned_column,
|
|
747
|
+
sequenceStart: row.sequence_start,
|
|
748
|
+
sequenceIncrement: row.sequence_increment,
|
|
749
|
+
sequenceMinimum: row.sequence_minimum,
|
|
750
|
+
sequenceMaximum: row.sequence_maximum,
|
|
751
|
+
sequenceCache: row.sequence_cache,
|
|
752
|
+
sequenceCycles: row.sequence_cycles,
|
|
753
|
+
}))
|
|
754
|
+
.sort((left, right) => left.name.localeCompare(right.name)),
|
|
755
|
+
columns: columns.rows
|
|
756
|
+
.map(row => ({
|
|
757
|
+
table: row.table_name,
|
|
758
|
+
name: row.column_name,
|
|
759
|
+
type: normalizeType(row.data_type),
|
|
760
|
+
notNull: row.not_null,
|
|
761
|
+
defaultExpression: normalizeExpression(row.default_expression ?? ''),
|
|
762
|
+
identity: row.identity_kind,
|
|
763
|
+
generated: row.generated_kind,
|
|
764
|
+
defaultCollation: row.uses_default_collation,
|
|
765
|
+
}))
|
|
766
|
+
.sort((left, right) => `${left.table}:${left.name}`.localeCompare(`${right.table}:${right.name}`)),
|
|
767
|
+
constraints: constraints.rows
|
|
768
|
+
.map(row => ({
|
|
769
|
+
table: row.table_name,
|
|
770
|
+
type: row.constraint_type,
|
|
771
|
+
columns: row.columns,
|
|
772
|
+
name: row.constraint_name,
|
|
773
|
+
referencedSchema: row.referenced_schema,
|
|
774
|
+
referencedTable: row.referenced_table,
|
|
775
|
+
referencedColumns: row.referenced_columns,
|
|
776
|
+
deleteAction: row.delete_action,
|
|
777
|
+
updateAction: row.update_action,
|
|
778
|
+
matchType: row.match_type,
|
|
779
|
+
deferrable: row.is_deferrable,
|
|
780
|
+
initiallyDeferred: row.is_initially_deferred,
|
|
781
|
+
validated: row.is_validated,
|
|
782
|
+
checkExpression: normalizeExpression(row.check_expression ?? ''),
|
|
783
|
+
}))
|
|
784
|
+
.sort((left, right) => JSON.stringify(left).localeCompare(JSON.stringify(right))),
|
|
785
|
+
indexes: applicationIndexes
|
|
786
|
+
.map(row => ({
|
|
787
|
+
name: row.index_name,
|
|
788
|
+
table: row.table_name,
|
|
789
|
+
unique: row.is_unique,
|
|
790
|
+
valid: row.is_valid,
|
|
791
|
+
ready: row.is_ready,
|
|
792
|
+
clustered: row.is_clustered,
|
|
793
|
+
replicaIdentity: row.is_replica_identity,
|
|
794
|
+
nullsNotDistinct: row.nulls_not_distinct,
|
|
795
|
+
accessMethod: row.access_method,
|
|
796
|
+
columns: indexColumns(row.definition),
|
|
797
|
+
predicate: normalizeExpression(row.predicate ?? ''),
|
|
798
|
+
}))
|
|
799
|
+
.sort((left, right) => left.name.localeCompare(right.name)),
|
|
800
|
+
triggers: applicationTriggers
|
|
801
|
+
.map(row => ({
|
|
802
|
+
name: row.trigger_name,
|
|
803
|
+
table: row.table_name,
|
|
804
|
+
definition: normalize(row.definition),
|
|
805
|
+
}))
|
|
806
|
+
.sort((left, right) => left.name.localeCompare(right.name)),
|
|
807
|
+
extensions: [...installedExtensions].sort(),
|
|
808
|
+
};
|
|
809
|
+
return {
|
|
810
|
+
compatible: problems.length === 0,
|
|
811
|
+
fingerprint: createHash('sha256')
|
|
812
|
+
.update(JSON.stringify(observed))
|
|
813
|
+
.digest('hex'),
|
|
814
|
+
problems,
|
|
815
|
+
};
|
|
816
|
+
};
|
|
817
|
+
//# sourceMappingURL=postgresSchemaInspector.js.map
|