n8n-nodes-meilisearch 0.1.2 → 0.1.5

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 CHANGED
@@ -1,21 +1,26 @@
1
1
  # n8n-nodes-meilisearch
2
2
 
3
- This is an n8n community node. It lets you use the meilisearch REST API in your n8n workflows.
3
+ A comprehensive n8n community node for interacting with the Meilisearch REST API. This node provides full coverage of Meilisearch operations including document management, index operations, search functionality, task management, and more.
4
4
 
5
- [Meilisearch](https://meilisearch.com)
6
- An open-source, lightning-fast, and hyper-relevant search engine that fits effortlessly into your apps, websites, and workflow.
5
+ ## About Meilisearch
7
6
 
8
- [meilisearch API Docs](https://docs.meilisearch.com/reference/api/overview.html)
7
+ [Meilisearch](https://meilisearch.com) is an open-source, lightning-fast, and hyper-relevant search engine that fits effortlessly into your apps, websites, and workflows. It provides a RESTful API for managing search indexes, documents, and performing lightning-fast searches.
9
8
 
10
- [n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.
9
+ ## About n8n
11
10
 
12
- [Installation](#installation)
13
- [Operations](#operations)
14
- [Credentials](#credentials)
15
- [Compatibility](#compatibility)
16
- [Usage](#usage)
17
- [Resources](#resources)
18
- [Version history](#version-history)
11
+ [n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform that allows you to connect different services and automate tasks.
12
+
13
+ ## Table of Contents
14
+
15
+ - [Installation](#installation)
16
+ - [Operations](#operations)
17
+ - [Credentials](#credentials)
18
+ - [Compatibility](#compatibility)
19
+ - [Usage](#usage)
20
+ - [Examples](#examples)
21
+ - [Resources](#resources)
22
+ - [Version History](#version-history)
23
+ - [Contributing](#contributing)
19
24
 
20
25
  ## Installation
21
26
 
@@ -23,55 +28,134 @@ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes
23
28
 
24
29
  ## Operations
25
30
 
26
- - Documents
27
- - Add or replace documents
28
- - Add or update documents
29
- - Delete batch of documents by UID
30
- - Delete all documents in an index
31
- - Get documents
32
- - Get one document by UID
33
- - General
34
- - Create a dump
35
- - Get all index stats
36
- - Get health
37
- - Get version information
38
- - Indexes
39
- - Create an index
40
- - Get stats of an index
41
- - List indexes
42
- - Search index
43
- - Swap indexes
44
- - Keys
45
- - Create a new key
46
- - Delete a key by its uid or key
47
- - Get a single key by its uid or key
48
- - Get many api keys
49
- - Update a key by its uid or key
50
- - Search
51
- - Search an index (Also found in indexes section)
52
- - Settings
53
- - Get the settings of an index
54
- - Reset the settings of an index
55
- - Update the settings of an index
56
- - Tasks
57
- - Cancel tasks
58
- - Delete tasks
59
- - Get all tasks
60
- - Get one task by UID
31
+ This node supports all major Meilisearch API operations organized by resource type:
32
+
33
+ ### Documents
34
+ - **Add or Replace Documents** - Add new documents or replace existing ones in an index
35
+ - Optional: Wait for task completion with configurable polling
36
+ - Optional: Primary key field mapping for flexible document structures
37
+ - **Add or Update Documents** - Add new documents or update existing ones (partial updates)
38
+ - Optional: Wait for task completion with configurable polling
39
+ - Optional: Primary key field mapping for flexible document structures
40
+ - **Delete Batch of Documents** - Delete multiple documents by their UIDs
41
+ - **Delete All Documents** - Remove all documents from an index
42
+ - **Get Documents** - Retrieve multiple documents with pagination and filtering support
43
+ - **Get One Document** - Retrieve a single document by its UID
44
+
45
+ ### General
46
+ - **Create a Dump** - Generate a database dump for backup or migration
47
+ - **Get All Index Stats** - Retrieve statistics about all indexes and the database
48
+ - **Get Health** - Check the health status of your Meilisearch instance
49
+ - **Get Version** - Get the version information of your Meilisearch instance
50
+
51
+ ### Indexes
52
+ - **Create an Index** - Create a new search index with optional primary key
53
+ - **Get Stats of an Index** - Retrieve detailed statistics for a specific index
54
+ - **List Indexes** - List all indexes with pagination support
55
+ - **Search Index** - Perform a search query on an index (also available in Search resource)
56
+ - **Swap Indexes** - Swap documents, settings, and task history between index pairs
57
+
58
+ ### Keys
59
+ - **Create an API Key** - Create a new API key with specific permissions
60
+ - **Delete an API Key** - Delete a key by its UID or key value
61
+ - **Get an API Key** - Retrieve details of a specific API key
62
+ - **Get API Keys** - List all API keys (returns 20 most recently created)
63
+ - **Update an API Key** - Update permissions or expiration of an existing key
64
+
65
+ ### Search
66
+ - **Search Index** - Perform advanced searches with filtering, faceting, highlighting, and more
67
+ - **Multi-Search** - Perform multiple searches across different indexes in a single request
68
+
69
+ ### Settings
70
+ - **Get Index Settings** - Retrieve all settings for an index
71
+ - **Reset Index Settings** - Reset all settings to their default values
72
+ - **Update Index Settings** - Update searchable attributes, ranking rules, typo tolerance, synonyms, and more
73
+
74
+ ### Tasks
75
+ - **Get All Tasks** - List all tasks with filtering options (by status, type, index, date, etc.)
76
+ - **Get a Single Task** - Retrieve details of a specific task by UID
77
+ - **Wait for Task** - Poll a task until completion (succeeded, failed, or canceled) with exponential backoff
78
+ - **Cancel Tasks** - Cancel enqueued or processing tasks
79
+ - **Delete Tasks** - Delete finished tasks (succeeded, failed, or canceled)
61
80
 
62
81
  ## Credentials
63
82
 
64
- By [providing Meilisearch with a master key at launch](https://docs.meilisearch.com/learn/security/master_api_keys.html#protecting-a-meilisearch-instance), you protect your instance from unauthorized requests. The provided master key must be at least 16 bytes. From then on, you must include the `Authorization` header along with a valid API key to access protected routes (all routes except /health.)
83
+ ### Setting Up Credentials
84
+
85
+ 1. **Host URL**: Enter your Meilisearch instance URL (e.g., `https://your-meilisearch-instance.com` or `http://localhost:7700`)
86
+ 2. **API Key**: Provide your Meilisearch API key
87
+
88
+ ### Security Notes
89
+
90
+ By [providing Meilisearch with a master key at launch](https://docs.meilisearch.com/learn/security/master_api_keys.html#protecting-a-meilisearch-instance), you protect your instance from unauthorized requests. The provided master key must be at least 16 bytes. From then on, you must include the `Authorization` header along with a valid API key to access protected routes (all routes except `/health`).
65
91
 
66
- The credentials type provided in this node send an `Authorization` header with the key you provide. e.g. `Authorization: Bearer YOURKEY`
92
+ The credentials type provided in this node automatically sends an `Authorization` header with the key you provide:
93
+ ```
94
+ Authorization: Bearer YOURKEY
95
+ ```
96
+
97
+ ### Credential Testing
98
+
99
+ The credentials are tested against the `/version` endpoint. You can save your credentials regardless of the test result, but ensure your API key has the necessary permissions for the operations you plan to use.
67
100
 
68
101
  ## Compatibility
69
102
 
70
- This is subject to change.
103
+ - **n8n**: Compatible with n8n version 2.1.0 and above (tested with 2.1.4)
104
+ - **Meilisearch**: Compatible with Meilisearch v1.0.0 and above
105
+ - **Node.js**: Requires Node.js 16.x or higher
106
+ - **TypeScript**: Built with TypeScript 5.3.3
107
+
108
+ *Note: Compatibility is subject to change with future updates.*
71
109
 
72
110
  ## Usage
73
111
 
74
- Use as you would any node- I tried to include useful descriptions and hints for all fields.
112
+ ### Basic Workflow
113
+
114
+ 1. Add the Meilisearch node to your workflow
115
+ 2. Configure your credentials (Host URL and API Key)
116
+ 3. Select the resource type (Documents, Indexes, Search, etc.)
117
+ 4. Choose the operation you want to perform
118
+ 5. Fill in the required parameters
119
+ 6. Execute the workflow
120
+
121
+ ### Tips
122
+
123
+ - **Index UID Fields**: When your API key has proper permissions, index UID fields will show as dropdowns with available indexes
124
+ - **JSON Input**: For document operations, you can use n8n expressions:
125
+ - `{{ $json }}` - For a single object (recommended)
126
+ - `{{ JSON.stringify($json) }}` - For stringified JSON
127
+ - `{{ JSON.stringify($input.all().map(j => j.json)) }}` - For multiple items
128
+ - **Primary Key Field Mapping**: If your documents use a different field name than the index's primary key, specify it in the "Primary Key Field" option. The node will automatically map it to the correct field name.
129
+ - **Wait for Completion**: Enable "Wait for Completion" on document operations to automatically poll until the task completes. Choose between fixed interval or exponential backoff polling.
130
+ - **Task Management**: Many operations return a task UID. Use the "Wait for Task" operation or enable "Wait for Completion" on document operations to automatically wait for tasks to finish.
131
+ - **Field Hints**: Most fields include helpful hints and examples in their descriptions
132
+
133
+ ### Common Patterns
134
+
135
+ #### Adding Documents
136
+ 1. Use "Documents" → "Add or Replace Documents" or "Add or Update Documents"
137
+ 2. Select your index from the dropdown
138
+ 3. Provide documents using `{{ $json }}` for a single object or `{{ JSON.stringify($input.all().map(j => j.json)) }}` for multiple items
139
+ 4. (Optional) Specify "Primary Key Field" if your documents use a different field name than the index's primary key
140
+ 5. (Optional) Enable "Wait for Completion" to automatically wait for the task to finish
141
+
142
+ #### Searching
143
+ 1. **Single Index Search**: Use "Search" → "Search Index" or "Indexes" → "Search Index"
144
+ - Select your index
145
+ - Enter your search query
146
+ - Configure additional fields like filters, facets, pagination, etc.
147
+ 2. **Multi-Index Search**: Use "Search" → "Multi-Search"
148
+ - Add multiple queries, each targeting a different index
149
+ - Configure search parameters per query (filters, facets, pagination, etc.)
150
+ - Get results from multiple indexes in a single request
151
+
152
+ #### Waiting for Task Completion
153
+ 1. **Automatic (Recommended)**: Enable "Wait for Completion" on document operations (Add/Replace/Update Documents)
154
+ - Configure polling interval and timeout
155
+ - Choose between fixed interval or exponential backoff
156
+ 2. **Manual**: Use "Tasks" → "Wait for Task" operation
157
+ - Provide the task UID from a previous operation
158
+ - Configure polling settings
75
159
 
76
160
  ## Updating
77
161
 
@@ -118,24 +202,111 @@ else
118
202
  fi
119
203
  ```
120
204
 
205
+ ## Examples
206
+
207
+ ### Example 1: Adding Documents to an Index
208
+
209
+ ```json
210
+ {
211
+ "resource": "documents",
212
+ "operation": "addOrReplaceDocuments",
213
+ "uid": "movies",
214
+ "documentsJson": "[{\"id\": 1, \"title\": \"Inception\", \"year\": 2010}, {\"id\": 2, \"title\": \"The Matrix\", \"year\": 1999}]"
215
+ }
216
+ ```
217
+
218
+ ### Example 2: Searching with Filters
219
+
220
+ ```json
221
+ {
222
+ "resource": "search",
223
+ "operation": "search",
224
+ "uid": "movies",
225
+ "additionalFields": {
226
+ "query": "sci-fi",
227
+ "filter": "year > 2000",
228
+ "limit": 20
229
+ }
230
+ }
231
+ ```
232
+
233
+ ### Example 3: Checking Task Status
234
+
235
+ ```json
236
+ {
237
+ "resource": "tasks",
238
+ "operation": "getTask",
239
+ "uid": 12345
240
+ }
241
+ ```
242
+
121
243
  ## Resources
122
244
 
123
- * [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
124
- * [n8n-nodes-meilisearch repository](https://github.com/Bwilliamson55/n8n-nodes-meilisearch)
125
- * [Official Meilisearch API Reference](https://www.meilisearch.com/docs/reference/api/overview)
126
- * [Official Meilisearch Docs](https://www.meilisearch.com/docs/learn/what_is_meilisearch/overview)
127
-
128
- ## Version history
129
-
130
- - 0.1.0 - Initial release
131
- - Almost all API endpoints accounted for in node operations
132
- - TODO:
133
- - multi-search,
134
- - index settings sub-routes,
135
- - (Done in 0.1.1) auto-populating options where possible
136
- - Due to the very dynamic permissions, getting options has a high chance of failure. For MVP I opted to skip loading options dynamically, such as index names.
137
- - Currently index settings can be interacted with, but as the entire settings object for each index
138
- - 0.1.1 - QOL Updates
139
- - When adding or updating documents, the "Documents JSON" field is now far more forgiving. Very broken JSON will throw an error before sending as well.
140
- - Some array type input fields are now also validated and transformed as JSON
141
- - UID fields will be a dropdown when credentials have the proper permissions
245
+ ### Documentation
246
+ - [n8n Community Nodes Documentation](https://docs.n8n.io/integrations/community-nodes/)
247
+ - [Official Meilisearch API Reference](https://www.meilisearch.com/docs/reference/api/overview)
248
+ - [Official Meilisearch Documentation](https://www.meilisearch.com/docs/learn/what_is_meilisearch/overview)
249
+ - [Meilisearch Tasks Documentation](https://www.meilisearch.com/docs/learn/async/working_with_tasks)
250
+
251
+ ### Repository
252
+ - [n8n-nodes-meilisearch GitHub Repository](https://github.com/Bwilliamson55/n8n-nodes-meilisearch)
253
+
254
+ ### Support
255
+ - [Meilisearch Discord](https://discord.gg/meilisearch)
256
+ - [n8n Community Forum](https://community.n8n.io/)
257
+
258
+ ## Version History
259
+
260
+ ### 0.1.4 (Current)
261
+ - **Multi-Search Support**: Added "Multi-Search" operation to search across multiple indexes in a single request
262
+ - Full support for all search parameters per query (filters, facets, pagination, etc.)
263
+ - Configure multiple queries with different indexes and parameters
264
+ - **Fixed 415 Errors**: Resolved Content-Type header issues in search and multi-search operations
265
+ - **Enhanced Body Parameter Handling**: Improved request body construction for POST operations
266
+
267
+ ### 0.1.3
268
+ - **Wait for Task Completion**: Added automatic task polling for document operations
269
+ - Configurable polling intervals with exponential backoff option
270
+ - Fixed interval or exponential backoff modes
271
+ - Configurable timeout and max polling interval
272
+ - **Wait for Task Operation**: New standalone operation to poll any task until completion
273
+ - **Primary Key Field Mapping**: Automatic field mapping for documents with different primary key field names
274
+ - Validates that specified field exists in all documents
275
+ - Automatically transforms documents to match index's primary key field
276
+ - **Enhanced JSON Input**: Improved support for object inputs (e.g., `{{ $json }}`)
277
+ - **Better Error Messages**: More detailed JSON validation errors with position information
278
+ - **Updated Dependencies**: Upgraded to n8n-workflow 2.2.1, TypeScript 5.3.3, and other dependencies
279
+
280
+ ### 0.1.2
281
+ - Previous stable version
282
+
283
+ ### 0.1.1 - QOL Updates
284
+ - Improved JSON validation for document operations with better error messages
285
+ - Array type input fields now validated and transformed as JSON
286
+ - UID fields display as dropdowns when credentials have proper permissions
287
+ - Enhanced field descriptions and hints
288
+
289
+ ### 0.1.0 - Initial Release
290
+ - Comprehensive coverage of Meilisearch API endpoints
291
+ - Support for Documents, General, Indexes, Keys, Search, Settings, and Tasks resources
292
+ - Auto-populating options for index UIDs (when permissions allow)
293
+ - Full settings management (as entire settings object)
294
+
295
+ ### Known Limitations & Planned Features
296
+ - **Index Settings Sub-routes**: Currently supports full settings object only (sub-routes planned for future version)
297
+ - See [PLANNING.md](./PLANNING.md) for detailed roadmap
298
+
299
+ ## Contributing
300
+
301
+ Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
302
+
303
+ ### Development Setup
304
+
305
+ 1. Clone the repository
306
+ 2. Install dependencies: `npm install`
307
+ 3. Build the project: `npm run build`
308
+ 4. Run linting: `npm run lint`
309
+
310
+ ### Reporting Issues
311
+
312
+ If you encounter any issues or have feature requests, please open an issue on the [GitHub repository](https://github.com/Bwilliamson55/n8n-nodes-meilisearch/issues).
@@ -1,5 +1,5 @@
1
1
  import { type INodeProperties } from 'n8n-workflow';
2
- export declare function validateJSON(json: string | undefined): any;
2
+ export declare function validateJSON(json: string | undefined | any): any;
3
3
  export declare const documentsOperations: INodeProperties[];
4
4
  export declare const documentsFields: INodeProperties[];
5
5
  export declare const documentsAdditionalFields: INodeProperties[];