@openpkg-ts/sdk 0.33.1 → 0.34.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 CHANGED
@@ -8,10 +8,22 @@ Programmatic SDK for TypeScript API extraction and documentation generation.
8
8
  npm install @openpkg-ts/sdk
9
9
  ```
10
10
 
11
+ ## Entry Points
12
+
13
+ ```typescript
14
+ // Full SDK (Node.js)
15
+ import { listExports, extractSpec, query } from '@openpkg-ts/sdk';
16
+
17
+ // Browser-safe (no fs, path, etc.)
18
+ import { query, loadSpec } from '@openpkg-ts/sdk/browser';
19
+ ```
20
+
21
+ Use `@openpkg-ts/sdk/browser` in React, Vite, Next.js client components.
22
+
11
23
  ## Quick Start
12
24
 
13
25
  ```typescript
14
- import { listExports, getExport, extractSpec, createDocs, toMarkdown } from '@openpkg-ts/sdk';
26
+ import { listExports, getExport, extractSpec, createDocs } from '@openpkg-ts/sdk';
15
27
 
16
28
  // List all exports
17
29
  const { exports } = await listExports({ entryFile: './src/index.ts' });
@@ -170,6 +182,56 @@ const searchIndex = toSearchIndex(spec);
170
182
  const algoliaRecords = toAlgoliaRecords(spec, { indexName: 'api_docs' });
171
183
  ```
172
184
 
185
+ ## QueryBuilder API
186
+
187
+ Fluent API for querying specs. Available in both Node.js and browser entry points.
188
+
189
+ ```typescript
190
+ import { query } from '@openpkg-ts/sdk';
191
+ // or: import { query } from '@openpkg-ts/sdk/browser';
192
+
193
+ // Chain filters
194
+ const functions = query(spec)
195
+ .byKind('function')
196
+ .search('create')
197
+ .find();
198
+
199
+ // Multiple kinds
200
+ const classesAndInterfaces = query(spec)
201
+ .byKind('class', 'interface')
202
+ .find();
203
+
204
+ // Combine filters
205
+ const documented = query(spec)
206
+ .byKind('function')
207
+ .hasDescription()
208
+ .notDeprecated()
209
+ .find();
210
+
211
+ // Get single export
212
+ const createClient = query(spec).byName('createClient').first();
213
+
214
+ // Search by tags
215
+ const publicAPIs = query(spec).byTag('public').find();
216
+ ```
217
+
218
+ ### QueryBuilder Methods
219
+
220
+ | Method | Description |
221
+ |--------|-------------|
222
+ | `.byKind(...kinds)` | Filter by export kind |
223
+ | `.byName(...names)` | Filter by exact name |
224
+ | `.byId(...ids)` | Filter by export ID |
225
+ | `.byTag(...tags)` | Filter by tags |
226
+ | `.search(term)` | Search name/description |
227
+ | `.hasDescription()` | Only with descriptions |
228
+ | `.missingDescription()` | Only without descriptions |
229
+ | `.deprecated()` | Only deprecated |
230
+ | `.notDeprecated()` | Exclude deprecated |
231
+ | `.find()` | Return all matches |
232
+ | `.first()` | Return first match |
233
+ | `.count()` | Return match count |
234
+
173
235
  ## Query Utilities
174
236
 
175
237
  ```typescript
@@ -197,9 +259,22 @@ import type {
197
259
  FilterResult,
198
260
  SpecDiagnostics,
199
261
  DiffOptions,
262
+ QueryBuilder,
200
263
  } from '@openpkg-ts/sdk';
201
264
  ```
202
265
 
266
+ ## Browser Entry Point
267
+
268
+ `@openpkg-ts/sdk/browser` exports only browser-safe utilities:
269
+
270
+ - `query()` - QueryBuilder
271
+ - `loadSpec()` - Load spec from object
272
+ - `filterSpec()` - Filter spec by criteria
273
+ - `buildSignatureString()` - Format signatures
274
+ - Query utilities (formatParameters, getProperties, etc.)
275
+
276
+ No Node.js dependencies (fs, path, child_process).
277
+
203
278
  ## License
204
279
 
205
280
  MIT