@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":["_dataMigration","require","_utils","_createTenantEntity","_createSettingsEntity","_createLocaleEntity","_ioc","_dbDynamodb","PageBuilder_5_35_0_002","constructor","table","newSettingsEntity","createSettingsEntity","legacySettingsEntity","createLegacySettingsEntity","tenantEntity","createTenantEntity","localeEntity","createLocaleEntity","getId","getDescription","shouldExecute","logger","defaultLocale","queryOne","entity","partitionKey","options","eq","info","settings","code","newSettings","execute","tenants","queryAll","index","gt","tenant","locales","id","locale","name","put","item","PK","SK","TYPE","data","getSettingsData","exports","makeInjectable","inject","PrimaryDynamoTableSymbol"],"sources":["index.ts"],"sourcesContent":["import { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { DataMigrationContext, PrimaryDynamoTableSymbol } from \"@webiny/data-migration\";\nimport { queryAll, queryOne } from \"~/utils\";\nimport { createTenantEntity } from \"./createTenantEntity\";\nimport {\n createLegacySettingsEntity,\n createSettingsEntity,\n getSettingsData\n} from \"./createSettingsEntity\";\nimport { createLocaleEntity } from \"./createLocaleEntity\";\nimport { inject, makeInjectable } from \"@webiny/ioc\";\nimport { put } from \"@webiny/db-dynamodb\";\n\nexport class PageBuilder_5_35_0_002 {\n private readonly newSettingsEntity: ReturnType<typeof createSettingsEntity>;\n private readonly legacySettingsEntity: ReturnType<typeof createLegacySettingsEntity>;\n private readonly tenantEntity: ReturnType<typeof createTenantEntity>;\n private readonly localeEntity: ReturnType<typeof createLocaleEntity>;\n\n constructor(table: Table<string, string, string>) {\n this.newSettingsEntity = createSettingsEntity(table);\n this.legacySettingsEntity = createLegacySettingsEntity(table);\n this.tenantEntity = createTenantEntity(table);\n this.localeEntity = createLocaleEntity(table);\n }\n\n getId() {\n return \"5.35.0-002\";\n }\n\n getDescription() {\n return \"Move PB Settings attributes to a `data` envelope.\";\n }\n\n async shouldExecute({ logger }: DataMigrationContext): Promise<boolean> {\n const defaultLocale = await queryOne<{ code: string }>({\n entity: this.localeEntity,\n partitionKey: `T#root#I18N#L#D`,\n options: {\n eq: \"default\"\n }\n });\n\n if (!defaultLocale) {\n logger.info(`Default locale not found; system is not yet installed.`);\n return false;\n }\n\n const settings = await queryOne({\n entity: this.legacySettingsEntity,\n partitionKey: `T#root#L#${defaultLocale.code}#PB#SETTINGS`,\n options: {\n eq: \"default\"\n }\n });\n\n if (!settings) {\n logger.info(`Settings not found; system is not yet installed.`);\n return false;\n }\n\n const newSettings = await queryOne({\n entity: this.newSettingsEntity,\n partitionKey: `T#root#L#${defaultLocale.code}#PB#SETTINGS`,\n options: {\n eq: \"A\"\n }\n });\n\n if (newSettings) {\n logger.info(`Settings record seems to be in order.`);\n return false;\n }\n\n return true;\n }\n\n async execute({ logger }: DataMigrationContext): Promise<void> {\n const tenants = await queryAll<{ id: string; name: string }>({\n entity: this.tenantEntity,\n partitionKey: \"TENANTS\",\n options: {\n index: \"GSI1\",\n gt: \" \"\n }\n });\n\n for (const tenant of tenants) {\n const locales = await queryAll<{ code: string }>({\n entity: this.localeEntity,\n partitionKey: `T#${tenant.id}#I18N#L`,\n options: {\n gt: \" \"\n }\n });\n\n for (const locale of locales) {\n const settings = await queryOne({\n entity: this.legacySettingsEntity,\n partitionKey: `T#${tenant.id}#L#${locale.code}#PB#SETTINGS`,\n options: {\n eq: \"default\"\n }\n });\n\n if (!settings) {\n // It's possible that a tenant exists, but it was not yet installed.\n logger.info(\n `Tenant ${tenant.name} (${tenant.id}) is not installed. Skipping migration of settings.`\n );\n continue;\n }\n\n logger.info(`Updating PB settings for tenant ${tenant.name} (${tenant.id}).`);\n await put({\n entity: this.newSettingsEntity,\n item: {\n PK: `T#${tenant.id}#L#${locale.code}#PB#SETTINGS`,\n SK: \"A\",\n TYPE: \"pb.settings\",\n data: {\n ...getSettingsData(settings),\n tenant: tenant.id\n }\n }\n });\n }\n }\n }\n}\n\nmakeInjectable(PageBuilder_5_35_0_002, [inject(PrimaryDynamoTableSymbol)]);\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAKA,IAAAI,mBAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAEO,MAAMO,sBAAsB,CAAC;EAMhCC,WAAWA,CAACC,KAAoC,EAAE;IAC9C,IAAI,CAACC,iBAAiB,GAAG,IAAAC,0CAAoB,EAACF,KAAK,CAAC;IACpD,IAAI,CAACG,oBAAoB,GAAG,IAAAC,gDAA0B,EAACJ,KAAK,CAAC;IAC7D,IAAI,CAACK,YAAY,GAAG,IAAAC,sCAAkB,EAACN,KAAK,CAAC;IAC7C,IAAI,CAACO,YAAY,GAAG,IAAAC,sCAAkB,EAACR,KAAK,CAAC;EACjD;EAEAS,KAAKA,CAAA,EAAG;IACJ,OAAO,YAAY;EACvB;EAEAC,cAAcA,CAAA,EAAG;IACb,OAAO,mDAAmD;EAC9D;EAEA,MAAMC,aAAaA,CAAC;IAAEC;EAA6B,CAAC,EAAoB;IACpE,MAAMC,aAAa,GAAG,MAAM,IAAAC,eAAQ,EAAmB;MACnDC,MAAM,EAAE,IAAI,CAACR,YAAY;MACzBS,YAAY,EAAG,iBAAgB;MAC/BC,OAAO,EAAE;QACLC,EAAE,EAAE;MACR;IACJ,CAAC,CAAC;IAEF,IAAI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EF,KAAK,MAAMI,MAAM,IAAIF,OAAO,EAAE;QAC1B,MAAMT,QAAQ,GAAG,MAAM,IAAAN,eAAQ,EAAC;UAC5BC,MAAM,EAAE,IAAI,CAACZ,oBAAoB;UACjCa,YAAY,EAAG,KAAIY,MAAM,CAACE,EAAG,MAAKC,MAAM,CAACV,IAAK,cAAa;UAC3DJ,OAAO,EAAE;YACLC,EAAE,EAAE;UACR;QACJ,CAAC,CAAC;QAEF,IAAI,CAACE,QAAQ,EAAE;UACX;UACAR,MAAM,CAACO,IAAI,CACN,UAASS,MAAM,CAACI,IAAK,KAAIJ,MAAM,CAACE,EAAG,qDACxC,CAAC;UACD;QACJ;QAEAlB,MAAM,CAACO,IAAI,CAAE,mCAAkCS,MAAM,CAACI,IAAK,KAAIJ,MAAM,CAACE,EAAG,IAAG,CAAC;QAC7E,MAAM,IAAAG,eAAG,EAAC;UACNlB,MAAM,EAAE,IAAI,CAACd,iBAAiB;UAC9BiC,IAAI,EAAE;YACFC,EAAE,EAAG,KAAIP,MAAM,CAACE,EAAG,MAAKC,MAAM,CAACV,IAAK,cAAa;YACjDe,EAAE,EAAE,GAAG;YACPC,IAAI,EAAE,aAAa;YACnBC,IAAI,EAAE;cACF,GAAG,IAAAC,qCAAe,EAACnB,QAAQ,CAAC;cAC5BQ,MAAM,EAAEA,MAAM,CAACE;YACnB;UACJ;QACJ,CAAC,CAAC;MACN;IACJ;EACJ;AACJ;AAACU,OAAA,CAAA1C,sBAAA,GAAAA,sBAAA;AAED,IAAA2C,mBAAc,EAAC3C,sBAAsB,EAAE,CAAC,IAAA4C,WAAM,EAACC,uCAAwB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
export declare const createTenantEntity: (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,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createTenantEntity = void 0;
|
|
7
|
+
var _utils = require("../../../utils");
|
|
8
|
+
const createTenantEntity = table => {
|
|
9
|
+
return (0, _utils.createLegacyEntity)(table, "TenancyTenant", {
|
|
10
|
+
id: {
|
|
11
|
+
type: "string"
|
|
12
|
+
},
|
|
13
|
+
name: {
|
|
14
|
+
type: "string"
|
|
15
|
+
},
|
|
16
|
+
description: {
|
|
17
|
+
type: "string"
|
|
18
|
+
},
|
|
19
|
+
status: {
|
|
20
|
+
type: "string",
|
|
21
|
+
default: "active"
|
|
22
|
+
},
|
|
23
|
+
createdOn: {
|
|
24
|
+
type: "string"
|
|
25
|
+
},
|
|
26
|
+
savedOn: {
|
|
27
|
+
type: "string"
|
|
28
|
+
},
|
|
29
|
+
createdBy: {
|
|
30
|
+
type: "map"
|
|
31
|
+
},
|
|
32
|
+
parent: {
|
|
33
|
+
type: "string"
|
|
34
|
+
},
|
|
35
|
+
webinyVersion: {
|
|
36
|
+
type: "string"
|
|
37
|
+
},
|
|
38
|
+
settings: {
|
|
39
|
+
type: "map",
|
|
40
|
+
default: {}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
exports.createTenantEntity = createTenantEntity;
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=createTenantEntity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_utils","require","createTenantEntity","table","createLegacyEntity","id","type","name","description","status","default","createdOn","savedOn","createdBy","parent","webinyVersion","settings","exports"],"sources":["createTenantEntity.ts"],"sourcesContent":["import { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { createLegacyEntity } from \"~/utils\";\n\nexport const createTenantEntity = (table: Table<string, string, string>) => {\n return createLegacyEntity(table, \"TenancyTenant\", {\n id: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n description: {\n type: \"string\"\n },\n status: {\n type: \"string\",\n default: \"active\"\n },\n createdOn: {\n type: \"string\"\n },\n savedOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n parent: {\n type: \"string\"\n },\n webinyVersion: {\n type: \"string\"\n },\n settings: {\n type: \"map\",\n default: {}\n }\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEO,MAAMC,kBAAkB,GAAIC,KAAoC,IAAK;EACxE,OAAO,IAAAC,yBAAkB,EAACD,KAAK,EAAE,eAAe,EAAE;IAC9CE,EAAE,EAAE;MACAC,IAAI,EAAE;IACV,CAAC;IACDC,IAAI,EAAE;MACFD,IAAI,EAAE;IACV,CAAC;IACDE,WAAW,EAAE;MACTF,IAAI,EAAE;IACV,CAAC;IACDG,MAAM,EAAE;MACJH,IAAI,EAAE,QAAQ;MACdI,OAAO,EAAE;IACb,CAAC;IACDC,SAAS,EAAE;MACPL,IAAI,EAAE;IACV,CAAC;IACDM,OAAO,EAAE;MACLN,IAAI,EAAE;IACV,CAAC;IACDO,SAAS,EAAE;MACPP,IAAI,EAAE;IACV,CAAC;IACDQ,MAAM,EAAE;MACJR,IAAI,EAAE;IACV,CAAC;IACDS,aAAa,EAAE;MACXT,IAAI,EAAE;IACV,CAAC;IACDU,QAAQ,EAAE;MACNV,IAAI,EAAE,KAAK;MACXI,OAAO,EAAE,CAAC;IACd;EACJ,CAAC,CAAC;AACN,CAAC;AAACO,OAAA,CAAAf,kBAAA,GAAAA,kBAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
export declare const getUserData: (user: any) => Pick<any, string>;
|
|
3
|
+
export declare const createLegacyUserEntity: (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, {
|
|
4
|
+
PK: {
|
|
5
|
+
partitionKey: true;
|
|
6
|
+
};
|
|
7
|
+
SK: {
|
|
8
|
+
sortKey: true;
|
|
9
|
+
};
|
|
10
|
+
GSI1_PK: {
|
|
11
|
+
type: "string";
|
|
12
|
+
};
|
|
13
|
+
GSI1_SK: {
|
|
14
|
+
type: "string";
|
|
15
|
+
};
|
|
16
|
+
TYPE: {
|
|
17
|
+
type: "string";
|
|
18
|
+
};
|
|
19
|
+
}, {
|
|
20
|
+
PK: {
|
|
21
|
+
partitionKey: true;
|
|
22
|
+
};
|
|
23
|
+
SK: {
|
|
24
|
+
sortKey: true;
|
|
25
|
+
};
|
|
26
|
+
GSI1_PK: {
|
|
27
|
+
type: "string";
|
|
28
|
+
};
|
|
29
|
+
GSI1_SK: {
|
|
30
|
+
type: "string";
|
|
31
|
+
};
|
|
32
|
+
TYPE: {
|
|
33
|
+
type: "string";
|
|
34
|
+
};
|
|
35
|
+
}, import("dynamodb-toolbox/dist/cjs/classes/Entity").ParsedAttributes<import("ts-toolbelt/out/Any/Key").Key>, any, {
|
|
36
|
+
[x: string]: any;
|
|
37
|
+
[x: number]: any;
|
|
38
|
+
[x: symbol]: any;
|
|
39
|
+
}, {
|
|
40
|
+
[x: string]: any;
|
|
41
|
+
[x: number]: any;
|
|
42
|
+
[x: symbol]: any;
|
|
43
|
+
}>;
|
|
44
|
+
export declare const createUserEntity: (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, {
|
|
45
|
+
PK: {
|
|
46
|
+
partitionKey: true;
|
|
47
|
+
};
|
|
48
|
+
SK: {
|
|
49
|
+
sortKey: true;
|
|
50
|
+
};
|
|
51
|
+
GSI1_PK: {
|
|
52
|
+
type: "string";
|
|
53
|
+
};
|
|
54
|
+
GSI1_SK: {
|
|
55
|
+
type: "string";
|
|
56
|
+
};
|
|
57
|
+
TYPE: {
|
|
58
|
+
type: "string";
|
|
59
|
+
};
|
|
60
|
+
data: {
|
|
61
|
+
type: "map";
|
|
62
|
+
};
|
|
63
|
+
}, {
|
|
64
|
+
PK: {
|
|
65
|
+
partitionKey: true;
|
|
66
|
+
};
|
|
67
|
+
SK: {
|
|
68
|
+
sortKey: true;
|
|
69
|
+
};
|
|
70
|
+
GSI1_PK: {
|
|
71
|
+
type: "string";
|
|
72
|
+
};
|
|
73
|
+
GSI1_SK: {
|
|
74
|
+
type: "string";
|
|
75
|
+
};
|
|
76
|
+
TYPE: {
|
|
77
|
+
type: "string";
|
|
78
|
+
};
|
|
79
|
+
data: {
|
|
80
|
+
type: "map";
|
|
81
|
+
};
|
|
82
|
+
}, import("dynamodb-toolbox/dist/cjs/classes/Entity").ParsedAttributes<import("ts-toolbelt/out/Any/Key").Key>, any, {
|
|
83
|
+
[x: string]: any;
|
|
84
|
+
[x: number]: any;
|
|
85
|
+
[x: symbol]: any;
|
|
86
|
+
}, {
|
|
87
|
+
[x: string]: any;
|
|
88
|
+
[x: number]: any;
|
|
89
|
+
[x: symbol]: any;
|
|
90
|
+
}>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getUserData = exports.createUserEntity = exports.createLegacyUserEntity = void 0;
|
|
8
|
+
var _pick = _interopRequireDefault(require("lodash/pick"));
|
|
9
|
+
var _utils = require("../../../utils");
|
|
10
|
+
const attributes = {
|
|
11
|
+
id: {
|
|
12
|
+
type: "string"
|
|
13
|
+
},
|
|
14
|
+
tenant: {
|
|
15
|
+
type: "string"
|
|
16
|
+
},
|
|
17
|
+
email: {
|
|
18
|
+
type: "string"
|
|
19
|
+
},
|
|
20
|
+
firstName: {
|
|
21
|
+
type: "string"
|
|
22
|
+
},
|
|
23
|
+
lastName: {
|
|
24
|
+
type: "string"
|
|
25
|
+
},
|
|
26
|
+
avatar: {
|
|
27
|
+
type: "map"
|
|
28
|
+
},
|
|
29
|
+
createdBy: {
|
|
30
|
+
type: "map"
|
|
31
|
+
},
|
|
32
|
+
createdOn: {
|
|
33
|
+
type: "string"
|
|
34
|
+
},
|
|
35
|
+
group: {
|
|
36
|
+
type: "string"
|
|
37
|
+
},
|
|
38
|
+
webinyVersion: {
|
|
39
|
+
type: "string"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const getUserData = user => {
|
|
43
|
+
return (0, _pick.default)(user, Object.keys(attributes));
|
|
44
|
+
};
|
|
45
|
+
exports.getUserData = getUserData;
|
|
46
|
+
const createLegacyUserEntity = table => {
|
|
47
|
+
return (0, _utils.createLegacyEntity)(table, "AdminUsers.User", attributes);
|
|
48
|
+
};
|
|
49
|
+
exports.createLegacyUserEntity = createLegacyUserEntity;
|
|
50
|
+
const createUserEntity = table => {
|
|
51
|
+
return (0, _utils.createStandardEntity)(table, "AdminUsers.User", attributes);
|
|
52
|
+
};
|
|
53
|
+
exports.createUserEntity = createUserEntity;
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=createUserEntity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_pick","_interopRequireDefault","require","_utils","attributes","id","type","tenant","email","firstName","lastName","avatar","createdBy","createdOn","group","webinyVersion","getUserData","user","pick","Object","keys","exports","createLegacyUserEntity","table","createLegacyEntity","createUserEntity","createStandardEntity"],"sources":["createUserEntity.ts"],"sourcesContent":["import { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport pick from \"lodash/pick\";\nimport { createLegacyEntity, createStandardEntity } from \"~/utils\";\n\nconst attributes: Parameters<typeof createLegacyEntity>[2] = {\n id: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n email: {\n type: \"string\"\n },\n firstName: {\n type: \"string\"\n },\n lastName: {\n type: \"string\"\n },\n avatar: {\n type: \"map\"\n },\n createdBy: {\n type: \"map\"\n },\n createdOn: {\n type: \"string\"\n },\n group: {\n type: \"string\"\n },\n webinyVersion: {\n type: \"string\"\n }\n};\n\nexport const getUserData = (user: any) => {\n return pick(user, Object.keys(attributes));\n};\n\nexport const createLegacyUserEntity = (table: Table<string, string, string>) => {\n return createLegacyEntity(table, \"AdminUsers.User\", attributes);\n};\n\nexport const createUserEntity = (table: Table<string, string, string>) => {\n return createStandardEntity(table, \"AdminUsers.User\", attributes);\n};\n"],"mappings":";;;;;;;AACA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAME,UAAoD,GAAG;EACzDC,EAAE,EAAE;IACAC,IAAI,EAAE;EACV,CAAC;EACDC,MAAM,EAAE;IACJD,IAAI,EAAE;EACV,CAAC;EACDE,KAAK,EAAE;IACHF,IAAI,EAAE;EACV,CAAC;EACDG,SAAS,EAAE;IACPH,IAAI,EAAE;EACV,CAAC;EACDI,QAAQ,EAAE;IACNJ,IAAI,EAAE;EACV,CAAC;EACDK,MAAM,EAAE;IACJL,IAAI,EAAE;EACV,CAAC;EACDM,SAAS,EAAE;IACPN,IAAI,EAAE;EACV,CAAC;EACDO,SAAS,EAAE;IACPP,IAAI,EAAE;EACV,CAAC;EACDQ,KAAK,EAAE;IACHR,IAAI,EAAE;EACV,CAAC;EACDS,aAAa,EAAE;IACXT,IAAI,EAAE;EACV;AACJ,CAAC;AAEM,MAAMU,WAAW,GAAIC,IAAS,IAAK;EACtC,OAAO,IAAAC,aAAI,EAACD,IAAI,EAAEE,MAAM,CAACC,IAAI,CAAChB,UAAU,CAAC,CAAC;AAC9C,CAAC;AAACiB,OAAA,CAAAL,WAAA,GAAAA,WAAA;AAEK,MAAMM,sBAAsB,GAAIC,KAAoC,IAAK;EAC5E,OAAO,IAAAC,yBAAkB,EAACD,KAAK,EAAE,iBAAiB,EAAEnB,UAAU,CAAC;AACnE,CAAC;AAACiB,OAAA,CAAAC,sBAAA,GAAAA,sBAAA;AAEK,MAAMG,gBAAgB,GAAIF,KAAoC,IAAK;EACtE,OAAO,IAAAG,2BAAoB,EAACH,KAAK,EAAE,iBAAiB,EAAEnB,UAAU,CAAC;AACrE,CAAC;AAACiB,OAAA,CAAAI,gBAAA,GAAAA,gBAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
import { DataMigrationContext } from "@webiny/data-migration";
|
|
3
|
+
export declare class AdminUsers_5_35_0_003 {
|
|
4
|
+
private readonly newUserEntity;
|
|
5
|
+
private readonly legacyUserEntity;
|
|
6
|
+
private readonly tenantEntity;
|
|
7
|
+
constructor(table: Table<string, string, string>);
|
|
8
|
+
getId(): string;
|
|
9
|
+
getDescription(): string;
|
|
10
|
+
shouldExecute({ logger }: DataMigrationContext): Promise<boolean>;
|
|
11
|
+
execute({ logger }: DataMigrationContext): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AdminUsers_5_35_0_003 = void 0;
|
|
7
|
+
var _dataMigration = require("@webiny/data-migration");
|
|
8
|
+
var _utils = require("../../../utils");
|
|
9
|
+
var _createTenantEntity = require("./createTenantEntity");
|
|
10
|
+
var _createUserEntity = require("./createUserEntity");
|
|
11
|
+
var _ioc = require("@webiny/ioc");
|
|
12
|
+
var _utils2 = require("@webiny/utils");
|
|
13
|
+
class AdminUsers_5_35_0_003 {
|
|
14
|
+
constructor(table) {
|
|
15
|
+
this.newUserEntity = (0, _createUserEntity.createUserEntity)(table);
|
|
16
|
+
this.legacyUserEntity = (0, _createUserEntity.createLegacyUserEntity)(table);
|
|
17
|
+
this.tenantEntity = (0, _createTenantEntity.createTenantEntity)(table);
|
|
18
|
+
}
|
|
19
|
+
getId() {
|
|
20
|
+
return "5.35.0-003";
|
|
21
|
+
}
|
|
22
|
+
getDescription() {
|
|
23
|
+
return "Move admin users attributes to a `data` envelope.";
|
|
24
|
+
}
|
|
25
|
+
async shouldExecute({
|
|
26
|
+
logger
|
|
27
|
+
}) {
|
|
28
|
+
const user = await (0, _utils.queryOne)({
|
|
29
|
+
entity: this.newUserEntity,
|
|
30
|
+
partitionKey: `T#root#ADMIN_USERS`,
|
|
31
|
+
options: {
|
|
32
|
+
index: "GSI1",
|
|
33
|
+
gt: " "
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
if (!user) {
|
|
37
|
+
logger.info(`No users were found; skipping migration.`);
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (user.data) {
|
|
41
|
+
logger.info(`User records seems to be in order; skipping migration.`);
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
async execute({
|
|
47
|
+
logger
|
|
48
|
+
}) {
|
|
49
|
+
const tenants = await (0, _utils.queryAll)({
|
|
50
|
+
entity: this.tenantEntity,
|
|
51
|
+
partitionKey: "TENANTS",
|
|
52
|
+
options: {
|
|
53
|
+
index: "GSI1",
|
|
54
|
+
gt: " "
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
for (const tenant of tenants) {
|
|
58
|
+
const users = await (0, _utils.queryAll)({
|
|
59
|
+
entity: this.legacyUserEntity,
|
|
60
|
+
partitionKey: `T#${tenant.id}#ADMIN_USERS`,
|
|
61
|
+
options: {
|
|
62
|
+
index: "GSI1",
|
|
63
|
+
gt: " "
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
if (users.length === 0) {
|
|
67
|
+
logger.info(`No users found on tenant "${tenant.id}".`);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const newUsers = users.filter(user => !user.data).map(user => {
|
|
71
|
+
return this.newUserEntity.putBatch({
|
|
72
|
+
PK: `T#${tenant.id}#ADMIN_USER#${user.id}`,
|
|
73
|
+
SK: "A",
|
|
74
|
+
GSI1_PK: `T#${tenant.id}#ADMIN_USERS`,
|
|
75
|
+
GSI1_SK: user.email,
|
|
76
|
+
TYPE: "adminUsers.user",
|
|
77
|
+
...(0, _createUserEntity.getUserData)(user),
|
|
78
|
+
// Move all data to a `data` envelope
|
|
79
|
+
data: (0, _createUserEntity.getUserData)(user)
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
await (0, _utils2.executeWithRetry)(() => (0, _utils.batchWriteAll)({
|
|
83
|
+
table: this.newUserEntity.table,
|
|
84
|
+
items: newUsers
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.AdminUsers_5_35_0_003 = AdminUsers_5_35_0_003;
|
|
90
|
+
(0, _ioc.makeInjectable)(AdminUsers_5_35_0_003, [(0, _ioc.inject)(_dataMigration.PrimaryDynamoTableSymbol)]);
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dataMigration","require","_utils","_createTenantEntity","_createUserEntity","_ioc","_utils2","AdminUsers_5_35_0_003","constructor","table","newUserEntity","createUserEntity","legacyUserEntity","createLegacyUserEntity","tenantEntity","createTenantEntity","getId","getDescription","shouldExecute","logger","user","queryOne","entity","partitionKey","options","index","gt","info","data","execute","tenants","queryAll","tenant","users","id","length","newUsers","filter","map","putBatch","PK","SK","GSI1_PK","GSI1_SK","email","TYPE","getUserData","executeWithRetry","batchWriteAll","items","exports","makeInjectable","inject","PrimaryDynamoTableSymbol"],"sources":["index.ts"],"sourcesContent":["import { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { DataMigrationContext, PrimaryDynamoTableSymbol } from \"@webiny/data-migration\";\nimport { queryOne, queryAll, batchWriteAll } from \"~/utils\";\nimport { createTenantEntity } from \"./createTenantEntity\";\nimport { createLegacyUserEntity, createUserEntity, getUserData } from \"./createUserEntity\";\nimport { makeInjectable, inject } from \"@webiny/ioc\";\nimport { executeWithRetry } from \"@webiny/utils\";\n\nexport class AdminUsers_5_35_0_003 {\n private readonly newUserEntity: ReturnType<typeof createUserEntity>;\n private readonly legacyUserEntity: ReturnType<typeof createLegacyUserEntity>;\n private readonly tenantEntity: ReturnType<typeof createTenantEntity>;\n\n constructor(table: Table<string, string, string>) {\n this.newUserEntity = createUserEntity(table);\n this.legacyUserEntity = createLegacyUserEntity(table);\n this.tenantEntity = createTenantEntity(table);\n }\n\n getId() {\n return \"5.35.0-003\";\n }\n\n getDescription() {\n return \"Move admin users attributes to a `data` envelope.\";\n }\n\n async shouldExecute({ logger }: DataMigrationContext): Promise<boolean> {\n const user = await queryOne<{ data: any }>({\n entity: this.newUserEntity,\n partitionKey: `T#root#ADMIN_USERS`,\n options: {\n index: \"GSI1\",\n gt: \" \"\n }\n });\n\n if (!user) {\n logger.info(`No users were found; skipping migration.`);\n return false;\n }\n\n if (user.data) {\n logger.info(`User records seems to be in order; skipping migration.`);\n return false;\n }\n\n return true;\n }\n\n async execute({ logger }: DataMigrationContext): Promise<void> {\n const tenants = await queryAll<{ id: string; name: string }>({\n entity: this.tenantEntity,\n partitionKey: \"TENANTS\",\n options: {\n index: \"GSI1\",\n gt: \" \"\n }\n });\n\n for (const tenant of tenants) {\n const users = await queryAll<{ id: string; email: string; data?: any }>({\n entity: this.legacyUserEntity,\n partitionKey: `T#${tenant.id}#ADMIN_USERS`,\n options: {\n index: \"GSI1\",\n gt: \" \"\n }\n });\n\n if (users.length === 0) {\n logger.info(`No users found on tenant \"${tenant.id}\".`);\n continue;\n }\n\n const newUsers = users\n .filter(user => !user.data)\n .map(user => {\n return this.newUserEntity.putBatch({\n PK: `T#${tenant.id}#ADMIN_USER#${user.id}`,\n SK: \"A\",\n GSI1_PK: `T#${tenant.id}#ADMIN_USERS`,\n GSI1_SK: user.email,\n TYPE: \"adminUsers.user\",\n ...getUserData(user),\n // Move all data to a `data` envelope\n data: getUserData(user)\n });\n });\n\n await executeWithRetry(() =>\n batchWriteAll({ table: this.newUserEntity.table, items: newUsers })\n );\n }\n }\n}\n\nmakeInjectable(AdminUsers_5_35_0_003, [inject(PrimaryDynamoTableSymbol)]);\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC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Ac,EAAC5C,qBAAqB,EAAE,CAAC,IAAA6C,WAAM,EAACC,uCAAwB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
export declare const getTenantData: (tenant: any) => Pick<any, string>;
|
|
3
|
+
export declare const createLegacyTenantEntity: (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, {
|
|
4
|
+
PK: {
|
|
5
|
+
partitionKey: true;
|
|
6
|
+
};
|
|
7
|
+
SK: {
|
|
8
|
+
sortKey: true;
|
|
9
|
+
};
|
|
10
|
+
GSI1_PK: {
|
|
11
|
+
type: "string";
|
|
12
|
+
};
|
|
13
|
+
GSI1_SK: {
|
|
14
|
+
type: "string";
|
|
15
|
+
};
|
|
16
|
+
TYPE: {
|
|
17
|
+
type: "string";
|
|
18
|
+
};
|
|
19
|
+
}, {
|
|
20
|
+
PK: {
|
|
21
|
+
partitionKey: true;
|
|
22
|
+
};
|
|
23
|
+
SK: {
|
|
24
|
+
sortKey: true;
|
|
25
|
+
};
|
|
26
|
+
GSI1_PK: {
|
|
27
|
+
type: "string";
|
|
28
|
+
};
|
|
29
|
+
GSI1_SK: {
|
|
30
|
+
type: "string";
|
|
31
|
+
};
|
|
32
|
+
TYPE: {
|
|
33
|
+
type: "string";
|
|
34
|
+
};
|
|
35
|
+
}, import("dynamodb-toolbox/dist/cjs/classes/Entity").ParsedAttributes<import("ts-toolbelt/out/Any/Key").Key>, any, {
|
|
36
|
+
[x: string]: any;
|
|
37
|
+
[x: number]: any;
|
|
38
|
+
[x: symbol]: any;
|
|
39
|
+
}, {
|
|
40
|
+
[x: string]: any;
|
|
41
|
+
[x: number]: any;
|
|
42
|
+
[x: symbol]: any;
|
|
43
|
+
}>;
|
|
44
|
+
export declare const createNewTenantEntity: (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, {
|
|
45
|
+
PK: {
|
|
46
|
+
partitionKey: true;
|
|
47
|
+
};
|
|
48
|
+
SK: {
|
|
49
|
+
sortKey: true;
|
|
50
|
+
};
|
|
51
|
+
GSI1_PK: {
|
|
52
|
+
type: "string";
|
|
53
|
+
};
|
|
54
|
+
GSI1_SK: {
|
|
55
|
+
type: "string";
|
|
56
|
+
};
|
|
57
|
+
TYPE: {
|
|
58
|
+
type: "string";
|
|
59
|
+
};
|
|
60
|
+
data: {
|
|
61
|
+
type: "map";
|
|
62
|
+
};
|
|
63
|
+
}, {
|
|
64
|
+
PK: {
|
|
65
|
+
partitionKey: true;
|
|
66
|
+
};
|
|
67
|
+
SK: {
|
|
68
|
+
sortKey: true;
|
|
69
|
+
};
|
|
70
|
+
GSI1_PK: {
|
|
71
|
+
type: "string";
|
|
72
|
+
};
|
|
73
|
+
GSI1_SK: {
|
|
74
|
+
type: "string";
|
|
75
|
+
};
|
|
76
|
+
TYPE: {
|
|
77
|
+
type: "string";
|
|
78
|
+
};
|
|
79
|
+
data: {
|
|
80
|
+
type: "map";
|
|
81
|
+
};
|
|
82
|
+
}, import("dynamodb-toolbox/dist/cjs/classes/Entity").ParsedAttributes<import("ts-toolbelt/out/Any/Key").Key>, any, {
|
|
83
|
+
[x: string]: any;
|
|
84
|
+
[x: number]: any;
|
|
85
|
+
[x: symbol]: any;
|
|
86
|
+
}, {
|
|
87
|
+
[x: string]: any;
|
|
88
|
+
[x: number]: any;
|
|
89
|
+
[x: symbol]: any;
|
|
90
|
+
}>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getTenantData = exports.createNewTenantEntity = exports.createLegacyTenantEntity = void 0;
|
|
8
|
+
var _pick = _interopRequireDefault(require("lodash/pick"));
|
|
9
|
+
var _utils = require("../../../utils");
|
|
10
|
+
const attributes = {
|
|
11
|
+
id: {
|
|
12
|
+
type: "string"
|
|
13
|
+
},
|
|
14
|
+
name: {
|
|
15
|
+
type: "string"
|
|
16
|
+
},
|
|
17
|
+
description: {
|
|
18
|
+
type: "string"
|
|
19
|
+
},
|
|
20
|
+
status: {
|
|
21
|
+
type: "string",
|
|
22
|
+
default: "active"
|
|
23
|
+
},
|
|
24
|
+
createdOn: {
|
|
25
|
+
type: "string"
|
|
26
|
+
},
|
|
27
|
+
savedOn: {
|
|
28
|
+
type: "string"
|
|
29
|
+
},
|
|
30
|
+
createdBy: {
|
|
31
|
+
type: "map"
|
|
32
|
+
},
|
|
33
|
+
parent: {
|
|
34
|
+
type: "string"
|
|
35
|
+
},
|
|
36
|
+
webinyVersion: {
|
|
37
|
+
type: "string"
|
|
38
|
+
},
|
|
39
|
+
settings: {
|
|
40
|
+
type: "map",
|
|
41
|
+
default: {}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const getTenantData = tenant => {
|
|
45
|
+
return (0, _pick.default)(tenant, Object.keys(attributes));
|
|
46
|
+
};
|
|
47
|
+
exports.getTenantData = getTenantData;
|
|
48
|
+
const createLegacyTenantEntity = table => {
|
|
49
|
+
return (0, _utils.createLegacyEntity)(table, "TenancyTenant", attributes);
|
|
50
|
+
};
|
|
51
|
+
exports.createLegacyTenantEntity = createLegacyTenantEntity;
|
|
52
|
+
const createNewTenantEntity = table => {
|
|
53
|
+
return (0, _utils.createStandardEntity)(table, "TenancyTenant", attributes);
|
|
54
|
+
};
|
|
55
|
+
exports.createNewTenantEntity = createNewTenantEntity;
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=createTenantEntity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_pick","_interopRequireDefault","require","_utils","attributes","id","type","name","description","status","default","createdOn","savedOn","createdBy","parent","webinyVersion","settings","getTenantData","tenant","pick","Object","keys","exports","createLegacyTenantEntity","table","createLegacyEntity","createNewTenantEntity","createStandardEntity"],"sources":["createTenantEntity.ts"],"sourcesContent":["import { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport pick from \"lodash/pick\";\nimport { createLegacyEntity, createStandardEntity } from \"~/utils\";\n\nconst attributes: Parameters<typeof createLegacyEntity>[2] = {\n id: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n description: {\n type: \"string\"\n },\n status: {\n type: \"string\",\n default: \"active\"\n },\n createdOn: {\n type: \"string\"\n },\n savedOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n parent: {\n type: \"string\"\n },\n webinyVersion: {\n type: \"string\"\n },\n settings: {\n type: \"map\",\n default: {}\n }\n};\n\nexport const getTenantData = (tenant: any) => {\n return pick(tenant, Object.keys(attributes));\n};\n\nexport const createLegacyTenantEntity = (table: Table<string, string, string>) => {\n return createLegacyEntity(table, \"TenancyTenant\", attributes);\n};\n\nexport const createNewTenantEntity = (table: Table<string, string, string>) => {\n return createStandardEntity(table, \"TenancyTenant\", attributes);\n};\n"],"mappings":";;;;;;;AACA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAME,UAAoD,GAAG;EACzDC,EAAE,EAAE;IACAC,IAAI,EAAE;EACV,CAAC;EACDC,IAAI,EAAE;IACFD,IAAI,EAAE;EACV,CAAC;EACDE,WAAW,EAAE;IACTF,IAAI,EAAE;EACV,CAAC;EACDG,MAAM,EAAE;IACJH,IAAI,EAAE,QAAQ;IACdI,OAAO,EAAE;EACb,CAAC;EACDC,SAAS,EAAE;IACPL,IAAI,EAAE;EACV,CAAC;EACDM,OAAO,EAAE;IACLN,IAAI,EAAE;EACV,CAAC;EACDO,SAAS,EAAE;IACPP,IAAI,EAAE;EACV,CAAC;EACDQ,MAAM,EAAE;IACJR,IAAI,EAAE;EACV,CAAC;EACDS,aAAa,EAAE;IACXT,IAAI,EAAE;EACV,CAAC;EACDU,QAAQ,EAAE;IACNV,IAAI,EAAE,KAAK;IACXI,OAAO,EAAE,CAAC;EACd;AACJ,CAAC;AAEM,MAAMO,aAAa,GAAIC,MAAW,IAAK;EAC1C,OAAO,IAAAC,aAAI,EAACD,MAAM,EAAEE,MAAM,CAACC,IAAI,CAACjB,UAAU,CAAC,CAAC;AAChD,CAAC;AAACkB,OAAA,CAAAL,aAAA,GAAAA,aAAA;AAEK,MAAMM,wBAAwB,GAAIC,KAAoC,IAAK;EAC9E,OAAO,IAAAC,yBAAkB,EAACD,KAAK,EAAE,eAAe,EAAEpB,UAAU,CAAC;AACjE,CAAC;AAACkB,OAAA,CAAAC,wBAAA,GAAAA,wBAAA;AAEK,MAAMG,qBAAqB,GAAIF,KAAoC,IAAK;EAC3E,OAAO,IAAAG,2BAAoB,EAACH,KAAK,EAAE,eAAe,EAAEpB,UAAU,CAAC;AACnE,CAAC;AAACkB,OAAA,CAAAI,qBAAA,GAAAA,qBAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
import { DataMigrationContext } from "@webiny/data-migration";
|
|
3
|
+
export declare class Tenancy_5_35_0_004 {
|
|
4
|
+
private readonly legacyTenantEntity;
|
|
5
|
+
private readonly newTenantEntity;
|
|
6
|
+
constructor(table: Table<string, string, string>);
|
|
7
|
+
getId(): string;
|
|
8
|
+
getDescription(): string;
|
|
9
|
+
shouldExecute({ logger }: DataMigrationContext): Promise<boolean>;
|
|
10
|
+
execute({ logger }: DataMigrationContext): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Tenancy_5_35_0_004 = void 0;
|
|
7
|
+
var _ioc = require("@webiny/ioc");
|
|
8
|
+
var _dataMigration = require("@webiny/data-migration");
|
|
9
|
+
var _utils = require("../../../utils");
|
|
10
|
+
var _createTenantEntity = require("./createTenantEntity");
|
|
11
|
+
var _dbDynamodb = require("@webiny/db-dynamodb");
|
|
12
|
+
class Tenancy_5_35_0_004 {
|
|
13
|
+
constructor(table) {
|
|
14
|
+
this.legacyTenantEntity = (0, _createTenantEntity.createLegacyTenantEntity)(table);
|
|
15
|
+
this.newTenantEntity = (0, _createTenantEntity.createNewTenantEntity)(table);
|
|
16
|
+
}
|
|
17
|
+
getId() {
|
|
18
|
+
return "5.35.0-004";
|
|
19
|
+
}
|
|
20
|
+
getDescription() {
|
|
21
|
+
return "Move tenant attributes to a `data` envelope.";
|
|
22
|
+
}
|
|
23
|
+
async shouldExecute({
|
|
24
|
+
logger
|
|
25
|
+
}) {
|
|
26
|
+
const tenant = await (0, _utils.queryOne)({
|
|
27
|
+
entity: this.legacyTenantEntity,
|
|
28
|
+
partitionKey: `TENANTS`,
|
|
29
|
+
options: {
|
|
30
|
+
index: "GSI1",
|
|
31
|
+
gt: " "
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
if (!tenant) {
|
|
35
|
+
logger.info(`No tenants were found; skipping migration.`);
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
if (tenant.data) {
|
|
39
|
+
logger.info(`Tenant records seems to be in order; skipping migration.`);
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
async execute({
|
|
45
|
+
logger
|
|
46
|
+
}) {
|
|
47
|
+
const tenants = await (0, _utils.queryAll)({
|
|
48
|
+
entity: this.legacyTenantEntity,
|
|
49
|
+
partitionKey: "TENANTS",
|
|
50
|
+
options: {
|
|
51
|
+
index: "GSI1",
|
|
52
|
+
gt: " "
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
for (const tenant of tenants) {
|
|
56
|
+
logger.info(`Updating tenant ${tenant.name} (${tenant.id}).`);
|
|
57
|
+
await (0, _dbDynamodb.put)({
|
|
58
|
+
entity: this.newTenantEntity,
|
|
59
|
+
item: {
|
|
60
|
+
PK: `T#${tenant.id}`,
|
|
61
|
+
SK: "A",
|
|
62
|
+
GSI1_PK: tenant.GSI1_PK,
|
|
63
|
+
GSI1_SK: tenant.GSI1_SK,
|
|
64
|
+
TYPE: tenant.TYPE,
|
|
65
|
+
...(0, _createTenantEntity.getTenantData)(tenant),
|
|
66
|
+
// Move all data to a `data` envelope
|
|
67
|
+
data: {
|
|
68
|
+
...(0, _createTenantEntity.getTenantData)(tenant),
|
|
69
|
+
// While we're here, add a `tags` attribute to tenants
|
|
70
|
+
tags: []
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.Tenancy_5_35_0_004 = Tenancy_5_35_0_004;
|
|
78
|
+
(0, _ioc.makeInjectable)(Tenancy_5_35_0_004, [(0, _ioc.inject)(_dataMigration.PrimaryDynamoTableSymbol)]);
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ioc","require","_dataMigration","_utils","_createTenantEntity","_dbDynamodb","Tenancy_5_35_0_004","constructor","table","legacyTenantEntity","createLegacyTenantEntity","newTenantEntity","createNewTenantEntity","getId","getDescription","shouldExecute","logger","tenant","queryOne","entity","partitionKey","options","index","gt","info","data","execute","tenants","queryAll","name","id","put","item","PK","SK","GSI1_PK","GSI1_SK","TYPE","getTenantData","tags","exports","makeInjectable","inject","PrimaryDynamoTableSymbol"],"sources":["index.ts"],"sourcesContent":["import { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { inject, makeInjectable } from \"@webiny/ioc\";\nimport { DataMigrationContext, PrimaryDynamoTableSymbol } from \"@webiny/data-migration\";\nimport { queryAll, queryOne } from \"~/utils\";\nimport {\n createLegacyTenantEntity,\n createNewTenantEntity,\n getTenantData\n} from \"./createTenantEntity\";\nimport { put } from \"@webiny/db-dynamodb\";\n\nexport class Tenancy_5_35_0_004 {\n private readonly legacyTenantEntity: ReturnType<typeof createLegacyTenantEntity>;\n private readonly newTenantEntity: ReturnType<typeof createNewTenantEntity>;\n\n constructor(table: Table<string, string, string>) {\n this.legacyTenantEntity = createLegacyTenantEntity(table);\n this.newTenantEntity = createNewTenantEntity(table);\n }\n\n getId() {\n return \"5.35.0-004\";\n }\n\n getDescription() {\n return \"Move tenant attributes to a `data` envelope.\";\n }\n\n async shouldExecute({ logger }: DataMigrationContext): Promise<boolean> {\n const tenant = await queryOne<{ data: any }>({\n entity: this.legacyTenantEntity,\n partitionKey: `TENANTS`,\n options: {\n index: \"GSI1\",\n gt: \" \"\n }\n });\n\n if (!tenant) {\n logger.info(`No tenants were found; skipping migration.`);\n return false;\n }\n\n if (tenant.data) {\n logger.info(`Tenant records seems to be in order; skipping migration.`);\n return false;\n }\n\n return true;\n }\n\n async execute({ logger }: DataMigrationContext): Promise<void> {\n const tenants = await queryAll<{ id: string; name: string }>({\n entity: this.legacyTenantEntity,\n partitionKey: \"TENANTS\",\n options: {\n index: \"GSI1\",\n gt: \" \"\n }\n });\n\n for (const tenant of tenants) {\n logger.info(`Updating tenant ${tenant.name} (${tenant.id}).`);\n await put({\n entity: this.newTenantEntity,\n item: {\n PK: `T#${tenant.id}`,\n SK: \"A\",\n GSI1_PK: tenant.GSI1_PK,\n GSI1_SK: tenant.GSI1_SK,\n TYPE: tenant.TYPE,\n ...getTenantData(tenant),\n // Move all data to a `data` envelope\n data: {\n ...getTenantData(tenant),\n // While we're here, add a `tags` attribute to tenants\n tags: []\n }\n }\n });\n }\n }\n}\n\nm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