Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b394a29
init(graphql): adds Functor, fold
ahrjarrett Sep 14, 2025
73a711a
Merge branch 'main' into graphql
ahrjarrett Sep 17, 2025
cd8d385
init(graphql,graphql-test,graphql-types): initializes `@traversable/g…
ahrjarrett Sep 17, 2025
a6452f5
chore: commits changeset
ahrjarrett Sep 17, 2025
924ee56
Merge branch 'main' into graphql
ahrjarrett Sep 18, 2025
463e5a3
feat(graphql): adds full AST support, `GQL.toType`
ahrjarrett Sep 19, 2025
4f5f316
deps(graphql-types): adds type-level dep on `graphql`
ahrjarrett Sep 19, 2025
c7499a3
deps(graphql-types): moves `graphql` to `peerDependencies`
ahrjarrett Sep 19, 2025
f7b55c8
chore: commits changeset
ahrjarrett Sep 19, 2025
4047d30
test(graphql-types): deletes unused `functor.test.ts` files
ahrjarrett Sep 19, 2025
f64262f
deps(graphql): promotes `graphql-types` to being a proper dependency
ahrjarrett Sep 19, 2025
5cb3330
docs(graphql): updates changelog
ahrjarrett Sep 19, 2025
0d61c58
Merge branch 'main' into graphql
ahrjarrett Sep 20, 2025
306933d
Merge branch 'main' into graphql
ahrjarrett Sep 20, 2025
fcf2957
Merge branch 'main' into graphql
ahrjarrett Sep 26, 2025
5587c5c
feat(graphql): adds naive `toString` function, beginning of the Graph…
ahrjarrett Sep 26, 2025
f29d329
feat(graphql): adds support for Field nodes, Selection set nodes
ahrjarrett Sep 26, 2025
2b33682
fix(graphql): fixes `F.isNullary` typeguard
ahrjarrett Sep 26, 2025
e15b876
feat(graphql,graphql-types,graphql-test): sorts graph topologically
ahrjarrett Sep 28, 2025
8f23b91
chore(*): freeze npm versions
ahrjarrett Sep 28, 2025
6c2a6a0
chore(registry): simplifies HKT encoding
ahrjarrett Sep 28, 2025
1b4f204
optimize(arktype-test): improves type-level performance of Seed/Gen
ahrjarrett Sep 28, 2025
914ed6b
optimize(json-schema-types,json-schema-test): improves type-level per…
ahrjarrett Sep 28, 2025
f6c1eaf
optimize(schema): improves type-level performance of Seed/Gen
ahrjarrett Sep 28, 2025
538b830
optimize(typebox-test,typebox-types): improves type-level performance…
ahrjarrett Sep 28, 2025
f97c7cc
optimize(valibot,valibot-test,valibot-types): improves type-level per…
ahrjarrett Sep 28, 2025
67c13ea
optimize(zod,zod-test): improves type-level performance of Seed/Gen/F…
ahrjarrett Sep 28, 2025
03afee2
chore(*): upgrades to pnpm 10.17.1, adds minimumReleaseAge of 1 day
ahrjarrett Sep 28, 2025
903303f
feat(graph-test): implements schema arbitrary
ahrjarrett Oct 1, 2025
86250c5
Merge branch 'main' into graphql
ahrjarrett Oct 4, 2025
9c6359c
optimize(registry): removes unnecessary type instantiation in `has` s…
ahrjarrett Oct 4, 2025
ae3f30e
fix(zod-test): fixes type-level bug where `Seed.Promise` was `never`,…
ahrjarrett Oct 4, 2025
adb2d84
Merge branch 'main' into graphql
ahrjarrett Oct 4, 2025
d19be80
Merge branch 'main' into graphql
ahrjarrett Oct 4, 2025
6e52d8e
feat(graphql-tes): generator partially working
ahrjarrett Oct 5, 2025
16aa4f6
feat(graphql-test): generator generates valid gql documents :tada:
ahrjarrett Oct 5, 2025
6192e6f
feat(graphql-types): AST.toString correctly stringifies nodes
ahrjarrett Oct 5, 2025
477a6a9
chore(graphql-test): cleans up impl
ahrjarrett Oct 5, 2025
f5afddf
chore(graphql-test): adds more configuration
ahrjarrett Oct 5, 2025
2151bdb
chore(graphql-test): deletes unused code
ahrjarrett Oct 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/cruel-geese-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@traversable/graphql-types": patch
"@traversable/graphql-test": patch
"@traversable/graphql": patch
---

feat(graphql): adds `graphql` to `dependencies`
7 changes: 7 additions & 0 deletions .changeset/fresh-years-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@traversable/graphql-types": patch
"@traversable/graphql-test": patch
"@traversable/graphql": patch
---

initializes `@traversable/graphql`, `@traverable/graphql-test`, `@traversable/graphql-types` packages
4 changes: 3 additions & 1 deletion bin/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ namespace write {
($) => pipe(
[
`export * from './exports.js'`,
null
].join('\n'),
$.dryRun ? tap(`\n\n[CREATE #10]: workspaceIndex\n`, globalThis.String)
: fs.writeString(path.join(PATH.packages, $.pkgName, 'src', 'index.ts')),
Expand All @@ -443,7 +444,8 @@ namespace write {
export const workspaceSrcExports = defineEffect(
($) => pipe(
[
`export * from './version.js'`,
`export { VERSION } from './version.js'`,
null
].join('\n'),
$.dryRun ? tap(`\n\n[CREATE #11]: workspaceSrcExports\n`, globalThis.String)
: fs.writeString(path.join(PATH.packages, $.pkgName, 'src', 'exports.ts')),
Expand Down
3 changes: 3 additions & 0 deletions config/__generated__/package-list.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"fast-check": "catalog:",
"madge": "catalog:",
"tinybench": "catalog:",
"typedoc": "^0.28.9",
"typedoc": "catalog:",
"typescript": "catalog:",
"vitest": "catalog:"
},
Expand Down
40 changes: 20 additions & 20 deletions packages/arktype-test/src/generator-bounds.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as fc from 'fast-check'

import type { newtype } from '@traversable/registry'
import { fn, Number_isFinite, Number_isNatural, Object_is } from '@traversable/registry'

/** @internal */
Expand All @@ -17,8 +16,8 @@ export const defaultDoubleConstraints = {
// const defaultIntBounds = [-0x1000, +0x1000, null] satisfies Bounds_int
const defaultBigIntBounds = [-0x1000000n, 0x1000000n, null] satisfies Bounds_bigint
const defaultNumberBounds = [-0x10000, +0x10000, null, false, false] satisfies Bounds_number
const defaultStringBounds = [0, +0x40] satisfies Bounds_string
const defaultArrayBounds = [0, +0x10] satisfies Bounds_array
const defaultStringBounds = [0, +0x40, null] satisfies Bounds_string
const defaultArrayBounds = [0, +0x10, null] satisfies Bounds_array

export const defaults = {
// int: defaultIntBounds,
Expand Down Expand Up @@ -68,11 +67,11 @@ const clampArrayMax = clampMax(defaults.array[0], defaults.array[1], Number_isNa
export const makeInclusiveBounds = <T>(model: fc.Arbitrary<T>) => ({ minimum: model, maximum: model })

// export { Bounds_int as int }
// interface Bounds_int extends newtype<[
// type Bounds_int = [
// minimum: number | null,
// maximum: number | null,
// multipleOf: number | null,
// ]> {}
// ]

// const Bounds_int
// : (model: fc.Arbitrary<number>) => fc.Arbitrary<Bounds_int>
Expand All @@ -84,11 +83,11 @@ export const makeInclusiveBounds = <T>(model: fc.Arbitrary<T>) => ({ minimum: mo
// ])

export { Bounds_bigint as bigint }
interface Bounds_bigint extends newtype<[
type Bounds_bigint = [
minimum: bigint | null,
maximum: bigint | null,
multipleOf: bigint | null,
]> {}
]

const Bounds_bigint
: (model: fc.Arbitrary<bigint>) => fc.Arbitrary<Bounds_bigint>
Expand All @@ -99,28 +98,28 @@ const Bounds_bigint
])

export { Bounds_string as string }
interface Bounds_string extends newtype<[
type Bounds_string = [
minLength: number | null,
maxLength: number | null,
]> {}
exactLength: number | null,
]

const Bounds_string
: (model: fc.Arbitrary<number>) => fc.Arbitrary<Bounds_string>
= (model) => fc.tuple(nullable(model), nullable(model), nullable(model)).map(
([x, y, length]) => Number_isNatural(length)
? [null, null] satisfies [any, any]
// [clampString(length), clampString(length)]
: [clampStringMin(x, y), clampStringMax(y, x)]
? [null, null, null] satisfies Bounds_string
: [clampStringMin(x, y), clampStringMax(y, x), null] satisfies Bounds_string
)

export { Bounds_number as number }
interface Bounds_number extends newtype<[
type Bounds_number = [
minimum: number | null,
maximum: number | null,
multipleOf: number | null,
exclusiveMinimum: boolean,
exclusiveMaximum: boolean,
]> {}
]

const deltaIsSubEpsilon = (x: number, y: number) => Math.abs(x - y) < Number.EPSILON

Expand Down Expand Up @@ -153,10 +152,11 @@ const Bounds_number
)

export { Bounds_array as array }
interface Bounds_array extends newtype<[
type Bounds_array = [
minLength: number | null,
maxLength: number | null,
]> {}
exactLength: number | null,
]

const Bounds_array
: (model: fc.Arbitrary<number>) => fc.Arbitrary<Bounds_array>
Expand All @@ -166,8 +166,8 @@ const Bounds_array
fc.constant(null)
).map(([x, y, exactLength]) =>
Number_isNatural(exactLength)
? [null, null]
: [clampArrayMin(x, y), clampArrayMax(y, x)]
? [null, null, exactLength] satisfies Bounds_array
: [clampArrayMin(x, y), clampArrayMax(y, x), null] satisfies Bounds_array
)


Expand All @@ -184,7 +184,7 @@ const Bounds_array
export const bigintBoundsToBigIntConstraints
: (bounds?: Bounds_bigint) => fc.BigIntConstraints
= (bounds = defaultBigIntBounds) => {
const [min, max, multipleOf] = bounds
const [min, max, _multipleOf] = bounds
return {
max: max ?? void 0,
min: min ?? void 0,
Expand All @@ -207,7 +207,7 @@ export const numberBoundsToDoubleConstraints

export const stringBoundsToStringConstraints
: (bounds?: Bounds_string) => fc.StringConstraints
= ([minLength, maxLength] = defaultStringBounds) => ({
= ([minLength, maxLength, exactLength] = defaultStringBounds) => ({
minLength: minLength ?? void 0,
maxLength: maxLength ?? void 0
}) satisfies fc.StringConstraints
Expand Down
7 changes: 4 additions & 3 deletions packages/arktype-test/src/generator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type } from 'arktype'
import * as fc from 'fast-check'

import type { newtype, inline } from '@traversable/registry'
import type { inline } from '@traversable/registry'
import {
Array_isArray,
fn,
Expand Down Expand Up @@ -120,7 +120,7 @@ export interface SeedBuilder<K extends keyof Seed> {
(tie: fc.LetrecTypedTie<SeedMap>, $: Config.byTypeName[K]): fc.Arbitrary<Seed[K]>
}

export interface SeedMap extends newtype<{ [K in keyof Seed]: SeedBuilder<K> }> {}
export type SeedMap = { [K in keyof Seed]: SeedBuilder<K> }
export const SeedMap = {
...TerminalMap,
...BoundableMap,
Expand Down Expand Up @@ -262,7 +262,8 @@ export declare namespace Gen {
type Base<T, $> = { [K in keyof T]: (tie: fc.LetrecLooselyTypedTie, constraints: $[K & keyof $]) => fc.Arbitrary<T[K]> }
type Values<T, OmitKeys extends keyof any = never> = never | T[Exclude<keyof T, OmitKeys>]
type InferArb<S> = S extends fc.Arbitrary<infer T> ? T : never
interface Builder<T extends {}> extends newtype<T> { ['*']: fc.Arbitrary<InferArb<Values<this, '*' | 'root'>>> }
type Builder<T extends {}> = T & BuilderStar
interface BuilderStar { ['*']: fc.Arbitrary<InferArb<Values<this, '*' | 'root'>>> }
type BuildBuilder<T, Options extends Config.Options<T>, Out extends {} = BuilderBase<T, Options>> = never | Builder<Out>
type BuilderBase<T, Options extends Config.Options<T>, $ extends ParseOptions<T, Options> = ParseOptions<T, Options>> = never |
& ([$['root']] extends [never] ? unknown : { root: fc.Arbitrary<$['root']> })
Expand Down
40 changes: 40 additions & 0 deletions packages/graphql-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<br>
<h1 align="center">ᯓ𝘁𝗿𝗮𝘃𝗲𝗿𝘀𝗮𝗯𝗹𝗲/𝗴𝗿𝗮𝗽𝗵𝗾𝗹-𝘁𝗲𝘀𝘁</h1>
<br>

<p align="center">
TODO: write me
</p>

<div align="center">
<img alt="NPM Version" src="https://img.shields.io/npm/v/%40traversable%2Fgraphql-test?style=flat-square&logo=npm&label=npm&color=blue">
&nbsp;
<img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-5.5%2B-blue?style=flat-square&logo=TypeScript&logoColor=4a9cf6">
&nbsp;
<img alt="License" src="https://img.shields.io/static/v1?label=License&message=MIT&labelColor=59636e&color=838a93">
&nbsp;
<img alt="npm" src="https://img.shields.io/npm/dt/@traversable/graphql-test?style=flat-square">
&nbsp;
</div>

<div align="center">
<!-- <img alt="npm bundle size (scoped)" src="https://img.shields.io/bundlephobia/minzip/%40traversable/graphql-test?style=flat-square&label=size">
&nbsp; -->
<img alt="Static Badge" src="https://img.shields.io/badge/%F0%9F%8C%B2-tree--shakeable-brightgreen?labelColor=white">
&nbsp;
<img alt="Static Badge" src="https://img.shields.io/badge/ESM-supported-2d9574?style=flat-square&logo=JavaScript">
&nbsp;
<img alt="Static Badge" src="https://img.shields.io/badge/CJS-supported-2d9574?style=flat-square&logo=Node.JS">
&nbsp;
</div>

<div align="center">
<a href="https://stackblitz.com/edit/traversable?file=src%2Fsandbox.tsx" target="_blank">Demo (StackBlitz)</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://tsplay.dev/w2y29W" target="_blank">TypeScript Playground</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://www.npmjs.com/package/@traversable/graphql-test" target="_blank">npm</a>
<br>
</div>
<br>
<br>
65 changes: 65 additions & 0 deletions packages/graphql-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "@traversable/graphql-test",
"type": "module",
"version": "0.0.0",
"private": false,
"description": "",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/traversable/schema.git",
"directory": "packages/graphql-test"
},
"bugs": {
"url": "https://github.com/traversable/schema/issues",
"email": "ahrjarrett@gmail.com"
},
"@traversable": {
"generateExports": {
"include": [
"**/*.ts"
]
},
"generateIndex": {
"include": [
"**/*.ts"
]
}
},
"publishConfig": {
"access": "public",
"directory": "dist",
"registry": "https://registry.npmjs.org"
},
"scripts": {
"bench": "echo NOTHING TO BENCH",
"build": "pnpm build:esm && pnpm build:cjs && pnpm build:annotate",
"build:annotate": "babel build --plugins annotate-pure-calls --out-dir build --source-maps",
"build:esm": "tsc -b tsconfig.build.json",
"build:cjs": "babel build/esm --plugins @babel/transform-export-namespace-from --plugins @babel/transform-modules-commonjs --out-dir build/cjs --source-maps",
"check": "tsc -b tsconfig.json",
"clean": "pnpm run \"/^clean:.*/\"",
"clean:build": "rm -rf .tsbuildinfo dist build",
"clean:deps": "rm -rf node_modules",
"test": "vitest"
},
"peerDependencies": {
"@traversable/graphql-types": "workspace:^",
"@traversable/json": "workspace:^",
"@traversable/registry": "workspace:^",
"graphql": ">= 16"
},
"peerDependenciesMeta": {
"@traversable/graphql-types": { "optional": false },
"@traversable/json": { "optional": false },
"@traversable/registry": { "optional": false },
"graphql": { "optional": true }
},
"devDependencies": {
"@prettier/sync": "catalog:",
"@traversable/graphql-types": "workspace:^",
"@traversable/json": "workspace:^",
"@traversable/registry": "workspace:^",
"graphql": "catalog:"
}
}
61 changes: 61 additions & 0 deletions packages/graphql-test/src/__generated__/__manifest__.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions packages/graphql-test/src/exports.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export { VERSION } from './version.js'

export { Config } from './generator-options.js'
export * from './generator-seed.js'
export {
Builder,
Gen,
SeedGenerator,
pickAndSortNodes,
seedToSchema,
} from './generator.js'
Loading
Loading