@openpkg-ts/sdk 0.33.1 → 0.34.1
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 +76 -1
- package/dist/browser.d.ts +678 -0
- package/dist/browser.js +56 -0
- package/dist/index.d.ts +234 -39
- package/dist/index.js +815 -941
- package/dist/shared/chunk-skapcfq1.js +552 -0
- package/package.json +7 -3
package/dist/browser.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
QueryBuilder,
|
|
3
|
+
analyzeSpec,
|
|
4
|
+
buildSignatureString,
|
|
5
|
+
findMissingParamDocs,
|
|
6
|
+
formatBadges,
|
|
7
|
+
formatConditionalType,
|
|
8
|
+
formatMappedType,
|
|
9
|
+
formatParameters,
|
|
10
|
+
formatReturnType,
|
|
11
|
+
formatSchema,
|
|
12
|
+
formatTypeParameters,
|
|
13
|
+
getDeprecationMessage,
|
|
14
|
+
getMemberBadges,
|
|
15
|
+
getMethods,
|
|
16
|
+
getProperties,
|
|
17
|
+
groupByVisibility,
|
|
18
|
+
hasDeprecatedTag,
|
|
19
|
+
isMethod,
|
|
20
|
+
isProperty,
|
|
21
|
+
query,
|
|
22
|
+
resolveTypeRef,
|
|
23
|
+
sortByName,
|
|
24
|
+
toAlgoliaRecords,
|
|
25
|
+
toPagefindRecords,
|
|
26
|
+
toSearchIndex,
|
|
27
|
+
toSearchIndexJSON
|
|
28
|
+
} from "./shared/chunk-skapcfq1.js";
|
|
29
|
+
export {
|
|
30
|
+
toSearchIndexJSON,
|
|
31
|
+
toSearchIndex,
|
|
32
|
+
toPagefindRecords,
|
|
33
|
+
toAlgoliaRecords,
|
|
34
|
+
sortByName,
|
|
35
|
+
resolveTypeRef,
|
|
36
|
+
query,
|
|
37
|
+
isProperty,
|
|
38
|
+
isMethod,
|
|
39
|
+
hasDeprecatedTag,
|
|
40
|
+
groupByVisibility,
|
|
41
|
+
getProperties,
|
|
42
|
+
getMethods,
|
|
43
|
+
getMemberBadges,
|
|
44
|
+
getDeprecationMessage,
|
|
45
|
+
formatTypeParameters,
|
|
46
|
+
formatSchema,
|
|
47
|
+
formatReturnType,
|
|
48
|
+
formatParameters,
|
|
49
|
+
formatMappedType,
|
|
50
|
+
formatConditionalType,
|
|
51
|
+
formatBadges,
|
|
52
|
+
findMissingParamDocs,
|
|
53
|
+
buildSignatureString,
|
|
54
|
+
analyzeSpec,
|
|
55
|
+
QueryBuilder
|
|
56
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -941,10 +941,102 @@ declare function formatConditionalType(condType: SpecConditionalType): string;
|
|
|
941
941
|
* ```
|
|
942
942
|
*/
|
|
943
943
|
declare function formatMappedType(mappedType: SpecMappedType): string;
|
|
944
|
-
import { OpenPkg as OpenPkg10, SpecExportKind as SpecExportKind5 } from "@openpkg-ts/spec";
|
|
944
|
+
import { OpenPkg as OpenPkg10, SpecExport as SpecExport5, SpecExportKind as SpecExportKind5 } from "@openpkg-ts/spec";
|
|
945
|
+
type Predicate = (exp: SpecExport5) => boolean;
|
|
946
|
+
/**
|
|
947
|
+
* Chainable query builder for filtering OpenPkg exports.
|
|
948
|
+
* Filters are lazy - predicates only run on execution methods (find, first, count, etc).
|
|
949
|
+
*/
|
|
950
|
+
declare class QueryBuilder {
|
|
951
|
+
private spec;
|
|
952
|
+
private predicates;
|
|
953
|
+
constructor(spec: OpenPkg10);
|
|
954
|
+
/**
|
|
955
|
+
* Filter by kind(s)
|
|
956
|
+
*/
|
|
957
|
+
byKind(...kinds: SpecExportKind5[]): this;
|
|
958
|
+
/**
|
|
959
|
+
* Filter by name (exact string or regex pattern)
|
|
960
|
+
*/
|
|
961
|
+
byName(pattern: string | RegExp): this;
|
|
962
|
+
/**
|
|
963
|
+
* Filter by tag(s) - must have at least one matching tag
|
|
964
|
+
*/
|
|
965
|
+
byTag(...tags: string[]): this;
|
|
966
|
+
/**
|
|
967
|
+
* Filter by deprecation status
|
|
968
|
+
* @param include - true = only deprecated, false = exclude deprecated, undefined = all
|
|
969
|
+
*/
|
|
970
|
+
deprecated(include?: boolean): this;
|
|
971
|
+
/**
|
|
972
|
+
* Filter to exports with descriptions only
|
|
973
|
+
*/
|
|
974
|
+
withDescription(): this;
|
|
975
|
+
/**
|
|
976
|
+
* Search name and description (case-insensitive)
|
|
977
|
+
*/
|
|
978
|
+
search(term: string): this;
|
|
979
|
+
/**
|
|
980
|
+
* Custom predicate filter
|
|
981
|
+
*/
|
|
982
|
+
where(predicate: Predicate): this;
|
|
983
|
+
/**
|
|
984
|
+
* Filter by source module/file path (contains match)
|
|
985
|
+
*/
|
|
986
|
+
byModule(modulePath: string): this;
|
|
987
|
+
private matches;
|
|
988
|
+
/**
|
|
989
|
+
* Execute query and return matching exports
|
|
990
|
+
*/
|
|
991
|
+
find(): SpecExport5[];
|
|
992
|
+
/**
|
|
993
|
+
* Execute query and return first match (or undefined)
|
|
994
|
+
*/
|
|
995
|
+
first(): SpecExport5 | undefined;
|
|
996
|
+
/**
|
|
997
|
+
* Execute query and return count of matches
|
|
998
|
+
*/
|
|
999
|
+
count(): number;
|
|
1000
|
+
/**
|
|
1001
|
+
* Execute query and return IDs of matching exports
|
|
1002
|
+
*/
|
|
1003
|
+
ids(): string[];
|
|
1004
|
+
/**
|
|
1005
|
+
* Execute query and return a new filtered OpenPkg spec
|
|
1006
|
+
*/
|
|
1007
|
+
toSpec(): OpenPkg10;
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Create a query builder for the given spec
|
|
1011
|
+
*/
|
|
1012
|
+
declare function query(spec: OpenPkg10): QueryBuilder;
|
|
1013
|
+
import { OpenPkg as OpenPkg11 } from "@openpkg-ts/spec";
|
|
1014
|
+
interface ReactLayoutOptions {
|
|
1015
|
+
/** Output directory for generated files */
|
|
1016
|
+
outDir: string;
|
|
1017
|
+
/** Layout variant: 'full' (single page) or 'index' (index with links) */
|
|
1018
|
+
variant?: "full" | "index";
|
|
1019
|
+
/** Components path alias (default: @/components/api) */
|
|
1020
|
+
componentsPath?: string;
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
1023
|
+
* Generate React layout from an OpenPkg spec.
|
|
1024
|
+
*
|
|
1025
|
+
* Unlike the old per-approach, this generates a single layout file.
|
|
1026
|
+
* Components are installed separately via the registry.
|
|
1027
|
+
*/
|
|
1028
|
+
declare function toReact(spec: OpenPkg11, options: ReactLayoutOptions): Promise<void>;
|
|
1029
|
+
/**
|
|
1030
|
+
* Generate layout code as a string (for preview).
|
|
1031
|
+
*/
|
|
1032
|
+
declare function toReactString(spec: OpenPkg11, options?: {
|
|
1033
|
+
variant?: "full" | "index";
|
|
1034
|
+
componentsPath?: string;
|
|
1035
|
+
}): string;
|
|
1036
|
+
import { OpenPkg as OpenPkg12, SpecExportKind as SpecExportKind6 } from "@openpkg-ts/spec";
|
|
945
1037
|
type FilterCriteria = {
|
|
946
1038
|
/** Filter by kinds */
|
|
947
|
-
kinds?:
|
|
1039
|
+
kinds?: SpecExportKind6[];
|
|
948
1040
|
/** Filter by names (exact match) */
|
|
949
1041
|
names?: string[];
|
|
950
1042
|
/** Filter by IDs */
|
|
@@ -966,7 +1058,7 @@ type FilterCriteria = {
|
|
|
966
1058
|
};
|
|
967
1059
|
type FilterResult = {
|
|
968
1060
|
/** New spec with only matched exports (immutable) */
|
|
969
|
-
spec:
|
|
1061
|
+
spec: OpenPkg12;
|
|
970
1062
|
/** Number of exports that matched */
|
|
971
1063
|
matched: number;
|
|
972
1064
|
/** Total number of exports in original spec */
|
|
@@ -982,8 +1074,8 @@ type FilterResult = {
|
|
|
982
1074
|
* @param criteria - Filter criteria (empty criteria matches all)
|
|
983
1075
|
* @returns FilterResult with new spec, matched count, total count
|
|
984
1076
|
*/
|
|
985
|
-
declare function filterSpec(spec:
|
|
986
|
-
import { SpecExport as
|
|
1077
|
+
declare function filterSpec(spec: OpenPkg12, criteria: FilterCriteria): FilterResult;
|
|
1078
|
+
import { SpecExport as SpecExport6, SpecType as SpecType3 } from "@openpkg-ts/spec";
|
|
987
1079
|
interface GetExportOptions {
|
|
988
1080
|
/** Entry point file path */
|
|
989
1081
|
entryFile: string;
|
|
@@ -998,7 +1090,7 @@ interface GetExportOptions {
|
|
|
998
1090
|
}
|
|
999
1091
|
interface GetExportResult {
|
|
1000
1092
|
/** The spec, or null if not found */
|
|
1001
|
-
export:
|
|
1093
|
+
export: SpecExport6 | null;
|
|
1002
1094
|
/** Related types referenced by the */
|
|
1003
1095
|
types: SpecType3[];
|
|
1004
1096
|
/** Errors encountered */
|
|
@@ -1295,21 +1387,124 @@ interface ProjectExtractionOutput extends StandardSchemaExtractionOutput {
|
|
|
1295
1387
|
* @param options - Extraction options
|
|
1296
1388
|
*/
|
|
1297
1389
|
declare function extractStandardSchemasFromProject(entryFile: string, baseDir: string, options?: ExtractFromProjectOptions): Promise<ProjectExtractionOutput>;
|
|
1390
|
+
/**
|
|
1391
|
+
* LRU Cache implementation with optional TTL support.
|
|
1392
|
+
* Used for bounded caching in spec extraction to prevent memory leaks.
|
|
1393
|
+
*/
|
|
1394
|
+
interface CacheManagerOptions {
|
|
1395
|
+
/** Maximum number of entries (default: 1000) */
|
|
1396
|
+
maxSize?: number;
|
|
1397
|
+
/** Time-to-live in milliseconds (optional, no expiry if not set) */
|
|
1398
|
+
ttl?: number;
|
|
1399
|
+
}
|
|
1400
|
+
/**
|
|
1401
|
+
* Bounded LRU cache with optional TTL.
|
|
1402
|
+
*
|
|
1403
|
+
* @example
|
|
1404
|
+
* ```ts
|
|
1405
|
+
* const cache = new CacheManager<string, number>({ maxSize: 100 });
|
|
1406
|
+
* cache.set('key', 42);
|
|
1407
|
+
* cache.get('key'); // 42
|
|
1408
|
+
* cache.clear();
|
|
1409
|
+
* ```
|
|
1410
|
+
*/
|
|
1411
|
+
declare class CacheManager<
|
|
1412
|
+
K,
|
|
1413
|
+
V
|
|
1414
|
+
> {
|
|
1415
|
+
private cache;
|
|
1416
|
+
private readonly maxSize;
|
|
1417
|
+
private readonly ttl?;
|
|
1418
|
+
constructor(options?: CacheManagerOptions);
|
|
1419
|
+
/**
|
|
1420
|
+
* Get a value from the cache.
|
|
1421
|
+
* Returns undefined if not found or expired.
|
|
1422
|
+
* Moves accessed entry to end (most recently used).
|
|
1423
|
+
*/
|
|
1424
|
+
get(key: K): V | undefined;
|
|
1425
|
+
/**
|
|
1426
|
+
* Check if key exists (without affecting LRU order).
|
|
1427
|
+
*/
|
|
1428
|
+
has(key: K): boolean;
|
|
1429
|
+
/**
|
|
1430
|
+
* Set a value in the cache.
|
|
1431
|
+
* Evicts least recently used entry if at capacity.
|
|
1432
|
+
*/
|
|
1433
|
+
set(key: K, value: V): void;
|
|
1434
|
+
/**
|
|
1435
|
+
* Delete a specific key from the cache.
|
|
1436
|
+
*/
|
|
1437
|
+
delete(key: K): boolean;
|
|
1438
|
+
/**
|
|
1439
|
+
* Clear all entries from the cache.
|
|
1440
|
+
*/
|
|
1441
|
+
clear(): void;
|
|
1442
|
+
/**
|
|
1443
|
+
* Get the current number of entries.
|
|
1444
|
+
*/
|
|
1445
|
+
get size(): number;
|
|
1446
|
+
/**
|
|
1447
|
+
* Get all keys (for debugging/testing).
|
|
1448
|
+
*/
|
|
1449
|
+
keys(): IterableIterator<K>;
|
|
1450
|
+
/**
|
|
1451
|
+
* Get all values (for debugging/testing).
|
|
1452
|
+
*/
|
|
1453
|
+
values(): V[];
|
|
1454
|
+
}
|
|
1455
|
+
/**
|
|
1456
|
+
* Extract API specification from TypeScript source files.
|
|
1457
|
+
*
|
|
1458
|
+
* Analyzes exports from the entry file, serializes them to OpenPkg spec format,
|
|
1459
|
+
* and detects forgotten exports (types referenced but not exported).
|
|
1460
|
+
*
|
|
1461
|
+
* @param options - Extraction configuration
|
|
1462
|
+
* @param options.entryFile - Path to the entry TypeScript file
|
|
1463
|
+
* @param options.baseDir - Base directory for resolving imports (defaults to entryFile dir)
|
|
1464
|
+
* @param options.content - Optional in-memory source content (skips file read)
|
|
1465
|
+
* @param options.maxTypeDepth - Max depth for nested type resolution (default: 10)
|
|
1466
|
+
* @param options.only - Glob patterns to include (e.g., ["get*", "create*"])
|
|
1467
|
+
* @param options.ignore - Glob patterns to exclude (e.g., ["*Internal", "_*"])
|
|
1468
|
+
* @param options.onProgress - Callback fired for each export: (current, total, name) => void
|
|
1469
|
+
* @param options.isDtsSource - Set true when extracting from .d.ts (enables degraded mode)
|
|
1470
|
+
* @param options.externals - Config for resolving re-exports from external packages
|
|
1471
|
+
*
|
|
1472
|
+
* @returns Promise resolving to extraction result
|
|
1473
|
+
* @returns result.spec - The OpenPkg specification object
|
|
1474
|
+
* @returns result.diagnostics - Warnings/errors encountered during extraction
|
|
1475
|
+
* @returns result.verification - Stats comparing discovered vs extracted exports
|
|
1476
|
+
* @returns result.forgottenExports - Types referenced but not exported (internal only)
|
|
1477
|
+
*
|
|
1478
|
+
* @example
|
|
1479
|
+
* ```ts
|
|
1480
|
+
* import { extract } from '@openpkg-ts/sdk';
|
|
1481
|
+
*
|
|
1482
|
+
* const { spec, diagnostics } = await extract({
|
|
1483
|
+
* entryFile: './src/index.ts',
|
|
1484
|
+
* onProgress: (i, total, name) => console.log(`${i}/${total}: ${name}`),
|
|
1485
|
+
* });
|
|
1486
|
+
* ```
|
|
1487
|
+
*
|
|
1488
|
+
* @remarks
|
|
1489
|
+
* - Caches are cleared before and after extraction (via try/finally)
|
|
1490
|
+
* - Progress callback yields to event loop every 5 exports for UI responsiveness
|
|
1491
|
+
* - External package re-exports require explicit `externals.include` patterns
|
|
1492
|
+
*/
|
|
1298
1493
|
declare function extract(options: ExtractOptions): Promise<ExtractResult>;
|
|
1299
|
-
import
|
|
1494
|
+
import ts7 from "typescript";
|
|
1300
1495
|
interface ProgramOptions {
|
|
1301
1496
|
entryFile: string;
|
|
1302
1497
|
baseDir?: string;
|
|
1303
1498
|
content?: string;
|
|
1304
1499
|
}
|
|
1305
1500
|
interface ProgramResult {
|
|
1306
|
-
program:
|
|
1307
|
-
compilerHost:
|
|
1308
|
-
compilerOptions:
|
|
1309
|
-
sourceFile?:
|
|
1501
|
+
program: ts7.Program;
|
|
1502
|
+
compilerHost: ts7.CompilerHost;
|
|
1503
|
+
compilerOptions: ts7.CompilerOptions;
|
|
1504
|
+
sourceFile?: ts7.SourceFile;
|
|
1310
1505
|
configPath?: string;
|
|
1311
1506
|
/** Resolved project references (workspace packages) */
|
|
1312
|
-
projectReferences?:
|
|
1507
|
+
projectReferences?: ts7.ResolvedProjectReference[];
|
|
1313
1508
|
}
|
|
1314
1509
|
declare function createProgram({ entryFile, baseDir, content }: ProgramOptions): ProgramResult;
|
|
1315
1510
|
import * as TS from "typescript";
|
|
@@ -1365,34 +1560,34 @@ declare const arktypeAdapter: SchemaAdapter;
|
|
|
1365
1560
|
declare const typeboxAdapter: SchemaAdapter;
|
|
1366
1561
|
declare const valibotAdapter: SchemaAdapter;
|
|
1367
1562
|
declare const zodAdapter: SchemaAdapter;
|
|
1368
|
-
import { SpecExport as SpecExport7 } from "@openpkg-ts/spec";
|
|
1369
|
-
import ts6 from "typescript";
|
|
1370
|
-
declare function serializeClass(node: ts6.ClassDeclaration, ctx: SerializerContext): SpecExport7 | null;
|
|
1371
|
-
import { SpecExport as SpecExport8 } from "@openpkg-ts/spec";
|
|
1372
|
-
import ts7 from "typescript";
|
|
1373
|
-
declare function serializeEnum(node: ts7.EnumDeclaration, ctx: SerializerContext): SpecExport8 | null;
|
|
1374
1563
|
import { SpecExport as SpecExport9 } from "@openpkg-ts/spec";
|
|
1375
1564
|
import ts8 from "typescript";
|
|
1376
|
-
declare function
|
|
1565
|
+
declare function serializeClass(node: ts8.ClassDeclaration, ctx: SerializerContext): SpecExport9 | null;
|
|
1377
1566
|
import { SpecExport as SpecExport10 } from "@openpkg-ts/spec";
|
|
1378
1567
|
import ts9 from "typescript";
|
|
1379
|
-
declare function
|
|
1568
|
+
declare function serializeEnum(node: ts9.EnumDeclaration, ctx: SerializerContext): SpecExport10 | null;
|
|
1380
1569
|
import { SpecExport as SpecExport11 } from "@openpkg-ts/spec";
|
|
1381
1570
|
import ts10 from "typescript";
|
|
1382
|
-
declare function
|
|
1571
|
+
declare function serializeFunctionExport(node: ts10.FunctionDeclaration | ts10.ArrowFunction, ctx: SerializerContext, nameOverride?: string): SpecExport11 | null;
|
|
1383
1572
|
import { SpecExport as SpecExport12 } from "@openpkg-ts/spec";
|
|
1384
1573
|
import ts11 from "typescript";
|
|
1385
|
-
declare function
|
|
1386
|
-
import {
|
|
1574
|
+
declare function serializeInterface(node: ts11.InterfaceDeclaration, ctx: SerializerContext): SpecExport12 | null;
|
|
1575
|
+
import { SpecExport as SpecExport13 } from "@openpkg-ts/spec";
|
|
1387
1576
|
import ts12 from "typescript";
|
|
1388
|
-
declare function
|
|
1577
|
+
declare function serializeTypeAlias(node: ts12.TypeAliasDeclaration, ctx: SerializerContext): SpecExport13 | null;
|
|
1578
|
+
import { SpecExport as SpecExport14 } from "@openpkg-ts/spec";
|
|
1579
|
+
import ts13 from "typescript";
|
|
1580
|
+
declare function serializeVariable(node: ts13.VariableDeclaration, statement: ts13.VariableStatement, ctx: SerializerContext): SpecExport14 | null;
|
|
1581
|
+
import { SpecSignatureParameter } from "@openpkg-ts/spec";
|
|
1582
|
+
import ts14 from "typescript";
|
|
1583
|
+
declare function extractParameters(signature: ts14.Signature, ctx: SerializerContext): SpecSignatureParameter[];
|
|
1389
1584
|
/**
|
|
1390
1585
|
* Recursively register types referenced by a ts.Type.
|
|
1391
1586
|
* Uses ctx.visitedTypes to prevent infinite recursion on circular types.
|
|
1392
1587
|
*/
|
|
1393
|
-
declare function registerReferencedTypes(type:
|
|
1588
|
+
declare function registerReferencedTypes(type: ts14.Type, ctx: SerializerContext, depth?: number): void;
|
|
1394
1589
|
import { SpecSchema as SpecSchema2 } from "@openpkg-ts/spec";
|
|
1395
|
-
import
|
|
1590
|
+
import ts15 from "typescript";
|
|
1396
1591
|
/**
|
|
1397
1592
|
* Built-in type schemas with JSON Schema format hints.
|
|
1398
1593
|
* Used for types that have specific serialization formats.
|
|
@@ -1411,7 +1606,7 @@ declare function isPrimitiveName(name: string): boolean;
|
|
|
1411
1606
|
* getTypeOrigin(trpcRouterType) // Returns '@trpc/server'
|
|
1412
1607
|
* getTypeOrigin(localUserType) // Returns undefined
|
|
1413
1608
|
*/
|
|
1414
|
-
declare function getTypeOrigin(type:
|
|
1609
|
+
declare function getTypeOrigin(type: ts15.Type, _checker: ts15.TypeChecker): string | undefined;
|
|
1415
1610
|
/**
|
|
1416
1611
|
* Check if a name is a built-in generic type
|
|
1417
1612
|
*/
|
|
@@ -1419,18 +1614,18 @@ declare function isBuiltinGeneric(name: string): boolean;
|
|
|
1419
1614
|
/**
|
|
1420
1615
|
* Check if a type is anonymous (no meaningful symbol name)
|
|
1421
1616
|
*/
|
|
1422
|
-
declare function isAnonymous(type:
|
|
1617
|
+
declare function isAnonymous(type: ts15.Type): boolean;
|
|
1423
1618
|
/**
|
|
1424
1619
|
* Ensure schema is non-empty — fallback to x-ts-type string representation if empty.
|
|
1425
1620
|
* Never emit {} as a schema; always include meaningful type info.
|
|
1426
1621
|
*/
|
|
1427
|
-
declare function ensureNonEmptySchema(schema: SpecSchema2, type:
|
|
1622
|
+
declare function ensureNonEmptySchema(schema: SpecSchema2, type: ts15.Type, checker: ts15.TypeChecker): SpecSchema2;
|
|
1428
1623
|
/**
|
|
1429
1624
|
* Build a structured SpecSchema from a TypeScript type.
|
|
1430
1625
|
* Uses $ref for named types and typeArguments for generics.
|
|
1431
1626
|
* Guarantees non-empty schema output via ensureNonEmptySchema wrapper.
|
|
1432
1627
|
*/
|
|
1433
|
-
declare function buildSchema(type:
|
|
1628
|
+
declare function buildSchema(type: ts15.Type, checker: ts15.TypeChecker, ctx?: SerializerContext, _depth?: number): SpecSchema2;
|
|
1434
1629
|
/**
|
|
1435
1630
|
* Check if a schema is a pure $ref (only has $ref property)
|
|
1436
1631
|
*/
|
|
@@ -1441,7 +1636,7 @@ declare function isPureRefSchema(schema: SpecSchema2): schema is {
|
|
|
1441
1636
|
* Add description to a schema, handling $ref properly.
|
|
1442
1637
|
* For pure $ref schemas, wraps in allOf to preserve the reference.
|
|
1443
1638
|
*/
|
|
1444
|
-
declare function
|
|
1639
|
+
declare function withDescription2(schema: SpecSchema2, description: string): SpecSchema2;
|
|
1445
1640
|
/**
|
|
1446
1641
|
* Check if a schema represents the 'any' type
|
|
1447
1642
|
*/
|
|
@@ -1458,8 +1653,8 @@ declare function deduplicateSchemas(schemas: SpecSchema2[]): SpecSchema2[];
|
|
|
1458
1653
|
* Find a discriminator property in a union of object types (tagged union pattern).
|
|
1459
1654
|
* A valid discriminator has a unique literal value in each union member.
|
|
1460
1655
|
*/
|
|
1461
|
-
declare function findDiscriminatorProperty(unionTypes:
|
|
1462
|
-
import { SpecExport as
|
|
1656
|
+
declare function findDiscriminatorProperty(unionTypes: ts15.Type[], checker: ts15.TypeChecker): string | undefined;
|
|
1657
|
+
import { SpecExport as SpecExport15, SpecMember as SpecMember3, SpecSchema as SpecSchema3, SpecType as SpecType6 } from "@openpkg-ts/spec";
|
|
1463
1658
|
/**
|
|
1464
1659
|
* Options for schema normalization
|
|
1465
1660
|
*/
|
|
@@ -1490,7 +1685,7 @@ declare function normalizeSchema(schema: SpecSchema3, options?: NormalizeOptions
|
|
|
1490
1685
|
* 2. Normalize member schemas
|
|
1491
1686
|
* 3. Generate a JSON Schema from members if members exist (populates `schema` field)
|
|
1492
1687
|
*/
|
|
1493
|
-
declare function normalizeExport(exp:
|
|
1688
|
+
declare function normalizeExport(exp: SpecExport15, options?: NormalizeOptions): SpecExport15;
|
|
1494
1689
|
/**
|
|
1495
1690
|
* Normalize a SpecType, normalizing its schema and nested schemas.
|
|
1496
1691
|
*
|
|
@@ -1499,7 +1694,7 @@ declare function normalizeExport(exp: SpecExport13, options?: NormalizeOptions):
|
|
|
1499
1694
|
* 2. Normalize member schemas
|
|
1500
1695
|
* 3. Generate a JSON Schema from members if members exist (populates `schema` field)
|
|
1501
1696
|
*/
|
|
1502
|
-
declare function normalizeType(type:
|
|
1697
|
+
declare function normalizeType(type: SpecType6, options?: NormalizeOptions): SpecType6;
|
|
1503
1698
|
/**
|
|
1504
1699
|
* Convert a members array to JSON Schema properties format.
|
|
1505
1700
|
*
|
|
@@ -1521,7 +1716,7 @@ declare function normalizeType(type: SpecType5, options?: NormalizeOptions): Spe
|
|
|
1521
1716
|
* @returns JSON Schema object with properties, required, and additionalProperties
|
|
1522
1717
|
*/
|
|
1523
1718
|
declare function normalizeMembers(members: SpecMember3[], options?: NormalizeOptions): JSONSchema;
|
|
1524
|
-
import
|
|
1525
|
-
declare function isExported(node:
|
|
1526
|
-
declare function getNodeName(node:
|
|
1527
|
-
export { zodAdapter, withDescription, valibotAdapter, typeboxAdapter, toSearchIndexJSON, toSearchIndex2 as toSearchIndex, toPagefindRecords2 as toPagefindRecords, toNavigation2 as toNavigation, toMarkdown2 as toMarkdown, toJSONString, toJSON2 as toJSON, toHTML2 as toHTML, toFumadocsMetaJSON, toDocusaurusSidebarJS, toAlgoliaRecords2 as toAlgoliaRecords, sortByName, serializeVariable, serializeTypeAlias, serializeInterface, serializeFunctionExport, serializeEnum, serializeClass, schemasAreEqual, schemaIsAny, resolveTypeRef, resolveExportTarget, resolveCompiledPath, registerReferencedTypes, registerAdapter, recommendSemverBump, normalizeType, normalizeSchema, normalizeMembers, normalizeExport, mergeConfig, loadSpec, loadConfig, listExports, isTypeReference, isTypeOnlyExport, isSymbolDeprecated, isStandardJSONSchema, isSchemaType, isPureRefSchema, isProperty, isPrimitiveName, isMethod, isExported, isBuiltinGeneric, isAnonymous, hasDeprecatedTag, groupByVisibility, getTypeOrigin, getSourceLocation, getProperties, getParamDescription, getNonNullableType, getNodeName, getMethods, getMemberBadges, getJSDocComment, getExport2 as getExport, getDeprecationMessage, toMarkdown2 as generateDocs, formatTypeParameters, formatSchema, formatReturnType, formatParameters, formatMappedType, formatConditionalType, formatBadges, findMissingParamDocs, findDiscriminatorProperty, findAdapter, filterSpec, extractTypeParameters, extractStandardSchemasFromTs, extractStandardSchemasFromProject, extractStandardSchemas, extractSpec, extractSchemaType, extractParameters, extract, exportToMarkdown, ensureNonEmptySchema, diffSpec2 as diffSpecs, diffSpec, detectTsRuntime, deduplicateSchemas, createProgram, createDocs, categorizeBreakingChanges, calculateNextVersion, buildSignatureString, buildSchema, arktypeAdapter, analyzeSpec, TypeRegistry, TypeReference2 as TypeReference, TsRuntime, StandardSchemaExtractionResult, StandardSchemaExtractionOutput, StandardJSONSchemaV1, StandardJSONSchemaTarget, StandardJSONSchemaOptions, SpecMappedType, SpecDiff, SpecDiagnostics, SpecConditionalType, SkippedExportDetail, SimplifiedSpec, SimplifiedSignature, SimplifiedReturn, SimplifiedParameter, SimplifiedMember, SimplifiedExport, SimplifiedExample, SerializerContext, SemverRecommendation, SemverBump, SearchRecord, SearchOptions, SearchIndex, SchemaExtractionResult, SchemaAdapter, ProjectExtractionOutput, ProjectExtractionInfo, ProgramResult, ProgramOptions, PagefindRecord, OpenpkgConfig, NormalizeOptions, NavOptions, NavItem, NavGroup, NavFormat, MemberChangeInfo, MarkdownOptions, LoadOptions, ListExportsResult, ListExportsOptions, JSONSchema, JSONOptions, HTMLOptions, GroupBy, GetExportResult, GetExportOptions, GenericNav, FumadocsMetaItem, FumadocsMeta, FormatSchemaOptions, ForgottenExport, FilterResult, FilterCriteria, ExtractStandardSchemasOptions, ExtractResult, ExtractOptions, ExtractFromProjectOptions, ExternalsConfig, ExportVerification, ExportTracker, ExportMarkdownOptions, ExportItem, DocusaurusSidebarItem, DocusaurusSidebar, DocsInstance, DiagnosticItem, Diagnostic, CategorizedBreaking, CONFIG_FILENAME, BreakingSeverity, BUILTIN_TYPE_SCHEMAS, AlgoliaRecord, ARRAY_PROTOTYPE_METHODS };
|
|
1719
|
+
import ts16 from "typescript";
|
|
1720
|
+
declare function isExported(node: ts16.Node): boolean;
|
|
1721
|
+
declare function getNodeName(node: ts16.Node): string | undefined;
|
|
1722
|
+
export { zodAdapter, withDescription2 as withDescription, valibotAdapter, typeboxAdapter, toSearchIndexJSON, toSearchIndex2 as toSearchIndex, toReactString, toReact, toPagefindRecords2 as toPagefindRecords, toNavigation2 as toNavigation, toMarkdown2 as toMarkdown, toJSONString, toJSON2 as toJSON, toHTML2 as toHTML, toFumadocsMetaJSON, toDocusaurusSidebarJS, toAlgoliaRecords2 as toAlgoliaRecords, sortByName, serializeVariable, serializeTypeAlias, serializeInterface, serializeFunctionExport, serializeEnum, serializeClass, schemasAreEqual, schemaIsAny, resolveTypeRef, resolveExportTarget, resolveCompiledPath, registerReferencedTypes, registerAdapter, recommendSemverBump, query, normalizeType, normalizeSchema, normalizeMembers, normalizeExport, mergeConfig, loadSpec, loadConfig, listExports, isTypeReference, isTypeOnlyExport, isSymbolDeprecated, isStandardJSONSchema, isSchemaType, isPureRefSchema, isProperty, isPrimitiveName, isMethod, isExported, isBuiltinGeneric, isAnonymous, hasDeprecatedTag, groupByVisibility, getTypeOrigin, getSourceLocation, getProperties, getParamDescription, getNonNullableType, getNodeName, getMethods, getMemberBadges, getJSDocComment, getExport2 as getExport, getDeprecationMessage, toMarkdown2 as generateDocs, formatTypeParameters, formatSchema, formatReturnType, formatParameters, formatMappedType, formatConditionalType, formatBadges, findMissingParamDocs, findDiscriminatorProperty, findAdapter, filterSpec, extractTypeParameters, extractStandardSchemasFromTs, extractStandardSchemasFromProject, extractStandardSchemas, extractSpec, extractSchemaType, extractParameters, extract, exportToMarkdown, ensureNonEmptySchema, diffSpec2 as diffSpecs, diffSpec, detectTsRuntime, deduplicateSchemas, createProgram, createDocs, categorizeBreakingChanges, calculateNextVersion, buildSignatureString, buildSchema, arktypeAdapter, analyzeSpec, TypeRegistry, TypeReference2 as TypeReference, TsRuntime, StandardSchemaExtractionResult, StandardSchemaExtractionOutput, StandardJSONSchemaV1, StandardJSONSchemaTarget, StandardJSONSchemaOptions, SpecMappedType, SpecDiff, SpecDiagnostics, SpecConditionalType, SkippedExportDetail, SimplifiedSpec, SimplifiedSignature, SimplifiedReturn, SimplifiedParameter, SimplifiedMember, SimplifiedExport, SimplifiedExample, SerializerContext, SemverRecommendation, SemverBump, SearchRecord, SearchOptions, SearchIndex, SchemaExtractionResult, SchemaAdapter, ReactLayoutOptions, QueryBuilder, ProjectExtractionOutput, ProjectExtractionInfo, ProgramResult, ProgramOptions, PagefindRecord, OpenpkgConfig, NormalizeOptions, NavOptions, NavItem, NavGroup, NavFormat, MemberChangeInfo, MarkdownOptions, LoadOptions, ListExportsResult, ListExportsOptions, JSONSchema, JSONOptions, HTMLOptions, GroupBy, GetExportResult, GetExportOptions, GenericNav, FumadocsMetaItem, FumadocsMeta, FormatSchemaOptions, ForgottenExport, FilterResult, FilterCriteria, ExtractStandardSchemasOptions, ExtractResult, ExtractOptions, ExtractFromProjectOptions, ExternalsConfig, ExportVerification, ExportTracker, ExportMarkdownOptions, ExportItem, DocusaurusSidebarItem, DocusaurusSidebar, DocsInstance, DiagnosticItem, Diagnostic, CategorizedBreaking, CacheManagerOptions, CacheManager, CONFIG_FILENAME, BreakingSeverity, BUILTIN_TYPE_SCHEMAS, AlgoliaRecord, ARRAY_PROTOTYPE_METHODS };
|