Merge branch 'master' into node-url-domain-to-ascii

This commit is contained in:
Nathan Shively-Sanders
2018-03-28 11:29:23 -07:00
186 changed files with 4235 additions and 2109 deletions
+21 -18
View File
@@ -11,6 +11,9 @@ const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
return results;
};
WScript.Echo('Hello, world');
WScript.Quit();
// source -- https://msdn.microsoft.com/en-us/library/windows/desktop/ms630826(v=vs.85).aspx
{
const cd = new ActiveXObject('WIA.CommonDialog');
@@ -51,7 +54,7 @@ const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
{
const dev = cd.ShowSelectDevice();
if (dev) {
collectionToArray(dev.Properties).forEach(p => {
for (const p of collectionToArray(dev.Properties)) {
let s = `${p.Name} (${p.PropertyID}) = `;
if (p.IsVector) {
s += '[vector of data]';
@@ -84,7 +87,7 @@ const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
}
WScript.Echo(s);
});
}
}
}
@@ -112,7 +115,7 @@ const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
{
const img = cd.ShowAcquireImage();
if (img) {
collectionToArray(img.Properties).forEach(p => {
for (const p of collectionToArray(img.Properties)) {
let contents = '';
if (p.IsVector) {
contents = '[vector data not emitted]';
@@ -124,7 +127,7 @@ const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
contents = p.Value;
}
WScript.Echo(`${p.Name} (${p.PropertyID}) = ${contents}`);
});
}
}
}
@@ -133,12 +136,12 @@ const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
const dev = cd.ShowSelectDevice();
if (dev) {
const actionEvent = WIA.WiaEventFlag.ActionEvent;
collectionToArray(dev.Events).forEach(e => {
for (const e of collectionToArray(dev.Events)) {
const msg = (e.Type & actionEvent) === actionEvent ?
`${e.Name} is an Action event` :
`${e.Name} is not an Action event`;
WScript.Echo(msg);
});
}
}
}
@@ -208,14 +211,14 @@ Frame count = ${img.FrameCount}}
// Create an imageprocess object and enumerate filters
{
const ip = new ActiveXObject('WIA.ImageProcess');
collectionToArray(ip.FilterInfos).forEach(fi => {
for (const fi of collectionToArray(ip.FilterInfos)) {
const s = [
fi.Name,
new Array(51).join('='),
fi.Description
].join('\n');
WScript.Echo(s);
});
}
}
// Create an imageprocess object and create one of each available filter
@@ -269,11 +272,11 @@ Frame count = ${img.FrameCount}}
WScript.Echo(s);
};
collectionToArray(ip.FilterInfos).forEach(fi => {
for (const fi of collectionToArray(ip.FilterInfos)) {
ip.Filters.Add(fi.FilterID);
listProperties(ip.Filters(1));
ip.Filters.Remove(1);
});
}
}
// List the supported transfer formats
@@ -308,14 +311,14 @@ Frame count = ${img.FrameCount}}
{
const dev = cd.ShowSelectDevice();
if (dev) {
collectionToArray(dev.Items).forEach(item => {
for (const item of collectionToArray(dev.Items)) {
let s: string = item.Properties("Item Name").Value;
if (item.Properties.Exists("Item Time Stamp")) {
const v: WIA.Vector = item.Properties("Item Time Stamp").Value;
if (v.Count === 8) { s += ` (${v.Date})`; }
}
WScript.Echo(s);
});
}
}
}
@@ -340,16 +343,16 @@ Frame count = ${img.FrameCount}}
}
// List all available devices by name and deviceid
collectionToArray(dm.DeviceInfos).forEach(di => {
for (const di of collectionToArray(dm.DeviceInfos)) {
const name: string = di.Properties("Name").Value;
WScript.Echo(`${name} (${di.DeviceID})`);
});
}
// Display all the properties for the selected device
{
const dev = cd.ShowSelectDevice();
if (dev) {
collectionToArray(dev.Properties).forEach(p => {
for (const p of collectionToArray(dev.Properties)) {
const name = `${p.Name} (${p.PropertyID})`;
let contents: string;
if (p.IsVector) {
@@ -360,7 +363,7 @@ Frame count = ${img.FrameCount}}
contents = p.Value;
}
WScript.Echo(`${name} = ${contents}`);
});
}
}
}
@@ -430,7 +433,7 @@ Frame count = ${img.FrameCount}}
if (args[0] === 'connect') {
const deviceID = args[1].substr(12);
const device = dm.DeviceInfos(deviceID).Connect();
collectionToArray(device.Items).forEach(item => {
for (const item of collectionToArray(device.Items)) {
const img = item.Transfer();
img.SaveFile(`C:\\${item.Properties('Item Name').Value}.${img.FileExtension}`);
@@ -445,7 +448,7 @@ Frame count = ${img.FrameCount}}
WScript.Echo(error);
}
}
});
}
WScript.Quit();
}
break;
+2 -2
View File
@@ -14,14 +14,14 @@ function ResponseCallback(err: Error | null, response: Azure.ServiceBus.Response
const ServiceBus = AzureSB.createServiceBusService('connectionstring');
// Queues
ServiceBus.listQueues('', createResultCallback<Models.Queue[]>());
ServiceBus.listQueues(createResultCallback<Models.Queue[]>());
ServiceBus.createQueue('test', createResultCallback<Models.Queue>());
ServiceBus.createQueueIfNotExists('test', createResultCallback<boolean>());
ServiceBus.getQueue('test', createResultCallback<Models.Queue>());
ServiceBus.deleteQueue('test', ResponseCallback);
// Topics
ServiceBus.listTopics('', createResultCallback<Models.Topic[]>());
ServiceBus.listTopics(createResultCallback<Models.Topic[]>());
ServiceBus.createTopic('test', createResultCallback<Models.Topic>());
ServiceBus.createTopicIfNotExists('test', createResultCallback<boolean>());
ServiceBus.getTopic('test', createResultCallback<Models.Topic>());
+10 -14
View File
@@ -214,15 +214,15 @@ export namespace Azure.ServiceBus {
// [x: string]: string | Dictionary<string | object>;
// }
export const ActiveMessageCount = 'd2p1:ActiveMessageCount';
export const DeadLetterMessageCount = 'd2p1:DeadLetterMessageCount';
export const ScheduledMessageCount = 'd2p1:ScheduledMessageCount';
export const TransferMessageCount = 'd2p1:TransferMessageCount';
export const TransferDeadLetterMessageCount = 'd2p1:TransferDeadLetterMessageCount';
export interface Topic extends ExtendedBase {
AccessedAt: DateString;
CountDetails: {
'd2p1:ActiveMessageCount': string;
'd2p1:DeadLetterMessageCount': string;
'd2p1:ScheduledMessageCount': string;
'd2p1:TransferMessageCount': string;
'd2p1:TransferDeadLetterMessageCount': string;
};
CountDetails: { [key: string]: string };
EnableSubscriptionPartitioning: string;
FilteringMessagesBeforePublishing: string;
IsExpress: string;
@@ -242,13 +242,7 @@ export namespace Azure.ServiceBus {
}
export interface Subscription extends ExtendedBase {
CountDetails: {
'd3p1:ActiveMessageCount': string;
'd3p1:DeadLetterMessageCount': string;
'd3p1:ScheduledMessageCount': string;
'd3p1:TransferMessageCount': string;
'd3p1:TransferDeadLetterMessageCount': string;
};
CountDetails: { [key: string]: string };
DeadLetteringOnFilterEvaluationExceptions: string;
DeadLetteringOnMessageExpiration: string;
LockDuration: string;
@@ -315,6 +309,8 @@ export namespace Azure.ServiceBus {
export type CreateSubscriptionOptions = Partial<ICreateSubscriptionOptions>;
export type ListSubscriptionsOptions = Partial<PaginationOptions>;
export type ListRulesOptions = Partial<PaginationOptions>;
export type ListTopicsOptions = Partial<PaginationOptions>;
export type ListQueuesOptions = Partial<PaginationOptions>;
export type CreateRuleOptions = Partial<ICreateRuleOptions>;
export type CreateNotificationHubOptions = Partial<ICreateNotificationHubOptions>;
export type ListNotificationHubsOptions = Partial<PaginationOptions>;
+6 -2
View File
@@ -11,6 +11,8 @@ import CreateTopicOptions = Azure.ServiceBus.CreateTopicOptions;
import ListNotificationHubsOptions = Azure.ServiceBus.ListNotificationHubsOptions;
import ListRulesOptions = Azure.ServiceBus.ListRulesOptions;
import ListSubscriptionsOptions = Azure.ServiceBus.ListSubscriptionsOptions;
import ListTopicsOptions = Azure.ServiceBus.ListTopicsOptions;
import ListQueuesOptions = Azure.ServiceBus.ListQueuesOptions;
import MessageOrName = Azure.ServiceBus.MessageOrName;
import Queue = Azure.ServiceBus.Results.Models.Queue;
import ReceiveQueueMessageOptions = Azure.ServiceBus.ReceiveQueueMessageOptions;
@@ -88,7 +90,8 @@ declare class ServiceBusService extends ServiceBusServiceBase {
public getQueue(queuePath: string,
callback: TypedResultAndResponseCallback<Queue>): void;
public listQueues(queuePath: string,
public listQueues(callback: TypedResultAndResponseCallback<Queue[]>): void;
public listQueues(options: ListQueuesOptions,
callback: TypedResultAndResponseCallback<Queue[]>): void;
/*
@@ -115,7 +118,8 @@ declare class ServiceBusService extends ServiceBusServiceBase {
public getTopic(topicPath: string,
callback: TypedResultAndResponseCallback<Topic>): void;
public listTopics(topicPath: string,
public listTopics(callback: TypedResultAndResponseCallback<Topic[]>): void;
public listTopics(options: ListTopicsOptions,
callback: TypedResultAndResponseCallback<Topic[]>): void;
/*
+3 -4
View File
@@ -1,14 +1,13 @@
/// <reference types="node" />
import EventEmitter = NodeJS.EventEmitter;
import ServiceClient = require('azure-sb/lib/serviceclient');
declare class ServiceBusServiceClient extends EventEmitter {
declare class ServiceBusServiceClient extends ServiceClient {
constructor(accessKey?: string,
issuer?: string,
sharedAccessKeyName?: string,
sharedAccessKeyValue?: string,
host?: string,
acsHost?: string,
authenticationProvider?: object);
authenticationProvider?: object);
}
export = ServiceBusServiceClient;
+8
View File
@@ -0,0 +1,8 @@
/// <reference types="node" />
import EventEmitter = NodeJS.EventEmitter;
declare class ServiceClient extends EventEmitter {
public host: string;
public port: number;
public protocol: string;
}
export = ServiceClient;
+2 -1
View File
@@ -30,6 +30,7 @@
"lib/models/subscriptionresult.d.ts",
"lib/models/notificationhubresult.d.ts",
"lib/models/resourceresult.d.ts",
"lib/serviceclient.d.ts",
"lib/servicebusserviceclient.d.ts",
"lib/gcmservice.d.ts",
"lib/wnsservice.d.ts",
@@ -38,4 +39,4 @@
"azure-sb-tests.ts",
"index.d.ts"
]
}
}
+106
View File
@@ -0,0 +1,106 @@
import { RequestQuery, Server } from 'hapi';
import * as bell from 'bell';
async function run() {
const server = new Server({ port: 8000 });
await server.register(bell);
server.auth.strategy('arcgisonline', 'bell', {
provider: 'twitter',
password: 'some cookie password',
location: 'http://example.com/oauth',
clientId: '',
clientSecret: '',
scope(request) {
const scopes = ['public_profile', 'email'];
if ((<RequestQuery> request.query).wantsSharePermission) {
scopes.push('publish_actions');
}
return scopes;
}
});
const providers: bell.BellOptions[] = [{
provider: 'discord',
password: 'cookie_encryption_password_secure',
isSecure: false,
clientId: '',
clientSecret: '',
location: () => '',
},
{
provider: 'facebook',
password: 'cookie_encryption_password_secure',
isSecure: false,
clientId: '',
clientSecret: '',
location: server.info.uri
},
{
provider: 'google',
password: 'cookie_encryption_password_secure',
isSecure: false,
clientId: '',
clientSecret: '',
location: server.info.uri
},
{
provider: 'linkedin',
password: 'cookie_encryption_password_secure',
isSecure: false,
clientId: '',
clientSecret: '',
providerParams: {
redirect_uri: server.info.uri + '/bell/door'
}
},
{
provider: 'meetup',
password: 'cookie_encryption_password_secure',
isSecure: false,
clientId: '',
clientSecret: '',
scope: ['basic', 'ageless', 'group_edit', 'reporting'],
},
{
provider: 'nest',
password: 'cookie_encryption_password_secure',
isSecure: false,
clientId: '',
clientSecret: ''
},
{
provider: 'office365',
clientId: '',
clientSecret: '',
password: 'cookie_encryption_password_secure',
providerParams: {
response_type: 'code'
},
scope: ['openid', 'offline_access', 'profile']
},
{
provider: 'okta',
config: { uri: 'https://your-organization.okta.com' },
password: 'cookie_encryption_password_secure',
isSecure: false,
location: 'http://127.0.0.1:8000',
clientId: '',
clientSecret: ''
},
{
provider: 'slack',
password: 'cookie_encryption_password_secure',
isSecure: false,
clientId: '',
clientSecret: ''
},
{
provider: 'twitch',
password: 'cookie_encryption_password_secure',
isSecure: false,
clientId: '',
clientSecret: '',
scope: ['user_read', 'channel_read']
}];
}
+269
View File
@@ -0,0 +1,269 @@
// Type definitions for bell 9.1
// Project: https://github.com/hapijs/bell
// Definitions by: Simon Schick <https://github.com/SimonSchick>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
import { Server, Request, Plugin, AuthCredentials } from 'hapi';
declare module 'hapi' {
interface ServerAuth {
strategy(name: string, scheme: 'bell', options: BellOptions): void;
strategy(
name: string,
scheme: 'bell',
mode: boolean | 'required' | 'optional' | 'try',
options: BellOptions,
): void;
}
}
export interface StringLikeMap {
[key: string]: string | number;
}
export type Provider =
'arcgisonline' |
'auth0' |
'azuread' |
'bitbucket' |
'digitalocean' |
'discord' |
'dropbox' |
'dropboxV2' |
'facebook' |
'fitbit' |
'foursquare' |
'github' |
'gitlab' |
'google' |
'googleplus' |
'instagram' |
'linkedin' |
'live' |
'medium' |
'meetup' |
'mixer' |
'nest' |
'office365' |
'okta' |
'phabricator' |
'pingfed' |
'pinterest' |
'reddit' |
'salesforce' |
'slack' |
'spotify' |
'stripe' |
'trakt' |
'tumblr' |
'twitch' |
'twitter' |
'vk' |
'wordpress' |
'yahoo';
export type RequestPassThrough = (
request: Request,
next: (err: Error | null, credentials: AuthCredentials) => void,
) => void;
export interface OptionalOptions {
/**
* the name of the cookie used to manage the temporary state.
* Defaults to 'bell-provider' where 'provider' is the provider name (or 'custom' for custom providers).
* For example, the Twitter cookie name defaults to 'bell-twitter'.
*/
cookie?: string;
/**
* sets the cookie secure flag.
* Defaults to true.
*/
isSecure?: boolean;
/**
* sets the cookie HTTP only flag.
* Defaults to true.
*/
isHttpOnly?: boolean;
/**
* cookie time-to-live in milliseconds.
* Defaults to null (session time-life - cookies are deleted when the browser is closed).
*/
ttl?: number;
/**
* the domain scope.
* Defaults to null (no domain).
*/
domain?: string;
/**
* provider-specific query parameters for the authentication endpoint.
* It may be passed either as an object to merge into the query string,
* or a function which takes the client's request and returns an object.
* Each provider supports its own set of parameters which customize the user's login experience.
* For example:
* * Facebook supports `display` ('page', 'popup', or 'touch'), `auth_type`, `auth_nonce`.
* * Google supports `access_type`, `approval_prompt`, `prompt`, `login_hint`, `user_id`, `hd`.
* * Twitter supports `force_login`, `screen_name`.
* * Linkedin supports `fields`.
*/
providerParams?: StringLikeMap | ((request: Request) => StringLikeMap);
/**
* allows passing query parameters from a bell protected endpoint to the auth request.
* It will merge the query params you pass along with the providerParams and any other predefined ones.
* Be aware that this will override predefined query parameters!
* Default to false.
*/
allowRuntimeProviderParams?: StringLikeMap | boolean;
/**
* Each built-in vendor comes with the required scope for basic profile information.
* Use scope to specify a different scope as required by your application.
* It may be passed either as an object to merge into the query string,
* or a function which takes the client's request and returns an object.
* Consult the provider for their specific supported scopes.
*/
scope?: string[] | ((request: Request) => string[]);
/**
* skips obtaining a user profile from the provider.
* Useful if you need specific scopes,
* but not the user profile.
* Defaults to false.
*/
skipProfile?: boolean;
/**
* a configuration object used to customize the provider settings.
* The built-in 'twitter' provider accepts the `extendedProfile` & `getMethod` options.
* option which allows disabling the extra profile request when the provider
* returns the user information in the callback (defaults to true).
* The built-in 'github' and 'phabricator' providers accept the uri
* option which allows pointing to a private enterprise installation (e.g. 'https://vpn.example.com').
* See Providers documentation for more information.
*/
config?: { extendedProfile?: boolean; getMethod?: string } | { uri?: string };
/**
* an object of key-value pairs that specify additional
* URL query parameters to send with the profile request to the provider.
* The built-in facebook provider,
* for example, could have fields specified to determine the fields returned from the user's graph,
* which would then be available to you in the auth.credentials.profile.raw object.
*/
profileParams?: StringLikeMap;
/**
* allows passing additional OAuth state from initial request.
* This must be a function returning a string,
* which will be appended to the bell internal state parameter for OAuth code flow.
*/
runtimeStateCallback?(req: Request): string;
// THESE ARE IN THE *REQUIRED* section but are actually not...
/**
* A boolean indicating whether or not you want the redirect_uri to be forced to https.
* Useful if your hapi application runs as http, but is accessed through https.
*/
forceHttps?: boolean;
/**
* Set the base redirect_uri manually if it cannot be inferred properly from server settings.
* Useful to override port, protocol, and host if proxied or forwarded.
*/
location?: string | ((req: Request) => string);
}
export interface RequiredProviderOptions {
/**
* the cookie encryption password.
* Used to encrypt the temporary state cookie used by the module in
* between the authorization protocol steps.
*/
password: string;
/**
* the OAuth client identifier (consumer key).
*/
clientId: string;
/**
* the OAuth client secret (consumer secret)
*/
clientSecret: string;
}
export interface KnownProviderOptions extends RequiredProviderOptions, OptionalOptions {
provider: Provider;
}
/**
* @param uri the requested resource URI (bell will add the token or authentication header as needed).
* @param params any URI query parameters (cannot include them in the URI due to signature requirements).
*/
export type AuthedRequest = (uri: string, params: { [key: string]: string } | null) => Promise<any>;
export interface CustomProtocol {
/**
* the authorization protocol used.
*/
protocol: 'oauth' | 'oauth2';
/**
* the OAuth signature method (OAuth 1.0a only). Must be one of:
* * 'HMAC-SHA1' - default
* * 'RSA-SHA1' - in that case, the clientSecret is your RSA private key
*/
signatureMethod?: 'HMAC-SHA1' | 'RSA-SHA1';
/**
* the temporary credentials (request token) endpoint (OAuth 1.0a only).
*/
temporary?: string;
/**
* boolean that determines if OAuth client id and client secret will be sent
* as parameters as opposed to an Authorization header (OAuth 2.0 only).
* Defaults to false.
*/
useParamsAuth?: boolean;
/**
* the authorization endpoint URI.
*/
auth: string;
/**
* the access token endpoint URI.
*/
token: string;
/**
* the OAuth version.
*/
version?: string;
/**
* an array of scope strings (OAuth 2.0 only).
*/
scope?: string[] | ((query: StringLikeMap) => string[]);
/**
* the scope separator character (OAuth 2.0 only). Only required when a provider has a broken OAuth 2.0 implementation. Defaults to space (Facebook and GitHub default to comma).
*/
scopeSeparator?: string;
/**
* a headers object with additional headers required by the provider
* (e.g. GitHub required the 'User-Agent' header which is set by default).
*/
headers?: {
[key: string]: string;
};
/**
* a function used to obtain user profile information and normalize it.
* @param credentials the credentials object.
* Change the object directly within the function (profile information is typically stored under credentials.profile).
* @param params the parsed information received from the provider (e.g. token, secret, and other custom fields).
* @param get an OAuth helper function to make authenticated requests using the credentials received.
*/
profile(credentials: any, params: { [key: string]: string }, get: AuthedRequest): Promise<void>;
}
export interface CustomProviderOptions extends RequiredProviderOptions, OptionalOptions {
provider: CustomProtocol;
}
export type BellOptions = CustomProviderOptions | KnownProviderOptions;
export const plugin: Plugin<CustomProviderOptions | KnownProviderOptions>;
/**
* Enables simulation mode.
*/
export function simulate(credentialsFunc: RequestPassThrough): void;
/**
* [See docs](https://github.com/hapijs/bell/blob/master/API.md#simulated-authentication)
* Disables simulation mode
*/
export function simulate(state: false): void;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"strictFunctionTypes": true,
"strictNullChecks": true,
"noImplicitAny": true,
"noImplicitThis": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bell-tests.ts"
]
}
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "dtslint/dt.json",
"rules": {
"unified-signatures": false // Disabling as it prevents me from using overloaded doctags
}
}
+7
View File
@@ -7,3 +7,10 @@ const b3 = b1.multiply(b2);
console.log(b3.toHex());
// => ae499bfe762edfb416d0ce71447af67ff33d1760cbebd70874be1d7a5564b0439a59808cb1856a91974f7023f72132
const b4 = BigInteger.valueOf(42);
const b5 = BigInteger.valueOf(10);
const b6 = b4.multiply(b5);
console.log(b6);
// => BigInteger { '0': 420, '1': 0, t: 1, s: 0 }
+1 -1
View File
@@ -87,7 +87,7 @@ declare class bigi {
static fromDERInteger(byteArray?: any): number;
static fromHex(hex: string): bigi;
static isBigInteger(obj: any, check_ver: any): obj is bigi;
static valueOf(i: any): number;
static valueOf(i: any): bigi;
}
declare namespace bigi {
interface Constants {
+1 -1
View File
@@ -42,7 +42,7 @@ declare namespace Bull {
* When specified, the `Queue` will use this function to create new `ioredis` client connections.
* This is useful if you want to re-use connections.
*/
createClient?(type: 'client' | 'subscriber', redisOpts?: Redis.RedisOptions): Redis.Redis;
createClient?(type: 'client' | 'subscriber' | 'bclient', redisOpts?: Redis.RedisOptions): Redis.Redis;
/**
* Prefix to use for all redis keys
+44 -31
View File
@@ -1,11 +1,11 @@
// Type definitions for C3js 0.4
// Type definitions for C3js 0.5
// Project: http://c3js.org/
// Definitions by: Marc Climent <https://github.com/mcliment>
// Gerin Jacob <https://github.com/gerinjacob>
// Bernd Hacker <https://github.com/denyo>
// Dzmitry Shyndzin <https://github.com/dmitryshindin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
// TypeScript Version: 2.3
import * as d3 from "d3";
@@ -28,7 +28,7 @@ export interface ChartConfiguration {
* Note: When chart is not binded, c3 starts observing if chart.element is binded by MutationObserver. In this case, polyfill is required in IE9 and IE10 becuase they do not support
* MutationObserver. On the other hand, if chart always will be binded, polyfill will not be required because MutationObserver will never be called.
*/
bindto?: string | HTMLElement | d3.Selection<any> | null;
bindto?: string | HTMLElement | d3.Selection<any, any, any, any> | null;
size?: {
/**
* The desired width of the chart element.
@@ -172,16 +172,18 @@ export interface ChartConfiguration {
/**
* Change the width of bar chart. If ratio is specified, change the width of bar chart by ratio.
*/
width?: number | {
/**
* Set the width of each bar by ratio
*/
ratio: number,
/**
* Set max width of each bar
*/
max?: number
};
width?:
| number
| {
/**
* Set the width of each bar by ratio
*/
ratio: number;
/**
* Set max width of each bar
*/
max?: number;
};
/**
* Set if min or max value will be 0 on bar chart.
*/
@@ -205,7 +207,7 @@ export interface ChartConfiguration {
/**
* Set threshold to show/hide labels.
*/
threshold?: number
threshold?: number;
};
/**
* Enable or disable expanding pie pieces.
@@ -226,7 +228,7 @@ export interface ChartConfiguration {
/**
* Set threshold to show/hide labels.
*/
threshold?: number
threshold?: number;
};
/**
* Enable or disable expanding pie pieces.
@@ -280,7 +282,17 @@ export interface ChartConfiguration {
/**
* Set custom spline interpolation
*/
type?: 'linear' | 'linear-closed' | 'basis' | 'basis-open' | 'basis-closed' | 'bundle' | 'cardinal' | 'cardinal-open' | 'cardinal-closed' | 'monotone';
type?:
| "linear"
| "linear-closed"
| "basis"
| "basis-open"
| "basis-closed"
| "bundle"
| "cardinal"
| "cardinal-open"
| "cardinal-closed"
| "monotone";
};
};
}
@@ -309,7 +321,7 @@ export interface Data {
/**
* Choose which JSON object keys correspond to desired data.
*/
keys?: { x?: string; value: string[]; };
keys?: { x?: string; value: string[] };
/**
* Specify the key of x values in the data.
* We can show the data with non-index x values by this option. This option is required when the type of x axis is timeseries. If this option is set on category axis, the values of the data
@@ -365,9 +377,7 @@ export interface Data {
* - j is the sub index of the data point where the label is shown.
* Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (e.g. d3.format('$'))
*/
labels?: boolean |
{ format: FormatFunction } |
{ format: { [key: string]: FormatFunction } };
labels?: boolean | { format: FormatFunction } | { format: { [key: string]: FormatFunction } };
/**
* Define the order of the data.
* This option changes the order of stacking the data and pieces of pie/donut. If null specified, it will be the order the data loaded. If function specified, it will be used to sort the data
@@ -387,11 +397,11 @@ export interface Data {
* This option should a function and the specified function receives color (e.g. '#ff0000') and d that has data parameters like id, value, index, etc. And it must return a string that
* represents color (e.g. '#00ff00').
*/
color?(color: string, d: any): string | d3.Rgb;
color?(color: string, d: any): string | d3.RGBColor;
/**
* Set color for each data.
*/
colors?: { [key: string]: string | d3.Rgb | ((d: any) => string | d3.Rgb) };
colors?: { [key: string]: string | d3.RGBColor | ((d: any) => string | d3.RGBColor) };
/**
* Hide each data when the chart appears.
* If true specified, all of data will be hidden. If multiple ids specified as an array, those will be hidden.
@@ -813,7 +823,7 @@ export interface PointOptions {
/**
* The radius size of each point on focus.
*/
r?: number
r?: number;
};
};
@@ -877,7 +887,7 @@ export interface ChartAPI {
load(args: {
url?: string;
json?: {};
keys?: { x?: string; value: string[]; }
keys?: { x?: string; value: string[] };
rows?: PrimitiveArray[];
columns?: PrimitiveArray[];
xs?: { [key: string]: string };
@@ -885,7 +895,7 @@ export interface ChartAPI {
classes?: { [key: string]: string };
categories?: string[];
axes?: { [key: string]: string };
colors?: { [key: string]: string | d3.Rgb };
colors?: { [key: string]: string | d3.RGBColor };
type?: string;
types?: { [key: string]: string };
unload?: boolean | ArrayOrString;
@@ -911,7 +921,7 @@ export interface ChartAPI {
*/
flow(args: {
json?: {};
keys?: { x?: string; value: string[]; }
keys?: { x?: string; value: string[] };
rows?: PrimitiveArray[];
columns?: PrimitiveArray[];
to?: any;
@@ -997,7 +1007,7 @@ export interface ChartAPI {
* Get and set colors of the data loaded in the chart.
* @param colors If this argument is given, the colors of data will be updated. If not given, the current colors will be returned. The format of this argument is the same as data.colors.
*/
colors(colors?: { [key: string]: string | d3.Rgb }): { [key: string]: string };
colors(colors?: { [key: string]: string | d3.RGBColor }): { [key: string]: string };
/**
* Get and set axes of the data loaded in the chart.
* @param axes If this argument is given, the axes of data will be updated. If not given, the current axes will be returned. The format of this argument is the same as data.axes.
@@ -1040,22 +1050,25 @@ export interface ChartAPI {
* Get and set axis labels.
* @param labels If labels is given, specified axis' label will be updated.
*/
labels(labels?: { [key: string]: string }): { [key: string]: string }
labels(labels?: { [key: string]: string }): { [key: string]: string };
/**
* Get and set axis min value.
* @param min If min is given, specified axis' min value will be updated. If no argument is given, the current min values for each axis will be returned.
*/
min(min?: number | { [key: string]: number }): number | { [key: string]: number }
min(min?: number | { [key: string]: number }): number | { [key: string]: number };
/**
* Get and set axis max value.
* @param max If max is given, specified axis' max value will be updated. If no argument is given, the current max values for each axis will be returned.
*/
max(max?: number | { [key: string]: number }): number | { [key: string]: number }
max(max?: number | { [key: string]: number }): number | { [key: string]: number };
/**
* Get and set axis min and max value.
* @param range If range is given, specified axis' min and max value will be updated. If no argument is given, the current min and max values for each axis will be returned.
*/
range(range?: { min?: number | { [key: string]: number }; max?: number | { [key: string]: number } }): { min: number | { [key: string]: number }; max: number | { [key: string]: number } }
range(range?: {
min?: number | { [key: string]: number };
max?: number | { [key: string]: number };
}): { min: number | { [key: string]: number }; max: number | { [key: string]: number } };
};
legend: {
+6 -15
View File
@@ -1,29 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"lib": ["es6", "dom"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"typeRoots": ["../"],
"types": [],
"paths": {
"d3": [
"d3/v3"
]
"d3-scale": ["d3-scale/v1"],
"d3": ["d3/v4"]
},
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"c3-tests.ts"
]
}
"files": ["index.d.ts", "c3-tests.ts"]
}
@@ -0,0 +1,20 @@
import CircuitBreaker = require('circuit-breaker-js');
const breaker = new CircuitBreaker();
breaker.isOpen();
const options: CircuitBreaker.Options = {};
let status: number = CircuitBreaker.CLOSED;
status = CircuitBreaker.OPEN;
breaker.forceOpen();
breaker.forceClose();
breaker.run((success, failure) => {
if (Math.random() > 0.5) {
success();
} else {
failure();
}
});
+44
View File
@@ -0,0 +1,44 @@
// Type definitions for circuit-breaker-js 0.0
// Project: http://yammer.github.io/circuit-breaker-js/
// Definitions by: Timur Amirov <https://github.com/DeTeam>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = CircuitBreaker;
declare namespace CircuitBreaker {
interface Options {
windowDuration?: number;
numBuckets?: number;
timeoutDuration?: number;
errorThreshold?: number;
volumeThreshold?: number;
onCircuitOpen?: (m: Metrics) => void;
onCircuitClose?: (m: Metrics) => void;
}
interface Metrics {
totalCount: number;
errorCount: number;
errorPercentage: number;
}
}
declare class CircuitBreaker {
static OPEN: 0;
static HALF_OPEN: 1;
static CLOSED: 2;
constructor(options?: CircuitBreaker.Options);
run(
command: (
success: () => void,
failure: () => void,
) => void,
fallback?: () => void
): void;
forceClose(): void;
forceOpen(): void;
unforce(): void;
isOpen(): boolean;
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"circuit-breaker-js-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+2
View File
@@ -4,9 +4,11 @@ import CryptoJS = require('crypto-js');
var wordArray: CryptoJS.WordArray;
wordArray = CryptoJS.MD5('some message');
wordArray = CryptoJS.MD5('some message', 'some key');
wordArray = CryptoJS.MD5('some message', { any: true });
wordArray = CryptoJS.SHA1('some message');
wordArray = CryptoJS.SHA1('some message', 'some key', { any: true });
wordArray = CryptoJS.SHA1('some message', { any: true });
wordArray = CryptoJS.format.OpenSSL('some message');
wordArray = CryptoJS.format.OpenSSL('some message', 'some key');
+34 -18
View File
@@ -8,7 +8,6 @@ export as namespace CryptoJS;
declare var CryptoJS: CryptoJS.Hashes;
declare namespace CryptoJS {
type Hash = (message: string | LibWordArray, key?: string | WordArray, ...options: any[]) => WordArray;
interface Cipher {
encrypt(message: string, secretPassphrase: string | WordArray, option?: CipherOption): WordArray;
decrypt(encryptedMessage: string | WordArray, secretPassphrase: string | WordArray, option?: CipherOption): DecryptedMessage;
@@ -54,23 +53,40 @@ declare namespace CryptoJS {
interface Padding {}
export interface Hashes {
MD5: Hash;
SHA1: Hash;
SHA256: Hash;
SHA224: Hash;
SHA512: Hash;
SHA384: Hash;
SHA3: Hash;
RIPEMD160: Hash;
HmacMD5: Hash;
HmacSHA1: Hash;
HmacSHA256: Hash;
HmacSHA224: Hash;
HmacSHA512: Hash;
HmacSHA384: Hash;
HmacSHA3: Hash;
HmacRIPEMD160: Hash;
PBKDF2: Hash;
MD5(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
MD5(message: string | LibWordArray, ...options: any[]): WordArray;
SHA1(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
SHA1(message: string | LibWordArray, ...options: any[]): WordArray;
SHA256(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
SHA256(message: string | LibWordArray, ...options: any[]): WordArray;
SHA224(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
SHA224(message: string | LibWordArray, ...options: any[]): WordArray;
SHA512(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
SHA512(message: string | LibWordArray, ...options: any[]): WordArray;
SHA384(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
SHA384(message: string | LibWordArray, ...options: any[]): WordArray;
SHA3(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
SHA3(message: string | LibWordArray, ...options: any[]): WordArray;
RIPEMD160(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
RIPEMD160(message: string | LibWordArray, ...options: any[]): WordArray;
HmacMD5(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
HmacMD5(message: string | LibWordArray, ...options: any[]): WordArray;
HmacSHA1(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
HmacSHA1(message: string | LibWordArray, ...options: any[]): WordArray;
HmacSHA256(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
HmacSHA256(message: string | LibWordArray, ...options: any[]): WordArray;
HmacSHA224(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
HmacSHA224(message: string | LibWordArray, ...options: any[]): WordArray;
HmacSHA512(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
HmacSHA512(message: string | LibWordArray, ...options: any[]): WordArray;
HmacSHA384(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
HmacSHA384(message: string | LibWordArray, ...options: any[]): WordArray;
HmacSHA3(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
HmacSHA3(message: string | LibWordArray, ...options: any[]): WordArray;
HmacRIPEMD160(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
HmacRIPEMD160(message: string | LibWordArray, ...options: any[]): WordArray;
PBKDF2(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
PBKDF2(message: string | LibWordArray, ...options: any[]): WordArray;
AES: Cipher;
DES: Cipher;
TripleDES: Cipher;
+11
View File
@@ -49,3 +49,14 @@ promise1 = d3Fetch.tsv(url);
promise1 = d3Fetch.tsv(url, init);
promise2 = d3Fetch.tsv<MyType>(url, parseRow);
promise2 = d3Fetch.tsv<MyType>(url, init, parseRow);
let docPromise: Promise<Document>;
docPromise = d3Fetch.hmtl(url);
docPromise = d3Fetch.hmtl(url, init);
docPromise = d3Fetch.svg(url);
docPromise = d3Fetch.svg(url, init);
let xmlDocPromise: Promise<XMLDocument>;
xmlDocPromise = d3Fetch.xml(url);
xmlDocPromise = d3Fetch.xml(url, init);
+32 -2
View File
@@ -1,10 +1,10 @@
// Type definitions for d3-fetch 1.0
// Type definitions for d3-fetch 1.1
// Project: https://d3js.org/d3-fetch/
// Definitions by: Hugues Stefanski <https://github.com/ledragon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// Last module patch version validated against: 1.0.1
// Last module patch version validated against: 1.1.0
import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv';
@@ -146,6 +146,16 @@ export function dsv<ParsedRow extends DSVRowAny>(
row: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow | undefined | null
): Promise<DSVParsedArray<ParsedRow>>;
/**
* Fetches the file at the specified input URL as text, parses it as HTML and returns a Promise of an HTML DOM Document.
*
* If init is specified, it is passed along to the underlying call to fetch.
*
* @param url A valid URL string.
* @param init An optional request initialization object.
*/
export function hmtl(url: string, init?: RequestInit): Promise<Document>;
/**
* Fetches the image at the specified input URL and returns a promise of an HTML image element.
*
@@ -168,6 +178,16 @@ export function image(url: string, init?: {[key: string]: any}): Promise<HTMLIma
*/
export function json<ParsedJSONObject extends any>(url: string, init?: RequestInit): Promise<ParsedJSONObject>;
/**
* Fetches the file at the specified input URL as text, parses it as SVG and returns a Promise of an SVG Document.
*
* If init is specified, it is passed along to the underlying call to fetch.
*
* @param url A valid URL string.
* @param init An optional request initialization object.
*/
export function svg(url: string, init?: RequestInit): Promise<Document>;
/**
* Fetches the text file at the specified input URL and returns it as a Promise of a string.
*
@@ -234,3 +254,13 @@ export function tsv<ParsedRow extends DSVRowAny>(
init: RequestInit,
row: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow | undefined | null
): Promise<DSVParsedArray<ParsedRow>>;
/**
* Fetches the file at the specified input URL as text, parses it as XML and returns a Promise of an XML Document.
*
* If init is specified, it is passed along to the underlying call to fetch.
*
* @param url A valid URL string.
* @param init An optional request initialization object.
*/
export function xml(url: string, init?: RequestInit): Promise<XMLDocument>;
+4 -2
View File
@@ -148,12 +148,14 @@ dynogels.dynamoDriver(dynamodb);
// Saving Models To DynamoDB
Account.create({ email: 'foo@example.com', name: 'Foo Bar', age: 21 }, (err, acc) => {
acc.get('email');
const email = acc.get('email') as string;
console.log(`Created account ${email}`);
});
const acc = new Account({ email: 'test@example.com', name: 'Test Example' });
acc.save((err) => {
acc.get('email');
const email = acc.get('email') as string;
console.log(`Created account ${email}`);
});
BlogPost.create({
+4 -2
View File
@@ -1,7 +1,8 @@
// Type definitions for dynogels 8.0
// Type definitions for dynogels 9.0
// Project: https://github.com/clarkie/dynogels#readme
// Definitions by: Spartan Labs <https://github.com/SpartanLabs>
// Ramon de Klein <https://github.com/ramondeklein>
// Stephen Tuso <https://github.com/stephentuso>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@@ -153,7 +154,8 @@ export interface ModelConfig {
// Dynogels Item
export interface Item {
get(key?: string): { [key: string]: any };
get(): { [key: string]: any };
get(key: string): any;
set(params: {}): Item;
save(callback?: DynogelsItemCallback): void;
update(options: UpdateItemOptions, callback?: DynogelsItemCallback): void;
+18 -3
View File
@@ -44,6 +44,20 @@ declare module 'ember-qunit' {
*/
export function setResolver(resolver: Ember.Resolver): void;
/**
* Sets up acceptance tests.
*
* The `setupApplicationTest` function is used for all acceptance tests. It
* is invoked in the callback scope of a QUnit module (aka "nested module").
*
* Once invoked, all subsequent hooks.beforeEach and test invocations will
* have access to the following:
* * `this.owner` - the owner object that been set on the test context.
* * `this.pauseTest` and `this.resumeTest` - allow easy pausing/resuming of tests.
* * `this.element` which returns the DOM element representing the application's root element.
*/
export function setupApplicationTest(hooks: NestedHooks): void;
/**
* Sets up tests that need to render snippets of templates.
*
@@ -80,7 +94,7 @@ declare module 'ember-qunit' {
*/
export function setupTest(hooks: NestedHooks): void;
export class QUnitAdapter extends Ember.Test.Adapter {}
export class QUnitAdapter extends Ember.Test.Adapter { }
export { module, test, skip, only, todo } from 'qunit';
}
@@ -147,9 +161,10 @@ declare module 'qunit' {
* ignoring the callback argument and the respective global and module's
* hooks.
*
* @param Title of unit being tested
* @param name Title of unit being tested
* @param callback Function to close over assertions
*/
export const skip: typeof QUnit.skip;
export function skip(name: string, callback?: (this: TestContext, assert: Assert) => void): void;
export default QUnit;
}
+6
View File
@@ -3500,6 +3500,12 @@ declare module '@ember/enumerable' {
export default Enumerable;
}
declare module '@ember/error' {
import Ember from 'ember';
const Error: typeof Ember.Error;
export default Error;
}
declare module '@ember/instrumentation' {
import Ember from 'ember';
export const instrument: typeof Ember.instrument;
+6
View File
@@ -0,0 +1,6 @@
import { assertType } from "./lib/assert";
import Ember from "ember";
import EmberError from "@ember/error";
assertType<typeof Ember.Error>(EmberError);
+2 -1
View File
@@ -23,6 +23,7 @@
"test/lib/assert.ts",
"test/application.ts",
"test/ember-tests.ts",
"test/error.ts",
"test/event.ts",
"test/extend.ts",
"test/create.ts",
@@ -49,4 +50,4 @@
"test/route.ts",
"test/view-utils.ts"
]
}
}
+17
View File
@@ -0,0 +1,17 @@
import enquire = require('enquire.js');
enquire
.register('(min-width: 300px) and (max-width: 600px)', {
deferSetup: true,
match: () => {},
unmatch: () => {},
setup: () => {},
destroy: () => {}
})
.register('(min-width: 300px) and (max-width: 600px)', {});
enquire.register('(min-width: 300px) and (max-width: 600px)', [{}, {}], true);
enquire.register('(min-width: 300px) and (max-width: 600px)', () => {}, true);
enquire.unregister('(min-width: 300px) and (max-width: 600px)');
+43
View File
@@ -0,0 +1,43 @@
// Type definitions for enquire.js 2.1
// Project: https://github.com/WickyNilliams/enquire.js/
// Definitions by: Christian Rackerseder <https://github.com/screendriver>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
interface Options {
/**
* If set to true, defers execution of the setup function until the first time the media query is matched
*/
deferSetup?: boolean;
/**
* If supplied, triggered when a media query matches.
*/
match?(): void;
/**
* If supplied, triggered when the media query transitions from a matched state to an unmatched state.
*/
unmatch?(): void;
/**
* If supplied, triggered once, when the handler is registered.
*/
setup?(): void;
/**
* If supplied, triggered when handler is unregistered. Place cleanup code here
*/
destroy?(): void;
}
type Callback = () => void;
interface EnquireJs {
register(
mediaQuery: string,
options: Options | Options[] | Callback,
shouldDegrade?: boolean,
): EnquireJs;
unregister(mediaQuery: string, handler?: Callback | Options): void;
}
declare const enquire: EnquireJs;
export = enquire;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"enquire.js-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+27 -27
View File
@@ -20,64 +20,64 @@ export function addHexPrefix(str: string): string;
export function arrayContainsArray(superset: any, subset: any, some: any): any;
export function baToJSON(ba: Buffer | string[]): Buffer | string[];
export function baToJSON(ba: Buffer | Uint8Array | string[]): Buffer | Uint8Array | string[];
export function bufferToHex(buf: Buffer): string;
export function bufferToHex(buf: Buffer | Uint8Array): string;
export function bufferToInt(buf: Buffer): string;
export function bufferToInt(buf: Buffer | Uint8Array): string;
export function defineProperties(self: {[k: string]: any}, fields: string[], data: {[k: string]: any}): {[k: string]: any};
export function ecrecover(msgHash: Buffer, v: number, r: Buffer, s: Buffer): Buffer;
export function ecrecover(msgHash: Buffer | Uint8Array, v: number, r: Buffer | Uint8Array, s: Buffer | Uint8Array): Buffer | Uint8Array;
export function ecsign(msgHash: Buffer, privateKey: Buffer): {[k: string]: any};
export function ecsign(msgHash: Buffer | Uint8Array, privateKey: Buffer | Uint8Array): {[k: string]: any};
export function fromRpcSig(sig: string): {[k: string]: any};
export function fromSigned(num: Buffer): any;
export function fromSigned(num: Buffer | Uint8Array): any;
export function generateAddress(from: Buffer, nonce: Buffer): Buffer;
export function generateAddress(from: Buffer | Uint8Array, nonce: Buffer | Uint8Array): Buffer | Uint8Array;
export function hashPersonalMessage(message: string): Buffer;
export function hashPersonalMessage(message: string): Buffer | Uint8Array;
export function importPublic(publicKey: Buffer): Buffer;
export function importPublic(publicKey: Buffer | Uint8Array): Buffer | Uint8Array;
export function isValidAddress(address: string): boolean;
export function isValidChecksumAddress(address: Buffer): boolean;
export function isValidChecksumAddress(address: Buffer | Uint8Array): boolean;
export function isValidPrivate(privateKey: Buffer): boolean;
export function isValidPrivate(privateKey: Buffer | Uint8Array): boolean;
export function isValidPublic(publicKey: Buffer, sanitize?: boolean): any;
export function isValidPublic(publicKey: Buffer | Uint8Array, sanitize?: boolean): any;
export function isValidSignature(v: Buffer, r: Buffer, s: Buffer, homestead?: boolean): boolean;
export function isValidSignature(v: Buffer | Uint8Array, r: Buffer | Uint8Array, s: Buffer | Uint8Array, homestead?: boolean): boolean;
export function privateToAddress(privateKey: Buffer): Buffer;
export function privateToAddress(privateKey: Buffer | Uint8Array): Buffer | Uint8Array;
export function privateToPublic(privateKey: Buffer): Buffer;
export function privateToPublic(privateKey: Buffer | Uint8Array): Buffer | Uint8Array;
export function pubToAddress(pubKey: Buffer, sanitize: boolean): Buffer;
export function pubToAddress(pubKey: Buffer | Uint8Array, sanitize: boolean): Buffer | Uint8Array;
export function ripemd160(a: Buffer | any[] | string | number, padded: boolean): Buffer;
export function ripemd160(a: Buffer | Uint8Array | any[] | string | number, padded: boolean): Buffer | Uint8Array;
export function rlphash(a: Buffer | any[] | string | number): Buffer;
export function rlphash(a: Buffer | Uint8Array | any[] | string | number): Buffer | Uint8Array;
export function setLengthLeft(msg: Buffer | any[], length: number, right?: boolean): Buffer | any[];
export function setLengthLeft(msg: Buffer | Uint8Array | any[], length: number, right?: boolean): Buffer | Uint8Array | any[];
export function setLengthRight(msg: Buffer | any[], length: number): Buffer | any[];
export function setLengthRight(msg: Buffer | Uint8Array | any[], length: number): Buffer | Uint8Array | any[];
export function sha256(a: Buffer | any[] | string | number): Buffer;
export function sha256(a: Buffer | Uint8Array | any[] | string | number): Buffer | Uint8Array;
export function sha3(a: Buffer | any[] | string | number, bits?: number): Buffer;
export function sha3(a: Buffer | Uint8Array | any[] | string | number, bits?: number): Buffer | Uint8Array;
export function toBuffer(v: any): Buffer;
export function toBuffer(v: any): Buffer | Uint8Array;
export function toChecksumAddress(address: string): string;
export function toRpcSig(v: number, r: Buffer, s: Buffer): string;
export function toRpcSig(v: number, r: Buffer | Uint8Array, s: Buffer | Uint8Array): string;
export function toUnsigned(num: any): Buffer;
export function toUnsigned(num: any): Buffer | Uint8Array;
export function unpad<T extends Buffer | any[] | string>(a: T): T;
export function unpad<T extends Buffer | Uint8Array | any[] | string>(a: T): T;
export function zeros(bytes: number): Buffer;
export function zeros(bytes: number): Buffer | Uint8Array;
+15
View File
@@ -0,0 +1,15 @@
import EventSource = require("eventsource");
const eventSource = new EventSource("http://foobar");
eventSource.onmessage = (x: any) => {};
eventSource.onerror = (x: any) => {};
eventSource.onopen = (x: any) => {};
eventSource.close();
import EventSourcePolyfill = require("eventsource/lib/eventsource-polyfill");
const eventSourcePolyfill = new EventSourcePolyfill("http://foobar");
eventSourcePolyfill.onmessage = (x: any) => {};
eventSourcePolyfill.onerror = (x: any) => {};
eventSourcePolyfill.onopen = (x: any) => {};
eventSourcePolyfill.close();
+35
View File
@@ -0,0 +1,35 @@
// Type definitions for eventsource 1.0
// Project: http://github.com/EventSource/eventsource
// Definitions by: Scott Lee Davis <https://github.com/scottleedavis>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
declare class EventSource {
constructor(url: string, eventSourceInitDict?: EventSource.EventSourceInitDict);
static CLOSED: EventSource.ReadyState;
static CONNECTING: EventSource.ReadyState;
static OPEN: EventSource.ReadyState;
url: string;
readyState: EventSource.ReadyState;
onopen: EventListener;
onmessage: EventListener;
onerror: EventListener;
close(): void;
}
declare namespace EventSource {
enum ReadyState {CONNECTING = 0, OPEN = 1, CLOSED = 2}
interface EventSourceInitDict {
withCredentials?: boolean;
headers?: object;
proxy?: string;
https?: object;
rejectUnauthorized?: boolean;
}
}
export = EventSource;
export as namespace EventSource;
+29
View File
@@ -0,0 +1,29 @@
declare class EventSource {
constructor(url: string, eventSourceInitDict?: EventSource.EventSourceInitDict);
static CLOSED: EventSource.ReadyState;
static CONNECTING: EventSource.ReadyState;
static OPEN: EventSource.ReadyState;
url: string;
readyState: EventSource.ReadyState;
onopen: EventListener;
onmessage: EventListener;
onerror: EventListener;
close(): void;
}
declare namespace EventSource {
enum ReadyState {CONNECTING = 0, OPEN = 1, CLOSED = 2}
interface EventSourceInitDict {
withCredentials?: boolean;
headers?: object;
proxy?: string;
https?: object;
rejectUnauthorized?: boolean;
}
}
export = EventSource;
export as namespace EventSource;
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"eventsource-tests.ts",
"lib/eventsource-polyfill/index.d.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+12 -22
View File
@@ -1,29 +1,19 @@
import express = require('express');
import 'express-session';
import graphqlHTTP = require('express-graphql');
import { GraphQLSchema } from 'graphql/type/schema';
import express = require("express");
import "express-session";
import graphqlHTTP = require("express-graphql");
import { buildSchema } from "graphql";
const app = express();
const schema: GraphQLSchema = {
getQueryType: null,
getMutationType: null,
getSubscriptionType: null,
getTypeMap: null,
getType: null,
getPossibleTypes: null,
isPossibleType: null,
getDirective: null,
getDirectives: null,
};
const schema = buildSchema(`type Query { hello: String }`);
const graphqlOption: graphqlHTTP.OptionsData = {
graphiql: true,
schema,
formatError: (error: Error) => ({
message: error.message
message: error.message,
}),
validationRules: [() => false, () => true],
extensions: ({ document, variables, operationName, result }) => ({ key: "value", key2: "value"}),
extensions: ({ document, variables, operationName, result }) => ({ key: "value", key2: "value" }),
};
const graphqlOptionRequest = (request: express.Request): graphqlHTTP.OptionsData => ({
@@ -38,15 +28,15 @@ const graphqlOptionRequestAsync = async (request: express.Request): Promise<grap
graphiql: true,
schema: await Promise.resolve(schema),
context: request.session,
extensions: async (args) => { },
extensions: async args => {},
validationRules: [() => false, () => true],
};
};
app.use('/graphql1', graphqlHTTP(graphqlOption));
app.use("/graphql1", graphqlHTTP(graphqlOption));
app.use('/graphql2', graphqlHTTP(graphqlOptionRequest));
app.use("/graphql2", graphqlHTTP(graphqlOptionRequest));
app.use('/graphqlasync', graphqlHTTP(graphqlOptionRequestAsync));
app.use("/graphqlasync", graphqlHTTP(graphqlOptionRequestAsync));
app.listen(8080, () => console.log('GraphQL Server running on localhost:8080'));
app.listen(8080, () => console.log("GraphQL Server running on localhost:8080"));
+23 -19
View File
@@ -5,21 +5,25 @@
// Daniel Fader <https://github.com/hubel>
// Ehsan Ziya <https://github.com/zya>
// Margus Lamp <https://github.com/mlamp>
// Firede <https://github.com/firede>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { Request, Response } from "express";
import { DocumentNode, GraphQLSchema, GraphQLError } from 'graphql';
import { DocumentNode, GraphQLSchema, GraphQLError } from "graphql";
export = graphqlHTTP;
declare namespace graphqlHTTP {
/**
* Used to configure the graphQLHTTP middleware by providing a schema
* Used to configure the graphqlHTTP middleware by providing a schema
* and other configuration options.
*
* Options can be provided as an Object, a Promise for an Object, or a Function
* that returns an Object or a Promise for an Object.
*/
export type Options = ((request: Request,
response: Response,
params?: GraphQLParams) => OptionsResult) | OptionsResult;
export type Options =
| ((request: Request, response: Response, params?: GraphQLParams) => OptionsResult)
| OptionsResult;
export type OptionsResult = OptionsData | Promise<OptionsData>;
export interface OptionsData {
/**
@@ -40,20 +44,20 @@ declare namespace graphqlHTTP {
/**
* A boolean to configure whether the output should be pretty-printed.
*/
pretty?: boolean;
pretty?: boolean | null;
/**
* An optional function which will be used to format any errors produced by
* fulfilling a GraphQL operation. If no function is provided, GraphQL's
* default spec-compliant `formatError` function will be used.
*/
formatError?: (error: GraphQLError) => any;
formatError?: ((error: GraphQLError) => any) | null;
/**
* An optional array of validation rules that will be applied on the document
* in additional to those defined by the GraphQL spec.
*/
validationRules?: any[];
validationRules?: any[] | null;
/**
* An optional function for adding additional metadata to the GraphQL response
@@ -65,12 +69,12 @@ declare namespace graphqlHTTP {
*
* This function may be async.
*/
extensions?: (info: RequestInfo) => { [key: string]: any };
extensions?: ((info: RequestInfo) => { [key: string]: any }) | null;
/**
* A boolean to optionally enable GraphiQL mode.
*/
graphiql?: boolean;
graphiql?: boolean | null;
}
/**
@@ -80,32 +84,32 @@ declare namespace graphqlHTTP {
/**
* The parsed GraphQL document.
*/
document?: DocumentNode;
document: DocumentNode | null | undefined;
/**
* The variable values used at runtime.
*/
variables?: { [name: string]: any };
variables: { [name: string]: any } | null | undefined;
/**
* The (optional) operation name requested.
*/
operationName?: string;
operationName: string | null | undefined;
/**
* The result of executing the operation.
*/
result?: any;
result: any;
}
export interface GraphQLParams {
query?: string;
variables?: { [name: string]: any };
operationName?: string;
raw?: boolean;
query: string | null | undefined;
variables: { [name: string]: any } | null | undefined;
operationName: string | null | undefined;
raw: boolean | null | undefined;
}
type Middleware = (request: Request, response: Response) => void;
type Middleware = (request: Request, response: Response) => Promise<undefined>;
}
/**
@@ -72,6 +72,15 @@ FB.ui({
console.log(data.payment_id);
});
FB.ui({
method: 'pay',
action: 'purchaseiap',
product_id: 'com.fb.friendsmash.coins.10',
developer_payload: 'this_is_a_test_payload'
}, response => {
console.log(response);
});
FB.ui({
method: 'pagetab',
redirect_uri: 'YOUR_URL'
+25 -1
View File
@@ -66,6 +66,11 @@ declare namespace facebook {
*/
ui(params: PayDialogParams, callback: (response: PayDialogResponse) => void): void;
/**
* @see https://developers.facebook.com/docs/games_payments/payments_lite
*/
ui(params: PaymentsLiteDialogParams, callback: (response: PaymentsLiteDialogResponse) => void): void;
/**
* @see https://developers.facebook.com/docs/videos/live-video/exploring-live
*/
@@ -154,6 +159,14 @@ declare namespace facebook {
request_id?: string;
test_currency?: string;
}
interface PaymentsLiteDialogParams extends DialogParams {
method: 'pay';
action: 'purchaseiap';
product_id: string;
developer_payload?: string;
quantity?: number;
}
interface LiveDialogParams extends DialogParams {
method: 'live_broadcast';
@@ -173,7 +186,7 @@ declare namespace facebook {
authResponse: {
accessToken: string;
expiresIn: number;
grantedScopes: string;
grantedScopes: string;
signedRequest: string;
userID: string;
};
@@ -199,6 +212,17 @@ declare namespace facebook {
signed_request: string;
}
interface PaymentsLiteDialogResponse {
developer_payload?: string;
payment_id: number;
product_id?: string;
purchase_time?: number;
purchase_token?: string;
signed_request?: string;
error_code?: number;
error_message?: string;
}
interface LiveDialogResponse {
id: string;
stream_url: string;
@@ -43,15 +43,15 @@ gapi.load('client', () => {
async function run() {
/** Gets information about the user, the user's Drive, and system capabilities. */
await gapi.client.about.get({
await gapi.client.drive.about.get({
});
/** Gets the starting pageToken for listing future changes. */
await gapi.client.changes.getStartPageToken({
await gapi.client.drive.changes.getStartPageToken({
supportsTeamDrives: true,
teamDriveId: "teamDriveId",
});
/** Lists the changes for a user or Team Drive. */
await gapi.client.changes.list({
await gapi.client.drive.changes.list({
includeCorpusRemovals: true,
includeRemoved: true,
includeTeamDriveItems: true,
@@ -63,7 +63,7 @@ gapi.load('client', () => {
teamDriveId: "teamDriveId",
});
/** Subscribes to changes for a user. */
await gapi.client.changes.watch({
await gapi.client.drive.changes.watch({
includeCorpusRemovals: true,
includeRemoved: true,
includeTeamDriveItems: true,
@@ -75,25 +75,25 @@ gapi.load('client', () => {
teamDriveId: "teamDriveId",
});
/** Stop watching resources through this channel */
await gapi.client.channels.stop({
await gapi.client.drive.channels.stop({
});
/** Creates a new comment on a file. */
await gapi.client.comments.create({
await gapi.client.drive.comments.create({
fileId: "fileId",
});
/** Deletes a comment. */
await gapi.client.comments.delete({
await gapi.client.drive.comments.delete({
commentId: "commentId",
fileId: "fileId",
});
/** Gets a comment by ID. */
await gapi.client.comments.get({
await gapi.client.drive.comments.get({
commentId: "commentId",
fileId: "fileId",
includeDeleted: true,
});
/** Lists a file's comments. */
await gapi.client.comments.list({
await gapi.client.drive.comments.list({
fileId: "fileId",
includeDeleted: true,
pageSize: 3,
@@ -101,12 +101,12 @@ gapi.load('client', () => {
startModifiedTime: "startModifiedTime",
});
/** Updates a comment with patch semantics. */
await gapi.client.comments.update({
await gapi.client.drive.comments.update({
commentId: "commentId",
fileId: "fileId",
});
/** Creates a copy of a file and applies any requested updates with patch semantics. */
await gapi.client.files.copy({
await gapi.client.drive.files.copy({
fileId: "fileId",
ignoreDefaultVisibility: true,
keepRevisionForever: true,
@@ -114,7 +114,7 @@ gapi.load('client', () => {
supportsTeamDrives: true,
});
/** Creates a new file. */
await gapi.client.files.create({
await gapi.client.drive.files.create({
ignoreDefaultVisibility: true,
keepRevisionForever: true,
ocrLanguage: "ocrLanguage",
@@ -125,31 +125,31 @@ gapi.load('client', () => {
* Permanently deletes a file owned by the user without moving it to the trash. If the file belongs to a Team Drive the user must be an organizer on the
* parent. If the target is a folder, all descendants owned by the user are also deleted.
*/
await gapi.client.files.delete({
await gapi.client.drive.files.delete({
fileId: "fileId",
supportsTeamDrives: true,
});
/** Permanently deletes all of the user's trashed files. */
await gapi.client.files.emptyTrash({
await gapi.client.drive.files.emptyTrash({
});
/** Exports a Google Doc to the requested MIME type and returns the exported content. Please note that the exported content is limited to 10MB. */
await gapi.client.files.export({
await gapi.client.drive.files.export({
fileId: "fileId",
mimeType: "mimeType",
});
/** Generates a set of file IDs which can be provided in create requests. */
await gapi.client.files.generateIds({
await gapi.client.drive.files.generateIds({
count: 1,
space: "space",
});
/** Gets a file's metadata or content by ID. */
await gapi.client.files.get({
await gapi.client.drive.files.get({
acknowledgeAbuse: true,
fileId: "fileId",
supportsTeamDrives: true,
});
/** Lists or searches files. */
await gapi.client.files.list({
await gapi.client.drive.files.list({
corpora: "corpora",
corpus: "corpus",
includeTeamDriveItems: true,
@@ -162,7 +162,7 @@ gapi.load('client', () => {
teamDriveId: "teamDriveId",
});
/** Updates a file's metadata and/or content with patch semantics. */
await gapi.client.files.update({
await gapi.client.drive.files.update({
addParents: "addParents",
fileId: "fileId",
keepRevisionForever: true,
@@ -172,66 +172,71 @@ gapi.load('client', () => {
useContentAsIndexableText: true,
});
/** Subscribes to changes to a file */
await gapi.client.files.watch({
await gapi.client.drive.files.watch({
acknowledgeAbuse: true,
fileId: "fileId",
supportsTeamDrives: true,
});
/** Creates a permission for a file or Team Drive. */
await gapi.client.permissions.create({
await gapi.client.drive.permissions.create({
emailMessage: "emailMessage",
fileId: "fileId",
sendNotificationEmail: true,
supportsTeamDrives: true,
transferOwnership: true,
useDomainAdminAccess: true,
});
/** Deletes a permission. */
await gapi.client.permissions.delete({
await gapi.client.drive.permissions.delete({
fileId: "fileId",
permissionId: "permissionId",
supportsTeamDrives: true,
useDomainAdminAccess: true,
});
/** Gets a permission by ID. */
await gapi.client.permissions.get({
await gapi.client.drive.permissions.get({
fileId: "fileId",
permissionId: "permissionId",
supportsTeamDrives: true,
useDomainAdminAccess: true,
});
/** Lists a file's or Team Drive's permissions. */
await gapi.client.permissions.list({
await gapi.client.drive.permissions.list({
fileId: "fileId",
pageSize: 2,
pageToken: "pageToken",
supportsTeamDrives: true,
useDomainAdminAccess: true,
});
/** Updates a permission with patch semantics. */
await gapi.client.permissions.update({
await gapi.client.drive.permissions.update({
fileId: "fileId",
permissionId: "permissionId",
removeExpiration: true,
supportsTeamDrives: true,
transferOwnership: true,
useDomainAdminAccess: true,
});
/** Creates a new reply to a comment. */
await gapi.client.replies.create({
await gapi.client.drive.replies.create({
commentId: "commentId",
fileId: "fileId",
});
/** Deletes a reply. */
await gapi.client.replies.delete({
await gapi.client.drive.replies.delete({
commentId: "commentId",
fileId: "fileId",
replyId: "replyId",
});
/** Gets a reply by ID. */
await gapi.client.replies.get({
await gapi.client.drive.replies.get({
commentId: "commentId",
fileId: "fileId",
includeDeleted: true,
replyId: "replyId",
});
/** Lists a comment's replies. */
await gapi.client.replies.list({
await gapi.client.drive.replies.list({
commentId: "commentId",
fileId: "fileId",
includeDeleted: true,
@@ -239,52 +244,55 @@ gapi.load('client', () => {
pageToken: "pageToken",
});
/** Updates a reply with patch semantics. */
await gapi.client.replies.update({
await gapi.client.drive.replies.update({
commentId: "commentId",
fileId: "fileId",
replyId: "replyId",
});
/** Permanently deletes a revision. This method is only applicable to files with binary content in Drive. */
await gapi.client.revisions.delete({
await gapi.client.drive.revisions.delete({
fileId: "fileId",
revisionId: "revisionId",
});
/** Gets a revision's metadata or content by ID. */
await gapi.client.revisions.get({
await gapi.client.drive.revisions.get({
acknowledgeAbuse: true,
fileId: "fileId",
revisionId: "revisionId",
});
/** Lists a file's revisions. */
await gapi.client.revisions.list({
await gapi.client.drive.revisions.list({
fileId: "fileId",
pageSize: 2,
pageToken: "pageToken",
});
/** Updates a revision with patch semantics. */
await gapi.client.revisions.update({
await gapi.client.drive.revisions.update({
fileId: "fileId",
revisionId: "revisionId",
});
/** Creates a new Team Drive. */
await gapi.client.teamdrives.create({
await gapi.client.drive.teamdrives.create({
requestId: "requestId",
});
/** Permanently deletes a Team Drive for which the user is an organizer. The Team Drive cannot contain any untrashed items. */
await gapi.client.teamdrives.delete({
await gapi.client.drive.teamdrives.delete({
teamDriveId: "teamDriveId",
});
/** Gets a Team Drive's metadata by ID. */
await gapi.client.teamdrives.get({
await gapi.client.drive.teamdrives.get({
teamDriveId: "teamDriveId",
useDomainAdminAccess: true,
});
/** Lists the user's Team Drives. */
await gapi.client.teamdrives.list({
await gapi.client.drive.teamdrives.list({
pageSize: 1,
pageToken: "pageToken",
q: "q",
useDomainAdminAccess: true,
});
/** Updates a Team Drive's metadata */
await gapi.client.teamdrives.update({
await gapi.client.drive.teamdrives.update({
teamDriveId: "teamDriveId",
});
}
+63 -21
View File
@@ -16,28 +16,12 @@ declare namespace gapi.client {
function load(name: "drive", version: "v3"): PromiseLike<void>;
function load(name: "drive", version: "v3", callback: () => any): void;
const about: drive.AboutResource;
const changes: drive.ChangesResource;
const channels: drive.ChannelsResource;
const comments: drive.CommentsResource;
const files: drive.FilesResource;
const permissions: drive.PermissionsResource;
const replies: drive.RepliesResource;
const revisions: drive.RevisionsResource;
const teamdrives: drive.TeamdrivesResource;
namespace drive {
interface About {
/** Whether the user has installed the requesting app. */
appInstalled?: boolean;
/** Whether the user can create Team Drives. */
canCreateTeamDrives?: boolean;
/** A map of source MIME type to possible targets for all supported exports. */
exportFormats?: Record<string, string[]>;
/** The currently supported folder colors as RGB hex strings. */
@@ -363,8 +347,9 @@ declare namespace gapi.client {
owners?: User[];
/**
* The IDs of the parent folders which contain the file.
* If not specified as part of a create request, the file will be placed directly in the My Drive folder. Update requests must use the addParents and
* removeParents parameters to modify the values.
* If not specified as part of a create request, the file will be placed directly in the user's My Drive folder. If not specified as part of a copy
* request, the file will inherit any discoverable parents of the source file. Update requests must use the addParents and removeParents parameters to
* modify the parents list.
*/
parents?: string[];
/** List of permission IDs for users with access to this file. */
@@ -683,6 +668,8 @@ declare namespace gapi.client {
};
/** The color of this Team Drive as an RGB hex string. It can only be set on a drive.teamdrives.update request that does not set themeId. */
colorRgb?: string;
/** The time at which the Team Drive was created (RFC 3339 date-time). */
createdTime?: string;
/** The ID of this Team Drive which is also the ID of the top level folder for this Team Drive. */
id?: string;
/** Identifies what kind of resource this is. Value: the fixed string "drive#teamDrive". */
@@ -1322,7 +1309,7 @@ declare namespace gapi.client {
create(request: {
/** Data format for the response. */
alt?: string;
/** A custom message to include in the notification email. */
/** A plain text custom message to include in the notification email. */
emailMessage?: string;
/** Selector specifying which fields to include in a partial response. */
fields?: string;
@@ -1351,6 +1338,11 @@ declare namespace gapi.client {
* the side effect.
*/
transferOwnership?: boolean;
/**
* Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they
* are an administrator of the domain to which the item belongs.
*/
useDomainAdminAccess?: boolean;
/** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */
userIp?: string;
}): Request<Permission>;
@@ -1377,6 +1369,11 @@ declare namespace gapi.client {
quotaUser?: string;
/** Whether the requesting application supports Team Drives. */
supportsTeamDrives?: boolean;
/**
* Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they
* are an administrator of the domain to which the item belongs.
*/
useDomainAdminAccess?: boolean;
/** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */
userIp?: string;
}): Request<void>;
@@ -1403,6 +1400,11 @@ declare namespace gapi.client {
quotaUser?: string;
/** Whether the requesting application supports Team Drives. */
supportsTeamDrives?: boolean;
/**
* Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they
* are an administrator of the domain to which the item belongs.
*/
useDomainAdminAccess?: boolean;
/** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */
userIp?: string;
}): Request<Permission>;
@@ -1434,6 +1436,11 @@ declare namespace gapi.client {
quotaUser?: string;
/** Whether the requesting application supports Team Drives. */
supportsTeamDrives?: boolean;
/**
* Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they
* are an administrator of the domain to which the item belongs.
*/
useDomainAdminAccess?: boolean;
/** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */
userIp?: string;
}): Request<PermissionList>;
@@ -1467,6 +1474,11 @@ declare namespace gapi.client {
* the side effect.
*/
transferOwnership?: boolean;
/**
* Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they
* are an administrator of the domain to which the item belongs.
*/
useDomainAdminAccess?: boolean;
/** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */
userIp?: string;
}): Request<Permission>;
@@ -1777,6 +1789,11 @@ declare namespace gapi.client {
quotaUser?: string;
/** The ID of the Team Drive */
teamDriveId: string;
/**
* Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they
* are an administrator of the domain to which the Team Drive belongs.
*/
useDomainAdminAccess?: boolean;
/** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */
userIp?: string;
}): Request<TeamDrive>;
@@ -1796,11 +1813,18 @@ declare namespace gapi.client {
pageToken?: string;
/** Returns response with indentations and line breaks. */
prettyPrint?: boolean;
/** Query string for searching Team Drives. */
q?: string;
/**
* Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* Overrides userIp if both are provided.
*/
quotaUser?: string;
/**
* Whether the request should be treated as if it was issued by a domain administrator; if set to true, then all Team Drives of the domain in which the
* requester is an administrator are returned.
*/
useDomainAdminAccess?: boolean;
/** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */
userIp?: string;
}): Request<TeamDriveList>;
@@ -1827,5 +1851,23 @@ declare namespace gapi.client {
userIp?: string;
}): Request<TeamDrive>;
}
const about: AboutResource;
const changes: ChangesResource;
const channels: ChannelsResource;
const comments: CommentsResource;
const files: FilesResource;
const permissions: PermissionsResource;
const replies: RepliesResource;
const revisions: RevisionsResource;
const teamdrives: TeamdrivesResource;
}
}
+1 -1
View File
@@ -14,7 +14,7 @@
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": [
@@ -1,41 +1,31 @@
import getFieldNames = require("graphql-list-fields");
import {
GraphQLID,
GraphQLObjectType,
GraphQLResolveInfo,
GraphQLSchema,
GraphQLString
} from "graphql";
import { GraphQLID, GraphQLObjectType, GraphQLSchema, GraphQLString } from "graphql";
const sampleGraphQLResolveInfo: GraphQLResolveInfo = {
fieldName: "",
fieldNodes: [],
returnType: GraphQLString,
parentType: new GraphQLObjectType({
name: "Sample",
const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: "SampleType",
fields: {
name: { type: GraphQLString }
}
scalarField: {
type: GraphQLString,
resolve(source, args, context, info) {
const fieldNames: string[] = getFieldNames(info);
},
},
someType: {
type: new GraphQLObjectType({
name: "SomeType",
fields: {
a: { type: GraphQLID },
b: { type: GraphQLString },
c: { type: GraphQLString },
d: { type: GraphQLString },
},
}),
resolve(source, args, context, info) {
const fieldNames: string[] = getFieldNames(info);
},
},
},
}),
path: undefined,
schema: new GraphQLSchema({
query: new GraphQLObjectType({
name: "SampleType",
fields: {}
})
}),
fragments: {},
rootValue: null,
operation: {
kind: "OperationDefinition",
operation: "query",
selectionSet: {
kind: "SelectionSet",
selections: []
}
},
variableValues: {}
};
const fieldNames: string[] = getFieldNames(sampleGraphQLResolveInfo);
});
+58 -58
View File
@@ -1,6 +1,6 @@
import { getLocation } from '../language';
import { ASTNode } from '../language/ast';
import { Source } from '../language/source';
import { getLocation } from "../language";
import { ASTNode } from "../language/ast";
import { Source } from "../language/source";
/**
* A GraphQLError describes an Error found during the parse, validate, or
@@ -9,66 +9,66 @@ import { Source } from '../language/source';
* GraphQL document and/or execution result that correspond to the Error.
*/
export class GraphQLError extends Error {
/**
* A message describing the Error for debugging purposes.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
message: string;
/**
* A message describing the Error for debugging purposes.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
message: string;
/**
* An array of { line, column } locations within the source GraphQL document
* which correspond to this error.
*
* Errors during validation often contain multiple locations, for example to
* point out two things with the same name. Errors during execution include a
* single location, the field which produced the error.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
locations?: Array<{ line: number; column: number }> | undefined;
/**
* An array of { line, column } locations within the source GraphQL document
* which correspond to this error.
*
* Errors during validation often contain multiple locations, for example to
* point out two things with the same name. Errors during execution include a
* single location, the field which produced the error.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
locations?: Array<{ line: number; column: number }> | undefined;
/**
* An array describing the JSON-path into the execution response which
* corresponds to this error. Only included for errors during execution.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
path?: Array<string | number> | undefined;
/**
* An array describing the JSON-path into the execution response which
* corresponds to this error. Only included for errors during execution.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
path?: Array<string | number> | undefined;
/**
* An array of GraphQL AST Nodes corresponding to this error.
*/
nodes?: ASTNode[] | undefined;
/**
* An array of GraphQL AST Nodes corresponding to this error.
*/
nodes?: ASTNode[] | undefined;
/**
* The source GraphQL document corresponding to this error.
*/
source?: Source | undefined;
/**
* The source GraphQL document corresponding to this error.
*/
source?: Source | undefined;
/**
* An array of character offsets within the source GraphQL document
* which correspond to this error.
*/
positions?: number[] | undefined;
/**
* An array of character offsets within the source GraphQL document
* which correspond to this error.
*/
positions?: number[] | undefined;
/**
* The original error thrown from a field resolver during execution.
*/
originalError?: Error;
/**
* Extension fields to add to the formatted error.
*/
extensions?: { [key: string]: any } | undefined;
/**
* The original error thrown from a field resolver during execution.
*/
originalError?: Error;
constructor(
message: string,
nodes?: any[],
source?: Source,
positions?: number[],
path?: Array<string | number>,
originalError?: Error,
extensions?: { [key: string]: any },
);
/**
* Extension fields to add to the formatted error.
*/
extensions?: { [key: string]: any } | undefined;
constructor(
message: string,
nodes?: any[],
source?: Source,
positions?: number[],
path?: Array<string | number>,
originalError?: Error,
extensions?: { [key: string]: any }
);
}
+6 -6
View File
@@ -1,4 +1,4 @@
import { GraphQLError } from './GraphQLError';
import { GraphQLError } from "./GraphQLError";
/**
* Given a GraphQLError, format it according to the rules described by the
@@ -7,12 +7,12 @@ import { GraphQLError } from './GraphQLError';
export function formatError(error: GraphQLError): GraphQLFormattedError;
export interface GraphQLFormattedError {
message: string;
locations?: GraphQLErrorLocation[];
path?: Array<string | number>;
message: string;
locations?: GraphQLErrorLocation[];
path?: Array<string | number>;
}
export interface GraphQLErrorLocation {
line: number;
column: number;
line: number;
column: number;
}
+4 -8
View File
@@ -1,8 +1,4 @@
export { GraphQLError } from './GraphQLError';
export { syntaxError } from './syntaxError';
export { locatedError } from './locatedError';
export {
formatError,
GraphQLFormattedError,
GraphQLErrorLocation,
} from './formatError';
export { GraphQLError } from "./GraphQLError";
export { syntaxError } from "./syntaxError";
export { locatedError } from "./locatedError";
export { formatError, GraphQLFormattedError, GraphQLErrorLocation } from "./formatError";
+2 -6
View File
@@ -1,12 +1,8 @@
import { GraphQLError } from './GraphQLError';
import { GraphQLError } from "./GraphQLError";
/**
* Given an arbitrary Error, presumably thrown while attempting to execute a
* GraphQL operation, produce a new GraphQLError aware of the location in the
* document responsible for the original Error.
*/
export function locatedError<T>(
originalError: Error,
nodes: T[],
path: Array<string | number>,
): GraphQLError;
export function locatedError<T>(originalError: Error, nodes: T[], path: Array<string | number>): GraphQLError;
+3 -7
View File
@@ -1,12 +1,8 @@
import { Source } from '../language/source';
import { GraphQLError } from './GraphQLError';
import { Source } from "../language/source";
import { GraphQLError } from "./GraphQLError";
/**
* Produces a GraphQLError representing a syntax error, containing useful
* descriptive information about the syntax error's position in the source.
*/
export function syntaxError(
source: Source,
position: number,
description: string,
): GraphQLError;
export function syntaxError(source: Source, position: number, description: string): GraphQLError;
+37 -41
View File
@@ -1,19 +1,15 @@
import { GraphQLError, locatedError } from '../error';
import { GraphQLSchema } from '../type/schema';
import { GraphQLError, locatedError } from "../error";
import { GraphQLSchema } from "../type/schema";
import { GraphQLField, GraphQLFieldResolver, ResponsePath } from "../type/definition";
import {
GraphQLField,
GraphQLFieldResolver,
ResponsePath,
} from '../type/definition';
import {
DirectiveNode,
DocumentNode,
OperationDefinitionNode,
SelectionSetNode,
FieldNode,
InlineFragmentNode,
FragmentDefinitionNode,
} from '../language/ast';
DirectiveNode,
DocumentNode,
OperationDefinitionNode,
SelectionSetNode,
FieldNode,
InlineFragmentNode,
FragmentDefinitionNode,
} from "../language/ast";
/**
* Data that must be available at all points during query execution.
*
@@ -21,13 +17,13 @@ import {
* and the fragments defined in the query document
*/
export interface ExecutionContext {
schema: GraphQLSchema;
fragments: { [key: string]: FragmentDefinitionNode };
rootValue: any;
operation: OperationDefinitionNode;
variableValues: { [key: string]: any };
fieldResolver: GraphQLFieldResolver<any, any>;
errors: GraphQLError[];
schema: GraphQLSchema;
fragments: { [key: string]: FragmentDefinitionNode };
rootValue: any;
operation: OperationDefinitionNode;
variableValues: { [key: string]: any };
fieldResolver: GraphQLFieldResolver<any, any>;
errors: GraphQLError[];
}
/**
@@ -37,19 +33,19 @@ export interface ExecutionContext {
* non-empty array if an error occurred.
*/
export interface ExecutionResult {
data?: { [key: string]: any };
extensions?: { [key: string]: any };
errors?: GraphQLError[];
data?: { [key: string]: any };
extensions?: { [key: string]: any };
errors?: GraphQLError[];
}
export type ExecutionArgs = {
schema: GraphQLSchema;
document: DocumentNode;
rootValue?: any;
contextValue?: any;
variableValues?: { [key: string]: any };
operationName?: string;
fieldResolver?: GraphQLFieldResolver<any, any>;
schema: GraphQLSchema;
document: DocumentNode;
rootValue?: any;
contextValue?: any;
variableValues?: { [key: string]: any };
operationName?: string;
fieldResolver?: GraphQLFieldResolver<any, any>;
};
/**
@@ -64,15 +60,15 @@ export type ExecutionArgs = {
*/
export function execute(args: ExecutionArgs): Promise<ExecutionResult>;
export function execute(
schema: GraphQLSchema,
document: DocumentNode,
rootValue?: any,
contextValue?: any,
variableValues?: {
[key: string]: any;
},
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>,
schema: GraphQLSchema,
document: DocumentNode,
rootValue?: any,
contextValue?: any,
variableValues?: {
[key: string]: any;
},
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>
): Promise<ExecutionResult>;
/**
+2 -8
View File
@@ -1,9 +1,3 @@
export {
execute,
defaultFieldResolver,
responsePathAsArray,
ExecutionArgs,
ExecutionResult,
} from './execute';
export { execute, defaultFieldResolver, responsePathAsArray, ExecutionArgs, ExecutionResult } from "./execute";
export { getDirectiveValues } from './values';
export { getDirectiveValues } from "./values";
+13 -21
View File
@@ -1,15 +1,7 @@
import {
GraphQLInputType,
GraphQLField,
GraphQLArgument,
} from '../type/definition';
import { GraphQLDirective } from '../type/directives';
import { GraphQLSchema } from '../type/schema';
import {
FieldNode,
DirectiveNode,
VariableDefinitionNode,
} from '../language/ast';
import { GraphQLInputType, GraphQLField, GraphQLArgument } from "../type/definition";
import { GraphQLDirective } from "../type/directives";
import { GraphQLSchema } from "../type/schema";
import { FieldNode, DirectiveNode, VariableDefinitionNode } from "../language/ast";
/**
* Prepares an object map of variableValues of the correct type based on the
@@ -17,9 +9,9 @@ import {
* parsed to match the variable definitions, a GraphQLError will be thrown.
*/
export function getVariableValues(
schema: GraphQLSchema,
varDefNodes: VariableDefinitionNode[],
inputs: { [key: string]: any },
schema: GraphQLSchema,
varDefNodes: VariableDefinitionNode[],
inputs: { [key: string]: any }
): { [key: string]: any };
/**
@@ -27,9 +19,9 @@ export function getVariableValues(
* definitions and list of argument AST nodes.
*/
export function getArgumentValues(
def: GraphQLField<any, any> | GraphQLDirective,
node: FieldNode | DirectiveNode,
variableValues?: { [key: string]: any },
def: GraphQLField<any, any> | GraphQLDirective,
node: FieldNode | DirectiveNode,
variableValues?: { [key: string]: any }
): { [key: string]: any };
/**
@@ -40,7 +32,7 @@ export function getArgumentValues(
* If the directive does not exist on the node, returns undefined.
*/
export function getDirectiveValues(
directiveDef: GraphQLDirective,
node: { directives?: Array<DirectiveNode> },
variableValues?: { [key: string]: any },
directiveDef: GraphQLDirective,
node: { directives?: Array<DirectiveNode> },
variableValues?: { [key: string]: any }
): void | { [key: string]: any };
+13 -13
View File
@@ -1,7 +1,7 @@
import { Source } from './language/source';
import { GraphQLFieldResolver } from './type/definition';
import { GraphQLSchema } from './type/schema';
import { ExecutionResult } from './execution/execute';
import { Source } from "./language/source";
import { GraphQLFieldResolver } from "./type/definition";
import { GraphQLSchema } from "./type/schema";
import { ExecutionResult } from "./execution/execute";
/**
* This is the primary entry point function for fulfilling GraphQL operations
@@ -34,15 +34,15 @@ import { ExecutionResult } from './execution/execute';
* value or method on the source value with the field's name).
*/
export function graphql(args: {
schema: GraphQLSchema,
source: string | Source,
rootValue?: any,
contextValue?: any,
schema: GraphQLSchema;
source: string | Source;
rootValue?: any;
contextValue?: any;
variableValues?: {
[key: string]: any
},
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>
[key: string]: any;
};
operationName?: string;
fieldResolver?: GraphQLFieldResolver<any, any>;
}): Promise<ExecutionResult>;
export function graphql(
schema: GraphQLSchema,
@@ -50,7 +50,7 @@ export function graphql(
rootValue?: any,
contextValue?: any,
variableValues?: {
[key: string]: any
[key: string]: any;
},
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>
+8 -39
View File
@@ -17,17 +17,15 @@
// TypeScript Version: 2.3
// The primary entry point into fulfilling a GraphQL request.
export {
graphql
} from './graphql';
export { graphql } from "./graphql";
// Create and operate on GraphQL type definitions and schema.
export * from './type';
export * from "./type";
// Parse and operate on GraphQL language source files.
export * from './language';
export * from "./language";
export * from './subscription';
export * from "./subscription";
// Execute GraphQL queries.
export {
@@ -37,16 +35,14 @@ export {
getDirectiveValues,
ExecutionArgs,
ExecutionResult,
} from './execution';
} from "./execution";
// Validate GraphQL queries.
export {
validate,
ValidationContext,
// All validation rules in the GraphQL Specification.
specifiedRules,
// Individual validation rules.
ArgumentsOfCorrectTypeRule,
DefaultValuesOfCorrectTypeRule,
@@ -74,87 +70,60 @@ export {
UniqueVariableNamesRule,
VariablesAreInputTypesRule,
VariablesInAllowedPositionRule,
} from './validation';
} from "./validation";
// Create and format GraphQL errors.
export {
GraphQLError,
formatError,
GraphQLFormattedError,
GraphQLErrorLocation,
} from './error';
export { GraphQLError, formatError, GraphQLFormattedError, GraphQLErrorLocation } from "./error";
// Utilities for operating on GraphQL type schema and parsed sources.
export {
// The GraphQL query recommended for a full schema introspection.
introspectionQuery,
// Gets the target Operation from a Document
getOperationAST,
// Build a GraphQLSchema from an introspection result.
buildClientSchema,
// Build a GraphQLSchema from a parsed GraphQL Schema language AST.
buildASTSchema,
// Build a GraphQLSchema from a GraphQL schema language document.
buildSchema,
// Get the description of an AST node
getDescription,
// Extends an existing GraphQLSchema from a parsed GraphQL Schema
// language AST.
extendSchema,
// Print a GraphQLSchema to GraphQL Schema language.
printSchema,
// Print a GraphQLType to GraphQL Schema language.
printType,
// Create a GraphQLType from a GraphQL language AST.
typeFromAST,
// Create a JavaScript value from a GraphQL language AST.
valueFromAST,
// Create a GraphQL language AST from a JavaScript value.
astFromValue,
// A helper to use within recursive-descent visitors which need to be aware of
// the GraphQL type system.
TypeInfo,
// Determine if JavaScript values adhere to a GraphQL type.
isValidJSValue,
// Determine if AST values adhere to a GraphQL type.
isValidLiteralValue,
// Concatenates multiple AST together.
concatAST,
// Separates an AST into an AST per Operation.
separateOperations,
// Comparators for types
isEqualType,
isTypeSubTypeOf,
doTypesOverlap,
// Asserts a string is a valid GraphQL name.
assertValidName,
// Compares two GraphQLSchemas and detects breaking changes.
findBreakingChanges,
// Report all deprecated usage within a GraphQL document.
findDeprecatedUsages,
BreakingChange,
IntrospectionDirective,
IntrospectionEnumType,
IntrospectionEnumValue,
@@ -172,4 +141,4 @@ export {
IntrospectionType,
IntrospectionTypeRef,
IntrospectionUnionType,
} from './utilities';
} from "./utilities";
+377 -381
View File
@@ -1,34 +1,34 @@
import { Source } from './source';
import { Source } from "./source";
/**
* Contains a range of UTF-8 character offsets and token references that
* identify the region of the source from which the AST derived.
*/
export interface Location {
/**
* The character offset at which this Node begins.
*/
start: number;
/**
* The character offset at which this Node begins.
*/
start: number;
/**
* The character offset at which this Node ends.
*/
end: number;
/**
* The character offset at which this Node ends.
*/
end: number;
/**
* The Token at which this Node begins.
*/
startToken: Token;
/**
* The Token at which this Node begins.
*/
startToken: Token;
/**
* The Token at which this Node ends.
*/
endToken: Token;
/**
* The Token at which this Node ends.
*/
endToken: Token;
/**
* The Source document the AST represents.
*/
source: Source;
/**
* The Source document the AST represents.
*/
source: Source;
}
/**
@@ -37,346 +37,342 @@ export interface Location {
* *only*.
*/
type TokenKind =
| '<SOF>'
| '<EOF>'
| '!'
| '$'
| '('
| ')'
| '...'
| ':'
| '='
| '@'
| '['
| ']'
| '{'
| '|'
| '}'
| 'Name'
| 'Int'
| 'Float'
| 'String'
| 'BlockString'
| 'Comment';
| "<SOF>"
| "<EOF>"
| "!"
| "$"
| "("
| ")"
| "..."
| ":"
| "="
| "@"
| "["
| "]"
| "{"
| "|"
| "}"
| "Name"
| "Int"
| "Float"
| "String"
| "BlockString"
| "Comment";
/**
* Represents a range of characters represented by a lexical token
* within a Source.
*/
export interface Token {
/**
* The kind of Token.
*/
kind: TokenKind;
/**
* The kind of Token.
*/
kind: TokenKind;
/**
* The character offset at which this Node begins.
*/
start: number;
/**
* The character offset at which this Node begins.
*/
start: number;
/**
* The character offset at which this Node ends.
*/
end: number;
/**
* The character offset at which this Node ends.
*/
end: number;
/**
* The 1-indexed line number on which this Token appears.
*/
line: number;
/**
* The 1-indexed line number on which this Token appears.
*/
line: number;
/**
* The 1-indexed column number at which this Token begins.
*/
column: number;
/**
* The 1-indexed column number at which this Token begins.
*/
column: number;
/**
* For non-punctuation tokens, represents the interpreted value of the token.
*/
value: string | undefined;
/**
* For non-punctuation tokens, represents the interpreted value of the token.
*/
value: string | undefined;
/**
* Tokens exist as nodes in a double-linked-list amongst all tokens
* including ignored tokens. <SOF> is always the first node and <EOF>
* the last.
*/
prev?: Token;
next?: Token;
/**
* Tokens exist as nodes in a double-linked-list amongst all tokens
* including ignored tokens. <SOF> is always the first node and <EOF>
* the last.
*/
prev?: Token;
next?: Token;
}
/**
* The list of all possible AST node types.
*/
export type 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
| ScalarTypeExtensionNode
| ObjectTypeExtensionNode
| InterfaceTypeExtensionNode
| UnionTypeExtensionNode
| EnumTypeExtensionNode
| InputObjectTypeExtensionNode
| DirectiveDefinitionNode;
| 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
| ScalarTypeExtensionNode
| ObjectTypeExtensionNode
| InterfaceTypeExtensionNode
| UnionTypeExtensionNode
| EnumTypeExtensionNode
| InputObjectTypeExtensionNode
| DirectiveDefinitionNode;
/**
* Utility type listing all nodes indexed by their kind.
*/
export interface ASTKindToNode {
Name: NameNode;
Document: DocumentNode;
OperationDefinition: OperationDefinitionNode;
VariableDefinition: VariableDefinitionNode;
Variable: VariableNode;
SelectionSet: SelectionSetNode;
Field: FieldNode;
Argument: ArgumentNode;
FragmentSpread: FragmentSpreadNode;
InlineFragment: InlineFragmentNode;
FragmentDefinition: FragmentDefinitionNode;
IntValue: IntValueNode;
FloatValue: FloatValueNode;
StringValue: StringValueNode;
BooleanValue: BooleanValueNode;
NullValue: NullValueNode;
EnumValue: EnumValueNode;
ListValue: ListValueNode;
ObjectValue: ObjectValueNode;
ObjectField: ObjectFieldNode;
Directive: DirectiveNode;
NamedType: NamedTypeNode;
ListType: ListTypeNode;
NonNullType: NonNullTypeNode;
SchemaDefinition: SchemaDefinitionNode;
OperationTypeDefinition: OperationTypeDefinitionNode;
ScalarTypeDefinition: ScalarTypeDefinitionNode;
ObjectTypeDefinition: ObjectTypeDefinitionNode;
FieldDefinition: FieldDefinitionNode;
InputValueDefinition: InputValueDefinitionNode;
InterfaceTypeDefinition: InterfaceTypeDefinitionNode;
UnionTypeDefinition: UnionTypeDefinitionNode;
EnumTypeDefinition: EnumTypeDefinitionNode;
EnumValueDefinition: EnumValueDefinitionNode;
InputObjectTypeDefinition: InputObjectTypeDefinitionNode;
ScalarTypeExtension: ScalarTypeExtensionNode;
ObjectTypeExtension: ObjectTypeExtensionNode;
InterfaceTypeExtension: InterfaceTypeExtensionNode;
UnionTypeExtension: UnionTypeExtensionNode;
EnumTypeExtension: EnumTypeExtensionNode;
InputObjectTypeExtension: InputObjectTypeExtensionNode;
DirectiveDefinition: DirectiveDefinitionNode;
Name: NameNode;
Document: DocumentNode;
OperationDefinition: OperationDefinitionNode;
VariableDefinition: VariableDefinitionNode;
Variable: VariableNode;
SelectionSet: SelectionSetNode;
Field: FieldNode;
Argument: ArgumentNode;
FragmentSpread: FragmentSpreadNode;
InlineFragment: InlineFragmentNode;
FragmentDefinition: FragmentDefinitionNode;
IntValue: IntValueNode;
FloatValue: FloatValueNode;
StringValue: StringValueNode;
BooleanValue: BooleanValueNode;
NullValue: NullValueNode;
EnumValue: EnumValueNode;
ListValue: ListValueNode;
ObjectValue: ObjectValueNode;
ObjectField: ObjectFieldNode;
Directive: DirectiveNode;
NamedType: NamedTypeNode;
ListType: ListTypeNode;
NonNullType: NonNullTypeNode;
SchemaDefinition: SchemaDefinitionNode;
OperationTypeDefinition: OperationTypeDefinitionNode;
ScalarTypeDefinition: ScalarTypeDefinitionNode;
ObjectTypeDefinition: ObjectTypeDefinitionNode;
FieldDefinition: FieldDefinitionNode;
InputValueDefinition: InputValueDefinitionNode;
InterfaceTypeDefinition: InterfaceTypeDefinitionNode;
UnionTypeDefinition: UnionTypeDefinitionNode;
EnumTypeDefinition: EnumTypeDefinitionNode;
EnumValueDefinition: EnumValueDefinitionNode;
InputObjectTypeDefinition: InputObjectTypeDefinitionNode;
ScalarTypeExtension: ScalarTypeExtensionNode;
ObjectTypeExtension: ObjectTypeExtensionNode;
InterfaceTypeExtension: InterfaceTypeExtensionNode;
UnionTypeExtension: UnionTypeExtensionNode;
EnumTypeExtension: EnumTypeExtensionNode;
InputObjectTypeExtension: InputObjectTypeExtensionNode;
DirectiveDefinition: DirectiveDefinitionNode;
}
// Name
export interface NameNode {
kind: 'Name';
loc?: Location;
value: string;
kind: "Name";
loc?: Location;
value: string;
}
// Document
export interface DocumentNode {
kind: 'Document';
loc?: Location;
definitions: DefinitionNode[];
kind: "Document";
loc?: Location;
definitions: DefinitionNode[];
}
export type DefinitionNode =
| ExecutableDefinitionNode
| TypeSystemDefinitionNode; // experimental non-spec addition.
export type DefinitionNode = ExecutableDefinitionNode | TypeSystemDefinitionNode; // experimental non-spec addition.
export type ExecutableDefinitionNode =
| OperationDefinitionNode
| FragmentDefinitionNode;
export type ExecutableDefinitionNode = OperationDefinitionNode | FragmentDefinitionNode;
export interface OperationDefinitionNode {
kind: 'OperationDefinition';
loc?: Location;
operation: OperationTypeNode;
name?: NameNode;
variableDefinitions?: VariableDefinitionNode[];
directives?: DirectiveNode[];
selectionSet: SelectionSetNode;
kind: "OperationDefinition";
loc?: Location;
operation: OperationTypeNode;
name?: NameNode;
variableDefinitions?: VariableDefinitionNode[];
directives?: DirectiveNode[];
selectionSet: SelectionSetNode;
}
// Note: subscription is an experimental non-spec addition.
export type OperationTypeNode = 'query' | 'mutation' | 'subscription';
export type OperationTypeNode = "query" | "mutation" | "subscription";
export interface VariableDefinitionNode {
kind: 'VariableDefinition';
loc?: Location;
variable: VariableNode;
type: TypeNode;
defaultValue?: ValueNode;
kind: "VariableDefinition";
loc?: Location;
variable: VariableNode;
type: TypeNode;
defaultValue?: ValueNode;
}
export interface VariableNode {
kind: 'Variable';
loc?: Location;
name: NameNode;
kind: "Variable";
loc?: Location;
name: NameNode;
}
export interface SelectionSetNode {
kind: 'SelectionSet';
loc?: Location;
selections: SelectionNode[];
kind: "SelectionSet";
loc?: Location;
selections: SelectionNode[];
}
export type SelectionNode = FieldNode | FragmentSpreadNode | InlineFragmentNode;
export interface FieldNode {
kind: 'Field';
loc?: Location;
alias?: NameNode;
name: NameNode;
arguments?: ArgumentNode[];
directives?: DirectiveNode[];
selectionSet?: SelectionSetNode;
kind: "Field";
loc?: Location;
alias?: NameNode;
name: NameNode;
arguments?: ArgumentNode[];
directives?: DirectiveNode[];
selectionSet?: SelectionSetNode;
}
export interface ArgumentNode {
kind: 'Argument';
loc?: Location;
name: NameNode;
value: ValueNode;
kind: "Argument";
loc?: Location;
name: NameNode;
value: ValueNode;
}
// Fragments
export interface FragmentSpreadNode {
kind: 'FragmentSpread';
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
kind: "FragmentSpread";
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
}
export interface InlineFragmentNode {
kind: 'InlineFragment';
loc?: Location;
typeCondition?: NamedTypeNode;
directives?: DirectiveNode[];
selectionSet: SelectionSetNode;
kind: "InlineFragment";
loc?: Location;
typeCondition?: NamedTypeNode;
directives?: DirectiveNode[];
selectionSet: SelectionSetNode;
}
export interface FragmentDefinitionNode {
kind: 'FragmentDefinition';
loc?: Location;
name: NameNode;
// Note: fragment variable definitions are experimental and may be changed
// or removed in the future.
variableDefinitions?: VariableDefinitionNode[];
typeCondition: NamedTypeNode;
directives?: DirectiveNode[];
selectionSet: SelectionSetNode;
kind: "FragmentDefinition";
loc?: Location;
name: NameNode;
// Note: fragment variable definitions are experimental and may be changed
// or removed in the future.
variableDefinitions?: VariableDefinitionNode[];
typeCondition: NamedTypeNode;
directives?: DirectiveNode[];
selectionSet: SelectionSetNode;
}
// Values
export type ValueNode =
| VariableNode
| IntValueNode
| FloatValueNode
| StringValueNode
| BooleanValueNode
| NullValueNode
| EnumValueNode
| ListValueNode
| ObjectValueNode;
| VariableNode
| IntValueNode
| FloatValueNode
| StringValueNode
| BooleanValueNode
| NullValueNode
| EnumValueNode
| ListValueNode
| ObjectValueNode;
export interface IntValueNode {
kind: 'IntValue';
loc?: Location;
value: string;
kind: "IntValue";
loc?: Location;
value: string;
}
export interface FloatValueNode {
kind: 'FloatValue';
loc?: Location;
value: string;
kind: "FloatValue";
loc?: Location;
value: string;
}
export interface StringValueNode {
kind: 'StringValue';
loc?: Location;
value: string;
kind: "StringValue";
loc?: Location;
value: string;
}
export interface BooleanValueNode {
kind: 'BooleanValue';
loc?: Location;
value: boolean;
kind: "BooleanValue";
loc?: Location;
value: boolean;
}
export interface NullValueNode {
kind: 'NullValue';
loc?: Location;
kind: "NullValue";
loc?: Location;
}
export interface EnumValueNode {
kind: 'EnumValue';
loc?: Location;
value: string;
kind: "EnumValue";
loc?: Location;
value: string;
}
export interface ListValueNode {
kind: 'ListValue';
loc?: Location;
values: ValueNode[];
kind: "ListValue";
loc?: Location;
values: ValueNode[];
}
export interface ObjectValueNode {
kind: 'ObjectValue';
loc?: Location;
fields: ObjectFieldNode[];
kind: "ObjectValue";
loc?: Location;
fields: ObjectFieldNode[];
}
export interface ObjectFieldNode {
kind: 'ObjectField';
loc?: Location;
name: NameNode;
value: ValueNode;
kind: "ObjectField";
loc?: Location;
name: NameNode;
value: ValueNode;
}
// Directives
export interface DirectiveNode {
kind: 'Directive';
loc?: Location;
name: NameNode;
arguments?: ArgumentNode[];
kind: "Directive";
loc?: Location;
name: NameNode;
arguments?: ArgumentNode[];
}
// Type Reference
@@ -384,198 +380,198 @@ export interface DirectiveNode {
export type TypeNode = NamedTypeNode | ListTypeNode | NonNullTypeNode;
export interface NamedTypeNode {
kind: 'NamedType';
loc?: Location;
name: NameNode;
kind: "NamedType";
loc?: Location;
name: NameNode;
}
export interface ListTypeNode {
kind: 'ListType';
loc?: Location;
type: TypeNode;
kind: "ListType";
loc?: Location;
type: TypeNode;
}
export interface NonNullTypeNode {
kind: 'NonNullType';
loc?: Location;
type: NamedTypeNode | ListTypeNode;
kind: "NonNullType";
loc?: Location;
type: NamedTypeNode | ListTypeNode;
}
// Type System Definition
export type TypeSystemDefinitionNode =
| SchemaDefinitionNode
| TypeDefinitionNode
| TypeExtensionNode
| DirectiveDefinitionNode;
| SchemaDefinitionNode
| TypeDefinitionNode
| TypeExtensionNode
| DirectiveDefinitionNode;
export interface SchemaDefinitionNode {
kind: 'SchemaDefinition';
loc?: Location;
directives: DirectiveNode[];
operationTypes: OperationTypeDefinitionNode[];
kind: "SchemaDefinition";
loc?: Location;
directives: DirectiveNode[];
operationTypes: OperationTypeDefinitionNode[];
}
export interface OperationTypeDefinitionNode {
kind: 'OperationTypeDefinition';
loc?: Location;
operation: OperationTypeNode;
type: NamedTypeNode;
kind: "OperationTypeDefinition";
loc?: Location;
operation: OperationTypeNode;
type: NamedTypeNode;
}
export type TypeDefinitionNode =
| ScalarTypeDefinitionNode
| ObjectTypeDefinitionNode
| InterfaceTypeDefinitionNode
| UnionTypeDefinitionNode
| EnumTypeDefinitionNode
| InputObjectTypeDefinitionNode;
| ScalarTypeDefinitionNode
| ObjectTypeDefinitionNode
| InterfaceTypeDefinitionNode
| UnionTypeDefinitionNode
| EnumTypeDefinitionNode
| InputObjectTypeDefinitionNode;
export interface ScalarTypeDefinitionNode {
kind: 'ScalarTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
kind: "ScalarTypeDefinition";
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
}
export interface ObjectTypeDefinitionNode {
kind: 'ObjectTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
interfaces?: NamedTypeNode[];
directives?: DirectiveNode[];
fields: FieldDefinitionNode[];
kind: "ObjectTypeDefinition";
loc?: Location;
description?: StringValueNode;
name: NameNode;
interfaces?: NamedTypeNode[];
directives?: DirectiveNode[];
fields: FieldDefinitionNode[];
}
export interface FieldDefinitionNode {
kind: 'FieldDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
arguments: InputValueDefinitionNode[];
type: TypeNode;
directives?: DirectiveNode[];
kind: "FieldDefinition";
loc?: Location;
description?: StringValueNode;
name: NameNode;
arguments: InputValueDefinitionNode[];
type: TypeNode;
directives?: DirectiveNode[];
}
export interface InputValueDefinitionNode {
kind: 'InputValueDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
type: TypeNode;
defaultValue?: ValueNode;
directives?: DirectiveNode[];
kind: "InputValueDefinition";
loc?: Location;
description?: StringValueNode;
name: NameNode;
type: TypeNode;
defaultValue?: ValueNode;
directives?: DirectiveNode[];
}
export interface InterfaceTypeDefinitionNode {
kind: 'InterfaceTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
fields: FieldDefinitionNode[];
kind: "InterfaceTypeDefinition";
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
fields: FieldDefinitionNode[];
}
export interface UnionTypeDefinitionNode {
kind: 'UnionTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
types: NamedTypeNode[];
kind: "UnionTypeDefinition";
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
types: NamedTypeNode[];
}
export interface EnumTypeDefinitionNode {
kind: 'EnumTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
values: EnumValueDefinitionNode[];
kind: "EnumTypeDefinition";
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
values: EnumValueDefinitionNode[];
}
export interface EnumValueDefinitionNode {
kind: 'EnumValueDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
kind: "EnumValueDefinition";
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
}
export interface InputObjectTypeDefinitionNode {
kind: 'InputObjectTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
fields: InputValueDefinitionNode[];
kind: "InputObjectTypeDefinition";
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
fields: InputValueDefinitionNode[];
}
export type TypeExtensionNode =
| ScalarTypeExtensionNode
| ObjectTypeExtensionNode
| InterfaceTypeExtensionNode
| UnionTypeExtensionNode
| EnumTypeExtensionNode
| InputObjectTypeExtensionNode;
| ScalarTypeExtensionNode
| ObjectTypeExtensionNode
| InterfaceTypeExtensionNode
| UnionTypeExtensionNode
| EnumTypeExtensionNode
| InputObjectTypeExtensionNode;
export type ScalarTypeExtensionNode = {
kind: 'ScalarTypeExtension';
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
kind: "ScalarTypeExtension";
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
};
export type ObjectTypeExtensionNode = {
kind: 'ObjectTypeExtension';
loc?: Location;
name: NameNode;
interfaces?: NamedTypeNode[];
directives?: DirectiveNode[];
fields?: FieldDefinitionNode[];
kind: "ObjectTypeExtension";
loc?: Location;
name: NameNode;
interfaces?: NamedTypeNode[];
directives?: DirectiveNode[];
fields?: FieldDefinitionNode[];
};
export type InterfaceTypeExtensionNode = {
kind: 'InterfaceTypeExtension';
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
fields?: FieldDefinitionNode[];
kind: "InterfaceTypeExtension";
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
fields?: FieldDefinitionNode[];
};
export type UnionTypeExtensionNode = {
kind: 'UnionTypeExtension';
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
types?: NamedTypeNode[];
kind: "UnionTypeExtension";
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
types?: NamedTypeNode[];
};
export type EnumTypeExtensionNode = {
kind: 'EnumTypeExtension';
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
values?: EnumValueDefinitionNode[];
kind: "EnumTypeExtension";
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
values?: EnumValueDefinitionNode[];
};
export type InputObjectTypeExtensionNode = {
kind: 'InputObjectTypeExtension';
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
fields?: InputValueDefinitionNode[];
kind: "InputObjectTypeExtension";
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
fields?: InputValueDefinitionNode[];
};
// Directive Definitions
export interface DirectiveDefinitionNode {
kind: 'DirectiveDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
arguments?: InputValueDefinitionNode[];
locations: NameNode[];
kind: "DirectiveDefinition";
loc?: Location;
description?: StringValueNode;
name: NameNode;
arguments?: InputValueDefinitionNode[];
locations: NameNode[];
}
+8 -14
View File
@@ -1,15 +1,9 @@
export * from './ast';
export { getLocation } from './location';
import * as Kind from './kinds';
export * from "./ast";
export { getLocation } from "./location";
import * as Kind from "./kinds";
export { Kind };
export { createLexer, TokenKind, Lexer } from './lexer';
export { parse, parseValue, parseType, ParseOptions } from './parser';
export { print } from './printer';
export { Source } from './source';
export {
visit,
visitInParallel,
visitWithTypeInfo,
getVisitFn,
BREAK,
} from './visitor';
export { createLexer, TokenKind, Lexer } from "./lexer";
export { parse, parseValue, parseType, ParseOptions } from "./parser";
export { print } from "./printer";
export { Source } from "./source";
export { visit, visitInParallel, visitWithTypeInfo, getVisitFn, BREAK } from "./visitor";
+43 -43
View File
@@ -1,72 +1,72 @@
// Name
export const NAME: 'Name';
export const NAME: "Name";
// Document
export const DOCUMENT: 'Document';
export const OPERATION_DEFINITION: 'OperationDefinition';
export const VARIABLE_DEFINITION: 'VariableDefinition';
export const VARIABLE: 'Variable';
export const SELECTION_SET: 'SelectionSet';
export const FIELD: 'Field';
export const ARGUMENT: 'Argument';
export const DOCUMENT: "Document";
export const OPERATION_DEFINITION: "OperationDefinition";
export const VARIABLE_DEFINITION: "VariableDefinition";
export const VARIABLE: "Variable";
export const SELECTION_SET: "SelectionSet";
export const FIELD: "Field";
export const ARGUMENT: "Argument";
// Fragments
export const FRAGMENT_SPREAD: 'FragmentSpread';
export const INLINE_FRAGMENT: 'InlineFragment';
export const FRAGMENT_DEFINITION: 'FragmentDefinition';
export const FRAGMENT_SPREAD: "FragmentSpread";
export const INLINE_FRAGMENT: "InlineFragment";
export const FRAGMENT_DEFINITION: "FragmentDefinition";
// Values
export const INT: 'IntValue';
export const FLOAT: 'FloatValue';
export const STRING: 'StringValue';
export const BOOLEAN: 'BooleanValue';
export const NULL: 'NullValue';
export const ENUM: 'EnumValue';
export const LIST: 'ListValue';
export const OBJECT: 'ObjectValue';
export const OBJECT_FIELD: 'ObjectField';
export const INT: "IntValue";
export const FLOAT: "FloatValue";
export const STRING: "StringValue";
export const BOOLEAN: "BooleanValue";
export const NULL: "NullValue";
export const ENUM: "EnumValue";
export const LIST: "ListValue";
export const OBJECT: "ObjectValue";
export const OBJECT_FIELD: "ObjectField";
// Directives
export const DIRECTIVE: 'Directive';
export const DIRECTIVE: "Directive";
// Types
export const NAMED_TYPE: 'NamedType';
export const LIST_TYPE: 'ListType';
export const NON_NULL_TYPE: 'NonNullType';
export const NAMED_TYPE: "NamedType";
export const LIST_TYPE: "ListType";
export const NON_NULL_TYPE: "NonNullType";
// Type System Definitions
export const SCHEMA_DEFINITION: 'SchemaDefinition';
export const OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition';
export const SCHEMA_DEFINITION: "SchemaDefinition";
export const OPERATION_TYPE_DEFINITION: "OperationTypeDefinition";
// Type Definitions
export const SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition';
export const OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition';
export const FIELD_DEFINITION: 'FieldDefinition';
export const INPUT_VALUE_DEFINITION: 'InputValueDefinition';
export const INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition';
export const UNION_TYPE_DEFINITION: 'UnionTypeDefinition';
export const ENUM_TYPE_DEFINITION: 'EnumTypeDefinition';
export const ENUM_VALUE_DEFINITION: 'EnumValueDefinition';
export const INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition';
export const SCALAR_TYPE_DEFINITION: "ScalarTypeDefinition";
export const OBJECT_TYPE_DEFINITION: "ObjectTypeDefinition";
export const FIELD_DEFINITION: "FieldDefinition";
export const INPUT_VALUE_DEFINITION: "InputValueDefinition";
export const INTERFACE_TYPE_DEFINITION: "InterfaceTypeDefinition";
export const UNION_TYPE_DEFINITION: "UnionTypeDefinition";
export const ENUM_TYPE_DEFINITION: "EnumTypeDefinition";
export const ENUM_VALUE_DEFINITION: "EnumValueDefinition";
export const INPUT_OBJECT_TYPE_DEFINITION: "InputObjectTypeDefinition";
// Type Extensions
export const TYPE_EXTENSION_DEFINITION: 'TypeExtensionDefinition';
export const SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension';
export const OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension';
export const INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension';
export const UNION_TYPE_EXTENSION: 'UnionTypeExtension';
export const ENUM_TYPE_EXTENSION: 'EnumTypeExtension';
export const INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension';
export const TYPE_EXTENSION_DEFINITION: "TypeExtensionDefinition";
export const SCALAR_TYPE_EXTENSION: "ScalarTypeExtension";
export const OBJECT_TYPE_EXTENSION: "ObjectTypeExtension";
export const INTERFACE_TYPE_EXTENSION: "InterfaceTypeExtension";
export const UNION_TYPE_EXTENSION: "UnionTypeExtension";
export const ENUM_TYPE_EXTENSION: "EnumTypeExtension";
export const INPUT_OBJECT_TYPE_EXTENSION: "InputObjectTypeExtension";
// Directive Definitions
export const DIRECTIVE_DEFINITION: 'DirectiveDefinition';
export const DIRECTIVE_DEFINITION: "DirectiveDefinition";
+46 -49
View File
@@ -1,6 +1,6 @@
import { Token } from './ast';
import { Source } from './source';
import { syntaxError } from '../error';
import { Token } from "./ast";
import { Source } from "./source";
import { syntaxError } from "../error";
/**
* Given a Source object, this returns a Lexer for that source.
@@ -10,42 +10,39 @@ import { syntaxError } from '../error';
* EOF, after which the lexer will repeatedly return the same EOF token
* whenever called.
*/
export function createLexer<TOptions>(
source: Source,
options: TOptions,
): Lexer<TOptions>;
export function createLexer<TOptions>(source: Source, options: TOptions): Lexer<TOptions>;
/**
* The return type of createLexer.
*/
export interface Lexer<TOptions> {
source: Source;
options: TOptions;
source: Source;
options: TOptions;
/**
* The previously focused non-ignored token.
*/
lastToken: Token;
/**
* The previously focused non-ignored token.
*/
lastToken: Token;
/**
* The currently focused non-ignored token.
*/
token: Token;
/**
* The currently focused non-ignored token.
*/
token: Token;
/**
* The (1-indexed) line containing the current token.
*/
line: number;
/**
* The (1-indexed) line containing the current token.
*/
line: number;
/**
* The character offset at which the current line begins.
*/
lineStart: number;
/**
* The character offset at which the current line begins.
*/
lineStart: number;
/**
* Advances the token stream to the next non-ignored token.
*/
advance(): Token;
/**
* Advances the token stream to the next non-ignored token.
*/
advance(): Token;
}
/**
@@ -53,26 +50,26 @@ export interface Lexer<TOptions> {
* lexer emits.
*/
export const TokenKind: {
SOF: '<SOF>';
EOF: '<EOF>';
BANG: '!';
DOLLAR: '$';
PAREN_L: '(';
PAREN_R: ')';
SPREAD: '...';
COLON: ':';
EQUALS: '=';
AT: '@';
BRACKET_L: '[';
BRACKET_R: ']';
BRACE_L: '{';
PIPE: '|';
BRACE_R: '}';
NAME: 'Name';
INT: 'Int';
FLOAT: 'Float';
STRING: 'String';
COMMENT: 'Comment';
SOF: "<SOF>";
EOF: "<EOF>";
BANG: "!";
DOLLAR: "$";
PAREN_L: "(";
PAREN_R: ")";
SPREAD: "...";
COLON: ":";
EQUALS: "=";
AT: "@";
BRACKET_L: "[";
BRACKET_R: "]";
BRACE_L: "{";
PIPE: "|";
BRACE_R: "}";
NAME: "Name";
INT: "Int";
FLOAT: "Float";
STRING: "String";
COMMENT: "Comment";
};
/**
+3 -3
View File
@@ -1,8 +1,8 @@
import { Source } from './source';
import { Source } from "./source";
export interface SourceLocation {
line: number;
column: number;
line: number;
column: number;
}
export function getLocation(source: Source, position: number): SourceLocation;
+47 -57
View File
@@ -1,66 +1,62 @@
import { NamedTypeNode, TypeNode, ValueNode, DocumentNode } from './ast';
import { Source } from './source';
import { Lexer } from './lexer';
import { NamedTypeNode, TypeNode, ValueNode, DocumentNode } from "./ast";
import { Source } from "./source";
import { Lexer } from "./lexer";
/**
* Configuration options to control parser behavior
*/
export interface ParseOptions {
/**
* By default, the parser creates AST nodes that know the location
* in the source that they correspond to. This configuration flag
* disables that behavior for performance or testing.
*/
noLocation?: boolean;
/**
* By default, the parser creates AST nodes that know the location
* in the source that they correspond to. This configuration flag
* disables that behavior for performance or testing.
*/
noLocation?: boolean,
/**
* If enabled, the parser will parse empty fields sets in the Schema
* Definition Language. Otherwise, the parser will follow the current
* specification.
*
* This option is provided to ease adoption of the final SDL specification
* and will be removed in a future major release.
*/
allowLegacySDLEmptyFields?: boolean;
/**
* If enabled, the parser will parse empty fields sets in the Schema
* Definition Language. Otherwise, the parser will follow the current
* specification.
*
* This option is provided to ease adoption of the final SDL specification
* and will be removed in a future major release.
*/
allowLegacySDLEmptyFields?: boolean,
/**
* If enabled, the parser will parse implemented interfaces with no `&`
* character between each interface. Otherwise, the parser will follow the
* current specification.
*
* This option is provided to ease adoption of the final SDL specification
* and will be removed in a future major release.
*/
allowLegacySDLImplementsInterfaces?: boolean;
/**
* If enabled, the parser will parse implemented interfaces with no `&`
* character between each interface. Otherwise, the parser will follow the
* current specification.
*
* This option is provided to ease adoption of the final SDL specification
* and will be removed in a future major release.
*/
allowLegacySDLImplementsInterfaces?: boolean,
/**
* EXPERIMENTAL:
*
* If enabled, the parser will understand and parse variable definitions
* contained in a fragment definition. They'll be represented in the
* `variableDefinitions` field of the FragmentDefinitionNode.
*
* The syntax is identical to normal, query-defined variables. For example:
*
* fragment A($var: Boolean = false) on T {
* ...
* }
*
* Note: this feature is experimental and may change or be removed in the
* future.
*/
experimentalFragmentVariables?: boolean,
/**
* EXPERIMENTAL:
*
* If enabled, the parser will understand and parse variable definitions
* contained in a fragment definition. They'll be represented in the
* `variableDefinitions` field of the FragmentDefinitionNode.
*
* The syntax is identical to normal, query-defined variables. For example:
*
* fragment A($var: Boolean = false) on T {
* ...
* }
*
* Note: this feature is experimental and may change or be removed in the
* future.
*/
experimentalFragmentVariables?: boolean;
}
/**
* Given a GraphQL source, parses it into a Document.
* Throws GraphQLError if a syntax error is encountered.
*/
export function parse(
source: string | Source,
options?: ParseOptions,
): DocumentNode;
export function parse(source: string | Source, options?: ParseOptions): DocumentNode;
/**
* Given a string containing a GraphQL value, parse the AST for that value.
@@ -69,10 +65,7 @@ export function parse(
* This is useful within tools that operate upon GraphQL Values directly and
* in isolation of complete GraphQL documents.
*/
export function parseValue(
source: Source | string,
options?: ParseOptions,
): ValueNode;
export function parseValue(source: Source | string, options?: ParseOptions): ValueNode;
/**
* Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for
@@ -84,10 +77,7 @@ export function parseValue(
*
* Consider providing the results to the utility function: typeFromAST().
*/
export function parseType(
source: Source | string,
options?: ParseOptions,
): TypeNode;
export function parseType(source: Source | string, options?: ParseOptions): TypeNode;
export function parseConstValue<TOptions>(lexer: Lexer<TOptions>): ValueNode;
+3 -3
View File
@@ -1,5 +1,5 @@
export class Source {
body: string;
name: string;
constructor(body: string, name?: string);
body: string;
name: string;
constructor(body: string, name?: string);
}
+34 -34
View File
@@ -1,43 +1,43 @@
export const QueryDocumentKeys: {
Name: any[];
Document: string[];
OperationDefinition: string[];
VariableDefinition: string[];
Variable: string[];
SelectionSet: string[];
Field: string[];
Argument: string[];
Name: any[];
Document: string[];
OperationDefinition: string[];
VariableDefinition: string[];
Variable: string[];
SelectionSet: string[];
Field: string[];
Argument: string[];
FragmentSpread: string[];
InlineFragment: string[];
FragmentDefinition: string[];
FragmentSpread: string[];
InlineFragment: string[];
FragmentDefinition: string[];
IntValue: number[];
FloatValue: number[];
StringValue: string[];
BooleanValue: boolean[];
NullValue: null[];
EnumValue: any[];
ListValue: string[];
ObjectValue: string[];
ObjectField: string[];
IntValue: number[];
FloatValue: number[];
StringValue: string[];
BooleanValue: boolean[];
NullValue: null[];
EnumValue: any[];
ListValue: string[];
ObjectValue: string[];
ObjectField: string[];
Directive: string[];
Directive: string[];
NamedType: string[];
ListType: string[];
NonNullType: string[];
NamedType: string[];
ListType: string[];
NonNullType: string[];
ObjectTypeDefinition: string[];
FieldDefinition: string[];
InputValueDefinition: string[];
InterfaceTypeDefinition: string[];
UnionTypeDefinition: string[];
ScalarTypeDefinition: string[];
EnumTypeDefinition: string[];
EnumValueDefinition: string[];
InputObjectTypeDefinition: string[];
TypeExtensionDefinition: string[];
ObjectTypeDefinition: string[];
FieldDefinition: string[];
InputValueDefinition: string[];
InterfaceTypeDefinition: string[];
UnionTypeDefinition: string[];
ScalarTypeDefinition: string[];
EnumTypeDefinition: string[];
EnumValueDefinition: string[];
InputObjectTypeDefinition: string[];
TypeExtensionDefinition: string[];
};
export const BREAK: any;
+1 -1
View File
@@ -1 +1 @@
export { subscribe, createSourceEventStream } from './subscribe';
export { subscribe, createSourceEventStream } from "./subscribe";
+23 -23
View File
@@ -1,29 +1,29 @@
import { GraphQLSchema } from '../type/schema';
import { DocumentNode } from '../language/ast';
import { GraphQLFieldResolver } from '../type/definition';
import { ExecutionResult } from '../execution/execute';
import { GraphQLSchema } from "../type/schema";
import { DocumentNode } from "../language/ast";
import { GraphQLFieldResolver } from "../type/definition";
import { ExecutionResult } from "../execution/execute";
export function subscribe(
schema: GraphQLSchema,
document: DocumentNode,
rootValue?: any,
contextValue?: any,
variableValues?: {
[key: string]: any;
},
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>,
subscribeFieldResolver?: GraphQLFieldResolver<any, any>,
schema: GraphQLSchema,
document: DocumentNode,
rootValue?: any,
contextValue?: any,
variableValues?: {
[key: string]: any;
},
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>,
subscribeFieldResolver?: GraphQLFieldResolver<any, any>
): Promise<AsyncIterator<ExecutionResult> | ExecutionResult>;
export function createSourceEventStream(
schema: GraphQLSchema,
document: DocumentNode,
rootValue?: any,
contextValue?: any,
variableValues?: {
[key: string]: any;
},
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>,
schema: GraphQLSchema,
document: DocumentNode,
rootValue?: any,
contextValue?: any,
variableValues?: {
[key: string]: any;
},
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>
): Promise<AsyncIterable<any>>;
+231 -257
View File
@@ -1,33 +1,33 @@
import {
ScalarTypeDefinitionNode,
ObjectTypeDefinitionNode,
FieldDefinitionNode,
InputValueDefinitionNode,
InterfaceTypeDefinitionNode,
UnionTypeDefinitionNode,
EnumTypeDefinitionNode,
EnumValueDefinitionNode,
InputObjectTypeDefinitionNode,
TypeExtensionNode,
OperationDefinitionNode,
FieldNode,
FragmentDefinitionNode,
ValueNode,
} from '../language/ast';
import { GraphQLSchema } from './schema';
ScalarTypeDefinitionNode,
ObjectTypeDefinitionNode,
FieldDefinitionNode,
InputValueDefinitionNode,
InterfaceTypeDefinitionNode,
UnionTypeDefinitionNode,
EnumTypeDefinitionNode,
EnumValueDefinitionNode,
InputObjectTypeDefinitionNode,
TypeExtensionNode,
OperationDefinitionNode,
FieldNode,
FragmentDefinitionNode,
ValueNode,
} from "../language/ast";
import { GraphQLSchema } from "./schema";
/**
* These are all of the possible kinds of types.
*/
export type GraphQLType =
| GraphQLScalarType
| GraphQLObjectType
| GraphQLInterfaceType
| GraphQLUnionType
| GraphQLEnumType
| GraphQLInputObjectType
| GraphQLList<any>
| GraphQLNonNull<any>;
| GraphQLScalarType
| GraphQLObjectType
| GraphQLInterfaceType
| GraphQLUnionType
| GraphQLEnumType
| GraphQLInputObjectType
| GraphQLList<any>
| GraphQLNonNull<any>;
export function isType(type: any): type is GraphQLType;
@@ -37,16 +37,11 @@ export function assertType(type: any): GraphQLType;
* These types may be used as input types for arguments and directives.
*/
export type GraphQLInputType =
| GraphQLScalarType
| GraphQLEnumType
| GraphQLInputObjectType
| GraphQLList<any>
| GraphQLNonNull<
| GraphQLScalarType
| GraphQLEnumType
| GraphQLInputObjectType
| GraphQLList<any>
>;
| GraphQLScalarType
| GraphQLEnumType
| GraphQLInputObjectType
| GraphQLList<any>
| GraphQLNonNull<GraphQLScalarType | GraphQLEnumType | GraphQLInputObjectType | GraphQLList<any>>;
export function isInputType(type: GraphQLType): type is GraphQLInputType;
@@ -56,20 +51,20 @@ export function assertInputType(type: GraphQLType): GraphQLInputType;
* These types may be used as output types as the result of fields.
*/
export type GraphQLOutputType =
| GraphQLScalarType
| GraphQLObjectType
| GraphQLInterfaceType
| GraphQLUnionType
| GraphQLEnumType
| GraphQLList<any>
| GraphQLNonNull<
| GraphQLScalarType
| GraphQLObjectType
| GraphQLInterfaceType
| GraphQLUnionType
| GraphQLEnumType
| GraphQLList<any>
>;
| GraphQLScalarType
| GraphQLObjectType
| GraphQLInterfaceType
| GraphQLUnionType
| GraphQLEnumType
| GraphQLList<any>
| GraphQLNonNull<
| GraphQLScalarType
| GraphQLObjectType
| GraphQLInterfaceType
| GraphQLUnionType
| GraphQLEnumType
| GraphQLList<any>
>;
export function isOutputType(type: GraphQLType): type is GraphQLOutputType;
@@ -87,14 +82,9 @@ export function assertLeafType(type: GraphQLType): GraphQLLeafType;
/**
* These types may describe the parent context of a selection set.
*/
export type GraphQLCompositeType =
| GraphQLObjectType
| GraphQLInterfaceType
| GraphQLUnionType;
export type GraphQLCompositeType = GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType;
export function isCompositeType(
type: GraphQLType,
): type is GraphQLCompositeType;
export function isCompositeType(type: GraphQLType): type is GraphQLCompositeType;
export function assertCompositeType(type: GraphQLType): GraphQLCompositeType;
@@ -111,28 +101,26 @@ export function assertAbstractType(type: GraphQLType): GraphQLAbstractType;
* These types can all accept null as a value.
*/
export type GraphQLNullableType =
| GraphQLScalarType
| GraphQLObjectType
| GraphQLInterfaceType
| GraphQLUnionType
| GraphQLEnumType
| GraphQLInputObjectType
| GraphQLList<any>;
| GraphQLScalarType
| GraphQLObjectType
| GraphQLInterfaceType
| GraphQLUnionType
| GraphQLEnumType
| GraphQLInputObjectType
| GraphQLList<any>;
export function getNullableType<T extends GraphQLType>(
type: T,
): T & GraphQLNullableType;
export function getNullableType<T extends GraphQLType>(type: T): T & GraphQLNullableType;
/**
* These named types do not include modifiers like List or NonNull.
*/
export type GraphQLNamedType =
| GraphQLScalarType
| GraphQLObjectType
| GraphQLInterfaceType
| GraphQLUnionType
| GraphQLEnumType
| GraphQLInputObjectType;
| GraphQLScalarType
| GraphQLObjectType
| GraphQLInterfaceType
| GraphQLUnionType
| GraphQLEnumType
| GraphQLInputObjectType;
export function isNamedType(type: GraphQLType): boolean;
@@ -164,30 +152,30 @@ export type Thunk<T> = (() => T) | T;
*
*/
export class GraphQLScalarType {
name: string;
description: string;
astNode?: ScalarTypeDefinitionNode;
constructor(config: GraphQLScalarTypeConfig<any, any>);
name: string;
description: string;
astNode?: ScalarTypeDefinitionNode;
constructor(config: GraphQLScalarTypeConfig<any, any>);
// Serializes an internal value to include in a response.
serialize(value: any): any;
// Serializes an internal value to include in a response.
serialize(value: any): any;
// Parses an externally provided value to use as an input.
parseValue(value: any): any;
// Parses an externally provided value to use as an input.
parseValue(value: any): any;
// Parses an externally provided literal value to use as an input.
parseLiteral(valueNode: ValueNode): any;
// Parses an externally provided literal value to use as an input.
parseLiteral(valueNode: ValueNode): any;
toString(): string;
toString(): string;
}
export interface GraphQLScalarTypeConfig<TInternal, TExternal> {
name: string;
description?: string;
astNode?: ScalarTypeDefinitionNode;
serialize(value: any): TExternal | null | undefined;
parseValue?(value: any): TInternal | null | undefined;
parseLiteral?(valueNode: ValueNode): TInternal | null | undefined;
name: string;
description?: string;
astNode?: ScalarTypeDefinitionNode;
serialize(value: any): TExternal | null | undefined;
parseValue?(value: any): TInternal | null | undefined;
parseLiteral?(valueNode: ValueNode): TInternal | null | undefined;
}
/**
@@ -228,123 +216,109 @@ export interface GraphQLScalarTypeConfig<TInternal, TExternal> {
*
*/
export class GraphQLObjectType {
name: string;
description: string;
astNode?: ObjectTypeDefinitionNode;
extensionASTNodes: Array<TypeExtensionNode>;
isTypeOf: GraphQLIsTypeOfFn<any, any>;
name: string;
description: string;
astNode?: ObjectTypeDefinitionNode;
extensionASTNodes: Array<TypeExtensionNode>;
isTypeOf: GraphQLIsTypeOfFn<any, any>;
constructor(config: GraphQLObjectTypeConfig<any, any>);
getFields(): GraphQLFieldMap<any, any>;
getInterfaces(): GraphQLInterfaceType[];
toString(): string;
constructor(config: GraphQLObjectTypeConfig<any, any>);
getFields(): GraphQLFieldMap<any, any>;
getInterfaces(): GraphQLInterfaceType[];
toString(): string;
}
export interface GraphQLObjectTypeConfig<TSource, TContext> {
name: string;
interfaces?: Thunk<GraphQLInterfaceType[]>;
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>;
isTypeOf?: GraphQLIsTypeOfFn<TSource, TContext>;
description?: string;
astNode?: ObjectTypeDefinitionNode;
extensionASTNodes?: Array<TypeExtensionNode>;
name: string;
interfaces?: Thunk<GraphQLInterfaceType[]>;
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>;
isTypeOf?: GraphQLIsTypeOfFn<TSource, TContext>;
description?: string;
astNode?: ObjectTypeDefinitionNode;
extensionASTNodes?: Array<TypeExtensionNode>;
}
export type GraphQLTypeResolver<TSource, TContext> = (
value: TSource,
context: TContext,
info: GraphQLResolveInfo,
value: TSource,
context: TContext,
info: GraphQLResolveInfo
) => GraphQLObjectType | string | Promise<GraphQLObjectType | string>;
export type GraphQLIsTypeOfFn<TSource, TContext> = (
source: TSource,
context: TContext,
info: GraphQLResolveInfo,
source: TSource,
context: TContext,
info: GraphQLResolveInfo
) => boolean | Promise<boolean>;
export type GraphQLFieldResolver<
TSource,
TContext,
TArgs = { [argName: string]: any }
> = (
source: TSource,
args: TArgs,
context: TContext,
info: GraphQLResolveInfo,
export type GraphQLFieldResolver<TSource, TContext, TArgs = { [argName: string]: any }> = (
source: TSource,
args: TArgs,
context: TContext,
info: GraphQLResolveInfo
) => any;
export interface GraphQLResolveInfo {
fieldName: string;
fieldNodes: FieldNode[];
returnType: GraphQLOutputType;
parentType: GraphQLCompositeType;
path: ResponsePath;
schema: GraphQLSchema;
fragments: { [fragmentName: string]: FragmentDefinitionNode };
rootValue: any;
operation: OperationDefinitionNode;
variableValues: { [variableName: string]: any };
fieldName: string;
fieldNodes: FieldNode[];
returnType: GraphQLOutputType;
parentType: GraphQLCompositeType;
path: ResponsePath;
schema: GraphQLSchema;
fragments: { [fragmentName: string]: FragmentDefinitionNode };
rootValue: any;
operation: OperationDefinitionNode;
variableValues: { [variableName: string]: any };
}
export type ResponsePath =
| { prev: ResponsePath; key: string | number }
| undefined;
export type ResponsePath = { prev: ResponsePath; key: string | number } | undefined;
export interface GraphQLFieldConfig<
TSource,
TContext,
TArgs = { [argName: string]: any }
> {
type: GraphQLOutputType;
args?: GraphQLFieldConfigArgumentMap;
resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>;
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>;
deprecationReason?: string;
description?: string;
astNode?: FieldDefinitionNode;
export interface GraphQLFieldConfig<TSource, TContext, TArgs = { [argName: string]: any }> {
type: GraphQLOutputType;
args?: GraphQLFieldConfigArgumentMap;
resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>;
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>;
deprecationReason?: string;
description?: string;
astNode?: FieldDefinitionNode;
}
export interface GraphQLFieldConfigArgumentMap {
[argName: string]: GraphQLArgumentConfig;
[argName: string]: GraphQLArgumentConfig;
}
export interface GraphQLArgumentConfig {
type: GraphQLInputType;
defaultValue?: any;
description?: string;
astNode?: InputValueDefinitionNode;
type: GraphQLInputType;
defaultValue?: any;
description?: string;
astNode?: InputValueDefinitionNode;
}
export interface GraphQLFieldConfigMap<TSource, TContext> {
[fieldName: string]: GraphQLFieldConfig<TSource, TContext>;
[fieldName: string]: GraphQLFieldConfig<TSource, TContext>;
}
export interface GraphQLField<
TSource,
TContext,
TArgs = { [argName: string]: any }
> {
name: string;
description: string;
type: GraphQLOutputType;
args: GraphQLArgument[];
resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>;
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>;
isDeprecated?: boolean;
deprecationReason?: string;
astNode?: FieldDefinitionNode;
export interface GraphQLField<TSource, TContext, TArgs = { [argName: string]: any }> {
name: string;
description: string;
type: GraphQLOutputType;
args: GraphQLArgument[];
resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>;
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>;
isDeprecated?: boolean;
deprecationReason?: string;
astNode?: FieldDefinitionNode;
}
export interface GraphQLArgument {
name: string;
type: GraphQLInputType;
defaultValue?: any;
description?: string;
astNode?: InputValueDefinitionNode;
name: string;
type: GraphQLInputType;
defaultValue?: any;
description?: string;
astNode?: InputValueDefinitionNode;
}
export interface GraphQLFieldMap<TSource, TContext> {
[fieldName: string]: GraphQLField<TSource, TContext>;
[fieldName: string]: GraphQLField<TSource, TContext>;
}
/**
@@ -366,29 +340,29 @@ export interface GraphQLFieldMap<TSource, TContext> {
*
*/
export class GraphQLInterfaceType {
name: string;
description: string;
astNode?: InterfaceTypeDefinitionNode;
resolveType: GraphQLTypeResolver<any, any>;
name: string;
description: string;
astNode?: InterfaceTypeDefinitionNode;
resolveType: GraphQLTypeResolver<any, any>;
constructor(config: GraphQLInterfaceTypeConfig<any, any>);
constructor(config: GraphQLInterfaceTypeConfig<any, any>);
getFields(): GraphQLFieldMap<any, any>;
getFields(): GraphQLFieldMap<any, any>;
toString(): string;
toString(): string;
}
export interface GraphQLInterfaceTypeConfig<TSource, TContext> {
name: string;
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>;
/**
* Optionally provide a custom type resolver function. If one is not provided,
* the default implementation will call `isTypeOf` on each implementing
* Object type.
*/
resolveType?: GraphQLTypeResolver<TSource, TContext>;
description?: string;
astNode?: InterfaceTypeDefinitionNode;
name: string;
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>;
/**
* Optionally provide a custom type resolver function. If one is not provided,
* the default implementation will call `isTypeOf` on each implementing
* Object type.
*/
resolveType?: GraphQLTypeResolver<TSource, TContext>;
description?: string;
astNode?: InterfaceTypeDefinitionNode;
}
/**
@@ -415,29 +389,29 @@ export interface GraphQLInterfaceTypeConfig<TSource, TContext> {
*
*/
export class GraphQLUnionType {
name: string;
description: string;
astNode?: UnionTypeDefinitionNode;
resolveType: GraphQLTypeResolver<any, any>;
name: string;
description: string;
astNode?: UnionTypeDefinitionNode;
resolveType: GraphQLTypeResolver<any, any>;
constructor(config: GraphQLUnionTypeConfig<any, any>);
constructor(config: GraphQLUnionTypeConfig<any, any>);
getTypes(): GraphQLObjectType[];
getTypes(): GraphQLObjectType[];
toString(): string;
toString(): string;
}
export interface GraphQLUnionTypeConfig<TSource, TContext> {
name: string;
types: Thunk<GraphQLObjectType[]>;
/**
* Optionally provide a custom type resolver function. If one is not provided,
* the default implementation will call `isTypeOf` on each implementing
* Object type.
*/
resolveType?: GraphQLTypeResolver<TSource, TContext>;
description?: string;
astNode?: UnionTypeDefinitionNode;
name: string;
types: Thunk<GraphQLObjectType[]>;
/**
* Optionally provide a custom type resolver function. If one is not provided,
* the default implementation will call `isTypeOf` on each implementing
* Object type.
*/
resolveType?: GraphQLTypeResolver<TSource, TContext>;
description?: string;
astNode?: UnionTypeDefinitionNode;
}
/**
@@ -462,45 +436,45 @@ export interface GraphQLUnionTypeConfig<TSource, TContext> {
* will be used as its internal value.
*/
export class GraphQLEnumType {
name: string;
description: string;
astNode?: EnumTypeDefinitionNode;
name: string;
description: string;
astNode?: EnumTypeDefinitionNode;
constructor(config: GraphQLEnumTypeConfig);
getValues(): GraphQLEnumValue[];
getValue(name: string): GraphQLEnumValue;
isValidValue(value: any): boolean;
serialize(value: any): string;
parseValue(value: any): any;
parseLiteral(valueNode: ValueNode): any;
toString(): string;
constructor(config: GraphQLEnumTypeConfig);
getValues(): GraphQLEnumValue[];
getValue(name: string): GraphQLEnumValue;
isValidValue(value: any): boolean;
serialize(value: any): string;
parseValue(value: any): any;
parseLiteral(valueNode: ValueNode): any;
toString(): string;
}
export interface GraphQLEnumTypeConfig {
name: string;
values: GraphQLEnumValueConfigMap;
description?: string;
astNode?: EnumTypeDefinitionNode;
name: string;
values: GraphQLEnumValueConfigMap;
description?: string;
astNode?: EnumTypeDefinitionNode;
}
export interface GraphQLEnumValueConfigMap {
[valueName: string]: GraphQLEnumValueConfig;
[valueName: string]: GraphQLEnumValueConfig;
}
export interface GraphQLEnumValueConfig {
value?: any;
deprecationReason?: string;
description?: string;
astNode?: EnumValueDefinitionNode;
value?: any;
deprecationReason?: string;
description?: string;
astNode?: EnumValueDefinitionNode;
}
export interface GraphQLEnumValue {
name: string;
description: string;
isDeprecated?: boolean;
deprecationReason: string;
astNode?: EnumValueDefinitionNode;
value: any;
name: string;
description: string;
isDeprecated?: boolean;
deprecationReason: string;
astNode?: EnumValueDefinitionNode;
value: any;
}
/**
@@ -524,42 +498,42 @@ export interface GraphQLEnumValue {
*
*/
export class GraphQLInputObjectType {
name: string;
description: string;
astNode?: InputObjectTypeDefinitionNode;
constructor(config: GraphQLInputObjectTypeConfig);
getFields(): GraphQLInputFieldMap;
toString(): string;
name: string;
description: string;
astNode?: InputObjectTypeDefinitionNode;
constructor(config: GraphQLInputObjectTypeConfig);
getFields(): GraphQLInputFieldMap;
toString(): string;
}
export interface GraphQLInputObjectTypeConfig {
name: string;
fields: Thunk<GraphQLInputFieldConfigMap>;
description?: string;
astNode?: InputObjectTypeDefinitionNode;
name: string;
fields: Thunk<GraphQLInputFieldConfigMap>;
description?: string;
astNode?: InputObjectTypeDefinitionNode;
}
export interface GraphQLInputFieldConfig {
type: GraphQLInputType;
defaultValue?: any;
description?: string;
astNode?: InputValueDefinitionNode;
type: GraphQLInputType;
defaultValue?: any;
description?: string;
astNode?: InputValueDefinitionNode;
}
export interface GraphQLInputFieldConfigMap {
[fieldName: string]: GraphQLInputFieldConfig;
[fieldName: string]: GraphQLInputFieldConfig;
}
export interface GraphQLInputField {
name: string;
type: GraphQLInputType;
defaultValue?: any;
description?: string;
astNode?: InputValueDefinitionNode;
name: string;
type: GraphQLInputType;
defaultValue?: any;
description?: string;
astNode?: InputValueDefinitionNode;
}
export interface GraphQLInputFieldMap {
[fieldName: string]: GraphQLInputField;
[fieldName: string]: GraphQLInputField;
}
/**
@@ -581,9 +555,9 @@ export interface GraphQLInputFieldMap {
*
*/
export class GraphQLList<T extends GraphQLType> {
ofType: T;
constructor(type: T);
toString(): string;
ofType: T;
constructor(type: T);
toString(): string;
}
/**
@@ -607,9 +581,9 @@ export class GraphQLList<T extends GraphQLType> {
* Note: the enforcement of non-nullability occurs within the executor.
*/
export class GraphQLNonNull<T extends GraphQLNullableType> {
ofType: T;
ofType: T;
constructor(type: T);
constructor(type: T);
toString(): string;
toString(): string;
}
+34 -34
View File
@@ -1,27 +1,27 @@
import { GraphQLFieldConfigArgumentMap, GraphQLArgument } from './definition';
import { DirectiveDefinitionNode } from '../language/ast';
import { GraphQLFieldConfigArgumentMap, GraphQLArgument } from "./definition";
import { DirectiveDefinitionNode } from "../language/ast";
export const DirectiveLocation: {
// Operations
QUERY: 'QUERY';
MUTATION: 'MUTATION';
SUBSCRIPTION: 'SUBSCRIPTION';
FIELD: 'FIELD';
FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION';
FRAGMENT_SPREAD: 'FRAGMENT_SPREAD';
INLINE_FRAGMENT: 'INLINE_FRAGMENT';
// Schema Definitions
SCHEMA: 'SCHEMA';
SCALAR: 'SCALAR';
OBJECT: 'OBJECT';
FIELD_DEFINITION: 'FIELD_DEFINITION';
ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION';
INTERFACE: 'INTERFACE';
UNION: 'UNION';
ENUM: 'ENUM';
ENUM_VALUE: 'ENUM_VALUE';
INPUT_OBJECT: 'INPUT_OBJECT';
INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION';
// Operations
QUERY: "QUERY";
MUTATION: "MUTATION";
SUBSCRIPTION: "SUBSCRIPTION";
FIELD: "FIELD";
FRAGMENT_DEFINITION: "FRAGMENT_DEFINITION";
FRAGMENT_SPREAD: "FRAGMENT_SPREAD";
INLINE_FRAGMENT: "INLINE_FRAGMENT";
// Schema Definitions
SCHEMA: "SCHEMA";
SCALAR: "SCALAR";
OBJECT: "OBJECT";
FIELD_DEFINITION: "FIELD_DEFINITION";
ARGUMENT_DEFINITION: "ARGUMENT_DEFINITION";
INTERFACE: "INTERFACE";
UNION: "UNION";
ENUM: "ENUM";
ENUM_VALUE: "ENUM_VALUE";
INPUT_OBJECT: "INPUT_OBJECT";
INPUT_FIELD_DEFINITION: "INPUT_FIELD_DEFINITION";
};
export type DirectiveLocationEnum = keyof typeof DirectiveLocation;
@@ -31,21 +31,21 @@ export type DirectiveLocationEnum = keyof typeof DirectiveLocation;
* behavior. Type system creators will usually not create these directly.
*/
export class GraphQLDirective {
name: string;
description?: string;
locations: DirectiveLocationEnum[];
args: GraphQLArgument[];
astNode?: DirectiveDefinitionNode;
name: string;
description?: string;
locations: DirectiveLocationEnum[];
args: GraphQLArgument[];
astNode?: DirectiveDefinitionNode;
constructor(config: GraphQLDirectiveConfig);
constructor(config: GraphQLDirectiveConfig);
}
export interface GraphQLDirectiveConfig {
name: string;
description?: string;
locations: DirectiveLocationEnum[];
args?: GraphQLFieldConfigArgumentMap;
astNode?: DirectiveDefinitionNode;
name: string;
description?: string;
locations: DirectiveLocationEnum[];
args?: GraphQLFieldConfigArgumentMap;
astNode?: DirectiveDefinitionNode;
}
/**
@@ -61,7 +61,7 @@ export const GraphQLSkipDirective: GraphQLDirective;
/**
* Constant string used for default reason for a deprecation.
*/
export const DEFAULT_DEPRECATION_REASON: 'No longer supported';
export const DEFAULT_DEPRECATION_REASON: "No longer supported";
/**
* Used to declare element of a GraphQL schema as deprecated.
+32 -38
View File
@@ -1,47 +1,41 @@
// GraphQL Schema definition
export { GraphQLSchema } from './schema';
export { GraphQLSchema } from "./schema";
export * from './definition';
export * from "./definition";
export {
// "Enum" of Directive Locations
DirectiveLocation,
// Directives Definition
GraphQLDirective,
// Built-in Directives defined by the Spec
specifiedDirectives,
GraphQLIncludeDirective,
GraphQLSkipDirective,
GraphQLDeprecatedDirective,
// Constant Deprecation Reason
DEFAULT_DEPRECATION_REASON,
} from './directives';
// "Enum" of Directive Locations
DirectiveLocation,
// Directives Definition
GraphQLDirective,
// Built-in Directives defined by the Spec
specifiedDirectives,
GraphQLIncludeDirective,
GraphQLSkipDirective,
GraphQLDeprecatedDirective,
// Constant Deprecation Reason
DEFAULT_DEPRECATION_REASON,
} from "./directives";
// Common built-in scalar instances.
export {
GraphQLInt,
GraphQLFloat,
GraphQLString,
GraphQLBoolean,
GraphQLID,
} from './scalars';
export { GraphQLInt, GraphQLFloat, GraphQLString, GraphQLBoolean, GraphQLID } from "./scalars";
export {
// "Enum" of Type Kinds
TypeKind,
// GraphQL Types for introspection.
__Schema,
__Directive,
__DirectiveLocation,
__Type,
__Field,
__InputValue,
__EnumValue,
__TypeKind,
// Meta-field definitions.
SchemaMetaFieldDef,
TypeMetaFieldDef,
TypeNameMetaFieldDef,
} from './introspection';
// "Enum" of Type Kinds
TypeKind,
// GraphQL Types for introspection.
__Schema,
__Directive,
__DirectiveLocation,
__Type,
__Field,
__InputValue,
__EnumValue,
__TypeKind,
// Meta-field definitions.
SchemaMetaFieldDef,
TypeMetaFieldDef,
TypeNameMetaFieldDef,
} from "./introspection";
export { DirectiveLocationEnum } from './directives';
export { DirectiveLocationEnum } from "./directives";
+18 -18
View File
@@ -1,14 +1,14 @@
import {
GraphQLScalarType,
GraphQLObjectType,
GraphQLInterfaceType,
GraphQLUnionType,
GraphQLEnumType,
GraphQLInputObjectType,
GraphQLList,
GraphQLNonNull,
} from './definition';
import { GraphQLField } from './definition';
GraphQLScalarType,
GraphQLObjectType,
GraphQLInterfaceType,
GraphQLUnionType,
GraphQLEnumType,
GraphQLInputObjectType,
GraphQLList,
GraphQLNonNull,
} from "./definition";
import { GraphQLField } from "./definition";
export const __Schema: GraphQLObjectType;
export const __Directive: GraphQLObjectType;
@@ -19,14 +19,14 @@ export const __InputValue: GraphQLObjectType;
export const __EnumValue: GraphQLObjectType;
export const TypeKind: {
SCALAR: 'SCALAR';
OBJECT: 'OBJECT';
INTERFACE: 'INTERFACE';
UNION: 'UNION';
ENUM: 'ENUM';
INPUT_OBJECT: 'INPUT_OBJECT';
LIST: 'LIST';
NON_NULL: 'NON_NULL';
SCALAR: "SCALAR";
OBJECT: "OBJECT";
INTERFACE: "INTERFACE";
UNION: "UNION";
ENUM: "ENUM";
INPUT_OBJECT: "INPUT_OBJECT";
LIST: "LIST";
NON_NULL: "NON_NULL";
};
export const __TypeKind: GraphQLEnumType;
+1 -1
View File
@@ -1,4 +1,4 @@
import { GraphQLScalarType } from './definition';
import { GraphQLScalarType } from "./definition";
export const GraphQLInt: GraphQLScalarType;
export const GraphQLFloat: GraphQLScalarType;
+45 -52
View File
@@ -1,11 +1,7 @@
import { GraphQLObjectType } from './definition';
import {
GraphQLType,
GraphQLNamedType,
GraphQLAbstractType,
} from './definition';
import { SchemaDefinitionNode } from '../language/ast';
import { GraphQLDirective } from './directives';
import { GraphQLObjectType } from "./definition";
import { GraphQLType, GraphQLNamedType, GraphQLAbstractType } from "./definition";
import { SchemaDefinitionNode } from "../language/ast";
import { GraphQLDirective } from "./directives";
/**
* Schema Definition
@@ -34,59 +30,56 @@ import { GraphQLDirective } from './directives';
*
*/
export class GraphQLSchema {
astNode?: SchemaDefinitionNode;
// private _queryType: GraphQLObjectType;
// private _mutationType: GraphQLObjectType;
// private _subscriptionType: GraphQLObjectType;
// private _directives: Array<GraphQLDirective>;
// private _typeMap: TypeMap;
// private _implementations: { [interfaceName: string]: Array<GraphQLObjectType> };
// private _possibleTypeMap: { [abstractName: string]: { [possibleName: string]: boolean } };
astNode?: SchemaDefinitionNode;
// private _queryType: GraphQLObjectType;
// private _mutationType: GraphQLObjectType;
// private _subscriptionType: GraphQLObjectType;
// private _directives: Array<GraphQLDirective>;
// private _typeMap: TypeMap;
// private _implementations: { [interfaceName: string]: Array<GraphQLObjectType> };
// private _possibleTypeMap: { [abstractName: string]: { [possibleName: string]: boolean } };
constructor(config: GraphQLSchemaConfig);
constructor(config: GraphQLSchemaConfig);
getQueryType(): GraphQLObjectType;
getMutationType(): GraphQLObjectType | null | undefined;
getSubscriptionType(): GraphQLObjectType | null | undefined;
getTypeMap(): { [typeName: string]: GraphQLNamedType };
getType(name: string): GraphQLNamedType;
getPossibleTypes(abstractType: GraphQLAbstractType): GraphQLObjectType[];
getQueryType(): GraphQLObjectType;
getMutationType(): GraphQLObjectType | null | undefined;
getSubscriptionType(): GraphQLObjectType | null | undefined;
getTypeMap(): { [typeName: string]: GraphQLNamedType };
getType(name: string): GraphQLNamedType;
getPossibleTypes(abstractType: GraphQLAbstractType): GraphQLObjectType[];
isPossibleType(
abstractType: GraphQLAbstractType,
possibleType: GraphQLObjectType,
): boolean;
isPossibleType(abstractType: GraphQLAbstractType, possibleType: GraphQLObjectType): boolean;
getDirectives(): GraphQLDirective[];
getDirective(name: string): GraphQLDirective;
getDirectives(): GraphQLDirective[];
getDirective(name: string): GraphQLDirective;
}
export type GraphQLSchemaValidationOptions = {
/**
* When building a schema from a GraphQL service's introspection result, it
* might be safe to assume the schema is valid. Set to true to assume the
* produced schema is valid.
*
* Default: false
*/
assumeValid?: boolean;
/**
* When building a schema from a GraphQL service's introspection result, it
* might be safe to assume the schema is valid. Set to true to assume the
* produced schema is valid.
*
* Default: false
*/
assumeValid?: boolean;
/**
* If provided, the schema will consider fields or types with names included
* in this list valid, even if they do not adhere to the specification's
* schema validation rules.
*
* This option is provided to ease adoption and may be removed in a future
* major release.
*/
allowedLegacyNames?: ReadonlyArray<string>;
/**
* If provided, the schema will consider fields or types with names included
* in this list valid, even if they do not adhere to the specification's
* schema validation rules.
*
* This option is provided to ease adoption and may be removed in a future
* major release.
*/
allowedLegacyNames?: ReadonlyArray<string>;
};
export interface GraphQLSchemaConfig {
query: GraphQLObjectType;
mutation?: GraphQLObjectType;
subscription?: GraphQLObjectType;
types?: GraphQLNamedType[];
directives?: GraphQLDirective[];
astNode?: SchemaDefinitionNode;
query: GraphQLObjectType;
mutation?: GraphQLObjectType;
subscription?: GraphQLObjectType;
types?: GraphQLNamedType[];
directives?: GraphQLDirective[];
astNode?: SchemaDefinitionNode;
}
+30 -30
View File
@@ -1,15 +1,15 @@
import { GraphQLSchema } from '../type/schema';
import { GraphQLSchema } from "../type/schema";
import {
GraphQLOutputType,
GraphQLCompositeType,
GraphQLInputType,
GraphQLField,
GraphQLArgument,
GraphQLEnumValue,
GraphQLType,
} from '../type/definition';
import { GraphQLDirective } from '../type/directives';
import { ASTNode, FieldNode } from '../language/ast';
GraphQLOutputType,
GraphQLCompositeType,
GraphQLInputType,
GraphQLField,
GraphQLArgument,
GraphQLEnumValue,
GraphQLType,
} from "../type/definition";
import { GraphQLDirective } from "../type/directives";
import { ASTNode, FieldNode } from "../language/ast";
/**
* TypeInfo is a utility class which, given a GraphQL schema, can keep track
@@ -17,27 +17,27 @@ import { ASTNode, FieldNode } from '../language/ast';
* AST during a recursive descent by calling `enter(node)` and `leave(node)`.
*/
export class TypeInfo {
constructor(
schema: GraphQLSchema,
// NOTE: this experimental optional second parameter is only needed in order
// to support non-spec-compliant codebases. You should never need to use it.
// It may disappear in the future.
getFieldDefFn?: getFieldDef,
);
constructor(
schema: GraphQLSchema,
// NOTE: this experimental optional second parameter is only needed in order
// to support non-spec-compliant codebases. You should never need to use it.
// It may disappear in the future.
getFieldDefFn?: getFieldDef
);
getType(): GraphQLOutputType;
getParentType(): GraphQLCompositeType;
getInputType(): GraphQLInputType;
getFieldDef(): GraphQLField<any, any>;
getDirective(): GraphQLDirective;
getArgument(): GraphQLArgument;
getEnumValue(): GraphQLEnumValue;
enter(node: ASTNode): any;
leave(node: ASTNode): any;
getType(): GraphQLOutputType;
getParentType(): GraphQLCompositeType;
getInputType(): GraphQLInputType;
getFieldDef(): GraphQLField<any, any>;
getDirective(): GraphQLDirective;
getArgument(): GraphQLArgument;
getEnumValue(): GraphQLEnumValue;
enter(node: ASTNode): any;
leave(node: ASTNode): any;
}
export type getFieldDef = (
schema: GraphQLSchema,
parentType: GraphQLType,
fieldNode: FieldNode,
schema: GraphQLSchema,
parentType: GraphQLType,
fieldNode: FieldNode
) => GraphQLField<any, any>;
+4 -4
View File
@@ -1,6 +1,6 @@
import {
ValueNode,
/*
ValueNode,
/*
TODO:
IntValueNode,
FloatValueNode,
@@ -10,8 +10,8 @@ import {
ListValueNode,
ObjectValueNode,
*/
} from '../language/ast';
import { GraphQLInputType } from '../type/definition';
} from "../language/ast";
import { GraphQLInputType } from "../type/definition";
/**
* Produces a GraphQL Value AST given a JavaScript value.
+13 -13
View File
@@ -1,16 +1,16 @@
import { DocumentNode, Location, StringValueNode } from '../language/ast';
import { Source } from '../language/source';
import { GraphQLSchema, GraphQLSchemaValidationOptions } from '../type/schema';
import { DocumentNode, Location, StringValueNode } from "../language/ast";
import { Source } from "../language/source";
import { GraphQLSchema, GraphQLSchemaValidationOptions } from "../type/schema";
interface BuildSchemaOptions extends GraphQLSchemaValidationOptions {
/**
* Descriptions are defined as preceding string literals, however an older
* experimental version of the SDL supported preceding comments as
* descriptions. Set to true to enable this deprecated behavior.
*
* Default: false
*/
commentDescriptions?: boolean;
/**
* Descriptions are defined as preceding string literals, however an older
* experimental version of the SDL supported preceding comments as
* descriptions. Set to true to enable this deprecated behavior.
*
* Default: false
*/
commentDescriptions?: boolean;
}
/**
@@ -35,8 +35,8 @@ export function buildASTSchema(ast: DocumentNode): GraphQLSchema;
*
*/
export function getDescription(
node: { description?: StringValueNode; loc?: Location },
options: BuildSchemaOptions
node: { description?: StringValueNode; loc?: Location },
options: BuildSchemaOptions
): string;
/**
+3 -6
View File
@@ -1,5 +1,5 @@
import { IntrospectionQuery } from './introspectionQuery';
import { GraphQLSchema, GraphQLSchemaValidationOptions } from '../type/schema';
import { IntrospectionQuery } from "./introspectionQuery";
import { GraphQLSchema, GraphQLSchemaValidationOptions } from "../type/schema";
interface Options extends GraphQLSchemaValidationOptions {}
@@ -12,7 +12,4 @@ interface Options extends GraphQLSchemaValidationOptions {}
* represent the "resolver", "parse" or "serialize" functions or any other
* server-internal mechanisms.
*/
export function buildClientSchema(
introspection: IntrospectionQuery,
options?: Options,
): GraphQLSchema;
export function buildClientSchema(introspection: IntrospectionQuery, options?: Options): GraphQLSchema;
+1 -1
View File
@@ -1,4 +1,4 @@
import { DocumentNode } from '../language/ast';
import { DocumentNode } from "../language/ast";
/**
* Provided a collection of ASTs, presumably each from different files,
+3 -6
View File
@@ -1,5 +1,5 @@
import { DocumentNode } from '../language/ast';
import { GraphQLSchema } from '../type/schema';
import { DocumentNode } from "../language/ast";
import { GraphQLSchema } from "../type/schema";
/**
* Produces a new schema given an existing schema and a document which may
@@ -13,7 +13,4 @@ import { GraphQLSchema } from '../type/schema';
* This algorithm copies the provided schema, applying extensions while
* producing the copy. The original schema remains unaltered.
*/
export function extendSchema(
schema: GraphQLSchema,
documentAST: DocumentNode,
): GraphQLSchema;
export function extendSchema(schema: GraphQLSchema, documentAST: DocumentNode): GraphQLSchema;
+30 -48
View File
@@ -1,88 +1,70 @@
import {
getNamedType,
GraphQLScalarType,
GraphQLEnumType,
GraphQLInputObjectType,
GraphQLInterfaceType,
GraphQLObjectType,
GraphQLUnionType,
GraphQLNamedType,
} from '../type/definition';
import { GraphQLSchema } from '../type/schema';
getNamedType,
GraphQLScalarType,
GraphQLEnumType,
GraphQLInputObjectType,
GraphQLInterfaceType,
GraphQLObjectType,
GraphQLUnionType,
GraphQLNamedType,
} from "../type/definition";
import { GraphQLSchema } from "../type/schema";
export const BreakingChangeType: {
FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND';
FIELD_REMOVED: 'FIELD_REMOVED';
TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND';
TYPE_REMOVED: 'TYPE_REMOVED';
TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION';
VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM';
FIELD_CHANGED_KIND: "FIELD_CHANGED_KIND";
FIELD_REMOVED: "FIELD_REMOVED";
TYPE_CHANGED_KIND: "TYPE_CHANGED_KIND";
TYPE_REMOVED: "TYPE_REMOVED";
TYPE_REMOVED_FROM_UNION: "TYPE_REMOVED_FROM_UNION";
VALUE_REMOVED_FROM_ENUM: "VALUE_REMOVED_FROM_ENUM";
};
export type BreakingChangeKey =
| 'FIELD_CHANGED_KIND'
| 'FIELD_REMOVED'
| 'TYPE_CHANGED_KIND'
| 'TYPE_REMOVED'
| 'TYPE_REMOVED_FROM_UNION'
| 'VALUE_REMOVED_FROM_ENUM';
| "FIELD_CHANGED_KIND"
| "FIELD_REMOVED"
| "TYPE_CHANGED_KIND"
| "TYPE_REMOVED"
| "TYPE_REMOVED_FROM_UNION"
| "VALUE_REMOVED_FROM_ENUM";
export interface BreakingChange {
type: BreakingChangeKey;
description: string;
type: BreakingChangeKey;
description: string;
}
/**
* Given two schemas, returns an Array containing descriptions of all the types
* of breaking changes covered by the other functions down below.
*/
export function findBreakingChanges(
oldSchema: GraphQLSchema,
newSchema: GraphQLSchema,
): BreakingChange[];
export function findBreakingChanges(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[];
/**
* Given two schemas, returns an Array containing descriptions of any breaking
* changes in the newSchema related to removing an entire type.
*/
export function findRemovedTypes(
oldSchema: GraphQLSchema,
newSchema: GraphQLSchema,
): BreakingChange[];
export function findRemovedTypes(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[];
/**
* Given two schemas, returns an Array containing descriptions of any breaking
* changes in the newSchema related to changing the type of a type.
*/
export function findTypesThatChangedKind(
oldSchema: GraphQLSchema,
newSchema: GraphQLSchema,
): BreakingChange[];
export function findTypesThatChangedKind(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[];
/**
* Given two schemas, returns an Array containing descriptions of any breaking
* changes in the newSchema related to the fields on a type. This includes if
* a field has been removed from a type or if a field has changed type.
*/
export function findFieldsThatChangedType(
oldSchema: GraphQLSchema,
newSchema: GraphQLSchema,
): BreakingChange[];
export function findFieldsThatChangedType(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[];
/**
* Given two schemas, returns an Array containing descriptions of any breaking
* changes in the newSchema related to removing types from a union type.
*/
export function findTypesRemovedFromUnions(
oldSchema: GraphQLSchema,
newSchema: GraphQLSchema,
): BreakingChange[];
export function findTypesRemovedFromUnions(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[];
/**
* Given two schemas, returns an Array containing descriptions of any breaking
* changes in the newSchema related to removing values from an enum type.
*/
export function findValuesRemovedFromEnums(
oldSchema: GraphQLSchema,
newSchema: GraphQLSchema,
): BreakingChange[];
export function findValuesRemovedFromEnums(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[];
+4 -7
View File
@@ -1,13 +1,10 @@
import { GraphQLSchema } from '../type/schema';
import { DocumentNode } from '../language/ast';
import { GraphQLError } from '../error/GraphQLError';
import { GraphQLSchema } from "../type/schema";
import { DocumentNode } from "../language/ast";
import { GraphQLError } from "../error/GraphQLError";
/**
* A validation rule which reports deprecated usages.
*
* Returns a list of GraphQLError instances describing each deprecated use.
*/
export function findDeprecatedUsages(
schema: GraphQLSchema,
ast: DocumentNode,
): GraphQLError[];
export function findDeprecatedUsages(schema: GraphQLSchema, ast: DocumentNode): GraphQLError[];
+2 -5
View File
@@ -1,11 +1,8 @@
import { DocumentNode, OperationDefinitionNode } from '../language/ast';
import { DocumentNode, OperationDefinitionNode } from "../language/ast";
/**
* Returns an operation AST given a document AST and optionally an operation
* name. If a name is not provided, an operation is only returned if only one is
* provided in the document.
*/
export function getOperationAST(
documentAST: DocumentNode,
operationName?: string,
): OperationDefinitionNode;
export function getOperationAST(documentAST: DocumentNode, operationName?: string): OperationDefinitionNode;
+37 -45
View File
@@ -1,82 +1,74 @@
// The GraphQL query recommended for a full schema introspection.
export { introspectionQuery } from './introspectionQuery';
export { introspectionQuery } from "./introspectionQuery";
export {
IntrospectionQuery,
IntrospectionSchema,
IntrospectionType,
IntrospectionScalarType,
IntrospectionObjectType,
IntrospectionInterfaceType,
IntrospectionUnionType,
IntrospectionEnumType,
IntrospectionInputObjectType,
IntrospectionTypeRef,
IntrospectionNamedTypeRef,
IntrospectionListTypeRef,
IntrospectionNonNullTypeRef,
IntrospectionField,
IntrospectionInputValue,
IntrospectionEnumValue,
IntrospectionDirective,
} from './introspectionQuery';
IntrospectionQuery,
IntrospectionSchema,
IntrospectionType,
IntrospectionScalarType,
IntrospectionObjectType,
IntrospectionInterfaceType,
IntrospectionUnionType,
IntrospectionEnumType,
IntrospectionInputObjectType,
IntrospectionTypeRef,
IntrospectionNamedTypeRef,
IntrospectionListTypeRef,
IntrospectionNonNullTypeRef,
IntrospectionField,
IntrospectionInputValue,
IntrospectionEnumValue,
IntrospectionDirective,
} from "./introspectionQuery";
// Gets the target Operation from a Document
export { getOperationAST } from './getOperationAST';
export { getOperationAST } from "./getOperationAST";
// Build a GraphQLSchema from an introspection result.
export { buildClientSchema } from './buildClientSchema';
export { buildClientSchema } from "./buildClientSchema";
// Build a GraphQLSchema from GraphQL Schema language.
export { buildASTSchema, buildSchema, getDescription } from './buildASTSchema';
export { buildASTSchema, buildSchema, getDescription } from "./buildASTSchema";
// Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST.
export { extendSchema } from './extendSchema';
export { extendSchema } from "./extendSchema";
// Print a GraphQLSchema to GraphQL Schema language.
export {
printSchema,
printType,
printIntrospectionSchema,
} from './schemaPrinter';
export { printSchema, printType, printIntrospectionSchema } from "./schemaPrinter";
// Create a GraphQLType from a GraphQL language AST.
export { typeFromAST } from './typeFromAST';
export { typeFromAST } from "./typeFromAST";
// Create a JavaScript value from a GraphQL language AST.
export { valueFromAST } from './valueFromAST';
export { valueFromAST } from "./valueFromAST";
// Create a GraphQL language AST from a JavaScript value.
export { astFromValue } from './astFromValue';
export { astFromValue } from "./astFromValue";
// A helper to use within recursive-descent visitors which need to be aware of
// the GraphQL type system.
export { TypeInfo } from './TypeInfo';
export { TypeInfo } from "./TypeInfo";
// Determine if JavaScript values adhere to a GraphQL type.
export { isValidJSValue } from './isValidJSValue';
export { isValidJSValue } from "./isValidJSValue";
// Determine if AST values adhere to a GraphQL type.
export { isValidLiteralValue } from './isValidLiteralValue';
export { isValidLiteralValue } from "./isValidLiteralValue";
// Concatenates multiple AST together.
export { concatAST } from './concatAST';
export { concatAST } from "./concatAST";
// Separates an AST into an AST per Operation.
export { separateOperations } from './separateOperations';
export { separateOperations } from "./separateOperations";
// Comparators for types
export {
isEqualType,
isTypeSubTypeOf,
doTypesOverlap,
} from './typeComparators';
export { isEqualType, isTypeSubTypeOf, doTypesOverlap } from "./typeComparators";
// Asserts that a string is a valid GraphQL name
export { assertValidName } from './assertValidName';
export { assertValidName } from "./assertValidName";
// Compares two GraphQLSchemas and detects breaking changes.
export { findBreakingChanges } from './findBreakingChanges';
export { BreakingChange } from './findBreakingChanges';
export { findBreakingChanges } from "./findBreakingChanges";
export { BreakingChange } from "./findBreakingChanges";
// Report all deprecated usage within a GraphQL document.
export { findDeprecatedUsages } from './findDeprecatedUsages';
export { findDeprecatedUsages } from "./findDeprecatedUsages";
+63 -66
View File
@@ -1,4 +1,4 @@
import { DirectiveLocationEnum } from '../type/directives';
import { DirectiveLocationEnum } from "../type/directives";
/*
query IntrospectionQuery {
@@ -96,114 +96,111 @@ fragment TypeRef on __Type {
export const introspectionQuery: string;
export interface IntrospectionQuery {
__schema: IntrospectionSchema;
__schema: IntrospectionSchema;
}
export interface IntrospectionSchema {
queryType: IntrospectionNamedTypeRef;
mutationType?: IntrospectionNamedTypeRef;
subscriptionType?: IntrospectionNamedTypeRef;
types: IntrospectionType[];
directives: IntrospectionDirective[];
queryType: IntrospectionNamedTypeRef;
mutationType?: IntrospectionNamedTypeRef;
subscriptionType?: IntrospectionNamedTypeRef;
types: IntrospectionType[];
directives: IntrospectionDirective[];
}
export type IntrospectionType =
| IntrospectionScalarType
| IntrospectionObjectType
| IntrospectionInterfaceType
| IntrospectionUnionType
| IntrospectionEnumType
| IntrospectionInputObjectType;
| IntrospectionScalarType
| IntrospectionObjectType
| IntrospectionInterfaceType
| IntrospectionUnionType
| IntrospectionEnumType
| IntrospectionInputObjectType;
export interface IntrospectionScalarType {
kind: 'SCALAR';
name: string;
description?: string;
kind: "SCALAR";
name: string;
description?: string;
}
export interface IntrospectionObjectType {
kind: 'OBJECT';
name: string;
description?: string;
fields: IntrospectionField[];
interfaces: IntrospectionNamedTypeRef[];
kind: "OBJECT";
name: string;
description?: string;
fields: IntrospectionField[];
interfaces: IntrospectionNamedTypeRef[];
}
export interface IntrospectionInterfaceType {
kind: 'INTERFACE';
name: string;
description?: string;
fields: IntrospectionField[];
possibleTypes: IntrospectionNamedTypeRef[];
kind: "INTERFACE";
name: string;
description?: string;
fields: IntrospectionField[];
possibleTypes: IntrospectionNamedTypeRef[];
}
export interface IntrospectionUnionType {
kind: 'UNION';
name: string;
description?: string;
possibleTypes: IntrospectionNamedTypeRef[];
kind: "UNION";
name: string;
description?: string;
possibleTypes: IntrospectionNamedTypeRef[];
}
export interface IntrospectionEnumType {
kind: 'ENUM';
name: string;
description?: string;
enumValues: IntrospectionEnumValue[];
kind: "ENUM";
name: string;
description?: string;
enumValues: IntrospectionEnumValue[];
}
export interface IntrospectionInputObjectType {
kind: 'INPUT_OBJECT';
name: string;
description?: string;
inputFields: IntrospectionInputValue[];
kind: "INPUT_OBJECT";
name: string;
description?: string;
inputFields: IntrospectionInputValue[];
}
export type IntrospectionTypeRef =
| IntrospectionNamedTypeRef
| IntrospectionListTypeRef
| IntrospectionNonNullTypeRef;
export type IntrospectionTypeRef = IntrospectionNamedTypeRef | IntrospectionListTypeRef | IntrospectionNonNullTypeRef;
export interface IntrospectionNamedTypeRef {
kind: string;
name: string;
kind: string;
name: string;
}
export interface IntrospectionListTypeRef {
kind: 'LIST';
ofType?: IntrospectionTypeRef;
kind: "LIST";
ofType?: IntrospectionTypeRef;
}
export interface IntrospectionNonNullTypeRef {
kind: 'NON_NULL';
ofType?: IntrospectionTypeRef;
kind: "NON_NULL";
ofType?: IntrospectionTypeRef;
}
export interface IntrospectionField {
name: string;
description?: string;
args: IntrospectionInputValue[];
type: IntrospectionTypeRef;
isDeprecated: boolean;
deprecationReason?: string;
name: string;
description?: string;
args: IntrospectionInputValue[];
type: IntrospectionTypeRef;
isDeprecated: boolean;
deprecationReason?: string;
}
export interface IntrospectionInputValue {
name: string;
description?: string;
type: IntrospectionTypeRef;
defaultValue?: string;
name: string;
description?: string;
type: IntrospectionTypeRef;
defaultValue?: string;
}
export interface IntrospectionEnumValue {
name: string;
description?: string;
isDeprecated: boolean;
deprecationReason?: string;
name: string;
description?: string;
isDeprecated: boolean;
deprecationReason?: string;
}
export interface IntrospectionDirective {
name: string;
description?: string;
locations: DirectiveLocationEnum[];
args: IntrospectionInputValue[];
name: string;
description?: string;
locations: DirectiveLocationEnum[];
args: IntrospectionInputValue[];
}
+1 -1
View File
@@ -1,4 +1,4 @@
import { GraphQLInputType } from '../type/definition';
import { GraphQLInputType } from "../type/definition";
/**
* Given a JavaScript value and a GraphQL type, determine if the value will be
+3 -6
View File
@@ -1,5 +1,5 @@
import { ValueNode } from '../language/ast';
import { GraphQLInputType } from '../type/definition';
import { ValueNode } from "../language/ast";
import { GraphQLInputType } from "../type/definition";
/**
* Utility for validators which determines if a value literal AST is valid given
@@ -8,7 +8,4 @@ import { GraphQLInputType } from '../type/definition';
* Note that this only validates literal values, variables are assumed to
* provide values of the correct type.
*/
export function isValidLiteralValue(
type: GraphQLInputType,
valueNode: ValueNode,
): string[];
export function isValidLiteralValue(type: GraphQLInputType, valueNode: ValueNode): string[];
+3 -3
View File
@@ -1,8 +1,8 @@
import { GraphQLSchema } from '../type/schema';
import { GraphQLType } from '../type/definition';
import { GraphQLSchema } from "../type/schema";
import { GraphQLType } from "../type/definition";
export interface PrinterOptions {
commentDescriptions?: boolean;
commentDescriptions?: boolean;
}
export function printSchema(schema: GraphQLSchema, options?: PrinterOptions): string;
+2 -4
View File
@@ -1,5 +1,3 @@
import { DocumentNode, OperationDefinitionNode } from '../language/ast';
import { DocumentNode, OperationDefinitionNode } from "../language/ast";
export function separateOperations(
documentAST: DocumentNode,
): { [operationName: string]: DocumentNode };
export function separateOperations(documentAST: DocumentNode): { [operationName: string]: DocumentNode };
+6 -14
View File
@@ -1,9 +1,5 @@
import {
GraphQLType,
GraphQLCompositeType,
GraphQLAbstractType,
} from '../type/definition';
import { GraphQLSchema } from '../type/schema';
import { GraphQLType, GraphQLCompositeType, GraphQLAbstractType } from "../type/definition";
import { GraphQLSchema } from "../type/schema";
/**
* Provided two types, return true if the types are equal (invariant).
@@ -14,11 +10,7 @@ export function isEqualType(typeA: GraphQLType, typeB: GraphQLType): boolean;
* Provided a type and a super type, return true if the first type is either
* equal or a subset of the second super type (covariant).
*/
export function isTypeSubTypeOf(
schema: GraphQLSchema,
maybeSubType: GraphQLType,
superType: GraphQLType,
): boolean;
export function isTypeSubTypeOf(schema: GraphQLSchema, maybeSubType: GraphQLType, superType: GraphQLType): boolean;
/**
* Provided two composite types, determine if they "overlap". Two composite
@@ -30,7 +22,7 @@ export function isTypeSubTypeOf(
* This function is commutative.
*/
export function doTypesOverlap(
schema: GraphQLSchema,
typeA: GraphQLCompositeType,
typeB: GraphQLCompositeType,
schema: GraphQLSchema,
typeA: GraphQLCompositeType,
typeB: GraphQLCompositeType
): boolean;
+4 -7
View File
@@ -1,8 +1,5 @@
import { TypeNode } from '../language/ast';
import { GraphQLType, GraphQLNullableType } from '../type/definition';
import { GraphQLSchema } from '../type/schema';
import { TypeNode } from "../language/ast";
import { GraphQLType, GraphQLNullableType } from "../type/definition";
import { GraphQLSchema } from "../type/schema";
export function typeFromAST(
schema: GraphQLSchema,
typeNode: TypeNode,
): GraphQLType;
export function typeFromAST(schema: GraphQLSchema, typeNode: TypeNode): GraphQLType;
+7 -12
View File
@@ -1,15 +1,10 @@
import { GraphQLInputType } from '../type/definition';
import {
ValueNode,
VariableNode,
ListValueNode,
ObjectValueNode,
} from '../language/ast';
import { GraphQLInputType } from "../type/definition";
import { ValueNode, VariableNode, ListValueNode, ObjectValueNode } from "../language/ast";
export function valueFromAST(
valueNode: ValueNode,
type: GraphQLInputType,
variables?: {
[key: string]: any;
},
valueNode: ValueNode,
type: GraphQLInputType,
variables?: {
[key: string]: any;
}
): any;
+28 -76
View File
@@ -1,128 +1,80 @@
export { validate, ValidationContext } from './validate';
export { specifiedRules } from './specifiedRules';
export { validate, ValidationContext } from "./validate";
export { specifiedRules } from "./specifiedRules";
// Spec Section: "Argument Values Type Correctness"
export {
ArgumentsOfCorrectType as ArgumentsOfCorrectTypeRule,
} from './rules/ArgumentsOfCorrectType';
export { ArgumentsOfCorrectType as ArgumentsOfCorrectTypeRule } from "./rules/ArgumentsOfCorrectType";
// Spec Section: "Variable Default Values Are Correctly Typed"
export {
DefaultValuesOfCorrectType as DefaultValuesOfCorrectTypeRule,
} from './rules/DefaultValuesOfCorrectType';
export { DefaultValuesOfCorrectType as DefaultValuesOfCorrectTypeRule } from "./rules/DefaultValuesOfCorrectType";
// Spec Section: "Field Selections on Objects, Interfaces, and Unions Types"
export {
FieldsOnCorrectType as FieldsOnCorrectTypeRule,
} from './rules/FieldsOnCorrectType';
export { FieldsOnCorrectType as FieldsOnCorrectTypeRule } from "./rules/FieldsOnCorrectType";
// Spec Section: "Fragments on Composite Types"
export {
FragmentsOnCompositeTypes as FragmentsOnCompositeTypesRule,
} from './rules/FragmentsOnCompositeTypes';
export { FragmentsOnCompositeTypes as FragmentsOnCompositeTypesRule } from "./rules/FragmentsOnCompositeTypes";
// Spec Section: "Argument Names"
export {
KnownArgumentNames as KnownArgumentNamesRule,
} from './rules/KnownArgumentNames';
export { KnownArgumentNames as KnownArgumentNamesRule } from "./rules/KnownArgumentNames";
// Spec Section: "Directives Are Defined"
export {
KnownDirectives as KnownDirectivesRule,
} from './rules/KnownDirectives';
export { KnownDirectives as KnownDirectivesRule } from "./rules/KnownDirectives";
// Spec Section: "Fragment spread target defined"
export {
KnownFragmentNames as KnownFragmentNamesRule,
} from './rules/KnownFragmentNames';
export { KnownFragmentNames as KnownFragmentNamesRule } from "./rules/KnownFragmentNames";
// Spec Section: "Fragment Spread Type Existence"
export { KnownTypeNames as KnownTypeNamesRule } from './rules/KnownTypeNames';
export { KnownTypeNames as KnownTypeNamesRule } from "./rules/KnownTypeNames";
// Spec Section: "Lone Anonymous Operation"
export {
LoneAnonymousOperation as LoneAnonymousOperationRule,
} from './rules/LoneAnonymousOperation';
export { LoneAnonymousOperation as LoneAnonymousOperationRule } from "./rules/LoneAnonymousOperation";
// Spec Section: "Fragments must not form cycles"
export {
NoFragmentCycles as NoFragmentCyclesRule,
} from './rules/NoFragmentCycles';
export { NoFragmentCycles as NoFragmentCyclesRule } from "./rules/NoFragmentCycles";
// Spec Section: "All Variable Used Defined"
export {
NoUndefinedVariables as NoUndefinedVariablesRule,
} from './rules/NoUndefinedVariables';
export { NoUndefinedVariables as NoUndefinedVariablesRule } from "./rules/NoUndefinedVariables";
// Spec Section: "Fragments must be used"
export {
NoUnusedFragments as NoUnusedFragmentsRule,
} from './rules/NoUnusedFragments';
export { NoUnusedFragments as NoUnusedFragmentsRule } from "./rules/NoUnusedFragments";
// Spec Section: "All Variables Used"
export {
NoUnusedVariables as NoUnusedVariablesRule,
} from './rules/NoUnusedVariables';
export { NoUnusedVariables as NoUnusedVariablesRule } from "./rules/NoUnusedVariables";
// Spec Section: "Field Selection Merging"
export {
OverlappingFieldsCanBeMerged as OverlappingFieldsCanBeMergedRule,
} from './rules/OverlappingFieldsCanBeMerged';
export { OverlappingFieldsCanBeMerged as OverlappingFieldsCanBeMergedRule } from "./rules/OverlappingFieldsCanBeMerged";
// Spec Section: "Fragment spread is possible"
export {
PossibleFragmentSpreads as PossibleFragmentSpreadsRule,
} from './rules/PossibleFragmentSpreads';
export { PossibleFragmentSpreads as PossibleFragmentSpreadsRule } from "./rules/PossibleFragmentSpreads";
// Spec Section: "Argument Optionality"
export {
ProvidedNonNullArguments as ProvidedNonNullArgumentsRule,
} from './rules/ProvidedNonNullArguments';
export { ProvidedNonNullArguments as ProvidedNonNullArgumentsRule } from "./rules/ProvidedNonNullArguments";
// Spec Section: "Leaf Field Selections"
export { ScalarLeafs as ScalarLeafsRule } from './rules/ScalarLeafs';
export { ScalarLeafs as ScalarLeafsRule } from "./rules/ScalarLeafs";
// Spec Section: "Subscriptions with Single Root Field"
export {
SingleFieldSubscriptions as SingleFieldSubscriptionsRule,
} from './rules/SingleFieldSubscriptions';
export { SingleFieldSubscriptions as SingleFieldSubscriptionsRule } from "./rules/SingleFieldSubscriptions";
// Spec Section: "Argument Uniqueness"
export {
UniqueArgumentNames as UniqueArgumentNamesRule,
} from './rules/UniqueArgumentNames';
export { UniqueArgumentNames as UniqueArgumentNamesRule } from "./rules/UniqueArgumentNames";
// Spec Section: "Directives Are Unique Per Location"
export {
UniqueDirectivesPerLocation as UniqueDirectivesPerLocationRule,
} from './rules/UniqueDirectivesPerLocation';
export { UniqueDirectivesPerLocation as UniqueDirectivesPerLocationRule } from "./rules/UniqueDirectivesPerLocation";
// Spec Section: "Fragment Name Uniqueness"
export {
UniqueFragmentNames as UniqueFragmentNamesRule,
} from './rules/UniqueFragmentNames';
export { UniqueFragmentNames as UniqueFragmentNamesRule } from "./rules/UniqueFragmentNames";
// Spec Section: "Input Object Field Uniqueness"
export {
UniqueInputFieldNames as UniqueInputFieldNamesRule,
} from './rules/UniqueInputFieldNames';
export { UniqueInputFieldNames as UniqueInputFieldNamesRule } from "./rules/UniqueInputFieldNames";
// Spec Section: "Operation Name Uniqueness"
export {
UniqueOperationNames as UniqueOperationNamesRule,
} from './rules/UniqueOperationNames';
export { UniqueOperationNames as UniqueOperationNamesRule } from "./rules/UniqueOperationNames";
// Spec Section: "Variable Uniqueness"
export {
UniqueVariableNames as UniqueVariableNamesRule,
} from './rules/UniqueVariableNames';
export { UniqueVariableNames as UniqueVariableNamesRule } from "./rules/UniqueVariableNames";
// Spec Section: "Variables are Input Types"
export {
VariablesAreInputTypes as VariablesAreInputTypesRule,
} from './rules/VariablesAreInputTypes';
export { VariablesAreInputTypes as VariablesAreInputTypesRule } from "./rules/VariablesAreInputTypes";
// Spec Section: "All Variable Usages Are Allowed"
export {
VariablesInAllowedPosition as VariablesInAllowedPositionRule,
} from './rules/VariablesInAllowedPosition';
export { VariablesInAllowedPosition as VariablesInAllowedPositionRule } from "./rules/VariablesInAllowedPosition";
+1 -1
View File
@@ -1,4 +1,4 @@
import { ValidationContext } from '../index';
import { ValidationContext } from "../index";
/**
* Argument values of correct type
@@ -1,4 +1,4 @@
import { ValidationContext } from '../index';
import { ValidationContext } from "../index";
/**
* Variable default values of correct type
+1 -1
View File
@@ -1,4 +1,4 @@
import { ValidationContext } from '../index';
import { ValidationContext } from "../index";
/**
* Fields on correct type
@@ -1,4 +1,4 @@
import { ValidationContext } from '../index';
import { ValidationContext } from "../index";
/**
* Fragments on composite type
+1 -1
View File
@@ -1,4 +1,4 @@
import { ValidationContext } from '../index';
import { ValidationContext } from "../index";
/**
* Known argument names
+1 -1
View File
@@ -1,4 +1,4 @@
import { ValidationContext } from '../index';
import { ValidationContext } from "../index";
/**
* Known directives
+1 -1
View File
@@ -1,4 +1,4 @@
import { ValidationContext } from '../index';
import { ValidationContext } from "../index";
/**
* Known fragment names

Some files were not shown because too many files have changed in this diff Show More