New graphql application. 676-line test-graphql.sx covers parser, executor, fetch-gql integration. lib/graphql.sx (686L) is the core parser/AST; lib/graphql-exec.sx (219L) runs resolvers. applications/graphql/spec.sx declares the application. sx/sx/applications/graphql/ provides the doc pages (parser, queries, mutation, fragments, vars, fetch-gql, executor). Includes rebuilt sx_browser.bc.js / sx_browser.bc.wasm.js bundles. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
65 lines
1.7 KiB
Plaintext
65 lines
1.7 KiB
Plaintext
|
|
;; GraphQL — SX language assimilation
|
|
;;
|
|
;; Pure SX implementation of the GraphQL query language.
|
|
;; Parser, executor, and serializer — all s-expressions,
|
|
;; compiled to bytecode by the same kernel.
|
|
;;
|
|
;; Files:
|
|
;; lib/graphql.sx — Tokenizer + recursive descent parser
|
|
;; lib/graphql-exec.sx — Executor (projection, fragments, variables)
|
|
;; spec/tests/test-graphql.sx — 66 tests across 15 suites
|
|
;;
|
|
;; Hyperscript integration:
|
|
;; fetch gql { query { ... } } — shorthand query
|
|
;; fetch gql mutation { ... } — mutation
|
|
;; fetch gql { ... } from "/endpoint" — custom endpoint
|
|
;;
|
|
;; Maps to existing SX infrastructure:
|
|
;; Query → defquery (IO suspension)
|
|
;; Mutation → defaction (IO suspension)
|
|
;; Subscription → SSE + signals (reactive islands)
|
|
;; Fragment → defcomp (component composition)
|
|
;; Schema → spec/types.sx (gradual type system)
|
|
;; Resolver → perform (CEK IO suspension)
|
|
|
|
(define graphql-version "0.1.0")
|
|
|
|
(define
|
|
graphql-features
|
|
(quote
|
|
(queries
|
|
mutations
|
|
subscriptions
|
|
fragments
|
|
inline-fragments
|
|
fragment-spreads
|
|
variables
|
|
variable-defaults
|
|
directives
|
|
directive-arguments
|
|
aliases
|
|
field-arguments
|
|
object-values
|
|
list-values
|
|
enum-values
|
|
block-strings
|
|
comments
|
|
field-projection
|
|
nested-projection
|
|
list-projection
|
|
variable-substitution
|
|
fragment-resolution
|
|
custom-resolvers
|
|
default-io-resolver
|
|
aliased-execution
|
|
multi-root-fields
|
|
named-operations
|
|
operation-introspection
|
|
ast-to-source
|
|
round-trip
|
|
fetch-gql
|
|
fetch-gql-from
|
|
fetch-gql-mutation
|
|
fetch-gql-query)))
|