@webiny/api-page-builder-import-export 0.0.0-unstable.ecd8734205 → 0.0.0-unstable.f9f12f52a0
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/client.d.ts +1 -1
- package/client.js +12 -21
- package/client.js.map +1 -1
- package/export/combine/blocksHandler.d.ts +2 -2
- package/export/combine/blocksHandler.js +4 -2
- package/export/combine/blocksHandler.js.map +1 -1
- package/export/combine/formsHandler.d.ts +2 -2
- package/export/combine/formsHandler.js +4 -2
- package/export/combine/formsHandler.js.map +1 -1
- package/export/combine/index.d.ts +2 -2
- package/export/combine/index.js +24 -20
- package/export/combine/index.js.map +1 -1
- package/export/combine/templatesHandler.d.ts +2 -2
- package/export/combine/templatesHandler.js +4 -2
- package/export/combine/templatesHandler.js.map +1 -1
- package/export/pages/ExportPagesCleanup.d.ts +5 -0
- package/export/pages/ExportPagesCleanup.js +82 -0
- package/export/pages/ExportPagesCleanup.js.map +1 -0
- package/export/pages/ExportPagesController.d.ts +5 -0
- package/export/pages/ExportPagesController.js +31 -0
- package/export/pages/ExportPagesController.js.map +1 -0
- package/export/pages/ExportPagesZipPages.d.ts +5 -0
- package/export/pages/ExportPagesZipPages.js +23 -0
- package/export/pages/ExportPagesZipPages.js.map +1 -0
- package/export/pages/controller/CombineZippedPages.d.ts +5 -0
- package/export/pages/controller/CombineZippedPages.js +75 -0
- package/export/pages/controller/CombineZippedPages.js.map +1 -0
- package/export/pages/controller/CreateZipPagesTasks.d.ts +8 -0
- package/export/pages/controller/CreateZipPagesTasks.js +103 -0
- package/export/pages/controller/CreateZipPagesTasks.js.map +1 -0
- package/export/pages/controller/ProcessZipPagesTasks.d.ts +6 -0
- package/export/pages/controller/ProcessZipPagesTasks.js +61 -0
- package/export/pages/controller/ProcessZipPagesTasks.js.map +1 -0
- package/export/pages/types.d.ts +53 -0
- package/export/pages/types.js +26 -0
- package/export/pages/types.js.map +1 -0
- package/export/pages/utils.d.ts +2 -0
- package/export/pages/utils.js +13 -0
- package/export/pages/utils.js.map +1 -0
- package/export/pages/zipPages/ZipPages.d.ts +5 -0
- package/export/pages/zipPages/ZipPages.js +100 -0
- package/export/pages/zipPages/ZipPages.js.map +1 -0
- package/export/pages/zipPages/ZipPagesDataManager.d.ts +14 -0
- package/export/pages/zipPages/ZipPagesDataManager.js +46 -0
- package/export/pages/zipPages/ZipPagesDataManager.js.map +1 -0
- package/export/pages/zipPages/getPageFactory.d.ts +4 -0
- package/export/pages/zipPages/getPageFactory.js +38 -0
- package/export/pages/zipPages/getPageFactory.js.map +1 -0
- package/export/process/blocksHandler.d.ts +2 -2
- package/export/process/blocksHandler.js +13 -6
- package/export/process/blocksHandler.js.map +1 -1
- package/export/process/exporters/BlockExporter.d.ts +12 -0
- package/export/process/exporters/BlockExporter.js +57 -0
- package/export/process/exporters/BlockExporter.js.map +1 -0
- package/export/process/exporters/FormExporter.d.ts +9 -0
- package/export/process/exporters/FormExporter.js +36 -0
- package/export/process/exporters/FormExporter.js.map +1 -0
- package/export/process/exporters/PageExporter.d.ts +18 -0
- package/export/process/exporters/PageExporter.js +59 -0
- package/export/process/exporters/PageExporter.js.map +1 -0
- package/export/process/exporters/PageTemplateExporter.d.ts +11 -0
- package/export/process/exporters/PageTemplateExporter.js +58 -0
- package/export/process/exporters/PageTemplateExporter.js.map +1 -0
- package/export/process/formsHandler.d.ts +2 -2
- package/export/process/formsHandler.js +8 -6
- package/export/process/formsHandler.js.map +1 -1
- package/export/process/index.d.ts +2 -2
- package/export/process/index.js +24 -20
- package/export/process/index.js.map +1 -1
- package/export/process/templatesHandler.d.ts +2 -2
- package/export/process/templatesHandler.js +8 -6
- package/export/process/templatesHandler.js.map +1 -1
- package/export/s3Stream.d.ts +12 -10
- package/export/s3Stream.js +27 -23
- package/export/s3Stream.js.map +1 -1
- package/export/utils.d.ts +10 -15
- package/export/utils.js +30 -49
- package/export/utils.js.map +1 -1
- package/export/zipper.d.ts +7 -6
- package/export/zipper.js +18 -22
- package/export/zipper.js.map +1 -1
- package/graphql/crud/blocks.crud.d.ts +1 -1
- package/graphql/crud/blocks.crud.js +50 -29
- package/graphql/crud/blocks.crud.js.map +1 -1
- package/graphql/crud/forms.crud.d.ts +1 -1
- package/graphql/crud/forms.crud.js +51 -18
- package/graphql/crud/forms.crud.js.map +1 -1
- package/graphql/crud/importExportTasks.crud.d.ts +2 -2
- package/graphql/crud/importExportTasks.crud.js +144 -111
- package/graphql/crud/importExportTasks.crud.js.map +1 -1
- package/graphql/crud/pages.crud.d.ts +1 -1
- package/graphql/crud/pages.crud.js +238 -121
- package/graphql/crud/pages.crud.js.map +1 -1
- package/graphql/crud/templates.crud.d.ts +1 -1
- package/graphql/crud/templates.crud.js +48 -16
- package/graphql/crud/templates.crud.js.map +1 -1
- package/graphql/crud.d.ts +2 -2
- package/graphql/crud.js +3 -1
- package/graphql/crud.js.map +1 -1
- package/graphql/graphql/blocks.gql.d.ts +2 -2
- package/graphql/graphql/blocks.gql.js +7 -7
- package/graphql/graphql/blocks.gql.js.map +1 -1
- package/graphql/graphql/forms.gql.d.ts +2 -2
- package/graphql/graphql/forms.gql.js +6 -6
- package/graphql/graphql/forms.gql.js.map +1 -1
- package/graphql/graphql/importExportTasks.gql.d.ts +2 -2
- package/graphql/graphql/importExportTasks.gql.js +7 -7
- package/graphql/graphql/importExportTasks.gql.js.map +1 -1
- package/graphql/graphql/pages.gql.d.ts +2 -2
- package/graphql/graphql/pages.gql.js +103 -14
- package/graphql/graphql/pages.gql.js.map +1 -1
- package/graphql/graphql/templates.gql.d.ts +2 -2
- package/graphql/graphql/templates.gql.js +6 -6
- package/graphql/graphql/templates.gql.js.map +1 -1
- package/graphql/graphql/utils/resolve.d.ts +3 -3
- package/graphql/graphql/utils/resolve.js +16 -5
- package/graphql/graphql/utils/resolve.js.map +1 -1
- package/graphql/graphql.d.ts +1 -1
- package/graphql/graphql.js +3 -2
- package/graphql/graphql.js.map +1 -1
- package/graphql/index.d.ts +2 -2
- package/graphql/index.js +5 -2
- package/graphql/index.js.map +1 -1
- package/graphql/types.d.ts +173 -33
- package/graphql/types.js +3 -1
- package/graphql/types.js.map +1 -1
- package/import/constants.js +5 -6
- package/import/constants.js.map +1 -1
- package/import/create/blocksHandler.d.ts +2 -2
- package/import/create/blocksHandler.js +3 -3
- package/import/create/blocksHandler.js.map +1 -1
- package/import/create/formsHandler.d.ts +2 -2
- package/import/create/formsHandler.js +3 -1
- package/import/create/formsHandler.js.map +1 -1
- package/import/create/index.d.ts +2 -2
- package/import/create/index.js +24 -20
- package/import/create/index.js.map +1 -1
- package/import/create/pagesHandler.d.ts +2 -2
- package/import/create/pagesHandler.js +3 -1
- package/import/create/pagesHandler.js.map +1 -1
- package/import/create/templatesHandler.d.ts +2 -2
- package/import/create/templatesHandler.js +3 -1
- package/import/create/templatesHandler.js.map +1 -1
- package/import/pages/ImportPagesController.d.ts +5 -0
- package/import/pages/ImportPagesController.js +29 -0
- package/import/pages/ImportPagesController.js.map +1 -0
- package/import/pages/ImportPagesProcessPages.d.ts +6 -0
- package/import/pages/ImportPagesProcessPages.js +112 -0
- package/import/pages/ImportPagesProcessPages.js.map +1 -0
- package/import/pages/controller/ImportPagesProcessPagesChecker.d.ts +6 -0
- package/import/pages/controller/ImportPagesProcessPagesChecker.js +40 -0
- package/import/pages/controller/ImportPagesProcessPagesChecker.js.map +1 -0
- package/import/pages/controller/ImportPagesProcessZipFile.d.ts +5 -0
- package/import/pages/controller/ImportPagesProcessZipFile.js +71 -0
- package/import/pages/controller/ImportPagesProcessZipFile.js.map +1 -0
- package/import/{process/pages → pages/process}/importPage.d.ts +3 -4
- package/import/{process/pages → pages/process}/importPage.js +9 -7
- package/import/pages/process/importPage.js.map +1 -0
- package/import/pages/types.d.ts +48 -0
- package/import/pages/types.js +20 -0
- package/import/pages/types.js.map +1 -0
- package/import/process/blocks/ElementIdsProcessor.d.ts +5 -0
- package/import/process/blocks/ElementIdsProcessor.js +26 -0
- package/import/process/blocks/ElementIdsProcessor.js.map +1 -0
- package/import/process/blocks/blocksHandler.d.ts +2 -2
- package/import/process/blocks/blocksHandler.js +6 -6
- package/import/process/blocks/blocksHandler.js.map +1 -1
- package/import/process/blocks/importBlock.d.ts +4 -4
- package/import/process/blocks/importBlock.js +39 -27
- package/import/process/blocks/importBlock.js.map +1 -1
- package/import/process/forms/formsHandler.d.ts +2 -2
- package/import/process/forms/formsHandler.js +4 -2
- package/import/process/forms/formsHandler.js.map +1 -1
- package/import/process/forms/importForm.d.ts +2 -2
- package/import/process/forms/importForm.js +6 -2
- package/import/process/forms/importForm.js.map +1 -1
- package/import/process/index.d.ts +2 -2
- package/import/process/index.js +24 -20
- package/import/process/index.js.map +1 -1
- package/import/process/templates/importTemplate.d.ts +3 -3
- package/import/process/templates/importTemplate.js +7 -3
- package/import/process/templates/importTemplate.js.map +1 -1
- package/import/process/templates/templatesHandler.d.ts +2 -2
- package/import/process/templates/templatesHandler.js +6 -2
- package/import/process/templates/templatesHandler.js.map +1 -1
- package/import/utils/deleteS3Folder.js +3 -1
- package/import/utils/deleteS3Folder.js.map +1 -1
- package/import/utils/extractAndUploadZipFileContents.d.ts +1 -1
- package/import/utils/extractAndUploadZipFileContents.js +9 -5
- package/import/utils/extractAndUploadZipFileContents.js.map +1 -1
- package/import/utils/extractZipAndUploadToS3.d.ts +1 -1
- package/import/utils/extractZipAndUploadToS3.js +3 -1
- package/import/utils/extractZipAndUploadToS3.js.map +1 -1
- package/import/utils/getFileNameWithoutExt.js +3 -1
- package/import/utils/getFileNameWithoutExt.js.map +1 -1
- package/import/utils/index.js +3 -1
- package/import/utils/index.js.map +1 -1
- package/import/utils/initialStats.js +3 -1
- package/import/utils/initialStats.js.map +1 -1
- package/import/utils/prepareDataDirMap.d.ts +1 -1
- package/import/utils/prepareDataDirMap.js +3 -1
- package/import/utils/prepareDataDirMap.js.map +1 -1
- package/import/utils/updateFilesInData.d.ts +1 -1
- package/import/utils/updateFilesInData.js +5 -2
- package/import/utils/updateFilesInData.js.map +1 -1
- package/import/utils/uploadAssets.d.ts +3 -3
- package/import/utils/uploadAssets.js +57 -23
- package/import/utils/uploadAssets.js.map +1 -1
- package/import/utils/uploadFilesFromS3.d.ts +3 -3
- package/import/utils/uploadFilesFromS3.js +4 -2
- package/import/utils/uploadFilesFromS3.js.map +1 -1
- package/mockSecurity.d.ts +1 -1
- package/mockSecurity.js +3 -2
- package/mockSecurity.js.map +1 -1
- package/package.json +37 -54
- package/tasks/common/ChildTasksCleanup.d.ts +12 -0
- package/tasks/common/ChildTasksCleanup.js +64 -0
- package/tasks/common/ChildTasksCleanup.js.map +1 -0
- package/tasks/index.d.ts +1 -0
- package/tasks/index.js +13 -0
- package/tasks/index.js.map +1 -0
- package/tasks/pages/exportPagesCleanupTask.d.ts +3 -0
- package/tasks/pages/exportPagesCleanupTask.js +36 -0
- package/tasks/pages/exportPagesCleanupTask.js.map +1 -0
- package/tasks/pages/exportPagesControllerTask.d.ts +3 -0
- package/tasks/pages/exportPagesControllerTask.js +83 -0
- package/tasks/pages/exportPagesControllerTask.js.map +1 -0
- package/tasks/pages/exportPagesZipPagesTask.d.ts +3 -0
- package/tasks/pages/exportPagesZipPagesTask.js +39 -0
- package/tasks/pages/exportPagesZipPagesTask.js.map +1 -0
- package/tasks/pages/importPagesControllerTask.d.ts +3 -0
- package/tasks/pages/importPagesControllerTask.js +39 -0
- package/tasks/pages/importPagesControllerTask.js.map +1 -0
- package/tasks/pages/importPagesProcessPageTask.d.ts +3 -0
- package/tasks/pages/importPagesProcessPageTask.js +39 -0
- package/tasks/pages/importPagesProcessPageTask.js.map +1 -0
- package/tasks/pages/index.d.ts +1 -0
- package/tasks/pages/index.js +17 -0
- package/tasks/pages/index.js.map +1 -0
- package/types.d.ts +2 -2
- package/types.js +60 -8
- package/types.js.map +1 -1
- package/utils/ZipFiles.d.ts +11 -0
- package/utils/ZipFiles.js +124 -0
- package/utils/ZipFiles.js.map +1 -0
- package/export/combine/pagesHandler.d.ts +0 -6
- package/export/combine/pagesHandler.js +0 -99
- package/export/combine/pagesHandler.js.map +0 -1
- package/export/process/pagesHandler.d.ts +0 -6
- package/export/process/pagesHandler.js +0 -189
- package/export/process/pagesHandler.js.map +0 -1
- package/import/process/blocksHandler.d.ts +0 -3
- package/import/process/blocksHandler.js +0 -175
- package/import/process/blocksHandler.js.map +0 -1
- package/import/process/pages/importPage.js.map +0 -1
- package/import/process/pages/pagesHandler.d.ts +0 -3
- package/import/process/pages/pagesHandler.js +0 -183
- package/import/process/pages/pagesHandler.js.map +0 -1
- package/import/process/pagesHandler.d.ts +0 -3
- package/import/process/pagesHandler.js +0 -180
- package/import/process/pagesHandler.js.map +0 -1
- package/import/utils.d.ts +0 -49
- package/import/utils.js +0 -641
- package/import/utils.js.map +0 -1
package/export/zipper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Zipper","constructor","config","archiveFileName","uniqueId","archiveFileKey","kebabCase","exportInfo","name","s3DownloadStreams","prefix","files","map","key","stream","s3Stream","readStream","filename","
|
|
1
|
+
{"version":3,"names":["_archiver","_interopRequireDefault","require","_stream","path","_interopRequireWildcard","_kebabCase","_uniqid","_s3Stream","Zipper","archiveFormat","filesDirName","constructor","config","archiveFileName","uniqueId","archiveFileKey","kebabCase","exportInfo","name","s3DownloadStreams","prefix","files","Promise","all","map","key","stream","s3Stream","readStream","filename","Readable","from","dataBuffer","process","streamPassThrough","streamPassThroughUploadPromise","writeStream","s3FilesStreams","archive","vending","create","on","error","Error","code","message","stack","forEach","streamDetails","append","pipe","finalize","exports","default","ZipOfZip","keys","getFileStreams","basename","fileStreamDetails"],"sources":["zipper.ts"],"sourcesContent":["// TODO: Move \"archive\" in layer\nimport type { ArchiverError } from \"archiver\";\nimport vending from \"archiver\";\nimport type { CompleteMultipartUploadOutput } from \"@webiny/aws-sdk/client-s3\";\nimport { Readable } from \"stream\";\nimport * as path from \"path\";\nimport kebabCase from \"lodash/kebabCase\";\nimport uniqueId from \"uniqid\";\nimport { s3Stream } from \"./s3Stream\";\nimport type { File } from \"@webiny/api-file-manager/types\";\n\ninterface FileStreamDetails {\n stream: Readable;\n filename: string;\n}\n\ninterface ExportInfo {\n files: File[];\n name: string;\n dataBuffer: Buffer;\n}\n\nexport interface ZipperConfig {\n exportInfo: ExportInfo;\n archiveFileKey: string;\n}\n\nexport default class Zipper {\n private readonly archiveFormat = \"zip\";\n private readonly filesDirName = \"assets\";\n private readonly archiveFileName: string;\n config: ZipperConfig;\n\n constructor(config: ZipperConfig) {\n this.config = config;\n this.archiveFileName = uniqueId(\n `${this.config.archiveFileKey}/`,\n `-${kebabCase(this.config.exportInfo.name)}.zip`\n );\n }\n\n async s3DownloadStreams(): Promise<FileStreamDetails[]> {\n const exportInfo = this.config.exportInfo;\n const prefix = uniqueId(\"\", `-${kebabCase(exportInfo.name)}`);\n const files = await Promise.all(\n exportInfo.files.map(async ({ key }) => {\n return {\n stream: await s3Stream.readStream(key),\n filename: `${prefix}\\\\${this.filesDirName}\\\\${key}`\n };\n })\n );\n\n return [\n ...files,\n {\n stream: Readable.from(exportInfo.dataBuffer),\n filename: `${prefix}\\\\${exportInfo.name}.json`\n }\n ];\n }\n\n async process(): Promise<CompleteMultipartUploadOutput> {\n const { streamPassThrough, streamPassThroughUploadPromise } = s3Stream.writeStream(\n this.archiveFileName\n );\n\n // 1. Read all files from S3 using stream.\n const s3FilesStreams = await this.s3DownloadStreams();\n\n // 2. Prepare zip from the file stream.\n const archive = vending.create(this.archiveFormat);\n // Handle archive events.\n archive.on(\"error\", (error: ArchiverError) => {\n throw new Error(\n `${error.name} ${error.code} ${error.message} ${error.path} ${error.stack}`\n );\n });\n\n // Append all file streams to archive.\n s3FilesStreams.forEach((streamDetails: FileStreamDetails) =>\n archive.append(streamDetails.stream, { name: streamDetails.filename })\n );\n\n // Pipe archive output to streamPassThrough (Transform Stream) which will be uploaded to S3.\n archive.pipe(streamPassThrough);\n // Finalize the archive (ie we are done appending files but streams have to finish yet)\n // 'close', 'end' or 'finish' may be fired right after calling this method so register to them beforehand\n archive.finalize();\n\n // 3. Return upload stream promise.\n return streamPassThroughUploadPromise;\n }\n}\n\nexport class ZipOfZip {\n private readonly archiveFormat = \"zip\";\n private readonly archiveFileName: string;\n keys: string[];\n filename: string;\n\n constructor(keys: string[], filename: string) {\n this.keys = keys;\n this.filename = filename;\n this.archiveFileName = uniqueId(\"EXPORTS/\", `-${filename}`);\n }\n\n async getFileStreams(): Promise<FileStreamDetails[]> {\n return await Promise.all(\n this.keys.map(async key => {\n return {\n stream: await s3Stream.readStream(key),\n filename: `${path.basename(key)}`\n };\n })\n );\n }\n\n async process(): Promise<CompleteMultipartUploadOutput> {\n const { streamPassThrough, streamPassThroughUploadPromise } = s3Stream.writeStream(\n this.archiveFileName\n );\n\n // 1. Read all files from S3 using stream.\n const fileStreamDetails = await this.getFileStreams();\n\n // 2. Prepare zip from the file stream.\n const archive = vending.create(this.archiveFormat);\n // Handle archive events.\n archive.on(\"error\", (error: ArchiverError) => {\n throw new Error(\n `${error.name} ${error.code} ${error.message} ${error.path} ${error.stack}`\n );\n });\n\n // Append all file streams to archive.\n fileStreamDetails.forEach((streamDetails: FileStreamDetails) =>\n archive.append(streamDetails.stream, { name: streamDetails.filename })\n );\n\n // Pipe archive output to streamPassThrough (Transform Stream) which will be uploaded to S3.\n archive.pipe(streamPassThrough);\n // Finalize the archive (ie we are done appending files but streams have to finish yet)\n // 'close', 'end' or 'finish' may be fired right after calling this method so register to them beforehand\n archive.finalize();\n\n // 3. Return upload stream promise.\n return streamPassThroughUploadPromise;\n }\n}\n"],"mappings":";;;;;;;;AAEA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,SAAA,GAAAN,OA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,QAAQ,EAAE,GAAG1B,IAAI,CAACsD,QAAQ,CAAChC,GAAG,CAAC;MACnC,CAAC;IACL,CAAC,CACL,CAAC;EACL;EAEA,MAAMQ,OAAOA,CAAA,EAA2C;IACpD,MAAM;MAAEC,iBAAiB;MAAEC;IAA+B,CAAC,GAAGR,kBAAQ,CAACS,WAAW,CAC9E,IAAI,CAACvB,eACT,CAAC;;IAED;IACA,MAAM6C,iBAAiB,GAAG,MAAM,IAAI,CAACF,cAAc,CAAC,CAAC;;IAErD;IACA,MAAMlB,OAAO,GAAGC,iBAAO,CAACC,MAAM,CAAC,IAAI,CAAC/B,aAAa,CAAC;IAClD;IACA6B,OAAO,CAACG,EAAE,CAAC,OAAO,EAAGC,KAAoB,IAAK;MAC1C,MAAM,IAAIC,KAAK,CACX,GAAGD,KAAK,CAACxB,IAAI,IAAIwB,KAAK,CAACE,IAAI,IAAIF,KAAK,CAACG,OAAO,IAAIH,KAAK,CAACvC,IAAI,IAAIuC,KAAK,CAACI,KAAK,EAC7E,CAAC;IACL,CAAC,CAAC;;IAEF;IACAY,iBAAiB,CAACX,OAAO,CAAEC,aAAgC,IACvDV,OAAO,CAACW,MAAM,CAACD,aAAa,CAACtB,MAAM,EAAE;MAAER,IAAI,EAAE8B,aAAa,CAACnB;IAAS,CAAC,CACzE,CAAC;;IAED;IACAS,OAAO,CAACY,IAAI,CAAChB,iBAAiB,CAAC;IAC/B;IACA;IACAI,OAAO,CAACa,QAAQ,CAAC,CAAC;;IAElB;IACA,OAAOhB,8BAA8B;EACzC;AACJ;AAACiB,OAAA,CAAAE,QAAA,GAAAA,QAAA","ignoreList":[]}
|
|
@@ -6,38 +6,47 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var
|
|
9
|
+
var _pubsub = require("@webiny/pubsub");
|
|
10
10
|
var _api = require("@webiny/api");
|
|
11
|
-
var _checkBasePermissions = _interopRequireDefault(require("@webiny/api-page-builder/graphql/crud/utils/checkBasePermissions"));
|
|
12
11
|
var _types = require("../../types");
|
|
13
12
|
var _client = require("../../client");
|
|
14
13
|
var _utils = require("../../import/utils");
|
|
15
|
-
var _utils2 = require("
|
|
16
|
-
var
|
|
17
|
-
const
|
|
14
|
+
var _utils2 = require("@webiny/utils");
|
|
15
|
+
var _PageBlocksPermissions = require("@webiny/api-page-builder/graphql/crud/permissions/PageBlocksPermissions");
|
|
16
|
+
const EXPORT_BLOCKS_FOLDER_KEY = "WEBINY_PB_EXPORT_BLOCK";
|
|
18
17
|
const EXPORT_BLOCKS_PROCESS_HANDLER = process.env.EXPORT_PROCESS_HANDLER;
|
|
19
18
|
const IMPORT_BLOCKS_CREATE_HANDLER = process.env.IMPORT_CREATE_HANDLER;
|
|
20
|
-
var _default = new _api.ContextPlugin(context => {
|
|
19
|
+
var _default = exports.default = new _api.ContextPlugin(context => {
|
|
20
|
+
const pageBlocksPermissions = new _PageBlocksPermissions.PageBlocksPermissions({
|
|
21
|
+
getPermissions: () => context.security.getPermissions("pb.block"),
|
|
22
|
+
getIdentity: context.security.getIdentity,
|
|
23
|
+
fullAccessPermissionName: "pb.*"
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Export
|
|
27
|
+
const onBlocksBeforeExport = (0, _pubsub.createTopic)("PageBuilder.onBlocksBeforeExport");
|
|
28
|
+
const onBlocksAfterExport = (0, _pubsub.createTopic)("PageBuilder.onBlocksAfterExport");
|
|
29
|
+
|
|
30
|
+
// Import
|
|
31
|
+
const onBlocksBeforeImport = (0, _pubsub.createTopic)("PageBuilder.onBlocksBeforeImport");
|
|
32
|
+
const onBlocksAfterImport = (0, _pubsub.createTopic)("PageBuilder.onBlocksAfterImport");
|
|
21
33
|
const importExportCrud = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
onBlocksBeforeExport,
|
|
35
|
+
onBlocksAfterExport,
|
|
36
|
+
onBlocksBeforeImport,
|
|
37
|
+
onBlocksAfterImport,
|
|
38
|
+
async importBlocks(params) {
|
|
39
|
+
const {
|
|
40
|
+
zipFileUrl
|
|
41
|
+
} = params;
|
|
42
|
+
await pageBlocksPermissions.ensure({
|
|
27
43
|
rwd: "w"
|
|
28
44
|
});
|
|
29
45
|
|
|
30
|
-
// Bail out early if category not found
|
|
31
|
-
const category = await context.pageBuilder.getBlockCategory(categorySlug);
|
|
32
|
-
if (!category) {
|
|
33
|
-
throw new _handlerGraphql.NotFoundError(`Category with slug "${categorySlug}" not found.`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
46
|
// Create a task for import block
|
|
37
47
|
const task = await context.pageBuilder.importExportTask.createTask({
|
|
38
48
|
status: _types.ImportExportTaskStatus.PENDING,
|
|
39
49
|
input: {
|
|
40
|
-
category: categorySlug,
|
|
41
50
|
zipFileUrl
|
|
42
51
|
}
|
|
43
52
|
});
|
|
@@ -46,11 +55,13 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
46
55
|
* ImportBlocks
|
|
47
56
|
* importBlocks
|
|
48
57
|
*/
|
|
58
|
+
await onBlocksBeforeImport.publish({
|
|
59
|
+
params
|
|
60
|
+
});
|
|
49
61
|
await (0, _client.invokeHandlerClient)({
|
|
50
62
|
context,
|
|
51
63
|
name: IMPORT_BLOCKS_CREATE_HANDLER,
|
|
52
64
|
payload: {
|
|
53
|
-
category: categorySlug,
|
|
54
65
|
zipFileUrl,
|
|
55
66
|
task,
|
|
56
67
|
type: "block",
|
|
@@ -58,26 +69,29 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
58
69
|
},
|
|
59
70
|
description: "Import Blocks - create"
|
|
60
71
|
});
|
|
72
|
+
await onBlocksAfterImport.publish({
|
|
73
|
+
params
|
|
74
|
+
});
|
|
61
75
|
return {
|
|
62
76
|
task
|
|
63
77
|
};
|
|
64
78
|
},
|
|
65
|
-
async exportBlocks({
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
79
|
+
async exportBlocks(params) {
|
|
80
|
+
const {
|
|
81
|
+
ids: initialBlockIds,
|
|
82
|
+
where
|
|
83
|
+
} = params;
|
|
84
|
+
await pageBlocksPermissions.ensure({
|
|
70
85
|
rwd: "w"
|
|
71
86
|
});
|
|
72
87
|
let blockIds = initialBlockIds || [];
|
|
73
88
|
// If no ids are provided then it means we want to export all blocks
|
|
74
89
|
if (!initialBlockIds || Array.isArray(initialBlockIds) && initialBlockIds.length === 0) {
|
|
75
|
-
blockIds = [];
|
|
76
90
|
const blocks = await context.pageBuilder.listPageBlocks({
|
|
77
91
|
where
|
|
78
92
|
});
|
|
79
93
|
// Save block ids
|
|
80
|
-
blocks.
|
|
94
|
+
blockIds = blocks.map(block => block.id);
|
|
81
95
|
}
|
|
82
96
|
if (blockIds.length === 0) {
|
|
83
97
|
throw new _error.default("Cannot export blocks - no blocks found for provided inputs.", "EMPTY_EXPORT_NO_BLOCKS_FOUND");
|
|
@@ -87,12 +101,12 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
87
101
|
const task = await context.pageBuilder.importExportTask.createTask({
|
|
88
102
|
status: _types.ImportExportTaskStatus.PENDING
|
|
89
103
|
});
|
|
90
|
-
const exportBlocksDataKey = `${
|
|
104
|
+
const exportBlocksDataKey = `${EXPORT_BLOCKS_FOLDER_KEY}/${task.id}`;
|
|
91
105
|
// For each block create a sub task and invoke the process handler.
|
|
92
106
|
for (let i = 0; i < blockIds.length; i++) {
|
|
93
107
|
const blockId = blockIds[i];
|
|
94
108
|
// Create sub task.
|
|
95
|
-
await context.pageBuilder.importExportTask.createSubTask(task.id, (0,
|
|
109
|
+
await context.pageBuilder.importExportTask.createSubTask(task.id, (0, _utils2.zeroPad)(i + 1, 5), {
|
|
96
110
|
status: _types.ImportExportTaskStatus.PENDING,
|
|
97
111
|
input: {
|
|
98
112
|
blockId,
|
|
@@ -114,6 +128,9 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
114
128
|
* ExportBlocks
|
|
115
129
|
* exportBlocks
|
|
116
130
|
*/
|
|
131
|
+
await onBlocksBeforeExport.publish({
|
|
132
|
+
params
|
|
133
|
+
});
|
|
117
134
|
// Invoke handler.
|
|
118
135
|
await (0, _client.invokeHandlerClient)({
|
|
119
136
|
context,
|
|
@@ -126,6 +143,9 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
126
143
|
},
|
|
127
144
|
description: "Export blocks - process"
|
|
128
145
|
});
|
|
146
|
+
await onBlocksAfterExport.publish({
|
|
147
|
+
params
|
|
148
|
+
});
|
|
129
149
|
return {
|
|
130
150
|
task
|
|
131
151
|
};
|
|
@@ -134,4 +154,5 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
134
154
|
// Modify context
|
|
135
155
|
context.pageBuilder.blocks = importExportCrud;
|
|
136
156
|
});
|
|
137
|
-
|
|
157
|
+
|
|
158
|
+
//# sourceMappingURL=blocks.crud.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PERMISSION_NAME","EXPORT_BLOCKS_PROCESS_HANDLER","process","env","EXPORT_PROCESS_HANDLER","IMPORT_BLOCKS_CREATE_HANDLER","IMPORT_CREATE_HANDLER","ContextPlugin","context","importExportCrud","importBlocks","category","categorySlug","zipFileUrl","checkBasePermissions","rwd","pageBuilder","getBlockCategory","NotFoundError","task","importExportTask","createTask","status","ImportExportTaskStatus","PENDING","input","invokeHandlerClient","name","payload","type","identity","security","getIdentity","description","exportBlocks","ids","initialBlockIds","where","blockIds","Array","isArray","length","blocks","listPageBlocks","forEach","block","push","id","WebinyError","exportBlocksDataKey","EXPORT_BLOCKS_FOLDER_KEY","i","blockId","createSubTask","zeroPad","updateTask","PROCESSING","stats","initialStats","taskId","subTaskIndex"],"sources":["blocks.crud.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport checkBasePermissions from \"@webiny/api-page-builder/graphql/crud/utils/checkBasePermissions\";\nimport { ImportExportTaskStatus, BlocksImportExportCrud, PbImportExportContext } from \"~/types\";\nimport { invokeHandlerClient } from \"~/client\";\nimport { Payload as CreateHandlerPayload } from \"~/import/create\";\nimport { initialStats } from \"~/import/utils\";\nimport { Payload as ExportBlocksProcessHandlerPayload } from \"~/export/process\";\nimport { EXPORT_BLOCKS_FOLDER_KEY } from \"~/export/utils\";\nimport { zeroPad } from \"@webiny/utils\";\n\nconst PERMISSION_NAME = \"pb.block\";\nconst EXPORT_BLOCKS_PROCESS_HANDLER = process.env.EXPORT_PROCESS_HANDLER as string;\nconst IMPORT_BLOCKS_CREATE_HANDLER = process.env.IMPORT_CREATE_HANDLER as string;\n\nexport default new ContextPlugin<PbImportExportContext>(context => {\n const importExportCrud: BlocksImportExportCrud = {\n async importBlocks({ category: categorySlug, zipFileUrl }) {\n await checkBasePermissions(context, PERMISSION_NAME, {\n rwd: \"w\"\n });\n\n // Bail out early if category not found\n const category = await context.pageBuilder.getBlockCategory(categorySlug);\n if (!category) {\n throw new NotFoundError(`Category with slug \"${categorySlug}\" not found.`);\n }\n\n // Create a task for import block\n const task = await context.pageBuilder.importExportTask.createTask({\n status: ImportExportTaskStatus.PENDING,\n input: {\n category: categorySlug,\n zipFileUrl\n }\n });\n /**\n * Import Blocks\n * ImportBlocks\n * importBlocks\n */\n await invokeHandlerClient<CreateHandlerPayload>({\n context,\n name: IMPORT_BLOCKS_CREATE_HANDLER,\n payload: {\n category: categorySlug,\n zipFileUrl,\n task,\n type: \"block\",\n identity: context.security.getIdentity()\n },\n description: \"Import Blocks - create\"\n });\n\n return {\n task\n };\n },\n\n async exportBlocks({ ids: initialBlockIds, where }) {\n await checkBasePermissions(context, PERMISSION_NAME, {\n rwd: \"w\"\n });\n let blockIds: string[] = initialBlockIds || [];\n // If no ids are provided then it means we want to export all blocks\n if (\n !initialBlockIds ||\n (Array.isArray(initialBlockIds) && initialBlockIds.length === 0)\n ) {\n blockIds = [];\n const blocks = await context.pageBuilder.listPageBlocks({ where });\n // Save block ids\n blocks.forEach(block => blockIds.push(block.id));\n }\n\n if (blockIds.length === 0) {\n throw new WebinyError(\n \"Cannot export blocks - no blocks found for provided inputs.\",\n \"EMPTY_EXPORT_NO_BLOCKS_FOUND\"\n );\n }\n\n // Create the main task for blocks export.\n const task = await context.pageBuilder.importExportTask.createTask({\n status: ImportExportTaskStatus.PENDING\n });\n const exportBlocksDataKey = `${EXPORT_BLOCKS_FOLDER_KEY}/${task.id}`;\n // For each block create a sub task and invoke the process handler.\n for (let i = 0; i < blockIds.length; i++) {\n const blockId = blockIds[i];\n // Create sub task.\n await context.pageBuilder.importExportTask.createSubTask(\n task.id,\n zeroPad(i + 1, 5),\n {\n status: ImportExportTaskStatus.PENDING,\n input: {\n blockId,\n exportBlocksDataKey\n }\n }\n );\n }\n // Update main task status.\n await context.pageBuilder.importExportTask.updateTask(task.id, {\n status: ImportExportTaskStatus.PROCESSING,\n stats: initialStats(blockIds.length),\n input: {\n exportBlocksDataKey\n }\n });\n\n /**\n * Export Blocks\n * ExportBlocks\n * exportBlocks\n */\n // Invoke handler.\n await invokeHandlerClient<ExportBlocksProcessHandlerPayload>({\n context,\n name: EXPORT_BLOCKS_PROCESS_HANDLER,\n payload: {\n taskId: task.id,\n subTaskIndex: 1,\n type: \"block\",\n identity: context.security.getIdentity()\n },\n description: \"Export blocks - process\"\n });\n\n return { task };\n }\n };\n // Modify context\n context.pageBuilder.blocks = importExportCrud;\n});\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA,MAAMA,eAAe,GAAG,UAAU;AAClC,MAAMC,6BAA6B,GAAGC,OAAO,CAACC,GAAG,CAACC,sBAAgC;AAClF,MAAMC,4BAA4B,GAAGH,OAAO,CAACC,GAAG,CAACG,qBAA+B;AAAC,eAElE,IAAIC,kBAAa,CAAwBC,OAAO,IAAI;EAC/D,MAAMC,gBAAwC,GAAG;IAC7C,M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AAK,EAAE;UACHwB;QACJ;MACJ,CAAC,CAAC;;MAEF;AACZ;AACA;AACA;AACA;MACY;MACA,MAAM,IAAAvB,2BAAmB,EAAoC;QACzDlB,OAAO;QACPmB,IAAI,EAAE1B,6BAA6B;QACnC2B,OAAO,EAAE;UACL+B,MAAM,EAAExC,IAAI,CAAC4B,EAAE;UACfa,YAAY,EAAE,CAAC;UACf/B,IAAI,EAAE,OAAO;UACbC,QAAQ,EAAEtB,OAAO,CAACuB,QAAQ,CAACC,WAAW;QAC1C,CAAC;QACDC,WAAW,EAAE;MACjB,CAAC,CAAC;MAEF,OAAO;QAAEd;MAAK,CAAC;IACnB;EACJ,CAAC;EACD;EACAX,OAAO,CAACQ,WAAW,CAAC0B,MAAM,GAAGjC,gBAAgB;AACjD,CAAC,CAAC;AAAA"}
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_pubsub","_api","_types","_client","_utils","_utils2","_PageBlocksPermissions","EXPORT_BLOCKS_FOLDER_KEY","EXPORT_BLOCKS_PROCESS_HANDLER","process","env","EXPORT_PROCESS_HANDLER","IMPORT_BLOCKS_CREATE_HANDLER","IMPORT_CREATE_HANDLER","_default","exports","default","ContextPlugin","context","pageBlocksPermissions","PageBlocksPermissions","getPermissions","security","getIdentity","fullAccessPermissionName","onBlocksBeforeExport","createTopic","onBlocksAfterExport","onBlocksBeforeImport","onBlocksAfterImport","importExportCrud","importBlocks","params","zipFileUrl","ensure","rwd","task","pageBuilder","importExportTask","createTask","status","ImportExportTaskStatus","PENDING","input","publish","invokeHandlerClient","name","payload","type","identity","description","exportBlocks","ids","initialBlockIds","where","blockIds","Array","isArray","length","blocks","listPageBlocks","map","block","id","WebinyError","exportBlocksDataKey","i","blockId","createSubTask","zeroPad","updateTask","PROCESSING","stats","initialStats","taskId","subTaskIndex"],"sources":["blocks.crud.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport type {\n BlocksImportExportCrud,\n PbImportExportContext,\n OnBlocksBeforeExportTopicParams,\n OnBlocksAfterExportTopicParams,\n OnBlocksBeforeImportTopicParams,\n OnBlocksAfterImportTopicParams\n} from \"~/types\";\nimport { ImportExportTaskStatus } from \"~/types\";\nimport { invokeHandlerClient } from \"~/client\";\nimport type { Payload as CreateHandlerPayload } from \"~/import/create\";\nimport { initialStats } from \"~/import/utils\";\nimport type { Payload as ExportBlocksProcessHandlerPayload } from \"~/export/process\";\nimport { zeroPad } from \"@webiny/utils\";\nimport { PageBlocksPermissions } from \"@webiny/api-page-builder/graphql/crud/permissions/PageBlocksPermissions\";\n\nconst EXPORT_BLOCKS_FOLDER_KEY = \"WEBINY_PB_EXPORT_BLOCK\";\nconst EXPORT_BLOCKS_PROCESS_HANDLER = process.env.EXPORT_PROCESS_HANDLER as string;\nconst IMPORT_BLOCKS_CREATE_HANDLER = process.env.IMPORT_CREATE_HANDLER as string;\n\nexport default new ContextPlugin<PbImportExportContext>(context => {\n const pageBlocksPermissions = new PageBlocksPermissions({\n getPermissions: () => context.security.getPermissions(\"pb.block\"),\n getIdentity: context.security.getIdentity,\n fullAccessPermissionName: \"pb.*\"\n });\n\n // Export\n const onBlocksBeforeExport = createTopic<OnBlocksBeforeExportTopicParams>(\n \"PageBuilder.onBlocksBeforeExport\"\n );\n const onBlocksAfterExport = createTopic<OnBlocksAfterExportTopicParams>(\n \"PageBuilder.onBlocksAfterExport\"\n );\n\n // Import\n const onBlocksBeforeImport = createTopic<OnBlocksBeforeImportTopicParams>(\n \"PageBuilder.onBlocksBeforeImport\"\n );\n const onBlocksAfterImport = createTopic<OnBlocksAfterImportTopicParams>(\n \"PageBuilder.onBlocksAfterImport\"\n );\n\n const importExportCrud: BlocksImportExportCrud = {\n onBlocksBeforeExport,\n onBlocksAfterExport,\n onBlocksBeforeImport,\n onBlocksAfterImport,\n async importBlocks(params) {\n const { zipFileUrl } = params;\n await pageBlocksPermissions.ensure({ rwd: \"w\" });\n\n // Create a task for import block\n const task = await context.pageBuilder.importExportTask.createTask({\n status: ImportExportTaskStatus.PENDING,\n input: {\n zipFileUrl\n }\n });\n /**\n * Import Blocks\n * ImportBlocks\n * importBlocks\n */\n await onBlocksBeforeImport.publish({ params });\n await invokeHandlerClient<CreateHandlerPayload>({\n context,\n name: IMPORT_BLOCKS_CREATE_HANDLER,\n payload: {\n zipFileUrl,\n task,\n type: \"block\",\n identity: context.security.getIdentity()\n },\n description: \"Import Blocks - create\"\n });\n await onBlocksAfterImport.publish({ params });\n\n return {\n task\n };\n },\n\n async exportBlocks(params) {\n const { ids: initialBlockIds, where } = params;\n await pageBlocksPermissions.ensure({ rwd: \"w\" });\n\n let blockIds: string[] = initialBlockIds || [];\n // If no ids are provided then it means we want to export all blocks\n if (\n !initialBlockIds ||\n (Array.isArray(initialBlockIds) && initialBlockIds.length === 0)\n ) {\n const blocks = await context.pageBuilder.listPageBlocks({ where });\n // Save block ids\n blockIds = blocks.map(block => block.id);\n }\n\n if (blockIds.length === 0) {\n throw new WebinyError(\n \"Cannot export blocks - no blocks found for provided inputs.\",\n \"EMPTY_EXPORT_NO_BLOCKS_FOUND\"\n );\n }\n\n // Create the main task for blocks export.\n const task = await context.pageBuilder.importExportTask.createTask({\n status: ImportExportTaskStatus.PENDING\n });\n const exportBlocksDataKey = `${EXPORT_BLOCKS_FOLDER_KEY}/${task.id}`;\n // For each block create a sub task and invoke the process handler.\n for (let i = 0; i < blockIds.length; i++) {\n const blockId = blockIds[i];\n // Create sub task.\n await context.pageBuilder.importExportTask.createSubTask(\n task.id,\n zeroPad(i + 1, 5),\n {\n status: ImportExportTaskStatus.PENDING,\n input: {\n blockId,\n exportBlocksDataKey\n }\n }\n );\n }\n // Update main task status.\n await context.pageBuilder.importExportTask.updateTask(task.id, {\n status: ImportExportTaskStatus.PROCESSING,\n stats: initialStats(blockIds.length),\n input: {\n exportBlocksDataKey\n }\n });\n\n /**\n * Export Blocks\n * ExportBlocks\n * exportBlocks\n */\n await onBlocksBeforeExport.publish({ params });\n // Invoke handler.\n await invokeHandlerClient<ExportBlocksProcessHandlerPayload>({\n context,\n name: EXPORT_BLOCKS_PROCESS_HANDLER,\n payload: {\n taskId: task.id,\n subTaskIndex: 1,\n type: \"block\",\n identity: context.security.getIdentity()\n },\n description: \"Export blocks - process\"\n });\n await onBlocksAfterExport.publish({ params });\n\n return { task };\n }\n };\n // Modify context\n context.pageBuilder.blocks = importExportCrud;\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AASA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAEA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,sBAAA,GAAAP,OAAA;AAEA,MAAMQ,wBAAwB,GAAG,wBAAwB;AACzD,MAAMC,6BAA6B,GAAGC,OAAO,CAACC,GAAG,CAACC,sBAAgC;AAClF,MAAMC,4BAA4B,GAAGH,OAAO,CAACC,GAAG,CAACG,qBAA+B;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAElE,IAAIC,kBAAa,CAAwBC,OAAO,IAAI;EAC/D,MAAMC,qBAAqB,GAAG,IAAIC,4CAAqB,CAAC;IACpDC,cAAc,EAAEA,CAAA,KAAMH,OAAO,CAACI,QAAQ,CAACD,cAAc,CAAC,UAAU,CAAC;IACjEE,WAAW,EAAEL,OAAO,CAACI,QAAQ,CAACC,WAAW;IACzCC,wBAAwB,EAAE;EAC9B,CAAC,CAAC;;EAEF;EACA,MAAMC,oBAAoB,GAAG,IAAAC,mBAAW,EACpC,kCACJ,CAAC;EACD,MAAMC,mBAAmB,GAAG,IAAAD,mBAAW,EACnC,iCACJ,CAAC;;EAED;EACA,MAAME,oBAAoB,GAAG,IAAAF,mBAAW,EACpC,kCACJ,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AAQ,CAACG,MAAM,CAAC;QACpCf,KAAK,EAAE;UACHsB;QACJ;MACJ,CAAC,CAAC;;MAEF;AACZ;AACA;AACA;AACA;MACY,MAAMxC,oBAAoB,CAACmB,OAAO,CAAC;QAAEZ;MAAO,CAAC,CAAC;MAC9C;MACA,MAAM,IAAAa,2BAAmB,EAAoC;QACzD3B,OAAO;QACP4B,IAAI,EAAEtC,6BAA6B;QACnCuC,OAAO,EAAE;UACL2B,MAAM,EAAEtC,IAAI,CAAC2B,EAAE;UACfY,YAAY,EAAE,CAAC;UACf3B,IAAI,EAAE,OAAO;UACbC,QAAQ,EAAE/B,OAAO,CAACI,QAAQ,CAACC,WAAW,CAAC;QAC3C,CAAC;QACD2B,WAAW,EAAE;MACjB,CAAC,CAAC;MACF,MAAMvB,mBAAmB,CAACiB,OAAO,CAAC;QAAEZ;MAAO,CAAC,CAAC;MAE7C,OAAO;QAAEI;MAAK,CAAC;IACnB;EACJ,CAAC;EACD;EACAlB,OAAO,CAACmB,WAAW,CAACsB,MAAM,GAAG7B,gBAAgB;AACjD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -6,22 +6,41 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
+
var _pubsub = require("@webiny/pubsub");
|
|
9
10
|
var _api = require("@webiny/api");
|
|
10
|
-
var _utils = require("@webiny/api-form-builder/plugins/crud/utils");
|
|
11
11
|
var _types = require("../../types");
|
|
12
12
|
var _client = require("../../client");
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
13
|
+
var _utils = require("../../import/utils");
|
|
14
|
+
var _utils2 = require("@webiny/utils");
|
|
15
|
+
var _FormsPermissions = require("@webiny/api-form-builder/plugins/crud/permissions/FormsPermissions");
|
|
16
|
+
const EXPORT_FORMS_FOLDER_KEY = "WEBINY_FB_EXPORT_FORM";
|
|
16
17
|
const EXPORT_FORMS_PROCESS_HANDLER = process.env.EXPORT_PROCESS_HANDLER;
|
|
17
18
|
const IMPORT_FORMS_CREATE_HANDLER = process.env.IMPORT_CREATE_HANDLER;
|
|
18
|
-
var _default = new _api.ContextPlugin(context => {
|
|
19
|
+
var _default = exports.default = new _api.ContextPlugin(context => {
|
|
20
|
+
const formsPermissions = new _FormsPermissions.FormsPermissions({
|
|
21
|
+
getPermissions: () => context.security.getPermissions("fb.form"),
|
|
22
|
+
getIdentity: context.security.getIdentity,
|
|
23
|
+
fullAccessPermissionName: "pb.*"
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Export
|
|
27
|
+
const onFormsBeforeExport = (0, _pubsub.createTopic)("PageBuilder.onFormsBeforeExport");
|
|
28
|
+
const onFormsAfterExport = (0, _pubsub.createTopic)("PageBuilder.onFormsAfterExport");
|
|
29
|
+
|
|
30
|
+
// Import
|
|
31
|
+
const onFormsBeforeImport = (0, _pubsub.createTopic)("PageBuilder.onFormsBeforeImport");
|
|
32
|
+
const onFormsAfterImport = (0, _pubsub.createTopic)("PageBuilder.onFormsAfterImport");
|
|
19
33
|
context.waitFor("formBuilder", () => {
|
|
20
34
|
const importExportCrud = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
35
|
+
onFormsBeforeExport,
|
|
36
|
+
onFormsAfterExport,
|
|
37
|
+
onFormsBeforeImport,
|
|
38
|
+
onFormsAfterImport,
|
|
39
|
+
async importForms(params) {
|
|
40
|
+
const {
|
|
41
|
+
zipFileUrl
|
|
42
|
+
} = params;
|
|
43
|
+
await formsPermissions.ensure({
|
|
25
44
|
rwd: "w"
|
|
26
45
|
});
|
|
27
46
|
|
|
@@ -37,6 +56,9 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
37
56
|
* ImportForms
|
|
38
57
|
* importForms
|
|
39
58
|
*/
|
|
59
|
+
await onFormsBeforeImport.publish({
|
|
60
|
+
params
|
|
61
|
+
});
|
|
40
62
|
await (0, _client.invokeHandlerClient)({
|
|
41
63
|
context,
|
|
42
64
|
name: IMPORT_FORMS_CREATE_HANDLER,
|
|
@@ -48,15 +70,19 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
48
70
|
},
|
|
49
71
|
description: "Import Forms - create"
|
|
50
72
|
});
|
|
73
|
+
await onFormsAfterImport.publish({
|
|
74
|
+
params
|
|
75
|
+
});
|
|
51
76
|
return {
|
|
52
77
|
task
|
|
53
78
|
};
|
|
54
79
|
},
|
|
55
|
-
async exportForms({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
80
|
+
async exportForms(params) {
|
|
81
|
+
const {
|
|
82
|
+
ids: initialFormIds,
|
|
83
|
+
revisionType
|
|
84
|
+
} = params;
|
|
85
|
+
await formsPermissions.ensure({
|
|
60
86
|
rwd: "w"
|
|
61
87
|
});
|
|
62
88
|
let formIds = initialFormIds || [];
|
|
@@ -76,12 +102,12 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
76
102
|
const task = await context.pageBuilder.importExportTask.createTask({
|
|
77
103
|
status: _types.ImportExportTaskStatus.PENDING
|
|
78
104
|
});
|
|
79
|
-
const exportFormsDataKey = `${
|
|
105
|
+
const exportFormsDataKey = `${EXPORT_FORMS_FOLDER_KEY}/${task.id}`;
|
|
80
106
|
// For each form create a sub task and invoke the process handler.
|
|
81
107
|
for (let i = 0; i < formIds.length; i++) {
|
|
82
108
|
const formId = formIds[i];
|
|
83
109
|
// Create sub task.
|
|
84
|
-
await context.pageBuilder.importExportTask.createSubTask(task.id, (0,
|
|
110
|
+
await context.pageBuilder.importExportTask.createSubTask(task.id, (0, _utils2.zeroPad)(i + 1, 5), {
|
|
85
111
|
status: _types.ImportExportTaskStatus.PENDING,
|
|
86
112
|
input: {
|
|
87
113
|
formId,
|
|
@@ -93,7 +119,7 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
93
119
|
// Update main task status.
|
|
94
120
|
await context.pageBuilder.importExportTask.updateTask(task.id, {
|
|
95
121
|
status: _types.ImportExportTaskStatus.PROCESSING,
|
|
96
|
-
stats: (0,
|
|
122
|
+
stats: (0, _utils.initialStats)(formIds.length),
|
|
97
123
|
input: {
|
|
98
124
|
exportFormsDataKey,
|
|
99
125
|
revisionType
|
|
@@ -105,6 +131,9 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
105
131
|
* ExportForms
|
|
106
132
|
* exportForms
|
|
107
133
|
*/
|
|
134
|
+
await onFormsBeforeExport.publish({
|
|
135
|
+
params
|
|
136
|
+
});
|
|
108
137
|
// Invoke handler.
|
|
109
138
|
await (0, _client.invokeHandlerClient)({
|
|
110
139
|
context,
|
|
@@ -117,6 +146,9 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
117
146
|
},
|
|
118
147
|
description: "Export forms - process"
|
|
119
148
|
});
|
|
149
|
+
await onFormsAfterExport.publish({
|
|
150
|
+
params
|
|
151
|
+
});
|
|
120
152
|
return {
|
|
121
153
|
task
|
|
122
154
|
};
|
|
@@ -126,4 +158,5 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
126
158
|
context.formBuilder.forms = importExportCrud;
|
|
127
159
|
});
|
|
128
160
|
});
|
|
129
|
-
|
|
161
|
+
|
|
162
|
+
//# sourceMappingURL=forms.crud.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["EXPORT_FORMS_PROCESS_HANDLER","process","env","EXPORT_PROCESS_HANDLER","IMPORT_FORMS_CREATE_HANDLER","IMPORT_CREATE_HANDLER","ContextPlugin","context","waitFor","importExportCrud","importForms","zipFileUrl","checkBaseFormPermissions","rwd","task","pageBuilder","importExportTask","createTask","status","ImportExportTaskStatus","PENDING","input","invokeHandlerClient","name","payload","type","identity","security","getIdentity","description","exportForms","ids","initialFormIds","revisionType","formIds","Array","isArray","length","forms","formBuilder","listForms","forEach","form","push","id","WebinyError","exportFormsDataKey","EXPORT_FORMS_FOLDER_KEY","i","formId","createSubTask","zeroPad","updateTask","PROCESSING","stats","initialStats","taskId","subTaskIndex"],"sources":["forms.crud.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { checkBaseFormPermissions } from \"@webiny/api-form-builder/plugins/crud/utils\";\nimport { ImportExportTaskStatus, FormsImportExportCrud, PbImportExportContext } from \"~/types\";\nimport { invokeHandlerClient } from \"~/client\";\nimport { Payload as CreateHandlerPayload } from \"~/import/create\";\nimport { initialStats } from \"~/import/utils\";\nimport { Payload as ExportFormsProcessHandlerPayload } from \"~/export/process\";\nimport { EXPORT_FORMS_FOLDER_KEY } from \"~/export/utils\";\nimport { zeroPad } from \"@webiny/utils\";\n\nconst EXPORT_FORMS_PROCESS_HANDLER = process.env.EXPORT_PROCESS_HANDLER as string;\nconst IMPORT_FORMS_CREATE_HANDLER = process.env.IMPORT_CREATE_HANDLER as string;\n\nexport default new ContextPlugin<PbImportExportContext>(context => {\n context.waitFor(\"formBuilder\", () => {\n const importExportCrud: FormsImportExportCrud = {\n async importForms({ zipFileUrl }) {\n await checkBaseFormPermissions(context, {\n rwd: \"w\"\n });\n\n // Create a task for import form\n const task = await context.pageBuilder.importExportTask.createTask({\n status: ImportExportTaskStatus.PENDING,\n input: {\n zipFileUrl\n }\n });\n /**\n * Import Forms\n * ImportForms\n * importForms\n */\n await invokeHandlerClient<CreateHandlerPayload>({\n context,\n name: IMPORT_FORMS_CREATE_HANDLER,\n payload: {\n zipFileUrl,\n task,\n type: \"form\",\n identity: context.security.getIdentity()\n },\n description: \"Import Forms - create\"\n });\n\n return {\n task\n };\n },\n\n async exportForms({ ids: initialFormIds, revisionType }) {\n await checkBaseFormPermissions(context, {\n rwd: \"w\"\n });\n let formIds: string[] = initialFormIds || [];\n // If no ids are provided then it means we want to export all forms\n if (\n !initialFormIds ||\n (Array.isArray(initialFormIds) && initialFormIds.length === 0)\n ) {\n formIds = [];\n\n const forms = await context.formBuilder.listForms();\n\n // Save form ids\n forms.forEach(form => formIds.push(form.id));\n }\n\n if (formIds.length === 0) {\n throw new WebinyError(\n \"Cannot export forms - no forms found for provided inputs.\",\n \"EMPTY_EXPORT_NO_FORMS_FOUND\"\n );\n }\n\n // Create the main task for form export.\n const task = await context.pageBuilder.importExportTask.createTask({\n status: ImportExportTaskStatus.PENDING\n });\n const exportFormsDataKey = `${EXPORT_FORMS_FOLDER_KEY}/${task.id}`;\n // For each form create a sub task and invoke the process handler.\n for (let i = 0; i < formIds.length; i++) {\n const formId = formIds[i];\n // Create sub task.\n await context.pageBuilder.importExportTask.createSubTask(\n task.id,\n zeroPad(i + 1, 5),\n {\n status: ImportExportTaskStatus.PENDING,\n input: {\n formId,\n exportFormsDataKey,\n revisionType\n }\n }\n );\n }\n // Update main task status.\n await context.pageBuilder.importExportTask.updateTask(task.id, {\n status: ImportExportTaskStatus.PROCESSING,\n stats: initialStats(formIds.length),\n input: {\n exportFormsDataKey,\n revisionType\n }\n });\n\n /**\n * Export Forms\n * ExportForms\n * exportForms\n */\n // Invoke handler.\n await invokeHandlerClient<ExportFormsProcessHandlerPayload>({\n context,\n name: EXPORT_FORMS_PROCESS_HANDLER,\n payload: {\n taskId: task.id,\n subTaskIndex: 1,\n type: \"form\",\n identity: context.security.getIdentity()\n },\n description: \"Export forms - process\"\n });\n\n return { task };\n }\n };\n // Modify context\n context.formBuilder.forms = importExportCrud;\n });\n});\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA,MAAMA,4BAA4B,GAAGC,OAAO,CAACC,GAAG,CAACC,sBAAgC;AACjF,MAAMC,2BAA2B,GAAGH,OAAO,CAACC,GAAG,CAACG,qBAA+B;AAAC,eAEjE,IAAIC,kBAAa,CAAwBC,OAAO,IAAI;EAC/DA,OAAO,CAACC,OAAO,CAAC,aAAa,EAAE,MAAM;IACjC,MAAMC,gBAAuC,GAAG;MAC5C,MAAMC,WAAW,CAAC;QAAEC;MAAW,CAAC,EAAE;QAC9B,MAAM,IAAAC,+BAAwB,EAACL,OAAO,EAA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Ef;QAAK,CAAC;MACnB;IACJ,CAAC;IACD;IACAP,OAAO,CAACgC,WAAW,CAACD,KAAK,GAAG7B,gBAAgB;EAChD,CAAC,CAAC;AACN,CAAC,CAAC;AAAA"}
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_pubsub","_api","_types","_client","_utils","_utils2","_FormsPermissions","EXPORT_FORMS_FOLDER_KEY","EXPORT_FORMS_PROCESS_HANDLER","process","env","EXPORT_PROCESS_HANDLER","IMPORT_FORMS_CREATE_HANDLER","IMPORT_CREATE_HANDLER","_default","exports","default","ContextPlugin","context","formsPermissions","FormsPermissions","getPermissions","security","getIdentity","fullAccessPermissionName","onFormsBeforeExport","createTopic","onFormsAfterExport","onFormsBeforeImport","onFormsAfterImport","waitFor","importExportCrud","importForms","params","zipFileUrl","ensure","rwd","task","pageBuilder","importExportTask","createTask","status","ImportExportTaskStatus","PENDING","input","publish","invokeHandlerClient","name","payload","type","identity","description","exportForms","ids","initialFormIds","revisionType","formIds","Array","isArray","length","forms","formBuilder","listForms","forEach","form","push","id","WebinyError","exportFormsDataKey","i","formId","createSubTask","zeroPad","updateTask","PROCESSING","stats","initialStats","taskId","subTaskIndex"],"sources":["forms.crud.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport type {\n FormsImportExportCrud,\n PbImportExportContext,\n OnFormsBeforeExportTopicParams,\n OnFormsAfterExportTopicParams,\n OnFormsBeforeImportTopicParams,\n OnFormsAfterImportTopicParams\n} from \"~/types\";\nimport { ImportExportTaskStatus } from \"~/types\";\nimport { invokeHandlerClient } from \"~/client\";\nimport type { Payload as CreateHandlerPayload } from \"~/import/create\";\nimport { initialStats } from \"~/import/utils\";\nimport type { Payload as ExportFormsProcessHandlerPayload } from \"~/export/process\";\nimport { zeroPad } from \"@webiny/utils\";\nimport { FormsPermissions } from \"@webiny/api-form-builder/plugins/crud/permissions/FormsPermissions\";\n\nconst EXPORT_FORMS_FOLDER_KEY = \"WEBINY_FB_EXPORT_FORM\";\nconst EXPORT_FORMS_PROCESS_HANDLER = process.env.EXPORT_PROCESS_HANDLER as string;\nconst IMPORT_FORMS_CREATE_HANDLER = process.env.IMPORT_CREATE_HANDLER as string;\n\nexport default new ContextPlugin<PbImportExportContext>(context => {\n const formsPermissions = new FormsPermissions({\n getPermissions: () => context.security.getPermissions(\"fb.form\"),\n getIdentity: context.security.getIdentity,\n fullAccessPermissionName: \"pb.*\"\n });\n\n // Export\n const onFormsBeforeExport = createTopic<OnFormsBeforeExportTopicParams>(\n \"PageBuilder.onFormsBeforeExport\"\n );\n const onFormsAfterExport = createTopic<OnFormsAfterExportTopicParams>(\n \"PageBuilder.onFormsAfterExport\"\n );\n\n // Import\n const onFormsBeforeImport = createTopic<OnFormsBeforeImportTopicParams>(\n \"PageBuilder.onFormsBeforeImport\"\n );\n const onFormsAfterImport = createTopic<OnFormsAfterImportTopicParams>(\n \"PageBuilder.onFormsAfterImport\"\n );\n\n context.waitFor(\"formBuilder\", () => {\n const importExportCrud: FormsImportExportCrud = {\n onFormsBeforeExport,\n onFormsAfterExport,\n onFormsBeforeImport,\n onFormsAfterImport,\n async importForms(params) {\n const { zipFileUrl } = params;\n await formsPermissions.ensure({ rwd: \"w\" });\n\n // Create a task for import form\n const task = await context.pageBuilder.importExportTask.createTask({\n status: ImportExportTaskStatus.PENDING,\n input: {\n zipFileUrl\n }\n });\n /**\n * Import Forms\n * ImportForms\n * importForms\n */\n await onFormsBeforeImport.publish({ params });\n await invokeHandlerClient<CreateHandlerPayload>({\n context,\n name: IMPORT_FORMS_CREATE_HANDLER,\n payload: {\n zipFileUrl,\n task,\n type: \"form\",\n identity: context.security.getIdentity()\n },\n description: \"Import Forms - create\"\n });\n await onFormsAfterImport.publish({ params });\n\n return {\n task\n };\n },\n\n async exportForms(params) {\n const { ids: initialFormIds, revisionType } = params;\n await formsPermissions.ensure({ rwd: \"w\" });\n let formIds: string[] = initialFormIds || [];\n // If no ids are provided then it means we want to export all forms\n if (\n !initialFormIds ||\n (Array.isArray(initialFormIds) && initialFormIds.length === 0)\n ) {\n formIds = [];\n\n const forms = await context.formBuilder.listForms();\n\n // Save form ids\n forms.forEach(form => formIds.push(form.id));\n }\n\n if (formIds.length === 0) {\n throw new WebinyError(\n \"Cannot export forms - no forms found for provided inputs.\",\n \"EMPTY_EXPORT_NO_FORMS_FOUND\"\n );\n }\n\n // Create the main task for form export.\n const task = await context.pageBuilder.importExportTask.createTask({\n status: ImportExportTaskStatus.PENDING\n });\n const exportFormsDataKey = `${EXPORT_FORMS_FOLDER_KEY}/${task.id}`;\n // For each form create a sub task and invoke the process handler.\n for (let i = 0; i < formIds.length; i++) {\n const formId = formIds[i];\n // Create sub task.\n await context.pageBuilder.importExportTask.createSubTask(\n task.id,\n zeroPad(i + 1, 5),\n {\n status: ImportExportTaskStatus.PENDING,\n input: {\n formId,\n exportFormsDataKey,\n revisionType\n }\n }\n );\n }\n // Update main task status.\n await context.pageBuilder.importExportTask.updateTask(task.id, {\n status: ImportExportTaskStatus.PROCESSING,\n stats: initialStats(formIds.length),\n input: {\n exportFormsDataKey,\n revisionType\n }\n });\n\n /**\n * Export Forms\n * ExportForms\n * exportForms\n */\n await onFormsBeforeExport.publish({ params });\n // Invoke handler.\n await invokeHandlerClient<ExportFormsProcessHandlerPayload>({\n context,\n name: EXPORT_FORMS_PROCESS_HANDLER,\n payload: {\n taskId: task.id,\n subTaskIndex: 1,\n type: \"form\",\n identity: context.security.getIdentity()\n },\n description: \"Export forms - process\"\n });\n await onFormsAfterExport.publish({ params });\n\n return { task };\n }\n };\n // Modify context\n context.formBuilder.forms = importExportCrud;\n });\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AASA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA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,EAAE,MAAM;YACZC,QAAQ,EAAEhC,OAAO,CAACI,QAAQ,CAACC,WAAW,CAAC;UAC3C,CAAC;UACD4B,WAAW,EAAE;QACjB,CAAC,CAAC;QACF,MAAMxB,kBAAkB,CAACkB,OAAO,CAAC;UAAEZ;QAAO,CAAC,CAAC;QAE5C,OAAO;UAAEI;QAAK,CAAC;MACnB;IACJ,CAAC;IACD;IACAnB,OAAO,CAAC2C,WAAW,CAACD,KAAK,GAAG7B,gBAAgB;EAChD,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContextPlugin } from "@webiny/api";
|
|
2
|
-
import { ImportExportPluginsParams } from "../../types";
|
|
3
|
-
import { PbImportExportContext } from "../types";
|
|
2
|
+
import type { ImportExportPluginsParams } from "../../types";
|
|
3
|
+
import type { PbImportExportContext } from "../types";
|
|
4
4
|
declare const _default: ({ storageOperations }: ImportExportPluginsParams) => ContextPlugin<PbImportExportContext>;
|
|
5
5
|
export default _default;
|