sanity-plugin-taxonomy-manager 4.5.0 → 4.7.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/lib/index.d.ts CHANGED
@@ -17,7 +17,11 @@ import type {useClient} from 'sanity'
17
17
  * plugin `schemeFilter` or `branchFilter` options.
18
18
  *
19
19
  */
20
- export declare function ArrayHierarchyInput(props: ArrayFieldProps): JSX.Element
20
+ export declare function ArrayHierarchyInput(props: ArrayHierarchyInputProps): JSX.Element
21
+
22
+ declare type ArrayHierarchyInputProps = ArrayFieldProps & {
23
+ embeddingsIndex?: EmbeddingsIndexConfig
24
+ }
21
25
 
22
26
  /**
23
27
  * #### Reference Field Scheme & Branch Filter
@@ -103,10 +107,34 @@ declare interface ConceptSchemeDocument extends SanityDocument {
103
107
  }
104
108
  }
105
109
 
110
+ declare interface EmbeddingsIndexConfig {
111
+ indexName: string
112
+ fieldReferences: string[]
113
+ maxResults?: number
114
+ }
115
+
116
+ declare interface EmbeddingsResult {
117
+ score: number
118
+ value: {
119
+ documentId: string
120
+ type: string
121
+ }
122
+ }
123
+
124
+ declare type HierarchyInput = ObjectFieldProps<Reference> & {
125
+ embeddingsIndex?: EmbeddingsIndexConfig
126
+ }
127
+
106
128
  declare interface Options {
107
129
  baseUri?: string
108
130
  customConceptFields?: FieldDefinition[]
109
131
  customSchemeFields?: FieldDefinition[]
132
+ ident?: {
133
+ pattern?: string
134
+ length?: number
135
+ prefix?: string
136
+ regenUi?: boolean
137
+ }
110
138
  }
111
139
 
112
140
  /**
@@ -118,7 +146,7 @@ declare interface Options {
118
146
  * Hierarchy view must be used in conjunction with the Taxonomy Manager
119
147
  * plugin `schemeFilter` or `branchFilter` options.
120
148
  */
121
- export declare function ReferenceHierarchyInput(props: ObjectFieldProps<Reference>): JSX.Element
149
+ export declare function ReferenceHierarchyInput(props: HierarchyInput): JSX.Element
122
150
 
123
151
  /**
124
152
  * #### Reference Field Scheme Filter
@@ -181,12 +209,17 @@ declare type SchemeOptions = {
181
209
  }
182
210
 
183
211
  /**
184
- * #### Defines a Sanity plugin for managing taxonomies
185
- * BaseURI should follow an IANA http/s scheme and should terminate with either a / or #.
186
- * @param options - Optional configuration options for the plugin.
187
- * @param options.baseUri - The base URI to use for SKOS concepts and concept schemes.
188
- * @param options.customConceptFields - An array of additional fields to add to the skosConcept type.
189
- * @param options.customSchemeFields - An array of additional fields to add to the skosConceptScheme type.
212
+ * #### Sanity Taxonomy Manager
213
+ * Defines a Sanity plugin for managing SKOS compliant taxonomies in Sanity Studio.
214
+ * #### Options
215
+ * @param baseUri - The base URI to use for SKOS concepts and concept schemes. BaseURI should follow an IANA http/s scheme and should terminate with either a / or #.
216
+ * @param customConceptFields - An array of additional fields to add to the skosConcept type.
217
+ * @param customSchemeFields - An array of additional fields to add to the skosConceptScheme type.
218
+ * #### Identifier Configuration
219
+ * @param ident.pattern - The character set to use for identifiers (default: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz').
220
+ * @param ident.length - The length of the generated identifier (default: 6).
221
+ * @param ident.prefix - A prefix to prepend to generated identifiers, for example to use Wikidata style IDs like "Q27521" (default: '').
222
+ * @param ident.regenUi - Whether to display the "Create Unique Identifier" button in the UI by default.
190
223
  * @returns A Sanity plugin object.
191
224
  */
192
225
  export declare const taxonomyManager: Plugin_2<Options | undefined>
@@ -207,14 +240,18 @@ export declare const TreeView: ({
207
240
  inputComponent,
208
241
  selectConcept,
209
242
  expanded,
243
+ conceptRecs,
244
+ recsError,
210
245
  }: TreeViewProps) => JSX.Element
211
246
 
212
247
  declare interface TreeViewProps {
213
248
  document?: ConceptSchemeDocument
214
- branchId: string
249
+ branchId?: string | null
215
250
  selectConcept?: (conceptId: {_ref: string; _type: 'reference'; _originalId?: string}) => void
216
251
  inputComponent?: boolean
217
252
  expanded?: boolean
253
+ conceptRecs?: EmbeddingsResult[]
254
+ recsError?: string | null
218
255
  }
219
256
 
220
257
  export {}
@@ -17,7 +17,11 @@ import type {useClient} from 'sanity'
17
17
  * plugin `schemeFilter` or `branchFilter` options.
18
18
  *
19
19
  */
20
- export declare function ArrayHierarchyInput(props: ArrayFieldProps): JSX.Element
20
+ export declare function ArrayHierarchyInput(props: ArrayHierarchyInputProps): JSX.Element
21
+
22
+ declare type ArrayHierarchyInputProps = ArrayFieldProps & {
23
+ embeddingsIndex?: EmbeddingsIndexConfig
24
+ }
21
25
 
22
26
  /**
23
27
  * #### Reference Field Scheme & Branch Filter
@@ -103,10 +107,34 @@ declare interface ConceptSchemeDocument extends SanityDocument {
103
107
  }
104
108
  }
105
109
 
110
+ declare interface EmbeddingsIndexConfig {
111
+ indexName: string
112
+ fieldReferences: string[]
113
+ maxResults?: number
114
+ }
115
+
116
+ declare interface EmbeddingsResult {
117
+ score: number
118
+ value: {
119
+ documentId: string
120
+ type: string
121
+ }
122
+ }
123
+
124
+ declare type HierarchyInput = ObjectFieldProps<Reference> & {
125
+ embeddingsIndex?: EmbeddingsIndexConfig
126
+ }
127
+
106
128
  declare interface Options {
107
129
  baseUri?: string
108
130
  customConceptFields?: FieldDefinition[]
109
131
  customSchemeFields?: FieldDefinition[]
132
+ ident?: {
133
+ pattern?: string
134
+ length?: number
135
+ prefix?: string
136
+ regenUi?: boolean
137
+ }
110
138
  }
111
139
 
112
140
  /**
@@ -118,7 +146,7 @@ declare interface Options {
118
146
  * Hierarchy view must be used in conjunction with the Taxonomy Manager
119
147
  * plugin `schemeFilter` or `branchFilter` options.
120
148
  */
121
- export declare function ReferenceHierarchyInput(props: ObjectFieldProps<Reference>): JSX.Element
149
+ export declare function ReferenceHierarchyInput(props: HierarchyInput): JSX.Element
122
150
 
123
151
  /**
124
152
  * #### Reference Field Scheme Filter
@@ -181,12 +209,17 @@ declare type SchemeOptions = {
181
209
  }
182
210
 
183
211
  /**
184
- * #### Defines a Sanity plugin for managing taxonomies
185
- * BaseURI should follow an IANA http/s scheme and should terminate with either a / or #.
186
- * @param options - Optional configuration options for the plugin.
187
- * @param options.baseUri - The base URI to use for SKOS concepts and concept schemes.
188
- * @param options.customConceptFields - An array of additional fields to add to the skosConcept type.
189
- * @param options.customSchemeFields - An array of additional fields to add to the skosConceptScheme type.
212
+ * #### Sanity Taxonomy Manager
213
+ * Defines a Sanity plugin for managing SKOS compliant taxonomies in Sanity Studio.
214
+ * #### Options
215
+ * @param baseUri - The base URI to use for SKOS concepts and concept schemes. BaseURI should follow an IANA http/s scheme and should terminate with either a / or #.
216
+ * @param customConceptFields - An array of additional fields to add to the skosConcept type.
217
+ * @param customSchemeFields - An array of additional fields to add to the skosConceptScheme type.
218
+ * #### Identifier Configuration
219
+ * @param ident.pattern - The character set to use for identifiers (default: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz').
220
+ * @param ident.length - The length of the generated identifier (default: 6).
221
+ * @param ident.prefix - A prefix to prepend to generated identifiers, for example to use Wikidata style IDs like "Q27521" (default: '').
222
+ * @param ident.regenUi - Whether to display the "Create Unique Identifier" button in the UI by default.
190
223
  * @returns A Sanity plugin object.
191
224
  */
192
225
  export declare const taxonomyManager: Plugin_2<Options | undefined>
@@ -207,14 +240,18 @@ export declare const TreeView: ({
207
240
  inputComponent,
208
241
  selectConcept,
209
242
  expanded,
243
+ conceptRecs,
244
+ recsError,
210
245
  }: TreeViewProps) => JSX.Element
211
246
 
212
247
  declare interface TreeViewProps {
213
248
  document?: ConceptSchemeDocument
214
- branchId: string
249
+ branchId?: string | null
215
250
  selectConcept?: (conceptId: {_ref: string; _type: 'reference'; _originalId?: string}) => void
216
251
  inputComponent?: boolean
217
252
  expanded?: boolean
253
+ conceptRecs?: EmbeddingsResult[]
254
+ recsError?: string | null
218
255
  }
219
256
 
220
257
  export {}