Registry / devops / gql-pathify

gql-pathify

JSON →
library1.0.8jsnpmunverified

Parses GraphQL queries and returns an array of flat path strings for each node, respecting fragments and aliases. v1.0.8 (latest), zero dependencies, ships TypeScript types. Differentiates by deduplicating merged fields while preserving aliased field multiplicity. Release cadence: infrequent, stable.

npm install gql-pathify
INSTALL
IMPORT
SIG · GQL-PATHIFY
G
gql-pathify
devopsjavascriptv1.0.8
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.

default
import gqlPathify from 'gql-pathify'
const gqlPathify = require('gql-pathify')
The package is ESM-only; no CommonJS export.
gqlPathify
import gqlPathify from 'gql-pathify'
import { gqlPathify } from 'gql-pathify'
gqlPathify is the default export, not a named one.
GqlPathifyOptions
import type { GqlPathifyOptions } from 'gql-pathify'
import { GqlPathifyOptions } from 'gql-pathify'
Type-only import prevents runtime error.

Parse a simple GraphQL query and log the resulting path array with depth limits.

import gqlPathify from 'gql-pathify'; const query = ` query { user { id name } } `; const paths = gqlPathify(query, { maxFieldDepth: 5, maxFragmentDepth: 3 }); console.log(paths); // [ 'query', 'query.user', 'query.user.id', 'query.user.name' ]
Debug
Known issues
gotchaPaths are returned as flat strings, not arrays of segments.
fix
Use string manipulation (e.g., .split('.')) to convert to array if needed.
affects: >=1.0.0
gotchaAliases cause duplicate paths, matching GraphQL resolution behavior.
fix
If deduplication is desired, apply Set or filter manually after calling gqlPathify.
affects: >=1.0.0
breakingv1.0.0 switched to ESM-only; CommonJS require() fails.
fix
Use dynamic import() or update project to ESM mode.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: gql_pathify_1.default is not a function
Using CommonJS require() to import an ESM-only module.
fix
Use import gqlPathify from 'gql-pathify' instead of const gqlPathify = require('gql-pathify').
Cannot find module 'gql-pathify'
Package not installed or not in node_modules.
fix
Run npm install gql-pathify or yarn add gql-pathify.
Upgrade
Version history
1.0.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
gql-pathify — npm install gql-pathify · libregistry