@apifn/core 0.0.4 → 0.1.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
@@ -5,9 +5,11 @@ Core JavaScript/TypeScript library for ApiFn — route introspection, schema con
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install @apifn/core
8
+ npm install @apifn/core @superfunctions/http
9
9
  ```
10
10
 
11
+ `@superfunctions/http` (`>=0.2.0 <0.4.0`) is a required peer. `@sinclair/typebox` and `@testfn/core` are optional peers: install them only to convert TypeBox schemas or to use the testFn adapter from `@apifn/core/testfn`, which also needs `@apifn/collections`.
12
+
11
13
  ## Features
12
14
 
13
15
  - **Route Introspection** — Walk a `@superfunctions/http` router and describe every route (parameters, request bodies, responses, security)
@@ -217,10 +219,14 @@ const logger = createCliLogger({ /* CliLoggerOptions */ });
217
219
 
218
220
  ### testfn
219
221
 
220
- Adapter that plugs ApiFn collection runs into testfn.
222
+ Adapter that plugs ApiFn collection runs into testfn. It lives in the `@apifn/core/testfn` subpath so that the root entry never loads testFn; install `@testfn/core` (`>=0.0.2 <0.1.0`) and `@apifn/collections` at the release that matches your `@apifn/core` yourself to use it. Importing the subpath without `@testfn/core` fails with a module-not-found error naming `@testfn/core`; the adapter loads `@apifn/collections` when `discover()` or `run()` is called, and those calls fail with an error naming `@apifn/collections` if it is missing. Installing `@apifn/core` alone installs neither package. `@testfn/core` is ESM-only: the CommonJS build of `@apifn/core/testfn` `require()`s it, so CommonJS use needs a Node.js version with `require(esm)` (20.19+ or 22.12+), and its CommonJS type declarations import `@testfn/core` with `resolution-mode` `import`, which needs TypeScript 5.3+.
223
+
224
+ ```bash
225
+ npm install @testfn/core @apifn/collections
226
+ ```
221
227
 
222
228
  ```typescript
223
- import { ApifnTestAdapter } from "@apifn/core";
229
+ import { ApifnTestAdapter } from "@apifn/core/testfn";
224
230
  ```
225
231
 
226
232
  ---
@@ -242,12 +248,13 @@ export { fetchEndpointMetrics, createWatchFnClient, apifnWatchMiddleware }
242
248
  export { mintTestToken, createAuthfnCollectionMiddleware }
243
249
  export { fetchRateLimits }
244
250
  export { logfnReporter, createCliLogger }
245
- export { ApifnTestAdapter }
246
251
 
247
252
  // Types — HTTP, OpenAPI document objects, introspection descriptors,
248
253
  // diff, validation, snippets, mock, and integration types
249
254
  ```
250
255
 
256
+ The `@apifn/core/testfn` subpath exports `ApifnTestAdapter` and needs the optional `@testfn/core` peer and `@apifn/collections`.
257
+
251
258
  The `@apifn/core/types` subpath exports the shared model types declared by the core package, including HTTP/OpenAPI, schema, diff, validation, snippet, mock, and integration data shapes. Types declared alongside runtime modules, such as `FromRouterOptions`, `SchemaType`, and `DiffReportJson`, are exported from the package root.
252
259
 
253
260
  ## License