@webiny/migrations 5.39.7-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +26 -0
- package/README.md +1 -0
- package/ddb-es.d.ts +18 -0
- package/ddb-es.js +67 -0
- package/ddb-es.js.map +1 -0
- package/ddb.d.ts +18 -0
- package/ddb.js +49 -0
- package/ddb.js.map +1 -0
- package/migrations/5.35.0/001/FileSettingsMigration.d.ts +12 -0
- package/migrations/5.35.0/001/FileSettingsMigration.js +93 -0
- package/migrations/5.35.0/001/FileSettingsMigration.js.map +1 -0
- package/migrations/5.35.0/001/ddb/FileDataMigration.d.ts +14 -0
- package/migrations/5.35.0/001/ddb/FileDataMigration.js +156 -0
- package/migrations/5.35.0/001/ddb/FileDataMigration.js.map +1 -0
- package/migrations/5.35.0/001/ddb/index.d.ts +10 -0
- package/migrations/5.35.0/001/ddb/index.js +50 -0
- package/migrations/5.35.0/001/ddb/index.js.map +1 -0
- package/migrations/5.35.0/001/ddb-es/FileDataMigration.d.ts +17 -0
- package/migrations/5.35.0/001/ddb-es/FileDataMigration.js +172 -0
- package/migrations/5.35.0/001/ddb-es/FileDataMigration.js.map +1 -0
- package/migrations/5.35.0/001/ddb-es/index.d.ts +12 -0
- package/migrations/5.35.0/001/ddb-es/index.js +65 -0
- package/migrations/5.35.0/001/ddb-es/index.js.map +1 -0
- package/migrations/5.35.0/001/entities/createFileEntity.d.ts +92 -0
- package/migrations/5.35.0/001/entities/createFileEntity.js +62 -0
- package/migrations/5.35.0/001/entities/createFileEntity.js.map +1 -0
- package/migrations/5.35.0/001/entities/createLocaleEntity.d.ts +42 -0
- package/migrations/5.35.0/001/entities/createLocaleEntity.js +52 -0
- package/migrations/5.35.0/001/entities/createLocaleEntity.js.map +1 -0
- package/migrations/5.35.0/001/entities/createSettingsEntity.d.ts +90 -0
- package/migrations/5.35.0/001/entities/createSettingsEntity.js +37 -0
- package/migrations/5.35.0/001/entities/createSettingsEntity.js.map +1 -0
- package/migrations/5.35.0/001/entities/createTenantEntity.d.ts +42 -0
- package/migrations/5.35.0/001/entities/createTenantEntity.js +69 -0
- package/migrations/5.35.0/001/entities/createTenantEntity.js.map +1 -0
- package/migrations/5.35.0/001/types.d.ts +19 -0
- package/migrations/5.35.0/001/types.js +7 -0
- package/migrations/5.35.0/001/types.js.map +1 -0
- package/migrations/5.35.0/002/createLocaleEntity.d.ts +42 -0
- package/migrations/5.35.0/002/createLocaleEntity.js +32 -0
- package/migrations/5.35.0/002/createLocaleEntity.js.map +1 -0
- package/migrations/5.35.0/002/createSettingsEntity.d.ts +90 -0
- package/migrations/5.35.0/002/createSettingsEntity.js +61 -0
- package/migrations/5.35.0/002/createSettingsEntity.js.map +1 -0
- package/migrations/5.35.0/002/createTenantEntity.d.ts +42 -0
- package/migrations/5.35.0/002/createTenantEntity.js +46 -0
- package/migrations/5.35.0/002/createTenantEntity.js.map +1 -0
- package/migrations/5.35.0/002/index.d.ts +13 -0
- package/migrations/5.35.0/002/index.js +117 -0
- package/migrations/5.35.0/002/index.js.map +1 -0
- package/migrations/5.35.0/003/createTenantEntity.d.ts +42 -0
- package/migrations/5.35.0/003/createTenantEntity.js +46 -0
- package/migrations/5.35.0/003/createTenantEntity.js.map +1 -0
- package/migrations/5.35.0/003/createUserEntity.d.ts +90 -0
- package/migrations/5.35.0/003/createUserEntity.js +55 -0
- package/migrations/5.35.0/003/createUserEntity.js.map +1 -0
- package/migrations/5.35.0/003/index.d.ts +12 -0
- package/migrations/5.35.0/003/index.js +92 -0
- package/migrations/5.35.0/003/index.js.map +1 -0
- package/migrations/5.35.0/004/createTenantEntity.d.ts +90 -0
- package/migrations/5.35.0/004/createTenantEntity.js +57 -0
- package/migrations/5.35.0/004/createTenantEntity.js.map +1 -0
- package/migrations/5.35.0/004/index.d.ts +11 -0
- package/migrations/5.35.0/004/index.js +80 -0
- package/migrations/5.35.0/004/index.js.map +1 -0
- package/migrations/5.35.0/005/createLocaleEntity.d.ts +42 -0
- package/migrations/5.35.0/005/createLocaleEntity.js +32 -0
- package/migrations/5.35.0/005/createLocaleEntity.js.map +1 -0
- package/migrations/5.35.0/005/createModelEntity.d.ts +42 -0
- package/migrations/5.35.0/005/createModelEntity.js +101 -0
- package/migrations/5.35.0/005/createModelEntity.js.map +1 -0
- package/migrations/5.35.0/005/createTenantEntity.d.ts +48 -0
- package/migrations/5.35.0/005/createTenantEntity.js +13 -0
- package/migrations/5.35.0/005/createTenantEntity.js.map +1 -0
- package/migrations/5.35.0/005/index.d.ts +15 -0
- package/migrations/5.35.0/005/index.js +144 -0
- package/migrations/5.35.0/005/index.js.map +1 -0
- package/migrations/5.35.0/005/types.d.ts +42 -0
- package/migrations/5.35.0/005/types.js +7 -0
- package/migrations/5.35.0/005/types.js.map +1 -0
- package/migrations/5.35.0/006/constants.d.ts +3 -0
- package/migrations/5.35.0/006/constants.js +14 -0
- package/migrations/5.35.0/006/constants.js.map +1 -0
- package/migrations/5.35.0/006/ddb/PageDataMigration.d.ts +17 -0
- package/migrations/5.35.0/006/ddb/PageDataMigration.js +249 -0
- package/migrations/5.35.0/006/ddb/PageDataMigration.js.map +1 -0
- package/migrations/5.35.0/006/ddb/index.d.ts +10 -0
- package/migrations/5.35.0/006/ddb/index.js +49 -0
- package/migrations/5.35.0/006/ddb/index.js.map +1 -0
- package/migrations/5.35.0/006/ddb-es/PageDataMigration.d.ts +22 -0
- package/migrations/5.35.0/006/ddb-es/PageDataMigration.js +413 -0
- package/migrations/5.35.0/006/ddb-es/PageDataMigration.js.map +1 -0
- package/migrations/5.35.0/006/ddb-es/index.d.ts +12 -0
- package/migrations/5.35.0/006/ddb-es/index.js +64 -0
- package/migrations/5.35.0/006/ddb-es/index.js.map +1 -0
- package/migrations/5.35.0/006/entities/createEntryEntity.d.ts +89 -0
- package/migrations/5.35.0/006/entities/createEntryEntity.js +106 -0
- package/migrations/5.35.0/006/entities/createEntryEntity.js.map +1 -0
- package/migrations/5.35.0/006/entities/createLocaleEntity.d.ts +42 -0
- package/migrations/5.35.0/006/entities/createLocaleEntity.js +32 -0
- package/migrations/5.35.0/006/entities/createLocaleEntity.js.map +1 -0
- package/migrations/5.35.0/006/entities/createPageEntity.d.ts +89 -0
- package/migrations/5.35.0/006/entities/createPageEntity.js +113 -0
- package/migrations/5.35.0/006/entities/createPageEntity.js.map +1 -0
- package/migrations/5.35.0/006/entities/createTenantEntity.d.ts +48 -0
- package/migrations/5.35.0/006/entities/createTenantEntity.js +13 -0
- package/migrations/5.35.0/006/entities/createTenantEntity.js.map +1 -0
- package/migrations/5.35.0/006/types.d.ts +91 -0
- package/migrations/5.35.0/006/types.js +7 -0
- package/migrations/5.35.0/006/types.js.map +1 -0
- package/migrations/5.35.0/006/utils/getCompressedData.d.ts +4 -0
- package/migrations/5.35.0/006/utils/getCompressedData.js +19 -0
- package/migrations/5.35.0/006/utils/getCompressedData.js.map +1 -0
- package/migrations/5.35.0/006/utils/getLexicalContentText.d.ts +1 -0
- package/migrations/5.35.0/006/utils/getLexicalContentText.js +29 -0
- package/migrations/5.35.0/006/utils/getLexicalContentText.js.map +1 -0
- package/migrations/5.35.0/006/utils/getSearchableContent.d.ts +6 -0
- package/migrations/5.35.0/006/utils/getSearchableContent.js +45 -0
- package/migrations/5.35.0/006/utils/getSearchableContent.js.map +1 -0
- package/migrations/5.35.0/006/utils/processors/button.d.ts +1 -0
- package/migrations/5.35.0/006/utils/processors/button.js +17 -0
- package/migrations/5.35.0/006/utils/processors/button.js.map +1 -0
- package/migrations/5.35.0/006/utils/processors/image.d.ts +1 -0
- package/migrations/5.35.0/006/utils/processors/image.js +17 -0
- package/migrations/5.35.0/006/utils/processors/image.js.map +1 -0
- package/migrations/5.35.0/006/utils/processors/images.d.ts +1 -0
- package/migrations/5.35.0/006/utils/processors/images.js +18 -0
- package/migrations/5.35.0/006/utils/processors/images.js.map +1 -0
- package/migrations/5.35.0/006/utils/processors/index.d.ts +1 -0
- package/migrations/5.35.0/006/utils/processors/index.js +14 -0
- package/migrations/5.35.0/006/utils/processors/index.js.map +1 -0
- package/migrations/5.35.0/006/utils/processors/paragraph.d.ts +1 -0
- package/migrations/5.35.0/006/utils/processors/paragraph.js +25 -0
- package/migrations/5.35.0/006/utils/processors/paragraph.js.map +1 -0
- package/migrations/5.36.0/001/constants.d.ts +3 -0
- package/migrations/5.36.0/001/constants.js +14 -0
- package/migrations/5.36.0/001/constants.js.map +1 -0
- package/migrations/5.36.0/001/ddb/FileDataMigration.d.ts +17 -0
- package/migrations/5.36.0/001/ddb/FileDataMigration.js +241 -0
- package/migrations/5.36.0/001/ddb/FileDataMigration.js.map +1 -0
- package/migrations/5.36.0/001/ddb/index.d.ts +10 -0
- package/migrations/5.36.0/001/ddb/index.js +49 -0
- package/migrations/5.36.0/001/ddb/index.js.map +1 -0
- package/migrations/5.36.0/001/ddb-es/FileDataMigration.d.ts +20 -0
- package/migrations/5.36.0/001/ddb-es/FileDataMigration.js +405 -0
- package/migrations/5.36.0/001/ddb-es/FileDataMigration.js.map +1 -0
- package/migrations/5.36.0/001/ddb-es/index.d.ts +12 -0
- package/migrations/5.36.0/001/ddb-es/index.js +64 -0
- package/migrations/5.36.0/001/ddb-es/index.js.map +1 -0
- package/migrations/5.36.0/001/entities/createEntryEntity.d.ts +89 -0
- package/migrations/5.36.0/001/entities/createEntryEntity.js +106 -0
- package/migrations/5.36.0/001/entities/createEntryEntity.js.map +1 -0
- package/migrations/5.36.0/001/entities/createFileEntity.d.ts +95 -0
- package/migrations/5.36.0/001/entities/createFileEntity.js +33 -0
- package/migrations/5.36.0/001/entities/createFileEntity.js.map +1 -0
- package/migrations/5.36.0/001/entities/createLocaleEntity.d.ts +42 -0
- package/migrations/5.36.0/001/entities/createLocaleEntity.js +32 -0
- package/migrations/5.36.0/001/entities/createLocaleEntity.js.map +1 -0
- package/migrations/5.36.0/001/entities/createTenantEntity.d.ts +48 -0
- package/migrations/5.36.0/001/entities/createTenantEntity.js +13 -0
- package/migrations/5.36.0/001/entities/createTenantEntity.js.map +1 -0
- package/migrations/5.36.0/001/types.d.ts +67 -0
- package/migrations/5.36.0/001/types.js +7 -0
- package/migrations/5.36.0/001/types.js.map +1 -0
- package/migrations/5.36.0/001/utils/createMimeTag.d.ts +1 -0
- package/migrations/5.36.0/001/utils/createMimeTag.js +10 -0
- package/migrations/5.36.0/001/utils/createMimeTag.js.map +1 -0
- package/migrations/5.36.0/001/utils/getCompressedData.d.ts +4 -0
- package/migrations/5.36.0/001/utils/getCompressedData.js +19 -0
- package/migrations/5.36.0/001/utils/getCompressedData.js.map +1 -0
- package/migrations/5.37.0/001/TenantLinkDataMigration.d.ts +14 -0
- package/migrations/5.37.0/001/TenantLinkDataMigration.js +106 -0
- package/migrations/5.37.0/001/TenantLinkDataMigration.js.map +1 -0
- package/migrations/5.37.0/001/entities/createTenantEntity.d.ts +48 -0
- package/migrations/5.37.0/001/entities/createTenantEntity.js +13 -0
- package/migrations/5.37.0/001/entities/createTenantEntity.js.map +1 -0
- package/migrations/5.37.0/001/entities/createTenantLinkEntity.d.ts +48 -0
- package/migrations/5.37.0/001/entities/createTenantLinkEntity.js +17 -0
- package/migrations/5.37.0/001/entities/createTenantLinkEntity.js.map +1 -0
- package/migrations/5.37.0/001/index.d.ts +10 -0
- package/migrations/5.37.0/001/index.js +49 -0
- package/migrations/5.37.0/001/index.js.map +1 -0
- package/migrations/5.37.0/001/types.d.ts +25 -0
- package/migrations/5.37.0/001/types.js +7 -0
- package/migrations/5.37.0/001/types.js.map +1 -0
- package/migrations/5.37.0/001/utils/isMigratedTenantLink.d.ts +2 -0
- package/migrations/5.37.0/001/utils/isMigratedTenantLink.js +12 -0
- package/migrations/5.37.0/001/utils/isMigratedTenantLink.js.map +1 -0
- package/migrations/5.37.0/002/constants.d.ts +1 -0
- package/migrations/5.37.0/002/constants.js +10 -0
- package/migrations/5.37.0/002/constants.js.map +1 -0
- package/migrations/5.37.0/002/ddb/index.d.ts +22 -0
- package/migrations/5.37.0/002/ddb/index.js +133 -0
- package/migrations/5.37.0/002/ddb/index.js.map +1 -0
- package/migrations/5.37.0/002/ddb-es/index.d.ts +35 -0
- package/migrations/5.37.0/002/ddb-es/index.js +321 -0
- package/migrations/5.37.0/002/ddb-es/index.js.map +1 -0
- package/migrations/5.37.0/002/entities/createEntryEntity.d.ts +89 -0
- package/migrations/5.37.0/002/entities/createEntryEntity.js +109 -0
- package/migrations/5.37.0/002/entities/createEntryEntity.js.map +1 -0
- package/migrations/5.37.0/002/entities/createLocaleEntity.d.ts +42 -0
- package/migrations/5.37.0/002/entities/createLocaleEntity.js +32 -0
- package/migrations/5.37.0/002/entities/createLocaleEntity.js.map +1 -0
- package/migrations/5.37.0/002/entities/createTenantEntity.d.ts +48 -0
- package/migrations/5.37.0/002/entities/createTenantEntity.js +13 -0
- package/migrations/5.37.0/002/entities/createTenantEntity.js.map +1 -0
- package/migrations/5.37.0/002/types.d.ts +53 -0
- package/migrations/5.37.0/002/types.js +7 -0
- package/migrations/5.37.0/002/types.js.map +1 -0
- package/migrations/5.37.0/002/utils/getCompressedData.d.ts +4 -0
- package/migrations/5.37.0/002/utils/getCompressedData.js +19 -0
- package/migrations/5.37.0/002/utils/getCompressedData.js.map +1 -0
- package/migrations/5.37.0/002/utils/getDecompressedData.d.ts +1 -0
- package/migrations/5.37.0/002/utils/getDecompressedData.js +31 -0
- package/migrations/5.37.0/002/utils/getDecompressedData.js.map +1 -0
- package/migrations/5.37.0/003/constants.d.ts +3 -0
- package/migrations/5.37.0/003/constants.js +14 -0
- package/migrations/5.37.0/003/constants.js.map +1 -0
- package/migrations/5.37.0/003/ddb/AcoFolderMigration.d.ts +15 -0
- package/migrations/5.37.0/003/ddb/AcoFolderMigration.js +179 -0
- package/migrations/5.37.0/003/ddb/AcoFolderMigration.js.map +1 -0
- package/migrations/5.37.0/003/ddb/index.d.ts +10 -0
- package/migrations/5.37.0/003/ddb/index.js +49 -0
- package/migrations/5.37.0/003/ddb/index.js.map +1 -0
- package/migrations/5.37.0/003/ddb-es/AcoFolderMigration.d.ts +20 -0
- package/migrations/5.37.0/003/ddb-es/AcoFolderMigration.js +313 -0
- package/migrations/5.37.0/003/ddb-es/AcoFolderMigration.js.map +1 -0
- package/migrations/5.37.0/003/ddb-es/index.d.ts +12 -0
- package/migrations/5.37.0/003/ddb-es/index.js +64 -0
- package/migrations/5.37.0/003/ddb-es/index.js.map +1 -0
- package/migrations/5.37.0/003/ddb-es/latestElasticsearchData.d.ts +4 -0
- package/migrations/5.37.0/003/ddb-es/latestElasticsearchData.js +30 -0
- package/migrations/5.37.0/003/ddb-es/latestElasticsearchData.js.map +1 -0
- package/migrations/5.37.0/003/entities/createEntryEntity.d.ts +89 -0
- package/migrations/5.37.0/003/entities/createEntryEntity.js +109 -0
- package/migrations/5.37.0/003/entities/createEntryEntity.js.map +1 -0
- package/migrations/5.37.0/003/entities/createLocaleEntity.d.ts +42 -0
- package/migrations/5.37.0/003/entities/createLocaleEntity.js +32 -0
- package/migrations/5.37.0/003/entities/createLocaleEntity.js.map +1 -0
- package/migrations/5.37.0/003/entities/createTenantEntity.d.ts +48 -0
- package/migrations/5.37.0/003/entities/createTenantEntity.js +13 -0
- package/migrations/5.37.0/003/entities/createTenantEntity.js.map +1 -0
- package/migrations/5.37.0/003/types.d.ts +46 -0
- package/migrations/5.37.0/003/types.js +7 -0
- package/migrations/5.37.0/003/types.js.map +1 -0
- package/migrations/5.37.0/003/utils/getCompressedData.d.ts +4 -0
- package/migrations/5.37.0/003/utils/getCompressedData.js +19 -0
- package/migrations/5.37.0/003/utils/getCompressedData.js.map +1 -0
- package/migrations/5.37.0/003/utils/getDecompressedData.d.ts +1 -0
- package/migrations/5.37.0/003/utils/getDecompressedData.js +31 -0
- package/migrations/5.37.0/003/utils/getDecompressedData.js.map +1 -0
- package/migrations/5.37.0/004/constants.d.ts +7 -0
- package/migrations/5.37.0/004/constants.js +22 -0
- package/migrations/5.37.0/004/constants.js.map +1 -0
- package/migrations/5.37.0/004/ddb/PageDataMigration.d.ts +17 -0
- package/migrations/5.37.0/004/ddb/PageDataMigration.js +269 -0
- package/migrations/5.37.0/004/ddb/PageDataMigration.js.map +1 -0
- package/migrations/5.37.0/004/ddb/index.d.ts +10 -0
- package/migrations/5.37.0/004/ddb/index.js +49 -0
- package/migrations/5.37.0/004/ddb/index.js.map +1 -0
- package/migrations/5.37.0/004/ddb-es/PageDataMigration.d.ts +22 -0
- package/migrations/5.37.0/004/ddb-es/PageDataMigration.js +364 -0
- package/migrations/5.37.0/004/ddb-es/PageDataMigration.js.map +1 -0
- package/migrations/5.37.0/004/ddb-es/index.d.ts +12 -0
- package/migrations/5.37.0/004/ddb-es/index.js +64 -0
- package/migrations/5.37.0/004/ddb-es/index.js.map +1 -0
- package/migrations/5.37.0/004/entities/createEntryEntity.d.ts +89 -0
- package/migrations/5.37.0/004/entities/createEntryEntity.js +109 -0
- package/migrations/5.37.0/004/entities/createEntryEntity.js.map +1 -0
- package/migrations/5.37.0/004/entities/createLocaleEntity.d.ts +42 -0
- package/migrations/5.37.0/004/entities/createLocaleEntity.js +32 -0
- package/migrations/5.37.0/004/entities/createLocaleEntity.js.map +1 -0
- package/migrations/5.37.0/004/entities/createPageEntity.d.ts +89 -0
- package/migrations/5.37.0/004/entities/createPageEntity.js +113 -0
- package/migrations/5.37.0/004/entities/createPageEntity.js.map +1 -0
- package/migrations/5.37.0/004/entities/createTenantEntity.d.ts +48 -0
- package/migrations/5.37.0/004/entities/createTenantEntity.js +13 -0
- package/migrations/5.37.0/004/entities/createTenantEntity.js.map +1 -0
- package/migrations/5.37.0/004/types.d.ts +149 -0
- package/migrations/5.37.0/004/types.js +7 -0
- package/migrations/5.37.0/004/types.js.map +1 -0
- package/migrations/5.37.0/004/utils/getCompressedData.d.ts +4 -0
- package/migrations/5.37.0/004/utils/getCompressedData.js +19 -0
- package/migrations/5.37.0/004/utils/getCompressedData.js.map +1 -0
- package/migrations/5.37.0/005/constants.d.ts +3 -0
- package/migrations/5.37.0/005/constants.js +14 -0
- package/migrations/5.37.0/005/constants.js.map +1 -0
- package/migrations/5.37.0/005/ddb/index.d.ts +20 -0
- package/migrations/5.37.0/005/ddb/index.js +245 -0
- package/migrations/5.37.0/005/ddb/index.js.map +1 -0
- package/migrations/5.37.0/005/ddb-es/index.d.ts +22 -0
- package/migrations/5.37.0/005/ddb-es/index.js +382 -0
- package/migrations/5.37.0/005/ddb-es/index.js.map +1 -0
- package/migrations/5.37.0/005/entities/createEntryEntity.d.ts +89 -0
- package/migrations/5.37.0/005/entities/createEntryEntity.js +109 -0
- package/migrations/5.37.0/005/entities/createEntryEntity.js.map +1 -0
- package/migrations/5.37.0/005/entities/createFileEntity.d.ts +95 -0
- package/migrations/5.37.0/005/entities/createFileEntity.js +33 -0
- package/migrations/5.37.0/005/entities/createFileEntity.js.map +1 -0
- package/migrations/5.37.0/005/entities/createLocaleEntity.d.ts +42 -0
- package/migrations/5.37.0/005/entities/createLocaleEntity.js +32 -0
- package/migrations/5.37.0/005/entities/createLocaleEntity.js.map +1 -0
- package/migrations/5.37.0/005/entities/createTenantEntity.d.ts +48 -0
- package/migrations/5.37.0/005/entities/createTenantEntity.js +13 -0
- package/migrations/5.37.0/005/entities/createTenantEntity.js.map +1 -0
- package/migrations/5.37.0/005/entities/createTenantLinkEntity.d.ts +48 -0
- package/migrations/5.37.0/005/entities/createTenantLinkEntity.js +17 -0
- package/migrations/5.37.0/005/entities/createTenantLinkEntity.js.map +1 -0
- package/migrations/5.37.0/005/types.d.ts +109 -0
- package/migrations/5.37.0/005/types.js +7 -0
- package/migrations/5.37.0/005/types.js.map +1 -0
- package/migrations/5.38.0/001/ddb/index.d.ts +11 -0
- package/migrations/5.38.0/001/ddb/index.js +116 -0
- package/migrations/5.38.0/001/ddb/index.js.map +1 -0
- package/migrations/5.38.0/001/ddb-es/index.d.ts +13 -0
- package/migrations/5.38.0/001/ddb-es/index.js +211 -0
- package/migrations/5.38.0/001/ddb-es/index.js.map +1 -0
- package/migrations/5.38.0/001/entities/createFormEntity.d.ts +42 -0
- package/migrations/5.38.0/001/entities/createFormEntity.js +92 -0
- package/migrations/5.38.0/001/entities/createFormEntity.js.map +1 -0
- package/migrations/5.38.0/001/types.d.ts +11 -0
- package/migrations/5.38.0/001/types.js +7 -0
- package/migrations/5.38.0/001/types.js.map +1 -0
- package/migrations/5.38.0/002/ddb/index.d.ts +22 -0
- package/migrations/5.38.0/002/ddb/index.js +140 -0
- package/migrations/5.38.0/002/ddb/index.js.map +1 -0
- package/migrations/5.38.0/002/ddb-es/index.d.ts +32 -0
- package/migrations/5.38.0/002/ddb-es/index.js +250 -0
- package/migrations/5.38.0/002/ddb-es/index.js.map +1 -0
- package/migrations/5.38.0/002/entities/createFormEntity.d.ts +42 -0
- package/migrations/5.38.0/002/entities/createFormEntity.js +92 -0
- package/migrations/5.38.0/002/entities/createFormEntity.js.map +1 -0
- package/migrations/5.38.0/002/entities/createFormSubmissionDdbEsEntity.d.ts +48 -0
- package/migrations/5.38.0/002/entities/createFormSubmissionDdbEsEntity.js +29 -0
- package/migrations/5.38.0/002/entities/createFormSubmissionDdbEsEntity.js.map +1 -0
- package/migrations/5.38.0/002/entities/createFormSubmissionEntity.d.ts +42 -0
- package/migrations/5.38.0/002/entities/createFormSubmissionEntity.js +56 -0
- package/migrations/5.38.0/002/entities/createFormSubmissionEntity.js.map +1 -0
- package/migrations/5.38.0/002/types.d.ts +23 -0
- package/migrations/5.38.0/002/types.js +7 -0
- package/migrations/5.38.0/002/types.js.map +1 -0
- package/migrations/5.38.0/003/ddb/compressContent.d.ts +4 -0
- package/migrations/5.38.0/003/ddb/compressContent.js +17 -0
- package/migrations/5.38.0/003/ddb/compressContent.js.map +1 -0
- package/migrations/5.38.0/003/ddb/index.d.ts +12 -0
- package/migrations/5.38.0/003/ddb/index.js +143 -0
- package/migrations/5.38.0/003/ddb/index.js.map +1 -0
- package/migrations/5.38.0/003/entities/createPageBlockEntity.d.ts +83 -0
- package/migrations/5.38.0/003/entities/createPageBlockEntity.js +68 -0
- package/migrations/5.38.0/003/entities/createPageBlockEntity.js.map +1 -0
- package/migrations/5.38.0/003/types.d.ts +8 -0
- package/migrations/5.38.0/003/types.js +7 -0
- package/migrations/5.38.0/003/types.js.map +1 -0
- package/migrations/5.39.0/001/ddb/index.d.ts +20 -0
- package/migrations/5.39.0/001/ddb/index.js +136 -0
- package/migrations/5.39.0/001/ddb/index.js.map +1 -0
- package/migrations/5.39.0/001/ddb-es/index.d.ts +30 -0
- package/migrations/5.39.0/001/ddb-es/index.js +266 -0
- package/migrations/5.39.0/001/ddb-es/index.js.map +1 -0
- package/migrations/5.39.0/001/entities/createEntryEntity.d.ts +89 -0
- package/migrations/5.39.0/001/entities/createEntryEntity.js +164 -0
- package/migrations/5.39.0/001/entities/createEntryEntity.js.map +1 -0
- package/migrations/5.39.0/001/types.d.ts +136 -0
- package/migrations/5.39.0/001/types.js +7 -0
- package/migrations/5.39.0/001/types.js.map +1 -0
- package/migrations/5.39.0/001/utils/assignNewMetaFields.d.ts +11 -0
- package/migrations/5.39.0/001/utils/assignNewMetaFields.js +44 -0
- package/migrations/5.39.0/001/utils/assignNewMetaFields.js.map +1 -0
- package/migrations/5.39.0/001/utils/ensureAllNonNullableValues.d.ts +8 -0
- package/migrations/5.39.0/001/utils/ensureAllNonNullableValues.js +38 -0
- package/migrations/5.39.0/001/utils/ensureAllNonNullableValues.js.map +1 -0
- package/migrations/5.39.0/001/utils/fixTypeFieldValue.d.ts +3 -0
- package/migrations/5.39.0/001/utils/fixTypeFieldValue.js +33 -0
- package/migrations/5.39.0/001/utils/fixTypeFieldValue.js.map +1 -0
- package/migrations/5.39.0/001/utils/getCompressedData.d.ts +4 -0
- package/migrations/5.39.0/001/utils/getCompressedData.js +19 -0
- package/migrations/5.39.0/001/utils/getCompressedData.js.map +1 -0
- package/migrations/5.39.0/001/utils/getDecompressedData.d.ts +1 -0
- package/migrations/5.39.0/001/utils/getDecompressedData.js +31 -0
- package/migrations/5.39.0/001/utils/getDecompressedData.js.map +1 -0
- package/migrations/5.39.0/001/utils/getFallbackIdentity.d.ts +8 -0
- package/migrations/5.39.0/001/utils/getFallbackIdentity.js +44 -0
- package/migrations/5.39.0/001/utils/getFallbackIdentity.js.map +1 -0
- package/migrations/5.39.0/001/utils/getFirstLastPublishedOn.d.ts +11 -0
- package/migrations/5.39.0/001/utils/getFirstLastPublishedOn.js +40 -0
- package/migrations/5.39.0/001/utils/getFirstLastPublishedOn.js.map +1 -0
- package/migrations/5.39.0/001/utils/getNonNullableFieldsWithMissingValues.d.ts +2 -0
- package/migrations/5.39.0/001/utils/getNonNullableFieldsWithMissingValues.js +22 -0
- package/migrations/5.39.0/001/utils/getNonNullableFieldsWithMissingValues.js.map +1 -0
- package/migrations/5.39.0/001/utils/getOldestRevisionCreatedOn.d.ts +11 -0
- package/migrations/5.39.0/001/utils/getOldestRevisionCreatedOn.js +33 -0
- package/migrations/5.39.0/001/utils/getOldestRevisionCreatedOn.js.map +1 -0
- package/migrations/5.39.0/001/utils/hasAllNonNullableValues.d.ts +2 -0
- package/migrations/5.39.0/001/utils/hasAllNonNullableValues.js +21 -0
- package/migrations/5.39.0/001/utils/hasAllNonNullableValues.js.map +1 -0
- package/migrations/5.39.0/001/utils/hasValidTypeFieldValue.d.ts +4 -0
- package/migrations/5.39.0/001/utils/hasValidTypeFieldValue.js +21 -0
- package/migrations/5.39.0/001/utils/hasValidTypeFieldValue.js.map +1 -0
- package/migrations/5.39.0/001/utils/isMigratedEntry.d.ts +2 -0
- package/migrations/5.39.0/001/utils/isMigratedEntry.js +12 -0
- package/migrations/5.39.0/001/utils/isMigratedEntry.js.map +1 -0
- package/migrations/5.39.0/002/ddb/FileManager_5_39_0_002.d.ts +14 -0
- package/migrations/5.39.0/002/ddb/FileManager_5_39_0_002.js +133 -0
- package/migrations/5.39.0/002/ddb/FileManager_5_39_0_002.js.map +1 -0
- package/migrations/5.39.0/002/ddb/index.d.ts +1 -0
- package/migrations/5.39.0/002/ddb/index.js +18 -0
- package/migrations/5.39.0/002/ddb/index.js.map +1 -0
- package/migrations/5.39.0/002/ddb-es/FileManager_5_39_0_002.d.ts +15 -0
- package/migrations/5.39.0/002/ddb-es/FileManager_5_39_0_002.js +190 -0
- package/migrations/5.39.0/002/ddb-es/FileManager_5_39_0_002.js.map +1 -0
- package/migrations/5.39.0/002/ddb-es/index.d.ts +1 -0
- package/migrations/5.39.0/002/ddb-es/index.js +18 -0
- package/migrations/5.39.0/002/ddb-es/index.js.map +1 -0
- package/migrations/5.39.0/002/utils/FileMetadata.d.ts +12 -0
- package/migrations/5.39.0/002/utils/FileMetadata.js +55 -0
- package/migrations/5.39.0/002/utils/FileMetadata.js.map +1 -0
- package/migrations/5.39.0/002/utils/createFileEntity.d.ts +53 -0
- package/migrations/5.39.0/002/utils/createFileEntity.js +50 -0
- package/migrations/5.39.0/002/utils/createFileEntity.js.map +1 -0
- package/migrations/5.39.0/002/utils/createLocaleEntity.d.ts +42 -0
- package/migrations/5.39.0/002/utils/createLocaleEntity.js +32 -0
- package/migrations/5.39.0/002/utils/createLocaleEntity.js.map +1 -0
- package/migrations/5.39.0/002/utils/createTenantEntity.d.ts +48 -0
- package/migrations/5.39.0/002/utils/createTenantEntity.js +13 -0
- package/migrations/5.39.0/002/utils/createTenantEntity.js.map +1 -0
- package/migrations/5.39.2/001/ddb-es/index.d.ts +30 -0
- package/migrations/5.39.2/001/ddb-es/index.js +276 -0
- package/migrations/5.39.2/001/ddb-es/index.js.map +1 -0
- package/migrations/5.39.6/001/ddb-es/MetaFieldsMigration.d.ts +21 -0
- package/migrations/5.39.6/001/ddb-es/MetaFieldsMigration.js +167 -0
- package/migrations/5.39.6/001/ddb-es/MetaFieldsMigration.js.map +1 -0
- package/migrations/5.39.6/001/ddb-es/SegmentProcessor.d.ts +23 -0
- package/migrations/5.39.6/001/ddb-es/SegmentProcessor.js +31 -0
- package/migrations/5.39.6/001/ddb-es/SegmentProcessor.js.map +1 -0
- package/migrations/5.39.6/001/ddb-es/bin.d.ts +2 -0
- package/migrations/5.39.6/001/ddb-es/bin.js +83 -0
- package/migrations/5.39.6/001/ddb-es/bin.js.map +1 -0
- package/migrations/5.39.6/001/ddb-es/createMetaFieldsDataMigrationDeploymentHook.d.ts +11 -0
- package/migrations/5.39.6/001/ddb-es/createMetaFieldsDataMigrationDeploymentHook.js +83 -0
- package/migrations/5.39.6/001/ddb-es/createMetaFieldsDataMigrationDeploymentHook.js.map +1 -0
- package/migrations/5.39.6/001/ddb-es/index.d.ts +30 -0
- package/migrations/5.39.6/001/ddb-es/index.js +329 -0
- package/migrations/5.39.6/001/ddb-es/index.js.map +1 -0
- package/migrations/5.39.6/001/ddb-es/utils.d.ts +28 -0
- package/migrations/5.39.6/001/ddb-es/utils.js +62 -0
- package/migrations/5.39.6/001/ddb-es/utils.js.map +1 -0
- package/migrations/5.39.6/001/ddb-es/worker.d.ts +1 -0
- package/migrations/5.39.6/001/ddb-es/worker.js +352 -0
- package/migrations/5.39.6/001/ddb-es/worker.js.map +1 -0
- package/package.json +45 -0
- package/utils/createEntity.d.ts +89 -0
- package/utils/createEntity.js +67 -0
- package/utils/createEntity.js.map +1 -0
- package/utils/createLocaleEntity.d.ts +42 -0
- package/utils/createLocaleEntity.js +32 -0
- package/utils/createLocaleEntity.js.map +1 -0
- package/utils/createTenantEntity.d.ts +48 -0
- package/utils/createTenantEntity.js +13 -0
- package/utils/createTenantEntity.js.map +1 -0
- package/utils/dynamoDb.d.ts +3 -0
- package/utils/dynamoDb.js +62 -0
- package/utils/dynamoDb.js.map +1 -0
- package/utils/elasticsearch/disableEsIndexing.d.ts +9 -0
- package/utils/elasticsearch/disableEsIndexing.js +34 -0
- package/utils/elasticsearch/disableEsIndexing.js.map +1 -0
- package/utils/elasticsearch/esCreateIndex.d.ts +9 -0
- package/utils/elasticsearch/esCreateIndex.js +62 -0
- package/utils/elasticsearch/esCreateIndex.js.map +1 -0
- package/utils/elasticsearch/esFindOne.d.ts +8 -0
- package/utils/elasticsearch/esFindOne.js +27 -0
- package/utils/elasticsearch/esFindOne.js.map +1 -0
- package/utils/elasticsearch/esGetIndexExist.d.ts +9 -0
- package/utils/elasticsearch/esGetIndexExist.js +37 -0
- package/utils/elasticsearch/esGetIndexExist.js.map +1 -0
- package/utils/elasticsearch/esGetIndexName.d.ts +7 -0
- package/utils/elasticsearch/esGetIndexName.js +40 -0
- package/utils/elasticsearch/esGetIndexName.js.map +1 -0
- package/utils/elasticsearch/esGetIndexSettings.d.ts +7 -0
- package/utils/elasticsearch/esGetIndexSettings.js +32 -0
- package/utils/elasticsearch/esGetIndexSettings.js.map +1 -0
- package/utils/elasticsearch/esListIndexes.d.ts +6 -0
- package/utils/elasticsearch/esListIndexes.js +23 -0
- package/utils/elasticsearch/esListIndexes.js.map +1 -0
- package/utils/elasticsearch/esPutIndexSettings.d.ts +7 -0
- package/utils/elasticsearch/esPutIndexSettings.js +30 -0
- package/utils/elasticsearch/esPutIndexSettings.js.map +1 -0
- package/utils/elasticsearch/esQueryAll.d.ts +8 -0
- package/utils/elasticsearch/esQueryAll.js +26 -0
- package/utils/elasticsearch/esQueryAll.js.map +1 -0
- package/utils/elasticsearch/esQueryAllWithCallback.d.ts +10 -0
- package/utils/elasticsearch/esQueryAllWithCallback.js +45 -0
- package/utils/elasticsearch/esQueryAllWithCallback.js.map +1 -0
- package/utils/elasticsearch/fetchOriginalEsSettings.d.ts +13 -0
- package/utils/elasticsearch/fetchOriginalEsSettings.js +36 -0
- package/utils/elasticsearch/fetchOriginalEsSettings.js.map +1 -0
- package/utils/elasticsearch/index.d.ts +12 -0
- package/utils/elasticsearch/index.js +139 -0
- package/utils/elasticsearch/index.js.map +1 -0
- package/utils/elasticsearch/plugins/base.d.ts +3 -0
- package/utils/elasticsearch/plugins/base.js +13 -0
- package/utils/elasticsearch/plugins/base.js.map +1 -0
- package/utils/elasticsearch/plugins/index.d.ts +6 -0
- package/utils/elasticsearch/plugins/index.js +14 -0
- package/utils/elasticsearch/plugins/index.js.map +1 -0
- package/utils/elasticsearch/plugins/japanese.d.ts +4 -0
- package/utils/elasticsearch/plugins/japanese.js +14 -0
- package/utils/elasticsearch/plugins/japanese.js.map +1 -0
- package/utils/elasticsearch/restoreOriginalEsSettings.d.ts +15 -0
- package/utils/elasticsearch/restoreOriginalEsSettings.js +44 -0
- package/utils/elasticsearch/restoreOriginalEsSettings.js.map +1 -0
- package/utils/forEachTenantLocale.d.ts +13 -0
- package/utils/forEachTenantLocale.js +55 -0
- package/utils/forEachTenantLocale.js.map +1 -0
- package/utils/index.d.ts +6 -0
- package/utils/index.js +73 -0
- package/utils/index.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_constants","require","hasAllNonNullableValues","entry","nonNullableMetaFields","pickEntryMetaFields","isNonNullableEntryMetaField","fieldName","value","exports"],"sources":["hasAllNonNullableValues.ts"],"sourcesContent":["import { CmsEntry } from \"~/migrations/5.39.0/001/types\";\nimport {\n EntryMetaFieldName,\n isNonNullableEntryMetaField,\n pickEntryMetaFields\n} from \"@webiny/api-headless-cms/constants\";\n\nexport const hasAllNonNullableValues = (entry: CmsEntry) => {\n // Only `modifiedX` and `publishedX` fields are nullable.\n const nonNullableMetaFields = pickEntryMetaFields(entry, isNonNullableEntryMetaField);\n\n for (const fieldName in nonNullableMetaFields) {\n const value = nonNullableMetaFields[fieldName as EntryMetaFieldName];\n if (!value) {\n return false;\n }\n }\n\n return true;\n};\n"],"mappings":";;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAMO,MAAMC,uBAAuB,GAAIC,KAAe,IAAK;EACxD;EACA,MAAMC,qBAAqB,GAAG,IAAAC,8BAAmB,EAACF,KAAK,EAAEG,sCAA2B,CAAC;EAErF,KAAK,MAAMC,SAAS,IAAIH,qBAAqB,EAAE;IAC3C,MAAMI,KAAK,GAAGJ,qBAAqB,CAACG,SAAS,CAAuB;IACpE,IAAI,CAACC,KAAK,EAAE;MACR,OAAO,KAAK;IAChB;EACJ;EAEA,OAAO,IAAI;AACf,CAAC;AAACC,OAAA,CAAAP,uBAAA,GAAAA,uBAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.hasValidTypeFieldValue = void 0;
|
|
7
|
+
var _recordType = require("@webiny/api-headless-cms-ddb-es/operations/entry/recordType");
|
|
8
|
+
const hasValidTypeFieldValue = entry => {
|
|
9
|
+
if (entry.SK.startsWith("REV#")) {
|
|
10
|
+
return entry.TYPE === (0, _recordType.createRecordType)();
|
|
11
|
+
}
|
|
12
|
+
if (entry.SK === "L") {
|
|
13
|
+
return entry.TYPE === (0, _recordType.createLatestRecordType)();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// SK === "P"
|
|
17
|
+
return entry.TYPE === (0, _recordType.createPublishedRecordType)();
|
|
18
|
+
};
|
|
19
|
+
exports.hasValidTypeFieldValue = hasValidTypeFieldValue;
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=hasValidTypeFieldValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_recordType","require","hasValidTypeFieldValue","entry","SK","startsWith","TYPE","createRecordType","createLatestRecordType","createPublishedRecordType","exports"],"sources":["hasValidTypeFieldValue.ts"],"sourcesContent":["import {\n createRecordType,\n createLatestRecordType,\n createPublishedRecordType\n} from \"@webiny/api-headless-cms-ddb-es/operations/entry/recordType\";\n\nexport const hasValidTypeFieldValue = (entry: { SK: string; TYPE?: string }) => {\n if (entry.SK.startsWith(\"REV#\")) {\n return entry.TYPE === createRecordType();\n }\n\n if (entry.SK === \"L\") {\n return entry.TYPE === createLatestRecordType();\n }\n\n // SK === \"P\"\n return entry.TYPE === createPublishedRecordType();\n};\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAMO,MAAMC,sBAAsB,GAAIC,KAAoC,IAAK;EAC5E,IAAIA,KAAK,CAACC,EAAE,CAACC,UAAU,CAAC,MAAM,CAAC,EAAE;IAC7B,OAAOF,KAAK,CAACG,IAAI,KAAK,IAAAC,4BAAgB,EAAC,CAAC;EAC5C;EAEA,IAAIJ,KAAK,CAACC,EAAE,KAAK,GAAG,EAAE;IAClB,OAAOD,KAAK,CAACG,IAAI,KAAK,IAAAE,kCAAsB,EAAC,CAAC;EAClD;;EAEA;EACA,OAAOL,KAAK,CAACG,IAAI,KAAK,IAAAG,qCAAyB,EAAC,CAAC;AACrD,CAAC;AAACC,OAAA,CAAAR,sBAAA,GAAAA,sBAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isMigratedEntry = void 0;
|
|
7
|
+
const isMigratedEntry = entry => {
|
|
8
|
+
return "revisionCreatedOn" in entry && entry.revisionCreatedOn;
|
|
9
|
+
};
|
|
10
|
+
exports.isMigratedEntry = isMigratedEntry;
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=isMigratedEntry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isMigratedEntry","entry","revisionCreatedOn","exports"],"sources":["isMigratedEntry.ts"],"sourcesContent":["import { CmsEntry } from \"../types\";\n\nexport const isMigratedEntry = (entry: CmsEntry) => {\n return \"revisionCreatedOn\" in entry && entry.revisionCreatedOn;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,eAAe,GAAIC,KAAe,IAAK;EAChD,OAAO,mBAAmB,IAAIA,KAAK,IAAIA,KAAK,CAACC,iBAAiB;AAClE,CAAC;AAACC,OAAA,CAAAH,eAAA,GAAAA,eAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
import { DataMigration, DataMigrationContext } from "@webiny/data-migration";
|
|
3
|
+
export declare class FileManager_5_39_0_002 implements DataMigration {
|
|
4
|
+
private readonly fileEntity;
|
|
5
|
+
private readonly table;
|
|
6
|
+
private readonly bucket;
|
|
7
|
+
private readonly s3;
|
|
8
|
+
constructor(table: Table<string, string, string>);
|
|
9
|
+
getId(): string;
|
|
10
|
+
getDescription(): string;
|
|
11
|
+
shouldExecute({ logger }: DataMigrationContext): Promise<boolean>;
|
|
12
|
+
execute({ logger, ...context }: DataMigrationContext): Promise<void>;
|
|
13
|
+
private getFileQuery;
|
|
14
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FileManager_5_39_0_002 = void 0;
|
|
7
|
+
var _ioc = require("@webiny/ioc");
|
|
8
|
+
var _utils = require("@webiny/utils");
|
|
9
|
+
var _dataMigration = require("@webiny/data-migration");
|
|
10
|
+
var _clientS = require("@webiny/aws-sdk/client-s3");
|
|
11
|
+
var _utils2 = require("../../../../utils");
|
|
12
|
+
var _createFileEntity = require("../utils/createFileEntity");
|
|
13
|
+
var _FileMetadata = require("../utils/FileMetadata");
|
|
14
|
+
const isGroupMigrationCompleted = status => {
|
|
15
|
+
return typeof status === "boolean";
|
|
16
|
+
};
|
|
17
|
+
class FileManager_5_39_0_002 {
|
|
18
|
+
constructor(table) {
|
|
19
|
+
this.table = table;
|
|
20
|
+
this.fileEntity = (0, _createFileEntity.createFileEntity)(table);
|
|
21
|
+
this.s3 = new _clientS.S3({
|
|
22
|
+
region: process.env.AWS_REGION
|
|
23
|
+
});
|
|
24
|
+
this.bucket = String(process.env.S3_BUCKET);
|
|
25
|
+
}
|
|
26
|
+
getId() {
|
|
27
|
+
return "5.39.0-002";
|
|
28
|
+
}
|
|
29
|
+
getDescription() {
|
|
30
|
+
return "Generate a metadata file for every File Manager file.";
|
|
31
|
+
}
|
|
32
|
+
async shouldExecute({
|
|
33
|
+
logger
|
|
34
|
+
}) {
|
|
35
|
+
let shouldExecute = false;
|
|
36
|
+
await (0, _utils2.forEachTenantLocale)({
|
|
37
|
+
table: this.table,
|
|
38
|
+
logger,
|
|
39
|
+
callback: async ({
|
|
40
|
+
tenantId,
|
|
41
|
+
localeCode
|
|
42
|
+
}) => {
|
|
43
|
+
const latestFile = await (0, _utils2.queryOne)(this.getFileQuery(tenantId, localeCode));
|
|
44
|
+
if (!latestFile) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
const fileMetadata = new _FileMetadata.FileMetadata(this.s3, this.bucket, latestFile);
|
|
48
|
+
const hasMetadata = await fileMetadata.exists();
|
|
49
|
+
if (!hasMetadata) {
|
|
50
|
+
shouldExecute = true;
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Continue to the next tenant/locale.
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return shouldExecute;
|
|
59
|
+
}
|
|
60
|
+
async execute({
|
|
61
|
+
logger,
|
|
62
|
+
...context
|
|
63
|
+
}) {
|
|
64
|
+
const migrationStatus = context.checkpoint || {};
|
|
65
|
+
let batch = 0;
|
|
66
|
+
await (0, _utils2.forEachTenantLocale)({
|
|
67
|
+
table: this.table,
|
|
68
|
+
logger,
|
|
69
|
+
callback: async ({
|
|
70
|
+
tenantId,
|
|
71
|
+
localeCode
|
|
72
|
+
}) => {
|
|
73
|
+
const groupId = `${tenantId}:${localeCode}`;
|
|
74
|
+
const status = migrationStatus[groupId];
|
|
75
|
+
if (isGroupMigrationCompleted(status)) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
await (0, _utils2.ddbQueryAllWithCallback)(this.getFileQuery(tenantId, localeCode, {
|
|
79
|
+
gt: status || " ",
|
|
80
|
+
limit: 1000
|
|
81
|
+
}), async files => {
|
|
82
|
+
batch++;
|
|
83
|
+
logger.info(`Processing batch #${batch} in group ${groupId} (${files.length} files).`);
|
|
84
|
+
const writers = files.map(file => {
|
|
85
|
+
const fileMetadata = new _FileMetadata.FileMetadata(this.s3, this.bucket, file);
|
|
86
|
+
const writeMetadata = () => fileMetadata.create();
|
|
87
|
+
return (0, _utils.executeWithRetry)(writeMetadata, {
|
|
88
|
+
onFailedAttempt: error => {
|
|
89
|
+
logger.error(`"batchWriteAll" attempt #${error.attemptNumber} failed.`);
|
|
90
|
+
logger.error(error.message);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
await Promise.all(writers);
|
|
95
|
+
|
|
96
|
+
// Update checkpoint after every batch
|
|
97
|
+
migrationStatus[groupId] = files[files.length - 1]?.id;
|
|
98
|
+
|
|
99
|
+
// Check if we should store checkpoint and exit.
|
|
100
|
+
if (context.runningOutOfTime()) {
|
|
101
|
+
await context.createCheckpointAndExit(migrationStatus);
|
|
102
|
+
} else {
|
|
103
|
+
await context.createCheckpoint(migrationStatus);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// Mark group as completed.
|
|
108
|
+
migrationStatus[groupId] = true;
|
|
109
|
+
|
|
110
|
+
// Store checkpoint.
|
|
111
|
+
await context.createCheckpoint(migrationStatus);
|
|
112
|
+
|
|
113
|
+
// Continue processing.
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
getFileQuery(tenantId, localeCode, options = {}) {
|
|
119
|
+
return {
|
|
120
|
+
entity: this.fileEntity,
|
|
121
|
+
partitionKey: `T#${tenantId}#L#${localeCode}#CMS#CME#M#fmFile#L`,
|
|
122
|
+
options: {
|
|
123
|
+
index: "GSI1",
|
|
124
|
+
gt: " ",
|
|
125
|
+
...options
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.FileManager_5_39_0_002 = FileManager_5_39_0_002;
|
|
131
|
+
(0, _ioc.makeInjectable)(FileManager_5_39_0_002, [(0, _ioc.inject)(_dataMigration.PrimaryDynamoTableSymbol)]);
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=FileManager_5_39_0_002.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ioc","require","_utils","_dataMigration","_clientS","_utils2","_createFileEntity","_FileMetadata","isGroupMigrationCompleted","status","FileManager_5_39_0_002","constructor","table","fileEntity","createFileEntity","s3","S3","region","process","env","AWS_REGION","bucket","String","S3_BUCKET","getId","getDescription","shouldExecute","logger","forEachTenantLocale","callback","tenantId","localeCode","latestFile","queryOne","getFileQuery","fileMetadata","FileMetadata","hasMetadata","exists","execute","context","migrationStatus","checkpoint","batch","groupId","ddbQueryAllWithCallback","gt","limit","files","info","length","writers","map","file","writeMetadata","create","executeWithRetry","onFailedAttempt","error","attemptNumber","message","Promise","all","id","runningOutOfTime","createCheckpointAndExit","createCheckpoint","options","entity","partitionKey","index","exports","makeInjectable","inject","PrimaryDynamoTableSymbol"],"sources":["FileManager_5_39_0_002.ts"],"sourcesContent":["import { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { inject, makeInjectable } from \"@webiny/ioc\";\nimport { executeWithRetry } from \"@webiny/utils\";\nimport { PrimitiveValue } from \"@webiny/api-elasticsearch/types\";\nimport {\n DataMigration,\n DataMigrationContext,\n PrimaryDynamoTableSymbol\n} from \"@webiny/data-migration\";\nimport { S3 } from \"@webiny/aws-sdk/client-s3\";\nimport { QueryAllParams } from \"@webiny/db-dynamodb\";\nimport { ddbQueryAllWithCallback, forEachTenantLocale, queryOne } from \"~/utils\";\nimport { createFileEntity, FileEntry } from \"../utils/createFileEntity\";\nimport { FileMetadata } from \"../utils/FileMetadata\";\n\nconst isGroupMigrationCompleted = (\n status: PrimitiveValue[] | boolean | undefined\n): status is boolean => {\n return typeof status === \"boolean\";\n};\n\nexport class FileManager_5_39_0_002 implements DataMigration {\n private readonly fileEntity: ReturnType<typeof createFileEntity>;\n private readonly table: Table<string, string, string>;\n private readonly bucket: string;\n private readonly s3: S3;\n\n constructor(table: Table<string, string, string>) {\n this.table = table;\n this.fileEntity = createFileEntity(table);\n this.s3 = new S3({ region: process.env.AWS_REGION });\n this.bucket = String(process.env.S3_BUCKET);\n }\n\n getId() {\n return \"5.39.0-002\";\n }\n\n getDescription() {\n return \"Generate a metadata file for every File Manager file.\";\n }\n\n async shouldExecute({ logger }: DataMigrationContext): Promise<boolean> {\n let shouldExecute = false;\n\n await forEachTenantLocale({\n table: this.table,\n logger,\n callback: async ({ tenantId, localeCode }) => {\n const latestFile = await queryOne<FileEntry>(\n this.getFileQuery(tenantId, localeCode)\n );\n\n if (!latestFile) {\n return false;\n }\n\n const fileMetadata = new FileMetadata(this.s3, this.bucket, latestFile);\n\n const hasMetadata = await fileMetadata.exists();\n\n if (!hasMetadata) {\n shouldExecute = true;\n return false;\n }\n\n // Continue to the next tenant/locale.\n return true;\n }\n });\n\n return shouldExecute;\n }\n\n async execute({ logger, ...context }: DataMigrationContext): Promise<void> {\n const migrationStatus = context.checkpoint || {};\n\n let batch = 0;\n\n await forEachTenantLocale({\n table: this.table,\n logger,\n callback: async ({ tenantId, localeCode }) => {\n const groupId = `${tenantId}:${localeCode}`;\n const status = migrationStatus[groupId];\n\n if (isGroupMigrationCompleted(status)) {\n return true;\n }\n\n await ddbQueryAllWithCallback<FileEntry>(\n this.getFileQuery(tenantId, localeCode, { gt: status || \" \", limit: 1000 }),\n async files => {\n batch++;\n\n logger.info(\n `Processing batch #${batch} in group ${groupId} (${files.length} files).`\n );\n\n const writers = files.map(file => {\n const fileMetadata = new FileMetadata(this.s3, this.bucket, file);\n const writeMetadata = () => fileMetadata.create();\n\n return executeWithRetry(writeMetadata, {\n onFailedAttempt: error => {\n logger.error(\n `\"batchWriteAll\" attempt #${error.attemptNumber} failed.`\n );\n logger.error(error.message);\n }\n });\n });\n\n await Promise.all(writers);\n\n // Update checkpoint after every batch\n migrationStatus[groupId] = files[files.length - 1]?.id;\n\n // Check if we should store checkpoint and exit.\n if (context.runningOutOfTime()) {\n await context.createCheckpointAndExit(migrationStatus);\n } else {\n await context.createCheckpoint(migrationStatus);\n }\n }\n );\n\n // Mark group as completed.\n migrationStatus[groupId] = true;\n\n // Store checkpoint.\n await context.createCheckpoint(migrationStatus);\n\n // Continue processing.\n return true;\n }\n });\n }\n\n private getFileQuery(\n tenantId: string,\n localeCode: string,\n options: QueryAllParams[\"options\"] = {}\n ) {\n return {\n entity: this.fileEntity,\n partitionKey: `T#${tenantId}#L#${localeCode}#CMS#CME#M#fmFile#L`,\n options: {\n index: \"GSI1\",\n gt: \" \",\n ...options\n }\n };\n }\n}\n\nmakeInjectable(FileManager_5_39_0_002, [inject(PrimaryDynamoTableSymbol)]);\n"],"mappings":";;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAEA,MAAMO,yBAAyB,GAC3BC,MAA8C,IAC1B;EACpB,OAAO,OAAOA,MAAM,KAAK,SAAS;AACtC,CAAC;AAEM,MAAMC,sBAAsB,CAA0B;EAMzDC,WAAWA,CAACC,KAAoC,EAAE;IAC9C,IAAI,CAACA,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,UAAU,GAAG,IAAAC,kCAAgB,EAACF,KAAK,CAAC;IACzC,IAAI,CAACG,EAAE,GAAG,IAAIC,WAAE,CAAC;MAAEC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAACC;IAAW,CAAC,CAAC;IACpD,IAAI,CAACC,MAAM,GAAGC,MAAM,CAACJ,OAAO,CAACC,GAAG,CAACI,SAAS,CAAC;EAC/C;EAEAC,KAAKA,CAAA,EAAG;IACJ,OAAO,YAAY;EACvB;EAEAC,cAAcA,CAAA,EAAG;IACb,OAAO,uDAAuD;EAClE;EAEA,M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;QAE/B;QACA,MAAMJ,OAAO,CAAC0B,gBAAgB,CAACzB,eAAe,CAAC;;QAE/C;QACA,OAAO,IAAI;MACf;IACJ,CAAC,CAAC;EACN;EAEQP,YAAYA,CAChBJ,QAAgB,EAChBC,UAAkB,EAClBoC,OAAkC,GAAG,CAAC,CAAC,EACzC;IACE,OAAO;MACHC,MAAM,EAAE,IAAI,CAACvD,UAAU;MACvBwD,YAAY,EAAG,KAAIvC,QAAS,MAAKC,UAAW,qBAAoB;MAChEoC,OAAO,EAAE;QACLG,KAAK,EAAE,MAAM;QACbxB,EAAE,EAAE,GAAG;QACP,GAAGqB;MACP;IACJ,CAAC;EACL;AACJ;AAACI,OAAA,CAAA7D,sBAAA,GAAAA,sBAAA;AAED,IAAA8D,mBAAc,EAAC9D,sBAAsB,EAAE,CAAC,IAAA+D,WAAM,EAACC,uCAAwB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./FileManager_5_39_0_002";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _FileManager_5_39_0_ = require("./FileManager_5_39_0_002");
|
|
7
|
+
Object.keys(_FileManager_5_39_0_).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _FileManager_5_39_0_[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _FileManager_5_39_0_[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_FileManager_5_39_0_","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["export * from \"./FileManager_5_39_0_002\";\n"],"mappings":";;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,oBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,oBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,oBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Client } from "@elastic/elasticsearch";
|
|
2
|
+
import { DataMigration, DataMigrationContext } from "@webiny/data-migration";
|
|
3
|
+
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
4
|
+
export declare class FileManager_5_39_0_002 implements DataMigration {
|
|
5
|
+
private readonly elasticsearchClient;
|
|
6
|
+
private readonly bucket;
|
|
7
|
+
private readonly s3;
|
|
8
|
+
private readonly table;
|
|
9
|
+
constructor(table: Table<string, string, string>, elasticsearchClient: Client);
|
|
10
|
+
getId(): string;
|
|
11
|
+
getDescription(): string;
|
|
12
|
+
private getIndexParams;
|
|
13
|
+
shouldExecute({ logger }: DataMigrationContext): Promise<boolean>;
|
|
14
|
+
execute({ logger, ...context }: DataMigrationContext): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FileManager_5_39_0_002 = void 0;
|
|
7
|
+
var _ioc = require("@webiny/ioc");
|
|
8
|
+
var _utils = require("@webiny/utils");
|
|
9
|
+
var _dataMigration = require("@webiny/data-migration");
|
|
10
|
+
var _clientS = require("@webiny/aws-sdk/client-s3");
|
|
11
|
+
var _utils2 = require("../../../../utils");
|
|
12
|
+
var _FileMetadata = require("../utils/FileMetadata");
|
|
13
|
+
const isGroupMigrationCompleted = status => {
|
|
14
|
+
return typeof status === "boolean";
|
|
15
|
+
};
|
|
16
|
+
class FileManager_5_39_0_002 {
|
|
17
|
+
constructor(table, elasticsearchClient) {
|
|
18
|
+
this.table = table;
|
|
19
|
+
this.elasticsearchClient = elasticsearchClient;
|
|
20
|
+
this.s3 = new _clientS.S3({
|
|
21
|
+
region: process.env.AWS_REGION
|
|
22
|
+
});
|
|
23
|
+
this.bucket = String(process.env.S3_BUCKET);
|
|
24
|
+
}
|
|
25
|
+
getId() {
|
|
26
|
+
return "5.39.0-002";
|
|
27
|
+
}
|
|
28
|
+
getDescription() {
|
|
29
|
+
return "Generate a metadata file for every File Manager file.";
|
|
30
|
+
}
|
|
31
|
+
getIndexParams(tenantId, localeCode) {
|
|
32
|
+
return {
|
|
33
|
+
tenant: tenantId,
|
|
34
|
+
locale: localeCode,
|
|
35
|
+
type: "fmFile",
|
|
36
|
+
isHeadlessCmsModel: true
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
async shouldExecute({
|
|
40
|
+
logger
|
|
41
|
+
}) {
|
|
42
|
+
let shouldExecute = false;
|
|
43
|
+
await (0, _utils2.forEachTenantLocale)({
|
|
44
|
+
table: this.table,
|
|
45
|
+
logger,
|
|
46
|
+
callback: async ({
|
|
47
|
+
tenantId,
|
|
48
|
+
localeCode
|
|
49
|
+
}) => {
|
|
50
|
+
const indexExists = await (0, _utils2.esGetIndexExist)({
|
|
51
|
+
elasticsearchClient: this.elasticsearchClient,
|
|
52
|
+
...this.getIndexParams(tenantId, localeCode)
|
|
53
|
+
});
|
|
54
|
+
if (!indexExists) {
|
|
55
|
+
logger.info(`No elasticsearch index found for File Manager in tenant "${tenantId}" and locale "${localeCode}".`);
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Fetch the latest file record from ES
|
|
60
|
+
const fmIndexName = (0, _utils2.esGetIndexName)(this.getIndexParams(tenantId, localeCode));
|
|
61
|
+
const latestFile = await (0, _utils2.esFindOne)({
|
|
62
|
+
elasticsearchClient: this.elasticsearchClient,
|
|
63
|
+
index: fmIndexName,
|
|
64
|
+
body: {
|
|
65
|
+
query: {
|
|
66
|
+
bool: {
|
|
67
|
+
filter: [{
|
|
68
|
+
term: {
|
|
69
|
+
"tenant.keyword": tenantId
|
|
70
|
+
}
|
|
71
|
+
}, {
|
|
72
|
+
term: {
|
|
73
|
+
"locale.keyword": localeCode
|
|
74
|
+
}
|
|
75
|
+
}]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
sort: [{
|
|
79
|
+
"id.keyword": {
|
|
80
|
+
order: "desc",
|
|
81
|
+
unmapped_type: "keyword"
|
|
82
|
+
}
|
|
83
|
+
}]
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
if (!latestFile) {
|
|
87
|
+
logger.info(`No files found in tenant "${tenantId}" and locale "${localeCode}".`);
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
const fileMetadata = new _FileMetadata.FileMetadata(this.s3, this.bucket, latestFile);
|
|
91
|
+
const hasMetadata = await fileMetadata.exists();
|
|
92
|
+
if (!hasMetadata) {
|
|
93
|
+
shouldExecute = true;
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Continue to the next tenant/locale.
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
return shouldExecute;
|
|
102
|
+
}
|
|
103
|
+
async execute({
|
|
104
|
+
logger,
|
|
105
|
+
...context
|
|
106
|
+
}) {
|
|
107
|
+
const migrationStatus = context.checkpoint || {};
|
|
108
|
+
await (0, _utils2.forEachTenantLocale)({
|
|
109
|
+
table: this.table,
|
|
110
|
+
logger,
|
|
111
|
+
callback: async ({
|
|
112
|
+
tenantId,
|
|
113
|
+
localeCode
|
|
114
|
+
}) => {
|
|
115
|
+
const groupId = `${tenantId}:${localeCode}`;
|
|
116
|
+
const status = migrationStatus[groupId];
|
|
117
|
+
if (isGroupMigrationCompleted(status)) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
const esIndexName = (0, _utils2.esGetIndexName)(this.getIndexParams(tenantId, localeCode));
|
|
121
|
+
let batch = 0;
|
|
122
|
+
await (0, _utils2.esQueryAllWithCallback)({
|
|
123
|
+
elasticsearchClient: this.elasticsearchClient,
|
|
124
|
+
index: esIndexName,
|
|
125
|
+
body: {
|
|
126
|
+
query: {
|
|
127
|
+
bool: {
|
|
128
|
+
filter: [{
|
|
129
|
+
term: {
|
|
130
|
+
"tenant.keyword": tenantId
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
term: {
|
|
134
|
+
"locale.keyword": localeCode
|
|
135
|
+
}
|
|
136
|
+
}]
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
size: 10000,
|
|
140
|
+
sort: [{
|
|
141
|
+
"id.keyword": {
|
|
142
|
+
order: "asc",
|
|
143
|
+
unmapped_type: "keyword"
|
|
144
|
+
}
|
|
145
|
+
}],
|
|
146
|
+
search_after: status
|
|
147
|
+
},
|
|
148
|
+
callback: async (files, cursor) => {
|
|
149
|
+
batch++;
|
|
150
|
+
logger.info(`Processing batch #${batch} in group ${groupId} (${files.length} files).`);
|
|
151
|
+
const writers = files.map(file => {
|
|
152
|
+
const fileMetadata = new _FileMetadata.FileMetadata(this.s3, this.bucket, file);
|
|
153
|
+
const writeMetadata = () => fileMetadata.create();
|
|
154
|
+
return (0, _utils.executeWithRetry)(writeMetadata, {
|
|
155
|
+
onFailedAttempt: error => {
|
|
156
|
+
logger.error(`"batchWriteAll" attempt #${error.attemptNumber} failed.`);
|
|
157
|
+
logger.error(error.message);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
await Promise.all(writers);
|
|
162
|
+
|
|
163
|
+
// Update checkpoint after every batch
|
|
164
|
+
migrationStatus[groupId] = cursor;
|
|
165
|
+
|
|
166
|
+
// Check if we should store checkpoint and exit.
|
|
167
|
+
if (context.runningOutOfTime()) {
|
|
168
|
+
await context.createCheckpointAndExit(migrationStatus);
|
|
169
|
+
} else {
|
|
170
|
+
await context.createCheckpoint(migrationStatus);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// Mark group as completed.
|
|
176
|
+
migrationStatus[groupId] = true;
|
|
177
|
+
|
|
178
|
+
// Store checkpoint.
|
|
179
|
+
await context.createCheckpoint(migrationStatus);
|
|
180
|
+
|
|
181
|
+
// Continue processing.
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
exports.FileManager_5_39_0_002 = FileManager_5_39_0_002;
|
|
188
|
+
(0, _ioc.makeInjectable)(FileManager_5_39_0_002, [(0, _ioc.inject)(_dataMigration.PrimaryDynamoTableSymbol), (0, _ioc.inject)(_dataMigration.ElasticsearchClientSymbol)]);
|
|
189
|
+
|
|
190
|
+
//# sourceMappingURL=FileManager_5_39_0_002.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ioc","require","_utils","_dataMigration","_clientS","_utils2","_FileMetadata","isGroupMigrationCompleted","status","FileManager_5_39_0_002","constructor","table","elasticsearchClient","s3","S3","region","process","env","AWS_REGION","bucket","String","S3_BUCKET","getId","getDescription","getIndexParams","tenantId","localeCode","tenant","locale","type","isHeadlessCmsModel","shouldExecute","logger","forEachTenantLocale","callback","indexExists","esGetIndexExist","info","fmIndexName","esGetIndexName","latestFile","esFindOne","index","body","query","bool","filter","term","sort","order","unmapped_type","fileMetadata","FileMetadata","hasMetadata","exists","execute","context","migrationStatus","checkpoint","groupId","esIndexName","batch","esQueryAllWithCallback","size","search_after","files","cursor","length","writers","map","file","writeMetadata","create","executeWithRetry","onFailedAttempt","error","attemptNumber","message","Promise","all","runningOutOfTime","createCheckpointAndExit","createCheckpoint","exports","makeInjectable","inject","PrimaryDynamoTableSymbol","ElasticsearchClientSymbol"],"sources":["FileManager_5_39_0_002.ts"],"sourcesContent":["import { Client } from \"@elastic/elasticsearch\";\nimport { inject, makeInjectable } from \"@webiny/ioc\";\nimport { executeWithRetry } from \"@webiny/utils\";\nimport { PrimitiveValue } from \"@webiny/api-elasticsearch/types\";\nimport {\n DataMigration,\n DataMigrationContext,\n ElasticsearchClientSymbol,\n PrimaryDynamoTableSymbol\n} from \"@webiny/data-migration\";\nimport { S3 } from \"@webiny/aws-sdk/client-s3\";\nimport { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport {\n esQueryAllWithCallback,\n forEachTenantLocale,\n esFindOne,\n esGetIndexExist,\n esGetIndexName\n} from \"~/utils\";\nimport { FileEntry } from \"../utils/createFileEntity\";\nimport { FileMetadata } from \"../utils/FileMetadata\";\n\nconst isGroupMigrationCompleted = (\n status: PrimitiveValue[] | boolean | undefined\n): status is boolean => {\n return typeof status === \"boolean\";\n};\n\nexport class FileManager_5_39_0_002 implements DataMigration {\n private readonly elasticsearchClient: Client;\n private readonly bucket: string;\n private readonly s3: S3;\n private readonly table: Table<string, string, string>;\n\n constructor(table: Table<string, string, string>, elasticsearchClient: Client) {\n this.table = table;\n this.elasticsearchClient = elasticsearchClient;\n this.s3 = new S3({ region: process.env.AWS_REGION });\n this.bucket = String(process.env.S3_BUCKET);\n }\n\n getId() {\n return \"5.39.0-002\";\n }\n\n getDescription() {\n return \"Generate a metadata file for every File Manager file.\";\n }\n\n private getIndexParams(tenantId: string, localeCode: string) {\n return {\n tenant: tenantId,\n locale: localeCode,\n type: \"fmFile\",\n isHeadlessCmsModel: true\n };\n }\n\n async shouldExecute({ logger }: DataMigrationContext): Promise<boolean> {\n let shouldExecute = false;\n\n await forEachTenantLocale({\n table: this.table,\n logger,\n callback: async ({ tenantId, localeCode }) => {\n const indexExists = await esGetIndexExist({\n elasticsearchClient: this.elasticsearchClient,\n ...this.getIndexParams(tenantId, localeCode)\n });\n\n if (!indexExists) {\n logger.info(\n `No elasticsearch index found for File Manager in tenant \"${tenantId}\" and locale \"${localeCode}\".`\n );\n return true;\n }\n\n // Fetch the latest file record from ES\n const fmIndexName = esGetIndexName(this.getIndexParams(tenantId, localeCode));\n\n const latestFile = await esFindOne<FileEntry>({\n elasticsearchClient: this.elasticsearchClient,\n index: fmIndexName,\n body: {\n query: {\n bool: {\n filter: [\n { term: { \"tenant.keyword\": tenantId } },\n { term: { \"locale.keyword\": localeCode } }\n ]\n }\n },\n sort: [\n {\n \"id.keyword\": { order: \"desc\", unmapped_type: \"keyword\" }\n }\n ]\n }\n });\n\n if (!latestFile) {\n logger.info(\n `No files found in tenant \"${tenantId}\" and locale \"${localeCode}\".`\n );\n return true;\n }\n\n const fileMetadata = new FileMetadata(this.s3, this.bucket, latestFile);\n const hasMetadata = await fileMetadata.exists();\n\n if (!hasMetadata) {\n shouldExecute = true;\n return false;\n }\n\n // Continue to the next tenant/locale.\n return true;\n }\n });\n\n return shouldExecute;\n }\n\n async execute({ logger, ...context }: DataMigrationContext): Promise<void> {\n const migrationStatus = context.checkpoint || {};\n\n await forEachTenantLocale({\n table: this.table,\n logger,\n callback: async ({ tenantId, localeCode }) => {\n const groupId = `${tenantId}:${localeCode}`;\n const status = migrationStatus[groupId];\n\n if (isGroupMigrationCompleted(status)) {\n return true;\n }\n\n const esIndexName = esGetIndexName(this.getIndexParams(tenantId, localeCode));\n\n let batch = 0;\n await esQueryAllWithCallback<FileEntry>({\n elasticsearchClient: this.elasticsearchClient,\n index: esIndexName,\n body: {\n query: {\n bool: {\n filter: [\n { term: { \"tenant.keyword\": tenantId } },\n { term: { \"locale.keyword\": localeCode } }\n ]\n }\n },\n size: 10000,\n sort: [\n {\n \"id.keyword\": { order: \"asc\", unmapped_type: \"keyword\" }\n }\n ],\n search_after: status\n },\n callback: async (files, cursor) => {\n batch++;\n\n logger.info(\n `Processing batch #${batch} in group ${groupId} (${files.length} files).`\n );\n\n const writers = files.map(file => {\n const fileMetadata = new FileMetadata(this.s3, this.bucket, file);\n const writeMetadata = () => fileMetadata.create();\n\n return executeWithRetry(writeMetadata, {\n onFailedAttempt: error => {\n logger.error(\n `\"batchWriteAll\" attempt #${error.attemptNumber} failed.`\n );\n logger.error(error.message);\n }\n });\n });\n\n await Promise.all(writers);\n\n // Update checkpoint after every batch\n migrationStatus[groupId] = cursor;\n\n // Check if we should store checkpoint and exit.\n if (context.runningOutOfTime()) {\n await context.createCheckpointAndExit(migrationStatus);\n } else {\n await context.createCheckpoint(migrationStatus);\n }\n }\n });\n\n // Mark group as completed.\n migrationStatus[groupId] = true;\n\n // Store checkpoint.\n await context.createCheckpoint(migrationStatus);\n\n // Continue processing.\n return true;\n }\n });\n }\n}\n\nmakeInjectable(FileManager_5_39_0_002, [\n inject(PrimaryDynamoTableSymbol),\n inject(ElasticsearchClientSymbol)\n]);\n"],"mappings":";;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AAQA,IAAAK,aAAA,GAAAL,OAAA;AAEA,MAAMM,yBAAyB,GAC3BC,MAA8C,IAC1B;EACpB,OAAO,OAAOA,MAAM,KAAK,SAAS;AACtC,CAAC;AAEM,MAAMC,sBAAsB,CAA0B;EAMzDC,WAAWA,CAACC,KAAoC,EAAEC,mBAA2B,EAAE;IAC3E,IAAI,CAACD,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,mBAAmB,GAAGA,mBAAmB;IAC9C,IAAI,CAACC,EAAE,GAAG,IAAIC,WAAE,CAAC;MAAEC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAACC;IAAW,CAAC,CAAC;IACpD,IAAI,CAACC,MAAM,GAAGC,MAAM,CAACJ,OAAO,CAACC,GAAG,CAACI,SA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,CAAC;YAEF,MAAMC,OAAO,CAACC,GAAG,CAACX,OAAO,CAAC;;YAE1B;YACAX,eAAe,CAACE,OAAO,CAAC,GAAGO,MAAM;;YAEjC;YACA,IAAIV,OAAO,CAACwB,gBAAgB,CAAC,CAAC,EAAE;cAC5B,MAAMxB,OAAO,CAACyB,uBAAuB,CAACxB,eAAe,CAAC;YAC1D,CAAC,MAAM;cACH,MAAMD,OAAO,CAAC0B,gBAAgB,CAACzB,eAAe,CAAC;YACnD;UACJ;QACJ,CAAC,CAAC;;QAEF;QACAA,eAAe,CAACE,OAAO,CAAC,GAAG,IAAI;;QAE/B;QACA,MAAMH,OAAO,CAAC0B,gBAAgB,CAACzB,eAAe,CAAC;;QAE/C;QACA,OAAO,IAAI;MACf;IACJ,CAAC,CAAC;EACN;AACJ;AAAC0B,OAAA,CAAA1E,sBAAA,GAAAA,sBAAA;AAED,IAAA2E,mBAAc,EAAC3E,sBAAsB,EAAE,CACnC,IAAA4E,WAAM,EAACC,uCAAwB,CAAC,EAChC,IAAAD,WAAM,EAACE,wCAAyB,CAAC,CACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./FileManager_5_39_0_002";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _FileManager_5_39_0_ = require("./FileManager_5_39_0_002");
|
|
7
|
+
Object.keys(_FileManager_5_39_0_).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _FileManager_5_39_0_[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _FileManager_5_39_0_[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_FileManager_5_39_0_","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["export * from \"./FileManager_5_39_0_002\";\n"],"mappings":";;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,oBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,oBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,oBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { S3 } from "@webiny/aws-sdk/client-s3";
|
|
2
|
+
import { FileEntry } from "./createFileEntity";
|
|
3
|
+
export declare class FileMetadata {
|
|
4
|
+
private s3;
|
|
5
|
+
private fileEntry;
|
|
6
|
+
private readonly bucket;
|
|
7
|
+
private readonly metadataKey;
|
|
8
|
+
private attempt;
|
|
9
|
+
constructor(s3: S3, bucket: string, fileEntry: FileEntry);
|
|
10
|
+
create(): Promise<void>;
|
|
11
|
+
exists(): Promise<boolean>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FileMetadata = void 0;
|
|
7
|
+
class FileMetadata {
|
|
8
|
+
attempt = 0;
|
|
9
|
+
constructor(s3, bucket, fileEntry) {
|
|
10
|
+
this.bucket = bucket;
|
|
11
|
+
this.s3 = s3;
|
|
12
|
+
this.fileEntry = fileEntry;
|
|
13
|
+
const fileKey = fileEntry.values["text@key"];
|
|
14
|
+
this.metadataKey = `${fileKey}.metadata`;
|
|
15
|
+
}
|
|
16
|
+
async create() {
|
|
17
|
+
const metadata = {
|
|
18
|
+
id: this.fileEntry.entryId,
|
|
19
|
+
tenant: this.fileEntry.tenant,
|
|
20
|
+
locale: this.fileEntry.locale,
|
|
21
|
+
size: this.fileEntry.values["number@size"],
|
|
22
|
+
contentType: this.fileEntry.values["text@type"]
|
|
23
|
+
};
|
|
24
|
+
try {
|
|
25
|
+
this.attempt++;
|
|
26
|
+
console.log(`Attempt #${this.attempt}: create metadata file at ${this.metadataKey}`);
|
|
27
|
+
await this.s3.putObject({
|
|
28
|
+
Bucket: this.bucket,
|
|
29
|
+
Key: this.metadataKey,
|
|
30
|
+
Body: JSON.stringify(metadata, null, 2)
|
|
31
|
+
});
|
|
32
|
+
console.log(`Attempt #${this.attempt} succeeded! Created ${this.metadataKey}`);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.log(`ERROR #${this.attempt} for ${this.metadataKey}`, JSON.stringify(error, null, 2));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async exists() {
|
|
38
|
+
try {
|
|
39
|
+
await this.s3.headObject({
|
|
40
|
+
Bucket: this.bucket,
|
|
41
|
+
Key: this.metadataKey
|
|
42
|
+
});
|
|
43
|
+
return true;
|
|
44
|
+
} catch (error) {
|
|
45
|
+
if (error.name === "NotFound") {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
console.log("ERROR: couldn't check for metadata", JSON.stringify(error, null, 2));
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.FileMetadata = FileMetadata;
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=FileMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FileMetadata","attempt","constructor","s3","bucket","fileEntry","fileKey","values","metadataKey","create","metadata","id","entryId","tenant","locale","size","contentType","console","log","putObject","Bucket","Key","Body","JSON","stringify","error","exists","headObject","name","exports"],"sources":["FileMetadata.ts"],"sourcesContent":["import { S3 } from \"@webiny/aws-sdk/client-s3\";\nimport { FileEntry } from \"./createFileEntity\";\n\nexport class FileMetadata {\n private s3: S3;\n private fileEntry: FileEntry;\n private readonly bucket: string;\n private readonly metadataKey: string;\n private attempt = 0;\n\n constructor(s3: S3, bucket: string, fileEntry: FileEntry) {\n this.bucket = bucket;\n this.s3 = s3;\n this.fileEntry = fileEntry;\n\n const fileKey = fileEntry.values[\"text@key\"];\n this.metadataKey = `${fileKey}.metadata`;\n }\n\n async create() {\n const metadata = {\n id: this.fileEntry.entryId,\n tenant: this.fileEntry.tenant,\n locale: this.fileEntry.locale,\n size: this.fileEntry.values[\"number@size\"],\n contentType: this.fileEntry.values[\"text@type\"]\n };\n\n try {\n this.attempt++;\n console.log(`Attempt #${this.attempt}: create metadata file at ${this.metadataKey}`);\n await this.s3.putObject({\n Bucket: this.bucket,\n Key: this.metadataKey,\n Body: JSON.stringify(metadata, null, 2)\n });\n console.log(`Attempt #${this.attempt} succeeded! Created ${this.metadataKey}`);\n } catch (error) {\n console.log(\n `ERROR #${this.attempt} for ${this.metadataKey}`,\n JSON.stringify(error, null, 2)\n );\n }\n }\n\n async exists() {\n try {\n await this.s3.headObject({ Bucket: this.bucket, Key: this.metadataKey });\n return true;\n } catch (error) {\n if (error.name === \"NotFound\") {\n return false;\n }\n\n console.log(\"ERROR: couldn't check for metadata\", JSON.stringify(error, null, 2));\n\n return false;\n }\n }\n}\n"],"mappings":";;;;;;AAGO,MAAMA,YAAY,CAAC;EAKdC,OAAO,GAAG,CAAC;EAEnBC,WAAWA,CAACC,EAAM,EAAEC,MAAc,EAAEC,SAAoB,EAAE;IACtD,IAAI,CAACD,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACD,EAAE,GAAGA,EAAE;IACZ,IAAI,CAACE,SAAS,GAAGA,SAAS;IAE1B,MAAMC,OAAO,GAAGD,SA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