← Back to README
- What m7Fetch is, supported runtimes (browser/ESM/Node), and when to use
Netvs. bareHTTP. - Key features at a glance: HTTP client, OpenAPI/custom specs, dynamic modules, batch/coordination.
2) Installation
- Getting the source into your project; recommended folder layout (alongside M7BootStrap).
- Minimal sanity check: instantiate
Netand perform a simple GET.
3) Quick Start
- Create a
Netinstance. - Make a GET and POST request.
- Load an OpenAPI spec and call an operation by
operationId. - Dynamically import a JS module via
Net.modules.
- Net hub: composition of
http,specs,modules, andbatch. - HTTP client: base URL resolution, JSON/urlencoded bodies, response formats.
- Specs: load OpenAPI/custom specs; dispatch by
operationId. - Modules: dynamic imports with simple registry.
- Batch/Sync loaders: coordinate many requests with concurrency control.
class Net(opts)— constructor, subsystems, and lifecycle.class HTTP— methods, option parsing, and response formats.specs.load(...)/specs.call(...)— loading and invoking operations.modules.load(id, url)— registering & importing modules.batch.run(loadList, onLoad, onFail, { awaitAll, limit })— orchestration entrypoint.
- Methods:
get,post,put,patch,delete,head,options. - Building URLs (base vs. absolute), headers, query params.
- Bodies: JSON, URL-encoded, FormData, text, blobs.
- Response formats:
body|full|raw; parsing JSON/text/blob. - Timeouts and AbortController notes.
- Per-instance vs. per-request options; merge behavior.
HTTP.FETCH_DEFAULTS— extending global defaults (e.g., credentials, mode).- Allowed fetch enums:
mode,cache,credentials,redirect,referrerPolicy, etc.
- Loading specs from URL, inline objects, or typed loaders.
- Calling operations by
operationId; method/path resolution. - Inferring request/response options from spec metadata.
- Dispatch by spec type (
x-type/conventions); GET vs. POST with payload. - How options propagate to HTTP layer.
- Registering modules by ID and URL; accessing exports.
- Caching/invalidations; error handling patterns.
BatchLoader.run(...): ID-keyed jobs, concurrency limit,{ awaitAll, limit }behavior.- Failure semantics: only
falsemarks a request as failed. context[id]result storage; when to use custom handlers.SyncLoader:require(),wrapper(),loaded()/failed()/success()states.- Writing custom batch handlers (store/validate/transform).
- Passing headers (e.g.,
Authorization) and credential modes. - CORS considerations; origin and cookie handling.
- Choosing
format: "full"for status/headers/body. - Preflight validation: duplicate IDs, unsupported methods.
- Using a debug logger/hook during development.
- Built-in limiter used by BatchLoader.
- Tuning
limitand tradeoffs (throughput vs. back-pressure).
15) Examples Library
- Plain HTTP usage: GET/POST with
fullresponses. - OpenAPI spec load +
operationIdcall. - Custom batch handler (validate/store/transform).
- Dynamic module load and invocation.
16) Troubleshooting
-
Common pitfalls and fixes:
- Duplicate batch IDs
- Invalid/unsupported HTTP methods
- Missing or mismatched spec type
- Non-object spec payloads
- Interpreting
falsecorrectly in handlers
17) Glossary
Net,HTTP,SpecManager,AutoLoader,ModuleManager,BatchLoader,SyncLoader,FETCH_DEFAULTS,format.
- MTL-10 summary: permitted vs. restricted use.
19) AI Disclosure
- Scope of AI assistance for docs/code and review process.
20) Changelog
- Versioned changes (API additions, behavior tweaks, deprecations).