@stainless-api/docs-search 0.1.0-beta.38 → 0.1.0-beta.39
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/context.d.ts +1 -1
- package/dist/context.js +1 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -4
- package/dist/indexer.d.ts +1 -2
- package/dist/indexer.js +1 -3
- package/dist/mcp.d.ts +1 -2
- package/dist/mcp.js +1 -3
- package/dist/providers/algolia.d.ts +1 -2
- package/dist/providers/algolia.js +1 -3
- package/dist/providers/fuse.d.ts +1 -2
- package/dist/providers/fuse.js +1 -3
- package/dist/providers/pagefind.d.ts +1 -1
- package/dist/providers/pagefind.js +1 -2
- package/dist/providers/walker.d.ts +1 -2
- package/dist/providers/walker.js +1 -3
- package/dist/{index-B6k7CNFb.d.ts → types-O3Jwo7Us.d.ts} +89 -1
- package/dist/types.d.ts +1 -90
- package/dist/types.js +1 -2
- package/package.json +7 -7
package/dist/context.d.ts
CHANGED
package/dist/context.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { search } from "./providers/algolia.js";
|
|
2
2
|
import { createContext, use, useCallback } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
5
4
|
//#region src/context.tsx
|
|
6
5
|
function createStrictContext(displayName) {
|
|
7
6
|
const Context = createContext(null);
|
|
@@ -27,6 +26,5 @@ function SearchProvider({ children, ...props }) {
|
|
|
27
26
|
children
|
|
28
27
|
});
|
|
29
28
|
}
|
|
30
|
-
|
|
31
29
|
//#endregion
|
|
32
|
-
export { SearchProvider, useSearch, useSearchContext };
|
|
30
|
+
export { SearchProvider, useSearch, useSearchContext };
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -8,7 +8,6 @@ import { useLanguage } from "@stainless-api/docs-ui/contexts";
|
|
|
8
8
|
import { useComponents } from "@stainless-api/docs-ui/contexts/use-components";
|
|
9
9
|
import style from "@stainless-api/docs-ui/style";
|
|
10
10
|
import { Button } from "@stainless-api/ui-primitives";
|
|
11
|
-
|
|
12
11
|
//#region src/results.tsx
|
|
13
12
|
const QueryKindDisplay = {
|
|
14
13
|
all: {
|
|
@@ -214,7 +213,6 @@ function SearchResultContent({ result }) {
|
|
|
214
213
|
});
|
|
215
214
|
}
|
|
216
215
|
}
|
|
217
|
-
|
|
218
216
|
//#endregion
|
|
219
217
|
//#region src/form.tsx
|
|
220
218
|
function SearchForm() {
|
|
@@ -327,6 +325,5 @@ function SearchModal({ id, open: isOpen }) {
|
|
|
327
325
|
children: open && /* @__PURE__ */ jsx(SearchForm, {})
|
|
328
326
|
});
|
|
329
327
|
}
|
|
330
|
-
|
|
331
328
|
//#endregion
|
|
332
|
-
export { SearchFilter, SearchForm, SearchModal };
|
|
329
|
+
export { SearchFilter, SearchForm, SearchModal };
|
package/dist/indexer.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IndexEntry } from "./types.js";
|
|
1
|
+
import { b as Resource, n as IndexEntry, x as Spec } from "./types-O3Jwo7Us.js";
|
|
3
2
|
import { DocsLanguage } from "@stainless-api/docs-ui/routing";
|
|
4
3
|
|
|
5
4
|
//#region src/indexer.d.ts
|
package/dist/indexer.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Languages, generateRoute, parseStainlessPath, walkTree } from "@stainless-api/docs-ui/routing";
|
|
2
2
|
import { printer, renderMarkdown } from "@stainless-api/docs-ui/markdown";
|
|
3
3
|
import { isResourceEmpty } from "@stainless-api/docs-ui/utils";
|
|
4
|
-
|
|
5
4
|
//#region src/indexer.ts
|
|
6
5
|
function getResourceNames(resourceIds, topResources) {
|
|
7
6
|
let element;
|
|
@@ -179,6 +178,5 @@ function* generateIndex(spec, renderMarkdownFn, includeTypes, languages) {
|
|
|
179
178
|
}
|
|
180
179
|
}
|
|
181
180
|
}
|
|
182
|
-
|
|
183
181
|
//#endregion
|
|
184
|
-
export { generateChatIndex, generateIndex, getResourceNames };
|
|
182
|
+
export { generateChatIndex, generateIndex, getResourceNames };
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IndexEntry, IndexMethod } from "./types.js";
|
|
1
|
+
import { n as IndexEntry, r as IndexMethod, x as Spec } from "./types-O3Jwo7Us.js";
|
|
3
2
|
import { generateIndex } from "./indexer.js";
|
|
4
3
|
import { DocsLanguage } from "@stainless-api/docs-ui/routing";
|
|
5
4
|
|
package/dist/mcp.js
CHANGED
|
@@ -2,7 +2,6 @@ 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";
|
|
5
|
-
|
|
6
5
|
//#region src/mcp.ts
|
|
7
6
|
function consolidate(results) {
|
|
8
7
|
const resources = /* @__PURE__ */ new Set();
|
|
@@ -31,6 +30,5 @@ function render(spec, language, items, includeModelProperties) {
|
|
|
31
30
|
});
|
|
32
31
|
return Object.fromEntries(output);
|
|
33
32
|
}
|
|
34
|
-
|
|
35
33
|
//#endregion
|
|
36
|
-
export { generateIndex, render };
|
|
34
|
+
export { generateIndex, render };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IndexEntry, ProseIndexEntry, ResultType, SearchParams, SearchSettings } from "../types.js";
|
|
1
|
+
import { f as ResultType, g as SearchSettings, h as SearchParams, n as IndexEntry, s as ProseIndexEntry, x as Spec } from "../types-O3Jwo7Us.js";
|
|
3
2
|
|
|
4
3
|
//#region src/providers/algolia.d.ts
|
|
5
4
|
declare function buildIndex(appId: string, indexName: string, writeKey: string, content: Spec | IndexEntry[], renderMarkdown: (_: string) => string | null): Promise<void>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { generateChatIndex, generateIndex } from "../indexer.js";
|
|
2
2
|
import { SearchableAttributes, SearchableAttributesChat, SearchableAttributesProse } from "../types.js";
|
|
3
3
|
import { searchClient } from "@algolia/client-search";
|
|
4
|
-
|
|
5
4
|
//#region src/providers/algolia.ts
|
|
6
5
|
async function buildIndex(appId, indexName, writeKey, content, renderMarkdown) {
|
|
7
6
|
if (!appId || !indexName || !writeKey) return;
|
|
@@ -78,6 +77,5 @@ async function search({ settings: { appId, indexName, searchKey }, params: { que
|
|
|
78
77
|
};
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
|
-
|
|
82
80
|
//#endregion
|
|
83
|
-
export { buildChatIndex, buildIndex, buildProseIndex, search };
|
|
81
|
+
export { buildChatIndex, buildIndex, buildProseIndex, search };
|
package/dist/providers/fuse.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IndexEntry } from "../types.js";
|
|
1
|
+
import { n as IndexEntry, x as Spec } from "../types-O3Jwo7Us.js";
|
|
3
2
|
import { DocsLanguage } from "@stainless-api/docs-ui/routing";
|
|
4
3
|
import * as fuse_js0 from "fuse.js";
|
|
5
4
|
import { FuseIndex } from "fuse.js";
|
package/dist/providers/fuse.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { generateIndex } from "../indexer.js";
|
|
2
2
|
import { SearchableAttributes } from "../types.js";
|
|
3
3
|
import Fuse from "fuse.js";
|
|
4
|
-
|
|
5
4
|
//#region src/providers/fuse.ts
|
|
6
5
|
function buildIndex(spec, language) {
|
|
7
6
|
const idx = Array.from(generateIndex(spec, void 0, false));
|
|
@@ -14,6 +13,5 @@ function buildIndex(spec, language) {
|
|
|
14
13
|
function search({ content, index }, query, limit = 100) {
|
|
15
14
|
return new Fuse(content, { keys: [...SearchableAttributes] }, index).search(query).slice(0, limit);
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
//#endregion
|
|
19
|
-
export { buildIndex, search };
|
|
17
|
+
export { buildIndex, search };
|
package/dist/providers/walker.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { generateIndex } from "../indexer.js";
|
|
2
2
|
import { SearchableAttributes } from "../types.js";
|
|
3
|
-
|
|
4
3
|
//#region src/providers/walker.ts
|
|
5
4
|
function buildIndex(spec) {
|
|
6
5
|
return generateIndex(spec, void 0, false);
|
|
@@ -18,6 +17,5 @@ function search(index, language, query, limit = 100) {
|
|
|
18
17
|
const results = findEntryInIndex(index, language, query);
|
|
19
18
|
return Array.from(results).sort((a, b) => a.priority - b.priority).slice(0, limit);
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
//#endregion
|
|
23
|
-
export { buildIndex, search };
|
|
21
|
+
export { buildIndex, search };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DocsLanguage } from "@stainless-api/docs-ui/routing";
|
|
1
2
|
import { Code } from "@pkg/plada/src/core";
|
|
2
3
|
|
|
3
4
|
//#region ../sdk-json/index.d.ts
|
|
@@ -1513,4 +1514,91 @@ type GoTypePointer = BaseType & {
|
|
|
1513
1514
|
inner: GoType;
|
|
1514
1515
|
};
|
|
1515
1516
|
//#endregion
|
|
1516
|
-
|
|
1517
|
+
//#region src/types.d.ts
|
|
1518
|
+
type SearchSettings = {
|
|
1519
|
+
appId: string;
|
|
1520
|
+
searchKey: string;
|
|
1521
|
+
indexName: string;
|
|
1522
|
+
assistant?: string;
|
|
1523
|
+
};
|
|
1524
|
+
type SearchParams = {
|
|
1525
|
+
query: string;
|
|
1526
|
+
language?: DocsLanguage | null;
|
|
1527
|
+
kind?: QueryKindsType | null;
|
|
1528
|
+
};
|
|
1529
|
+
declare const QueryKinds: readonly ["all", "guide", "resource", "http_method", "model", "property"];
|
|
1530
|
+
type QueryKindsType = (typeof QueryKinds)[number];
|
|
1531
|
+
type IndexModel = {
|
|
1532
|
+
kind: 'model';
|
|
1533
|
+
title: string;
|
|
1534
|
+
children?: string[];
|
|
1535
|
+
ident?: string;
|
|
1536
|
+
};
|
|
1537
|
+
type IndexProperty = {
|
|
1538
|
+
kind: 'property';
|
|
1539
|
+
docstring?: string;
|
|
1540
|
+
type?: string;
|
|
1541
|
+
};
|
|
1542
|
+
type IndexResource = {
|
|
1543
|
+
kind: 'resource';
|
|
1544
|
+
title: string;
|
|
1545
|
+
Name: string;
|
|
1546
|
+
QualifiedName: string;
|
|
1547
|
+
};
|
|
1548
|
+
type IndexMethod = Pick<Method, 'kind' | 'summary' | 'description' | 'endpoint' | 'httpMethod'> & {
|
|
1549
|
+
title: string;
|
|
1550
|
+
qualified?: string;
|
|
1551
|
+
ident?: string;
|
|
1552
|
+
};
|
|
1553
|
+
declare const SearchableAttributes: readonly ["name", "title", "ident", "Name", "qualified", "QualifiedName", "endpoint", "summary", "description", "docstring"];
|
|
1554
|
+
declare const SearchableAttributesChat: string[];
|
|
1555
|
+
declare const SearchableAttributesProse: string[];
|
|
1556
|
+
type SearchAttributeNames = (typeof SearchableAttributes)[number];
|
|
1557
|
+
type RoutableJsonNode = Method | Model | Resource;
|
|
1558
|
+
type IndexEntry = Pick<RoutableJsonNode, 'name' | 'stainlessPath'> & (IndexProperty | IndexModel | IndexResource | IndexMethod) & {
|
|
1559
|
+
language: DocsLanguage;
|
|
1560
|
+
priority: number;
|
|
1561
|
+
crumbs: string[];
|
|
1562
|
+
};
|
|
1563
|
+
type ResultRecordType = IndexEntry & {
|
|
1564
|
+
objectID: string;
|
|
1565
|
+
_highlightResult: Record<SearchAttributeNames, {
|
|
1566
|
+
value: string;
|
|
1567
|
+
}>;
|
|
1568
|
+
};
|
|
1569
|
+
type ResultType = {
|
|
1570
|
+
hits: ResultRecordType[];
|
|
1571
|
+
facets?: Record<string, Record<string, number>>;
|
|
1572
|
+
nbHits: number;
|
|
1573
|
+
};
|
|
1574
|
+
type GuideResultType = {
|
|
1575
|
+
id: string;
|
|
1576
|
+
score: number;
|
|
1577
|
+
words: number[];
|
|
1578
|
+
data: {
|
|
1579
|
+
excerpt: string;
|
|
1580
|
+
url: string;
|
|
1581
|
+
word_count: number;
|
|
1582
|
+
meta: {
|
|
1583
|
+
title: string;
|
|
1584
|
+
};
|
|
1585
|
+
sub_results: {
|
|
1586
|
+
url: string;
|
|
1587
|
+
title: string;
|
|
1588
|
+
excerpt: string;
|
|
1589
|
+
}[];
|
|
1590
|
+
};
|
|
1591
|
+
};
|
|
1592
|
+
type ResultData = {
|
|
1593
|
+
items: Array<ResultRecordType | GuideResultType>;
|
|
1594
|
+
counts: Partial<Record<QueryKindsType, number>>;
|
|
1595
|
+
};
|
|
1596
|
+
type ProseIndexEntry = {
|
|
1597
|
+
id?: string;
|
|
1598
|
+
tag: string;
|
|
1599
|
+
content: string;
|
|
1600
|
+
source?: string;
|
|
1601
|
+
[additional: string]: unknown;
|
|
1602
|
+
};
|
|
1603
|
+
//#endregion
|
|
1604
|
+
export { SearchableAttributes as _, IndexProperty as a, Resource as b, QueryKinds as c, ResultRecordType as d, ResultType as f, SearchSettings as g, SearchParams as h, IndexModel as i, QueryKindsType as l, SearchAttributeNames as m, IndexEntry as n, IndexResource as o, RoutableJsonNode as p, IndexMethod as r, ProseIndexEntry as s, GuideResultType as t, ResultData as u, SearchableAttributesChat as v, Spec as x, SearchableAttributesProse as y };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,91 +1,2 @@
|
|
|
1
|
-
import { n as
|
|
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
|
|
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-O3Jwo7Us.js";
|
|
91
2
|
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
|
@@ -30,6 +30,5 @@ const SearchableAttributesChat = [
|
|
|
30
30
|
"content"
|
|
31
31
|
];
|
|
32
32
|
const SearchableAttributesProse = ["content"];
|
|
33
|
-
|
|
34
33
|
//#endregion
|
|
35
|
-
export { QueryKinds, SearchableAttributes, SearchableAttributesChat, SearchableAttributesProse };
|
|
34
|
+
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
|
+
"version": "0.1.0-beta.39",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -13,23 +13,23 @@
|
|
|
13
13
|
"react-dom": ">=19.0.0"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@algolia/client-search": "^5.49.
|
|
17
|
-
"@markdoc/markdoc": "^0.5.
|
|
16
|
+
"@algolia/client-search": "^5.49.2",
|
|
17
|
+
"@markdoc/markdoc": "^0.5.6",
|
|
18
18
|
"cheerio": "^1.2.0",
|
|
19
19
|
"fuse.js": "^7.1.0",
|
|
20
20
|
"htmlparser2": "^10.1.0",
|
|
21
21
|
"lucide-react": "^0.574.0",
|
|
22
|
-
"@stainless-api/
|
|
23
|
-
"@stainless-api/ui
|
|
22
|
+
"@stainless-api/ui-primitives": "0.1.0-beta.50",
|
|
23
|
+
"@stainless-api/docs-ui": "0.1.0-beta.86"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@types/node": "24.
|
|
26
|
+
"@types/node": "24.12.0",
|
|
27
27
|
"@types/react": "19.2.14",
|
|
28
28
|
"@types/react-dom": "^19.2.3",
|
|
29
29
|
"dotenv": "17.3.1",
|
|
30
30
|
"react": "^19.2.4",
|
|
31
31
|
"react-dom": "^19.2.4",
|
|
32
|
-
"tsdown": "^0.
|
|
32
|
+
"tsdown": "^0.21.4",
|
|
33
33
|
"typescript": "5.9.3",
|
|
34
34
|
"@stainless/eslint-config": "0.1.0-beta.1",
|
|
35
35
|
"@stainless/sdk-json": "^0.1.0-beta.9"
|