chore: add mobile app

This commit is contained in:
2026-02-07 22:33:02 +01:00
parent db34640acc
commit e89384ad4e
29327 changed files with 3886944 additions and 12 deletions
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 0no.co
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+79
View File
@@ -0,0 +1,79 @@
<div align="center">
<h2>@0no-co/graphql.web</h2>
<strong>The spec-compliant minimum of client-side GraphQL.</strong>
<br />
<br />
<a href="https://github.com/0no-co/graphql.web/actions/workflows/release.yml">
<img alt="CI Status" src="https://github.com/0no-co/graphql.web/actions/workflows/release.yml/badge.svg?branch=main" />
</a>
<a href="https://npmjs.com/package/@0no-co/graphql.web">
<img alt="Bundlesize" src="https://deno.bundlejs.com/?q=@0no-co/graphql.web&badge" />
</a>
<a href="https://urql.dev/discord">
<img alt="Discord" src="https://img.shields.io/discord/1082378892523864074?color=7389D8&label&logo=discord&logoColor=ffffff" />
</a>
<br />
<br />
</div>
`@0no-co/graphql.web` is a utility library, aiming to provide the minimum of
functions that typical GraphQL clients need and would usually import from
`graphql`, e.g. a GraphQL query parser, printer, and visitor.
While its goal isnt to be an exact match to [the GraphQL.js
API](https://graphql.org/graphql-js/graphql/) it aims to remain API- and
type-compatible where possible and necessary. However, its goal is to provide
the smallest implementation for common GraphQL utilities that are still either
spec-compliant or compatible with GraphQL.js implementation.
> **Note:** If youre instead looking for a drop-in replacement for the
> `graphql` package that you can just alias into your web apps, read more about
> the [`graphql-web-lite` project](https://github.com/0no-co/graphql-web-lite),
> which uses this library to shim the `graphql` package.
[`@urql/core`](https://github.com/urql-graphql/urql) depends on this package to
power its GraphQL query parsing and printing. **If youre using `@urql/core@^4`
youre already using this library! ✨**
### Overview
`@0no-co/graphql.web` aims to provide a minimal set of exports to implement
client-side GraphQL utilities, mostly including parsing, printing, and visiting
the GraphQL AST, and the `GraphQLError` class.
Currently, `graphql.web` compresses to under 4kB and doesnt regress on
GraphQL.js performance when parsing, printing, or visiting the AST.
For all primary APIs we aim to hit 100% test coverage and match the output,
types, and API compatibility of GraphQL.js, including — as far as possible
— TypeScript type compatibility of the AST types with the currently stable
version of GraphQL.js.
### API
Currently, only a select few exports are provided — namely, the ones listed here
are used in `@urql/core`, and we expect them to be common in all client-side
GraphQL applications.
| Export | Description | Links |
| --------------------- | ------------------------------------------------------------------ | -------------------------- |
| `parse` | A tiny (but compliant) GraphQL query language parser. | [Source](./src/parser.ts) |
| `print` | A (compliant) GraphQL query language printer. | [Source](./src/printer.ts) |
| `visit` | A recursive reimplementation of GraphQL.js visitor. | [Source](./src/printer.ts) |
| `Kind` | The GraphQL.js `Kind` enum, containing supported `ASTNode` kinds. | [Source](./src/kind.ts) |
| `GraphQLError` | `GraphQLError` stripped of source/location debugging. | [Source](./src/kind.ts) |
| `valueFromASTUntyped` | Coerces AST values into JS values. | [Source](./src/values.ts) |
The stated goals of any reimplementation are:
1. Not to implement any execution or type system parts of the GraphQL
specification.
2. To adhere to GraphQL.js types and APIs as much as possible.
3. Not to implement or expose any rarely used APIs or properties of the
GraphQL.js library.
4. To provide a minimal and maintainable subset of GraphQL.js utilities.
Therefore, while we can foresee implementing APIs that are entirely separate and
unrelated to the GraphQL.js library in the future, for now the stated goals are
designed to allow this library to be used by GraphQL clients, like
[`@urql/core`](https://github.com/urql-graphql/urql).
+835
View File
@@ -0,0 +1,835 @@
/*@ts-ignore*/
import * as GraphQL from 'graphql';
type Or<T, U> = void extends T ? U : T;
type Maybe<T> = T | undefined | null;
interface Extensions {
[extension: string]: unknown;
}
type Source =
| any
| {
body: string;
name: string;
locationOffset: {
line: number;
column: number;
};
};
type Location =
| any
| {
start: number;
end: number;
source: Source;
};
declare enum Kind {
/** Name */
NAME = 'Name',
/** Document */
DOCUMENT = 'Document',
OPERATION_DEFINITION = 'OperationDefinition',
VARIABLE_DEFINITION = 'VariableDefinition',
SELECTION_SET = 'SelectionSet',
FIELD = 'Field',
ARGUMENT = 'Argument',
/** Fragments */
FRAGMENT_SPREAD = 'FragmentSpread',
INLINE_FRAGMENT = 'InlineFragment',
FRAGMENT_DEFINITION = 'FragmentDefinition',
/** Values */
VARIABLE = 'Variable',
INT = 'IntValue',
FLOAT = 'FloatValue',
STRING = 'StringValue',
BOOLEAN = 'BooleanValue',
NULL = 'NullValue',
ENUM = 'EnumValue',
LIST = 'ListValue',
OBJECT = 'ObjectValue',
OBJECT_FIELD = 'ObjectField',
/** Directives */
DIRECTIVE = 'Directive',
/** Types */
NAMED_TYPE = 'NamedType',
LIST_TYPE = 'ListType',
NON_NULL_TYPE = 'NonNullType',
/** Type System Definitions */
SCHEMA_DEFINITION = 'SchemaDefinition',
OPERATION_TYPE_DEFINITION = 'OperationTypeDefinition',
/** Type Definitions */
SCALAR_TYPE_DEFINITION = 'ScalarTypeDefinition',
OBJECT_TYPE_DEFINITION = 'ObjectTypeDefinition',
FIELD_DEFINITION = 'FieldDefinition',
INPUT_VALUE_DEFINITION = 'InputValueDefinition',
INTERFACE_TYPE_DEFINITION = 'InterfaceTypeDefinition',
UNION_TYPE_DEFINITION = 'UnionTypeDefinition',
ENUM_TYPE_DEFINITION = 'EnumTypeDefinition',
ENUM_VALUE_DEFINITION = 'EnumValueDefinition',
INPUT_OBJECT_TYPE_DEFINITION = 'InputObjectTypeDefinition',
/** Directive Definitions */
DIRECTIVE_DEFINITION = 'DirectiveDefinition',
/** Type System Extensions */
SCHEMA_EXTENSION = 'SchemaExtension',
/** Type Extensions */
SCALAR_TYPE_EXTENSION = 'ScalarTypeExtension',
OBJECT_TYPE_EXTENSION = 'ObjectTypeExtension',
INTERFACE_TYPE_EXTENSION = 'InterfaceTypeExtension',
UNION_TYPE_EXTENSION = 'UnionTypeExtension',
ENUM_TYPE_EXTENSION = 'EnumTypeExtension',
INPUT_OBJECT_TYPE_EXTENSION = 'InputObjectTypeExtension',
}
declare enum OperationTypeNode {
QUERY = 'query',
MUTATION = 'mutation',
SUBSCRIPTION = 'subscription',
}
/** Type System Definition */
declare type TypeSystemDefinitionNode = Or<
GraphQL.TypeSystemDefinitionNode,
SchemaDefinitionNode | TypeDefinitionNode | DirectiveDefinitionNode
>;
type SchemaDefinitionNode = Or<
GraphQL.SchemaDefinitionNode,
{
readonly kind: Kind.SCHEMA_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
readonly operationTypes: ReadonlyArray<OperationTypeDefinitionNode>;
}
>;
type OperationTypeDefinitionNode = Or<
GraphQL.OperationTypeDefinitionNode,
{
readonly kind: Kind.OPERATION_TYPE_DEFINITION;
readonly loc?: Location;
readonly operation: OperationTypeNode;
readonly type: NamedTypeNode;
}
>;
/** Type Definition */
declare type TypeDefinitionNode = Or<
GraphQL.TypeDefinitionNode,
| ScalarTypeDefinitionNode
| ObjectTypeDefinitionNode
| InterfaceTypeDefinitionNode
| UnionTypeDefinitionNode
| EnumTypeDefinitionNode
| InputObjectTypeDefinitionNode
>;
type ScalarTypeDefinitionNode = Or<
GraphQL.ScalarTypeDefinitionNode,
{
readonly kind: Kind.SCALAR_TYPE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
}
>;
type ObjectTypeDefinitionNode = Or<
GraphQL.ObjectTypeDefinitionNode,
{
readonly kind: Kind.OBJECT_TYPE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly interfaces?: ReadonlyArray<NamedTypeNode>;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
readonly fields?: ReadonlyArray<FieldDefinitionNode>;
}
>;
type FieldDefinitionNode = Or<
GraphQL.FieldDefinitionNode,
{
readonly kind: Kind.FIELD_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly arguments?: ReadonlyArray<InputValueDefinitionNode>;
readonly type: TypeNode;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
}
>;
type InputValueDefinitionNode = Or<
GraphQL.InputValueDefinitionNode,
{
readonly kind: Kind.INPUT_VALUE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly type: TypeNode;
readonly defaultValue?: ConstValueNode;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
}
>;
type InterfaceTypeDefinitionNode = Or<
GraphQL.InterfaceTypeDefinitionNode,
{
readonly kind: Kind.INTERFACE_TYPE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly interfaces?: ReadonlyArray<NamedTypeNode>;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
readonly fields?: ReadonlyArray<FieldDefinitionNode>;
}
>;
type UnionTypeDefinitionNode = Or<
GraphQL.UnionTypeDefinitionNode,
{
readonly kind: Kind.UNION_TYPE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
readonly types?: ReadonlyArray<NamedTypeNode>;
}
>;
type EnumTypeDefinitionNode = Or<
GraphQL.EnumTypeDefinitionNode,
{
readonly kind: Kind.ENUM_TYPE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
readonly values?: ReadonlyArray<EnumValueDefinitionNode>;
}
>;
type EnumValueDefinitionNode = Or<
GraphQL.EnumValueDefinitionNode,
{
readonly kind: Kind.ENUM_VALUE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
}
>;
type InputObjectTypeDefinitionNode = Or<
GraphQL.InputObjectTypeDefinitionNode,
{
readonly kind: Kind.INPUT_OBJECT_TYPE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
readonly fields?: ReadonlyArray<InputValueDefinitionNode>;
}
>;
type DirectiveDefinitionNode = Or<
GraphQL.DirectiveDefinitionNode,
{
readonly kind: Kind.DIRECTIVE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly arguments?: ReadonlyArray<InputValueDefinitionNode>;
readonly repeatable: boolean;
readonly locations: ReadonlyArray<NameNode>;
}
>;
type TypeSystemExtensionNode = Or<
GraphQL.TypeSystemExtensionNode,
SchemaExtensionNode | TypeExtensionNode
>;
type SchemaExtensionNode = Or<
GraphQL.SchemaExtensionNode,
{
readonly kind: Kind.SCHEMA_EXTENSION;
readonly loc?: Location;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
readonly operationTypes?: ReadonlyArray<OperationTypeDefinitionNode>;
}
>;
declare type TypeExtensionNode = Or<
GraphQL.TypeExtensionNode,
| ScalarTypeExtensionNode
| ObjectTypeExtensionNode
| InterfaceTypeExtensionNode
| UnionTypeExtensionNode
| EnumTypeExtensionNode
| InputObjectTypeExtensionNode
>;
type ScalarTypeExtensionNode = Or<
GraphQL.ScalarTypeExtensionNode,
{
readonly kind: Kind.SCALAR_TYPE_EXTENSION;
readonly loc?: Location;
readonly name: NameNode;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
}
>;
type ObjectTypeExtensionNode = Or<
GraphQL.ObjectTypeExtensionNode,
{
readonly kind: Kind.OBJECT_TYPE_EXTENSION;
readonly loc?: Location;
readonly name: NameNode;
readonly interfaces?: ReadonlyArray<NamedTypeNode>;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
readonly fields?: ReadonlyArray<FieldDefinitionNode>;
}
>;
type InterfaceTypeExtensionNode = Or<
GraphQL.InterfaceTypeExtensionNode,
{
readonly kind: Kind.INTERFACE_TYPE_EXTENSION;
readonly loc?: Location;
readonly name: NameNode;
readonly interfaces?: ReadonlyArray<NamedTypeNode>;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
readonly fields?: ReadonlyArray<FieldDefinitionNode>;
}
>;
type UnionTypeExtensionNode = Or<
GraphQL.UnionTypeExtensionNode,
{
readonly kind: Kind.UNION_TYPE_EXTENSION;
readonly loc?: Location;
readonly name: NameNode;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
readonly types?: ReadonlyArray<NamedTypeNode>;
}
>;
type EnumTypeExtensionNode = Or<
GraphQL.EnumTypeExtensionNode,
{
readonly kind: Kind.ENUM_TYPE_EXTENSION;
readonly loc?: Location;
readonly name: NameNode;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
readonly values?: ReadonlyArray<EnumValueDefinitionNode>;
}
>;
type InputObjectTypeExtensionNode = Or<
GraphQL.InputObjectTypeExtensionNode,
{
readonly kind: Kind.INPUT_OBJECT_TYPE_EXTENSION;
readonly loc?: Location;
readonly name: NameNode;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
readonly fields?: ReadonlyArray<InputValueDefinitionNode>;
}
>;
type ASTNode = Or<
GraphQL.ASTNode,
| NameNode
| DocumentNode
| OperationDefinitionNode
| VariableDefinitionNode
| VariableNode
| SelectionSetNode
| FieldNode
| ArgumentNode
| FragmentSpreadNode
| InlineFragmentNode
| FragmentDefinitionNode
| IntValueNode
| FloatValueNode
| StringValueNode
| BooleanValueNode
| NullValueNode
| EnumValueNode
| ListValueNode
| ObjectValueNode
| ObjectFieldNode
| DirectiveNode
| NamedTypeNode
| ListTypeNode
| NonNullTypeNode
| SchemaDefinitionNode
| OperationTypeDefinitionNode
| ScalarTypeDefinitionNode
| ObjectTypeDefinitionNode
| FieldDefinitionNode
| InputValueDefinitionNode
| InterfaceTypeDefinitionNode
| UnionTypeDefinitionNode
| EnumTypeDefinitionNode
| EnumValueDefinitionNode
| InputObjectTypeDefinitionNode
| DirectiveDefinitionNode
| SchemaExtensionNode
| ScalarTypeExtensionNode
| ObjectTypeExtensionNode
| InterfaceTypeExtensionNode
| UnionTypeExtensionNode
| EnumTypeExtensionNode
| InputObjectTypeExtensionNode
>;
type NameNode = Or<
GraphQL.NameNode,
{
readonly kind: Kind.NAME;
readonly value: string;
readonly loc?: Location;
}
>;
type DocumentNode = Or<
GraphQL.DocumentNode,
{
readonly kind: Kind.DOCUMENT;
readonly definitions: ReadonlyArray<DefinitionNode>;
readonly loc?: Location;
}
>;
type DefinitionNode = Or<
GraphQL.DefinitionNode,
ExecutableDefinitionNode | TypeSystemDefinitionNode | TypeSystemExtensionNode
>;
type ExecutableDefinitionNode = Or<
GraphQL.ExecutableDefinitionNode,
OperationDefinitionNode | FragmentDefinitionNode
>;
type OperationDefinitionNode = Or<
GraphQL.OperationDefinitionNode & {
description?: StringValueNode;
},
{
readonly kind: Kind.OPERATION_DEFINITION;
readonly operation: OperationTypeNode;
readonly name?: NameNode;
readonly description?: StringValueNode;
readonly variableDefinitions?: ReadonlyArray<VariableDefinitionNode>;
readonly directives?: ReadonlyArray<DirectiveNode>;
readonly selectionSet: SelectionSetNode;
readonly loc?: Location;
}
>;
type VariableDefinitionNode = Or<
GraphQL.VariableDefinitionNode & {
description?: StringValueNode;
},
{
readonly kind: Kind.VARIABLE_DEFINITION;
readonly variable: VariableNode;
readonly type: TypeNode;
readonly defaultValue?: ConstValueNode;
readonly description?: StringValueNode;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
readonly loc?: Location;
}
>;
type VariableNode = Or<
GraphQL.VariableNode,
{
readonly kind: Kind.VARIABLE;
readonly name: NameNode;
readonly loc?: Location;
}
>;
type SelectionSetNode = Or<
GraphQL.SelectionSetNode,
{
readonly kind: Kind.SELECTION_SET;
readonly selections: ReadonlyArray<SelectionNode>;
readonly loc?: Location;
}
>;
declare type SelectionNode = Or<
GraphQL.SelectionNode,
FieldNode | FragmentSpreadNode | InlineFragmentNode
>;
type FieldNode = Or<
GraphQL.FieldNode,
{
readonly kind: Kind.FIELD;
readonly alias?: NameNode;
readonly name: NameNode;
readonly arguments?: ReadonlyArray<ArgumentNode>;
readonly directives?: ReadonlyArray<DirectiveNode>;
readonly selectionSet?: SelectionSetNode;
readonly loc?: Location;
}
>;
type ArgumentNode = Or<
GraphQL.ArgumentNode,
{
readonly kind: Kind.ARGUMENT;
readonly name: NameNode;
readonly value: ValueNode;
readonly loc?: Location;
}
>;
type ConstArgumentNode = Or<
GraphQL.ConstArgumentNode,
{
readonly kind: Kind.ARGUMENT;
readonly name: NameNode;
readonly value: ConstValueNode;
readonly loc?: Location;
}
>;
type FragmentSpreadNode = Or<
GraphQL.FragmentSpreadNode,
{
readonly kind: Kind.FRAGMENT_SPREAD;
readonly name: NameNode;
readonly directives?: ReadonlyArray<DirectiveNode>;
readonly loc?: Location;
}
>;
type InlineFragmentNode = Or<
GraphQL.InlineFragmentNode,
{
readonly kind: Kind.INLINE_FRAGMENT;
readonly typeCondition?: NamedTypeNode;
readonly directives?: ReadonlyArray<DirectiveNode>;
readonly selectionSet: SelectionSetNode;
readonly loc?: Location;
}
>;
type FragmentDefinitionNode = Or<
GraphQL.FragmentDefinitionNode & {
description?: StringValueNode;
},
{
readonly kind: Kind.FRAGMENT_DEFINITION;
readonly name: NameNode;
readonly description?: StringValueNode;
readonly typeCondition: NamedTypeNode;
readonly directives?: ReadonlyArray<DirectiveNode>;
readonly selectionSet: SelectionSetNode;
readonly loc?: Location;
}
>;
type ValueNode = Or<
GraphQL.ValueNode,
| VariableNode
| IntValueNode
| FloatValueNode
| StringValueNode
| BooleanValueNode
| NullValueNode
| EnumValueNode
| ListValueNode
| ObjectValueNode
>;
type ConstValueNode = Or<
GraphQL.ConstValueNode,
| IntValueNode
| FloatValueNode
| StringValueNode
| BooleanValueNode
| NullValueNode
| EnumValueNode
| ConstListValueNode
| ConstObjectValueNode
>;
type IntValueNode = Or<
GraphQL.IntValueNode,
{
readonly kind: Kind.INT;
readonly value: string;
readonly loc?: Location;
}
>;
type FloatValueNode = Or<
GraphQL.FloatValueNode,
{
readonly kind: Kind.FLOAT;
readonly value: string;
readonly loc?: Location;
}
>;
type StringValueNode = Or<
GraphQL.StringValueNode,
{
readonly kind: Kind.STRING;
readonly value: string;
readonly block?: boolean;
readonly loc?: Location;
}
>;
type BooleanValueNode = Or<
GraphQL.BooleanValueNode,
{
readonly kind: Kind.BOOLEAN;
readonly value: boolean;
readonly loc?: Location;
}
>;
type NullValueNode = Or<
GraphQL.NullValueNode,
{
readonly kind: Kind.NULL;
readonly loc?: Location;
}
>;
type EnumValueNode = Or<
GraphQL.EnumValueNode,
{
readonly kind: Kind.ENUM;
readonly value: string;
readonly loc?: Location;
}
>;
type ListValueNode = Or<
GraphQL.ListValueNode,
{
readonly kind: Kind.LIST;
readonly values: ReadonlyArray<ValueNode>;
readonly loc?: Location;
}
>;
type ConstListValueNode = Or<
GraphQL.ConstListValueNode,
{
readonly kind: Kind.LIST;
readonly values: ReadonlyArray<ConstValueNode>;
readonly loc?: Location;
}
>;
type ObjectValueNode = Or<
GraphQL.ObjectValueNode,
{
readonly kind: Kind.OBJECT;
readonly fields: ReadonlyArray<ObjectFieldNode>;
readonly loc?: Location;
}
>;
type ConstObjectValueNode = Or<
GraphQL.ConstObjectValueNode,
{
readonly kind: Kind.OBJECT;
readonly fields: ReadonlyArray<ConstObjectFieldNode>;
readonly loc?: Location;
}
>;
type ObjectFieldNode = Or<
GraphQL.ObjectFieldNode,
{
readonly kind: Kind.OBJECT_FIELD;
readonly name: NameNode;
readonly value: ValueNode;
readonly loc?: Location;
}
>;
type ConstObjectFieldNode = Or<
GraphQL.ConstObjectFieldNode,
{
readonly kind: Kind.OBJECT_FIELD;
readonly name: NameNode;
readonly value: ConstValueNode;
readonly loc?: Location;
}
>;
type DirectiveNode = Or<
GraphQL.DirectiveNode,
{
readonly kind: Kind.DIRECTIVE;
readonly name: NameNode;
readonly arguments?: ReadonlyArray<ArgumentNode>;
readonly loc?: Location;
}
>;
type ConstDirectiveNode = Or<
GraphQL.ConstDirectiveNode,
{
readonly kind: Kind.DIRECTIVE;
readonly name: NameNode;
readonly arguments?: ReadonlyArray<ConstArgumentNode>;
readonly loc?: Location;
}
>;
type TypeNode = Or<GraphQL.TypeNode, NamedTypeNode | ListTypeNode | NonNullTypeNode>;
type NamedTypeNode = Or<
GraphQL.NamedTypeNode,
{
readonly kind: Kind.NAMED_TYPE;
readonly name: NameNode;
readonly loc?: Location;
}
>;
type ListTypeNode = Or<
GraphQL.ListTypeNode,
{
readonly kind: Kind.LIST_TYPE;
readonly type: TypeNode;
readonly loc?: Location;
}
>;
type NonNullTypeNode = Or<
GraphQL.NonNullTypeNode,
{
readonly kind: Kind.NON_NULL_TYPE;
readonly type: NamedTypeNode | ListTypeNode;
readonly loc?: Location;
}
>;
declare class GraphQLError extends Error {
readonly locations: ReadonlyArray<any> | undefined;
readonly path: ReadonlyArray<string | number> | undefined;
readonly nodes: ReadonlyArray<any> | undefined;
readonly source: Source | undefined;
readonly positions: ReadonlyArray<number> | undefined;
readonly originalError: Error | undefined;
readonly extensions: Extensions;
constructor(
message: string,
nodes?: ReadonlyArray<ASTNode> | ASTNode | null,
source?: Maybe<Source>,
positions?: Maybe<ReadonlyArray<number>>,
path?: Maybe<ReadonlyArray<string | number>>,
originalError?: Maybe<Error>,
extensions?: Maybe<Extensions>
);
toJSON(): any;
toString(): string;
get [Symbol.toStringTag](): string;
}
type ParseOptions = {
[option: string]: any;
};
declare function parse(string: string | Source, options?: ParseOptions | undefined): DocumentNode;
declare function parseValue(
string: string | Source,
_options?: ParseOptions | undefined
): ValueNode;
declare function parseType(string: string | Source, _options?: ParseOptions | undefined): TypeNode;
declare const BREAK: {};
declare function visit<N extends ASTNode>(root: N, visitor: ASTVisitor): N;
declare function visit<R>(root: ASTNode, visitor: ASTReducer<R>): R;
type ASTVisitor = EnterLeaveVisitor<ASTNode> | KindVisitor;
type KindVisitor = {
readonly [NodeT in ASTNode as NodeT['kind']]?: ASTVisitFn<NodeT> | EnterLeaveVisitor<NodeT>;
};
interface EnterLeaveVisitor<TVisitedNode extends ASTNode> {
readonly enter?: ASTVisitFn<TVisitedNode> | undefined;
readonly leave?: ASTVisitFn<TVisitedNode> | undefined;
}
type ASTVisitFn<Node extends ASTNode> = (
node: Node,
key: string | number | undefined,
parent: ASTNode | ReadonlyArray<ASTNode> | undefined,
path: ReadonlyArray<string | number>,
ancestors: ReadonlyArray<ASTNode | ReadonlyArray<ASTNode>>
) => any;
type ASTReducer<R> = {
readonly [NodeT in ASTNode as NodeT['kind']]?: {
readonly enter?: ASTVisitFn<NodeT>;
readonly leave: ASTReducerFn<NodeT, R>;
};
};
type ASTReducerFn<TReducedNode extends ASTNode, R> = (
node: {
[K in keyof TReducedNode]: ReducedField<TReducedNode[K], R>;
},
key: string | number | undefined,
parent: ASTNode | ReadonlyArray<ASTNode> | undefined,
path: ReadonlyArray<string | number>,
ancestors: ReadonlyArray<ASTNode | ReadonlyArray<ASTNode>>
) => R;
type ReducedField<T, R> = T extends null | undefined
? T
: T extends ReadonlyArray<any>
? ReadonlyArray<R>
: R;
declare function printString(string: string): string;
declare function printBlockString(string: string): string;
declare function print(node: ASTNode): string;
declare function valueFromASTUntyped(
node: ValueNode,
variables?: Maybe<Record<string, any>>
): unknown;
declare function valueFromTypeNode(
node: ValueNode,
type: TypeNode,
variables?: Maybe<Record<string, any>>
): unknown;
declare function isSelectionNode(node: ASTNode): node is SelectionNode;
export {
type ASTNode,
type ASTReducer,
type ASTVisitFn,
type ASTVisitor,
type ArgumentNode,
BREAK,
type BooleanValueNode,
type ConstArgumentNode,
type ConstDirectiveNode,
type ConstListValueNode,
type ConstObjectFieldNode,
type ConstObjectValueNode,
type ConstValueNode,
type DefinitionNode,
type DirectiveDefinitionNode,
type DirectiveNode,
type DocumentNode,
type EnumTypeDefinitionNode,
type EnumTypeExtensionNode,
type EnumValueDefinitionNode,
type EnumValueNode,
type ExecutableDefinitionNode,
type Extensions,
type FieldDefinitionNode,
type FieldNode,
type FloatValueNode,
type FragmentDefinitionNode,
type FragmentSpreadNode,
GraphQLError,
type InlineFragmentNode,
type InputObjectTypeDefinitionNode,
type InputObjectTypeExtensionNode,
type InputValueDefinitionNode,
type IntValueNode,
type InterfaceTypeDefinitionNode,
type InterfaceTypeExtensionNode,
Kind,
type ListTypeNode,
type ListValueNode,
type Location,
type NameNode,
type NamedTypeNode,
type NonNullTypeNode,
type NullValueNode,
type ObjectFieldNode,
type ObjectTypeDefinitionNode,
type ObjectTypeExtensionNode,
type ObjectValueNode,
type OperationDefinitionNode,
type OperationTypeDefinitionNode,
OperationTypeNode,
type ScalarTypeDefinitionNode,
type ScalarTypeExtensionNode,
type SchemaDefinitionNode,
type SchemaExtensionNode,
type SelectionNode,
type SelectionSetNode,
type Source,
type StringValueNode,
type TypeDefinitionNode,
type TypeExtensionNode,
type TypeNode,
type TypeSystemDefinitionNode,
type TypeSystemExtensionNode,
type UnionTypeDefinitionNode,
type UnionTypeExtensionNode,
type ValueNode,
type VariableDefinitionNode,
type VariableNode,
isSelectionNode,
parse,
parseType,
parseValue,
print,
printBlockString,
printString,
valueFromASTUntyped,
valueFromTypeNode,
visit,
};
+871
View File
@@ -0,0 +1,871 @@
Object.defineProperty(exports, "__esModule", {
value: !0
});
class GraphQLError extends Error {
constructor(e, r, i, n, t, a, o) {
if (super(e), this.name = "GraphQLError", this.message = e, t) {
this.path = t;
}
if (r) {
this.nodes = Array.isArray(r) ? r : [ r ];
}
if (i) {
this.source = i;
}
if (n) {
this.positions = n;
}
if (a) {
this.originalError = a;
}
var l = o;
if (!l && a) {
var d = a.extensions;
if (d && "object" == typeof d) {
l = d;
}
}
this.extensions = l || {};
}
toJSON() {
return {
...this,
message: this.message
};
}
toString() {
return this.message;
}
get [Symbol.toStringTag]() {
return "GraphQLError";
}
}
var e;
var r;
function error(e) {
return new GraphQLError(`Syntax Error: Unexpected token at ${r} in ${e}`);
}
function advance(i) {
if (i.lastIndex = r, i.test(e)) {
return e.slice(r, r = i.lastIndex);
}
}
var i = / +(?=[^\s])/y;
function blockString(e) {
var r = e.split("\n");
var n = "";
var t = 0;
var a = 0;
var o = r.length - 1;
for (var l = 0; l < r.length; l++) {
if (i.lastIndex = 0, i.test(r[l])) {
if (l && (!t || i.lastIndex < t)) {
t = i.lastIndex;
}
a = a || l, o = l;
}
}
for (var d = a; d <= o; d++) {
if (d !== a) {
n += "\n";
}
n += r[d].slice(t).replace(/\\"""/g, '"""');
}
return n;
}
function ignored() {
for (var i = 0 | e.charCodeAt(r++); 9 === i || 10 === i || 13 === i || 32 === i || 35 === i || 44 === i || 65279 === i; i = 0 | e.charCodeAt(r++)) {
if (35 === i) {
for (;(i = 0 | e.charCodeAt(r++)) && 10 !== i && 13 !== i; ) {}
}
}
r--;
}
function name() {
var i = r;
for (var n = 0 | e.charCodeAt(r++); n >= 48 && n <= 57 || n >= 65 && n <= 90 || 95 === n || n >= 97 && n <= 122; n = 0 | e.charCodeAt(r++)) {}
if (i === r - 1) {
throw error("Name");
}
var t = e.slice(i, --r);
return ignored(), t;
}
function nameNode() {
return {
kind: "Name",
value: name()
};
}
var n = /(?:"""|(?:[\s\S]*?[^\\])""")/y;
var t = /(?:(?:\.\d+)?[eE][+-]?\d+|\.\d+)/y;
function value(i) {
var a;
switch (e.charCodeAt(r)) {
case 91:
r++, ignored();
var o = [];
for (;93 !== e.charCodeAt(r); ) {
o.push(value(i));
}
return r++, ignored(), {
kind: "ListValue",
values: o
};
case 123:
r++, ignored();
var l = [];
for (;125 !== e.charCodeAt(r); ) {
var d = nameNode();
if (58 !== e.charCodeAt(r++)) {
throw error("ObjectField");
}
ignored(), l.push({
kind: "ObjectField",
name: d,
value: value(i)
});
}
return r++, ignored(), {
kind: "ObjectValue",
fields: l
};
case 36:
if (i) {
throw error("Variable");
}
return r++, {
kind: "Variable",
name: nameNode()
};
case 34:
if (34 === e.charCodeAt(r + 1) && 34 === e.charCodeAt(r + 2)) {
if (r += 3, null == (a = advance(n))) {
throw error("StringValue");
}
return ignored(), {
kind: "StringValue",
value: blockString(a.slice(0, -3)),
block: !0
};
} else {
var s = r;
var u;
r++;
var c = !1;
for (u = 0 | e.charCodeAt(r++); 92 === u && (r++, c = !0) || 10 !== u && 13 !== u && 34 !== u && u; u = 0 | e.charCodeAt(r++)) {}
if (34 !== u) {
throw error("StringValue");
}
return a = e.slice(s, r), ignored(), {
kind: "StringValue",
value: c ? JSON.parse(a) : a.slice(1, -1),
block: !1
};
}
case 45:
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
var v = r++;
var f;
for (;(f = 0 | e.charCodeAt(r++)) >= 48 && f <= 57; ) {}
var p = e.slice(v, --r);
if (46 === (f = e.charCodeAt(r)) || 69 === f || 101 === f) {
if (null == (a = advance(t))) {
throw error("FloatValue");
}
return ignored(), {
kind: "FloatValue",
value: p + a
};
} else {
return ignored(), {
kind: "IntValue",
value: p
};
}
case 110:
if (117 === e.charCodeAt(r + 1) && 108 === e.charCodeAt(r + 2) && 108 === e.charCodeAt(r + 3)) {
return r += 4, ignored(), {
kind: "NullValue"
};
} else {
break;
}
case 116:
if (114 === e.charCodeAt(r + 1) && 117 === e.charCodeAt(r + 2) && 101 === e.charCodeAt(r + 3)) {
return r += 4, ignored(), {
kind: "BooleanValue",
value: !0
};
} else {
break;
}
case 102:
if (97 === e.charCodeAt(r + 1) && 108 === e.charCodeAt(r + 2) && 115 === e.charCodeAt(r + 3) && 101 === e.charCodeAt(r + 4)) {
return r += 5, ignored(), {
kind: "BooleanValue",
value: !1
};
} else {
break;
}
}
return {
kind: "EnumValue",
value: name()
};
}
function arguments_(i) {
if (40 === e.charCodeAt(r)) {
var n = [];
r++, ignored();
do {
var t = nameNode();
if (58 !== e.charCodeAt(r++)) {
throw error("Argument");
}
ignored(), n.push({
kind: "Argument",
name: t,
value: value(i)
});
} while (41 !== e.charCodeAt(r));
return r++, ignored(), n;
}
}
function directives(i) {
if (64 === e.charCodeAt(r)) {
var n = [];
do {
r++, n.push({
kind: "Directive",
name: nameNode(),
arguments: arguments_(i)
});
} while (64 === e.charCodeAt(r));
return n;
}
}
function type() {
var i = 0;
for (;91 === e.charCodeAt(r); ) {
i++, r++, ignored();
}
var n = {
kind: "NamedType",
name: nameNode()
};
do {
if (33 === e.charCodeAt(r)) {
r++, ignored(), n = {
kind: "NonNullType",
type: n
};
}
if (i) {
if (93 !== e.charCodeAt(r++)) {
throw error("NamedType");
}
ignored(), n = {
kind: "ListType",
type: n
};
}
} while (i--);
return n;
}
function selectionSetStart() {
if (123 !== e.charCodeAt(r++)) {
throw error("SelectionSet");
}
return ignored(), selectionSet();
}
function selectionSet() {
var i = [];
do {
if (46 === e.charCodeAt(r)) {
if (46 !== e.charCodeAt(++r) || 46 !== e.charCodeAt(++r)) {
throw error("SelectionSet");
}
switch (r++, ignored(), e.charCodeAt(r)) {
case 64:
i.push({
kind: "InlineFragment",
typeCondition: void 0,
directives: directives(!1),
selectionSet: selectionSetStart()
});
break;
case 111:
if (110 === e.charCodeAt(r + 1)) {
r += 2, ignored(), i.push({
kind: "InlineFragment",
typeCondition: {
kind: "NamedType",
name: nameNode()
},
directives: directives(!1),
selectionSet: selectionSetStart()
});
} else {
i.push({
kind: "FragmentSpread",
name: nameNode(),
directives: directives(!1)
});
}
break;
case 123:
r++, ignored(), i.push({
kind: "InlineFragment",
typeCondition: void 0,
directives: void 0,
selectionSet: selectionSet()
});
break;
default:
i.push({
kind: "FragmentSpread",
name: nameNode(),
directives: directives(!1)
});
}
} else {
var n = nameNode();
var t = void 0;
if (58 === e.charCodeAt(r)) {
r++, ignored(), t = n, n = nameNode();
}
var a = arguments_(!1);
var o = directives(!1);
var l = void 0;
if (123 === e.charCodeAt(r)) {
r++, ignored(), l = selectionSet();
}
i.push({
kind: "Field",
alias: t,
name: n,
arguments: a,
directives: o,
selectionSet: l
});
}
} while (125 !== e.charCodeAt(r));
return r++, ignored(), {
kind: "SelectionSet",
selections: i
};
}
function variableDefinitions() {
if (ignored(), 40 === e.charCodeAt(r)) {
var i = [];
r++, ignored();
do {
var n = void 0;
if (34 === e.charCodeAt(r)) {
n = value(!0);
}
if (36 !== e.charCodeAt(r++)) {
throw error("Variable");
}
var t = nameNode();
if (58 !== e.charCodeAt(r++)) {
throw error("VariableDefinition");
}
ignored();
var a = type();
var o = void 0;
if (61 === e.charCodeAt(r)) {
r++, ignored(), o = value(!0);
}
ignored();
var l = {
kind: "VariableDefinition",
variable: {
kind: "Variable",
name: t
},
type: a,
defaultValue: o,
directives: directives(!0)
};
if (n) {
l.description = n;
}
i.push(l);
} while (41 !== e.charCodeAt(r));
return r++, ignored(), i;
}
}
function fragmentDefinition(i) {
var n = nameNode();
if (111 !== e.charCodeAt(r++) || 110 !== e.charCodeAt(r++)) {
throw error("FragmentDefinition");
}
ignored();
var t = {
kind: "FragmentDefinition",
name: n,
typeCondition: {
kind: "NamedType",
name: nameNode()
},
directives: directives(!1),
selectionSet: selectionSetStart()
};
if (i) {
t.description = i;
}
return t;
}
function definitions() {
var i = [];
do {
var n = void 0;
if (34 === e.charCodeAt(r)) {
n = value(!0);
}
if (123 === e.charCodeAt(r)) {
if (n) {
throw error("Document");
}
r++, ignored(), i.push({
kind: "OperationDefinition",
operation: "query",
name: void 0,
variableDefinitions: void 0,
directives: void 0,
selectionSet: selectionSet()
});
} else {
var t = name();
switch (t) {
case "fragment":
i.push(fragmentDefinition(n));
break;
case "query":
case "mutation":
case "subscription":
var a;
var o = void 0;
if (40 !== (a = e.charCodeAt(r)) && 64 !== a && 123 !== a) {
o = nameNode();
}
var l = {
kind: "OperationDefinition",
operation: t,
name: o,
variableDefinitions: variableDefinitions(),
directives: directives(!1),
selectionSet: selectionSetStart()
};
if (n) {
l.description = n;
}
i.push(l);
break;
default:
throw error("Document");
}
}
} while (r < e.length);
return i;
}
var a = {};
function mapJoin(e, r, i) {
var n = "";
for (var t = 0; t < e.length; t++) {
if (t) {
n += r;
}
n += i(e[t]);
}
return n;
}
function printString(e) {
return JSON.stringify(e);
}
function printBlockString(e) {
return '"""\n' + e.replace(/"""/g, '\\"""') + '\n"""';
}
var o = "\n";
var l = {
OperationDefinition(e) {
var r = "";
if (e.description) {
r += l.StringValue(e.description) + "\n";
}
if (r += e.operation, e.name) {
r += " " + e.name.value;
}
if (e.variableDefinitions && e.variableDefinitions.length) {
if (!e.name) {
r += " ";
}
r += "(" + mapJoin(e.variableDefinitions, ", ", l.VariableDefinition) + ")";
}
if (e.directives && e.directives.length) {
r += " " + mapJoin(e.directives, " ", l.Directive);
}
var i = l.SelectionSet(e.selectionSet);
return "query" !== r ? r + " " + i : i;
},
VariableDefinition(e) {
var r = "";
if (e.description) {
r += l.StringValue(e.description) + " ";
}
if (r += l.Variable(e.variable) + ": " + _print(e.type), e.defaultValue) {
r += " = " + _print(e.defaultValue);
}
if (e.directives && e.directives.length) {
r += " " + mapJoin(e.directives, " ", l.Directive);
}
return r;
},
Field(e) {
var r = e.alias ? e.alias.value + ": " + e.name.value : e.name.value;
if (e.arguments && e.arguments.length) {
var i = mapJoin(e.arguments, ", ", l.Argument);
if (r.length + i.length + 2 > 80) {
r += "(" + (o += " ") + mapJoin(e.arguments, o, l.Argument) + (o = o.slice(0, -2)) + ")";
} else {
r += "(" + i + ")";
}
}
if (e.directives && e.directives.length) {
r += " " + mapJoin(e.directives, " ", l.Directive);
}
if (e.selectionSet && e.selectionSet.selections.length) {
r += " " + l.SelectionSet(e.selectionSet);
}
return r;
},
StringValue(e) {
if (e.block) {
return printBlockString(e.value).replace(/\n/g, o);
} else {
return printString(e.value);
}
},
BooleanValue: e => "" + e.value,
NullValue: e => "null",
IntValue: e => e.value,
FloatValue: e => e.value,
EnumValue: e => e.value,
Name: e => e.value,
Variable: e => "$" + e.name.value,
ListValue: e => "[" + mapJoin(e.values, ", ", _print) + "]",
ObjectValue: e => "{" + mapJoin(e.fields, ", ", l.ObjectField) + "}",
ObjectField: e => e.name.value + ": " + _print(e.value),
Document(e) {
if (!e.definitions || !e.definitions.length) {
return "";
} else {
return mapJoin(e.definitions, "\n\n", _print);
}
},
SelectionSet: e => "{" + (o += " ") + mapJoin(e.selections, o, _print) + (o = o.slice(0, -2)) + "}",
Argument: e => e.name.value + ": " + _print(e.value),
FragmentSpread(e) {
var r = "..." + e.name.value;
if (e.directives && e.directives.length) {
r += " " + mapJoin(e.directives, " ", l.Directive);
}
return r;
},
InlineFragment(e) {
var r = "...";
if (e.typeCondition) {
r += " on " + e.typeCondition.name.value;
}
if (e.directives && e.directives.length) {
r += " " + mapJoin(e.directives, " ", l.Directive);
}
return r += " " + l.SelectionSet(e.selectionSet);
},
FragmentDefinition(e) {
var r = "";
if (e.description) {
r += l.StringValue(e.description) + "\n";
}
if (r += "fragment " + e.name.value, r += " on " + e.typeCondition.name.value, e.directives && e.directives.length) {
r += " " + mapJoin(e.directives, " ", l.Directive);
}
return r + " " + l.SelectionSet(e.selectionSet);
},
Directive(e) {
var r = "@" + e.name.value;
if (e.arguments && e.arguments.length) {
r += "(" + mapJoin(e.arguments, ", ", l.Argument) + ")";
}
return r;
},
NamedType: e => e.name.value,
ListType: e => "[" + _print(e.type) + "]",
NonNullType: e => _print(e.type) + "!"
};
var _print = e => l[e.kind](e);
function valueFromASTUntyped(e, r) {
switch (e.kind) {
case "NullValue":
return null;
case "IntValue":
return parseInt(e.value, 10);
case "FloatValue":
return parseFloat(e.value);
case "StringValue":
case "EnumValue":
case "BooleanValue":
return e.value;
case "ListValue":
var i = [];
for (var n = 0, t = e.values.length; n < t; n++) {
i.push(valueFromASTUntyped(e.values[n], r));
}
return i;
case "ObjectValue":
var a = Object.create(null);
for (var o = 0, l = e.fields.length; o < l; o++) {
var d = e.fields[o];
a[d.name.value] = valueFromASTUntyped(d.value, r);
}
return a;
case "Variable":
return r && r[e.name.value];
}
}
exports.BREAK = a, exports.GraphQLError = GraphQLError, exports.Kind = {
NAME: "Name",
DOCUMENT: "Document",
OPERATION_DEFINITION: "OperationDefinition",
VARIABLE_DEFINITION: "VariableDefinition",
SELECTION_SET: "SelectionSet",
FIELD: "Field",
ARGUMENT: "Argument",
FRAGMENT_SPREAD: "FragmentSpread",
INLINE_FRAGMENT: "InlineFragment",
FRAGMENT_DEFINITION: "FragmentDefinition",
VARIABLE: "Variable",
INT: "IntValue",
FLOAT: "FloatValue",
STRING: "StringValue",
BOOLEAN: "BooleanValue",
NULL: "NullValue",
ENUM: "EnumValue",
LIST: "ListValue",
OBJECT: "ObjectValue",
OBJECT_FIELD: "ObjectField",
DIRECTIVE: "Directive",
NAMED_TYPE: "NamedType",
LIST_TYPE: "ListType",
NON_NULL_TYPE: "NonNullType"
}, exports.OperationTypeNode = {
QUERY: "query",
MUTATION: "mutation",
SUBSCRIPTION: "subscription"
}, exports.Source = function Source(e, r, i) {
return {
body: e,
name: r,
locationOffset: i || {
line: 1,
column: 1
}
};
}, exports.isSelectionNode = function isSelectionNode(e) {
return "Field" === e.kind || "FragmentSpread" === e.kind || "InlineFragment" === e.kind;
}, exports.parse = function parse(i, n) {
if (e = i.body ? i.body : i, r = 0, ignored(), n && n.noLocation) {
return {
kind: "Document",
definitions: definitions()
};
} else {
return {
kind: "Document",
definitions: definitions(),
loc: {
start: 0,
end: e.length,
startToken: void 0,
endToken: void 0,
source: {
body: e,
name: "graphql.web",
locationOffset: {
line: 1,
column: 1
}
}
}
};
}
}, exports.parseType = function parseType(i, n) {
return e = i.body ? i.body : i, r = 0, type();
}, exports.parseValue = function parseValue(i, n) {
return e = i.body ? i.body : i, r = 0, ignored(), value(!1);
}, exports.print = function print(e) {
return o = "\n", l[e.kind] ? l[e.kind](e) : "";
}, exports.printBlockString = printBlockString, exports.printString = printString,
exports.valueFromASTUntyped = valueFromASTUntyped, exports.valueFromTypeNode = function valueFromTypeNode(e, r, i) {
if ("Variable" === e.kind) {
return i ? valueFromTypeNode(i[e.name.value], r, i) : void 0;
} else if ("NonNullType" === r.kind) {
return "NullValue" !== e.kind ? valueFromTypeNode(e, r, i) : void 0;
} else if ("NullValue" === e.kind) {
return null;
} else if ("ListType" === r.kind) {
if ("ListValue" === e.kind) {
var n = [];
for (var t = 0, a = e.values.length; t < a; t++) {
var o = valueFromTypeNode(e.values[t], r.type, i);
if (void 0 === o) {
return;
} else {
n.push(o);
}
}
return n;
}
} else if ("NamedType" === r.kind) {
switch (r.name.value) {
case "Int":
case "Float":
case "String":
case "Bool":
return r.name.value + "Value" === e.kind ? valueFromASTUntyped(e, i) : void 0;
default:
return valueFromASTUntyped(e, i);
}
}
}, exports.visit = function visit(e, r) {
var i = [];
var n = [];
try {
var t = function traverse(e, t, o) {
var l = !1;
var d = r[e.kind] && r[e.kind].enter || r[e.kind] || r.enter;
var s = d && d.call(r, e, t, o, n, i);
if (!1 === s) {
return e;
} else if (null === s) {
return null;
} else if (s === a) {
throw a;
} else if (s && "string" == typeof s.kind) {
l = s !== e, e = s;
}
if (o) {
i.push(o);
}
var u;
var c = {
...e
};
for (var v in e) {
n.push(v);
var f = e[v];
if (Array.isArray(f)) {
var p = [];
for (var m = 0; m < f.length; m++) {
if (null != f[m] && "string" == typeof f[m].kind) {
if (i.push(e), n.push(m), u = traverse(f[m], m, f), n.pop(), i.pop(), null == u) {
l = !0;
} else {
l = l || u !== f[m], p.push(u);
}
}
}
f = p;
} else if (null != f && "string" == typeof f.kind) {
if (void 0 !== (u = traverse(f, v, e))) {
l = l || f !== u, f = u;
}
}
if (n.pop(), l) {
c[v] = f;
}
}
if (o) {
i.pop();
}
var h = r[e.kind] && r[e.kind].leave || r.leave;
var g = h && h.call(r, e, t, o, n, i);
if (g === a) {
throw a;
} else if (void 0 !== g) {
return g;
} else if (void 0 !== s) {
return l ? c : s;
} else {
return l ? c : e;
}
}(e);
return void 0 !== t && !1 !== t ? t : e;
} catch (r) {
if (r !== a) {
throw r;
}
return e;
}
};
//# sourceMappingURL=graphql.web.js.map
File diff suppressed because one or more lines are too long
+886
View File
@@ -0,0 +1,886 @@
var e = {
NAME: "Name",
DOCUMENT: "Document",
OPERATION_DEFINITION: "OperationDefinition",
VARIABLE_DEFINITION: "VariableDefinition",
SELECTION_SET: "SelectionSet",
FIELD: "Field",
ARGUMENT: "Argument",
FRAGMENT_SPREAD: "FragmentSpread",
INLINE_FRAGMENT: "InlineFragment",
FRAGMENT_DEFINITION: "FragmentDefinition",
VARIABLE: "Variable",
INT: "IntValue",
FLOAT: "FloatValue",
STRING: "StringValue",
BOOLEAN: "BooleanValue",
NULL: "NullValue",
ENUM: "EnumValue",
LIST: "ListValue",
OBJECT: "ObjectValue",
OBJECT_FIELD: "ObjectField",
DIRECTIVE: "Directive",
NAMED_TYPE: "NamedType",
LIST_TYPE: "ListType",
NON_NULL_TYPE: "NonNullType"
};
var r = {
QUERY: "query",
MUTATION: "mutation",
SUBSCRIPTION: "subscription"
};
class GraphQLError extends Error {
constructor(e, r, i, n, t, a, o) {
if (super(e), this.name = "GraphQLError", this.message = e, t) {
this.path = t;
}
if (r) {
this.nodes = Array.isArray(r) ? r : [ r ];
}
if (i) {
this.source = i;
}
if (n) {
this.positions = n;
}
if (a) {
this.originalError = a;
}
var l = o;
if (!l && a) {
var d = a.extensions;
if (d && "object" == typeof d) {
l = d;
}
}
this.extensions = l || {};
}
toJSON() {
return {
...this,
message: this.message
};
}
toString() {
return this.message;
}
get [Symbol.toStringTag]() {
return "GraphQLError";
}
}
var i;
var n;
function error(e) {
return new GraphQLError(`Syntax Error: Unexpected token at ${n} in ${e}`);
}
function advance(e) {
if (e.lastIndex = n, e.test(i)) {
return i.slice(n, n = e.lastIndex);
}
}
var t = / +(?=[^\s])/y;
function blockString(e) {
var r = e.split("\n");
var i = "";
var n = 0;
var a = 0;
var o = r.length - 1;
for (var l = 0; l < r.length; l++) {
if (t.lastIndex = 0, t.test(r[l])) {
if (l && (!n || t.lastIndex < n)) {
n = t.lastIndex;
}
a = a || l, o = l;
}
}
for (var d = a; d <= o; d++) {
if (d !== a) {
i += "\n";
}
i += r[d].slice(n).replace(/\\"""/g, '"""');
}
return i;
}
function ignored() {
for (var e = 0 | i.charCodeAt(n++); 9 === e || 10 === e || 13 === e || 32 === e || 35 === e || 44 === e || 65279 === e; e = 0 | i.charCodeAt(n++)) {
if (35 === e) {
for (;(e = 0 | i.charCodeAt(n++)) && 10 !== e && 13 !== e; ) {}
}
}
n--;
}
function name() {
var e = n;
for (var r = 0 | i.charCodeAt(n++); r >= 48 && r <= 57 || r >= 65 && r <= 90 || 95 === r || r >= 97 && r <= 122; r = 0 | i.charCodeAt(n++)) {}
if (e === n - 1) {
throw error("Name");
}
var t = i.slice(e, --n);
return ignored(), t;
}
function nameNode() {
return {
kind: "Name",
value: name()
};
}
var a = /(?:"""|(?:[\s\S]*?[^\\])""")/y;
var o = /(?:(?:\.\d+)?[eE][+-]?\d+|\.\d+)/y;
function value(e) {
var r;
switch (i.charCodeAt(n)) {
case 91:
n++, ignored();
var t = [];
for (;93 !== i.charCodeAt(n); ) {
t.push(value(e));
}
return n++, ignored(), {
kind: "ListValue",
values: t
};
case 123:
n++, ignored();
var l = [];
for (;125 !== i.charCodeAt(n); ) {
var d = nameNode();
if (58 !== i.charCodeAt(n++)) {
throw error("ObjectField");
}
ignored(), l.push({
kind: "ObjectField",
name: d,
value: value(e)
});
}
return n++, ignored(), {
kind: "ObjectValue",
fields: l
};
case 36:
if (e) {
throw error("Variable");
}
return n++, {
kind: "Variable",
name: nameNode()
};
case 34:
if (34 === i.charCodeAt(n + 1) && 34 === i.charCodeAt(n + 2)) {
if (n += 3, null == (r = advance(a))) {
throw error("StringValue");
}
return ignored(), {
kind: "StringValue",
value: blockString(r.slice(0, -3)),
block: !0
};
} else {
var u = n;
var s;
n++;
var c = !1;
for (s = 0 | i.charCodeAt(n++); 92 === s && (n++, c = !0) || 10 !== s && 13 !== s && 34 !== s && s; s = 0 | i.charCodeAt(n++)) {}
if (34 !== s) {
throw error("StringValue");
}
return r = i.slice(u, n), ignored(), {
kind: "StringValue",
value: c ? JSON.parse(r) : r.slice(1, -1),
block: !1
};
}
case 45:
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
var v = n++;
var f;
for (;(f = 0 | i.charCodeAt(n++)) >= 48 && f <= 57; ) {}
var m = i.slice(v, --n);
if (46 === (f = i.charCodeAt(n)) || 69 === f || 101 === f) {
if (null == (r = advance(o))) {
throw error("FloatValue");
}
return ignored(), {
kind: "FloatValue",
value: m + r
};
} else {
return ignored(), {
kind: "IntValue",
value: m
};
}
case 110:
if (117 === i.charCodeAt(n + 1) && 108 === i.charCodeAt(n + 2) && 108 === i.charCodeAt(n + 3)) {
return n += 4, ignored(), {
kind: "NullValue"
};
} else {
break;
}
case 116:
if (114 === i.charCodeAt(n + 1) && 117 === i.charCodeAt(n + 2) && 101 === i.charCodeAt(n + 3)) {
return n += 4, ignored(), {
kind: "BooleanValue",
value: !0
};
} else {
break;
}
case 102:
if (97 === i.charCodeAt(n + 1) && 108 === i.charCodeAt(n + 2) && 115 === i.charCodeAt(n + 3) && 101 === i.charCodeAt(n + 4)) {
return n += 5, ignored(), {
kind: "BooleanValue",
value: !1
};
} else {
break;
}
}
return {
kind: "EnumValue",
value: name()
};
}
function arguments_(e) {
if (40 === i.charCodeAt(n)) {
var r = [];
n++, ignored();
do {
var t = nameNode();
if (58 !== i.charCodeAt(n++)) {
throw error("Argument");
}
ignored(), r.push({
kind: "Argument",
name: t,
value: value(e)
});
} while (41 !== i.charCodeAt(n));
return n++, ignored(), r;
}
}
function directives(e) {
if (64 === i.charCodeAt(n)) {
var r = [];
do {
n++, r.push({
kind: "Directive",
name: nameNode(),
arguments: arguments_(e)
});
} while (64 === i.charCodeAt(n));
return r;
}
}
function type() {
var e = 0;
for (;91 === i.charCodeAt(n); ) {
e++, n++, ignored();
}
var r = {
kind: "NamedType",
name: nameNode()
};
do {
if (33 === i.charCodeAt(n)) {
n++, ignored(), r = {
kind: "NonNullType",
type: r
};
}
if (e) {
if (93 !== i.charCodeAt(n++)) {
throw error("NamedType");
}
ignored(), r = {
kind: "ListType",
type: r
};
}
} while (e--);
return r;
}
function selectionSetStart() {
if (123 !== i.charCodeAt(n++)) {
throw error("SelectionSet");
}
return ignored(), selectionSet();
}
function selectionSet() {
var e = [];
do {
if (46 === i.charCodeAt(n)) {
if (46 !== i.charCodeAt(++n) || 46 !== i.charCodeAt(++n)) {
throw error("SelectionSet");
}
switch (n++, ignored(), i.charCodeAt(n)) {
case 64:
e.push({
kind: "InlineFragment",
typeCondition: void 0,
directives: directives(!1),
selectionSet: selectionSetStart()
});
break;
case 111:
if (110 === i.charCodeAt(n + 1)) {
n += 2, ignored(), e.push({
kind: "InlineFragment",
typeCondition: {
kind: "NamedType",
name: nameNode()
},
directives: directives(!1),
selectionSet: selectionSetStart()
});
} else {
e.push({
kind: "FragmentSpread",
name: nameNode(),
directives: directives(!1)
});
}
break;
case 123:
n++, ignored(), e.push({
kind: "InlineFragment",
typeCondition: void 0,
directives: void 0,
selectionSet: selectionSet()
});
break;
default:
e.push({
kind: "FragmentSpread",
name: nameNode(),
directives: directives(!1)
});
}
} else {
var r = nameNode();
var t = void 0;
if (58 === i.charCodeAt(n)) {
n++, ignored(), t = r, r = nameNode();
}
var a = arguments_(!1);
var o = directives(!1);
var l = void 0;
if (123 === i.charCodeAt(n)) {
n++, ignored(), l = selectionSet();
}
e.push({
kind: "Field",
alias: t,
name: r,
arguments: a,
directives: o,
selectionSet: l
});
}
} while (125 !== i.charCodeAt(n));
return n++, ignored(), {
kind: "SelectionSet",
selections: e
};
}
function variableDefinitions() {
if (ignored(), 40 === i.charCodeAt(n)) {
var e = [];
n++, ignored();
do {
var r = void 0;
if (34 === i.charCodeAt(n)) {
r = value(!0);
}
if (36 !== i.charCodeAt(n++)) {
throw error("Variable");
}
var t = nameNode();
if (58 !== i.charCodeAt(n++)) {
throw error("VariableDefinition");
}
ignored();
var a = type();
var o = void 0;
if (61 === i.charCodeAt(n)) {
n++, ignored(), o = value(!0);
}
ignored();
var l = {
kind: "VariableDefinition",
variable: {
kind: "Variable",
name: t
},
type: a,
defaultValue: o,
directives: directives(!0)
};
if (r) {
l.description = r;
}
e.push(l);
} while (41 !== i.charCodeAt(n));
return n++, ignored(), e;
}
}
function fragmentDefinition(e) {
var r = nameNode();
if (111 !== i.charCodeAt(n++) || 110 !== i.charCodeAt(n++)) {
throw error("FragmentDefinition");
}
ignored();
var t = {
kind: "FragmentDefinition",
name: r,
typeCondition: {
kind: "NamedType",
name: nameNode()
},
directives: directives(!1),
selectionSet: selectionSetStart()
};
if (e) {
t.description = e;
}
return t;
}
function definitions() {
var e = [];
do {
var r = void 0;
if (34 === i.charCodeAt(n)) {
r = value(!0);
}
if (123 === i.charCodeAt(n)) {
if (r) {
throw error("Document");
}
n++, ignored(), e.push({
kind: "OperationDefinition",
operation: "query",
name: void 0,
variableDefinitions: void 0,
directives: void 0,
selectionSet: selectionSet()
});
} else {
var t = name();
switch (t) {
case "fragment":
e.push(fragmentDefinition(r));
break;
case "query":
case "mutation":
case "subscription":
var a;
var o = void 0;
if (40 !== (a = i.charCodeAt(n)) && 64 !== a && 123 !== a) {
o = nameNode();
}
var l = {
kind: "OperationDefinition",
operation: t,
name: o,
variableDefinitions: variableDefinitions(),
directives: directives(!1),
selectionSet: selectionSetStart()
};
if (r) {
l.description = r;
}
e.push(l);
break;
default:
throw error("Document");
}
}
} while (n < i.length);
return e;
}
function parse(e, r) {
if (i = e.body ? e.body : e, n = 0, ignored(), r && r.noLocation) {
return {
kind: "Document",
definitions: definitions()
};
} else {
return {
kind: "Document",
definitions: definitions(),
loc: {
start: 0,
end: i.length,
startToken: void 0,
endToken: void 0,
source: {
body: i,
name: "graphql.web",
locationOffset: {
line: 1,
column: 1
}
}
}
};
}
}
function parseValue(e, r) {
return i = e.body ? e.body : e, n = 0, ignored(), value(!1);
}
function parseType(e, r) {
return i = e.body ? e.body : e, n = 0, type();
}
var l = {};
function visit(e, r) {
var i = [];
var n = [];
try {
var t = function traverse(e, t, a) {
var o = !1;
var d = r[e.kind] && r[e.kind].enter || r[e.kind] || r.enter;
var u = d && d.call(r, e, t, a, n, i);
if (!1 === u) {
return e;
} else if (null === u) {
return null;
} else if (u === l) {
throw l;
} else if (u && "string" == typeof u.kind) {
o = u !== e, e = u;
}
if (a) {
i.push(a);
}
var s;
var c = {
...e
};
for (var v in e) {
n.push(v);
var f = e[v];
if (Array.isArray(f)) {
var m = [];
for (var p = 0; p < f.length; p++) {
if (null != f[p] && "string" == typeof f[p].kind) {
if (i.push(e), n.push(p), s = traverse(f[p], p, f), n.pop(), i.pop(), null == s) {
o = !0;
} else {
o = o || s !== f[p], m.push(s);
}
}
}
f = m;
} else if (null != f && "string" == typeof f.kind) {
if (void 0 !== (s = traverse(f, v, e))) {
o = o || f !== s, f = s;
}
}
if (n.pop(), o) {
c[v] = f;
}
}
if (a) {
i.pop();
}
var h = r[e.kind] && r[e.kind].leave || r.leave;
var g = h && h.call(r, e, t, a, n, i);
if (g === l) {
throw l;
} else if (void 0 !== g) {
return g;
} else if (void 0 !== u) {
return o ? c : u;
} else {
return o ? c : e;
}
}(e);
return void 0 !== t && !1 !== t ? t : e;
} catch (r) {
if (r !== l) {
throw r;
}
return e;
}
}
function mapJoin(e, r, i) {
var n = "";
for (var t = 0; t < e.length; t++) {
if (t) {
n += r;
}
n += i(e[t]);
}
return n;
}
function printString(e) {
return JSON.stringify(e);
}
function printBlockString(e) {
return '"""\n' + e.replace(/"""/g, '\\"""') + '\n"""';
}
var d = "\n";
var u = {
OperationDefinition(e) {
var r = "";
if (e.description) {
r += u.StringValue(e.description) + "\n";
}
if (r += e.operation, e.name) {
r += " " + e.name.value;
}
if (e.variableDefinitions && e.variableDefinitions.length) {
if (!e.name) {
r += " ";
}
r += "(" + mapJoin(e.variableDefinitions, ", ", u.VariableDefinition) + ")";
}
if (e.directives && e.directives.length) {
r += " " + mapJoin(e.directives, " ", u.Directive);
}
var i = u.SelectionSet(e.selectionSet);
return "query" !== r ? r + " " + i : i;
},
VariableDefinition(e) {
var r = "";
if (e.description) {
r += u.StringValue(e.description) + " ";
}
if (r += u.Variable(e.variable) + ": " + _print(e.type), e.defaultValue) {
r += " = " + _print(e.defaultValue);
}
if (e.directives && e.directives.length) {
r += " " + mapJoin(e.directives, " ", u.Directive);
}
return r;
},
Field(e) {
var r = e.alias ? e.alias.value + ": " + e.name.value : e.name.value;
if (e.arguments && e.arguments.length) {
var i = mapJoin(e.arguments, ", ", u.Argument);
if (r.length + i.length + 2 > 80) {
r += "(" + (d += " ") + mapJoin(e.arguments, d, u.Argument) + (d = d.slice(0, -2)) + ")";
} else {
r += "(" + i + ")";
}
}
if (e.directives && e.directives.length) {
r += " " + mapJoin(e.directives, " ", u.Directive);
}
if (e.selectionSet && e.selectionSet.selections.length) {
r += " " + u.SelectionSet(e.selectionSet);
}
return r;
},
StringValue(e) {
if (e.block) {
return printBlockString(e.value).replace(/\n/g, d);
} else {
return printString(e.value);
}
},
BooleanValue: e => "" + e.value,
NullValue: e => "null",
IntValue: e => e.value,
FloatValue: e => e.value,
EnumValue: e => e.value,
Name: e => e.value,
Variable: e => "$" + e.name.value,
ListValue: e => "[" + mapJoin(e.values, ", ", _print) + "]",
ObjectValue: e => "{" + mapJoin(e.fields, ", ", u.ObjectField) + "}",
ObjectField: e => e.name.value + ": " + _print(e.value),
Document(e) {
if (!e.definitions || !e.definitions.length) {
return "";
} else {
return mapJoin(e.definitions, "\n\n", _print);
}
},
SelectionSet: e => "{" + (d += " ") + mapJoin(e.selections, d, _print) + (d = d.slice(0, -2)) + "}",
Argument: e => e.name.value + ": " + _print(e.value),
FragmentSpread(e) {
var r = "..." + e.name.value;
if (e.directives && e.directives.length) {
r += " " + mapJoin(e.directives, " ", u.Directive);
}
return r;
},
InlineFragment(e) {
var r = "...";
if (e.typeCondition) {
r += " on " + e.typeCondition.name.value;
}
if (e.directives && e.directives.length) {
r += " " + mapJoin(e.directives, " ", u.Directive);
}
return r += " " + u.SelectionSet(e.selectionSet);
},
FragmentDefinition(e) {
var r = "";
if (e.description) {
r += u.StringValue(e.description) + "\n";
}
if (r += "fragment " + e.name.value, r += " on " + e.typeCondition.name.value, e.directives && e.directives.length) {
r += " " + mapJoin(e.directives, " ", u.Directive);
}
return r + " " + u.SelectionSet(e.selectionSet);
},
Directive(e) {
var r = "@" + e.name.value;
if (e.arguments && e.arguments.length) {
r += "(" + mapJoin(e.arguments, ", ", u.Argument) + ")";
}
return r;
},
NamedType: e => e.name.value,
ListType: e => "[" + _print(e.type) + "]",
NonNullType: e => _print(e.type) + "!"
};
var _print = e => u[e.kind](e);
function print(e) {
return d = "\n", u[e.kind] ? u[e.kind](e) : "";
}
function valueFromASTUntyped(e, r) {
switch (e.kind) {
case "NullValue":
return null;
case "IntValue":
return parseInt(e.value, 10);
case "FloatValue":
return parseFloat(e.value);
case "StringValue":
case "EnumValue":
case "BooleanValue":
return e.value;
case "ListValue":
var i = [];
for (var n = 0, t = e.values.length; n < t; n++) {
i.push(valueFromASTUntyped(e.values[n], r));
}
return i;
case "ObjectValue":
var a = Object.create(null);
for (var o = 0, l = e.fields.length; o < l; o++) {
var d = e.fields[o];
a[d.name.value] = valueFromASTUntyped(d.value, r);
}
return a;
case "Variable":
return r && r[e.name.value];
}
}
function valueFromTypeNode(e, r, i) {
if ("Variable" === e.kind) {
return i ? valueFromTypeNode(i[e.name.value], r, i) : void 0;
} else if ("NonNullType" === r.kind) {
return "NullValue" !== e.kind ? valueFromTypeNode(e, r, i) : void 0;
} else if ("NullValue" === e.kind) {
return null;
} else if ("ListType" === r.kind) {
if ("ListValue" === e.kind) {
var n = [];
for (var t = 0, a = e.values.length; t < a; t++) {
var o = valueFromTypeNode(e.values[t], r.type, i);
if (void 0 === o) {
return;
} else {
n.push(o);
}
}
return n;
}
} else if ("NamedType" === r.kind) {
switch (r.name.value) {
case "Int":
case "Float":
case "String":
case "Bool":
return r.name.value + "Value" === e.kind ? valueFromASTUntyped(e, i) : void 0;
default:
return valueFromASTUntyped(e, i);
}
}
}
function isSelectionNode(e) {
return "Field" === e.kind || "FragmentSpread" === e.kind || "InlineFragment" === e.kind;
}
function Source(e, r, i) {
return {
body: e,
name: r,
locationOffset: i || {
line: 1,
column: 1
}
};
}
export { l as BREAK, GraphQLError, e as Kind, r as OperationTypeNode, Source, isSelectionNode, parse, parseType, parseValue, print, printBlockString, printString, valueFromASTUntyped, valueFromTypeNode, visit };
//# sourceMappingURL=graphql.web.mjs.map
File diff suppressed because one or more lines are too long
+115
View File
@@ -0,0 +1,115 @@
{
"name": "@0no-co/graphql.web",
"description": "A spec-compliant client-side GraphQL implementation",
"version": "1.2.0",
"author": "0no.co <hi@0no.co>",
"source": "./src/index.ts",
"main": "./dist/graphql.web",
"module": "./dist/graphql.web.mjs",
"types": "./dist/graphql.web.d.ts",
"sideEffects": false,
"files": [
"LICENSE",
"README.md",
"dist/"
],
"exports": {
".": {
"types": "./dist/graphql.web.d.ts",
"import": "./dist/graphql.web.mjs",
"require": "./dist/graphql.web.js",
"source": "./src/index.ts"
},
"./package.json": "./package.json"
},
"peerDependencies": {
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
},
"peerDependenciesMeta": {
"graphql": {
"optional": true
}
},
"public": true,
"keywords": [
"graphql",
"graphql-js",
"client-side graphql"
],
"repository": "https://github.com/0no-co/graphql.web",
"bugs": {
"url": "https://github.com/0no-co/graphql.web/issues"
},
"license": "MIT",
"prettier": {
"singleQuote": true,
"tabWidth": 2,
"printWidth": 100,
"trailingComma": "es5"
},
"lint-staged": {
"*.{ts,js}": "eslint -c scripts/eslint-preset.js --fix",
"*.json": "prettier --write",
"*.md": "prettier --write"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged --quiet --relative"
}
},
"eslintConfig": {
"root": true,
"extends": [
"./scripts/eslint-preset.js"
]
},
"devDependencies": {
"@actions/core": "^1.10.0",
"@actions/github": "^5.1.1",
"@babel/plugin-transform-block-scoping": "^7.23.4",
"@babel/plugin-transform-typescript": "^7.23.6",
"@changesets/cli": "^2.27.1",
"@changesets/get-github-info": "^0.6.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"@vitest/coverage-v8": "^1.2.2",
"dotenv": "^16.4.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-tsdoc": "^0.2.17",
"husky-v4": "^4.3.8",
"jsr": "^0.12.1",
"lint-staged": "^15.2.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.2.4",
"rimraf": "^5.0.5",
"rollup": "^4.9.6",
"rollup-plugin-cjs-check": "^1.0.3",
"rollup-plugin-dts": "^6.1.0",
"terser": "^5.27.0",
"typescript": "^5.3.3",
"vitest": "^1.2.2",
"graphql15": "npm:graphql@^15.8.0",
"graphql16": "npm:graphql@^16.8.1",
"graphql17": "npm:graphql@^17.0.0-alpha.3"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"scripts": {
"test": "vitest test",
"bench": "vitest bench --typecheck.enabled=false",
"check": "tsc",
"lint": "eslint --ext=js,ts .",
"build": "rollup -c scripts/rollup.config.mjs",
"clean": "rimraf dist node_modules/.cache",
"changeset:version": "changeset version && pnpm install --lockfile-only && node ./scripts/jsr.js",
"changeset:publish": "changeset publish && jsr publish"
}
}