Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gql.tada

Package Overview
Dependencies
Maintainers
1
Versions
234
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.3.0-canary-215fa6873b5c9a386d95be0d2f97d86d7d60b8a9 to 1.3.0-canary-2662d44b1ba148de056c39701b899b1011b33411

282

dist/gql-tada.d.ts

@@ -20,14 +20,6 @@ import { Kind, OperationTypeNode, DocumentNode } from '@0no-co/graphql.web';

}
? T extends infer U
? {
[K in keyof U]: U[K];
}
: never
? {
[K in keyof T]: T[K];
}
: never;
/** Retrieves all non-nullish value types of an object dictionary. */
type objValues<T> = T[keyof T] extends infer U
? U extends null | undefined | never | void
? never
: U
: never;
/** Annotations for GraphQL’s `DocumentNode` with attached generics for its result data and variables types.

@@ -842,3 +834,3 @@ *

kind: Kind.DOCUMENT;
definitions: any[];
definitions: readonly any[];
};

@@ -975,3 +967,3 @@

};
type _unwrapTypeRec$1<
type unwrapTypeRec$1<
Type,

@@ -983,2 +975,3 @@ SelectionSet,

},
IsOptional,
> = Type extends {

@@ -988,3 +981,9 @@ readonly kind: 'NON_NULL';

}
? _unwrapTypeRec$1<Type['ofType'], SelectionSet, Introspection, Fragments>
? unwrapTypeRec$1<
Type['ofType'],
SelectionSet,
Introspection,
Fragments,
IsOptional extends void ? false : IsOptional
>
: Type extends {

@@ -994,3 +993,5 @@ readonly kind: 'LIST';

}
? Array<unwrapType$1<Type['ofType'], SelectionSet, Introspection, Fragments>>
? IsOptional extends false
? Array<unwrapTypeRec$1<Type['ofType'], SelectionSet, Introspection, Fragments, void>>
: null | Array<unwrapTypeRec$1<Type['ofType'], SelectionSet, Introspection, Fragments, void>>
: Type extends {

@@ -1004,29 +1005,20 @@ readonly name: string;

}
? getSelection<
SelectionSet['selections'],
Introspection['types'][Type['name']],
Introspection,
Fragments
>
? IsOptional extends false
? getSelection<
SelectionSet['selections'],
Introspection['types'][Type['name']],
Introspection,
Fragments
>
: null | getSelection<
SelectionSet['selections'],
Introspection['types'][Type['name']],
Introspection,
Fragments
>
: unknown
: Introspection['types'][Type['name']]['type']
: IsOptional extends false
? Introspection['types'][Type['name']]['type']
: null | Introspection['types'][Type['name']]['type']
: unknown;
type unwrapType$1<
Type,
SelectionSet,
Introspection extends IntrospectionLikeType,
Fragments extends {
[name: string]: any;
},
TypeDirective = void,
> = Type extends {
readonly kind: 'NON_NULL';
readonly ofType: any;
}
? 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<Node> = Node extends {

@@ -1038,4 +1030,4 @@ directives: any[];

? void
: 'optional'
: 'required'
: true
: false
: void;

@@ -1061,2 +1053,3 @@ type isOptional<Node> = Node extends {

Node,
PossibleType extends string,
Type extends ObjectLikeType,

@@ -1071,3 +1064,10 @@ Introspection extends IntrospectionLikeType,

}
? getSelection<Node['selectionSet']['selections'], Type, Introspection, Fragments>
? getPossibleTypeSelectionRec<
Node['selectionSet']['selections'],
PossibleType,
Type,
Introspection,
Fragments,
{}
>
: Node extends {

@@ -1082,7 +1082,9 @@ kind: Kind.FRAGMENT_SPREAD;

? Fragments[Node['name']['value']][$tada.ref]
: getSelection<
: getPossibleTypeSelectionRec<
Fragments[Node['name']['value']]['selectionSet']['selections'],
PossibleType,
Type,
Introspection,
Fragments
Fragments,
{}
>

@@ -1134,24 +1136,25 @@ : {}

},
> = 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;
> = Type extends {
kind: 'UNION' | 'INTERFACE';
possibleTypes: any;
}
? {
[PossibleType in Type['possibleTypes']]: getPossibleTypeSelectionRec<
Selections,
PossibleType,
Type,
Introspection,
Fragments,
{
__typename?: PossibleType;
}
? _getPossibleTypeSelectionRec<Selections, Type['name'], Type, Introspection, Fragments>
: {}
>;
type _getPossibleTypeSelectionRec<
>;
}[Type['possibleTypes']]
: Type extends {
kind: 'OBJECT';
name: any;
}
? getPossibleTypeSelectionRec<Selections, Type['name'], Type, Introspection, Fragments, {}>
: {};
type getPossibleTypeSelectionRec<
Selections,

@@ -1164,5 +1167,5 @@ PossibleType extends string,

},
SelectionAcc = {},
SelectionAcc,
> = Selections extends [infer Node, ...infer Rest]
? _getPossibleTypeSelectionRec<
? getPossibleTypeSelectionRec<
Rest,

@@ -1181,3 +1184,3 @@ PossibleType,

| (isOptional<Node> extends true ? {} : never)
| getFragmentSelection<Node, Subtype, Introspection, Fragments>
| getFragmentSelection<Node, PossibleType, Subtype, Introspection, Fragments>
: {}

@@ -1199,3 +1202,3 @@ : Node extends {

? PossibleType
: unwrapType$1<
: unwrapTypeRec$1<
Type['fields'][Node['name']['value']]['type'],

@@ -1211,3 +1214,3 @@ Node['selectionSet'],

? PossibleType
: unwrapType$1<
: unwrapTypeRec$1<
Type['fields'][Node['name']['value']]['type'],

@@ -1223,3 +1226,3 @@ Node['selectionSet'],

>
: SelectionAcc;
: obj<SelectionAcc>;
type getOperationSelectionType<

@@ -1304,3 +1307,3 @@ Definition,

? InputField extends {
defaultValue: undefined | null;
defaultValue?: undefined | null;
type: {

@@ -1311,6 +1314,10 @@ kind: 'NON_NULL';

? {
[Name in InputField['name']]: unwrapType<InputField['type'], Introspection>;
[Name in InputField['name']]: unwrapTypeRec<InputField['type'], Introspection, true>;
}
: {
[Name in InputField['name']]?: unwrapType<InputField['type'], Introspection> | null;
[Name in InputField['name']]?: unwrapTypeRec<
InputField['type'],
Introspection,
true
> | null;
}

@@ -1321,7 +1328,11 @@ : {}) &

: InputObject;
type _unwrapTypeRec<TypeRef, Introspection extends IntrospectionLikeType> = TypeRef extends {
type unwrapTypeRec<
TypeRef,
Introspection extends IntrospectionLikeType,
IsOptional,
> = TypeRef extends {
kind: 'NON_NULL';
ofType: any;
}
? _unwrapTypeRec<TypeRef['ofType'], Introspection>
? unwrapTypeRec<TypeRef['ofType'], Introspection, false>
: TypeRef extends {

@@ -1331,19 +1342,21 @@ kind: 'LIST';

}
? Array<unwrapType<TypeRef['ofType'], Introspection>>
? IsOptional extends false
? Array<unwrapTypeRec<TypeRef['ofType'], Introspection, true>>
: null | Array<unwrapTypeRec<TypeRef['ofType'], Introspection, true>>
: TypeRef extends {
name: any;
}
? _getScalarType<TypeRef['name'], Introspection>
? IsOptional extends false
? _getScalarType<TypeRef['name'], Introspection>
: null | _getScalarType<TypeRef['name'], Introspection>
: unknown;
type unwrapType<Type, Introspection extends IntrospectionLikeType> = Type extends {
kind: 'NON_NULL';
ofType: any;
}
? _unwrapTypeRec<Type['ofType'], Introspection>
: null | _unwrapTypeRec<Type, Introspection>;
type _unwrapTypeRefRec<Type, Introspection extends IntrospectionLikeType> = Type extends {
type unwrapTypeRefRec<
Type,
Introspection extends IntrospectionLikeType,
IsOptional,
> = Type extends {
kind: Kind.NON_NULL_TYPE;
type: any;
}
? _unwrapTypeRefRec<Type['type'], Introspection>
? unwrapTypeRefRec<Type['type'], Introspection, false>
: Type extends {

@@ -1353,3 +1366,5 @@ kind: Kind.LIST_TYPE;

}
? Array<unwrapTypeRef<Type['type'], Introspection>>
? IsOptional extends false
? Array<unwrapTypeRefRec<Type['type'], Introspection, true>>
: null | Array<unwrapTypeRefRec<Type['type'], Introspection, true>>
: Type extends {

@@ -1359,10 +1374,6 @@ kind: Kind.NAMED_TYPE;

}
? _getScalarType<Type['name']['value'], Introspection>
? IsOptional extends false
? _getScalarType<Type['name']['value'], Introspection>
: null | _getScalarType<Type['name']['value'], Introspection>
: unknown;
type unwrapTypeRef<Type, Introspection extends IntrospectionLikeType> = Type extends {
kind: Kind.NON_NULL_TYPE;
type: any;
}
? _unwrapTypeRefRec<Type['type'], Introspection>
: null | _unwrapTypeRefRec<Type, Introspection>;
type _getVariablesRec<

@@ -1388,11 +1399,13 @@ Variables,

? {
[Name in Variable['variable']['name']['value']]: unwrapTypeRef<
[Name in Variable['variable']['name']['value']]: unwrapTypeRefRec<
Variable['type'],
Introspection
Introspection,
true
>;
}
: {
[Name in Variable['variable']['name']['value']]?: unwrapTypeRef<
[Name in Variable['variable']['name']['value']]?: unwrapTypeRefRec<
Variable['type'],
Introspection
Introspection,
true
>;

@@ -1596,2 +1609,34 @@ }

): getScalarType<Name, Schema>;
/** Function to replace a GraphQL document with a persisted document.
*
* @typeParam Document - The document type of {@link TadaDocumentNode}.
* @param id - A document ID that replaces the document for the API.
* @returns A {@link TadaPersistedDocumentNode}.
*
* @remarks
* This function may be used to replace a GraphQL document with a
* stand-in, persisted document.
*
* The returned document’s value won’t contain any of the document’s
* definitions, but its type will be equivalent to the `Document` that’s
* been passed as a generic.
*
* As long as the query (type parameter of `Document`) is only referenced
* as a type in your code, it will be omitted from your output build by
* your bundler and the resulting GraphQL document’s ID will replace your
* document entirely.
*
* @example
* ```
* import { graphql } from 'gql.tada';
*
* const query = graphql(`query MyQuery { __typename }`);
* const persisted = graphql.persisted<typeof query>('MyQuery');
* ```
*/
persisted<Document extends DocumentNodeLike = never>(
documentId: string
): Document extends DocumentDecoration<infer Result, infer Variables>
? TadaPersistedDocumentNode<Result, Variables>
: never;
}

@@ -1653,11 +1698,9 @@ type schemaOfSetup<Setup extends AbstractSetupSchema> = mapIntrospection<

isMaskingDisabled = false,
> = getDocumentType<Document, Introspection, Fragments> extends infer Result
? Result extends never
? never
: TadaDocumentNode<
Result,
getVariablesType<Document, Introspection>,
decorateFragmentDef<Document, isMaskingDisabled>
>
: never;
> = getDocumentType<Document, Introspection, Fragments> extends never
? never
: TadaDocumentNode<
getDocumentType<Document, Introspection, Fragments>,
getVariablesType<Document, Introspection>,
decorateFragmentDef<Document, isMaskingDisabled>
>;
/** A GraphQL `DocumentNode` with attached types for results and variables.

@@ -1688,2 +1731,24 @@ *

makeDefinitionDecoration<Decoration> {}
/** A GraphQL persisted document with attached types for results and variables.
*
* @remarks
* This type still matches a GraphQL {@link DocumentNode}, but doesn’t contain
* any definitions. At runtime, this means that this document is empty.
*
* Instead of its definitions, it carries an `id` property that is typically
* used to uniquely identify the document to your GraphQL API, without disclosing
* the shape of the query or schema transparently.
*/
interface TadaPersistedDocumentNode<
Result = {
[key: string]: any;
},
Variables = {
[key: string]: any;
},
> extends DocumentNode,
DocumentDecoration<Result, Variables> {
definitions: readonly [];
documentId: string;
}
/** A utility type returning the `Result` type of typed GraphQL documents.

@@ -1912,2 +1977,3 @@ *

type TadaDocumentNode,
type TadaPersistedDocumentNode,
type VariablesOf,

@@ -1914,0 +1980,0 @@ graphql,

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

function initGraphQLTada() {
function graphql(e, a) {
var n = r.parse(e).definitions;
function graphql(e, n) {
var a = r.parse(e).definitions;
var i = new Set;
for (var t of a || []) {
for (var t of n || []) {
for (var s of t.definitions) {
if (s.kind === r.Kind.FRAGMENT_DEFINITION && !i.has(s)) {
n.push(s);
a.push(s);
i.add(s);

@@ -20,8 +20,8 @@ }

}
if (n[0].kind === r.Kind.FRAGMENT_DEFINITION && n[0].directives) {
n[0].directives = n[0].directives.filter((r => "_unmask" !== r.name.value));
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
};

@@ -32,2 +32,9 @@ }

};
graphql.persisted = function persisted(e) {
return {
kind: r.Kind.DOCUMENT,
definitions: [],
documentId: e
};
};
return graphql;

@@ -34,0 +41,0 @@ }

{
"name": "gql.tada",
"description": "The spec-compliant & magical GraphQL query language engine in the TypeScript type system",
"version": "1.3.0-canary-215fa6873b5c9a386d95be0d2f97d86d7d60b8a9",
"version": "1.3.0-canary-2662d44b1ba148de056c39701b899b1011b33411",
"author": "0no.co <hi@0no.co>",

@@ -39,3 +39,3 @@ "source": "./src/index.ts",

"@0no-co/graphql.web": "^1.0.4",
"@gql.tada/cli-utils": "0.1.0-canary-215fa6873b5c9a386d95be0d2f97d86d7d60b8a9"
"@gql.tada/cli-utils": "0.1.0-canary-2662d44b1ba148de056c39701b899b1011b33411"
},

@@ -42,0 +42,0 @@ "public": true,

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