@rubixstudios/payload-typesense 1.1.2 → 1.1.6
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/README.md +1 -2
- package/dist/endpoints/handler/createAdvancedSearch.d.ts +2 -2
- package/dist/endpoints/handler/createAdvancedSearch.d.ts.map +1 -1
- package/dist/endpoints/handler/createCollections.d.ts +2 -2
- package/dist/endpoints/handler/createCollections.d.ts.map +1 -1
- package/dist/endpoints/handler/createSearch.d.ts +2 -2
- package/dist/endpoints/handler/createSearch.d.ts.map +1 -1
- package/dist/endpoints/handler/createSuggest.d.ts +2 -2
- package/dist/endpoints/handler/createSuggest.d.ts.map +1 -1
- package/dist/endpoints/health.d.ts +3 -3
- package/dist/endpoints/health.d.ts.map +1 -1
- package/dist/endpoints/search.d.ts +2 -2
- package/dist/endpoints/search.d.ts.map +1 -1
- package/dist/index.d.ts +2 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/lib/client.d.ts +2 -2
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/hooks.d.ts +3 -3
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/initialization.d.ts +2 -2
- package/dist/lib/initialization.d.ts.map +1 -1
- package/dist/lib/schema-mapper.d.ts +3 -3
- package/dist/lib/schema-mapper.d.ts.map +1 -1
- package/dist/lib/schema-mapper.js +2 -2
- package/dist/lib/validation.d.ts +0 -2
- package/dist/lib/validation.d.ts.map +1 -1
- package/dist/lib/validation.js +0 -54
- package/dist/utils/getAllCollections.d.ts +2 -2
- package/dist/utils/getAllCollections.d.ts.map +1 -1
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -100,8 +100,7 @@ function CollectionSearch() {
|
|
|
100
100
|
## Components
|
|
101
101
|
|
|
102
102
|
- **HeadlessSearchInput**: Single component supporting all search patterns:
|
|
103
|
-
- **
|
|
104
|
-
- **Multiple Collections**: `collections={['posts', 'products']}` - Smart filtering with universal search
|
|
103
|
+
- **Collections**: `collections={['posts', 'products']}` - Smart filtering with universal search
|
|
105
104
|
- **Universal Search**: No collection props - Search across all collections
|
|
106
105
|
- **Complete UI Control**: Customizable rendering with comprehensive theme system
|
|
107
106
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type Typesense from 'typesense';
|
|
2
2
|
import { type PayloadHandler } from 'payload';
|
|
3
|
-
import { type
|
|
4
|
-
export declare const createAdvancedSearch: (typesenseClient: Typesense.Client, pluginOptions:
|
|
3
|
+
import { type TypesenseConfig } from '../../index.js';
|
|
4
|
+
export declare const createAdvancedSearch: (typesenseClient: Typesense.Client, pluginOptions: TypesenseConfig) => PayloadHandler;
|
|
5
5
|
//# sourceMappingURL=createAdvancedSearch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAdvancedSearch.d.ts","sourceRoot":"","sources":["../../../src/endpoints/handler/createAdvancedSearch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,SAAS,CAAA;AAElE,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"createAdvancedSearch.d.ts","sourceRoot":"","sources":["../../../src/endpoints/handler/createAdvancedSearch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,SAAS,CAAA;AAElE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAErD,eAAO,MAAM,oBAAoB,GAC/B,iBAAiB,SAAS,CAAC,MAAM,EACjC,eAAe,eAAe,KAC7B,cA+BF,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type PayloadHandler } from 'payload';
|
|
2
|
-
import { type
|
|
3
|
-
export declare const createCollections: (pluginOptions:
|
|
2
|
+
import { type TypesenseConfig } from '../../index.js';
|
|
3
|
+
export declare const createCollections: (pluginOptions: TypesenseConfig) => PayloadHandler;
|
|
4
4
|
//# sourceMappingURL=createCollections.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCollections.d.ts","sourceRoot":"","sources":["../../../src/endpoints/handler/createCollections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"createCollections.d.ts","sourceRoot":"","sources":["../../../src/endpoints/handler/createCollections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAErD,eAAO,MAAM,iBAAiB,GAAI,eAAe,eAAe,KAAG,cAqBlE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type Typesense from 'typesense';
|
|
2
2
|
import { type PayloadHandler } from 'payload';
|
|
3
|
-
import { type
|
|
4
|
-
export declare const createSearch: (typesenseClient: Typesense.Client, pluginOptions:
|
|
3
|
+
import { type TypesenseConfig } from '../../index.js';
|
|
4
|
+
export declare const createSearch: (typesenseClient: Typesense.Client, pluginOptions: TypesenseConfig) => PayloadHandler;
|
|
5
5
|
//# sourceMappingURL=createSearch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSearch.d.ts","sourceRoot":"","sources":["../../../src/endpoints/handler/createSearch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,SAAS,CAAA;AAElE,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"createSearch.d.ts","sourceRoot":"","sources":["../../../src/endpoints/handler/createSearch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,SAAS,CAAA;AAElE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAKrD,eAAO,MAAM,YAAY,GACvB,iBAAiB,SAAS,CAAC,MAAM,EACjC,eAAe,eAAe,KAC7B,cAoGF,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type Typesense from 'typesense';
|
|
2
2
|
import { type PayloadHandler } from 'payload';
|
|
3
|
-
import { type
|
|
4
|
-
export declare const createSuggest: (typesenseClient: Typesense.Client, pluginOptions:
|
|
3
|
+
import { type TypesenseConfig } from '../../index.js';
|
|
4
|
+
export declare const createSuggest: (typesenseClient: Typesense.Client, pluginOptions: TypesenseConfig) => PayloadHandler;
|
|
5
5
|
//# sourceMappingURL=createSuggest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSuggest.d.ts","sourceRoot":"","sources":["../../../src/endpoints/handler/createSuggest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,SAAS,CAAA;AAElE,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"createSuggest.d.ts","sourceRoot":"","sources":["../../../src/endpoints/handler/createSuggest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,SAAS,CAAA;AAElE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAErD,eAAO,MAAM,aAAa,GACxB,iBAAiB,SAAS,CAAC,MAAM,EACjC,eAAe,eAAe,KAC7B,cA0CF,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type Typesense from 'typesense';
|
|
2
2
|
import { type PayloadHandler } from 'payload';
|
|
3
|
-
import { type
|
|
4
|
-
export declare const createHealthCheck: (typesenseClient: Typesense.Client, _pluginOptions:
|
|
5
|
-
export declare const createDetailedHealthCheck: (typesenseClient: Typesense.Client, pluginOptions:
|
|
3
|
+
import { type TypesenseConfig } from '../index.js';
|
|
4
|
+
export declare const createHealthCheck: (typesenseClient: Typesense.Client, _pluginOptions: TypesenseConfig, lastSyncTime?: number) => PayloadHandler;
|
|
5
|
+
export declare const createDetailedHealthCheck: (typesenseClient: Typesense.Client, pluginOptions: TypesenseConfig, lastSyncTime?: number) => PayloadHandler;
|
|
6
6
|
//# sourceMappingURL=health.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/endpoints/health.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAG7C,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/endpoints/health.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAG7C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAA;AAOlD,eAAO,MAAM,iBAAiB,GAC5B,iBAAiB,SAAS,CAAC,MAAM,EACjC,gBAAgB,eAAe,EAC/B,eAAe,MAAM,KACpB,cAsCF,CAAA;AAED,eAAO,MAAM,yBAAyB,GACpC,iBAAiB,SAAS,CAAC,MAAM,EACjC,eAAe,eAAe,EAC9B,eAAe,MAAM,KACpB,cAsFF,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type Typesense from 'typesense';
|
|
2
|
-
import { type
|
|
3
|
-
export declare const createSearchEndpoints: (typesenseClient: Typesense.Client, pluginOptions:
|
|
2
|
+
import { type TypesenseConfig } from '../index.js';
|
|
3
|
+
export declare const createSearchEndpoints: (typesenseClient: Typesense.Client, pluginOptions: TypesenseConfig, lastSyncTime?: number) => ({
|
|
4
4
|
handler: import("payload").PayloadHandler;
|
|
5
5
|
method: "get";
|
|
6
6
|
path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/endpoints/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/endpoints/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAA;AAOlD,eAAO,MAAM,qBAAqB,GAChC,iBAAiB,SAAS,CAAC,MAAM,EACjC,eAAe,eAAe,EAC9B,eAAe,MAAM;;;;;;;;IAuCtB,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { Config } from 'payload';
|
|
2
2
|
export * from './components/index.js';
|
|
3
|
-
export type
|
|
4
|
-
/**
|
|
5
|
-
* Collections to index in Typesense
|
|
6
|
-
*/
|
|
3
|
+
export type TypesenseConfig = {
|
|
7
4
|
collections?: Partial<Record<string, {
|
|
8
5
|
displayName?: string;
|
|
9
6
|
enabled: boolean;
|
|
@@ -13,18 +10,12 @@ export type TypesenseSearchConfig = {
|
|
|
13
10
|
sortFields?: string[];
|
|
14
11
|
}>>;
|
|
15
12
|
disabled?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Global plugin settings
|
|
18
|
-
*/
|
|
19
13
|
settings?: {
|
|
20
14
|
autoSync?: boolean;
|
|
21
15
|
batchSize?: number;
|
|
22
16
|
categorized?: boolean;
|
|
23
17
|
searchEndpoint?: string;
|
|
24
18
|
};
|
|
25
|
-
/**
|
|
26
|
-
* Typesense server configuration
|
|
27
|
-
*/
|
|
28
19
|
typesense: {
|
|
29
20
|
apiKey: string;
|
|
30
21
|
connectionTimeoutSeconds?: number;
|
|
@@ -35,5 +26,5 @@ export type TypesenseSearchConfig = {
|
|
|
35
26
|
}>;
|
|
36
27
|
};
|
|
37
28
|
};
|
|
38
|
-
export declare const typesenseSearch: (pluginOptions:
|
|
29
|
+
export declare const typesenseSearch: (pluginOptions: TypesenseConfig) => (config: Config) => Config;
|
|
39
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAOrC,cAAc,uBAAuB,CAAA;AAErC,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAOrC,cAAc,uBAAuB,CAAA;AAErC,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,CAAC,EAAE,OAAO,CACnB,MAAM,CACJ,MAAM,EACN;QACE,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,OAAO,EAAE,OAAO,CAAA;QAChB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;QACtB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;QACvB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;KACtB,CACF,CACF,CAAA;IAED,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,WAAW,CAAC,EAAE,OAAO,CAAA;QACrB,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB,CAAA;IAED,SAAS,EAAE;QACT,MAAM,EAAE,MAAM,CAAA;QACd,wBAAwB,CAAC,EAAE,MAAM,CAAA;QACjC,KAAK,EAAE,KAAK,CAAC;YACX,IAAI,EAAE,MAAM,CAAA;YACZ,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;YACrB,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAA;SAC3B,CAAC,CAAA;KACH,CAAA;CACF,CAAA;AAED,eAAO,MAAM,eAAe,GACzB,eAAe,eAAe,MAC9B,QAAQ,MAAM,KAAG,MAyDjB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -7,14 +7,11 @@ export const typesenseSearch = (pluginOptions)=>(config)=>{
|
|
|
7
7
|
if (pluginOptions.disabled) {
|
|
8
8
|
return config;
|
|
9
9
|
}
|
|
10
|
-
// Initialize Typesense client
|
|
11
10
|
const typesenseClient = createClient(pluginOptions.typesense);
|
|
12
|
-
// Add search endpoints
|
|
13
11
|
config.endpoints = [
|
|
14
12
|
...config.endpoints || [],
|
|
15
13
|
...createSearchEndpoints(typesenseClient, pluginOptions, Date.now())
|
|
16
14
|
];
|
|
17
|
-
// Apply hooks to individual collections
|
|
18
15
|
if (pluginOptions.settings?.autoSync !== false && pluginOptions.collections) {
|
|
19
16
|
config.collections = (config.collections || []).map((collection)=>{
|
|
20
17
|
const collectionConfig = pluginOptions.collections?.[collection.slug];
|
|
@@ -41,7 +38,6 @@ export const typesenseSearch = (pluginOptions)=>(config)=>{
|
|
|
41
38
|
return collection;
|
|
42
39
|
});
|
|
43
40
|
}
|
|
44
|
-
// Initialize collections in Typesense
|
|
45
41
|
const incomingOnInit = config.onInit;
|
|
46
42
|
config.onInit = async (payload)=>{
|
|
47
43
|
if (incomingOnInit) {
|
package/dist/lib/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Typesense from 'typesense';
|
|
2
|
-
import { type
|
|
3
|
-
export declare const createClient: (typesenseConfig:
|
|
2
|
+
import { type TypesenseConfig } from '../index.js';
|
|
3
|
+
export declare const createClient: (typesenseConfig: TypesenseConfig["typesense"]) => Typesense.Client;
|
|
4
4
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/lib/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAA;AAiDlD,eAAO,MAAM,YAAY,GACvB,iBAAiB,eAAe,CAAC,WAAW,CAAC,KAC5C,SAAS,CAAC,MAoBZ,CAAA"}
|
package/dist/lib/hooks.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type Typesense from 'typesense';
|
|
2
2
|
import { type CollectionAfterChangeHook, type CollectionAfterDeleteHook } from 'payload';
|
|
3
|
-
import { type
|
|
4
|
-
export declare const setupHooks: (typesenseClient: Typesense.Client, pluginOptions:
|
|
3
|
+
import { type TypesenseConfig } from '../index.js';
|
|
4
|
+
export declare const setupHooks: (typesenseClient: Typesense.Client, pluginOptions: TypesenseConfig, existingHooks?: {
|
|
5
5
|
afterChange?: Record<string, CollectionAfterChangeHook[]>;
|
|
6
6
|
afterDelete?: Record<string, CollectionAfterDeleteHook[]>;
|
|
7
7
|
}) => {
|
|
8
8
|
afterChange?: Record<string, CollectionAfterChangeHook[]>;
|
|
9
9
|
afterDelete?: Record<string, CollectionAfterDeleteHook[]>;
|
|
10
10
|
};
|
|
11
|
-
export declare const syncDocumentToTypesense: (typesenseClient: Typesense.Client, collectionSlug: string, doc: any, _operation: "create" | "update", config: NonNullable<
|
|
11
|
+
export declare const syncDocumentToTypesense: (typesenseClient: Typesense.Client, collectionSlug: string, doc: any, _operation: "create" | "update", config: NonNullable<TypesenseConfig["collections"]>[string] | undefined) => Promise<void>;
|
|
12
12
|
export declare const deleteDocumentFromTypesense: (typesenseClient: Typesense.Client, collectionSlug: string, docId: string) => Promise<void>;
|
|
13
13
|
//# sourceMappingURL=hooks.d.ts.map
|
package/dist/lib/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/lib/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,yBAAyB,EAAE,KAAK,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAExF,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/lib/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,yBAAyB,EAAE,KAAK,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAExF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAA;AAIlD,eAAO,MAAM,UAAU,GACrB,iBAAiB,SAAS,CAAC,MAAM,EACjC,eAAe,eAAe,EAC9B,gBAAe;IACb,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,EAAE,CAAC,CAAA;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,EAAE,CAAC,CAAA;CACrD;kBAFU,MAAM,CAAC,MAAM,EAAE,yBAAyB,EAAE,CAAC;kBAC3C,MAAM,CAAC,MAAM,EAAE,yBAAyB,EAAE,CAAC;CAgC5D,CAAA;AAED,eAAO,MAAM,uBAAuB,GAClC,iBAAiB,SAAS,CAAC,MAAM,EACjC,gBAAgB,MAAM,EACtB,KAAK,GAAG,EACR,YAAY,QAAQ,GAAG,QAAQ,EAC/B,QAAQ,WAAW,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,kBAaxE,CAAA;AAED,eAAO,MAAM,2BAA2B,GACtC,iBAAiB,SAAS,CAAC,MAAM,EACjC,gBAAgB,MAAM,EACtB,OAAO,MAAM,kBAOd,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type Typesense from 'typesense';
|
|
2
2
|
import { type Payload } from 'payload';
|
|
3
|
-
import { type
|
|
4
|
-
export declare const initializeTypesenseCollections: (payload: Payload, typesenseClient: Typesense.Client, pluginOptions:
|
|
3
|
+
import { type TypesenseConfig } from '../index.js';
|
|
4
|
+
export declare const initializeTypesenseCollections: (payload: Payload, typesenseClient: Typesense.Client, pluginOptions: TypesenseConfig) => Promise<void>;
|
|
5
5
|
//# sourceMappingURL=initialization.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialization.d.ts","sourceRoot":"","sources":["../../src/lib/initialization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"initialization.d.ts","sourceRoot":"","sources":["../../src/lib/initialization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAA;AAOlD,eAAO,MAAM,8BAA8B,GACzC,SAAS,OAAO,EAChB,iBAAiB,SAAS,CAAC,MAAM,EACjC,eAAe,eAAe,kBAkB/B,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type TypesenseConfig } from '../index.js';
|
|
2
2
|
import { type BaseDocument } from '../types.js';
|
|
3
|
-
export declare const mapCollectionToTypesense: (collectionSlug: string, config: NonNullable<
|
|
3
|
+
export declare const mapCollectionToTypesense: (collectionSlug: string, config: NonNullable<TypesenseConfig["collections"]>[string] | undefined) => {
|
|
4
4
|
name: string;
|
|
5
5
|
fields: ({
|
|
6
6
|
readonly name: "id";
|
|
@@ -20,5 +20,5 @@ export declare const mapCollectionToTypesense: (collectionSlug: string, config:
|
|
|
20
20
|
facet: boolean;
|
|
21
21
|
})[];
|
|
22
22
|
};
|
|
23
|
-
export declare const mapToTypesense: (doc: BaseDocument, _collectionSlug: string, config: NonNullable<
|
|
23
|
+
export declare const mapToTypesense: (doc: BaseDocument, _collectionSlug: string, config: NonNullable<TypesenseConfig["collections"]>[string] | undefined) => Record<string, string | number>;
|
|
24
24
|
//# sourceMappingURL=schema-mapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-mapper.d.ts","sourceRoot":"","sources":["../../src/lib/schema-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"schema-mapper.d.ts","sourceRoot":"","sources":["../../src/lib/schema-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C,eAAO,MAAM,wBAAwB,GACnC,gBAAgB,MAAM,EACtB,QAAQ,WAAW,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS;;;;;;;;;;;;;;;;;;;CAgCxE,CAAA;AAED,eAAO,MAAM,cAAc,GACzB,KAAK,YAAY,EACjB,iBAAiB,MAAM,EACvB,QAAQ,WAAW,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,oCA2ExE,CAAA"}
|
|
@@ -34,7 +34,7 @@ export const mapCollectionToTypesense = (collectionSlug, config)=>{
|
|
|
34
34
|
type: 'string',
|
|
35
35
|
facet: true
|
|
36
36
|
}));
|
|
37
|
-
const
|
|
37
|
+
const schema = {
|
|
38
38
|
name: collectionSlug,
|
|
39
39
|
fields: [
|
|
40
40
|
...baseFields,
|
|
@@ -42,7 +42,7 @@ export const mapCollectionToTypesense = (collectionSlug, config)=>{
|
|
|
42
42
|
...facetOnlyFields
|
|
43
43
|
]
|
|
44
44
|
};
|
|
45
|
-
return
|
|
45
|
+
return schema;
|
|
46
46
|
};
|
|
47
47
|
export const mapToTypesense = (doc, _collectionSlug, config)=>{
|
|
48
48
|
const searchableFields = config?.searchFields || [
|
package/dist/lib/validation.d.ts
CHANGED
|
@@ -50,8 +50,6 @@ export interface ValidationResult {
|
|
|
50
50
|
success: boolean;
|
|
51
51
|
}
|
|
52
52
|
export declare function validateConfig(config: unknown): ValidationResult;
|
|
53
|
-
export declare function validateAndTransformConfig(config: unknown): ValidationResult;
|
|
54
|
-
export declare function validateCollectionConfig(collectionSlug: string, config: unknown): ValidateResult;
|
|
55
53
|
export declare function getValidationErrors(errors: string[]): string;
|
|
56
54
|
export declare const SearchParamsSchema: z.ZodObject<{
|
|
57
55
|
facets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/lib/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC,GAAG,qBAAqB,CAAA;IACrF,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;CACjB;AAQD,QAAA,MAAM,sBAAsB;;;;;;;iBAO1B,CAAA;AAYF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUtC,CAAA;AAEF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAExF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,8BAA8B,CAAA;IACrC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,gBAAgB,CAgBhE;AAED,wBAAgB,
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/lib/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC,GAAG,qBAAqB,CAAA;IACrF,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;CACjB;AAQD,QAAA,MAAM,sBAAsB;;;;;;;iBAO1B,CAAA;AAYF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUtC,CAAA;AAEF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAExF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,8BAA8B,CAAA;IACrC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,gBAAgB,CAgBhE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAE5D;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;iBAW7B,CAAA;AAEF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEtE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,cAAc,CAgBpE"}
|
package/dist/lib/validation.js
CHANGED
|
@@ -60,60 +60,6 @@ export function validateConfig(config) {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
export function validateAndTransformConfig(config) {
|
|
64
|
-
try {
|
|
65
|
-
const validatedConfig = TypesenseSearchConfigSchema.parse(config);
|
|
66
|
-
return {
|
|
67
|
-
data: validatedConfig,
|
|
68
|
-
success: true
|
|
69
|
-
};
|
|
70
|
-
} catch (error) {
|
|
71
|
-
if (error instanceof z.ZodError) {
|
|
72
|
-
const errors = error.issues.map((issue)=>{
|
|
73
|
-
const path = issue.path.length ? `${issue.path.join('.')}: ` : '';
|
|
74
|
-
return `${path}${issue.message}`;
|
|
75
|
-
});
|
|
76
|
-
return {
|
|
77
|
-
errors,
|
|
78
|
-
success: false
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
errors: [
|
|
83
|
-
'Invalid configuration format'
|
|
84
|
-
],
|
|
85
|
-
success: false
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
export function validateCollectionConfig(collectionSlug, config) {
|
|
90
|
-
try {
|
|
91
|
-
const validatedConfig = CollectionConfigSchema.parse(config);
|
|
92
|
-
return {
|
|
93
|
-
data: {
|
|
94
|
-
[collectionSlug]: validatedConfig
|
|
95
|
-
},
|
|
96
|
-
success: true
|
|
97
|
-
};
|
|
98
|
-
} catch (error) {
|
|
99
|
-
if (error instanceof z.ZodError) {
|
|
100
|
-
const errors = error.issues.map((issue)=>{
|
|
101
|
-
const path = issue.path.length ? `${issue.path.join('.')}: ` : '';
|
|
102
|
-
return `Collection '${collectionSlug}' - ${path}${issue.message}`;
|
|
103
|
-
});
|
|
104
|
-
return {
|
|
105
|
-
errors,
|
|
106
|
-
success: false
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
return {
|
|
110
|
-
errors: [
|
|
111
|
-
`Collection '${collectionSlug}': Invalid configuration format`
|
|
112
|
-
],
|
|
113
|
-
success: false
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
63
|
export function getValidationErrors(errors) {
|
|
118
64
|
return errors.map((error, index)=>`${index + 1}. ${error}`).join('\n');
|
|
119
65
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type Typesense from 'typesense';
|
|
2
|
-
import { type
|
|
3
|
-
export declare const getAllCollections: (typesenseClient: Typesense.Client, pluginOptions:
|
|
2
|
+
import { type TypesenseConfig } from '../index.js';
|
|
3
|
+
export declare const getAllCollections: (typesenseClient: Typesense.Client, pluginOptions: TypesenseConfig, query: string, options: {
|
|
4
4
|
filters: Record<string, unknown>;
|
|
5
5
|
page: number;
|
|
6
6
|
per_page: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAllCollections.d.ts","sourceRoot":"","sources":["../../src/utils/getAllCollections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"getAllCollections.d.ts","sourceRoot":"","sources":["../../src/utils/getAllCollections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAA;AAGlD,eAAO,MAAM,iBAAiB,GAC5B,iBAAiB,SAAS,CAAC,MAAM,EACjC,eAAe,eAAe,EAC9B,OAAO,MAAM,EACb,SAAS;IACP,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,sBA8FF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rubixstudios/payload-typesense",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "A production-ready search plugin that integrates Typesense with Payload CMS, offering fast, typo-tolerant search with real-time synchronization. This fork by Rubix Studios reduces bloat and introduces targeted changes for improved performance, maintainability, and flexibility.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Rubix Studios <hello@rubixstudios.com.au> (https://rubixstudios.com.au)",
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
"@semantic-release/changelog": "^6.0.3",
|
|
63
63
|
"@semantic-release/git": "^10.0.1",
|
|
64
64
|
"@semantic-release/github": "^12.0.2",
|
|
65
|
-
"@semantic-release/npm": "^13.1.
|
|
65
|
+
"@semantic-release/npm": "^13.1.2",
|
|
66
66
|
"@swc/cli": "^0.7.9",
|
|
67
|
-
"@swc/core": "^1.15.
|
|
68
|
-
"@types/react": "19.2.
|
|
67
|
+
"@swc/core": "^1.15.3",
|
|
68
|
+
"@types/react": "19.2.7",
|
|
69
69
|
"eslint": "^9.39.1",
|
|
70
|
-
"payload": "3.
|
|
71
|
-
"prettier": "^3.
|
|
72
|
-
"rimraf": "6.1.
|
|
70
|
+
"payload": "3.65.0",
|
|
71
|
+
"prettier": "^3.7.2",
|
|
72
|
+
"rimraf": "6.1.2",
|
|
73
73
|
"semantic-release": "^25.0.2",
|
|
74
74
|
"typescript": "5.9.3"
|
|
75
75
|
},
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"access": "public",
|
|
85
85
|
"registry": "https://registry.npmjs.org/",
|
|
86
86
|
"main": "./dist/index.js",
|
|
87
|
+
"provenance": true,
|
|
87
88
|
"types": "./dist/index.d.ts",
|
|
88
89
|
"exports": {
|
|
89
90
|
".": {
|
|
@@ -95,7 +96,7 @@
|
|
|
95
96
|
},
|
|
96
97
|
"dependencies": {
|
|
97
98
|
"typesense": "^2.1.0",
|
|
98
|
-
"zod": "^4.1.
|
|
99
|
+
"zod": "^4.1.13"
|
|
99
100
|
},
|
|
100
|
-
"packageManager": "pnpm@10.
|
|
101
|
+
"packageManager": "pnpm@10.24.0"
|
|
101
102
|
}
|