Socket
Socket
Sign inDemoInstall

gql.tada

Package Overview
Dependencies
Maintainers
1
Versions
229
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gql.tada - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0-canary-11e24818de5b33062257bcdfd5316e6900387c39

230

dist/gql-tada.d.ts
import {
Kind,
OperationTypeNode,
DocumentNode,
FragmentSpreadNode,

@@ -10,2 +9,3 @@ InlineFragmentNode,

TypeNode,
DocumentNode,
} from '@0no-co/graphql.web';

@@ -903,26 +903,36 @@

type fragmentRefs = typeof fragmentRefs;
const fragmentDef: unique symbol;
type fragmentDef = typeof fragmentDef;
const fragmentId: unique symbol;
type fragmentId = typeof fragmentId;
const definition: unique symbol;
type definition = typeof definition;
const ref: unique symbol;
type ref = typeof ref;
}
interface FragmentDefDecorationLike {
readonly [$tada.fragmentId]: symbol;
kind: Kind.FRAGMENT_DEFINITION;
name: any;
typeCondition: any;
fragment: any;
on: any;
masked: any;
}
interface DocumentDefDecorationLike extends DocumentNode {
[$tada.fragmentDef]?: FragmentDefDecorationLike;
interface DocumentDefDecorationLike {
[$tada.definition]?: FragmentDefDecorationLike;
}
type isMaskedRec<Directives extends readonly unknown[] | undefined> = Directives extends readonly [
infer Directive,
...infer Rest,
]
? Directive extends {
kind: Kind.DIRECTIVE;
name: any;
}
? Directive['name']['value'] extends '_unmask'
? false
: isMaskedRec<Rest>
: isMaskedRec<Rest>
: true;
type decorateFragmentDef<Document extends DocumentNodeLike> = Document['definitions'][0] extends {
kind: Kind.FRAGMENT_DEFINITION;
name: any;
typeCondition: any;
}
? {
kind: Kind.FRAGMENT_DEFINITION;
name: Document['definitions'][0]['name'];
typeCondition: Document['definitions'][0]['typeCondition'];
readonly [$tada.fragmentId]: unique symbol;
fragment: Document['definitions'][0]['name']['value'];
on: Document['definitions'][0]['typeCondition']['name']['value'];
masked: isMaskedRec<Document['definitions'][0]['directives']>;
}

@@ -935,11 +945,22 @@ : never;

? (Document extends {
[$tada.fragmentDef]?: any;
[$tada.definition]?: any;
}
? Exclude<Document[$tada.fragmentDef], undefined> extends infer FragmentDef extends {
kind: Kind.FRAGMENT_DEFINITION;
name: any;
typeCondition: any;
}
? Exclude<Document[$tada.definition], undefined> extends infer Definition extends
FragmentDefDecorationLike
? {
[Name in FragmentDef['name']['value']]: FragmentDef;
[Name in Definition['fragment']]: {
kind: Kind.FRAGMENT_DEFINITION;
name: {
kind: Kind.NAME;
value: Definition['fragment'];
};
typeCondition: {
kind: Kind.NAMED_TYPE;
name: {
kind: Kind.NAME;
value: Definition['on'];
};
};
[$tada.ref]: makeFragmentRef<Document>;
};
}

@@ -950,7 +971,21 @@ : {}

: {};
type makeFragmentRef<Definition extends FragmentDefDecorationLike> = obj<{
[$tada.fragmentRefs]: {
[Name in Definition['name']['value']]: Definition[$tada.fragmentId];
};
}>;
type makeFragmentRef<Document> = Document extends {
[$tada.definition]?: infer Definition;
}
? Definition extends FragmentDefDecorationLike
? Definition['masked'] extends false
? Document extends DocumentDecoration<infer Result, any>
? Result
: {
[$tada.fragmentRefs]: {
[Name in Definition['fragment']]: $tada.ref;
};
}
: {
[$tada.fragmentRefs]: {
[Name in Definition['fragment']]: $tada.ref;
};
}
: never
: never;
type makeUndefinedFragmentRef<FragmentName extends string> = {

@@ -961,4 +996,4 @@ [$tada.fragmentRefs]: {

};
type makeFragmentDefDecoration<Definition> = {
[$tada.fragmentDef]?: Definition extends DocumentDefDecorationLike[$tada.fragmentDef]
type makeDefinitionDecoration<Definition> = {
[$tada.definition]?: Definition extends DocumentDefDecorationLike[$tada.definition]
? Definition

@@ -977,7 +1012,3 @@ : never;

Type extends IntrospectionTypeRef,
SelectionSet extends
| {
kind: Kind.SELECTION_SET;
}
| undefined,
SelectionSet,
Introspection extends IntrospectionLikeType,

@@ -1008,7 +1039,3 @@ Fragments extends {

Type extends IntrospectionTypeRef,
SelectionSet extends
| {
kind: Kind.SELECTION_SET;
}
| undefined,
SelectionSet,
Introspection extends IntrospectionLikeType,

@@ -1018,16 +1045,38 @@ Fragments extends {

},
TypeDirective = void,
> = Type extends IntrospectionNonNullTypeRef
? _unwrapTypeRec$1<Type['ofType'], SelectionSet, Introspection, Fragments>
: null | _unwrapTypeRec$1<Type, SelectionSet, Introspection, Fragments>;
type isOptionalRec<Directives extends readonly unknown[] | undefined> =
Directives extends readonly [infer Directive, ...infer Rest]
? Directive extends {
kind: Kind.DIRECTIVE;
name: any;
}
? Directive['name']['value'] extends 'include' | 'skip' | 'defer'
? true
: isOptionalRec<Rest>
? TypeDirective extends 'optional'
? null | _unwrapTypeRec$1<Type['ofType'], SelectionSet, Introspection, Fragments>
: _unwrapTypeRec$1<Type['ofType'], SelectionSet, Introspection, Fragments>
: TypeDirective extends 'required'
? _unwrapTypeRec$1<Type, SelectionSet, Introspection, Fragments>
: null | _unwrapTypeRec$1<Type, SelectionSet, Introspection, Fragments>;
type getTypeDirective<Directives extends readonly any[] | undefined> = Directives extends readonly [
infer Directive,
...infer Rest,
]
? Directive extends {
kind: Kind.DIRECTIVE;
name: any;
}
? Directive['name']['value'] extends 'required' | '_required'
? 'required'
: Directive['name']['value'] extends 'optional' | '_optional'
? 'optional'
: getTypeDirective<Rest>
: getTypeDirective<Rest>
: void;
type isOptionalRec<Directives extends readonly any[] | undefined> = Directives extends readonly [
infer Directive,
...infer Rest,
]
? Directive extends {
kind: Kind.DIRECTIVE;
name: any;
}
? Directive['name']['value'] extends 'include' | 'skip' | 'defer'
? true
: isOptionalRec<Rest>
: false;
: isOptionalRec<Rest>
: false;
type getFieldAlias<Node extends FieldNode> = Node['alias'] extends undefined

@@ -1057,4 +1106,6 @@ ? Node['name']['value']

? Node['name']['value'] extends keyof Fragments
? Fragments[Node['name']['value']] extends FragmentDefDecorationLike
? makeFragmentRef<Fragments[Node['name']['value']]>
? Fragments[Node['name']['value']] extends {
[$tada.ref]: any;
}
? Fragments[Node['name']['value']][$tada.ref]
: getSelection<

@@ -1107,5 +1158,25 @@ Fragments[Node['name']['value']]['selectionSet']['selections'],

},
> = obj<getPossibleTypesSelection<Selections, Type, Introspection, Fragments>>;
> = obj<
Type extends {
kind: 'UNION' | 'INTERFACE';
possibleTypes: any;
}
? objValues<{
[PossibleType in Type['possibleTypes']]: _getPossibleTypeSelectionRec<
Selections,
PossibleType,
Type,
Introspection,
Fragments
>;
}>
: Type extends {
kind: 'OBJECT';
name: any;
}
? _getPossibleTypeSelectionRec<Selections, Type['name'], Type, Introspection, Fragments>
: {}
>;
type _getPossibleTypeSelectionRec<
Selections extends readonly unknown[],
Selections extends readonly any[],
PossibleType extends string,

@@ -1138,3 +1209,4 @@ Type extends ObjectLikeType,

Introspection,
Fragments
Fragments,
getTypeDirective<Node['directives']>
>;

@@ -1149,3 +1221,4 @@ }

Introspection,
Fragments
Fragments,
getTypeDirective<Node['directives']>
>;

@@ -1156,28 +1229,2 @@ }

: {};
type getPossibleTypesSelection<
Selections extends readonly unknown[],
Type extends ObjectLikeType,
Introspection extends IntrospectionLikeType,
Fragments extends {
[name: string]: any;
},
> = Type extends {
kind: 'UNION' | 'INTERFACE';
possibleTypes: any;
}
? objValues<{
[PossibleType in Type['possibleTypes']]: _getPossibleTypeSelectionRec<
Selections,
PossibleType,
Type,
Introspection,
Fragments
>;
}>
: Type extends {
kind: 'OBJECT';
name: any;
}
? _getPossibleTypeSelectionRec<Selections, Type['name'], Type, Introspection, Fragments>
: {};
type getOperationSelectionType<

@@ -1548,3 +1595,3 @@ Definition,

DocumentDecoration<Result, Variables>,
makeFragmentDefDecoration<Decoration> {}
makeDefinitionDecoration<Decoration> {}
/** A utility type returning the `Result` type of typed GraphQL documents.

@@ -1556,5 +1603,3 @@ *

*/
type ResultOf<Document> = Document extends DocumentDecoration<infer Result, infer _>
? Result
: never;
type ResultOf<Document> = Document extends DocumentDecoration<infer Result, any> ? Result : never;
/** A utility type returning the `Variables` type of typed GraphQL documents.

@@ -1566,3 +1611,3 @@ *

*/
type VariablesOf<Document> = Document extends DocumentDecoration<infer _, infer Variables>
type VariablesOf<Document> = Document extends DocumentDecoration<any, infer Variables>
? Variables

@@ -1601,8 +1646,3 @@ : never;

*/
type FragmentOf<Document extends DocumentDefDecorationLike> = Exclude<
Document[$tada.fragmentDef],
undefined
> extends infer FragmentDef extends FragmentDefDecorationLike
? makeFragmentRef<FragmentDef>
: never;
type FragmentOf<Document extends DocumentDefDecorationLike> = makeFragmentRef<Document>;
type mirrorFragmentTypeRec<Fragment, Data> = Fragment extends (infer Value)[]

@@ -1609,0 +1649,0 @@ ? mirrorFragmentTypeRec<Value, Data>[]

@@ -8,16 +8,19 @@ Object.defineProperty(exports, "__esModule", {

function initGraphQLTada() {
return function graphql(a, e) {
var n = r.parse(a).definitions;
var i = new Set;
for (var t of e || []) {
for (var o of t.definitions) {
if (o.kind === r.Kind.FRAGMENT_DEFINITION && !i.has(o)) {
n.push(o);
i.add(o);
return function graphql(e, i) {
var a = r.parse(e).definitions;
var n = new Set;
for (var t of i || []) {
for (var d of t.definitions) {
if (d.kind === r.Kind.FRAGMENT_DEFINITION && !n.has(d)) {
a.push(d);
n.add(d);
}
}
}
if (a[0].kind === r.Kind.FRAGMENT_DEFINITION && a[0].directives) {
a[0].directives = a[0].directives.filter((r => "_unmask" !== r.name.value));
}
return {
kind: r.Kind.DOCUMENT,
definitions: [ ...n ]
definitions: a
};

@@ -27,15 +30,15 @@ };

var a = initGraphQLTada();
var e = initGraphQLTada();
exports.graphql = a;
exports.graphql = e;
exports.initGraphQLTada = initGraphQLTada;
exports.parse = function parse(a) {
return r.parse(a);
exports.parse = function parse(e) {
return r.parse(e);
};
exports.readFragment = function readFragment(r, a) {
return a;
exports.readFragment = function readFragment(r, e) {
return e;
};
//# sourceMappingURL=gql-tada.js.map
{
"name": "gql.tada",
"description": "The spec-compliant & magical GraphQL query language engine in the TypeScript type system",
"version": "1.0.3",
"version": "1.1.0-canary-11e24818de5b33062257bcdfd5316e6900387c39",
"author": "0no.co <hi@0no.co>",

@@ -6,0 +6,0 @@ "source": "./src/index.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc