@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,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MultiStepForms_5_38_0_001 = void 0;
|
|
7
|
+
var _dataMigration = require("@webiny/data-migration");
|
|
8
|
+
var _createFormEntity = require("../entities/createFormEntity");
|
|
9
|
+
var _utils = require("../../../../utils");
|
|
10
|
+
var _ioc = require("@webiny/ioc");
|
|
11
|
+
var _utils2 = require("@webiny/utils");
|
|
12
|
+
class MultiStepForms_5_38_0_001 {
|
|
13
|
+
constructor(table, elasticsearchClient) {
|
|
14
|
+
this.table = table;
|
|
15
|
+
this.formEntity = (0, _createFormEntity.createFormEntity)(table);
|
|
16
|
+
this.elasticsearchClient = elasticsearchClient;
|
|
17
|
+
}
|
|
18
|
+
getId() {
|
|
19
|
+
return "5.38.0-001";
|
|
20
|
+
}
|
|
21
|
+
getDescription() {
|
|
22
|
+
return "Convert forms to multi-step forms.";
|
|
23
|
+
}
|
|
24
|
+
async shouldExecute({
|
|
25
|
+
logger
|
|
26
|
+
}) {
|
|
27
|
+
let shouldExecute = false;
|
|
28
|
+
await (0, _utils.forEachTenantLocale)({
|
|
29
|
+
table: this.table,
|
|
30
|
+
logger,
|
|
31
|
+
callback: async ({
|
|
32
|
+
tenantId,
|
|
33
|
+
localeCode
|
|
34
|
+
}) => {
|
|
35
|
+
const indexNameParams = {
|
|
36
|
+
tenant: tenantId,
|
|
37
|
+
locale: localeCode,
|
|
38
|
+
type: "form-builder",
|
|
39
|
+
isHeadlessCmsModel: false
|
|
40
|
+
};
|
|
41
|
+
const indexExists = await (0, _utils.esGetIndexExist)({
|
|
42
|
+
elasticsearchClient: this.elasticsearchClient,
|
|
43
|
+
...indexNameParams
|
|
44
|
+
});
|
|
45
|
+
if (!indexExists) {
|
|
46
|
+
logger.info(`No Elasticsearch index found for folders in tenant "${tenantId}" and locale "${localeCode}"; skipping.`);
|
|
47
|
+
|
|
48
|
+
// Continue with next locale.
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
const esRecords = await (0, _utils.esQueryAll)({
|
|
52
|
+
elasticsearchClient: this.elasticsearchClient,
|
|
53
|
+
index: (0, _utils.esGetIndexName)(indexNameParams),
|
|
54
|
+
body: {
|
|
55
|
+
query: {
|
|
56
|
+
bool: {
|
|
57
|
+
filter: [{
|
|
58
|
+
term: {
|
|
59
|
+
"__type.keyword": "fb.form"
|
|
60
|
+
}
|
|
61
|
+
}]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
size: 10000
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
if (!esRecords.length) {
|
|
68
|
+
// Continue with next locale.
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
const formIds = esRecords.map(item => item.formId).filter(Boolean);
|
|
72
|
+
const uniqueFormIds = [...new Set(formIds)];
|
|
73
|
+
const batchGetItems = [];
|
|
74
|
+
for (const formId of uniqueFormIds) {
|
|
75
|
+
batchGetItems.push(this.formEntity.getBatch({
|
|
76
|
+
PK: `T#${tenantId}#L#${localeCode}#FB#F#${formId}`,
|
|
77
|
+
SK: "L"
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Get DynamoDB records for all the forms retrieved from Elasticsearch.
|
|
82
|
+
const ddbRecords = await (0, _utils.batchReadAll)({
|
|
83
|
+
table: this.formEntity.table,
|
|
84
|
+
items: batchGetItems
|
|
85
|
+
});
|
|
86
|
+
for (const ddbRecord of ddbRecords) {
|
|
87
|
+
if (!ddbRecord.steps) {
|
|
88
|
+
shouldExecute = true;
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
return shouldExecute;
|
|
96
|
+
}
|
|
97
|
+
async execute({
|
|
98
|
+
logger
|
|
99
|
+
}) {
|
|
100
|
+
await (0, _utils.forEachTenantLocale)({
|
|
101
|
+
table: this.table,
|
|
102
|
+
logger,
|
|
103
|
+
callback: async ({
|
|
104
|
+
tenantId,
|
|
105
|
+
localeCode
|
|
106
|
+
}) => {
|
|
107
|
+
const indexNameParams = {
|
|
108
|
+
tenant: tenantId,
|
|
109
|
+
locale: localeCode,
|
|
110
|
+
type: "form-builder",
|
|
111
|
+
isHeadlessCmsModel: false
|
|
112
|
+
};
|
|
113
|
+
const indexExists = await (0, _utils.esGetIndexExist)({
|
|
114
|
+
elasticsearchClient: this.elasticsearchClient,
|
|
115
|
+
...indexNameParams
|
|
116
|
+
});
|
|
117
|
+
if (!indexExists) {
|
|
118
|
+
// Continue with next locale.
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
const esRecords = await (0, _utils.esQueryAll)({
|
|
122
|
+
elasticsearchClient: this.elasticsearchClient,
|
|
123
|
+
index: (0, _utils.esGetIndexName)(indexNameParams),
|
|
124
|
+
body: {
|
|
125
|
+
query: {
|
|
126
|
+
bool: {
|
|
127
|
+
filter: [{
|
|
128
|
+
term: {
|
|
129
|
+
"__type.keyword": "fb.form"
|
|
130
|
+
}
|
|
131
|
+
}]
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
size: 10000
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
if (!esRecords.length) {
|
|
138
|
+
// Continue with next locale.
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
const formIds = esRecords.map(item => item.formId).filter(Boolean);
|
|
142
|
+
const uniqueFormIds = [...new Set(formIds)];
|
|
143
|
+
|
|
144
|
+
// For each form record, let's ensure the "steps" property is defined.
|
|
145
|
+
for (const formId of uniqueFormIds) {
|
|
146
|
+
const ddbRecords = await Promise.all([(0, _utils.queryAll)({
|
|
147
|
+
entity: this.formEntity,
|
|
148
|
+
partitionKey: `T#${tenantId}#L#${localeCode}#FB#F#${formId}`,
|
|
149
|
+
options: {
|
|
150
|
+
eq: "L"
|
|
151
|
+
}
|
|
152
|
+
}), (0, _utils.queryAll)({
|
|
153
|
+
entity: this.formEntity,
|
|
154
|
+
partitionKey: `T#${tenantId}#L#${localeCode}#FB#F#${formId}`,
|
|
155
|
+
options: {
|
|
156
|
+
eq: "LP"
|
|
157
|
+
}
|
|
158
|
+
}), (0, _utils.queryAll)({
|
|
159
|
+
entity: this.formEntity,
|
|
160
|
+
partitionKey: `T#${tenantId}#L#${localeCode}#FB#F#${formId}`,
|
|
161
|
+
options: {
|
|
162
|
+
beginsWith: "REV#"
|
|
163
|
+
}
|
|
164
|
+
})]).then(response => response.flat());
|
|
165
|
+
const items = [];
|
|
166
|
+
for (const ddbRecord of ddbRecords) {
|
|
167
|
+
if (ddbRecord.steps) {
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// If no steps are defined, we need to create a single step.
|
|
172
|
+
ddbRecord.steps = [];
|
|
173
|
+
if (Array.isArray(ddbRecord.layout)) {
|
|
174
|
+
// If layout is an array, we need to create a single step with all the fields.
|
|
175
|
+
ddbRecord.steps.push({
|
|
176
|
+
title: "Step 1",
|
|
177
|
+
layout: ddbRecord.layout
|
|
178
|
+
});
|
|
179
|
+
delete ddbRecord.layout;
|
|
180
|
+
}
|
|
181
|
+
items.push(this.formEntity.putBatch(ddbRecord));
|
|
182
|
+
}
|
|
183
|
+
if (!items.length) {
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
const execute = () => {
|
|
187
|
+
return (0, _utils.batchWriteAll)({
|
|
188
|
+
table: this.formEntity.table,
|
|
189
|
+
items
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
logger.trace("Storing the DynamoDB records...");
|
|
193
|
+
await (0, _utils2.executeWithRetry)(execute, {
|
|
194
|
+
onFailedAttempt: error => {
|
|
195
|
+
logger.error(`"batchWriteAll" attempt #${error.attemptNumber} failed.`);
|
|
196
|
+
logger.error(error.message);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Continue with next locale.
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
logger.info("Updated all the forms.");
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
exports.MultiStepForms_5_38_0_001 = MultiStepForms_5_38_0_001;
|
|
209
|
+
(0, _ioc.makeInjectable)(MultiStepForms_5_38_0_001, [(0, _ioc.inject)(_dataMigration.PrimaryDynamoTableSymbol), (0, _ioc.inject)(_dataMigration.ElasticsearchClientSymbol)]);
|
|
210
|
+
|
|
211
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dataMigration","require","_createFormEntity","_utils","_ioc","_utils2","MultiStepForms_5_38_0_001","constructor","table","elasticsearchClient","formEntity","createFormEntity","getId","getDescription","shouldExecute","logger","forEachTenantLocale","callback","tenantId","localeCode","indexNameParams","tenant","locale","type","isHeadlessCmsModel","indexExists","esGetIndexExist","info","esRecords","esQueryAll","index","esGetIndexName","body","query","bool","filter","term","size","length","formIds","map","item","formId","Boolean","uniqueFormIds","Set","batchGetItems","push","getBatch","PK","SK","ddbRecords","batchReadAll","items","ddbRecord","steps","execute","Promise","all","queryAll","entity","partitionKey","options","eq","beginsWith","then","response","flat","Array","isArray","layout","title","putBatch","batchWriteAll","trace","executeWithRetry","onFailedAttempt","error","attemptNumber","message","exports","makeInjectable","inject","PrimaryDynamoTableSymbol","ElasticsearchClientSymbol"],"sources":["index.ts"],"sourcesContent":["import { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport {\n DataMigration,\n DataMigrationContext,\n ElasticsearchClientSymbol,\n PrimaryDynamoTableSymbol\n} from \"@webiny/data-migration\";\nimport { createFormEntity } from \"../entities/createFormEntity\";\nimport {\n batchReadAll,\n BatchReadItem,\n batchWriteAll,\n BatchWriteItem,\n esGetIndexExist,\n esGetIndexName,\n esQueryAll,\n forEachTenantLocale,\n queryAll\n} from \"~/utils\";\nimport { FbForm } from \"../types\";\nimport { inject, makeInjectable } from \"@webiny/ioc\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport { executeWithRetry } from \"@webiny/utils\";\n\nexport class MultiStepForms_5_38_0_001 implements DataMigration {\n private readonly table: Table<string, string, string>;\n private readonly formEntity: ReturnType<typeof createFormEntity>;\n private readonly elasticsearchClient: Client;\n\n constructor(table: Table<string, string, string>, elasticsearchClient: Client) {\n this.table = table;\n this.formEntity = createFormEntity(table);\n this.elasticsearchClient = elasticsearchClient;\n }\n\n getId() {\n return \"5.38.0-001\";\n }\n\n getDescription() {\n return \"Convert forms to multi-step forms.\";\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 indexNameParams = {\n tenant: tenantId,\n locale: localeCode,\n type: \"form-builder\",\n isHeadlessCmsModel: false\n };\n\n const indexExists = await esGetIndexExist({\n elasticsearchClient: this.elasticsearchClient,\n ...indexNameParams\n });\n\n if (!indexExists) {\n logger.info(\n `No Elasticsearch index found for folders in tenant \"${tenantId}\" and locale \"${localeCode}\"; skipping.`\n );\n\n // Continue with next locale.\n return true;\n }\n\n const esRecords = await esQueryAll<FbForm>({\n elasticsearchClient: this.elasticsearchClient,\n index: esGetIndexName(indexNameParams),\n body: {\n query: {\n bool: {\n filter: [{ term: { \"__type.keyword\": \"fb.form\" } }]\n }\n },\n size: 10000\n }\n });\n\n if (!esRecords.length) {\n // Continue with next locale.\n return true;\n }\n\n const formIds = esRecords.map(item => item.formId).filter(Boolean);\n const uniqueFormIds = [...new Set(formIds)];\n\n const batchGetItems: BatchReadItem[] = [];\n for (const formId of uniqueFormIds) {\n batchGetItems.push(\n this.formEntity.getBatch({\n PK: `T#${tenantId}#L#${localeCode}#FB#F#${formId}`,\n SK: \"L\"\n })\n );\n }\n\n // Get DynamoDB records for all the forms retrieved from Elasticsearch.\n const ddbRecords = await batchReadAll<FbForm>({\n table: this.formEntity.table,\n items: batchGetItems\n });\n\n for (const ddbRecord of ddbRecords) {\n if (!ddbRecord.steps) {\n shouldExecute = true;\n return false;\n }\n }\n\n return true;\n }\n });\n\n return shouldExecute;\n }\n\n async execute({ logger }: DataMigrationContext): Promise<void> {\n await forEachTenantLocale({\n table: this.table,\n logger,\n callback: async ({ tenantId, localeCode }) => {\n const indexNameParams = {\n tenant: tenantId,\n locale: localeCode,\n type: \"form-builder\",\n isHeadlessCmsModel: false\n };\n\n const indexExists = await esGetIndexExist({\n elasticsearchClient: this.elasticsearchClient,\n ...indexNameParams\n });\n\n if (!indexExists) {\n // Continue with next locale.\n return true;\n }\n\n const esRecords = await esQueryAll<FbForm>({\n elasticsearchClient: this.elasticsearchClient,\n index: esGetIndexName(indexNameParams),\n body: {\n query: {\n bool: {\n filter: [{ term: { \"__type.keyword\": \"fb.form\" } }]\n }\n },\n size: 10000\n }\n });\n\n if (!esRecords.length) {\n // Continue with next locale.\n return true;\n }\n\n const formIds = esRecords.map(item => item.formId).filter(Boolean);\n const uniqueFormIds = [...new Set(formIds)];\n\n // For each form record, let's ensure the \"steps\" property is defined.\n for (const formId of uniqueFormIds) {\n const ddbRecords = await Promise.all([\n queryAll<FbForm>({\n entity: this.formEntity,\n partitionKey: `T#${tenantId}#L#${localeCode}#FB#F#${formId}`,\n options: {\n eq: \"L\"\n }\n }),\n queryAll<FbForm>({\n entity: this.formEntity,\n partitionKey: `T#${tenantId}#L#${localeCode}#FB#F#${formId}`,\n options: {\n eq: \"LP\"\n }\n }),\n queryAll<FbForm>({\n entity: this.formEntity,\n partitionKey: `T#${tenantId}#L#${localeCode}#FB#F#${formId}`,\n options: {\n beginsWith: \"REV#\"\n }\n })\n ]).then(response => response.flat());\n\n const items: BatchWriteItem[] = [];\n for (const ddbRecord of ddbRecords) {\n if (ddbRecord.steps) {\n continue;\n }\n\n // If no steps are defined, we need to create a single step.\n ddbRecord.steps = [];\n\n if (Array.isArray(ddbRecord.layout)) {\n // If layout is an array, we need to create a single step with all the fields.\n ddbRecord.steps.push({ title: \"Step 1\", layout: ddbRecord.layout });\n delete ddbRecord.layout;\n }\n\n items.push(this.formEntity.putBatch(ddbRecord));\n }\n\n if (!items.length) {\n continue;\n }\n\n const execute = () => {\n return batchWriteAll({ table: this.formEntity.table, items });\n };\n\n logger.trace(\"Storing the DynamoDB records...\");\n await executeWithRetry(execute, {\n onFailedAttempt: error => {\n logger.error(`\"batchWriteAll\" attempt #${error.attemptNumber} failed.`);\n logger.error(error.message);\n }\n });\n }\n\n // Continue with next locale.\n return true;\n }\n });\n\n logger.info(\"Updated all the forms.\");\n }\n}\n\nmakeInjectable(MultiStepForms_5_38_0_001, [\n inject(PrimaryDynamoTableSymbol),\n inject(ElasticsearchClientSymbol)\n]);\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAMA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAYA,IAAAG,IAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AAEO,MAAMK,yBAAyB,CAA0B;EAK5DC,WAAWA,CAACC,KAAoC,EAAEC,mBAA2B,EAAE;IAC3E,IAAI,CAACD,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACE,UAAU,GAAG,IAAAC,kCAAgB,EAACH,KAAK,CAAC;IACzC,IAAI,CAACC,mBAAmB,GAAGA,mBAA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AC;QACN;;QAEA;QACA,OAAO,IAAI;MACf;IACJ,CAAC,CAAC;IAEFhE,MAAM,CAACY,IAAI,CAAC,wBAAwB,CAAC;EACzC;AACJ;AAACqD,OAAA,CAAA1E,yBAAA,GAAAA,yBAAA;AAED,IAAA2E,mBAAc,EAAC3E,yBAAyB,EAAE,CACtC,IAAA4E,WAAM,EAACC,uCAAwB,CAAC,EAChC,IAAAD,WAAM,EAACE,wCAAyB,CAAC,CACpC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
export declare const createFormEntity: (table: Table<string, string, string>) => import("dynamodb-toolbox/dist/cjs/classes/Entity/Entity").default<string, import("dynamodb-toolbox/dist/cjs/classes/Entity").Overlay, import("dynamodb-toolbox/dist/cjs/classes/Entity").Overlay, Table<string, string, string>, true, true, boolean, string, string, string, boolean, {
|
|
3
|
+
PK: {
|
|
4
|
+
partitionKey: true;
|
|
5
|
+
};
|
|
6
|
+
SK: {
|
|
7
|
+
sortKey: true;
|
|
8
|
+
};
|
|
9
|
+
GSI1_PK: {
|
|
10
|
+
type: "string";
|
|
11
|
+
};
|
|
12
|
+
GSI1_SK: {
|
|
13
|
+
type: "string";
|
|
14
|
+
};
|
|
15
|
+
TYPE: {
|
|
16
|
+
type: "string";
|
|
17
|
+
};
|
|
18
|
+
}, {
|
|
19
|
+
PK: {
|
|
20
|
+
partitionKey: true;
|
|
21
|
+
};
|
|
22
|
+
SK: {
|
|
23
|
+
sortKey: true;
|
|
24
|
+
};
|
|
25
|
+
GSI1_PK: {
|
|
26
|
+
type: "string";
|
|
27
|
+
};
|
|
28
|
+
GSI1_SK: {
|
|
29
|
+
type: "string";
|
|
30
|
+
};
|
|
31
|
+
TYPE: {
|
|
32
|
+
type: "string";
|
|
33
|
+
};
|
|
34
|
+
}, import("dynamodb-toolbox/dist/cjs/classes/Entity").ParsedAttributes<import("ts-toolbelt/out/Any/Key").Key>, any, {
|
|
35
|
+
[x: string]: any;
|
|
36
|
+
[x: number]: any;
|
|
37
|
+
[x: symbol]: any;
|
|
38
|
+
}, {
|
|
39
|
+
[x: string]: any;
|
|
40
|
+
[x: number]: any;
|
|
41
|
+
[x: symbol]: any;
|
|
42
|
+
}>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createFormEntity = void 0;
|
|
7
|
+
var _utils = require("../../../../utils");
|
|
8
|
+
const createFormEntity = table => {
|
|
9
|
+
return (0, _utils.createLegacyEntity)(table, "FormBuilderForm", {
|
|
10
|
+
PK: {
|
|
11
|
+
partitionKey: true
|
|
12
|
+
},
|
|
13
|
+
SK: {
|
|
14
|
+
sortKey: true
|
|
15
|
+
},
|
|
16
|
+
GSI1_PK: {
|
|
17
|
+
type: "string"
|
|
18
|
+
},
|
|
19
|
+
GSI1_SK: {
|
|
20
|
+
type: "string"
|
|
21
|
+
},
|
|
22
|
+
TYPE: {
|
|
23
|
+
type: "string"
|
|
24
|
+
},
|
|
25
|
+
id: {
|
|
26
|
+
type: "string"
|
|
27
|
+
},
|
|
28
|
+
formId: {
|
|
29
|
+
type: "string"
|
|
30
|
+
},
|
|
31
|
+
tenant: {
|
|
32
|
+
type: "string"
|
|
33
|
+
},
|
|
34
|
+
locale: {
|
|
35
|
+
type: "string"
|
|
36
|
+
},
|
|
37
|
+
createdBy: {
|
|
38
|
+
type: "map"
|
|
39
|
+
},
|
|
40
|
+
ownedBy: {
|
|
41
|
+
type: "map"
|
|
42
|
+
},
|
|
43
|
+
savedOn: {
|
|
44
|
+
type: "string"
|
|
45
|
+
},
|
|
46
|
+
createdOn: {
|
|
47
|
+
type: "string"
|
|
48
|
+
},
|
|
49
|
+
name: {
|
|
50
|
+
type: "string"
|
|
51
|
+
},
|
|
52
|
+
slug: {
|
|
53
|
+
type: "string"
|
|
54
|
+
},
|
|
55
|
+
version: {
|
|
56
|
+
type: "number"
|
|
57
|
+
},
|
|
58
|
+
locked: {
|
|
59
|
+
type: "boolean"
|
|
60
|
+
},
|
|
61
|
+
published: {
|
|
62
|
+
type: "boolean"
|
|
63
|
+
},
|
|
64
|
+
publishedOn: {
|
|
65
|
+
type: "string"
|
|
66
|
+
},
|
|
67
|
+
status: {
|
|
68
|
+
type: "string"
|
|
69
|
+
},
|
|
70
|
+
fields: {
|
|
71
|
+
type: "list"
|
|
72
|
+
},
|
|
73
|
+
steps: {
|
|
74
|
+
type: "list"
|
|
75
|
+
},
|
|
76
|
+
stats: {
|
|
77
|
+
type: "map"
|
|
78
|
+
},
|
|
79
|
+
settings: {
|
|
80
|
+
type: "map"
|
|
81
|
+
},
|
|
82
|
+
triggers: {
|
|
83
|
+
type: "map"
|
|
84
|
+
},
|
|
85
|
+
webinyVersion: {
|
|
86
|
+
type: "string"
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
exports.createFormEntity = createFormEntity;
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=createFormEntity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_utils","require","createFormEntity","table","createLegacyEntity","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","TYPE","id","formId","tenant","locale","createdBy","ownedBy","savedOn","createdOn","name","slug","version","locked","published","publishedOn","status","fields","steps","stats","settings","triggers","webinyVersion","exports"],"sources":["createFormEntity.ts"],"sourcesContent":["import { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { createLegacyEntity } from \"~/utils\";\n\nexport const createFormEntity = (table: Table<string, string, string>) => {\n return createLegacyEntity(table, \"FormBuilderForm\", {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n formId: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n ownedBy: {\n type: \"map\"\n },\n savedOn: {\n type: \"string\"\n },\n createdOn: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n slug: {\n type: \"string\"\n },\n version: {\n type: \"number\"\n },\n locked: {\n type: \"boolean\"\n },\n published: {\n type: \"boolean\"\n },\n publishedOn: {\n type: \"string\"\n },\n status: {\n type: \"string\"\n },\n fields: {\n type: \"list\"\n },\n steps: {\n type: \"list\"\n },\n stats: {\n type: \"map\"\n },\n settings: {\n type: \"map\"\n },\n triggers: {\n type: \"map\"\n },\n webinyVersion: {\n type: \"string\"\n }\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEO,MAAMC,gBAAgB,GAAIC,KAAoC,IAAK;EACtE,OAAO,IAAAC,yBAAkB,EAACD,KAAK,EAAE,iBAAiB,EAAE;IAChDE,EAAE,EAAE;MACAC,YAAY,EAAE;IAClB,CAAC;IACDC,EAAE,EAAE;MACAC,OAAO,EAAE;IACb,CAAC;IACDC,OAAO,EAAE;MACLC,IAAI,EAAE;IACV,CAAC;IACDC,OAAO,EAAE;MACLD,IAAI,EAAE;IACV,CAAC;IACDE,IAAI,EAAE;MACFF,IAAI,EAAE;IACV,CAAC;IACDG,EAAE,EAAE;MACAH,IAAI,EAAE;IACV,CAAC;IACDI,MAAM,EAAE;MACJJ,IAAI,EAAE;IACV,CAAC;IACDK,MAAM,EAAE;MACJL,IAAI,EAAE;IACV,CAAC;IACDM,MAAM,EAAE;MACJN,IAAI,EAAE;IACV,CAAC;IACDO,SAAS,EAAE;MACPP,IAAI,EAAE;IACV,CAAC;IACDQ,OAAO,EAAE;MACLR,IAAI,EAAE;IACV,CAAC;IACDS,OAAO,EAAE;MACLT,IAAI,EAAE;IACV,CAAC;IACDU,SAAS,EAAE;MACPV,IAAI,EAAE;IACV,CAAC;IACDW,IAAI,EAAE;MACFX,IAAI,EAAE;IACV,CAAC;IACDY,IAAI,EAAE;MACFZ,IAAI,EAAE;IACV,CAAC;IACDa,OAAO,EAAE;MACLb,IAAI,EAAE;IACV,CAAC;IACDc,MAAM,EAAE;MACJd,IAAI,EAAE;IACV,CAAC;IACDe,SAAS,EAAE;MACPf,IAAI,EAAE;IACV,CAAC;IACDgB,WAAW,EAAE;MACThB,IAAI,EAAE;IACV,CAAC;IACDiB,MAAM,EAAE;MACJjB,IAAI,EAAE;IACV,CAAC;IACDkB,MAAM,EAAE;MACJlB,IAAI,EAAE;IACV,CAAC;IACDmB,KAAK,EAAE;MACHnB,IAAI,EAAE;IACV,CAAC;IACDoB,KAAK,EAAE;MACHpB,IAAI,EAAE;IACV,CAAC;IACDqB,QAAQ,EAAE;MACNrB,IAAI,EAAE;IACV,CAAC;IACDsB,QAAQ,EAAE;MACNtB,IAAI,EAAE;IACV,CAAC;IACDuB,aAAa,EAAE;MACXvB,IAAI,EAAE;IACV;EACJ,CAAC,CAAC;AACN,CAAC;AAACwB,OAAA,CAAAhC,gBAAA,GAAAA,gBAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export type FbFormLayout = Array<Array<string>>;\n\nexport interface FbForm {\n id: string;\n formId: string;\n steps?: Array<{ title: string; layout: FbFormLayout }>;\n layout?: FbFormLayout;\n TYPE?: string;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
import { DataMigration, DataMigrationContext } from "@webiny/data-migration";
|
|
3
|
+
interface LastEvaluatedKey {
|
|
4
|
+
PK: string;
|
|
5
|
+
SK: string;
|
|
6
|
+
GSI1_PK: string;
|
|
7
|
+
GSI1_SK: string;
|
|
8
|
+
}
|
|
9
|
+
interface FolderSubmissionsDataMigrationCheckpoint {
|
|
10
|
+
lastEvaluatedKey?: LastEvaluatedKey | boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare class MultiStepForms_5_38_0_002 implements DataMigration {
|
|
13
|
+
private readonly formEntity;
|
|
14
|
+
private readonly formSubmissionEntity;
|
|
15
|
+
private readonly table;
|
|
16
|
+
constructor(table: Table<string, string, string>);
|
|
17
|
+
getId(): string;
|
|
18
|
+
getDescription(): string;
|
|
19
|
+
shouldExecute({ logger }: DataMigrationContext): Promise<boolean>;
|
|
20
|
+
execute({ logger, ...context }: DataMigrationContext<FolderSubmissionsDataMigrationCheckpoint>): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MultiStepForms_5_38_0_002 = void 0;
|
|
7
|
+
var _dataMigration = require("@webiny/data-migration");
|
|
8
|
+
var _createFormEntity = require("../entities/createFormEntity");
|
|
9
|
+
var _createFormSubmissionEntity = require("../entities/createFormSubmissionEntity");
|
|
10
|
+
var _utils = require("../../../../utils");
|
|
11
|
+
var _ioc = require("@webiny/ioc");
|
|
12
|
+
var _utils2 = require("@webiny/utils");
|
|
13
|
+
class MultiStepForms_5_38_0_002 {
|
|
14
|
+
constructor(table) {
|
|
15
|
+
this.table = table;
|
|
16
|
+
this.formEntity = (0, _createFormEntity.createFormEntity)(table);
|
|
17
|
+
this.formSubmissionEntity = (0, _createFormSubmissionEntity.createFormSubmissionEntity)(table);
|
|
18
|
+
}
|
|
19
|
+
getId() {
|
|
20
|
+
return "5.38.0-002";
|
|
21
|
+
}
|
|
22
|
+
getDescription() {
|
|
23
|
+
return "Convert forms to multi-step forms (form submissions).";
|
|
24
|
+
}
|
|
25
|
+
async shouldExecute({
|
|
26
|
+
logger
|
|
27
|
+
}) {
|
|
28
|
+
let shouldExecute = false;
|
|
29
|
+
await (0, _utils.forEachTenantLocale)({
|
|
30
|
+
table: this.table,
|
|
31
|
+
logger,
|
|
32
|
+
callback: async ({
|
|
33
|
+
tenantId,
|
|
34
|
+
localeCode
|
|
35
|
+
}) => {
|
|
36
|
+
const latestFormRecords = await (0, _utils.queryAll)({
|
|
37
|
+
entity: this.formEntity,
|
|
38
|
+
partitionKey: `T#${tenantId}#L#${localeCode}#FB#F#L`
|
|
39
|
+
});
|
|
40
|
+
const formIds = latestFormRecords.map(item => item.formId).filter(Boolean);
|
|
41
|
+
const uniqueFormIds = [...new Set(formIds)];
|
|
42
|
+
for (const formId of uniqueFormIds) {
|
|
43
|
+
// Get a form submission. If the "steps" property
|
|
44
|
+
// is not defined, we need to execute the migration.
|
|
45
|
+
const formSubmission = await (0, _utils.queryOne)({
|
|
46
|
+
entity: this.formSubmissionEntity,
|
|
47
|
+
partitionKey: `T#${tenantId}#L#${localeCode}#FB#FS#${formId}`
|
|
48
|
+
});
|
|
49
|
+
if (!formSubmission) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (!formSubmission.form.steps) {
|
|
53
|
+
shouldExecute = true;
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Continue to the next locale.
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return shouldExecute;
|
|
63
|
+
}
|
|
64
|
+
async execute({
|
|
65
|
+
logger,
|
|
66
|
+
...context
|
|
67
|
+
}) {
|
|
68
|
+
const migrationStatus = context.checkpoint || {};
|
|
69
|
+
if (migrationStatus.lastEvaluatedKey === true) {
|
|
70
|
+
logger.info(`Migration completed, no need to start again.`);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
let usingKey = "";
|
|
74
|
+
if (migrationStatus?.lastEvaluatedKey) {
|
|
75
|
+
usingKey = JSON.stringify(migrationStatus.lastEvaluatedKey);
|
|
76
|
+
}
|
|
77
|
+
logger.debug(`Scanning DynamoDB table... ${usingKey}`);
|
|
78
|
+
await (0, _utils.ddbScanWithCallback)({
|
|
79
|
+
entity: this.formSubmissionEntity,
|
|
80
|
+
options: {
|
|
81
|
+
filters: [{
|
|
82
|
+
attr: "TYPE",
|
|
83
|
+
eq: "fb.formSubmission"
|
|
84
|
+
}],
|
|
85
|
+
startKey: migrationStatus.lastEvaluatedKey || undefined,
|
|
86
|
+
limit: 1000
|
|
87
|
+
}
|
|
88
|
+
}, async result => {
|
|
89
|
+
logger.debug(`Processing ${result.items.length} items...`);
|
|
90
|
+
const items = [];
|
|
91
|
+
for (const item of result.items) {
|
|
92
|
+
if (item.form.steps) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// If no steps are defined, we need to create a single step.
|
|
97
|
+
item.form.steps = [];
|
|
98
|
+
if (Array.isArray(item.form.layout)) {
|
|
99
|
+
// If layout is an array, we need to create a single step with all the fields.
|
|
100
|
+
item.form.steps = [{
|
|
101
|
+
title: "Step 1",
|
|
102
|
+
layout: item.form.layout
|
|
103
|
+
}];
|
|
104
|
+
delete item.form.layout;
|
|
105
|
+
}
|
|
106
|
+
items.push(this.formSubmissionEntity.putBatch(item));
|
|
107
|
+
}
|
|
108
|
+
const execute = () => {
|
|
109
|
+
return (0, _utils.batchWriteAll)({
|
|
110
|
+
table: this.formSubmissionEntity.table,
|
|
111
|
+
items
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
logger.trace("Storing the DynamoDB records...");
|
|
115
|
+
await (0, _utils2.executeWithRetry)(execute, {
|
|
116
|
+
onFailedAttempt: error => {
|
|
117
|
+
logger.error(`"batchWriteAll" attempt #${error.attemptNumber} failed.`);
|
|
118
|
+
logger.error(error.message);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
logger.trace("...stored.");
|
|
122
|
+
|
|
123
|
+
// Update checkpoint after every batch
|
|
124
|
+
migrationStatus.lastEvaluatedKey = result.lastEvaluatedKey?.PK ? result.lastEvaluatedKey : true;
|
|
125
|
+
|
|
126
|
+
// Check if we should store checkpoint and exit.
|
|
127
|
+
if (context.runningOutOfTime()) {
|
|
128
|
+
await context.createCheckpointAndExit(migrationStatus);
|
|
129
|
+
} else {
|
|
130
|
+
await context.createCheckpoint(migrationStatus);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
migrationStatus.lastEvaluatedKey = true;
|
|
134
|
+
context.createCheckpoint(migrationStatus);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.MultiStepForms_5_38_0_002 = MultiStepForms_5_38_0_002;
|
|
138
|
+
(0, _ioc.makeInjectable)(MultiStepForms_5_38_0_002, [(0, _ioc.inject)(_dataMigration.PrimaryDynamoTableSymbol)]);
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dataMigration","require","_createFormEntity","_createFormSubmissionEntity","_utils","_ioc","_utils2","MultiStepForms_5_38_0_002","constructor","table","formEntity","createFormEntity","formSubmissionEntity","createFormSubmissionEntity","getId","getDescription","shouldExecute","logger","forEachTenantLocale","callback","tenantId","localeCode","latestFormRecords","queryAll","entity","partitionKey","formIds","map","item","formId","filter","Boolean","uniqueFormIds","Set","formSubmission","queryOne","form","steps","execute","context","migrationStatus","checkpoint","lastEvaluatedKey","info","usingKey","JSON","stringify","debug","ddbScanWithCallback","options","filters","attr","eq","startKey","undefined","limit","result","items","length","Array","isArray","layout","title","push","putBatch","batchWriteAll","trace","executeWithRetry","onFailedAttempt","error","attemptNumber","message","PK","runningOutOfTime","createCheckpointAndExit","createCheckpoint","exports","makeInjectable","inject","PrimaryDynamoTableSymbol"],"sources":["index.ts"],"sourcesContent":["import { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport {\n DataMigration,\n DataMigrationContext,\n PrimaryDynamoTableSymbol\n} from \"@webiny/data-migration\";\nimport { createFormEntity } from \"../entities/createFormEntity\";\nimport { createFormSubmissionEntity } from \"../entities/createFormSubmissionEntity\";\nimport {\n batchWriteAll,\n BatchWriteItem,\n ddbScanWithCallback,\n forEachTenantLocale,\n queryAll,\n queryOne\n} from \"~/utils\";\nimport { FbForm, FbFormSubmission } from \"../types\";\nimport { inject, makeInjectable } from \"@webiny/ioc\";\nimport { executeWithRetry } from \"@webiny/utils\";\n\ninterface LastEvaluatedKey {\n PK: string;\n SK: string;\n GSI1_PK: string;\n GSI1_SK: string;\n}\n\ninterface FolderSubmissionsDataMigrationCheckpoint {\n lastEvaluatedKey?: LastEvaluatedKey | boolean;\n}\n\nexport class MultiStepForms_5_38_0_002 implements DataMigration {\n private readonly formEntity: ReturnType<typeof createFormEntity>;\n private readonly formSubmissionEntity: ReturnType<typeof createFormSubmissionEntity>;\n private readonly table: Table<string, string, string>;\n\n constructor(table: Table<string, string, string>) {\n this.table = table;\n this.formEntity = createFormEntity(table);\n this.formSubmissionEntity = createFormSubmissionEntity(table);\n }\n\n getId() {\n return \"5.38.0-002\";\n }\n\n getDescription() {\n return \"Convert forms to multi-step forms (form submissions).\";\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 latestFormRecords = await queryAll<FbForm>({\n entity: this.formEntity,\n partitionKey: `T#${tenantId}#L#${localeCode}#FB#F#L`\n });\n\n const formIds = latestFormRecords.map(item => item.formId).filter(Boolean);\n const uniqueFormIds = [...new Set(formIds)];\n\n for (const formId of uniqueFormIds) {\n // Get a form submission. If the \"steps\" property\n // is not defined, we need to execute the migration.\n const formSubmission = await queryOne<FbFormSubmission>({\n entity: this.formSubmissionEntity,\n partitionKey: `T#${tenantId}#L#${localeCode}#FB#FS#${formId}`\n });\n\n if (!formSubmission) {\n continue;\n }\n\n if (!formSubmission.form.steps) {\n shouldExecute = true;\n return false;\n }\n }\n\n // Continue to the next locale.\n return true;\n }\n });\n\n return shouldExecute;\n }\n\n async execute({\n logger,\n ...context\n }: DataMigrationContext<FolderSubmissionsDataMigrationCheckpoint>): Promise<void> {\n const migrationStatus = context.checkpoint || {};\n\n if (migrationStatus.lastEvaluatedKey === true) {\n logger.info(`Migration completed, no need to start again.`);\n return;\n }\n\n let usingKey = \"\";\n if (migrationStatus?.lastEvaluatedKey) {\n usingKey = JSON.stringify(migrationStatus.lastEvaluatedKey);\n }\n\n logger.debug(`Scanning DynamoDB table... ${usingKey}`);\n await ddbScanWithCallback<FbFormSubmission>(\n {\n entity: this.formSubmissionEntity,\n options: {\n filters: [\n {\n attr: \"TYPE\",\n eq: \"fb.formSubmission\"\n }\n ],\n startKey: migrationStatus.lastEvaluatedKey || undefined,\n limit: 1000\n }\n },\n async result => {\n logger.debug(`Processing ${result.items.length} items...`);\n const items: BatchWriteItem[] = [];\n for (const item of result.items) {\n if (item.form.steps) {\n continue;\n }\n\n // If no steps are defined, we need to create a single step.\n item.form.steps = [];\n\n if (Array.isArray(item.form.layout)) {\n // If layout is an array, we need to create a single step with all the fields.\n item.form.steps = [{ title: \"Step 1\", layout: item.form.layout }];\n delete item.form.layout;\n }\n\n items.push(this.formSubmissionEntity.putBatch(item));\n }\n\n const execute = () => {\n return batchWriteAll({ table: this.formSubmissionEntity.table, items });\n };\n\n logger.trace(\"Storing the DynamoDB records...\");\n await executeWithRetry(execute, {\n onFailedAttempt: error => {\n logger.error(`\"batchWriteAll\" attempt #${error.attemptNumber} failed.`);\n logger.error(error.message);\n }\n });\n logger.trace(\"...stored.\");\n\n // Update checkpoint after every batch\n migrationStatus.lastEvaluatedKey = result.lastEvaluatedKey?.PK\n ? (result.lastEvaluatedKey as unknown as LastEvaluatedKey)\n : true;\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 migrationStatus.lastEvaluatedKey = true;\n context.createCheckpoint(migrationStatus);\n }\n}\n\nmakeInjectable(MultiStepForms_5_38_0_002, [inject(PrimaryDynamoTableSymbol)]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gBAAgB,CAAC,CAAC,EAAE;QAC5B,MAAMlC,OAAO,CAACmC,uBAAuB,CAAClC,eAAe,CAAC;MAC1D,CAAC,MAAM;QACH,MAAMD,OAAO,CAACoC,gBAAgB,CAACnC,eAAe,CAAC;MACnD;IACJ,CACJ,CAAC;IAEDA,eAAe,CAACE,gBAAgB,GAAG,IAAI;IACvCH,OAAO,CAACoC,gBAAgB,CAACnC,eAAe,CAAC;EAC7C;AACJ;AAACoC,OAAA,CAAArE,yBAAA,GAAAA,yBAAA;AAED,IAAAsE,mBAAc,EAACtE,yBAAyB,EAAE,CAAC,IAAAuE,WAAM,EAACC,uCAAwB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
import { DataMigration, DataMigrationContext } from "@webiny/data-migration";
|
|
3
|
+
import { Client } from "@elastic/elasticsearch";
|
|
4
|
+
interface LastEvaluatedKey {
|
|
5
|
+
PK: string;
|
|
6
|
+
SK: string;
|
|
7
|
+
GSI1_PK: string;
|
|
8
|
+
GSI1_SK: string;
|
|
9
|
+
}
|
|
10
|
+
interface IndexSettings {
|
|
11
|
+
number_of_replicas: number;
|
|
12
|
+
refresh_interval: `${number}s`;
|
|
13
|
+
}
|
|
14
|
+
interface FormSubmissionsDataMigrationCheckpoint {
|
|
15
|
+
lastEvaluatedKey?: LastEvaluatedKey | boolean;
|
|
16
|
+
indexes: {
|
|
17
|
+
[index: string]: IndexSettings | null;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare class MultiStepForms_5_38_0_002 implements DataMigration {
|
|
21
|
+
private readonly table;
|
|
22
|
+
private readonly esTable;
|
|
23
|
+
private readonly formSubmissionEntity;
|
|
24
|
+
private readonly formSubmissionDdbEsEntity;
|
|
25
|
+
private readonly elasticsearchClient;
|
|
26
|
+
constructor(table: Table<string, string, string>, esTable: Table<string, string, string>, elasticsearchClient: Client);
|
|
27
|
+
getId(): string;
|
|
28
|
+
getDescription(): string;
|
|
29
|
+
shouldExecute({ logger }: DataMigrationContext): Promise<boolean>;
|
|
30
|
+
execute({ logger, ...context }: DataMigrationContext<FormSubmissionsDataMigrationCheckpoint>): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
export {};
|