@stacksjs/types 0.70.308 → 0.70.311

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.
@@ -54,11 +54,28 @@ export declare interface SearchEngineOptions {
54
54
  }
55
55
  perPage?: number
56
56
  }
57
+ /**
58
+ * Options for creating an index.
59
+ *
60
+ * Meilisearch is schemaless and only ever needed `primaryKey`. Typesense and
61
+ * OpenSearch are not: a collection has to declare its fields, their types, and
62
+ * which ones can be faceted or sorted, and it cannot be extended afterwards.
63
+ *
64
+ * Without somewhere to put that, those drivers created a collection holding
65
+ * `id` and nothing else. Documents imported cleanly and then every query
66
+ * failed with "Could not find a field named ... in the schema".
67
+ *
68
+ * Both extra fields are optional and ignored by schemaless engines.
69
+ */
70
+ export declare interface CreateIndexOptions extends IndexOptions {
71
+ settings?: Settings
72
+ sampleDocument?: Record<string, unknown>
73
+ }
57
74
  export declare interface SearchEngineDriver {
58
75
  client: () => Meilisearch
59
76
  resetClient?: () => void
60
77
  search: (index: string, params: any) => Promise<SearchResponse<Record<string, any>>>
61
- createIndex: (name: string, options?: IndexOptions) => MaybePromise<EnqueuedTask>
78
+ createIndex: (name: string, options?: CreateIndexOptions) => MaybePromise<EnqueuedTask>
62
79
  getIndex: (name: string) => Promise<Index<Record<string, any>>>
63
80
  addDocument: (indexName: string, params: any) => Promise<EnqueuedTask>
64
81
  updateDocuments: (indexName: string, params: DocumentOptions[]) => Promise<EnqueuedTask>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/types",
3
3
  "type": "module",
4
- "version": "0.70.308",
4
+ "version": "0.70.311",
5
5
  "description": "The Stacks framework types.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -60,7 +60,7 @@
60
60
  "@stacksjs/clapp": "^0.2.12",
61
61
  "@stacksjs/stx": "^0.2.148",
62
62
  "@stacksjs/ts-validation": "^0.5.0",
63
- "bun-query-builder": "^0.2.24"
63
+ "bun-query-builder": "^0.2.25"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "meilisearch": "^0.59.0"
@@ -71,7 +71,7 @@
71
71
  }
72
72
  },
73
73
  "devDependencies": {
74
- "@stacksjs/validation": "0.70.308",
74
+ "@stacksjs/validation": "0.70.311",
75
75
  "better-dx": "^0.2.17",
76
76
  "meilisearch": "^0.59.0"
77
77
  },