@webiny/api-page-builder-import-export 0.0.0-unstable.99666aeb00 → 0.0.0-unstable.9bd236cf5e
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 +5 -3
- 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 +5 -3
- 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 +18 -43
- 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 +41 -23
- package/graphql/crud/blocks.crud.js.map +1 -1
- package/graphql/crud/forms.crud.d.ts +1 -1
- package/graphql/crud/forms.crud.js +41 -13
- package/graphql/crud/forms.crud.js.map +1 -1
- package/graphql/crud/importExportTasks.crud.d.ts +2 -2
- package/graphql/crud/importExportTasks.crud.js +108 -79
- package/graphql/crud/importExportTasks.crud.js.map +1 -1
- package/graphql/crud/pages.crud.d.ts +1 -1
- package/graphql/crud/pages.crud.js +230 -117
- package/graphql/crud/pages.crud.js.map +1 -1
- package/graphql/crud/templates.crud.d.ts +1 -1
- package/graphql/crud/templates.crud.js +40 -12
- 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 +5 -3
- 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 +8 -6
- 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 +38 -29
- 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 +5 -3
- package/import/process/index.js.map +1 -1
- package/import/process/templates/importTemplate.d.ts +3 -3
- package/import/process/templates/importTemplate.js +6 -2
- 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 +54 -11
- 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 -1
- package/mockSecurity.js.map +1 -1
- package/package.json +33 -46
- 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/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/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,OAAA;AARA;;AA2Be,MAAMO,MAAM,CAAC;EACPC,aAAa,GAAG,KAAK;EACrBC,YAAY,GAAG,QAAQ;EAIxCC,WAAWA,CAACC,MAAoB,EAAE;IAC9B,IAAI,CAACA,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,eAAe,GAAG,IAAAC,eAAQ,EAC3B,GAAG,IAAI,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,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,42 +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
11
|
var _types = require("../../types");
|
|
12
12
|
var _client = require("../../client");
|
|
13
13
|
var _utils = require("../../import/utils");
|
|
14
|
-
var _utils2 = require("
|
|
15
|
-
var _utils3 = require("@webiny/utils");
|
|
14
|
+
var _utils2 = require("@webiny/utils");
|
|
16
15
|
var _PageBlocksPermissions = require("@webiny/api-page-builder/graphql/crud/permissions/PageBlocksPermissions");
|
|
16
|
+
const EXPORT_BLOCKS_FOLDER_KEY = "WEBINY_PB_EXPORT_BLOCK";
|
|
17
17
|
const EXPORT_BLOCKS_PROCESS_HANDLER = process.env.EXPORT_PROCESS_HANDLER;
|
|
18
18
|
const IMPORT_BLOCKS_CREATE_HANDLER = process.env.IMPORT_CREATE_HANDLER;
|
|
19
|
-
var _default = new _api.ContextPlugin(context => {
|
|
19
|
+
var _default = exports.default = new _api.ContextPlugin(context => {
|
|
20
20
|
const pageBlocksPermissions = new _PageBlocksPermissions.PageBlocksPermissions({
|
|
21
21
|
getPermissions: () => context.security.getPermissions("pb.block"),
|
|
22
22
|
getIdentity: context.security.getIdentity,
|
|
23
23
|
fullAccessPermissionName: "pb.*"
|
|
24
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");
|
|
25
33
|
const importExportCrud = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
onBlocksBeforeExport,
|
|
35
|
+
onBlocksAfterExport,
|
|
36
|
+
onBlocksBeforeImport,
|
|
37
|
+
onBlocksAfterImport,
|
|
38
|
+
async importBlocks(params) {
|
|
39
|
+
const {
|
|
40
|
+
zipFileUrl
|
|
41
|
+
} = params;
|
|
30
42
|
await pageBlocksPermissions.ensure({
|
|
31
43
|
rwd: "w"
|
|
32
44
|
});
|
|
33
45
|
|
|
34
|
-
// Bail out early if category not found
|
|
35
|
-
const category = await context.pageBuilder.getBlockCategory(categorySlug);
|
|
36
|
-
if (!category) {
|
|
37
|
-
throw new _handlerGraphql.NotFoundError(`Category with slug "${categorySlug}" not found.`);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
46
|
// Create a task for import block
|
|
41
47
|
const task = await context.pageBuilder.importExportTask.createTask({
|
|
42
48
|
status: _types.ImportExportTaskStatus.PENDING,
|
|
43
49
|
input: {
|
|
44
|
-
category: categorySlug,
|
|
45
50
|
zipFileUrl
|
|
46
51
|
}
|
|
47
52
|
});
|
|
@@ -50,11 +55,13 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
50
55
|
* ImportBlocks
|
|
51
56
|
* importBlocks
|
|
52
57
|
*/
|
|
58
|
+
await onBlocksBeforeImport.publish({
|
|
59
|
+
params
|
|
60
|
+
});
|
|
53
61
|
await (0, _client.invokeHandlerClient)({
|
|
54
62
|
context,
|
|
55
63
|
name: IMPORT_BLOCKS_CREATE_HANDLER,
|
|
56
64
|
payload: {
|
|
57
|
-
category: categorySlug,
|
|
58
65
|
zipFileUrl,
|
|
59
66
|
task,
|
|
60
67
|
type: "block",
|
|
@@ -62,14 +69,18 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
62
69
|
},
|
|
63
70
|
description: "Import Blocks - create"
|
|
64
71
|
});
|
|
72
|
+
await onBlocksAfterImport.publish({
|
|
73
|
+
params
|
|
74
|
+
});
|
|
65
75
|
return {
|
|
66
76
|
task
|
|
67
77
|
};
|
|
68
78
|
},
|
|
69
|
-
async exportBlocks({
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
async exportBlocks(params) {
|
|
80
|
+
const {
|
|
81
|
+
ids: initialBlockIds,
|
|
82
|
+
where
|
|
83
|
+
} = params;
|
|
73
84
|
await pageBlocksPermissions.ensure({
|
|
74
85
|
rwd: "w"
|
|
75
86
|
});
|
|
@@ -90,12 +101,12 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
90
101
|
const task = await context.pageBuilder.importExportTask.createTask({
|
|
91
102
|
status: _types.ImportExportTaskStatus.PENDING
|
|
92
103
|
});
|
|
93
|
-
const exportBlocksDataKey = `${
|
|
104
|
+
const exportBlocksDataKey = `${EXPORT_BLOCKS_FOLDER_KEY}/${task.id}`;
|
|
94
105
|
// For each block create a sub task and invoke the process handler.
|
|
95
106
|
for (let i = 0; i < blockIds.length; i++) {
|
|
96
107
|
const blockId = blockIds[i];
|
|
97
108
|
// Create sub task.
|
|
98
|
-
await context.pageBuilder.importExportTask.createSubTask(task.id, (0,
|
|
109
|
+
await context.pageBuilder.importExportTask.createSubTask(task.id, (0, _utils2.zeroPad)(i + 1, 5), {
|
|
99
110
|
status: _types.ImportExportTaskStatus.PENDING,
|
|
100
111
|
input: {
|
|
101
112
|
blockId,
|
|
@@ -117,6 +128,9 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
117
128
|
* ExportBlocks
|
|
118
129
|
* exportBlocks
|
|
119
130
|
*/
|
|
131
|
+
await onBlocksBeforeExport.publish({
|
|
132
|
+
params
|
|
133
|
+
});
|
|
120
134
|
// Invoke handler.
|
|
121
135
|
await (0, _client.invokeHandlerClient)({
|
|
122
136
|
context,
|
|
@@ -129,6 +143,9 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
129
143
|
},
|
|
130
144
|
description: "Export blocks - process"
|
|
131
145
|
});
|
|
146
|
+
await onBlocksAfterExport.publish({
|
|
147
|
+
params
|
|
148
|
+
});
|
|
132
149
|
return {
|
|
133
150
|
task
|
|
134
151
|
};
|
|
@@ -137,4 +154,5 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
137
154
|
// Modify context
|
|
138
155
|
context.pageBuilder.blocks = importExportCrud;
|
|
139
156
|
});
|
|
140
|
-
|
|
157
|
+
|
|
158
|
+
//# sourceMappingURL=blocks.crud.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["EXPORT_BLOCKS_PROCESS_HANDLER","process","env","EXPORT_PROCESS_HANDLER","IMPORT_BLOCKS_CREATE_HANDLER","IMPORT_CREATE_HANDLER","ContextPlugin","context","pageBlocksPermissions","PageBlocksPermissions","getPermissions","security","getIdentity","fullAccessPermissionName","importExportCrud","importBlocks","category","categorySlug","zipFileUrl","ensure","rwd","pageBuilder","getBlockCategory","NotFoundError","task","importExportTask","createTask","status","ImportExportTaskStatus","PENDING","input","invokeHandlerClient","name","payload","type","identity","description","exportBlocks","ids","initialBlockIds","where","blockIds","Array","isArray","length","blocks","listPageBlocks","map","block","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 { 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\";\nimport { PageBlocksPermissions } from \"@webiny/api-page-builder/graphql/crud/permissions/PageBlocksPermissions\";\n\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 const importExportCrud: BlocksImportExportCrud = {\n async importBlocks({ category: categorySlug, zipFileUrl }) {\n await pageBlocksPermissions.ensure({ rwd: \"w\" });\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 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 // 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;AAEA;AAEA;AACA;AACA;AAEA,MAAMA,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,qBAAqB,GAAG,IAAIC,4CAAqB,CAAC;IACpDC,cAAc,EAAE,MAAMH,OAAO,CAACI,QAAQ,CAACD,cAAc,CAAC,UAAU,CAAC;IACjEE,WAAW,EAAEL,OAAO,CAACI,QAAQ,CAACC,WAAW;IACzCC,wBAAwB,EAAE;EAC9B,CAAC,CAAC;EAEF,MAAMC,gBAAwC,GAAG;IAC7C,MAAMC,YAAY,CAAC;MAAEC,QAAQ,EAAEC,YAAY;MAAEC;IAAW,CAAC,EAAE;MACvD,MAAMV,qBAAqB,CAACW,MAAM,CAAC;QAAEC,GAAG,EAAE;MAAI,CAAC,CAAC;;MAEhD;MACA,MAAMJ,QAAQ,GAAG,MAAMT,OAAO,CAACc,WAAW,CAACC,gBAAgB,CAACL,YAAY,CAAC;MACzE,IAAI,CAACD,QAAQ,EAAE;QACX,MAAM,IAAIO,6BAAa,CAAE,uBAAsBN,YAAa,cAAa,CAAC;MAC9E;;MAEA;MACA,MAAMO,IAAI,GAAG,MAAMjB,OAAO,CAACc,WAAW,CAACI,gBAAgB,CAACC,UAAU,CAAC;QAC/DC,MAAM,EAAEC,6BAAsB,CAACC,OAAO;QACt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_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,sB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O;QAAEI;MAAK,CAAC;IACnB;EACJ,CAAC;EACD;EACAlB,OAAO,CAACmB,WAAW,CAACsB,MAAM,GAAG7B,gBAAgB;AACjD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -6,26 +6,40 @@ 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
11
|
var _types = require("../../types");
|
|
11
12
|
var _client = require("../../client");
|
|
12
13
|
var _utils = require("../../import/utils");
|
|
13
|
-
var _utils2 = require("
|
|
14
|
-
var _utils3 = require("@webiny/utils");
|
|
14
|
+
var _utils2 = require("@webiny/utils");
|
|
15
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 => {
|
|
19
20
|
const formsPermissions = new _FormsPermissions.FormsPermissions({
|
|
20
21
|
getPermissions: () => context.security.getPermissions("fb.form"),
|
|
21
22
|
getIdentity: context.security.getIdentity,
|
|
22
23
|
fullAccessPermissionName: "pb.*"
|
|
23
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");
|
|
24
33
|
context.waitFor("formBuilder", () => {
|
|
25
34
|
const importExportCrud = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
onFormsBeforeExport,
|
|
36
|
+
onFormsAfterExport,
|
|
37
|
+
onFormsBeforeImport,
|
|
38
|
+
onFormsAfterImport,
|
|
39
|
+
async importForms(params) {
|
|
40
|
+
const {
|
|
41
|
+
zipFileUrl
|
|
42
|
+
} = params;
|
|
29
43
|
await formsPermissions.ensure({
|
|
30
44
|
rwd: "w"
|
|
31
45
|
});
|
|
@@ -42,6 +56,9 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
42
56
|
* ImportForms
|
|
43
57
|
* importForms
|
|
44
58
|
*/
|
|
59
|
+
await onFormsBeforeImport.publish({
|
|
60
|
+
params
|
|
61
|
+
});
|
|
45
62
|
await (0, _client.invokeHandlerClient)({
|
|
46
63
|
context,
|
|
47
64
|
name: IMPORT_FORMS_CREATE_HANDLER,
|
|
@@ -53,14 +70,18 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
53
70
|
},
|
|
54
71
|
description: "Import Forms - create"
|
|
55
72
|
});
|
|
73
|
+
await onFormsAfterImport.publish({
|
|
74
|
+
params
|
|
75
|
+
});
|
|
56
76
|
return {
|
|
57
77
|
task
|
|
58
78
|
};
|
|
59
79
|
},
|
|
60
|
-
async exportForms({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
80
|
+
async exportForms(params) {
|
|
81
|
+
const {
|
|
82
|
+
ids: initialFormIds,
|
|
83
|
+
revisionType
|
|
84
|
+
} = params;
|
|
64
85
|
await formsPermissions.ensure({
|
|
65
86
|
rwd: "w"
|
|
66
87
|
});
|
|
@@ -81,12 +102,12 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
81
102
|
const task = await context.pageBuilder.importExportTask.createTask({
|
|
82
103
|
status: _types.ImportExportTaskStatus.PENDING
|
|
83
104
|
});
|
|
84
|
-
const exportFormsDataKey = `${
|
|
105
|
+
const exportFormsDataKey = `${EXPORT_FORMS_FOLDER_KEY}/${task.id}`;
|
|
85
106
|
// For each form create a sub task and invoke the process handler.
|
|
86
107
|
for (let i = 0; i < formIds.length; i++) {
|
|
87
108
|
const formId = formIds[i];
|
|
88
109
|
// Create sub task.
|
|
89
|
-
await context.pageBuilder.importExportTask.createSubTask(task.id, (0,
|
|
110
|
+
await context.pageBuilder.importExportTask.createSubTask(task.id, (0, _utils2.zeroPad)(i + 1, 5), {
|
|
90
111
|
status: _types.ImportExportTaskStatus.PENDING,
|
|
91
112
|
input: {
|
|
92
113
|
formId,
|
|
@@ -110,6 +131,9 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
110
131
|
* ExportForms
|
|
111
132
|
* exportForms
|
|
112
133
|
*/
|
|
134
|
+
await onFormsBeforeExport.publish({
|
|
135
|
+
params
|
|
136
|
+
});
|
|
113
137
|
// Invoke handler.
|
|
114
138
|
await (0, _client.invokeHandlerClient)({
|
|
115
139
|
context,
|
|
@@ -122,6 +146,9 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
122
146
|
},
|
|
123
147
|
description: "Export forms - process"
|
|
124
148
|
});
|
|
149
|
+
await onFormsAfterExport.publish({
|
|
150
|
+
params
|
|
151
|
+
});
|
|
125
152
|
return {
|
|
126
153
|
task
|
|
127
154
|
};
|
|
@@ -131,4 +158,5 @@ var _default = new _api.ContextPlugin(context => {
|
|
|
131
158
|
context.formBuilder.forms = importExportCrud;
|
|
132
159
|
});
|
|
133
160
|
});
|
|
134
|
-
|
|
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","formsPermissions","FormsPermissions","getPermissions","security","getIdentity","fullAccessPermissionName","waitFor","importExportCrud","importForms","zipFileUrl","ensure","rwd","task","pageBuilder","importExportTask","createTask","status","ImportExportTaskStatus","PENDING","input","invokeHandlerClient","name","payload","type","identity","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 { 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\";\nimport { FormsPermissions } from \"@webiny/api-form-builder/plugins/crud/permissions/FormsPermissions\";\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 const formsPermissions = new FormsPermissions({\n getPermissions: () => context.security.getPermissions(\"fb.form\"),\n getIdentity: context.security.getIdentity,\n fullAccessPermissionName: \"pb.*\"\n });\n\n context.waitFor(\"formBuilder\", () => {\n const importExportCrud: FormsImportExportCrud = {\n async importForms({ zipFileUrl }) {\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 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 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 // 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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,CAAC,CACJ;QACL;QACA;QACA,MAAM9B,OAAO,CAACc,WAAW,CAACC,gBAAgB,CAACkC,UAAU,CAACpC,IAAI,CAAC4B,EAAE,EAAE;UAC3DxB,MAAM,EAAEC,6BAAsB,CAACgC,UAAU;UACzCC,KAAK,EAAE,IAAAC,mBAAY,EAACrB,OAAO,CAACG,MAAM,CAAC;UACnCd,KAAK,EAAE;YACHuB,kBAAkB;YAClBb;UACJ;QACJ,CAAC,CAAC;;QAEF;AAChB;AACA;AACA;AACA;QACgB;QACA,MAAM,IAAAT,2BAAmB,EAAmC;UACxDrB,OAAO;UACPsB,IAAI,EAAE7B,4BAA4B;UAClC8B,OAAO,EAAE;YACL8B,MAAM,EAAExC,IAAI,CAAC4B,EAAE;YACfa,YAAY,EAAE,CAAC;YACf9B,IAAI,EAAE,MAAM;YACZC,QAAQ,EAAEzB,OAAO,CAACI,QAAQ,CAACC,WAAW;UAC1C,CAAC;UACDqB,WAAW,EAAE;QACjB,CAAC,CAAC;QAEF,OAAO;UAAEb;QAAK,CAAC;MACnB;IACJ,CAAC;IACD;IACAb,OAAO,CAACoC,WAAW,CAACD,KAAK,GAAG3B,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,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAEA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,iBAAA,GAAAP,OAAA;AAEA,MAAMQ,uBAAuB,GAAG,uBAAuB;AACvD,MAAMC,4BAA4B,GAAGC,OAAO,CAACC,GAAG,CAACC,sBAAgC;AACjF,MAAMC,2BAA2B,GAAGH,OAAO,CAACC,GAAG,CAACG,qBAA+B;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEjE,IAAIC,kBAAa,CAAwBC,OAAO,IAAI;EAC/D,MAAMC,gBAAgB,GAAG,IAAIC,kCAAgB,CAAC;IAC1CC,cAAc,EAAEA,CAAA,KAAMH,OAAO,CAACI,QAAQ,CAACD,cAAc,CAAC,SAAS,CAAC;IAChEE,WAAW,EAAEL,OAAO,CAACI,QAAQ,CAACC,WAAW;IACzCC,wBAAwB,EAAE;EAC9B,CAAC,CAAC;;EAEF;EAC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tCC,KAAK,EAAE;cACH0B,MAAM;cACNF,kBAAkB;cAClBb;YACJ;UACJ,CACJ,CAAC;QACL;QACA;QACA,MAAMrC,OAAO,CAACoB,WAAW,CAACC,gBAAgB,CAACkC,UAAU,CAACpC,IAAI,CAAC6B,EAAE,EAAE;UAC3DzB,MAAM,EAAEC,6BAAsB,CAACgC,UAAU;UACzCC,KAAK,EAAE,IAAAC,mBAAY,EAACpB,OAAO,CAACG,MAAM,CAAC;UACnCf,KAAK,EAAE;YACHwB,kBAAkB;YAClBb;UACJ;QACJ,CAAC,CAAC;;QAEF;AAChB;AACA;AACA;AACA;QACgB,MAAM9B,mBAAmB,CAACoB,OAAO,CAAC;UAAEZ;QAAO,CAAC,CAAC;QAC7C;QACA,MAAM,IAAAa,2BAAmB,EAAmC;UACxD5B,OAAO;UACP6B,IAAI,EAAEvC,4BAA4B;UAClCwC,OAAO,EAAE;YACL6B,MAAM,EAAExC,IAAI,CAAC6B,EAAE;YACfY,YAAY,EAAE,CAAC;YACf7B,IAAI,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;
|