@magicpages/ghost-typesense-core 1.3.2 → 1.3.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/dist/index.js CHANGED
@@ -174,7 +174,19 @@ var GhostTypesenseManager = class {
174
174
  */
175
175
  async clearCollection() {
176
176
  const collection = this.typesense.collections(this.collectionName);
177
- await collection.documents().delete({ filter_by: "*" });
177
+ await collection.delete();
178
+ const schema = {
179
+ name: this.collectionName,
180
+ fields: this.config.collection.fields.map((field) => ({
181
+ name: field.name,
182
+ type: field.type,
183
+ facet: field.facet,
184
+ index: field.index,
185
+ optional: field.optional,
186
+ sort: field.sort
187
+ }))
188
+ };
189
+ await this.typesense.collections().create(schema);
178
190
  }
179
191
  };
180
192
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -150,7 +150,19 @@ var GhostTypesenseManager = class {
150
150
  */
151
151
  async clearCollection() {
152
152
  const collection = this.typesense.collections(this.collectionName);
153
- await collection.documents().delete({ filter_by: "*" });
153
+ await collection.delete();
154
+ const schema = {
155
+ name: this.collectionName,
156
+ fields: this.config.collection.fields.map((field) => ({
157
+ name: field.name,
158
+ type: field.type,
159
+ facet: field.facet,
160
+ index: field.index,
161
+ optional: field.optional,
162
+ sort: field.sort
163
+ }))
164
+ };
165
+ await this.typesense.collections().create(schema);
154
166
  }
155
167
  };
156
168
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magicpages/ghost-typesense-core",
3
- "version": "1.3.2",
3
+ "version": "1.3.5",
4
4
  "description": "Core functionality for Ghost-Typesense integration",
5
5
  "author": "MagicPages",
6
6
  "license": "MIT",