chore(plugin-search): esm imports
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@payloadcms/ui": "workspace:*",
|
||||
"ts-deepmerge": "^2.0.1"
|
||||
"deepmerge": "4.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@payloadcms/eslint-config": "workspace:*",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DocToSync, SearchConfig, SyncWithSearch } from '../../types'
|
||||
import type { DocToSync, SearchConfig, SyncWithSearch } from '../../types.js'
|
||||
|
||||
const syncWithSearch: SyncWithSearch = async (args) => {
|
||||
const {
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import type { CollectionConfig } from 'payload/types'
|
||||
|
||||
import deepMerge from 'ts-deepmerge'
|
||||
import deepMerge from 'deepmerge'
|
||||
|
||||
import type { SearchConfig } from '../types'
|
||||
import type { SearchConfig } from '../types.js'
|
||||
|
||||
import { LinkToDoc } from './ui'
|
||||
import { LinkToDoc } from './ui/index.js'
|
||||
|
||||
// all settings can be overridden by the config
|
||||
export const generateSearchCollection = (searchConfig: SearchConfig): CollectionConfig =>
|
||||
deepMerge(
|
||||
{
|
||||
slug: 'search',
|
||||
access: {
|
||||
create: (): boolean => false,
|
||||
read: (): boolean => true,
|
||||
@@ -24,20 +25,21 @@ export const generateSearchCollection = (searchConfig: SearchConfig): Collection
|
||||
fields: [
|
||||
{
|
||||
name: 'title',
|
||||
type: 'text',
|
||||
admin: {
|
||||
readOnly: true,
|
||||
},
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
name: 'priority',
|
||||
type: 'number',
|
||||
admin: {
|
||||
position: 'sidebar',
|
||||
},
|
||||
type: 'number',
|
||||
},
|
||||
{
|
||||
name: 'doc',
|
||||
type: 'relationship',
|
||||
admin: {
|
||||
position: 'sidebar',
|
||||
readOnly: true,
|
||||
@@ -46,24 +48,22 @@ export const generateSearchCollection = (searchConfig: SearchConfig): Collection
|
||||
maxDepth: 0,
|
||||
relationTo: searchConfig?.collections || [],
|
||||
required: true,
|
||||
type: 'relationship',
|
||||
},
|
||||
{
|
||||
name: 'docUrl',
|
||||
type: 'ui',
|
||||
admin: {
|
||||
components: {
|
||||
Field: LinkToDoc,
|
||||
},
|
||||
position: 'sidebar',
|
||||
},
|
||||
type: 'ui',
|
||||
},
|
||||
],
|
||||
labels: {
|
||||
plural: 'Search Results',
|
||||
singular: 'Search Result',
|
||||
},
|
||||
slug: 'search',
|
||||
},
|
||||
searchConfig?.searchOverrides || {},
|
||||
)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { FormState } from '@payloadcms/ui'
|
||||
import type { UIField } from 'payload/types'
|
||||
import type { FormState, UIField } from 'payload/types'
|
||||
|
||||
import { useConfig, useWatchForm } from '@payloadcms/ui'
|
||||
import React from 'react'
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { Config } from 'payload/config'
|
||||
|
||||
import type { SearchConfig } from './types'
|
||||
import type { SearchConfig } from './types.js'
|
||||
|
||||
import { generateSearchCollection } from './Search'
|
||||
import deleteFromSearch from './Search/hooks/deleteFromSearch'
|
||||
import syncWithSearch from './Search/hooks/syncWithSearch'
|
||||
import deleteFromSearch from './Search/hooks/deleteFromSearch.js'
|
||||
import syncWithSearch from './Search/hooks/syncWithSearch.js'
|
||||
import { generateSearchCollection } from './Search/index.js'
|
||||
|
||||
const Search =
|
||||
(incomingSearchConfig: SearchConfig) =>
|
||||
|
||||
14
pnpm-lock.yaml
generated
14
pnpm-lock.yaml
generated
@@ -199,10 +199,10 @@ importers:
|
||||
specifier: 10.2.0
|
||||
version: 10.2.0
|
||||
playwright:
|
||||
specifier: file:playwright-1.43.0-next.tgz
|
||||
specifier: file:C:\code\payload\playwright-1.43.0-next.tgz
|
||||
version: file:playwright-1.43.0-next.tgz
|
||||
playwright-core:
|
||||
specifier: file:playwright-core-1.43.0-next.tgz
|
||||
specifier: file:C:\code\payload\playwright-core-1.43.0-next.tgz
|
||||
version: file:playwright-core-1.43.0-next.tgz
|
||||
prettier:
|
||||
specifier: ^3.0.3
|
||||
@@ -973,9 +973,9 @@ importers:
|
||||
'@payloadcms/ui':
|
||||
specifier: workspace:*
|
||||
version: link:../ui
|
||||
ts-deepmerge:
|
||||
specifier: ^2.0.1
|
||||
version: 2.0.7
|
||||
deepmerge:
|
||||
specifier: 4.3.1
|
||||
version: 4.3.1
|
||||
devDependencies:
|
||||
'@payloadcms/eslint-config':
|
||||
specifier: workspace:*
|
||||
@@ -15516,10 +15516,6 @@ packages:
|
||||
typescript: 5.2.2
|
||||
dev: false
|
||||
|
||||
/ts-deepmerge@2.0.7:
|
||||
resolution: {integrity: sha512-3phiGcxPSSR47RBubQxPoZ+pqXsEsozLo4G4AlSrsMKTFg9TA3l+3he5BqpUi9wiuDbaHWXH/amlzQ49uEdXtg==}
|
||||
dev: false
|
||||
|
||||
/ts-essentials@7.0.3(typescript@5.2.2):
|
||||
resolution: {integrity: sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ==}
|
||||
peerDependencies:
|
||||
|
||||
@@ -27,7 +27,13 @@ const packageWhitelist = [
|
||||
'richtext-lexical',
|
||||
'plugin-cloud',
|
||||
'plugin-cloud-storage',
|
||||
// 'plugin-form-builder',
|
||||
// 'plugin-nested-docs',
|
||||
// 'plugin-redirects',
|
||||
// 'plugin-search',
|
||||
// 'plugin-sentry',
|
||||
'plugin-seo',
|
||||
// 'plugin-stripe',
|
||||
]
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
|
||||
Reference in New Issue
Block a user