@payloadcms/plugin-search 4.0.0-internal.40de3ec → 4.0.0-internal.4804abd
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/Search/ui/LinkToDoc/index.client.d.ts +1 -0
- package/dist/Search/ui/LinkToDoc/index.client.d.ts.map +1 -1
- package/dist/Search/ui/LinkToDoc/index.client.js +9 -15
- package/dist/Search/ui/LinkToDoc/index.client.js.map +1 -1
- package/dist/Search/ui/LinkToDoc/index.css +26 -0
- package/dist/Search/ui/ReindexButton/ReindexButtonLabel/index.d.ts +10 -1
- package/dist/Search/ui/ReindexButton/ReindexButtonLabel/index.d.ts.map +1 -1
- package/dist/Search/ui/ReindexButton/ReindexButtonLabel/index.js +14 -4
- package/dist/Search/ui/ReindexButton/ReindexButtonLabel/index.js.map +1 -1
- package/dist/Search/ui/ReindexButton/index.client.js +3 -1
- package/dist/Search/ui/ReindexButton/index.client.js.map +1 -1
- package/dist/utilities/generateReindexHandler.d.ts.map +1 -1
- package/dist/utilities/generateReindexHandler.js +2 -1
- package/dist/utilities/generateReindexHandler.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../../src/Search/ui/LinkToDoc/index.client.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../../src/Search/ui/LinkToDoc/index.client.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,aAAa,CAAA;AAIpB,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAmCnC,CAAA"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { CopyToClipboard, Link, useConfig, useField } from '@payloadcms/ui';
|
|
3
|
+
import { CopyToClipboard, FieldLabel, Link, useConfig, useField } from '@payloadcms/ui';
|
|
4
4
|
import { formatAdminURL } from 'payload/shared';
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import './index.css';
|
|
7
|
+
const baseClass = 'link-to-doc';
|
|
6
8
|
export const LinkToDocClient = ()=>{
|
|
7
9
|
const { config } = useConfig();
|
|
8
10
|
const { routes: { admin: adminRoute }, serverURL } = config;
|
|
@@ -18,18 +20,14 @@ export const LinkToDocClient = ()=>{
|
|
|
18
20
|
serverURL
|
|
19
21
|
});
|
|
20
22
|
return /*#__PURE__*/ _jsxs("div", {
|
|
21
|
-
|
|
22
|
-
marginBottom: 'var(--spacing-field, 1rem)'
|
|
23
|
-
},
|
|
23
|
+
className: baseClass,
|
|
24
24
|
children: [
|
|
25
25
|
/*#__PURE__*/ _jsxs("div", {
|
|
26
|
+
className: `${baseClass}__header`,
|
|
26
27
|
children: [
|
|
27
|
-
/*#__PURE__*/ _jsx(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
color: '#9A9A9A'
|
|
31
|
-
},
|
|
32
|
-
children: "Doc URL"
|
|
28
|
+
/*#__PURE__*/ _jsx(FieldLabel, {
|
|
29
|
+
htmlFor: baseClass,
|
|
30
|
+
label: "Doc URL"
|
|
33
31
|
}),
|
|
34
32
|
/*#__PURE__*/ _jsx(CopyToClipboard, {
|
|
35
33
|
value: href
|
|
@@ -37,11 +35,7 @@ export const LinkToDocClient = ()=>{
|
|
|
37
35
|
]
|
|
38
36
|
}),
|
|
39
37
|
/*#__PURE__*/ _jsx("div", {
|
|
40
|
-
|
|
41
|
-
fontWeight: '600',
|
|
42
|
-
overflow: 'hidden',
|
|
43
|
-
textOverflow: 'ellipsis'
|
|
44
|
-
},
|
|
38
|
+
className: `${baseClass}__url`,
|
|
45
39
|
children: /*#__PURE__*/ _jsx(Link, {
|
|
46
40
|
href: href,
|
|
47
41
|
rel: "noopener noreferrer",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/Search/ui/LinkToDoc/index.client.tsx"],"sourcesContent":["'use client'\n\nimport { CopyToClipboard, Link, useConfig, useField } from '@payloadcms/ui'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nexport const LinkToDocClient: React.FC = () => {\n const { config } = useConfig()\n\n const {\n routes: {\n admin: adminRoute, // already includes leading slash\n },\n serverURL,\n } = config\n\n const { value } = useField<{ relationTo?: string; value?: string }>({ path: 'doc' })\n\n if (!value?.relationTo || !value?.value) {\n return null\n }\n\n const href = formatAdminURL({\n adminRoute,\n path: `/collections/${value.relationTo || ''}/${value.value || ''}`,\n serverURL,\n })\n\n return (\n <div
|
|
1
|
+
{"version":3,"sources":["../../../../src/Search/ui/LinkToDoc/index.client.tsx"],"sourcesContent":["'use client'\n\nimport { CopyToClipboard, FieldLabel, Link, useConfig, useField } from '@payloadcms/ui'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport './index.css'\n\nconst baseClass = 'link-to-doc'\n\nexport const LinkToDocClient: React.FC = () => {\n const { config } = useConfig()\n\n const {\n routes: {\n admin: adminRoute, // already includes leading slash\n },\n serverURL,\n } = config\n\n const { value } = useField<{ relationTo?: string; value?: string }>({ path: 'doc' })\n\n if (!value?.relationTo || !value?.value) {\n return null\n }\n\n const href = formatAdminURL({\n adminRoute,\n path: `/collections/${value.relationTo || ''}/${value.value || ''}`,\n serverURL,\n })\n\n return (\n <div className={baseClass}>\n <div className={`${baseClass}__header`}>\n <FieldLabel htmlFor={baseClass} label=\"Doc URL\" />\n <CopyToClipboard value={href} />\n </div>\n <div className={`${baseClass}__url`}>\n <Link href={href} rel=\"noopener noreferrer\" target=\"_blank\">\n {href}\n </Link>\n </div>\n </div>\n )\n}\n"],"names":["CopyToClipboard","FieldLabel","Link","useConfig","useField","formatAdminURL","React","baseClass","LinkToDocClient","config","routes","admin","adminRoute","serverURL","value","path","relationTo","href","div","className","htmlFor","label","rel","target"],"mappings":"AAAA;;AAEA,SAASA,eAAe,EAAEC,UAAU,EAAEC,IAAI,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,iBAAgB;AACvF,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,WAAW,QAAO;AAEzB,OAAO,cAAa;AAEpB,MAAMC,YAAY;AAElB,OAAO,MAAMC,kBAA4B;IACvC,MAAM,EAAEC,MAAM,EAAE,GAAGN;IAEnB,MAAM,EACJO,QAAQ,EACNC,OAAOC,UAAU,EAClB,EACDC,SAAS,EACV,GAAGJ;IAEJ,MAAM,EAAEK,KAAK,EAAE,GAAGV,SAAkD;QAAEW,MAAM;IAAM;IAElF,IAAI,CAACD,OAAOE,cAAc,CAACF,OAAOA,OAAO;QACvC,OAAO;IACT;IAEA,MAAMG,OAAOZ,eAAe;QAC1BO;QACAG,MAAM,CAAC,aAAa,EAAED,MAAME,UAAU,IAAI,GAAG,CAAC,EAAEF,MAAMA,KAAK,IAAI,IAAI;QACnED;IACF;IAEA,qBACE,MAACK;QAAIC,WAAWZ;;0BACd,MAACW;gBAAIC,WAAW,GAAGZ,UAAU,QAAQ,CAAC;;kCACpC,KAACN;wBAAWmB,SAASb;wBAAWc,OAAM;;kCACtC,KAACrB;wBAAgBc,OAAOG;;;;0BAE1B,KAACC;gBAAIC,WAAW,GAAGZ,UAAU,KAAK,CAAC;0BACjC,cAAA,KAACL;oBAAKe,MAAMA;oBAAMK,KAAI;oBAAsBC,QAAO;8BAChDN;;;;;AAKX,EAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@layer payload-default {
|
|
2
|
+
.link-to-doc {
|
|
3
|
+
margin-bottom: var(--spacing-field);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.link-to-doc__header {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
width: fit-content;
|
|
10
|
+
gap: var(--spacer-1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.link-to-doc__url {
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
text-overflow: ellipsis;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.link-to-doc__url a {
|
|
20
|
+
color: var(--color-text-secondary);
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
color: var(--color-text);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type ReindexButtonLabelProps = {
|
|
3
|
+
readonly active?: boolean;
|
|
4
|
+
readonly 'aria-expanded'?: boolean;
|
|
5
|
+
readonly 'aria-haspopup'?: true;
|
|
6
|
+
readonly onClick?: React.MouseEventHandler;
|
|
7
|
+
readonly onKeyDown?: React.KeyboardEventHandler;
|
|
8
|
+
};
|
|
9
|
+
export declare const ReindexButtonLabel: React.FC<ReindexButtonLabelProps>;
|
|
10
|
+
export {};
|
|
2
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/Search/ui/ReindexButton/ReindexButtonLabel/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/Search/ui/ReindexButton/ReindexButtonLabel/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAA;IAClC,QAAQ,CAAC,eAAe,CAAC,EAAE,IAAI,CAAA;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAA;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAA;CAChD,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAuBhE,CAAA"}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, useTranslation } from '@payloadcms/ui';
|
|
3
|
-
|
|
2
|
+
import { Button, ChevronIcon, useTranslation } from '@payloadcms/ui';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export const ReindexButtonLabel = ({ active, onClick, onKeyDown, ...ariaProps })=>{
|
|
4
5
|
const { i18n: { t } } = useTranslation();
|
|
5
6
|
return /*#__PURE__*/ _jsx(Button, {
|
|
6
|
-
buttonStyle: "
|
|
7
|
-
|
|
7
|
+
buttonStyle: "secondary",
|
|
8
|
+
extraButtonProps: {
|
|
9
|
+
onKeyDown
|
|
10
|
+
},
|
|
11
|
+
icon: /*#__PURE__*/ _jsx(ChevronIcon, {
|
|
12
|
+
direction: active ? 'up' : 'down',
|
|
13
|
+
size: 16
|
|
14
|
+
}),
|
|
8
15
|
iconPosition: "right",
|
|
16
|
+
onClick: onClick,
|
|
17
|
+
selected: active,
|
|
9
18
|
size: "medium",
|
|
19
|
+
...ariaProps,
|
|
10
20
|
children: t('general:reindex')
|
|
11
21
|
});
|
|
12
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/Search/ui/ReindexButton/ReindexButtonLabel/index.tsx"],"sourcesContent":["import { Button, ChevronIcon, useTranslation } from '@payloadcms/ui'\n\nexport const ReindexButtonLabel = () => {\n const {\n i18n: { t },\n } = useTranslation()\n return (\n <Button
|
|
1
|
+
{"version":3,"sources":["../../../../../src/Search/ui/ReindexButton/ReindexButtonLabel/index.tsx"],"sourcesContent":["import { Button, ChevronIcon, useTranslation } from '@payloadcms/ui'\nimport React from 'react'\n\ntype ReindexButtonLabelProps = {\n readonly active?: boolean\n readonly 'aria-expanded'?: boolean\n readonly 'aria-haspopup'?: true\n readonly onClick?: React.MouseEventHandler\n readonly onKeyDown?: React.KeyboardEventHandler\n}\n\nexport const ReindexButtonLabel: React.FC<ReindexButtonLabelProps> = ({\n active,\n onClick,\n onKeyDown,\n ...ariaProps\n}) => {\n const {\n i18n: { t },\n } = useTranslation()\n return (\n <Button\n buttonStyle=\"secondary\"\n extraButtonProps={{ onKeyDown }}\n icon={<ChevronIcon direction={active ? 'up' : 'down'} size={16} />}\n iconPosition=\"right\"\n onClick={onClick}\n selected={active}\n size=\"medium\"\n {...ariaProps}\n >\n {t('general:reindex')}\n </Button>\n )\n}\n"],"names":["Button","ChevronIcon","useTranslation","React","ReindexButtonLabel","active","onClick","onKeyDown","ariaProps","i18n","t","buttonStyle","extraButtonProps","icon","direction","size","iconPosition","selected"],"mappings":";AAAA,SAASA,MAAM,EAAEC,WAAW,EAAEC,cAAc,QAAQ,iBAAgB;AACpE,OAAOC,WAAW,QAAO;AAUzB,OAAO,MAAMC,qBAAwD,CAAC,EACpEC,MAAM,EACNC,OAAO,EACPC,SAAS,EACT,GAAGC,WACJ;IACC,MAAM,EACJC,MAAM,EAAEC,CAAC,EAAE,EACZ,GAAGR;IACJ,qBACE,KAACF;QACCW,aAAY;QACZC,kBAAkB;YAAEL;QAAU;QAC9BM,oBAAM,KAACZ;YAAYa,WAAWT,SAAS,OAAO;YAAQU,MAAM;;QAC5DC,cAAa;QACbV,SAASA;QACTW,UAAUZ;QACVU,MAAK;QACJ,GAAGP,SAAS;kBAEZE,EAAE;;AAGT,EAAC"}
|
|
@@ -97,7 +97,6 @@ export const ReindexButtonClient = ({ collectionLabels, searchCollections, searc
|
|
|
97
97
|
return /*#__PURE__*/ _jsxs("div", {
|
|
98
98
|
children: [
|
|
99
99
|
/*#__PURE__*/ _jsx(Popup, {
|
|
100
|
-
button: /*#__PURE__*/ _jsx(ReindexButtonLabel, {}),
|
|
101
100
|
render: ({ close })=>/*#__PURE__*/ _jsxs(PopupList.ButtonGroup, {
|
|
102
101
|
children: [
|
|
103
102
|
searchCollections.map((collectionSlug)=>/*#__PURE__*/ _jsx(PopupList.Button, {
|
|
@@ -110,6 +109,9 @@ export const ReindexButtonClient = ({ collectionLabels, searchCollections, searc
|
|
|
110
109
|
})
|
|
111
110
|
]
|
|
112
111
|
}),
|
|
112
|
+
renderButton: (buttonProps)=>/*#__PURE__*/ _jsx(ReindexButtonLabel, {
|
|
113
|
+
...buttonProps
|
|
114
|
+
}),
|
|
113
115
|
showScrollbar: true,
|
|
114
116
|
size: "large",
|
|
115
117
|
verticalAlign: "bottom"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/Search/ui/ReindexButton/index.client.tsx"],"sourcesContent":["'use client'\n\nimport {\n ConfirmationModal,\n Popup,\n PopupList,\n toast,\n useConfig,\n useLocale,\n useModal,\n useRouter,\n useTranslation,\n} from '@payloadcms/ui'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useCallback, useMemo, useState } from 'react'\n\nimport type { ReindexButtonProps } from './types.js'\n\nimport { ReindexButtonLabel } from './ReindexButtonLabel/index.js'\n\nconst confirmReindexModalSlug = 'confirm-reindex-modal'\n\nexport const ReindexButtonClient: React.FC<ReindexButtonProps> = ({\n collectionLabels,\n searchCollections,\n searchSlug,\n}) => {\n const { openModal } = useModal()\n\n const { config } = useConfig()\n\n const {\n i18n: { t },\n } = useTranslation()\n\n const locale = useLocale()\n const router = useRouter()\n\n const [reindexCollections, setReindexCollections] = useState<string[]>([])\n\n const openConfirmModal = useCallback(() => openModal(confirmReindexModalSlug), [openModal])\n\n const handleReindexSubmit = useCallback(async () => {\n if (!reindexCollections.length) {\n return\n }\n\n try {\n const res = await fetch(\n formatAdminURL({\n apiRoute: config.routes.api,\n path: `/${searchSlug}/reindex?locale=${locale.code}`,\n }),\n {\n body: JSON.stringify({\n collections: reindexCollections,\n }),\n method: 'POST',\n },\n )\n\n const { message } = (await res.json()) as { message: string }\n\n if (!res.ok) {\n toast.error(message)\n } else {\n toast.success(message)\n return router.refresh()\n }\n } catch (_err: unknown) {\n // swallow error, toast shown above\n } finally {\n setReindexCollections([])\n }\n }, [reindexCollections, router, searchSlug, locale, config])\n\n const handleShowConfirmModal = useCallback(\n (collections: string | string[] = searchCollections) => {\n setReindexCollections(typeof collections === 'string' ? [collections] : collections)\n openConfirmModal()\n },\n [openConfirmModal, searchCollections],\n )\n\n const handlePopupButtonClick = useCallback(\n (closePopup: () => void, slug?: string) => {\n closePopup()\n handleShowConfirmModal(slug)\n },\n [handleShowConfirmModal],\n )\n\n const getPluralizedLabel = useCallback(\n (slug: string) => {\n const label = collectionLabels[slug]\n if (typeof label === 'string') {\n return label\n } else {\n return label && Object.hasOwn(label, locale.code) ? label[locale.code] : slug\n }\n },\n [collectionLabels, locale.code],\n )\n\n const pluralizedLabels = useMemo(() => {\n return searchCollections.reduce<Record<string, string>>((acc, slug) => {\n const label = getPluralizedLabel(slug)\n if (label) {\n acc[slug] = label\n }\n return acc\n }, {})\n }, [searchCollections, getPluralizedLabel])\n\n const selectedAll = reindexCollections.length === searchCollections.length\n const selectedLabels = reindexCollections.map((slug) => pluralizedLabels[slug]).join(', ')\n\n const modalTitle = selectedAll\n ? t('general:confirmReindexAll')\n : t('general:confirmReindex', { collections: selectedLabels })\n const modalDescription = selectedAll\n ? t('general:confirmReindexDescriptionAll')\n : t('general:confirmReindexDescription', { collections: selectedLabels })\n\n return (\n <div>\n <Popup\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/Search/ui/ReindexButton/index.client.tsx"],"sourcesContent":["'use client'\n\nimport {\n ConfirmationModal,\n Popup,\n PopupList,\n toast,\n useConfig,\n useLocale,\n useModal,\n useRouter,\n useTranslation,\n} from '@payloadcms/ui'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useCallback, useMemo, useState } from 'react'\n\nimport type { ReindexButtonProps } from './types.js'\n\nimport { ReindexButtonLabel } from './ReindexButtonLabel/index.js'\n\nconst confirmReindexModalSlug = 'confirm-reindex-modal'\n\nexport const ReindexButtonClient: React.FC<ReindexButtonProps> = ({\n collectionLabels,\n searchCollections,\n searchSlug,\n}) => {\n const { openModal } = useModal()\n\n const { config } = useConfig()\n\n const {\n i18n: { t },\n } = useTranslation()\n\n const locale = useLocale()\n const router = useRouter()\n\n const [reindexCollections, setReindexCollections] = useState<string[]>([])\n\n const openConfirmModal = useCallback(() => openModal(confirmReindexModalSlug), [openModal])\n\n const handleReindexSubmit = useCallback(async () => {\n if (!reindexCollections.length) {\n return\n }\n\n try {\n const res = await fetch(\n formatAdminURL({\n apiRoute: config.routes.api,\n path: `/${searchSlug}/reindex?locale=${locale.code}`,\n }),\n {\n body: JSON.stringify({\n collections: reindexCollections,\n }),\n method: 'POST',\n },\n )\n\n const { message } = (await res.json()) as { message: string }\n\n if (!res.ok) {\n toast.error(message)\n } else {\n toast.success(message)\n return router.refresh()\n }\n } catch (_err: unknown) {\n // swallow error, toast shown above\n } finally {\n setReindexCollections([])\n }\n }, [reindexCollections, router, searchSlug, locale, config])\n\n const handleShowConfirmModal = useCallback(\n (collections: string | string[] = searchCollections) => {\n setReindexCollections(typeof collections === 'string' ? [collections] : collections)\n openConfirmModal()\n },\n [openConfirmModal, searchCollections],\n )\n\n const handlePopupButtonClick = useCallback(\n (closePopup: () => void, slug?: string) => {\n closePopup()\n handleShowConfirmModal(slug)\n },\n [handleShowConfirmModal],\n )\n\n const getPluralizedLabel = useCallback(\n (slug: string) => {\n const label = collectionLabels[slug]\n if (typeof label === 'string') {\n return label\n } else {\n return label && Object.hasOwn(label, locale.code) ? label[locale.code] : slug\n }\n },\n [collectionLabels, locale.code],\n )\n\n const pluralizedLabels = useMemo(() => {\n return searchCollections.reduce<Record<string, string>>((acc, slug) => {\n const label = getPluralizedLabel(slug)\n if (label) {\n acc[slug] = label\n }\n return acc\n }, {})\n }, [searchCollections, getPluralizedLabel])\n\n const selectedAll = reindexCollections.length === searchCollections.length\n const selectedLabels = reindexCollections.map((slug) => pluralizedLabels[slug]).join(', ')\n\n const modalTitle = selectedAll\n ? t('general:confirmReindexAll')\n : t('general:confirmReindex', { collections: selectedLabels })\n const modalDescription = selectedAll\n ? t('general:confirmReindexDescriptionAll')\n : t('general:confirmReindexDescription', { collections: selectedLabels })\n\n return (\n <div>\n <Popup\n render={({ close }) => (\n <PopupList.ButtonGroup>\n {searchCollections.map((collectionSlug) => (\n <PopupList.Button\n key={collectionSlug}\n onClick={() => handlePopupButtonClick(close, collectionSlug)}\n >\n {pluralizedLabels[collectionSlug]}\n </PopupList.Button>\n ))}\n <PopupList.Button onClick={() => handlePopupButtonClick(close)}>\n {t('general:allCollections')}\n </PopupList.Button>\n </PopupList.ButtonGroup>\n )}\n renderButton={(buttonProps) => <ReindexButtonLabel {...buttonProps} />}\n showScrollbar\n size=\"large\"\n verticalAlign=\"bottom\"\n />\n <ConfirmationModal\n body={modalDescription}\n heading={modalTitle}\n modalSlug={confirmReindexModalSlug}\n onConfirm={handleReindexSubmit}\n />\n </div>\n )\n}\n"],"names":["ConfirmationModal","Popup","PopupList","toast","useConfig","useLocale","useModal","useRouter","useTranslation","formatAdminURL","React","useCallback","useMemo","useState","ReindexButtonLabel","confirmReindexModalSlug","ReindexButtonClient","collectionLabels","searchCollections","searchSlug","openModal","config","i18n","t","locale","router","reindexCollections","setReindexCollections","openConfirmModal","handleReindexSubmit","length","res","fetch","apiRoute","routes","api","path","code","body","JSON","stringify","collections","method","message","json","ok","error","success","refresh","_err","handleShowConfirmModal","handlePopupButtonClick","closePopup","slug","getPluralizedLabel","label","Object","hasOwn","pluralizedLabels","reduce","acc","selectedAll","selectedLabels","map","join","modalTitle","modalDescription","div","render","close","ButtonGroup","collectionSlug","Button","onClick","renderButton","buttonProps","showScrollbar","size","verticalAlign","heading","modalSlug","onConfirm"],"mappings":"AAAA;;AAEA,SACEA,iBAAiB,EACjBC,KAAK,EACLC,SAAS,EACTC,KAAK,EACLC,SAAS,EACTC,SAAS,EACTC,QAAQ,EACRC,SAAS,E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BACnBpD,kBAAkB6C,GAAG,CAAC,CAACQ,+BACtB,KAACrE,UAAUsE,MAAM;oCAEfC,SAAS,IAAMtB,uBAAuBkB,OAAOE;8CAE5Cb,gBAAgB,CAACa,eAAe;mCAH5BA;0CAMT,KAACrE,UAAUsE,MAAM;gCAACC,SAAS,IAAMtB,uBAAuBkB;0CACrD9C,EAAE;;;;gBAITmD,cAAc,CAACC,4BAAgB,KAAC7D;wBAAoB,GAAG6D,WAAW;;gBAClEC,aAAa;gBACbC,MAAK;gBACLC,eAAc;;0BAEhB,KAAC9E;gBACCsC,MAAM4B;gBACNa,SAASd;gBACTe,WAAWjE;gBACXkE,WAAWpD;;;;AAInB,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateReindexHandler.d.ts","sourceRoot":"","sources":["../../src/utilities/generateReindexHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,SAAS,CAAA;AAWpD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAS9D,eAAO,MAAM,sBAAsB,GAChC,cAAc,2BAA2B,KAAG,
|
|
1
|
+
{"version":3,"file":"generateReindexHandler.d.ts","sourceRoot":"","sources":["../../src/utilities/generateReindexHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,SAAS,CAAA;AAWpD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAS9D,eAAO,MAAM,sBAAsB,GAChC,cAAc,2BAA2B,KAAG,cAyN5C,CAAA"}
|
|
@@ -78,6 +78,7 @@ export const generateReindexHandler = (pluginConfig)=>async (req)=>{
|
|
|
78
78
|
}
|
|
79
79
|
const payload = req.payload;
|
|
80
80
|
const { reindexBatchSize: batchSize, syncDrafts } = pluginConfig;
|
|
81
|
+
const defaultLocale = payload.config.localization ? payload.config.localization.defaultLocale : req.locale;
|
|
81
82
|
const defaultLocalApiProps = {
|
|
82
83
|
overrideAccess: false,
|
|
83
84
|
req,
|
|
@@ -92,6 +93,7 @@ export const generateReindexHandler = (pluginConfig)=>async (req)=>{
|
|
|
92
93
|
const { totalDocs } = await payload.count({
|
|
93
94
|
collection,
|
|
94
95
|
...defaultLocalApiProps,
|
|
96
|
+
locale: defaultLocale,
|
|
95
97
|
req: undefined,
|
|
96
98
|
where: drafts ? undefined : whereStatusPublished
|
|
97
99
|
});
|
|
@@ -120,7 +122,6 @@ export const generateReindexHandler = (pluginConfig)=>async (req)=>{
|
|
|
120
122
|
let localErrors = 0;
|
|
121
123
|
// Loop through batches, then documents, then locales per document
|
|
122
124
|
for(let i = 0; i < totalBatches; i++){
|
|
123
|
-
const defaultLocale = req.payload.config.localization ? req.payload.config.localization.defaultLocale : req.locale;
|
|
124
125
|
const { docs } = await payload.find({
|
|
125
126
|
collection,
|
|
126
127
|
depth: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/generateReindexHandler.ts"],"sourcesContent":["import type { PayloadHandler, Where } from 'payload'\n\nimport {\n addLocalesToRequestFromData,\n commitTransaction,\n getAccessResults,\n headersWithCors,\n initTransaction,\n killTransaction,\n} from 'payload'\n\nimport type { SanitizedSearchPluginConfig } from '../types.js'\n\nimport { syncDocAsSearchIndex } from './syncDocAsSearchIndex.js'\n\ntype ValidationResult = {\n isValid: boolean\n message?: string\n}\n\nexport const generateReindexHandler =\n (pluginConfig: SanitizedSearchPluginConfig): PayloadHandler =>\n async (req) => {\n addLocalesToRequestFromData(req)\n if (!req.json) {\n return new Response('Req.json is undefined', { status: 400 })\n }\n const { collections = [] } = (await req.json()) as { collections: string[] }\n const t = req.t\n\n const searchSlug = pluginConfig?.searchOverrides?.slug || 'search'\n const searchCollections = pluginConfig?.collections || []\n\n async function validatePermissions(): Promise<ValidationResult> {\n const accessResults = await getAccessResults({ req })\n const searchAccessResults = accessResults.collections?.[searchSlug]\n if (!searchAccessResults) {\n return { isValid: false, message: t('error:notAllowedToPerformAction') }\n }\n\n const permissions = [searchAccessResults.delete, searchAccessResults.update]\n // plugin doesn't allow create by default:\n // if user provided, then add it to check\n if (pluginConfig.searchOverrides?.access?.create) {\n permissions.push(searchAccessResults.create)\n }\n // plugin allows reads by anyone by default:\n // so if user provided, then add to check\n if (pluginConfig.searchOverrides?.access?.read) {\n permissions.push(searchAccessResults.read)\n }\n return permissions.every(Boolean)\n ? { isValid: true }\n : { isValid: false, message: t('error:notAllowedToPerformAction') }\n }\n\n function validateCollections(): ValidationResult {\n const collectionsAreValid = collections.every((col) => searchCollections.includes(col))\n return collections.length && collectionsAreValid\n ? { isValid: true }\n : { isValid: false, message: t('error:invalidRequestArgs', { args: `'collections'` }) }\n }\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n const { isValid: hasPermissions, message: permissionError } = await validatePermissions()\n if (!hasPermissions) {\n return Response.json({ message: permissionError }, { headers, status: 401 })\n }\n\n const { isValid: validCollections, message: collectionError } = validateCollections()\n if (!validCollections) {\n return Response.json({ message: collectionError }, { headers, status: 400 })\n }\n\n const payload = req.payload\n const { reindexBatchSize: batchSize, syncDrafts } = pluginConfig\n\n const defaultLocalApiProps = {\n overrideAccess: false,\n req,\n user: req.user,\n }\n const whereStatusPublished: Where = {\n _status: {\n equals: 'published',\n },\n }\n async function countDocuments(collection: string, drafts?: boolean): Promise<number> {\n const { totalDocs } = await payload.count({\n collection,\n ...defaultLocalApiProps,\n req: undefined,\n where: drafts ? undefined : whereStatusPublished,\n })\n return totalDocs\n }\n\n async function deleteIndexes(collection: string) {\n await payload.delete({\n collection: searchSlug,\n depth: 0,\n select: { id: true },\n where: { 'doc.relationTo': { equals: collection } },\n ...defaultLocalApiProps,\n })\n }\n\n async function reindexCollection(\n collection: string,\n ): Promise<{ docs: number; docsWithDrafts: number; errors: number }> {\n const draftsEnabled = Boolean(payload.collections[collection]?.config.versions?.drafts)\n\n const totalDocsWithDrafts = await countDocuments(collection, true)\n const totalDocs =\n syncDrafts || !draftsEnabled\n ? totalDocsWithDrafts\n : await countDocuments(collection, !draftsEnabled)\n const totalBatches = Math.ceil(totalDocs / batchSize)\n\n let localErrors = 0\n\n // Loop through batches, then documents, then locales per document\n for (let i = 0; i < totalBatches; i++) {\n const defaultLocale = req.payload.config.localization\n ? req.payload.config.localization.defaultLocale\n : req.locale\n\n const { docs } = await payload.find({\n collection,\n depth: 0,\n limit: batchSize,\n locale: defaultLocale,\n page: i + 1,\n where: syncDrafts || !draftsEnabled ? undefined : whereStatusPublished,\n ...defaultLocalApiProps,\n })\n\n for (const doc of docs) {\n // Get all configured locales\n // If no localization, use [undefined] to sync once without a locale\n const allLocales = req.payload.config.localization\n ? req.payload.config.localization.localeCodes\n : [undefined]\n\n // Loop through all locales and check each one\n let firstAllowedLocale = true\n for (const localeToSync of allLocales) {\n // Check if we should skip this locale for this document\n let shouldSkip = false\n if (typeof pluginConfig.skipSync === 'function') {\n try {\n shouldSkip = await pluginConfig.skipSync({\n collectionSlug: collection,\n doc,\n locale: localeToSync,\n req,\n })\n } catch (err) {\n req.payload.logger.error({\n err,\n msg: 'Search plugin: Error executing skipSync. Proceeding with sync.',\n })\n }\n }\n\n if (shouldSkip) {\n continue // Skip this locale\n }\n\n // Sync this locale (create first index, then update with other locales accordingly)\n const operation = firstAllowedLocale ? 'create' : 'update'\n firstAllowedLocale = false\n\n await syncDocAsSearchIndex({\n collection,\n data: doc,\n doc,\n locale: localeToSync,\n onSyncError: () => operation === 'create' && localErrors++,\n operation,\n pluginConfig,\n req,\n })\n }\n }\n }\n\n return { docs: totalDocs, docsWithDrafts: totalDocsWithDrafts, errors: localErrors }\n }\n\n const shouldCommit = await initTransaction(req)\n\n // Collections are processed sequentially to avoid race conditions within the shared transaction.\n // Concurrent writes to the search collection interleave on the same DB connection and can cause\n // locale data to be missing non-deterministically.\n const results: Array<{ docs: number; docsWithDrafts: number; errors: number }> = []\n try {\n for (const collection of collections) {\n try {\n await deleteIndexes(collection)\n results.push(await reindexCollection(collection))\n } catch (err) {\n const message = t('error:unableToReindexCollection', { collection })\n payload.logger.error({ err, msg: message })\n results.push({ docs: 0, docsWithDrafts: 0, errors: 0 })\n }\n }\n } catch (err: unknown) {\n if (shouldCommit) {\n await killTransaction(req)\n }\n return Response.json(\n { message: err instanceof Error ? err.message : String(err) },\n { headers, status: 500 },\n )\n }\n\n const aggregateDocsWithDrafts = results.reduce((sum, r) => sum + r.docsWithDrafts, 0)\n const aggregateDocs = results.reduce((sum, r) => sum + r.docs, 0)\n const aggregateErrors = results.reduce((sum, r) => sum + r.errors, 0)\n\n const message = t('general:successfullyReindexed', {\n collections: collections.join(', '),\n count: aggregateDocs - aggregateErrors,\n skips: syncDrafts ? 0 : aggregateDocsWithDrafts - aggregateDocs,\n total: aggregateDocsWithDrafts,\n })\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return Response.json({ message }, { headers, status: 200 })\n }\n"],"names":["addLocalesToRequestFromData","commitTransaction","getAccessResults","headersWithCors","initTransaction","killTransaction","syncDocAsSearchIndex","generateReindexHandler","pluginConfig","req","json","Response","status","collections","t","searchSlug","searchOverrides","slug","searchCollections","validatePermissions","accessResults","searchAccessResults","isValid","message","permissions","delete","update","access","create","push","read","every","Boolean","validateCollections","collectionsAreValid","col","includes","length","args","headers","Headers","hasPermissions","permissionError","validCollections","collectionError","payload","reindexBatchSize","batchSize","syncDrafts","defaultLocalApiProps","overrideAccess","user","whereStatusPublished","_status","equals","countDocuments","collection","drafts","totalDocs","count","undefined","where","deleteIndexes","depth","select","id","reindexCollection","draftsEnabled","config","versions","totalDocsWithDrafts","totalBatches","Math","ceil","localErrors","i","defaultLocale","localization","locale","docs","find","limit","page","doc","allLocales","localeCodes","firstAllowedLocale","localeToSync","shouldSkip","skipSync","collectionSlug","err","logger","error","msg","operation","data","onSyncError","docsWithDrafts","errors","shouldCommit","results","Error","String","aggregateDocsWithDrafts","reduce","sum","r","aggregateDocs","aggregateErrors","join","skips","total"],"mappings":"AAEA,SACEA,2B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AQ;YAAI;QAE3B;QAEA,MAAM4F,0BAA0BH,QAAQI,MAAM,CAAC,CAACC,KAAKC,IAAMD,MAAMC,EAAET,cAAc,EAAE;QACnF,MAAMU,gBAAgBP,QAAQI,MAAM,CAAC,CAACC,KAAKC,IAAMD,MAAMC,EAAE5B,IAAI,EAAE;QAC/D,MAAM8B,kBAAkBR,QAAQI,MAAM,CAAC,CAACC,KAAKC,IAAMD,MAAMC,EAAER,MAAM,EAAE;QAEnE,MAAM5E,UAAUT,EAAE,iCAAiC;YACjDD,aAAaA,YAAYiG,IAAI,CAAC;YAC9BnD,OAAOiD,gBAAgBC;YACvBE,OAAO/D,aAAa,IAAIwD,0BAA0BI;YAClDI,OAAOR;QACT;QAEA,IAAIJ,cAAc;YAChB,MAAMnG,kBAAkBQ;QAC1B;QAEA,OAAOE,SAASD,IAAI,CAAC;YAAEa;QAAQ,GAAG;YAAEgB;YAAS3B,QAAQ;QAAI;IAC3D,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/generateReindexHandler.ts"],"sourcesContent":["import type { PayloadHandler, Where } from 'payload'\n\nimport {\n addLocalesToRequestFromData,\n commitTransaction,\n getAccessResults,\n headersWithCors,\n initTransaction,\n killTransaction,\n} from 'payload'\n\nimport type { SanitizedSearchPluginConfig } from '../types.js'\n\nimport { syncDocAsSearchIndex } from './syncDocAsSearchIndex.js'\n\ntype ValidationResult = {\n isValid: boolean\n message?: string\n}\n\nexport const generateReindexHandler =\n (pluginConfig: SanitizedSearchPluginConfig): PayloadHandler =>\n async (req) => {\n addLocalesToRequestFromData(req)\n if (!req.json) {\n return new Response('Req.json is undefined', { status: 400 })\n }\n const { collections = [] } = (await req.json()) as { collections: string[] }\n const t = req.t\n\n const searchSlug = pluginConfig?.searchOverrides?.slug || 'search'\n const searchCollections = pluginConfig?.collections || []\n\n async function validatePermissions(): Promise<ValidationResult> {\n const accessResults = await getAccessResults({ req })\n const searchAccessResults = accessResults.collections?.[searchSlug]\n if (!searchAccessResults) {\n return { isValid: false, message: t('error:notAllowedToPerformAction') }\n }\n\n const permissions = [searchAccessResults.delete, searchAccessResults.update]\n // plugin doesn't allow create by default:\n // if user provided, then add it to check\n if (pluginConfig.searchOverrides?.access?.create) {\n permissions.push(searchAccessResults.create)\n }\n // plugin allows reads by anyone by default:\n // so if user provided, then add to check\n if (pluginConfig.searchOverrides?.access?.read) {\n permissions.push(searchAccessResults.read)\n }\n return permissions.every(Boolean)\n ? { isValid: true }\n : { isValid: false, message: t('error:notAllowedToPerformAction') }\n }\n\n function validateCollections(): ValidationResult {\n const collectionsAreValid = collections.every((col) => searchCollections.includes(col))\n return collections.length && collectionsAreValid\n ? { isValid: true }\n : { isValid: false, message: t('error:invalidRequestArgs', { args: `'collections'` }) }\n }\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n const { isValid: hasPermissions, message: permissionError } = await validatePermissions()\n if (!hasPermissions) {\n return Response.json({ message: permissionError }, { headers, status: 401 })\n }\n\n const { isValid: validCollections, message: collectionError } = validateCollections()\n if (!validCollections) {\n return Response.json({ message: collectionError }, { headers, status: 400 })\n }\n\n const payload = req.payload\n const { reindexBatchSize: batchSize, syncDrafts } = pluginConfig\n\n const defaultLocale = payload.config.localization\n ? payload.config.localization.defaultLocale\n : req.locale\n\n const defaultLocalApiProps = {\n overrideAccess: false,\n req,\n user: req.user,\n }\n const whereStatusPublished: Where = {\n _status: {\n equals: 'published',\n },\n }\n async function countDocuments(collection: string, drafts?: boolean): Promise<number> {\n const { totalDocs } = await payload.count({\n collection,\n ...defaultLocalApiProps,\n locale: defaultLocale,\n req: undefined,\n where: drafts ? undefined : whereStatusPublished,\n })\n return totalDocs\n }\n\n async function deleteIndexes(collection: string) {\n await payload.delete({\n collection: searchSlug,\n depth: 0,\n select: { id: true },\n where: { 'doc.relationTo': { equals: collection } },\n ...defaultLocalApiProps,\n })\n }\n\n async function reindexCollection(\n collection: string,\n ): Promise<{ docs: number; docsWithDrafts: number; errors: number }> {\n const draftsEnabled = Boolean(payload.collections[collection]?.config.versions?.drafts)\n\n const totalDocsWithDrafts = await countDocuments(collection, true)\n const totalDocs =\n syncDrafts || !draftsEnabled\n ? totalDocsWithDrafts\n : await countDocuments(collection, !draftsEnabled)\n const totalBatches = Math.ceil(totalDocs / batchSize)\n\n let localErrors = 0\n\n // Loop through batches, then documents, then locales per document\n for (let i = 0; i < totalBatches; i++) {\n const { docs } = await payload.find({\n collection,\n depth: 0,\n limit: batchSize,\n locale: defaultLocale,\n page: i + 1,\n where: syncDrafts || !draftsEnabled ? undefined : whereStatusPublished,\n ...defaultLocalApiProps,\n })\n\n for (const doc of docs) {\n // Get all configured locales\n // If no localization, use [undefined] to sync once without a locale\n const allLocales = req.payload.config.localization\n ? req.payload.config.localization.localeCodes\n : [undefined]\n\n // Loop through all locales and check each one\n let firstAllowedLocale = true\n for (const localeToSync of allLocales) {\n // Check if we should skip this locale for this document\n let shouldSkip = false\n if (typeof pluginConfig.skipSync === 'function') {\n try {\n shouldSkip = await pluginConfig.skipSync({\n collectionSlug: collection,\n doc,\n locale: localeToSync,\n req,\n })\n } catch (err) {\n req.payload.logger.error({\n err,\n msg: 'Search plugin: Error executing skipSync. Proceeding with sync.',\n })\n }\n }\n\n if (shouldSkip) {\n continue // Skip this locale\n }\n\n // Sync this locale (create first index, then update with other locales accordingly)\n const operation = firstAllowedLocale ? 'create' : 'update'\n firstAllowedLocale = false\n\n await syncDocAsSearchIndex({\n collection,\n data: doc,\n doc,\n locale: localeToSync,\n onSyncError: () => operation === 'create' && localErrors++,\n operation,\n pluginConfig,\n req,\n })\n }\n }\n }\n\n return { docs: totalDocs, docsWithDrafts: totalDocsWithDrafts, errors: localErrors }\n }\n\n const shouldCommit = await initTransaction(req)\n\n // Collections are processed sequentially to avoid race conditions within the shared transaction.\n // Concurrent writes to the search collection interleave on the same DB connection and can cause\n // locale data to be missing non-deterministically.\n const results: Array<{ docs: number; docsWithDrafts: number; errors: number }> = []\n try {\n for (const collection of collections) {\n try {\n await deleteIndexes(collection)\n results.push(await reindexCollection(collection))\n } catch (err) {\n const message = t('error:unableToReindexCollection', { collection })\n payload.logger.error({ err, msg: message })\n results.push({ docs: 0, docsWithDrafts: 0, errors: 0 })\n }\n }\n } catch (err: unknown) {\n if (shouldCommit) {\n await killTransaction(req)\n }\n return Response.json(\n { message: err instanceof Error ? err.message : String(err) },\n { headers, status: 500 },\n )\n }\n\n const aggregateDocsWithDrafts = results.reduce((sum, r) => sum + r.docsWithDrafts, 0)\n const aggregateDocs = results.reduce((sum, r) => sum + r.docs, 0)\n const aggregateErrors = results.reduce((sum, r) => sum + r.errors, 0)\n\n const message = t('general:successfullyReindexed', {\n collections: collections.join(', '),\n count: aggregateDocs - aggregateErrors,\n skips: syncDrafts ? 0 : aggregateDocsWithDrafts - aggregateDocs,\n total: aggregateDocsWithDrafts,\n })\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return Response.json({ message }, { headers, status: 200 })\n }\n"],"names":["addLocalesToRequestFromData","commitTransaction","getAccessResults","headersWithCors","initTransaction","killTransaction","syncDocAsSearchIndex","generateReindexHandler","pluginConfig","req","json","Response","status","collections","t","searchSlug","searchOverrides","slug","searchCollections","validatePermissions","accessResults","searchAccessResults","isValid","message","permissions","delete","update","access","create","push","read","every","Boolean","validateCollections","collectionsAreValid","col","includes","length","args","headers","Headers","hasPermissions","permissionError","validCollections","collectionError","payload","reindexBatchSize","batchSize","syncDrafts","defaultLocale","config","localization","locale","defaultLocalApiProps","overrideAccess","user","whereStatusPublished","_status","equals","countDocuments","collection","drafts","totalDocs","count","undefined","where","deleteIndexes","depth","select","id","reindexCollection","draftsEnabled","versions","totalDocsWithDrafts","totalBatches","Math","ceil","localErrors","i","docs","find","limit","page","doc","allLocales","localeCodes","firstAllowedLocale","localeToSync","shouldSkip","skipSync","collectionSlug","err","logger","error","msg","operation","data","onSyncError","docsWithDrafts","errors","shouldCommit","results","Error","String","aggregateDocsWithDrafts","reduce","sum","r","aggregateDocs","aggregateErrors","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AAEpD;gBAAS3B,QAAQ;YAAI;QAE3B;QAEA,MAAM4F,0BAA0BH,QAAQI,MAAM,CAAC,CAACC,KAAKC,IAAMD,MAAMC,EAAET,cAAc,EAAE;QACnF,MAAMU,gBAAgBP,QAAQI,MAAM,CAAC,CAACC,KAAKC,IAAMD,MAAMC,EAAE5B,IAAI,EAAE;QAC/D,MAAM8B,kBAAkBR,QAAQI,MAAM,CAAC,CAACC,KAAKC,IAAMD,MAAMC,EAAER,MAAM,EAAE;QAEnE,MAAM5E,UAAUT,EAAE,iCAAiC;YACjDD,aAAaA,YAAYiG,IAAI,CAAC;YAC9B/C,OAAO6C,gBAAgBC;YACvBE,OAAO/D,aAAa,IAAIwD,0BAA0BI;YAClDI,OAAOR;QACT;QAEA,IAAIJ,cAAc;YAChB,MAAMnG,kBAAkBQ;QAC1B;QAEA,OAAOE,SAASD,IAAI,CAAC;YAAEa;QAAQ,GAAG;YAAEgB;YAAS3B,QAAQ;QAAI;IAC3D,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/plugin-search",
|
|
3
|
-
"version": "4.0.0-internal.
|
|
3
|
+
"version": "4.0.0-internal.4804abd",
|
|
4
4
|
"description": "Search plugin for Payload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -50,19 +50,19 @@
|
|
|
50
50
|
"dist"
|
|
51
51
|
],
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@payloadcms/next": "4.0.0-internal.
|
|
54
|
-
"@payloadcms/ui": "4.0.0-internal.
|
|
53
|
+
"@payloadcms/next": "4.0.0-internal.4804abd",
|
|
54
|
+
"@payloadcms/ui": "4.0.0-internal.4804abd"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/react": "19.2.14",
|
|
58
58
|
"@types/react-dom": "19.2.3",
|
|
59
59
|
"@payloadcms/eslint-config": "3.28.0",
|
|
60
|
-
"payload": "4.0.0-internal.
|
|
60
|
+
"payload": "4.0.0-internal.4804abd"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"react": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
64
64
|
"react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
65
|
-
"payload": "4.0.0-internal.
|
|
65
|
+
"payload": "4.0.0-internal.4804abd"
|
|
66
66
|
},
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"registry": "https://registry.npmjs.org/"
|