@http-forge/core 0.4.7 → 0.4.8
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 +29 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +196 -196
- package/dist/index.mjs +196 -196
- package/dist/infrastructure/auth/oauth2-token-manager.d.ts +1 -1
- package/dist/infrastructure/script/interfaces.d.ts +1 -0
- package/dist/infrastructure/script/request-script-session.d.ts +13 -0
- package/dist/infrastructure/script/script-factories.d.ts +1 -0
- package/dist/runtime/mcp-tool-name.d.ts +46 -0
- package/dist/runtime/mcp-tool-schemas.d.ts +170 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -252,6 +252,35 @@ if (pm.response.headers.has('Set-Cookie')) {
|
|
|
252
252
|
}
|
|
253
253
|
```
|
|
254
254
|
|
|
255
|
+
#### Response Body Type
|
|
256
|
+
|
|
257
|
+
Like Postman, `pm.response.body` is the **raw response string** — it is not eagerly parsed. Parse JSON on demand:
|
|
258
|
+
|
|
259
|
+
```javascript
|
|
260
|
+
const data = pm.response.json(); // parsed object (null if not JSON)
|
|
261
|
+
const text = pm.response.text(); // raw string
|
|
262
|
+
const obj = JSON.parse(pm.response.body); // body is a string
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
`json()` tolerates an already-parsed object body for backward compatibility, but new code should treat `pm.response.body` as a string.
|
|
266
|
+
|
|
267
|
+
#### Legacy Postman Globals
|
|
268
|
+
|
|
269
|
+
Older Postman scripts and many Newman-exported collections rely on bare globals from the pre-`pm.*` sandbox. The core injects these so legacy scripts run unchanged.
|
|
270
|
+
|
|
271
|
+
Available in **both** pre-request and test scripts: `request` (`{ id, name, description, url, method, headers, data }`), `environment` (read snapshot), `globals` (read snapshot), `data` (iteration row), `iteration` (index), and `tv4` (`tv4.validate(data, schema)` — when the optional `tv4` module is installed).
|
|
272
|
+
|
|
273
|
+
Available in **test** scripts only: `responseBody` (raw string), `responseCode` (`{ code, name, detail }`), `responseHeaders`, `responseTime`, `responseCookies` (`[{ name, value }]`), `tests` (`tests['name'] = boolean`), plus `postman.getResponseHeader(name)` and `postman.getResponseCookie(name)` (case-insensitive, return `null` if absent).
|
|
274
|
+
|
|
275
|
+
```javascript
|
|
276
|
+
// Legacy-style test script — runs unmodified
|
|
277
|
+
tests['status 200'] = responseCode.code === 200;
|
|
278
|
+
tests['has token'] = JSON.parse(responseBody).token !== undefined;
|
|
279
|
+
tests['is json'] = /application\/json/.test(postman.getResponseHeader('Content-Type'));
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
> `environment` and `globals` are read snapshots — direct assignment was never persisted in legacy Postman either. Use `postman.setEnvironmentVariable()` / `postman.setGlobalVariable()` (or the modern `pm.environment.set()` / `pm.globals.set()`) to persist changes.
|
|
283
|
+
|
|
255
284
|
#### Script Scope
|
|
256
285
|
|
|
257
286
|
Control how script levels (collection → folder → request) and the pre-request/post-response phases share a JavaScript scope via `scripts.scope` in `http-forge.config.json` (or the `scriptScope` SDK option):
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,9 @@ export { ForgeContainer } from './container';
|
|
|
20
20
|
export type { ForgeContainerOptions, StorageFormat } from './container';
|
|
21
21
|
export { getServiceContainer, registerCoreServices, ServiceContainer, ServiceIdentifiers } from './di';
|
|
22
22
|
export type { PlatformAdapters, ServiceIdentifier } from './di';
|
|
23
|
+
export { buildCollectionToolDescription, buildCollectionToolName, buildFolderToolDescription, buildFolderToolName, buildRequestToolDescription, buildRequestToolName, buildSuiteToolDescription, buildSuiteToolName, mcpToolToken, parseMcpToolName, resolveFolderToken, resolveToken } from './runtime/mcp-tool-name';
|
|
24
|
+
export type { McpToolKind, ParsedMcpToolName } from './runtime/mcp-tool-name';
|
|
25
|
+
export { COLLECTION_INPUT_SCHEMA, FOLDER_INPUT_SCHEMA, REQUEST_INPUT_SCHEMA, SUITE_INPUT_SCHEMA } from './runtime/mcp-tool-schemas';
|
|
23
26
|
export { createMcpRuntime, runCollection, runFolder, runRequest, runSuite } from './runtime/runtime-contracts';
|
|
24
27
|
export type { McpRuntimeHandle, McpRuntimeOptions, RunCollectionOptions, RunRequestOptions, RunSuiteOptions } from './runtime/runtime-contracts';
|
|
25
28
|
export { bootstrapNodeRuntime, createNodeContainer } from './runtime/node-bootstrap';
|