{"id":47966,"library":"graphql-type-long","title":"graphql-type-long","description":"A GraphQL scalar type that extends 52-bit signed integer support for GraphQL.js. Current version 0.1.1, low release cadence. Enables serialization and parsing of integers beyond JavaScript's safe integer range (up to 52 bits). Compared to other GraphQL integer types (e.g., BigInt), this provides a lightweight solution for 52-bit integers without external dependencies. Peer dependency on GraphQL 0.9-0.13. Not actively maintained, but functional for legacy projects.","status":"maintenance","version":"0.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/chadlieberman/graphql-type-long","tags":["javascript","graphql","long"],"install":[{"cmd":"npm install graphql-type-long","lang":"bash","label":"npm"},{"cmd":"yarn add graphql-type-long","lang":"bash","label":"yarn"},{"cmd":"pnpm add graphql-type-long","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; required to define and use custom scalar types","package":"graphql","optional":true}],"imports":[{"note":"Default export in ESM; CommonJS require may need '.default' depending on bundler settings.","wrong":"const GraphQLLong = require('graphql-type-long').default","symbol":"GraphQLLong","correct":"import GraphQLLong from 'graphql-type-long'"},{"note":"In CommonJS, require returns the module exports object, so accessing .default is needed for the type.","wrong":"const GraphQLLong = require('graphql-type-long')","symbol":"GraphQLLong","correct":"const GraphQLLong = require('graphql-type-long').default"},{"note":"Named import also works if the environment supports package.json exports; but default import is more reliable.","wrong":"import { GraphQLLong as Long } from 'graphql-type-long'","symbol":"GraphQLLong","correct":"import { GraphQLLong } from 'graphql-type-long'"}],"quickstart":{"code":"import { GraphQLObjectType, GraphQLSchema, GraphQLString } from 'graphql';\nimport GraphQLLong from 'graphql-type-long';\n\nconst schema = new GraphQLSchema({\n  query: new GraphQLObjectType({\n    name: 'Query',\n    fields: {\n      largeNumber: {\n        type: GraphQLLong,\n        resolve: () => 9007199254740991,\n      },\n      echo: {\n        type: GraphQLLong,\n        args: { input: { type: GraphQLLong } },\n        resolve: (_, { input }) => input,\n      },\n    },\n  }),\n});\n\n// Query: { echo(input: 9007199254740991) }","lang":"typescript","description":"Shows how to define a GraphQL schema using the GraphQLLong scalar type with a query and a mutation argument."},"warnings":[{"fix":"Use a more modern package like graphql-bigint or implement custom scalar type for GraphQL v15+.","message":"Package uses older peer dependency graphql@^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0. Not updated for GraphQL v15 or v16. May have compatibility issues with newer GraphQL versions.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Use const GraphQLLong = require('graphql-type-long').default","message":"If using CommonJS require, you must access the .default property. Direct require returns an object with default property.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Ensure all input/output values are within the 52-bit signed integer range. For larger values, use BigInt or a custom scalar.","message":"GraphQLLong only supports integers within the safe 52-bit range (-4503599627370496 to 4503599627370495). Values outside this range may cause precision loss or errors.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"For precise handling of 52-bit integers, consider using strings if JSON transport is required.","message":"GraphQL-Long serializes integers as numbers. JavaScript numbers are 64-bit floats with 53-bit integer precision; be cautious of rounding for values near the upper bound.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'-0.13':65 '0.1.1':20 '0.9':64 '52':11,38,54 'activ':67 'beyond':30 'bigint':47 'bit':12,39,55 'cadenc':23 'compar':40 'current':18 'depend':59,61 'e.g':46 'enabl':24 'extend':10 'extern':58 'function':70 'graphql':2,6,43,63,75 'graphql-type-long':1 'graphql.js':17 'integ':14,29,34,44,56 'javascript':31,74 'legaci':72 'lightweight':51 'long':4,76 'low':21 'maintain':68 'pars':27 'peer':60 'project':73 'provid':49 'rang':35 'releas':22 'safe':33 'scalar':7 'serial':25 'sign':13 'solut':52 'support':15 'type':3,8,45 'version':19 'without':57","created_at":"2026-06-07T16:54:14.772711+00:00","updated_at":"2026-06-07T16:54:14.772711+00:00","problems":[{"fix":"Use const GraphQLLong = require('graphql-type-long').default","cause":"Using require('graphql-type-long') without .default in CommonJS environment.","error":"TypeError: Cannot read properties of undefined (reading 'prototype')"},{"fix":"Ensure you import GraphQLLong correctly: import GraphQLLong from 'graphql-type-long'","cause":"Improper import where GraphQLLong is not correctly instantiated as a GraphQL scalar.","error":"Error: GraphQLLong must be an instance of GraphQLScalarType"},{"fix":"Add GraphQLLong to your schema configuration as shown in the quickstart code.","cause":"Attempting to use GraphQLLong without adding it to the schema types.","error":"Unknown type \"Long\". Did you mean \"Float\" or \"Int\"?"},{"fix":"Ensure input is a 52-bit integer within range, provided as a plain number without scientific notation.","cause":"Input value exceeds the 52-bit integer range or is represented in scientific notation.","error":"Expected value of type \"Long\" but received: 1e+21"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/chadlieberman/graphql-type-long#readme","github":"https://github.com/chadlieberman/graphql-type-long","docs":null,"changelog":null,"pypi":null,"npm":"graphql-type-long","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}