thehardwarestore.ai

where AI agents shop for the right tools

$ show graphql-hive/graphql-scalars

[account ↗] [repo ↗] APPLICATION ★ 1931 141 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

This repository is a comprehensive library of custom GraphQL scalar types, intended to supplement the base GraphQL specification with precise, type-safe scalars for common data formats (e.g., UUID, DateTime, EmailAddress, PhoneNumber, IBAN, GeoJSON, ISBN, etc.). It exports over 80 scalar definitions as `GraphQLScalarType` instances, along with corresponding SDL type definitions, mock generators, and JSON Schema extensions. The architecture is clean and uniform: each scalar is implemented as a self-contained module with `serialize`, `parseValue`, and `parseLiteral` methods, leveraging a shared validation pattern via `createGraphQLError`. The library integrates seamlessly with GraphQL codegen via `extensions.codegenScalarType` and provides a `RegularExpression` factory for creating custom regex-based scalars. Production usage is as a dependency for GraphQL servers (Apollo, Yoga, etc.) where precise input validation and output formatting are required. The codebase is well-tested with per-scalar unit tests, integration tests for date/time scalars, and bundle-size checks. While the majority of scalars are simple regex or range validations, several modules (GeoJSON, IBAN, iso-date) demonstrate non-trivial validation logic and are safely reusable. The repository also includes a Next.js documentation website and automated release tooling via Changesets.

RATING7.9/10
QUALITY7.5/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS81
VELOCITY0.69
OPEN ISSUES53
CLOSED ISSUES156
LAST COMMIT1 month ago
tslib (npm) ^2.5.0
@babel/core (npm) 7.29.0
@babel/preset-env (npm) 7.29.2
@babel/preset-typescript (npm) 7.28.5
@changesets/changelog-github (npm) 0.6.0
@changesets/cli (npm) 2.30.0
@graphql-tools/merge (npm) 9.1.7
@graphql-tools/schema (npm) 10.0.31
@theguild/prettier-config (npm) 3.0.1
@types/mongodb (npm) 4.0.7
@types/node (npm) 24.12.0
@typescript-eslint/eslint-plugin (npm) 8.57.1
@typescript-eslint/parser (npm) 8.57.1
@vitest/utils (npm) 3.2.4
bob-the-bundler (npm) 7.0.1
cross-env (npm) 10.1.0
eslint (npm) 9.39.4
eslint-config-prettier (npm) 10.1.8
eslint-plugin-import (npm) 2.32.0
eslint-plugin-n (npm) 17.24.0
eslint-plugin-promise (npm) 7.2.1
graphql (npm) 17.0.2
graphql-16 (npm) npm:[email protected]
husky (npm) 9.1.7
json-bigint-patch (npm) 0.0.9
lint-staged (npm) 16.4.0
mockdate (npm) 3.0.5
mongodb (npm) 7.1.0
prettier (npm) 3.8.1
semver (npm) 7.7.4
typescript (npm) 5.9.3
vitest (npm) 3.2.4
Files by Type (count)
TypeScript
163
Other (.mdx)
80
JSON
12
JavaScript
8
Markdown
6
Other (no ext)
6
YAML
6
TSX
5
Lock File
4
Other (.snap)
4
Git Ignore
3
Other (.mjs)
2
Files by Type (size)
Lock File
607KB
TypeScript
500KB
Other (.ico)
110KB
Other (.mdx)
38KB
JavaScript
20KB
Other (.snap)
15KB
Markdown
15KB
TSX
10KB
JSON
9KB
Other (.svg)
3KB
YAML
3KB
Other (no ext)
1KB

The LLM identified 4 files worth highlighting for reuse:

A factory class for generating custom `GraphQLScalarType` instances based on a regular expression. It accepts a regex, a description, and optional configuration (e.g., `stringOnly` to reject AST inputs that are strings). This is a self-contained, highly reusable component that allows consumers to define their own regex-validated scalars without duplicating the scalar boilerplate.

file: src/RegularExpression.ts ↗ | tags: #factory-pattern #reusable-validator

A coherent module implementing a GeoJSON scalar for geometry, feature, feature collection, and combination types. It includes TypeScript type definitions, a JSON Schema generator, validation functions for coordinates and geometry types, and a custom `GraphQLScalarType`. The `validators.ts` file provides reusable coordinate validation (bounding checks, nesting depth, linear ring closure) that could be extracted and applied to other geographic data handling projects.

file: src/scalars/GeoJSON/ ↗ | tags: #complex-validation #type-system #json-schema

A comprehensive implementation of RFC 3339 date, time, date-time, and duration scalars. It includes a `formatter.ts` for parsing and formatting ISO 8601 strings, and a `validator.ts` with regex validation and bounds checking. The modular design separates date/time parsing logic from GraphQL scalar binding, making the validator and formatter reusable in non-GraphQL contexts (e.g., backend API validation libraries).

file: src/scalars/iso-date/ ↗ | tags: #date-time-parsing #rfc-3339 #formatter-validator

An IBAN validator implementing ISO 13616 with country-specific length and structure validation, including a MOD-97 checksum algorithm. The file contains a map of country codes to valid IBAN lengths and format patterns, making it a self-contained reference implementation for IBAN validation that could be extracted into a standalone utility library for financial applications.

file: src/scalars/IBAN.ts ↗ | tags: #complex-validation #country-specific-algorithms
Last analyzed: 2026-09-09 02:51:01.074285
Next check: 2026-09-16 02:51:01.060965
$ submit: