@payloadcms/plugin-search 3.21.0-canary.0a1cc6a → 3.21.0-canary.db74962
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/index.d.ts.map +1 -1
- package/dist/Search/index.js.map +1 -1
- package/dist/Search/ui/LinkToDoc/index.client.d.ts.map +1 -1
- package/dist/Search/ui/LinkToDoc/index.client.js +22 -14
- package/dist/Search/ui/LinkToDoc/index.client.js.map +1 -1
- package/dist/Search/ui/ReindexButton/index.d.ts.map +1 -1
- package/dist/Search/ui/ReindexButton/index.js +20 -22
- package/dist/Search/ui/ReindexButton/index.js.map +1 -1
- package/dist/Search/ui/ReindexButton/types.d.ts +5 -6
- package/dist/Search/ui/ReindexButton/types.d.ts.map +1 -1
- package/dist/Search/ui/ReindexButton/types.js.map +1 -1
- package/dist/types.d.ts +6 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Search/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAS,MAAM,SAAS,CAAA;AAEtD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Search/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAS,MAAM,SAAS,CAAA;AAEtD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAMhE,eAAO,MAAM,wBAAwB,iBACrB,6BAA6B,KAC1C,gBAqGF,CAAA"}
|
package/dist/Search/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Search/index.ts"],"sourcesContent":["import type { CollectionConfig, Field } from 'payload'\n\nimport type { SearchPluginConfigWithLocales } from '../types.js'\n\nimport { generateReindexHandler } from '../utilities/generateReindexHandler.js'\n\n// all settings can be overridden by the config\nexport const generateSearchCollection = (\n pluginConfig: SearchPluginConfigWithLocales,\n): CollectionConfig => {\n const searchSlug = pluginConfig?.searchOverrides?.slug || 'search'\n const searchCollections = pluginConfig?.collections || []\n const collectionLabels = pluginConfig?.labels\n\n const defaultFields: Field[] = [\n {\n name: 'title',\n type: 'text',\n admin: {\n readOnly: true,\n },\n localized: pluginConfig.localize,\n },\n {\n name: 'priority',\n type: 'number',\n admin: {\n position: 'sidebar',\n },\n },\n {\n name: 'doc',\n type: 'relationship',\n admin: {\n position: 'sidebar',\n readOnly: true,\n },\n index: true,\n maxDepth: 0,\n relationTo: searchCollections,\n required: true,\n },\n {\n name: 'docUrl',\n type: 'ui',\n admin: {\n components: {\n Field: {\n path: '@payloadcms/plugin-search/client#LinkToDoc',\n },\n },\n position: 'sidebar',\n },\n },\n ]\n\n const newConfig: CollectionConfig = {\n ...(pluginConfig?.searchOverrides || {}),\n slug: searchSlug,\n access: {\n create: (): boolean => false,\n read: (): boolean => true,\n ...(pluginConfig?.searchOverrides?.access || {}),\n },\n admin: {\n components: {\n views: {\n list: {\n actions: [\n {\n path: '@payloadcms/plugin-search/client#ReindexButton',\n serverProps: {\n collectionLabels,\n searchCollections,\n searchSlug,\n },\n },\n ],\n },\n },\n },\n defaultColumns: ['title'],\n description:\n 'This is a collection of automatically created search results. These results are used by the global site search and will be updated automatically as documents in the CMS are created or updated.',\n enableRichTextRelationship: false,\n useAsTitle: 'title',\n ...(pluginConfig?.searchOverrides?.admin || {}),\n },\n endpoints: [\n ...(pluginConfig?.searchOverrides?.endpoints || []),\n {\n handler: generateReindexHandler(pluginConfig),\n method: 'post',\n path: '/reindex',\n },\n ],\n fields:\n pluginConfig?.searchOverrides?.fields &&\n typeof pluginConfig?.searchOverrides?.fields === 'function'\n ? pluginConfig?.searchOverrides.fields({ defaultFields })\n : defaultFields,\n labels: {\n ...(pluginConfig?.searchOverrides?.labels || {\n plural: 'Search Results',\n singular: 'Search Result',\n }),\n },\n }\n\n return newConfig\n}\n"],"names":["generateReindexHandler","generateSearchCollection","pluginConfig","searchSlug","searchOverrides","slug","searchCollections","collections","collectionLabels","labels","defaultFields","name","type","admin","readOnly","localized","localize","position","index","maxDepth","relationTo","required","components","Field","path","newConfig","access","create","read","views","list","actions","serverProps","defaultColumns","description","enableRichTextRelationship","useAsTitle","endpoints","handler","method","fields","plural","singular"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/Search/index.ts"],"sourcesContent":["import type { CollectionConfig, Field } from 'payload'\n\nimport type { SearchPluginConfigWithLocales } from '../types.js'\nimport type { ReindexButtonServerProps } from './ui/ReindexButton/types.js'\n\nimport { generateReindexHandler } from '../utilities/generateReindexHandler.js'\n\n// all settings can be overridden by the config\nexport const generateSearchCollection = (\n pluginConfig: SearchPluginConfigWithLocales,\n): CollectionConfig => {\n const searchSlug = pluginConfig?.searchOverrides?.slug || 'search'\n const searchCollections = pluginConfig?.collections || []\n const collectionLabels = pluginConfig?.labels\n\n const defaultFields: Field[] = [\n {\n name: 'title',\n type: 'text',\n admin: {\n readOnly: true,\n },\n localized: pluginConfig.localize,\n },\n {\n name: 'priority',\n type: 'number',\n admin: {\n position: 'sidebar',\n },\n },\n {\n name: 'doc',\n type: 'relationship',\n admin: {\n position: 'sidebar',\n readOnly: true,\n },\n index: true,\n maxDepth: 0,\n relationTo: searchCollections,\n required: true,\n },\n {\n name: 'docUrl',\n type: 'ui',\n admin: {\n components: {\n Field: {\n path: '@payloadcms/plugin-search/client#LinkToDoc',\n },\n },\n position: 'sidebar',\n },\n },\n ]\n\n const newConfig: CollectionConfig = {\n ...(pluginConfig?.searchOverrides || {}),\n slug: searchSlug,\n access: {\n create: (): boolean => false,\n read: (): boolean => true,\n ...(pluginConfig?.searchOverrides?.access || {}),\n },\n admin: {\n components: {\n views: {\n list: {\n actions: [\n {\n path: '@payloadcms/plugin-search/client#ReindexButton',\n serverProps: {\n collectionLabels,\n searchCollections,\n searchSlug,\n } satisfies ReindexButtonServerProps,\n },\n ],\n },\n },\n },\n defaultColumns: ['title'],\n description:\n 'This is a collection of automatically created search results. These results are used by the global site search and will be updated automatically as documents in the CMS are created or updated.',\n enableRichTextRelationship: false,\n useAsTitle: 'title',\n ...(pluginConfig?.searchOverrides?.admin || {}),\n },\n endpoints: [\n ...(pluginConfig?.searchOverrides?.endpoints || []),\n {\n handler: generateReindexHandler(pluginConfig),\n method: 'post',\n path: '/reindex',\n },\n ],\n fields:\n pluginConfig?.searchOverrides?.fields &&\n typeof pluginConfig?.searchOverrides?.fields === 'function'\n ? pluginConfig?.searchOverrides.fields({ defaultFields })\n : defaultFields,\n labels: {\n ...(pluginConfig?.searchOverrides?.labels || {\n plural: 'Search Results',\n singular: 'Search Result',\n }),\n },\n }\n\n return newConfig\n}\n"],"names":["generateReindexHandler","generateSearchCollection","pluginConfig","searchSlug","searchOverrides","slug","searchCollections","collections","collectionLabels","labels","defaultFields","name","type","admin","readOnly","localized","localize","position","index","maxDepth","relationTo","required","components","Field","path","newConfig","access","create","read","views","list","actions","serverProps","defaultColumns","description","enableRichTextRelationship","useAsTitle","endpoints","handler","method","fields","plural","singular"],"mappings":"AAKA,SAASA,sBAAsB,QAAQ,yCAAwC;AAE/E,+CAA+C;AAC/C,OAAO,MAAMC,2BAA2B,CACtCC;IAEA,MAAMC,aAAaD,cAAcE,iBAAiBC,QAAQ;IAC1D,MAAMC,oBAAoBJ,cAAcK,eAAe,EAAE;IACzD,MAAMC,mBAAmBN,cAAcO;IAEvC,MAAMC,gBAAyB;QAC7B;YACEC,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,UAAU;YACZ;YACAC,WAAWb,aAAac,QAAQ;QAClC;QACA;YACEL,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLI,UAAU;YACZ;QACF;QACA;YACEN,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLI,UAAU;gBACVH,UAAU;YACZ;YACAI,OAAO;YACPC,UAAU;YACVC,YAAYd;YACZe,UAAU;QACZ;QACA;YACEV,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLS,YAAY;oBACVC,OAAO;wBACLC,MAAM;oBACR;gBACF;gBACAP,UAAU;YACZ;QACF;KACD;IAED,MAAMQ,YAA8B;QAClC,GAAIvB,cAAcE,mBAAmB,CAAC,CAAC;QACvCC,MAAMF;QACNuB,QAAQ;YACNC,QAAQ,IAAe;YACvBC,MAAM,IAAe;YACrB,GAAI1B,cAAcE,iBAAiBsB,UAAU,CAAC,CAAC;QACjD;QACAb,OAAO;YACLS,YAAY;gBACVO,OAAO;oBACLC,MAAM;wBACJC,SAAS;4BACP;gCACEP,MAAM;gCACNQ,aAAa;oCACXxB;oCACAF;oCACAH;gCACF;4BACF;yBACD;oBACH;gBACF;YACF;YACA8B,gBAAgB;gBAAC;aAAQ;YACzBC,aACE;YACFC,4BAA4B;YAC5BC,YAAY;YACZ,GAAIlC,cAAcE,iBAAiBS,SAAS,CAAC,CAAC;QAChD;QACAwB,WAAW;eACLnC,cAAcE,iBAAiBiC,aAAa,EAAE;YAClD;gBACEC,SAAStC,uBAAuBE;gBAChCqC,QAAQ;gBACRf,MAAM;YACR;SACD;QACDgB,QACEtC,cAAcE,iBAAiBoC,UAC/B,OAAOtC,cAAcE,iBAAiBoC,WAAW,aAC7CtC,cAAcE,gBAAgBoC,OAAO;YAAE9B;QAAc,KACrDA;QACND,QAAQ;YACN,GAAIP,cAAcE,iBAAiBK,UAAU;gBAC3CgC,QAAQ;gBACRC,UAAU;YACZ,CAAC;QACH;IACF;IAEA,OAAOjB;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../../src/Search/ui/LinkToDoc/index.client.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../../src/Search/ui/LinkToDoc/index.client.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAiDnC,CAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useConfig, useField } from '@payloadcms/ui';
|
|
3
|
+
import { CopyToClipboard, useConfig, useField } from '@payloadcms/ui';
|
|
4
4
|
import { formatAdminURL } from '@payloadcms/ui/shared';
|
|
5
|
+
import LinkImport from 'next/link.js';
|
|
5
6
|
import React from 'react';
|
|
6
|
-
|
|
7
|
-
// import CopyToClipboard from 'payload/dist/admin/components/elements/CopyToClipboard'
|
|
7
|
+
const Link = LinkImport.default || LinkImport;
|
|
8
8
|
export const LinkToDocClient = ()=>{
|
|
9
9
|
const { config } = useConfig();
|
|
10
10
|
const { routes: { admin: adminRoute }, serverURL } = config;
|
|
@@ -18,19 +18,25 @@ export const LinkToDocClient = ()=>{
|
|
|
18
18
|
adminRoute,
|
|
19
19
|
path: `/collections/${value.relationTo || ''}/${value.value || ''}`
|
|
20
20
|
})}`;
|
|
21
|
+
const hrefToDisplay = `${process.env.NEXT_BASE_PATH || ''}${href}`;
|
|
21
22
|
return /*#__PURE__*/ _jsxs("div", {
|
|
22
23
|
style: {
|
|
23
24
|
marginBottom: 'var(--spacing-field, 1rem)'
|
|
24
25
|
},
|
|
25
26
|
children: [
|
|
26
|
-
/*#__PURE__*/
|
|
27
|
-
children:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
28
|
+
children: [
|
|
29
|
+
/*#__PURE__*/ _jsx("span", {
|
|
30
|
+
className: "label",
|
|
31
|
+
style: {
|
|
32
|
+
color: '#9A9A9A'
|
|
33
|
+
},
|
|
34
|
+
children: "Doc URL"
|
|
35
|
+
}),
|
|
36
|
+
/*#__PURE__*/ _jsx(CopyToClipboard, {
|
|
37
|
+
value: hrefToDisplay
|
|
38
|
+
})
|
|
39
|
+
]
|
|
34
40
|
}),
|
|
35
41
|
/*#__PURE__*/ _jsx("div", {
|
|
36
42
|
style: {
|
|
@@ -38,10 +44,12 @@ export const LinkToDocClient = ()=>{
|
|
|
38
44
|
overflow: 'hidden',
|
|
39
45
|
textOverflow: 'ellipsis'
|
|
40
46
|
},
|
|
41
|
-
children: /*#__PURE__*/ _jsx(
|
|
47
|
+
children: /*#__PURE__*/ _jsx(Link, {
|
|
42
48
|
href: href,
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
passHref: true,
|
|
50
|
+
rel: 'noopener noreferrer',
|
|
51
|
+
target: '_blank',
|
|
52
|
+
children: hrefToDisplay
|
|
45
53
|
})
|
|
46
54
|
})
|
|
47
55
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/Search/ui/LinkToDoc/index.client.tsx"],"sourcesContent":["'use client'\n\nimport { useConfig, useField } from '@payloadcms/ui'\nimport { formatAdminURL } from '@payloadcms/ui/shared'\nimport React from 'react'\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/Search/ui/LinkToDoc/index.client.tsx"],"sourcesContent":["'use client'\n\nimport { CopyToClipboard, useConfig, useField } from '@payloadcms/ui'\nimport { formatAdminURL } from '@payloadcms/ui/shared'\nimport LinkImport from 'next/link.js'\nimport React from 'react'\n\nconst Link = (LinkImport.default || LinkImport) as unknown as typeof LinkImport.default\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 = `${serverURL}${formatAdminURL({\n adminRoute,\n path: `/collections/${value.relationTo || ''}/${value.value || ''}`,\n })}`\n\n const hrefToDisplay = `${process.env.NEXT_BASE_PATH || ''}${href}`\n\n return (\n <div style={{ marginBottom: 'var(--spacing-field, 1rem)' }}>\n <div>\n <span\n className=\"label\"\n style={{\n color: '#9A9A9A',\n }}\n >\n Doc URL\n </span>\n <CopyToClipboard value={hrefToDisplay} />\n </div>\n <div\n style={{\n fontWeight: '600',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n <Link href={href} passHref {...{ rel: 'noopener noreferrer', target: '_blank' }}>\n {hrefToDisplay}\n </Link>\n </div>\n </div>\n )\n}\n"],"names":["CopyToClipboard","useConfig","useField","formatAdminURL","LinkImport","React","Link","default","LinkToDocClient","config","routes","admin","adminRoute","serverURL","value","path","relationTo","href","hrefToDisplay","process","env","NEXT_BASE_PATH","div","style","marginBottom","span","className","color","fontWeight","overflow","textOverflow","passHref","rel","target"],"mappings":"AAAA;;AAEA,SAASA,eAAe,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,iBAAgB;AACrE,SAASC,cAAc,QAAQ,wBAAuB;AACtD,OAAOC,gBAAgB,eAAc;AACrC,OAAOC,WAAW,QAAO;AAEzB,MAAMC,OAAQF,WAAWG,OAAO,IAAIH;AAEpC,OAAO,MAAMI,kBAA4B;IACvC,MAAM,EAAEC,MAAM,EAAE,GAAGR;IAEnB,MAAM,EACJS,QAAQ,EACNC,OAAOC,UAAU,EAClB,EACDC,SAAS,EACV,GAAGJ;IAEJ,MAAM,EAAEK,KAAK,EAAE,GAAGZ,SAAkD;QAAEa,MAAM;IAAM;IAElF,IAAI,CAACD,OAAOE,cAAc,CAACF,OAAOA,OAAO;QACvC,OAAO;IACT;IAEA,MAAMG,OAAO,GAAGJ,YAAYV,eAAe;QACzCS;QACAG,MAAM,CAAC,aAAa,EAAED,MAAME,UAAU,IAAI,GAAG,CAAC,EAAEF,MAAMA,KAAK,IAAI,IAAI;IACrE,IAAI;IAEJ,MAAMI,gBAAgB,GAAGC,QAAQC,GAAG,CAACC,cAAc,IAAI,KAAKJ,MAAM;IAElE,qBACE,MAACK;QAAIC,OAAO;YAAEC,cAAc;QAA6B;;0BACvD,MAACF;;kCACC,KAACG;wBACCC,WAAU;wBACVH,OAAO;4BACLI,OAAO;wBACT;kCACD;;kCAGD,KAAC3B;wBAAgBc,OAAOI;;;;0BAE1B,KAACI;gBACCC,OAAO;oBACLK,YAAY;oBACZC,UAAU;oBACVC,cAAc;gBAChB;0BAEA,cAAA,KAACxB;oBAAKW,MAAMA;oBAAMc,QAAQ;oBAAOC,KAAK;oBAAuBC,QAAQ;8BAClEf;;;;;AAKX,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Search/ui/ReindexButton/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Search/ui/ReindexButton/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,YAAY,CAAA;AAIpE,eAAO,MAAM,aAAa,EAAE,kCA2B3B,CAAA"}
|
|
@@ -2,32 +2,30 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { ReindexButtonClient } from './index.client.js';
|
|
3
3
|
export const ReindexButton = (props)=>{
|
|
4
4
|
const { collectionLabels, i18n, searchCollections, searchSlug } = props;
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (typeof pluralLabel === 'function') {
|
|
10
|
-
return [
|
|
11
|
-
collection,
|
|
12
|
-
pluralLabel({
|
|
13
|
-
t: i18n.t
|
|
14
|
-
})
|
|
15
|
-
];
|
|
16
|
-
}
|
|
17
|
-
if (pluralLabel) {
|
|
18
|
-
return [
|
|
19
|
-
collection,
|
|
20
|
-
pluralLabel
|
|
21
|
-
];
|
|
22
|
-
}
|
|
5
|
+
const resolvedCollectionLabels = Object.fromEntries(searchCollections.map((collection)=>{
|
|
6
|
+
const labels = collectionLabels[collection];
|
|
7
|
+
const pluralLabel = labels?.plural;
|
|
8
|
+
if (typeof pluralLabel === 'function') {
|
|
23
9
|
return [
|
|
24
10
|
collection,
|
|
25
|
-
|
|
11
|
+
pluralLabel({
|
|
12
|
+
t: i18n.t
|
|
13
|
+
})
|
|
26
14
|
];
|
|
27
|
-
}
|
|
28
|
-
|
|
15
|
+
}
|
|
16
|
+
if (pluralLabel) {
|
|
17
|
+
return [
|
|
18
|
+
collection,
|
|
19
|
+
pluralLabel
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
return [
|
|
23
|
+
collection,
|
|
24
|
+
collection
|
|
25
|
+
];
|
|
26
|
+
}));
|
|
29
27
|
return /*#__PURE__*/ _jsx(ReindexButtonClient, {
|
|
30
|
-
collectionLabels:
|
|
28
|
+
collectionLabels: resolvedCollectionLabels,
|
|
31
29
|
searchCollections: searchCollections,
|
|
32
30
|
searchSlug: searchSlug
|
|
33
31
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/Search/ui/ReindexButton/index.tsx"],"sourcesContent":["import type { SearchReindexButtonServerComponent } from './types.js'\n\nimport { ReindexButtonClient } from './index.client.js'\n\nexport const ReindexButton: SearchReindexButtonServerComponent = (props) => {\n const { collectionLabels, i18n, searchCollections, searchSlug } = props\n\n const
|
|
1
|
+
{"version":3,"sources":["../../../../src/Search/ui/ReindexButton/index.tsx"],"sourcesContent":["import type { ResolvedCollectionLabels } from '../../../types.js'\nimport type { SearchReindexButtonServerComponent } from './types.js'\n\nimport { ReindexButtonClient } from './index.client.js'\n\nexport const ReindexButton: SearchReindexButtonServerComponent = (props) => {\n const { collectionLabels, i18n, searchCollections, searchSlug } = props\n\n const resolvedCollectionLabels: ResolvedCollectionLabels = Object.fromEntries(\n searchCollections.map((collection) => {\n const labels = collectionLabels[collection]\n const pluralLabel = labels?.plural\n\n if (typeof pluralLabel === 'function') {\n return [collection, pluralLabel({ t: i18n.t })]\n }\n\n if (pluralLabel) {\n return [collection, pluralLabel]\n }\n\n return [collection, collection]\n }),\n )\n\n return (\n <ReindexButtonClient\n collectionLabels={resolvedCollectionLabels}\n searchCollections={searchCollections}\n searchSlug={searchSlug}\n />\n )\n}\n"],"names":["ReindexButtonClient","ReindexButton","props","collectionLabels","i18n","searchCollections","searchSlug","resolvedCollectionLabels","Object","fromEntries","map","collection","labels","pluralLabel","plural","t"],"mappings":";AAGA,SAASA,mBAAmB,QAAQ,oBAAmB;AAEvD,OAAO,MAAMC,gBAAoD,CAACC;IAChE,MAAM,EAAEC,gBAAgB,EAAEC,IAAI,EAAEC,iBAAiB,EAAEC,UAAU,EAAE,GAAGJ;IAElE,MAAMK,2BAAqDC,OAAOC,WAAW,CAC3EJ,kBAAkBK,GAAG,CAAC,CAACC;QACrB,MAAMC,SAAST,gBAAgB,CAACQ,WAAW;QAC3C,MAAME,cAAcD,QAAQE;QAE5B,IAAI,OAAOD,gBAAgB,YAAY;YACrC,OAAO;gBAACF;gBAAYE,YAAY;oBAAEE,GAAGX,KAAKW,CAAC;gBAAC;aAAG;QACjD;QAEA,IAAIF,aAAa;YACf,OAAO;gBAACF;gBAAYE;aAAY;QAClC;QAEA,OAAO;YAACF;YAAYA;SAAW;IACjC;IAGF,qBACE,KAACX;QACCG,kBAAkBI;QAClBF,mBAAmBA;QACnBC,YAAYA;;AAGlB,EAAC"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type { CustomComponent, PayloadServerReactComponent
|
|
2
|
-
import type { CollectionLabels } from '../../../types.js';
|
|
1
|
+
import type { CustomComponent, PayloadServerReactComponent } from 'payload';
|
|
2
|
+
import type { CollectionLabels, ResolvedCollectionLabels } from '../../../types.js';
|
|
3
3
|
export type ReindexButtonProps = {
|
|
4
|
-
collectionLabels:
|
|
4
|
+
collectionLabels: ResolvedCollectionLabels;
|
|
5
5
|
searchCollections: string[];
|
|
6
6
|
searchSlug: string;
|
|
7
7
|
};
|
|
8
|
-
type ReindexButtonServerProps = {
|
|
8
|
+
export type ReindexButtonServerProps = {
|
|
9
9
|
collectionLabels: CollectionLabels;
|
|
10
|
-
} & ReindexButtonProps
|
|
10
|
+
} & Omit<ReindexButtonProps, 'collectionLabels'>;
|
|
11
11
|
export type SearchReindexButtonClientComponent = ReindexButtonProps;
|
|
12
12
|
export type SearchReindexButtonServerComponent = PayloadServerReactComponent<CustomComponent<ReindexButtonServerProps>>;
|
|
13
|
-
export {};
|
|
14
13
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/Search/ui/ReindexButton/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,2BAA2B,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/Search/ui/ReindexButton/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAEnF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gBAAgB,EAAE,wBAAwB,CAAA;IAC1C,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,gBAAgB,EAAE,gBAAgB,CAAA;CACnC,GAAG,IAAI,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAA;AAEhD,MAAM,MAAM,kCAAkC,GAAG,kBAAkB,CAAA;AAEnE,MAAM,MAAM,kCAAkC,GAAG,2BAA2B,CAC1E,eAAe,CAAC,wBAAwB,CAAC,CAC1C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/Search/ui/ReindexButton/types.ts"],"sourcesContent":["import type { CustomComponent, PayloadServerReactComponent
|
|
1
|
+
{"version":3,"sources":["../../../../src/Search/ui/ReindexButton/types.ts"],"sourcesContent":["import type { CustomComponent, PayloadServerReactComponent } from 'payload'\n\nimport type { CollectionLabels, ResolvedCollectionLabels } from '../../../types.js'\n\nexport type ReindexButtonProps = {\n collectionLabels: ResolvedCollectionLabels\n searchCollections: string[]\n searchSlug: string\n}\n\nexport type ReindexButtonServerProps = {\n collectionLabels: CollectionLabels\n} & Omit<ReindexButtonProps, 'collectionLabels'>\n\nexport type SearchReindexButtonClientComponent = ReindexButtonProps\n\nexport type SearchReindexButtonServerComponent = PayloadServerReactComponent<\n CustomComponent<ReindexButtonServerProps>\n>\n"],"names":[],"mappings":"AAgBA,WAEC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CollectionAfterChangeHook, CollectionAfterDeleteHook, CollectionConfig, Field,
|
|
1
|
+
import type { CollectionAfterChangeHook, CollectionAfterDeleteHook, CollectionConfig, Field, Locale, Payload, PayloadRequest, StaticLabel } from 'payload';
|
|
2
2
|
export type DocToSync = {
|
|
3
3
|
[key: string]: any;
|
|
4
4
|
doc: {
|
|
@@ -40,10 +40,10 @@ export type SearchPluginConfig = {
|
|
|
40
40
|
syncDrafts?: boolean;
|
|
41
41
|
};
|
|
42
42
|
export type CollectionLabels = {
|
|
43
|
-
[collection: string]:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
[collection: string]: CollectionConfig['labels'];
|
|
44
|
+
};
|
|
45
|
+
export type ResolvedCollectionLabels = {
|
|
46
|
+
[collection: string]: StaticLabel;
|
|
47
47
|
};
|
|
48
48
|
export type SearchPluginConfigWithLocales = {
|
|
49
49
|
labels?: CollectionLabels;
|
|
@@ -54,7 +54,7 @@ export type SyncWithSearchArgs = {
|
|
|
54
54
|
pluginConfig: SearchPluginConfig;
|
|
55
55
|
} & Omit<Parameters<CollectionAfterChangeHook>[0], 'collection'>;
|
|
56
56
|
export type SyncDocArgs = {
|
|
57
|
-
locale?:
|
|
57
|
+
locale?: Locale['code'];
|
|
58
58
|
onSyncError?: () => void;
|
|
59
59
|
} & Omit<SyncWithSearchArgs, 'context' | 'previousDoc'>;
|
|
60
60
|
export type SyncWithSearch = (Args: SyncWithSearchArgs) => ReturnType<CollectionAfterChangeHook>;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,yBAAyB,EACzB,gBAAgB,EAChB,KAAK,EACL,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n CollectionAfterChangeHook,\n CollectionAfterDeleteHook,\n CollectionConfig,\n Field,\n
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n CollectionAfterChangeHook,\n CollectionAfterDeleteHook,\n CollectionConfig,\n Field,\n Locale,\n Payload,\n PayloadRequest,\n StaticLabel,\n} from 'payload'\n\nexport type DocToSync = {\n [key: string]: any\n doc: {\n relationTo: string\n value: string\n }\n title: string\n}\n\nexport type BeforeSync = (args: {\n originalDoc: {\n [key: string]: any\n }\n payload: Payload\n req: PayloadRequest\n searchDoc: DocToSync\n}) => DocToSync | Promise<DocToSync>\n\nexport type FieldsOverride = (args: { defaultFields: Field[] }) => Field[]\n\nexport type SearchPluginConfig = {\n /**\n * @deprecated\n * This plugin gets the api route from the config directly and does not need to be passed in.\n * As long as you have `routes.api` set in your Payload config, the plugin will use that.\n * This property will be removed in the next major version.\n */\n apiBasePath?: string\n beforeSync?: BeforeSync\n collections?: string[]\n defaultPriorities?: {\n [collection: string]: ((doc: any) => number | Promise<number>) | number\n }\n deleteDrafts?: boolean\n localize?: boolean\n reindexBatchSize?: number\n searchOverrides?: { fields?: FieldsOverride } & Partial<Omit<CollectionConfig, 'fields'>>\n syncDrafts?: boolean\n}\n\nexport type CollectionLabels = {\n [collection: string]: CollectionConfig['labels']\n}\n\nexport type ResolvedCollectionLabels = {\n [collection: string]: StaticLabel\n}\n\nexport type SearchPluginConfigWithLocales = {\n labels?: CollectionLabels\n locales?: string[]\n} & SearchPluginConfig\n\nexport type SyncWithSearchArgs = {\n collection: string\n pluginConfig: SearchPluginConfig\n} & Omit<Parameters<CollectionAfterChangeHook>[0], 'collection'>\n\nexport type SyncDocArgs = {\n locale?: Locale['code']\n onSyncError?: () => void\n} & Omit<SyncWithSearchArgs, 'context' | 'previousDoc'>\n\n// Extend the `CollectionAfterChangeHook` with more function args\n// Convert the `collection` arg from `SanitizedCollectionConfig` to a string\nexport type SyncWithSearch = (Args: SyncWithSearchArgs) => ReturnType<CollectionAfterChangeHook>\n\nexport type DeleteFromSearch = (\n Args: {\n pluginConfig: SearchPluginConfig\n } & Parameters<CollectionAfterDeleteHook>[0],\n) => ReturnType<CollectionAfterDeleteHook>\n"],"names":[],"mappings":"AA8EA,WAI0C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/plugin-search",
|
|
3
|
-
"version": "3.21.0-canary.
|
|
3
|
+
"version": "3.21.0-canary.db74962",
|
|
4
4
|
"description": "Search plugin for Payload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -49,19 +49,19 @@
|
|
|
49
49
|
"dist"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@payloadcms/
|
|
53
|
-
"@payloadcms/
|
|
52
|
+
"@payloadcms/ui": "3.21.0-canary.db74962",
|
|
53
|
+
"@payloadcms/next": "3.21.0-canary.db74962"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/react": "19.0.1",
|
|
57
57
|
"@types/react-dom": "19.0.1",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
58
|
+
"payload": "3.21.0-canary.db74962",
|
|
59
|
+
"@payloadcms/eslint-config": "3.9.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
63
63
|
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
64
|
-
"payload": "3.21.0-canary.
|
|
64
|
+
"payload": "3.21.0-canary.db74962"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"registry": "https://registry.npmjs.org/"
|