strapi-plugin-meilisearch 0.13.2 → 0.13.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.
@@ -3,7 +3,7 @@ import * as React from "react";
3
3
  import { useState, useEffect, memo } from "react";
4
4
  import { Routes, Route } from "react-router-dom";
5
5
  import { useNotification, useFetchClient, useRBAC, private_useAutoReloadOverlayBlocker, private_AutoReloadOverlayBlockerProvider, Page, Layouts, BackButton } from "@strapi/strapi/admin";
6
- import { p as pluginId, P as PERMISSIONS } from "./index-CnETd4ds.mjs";
6
+ import { p as pluginId, P as PERMISSIONS } from "./index-BTlN9jCr.mjs";
7
7
  import { Tr, Td, Checkbox, Typography, Flex, Box, Button, Thead, Th, VisuallyHidden, Table, Tbody, Field, Link, Tabs } from "@strapi/design-system";
8
8
  var __assign = function() {
9
9
  __assign = Object.assign || function __assign2(t) {
@@ -4,7 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const reactRouterDom = require("react-router-dom");
6
6
  const admin = require("@strapi/strapi/admin");
7
- const index = require("./index-OgM-GMGo.js");
7
+ const index = require("./index-CMmYtjmc.js");
8
8
  const designSystem = require("@strapi/design-system");
9
9
  function _interopNamespace(e) {
10
10
  if (e && e.__esModule) return e;
@@ -18,7 +18,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
18
18
  });
19
19
  };
20
20
  const name$1 = "strapi-plugin-meilisearch";
21
- const version = "0.13.2";
21
+ const version = "0.13.4";
22
22
  const description = "Synchronise and search in your Strapi content-types with Meilisearch";
23
23
  const scripts = {
24
24
  build: "strapi-plugin build",
@@ -210,7 +210,7 @@ const index = {
210
210
  defaultMessage: name
211
211
  },
212
212
  Component: async () => {
213
- const { App } = await import("./App-C_AT8Sze.mjs");
213
+ const { App } = await import("./App-BPVMrqHd.mjs");
214
214
  return App;
215
215
  },
216
216
  permissions: PERMISSIONS.main
@@ -19,7 +19,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
19
19
  });
20
20
  };
21
21
  const name$1 = "strapi-plugin-meilisearch";
22
- const version = "0.13.2";
22
+ const version = "0.13.4";
23
23
  const description = "Synchronise and search in your Strapi content-types with Meilisearch";
24
24
  const scripts = {
25
25
  build: "strapi-plugin build",
@@ -211,7 +211,7 @@ const index = {
211
211
  defaultMessage: name
212
212
  },
213
213
  Component: async () => {
214
- const { App } = await Promise.resolve().then(() => require("./App-4wYXCpIt.js"));
214
+ const { App } = await Promise.resolve().then(() => require("./App-Dx-0FOiS.js"));
215
215
  return App;
216
216
  },
217
217
  permissions: PERMISSIONS.main
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-OgM-GMGo.js");
2
+ const index = require("../_chunks/index-CMmYtjmc.js");
3
3
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "../_chunks/index-CnETd4ds.mjs";
1
+ import { i } from "../_chunks/index-BTlN9jCr.mjs";
2
2
  export {
3
3
  i as default
4
4
  };
@@ -724,20 +724,23 @@ const contentTypeService = ({ strapi: strapi2 }) => ({
724
724
  * @param {object} [options.entriesQuery={}] - Options to apply when fetching entries from the database.
725
725
  * @param {string | string[]} [options.entriesQuery.fields] - Fields present in the returned entry.
726
726
  * @param {object} [options.entriesQuery.populate] - Relations, components and dynamic zones to populate.
727
- * @param {object} [options.entriesQuery.locale] - When using internalization, the language to fetch.
727
+ * @param {string} [options.entriesQuery.status] - Publication state: draft or published.
728
+ * @param {string} [options.entriesQuery.locale] - When using internationalization (i18n), the language to fetch.
728
729
  * @param {string} options.contentType - Content type.
729
730
  *
730
731
  * @returns {Promise<object>} - Entries.
731
732
  */
732
733
  async getEntry({ contentType: contentType2, documentId, entriesQuery = {} }) {
733
- const { populate = "*", fields = "*" } = entriesQuery;
734
+ const {
735
+ populate = "*",
736
+ fields = "*",
737
+ status = "published",
738
+ locale
739
+ } = entriesQuery;
740
+ const queryOptions = { documentId, fields, populate, status, locale };
734
741
  const contentTypeUid = this.getContentTypeUid({ contentType: contentType2 });
735
742
  if (contentTypeUid === void 0) return {};
736
- const entry = await strapi2.documents(contentTypeUid).findOne({
737
- documentId,
738
- fields,
739
- populate
740
- });
743
+ const entry = await strapi2.documents(contentTypeUid).findOne(queryOptions);
741
744
  if (entry == null) {
742
745
  strapi2.log.error(
743
746
  `Could not find entry with id ${documentId} in ${contentType2}`
@@ -758,7 +761,7 @@ const contentTypeService = ({ strapi: strapi2 }) => ({
758
761
  * @param {object} [options.populate] - Relations, components and dynamic zones to populate.
759
762
  * @param {object} [options.status] - Publication state: draft or published.
760
763
  * @param {string} options.contentType - Content type.
761
- * @param {string} [options.locale] - When using internalization, the language to fetch.
764
+ * @param {string} [options.locale] - When using internationalization (i18n), the language to fetch.
762
765
  *
763
766
  * @returns {Promise<object[]>} - Entries.
764
767
  */
@@ -782,11 +785,9 @@ const contentTypeService = ({ strapi: strapi2 }) => ({
782
785
  filters,
783
786
  sort,
784
787
  populate,
785
- status
788
+ status,
789
+ locale
786
790
  };
787
- if (locale) {
788
- queryOptions.locale = locale;
789
- }
790
791
  const entries = await strapi2.documents(contentTypeUid).findMany(queryOptions);
791
792
  if (entries && !Array.isArray(entries)) return [entries];
792
793
  return entries || [];
@@ -1341,7 +1342,9 @@ const configurationService = ({ strapi: strapi2 }) => {
1341
1342
  if (entriesQuery.status === "draft") {
1342
1343
  return entries;
1343
1344
  } else {
1344
- return entries.filter((entry) => !(entry?.publishedAt === null));
1345
+ return entries.filter(
1346
+ (entry) => !(entry?.publishedAt === void 0 || entry?.publishedAt === null)
1347
+ );
1345
1348
  }
1346
1349
  },
1347
1350
  /**
@@ -1369,7 +1372,7 @@ const configurationService = ({ strapi: strapi2 }) => {
1369
1372
  }
1370
1373
  };
1371
1374
  };
1372
- const version = "0.13.2";
1375
+ const version = "0.13.4";
1373
1376
  const Meilisearch = (config2) => {
1374
1377
  return new meilisearch$1.MeiliSearch({
1375
1378
  ...config2,
@@ -1829,9 +1832,13 @@ const lifecycleService = ({ strapi: strapi2 }) => {
1829
1832
  const entry = await contentTypeService2.getEntry({
1830
1833
  contentType: contentTypeUid,
1831
1834
  documentId: result.documentId,
1832
- entriesQuery: meilisearch2.entriesQuery({ contentType: contentType2 })
1835
+ entriesQuery: {
1836
+ ...meilisearch2.entriesQuery({ contentType: contentType2 }),
1837
+ locale: result.locale,
1838
+ status: "published"
1839
+ }
1833
1840
  });
1834
- meilisearch2.addEntriesToMeilisearch({
1841
+ await meilisearch2.addEntriesToMeilisearch({
1835
1842
  contentType: contentTypeUid,
1836
1843
  entries: [entry]
1837
1844
  }).catch((e) => {
@@ -1875,9 +1882,13 @@ const lifecycleService = ({ strapi: strapi2 }) => {
1875
1882
  const entry = await contentTypeService2.getEntry({
1876
1883
  contentType: contentTypeUid,
1877
1884
  documentId: result.documentId,
1878
- entriesQuery: meilisearch2.entriesQuery({ contentType: contentType2 })
1885
+ entriesQuery: {
1886
+ ...meilisearch2.entriesQuery({ contentType: contentType2 }),
1887
+ locale: result.locale,
1888
+ status: "published"
1889
+ }
1879
1890
  });
1880
- meilisearch2.updateEntriesInMeilisearch({
1891
+ await meilisearch2.updateEntriesInMeilisearch({
1881
1892
  contentType: contentTypeUid,
1882
1893
  entries: [entry]
1883
1894
  }).catch((e) => {
@@ -723,20 +723,23 @@ const contentTypeService = ({ strapi: strapi2 }) => ({
723
723
  * @param {object} [options.entriesQuery={}] - Options to apply when fetching entries from the database.
724
724
  * @param {string | string[]} [options.entriesQuery.fields] - Fields present in the returned entry.
725
725
  * @param {object} [options.entriesQuery.populate] - Relations, components and dynamic zones to populate.
726
- * @param {object} [options.entriesQuery.locale] - When using internalization, the language to fetch.
726
+ * @param {string} [options.entriesQuery.status] - Publication state: draft or published.
727
+ * @param {string} [options.entriesQuery.locale] - When using internationalization (i18n), the language to fetch.
727
728
  * @param {string} options.contentType - Content type.
728
729
  *
729
730
  * @returns {Promise<object>} - Entries.
730
731
  */
731
732
  async getEntry({ contentType: contentType2, documentId, entriesQuery = {} }) {
732
- const { populate = "*", fields = "*" } = entriesQuery;
733
+ const {
734
+ populate = "*",
735
+ fields = "*",
736
+ status = "published",
737
+ locale
738
+ } = entriesQuery;
739
+ const queryOptions = { documentId, fields, populate, status, locale };
733
740
  const contentTypeUid = this.getContentTypeUid({ contentType: contentType2 });
734
741
  if (contentTypeUid === void 0) return {};
735
- const entry = await strapi2.documents(contentTypeUid).findOne({
736
- documentId,
737
- fields,
738
- populate
739
- });
742
+ const entry = await strapi2.documents(contentTypeUid).findOne(queryOptions);
740
743
  if (entry == null) {
741
744
  strapi2.log.error(
742
745
  `Could not find entry with id ${documentId} in ${contentType2}`
@@ -757,7 +760,7 @@ const contentTypeService = ({ strapi: strapi2 }) => ({
757
760
  * @param {object} [options.populate] - Relations, components and dynamic zones to populate.
758
761
  * @param {object} [options.status] - Publication state: draft or published.
759
762
  * @param {string} options.contentType - Content type.
760
- * @param {string} [options.locale] - When using internalization, the language to fetch.
763
+ * @param {string} [options.locale] - When using internationalization (i18n), the language to fetch.
761
764
  *
762
765
  * @returns {Promise<object[]>} - Entries.
763
766
  */
@@ -781,11 +784,9 @@ const contentTypeService = ({ strapi: strapi2 }) => ({
781
784
  filters,
782
785
  sort,
783
786
  populate,
784
- status
787
+ status,
788
+ locale
785
789
  };
786
- if (locale) {
787
- queryOptions.locale = locale;
788
- }
789
790
  const entries = await strapi2.documents(contentTypeUid).findMany(queryOptions);
790
791
  if (entries && !Array.isArray(entries)) return [entries];
791
792
  return entries || [];
@@ -1340,7 +1341,9 @@ const configurationService = ({ strapi: strapi2 }) => {
1340
1341
  if (entriesQuery.status === "draft") {
1341
1342
  return entries;
1342
1343
  } else {
1343
- return entries.filter((entry) => !(entry?.publishedAt === null));
1344
+ return entries.filter(
1345
+ (entry) => !(entry?.publishedAt === void 0 || entry?.publishedAt === null)
1346
+ );
1344
1347
  }
1345
1348
  },
1346
1349
  /**
@@ -1368,7 +1371,7 @@ const configurationService = ({ strapi: strapi2 }) => {
1368
1371
  }
1369
1372
  };
1370
1373
  };
1371
- const version = "0.13.2";
1374
+ const version = "0.13.4";
1372
1375
  const Meilisearch = (config2) => {
1373
1376
  return new MeiliSearch({
1374
1377
  ...config2,
@@ -1828,9 +1831,13 @@ const lifecycleService = ({ strapi: strapi2 }) => {
1828
1831
  const entry = await contentTypeService2.getEntry({
1829
1832
  contentType: contentTypeUid,
1830
1833
  documentId: result.documentId,
1831
- entriesQuery: meilisearch2.entriesQuery({ contentType: contentType2 })
1834
+ entriesQuery: {
1835
+ ...meilisearch2.entriesQuery({ contentType: contentType2 }),
1836
+ locale: result.locale,
1837
+ status: "published"
1838
+ }
1832
1839
  });
1833
- meilisearch2.addEntriesToMeilisearch({
1840
+ await meilisearch2.addEntriesToMeilisearch({
1834
1841
  contentType: contentTypeUid,
1835
1842
  entries: [entry]
1836
1843
  }).catch((e) => {
@@ -1874,9 +1881,13 @@ const lifecycleService = ({ strapi: strapi2 }) => {
1874
1881
  const entry = await contentTypeService2.getEntry({
1875
1882
  contentType: contentTypeUid,
1876
1883
  documentId: result.documentId,
1877
- entriesQuery: meilisearch2.entriesQuery({ contentType: contentType2 })
1884
+ entriesQuery: {
1885
+ ...meilisearch2.entriesQuery({ contentType: contentType2 }),
1886
+ locale: result.locale,
1887
+ status: "published"
1888
+ }
1878
1889
  });
1879
- meilisearch2.updateEntriesInMeilisearch({
1890
+ await meilisearch2.updateEntriesInMeilisearch({
1880
1891
  contentType: contentTypeUid,
1881
1892
  entries: [entry]
1882
1893
  }).catch((e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-meilisearch",
3
- "version": "0.13.2",
3
+ "version": "0.13.4",
4
4
  "description": "Synchronise and search in your Strapi content-types with Meilisearch",
5
5
  "scripts": {
6
6
  "build": "strapi-plugin build",