-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsproxy.config.ts
More file actions
63 lines (56 loc) · 1.7 KB
/
Copy pathtsproxy.config.ts
File metadata and controls
63 lines (56 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { defineConfig } from "@tsproxy/api";
export default defineConfig({
typesense: {
host: "localhost",
port: 8108,
protocol: "http",
apiKey: "test-api-key",
},
server: {
port: 3000,
apiKey: "ingest-secret-key",
},
cache: {
ttl: 60,
maxSize: 1000,
},
queue: {
concurrency: 5,
maxSize: 10000,
},
rateLimit: {
search: 100,
ingest: 30,
},
collections: {
products: {
fields: {
name: { type: "string", searchable: true },
description: { type: "string", searchable: true, optional: true },
price: { type: "float", sortable: true },
category: { type: "string", facet: true },
color: { type: "string", facet: true },
brand: { type: "string", facet: true },
tags: { type: "string[]", facet: true, optional: true },
in_stock: { type: "bool", facet: true },
rating: { type: "float", sortable: true },
created_at: { type: "int64", sortable: true },
// Computed field: generates a category page slug from color + category
// Locale-aware: receives the locale so you can compute localized slugs
// e.g., "red-furniture" (en), "rouge-meubles" (fr), "rot-möbel" (de)
category_page_slug: {
type: "string",
facet: true,
compute: (doc, locale) => {
const color = String(doc.color || "").toLowerCase().trim();
const category = String(doc.category || "").toLowerCase().trim();
if (!color || !category) return "";
return `${color}-${category}`.replace(/\s+/g, "-");
},
},
},
locales: ["en", "fr", "de"],
defaultSortBy: "created_at",
},
},
});