strapi-plugin-navigation 3.0.0-beta.2 → 3.0.0-beta.4

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.
Files changed (33) hide show
  1. package/README.md +7 -7
  2. package/dist/_chunks/{ca-DIZHA0OL.mjs → ca-Catou0wg.mjs} +4 -0
  3. package/dist/_chunks/{ca-Bjfh0w36.js → ca-DtaqQvTI.js} +4 -0
  4. package/dist/admin/index.js +486 -308
  5. package/dist/admin/index.mjs +487 -309
  6. package/dist/admin/src/api/client.d.ts +4 -2
  7. package/dist/admin/src/api/validators.d.ts +10 -10
  8. package/dist/admin/src/pages/HomePage/components/NavigationItemForm/index.d.ts +1 -1
  9. package/dist/admin/src/pages/HomePage/components/NavigationItemForm/utils/form.d.ts +78 -0
  10. package/dist/admin/src/pages/HomePage/components/NavigationItemPopup/index.d.ts +1 -1
  11. package/dist/admin/src/pages/HomePage/components/NavigationManager/types.d.ts +1 -1
  12. package/dist/admin/src/pages/HomePage/hooks/index.d.ts +4 -4
  13. package/dist/admin/src/pages/HomePage/utils/parsers.d.ts +2 -2
  14. package/dist/admin/src/pages/SettingsPage/hooks/index.d.ts +1 -1
  15. package/dist/admin/src/translations/ca.d.ts +4 -0
  16. package/dist/server/index.js +113 -101
  17. package/dist/server/index.mjs +113 -101
  18. package/dist/server/src/content-types/index.d.ts +0 -4
  19. package/dist/server/src/content-types/navigation/index.d.ts +0 -4
  20. package/dist/server/src/content-types/navigation/schema.d.ts +0 -4
  21. package/dist/server/src/controllers/admin.d.ts +10 -10
  22. package/dist/server/src/controllers/client.d.ts +2 -2
  23. package/dist/server/src/controllers/validators.d.ts +2 -2
  24. package/dist/server/src/index.d.ts +7 -11
  25. package/dist/server/src/repositories/navigation-item.d.ts +8 -4
  26. package/dist/server/src/repositories/navigation.d.ts +12 -8
  27. package/dist/server/src/schemas/navigation.d.ts +8 -8
  28. package/dist/server/src/services/admin/admin.d.ts +2 -2
  29. package/dist/server/src/services/admin/types.d.ts +2 -2
  30. package/dist/server/src/services/admin/utils.d.ts +1 -1
  31. package/dist/server/src/services/client/client.d.ts +1 -1
  32. package/dist/server/src/services/index.d.ts +7 -7
  33. package/package.json +7 -8
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  const z = require("zod");
3
3
  const ___default = require("lodash");
4
- const cuid2 = require("@paralleldrive/cuid2");
5
4
  const fp = require("lodash/fp");
6
5
  const require$$1 = require("crypto");
7
6
  const require$$0$1 = require("child_process");
@@ -260,7 +259,7 @@ const navigationDBSchema = (withItems) => z__namespace.object({
260
259
  documentId: z__namespace.string(),
261
260
  name: z__namespace.string(),
262
261
  slug: z__namespace.string(),
263
- localeCode: z__namespace.string(),
262
+ locale: z__namespace.string(),
264
263
  visible: z__namespace.boolean(),
265
264
  items: withItems ? z__namespace.array(navigationItemDBSchema) : navigationItemDBSchema.array().optional()
266
265
  });
@@ -269,7 +268,7 @@ const createNavigationSchema = navigationDBSchema(false).omit({
269
268
  id: true,
270
269
  documentId: true,
271
270
  slug: true,
272
- localeCode: true
271
+ locale: true
273
272
  }).extend({
274
273
  documentId: z__namespace.string().optional(),
275
274
  id: z__namespace.undefined().optional()
@@ -527,15 +526,15 @@ const getNavigationItemRepository = ___default.once((context) => ({
527
526
  save(item) {
528
527
  const { itemModel } = getPluginModels(context);
529
528
  if (typeof item.documentId === "string") {
530
- const { documentId, id, ...rest } = item;
531
- return context.strapi.query(itemModel.uid).update({ where: { documentId: item.documentId }, data: { ...rest } });
529
+ const { documentId, ...rest } = item;
530
+ return context.strapi.documents(itemModel.uid).update({ documentId: item.documentId, data: { ...rest } });
532
531
  } else {
533
- return context.strapi.query(itemModel.uid).create({ data: item });
532
+ return context.strapi.documents(itemModel.uid).create({ data: item });
534
533
  }
535
534
  },
536
- find({ where, limit, order, populate: populate2 }) {
535
+ find({ filters: filters2, locale: locale2, limit, order, populate: populate2 }) {
537
536
  const { itemModel } = getPluginModels(context);
538
- return context.strapi.query(itemModel.uid).findMany({ where, limit, populate: populate2, orderBy: order }).then(navigationItemsDBSchema.parse);
537
+ return context.strapi.documents(itemModel.uid).findMany({ filters: filters2, locale: locale2, limit, populate: populate2, orderBy: order }).then(navigationItemsDBSchema.parse);
539
538
  },
540
539
  count(where) {
541
540
  const { itemModel } = getPluginModels(context);
@@ -584,31 +583,33 @@ const calculateItemsRequirement = (populate2) => {
584
583
  return populate2 === true ? true : Array.isArray(populate2) ? populate2.includes("items") : false;
585
584
  };
586
585
  const getNavigationRepository = ___default.once((context) => ({
587
- find({ where, limit, orderBy, populate: populate2 }) {
586
+ find({ filters: filters2, locale: locale2, limit, orderBy, populate: populate2 }) {
588
587
  const { masterModel } = getPluginModels(context);
589
- return context.strapi.query(masterModel.uid).findMany({ where, limit, populate: populate2, orderBy }).then((data) => {
588
+ return context.strapi.documents(masterModel.uid).findMany({ filters: filters2, locale: locale2, limit, populate: populate2, orderBy }).then((data) => {
590
589
  return navigationDBSchema(calculateItemsRequirement(populate2)).array().parse(data);
591
590
  });
592
591
  },
593
- findOne({ where, populate: populate2 }) {
592
+ findOne({ locale: locale2, filters: filters2, populate: populate2 }) {
594
593
  const { masterModel } = getPluginModels(context);
595
- return context.strapi.query(masterModel.uid).findOne({ where, populate: populate2 }).then((data) => {
594
+ return context.strapi.documents(masterModel.uid).findOne({ documentId: filters2.documentId, locale: locale2, populate: populate2 }).then((data) => {
596
595
  return navigationDBSchema(calculateItemsRequirement(populate2)).parse(data);
597
596
  });
598
597
  },
599
- save(navigation2) {
598
+ async save(navigation2) {
600
599
  const { masterModel } = getPluginModels(context);
601
- if (navigation2.documentId) {
602
- return context.strapi.query(masterModel.uid).update({
603
- where: { documentId: navigation2.documentId },
604
- data: ___default.omit(navigation2, ["id", "documentId"]),
600
+ const { documentId, locale: locale2, ...rest } = navigation2;
601
+ if (documentId) {
602
+ return context.strapi.documents(masterModel.uid).update({
603
+ locale: locale2,
604
+ documentId,
605
+ data: ___default.omit(rest, ["id", "documentId"]),
605
606
  populate: ["items"]
606
607
  }).then(navigationDBSchema(false).parse);
607
608
  } else {
608
- return context.strapi.query(masterModel.uid).create({
609
+ return context.strapi.documents(masterModel.uid).create({
610
+ locale: locale2,
609
611
  data: {
610
- ...navigation2,
611
- documentId: navigation2.documentId ?? cuid2.createId(),
612
+ ...rest,
612
613
  populate: ["items"]
613
614
  }
614
615
  }).then((x) => {
@@ -632,33 +633,32 @@ const navigationSetup = async (context) => {
632
633
  const navigationRepository = getNavigationRepository(context);
633
634
  const navigations = await navigationRepository.find({
634
635
  limit: Number.MAX_SAFE_INTEGER,
635
- where: {}
636
+ filters: {},
637
+ locale: "*"
636
638
  });
637
639
  if (navigations.length === 0) {
638
640
  navigations.push(
639
641
  await navigationRepository.save({
640
642
  name: DEFAULT_NAVIGATION_NAME,
641
- localeCode: defaultLocale,
642
643
  visible: true,
643
- slug: `${DEFAULT_NAVIGATION_SLUG}-${defaultLocale}`
644
+ locale: defaultLocale,
645
+ slug: DEFAULT_NAVIGATION_SLUG
644
646
  })
645
647
  );
646
648
  }
647
- const defaultLocaleNavigations = navigations.filter(
648
- ({ localeCode }) => localeCode === defaultLocale
649
- );
649
+ const defaultLocaleNavigations = navigations.filter(({ locale: locale2 }) => locale2 === defaultLocale);
650
650
  for (const defaultLocaleNavigation of defaultLocaleNavigations) {
651
651
  for (const otherLocale of restLocale) {
652
652
  const otherLocaleMissing = !navigations.find(
653
- ({ localeCode, documentId }) => documentId === defaultLocaleNavigation.documentId && otherLocale === localeCode
653
+ ({ locale: locale2, documentId }) => documentId === defaultLocaleNavigation.documentId && otherLocale === locale2
654
654
  );
655
655
  if (otherLocaleMissing) {
656
656
  await navigationRepository.save({
657
657
  documentId: defaultLocaleNavigation.documentId,
658
658
  name: defaultLocaleNavigation.name,
659
- localeCode: otherLocale,
659
+ locale: otherLocale,
660
660
  visible: defaultLocaleNavigation.visible,
661
- slug: `${defaultLocaleNavigation.slug.replace(`-${defaultLocale}`, "")}-${otherLocale}`
661
+ slug: defaultLocaleNavigation.slug
662
662
  });
663
663
  }
664
664
  }
@@ -1090,10 +1090,6 @@ const schema$2 = {
1090
1090
  target: "plugin::navigation.navigation-item",
1091
1091
  configurable: false,
1092
1092
  mappedBy: "master"
1093
- },
1094
- localeCode: {
1095
- type: "string",
1096
- configurable: false
1097
1093
  }
1098
1094
  }
1099
1095
  };
@@ -14773,7 +14769,7 @@ const processItems = (context) => async (item) => {
14773
14769
  const entity = context.entities.get(related);
14774
14770
  const localeVersion = await strapi.documents(entity.uid).findOne({
14775
14771
  documentId: entity.documentId,
14776
- locale: context.localeCode,
14772
+ locale: context.locale,
14777
14773
  status: "published"
14778
14774
  });
14779
14775
  if (localeVersion) {
@@ -14961,16 +14957,14 @@ const adminService = (context) => ({
14961
14957
  return acc;
14962
14958
  }, []);
14963
14959
  },
14964
- async get({ ids, localeCode }) {
14965
- let where = {};
14960
+ async get({ ids, locale: locale2 }) {
14961
+ let filters2 = {};
14966
14962
  if (ids && ids.length) {
14967
- where.id = { $in: ids };
14968
- }
14969
- if (localeCode) {
14970
- where.localeCode = localeCode;
14963
+ filters2.id = { $in: ids };
14971
14964
  }
14972
14965
  const dbResults = await getNavigationRepository(context).find({
14973
- where,
14966
+ filters: filters2,
14967
+ locale: locale2 || "*",
14974
14968
  limit: Number.MAX_SAFE_INTEGER,
14975
14969
  populate: ["items", "items.parent", "items.audience"]
14976
14970
  });
@@ -14979,7 +14973,7 @@ const adminService = (context) => ({
14979
14973
  item,
14980
14974
  parent
14981
14975
  }) => {
14982
- const children = allItems.filter((child) => child.parent?.id === item.id);
14976
+ const children = allItems.filter((child) => child.parent?.documentId === item.documentId);
14983
14977
  return {
14984
14978
  ...item,
14985
14979
  parent,
@@ -14999,22 +14993,22 @@ const adminService = (context) => ({
14999
14993
  allItems: navigation2.items ?? [],
15000
14994
  item
15001
14995
  })
15002
- )
14996
+ ).sort((a, b) => a.order - b.order)
15003
14997
  }));
15004
14998
  },
15005
- async getById({ documentId, localeCode }) {
14999
+ async getById({ documentId, locale: locale2 }) {
15006
15000
  const commonService2 = getPluginService(context, "common");
15007
- const where = {
15001
+ const { defaultLocale } = await commonService2.readLocale();
15002
+ const filters2 = {
15008
15003
  documentId
15009
15004
  };
15010
- if (localeCode) {
15011
- where.localeCode = localeCode;
15012
- }
15013
15005
  const navigation2 = await getNavigationRepository(context).findOne({
15014
- where
15006
+ filters: filters2,
15007
+ locale: locale2 || defaultLocale
15015
15008
  });
15016
15009
  const dbNavigationItems = await getNavigationItemRepository(context).find({
15017
- where: { master: navigation2.id },
15010
+ filters: { master: navigation2.id },
15011
+ locale: locale2 || defaultLocale,
15018
15012
  limit: Number.MAX_SAFE_INTEGER,
15019
15013
  order: [{ order: "asc" }],
15020
15014
  populate: ["parent", "audience"]
@@ -15037,7 +15031,7 @@ const adminService = (context) => ({
15037
15031
  const mainNavigation = await repository.save({
15038
15032
  name,
15039
15033
  visible,
15040
- localeCode: defaultLocale,
15034
+ locale: defaultLocale,
15041
15035
  slug
15042
15036
  });
15043
15037
  navigationSummary.push(await this.getById({ documentId: mainNavigation.documentId }));
@@ -15045,8 +15039,8 @@ const adminService = (context) => ({
15045
15039
  const newLocaleNavigation = await repository.save({
15046
15040
  name,
15047
15041
  visible,
15048
- localeCode,
15049
- slug: `${slug}-${localeCode}`,
15042
+ locale: localeCode,
15043
+ slug,
15050
15044
  documentId: mainNavigation.documentId
15051
15045
  });
15052
15046
  navigationSummary.push(await this.getById({ documentId: newLocaleNavigation.documentId }));
@@ -15071,30 +15065,37 @@ const adminService = (context) => ({
15071
15065
  async put({ auditLog, payload }) {
15072
15066
  const { masterModel } = getPluginModels(context);
15073
15067
  const commonService2 = getPluginService(context, "common");
15074
- const { defaultLocale } = await commonService2.readLocale();
15068
+ const { defaultLocale, restLocale } = await commonService2.readLocale();
15075
15069
  const repository = getNavigationRepository(context);
15076
15070
  const { name, visible, items } = payload;
15077
15071
  const currentNavigation = await repository.findOne({
15078
- where: { documentId: payload.documentId, localeCode: payload.localeCode },
15079
- populate: true
15072
+ filters: { documentId: payload.documentId },
15073
+ locale: payload.locale,
15074
+ populate: "*"
15080
15075
  });
15081
15076
  const currentNavigationAsDTO = await this.getById({
15082
15077
  documentId: payload.documentId,
15083
- localeCode: payload.localeCode
15078
+ locale: payload.locale
15084
15079
  });
15085
15080
  const detailsHaveChanged = currentNavigation.name !== name || currentNavigation.visible !== visible;
15086
15081
  if (detailsHaveChanged) {
15087
- const allNavigations = await repository.find({
15088
- where: { documentId: currentNavigation.documentId }
15089
- });
15082
+ const newSlug = name ? await commonService2.getSlug({
15083
+ query: name
15084
+ }) : currentNavigation.slug;
15085
+ const allNavigations = await Promise.all(
15086
+ [defaultLocale, ...restLocale].map(
15087
+ (locale2) => repository.findOne({
15088
+ filters: { documentId: currentNavigation.documentId },
15089
+ locale: locale2
15090
+ })
15091
+ )
15092
+ );
15090
15093
  for (const navigation2 of allNavigations) {
15091
- const newSlug = name ? await commonService2.getSlug({
15092
- query: `${name}${navigation2.localeCode !== defaultLocale ? ` ${navigation2.localeCode}` : ""}`
15093
- }) : currentNavigation.slug;
15094
15094
  await repository.save({
15095
15095
  documentId: navigation2.documentId,
15096
15096
  id: navigation2.id,
15097
15097
  slug: newSlug,
15098
+ locale: navigation2.locale,
15098
15099
  name,
15099
15100
  visible
15100
15101
  });
@@ -15115,8 +15116,8 @@ const adminService = (context) => ({
15115
15116
  });
15116
15117
  await commonService2.emitEvent({
15117
15118
  entity: await repository.findOne({
15118
- where: { documentId: payload.documentId },
15119
- populate: true
15119
+ filters: { documentId: payload.documentId },
15120
+ populate: "*"
15120
15121
  }),
15121
15122
  event: "entry.update",
15122
15123
  uid: masterModel.uid
@@ -15143,12 +15144,12 @@ const adminService = (context) => ({
15143
15144
  );
15144
15145
  };
15145
15146
  const navigation2 = await navigationRepository.findOne({
15146
- where: { documentId },
15147
- populate: true
15147
+ filters: { documentId },
15148
+ populate: "*"
15148
15149
  });
15149
15150
  const allNavigations = await navigationRepository.find({
15150
- where: { documentId: navigation2.documentId },
15151
- populate: true
15151
+ filters: { documentId: navigation2.documentId },
15152
+ populate: "*"
15152
15153
  });
15153
15154
  await cleanNavigationItems(
15154
15155
  allNavigations.map(({ documentId: documentId2 }) => documentId2)
@@ -15175,7 +15176,6 @@ const adminService = (context) => ({
15175
15176
  key: "config"
15176
15177
  }).then(configSchema.parse);
15177
15178
  validateAdditionalFields(newConfig.additionalFields);
15178
- console.log({ newConfig });
15179
15179
  await pluginStore.set({ key: "config", value: newConfig });
15180
15180
  const removedFields = ___default.differenceBy(
15181
15181
  config2.additionalFields,
@@ -15198,11 +15198,11 @@ const adminService = (context) => ({
15198
15198
  target,
15199
15199
  documentId
15200
15200
  }) {
15201
- const targetEntity = await this.getById({ documentId, localeCode: target });
15201
+ const targetEntity = await this.getById({ documentId, locale: target });
15202
15202
  return await this.i18nNavigationContentsCopy({
15203
- source: await this.getById({ documentId, localeCode: source }),
15203
+ source: await this.getById({ documentId, locale: source }),
15204
15204
  target: targetEntity
15205
- }).then(() => this.getById({ documentId, localeCode: target })).then((newEntity) => {
15205
+ }).then(() => this.getById({ documentId, locale: target })).then((newEntity) => {
15206
15206
  sendAuditLog(auditLog, "onChangeNavigation", {
15207
15207
  actionType: "UPDATE",
15208
15208
  oldEntity: targetEntity,
@@ -15221,7 +15221,7 @@ const adminService = (context) => ({
15221
15221
  if (target.items?.length) {
15222
15222
  throw new FillNavigationError("Current navigation is non-empty");
15223
15223
  }
15224
- if (!target.localeCode) {
15224
+ if (!target.locale) {
15225
15225
  throw new FillNavigationError("Current navigation does not have specified locale");
15226
15226
  }
15227
15227
  if (!sourceItems.length) {
@@ -15230,15 +15230,16 @@ const adminService = (context) => ({
15230
15230
  const entities = /* @__PURE__ */ new Map();
15231
15231
  const itemProcessor = processItems({
15232
15232
  master: target,
15233
- localeCode: target.localeCode,
15233
+ locale: target.locale,
15234
15234
  strapi,
15235
15235
  entities
15236
15236
  });
15237
15237
  await commonService2.createBranch({
15238
15238
  action: { create: true },
15239
15239
  masterEntity: await navigationRepository.findOne({
15240
- where: { documentId: target.documentId, localeCode: target.localeCode },
15241
- populate: true
15240
+ filters: { documentId: target.documentId },
15241
+ locale: target.locale,
15242
+ populate: "*"
15242
15243
  }),
15243
15244
  navigationItems: await Promise.all(sourceItems.map(itemProcessor)),
15244
15245
  parentItem: void 0
@@ -15311,7 +15312,7 @@ const adminService = (context) => ({
15311
15312
  },
15312
15313
  async purgeNavigationCache(documentId, clearLocalisations) {
15313
15314
  const navigationRepository = getNavigationRepository(context);
15314
- const entity = await navigationRepository.findOne({ where: { documentId } });
15315
+ const entity = await navigationRepository.findOne({ filters: { documentId } });
15315
15316
  if (!entity) {
15316
15317
  throw new errors.NotFoundError("Navigation is not defined");
15317
15318
  }
@@ -15319,7 +15320,7 @@ const adminService = (context) => ({
15319
15320
  let regexps = [mapToRegExp(entity.documentId)];
15320
15321
  if (clearLocalisations) {
15321
15322
  const navigations = await navigationRepository.find({
15322
- where: {
15323
+ filters: {
15323
15324
  documentId: entity.documentId
15324
15325
  }
15325
15326
  });
@@ -15410,9 +15411,7 @@ const clientService = (context) => ({
15410
15411
  async readAll({ locale: locale2, orderBy = "createdAt", orderDirection = "DESC" }) {
15411
15412
  const repository = getNavigationRepository(context);
15412
15413
  const navigations = repository.find({
15413
- where: locale2 ? {
15414
- localeCode: locale2
15415
- } : {},
15414
+ locale: locale2,
15416
15415
  orderBy: { [orderBy]: orderDirection }
15417
15416
  });
15418
15417
  return navigations;
@@ -15424,6 +15423,9 @@ const clientService = (context) => ({
15424
15423
  type: type2,
15425
15424
  audience: audience2?.map(({ key }) => key)
15426
15425
  };
15426
+ if (type2 === "WRAPPER") {
15427
+ return { ...itemCommon };
15428
+ }
15427
15429
  if (type2 === "EXTERNAL") {
15428
15430
  assertNotEmpty(
15429
15431
  path2,
@@ -15589,26 +15591,34 @@ const clientService = (context) => ({
15589
15591
  };
15590
15592
  const navigationRepository = getNavigationRepository(context);
15591
15593
  const navigationItemRepository = getNavigationItemRepository(context);
15592
- let navigation2 = await navigationRepository.findOne({
15593
- where: entityWhereClause
15594
- });
15595
- if (locale2 && locale2 !== navigation2.localeCode) {
15596
- navigation2 = await navigationRepository.findOne({
15597
- where: {
15598
- ...entityWhereClause,
15599
- localeCode: locale2
15600
- }
15594
+ let navigation2;
15595
+ if (locale2) {
15596
+ navigation2 = await navigationRepository.find({
15597
+ filters: {
15598
+ ...entityWhereClause
15599
+ },
15600
+ locale: locale2,
15601
+ limit: 1
15602
+ });
15603
+ } else {
15604
+ navigation2 = await navigationRepository.find({
15605
+ filters: entityWhereClause,
15606
+ limit: 1
15601
15607
  });
15602
15608
  }
15609
+ if (___default.isArray(navigation2)) {
15610
+ navigation2 = ___default.first(navigation2);
15611
+ }
15603
15612
  if (navigation2 && navigation2.documentId) {
15604
15613
  const navigationItems = await navigationItemRepository.find({
15605
- where: {
15614
+ filters: {
15606
15615
  master: navigation2,
15607
15616
  ...itemCriteria
15608
15617
  },
15618
+ locale: locale2,
15609
15619
  limit: Number.MAX_SAFE_INTEGER,
15610
15620
  order: [{ order: "asc" }],
15611
- populate: ["related", "audience", "parent"]
15621
+ populate: ["audience", "parent"]
15612
15622
  });
15613
15623
  const mappedItems = await commonService2.mapToNavigationItemDTO({
15614
15624
  navigationItems,
@@ -15838,7 +15848,7 @@ const commonService = (context) => ({
15838
15848
  documentId,
15839
15849
  ___default.isNil(populate2) ? config2.contentTypesPopulate[uid] || [] : parsePopulateQuery(populate2),
15840
15850
  "published",
15841
- { locale: master?.localeCode }
15851
+ { locale: master?.locale }
15842
15852
  );
15843
15853
  if (relatedItem) {
15844
15854
  entities.set(related, {
@@ -15935,7 +15945,7 @@ const commonService = (context) => ({
15935
15945
  }) {
15936
15946
  const navigationActions = [];
15937
15947
  for (const navigationItem2 of navigationItems) {
15938
- if (!navigationItem2.id) {
15948
+ if (!navigationItem2.documentId) {
15939
15949
  continue;
15940
15950
  }
15941
15951
  action.remove = true;
@@ -15961,14 +15971,16 @@ const commonService = (context) => ({
15961
15971
  let navigationActions = [];
15962
15972
  for (const navigationItem2 of navigationItems) {
15963
15973
  action.create = true;
15964
- const { parent, master, items, id, ...params } = navigationItem2;
15965
- const insertDetails = id ? {
15974
+ const { parent, master, items, documentId, id, ...params } = navigationItem2;
15975
+ const insertDetails = documentId && id ? {
15966
15976
  ...params,
15977
+ documentId,
15967
15978
  id,
15968
15979
  master: masterEntity ? masterEntity.id : void 0,
15969
15980
  parent: parentItem ? parentItem.id : void 0
15970
15981
  } : {
15971
15982
  ...params,
15983
+ documentId: void 0,
15972
15984
  id: void 0,
15973
15985
  master: masterEntity ? masterEntity.id : void 0,
15974
15986
  parent: parentItem ? parentItem.id : void 0
@@ -15997,11 +16009,11 @@ const commonService = (context) => ({
15997
16009
  const result = [];
15998
16010
  for (const updateDetails of navigationItems) {
15999
16011
  action.update = true;
16000
- const { id, updated, parent, master, items, ...params } = updateDetails;
16012
+ const { documentId, updated, parent, master, items, ...params } = updateDetails;
16001
16013
  let currentItem;
16002
16014
  if (updated) {
16003
16015
  currentItem = await getNavigationItemRepository(context).save({
16004
- id,
16016
+ documentId,
16005
16017
  ...params
16006
16018
  });
16007
16019
  } else {
@@ -16046,7 +16058,7 @@ const commonService = (context) => ({
16046
16058
  const removedFieldsKeys = removedFields.map(({ name }) => `additionalFields.${name}`);
16047
16059
  const removedFieldsNames = removedFields.map(({ name }) => name);
16048
16060
  const navigationItems = await getNavigationItemRepository(context).find({
16049
- where: {
16061
+ filters: {
16050
16062
  additionalFields: {
16051
16063
  $contains: [removedFieldsNames]
16052
16064
  }
@@ -16130,7 +16142,7 @@ const migrationService = (context) => ({
16130
16142
  async migrateRelatedIdToDocumentId() {
16131
16143
  console.log("Navigation plugin :: Migrations :: Relared id to document id - START");
16132
16144
  const navigationItemRepository = getNavigationItemRepository(context);
16133
- const all = await navigationItemRepository.find({ where: {}, limit: Number.MAX_SAFE_INTEGER });
16145
+ const all = await navigationItemRepository.find({ filters: {}, limit: Number.MAX_SAFE_INTEGER });
16134
16146
  await Promise.all(
16135
16147
  all.map(async (item) => {
16136
16148
  if (item.related) {