@stainless-api/docs-search 0.1.0-beta.3 → 0.1.0-beta.31

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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { l as QueryKindsType, u as ResultData } from "./types-Gg968wOz.js";
1
+ import { QueryKindsType, ResultData } from "./types.js";
2
2
  import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/form.d.ts
package/dist/index.js CHANGED
@@ -1,14 +1,13 @@
1
- import "./indexer-DBU0POrK.js";
2
- import { t as QueryKinds } from "./types-BhJLoaNF.js";
3
- import "./algolia-BOY-OcxU.js";
4
- import { n as useSearch, r as useSearchContext } from "./context-CBTWkDal.js";
5
- import { t as guideSearch } from "./pagefind-Dcn-gjDe.js";
6
- import * as React from "react";
1
+ import { QueryKinds } from "./types.js";
2
+ import { useSearch, useSearchContext } from "./context.js";
3
+ import { guideSearch } from "./providers/pagefind.js";
4
+ import { createElement, useEffect, useRef, useState } from "react";
7
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
- import { BookOpenText, Box, Code, Folder, Search, Wrench, X } from "lucide-react";
6
+ import { BookOpenText, Box, Code, Folder, Search, Wrench } from "lucide-react";
9
7
  import { useLanguage } from "@stainless-api/docs-ui/contexts";
10
8
  import { useComponents } from "@stainless-api/docs-ui/contexts/use-components";
11
9
  import style from "@stainless-api/docs-ui/style";
10
+ import { Button } from "@stainless-api/ui-primitives";
12
11
 
13
12
  //#region src/results.tsx
14
13
  const QueryKindDisplay = {
@@ -223,35 +222,40 @@ function SearchForm() {
223
222
  const search = useSearch();
224
223
  const language = useLanguage();
225
224
  const { onSelect, pageFind } = useSearchContext();
226
- const [results, setResults] = React.useState(null);
227
- const [filterKind, setFilterKind] = React.useState("all");
228
- const [searchQuery, setSearchQuery] = React.useState("");
229
- const inputRef = React.useRef(null);
230
- async function performSearch() {
231
- const guideLimit = filterKind === "guide" ? 25 : 5;
232
- const kind = ["all", "guide"].includes(filterKind) ? void 0 : filterKind;
233
- const [guideResults, apiResults] = await Promise.all([pageFind ? guideSearch(pageFind, searchQuery, guideLimit) : [], search({
225
+ const [results, setResults] = useState(null);
226
+ const [filterKind, setFilterKind] = useState("all");
227
+ const [searchQuery, setSearchQuery] = useState("");
228
+ const inputRef = useRef(null);
229
+ useEffect(() => {
230
+ const guideLimit = 25;
231
+ const apiKindFilter = ["all", "guide"].includes(filterKind) ? void 0 : filterKind;
232
+ const ac = new AbortController();
233
+ Promise.all([pageFind ? guideSearch(pageFind, searchQuery, guideLimit) : [], search({
234
234
  query: searchQuery,
235
- kind,
235
+ kind: apiKindFilter,
236
236
  language
237
- })]);
238
- setResults({
239
- items: filterKind === "guide" ? guideResults : filterKind === "all" ? [...guideResults.slice(0, 5), ...apiResults?.hits ?? []] : apiResults?.hits ?? [],
240
- counts: {
241
- ...apiResults?.facets?.["kind"],
242
- guide: guideResults.length,
243
- all: apiResults?.nbHits
244
- }
245
- });
246
- }
247
- function clearInput() {
248
- setSearchQuery("");
249
- inputRef?.current?.focus();
250
- }
251
- React.useEffect(() => void performSearch(), [
237
+ })]).then(([guideResults, apiResults]) => {
238
+ if (ac.signal.aborted) return;
239
+ setResults({
240
+ items: filterKind === "guide" ? guideResults : filterKind === "all" ? [
241
+ ...guideResults.slice(0, 5),
242
+ ...apiResults?.hits ?? [],
243
+ ...guideResults.slice(5)
244
+ ] : apiResults?.hits ?? [],
245
+ counts: {
246
+ ...apiResults?.facets?.["kind"],
247
+ guide: guideResults.length,
248
+ all: (apiResults?.nbHits ?? 0) + guideResults.length
249
+ }
250
+ });
251
+ }).catch(() => {});
252
+ return () => ac.abort();
253
+ }, [
252
254
  searchQuery,
253
255
  filterKind,
254
- language
256
+ language,
257
+ search,
258
+ pageFind
255
259
  ]);
256
260
  return /* @__PURE__ */ jsxs("div", {
257
261
  className: style.SearchForm,
@@ -264,19 +268,13 @@ function SearchForm() {
264
268
  size: 16,
265
269
  className: style.Icon
266
270
  }),
267
- right: searchQuery && /* @__PURE__ */ jsx(X, {
268
- cursor: "pointer",
269
- onClick: () => clearInput(),
270
- size: 16,
271
- className: style.Icon
272
- }),
273
271
  value: searchQuery,
274
272
  placeholder: "Search"
275
273
  }),
276
274
  /* @__PURE__ */ jsx(SearchFilter, {
277
275
  results,
278
276
  filterKind,
279
- onChange: (filterKind$1) => setFilterKind(filterKind$1)
277
+ onChange: (filterKind) => setFilterKind(filterKind)
280
278
  }),
281
279
  /* @__PURE__ */ jsx(Docs.ListView, {
282
280
  items: results?.items ?? [],
@@ -287,16 +285,15 @@ function SearchForm() {
287
285
  });
288
286
  }
289
287
  function SearchFilter({ results, filterKind, onChange }) {
290
- const Docs = useComponents();
291
288
  const { pageFind } = useSearchContext();
292
- const toggles = pageFind ? QueryKinds : QueryKinds.slice(0, -1);
289
+ const toggles = pageFind ? QueryKinds : QueryKinds.filter((k) => k !== "guide");
293
290
  return /* @__PURE__ */ jsx("div", {
294
291
  className: style.SearchFilter,
295
- children: toggles.map((kind, index) => /* @__PURE__ */ jsxs(Docs.ToggleButton, {
296
- selected: filterKind === kind,
292
+ children: toggles.map((kind, index) => /* @__PURE__ */ jsxs(Button, {
293
+ variant: filterKind === kind ? "accent" : "outline",
297
294
  onClick: () => onChange?.(kind),
298
295
  children: [
299
- React.createElement(QueryKindDisplay[kind].icon, {
296
+ createElement(QueryKindDisplay[kind].icon, {
300
297
  size: 16,
301
298
  className: style.Icon
302
299
  }),
@@ -313,7 +310,14 @@ function SearchFilter({ results, filterKind, onChange }) {
313
310
  });
314
311
  }
315
312
  function SearchModal({ id, open: isOpen }) {
316
- const [open, setOpen] = React.useState(isOpen ?? false);
313
+ const [open, setOpen] = useState(isOpen ?? false);
314
+ useEffect(() => {
315
+ if (open) document.body.style.overflow = "hidden";
316
+ else document.body.style.overflow = "";
317
+ return () => {
318
+ document.body.style.overflow = "";
319
+ };
320
+ }, [open]);
317
321
  return /* @__PURE__ */ jsx("div", {
318
322
  id,
319
323
  onToggle: (ev) => setOpen(ev.newState === "open"),
@@ -0,0 +1,36 @@
1
+ import { i as Spec, r as Resource } from "./index-ax9-8vsm.js";
2
+ import { IndexEntry } from "./types.js";
3
+ import { DocsLanguage } from "@stainless-api/docs-ui/routing";
4
+
5
+ //#region src/indexer.d.ts
6
+ declare function getResourceNames(resourceIds: string[], topResources?: Record<string, Resource>): string[];
7
+ declare function generateChatIndex(spec: Spec): Generator<{
8
+ language: string;
9
+ title: string;
10
+ content: string;
11
+ url: string;
12
+ name?: undefined;
13
+ endpoint?: undefined;
14
+ httpMethod?: undefined;
15
+ summary?: undefined;
16
+ description?: undefined;
17
+ stainlessPath?: undefined;
18
+ qualified?: undefined;
19
+ ident?: undefined;
20
+ } | {
21
+ language: "cli" | "csharp" | "go" | "http" | "java" | "kotlin" | "node" | "php" | "python" | "ruby" | "terraform" | "typescript";
22
+ title: string;
23
+ name: string;
24
+ endpoint: string;
25
+ httpMethod: string;
26
+ summary: string | undefined;
27
+ description: string | undefined;
28
+ stainlessPath: string;
29
+ qualified: string | undefined;
30
+ ident: string | undefined;
31
+ content: string;
32
+ url: string | null;
33
+ }, void, unknown>;
34
+ declare function generateIndex(spec: Spec, renderMarkdownFn?: (_: string) => string | null, includeTypes?: boolean, languages?: DocsLanguage[]): Generator<IndexEntry>;
35
+ //#endregion
36
+ export { generateChatIndex, generateIndex, getResourceNames };
@@ -72,8 +72,9 @@ function* generateChatIndex(spec) {
72
72
  }
73
73
  }
74
74
  }
75
- function* generateIndex(spec, renderMarkdownFn, includeTypes) {
75
+ function* generateIndex(spec, renderMarkdownFn, includeTypes, languages) {
76
76
  const parentCrumbs = {};
77
+ const targetLangs = languages ?? Languages;
77
78
  for (const { data } of walkTree(spec, true)) {
78
79
  const { kind, name, title, stainlessPath } = data;
79
80
  const common = {
@@ -84,7 +85,7 @@ function* generateIndex(spec, renderMarkdownFn, includeTypes) {
84
85
  const crumbs = getResourceNames(parseStainlessPath(stainlessPath).resource, spec.resources);
85
86
  switch (kind) {
86
87
  case "resource":
87
- for (const language of Languages) {
88
+ for (const language of targetLangs) {
88
89
  if (!data[language]) continue;
89
90
  parentCrumbs[stainlessPath] = crumbs;
90
91
  const { Name, QualifiedName } = data[language];
@@ -101,7 +102,7 @@ function* generateIndex(spec, renderMarkdownFn, includeTypes) {
101
102
  break;
102
103
  case "http_method": {
103
104
  const { summary, endpoint, httpMethod } = data;
104
- for (const language of Languages) {
105
+ for (const language of targetLangs) {
105
106
  const found = spec.decls[language]?.[stainlessPath];
106
107
  if (!found) continue;
107
108
  parentCrumbs[stainlessPath] = [...crumbs, title];
@@ -123,7 +124,7 @@ function* generateIndex(spec, renderMarkdownFn, includeTypes) {
123
124
  }
124
125
  break;
125
126
  }
126
- case "model": for (const language of Languages) {
127
+ case "model": for (const language of targetLangs) {
127
128
  if (!spec.decls[language]) continue;
128
129
  parentCrumbs[stainlessPath] = [...crumbs, title];
129
130
  const schema = spec.decls[language]?.[`${stainlessPath} > (schema)`];
@@ -143,7 +144,7 @@ function* generateIndex(spec, renderMarkdownFn, includeTypes) {
143
144
  }
144
145
  }
145
146
  }
146
- for (const language of Languages) {
147
+ for (const language of targetLangs) {
147
148
  const decls = spec.decls?.[language];
148
149
  if (!decls) continue;
149
150
  for (const decl of Object.values(decls)) switch (decl.kind) {
@@ -178,4 +179,4 @@ function* generateIndex(spec, renderMarkdownFn, includeTypes) {
178
179
  }
179
180
 
180
181
  //#endregion
181
- export { generateIndex as n, generateChatIndex as t };
182
+ export { generateChatIndex, generateIndex, getResourceNames };
package/dist/mcp.d.ts CHANGED
@@ -1,13 +1,10 @@
1
- import { n as IndexEntry, r as IndexMethod } from "./types-Gg968wOz.js";
1
+ import { i as Spec } from "./index-ax9-8vsm.js";
2
+ import { IndexEntry, IndexMethod } from "./types.js";
3
+ import { generateIndex } from "./indexer.js";
2
4
  import { DocsLanguage } from "@stainless-api/docs-ui/routing";
3
- import * as SDKJSON from "@stainless/sdk-json";
4
5
 
5
- //#region src/indexer.d.ts
6
-
7
- declare function generateIndex(spec: SDKJSON.Spec, renderMarkdownFn?: (_: string) => string | null, includeTypes?: boolean): Generator<IndexEntry>;
8
- //#endregion
9
6
  //#region src/mcp.d.ts
10
7
  type Item = IndexEntry & IndexMethod;
11
- declare function render(spec: SDKJSON.Spec, language: DocsLanguage, items: Item[], includeModelProperties: boolean): any;
8
+ declare function render(spec: Spec, language: DocsLanguage, items: Item[], includeModelProperties: boolean): any;
12
9
  //#endregion
13
10
  export { generateIndex, render };
package/dist/mcp.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as generateIndex } from "./indexer-DBU0POrK.js";
1
+ import { generateIndex } from "./indexer.js";
2
2
  import { parseStainlessPath } from "@stainless-api/docs-ui/routing";
3
3
  import { renderMarkdown } from "@stainless-api/docs-ui/markdown";
4
4
  import { getResourceFromSpec } from "@stainless-api/docs-ui/utils";
@@ -1,9 +1,9 @@
1
- import { f as ResultType, g as SearchSettings, h as SearchParams, s as ProseIndexEntry } from "../types-Gg968wOz.js";
2
- import * as SDKJSON from "@stainless/sdk-json";
1
+ import { i as Spec } from "../index-ax9-8vsm.js";
2
+ import { IndexEntry, ProseIndexEntry, ResultType, SearchParams, SearchSettings } from "../types.js";
3
3
 
4
4
  //#region src/providers/algolia.d.ts
5
- declare function buildIndex(appId: string, indexName: string, writeKey: string, spec: SDKJSON.Spec, renderMarkdown: (_: string) => string | null): Promise<void>;
6
- declare function buildChatIndex(appId: string, indexName: string, writeKey: string, spec: SDKJSON.Spec): Promise<void>;
5
+ declare function buildIndex(appId: string, indexName: string, writeKey: string, content: Spec | IndexEntry[], renderMarkdown: (_: string) => string | null): Promise<void>;
6
+ declare function buildChatIndex(appId: string, indexName: string, writeKey: string, spec: Spec): Promise<void>;
7
7
  declare function buildProseIndex(appId: string, indexName: string, writeKey: string, objects: ProseIndexEntry[]): Promise<void>;
8
8
  declare function search({
9
9
  settings: {
@@ -1,4 +1,83 @@
1
- import "../indexer-DBU0POrK.js";
2
- import { i as search, n as buildIndex, r as buildProseIndex, t as buildChatIndex } from "../algolia-BOY-OcxU.js";
1
+ import { generateChatIndex, generateIndex } from "../indexer.js";
2
+ import { SearchableAttributes, SearchableAttributesChat, SearchableAttributesProse } from "../types.js";
3
+ import { searchClient } from "@algolia/client-search";
3
4
 
5
+ //#region src/providers/algolia.ts
6
+ async function buildIndex(appId, indexName, writeKey, content, renderMarkdown) {
7
+ if (!appId || !indexName || !writeKey) return;
8
+ const objects = Array.isArray(content) ? content : Array.from(generateIndex(content, renderMarkdown));
9
+ const client = searchClient(appId, writeKey);
10
+ await client.setSettings({
11
+ indexName,
12
+ indexSettings: {
13
+ highlightPreTag: "<mark>",
14
+ highlightPostTag: "</mark>",
15
+ customRanking: ["asc(priority)"],
16
+ attributesForFaceting: ["language", "kind"],
17
+ searchableAttributes: [...SearchableAttributes]
18
+ }
19
+ });
20
+ await client.replaceAllObjects({
21
+ indexName,
22
+ objects
23
+ });
24
+ }
25
+ async function buildChatIndex(appId, indexName, writeKey, spec) {
26
+ if (!appId || !indexName || !writeKey) return;
27
+ const objects = Array.from(generateChatIndex(spec));
28
+ const client = searchClient(appId, writeKey);
29
+ await client.setSettings({
30
+ indexName,
31
+ indexSettings: {
32
+ attributesForFaceting: ["language"],
33
+ attributeForDistinct: "stainlessPath",
34
+ searchableAttributes: SearchableAttributesChat
35
+ }
36
+ });
37
+ await client.replaceAllObjects({
38
+ indexName,
39
+ objects
40
+ });
41
+ }
42
+ async function buildProseIndex(appId, indexName, writeKey, objects) {
43
+ if (!appId || !indexName || !writeKey) return;
44
+ const client = searchClient(appId, writeKey);
45
+ await client.setSettings({
46
+ indexName,
47
+ indexSettings: { searchableAttributes: SearchableAttributesProse }
48
+ });
49
+ await client.replaceAllObjects({
50
+ indexName,
51
+ objects
52
+ });
53
+ }
54
+ async function search({ settings: { appId, indexName, searchKey }, params: { query, language, kind } }) {
55
+ const client = searchClient(appId, searchKey);
56
+ const filters = language ? `language:${language}` : void 0;
57
+ const facetFilters = kind ? [`kind:${kind}`] : void 0;
58
+ const { results } = await client.search({ requests: [{
59
+ query,
60
+ indexName,
61
+ filters,
62
+ hitsPerPage: 5,
63
+ facets: ["kind"]
64
+ }, {
65
+ query,
66
+ indexName,
67
+ filters,
68
+ facetFilters,
69
+ facets: ["kind"],
70
+ hitsPerPage: 50
71
+ }] });
72
+ if ("hits" in results[0] && "hits" in results[1]) {
73
+ const [{ nbHits, facets }, { hits }] = results;
74
+ return {
75
+ hits,
76
+ nbHits: nbHits ?? 0,
77
+ facets
78
+ };
79
+ }
80
+ }
81
+
82
+ //#endregion
4
83
  export { buildChatIndex, buildIndex, buildProseIndex, search };
@@ -1,15 +1,15 @@
1
- import { n as IndexEntry } from "../types-Gg968wOz.js";
1
+ import { i as Spec } from "../index-ax9-8vsm.js";
2
+ import { IndexEntry } from "../types.js";
2
3
  import { DocsLanguage } from "@stainless-api/docs-ui/routing";
3
4
  import * as fuse_js0 from "fuse.js";
4
5
  import { FuseIndex } from "fuse.js";
5
- import * as SDKJSON from "@stainless/sdk-json";
6
6
 
7
7
  //#region src/providers/fuse.d.ts
8
8
  type FuseIndexData = {
9
9
  content: IndexEntry[];
10
10
  index: FuseIndex<IndexEntry>;
11
11
  };
12
- declare function buildIndex(spec: SDKJSON.Spec, language?: DocsLanguage): FuseIndexData;
12
+ declare function buildIndex(spec: Spec, language?: DocsLanguage): FuseIndexData;
13
13
  declare function search({
14
14
  content,
15
15
  index
@@ -1,5 +1,5 @@
1
- import { n as generateIndex } from "../indexer-DBU0POrK.js";
2
- import { n as SearchableAttributes } from "../types-BhJLoaNF.js";
1
+ import { generateIndex } from "../indexer.js";
2
+ import { SearchableAttributes } from "../types.js";
3
3
  import Fuse from "fuse.js";
4
4
 
5
5
  //#region src/providers/fuse.ts
@@ -1,4 +1,4 @@
1
- import { t as GuideResultType } from "../types-Gg968wOz.js";
1
+ import { GuideResultType } from "../types.js";
2
2
 
3
3
  //#region src/providers/pagefind.d.ts
4
4
  declare function guideSearch(loadPath: string, query: string, limit?: number): Promise<GuideResultType[]>;
@@ -1,3 +1,15 @@
1
- import { t as guideSearch } from "../pagefind-Dcn-gjDe.js";
1
+ //#region src/providers/pagefind.ts
2
+ async function loadPagefind(path) {
3
+ return await import(new URL(path, import.meta.url).href);
4
+ }
5
+ async function guideSearch(loadPath, query, limit) {
6
+ const response = await (await loadPagefind(loadPath)).search(query);
7
+ const items = limit ? response.results.slice(0, limit) : response.results;
8
+ return Promise.all(items.map((result) => result.data().then((data) => ({
9
+ ...result,
10
+ data
11
+ }))));
12
+ }
2
13
 
14
+ //#endregion
3
15
  export { guideSearch };
@@ -1,9 +1,9 @@
1
- import { n as IndexEntry } from "../types-Gg968wOz.js";
1
+ import { i as Spec } from "../index-ax9-8vsm.js";
2
+ import { IndexEntry } from "../types.js";
2
3
  import { DocsLanguage } from "@stainless-api/docs-ui/routing";
3
- import * as SDKJSON from "@stainless/sdk-json";
4
4
 
5
5
  //#region src/providers/walker.d.ts
6
- declare function buildIndex(spec: SDKJSON.Spec): Generator<IndexEntry, any, any>;
6
+ declare function buildIndex(spec: Spec): Generator<IndexEntry, any, any>;
7
7
  declare function search(index: Generator<IndexEntry>, language: DocsLanguage, query: string, limit?: number): IndexEntry[];
8
8
  //#endregion
9
9
  export { buildIndex, search };
@@ -1,5 +1,5 @@
1
- import { n as generateIndex } from "../indexer-DBU0POrK.js";
2
- import { n as SearchableAttributes } from "../types-BhJLoaNF.js";
1
+ import { generateIndex } from "../indexer.js";
2
+ import { SearchableAttributes } from "../types.js";
3
3
 
4
4
  //#region src/providers/walker.ts
5
5
  function buildIndex(spec) {
package/dist/types.d.ts CHANGED
@@ -1,2 +1,91 @@
1
- import { _ as SearchableAttributes, a as IndexProperty, c as QueryKinds, d as ResultRecordType, f as ResultType, g as SearchSettings, h as SearchParams, i as IndexModel, l as QueryKindsType, m as SearchAttributeNames, n as IndexEntry, o as IndexResource, p as RoutableJsonNode, r as IndexMethod, s as ProseIndexEntry, t as GuideResultType, u as ResultData, v as SearchableAttributesChat, y as SearchableAttributesProse } from "./types-Gg968wOz.js";
1
+ import { n as Model, r as Resource, t as Method } from "./index-ax9-8vsm.js";
2
+ import { DocsLanguage } from "@stainless-api/docs-ui/routing";
3
+
4
+ //#region src/types.d.ts
5
+ type SearchSettings = {
6
+ appId: string;
7
+ searchKey: string;
8
+ indexName: string;
9
+ assistant?: string;
10
+ };
11
+ type SearchParams = {
12
+ query: string;
13
+ language?: DocsLanguage | null;
14
+ kind?: QueryKindsType | null;
15
+ };
16
+ declare const QueryKinds: readonly ["all", "guide", "resource", "http_method", "model", "property"];
17
+ type QueryKindsType = (typeof QueryKinds)[number];
18
+ type IndexModel = {
19
+ kind: 'model';
20
+ title: string;
21
+ children?: string[];
22
+ ident?: string;
23
+ };
24
+ type IndexProperty = {
25
+ kind: 'property';
26
+ docstring?: string;
27
+ type?: string;
28
+ };
29
+ type IndexResource = {
30
+ kind: 'resource';
31
+ title: string;
32
+ Name: string;
33
+ QualifiedName: string;
34
+ };
35
+ type IndexMethod = Pick<Method, 'kind' | 'summary' | 'description' | 'endpoint' | 'httpMethod'> & {
36
+ title: string;
37
+ qualified?: string;
38
+ ident?: string;
39
+ };
40
+ declare const SearchableAttributes: readonly ["name", "title", "ident", "Name", "qualified", "QualifiedName", "endpoint", "summary", "description", "docstring"];
41
+ declare const SearchableAttributesChat: string[];
42
+ declare const SearchableAttributesProse: string[];
43
+ type SearchAttributeNames = (typeof SearchableAttributes)[number];
44
+ type RoutableJsonNode = Method | Model | Resource;
45
+ type IndexEntry = Pick<RoutableJsonNode, 'name' | 'stainlessPath'> & (IndexProperty | IndexModel | IndexResource | IndexMethod) & {
46
+ language: DocsLanguage;
47
+ priority: number;
48
+ crumbs: string[];
49
+ };
50
+ type ResultRecordType = IndexEntry & {
51
+ objectID: string;
52
+ _highlightResult: Record<SearchAttributeNames, {
53
+ value: string;
54
+ }>;
55
+ };
56
+ type ResultType = {
57
+ hits: ResultRecordType[];
58
+ facets?: Record<string, Record<string, number>>;
59
+ nbHits: number;
60
+ };
61
+ type GuideResultType = {
62
+ id: string;
63
+ score: number;
64
+ words: number[];
65
+ data: {
66
+ excerpt: string;
67
+ url: string;
68
+ word_count: number;
69
+ meta: {
70
+ title: string;
71
+ };
72
+ sub_results: {
73
+ url: string;
74
+ title: string;
75
+ excerpt: string;
76
+ }[];
77
+ };
78
+ };
79
+ type ResultData = {
80
+ items: Array<ResultRecordType | GuideResultType>;
81
+ counts: Partial<Record<QueryKindsType, number>>;
82
+ };
83
+ type ProseIndexEntry = {
84
+ id?: string;
85
+ tag: string;
86
+ content: string;
87
+ source?: string;
88
+ [additional: string]: unknown;
89
+ };
90
+ //#endregion
2
91
  export { GuideResultType, IndexEntry, IndexMethod, IndexModel, IndexProperty, IndexResource, ProseIndexEntry, QueryKinds, QueryKindsType, ResultData, ResultRecordType, ResultType, RoutableJsonNode, SearchAttributeNames, SearchParams, SearchSettings, SearchableAttributes, SearchableAttributesChat, SearchableAttributesProse };
package/dist/types.js CHANGED
@@ -1,3 +1,35 @@
1
- import { i as SearchableAttributesProse, n as SearchableAttributes, r as SearchableAttributesChat, t as QueryKinds } from "./types-BhJLoaNF.js";
1
+ //#region src/types.ts
2
+ const QueryKinds = [
3
+ "all",
4
+ "guide",
5
+ "resource",
6
+ "http_method",
7
+ "model",
8
+ "property"
9
+ ];
10
+ const SearchableAttributes = [
11
+ "name",
12
+ "title",
13
+ "ident",
14
+ "Name",
15
+ "qualified",
16
+ "QualifiedName",
17
+ "endpoint",
18
+ "summary",
19
+ "description",
20
+ "docstring"
21
+ ];
22
+ const SearchableAttributesChat = [
23
+ "title",
24
+ "name",
25
+ "endpoint",
26
+ "summary",
27
+ "description",
28
+ "qualified",
29
+ "ident",
30
+ "content"
31
+ ];
32
+ const SearchableAttributesProse = ["content"];
2
33
 
34
+ //#endregion
3
35
  export { QueryKinds, SearchableAttributes, SearchableAttributesChat, SearchableAttributesProse };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stainless-api/docs-search",
3
- "version": "0.1.0-beta.3",
3
+ "version": "0.1.0-beta.31",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -13,30 +13,34 @@
13
13
  "react-dom": ">=19.0.0"
14
14
  },
15
15
  "dependencies": {
16
- "@algolia/client-search": "^5.25.0",
16
+ "@algolia/client-search": "^5.49.0",
17
17
  "@markdoc/markdoc": "^0.5.4",
18
- "cheerio": "^1.1.2",
18
+ "cheerio": "^1.2.0",
19
19
  "fuse.js": "^7.1.0",
20
- "htmlparser2": "^10.0.0",
21
- "lucide-react": "^0.561.0",
22
- "@stainless-api/docs-ui": "0.1.0-beta.51"
20
+ "htmlparser2": "^10.1.0",
21
+ "lucide-react": "^0.574.0",
22
+ "@stainless-api/docs-ui": "0.1.0-beta.78",
23
+ "@stainless-api/ui-primitives": "0.1.0-beta.48"
23
24
  },
24
25
  "devDependencies": {
25
- "@types/node": "24.10.3",
26
- "@types/react": "19.2.7",
26
+ "@types/node": "24.10.13",
27
+ "@types/react": "19.2.14",
27
28
  "@types/react-dom": "^19.2.3",
28
- "dotenv": "17.2.3",
29
- "react": "^19.2.3",
30
- "react-dom": "^19.2.3",
31
- "tsdown": "^0.18.0",
29
+ "dotenv": "17.3.1",
30
+ "react": "^19.2.4",
31
+ "react-dom": "^19.2.4",
32
+ "tsdown": "^0.20.3",
32
33
  "typescript": "5.9.3",
33
- "@stainless/eslint-config": "0.1.0-beta.0",
34
- "@stainless/sdk-json": "^0.1.0-beta.2"
34
+ "@stainless/eslint-config": "0.1.0-beta.1",
35
+ "@stainless/sdk-json": "^0.1.0-beta.7"
35
36
  },
36
37
  "exports": {
37
38
  ".": {
38
39
  "default": "./dist/index.js"
39
40
  },
41
+ "./indexer": {
42
+ "default": "./dist/indexer.js"
43
+ },
40
44
  "./context": {
41
45
  "default": "./dist/context.js"
42
46
  },