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-e0647437a4ac950bfb88a72db2386e354bdb07f7

116

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

@@ -1054,4 +1089,6 @@ : never;

? 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<

@@ -1541,3 +1578,3 @@ Fragments[Node['name']['value']]['selectionSet']['selections'],

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

@@ -1549,5 +1586,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.

@@ -1559,3 +1594,3 @@ *

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

@@ -1594,8 +1629,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)[]

@@ -1602,0 +1632,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-e0647437a4ac950bfb88a72db2386e354bdb07f7",
"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