Commit 30fa252
feat: Add NIP-50 full-text search support (#587)
* feat: implement NIP-50 full-text search support
* fix: use timingSafeEqual and zod for nodeless HMAC check
* refactor: only register nodeless route when enabled
* chore: sync with upstream main
* feat(nip-50): add full-text search support
wire up NIP-50 search filter through subscription handler,
event repository, and filter schema. add ts_rank relevance
sorting, maxQueryLength truncation, and GIN index migration.
parameterize tsConfig as ?::regconfig to prevent SQL injection.
trim search input before truncation so whitespace doesn't waste
the query length budget. advertise search_supported in NIP-11.
* fix(nodeless): harden webhook verification
use logger.error for security rejection paths (missing secret,
invalid signature format, signature mismatch). guard all
callback routes with requireProcessor middleware.
* test: cover NIP-50 search, nodeless security, and NIP-11 fields
add search filter tests for event-repository (parameterized SQL,
truncation, relevance ranking), filter-schema (validation bounds),
subscribe-handler (search stripping when disabled), event utils
(in-memory matching), and root-request-handler (search_supported).
update nodeless controller specs for logger.error assertions.
* docs: fix GIN index name in nip50.language note
the migration creates events_content_fts_idx, not
idx_events_content_fts. operators following the old
instructions would create a duplicate index.
* test: update assertions for parameterized regconfig
the ?::regconfig bindings serialize as 'simple'::regconfig
in knex query strings, not 'simple' inside a template literal.
* chore: add new files from upstream main
includes changesets, husky install script, auth handler,
group event strategy, geohash utils, NIP-25/NIP-65 utils,
integration and performance test scaffolding.
* refactor: remove unrelated nodeless changes from NIP-50 PR
revert logger.error and route guard changes to match main.
these will be submitted as a separate PR.
* fix(ci): enable NIP-50 in integration test settings
the test container uses default-settings.yaml which has nip50.enabled: false.
without this override the relay strips the search filter and nip-50.feature
scenarios fail.
---------
Co-authored-by: Ricardo Cabral <me@ricardocabral.io>1 parent ca23be1 commit 30fa252
22 files changed
Lines changed: 431 additions & 11 deletions
File tree
- .changeset
- migrations
- resources
- src
- @types
- factories
- handlers
- request-handlers
- repositories
- schemas
- utils
- test
- integration
- features
- nip-50
- unit
- handlers/request-handlers
- repositories
- schemas
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
182 | 185 | | |
183 | 186 | | |
184 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
255 | 261 | | |
256 | 262 | | |
257 | 263 | | |
| |||
317 | 323 | | |
318 | 324 | | |
319 | 325 | | |
| 326 | + | |
320 | 327 | | |
321 | 328 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| |||
0 commit comments