@stainless-api/docs-search 0.1.0-beta.23 → 0.1.0-beta.24
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/{algolia-gvZUkKkS.js → algolia-elwP_mmI.js} +3 -3
- package/dist/{context-BeqLpg4u.js → context-DIYY3XIj.js} +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/context.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/{indexer-BDmIxFRi.js → indexer-CajKYSRj.js} +7 -6
- package/dist/indexer.d.ts +35 -0
- package/dist/indexer.js +3 -0
- package/dist/mcp.d.ts +2 -4
- package/dist/mcp.js +1 -1
- package/dist/providers/algolia.d.ts +2 -2
- package/dist/providers/algolia.js +2 -2
- package/dist/providers/fuse.d.ts +1 -1
- package/dist/providers/fuse.js +1 -1
- package/dist/providers/pagefind.d.ts +1 -1
- package/dist/providers/walker.d.ts +1 -1
- package/dist/providers/walker.js +1 -1
- package/dist/{types-fPzO2V0p.d.ts → types-2WWqDCEW.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +7 -4
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { n as generateIndex, t as generateChatIndex } from "./indexer-
|
|
1
|
+
import { n as generateIndex, t as generateChatIndex } from "./indexer-CajKYSRj.js";
|
|
2
2
|
import { i as SearchableAttributesProse, n as SearchableAttributes, r as SearchableAttributesChat } from "./types-DyGUPDP0.js";
|
|
3
3
|
import { searchClient } from "@algolia/client-search";
|
|
4
4
|
|
|
5
5
|
//#region src/providers/algolia.ts
|
|
6
|
-
async function buildIndex(appId, indexName, writeKey,
|
|
6
|
+
async function buildIndex(appId, indexName, writeKey, content, renderMarkdown) {
|
|
7
7
|
if (!appId || !indexName || !writeKey) return;
|
|
8
|
-
const objects = Array.from(generateIndex(
|
|
8
|
+
const objects = Array.isArray(content) ? content : Array.from(generateIndex(content, renderMarkdown));
|
|
9
9
|
const client = searchClient(appId, writeKey);
|
|
10
10
|
await client.setSettings({
|
|
11
11
|
indexName,
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as ResultType, g as SearchSettings, h as SearchParams } from "./types-
|
|
1
|
+
import { f as ResultType, g as SearchSettings, h as SearchParams } from "./types-2WWqDCEW.js";
|
|
2
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/context.d.ts
|
package/dist/context.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./indexer-
|
|
2
|
-
import "./algolia-
|
|
3
|
-
import { n as useSearch, r as useSearchContext, t as SearchProvider } from "./context-
|
|
1
|
+
import "./indexer-CajKYSRj.js";
|
|
2
|
+
import "./algolia-elwP_mmI.js";
|
|
3
|
+
import { n as useSearch, r as useSearchContext, t as SearchProvider } from "./context-DIYY3XIj.js";
|
|
4
4
|
|
|
5
5
|
export { SearchProvider, useSearch, useSearchContext };
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./indexer-
|
|
1
|
+
import "./indexer-CajKYSRj.js";
|
|
2
2
|
import { t as QueryKinds } from "./types-DyGUPDP0.js";
|
|
3
|
-
import "./algolia-
|
|
4
|
-
import { n as useSearch, r as useSearchContext } from "./context-
|
|
3
|
+
import "./algolia-elwP_mmI.js";
|
|
4
|
+
import { n as useSearch, r as useSearchContext } from "./context-DIYY3XIj.js";
|
|
5
5
|
import { t as guideSearch } from "./pagefind-DCvI8YmZ.js";
|
|
6
6
|
import { createElement, useEffect, useRef, useState } from "react";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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 { generateIndex as n, getResourceNames as r, generateChatIndex as t };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { b as Resource, n as IndexEntry, x as Spec } from "./types-2WWqDCEW.js";
|
|
2
|
+
import { DocsLanguage } from "@stainless-api/docs-ui/routing";
|
|
3
|
+
|
|
4
|
+
//#region src/indexer.d.ts
|
|
5
|
+
declare function getResourceNames(resourceIds: string[], topResources?: Record<string, Resource>): string[];
|
|
6
|
+
declare function generateChatIndex(spec: Spec): Generator<{
|
|
7
|
+
language: string;
|
|
8
|
+
title: string;
|
|
9
|
+
content: string;
|
|
10
|
+
url: string;
|
|
11
|
+
name?: undefined;
|
|
12
|
+
endpoint?: undefined;
|
|
13
|
+
httpMethod?: undefined;
|
|
14
|
+
summary?: undefined;
|
|
15
|
+
description?: undefined;
|
|
16
|
+
stainlessPath?: undefined;
|
|
17
|
+
qualified?: undefined;
|
|
18
|
+
ident?: undefined;
|
|
19
|
+
} | {
|
|
20
|
+
language: "cli" | "csharp" | "go" | "http" | "java" | "kotlin" | "node" | "php" | "python" | "ruby" | "terraform" | "typescript";
|
|
21
|
+
title: string;
|
|
22
|
+
name: string;
|
|
23
|
+
endpoint: string;
|
|
24
|
+
httpMethod: string;
|
|
25
|
+
summary: string | undefined;
|
|
26
|
+
description: string | undefined;
|
|
27
|
+
stainlessPath: string;
|
|
28
|
+
qualified: string | undefined;
|
|
29
|
+
ident: string | undefined;
|
|
30
|
+
content: string;
|
|
31
|
+
url: string | null;
|
|
32
|
+
}, void, unknown>;
|
|
33
|
+
declare function generateIndex(spec: Spec, renderMarkdownFn?: (_: string) => string | null, includeTypes?: boolean, languages?: DocsLanguage[]): Generator<IndexEntry>;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { generateChatIndex, generateIndex, getResourceNames };
|
package/dist/indexer.js
ADDED
package/dist/mcp.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as IndexEntry, r as IndexMethod, x as Spec } from "./types-2WWqDCEW.js";
|
|
2
|
+
import { generateIndex } from "./indexer.js";
|
|
2
3
|
import { DocsLanguage } from "@stainless-api/docs-ui/routing";
|
|
3
4
|
|
|
4
|
-
//#region src/indexer.d.ts
|
|
5
|
-
declare function generateIndex(spec: Spec, renderMarkdownFn?: (_: string) => string | null, includeTypes?: boolean): Generator<IndexEntry>;
|
|
6
|
-
//#endregion
|
|
7
5
|
//#region src/mcp.d.ts
|
|
8
6
|
type Item = IndexEntry & IndexMethod;
|
|
9
7
|
declare function render(spec: Spec, language: DocsLanguage, items: Item[], includeModelProperties: boolean): any;
|
package/dist/mcp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as generateIndex } from "./indexer-
|
|
1
|
+
import { n as generateIndex } from "./indexer-CajKYSRj.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,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as ResultType, g as SearchSettings, h as SearchParams, n as IndexEntry, s as ProseIndexEntry, x as Spec } from "../types-2WWqDCEW.js";
|
|
2
2
|
|
|
3
3
|
//#region src/providers/algolia.d.ts
|
|
4
|
-
declare function buildIndex(appId: string, indexName: string, writeKey: string,
|
|
4
|
+
declare function buildIndex(appId: string, indexName: string, writeKey: string, content: Spec | IndexEntry[], renderMarkdown: (_: string) => string | null): Promise<void>;
|
|
5
5
|
declare function buildChatIndex(appId: string, indexName: string, writeKey: string, spec: Spec): Promise<void>;
|
|
6
6
|
declare function buildProseIndex(appId: string, indexName: string, writeKey: string, objects: ProseIndexEntry[]): Promise<void>;
|
|
7
7
|
declare function search({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../indexer-
|
|
2
|
-
import { i as search, n as buildIndex, r as buildProseIndex, t as buildChatIndex } from "../algolia-
|
|
1
|
+
import "../indexer-CajKYSRj.js";
|
|
2
|
+
import { i as search, n as buildIndex, r as buildProseIndex, t as buildChatIndex } from "../algolia-elwP_mmI.js";
|
|
3
3
|
|
|
4
4
|
export { buildChatIndex, buildIndex, buildProseIndex, search };
|
package/dist/providers/fuse.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as IndexEntry, x as Spec } from "../types-2WWqDCEW.js";
|
|
2
2
|
import { DocsLanguage } from "@stainless-api/docs-ui/routing";
|
|
3
3
|
import * as fuse_js0 from "fuse.js";
|
|
4
4
|
import { FuseIndex } from "fuse.js";
|
package/dist/providers/fuse.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as GuideResultType } from "../types-
|
|
1
|
+
import { t as GuideResultType } from "../types-2WWqDCEW.js";
|
|
2
2
|
|
|
3
3
|
//#region src/providers/pagefind.d.ts
|
|
4
4
|
declare function guideSearch(loadPath: string, query: string, limit?: number): Promise<GuideResultType[]>;
|
package/dist/providers/walker.js
CHANGED
|
@@ -1582,4 +1582,4 @@ type ProseIndexEntry = {
|
|
|
1582
1582
|
[additional: string]: unknown;
|
|
1583
1583
|
};
|
|
1584
1584
|
//#endregion
|
|
1585
|
-
export { SearchableAttributes as _, IndexProperty as a,
|
|
1585
|
+
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,2 +1,2 @@
|
|
|
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-
|
|
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-2WWqDCEW.js";
|
|
2
2
|
export { GuideResultType, IndexEntry, IndexMethod, IndexModel, IndexProperty, IndexResource, ProseIndexEntry, QueryKinds, QueryKindsType, ResultData, ResultRecordType, ResultType, RoutableJsonNode, SearchAttributeNames, SearchParams, SearchSettings, 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.24",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"fuse.js": "^7.1.0",
|
|
20
20
|
"htmlparser2": "^10.1.0",
|
|
21
21
|
"lucide-react": "^0.562.0",
|
|
22
|
-
"@stainless-api/docs-ui": "0.1.0-beta.
|
|
22
|
+
"@stainless-api/docs-ui": "0.1.0-beta.71",
|
|
23
23
|
"@stainless-api/ui-primitives": "0.1.0-beta.47"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
@@ -31,13 +31,16 @@
|
|
|
31
31
|
"react-dom": "^19.2.4",
|
|
32
32
|
"tsdown": "^0.20.0",
|
|
33
33
|
"typescript": "5.9.3",
|
|
34
|
-
"@stainless/
|
|
35
|
-
"@stainless/
|
|
34
|
+
"@stainless/eslint-config": "0.1.0-beta.1",
|
|
35
|
+
"@stainless/sdk-json": "^0.1.0-beta.4"
|
|
36
36
|
},
|
|
37
37
|
"exports": {
|
|
38
38
|
".": {
|
|
39
39
|
"default": "./dist/index.js"
|
|
40
40
|
},
|
|
41
|
+
"./indexer": {
|
|
42
|
+
"default": "./dist/indexer.js"
|
|
43
|
+
},
|
|
41
44
|
"./context": {
|
|
42
45
|
"default": "./dist/context.js"
|
|
43
46
|
},
|