@openpkg-ts/sdk 0.50.1 → 0.52.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/README.md +36 -0
- package/dist/index.d.ts +163 -49
- package/dist/index.js +1072 -207
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -8,6 +8,21 @@ Extract [OpenPkg](https://openpkg.dev) documents from TypeScript source and gene
|
|
|
8
8
|
npm install @openpkg-ts/sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## TypeScript version support
|
|
12
|
+
|
|
13
|
+
The sdk drives the TypeScript **JS compiler API** and declares
|
|
14
|
+
`typescript@^5.0.0 || ^6.0.0` as a regular dependency, so your package manager
|
|
15
|
+
installs a compatible copy for the sdk automatically — extraction works even if
|
|
16
|
+
your own project uses a different TypeScript version.
|
|
17
|
+
|
|
18
|
+
**On a TypeScript 7 toolchain?** That's fine: TS7's `tsc` is a native binary and
|
|
19
|
+
does not conflict with the sdk's nested TS5/6 copy. One caveat: do **not** force
|
|
20
|
+
a workspace-wide `typescript@7` via `overrides`/`resolutions`. The extraction
|
|
21
|
+
engine needs the JS compiler API, which TypeScript 7 removed — its main export
|
|
22
|
+
is a version stub with no `createProgram`. Native TS7-backed extraction is
|
|
23
|
+
planned as a separate opt-in package; the JS backend remains the default and is
|
|
24
|
+
fully supported.
|
|
25
|
+
|
|
11
26
|
## Entry Points
|
|
12
27
|
|
|
13
28
|
```typescript
|
|
@@ -75,9 +90,30 @@ const { spec, diagnostics, verification } = await extractSpec({
|
|
|
75
90
|
resolveExternalTypes: true,
|
|
76
91
|
only: ['use*'], // filter by pattern
|
|
77
92
|
ignore: ['*Internal'], // exclude by pattern
|
|
93
|
+
followExternal: ['@ai-sdk/*'], // or true, or 'auto' with decisions: 'jev'
|
|
78
94
|
});
|
|
79
95
|
```
|
|
80
96
|
|
|
97
|
+
`followExternal: 'auto'` scores referenced externals with Jev and expands the load-bearing ones. Requires `decisions: 'jev'`, `AI_GATEWAY_API_KEY`, and optional peer `ai` (≥7.0.105). Specs record `generation.entryPoint` and `generation.entryPointSource` (`types` / `exports` / `fallback` / `explicit` / `llm`).
|
|
98
|
+
|
|
99
|
+
### resolveTarget
|
|
100
|
+
|
|
101
|
+
Resolve a package and entry from a directory, cwd, intent, or git URL before extracting:
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import { resolveTarget, extractSpec } from '@openpkg-ts/sdk';
|
|
105
|
+
|
|
106
|
+
const resolved = await resolveTarget({ input: '.', intent: 'sdk' });
|
|
107
|
+
if (resolved.kind === 'ok') {
|
|
108
|
+
const { spec } = await extractSpec({
|
|
109
|
+
entryFile: resolved.entryFile,
|
|
110
|
+
entryPointSource: resolved.entryPointSource,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`decisions: 'jev'` uses Jev when the heuristic is ambiguous. GitHub URLs clone via `gh` if present, else `git clone --depth 1`.
|
|
116
|
+
|
|
81
117
|
### diffSpecs
|
|
82
118
|
|
|
83
119
|
Compare two specs for breaking changes.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
import { BreakingSeverity, CategorizedBreaking, calculateNextVersion, categorizeBreakingChanges, diffSpec, diffSpec as diffSpec2, MemberChangeInfo, recommendSemverBump, SemverBump, SemverRecommendation, SpecDiff } from "@openpkg-ts/spec";
|
|
2
|
-
import { OpenPkg } from "@openpkg-ts/spec";
|
|
2
|
+
import { EntryPointDetectionMethod, OpenPkg } from "@openpkg-ts/spec";
|
|
3
|
+
declare const JEV_MODEL = "typesafe-ai/jev";
|
|
4
|
+
declare const JEV_CONFIDENCE = .5;
|
|
5
|
+
type ChoiceQuestion = {
|
|
6
|
+
type: "choice";
|
|
7
|
+
instructions: string;
|
|
8
|
+
criteria: Record<string, string>;
|
|
9
|
+
};
|
|
10
|
+
type ScoreQuestion = {
|
|
11
|
+
type: "score";
|
|
12
|
+
instructions: string;
|
|
13
|
+
criteria: string[];
|
|
14
|
+
};
|
|
15
|
+
type EvaluateQuestion = ChoiceQuestion | ScoreQuestion;
|
|
16
|
+
type EvaluateRequest = {
|
|
17
|
+
model: string;
|
|
18
|
+
state: unknown;
|
|
19
|
+
questions: Record<string, EvaluateQuestion>;
|
|
20
|
+
providerOptions?: {
|
|
21
|
+
gateway?: {
|
|
22
|
+
zeroDataRetention?: boolean;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
type EvaluateAnswer = {
|
|
27
|
+
choice?: string;
|
|
28
|
+
score?: number;
|
|
29
|
+
probabilities?: Record<string, number>;
|
|
30
|
+
};
|
|
31
|
+
type EvaluateResult = {
|
|
32
|
+
answers: Record<string, EvaluateAnswer>;
|
|
33
|
+
providerMetadata?: {
|
|
34
|
+
typesafe?: {
|
|
35
|
+
confidence?: Record<string, number>;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
type EvaluateFn = (request: EvaluateRequest) => Promise<EvaluateResult>;
|
|
3
40
|
/** Configuration for resolving external package re-exports */
|
|
4
41
|
interface ExternalsConfig {
|
|
5
42
|
/** Package patterns to resolve (globs supported, e.g., "@myorg/*") */
|
|
@@ -11,6 +48,8 @@ interface ExternalsConfig {
|
|
|
11
48
|
}
|
|
12
49
|
interface ExtractOptions {
|
|
13
50
|
entryFile: string;
|
|
51
|
+
/** How the entry file was chosen. Default: explicit. */
|
|
52
|
+
entryPointSource?: EntryPointDetectionMethod;
|
|
14
53
|
baseDir?: string;
|
|
15
54
|
content?: string;
|
|
16
55
|
maxTypeDepth?: number;
|
|
@@ -49,7 +88,9 @@ interface ExtractOptions {
|
|
|
49
88
|
* - `false` → disable the reachability-expansion pass entirely
|
|
50
89
|
* - default → workspace siblings only; everything else stubbed
|
|
51
90
|
*/
|
|
52
|
-
followExternal?: boolean | string[];
|
|
91
|
+
followExternal?: boolean | string[] | "auto";
|
|
92
|
+
evaluate?: EvaluateFn;
|
|
93
|
+
decisions?: "heuristic" | "jev";
|
|
53
94
|
/** Callback when properties are truncated */
|
|
54
95
|
onTruncation?: (typeName: string, actual: number, limit: number) => void;
|
|
55
96
|
}
|
|
@@ -161,11 +202,13 @@ interface OpenpkgConfig {
|
|
|
161
202
|
* them as opaque stubs. `true` follows every dependency; a string[] follows
|
|
162
203
|
* only the named packages (by declaring package name). Default: stub.
|
|
163
204
|
*/
|
|
164
|
-
followExternal?: boolean | string[];
|
|
205
|
+
followExternal?: boolean | string[] | "auto";
|
|
165
206
|
/** Only extract these exports (supports * wildcards). */
|
|
166
207
|
only?: string[];
|
|
167
208
|
/** Ignore these exports (supports * wildcards). */
|
|
168
209
|
ignore?: string[];
|
|
210
|
+
/** Use Jev for package/entry routing. Requires AI_GATEWAY_API_KEY. */
|
|
211
|
+
decisions?: "heuristic" | "jev";
|
|
169
212
|
}
|
|
170
213
|
/** Default config filename */
|
|
171
214
|
declare const CONFIG_FILENAME = "openpkg.config.json";
|
|
@@ -1063,6 +1106,77 @@ declare class QueryBuilder {
|
|
|
1063
1106
|
* Create a query builder for the given spec
|
|
1064
1107
|
*/
|
|
1065
1108
|
declare function query(spec: OpenPkg10): QueryBuilder;
|
|
1109
|
+
import { EntryPointDetectionMethod as EntryPointDetectionMethod2 } from "@openpkg-ts/spec";
|
|
1110
|
+
type PackageRecord = {
|
|
1111
|
+
name: string;
|
|
1112
|
+
dir: string;
|
|
1113
|
+
private: boolean;
|
|
1114
|
+
description?: string;
|
|
1115
|
+
types?: string;
|
|
1116
|
+
typings?: string;
|
|
1117
|
+
main?: string;
|
|
1118
|
+
module?: string;
|
|
1119
|
+
hasSrc: boolean;
|
|
1120
|
+
hasDist: boolean;
|
|
1121
|
+
scripts: string[];
|
|
1122
|
+
};
|
|
1123
|
+
type CloneFn = (input: string) => Promise<string>;
|
|
1124
|
+
type ResolveTargetOptions = {
|
|
1125
|
+
input?: string;
|
|
1126
|
+
intent?: string;
|
|
1127
|
+
cwd?: string;
|
|
1128
|
+
decisions?: "heuristic" | "jev";
|
|
1129
|
+
evaluate?: EvaluateFn;
|
|
1130
|
+
clone?: CloneFn;
|
|
1131
|
+
};
|
|
1132
|
+
type ResolveOk = {
|
|
1133
|
+
kind: "ok";
|
|
1134
|
+
package: PackageRecord;
|
|
1135
|
+
entryFile: string;
|
|
1136
|
+
entryPointSource: EntryPointDetectionMethod2;
|
|
1137
|
+
};
|
|
1138
|
+
type ResolveAmbiguous = {
|
|
1139
|
+
kind: "ambiguous";
|
|
1140
|
+
candidates: PackageRecord[];
|
|
1141
|
+
};
|
|
1142
|
+
type ResolveNeedsBuild = {
|
|
1143
|
+
kind: "needs-build";
|
|
1144
|
+
package: PackageRecord;
|
|
1145
|
+
reason: string;
|
|
1146
|
+
command?: string;
|
|
1147
|
+
};
|
|
1148
|
+
type ResolveEmpty = {
|
|
1149
|
+
kind: "empty";
|
|
1150
|
+
reason: string;
|
|
1151
|
+
};
|
|
1152
|
+
type ResolveRemote = {
|
|
1153
|
+
kind: "remote";
|
|
1154
|
+
input: string;
|
|
1155
|
+
};
|
|
1156
|
+
type ResolveExplicit = {
|
|
1157
|
+
kind: "explicit";
|
|
1158
|
+
entryFile: string;
|
|
1159
|
+
entryPointSource: "explicit";
|
|
1160
|
+
};
|
|
1161
|
+
type ResolveUnavailable = {
|
|
1162
|
+
kind: "unavailable";
|
|
1163
|
+
reason: string;
|
|
1164
|
+
};
|
|
1165
|
+
type ResolveTargetResult = ResolveOk | ResolveAmbiguous | ResolveNeedsBuild | ResolveEmpty | ResolveRemote | ResolveExplicit | ResolveUnavailable;
|
|
1166
|
+
declare function isRemoteInput(input: string): boolean;
|
|
1167
|
+
declare function isEntryFilePath(input: string): boolean;
|
|
1168
|
+
declare function parseGithubRepo(input: string): {
|
|
1169
|
+
owner: string;
|
|
1170
|
+
repo: string;
|
|
1171
|
+
} | null;
|
|
1172
|
+
declare function cloneRemote(input: string): Promise<string>;
|
|
1173
|
+
declare function findWorkspaceRoot(start: string): string | undefined;
|
|
1174
|
+
declare function catalogPackages(start: string): PackageRecord[];
|
|
1175
|
+
declare function pickEntry(pkgDir: string): {
|
|
1176
|
+
entryFile: string;
|
|
1177
|
+
entryPointSource: EntryPointDetectionMethod2;
|
|
1178
|
+
} | null;
|
|
1179
|
+
declare function resolveTarget(options?: ResolveTargetOptions): Promise<ResolveTargetResult>;
|
|
1066
1180
|
import { OpenPkg as OpenPkg11, SpecExportKind as SpecExportKind7 } from "@openpkg-ts/spec";
|
|
1067
1181
|
type FilterCriteria = {
|
|
1068
1182
|
/** Filter by kinds */
|
|
@@ -1608,7 +1722,7 @@ interface ProgramResult {
|
|
|
1608
1722
|
workspacePackages?: Map<string, string>;
|
|
1609
1723
|
}
|
|
1610
1724
|
declare function createProgram(options: ProgramOptions): ProgramResult;
|
|
1611
|
-
import
|
|
1725
|
+
import ts8 from "typescript";
|
|
1612
1726
|
/**
|
|
1613
1727
|
* A schema adapter can detect and extract output types from a specific
|
|
1614
1728
|
* schema validation library.
|
|
@@ -1622,17 +1736,17 @@ interface SchemaAdapter {
|
|
|
1622
1736
|
* Check if a type matches this adapter's schema library.
|
|
1623
1737
|
* Should be fast - called for every export.
|
|
1624
1738
|
*/
|
|
1625
|
-
matches(type:
|
|
1739
|
+
matches(type: ts8.Type, checker: ts8.TypeChecker): boolean;
|
|
1626
1740
|
/**
|
|
1627
1741
|
* Extract the output type from a schema type.
|
|
1628
1742
|
* Returns null if extraction fails.
|
|
1629
1743
|
*/
|
|
1630
|
-
extractOutputType(type:
|
|
1744
|
+
extractOutputType(type: ts8.Type, checker: ts8.TypeChecker): ts8.Type | null;
|
|
1631
1745
|
/**
|
|
1632
1746
|
* Extract the input type from a schema type (optional).
|
|
1633
1747
|
* Useful for transforms where input differs from output.
|
|
1634
1748
|
*/
|
|
1635
|
-
extractInputType?(type:
|
|
1749
|
+
extractInputType?(type: ts8.Type, checker: ts8.TypeChecker): ts8.Type | null;
|
|
1636
1750
|
}
|
|
1637
1751
|
/**
|
|
1638
1752
|
* Result of schema type extraction
|
|
@@ -1641,22 +1755,22 @@ interface SchemaExtractionResult {
|
|
|
1641
1755
|
/** The adapter that matched */
|
|
1642
1756
|
adapter: SchemaAdapter;
|
|
1643
1757
|
/** The extracted output type */
|
|
1644
|
-
outputType:
|
|
1758
|
+
outputType: ts8.Type;
|
|
1645
1759
|
/** The extracted input type (if different from output) */
|
|
1646
|
-
inputType?:
|
|
1760
|
+
inputType?: ts8.Type;
|
|
1647
1761
|
}
|
|
1648
1762
|
/**
|
|
1649
1763
|
* Utility: Check if type is an object type reference (has type arguments)
|
|
1650
1764
|
*/
|
|
1651
|
-
declare function isTypeReference(type:
|
|
1765
|
+
declare function isTypeReference(type: ts8.Type): type is ts8.TypeReference;
|
|
1652
1766
|
/**
|
|
1653
1767
|
* Utility: Remove undefined/null from a union type
|
|
1654
1768
|
*/
|
|
1655
|
-
declare function getNonNullableType(type:
|
|
1769
|
+
declare function getNonNullableType(type: ts8.Type): ts8.Type;
|
|
1656
1770
|
declare function registerAdapter(adapter: SchemaAdapter): void;
|
|
1657
|
-
declare function findAdapter(type:
|
|
1658
|
-
declare function isSchemaType(type:
|
|
1659
|
-
declare function extractSchemaType(type:
|
|
1771
|
+
declare function findAdapter(type: ts8.Type, checker: ts8.TypeChecker): SchemaAdapter | undefined;
|
|
1772
|
+
declare function isSchemaType(type: ts8.Type, checker: ts8.TypeChecker): boolean;
|
|
1773
|
+
declare function extractSchemaType(type: ts8.Type, checker: ts8.TypeChecker): SchemaExtractionResult | null;
|
|
1660
1774
|
declare const arktypeAdapter: SchemaAdapter;
|
|
1661
1775
|
declare const typeboxAdapter: SchemaAdapter;
|
|
1662
1776
|
declare const valibotAdapter: SchemaAdapter;
|
|
@@ -1803,33 +1917,33 @@ interface ToolSchemaResult {
|
|
|
1803
1917
|
*/
|
|
1804
1918
|
declare function toToolSchema(exp: SpecExport12, spec: OpenPkg15, options: ToToolSchemaOptions): ToolSchemaResult;
|
|
1805
1919
|
import { SpecExport as SpecExport13 } from "@openpkg-ts/spec";
|
|
1806
|
-
import ts8 from "typescript";
|
|
1807
|
-
declare function serializeClass(node: ts8.ClassDeclaration, ctx: SerializerContext): SpecExport13 | null;
|
|
1808
|
-
import { SpecExport as SpecExport14 } from "@openpkg-ts/spec";
|
|
1809
1920
|
import ts9 from "typescript";
|
|
1810
|
-
declare function
|
|
1811
|
-
import { SpecExport as
|
|
1921
|
+
declare function serializeClass(node: ts9.ClassDeclaration, ctx: SerializerContext): SpecExport13 | null;
|
|
1922
|
+
import { SpecExport as SpecExport14 } from "@openpkg-ts/spec";
|
|
1812
1923
|
import ts10 from "typescript";
|
|
1813
|
-
declare function
|
|
1814
|
-
import { SpecExport as
|
|
1924
|
+
declare function serializeEnum(node: ts10.EnumDeclaration, ctx: SerializerContext): SpecExport14 | null;
|
|
1925
|
+
import { SpecExport as SpecExport15 } from "@openpkg-ts/spec";
|
|
1815
1926
|
import ts11 from "typescript";
|
|
1816
|
-
declare function
|
|
1817
|
-
import { SpecExport as
|
|
1927
|
+
declare function serializeFunctionExport(node: ts11.FunctionDeclaration | ts11.ArrowFunction | ts11.FunctionExpression, ctx: SerializerContext, nameOverride?: string): SpecExport15 | null;
|
|
1928
|
+
import { SpecExport as SpecExport16 } from "@openpkg-ts/spec";
|
|
1818
1929
|
import ts12 from "typescript";
|
|
1819
|
-
declare function
|
|
1820
|
-
import { SpecExport as
|
|
1930
|
+
declare function serializeInterface(node: ts12.InterfaceDeclaration, ctx: SerializerContext): SpecExport16 | null;
|
|
1931
|
+
import { SpecExport as SpecExport17 } from "@openpkg-ts/spec";
|
|
1821
1932
|
import ts13 from "typescript";
|
|
1822
|
-
declare function
|
|
1823
|
-
import {
|
|
1933
|
+
declare function serializeTypeAlias(node: ts13.TypeAliasDeclaration, ctx: SerializerContext): SpecExport17 | null;
|
|
1934
|
+
import { SpecExport as SpecExport18 } from "@openpkg-ts/spec";
|
|
1824
1935
|
import ts14 from "typescript";
|
|
1825
|
-
declare function
|
|
1936
|
+
declare function serializeVariable(node: ts14.VariableDeclaration, statement: ts14.VariableStatement, ctx: SerializerContext): SpecExport18 | null;
|
|
1937
|
+
import { SpecSignatureParameter } from "@openpkg-ts/spec";
|
|
1938
|
+
import ts15 from "typescript";
|
|
1939
|
+
declare function extractParameters(signature: ts15.Signature, ctx: SerializerContext): SpecSignatureParameter[];
|
|
1826
1940
|
/**
|
|
1827
1941
|
* Recursively register types referenced by a ts.Type.
|
|
1828
1942
|
* Uses ctx.registeredTypes to prevent re-processing already-registered types.
|
|
1829
1943
|
*/
|
|
1830
|
-
declare function registerReferencedTypes(type:
|
|
1944
|
+
declare function registerReferencedTypes(type: ts15.Type, ctx: SerializerContext, depth?: number): void;
|
|
1831
1945
|
import { SpecSchema as SpecSchema5 } from "@openpkg-ts/spec";
|
|
1832
|
-
import
|
|
1946
|
+
import ts16 from "typescript";
|
|
1833
1947
|
/**
|
|
1834
1948
|
* Remove `import("<abs path>").` qualifiers from checker-rendered type text.
|
|
1835
1949
|
* Machine-specific paths must never appear in a published spec.
|
|
@@ -1839,7 +1953,7 @@ declare function scrubImportQualifiers(text: string): string;
|
|
|
1839
1953
|
* Render the developer-facing type text at its owning declaration.
|
|
1840
1954
|
* NoTruncation keeps long unions intact; import() qualifiers are scrubbed.
|
|
1841
1955
|
*/
|
|
1842
|
-
declare function renderTypeText(type:
|
|
1956
|
+
declare function renderTypeText(type: ts16.Type, checker: ts16.TypeChecker, enclosing?: ts16.Node, extraFlags?: ts16.TypeFormatFlags): string;
|
|
1843
1957
|
/**
|
|
1844
1958
|
* The type exactly as the author WROTE it — the annotation node's source text.
|
|
1845
1959
|
* `x-ts-type` carries the resolved truth (`Omit<T, K>` expanded to its mapped
|
|
@@ -1852,17 +1966,17 @@ declare function renderTypeText(type: ts15.Type, checker: ts15.TypeChecker, encl
|
|
|
1852
1966
|
* formatting (a trailing `;`, `readonly T[]` vs `ReadonlyArray<T>`) or would
|
|
1853
1967
|
* drag source comments into the spec, both of which are noise, not signal.
|
|
1854
1968
|
*/
|
|
1855
|
-
declare function writtenTypeText(typeNode:
|
|
1969
|
+
declare function writtenTypeText(typeNode: ts16.TypeNode | undefined): string | undefined;
|
|
1856
1970
|
/** The annotation TypeNode on a declaration (property, alias, parameter), if any. */
|
|
1857
|
-
declare function declaredTypeNode(decl:
|
|
1971
|
+
declare function declaredTypeNode(decl: ts16.Declaration | undefined): ts16.TypeNode | undefined;
|
|
1858
1972
|
/**
|
|
1859
1973
|
* Strip `undefined` from a union type when optionality is already expressed
|
|
1860
1974
|
* elsewhere (`required: false`, `flags.optional`). Used for both schema shape
|
|
1861
1975
|
* and x-ts-type text so neither re-encodes optionality as `| undefined`.
|
|
1862
1976
|
*/
|
|
1863
|
-
declare function stripUndefinedFromType(type:
|
|
1977
|
+
declare function stripUndefinedFromType(type: ts16.Type, checker: ts16.TypeChecker): ts16.Type;
|
|
1864
1978
|
/** Declaration-modifier readonly check — matches the member-layer flags.readonly source. */
|
|
1865
|
-
declare function isReadonlyPropertySymbol(prop:
|
|
1979
|
+
declare function isReadonlyPropertySymbol(prop: ts16.Symbol): boolean;
|
|
1866
1980
|
/**
|
|
1867
1981
|
* Decorate a property schema with TS-fidelity metadata:
|
|
1868
1982
|
* - `x-ts-type`: checker-rendered text at the owning declaration. Emitted
|
|
@@ -1872,14 +1986,14 @@ declare function isReadonlyPropertySymbol(prop: ts15.Symbol): boolean;
|
|
|
1872
1986
|
* - `x-ts-method`: declaration form marker for method-syntax members
|
|
1873
1987
|
* (SymbolFlags.Method survives on true methods, is stripped by mapping).
|
|
1874
1988
|
*/
|
|
1875
|
-
declare function decoratePropertySchema(schema: SpecSchema5, prop:
|
|
1989
|
+
declare function decoratePropertySchema(schema: SpecSchema5, prop: ts16.Symbol, propType: ts16.Type, checker: ts16.TypeChecker): SpecSchema5;
|
|
1876
1990
|
/**
|
|
1877
1991
|
* Alias-level x-ts-type is emitted when the alias RHS is a renderable
|
|
1878
1992
|
* expression (array, instantiation, union, intersection, function, keyof, …).
|
|
1879
1993
|
* Type-literal and mapped bodies are skipped — their structure is already
|
|
1880
1994
|
* carried by schema.properties and the text would be the whole literal body.
|
|
1881
1995
|
*/
|
|
1882
|
-
declare function shouldEmitAliasTypeText(typeNode:
|
|
1996
|
+
declare function shouldEmitAliasTypeText(typeNode: ts16.TypeNode): boolean;
|
|
1883
1997
|
declare const PRIMITIVES: Set<string>;
|
|
1884
1998
|
declare const ARRAY_PROTOTYPE_METHODS: Set<string>;
|
|
1885
1999
|
declare const STRING_PROTOTYPE_METHODS: Set<string>;
|
|
@@ -1892,7 +2006,7 @@ declare function isPrimitiveName(name: string): boolean;
|
|
|
1892
2006
|
* Check if a symbol is from TypeScript's built-in lib (lib.es*.d.ts).
|
|
1893
2007
|
* Used to detect Array, Object, and other built-in types.
|
|
1894
2008
|
*/
|
|
1895
|
-
declare function isBuiltinSymbol(symbol:
|
|
2009
|
+
declare function isBuiltinSymbol(symbol: ts16.Symbol | undefined): boolean;
|
|
1896
2010
|
/**
|
|
1897
2011
|
* Get the origin package name for a type if it comes from node_modules.
|
|
1898
2012
|
* Returns undefined for types defined in the current project.
|
|
@@ -1901,7 +2015,7 @@ declare function isBuiltinSymbol(symbol: ts15.Symbol | undefined): boolean;
|
|
|
1901
2015
|
* getTypeOrigin(trpcRouterType) // Returns '@trpc/server'
|
|
1902
2016
|
* getTypeOrigin(localUserType) // Returns undefined
|
|
1903
2017
|
*/
|
|
1904
|
-
declare function getTypeOrigin(type:
|
|
2018
|
+
declare function getTypeOrigin(type: ts16.Type, _checker: ts16.TypeChecker): string | undefined;
|
|
1905
2019
|
/**
|
|
1906
2020
|
* Check if a name is a built-in generic type
|
|
1907
2021
|
*/
|
|
@@ -1909,26 +2023,26 @@ declare function isBuiltinGeneric(name: string): boolean;
|
|
|
1909
2023
|
/**
|
|
1910
2024
|
* Check if a type is anonymous (no meaningful symbol name)
|
|
1911
2025
|
*/
|
|
1912
|
-
declare function isAnonymous(type:
|
|
2026
|
+
declare function isAnonymous(type: ts16.Type): boolean;
|
|
1913
2027
|
/**
|
|
1914
2028
|
* Ensure schema is non-empty — fallback to x-ts-type string representation if empty.
|
|
1915
2029
|
* Never emit {} as a schema; always include meaningful type info.
|
|
1916
2030
|
*/
|
|
1917
|
-
declare function ensureNonEmptySchema(schema: SpecSchema5, type:
|
|
2031
|
+
declare function ensureNonEmptySchema(schema: SpecSchema5, type: ts16.Type, checker: ts16.TypeChecker): SpecSchema5;
|
|
1918
2032
|
/**
|
|
1919
2033
|
* Build a structured SpecSchema from a TypeScript type.
|
|
1920
2034
|
* Uses $ref for named types and typeArguments for generics.
|
|
1921
2035
|
* Guarantees non-empty schema output via ensureNonEmptySchema wrapper.
|
|
1922
2036
|
*/
|
|
1923
|
-
declare function buildSchema(type:
|
|
2037
|
+
declare function buildSchema(type: ts16.Type, checker: ts16.TypeChecker, ctx?: SerializerContext): SpecSchema5;
|
|
1924
2038
|
/**
|
|
1925
2039
|
* Build schema for function types
|
|
1926
2040
|
*/
|
|
1927
|
-
declare function buildFunctionSchema(callSignatures: readonly
|
|
2041
|
+
declare function buildFunctionSchema(callSignatures: readonly ts16.Signature[], checker: ts16.TypeChecker, ctx: SerializerContext | undefined): SpecSchema5;
|
|
1928
2042
|
/**
|
|
1929
2043
|
* Build schema for object types with properties
|
|
1930
2044
|
*/
|
|
1931
|
-
declare function buildObjectSchema(properties:
|
|
2045
|
+
declare function buildObjectSchema(properties: ts16.Symbol[], checker: ts16.TypeChecker, ctx: SerializerContext | undefined, originalType?: ts16.Type): SpecSchema5;
|
|
1932
2046
|
/**
|
|
1933
2047
|
* Check if a schema is a pure $ref (only has $ref property)
|
|
1934
2048
|
*/
|
|
@@ -1961,8 +2075,8 @@ declare function deduplicateSchemas(schemas: SpecSchema5[]): SpecSchema5[];
|
|
|
1961
2075
|
* Find a discriminator property in a union of object types (tagged union pattern).
|
|
1962
2076
|
* A valid discriminator has a unique literal value in each union member.
|
|
1963
2077
|
*/
|
|
1964
|
-
declare function findDiscriminatorProperty(unionTypes:
|
|
1965
|
-
import
|
|
1966
|
-
declare function isExported(node:
|
|
1967
|
-
declare function getNodeName(node:
|
|
1968
|
-
export { zodAdapter, writtenTypeText, withDescription2 as withDescription, withDeprecated, validateSpec, valibotAdapter, typeboxAdapter, toToolSchema, toSearchIndexJSON, toSearchIndex2 as toSearchIndex, toPagefindRecords2 as toPagefindRecords, toNavigation2 as toNavigation, toMarkdown2 as toMarkdown, toJsonSchema, toJSONString, toJSON2 as toJSON, toHTML2 as toHTML, toFumadocsMetaJSON, toDocusaurusSidebarJS, toAlgoliaRecords2 as toAlgoliaRecords, stripUndefinedFromType, stripTsExtensions, sortByName, shouldEmitAliasTypeText, serializeVariable, serializeTypeAlias, serializeInterface, serializeFunctionExport, serializeEnum, serializeClass, scrubImportQualifiers, schemasAreEqual, schemaIsAny, resolveTypeRef, resolveExportTarget, resolveCompiledPath, renderTypeText, registerReferencedTypes, registerAdapter, recommendSemverBump, query, normalizeType, normalizeSchema, normalizeMembers, normalizeExport, mergeConfig, loadSpec, loadConfig, listExports, isTypeReference, isTypeOnlyExport, isSymbolDeprecated, isStandardJSONSchema, isSchemaType, isReadonlyPropertySymbol, isPureRefSchema, isProperty, isPrimitiveName, isMethod, isExported, isBuiltinSymbol, isBuiltinGeneric, isAnonymous, hasDeprecatedTag, groupByVisibility, getValidationErrors, getTypeOrigin, getSourceLocation, getProperties, getParamDescription, getNonNullableType, getNodeName, getMethods, getMemberBadges, getJSDocComment, getExportKind, getExport2 as getExport, getDeprecationMessage, getAvailableVersions, toMarkdown2 as generateDocs, formatTypeParameters, formatSchema, formatReturnType, formatParameters, formatMappedType, formatConditionalType, formatBadges, findMissingParamDocs, findDiscriminatorProperty, findAdapter, filterSpec, extractTypeParameters, extractStandardSchemasFromTs, extractStandardSchemasFromProject, extractStandardSchemas, extractSpec, extractSchemaType, extractParameters, extract, exportToMarkdown, exportToJsonSchema, ensureNonEmptySchema, diffSpec2 as diffSpecs, diffSpec, detectTsRuntime, deduplicateSchemas, decoratePropertySchema, declaredTypeNode, createProgram, createDocs, categorizeBreakingChanges, calculateNextVersion, bundleRefs, buildSignatureString, buildSchema, buildObjectSchema, buildFunctionSchema, assertSpec, asStandardSchema, arktypeAdapter, analyzeSpec, TypeRegistry, TypeReference2 as TypeReference, TsRuntime, ToolSchemaResult, ToolSchemaProvider, ToToolSchemaOptions, ToJsonSchemaOptions, StandardSchemaExtractionResult, StandardSchemaExtractionOutput, StandardJSONSchemaV1, StandardJSONSchemaTarget, StandardJSONSchemaOptions, SpecMappedType, SpecError, SpecDiff, SpecDiagnostics, SpecConditionalType, SkippedExportDetail, SimplifiedSpec, SimplifiedSignature, SimplifiedReturn, SimplifiedParameter, SimplifiedMember, SimplifiedExport, SimplifiedExample, SerializerContext, SemverRecommendation, SemverBump, SearchRecord, SearchOptions, SearchIndex, SchemaVersion, SchemaExtractionResult, SchemaAdapter, STRING_PROTOTYPE_METHODS, QueryBuilder, ProjectExtractionOutput, ProjectExtractionInfo, ProgramResult, ProgramOptions, PagefindRecord, PRIMITIVES, OpenpkgConfig, NormalizeOptions, NavOptions, NavItem, NavGroup, NavFormat, NUMBER_PROTOTYPE_METHODS, MemberChangeInfo, MarkdownOptions, LoadOptions, ListExportsResult, ListExportsOptions, LATEST_VERSION, JsonSchemaDocument, JSONSchema, JSONOptions, HTMLOptions, GroupBy, GetExportResult, GetExportOptions, GenericNav, FumadocsMetaItem, FumadocsMeta, FormatSchemaOptions, ForgottenExport, FilterResult, FilterCriteria, ExtractionWarningCode, ExtractionWarning, ExtractStandardSchemasOptions, ExtractResult, ExtractOptions, ExtractFromProjectOptions, ExternalsConfig, ExportVerification, ExportTracker, ExportMarkdownOptions, ExportItem, DocusaurusSidebarItem, DocusaurusSidebar, DocsInstance, DiagnosticItem, Diagnostic, CategorizedBreaking, CacheManagerOptions, CacheManager, CONFIG_FILENAME, BundleResult, BundleOptions, BuiltinSchema, BreakingSeverity, BUILTIN_TYPE_SCHEMAS, AsStandardSchemaOptions, AlgoliaRecord, ARRAY_PROTOTYPE_METHODS };
|
|
2078
|
+
declare function findDiscriminatorProperty(unionTypes: ts16.Type[], checker: ts16.TypeChecker): string | undefined;
|
|
2079
|
+
import ts17 from "typescript";
|
|
2080
|
+
declare function isExported(node: ts17.Node): boolean;
|
|
2081
|
+
declare function getNodeName(node: ts17.Node): string | undefined;
|
|
2082
|
+
export { zodAdapter, writtenTypeText, withDescription2 as withDescription, withDeprecated, validateSpec, valibotAdapter, typeboxAdapter, toToolSchema, toSearchIndexJSON, toSearchIndex2 as toSearchIndex, toPagefindRecords2 as toPagefindRecords, toNavigation2 as toNavigation, toMarkdown2 as toMarkdown, toJsonSchema, toJSONString, toJSON2 as toJSON, toHTML2 as toHTML, toFumadocsMetaJSON, toDocusaurusSidebarJS, toAlgoliaRecords2 as toAlgoliaRecords, stripUndefinedFromType, stripTsExtensions, sortByName, shouldEmitAliasTypeText, serializeVariable, serializeTypeAlias, serializeInterface, serializeFunctionExport, serializeEnum, serializeClass, scrubImportQualifiers, schemasAreEqual, schemaIsAny, resolveTypeRef, resolveTarget, resolveExportTarget, resolveCompiledPath, renderTypeText, registerReferencedTypes, registerAdapter, recommendSemverBump, query, pickEntry, parseGithubRepo, normalizeType, normalizeSchema, normalizeMembers, normalizeExport, mergeConfig, loadSpec, loadConfig, listExports, isTypeReference, isTypeOnlyExport, isSymbolDeprecated, isStandardJSONSchema, isSchemaType, isRemoteInput, isReadonlyPropertySymbol, isPureRefSchema, isProperty, isPrimitiveName, isMethod, isExported, isEntryFilePath, isBuiltinSymbol, isBuiltinGeneric, isAnonymous, hasDeprecatedTag, groupByVisibility, getValidationErrors, getTypeOrigin, getSourceLocation, getProperties, getParamDescription, getNonNullableType, getNodeName, getMethods, getMemberBadges, getJSDocComment, getExportKind, getExport2 as getExport, getDeprecationMessage, getAvailableVersions, toMarkdown2 as generateDocs, formatTypeParameters, formatSchema, formatReturnType, formatParameters, formatMappedType, formatConditionalType, formatBadges, findWorkspaceRoot, findMissingParamDocs, findDiscriminatorProperty, findAdapter, filterSpec, extractTypeParameters, extractStandardSchemasFromTs, extractStandardSchemasFromProject, extractStandardSchemas, extractSpec, extractSchemaType, extractParameters, extract, exportToMarkdown, exportToJsonSchema, ensureNonEmptySchema, diffSpec2 as diffSpecs, diffSpec, detectTsRuntime, deduplicateSchemas, decoratePropertySchema, declaredTypeNode, createProgram, createDocs, cloneRemote, categorizeBreakingChanges, catalogPackages, calculateNextVersion, bundleRefs, buildSignatureString, buildSchema, buildObjectSchema, buildFunctionSchema, assertSpec, asStandardSchema, arktypeAdapter, analyzeSpec, TypeRegistry, TypeReference2 as TypeReference, TsRuntime, ToolSchemaResult, ToolSchemaProvider, ToToolSchemaOptions, ToJsonSchemaOptions, StandardSchemaExtractionResult, StandardSchemaExtractionOutput, StandardJSONSchemaV1, StandardJSONSchemaTarget, StandardJSONSchemaOptions, SpecMappedType, SpecError, SpecDiff, SpecDiagnostics, SpecConditionalType, SkippedExportDetail, SimplifiedSpec, SimplifiedSignature, SimplifiedReturn, SimplifiedParameter, SimplifiedMember, SimplifiedExport, SimplifiedExample, SerializerContext, SemverRecommendation, SemverBump, SearchRecord, SearchOptions, SearchIndex, SchemaVersion, SchemaExtractionResult, SchemaAdapter, STRING_PROTOTYPE_METHODS, ResolveUnavailable, ResolveTargetResult, ResolveTargetOptions, ResolveRemote, ResolveOk, ResolveNeedsBuild, ResolveExplicit, ResolveEmpty, ResolveAmbiguous, QueryBuilder, ProjectExtractionOutput, ProjectExtractionInfo, ProgramResult, ProgramOptions, PagefindRecord, PackageRecord, PRIMITIVES, OpenpkgConfig, NormalizeOptions, NavOptions, NavItem, NavGroup, NavFormat, NUMBER_PROTOTYPE_METHODS, MemberChangeInfo, MarkdownOptions, LoadOptions, ListExportsResult, ListExportsOptions, LATEST_VERSION, JsonSchemaDocument, JSONSchema, JSONOptions, JEV_MODEL, JEV_CONFIDENCE, HTMLOptions, GroupBy, GetExportResult, GetExportOptions, GenericNav, FumadocsMetaItem, FumadocsMeta, FormatSchemaOptions, ForgottenExport, FilterResult, FilterCriteria, ExtractionWarningCode, ExtractionWarning, ExtractStandardSchemasOptions, ExtractResult, ExtractOptions, ExtractFromProjectOptions, ExternalsConfig, ExportVerification, ExportTracker, ExportMarkdownOptions, ExportItem, EvaluateResult, EvaluateRequest, EvaluateFn, DocusaurusSidebarItem, DocusaurusSidebar, DocsInstance, DiagnosticItem, Diagnostic, CloneFn, CategorizedBreaking, CacheManagerOptions, CacheManager, CONFIG_FILENAME, BundleResult, BundleOptions, BuiltinSchema, BreakingSeverity, BUILTIN_TYPE_SCHEMAS, AsStandardSchemaOptions, AlgoliaRecord, ARRAY_PROTOTYPE_METHODS };
|