@webiny/api-headless-cms-import-export 0.0.0-unstable.e622468070 → 0.0.0-unstable.f6dc066313

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.
@@ -8,7 +8,7 @@ const getModelValues = ast => {
8
8
  path
9
9
  }) => {
10
10
  const ref = field.settings?.models ? `#R#${field.settings.models.map(m => m.modelId).sort().join(",")}` : "";
11
- const key = `${field.type}@${path.join(".")}#${field.multipleValues ? "m" : "s"}${ref}`;
11
+ const key = `${field.type}@${path.join(".")}#${field.list ? "m" : "s"}${ref}`;
12
12
  results.push({
13
13
  key,
14
14
  field,
@@ -1 +1 @@
1
- {"version":3,"names":["ModelFieldTraverser","WebinyError","getModelValues","ast","traverser","results","traverse","field","path","ref","settings","models","map","m","modelId","sort","join","key","type","multipleValues","push","makeSureModelsAreIdentical","params","modelToAstConverter","model","target","modelAst","toAst","targetAst","modelValues","targetValues","value","some","v","message","fieldId","code","data"],"sources":["makeSureModelsAreIdentical.ts"],"sourcesContent":["import type { CmsModel, CmsModelAst, CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IExportedCmsModel } from \"~/tasks/domain/abstractions/ExportContentEntriesController.js\";\nimport { ModelFieldTraverser } from \"@webiny/api-headless-cms/utils/index.js\";\nimport { WebinyError } from \"@webiny/error\";\nimport { ModelToAstConverter } from \"@webiny/api-headless-cms/features/contentModel/ModelToAstConverter/index.js\";\n\nexport interface IMakeSureModelsAreIdenticalParams {\n modelToAstConverter: ModelToAstConverter.Interface;\n model: CmsModel;\n target: IExportedCmsModel;\n}\n\ninterface IResult {\n key: string;\n path: string;\n field: CmsModelField;\n}\n\nconst getModelValues = (ast: CmsModelAst): IResult[] => {\n const traverser = new ModelFieldTraverser();\n\n const results: IResult[] = [];\n\n traverser.traverse(ast, ({ field, path }) => {\n const ref = field.settings?.models\n ? `#R#${field.settings.models\n .map(m => m.modelId)\n .sort()\n .join(\",\")}`\n : \"\";\n\n const key = `${field.type}@${path.join(\".\")}#${field.multipleValues ? \"m\" : \"s\"}${ref}`;\n results.push({\n key,\n field,\n path: path.join(\".\")\n });\n });\n\n return results;\n};\n\nexport const makeSureModelsAreIdentical = (params: IMakeSureModelsAreIdenticalParams): void => {\n const { modelToAstConverter, model, target } = params;\n\n const modelAst = modelToAstConverter.toAst(model);\n const targetAst = modelToAstConverter.toAst(target as CmsModel);\n\n const modelValues = getModelValues(modelAst);\n const targetValues = getModelValues(targetAst);\n /**\n * First we will go through the model from the database.\n * Then we will go through the exported model and check against the model from the database.\n */\n for (const value of modelValues) {\n if (targetValues.some(v => v.key === value.key)) {\n continue;\n }\n throw new WebinyError({\n message: `Field \"${value.field.fieldId}\" not found in the model provided via the JSON data.`,\n code: \"MODEL_FIELD_NOT_FOUND\",\n data: {\n field: value,\n targetValues,\n modelValues\n }\n });\n }\n for (const value of targetValues) {\n if (modelValues.some(v => v.key === value.key)) {\n continue;\n }\n throw new WebinyError({\n message: `Field \"${value.field.fieldId}\" not found in the model from the database.`,\n code: \"MODEL_FIELD_NOT_FOUND\",\n data: {\n ...value\n }\n });\n }\n};\n"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ,yCAAyC;AAC7E,SAASC,WAAW,QAAQ,eAAe;AAe3C,MAAMC,cAAc,GAAIC,GAAgB,IAAgB;EACpD,MAAMC,SAAS,GAAG,IAAIJ,mBAAmB,CAAC,CAAC;EAE3C,MAAMK,OAAkB,GAAG,EAAE;EAE7BD,SAAS,CAACE,QAAQ,CAACH,GAAG,EAAE,CAAC;IAAEI,KAAK;IAAEC;EAAK,CAAC,KAAK;IACzC,MAAMC,GAAG,GAAGF,KAAK,CAACG,QAAQ,EAAEC,MAAM,GAC5B,MAAMJ,KAAK,CAACG,QAAQ,CAACC,MAAM,CACtBC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,CAAC,CACnBC,IAAI,CAAC,CAAC,CACNC,IAAI,CAAC,GAAG,CAAC,EAAE,GAChB,EAAE;IA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AK,CAACd,GAAG,CAAC,EAAE;MAC5C;IACJ;IACA,MAAM,IAAIhB,WAAW,CAAC;MAClBiC,OAAO,EAAE,UAAUH,KAAK,CAACxB,KAAK,CAAC4B,OAAO,6CAA6C;MACnFC,IAAI,EAAE,uBAAuB;MAC7BC,IAAI,EAAE;QACF,GAAGN;MACP;IACJ,CAAC,CAAC;EACN;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ModelFieldTraverser","WebinyError","getModelValues","ast","traverser","results","traverse","field","path","ref","settings","models","map","m","modelId","sort","join","key","type","list","push","makeSureModelsAreIdentical","params","modelToAstConverter","model","target","modelAst","toAst","targetAst","modelValues","targetValues","value","some","v","message","fieldId","code","data"],"sources":["makeSureModelsAreIdentical.ts"],"sourcesContent":["import type { CmsModel, CmsModelAst, CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IExportedCmsModel } from \"~/tasks/domain/abstractions/ExportContentEntriesController.js\";\nimport { ModelFieldTraverser } from \"@webiny/api-headless-cms/utils/index.js\";\nimport { WebinyError } from \"@webiny/error\";\nimport { ModelToAstConverter } from \"@webiny/api-headless-cms/features/contentModel/ModelToAstConverter/index.js\";\n\nexport interface IMakeSureModelsAreIdenticalParams {\n modelToAstConverter: ModelToAstConverter.Interface;\n model: CmsModel;\n target: IExportedCmsModel;\n}\n\ninterface IResult {\n key: string;\n path: string;\n field: CmsModelField;\n}\n\nconst getModelValues = (ast: CmsModelAst): IResult[] => {\n const traverser = new ModelFieldTraverser();\n\n const results: IResult[] = [];\n\n traverser.traverse(ast, ({ field, path }) => {\n const ref = field.settings?.models\n ? `#R#${field.settings.models\n .map(m => m.modelId)\n .sort()\n .join(\",\")}`\n : \"\";\n\n const key = `${field.type}@${path.join(\".\")}#${field.list ? \"m\" : \"s\"}${ref}`;\n results.push({\n key,\n field,\n path: path.join(\".\")\n });\n });\n\n return results;\n};\n\nexport const makeSureModelsAreIdentical = (params: IMakeSureModelsAreIdenticalParams): void => {\n const { modelToAstConverter, model, target } = params;\n\n const modelAst = modelToAstConverter.toAst(model);\n const targetAst = modelToAstConverter.toAst(target as CmsModel);\n\n const modelValues = getModelValues(modelAst);\n const targetValues = getModelValues(targetAst);\n /**\n * First we will go through the model from the database.\n * Then we will go through the exported model and check against the model from the database.\n */\n for (const value of modelValues) {\n if (targetValues.some(v => v.key === value.key)) {\n continue;\n }\n throw new WebinyError({\n message: `Field \"${value.field.fieldId}\" not found in the model provided via the JSON data.`,\n code: \"MODEL_FIELD_NOT_FOUND\",\n data: {\n field: value,\n targetValues,\n modelValues\n }\n });\n }\n for (const value of targetValues) {\n if (modelValues.some(v => v.key === value.key)) {\n continue;\n }\n throw new WebinyError({\n message: `Field \"${value.field.fieldId}\" not found in the model from the database.`,\n code: \"MODEL_FIELD_NOT_FOUND\",\n data: {\n ...value\n }\n });\n }\n};\n"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ,yCAAyC;AAC7E,SAASC,WAAW,QAAQ,eAAe;AAe3C,MAAMC,cAAc,GAAIC,GAAgB,IAAgB;EACpD,MAAMC,SAAS,GAAG,IAAIJ,mBAAmB,CAAC,CAAC;EAE3C,MAAMK,OAAkB,GAAG,EAAE;EAE7BD,SAAS,CAACE,QAAQ,CAACH,GAAG,EAAE,CAAC;IAAEI,KAAK;IAAEC;EAAK,CAAC,KAAK;IACzC,MAAMC,GAAG,GAAGF,KAAK,CAACG,QAAQ,EAAEC,MAAM,GAC5B,MAAMJ,KAAK,CAACG,QAAQ,CAACC,MAAM,CACtBC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,CAAC,CACnBC,IAAI,CAAC,CAAC,CACNC,IAAI,CAAC,GAAG,CAAC,EAAE,GAChB,EAAE;IAER,MAAMC,GAAG,GAAG,GAAGV,KAAK,CAACW,IAAI,IAAIV,IAAI,CAACQ,IAAI,CAAC,GAAG,CAAC,IAAIT,KAAK,CAACY,IAAI,GAAG,GAAG,GAAG,GAAG,GAAGV,GAAG,EAAE;IAC7EJ,OA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AC7BC,IAAI,EAAE;QACF,GAAGN;MACP;IACJ,CAAC,CAAC;EACN;AACJ,CAAC","ignoreList":[]}
@@ -13,7 +13,7 @@ const validateData = zod.object({
13
13
  id: zod.string(),
14
14
  fieldId: zod.string(),
15
15
  type: zod.string(),
16
- multipleValues: zod.boolean().optional(),
16
+ list: zod.boolean().optional(),
17
17
  settings: zod.object({
18
18
  fields: zod.array(zod.object({}).passthrough()).optional(),
19
19
  templates: zod.array(zod.object({}).passthrough()).optional()
@@ -1 +1 @@
1
- {"version":3,"names":["CmsImportExportFileType","zod","WebinyError","createZodError","validateData","object","model","modelId","string","fields","array","id","fieldId","type","multipleValues","boolean","optional","settings","passthrough","templates","min","files","get","url","head","key","checksum","enum","ENTRIES","ASSETS","parseImportUrlData","input","json","JSON","parse","result","safeParse","success","error","data"],"sources":["parseImportUrlData.ts"],"sourcesContent":["import { CmsImportExportFileType } from \"~/types.js\";\nimport type { ICmsImportExportFile } from \"~/types.js\";\nimport zod from \"zod\";\nimport { WebinyError } from \"@webiny/error\";\nimport { createZodError } from \"@webiny/utils\";\nimport type { IExportedCmsModel } from \"~/tasks/domain/abstractions/ExportContentEntriesController.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\nconst validateData = zod.object({\n /**\n * Basic model validation.\n * We will check it more thoroughly in the next step.\n */\n model: zod.object({\n modelId: zod.string(),\n fields: zod\n .array(\n zod.object({\n id: zod.string(),\n fieldId: zod.string(),\n type: zod.string(),\n multipleValues: zod.boolean().optional(),\n settings: zod\n .object({\n fields: zod.array(zod.object({}).passthrough()).optional(),\n templates: zod.array(zod.object({}).passthrough()).optional()\n })\n .passthrough()\n .optional()\n })\n )\n .min(1)\n }),\n files: zod.array(\n zod.object({\n get: zod.string().url(),\n head: zod.string().url(),\n key: zod.string(),\n checksum: zod.string(),\n type: zod.enum([CmsImportExportFileType.ENTRIES, CmsImportExportFileType.ASSETS])\n })\n )\n});\n\nexport interface IParseImportUrlDataResult {\n model: IExportedCmsModel;\n files: ICmsImportExportFile[];\n}\n\nexport const parseImportUrlData = (input: string | GenericRecord): IParseImportUrlDataResult => {\n let json: unknown;\n try {\n json = typeof input === \"string\" ? JSON.parse(input) : input;\n } catch {\n throw new WebinyError(\"Invalid input data provided.\", \"INVALID_INPUT_DATA\");\n }\n\n const result = validateData.safeParse(json);\n if (!result.success) {\n throw createZodError(result.error);\n }\n return {\n model: result.data.model as unknown as IExportedCmsModel,\n files: result.data.files\n };\n};\n"],"mappings":"AAAA,SAASA,uBAAuB;AAEhC,OAAOC,GAAG,MAAM,KAAK;AACrB,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,cAAc,QAAQ,eAAe;AAI9C,MAAMC,YAAY,GAAGH,GAAG,CAACI,MAAM,CAAC;EAC5B;AACJ;AACA;AACA;EACIC,KAAK,EAAEL,GAAG,CAACI,MAAM,CAAC;IACdE,OAAO,EAAEN,GAAG,CAACO,MAAM,CAAC,CAAC;IACrBC,MAAM,EAAER,GAAG,CACNS,KAAK,CACFT,GAAG,CAACI,MAAM,CAAC;MACPM,EAAE,EAAEV,GAAG,CAACO,MAAM,CAAC,CAAC;MAChBI,OAAO,EAAEX,GAAG,CAACO,MAAM,CAAC,CAAC;MACrBK,IAAI,EAAEZ,GAAG,CAACO,MAAM,CAAC,CAAC;MAClBM,cAAc,EAAEb,GAAG,CAACc,OAAO,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;MACxCC,QAAQ,EAAEhB,GAAG,CACRI,MAAM,CAAC;QACJI,MAAM,EAAER,GAAG,CAACS,KAAK,CAACT,GAAG,CAACI,MAAM,CAAC,CAAC,CAAC,CAAC,CAACa,WAAW,CAAC,CAAC,CAAC,CAACF,QAAQ,CAAC,CAAC;QAC1DG,SAAS,EAAElB,GAAG,CAACS,KAAK,CAACT,GAAG,CAACI,MAAM,CAAC,CAAC,CAAC,CAAC,CAACa,WAAW,CAAC,CAAC,CAAC,CAACF,QAAQ,CAAC;MAChE,CAAC,CAAC,CACDE,WAAW,CAAC,CAAC,CACbF,QAAQ,CAAC;IAClB,CAAC,CACL,CAAC,CACAI,GAAG,CAAC,CAAC;EACd,CAAC,CAAC;EACFC,KAAK,EAAEpB,GAAG,CAACS,KAAK,CACZT,GAAG,CAACI,MAAM,CAAC;IACPiB,GAAG,EAAErB,GAAG,CAACO,MAAM,CAAC,CAAC,CAACe,GAAG,CAAC,CAAC;IACvBC,IAAI,EAAEvB,GAAG,CAACO,MAAM,CAAC,CAAC,CAACe,GAAG,CAAC,CAAC;IACxBE,GAAG,EAAExB,GAAG,CAACO,MAAM,CAAC,CAAC;IACjBkB,QAAQ,EAAEzB,GAAG,CAACO,MAAM,CAAC,CAAC;IACtBK,IAAI,EAAEZ,GAAG,CAAC0B,IAAI,CAAC,CAAC3B,uBAAuB,CAAC4B,OAAO,EAAE5B,uBAAuB,CAAC6B,MAAM,CAAC;EACpF,CAAC,CACL;AACJ,CAAC,CAAC;AAOF,OAAO,MAAMC,kBAAkB,GAAIC,KAA6B,IAAgC;EAC5F,IAAIC,IAAa;EACjB,IAAI;IACAA,IAAI,GAAG,OAAOD,KAAK,KAAK,QAAQ,GAAGE,IAAI,CAACC,KAAK,CAACH,KAAK,CAAC,GAAGA,KAAK;EAChE,CAAC,CAAC,MAAM;IACJ,MAAM,IAAI7B,WAAW,CAAC,8BAA8B,EAAE,oBAAoB,CAAC;EAC/E;EAEA,MAAMiC,MAAM,GAAG/B,YAAY,CAACgC,SAAS,CAACJ,IAAI,CAAC;EAC3C,IAAI,CAACG,MAAM,CAACE,OAAO,EAAE;IACjB,MAAMlC,cAAc,CAACgC,MAAM,CAACG,KAAK,CAAC;EACtC;EACA,OAAO;IACHhC,KAAK,EAAE6B,MAAM,CAACI,IAAI,CAACjC,KAAqC;IACxDe,KAAK,EAAEc,MAAM,CAACI,IAAI,CAAClB;EACvB,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["CmsImportExportFileType","zod","WebinyError","createZodError","validateData","object","model","modelId","string","fields","array","id","fieldId","type","list","boolean","optional","settings","passthrough","templates","min","files","get","url","head","key","checksum","enum","ENTRIES","ASSETS","parseImportUrlData","input","json","JSON","parse","result","safeParse","success","error","data"],"sources":["parseImportUrlData.ts"],"sourcesContent":["import { CmsImportExportFileType } from \"~/types.js\";\nimport type { ICmsImportExportFile } from \"~/types.js\";\nimport zod from \"zod\";\nimport { WebinyError } from \"@webiny/error\";\nimport { createZodError } from \"@webiny/utils\";\nimport type { IExportedCmsModel } from \"~/tasks/domain/abstractions/ExportContentEntriesController.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\nconst validateData = zod.object({\n /**\n * Basic model validation.\n * We will check it more thoroughly in the next step.\n */\n model: zod.object({\n modelId: zod.string(),\n fields: zod\n .array(\n zod.object({\n id: zod.string(),\n fieldId: zod.string(),\n type: zod.string(),\n list: zod.boolean().optional(),\n settings: zod\n .object({\n fields: zod.array(zod.object({}).passthrough()).optional(),\n templates: zod.array(zod.object({}).passthrough()).optional()\n })\n .passthrough()\n .optional()\n })\n )\n .min(1)\n }),\n files: zod.array(\n zod.object({\n get: zod.string().url(),\n head: zod.string().url(),\n key: zod.string(),\n checksum: zod.string(),\n type: zod.enum([CmsImportExportFileType.ENTRIES, CmsImportExportFileType.ASSETS])\n })\n )\n});\n\nexport interface IParseImportUrlDataResult {\n model: IExportedCmsModel;\n files: ICmsImportExportFile[];\n}\n\nexport const parseImportUrlData = (input: string | GenericRecord): IParseImportUrlDataResult => {\n let json: unknown;\n try {\n json = typeof input === \"string\" ? JSON.parse(input) : input;\n } catch {\n throw new WebinyError(\"Invalid input data provided.\", \"INVALID_INPUT_DATA\");\n }\n\n const result = validateData.safeParse(json);\n if (!result.success) {\n throw createZodError(result.error);\n }\n return {\n model: result.data.model as unknown as IExportedCmsModel,\n files: result.data.files\n };\n};\n"],"mappings":"AAAA,SAASA,uBAAuB;AAEhC,OAAOC,GAAG,MAAM,KAAK;AACrB,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,cAAc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MAAM,CAAC,CAAC;IACtBK,IAAI,EAAEZ,GAAG,CAAC0B,IAAI,CAAC,CAAC3B,uBAAuB,CAAC4B,OAAO,EAAE5B,uBAAuB,CAAC6B,MAAM,CAAC;EACpF,CAAC,CACL;AACJ,CAAC,CAAC;AAOF,OAAO,MAAMC,kBAAkB,GAAIC,KAA6B,IAAgC;EAC5F,IAAIC,IAAa;EACjB,IAAI;IACAA,IAAI,GAAG,OAAOD,KAAK,KAAK,QAAQ,GAAGE,IAAI,CAACC,KAAK,CAACH,KAAK,CAAC,GAAGA,KAAK;EAChE,CAAC,CAAC,MAAM;IACJ,MAAM,IAAI7B,WAAW,CAAC,8BAA8B,EAAE,oBAAoB,CAAC;EAC/E;EAEA,MAAMiC,MAAM,GAAG/B,YAAY,CAACgC,SAAS,CAACJ,IAAI,CAAC;EAC3C,IAAI,CAACG,MAAM,CAACE,OAAO,EAAE;IACjB,MAAMlC,cAAc,CAACgC,MAAM,CAACG,KAAK,CAAC;EACtC;EACA,OAAO;IACHhC,KAAK,EAAE6B,MAAM,CAACI,IAAI,CAACjC,KAAqC;IACxDe,KAAK,EAAEc,MAAM,CAACI,IAAI,CAAClB;EACvB,CAAC;AACL,CAAC","ignoreList":[]}
package/index.js CHANGED
@@ -10,8 +10,9 @@ import { ImportFromUrlControllerTaskFeature } from "./features/ImportFromUrlCont
10
10
  import { ImportFromUrlDownloadTaskFeature } from "./features/ImportFromUrlDownloadTask/feature.js";
11
11
  import { ImportFromUrlProcessEntriesTaskFeature } from "./features/ImportFromUrlProcessEntriesTask/feature.js";
12
12
  import { ImportFromUrlProcessAssetsTaskFeature } from "./features/ImportFromUrlProcessAssetsTask/feature.js";
13
+ import { createBeforeHandlerPlugin } from "@webiny/handler";
13
14
  export const createHeadlessCmsImportExport = () => {
14
- const plugin = new ContextPlugin(async context => {
15
+ const contextPlugin = new ContextPlugin(async context => {
15
16
  const installed = await isHeadlessCmsReady(context);
16
17
  if (!installed) {
17
18
  return;
@@ -25,10 +26,13 @@ export const createHeadlessCmsImportExport = () => {
25
26
  ImportFromUrlProcessEntriesTaskFeature.register(context.container);
26
27
  ImportFromUrlProcessAssetsTaskFeature.register(context.container);
27
28
  context.cmsImportExport = await createHeadlessCmsImportExportCrud(context);
29
+ });
30
+ contextPlugin.name = "headlessCms.context.importExport";
31
+ const beforeHandlerPlugin = createBeforeHandlerPlugin(async context => {
28
32
  await attachHeadlessCmsImportExportGraphQL(context);
29
33
  });
30
- plugin.name = "headlessCms.context.importExport";
31
- return [plugin];
34
+ beforeHandlerPlugin.name = "headlessCms.beforeHandler.importExport";
35
+ return [contextPlugin, beforeHandlerPlugin];
32
36
  };
33
37
 
34
38
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ContextPlugin","attachHeadlessCmsImportExportGraphQL","isHeadlessCmsReady","createHeadlessCmsImportExportCrud","ExportContentEntriesControllerTaskFeature","ExportContentEntriesTaskFeature","ExportContentAssetsTaskFeature","ValidateImportFromUrlTaskFeature","ImportFromUrlControllerTaskFeature","ImportFromUrlDownloadTaskFeature","ImportFromUrlProcessEntriesTaskFeature","ImportFromUrlProcessAssetsTaskFeature","createHeadlessCmsImportExport","plugin","context","installed","register","container","cmsImportExport","name"],"sources":["index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport type { Plugin } from \"@webiny/plugins/types.js\";\nimport { attachHeadlessCmsImportExportGraphQL } from \"~/graphql/index.js\";\nimport type { Context } from \"./types.js\";\nimport { isHeadlessCmsReady } from \"@webiny/api-headless-cms\";\nimport { createHeadlessCmsImportExportCrud } from \"~/crud/index.js\";\nimport { ExportContentEntriesControllerTaskFeature } from \"~/features/ExportContentEntriesControllerTask/feature.js\";\nimport { ExportContentEntriesTaskFeature } from \"~/features/ExportContentEntriesTask/feature.js\";\nimport { ExportContentAssetsTaskFeature } from \"~/features/ExportContentAssetsTask/feature.js\";\nimport { ValidateImportFromUrlTaskFeature } from \"~/features/ValidateImportFromUrlTask/feature.js\";\nimport { ImportFromUrlControllerTaskFeature } from \"~/features/ImportFromUrlControllerTask/feature.js\";\nimport { ImportFromUrlDownloadTaskFeature } from \"~/features/ImportFromUrlDownloadTask/feature.js\";\nimport { ImportFromUrlProcessEntriesTaskFeature } from \"~/features/ImportFromUrlProcessEntriesTask/feature.js\";\nimport { ImportFromUrlProcessAssetsTaskFeature } from \"~/features/ImportFromUrlProcessAssetsTask/feature.js\";\n\nexport const createHeadlessCmsImportExport = (): Plugin[] => {\n const plugin = new ContextPlugin<Context>(async context => {\n const installed = await isHeadlessCmsReady(context);\n if (!installed) {\n return;\n }\n\n ExportContentEntriesControllerTaskFeature.register(context.container);\n ExportContentEntriesTaskFeature.register(context.container);\n ExportContentAssetsTaskFeature.register(context.container);\n ValidateImportFromUrlTaskFeature.register(context.container);\n ImportFromUrlControllerTaskFeature.register(context.container);\n ImportFromUrlDownloadTaskFeature.register(context.container);\n ImportFromUrlProcessEntriesTaskFeature.register(context.container);\n ImportFromUrlProcessAssetsTaskFeature.register(context.container);\n\n context.cmsImportExport = await createHeadlessCmsImportExportCrud(context);\n await attachHeadlessCmsImportExportGraphQL(context);\n });\n plugin.name = \"headlessCms.context.importExport\";\n return [plugin];\n};\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;AAE3C,SAASC,oCAAoC;AAE7C,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,iCAAiC;AAC1C,SAASC,yCAAyC;AAClD,SAASC,+BAA+B;AACxC,SAASC,8BAA8B;AACvC,SAASC,gCAAgC;AACzC,SAASC,kCAAkC;AAC3C,SAASC,gCAAgC;AACzC,SAASC,sCAAsC;AAC/C,SAASC,qCAAqC;AAE9C,OAAO,MAAMC,6BAA6B,GAAGA,CAAA,KAAgB;EACzD,MAAMC,MAAM,GAAG,IAAIb,aAAa,CAAU,MAAMc,OAAO,IAAI;IACvD,MAAMC,SAAS,GAAG,MAAMb,kBAAkB,CAACY,OAAO,CAAC;IACnD,IAAI,CAACC,SAAS,EAAE;MACZ;IACJ;IAEAX,yCAAyC,CAACY,QAAQ,CAACF,OAAO,CAACG,SAAS,CAAC;IACrEZ,+BAA+B,CAACW,QAAQ,CAACF,OAAO,CAACG,SAAS,CAAC;IAC3DX,8BAA8B,CAACU,QAAQ,CAACF,OAAO,CAACG,SAAS,CAAC;IAC1DV,gCAAgC,CAACS,QAAQ,CAACF,OAAO,CAACG,SAAS,CAAC;IAC5DT,kCAAkC,CAACQ,QAAQ,CAACF,OAAO,CAACG,SAAS,CAAC;IAC9DR,gCAAgC,CAACO,QAAQ,CAACF,OAAO,CAACG,SAAS,CAAC;IAC5DP,sCAAsC,CAACM,QAAQ,CAACF,OAAO,CAACG,SAAS,CAAC;IAClEN,qCAAqC,CAACK,QAAQ,CAACF,OAAO,CAACG,SAAS,CAAC;IAEjEH,OAAO,CAACI,eAAe,GAAG,MAAMf,iCAAiC,CAACW,OAAO,CAAC;IAC1E,MAAMb,oCAAoC,CAACa,OAAO,CAAC;EACvD,CAAC,CAAC;EACFD,MAAM,CAACM,IAAI,GAAG,kCAAkC;EAChD,OAAO,CAACN,MAAM,CAAC;AACnB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ContextPlugin","attachHeadlessCmsImportExportGraphQL","isHeadlessCmsReady","createHeadlessCmsImportExportCrud","ExportContentEntriesControllerTaskFeature","ExportContentEntriesTaskFeature","ExportContentAssetsTaskFeature","ValidateImportFromUrlTaskFeature","ImportFromUrlControllerTaskFeature","ImportFromUrlDownloadTaskFeature","ImportFromUrlProcessEntriesTaskFeature","ImportFromUrlProcessAssetsTaskFeature","createBeforeHandlerPlugin","createHeadlessCmsImportExport","contextPlugin","context","installed","register","container","cmsImportExport","name","beforeHandlerPlugin"],"sources":["index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport type { Plugin } from \"@webiny/plugins/types.js\";\nimport { attachHeadlessCmsImportExportGraphQL } from \"~/graphql/index.js\";\nimport type { Context } from \"./types.js\";\nimport { isHeadlessCmsReady } from \"@webiny/api-headless-cms\";\nimport { createHeadlessCmsImportExportCrud } from \"~/crud/index.js\";\nimport { ExportContentEntriesControllerTaskFeature } from \"~/features/ExportContentEntriesControllerTask/feature.js\";\nimport { ExportContentEntriesTaskFeature } from \"~/features/ExportContentEntriesTask/feature.js\";\nimport { ExportContentAssetsTaskFeature } from \"~/features/ExportContentAssetsTask/feature.js\";\nimport { ValidateImportFromUrlTaskFeature } from \"~/features/ValidateImportFromUrlTask/feature.js\";\nimport { ImportFromUrlControllerTaskFeature } from \"~/features/ImportFromUrlControllerTask/feature.js\";\nimport { ImportFromUrlDownloadTaskFeature } from \"~/features/ImportFromUrlDownloadTask/feature.js\";\nimport { ImportFromUrlProcessEntriesTaskFeature } from \"~/features/ImportFromUrlProcessEntriesTask/feature.js\";\nimport { ImportFromUrlProcessAssetsTaskFeature } from \"~/features/ImportFromUrlProcessAssetsTask/feature.js\";\nimport { createBeforeHandlerPlugin } from \"@webiny/handler\";\n\nexport const createHeadlessCmsImportExport = (): Plugin[] => {\n const contextPlugin = new ContextPlugin<Context>(async context => {\n const installed = await isHeadlessCmsReady(context);\n if (!installed) {\n return;\n }\n\n ExportContentEntriesControllerTaskFeature.register(context.container);\n ExportContentEntriesTaskFeature.register(context.container);\n ExportContentAssetsTaskFeature.register(context.container);\n ValidateImportFromUrlTaskFeature.register(context.container);\n ImportFromUrlControllerTaskFeature.register(context.container);\n ImportFromUrlDownloadTaskFeature.register(context.container);\n ImportFromUrlProcessEntriesTaskFeature.register(context.container);\n ImportFromUrlProcessAssetsTaskFeature.register(context.container);\n\n context.cmsImportExport = await createHeadlessCmsImportExportCrud(context);\n });\n contextPlugin.name = \"headlessCms.context.importExport\";\n\n const beforeHandlerPlugin = createBeforeHandlerPlugin<Context>(async context => {\n await attachHeadlessCmsImportExportGraphQL(context);\n });\n beforeHandlerPlugin.name = \"headlessCms.beforeHandler.importExport\";\n\n return [contextPlugin, beforeHandlerPlugin];\n};\n"],"mapp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,OAAO,CAAC;EACvD,CAAC,CAAC;EACFM,mBAAmB,CAACD,IAAI,GAAG,wCAAwC;EAEnE,OAAO,CAACN,aAAa,EAAEO,mBAAmB,CAAC;AAC/C,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-import-export",
3
- "version": "0.0.0-unstable.e622468070",
3
+ "version": "0.0.0-unstable.f6dc066313",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "description": "Import / Export for Webiny Headless CMS",
@@ -14,17 +14,17 @@
14
14
  },
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
- "@smithy/node-http-handler": "4.4.10",
18
- "@webiny/api-file-manager": "0.0.0-unstable.e622468070",
19
- "@webiny/api-headless-cms": "0.0.0-unstable.e622468070",
20
- "@webiny/aws-sdk": "0.0.0-unstable.e622468070",
21
- "@webiny/error": "0.0.0-unstable.e622468070",
22
- "@webiny/feature": "0.0.0-unstable.e622468070",
23
- "@webiny/handler-graphql": "0.0.0-unstable.e622468070",
24
- "@webiny/plugins": "0.0.0-unstable.e622468070",
25
- "@webiny/project-utils": "0.0.0-unstable.e622468070",
26
- "@webiny/tasks": "0.0.0-unstable.e622468070",
27
- "@webiny/utils": "0.0.0-unstable.e622468070",
17
+ "@smithy/node-http-handler": "4.4.12",
18
+ "@webiny/api-file-manager": "0.0.0-unstable.f6dc066313",
19
+ "@webiny/api-headless-cms": "0.0.0-unstable.f6dc066313",
20
+ "@webiny/aws-sdk": "0.0.0-unstable.f6dc066313",
21
+ "@webiny/error": "0.0.0-unstable.f6dc066313",
22
+ "@webiny/feature": "0.0.0-unstable.f6dc066313",
23
+ "@webiny/handler-graphql": "0.0.0-unstable.f6dc066313",
24
+ "@webiny/plugins": "0.0.0-unstable.f6dc066313",
25
+ "@webiny/project-utils": "0.0.0-unstable.f6dc066313",
26
+ "@webiny/tasks": "0.0.0-unstable.f6dc066313",
27
+ "@webiny/utils": "0.0.0-unstable.f6dc066313",
28
28
  "archiver": "7.0.1",
29
29
  "bytes": "3.1.2",
30
30
  "uniqid": "5.4.0",
@@ -35,22 +35,22 @@
35
35
  "@types/adm-zip": "0.5.7",
36
36
  "@types/archiver": "6.0.4",
37
37
  "@types/unzipper": "0.10.11",
38
- "@webiny/api": "0.0.0-unstable.e622468070",
39
- "@webiny/api-core": "0.0.0-unstable.e622468070",
40
- "@webiny/build-tools": "0.0.0-unstable.e622468070",
41
- "@webiny/handler": "0.0.0-unstable.e622468070",
42
- "@webiny/handler-aws": "0.0.0-unstable.e622468070",
38
+ "@webiny/api": "0.0.0-unstable.f6dc066313",
39
+ "@webiny/api-core": "0.0.0-unstable.f6dc066313",
40
+ "@webiny/build-tools": "0.0.0-unstable.f6dc066313",
41
+ "@webiny/handler": "0.0.0-unstable.f6dc066313",
42
+ "@webiny/handler-aws": "0.0.0-unstable.f6dc066313",
43
43
  "@webiny/plugins": "0.0.0",
44
- "@webiny/wcp": "0.0.0-unstable.e622468070",
44
+ "@webiny/wcp": "0.0.0-unstable.f6dc066313",
45
45
  "adm-zip": "0.5.16",
46
46
  "aws-sdk-client-mock": "4.1.0",
47
- "graphql": "16.12.0",
47
+ "graphql": "16.13.0",
48
48
  "typescript": "5.9.3",
49
- "vitest": "3.2.4"
49
+ "vitest": "4.0.18"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public",
53
53
  "directory": "dist"
54
54
  },
55
- "gitHead": "e622468070839dc3f9552c85bf2bbac12d2ef88f"
55
+ "gitHead": "f6dc066313ddce5339d2aacec3aa84e61232689b"
56
56
  }