Registry / devops / microfiber

microfiber

JSON →
library2.1.2jsnpmunverified

A library for querying and manipulating GraphQL Introspection Query results: find, remove, or clean specific types, fields, arguments, and subscriptions. Current stable version is 2.1.2, published on npm as 'microfiber' (also known as @anvilco/graphql-introspection-tools). Release cadence is irregular. Key differentiator: it powers SpectaQL for schema documentation. Supports Node >=14, ESM-only.

npm install microfiber
INSTALL
IMPORT
SIG · MICROFIBER
M
microfiber
devopsjavascriptv2.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Microfiber
import { Microfiber } from 'microfiber'
const Microfiber = require('microfiber')
ESM-only package; CommonJS require will fail.
Microfiber type
import type { Microfiber } from 'microfiber'
import { Microfiber } from '@anvilco/graphql-introspection-tools'
TypeScript type import is separate; also, the package is also published as @anvilco/graphql-introspection-tools but the main import path is 'microfiber'.

Creates a Microfiber instance from introspection results and gets the cleaned schema.

import { Microfiber } from 'microfiber'; const introspectionQueryResults = { data: { __schema: { queryType: { name: 'Query' }, mutationType: null, subscriptionType: null, types: [ { kind: 'OBJECT', name: 'Query', fields: [{ name: 'user', type: { kind: 'NON_NULL', ofType: { kind: 'OBJECT', name: 'User' } }, args: [] }] }, { kind: 'OBJECT', name: 'User', fields: [{ name: 'id', type: { kind: 'NON_NULL', ofType: { kind: 'SCALAR', name: 'ID' } }, args: [] }], interfaces: [] } ], directives: [] } } }; const microfiber = new Microfiber(introspectionQueryResults, { fixQueryAndMutationAndSubscriptionTypes: true, removeUnusedTypes: true, cleanupSchemaImmediately: true }); const cleaned = microfiber.getResponse(); console.log(JSON.stringify(cleaned, null, 2));
Debug
Known issues
breakingESM-only: Node <14 not supported; CommonJS require() fails.
fix
Use ESM imports or upgrade Node to >=14.
affects: >=2.0.0
gotchaOptions cleanupSchemaImmediately: true removes unused types immediately; later operations may be affected.
fix
Set cleanupSchemaImmediately: false to defer cleanup.
affects: >=1.0.0
gotchaDefault options removeUnusedTypes: true may remove types you intended to keep.
fix
Explicitly pass removeUnusedTypes: false if needed.
affects: >=1.0.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module not supported
Attempting to use CommonJS require('microfiber')
fix
Use dynamic import or switch to ESM: import { Microfiber } from 'microfiber'
TypeError: Microfiber is not a constructor
Using wrong import or destructuring incorrectly
fix
Ensure you use `import { Microfiber } from 'microfiber'` not default import.
Upgrade
Version history
2.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
microfiber — npm install microfiber · libregistry