@magicpages/ghost-typesense-config 1.5.0 → 1.6.0

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
@@ -40,11 +40,42 @@ const config: Config = {
40
40
  apiKey: 'your-typesense-api-key'
41
41
  },
42
42
  collection: {
43
- name: 'ghost'
43
+ name: 'ghost',
44
+ // Optional: customize fields
45
+ fields: [
46
+ { name: 'title', type: 'string', index: true, sort: true },
47
+ { name: 'plaintext', type: 'string', index: true },
48
+ { name: 'custom_field', type: 'string', optional: true },
49
+ // Nested fields are supported with dot notation
50
+ { name: 'tags.name', type: 'string', facet: true, optional: true },
51
+ { name: 'authors.name', type: 'string', facet: true, optional: true }
52
+ ]
44
53
  }
45
54
  };
46
55
  ```
47
56
 
57
+ ## Default Fields
58
+
59
+ The package includes default fields optimized for Ghost content, including:
60
+
61
+ ```typescript
62
+ // Required fields
63
+ { name: 'id', type: 'string' }
64
+ { name: 'title', type: 'string' }
65
+ { name: 'url', type: 'string' }
66
+ { name: 'slug', type: 'string' }
67
+ { name: 'html', type: 'string' }
68
+ { name: 'plaintext', type: 'string' }
69
+ { name: 'excerpt', type: 'string' }
70
+ { name: 'published_at', type: 'int64' }
71
+ { name: 'updated_at', type: 'int64' }
72
+
73
+ // Optional fields
74
+ { name: 'feature_image', type: 'string', optional: true }
75
+ { name: 'tags', type: 'string[]', optional: true }
76
+ { name: 'authors', type: 'string[]', optional: true }
77
+ ```
78
+
48
79
  ## Types
49
80
 
50
81
  ```typescript
@@ -64,10 +95,41 @@ interface Config {
64
95
  };
65
96
  collection: {
66
97
  name: string;
98
+ fields?: CollectionField[];
67
99
  };
68
100
  }
101
+
102
+ interface CollectionField {
103
+ name: string; // Can use dot notation for nested fields (e.g., 'tags.name')
104
+ type: string; // 'string', 'int32', 'int64', 'float', 'bool', or string arrays (e.g., 'string[]')
105
+ index?: boolean; // Whether to index this field for searching
106
+ sort?: boolean; // Whether this field can be used for sorting
107
+ facet?: boolean; // Whether this field can be used for faceting
108
+ optional?: boolean; // Whether this field is optional in documents
109
+ }
69
110
  ```
70
111
 
112
+ ## Nested Fields
113
+
114
+ The package supports nested fields using dot notation in the field name. This is particularly useful for accessing properties of complex objects like tags and authors:
115
+
116
+ ```typescript
117
+ // Example with nested fields
118
+ const config = {
119
+ collection: {
120
+ name: 'ghost',
121
+ fields: [
122
+ // Access nested properties
123
+ { name: 'tags.name', type: 'string', facet: true, optional: true },
124
+ { name: 'authors.bio', type: 'string', index: true, optional: true },
125
+ { name: 'authors.name', type: 'string', facet: true, optional: true }
126
+ ]
127
+ }
128
+ };
129
+ ```
130
+
131
+ When Typesense is configured with `enable_nested_fields: true`, you can efficiently search and facet on these nested properties.
132
+
71
133
  ## License
72
134
 
73
135
  MIT © [MagicPages](https://www.magicpages.co)
package/dist/index.d.mts CHANGED
@@ -142,6 +142,10 @@ declare const REQUIRED_FIELDS: {
142
142
  readonly type: "string";
143
143
  readonly description: "Post content in HTML format";
144
144
  };
145
+ readonly plaintext: {
146
+ readonly type: "string";
147
+ readonly description: "Post content in plain text format";
148
+ };
145
149
  readonly excerpt: {
146
150
  readonly type: "string";
147
151
  readonly description: "Post excerpt or summary";
package/dist/index.d.ts CHANGED
@@ -142,6 +142,10 @@ declare const REQUIRED_FIELDS: {
142
142
  readonly type: "string";
143
143
  readonly description: "Post content in HTML format";
144
144
  };
145
+ readonly plaintext: {
146
+ readonly type: "string";
147
+ readonly description: "Post content in plain text format";
148
+ };
145
149
  readonly excerpt: {
146
150
  readonly type: "string";
147
151
  readonly description: "Post excerpt or summary";
package/dist/index.js CHANGED
@@ -71,6 +71,7 @@ var REQUIRED_FIELDS = {
71
71
  url: { type: "string", description: "Full URL to the post" },
72
72
  slug: { type: "string", description: "URL-friendly post slug" },
73
73
  html: { type: "string", description: "Post content in HTML format" },
74
+ plaintext: { type: "string", description: "Post content in plain text format" },
74
75
  excerpt: { type: "string", description: "Post excerpt or summary" },
75
76
  published_at: { type: "int64", description: "Post publication timestamp" },
76
77
  updated_at: { type: "int64", description: "Post last update timestamp" }
@@ -81,6 +82,7 @@ var DEFAULT_COLLECTION_FIELDS = [
81
82
  { name: "url", type: "string", index: true, optional: false },
82
83
  { name: "slug", type: "string", index: true, optional: false },
83
84
  { name: "html", type: "string", index: true, optional: false },
85
+ { name: "plaintext", type: "string", index: true, optional: false },
84
86
  { name: "excerpt", type: "string", index: true, optional: false },
85
87
  { name: "feature_image", type: "string", index: false, optional: true },
86
88
  { name: "published_at", type: "int64", sort: true, optional: false },
package/dist/index.mjs CHANGED
@@ -38,6 +38,7 @@ var REQUIRED_FIELDS = {
38
38
  url: { type: "string", description: "Full URL to the post" },
39
39
  slug: { type: "string", description: "URL-friendly post slug" },
40
40
  html: { type: "string", description: "Post content in HTML format" },
41
+ plaintext: { type: "string", description: "Post content in plain text format" },
41
42
  excerpt: { type: "string", description: "Post excerpt or summary" },
42
43
  published_at: { type: "int64", description: "Post publication timestamp" },
43
44
  updated_at: { type: "int64", description: "Post last update timestamp" }
@@ -48,6 +49,7 @@ var DEFAULT_COLLECTION_FIELDS = [
48
49
  { name: "url", type: "string", index: true, optional: false },
49
50
  { name: "slug", type: "string", index: true, optional: false },
50
51
  { name: "html", type: "string", index: true, optional: false },
52
+ { name: "plaintext", type: "string", index: true, optional: false },
51
53
  { name: "excerpt", type: "string", index: true, optional: false },
52
54
  { name: "feature_image", type: "string", index: false, optional: true },
53
55
  { name: "published_at", type: "int64", sort: true, optional: false },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magicpages/ghost-typesense-config",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Configuration types and utilities for Ghost-Typesense integration",
5
5
  "author": "MagicPages",
6
6
  "license": "MIT",