@littlebox/strapi-suite 1.0.56 → 1.0.57
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/dist/_chunks/{App-Dnmp5zFS.mjs → App-agSgfZ_o.mjs} +3 -3
- package/dist/_chunks/{App-1GsyRTBJ.js → App-bYPLxRJW.js} +3 -3
- package/dist/_chunks/{ImageFieldInput-DjFbcxyf.js → ImageFieldInput-AeRfPoVC.js} +2 -2
- package/dist/_chunks/{ImageFieldInput-O_QYJ-xH.mjs → ImageFieldInput-BT-p0eaI.mjs} +2 -2
- package/dist/_chunks/{SlugInput-BZDFFS8G.mjs → SlugInput-CHmnYNtp.mjs} +1 -1
- package/dist/_chunks/{SlugInput-l36ezrCg.js → SlugInput-CabJiXCL.js} +1 -1
- package/dist/_chunks/{fullScreen-D27-jNKf.js → fullScreen-BLfwi2Jr.js} +1 -1
- package/dist/_chunks/{fullScreen-BEdXKQzo.mjs → fullScreen-Bptl14FH.mjs} +1 -1
- package/dist/_chunks/{index-D-BR2cEM.js → index-DcqMfW_Q.js} +3 -3
- package/dist/_chunks/{index-v8i2X1Bs.mjs → index-WIuZTI9m.mjs} +3 -3
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +16 -8
- package/dist/server/index.mjs +16 -8
- package/dist/server/src/utils/deleteMatching.d.ts +7 -0
- package/package.json +1 -1
|
@@ -2,12 +2,12 @@ import { jsxs, jsx, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
|
2
2
|
import { useNavigate, useParams, useLocation, Link, Navigate, useBlocker, useSearchParams, Routes, Route } from "react-router-dom";
|
|
3
3
|
import React__default, { useState, useEffect, createContext, useContext, useRef, Fragment as Fragment$2, useDebugValue, forwardRef, useLayoutEffect, useMemo, useCallback, useImperativeHandle, Children, useId, useReducer } from "react";
|
|
4
4
|
import { Box, Loader, Main, Typography, Button, Flex, Breadcrumbs, Crumb, CrumbLink, CardBody, CardContent, CardTitle, CardBadge, CardSubtitle, Card as Card$2, Field, TextInput, SingleSelect, SingleSelectOption, Checkbox, Table, Tbody, Tr, Td, Thead, Th, Modal, Radio, Dialog, IconButton, Toggle, SearchForm, Searchbar, VisuallyHidden, EmptyStateLayout, Tooltip, Pagination, PreviousLink, Dots, PageLink, NextLink, Grid, Popover, Tag as Tag$2, Textarea, Combobox, ComboboxOption, Switch, Tabs, Link as Link$1, Badge, SimpleMenu, MenuItem as MenuItem$1, Divider, Alert } from "@strapi/design-system";
|
|
5
|
-
import { R as Registry, F as FetchSettings, g as getTranslation, c as config, S as SLUG_LANGUAGE_STRATEGY, a as SLUG_CONTENT_STRATEGY, b as FetchSlugs, d as FetchLocales, e as convertToSlug, A as AI_TRANSLATION_DEFAULT_MODEL, f as fetchTemplates } from "./index-
|
|
5
|
+
import { R as Registry, F as FetchSettings, g as getTranslation, c as config, S as SLUG_LANGUAGE_STRATEGY, a as SLUG_CONTENT_STRATEGY, b as FetchSlugs, d as FetchLocales, e as convertToSlug, A as AI_TRANSLATION_DEFAULT_MODEL, f as fetchTemplates } from "./index-WIuZTI9m.mjs";
|
|
6
6
|
import { ArrowLeft, ExternalLink, WarningCircle, Cross, BulletList, Pencil, Trash, Plus, Duplicate, Drag, Check, Sparkle, Bold as Bold$1, Italic as Italic$1, Underline as Underline$1, CaretDown, Search, Information, ArrowClockwise, ChevronLeft, ChevronRight, More } from "@strapi/icons";
|
|
7
7
|
import { useIntl } from "react-intl";
|
|
8
8
|
import styled, { useTheme, createGlobalStyle } from "styled-components";
|
|
9
9
|
import { useRBAC, useNotification, useAuth } from "@strapi/strapi/admin";
|
|
10
|
-
import { r as rbacKey, D as DoodleSvg, S as Sparkle$1, a as Dot, P as PROMOTIONS_READ_ACTION, b as PROMOTIONS_MANAGE_ACTION, C as CUSTOMERS_READ_ACTION, R as REFUNDS_MANAGE_ACTION, f as filterMenu, F as FULL_SCREEN_MODAL, c as CROP_BODY, d as CropZoomStep, I as ImageDropzone, e as CropFooter, M as MAX_IMAGE_BYTES, s as startSize, g as buildUploadForm, i as imageErrorCode, h as formatBytes, j as SETTINGS_READ_ACTION, k as SETTINGS_MANAGE_ACTION, l as ImageDrop, m as CUSTOMERS_MANAGE_ACTION, n as CUSTOMERS_BLOCK_ACTION, o as CUSTOMERS_PASSWORD_ACTION, O as ORDERS_READ_ACTION, p as ORDERS_MANAGE_ACTION, q as PAYMENTS_MANAGE_ACTION, t as INVOICING_MANAGE_ACTION } from "./fullScreen-
|
|
10
|
+
import { r as rbacKey, D as DoodleSvg, S as Sparkle$1, a as Dot, P as PROMOTIONS_READ_ACTION, b as PROMOTIONS_MANAGE_ACTION, C as CUSTOMERS_READ_ACTION, R as REFUNDS_MANAGE_ACTION, f as filterMenu, F as FULL_SCREEN_MODAL, c as CROP_BODY, d as CropZoomStep, I as ImageDropzone, e as CropFooter, M as MAX_IMAGE_BYTES, s as startSize, g as buildUploadForm, i as imageErrorCode, h as formatBytes, j as SETTINGS_READ_ACTION, k as SETTINGS_MANAGE_ACTION, l as ImageDrop, m as CUSTOMERS_MANAGE_ACTION, n as CUSTOMERS_BLOCK_ACTION, o as CUSTOMERS_PASSWORD_ACTION, O as ORDERS_READ_ACTION, p as ORDERS_MANAGE_ACTION, q as PAYMENTS_MANAGE_ACTION, t as INVOICING_MANAGE_ACTION } from "./fullScreen-Bptl14FH.mjs";
|
|
11
11
|
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
12
12
|
import { DndContext, DragOverlay, pointerWithin, rectIntersection } from "@dnd-kit/core";
|
|
13
13
|
import { useSortable, SortableContext, verticalListSortingStrategy, arrayMove } from "@dnd-kit/sortable";
|
|
@@ -1379,7 +1379,7 @@ const HomePage = () => {
|
|
|
1379
1379
|
style: { marginRight: "10px" },
|
|
1380
1380
|
endIcon: /* @__PURE__ */ jsx(ExternalLink, {}),
|
|
1381
1381
|
onClick: () => window.open("https://www.npmjs.com/package/@littlebox/strapi-suite", "_blank"),
|
|
1382
|
-
children: "v1.0.
|
|
1382
|
+
children: "v1.0.57"
|
|
1383
1383
|
}
|
|
1384
1384
|
),
|
|
1385
1385
|
/* @__PURE__ */ jsx(
|
|
@@ -4,12 +4,12 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const reactRouterDom = require("react-router-dom");
|
|
5
5
|
const React = require("react");
|
|
6
6
|
const designSystem = require("@strapi/design-system");
|
|
7
|
-
const index = require("./index-
|
|
7
|
+
const index = require("./index-DcqMfW_Q.js");
|
|
8
8
|
const icons = require("@strapi/icons");
|
|
9
9
|
const reactIntl = require("react-intl");
|
|
10
10
|
const styled = require("styled-components");
|
|
11
11
|
const admin = require("@strapi/strapi/admin");
|
|
12
|
-
const fullScreen = require("./fullScreen-
|
|
12
|
+
const fullScreen = require("./fullScreen-BLfwi2Jr.js");
|
|
13
13
|
const symbols = require("@strapi/icons/symbols");
|
|
14
14
|
const core = require("@dnd-kit/core");
|
|
15
15
|
const sortable = require("@dnd-kit/sortable");
|
|
@@ -1386,7 +1386,7 @@ const HomePage = () => {
|
|
|
1386
1386
|
style: { marginRight: "10px" },
|
|
1387
1387
|
endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ExternalLink, {}),
|
|
1388
1388
|
onClick: () => window.open("https://www.npmjs.com/package/@littlebox/strapi-suite", "_blank"),
|
|
1389
|
-
children: "v1.0.
|
|
1389
|
+
children: "v1.0.57"
|
|
1390
1390
|
}
|
|
1391
1391
|
),
|
|
1392
1392
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5,9 +5,9 @@ const React = require("react");
|
|
|
5
5
|
const reactIntl = require("react-intl");
|
|
6
6
|
const designSystem = require("@strapi/design-system");
|
|
7
7
|
const icons = require("@strapi/icons");
|
|
8
|
-
const index = require("./index-
|
|
8
|
+
const index = require("./index-DcqMfW_Q.js");
|
|
9
9
|
const admin = require("@strapi/strapi/admin");
|
|
10
|
-
const fullScreen = require("./fullScreen-
|
|
10
|
+
const fullScreen = require("./fullScreen-BLfwi2Jr.js");
|
|
11
11
|
const MAX_DIMENSION = 6e3;
|
|
12
12
|
const positiveInt = (raw, max = Number.MAX_SAFE_INTEGER) => {
|
|
13
13
|
if (raw === null || raw === void 0 || raw === "") return void 0;
|
|
@@ -3,9 +3,9 @@ import { useRef, useState, useEffect, forwardRef } from "react";
|
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import { Flex, Loader, Typography, Modal, Field, TextInput, Button, Box } from "@strapi/design-system";
|
|
5
5
|
import { Folder, ArrowClockwise, Pencil, Trash, Plus } from "@strapi/icons";
|
|
6
|
-
import { c as config, g as getTranslation } from "./index-
|
|
6
|
+
import { c as config, g as getTranslation } from "./index-WIuZTI9m.mjs";
|
|
7
7
|
import { useFetchClient, useStrapiApp, useRBAC } from "@strapi/strapi/admin";
|
|
8
|
-
import { F as FULL_SCREEN_MODAL, c as CROP_BODY, d as CropZoomStep, I as ImageDropzone, e as CropFooter, r as rbacKey, M as MAX_IMAGE_BYTES, i as imageErrorCode, s as startSize, h as formatBytes } from "./fullScreen-
|
|
8
|
+
import { F as FULL_SCREEN_MODAL, c as CROP_BODY, d as CropZoomStep, I as ImageDropzone, e as CropFooter, r as rbacKey, M as MAX_IMAGE_BYTES, i as imageErrorCode, s as startSize, h as formatBytes } from "./fullScreen-Bptl14FH.mjs";
|
|
9
9
|
const MAX_DIMENSION = 6e3;
|
|
10
10
|
const positiveInt = (raw, max = Number.MAX_SAFE_INTEGER) => {
|
|
11
11
|
if (raw === null || raw === void 0 || raw === "") return void 0;
|
|
@@ -6,7 +6,7 @@ import { useComposedRefs, Field, Box, Typography, TextInput, IconButton, Button
|
|
|
6
6
|
import { Pin, Cross } from "@strapi/icons";
|
|
7
7
|
import { useFocusInputField, unstable_useContentManagerContext } from "@strapi/strapi/admin";
|
|
8
8
|
import styled from "styled-components";
|
|
9
|
-
import { R as Registry, P as PageAttributeUpdated, D as DocumentCustomFieldStarted, h as PluginIcon, g as getTranslation, e as convertToSlug, d as FetchLocales, i as FetchModuleSettings, c as config } from "./index-
|
|
9
|
+
import { R as Registry, P as PageAttributeUpdated, D as DocumentCustomFieldStarted, h as PluginIcon, g as getTranslation, e as convertToSlug, d as FetchLocales, i as FetchModuleSettings, c as config } from "./index-WIuZTI9m.mjs";
|
|
10
10
|
const BoxInput = styled(Box)`
|
|
11
11
|
& > div {
|
|
12
12
|
width: 100%;
|
|
@@ -8,7 +8,7 @@ const designSystem = require("@strapi/design-system");
|
|
|
8
8
|
const icons = require("@strapi/icons");
|
|
9
9
|
const admin = require("@strapi/strapi/admin");
|
|
10
10
|
const styled = require("styled-components");
|
|
11
|
-
const index = require("./index-
|
|
11
|
+
const index = require("./index-DcqMfW_Q.js");
|
|
12
12
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
13
13
|
function _interopNamespace(e) {
|
|
14
14
|
if (e && e.__esModule) return e;
|
|
@@ -4,7 +4,7 @@ const React = require("react");
|
|
|
4
4
|
const reactIntl = require("react-intl");
|
|
5
5
|
const styled = require("styled-components");
|
|
6
6
|
const designSystem = require("@strapi/design-system");
|
|
7
|
-
const index = require("./index-
|
|
7
|
+
const index = require("./index-DcqMfW_Q.js");
|
|
8
8
|
const icons = require("@strapi/icons");
|
|
9
9
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
10
10
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
@@ -3,7 +3,7 @@ import { useRef, useState, useEffect, useMemo } from "react";
|
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import styled from "styled-components";
|
|
5
5
|
import { Typography, Button, Flex, IconButton, Box, Field, TextInput, Modal } from "@strapi/design-system";
|
|
6
|
-
import { g as getTranslation } from "./index-
|
|
6
|
+
import { g as getTranslation } from "./index-WIuZTI9m.mjs";
|
|
7
7
|
import { Link, ArrowsHorizontal, ArrowsVertical, ArrowsOut } from "@strapi/icons";
|
|
8
8
|
const SETTINGS_READ_ACTION = "plugin::littlebox-strapi-suite.ecommerce.settings.read";
|
|
9
9
|
const SETTINGS_MANAGE_ACTION = "plugin::littlebox-strapi-suite.ecommerce.settings.manage";
|
|
@@ -6279,7 +6279,7 @@ const index = {
|
|
|
6279
6279
|
defaultMessage: config.pluginId
|
|
6280
6280
|
},
|
|
6281
6281
|
position: 999,
|
|
6282
|
-
Component: () => Promise.resolve().then(() => require("./App-
|
|
6282
|
+
Component: () => Promise.resolve().then(() => require("./App-bYPLxRJW.js"))
|
|
6283
6283
|
});
|
|
6284
6284
|
app.addMenuLink({
|
|
6285
6285
|
to: `plugins/${config.pluginId}/ecommerce`,
|
|
@@ -6306,7 +6306,7 @@ const index = {
|
|
|
6306
6306
|
components: {
|
|
6307
6307
|
Input: async () => Promise.resolve().then(() => require(
|
|
6308
6308
|
/* webpackChunkName: "input-slug-component" */
|
|
6309
|
-
"./SlugInput-
|
|
6309
|
+
"./SlugInput-CabJiXCL.js"
|
|
6310
6310
|
))
|
|
6311
6311
|
},
|
|
6312
6312
|
options: {
|
|
@@ -6378,7 +6378,7 @@ const index = {
|
|
|
6378
6378
|
components: {
|
|
6379
6379
|
Input: async () => Promise.resolve().then(() => require(
|
|
6380
6380
|
/* webpackChunkName: "input-image-field" */
|
|
6381
|
-
"./ImageFieldInput-
|
|
6381
|
+
"./ImageFieldInput-AeRfPoVC.js"
|
|
6382
6382
|
))
|
|
6383
6383
|
},
|
|
6384
6384
|
options: {
|
|
@@ -6259,7 +6259,7 @@ const index = {
|
|
|
6259
6259
|
defaultMessage: config.pluginId
|
|
6260
6260
|
},
|
|
6261
6261
|
position: 999,
|
|
6262
|
-
Component: () => import("./App-
|
|
6262
|
+
Component: () => import("./App-agSgfZ_o.mjs")
|
|
6263
6263
|
});
|
|
6264
6264
|
app.addMenuLink({
|
|
6265
6265
|
to: `plugins/${config.pluginId}/ecommerce`,
|
|
@@ -6286,7 +6286,7 @@ const index = {
|
|
|
6286
6286
|
components: {
|
|
6287
6287
|
Input: async () => import(
|
|
6288
6288
|
/* webpackChunkName: "input-slug-component" */
|
|
6289
|
-
"./SlugInput-
|
|
6289
|
+
"./SlugInput-CHmnYNtp.mjs"
|
|
6290
6290
|
)
|
|
6291
6291
|
},
|
|
6292
6292
|
options: {
|
|
@@ -6358,7 +6358,7 @@ const index = {
|
|
|
6358
6358
|
components: {
|
|
6359
6359
|
Input: async () => import(
|
|
6360
6360
|
/* webpackChunkName: "input-image-field" */
|
|
6361
|
-
"./ImageFieldInput-
|
|
6361
|
+
"./ImageFieldInput-BT-p0eaI.mjs"
|
|
6362
6362
|
)
|
|
6363
6363
|
},
|
|
6364
6364
|
options: {
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -19570,6 +19570,13 @@ function moveError(nodes, id, newParentId) {
|
|
|
19570
19570
|
if (categoryDepth(nodes, newParentId) + subtreeHeight(nodes, id) > MAX_CATEGORY_DEPTH) return "CATEGORY_TOO_DEEP";
|
|
19571
19571
|
return null;
|
|
19572
19572
|
}
|
|
19573
|
+
async function deleteMatching(query, where) {
|
|
19574
|
+
const rows = await query.findMany({ where, select: ["id"] }) ?? [];
|
|
19575
|
+
const ids = rows.map((row) => row.id).filter((id) => id !== void 0 && id !== null);
|
|
19576
|
+
if (!ids.length) return 0;
|
|
19577
|
+
const result = await query.deleteMany({ where: { id: { $in: ids } } });
|
|
19578
|
+
return typeof result?.count === "number" ? result.count : ids.length;
|
|
19579
|
+
}
|
|
19573
19580
|
const PAGE_SIZE$6 = 50;
|
|
19574
19581
|
const adjustmentKey = (key) => typeof key === "string" && /^[A-Za-z0-9-]{1,64}$/.test(key) ? key : crypto.randomUUID();
|
|
19575
19582
|
const isPositiveInt$2 = (v) => typeof v === "number" && Number.isInteger(v) && v > 0;
|
|
@@ -19770,7 +19777,7 @@ const EcommerceProductService = ({ strapi: strapi2 }) => {
|
|
|
19770
19777
|
if (Array.isArray(input.collectionIds)) await syncManualCollections(ownerId, input.collectionIds);
|
|
19771
19778
|
for (const [locale, t] of Object.entries(input.translations ?? {})) {
|
|
19772
19779
|
if (isBlank$2(t?.name)) {
|
|
19773
|
-
await strapi2.db.query(u.productTranslation)
|
|
19780
|
+
await deleteMatching(strapi2.db.query(u.productTranslation), { product: ownerId, locale });
|
|
19774
19781
|
continue;
|
|
19775
19782
|
}
|
|
19776
19783
|
const data = {
|
|
@@ -19891,7 +19898,7 @@ const EcommerceProductService = ({ strapi: strapi2 }) => {
|
|
|
19891
19898
|
}
|
|
19892
19899
|
for (const [locale, vt] of Object.entries(v.translations ?? {})) {
|
|
19893
19900
|
if (isBlank$2(vt?.option)) {
|
|
19894
|
-
await strapi2.db.query(u.variantTranslation)
|
|
19901
|
+
await deleteMatching(strapi2.db.query(u.variantTranslation), { variant: variantId, locale });
|
|
19895
19902
|
continue;
|
|
19896
19903
|
}
|
|
19897
19904
|
const tData = { locale, option: vt.option.trim(), variant: variantId };
|
|
@@ -33850,7 +33857,7 @@ const EcommerceOrganizationService = ({ strapi: strapi2 }) => {
|
|
|
33850
33857
|
const q = strapi2.db.query(u.categoryTranslation);
|
|
33851
33858
|
for (const [locale, t] of Object.entries(translations ?? {})) {
|
|
33852
33859
|
if (isBlank$2(t?.name)) {
|
|
33853
|
-
await q
|
|
33860
|
+
await deleteMatching(q, { category: categoryId, locale });
|
|
33854
33861
|
continue;
|
|
33855
33862
|
}
|
|
33856
33863
|
const data = {
|
|
@@ -33936,7 +33943,7 @@ const EcommerceOrganizationService = ({ strapi: strapi2 }) => {
|
|
|
33936
33943
|
for (const [locale, t] of Object.entries(translations ?? {})) {
|
|
33937
33944
|
const name = cleanName(t?.name ?? "");
|
|
33938
33945
|
if (!name) {
|
|
33939
|
-
await q
|
|
33946
|
+
await deleteMatching(q, { tag: ownerId, locale });
|
|
33940
33947
|
continue;
|
|
33941
33948
|
}
|
|
33942
33949
|
const existing = await q.findOne({ where: { tag: ownerId, locale } });
|
|
@@ -34291,7 +34298,7 @@ const EcommerceCollectionService = ({ strapi: strapi2 }) => {
|
|
|
34291
34298
|
const q = strapi2.db.query(uids().collectionTranslation);
|
|
34292
34299
|
for (const [locale, t] of Object.entries(translations ?? {})) {
|
|
34293
34300
|
if (isBlank$2(t?.title)) {
|
|
34294
|
-
await q
|
|
34301
|
+
await deleteMatching(q, { collection: collectionId, locale });
|
|
34295
34302
|
continue;
|
|
34296
34303
|
}
|
|
34297
34304
|
const data = {
|
|
@@ -34619,8 +34626,9 @@ const EcommerceCollectionService = ({ strapi: strapi2 }) => {
|
|
|
34619
34626
|
requireManual(collection);
|
|
34620
34627
|
const ids = productIdList(productIds, { allowEmpty: true });
|
|
34621
34628
|
if (!ids.length) return;
|
|
34622
|
-
await strapi2.db.query(uids().collectionProduct)
|
|
34623
|
-
|
|
34629
|
+
await deleteMatching(strapi2.db.query(uids().collectionProduct), {
|
|
34630
|
+
collection: { id },
|
|
34631
|
+
product: { id: { $in: ids } }
|
|
34624
34632
|
});
|
|
34625
34633
|
},
|
|
34626
34634
|
/** `productIds` must name every current member exactly once (a stale list is refused). */
|
|
@@ -34716,7 +34724,7 @@ const EcommerceCollectionService = ({ strapi: strapi2 }) => {
|
|
|
34716
34724
|
where: { collection: { id: value2 }, product: { id: { $in: ids } } },
|
|
34717
34725
|
populate: { product: { select: ["id"] } }
|
|
34718
34726
|
});
|
|
34719
|
-
await q
|
|
34727
|
+
await deleteMatching(q, { collection: { id: value2 }, product: { id: { $in: ids } } });
|
|
34720
34728
|
const removed = new Set(rows.map((r2) => r2.product?.id ?? r2.product));
|
|
34721
34729
|
return ids.filter((id) => removed.has(id));
|
|
34722
34730
|
}
|
package/dist/server/index.mjs
CHANGED
|
@@ -19540,6 +19540,13 @@ function moveError(nodes, id, newParentId) {
|
|
|
19540
19540
|
if (categoryDepth(nodes, newParentId) + subtreeHeight(nodes, id) > MAX_CATEGORY_DEPTH) return "CATEGORY_TOO_DEEP";
|
|
19541
19541
|
return null;
|
|
19542
19542
|
}
|
|
19543
|
+
async function deleteMatching(query, where) {
|
|
19544
|
+
const rows = await query.findMany({ where, select: ["id"] }) ?? [];
|
|
19545
|
+
const ids = rows.map((row) => row.id).filter((id) => id !== void 0 && id !== null);
|
|
19546
|
+
if (!ids.length) return 0;
|
|
19547
|
+
const result = await query.deleteMany({ where: { id: { $in: ids } } });
|
|
19548
|
+
return typeof result?.count === "number" ? result.count : ids.length;
|
|
19549
|
+
}
|
|
19543
19550
|
const PAGE_SIZE$6 = 50;
|
|
19544
19551
|
const adjustmentKey = (key) => typeof key === "string" && /^[A-Za-z0-9-]{1,64}$/.test(key) ? key : randomUUID();
|
|
19545
19552
|
const isPositiveInt$2 = (v) => typeof v === "number" && Number.isInteger(v) && v > 0;
|
|
@@ -19740,7 +19747,7 @@ const EcommerceProductService = ({ strapi: strapi2 }) => {
|
|
|
19740
19747
|
if (Array.isArray(input.collectionIds)) await syncManualCollections(ownerId, input.collectionIds);
|
|
19741
19748
|
for (const [locale, t] of Object.entries(input.translations ?? {})) {
|
|
19742
19749
|
if (isBlank$2(t?.name)) {
|
|
19743
|
-
await strapi2.db.query(u.productTranslation)
|
|
19750
|
+
await deleteMatching(strapi2.db.query(u.productTranslation), { product: ownerId, locale });
|
|
19744
19751
|
continue;
|
|
19745
19752
|
}
|
|
19746
19753
|
const data = {
|
|
@@ -19861,7 +19868,7 @@ const EcommerceProductService = ({ strapi: strapi2 }) => {
|
|
|
19861
19868
|
}
|
|
19862
19869
|
for (const [locale, vt] of Object.entries(v.translations ?? {})) {
|
|
19863
19870
|
if (isBlank$2(vt?.option)) {
|
|
19864
|
-
await strapi2.db.query(u.variantTranslation)
|
|
19871
|
+
await deleteMatching(strapi2.db.query(u.variantTranslation), { variant: variantId, locale });
|
|
19865
19872
|
continue;
|
|
19866
19873
|
}
|
|
19867
19874
|
const tData = { locale, option: vt.option.trim(), variant: variantId };
|
|
@@ -33820,7 +33827,7 @@ const EcommerceOrganizationService = ({ strapi: strapi2 }) => {
|
|
|
33820
33827
|
const q = strapi2.db.query(u.categoryTranslation);
|
|
33821
33828
|
for (const [locale, t] of Object.entries(translations ?? {})) {
|
|
33822
33829
|
if (isBlank$2(t?.name)) {
|
|
33823
|
-
await q
|
|
33830
|
+
await deleteMatching(q, { category: categoryId, locale });
|
|
33824
33831
|
continue;
|
|
33825
33832
|
}
|
|
33826
33833
|
const data = {
|
|
@@ -33906,7 +33913,7 @@ const EcommerceOrganizationService = ({ strapi: strapi2 }) => {
|
|
|
33906
33913
|
for (const [locale, t] of Object.entries(translations ?? {})) {
|
|
33907
33914
|
const name = cleanName(t?.name ?? "");
|
|
33908
33915
|
if (!name) {
|
|
33909
|
-
await q
|
|
33916
|
+
await deleteMatching(q, { tag: ownerId, locale });
|
|
33910
33917
|
continue;
|
|
33911
33918
|
}
|
|
33912
33919
|
const existing = await q.findOne({ where: { tag: ownerId, locale } });
|
|
@@ -34261,7 +34268,7 @@ const EcommerceCollectionService = ({ strapi: strapi2 }) => {
|
|
|
34261
34268
|
const q = strapi2.db.query(uids().collectionTranslation);
|
|
34262
34269
|
for (const [locale, t] of Object.entries(translations ?? {})) {
|
|
34263
34270
|
if (isBlank$2(t?.title)) {
|
|
34264
|
-
await q
|
|
34271
|
+
await deleteMatching(q, { collection: collectionId, locale });
|
|
34265
34272
|
continue;
|
|
34266
34273
|
}
|
|
34267
34274
|
const data = {
|
|
@@ -34589,8 +34596,9 @@ const EcommerceCollectionService = ({ strapi: strapi2 }) => {
|
|
|
34589
34596
|
requireManual(collection);
|
|
34590
34597
|
const ids = productIdList(productIds, { allowEmpty: true });
|
|
34591
34598
|
if (!ids.length) return;
|
|
34592
|
-
await strapi2.db.query(uids().collectionProduct)
|
|
34593
|
-
|
|
34599
|
+
await deleteMatching(strapi2.db.query(uids().collectionProduct), {
|
|
34600
|
+
collection: { id },
|
|
34601
|
+
product: { id: { $in: ids } }
|
|
34594
34602
|
});
|
|
34595
34603
|
},
|
|
34596
34604
|
/** `productIds` must name every current member exactly once (a stale list is refused). */
|
|
@@ -34686,7 +34694,7 @@ const EcommerceCollectionService = ({ strapi: strapi2 }) => {
|
|
|
34686
34694
|
where: { collection: { id: value2 }, product: { id: { $in: ids } } },
|
|
34687
34695
|
populate: { product: { select: ["id"] } }
|
|
34688
34696
|
});
|
|
34689
|
-
await q
|
|
34697
|
+
await deleteMatching(q, { collection: { id: value2 }, product: { id: { $in: ids } } });
|
|
34690
34698
|
const removed = new Set(rows.map((r2) => r2.product?.id ?? r2.product));
|
|
34691
34699
|
return ids.filter((id) => removed.has(id));
|
|
34692
34700
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deletes the rows matching `where` by their ids. A `deleteMany` whose where mixes a relation with
|
|
3
|
+
* another column (`{ category: 1, locale: 'en' }`) makes Strapi build a sub-query with a join and
|
|
4
|
+
* the column unqualified, which MySQL refuses when the joined table has a column of the same name
|
|
5
|
+
* ("Column 'locale' in WHERE is ambiguous"). Reading the ids first keeps the delete on one table.
|
|
6
|
+
*/
|
|
7
|
+
export declare function deleteMatching(query: any, where: Record<string, any>): Promise<number>;
|
package/package.json
CHANGED