This commit is contained in:
236
node_modules/graphql-tag/CHANGELOG.md
generated
vendored
Normal file
236
node_modules/graphql-tag/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
# Change log
|
||||
|
||||
### v2.12.6
|
||||
|
||||
* Update peer dependencies to allow `graphql` ^16.0.0. <br/>
|
||||
[@brainkim](https://github.com/brainkim) in [#530](https://github.com/apollographql/graphql-tag/pull/530)
|
||||
|
||||
### v2.12.5
|
||||
|
||||
* Also publish `src/` directory to npm, enabling source maps. <br/>
|
||||
[@maclockard](https://github.com/maclockard) in [#403](https://github.com/apollographql/graphql-tag/pull/403)
|
||||
|
||||
### v2.12.4 (2021-04-29)
|
||||
|
||||
* Allow fragments to be imported by name when using the webpack loader. <br/>
|
||||
[@dobesv](https://github.com/dobesv) in [#257](https://github.com/apollographql/graphql-tag/pull/257)
|
||||
|
||||
### v2.12.3
|
||||
|
||||
* Update `tslib` dependency to version 2.1.0. <br/>
|
||||
[@benjamn](http://github.com/benjamn) in [#381](https://github.com/apollographql/graphql-tag/pull/381)
|
||||
|
||||
### v2.12.2
|
||||
|
||||
* Avoid using `Object.assign` to attach extra properties to `gql`. <br/>
|
||||
[@benjamn](http://github.com/benjamn) in [#380](https://github.com/apollographql/graphql-tag/pull/380)
|
||||
|
||||
### v2.12.1
|
||||
|
||||
* To accommodate older versions of TypeScript, usage of the `import type ...` syntax (introduced by [#325](https://github.com/apollographql/graphql-tag/pull/325)) has been removed, fixing issue [#345](https://github.com/apollographql/graphql-tag/issues/345). <br/>
|
||||
[@benjamn](http://github.com/benjamn) in [#352](https://github.com/apollographql/graphql-tag/pull/352)
|
||||
|
||||
### v2.12.0
|
||||
|
||||
* The `graphql-tag` repository has been converted to TypeScript, adding type safety and enabling both ECMAScript and CommonJS module exports. While these changes are intended to be as backwards-compatible as possible, we decided to bump the minor version to reflect the significant refactoring. <br/>
|
||||
[@PowerKiKi](http://github.com/PowerKiKi) and [@benjamn](http://github.com/benjamn) in [#325](https://github.com/apollographql/graphql-tag/pull/325)
|
||||
|
||||
### v2.11.0 (2020-07-28)
|
||||
|
||||
* `package.json` `sideEffects` changes to clearly identify that `graphql-tag` doesn't have side effects. <br/>
|
||||
[@hwillson](http://github.com/hwillson) in [#313](https://github.com/apollographql/graphql-tag/pull/313)
|
||||
|
||||
### v2.10.4 (2020-07-08)
|
||||
|
||||
* Bump dev/peer deps to accommodate `graphql` 15. <br/>
|
||||
[@adriencohen](https://github.com/adriencohen) in [#299](https://github.com/apollographql/graphql-tag/pull/299)
|
||||
|
||||
### v2.10.3 (2020-02-05)
|
||||
|
||||
* Further adjustments to the TS `index.d.ts` declaration file. <br/>
|
||||
[@Guillaumez](https://github.com/Guillaumez) in [#289](https://github.com/apollographql/graphql-tag/pull/289)
|
||||
|
||||
### v2.10.2 (2020-02-04)
|
||||
|
||||
* Update/fix the existing TS `index.d.ts` declaration file. <br/>
|
||||
[@hwillson](https://github.com/hwillson) in [#285](https://github.com/apollographql/graphql-tag/pull/285)
|
||||
|
||||
### v2.10.1
|
||||
|
||||
* Fix failures in IE11 by avoiding unsupported (by IE11) constructor arguments to `Set` by [rocwang](https://github.com/rocwang) in [#190](https://github.com/apollographql/graphql-tag/pull/190)
|
||||
|
||||
### v2.10.0
|
||||
* Add support for `graphql@14` by [timsuchanek](https://github.com/timsuchanek) in [#210](https://github.com/apollographql/graphql-tag/pull/210), [#211](https://github.com/apollographql/graphql-tag/pull/211)
|
||||
|
||||
### v2.9.1
|
||||
* Fix IE11 support by using a regular for-loop by [vitorbal](https://github.com/vitorbal) in [#176](https://github.com/apollographql/graphql-tag/pull/176)
|
||||
|
||||
### v2.9.0
|
||||
* Remove duplicate exports in named exports by [wacii](https://github.com/wacii) in [#170](https://github.com/apollographql/graphql-tag/pull/170)
|
||||
* Add `experimentalFragmentVariables` compatibility by [lucasconstantino](https://github.com/lucasconstantino) in [#167](https://github.com/apollographql/graphql-tag/pull/167/)
|
||||
|
||||
### v2.8.0
|
||||
|
||||
* Update `graphql` to ^0.13, support testing all compatible versions [jnwng](https://github.com/jnwng) in
|
||||
[PR #156](https://github.com/apollographql/graphql-tag/pull/156)
|
||||
* Export single queries as both default and named [stonexer](https://github.com/stonexer) in
|
||||
[PR #154](https://github.com/apollographql/graphql-tag/pull/154)
|
||||
|
||||
### v2.7.{0,1,2,3}
|
||||
|
||||
* Merge and then revert [PR #141](https://github.com/apollographql/graphql-tag/pull/141) due to errors being thrown
|
||||
|
||||
### v2.6.1
|
||||
|
||||
* Accept `graphql@^0.12.0` as peerDependency [jnwng](https://github.com/jnwng)
|
||||
addressing [#134](https://github.com/apollographql/graphql-tag/issues/134)
|
||||
|
||||
### v2.6.0
|
||||
|
||||
* Support multiple query definitions when using Webpack loader [jfaust](https://github.com/jfaust) in
|
||||
[PR #122](https://github.com/apollographql/graphql-tag/pull/122)
|
||||
|
||||
### v2.5.0
|
||||
|
||||
* Update graphql to ^0.11.0, add graphql@^0.11.0 to peerDependencies [pleunv](https://github.com/pleunv) in
|
||||
[PR #124](https://github.com/apollographql/graphql-tag/pull/124)
|
||||
|
||||
### v2.4.{1,2}
|
||||
|
||||
* Temporarily reverting [PR #99](https://github.com/apollographql/graphql-tag/pull/99) to investigate issues with
|
||||
bundling
|
||||
|
||||
### v2.4.0
|
||||
|
||||
* Add support for descriptors [jamiter](https://github.com/jamiter) in
|
||||
[PR #99](https://github.com/apollographql/graphql-tag/pull/99)
|
||||
|
||||
### v2.3.0
|
||||
|
||||
* Add flow support [michalkvasnicak](https://github.com/michalkvasnicak) in
|
||||
[PR #98](https://github.com/apollographql/graphql-tag/pull/98)
|
||||
|
||||
### v2.2.2
|
||||
|
||||
* Make parsing line endings kind agnostic [vlasenko](https://github.com/vlasenko) in
|
||||
[PR #95](https://github.com/apollographql/graphql-tag/pull/95)
|
||||
|
||||
### v2.2.1
|
||||
|
||||
* Fix #61: split('/n') does not work on Windows [dnalborczyk](https://github.com/dnalborczyk) in
|
||||
[PR #89](https://github.com/apollographql/graphql-tag/pull/89)
|
||||
|
||||
### v2.2.0
|
||||
|
||||
* Bumping `graphql` peer dependency to ^0.10.0 [dotansimha](https://github.com/dotansimha) in
|
||||
[PR #85](https://github.com/apollographql/graphql-tag/pull/85)
|
||||
|
||||
### v2.1.0
|
||||
|
||||
* Add support for calling `gql` as a function [matthewerwin](https://github.com/matthewerwin) in
|
||||
[PR #66](https://github.com/apollographql/graphql-tag/pull/66)
|
||||
* Including yarn.lock file [PowerKiKi](https://github.com/PowerKiKi) in
|
||||
[PR #72](https://github.com/apollographql/graphql-tag/pull/72)
|
||||
* Ignore duplicate fragments when using the Webpack loader [czert](https://github.com/czert) in
|
||||
[PR #52](https://github.com/apollographql/graphql-tag/pull/52)
|
||||
* Fixing `graphql-tag/loader` by properly stringifying GraphQL Source [jnwng](https://github.com/jnwng) in
|
||||
[PR #65](https://github.com/apollographql/graphql-tag/pull/65)
|
||||
|
||||
### v2.0.0
|
||||
|
||||
Restore dependence on `graphql` module [abhiaiyer91](https://github.com/abhiaiyer91) in
|
||||
[PR #46](https://github.com/apollographql/graphql-tag/pull/46) addressing
|
||||
[#6](https://github.com/apollographql/graphql-tag/issues/6)
|
||||
|
||||
* Added `graphql` as a
|
||||
[peerDependency](https://github.com/apollographql/graphql-tag/commit/ac061dd16440e75c166c85b4bff5ba06c79c9356)
|
||||
|
||||
### v1.3.2
|
||||
|
||||
* Add typescript definitions for the bundledPrinter [PR #63](https://github.com/apollographql/graphql-tag/pull/63)
|
||||
|
||||
### v1.3.1
|
||||
|
||||
* Making sure not to log deprecation warnings for internal use of deprecated module [jnwng](https://github.com/jnwng)
|
||||
addressing [#54](https://github.com/apollographql/graphql-tag/issues/54#issuecomment-283301475)
|
||||
|
||||
### v1.3.0
|
||||
|
||||
* Bump bundled `graphql` packages to v0.9.1 [jnwng](https://github.com/jnwng) in
|
||||
[PR #55](https://github.com/apollographql/graphql-tag/pull/55).
|
||||
* Deprecate the `graphql/language/parser` and `graphql/language/printer` exports [jnwng](https://github.com/jnwng) in
|
||||
[PR #55](https://github.com/apollographql/graphql-tag/pull/55)
|
||||
|
||||
### v1.2.4
|
||||
|
||||
Restore Node < 6 compatibility. [DragosRotaru](https://github.com/DragosRotaru) in
|
||||
[PR #41](https://github.com/apollographql/graphql-tag/pull/41) addressing
|
||||
[#39](https://github.com/apollographql/graphql-tag/issues/39)
|
||||
|
||||
### v1.2.1
|
||||
|
||||
Fixed an issue with fragment imports. [PR #35](https://github.com/apollostack/graphql-tag/issues/35).
|
||||
|
||||
### v1.2.0
|
||||
|
||||
Added ability to import other GraphQL documents with fragments using `#import` comments.
|
||||
[PR #33](https://github.com/apollostack/graphql-tag/pull/33)
|
||||
|
||||
### v1.1.2
|
||||
|
||||
Fix issue with interpolating undefined values [Issue #19](https://github.com/apollostack/graphql-tag/issues/19)
|
||||
|
||||
### v1.1.1
|
||||
|
||||
Added typescript definitions for the below.
|
||||
|
||||
### v1.1.0
|
||||
|
||||
We now emit warnings if you use the same name for two different fragments.
|
||||
|
||||
You can disable this with:
|
||||
|
||||
```js
|
||||
import { disableFragmentWarnings } from 'graphql-tag';
|
||||
|
||||
disableFragmentWarnings();
|
||||
```
|
||||
|
||||
### v1.0.0
|
||||
|
||||
Releasing 0.1.17 as 1.0.0 in order to be explicit about Semantic Versioning.
|
||||
|
||||
### v0.1.17
|
||||
|
||||
* Allow embedding fragments inside document strings, as in
|
||||
|
||||
```js
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
const fragment = gql`
|
||||
fragment Foo on Bar {
|
||||
field
|
||||
}
|
||||
`;
|
||||
|
||||
const query = gql`
|
||||
{
|
||||
...Foo
|
||||
}
|
||||
${Foo}
|
||||
`;
|
||||
```
|
||||
|
||||
See also http://dev.apollodata.com/react/fragments.html
|
||||
|
||||
### v0.1.16
|
||||
|
||||
* Add caching to Webpack loader. [PR #16](https://github.com/apollostack/graphql-tag/pull/16)
|
||||
|
||||
### v0.1.15
|
||||
|
||||
* Add Webpack loader to `graphql-tag/loader`.
|
||||
|
||||
### v0.1.14
|
||||
|
||||
Changes were not tracked before this version.
|
||||
21
node_modules/graphql-tag/LICENSE
generated
vendored
Normal file
21
node_modules/graphql-tag/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2021 Apollo Graph, Inc. (Formerly Meteor Development Group, Inc.)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
251
node_modules/graphql-tag/README.md
generated
vendored
Normal file
251
node_modules/graphql-tag/README.md
generated
vendored
Normal file
@@ -0,0 +1,251 @@
|
||||
# graphql-tag
|
||||
[](https://badge.fury.io/js/graphql-tag)
|
||||
[](https://travis-ci.org/apollographql/graphql-tag)
|
||||
[](http://www.apollodata.com/#slack)
|
||||
|
||||
Helpful utilities for parsing GraphQL queries. Includes:
|
||||
|
||||
- `gql` A JavaScript template literal tag that parses GraphQL query strings into the standard GraphQL AST.
|
||||
- `/loader` A webpack loader to preprocess queries
|
||||
|
||||
`graphql-tag` uses [the reference `graphql` library](https://github.com/graphql/graphql-js) under the hood as a peer dependency, so in addition to installing this module, you'll also have to install `graphql`.
|
||||
|
||||
### gql
|
||||
|
||||
The `gql` template literal tag can be used to concisely write a GraphQL query that is parsed into a standard GraphQL AST. It is the recommended method for passing queries to [Apollo Client](https://github.com/apollographql/apollo-client). While it is primarily built for Apollo Client, it generates a generic GraphQL AST which can be used by any GraphQL client.
|
||||
|
||||
```js
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
const query = gql`
|
||||
{
|
||||
user(id: 5) {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
}
|
||||
`
|
||||
```
|
||||
|
||||
The above query now contains the following syntax tree.
|
||||
|
||||
```js
|
||||
{
|
||||
"kind": "Document",
|
||||
"definitions": [
|
||||
{
|
||||
"kind": "OperationDefinition",
|
||||
"operation": "query",
|
||||
"name": null,
|
||||
"variableDefinitions": null,
|
||||
"directives": [],
|
||||
"selectionSet": {
|
||||
"kind": "SelectionSet",
|
||||
"selections": [
|
||||
{
|
||||
"kind": "Field",
|
||||
"alias": null,
|
||||
"name": {
|
||||
"kind": "Name",
|
||||
"value": "user",
|
||||
...
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### Fragments
|
||||
|
||||
The `gql` tag can also be used to define reusable fragments, which can easily be added to queries or other fragments.
|
||||
|
||||
```js
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
const userFragment = gql`
|
||||
fragment User_user on User {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
`
|
||||
```
|
||||
|
||||
The above `userFragment` document can be embedded in another document using a template literal placeholder.
|
||||
|
||||
```js
|
||||
const query = gql`
|
||||
{
|
||||
user(id: 5) {
|
||||
...User_user
|
||||
}
|
||||
}
|
||||
${userFragment}
|
||||
`
|
||||
```
|
||||
|
||||
**Note:** _While it may seem redundant to have to both embed the `userFragment` variable in the template literal **AND** spread the `...User_user` fragment in the graphQL selection set, this requirement makes static analysis by tools such as `eslint-plugin-graphql` possible._
|
||||
|
||||
#### Why use this?
|
||||
|
||||
GraphQL strings are the right way to write queries in your code, because they can be statically analyzed using tools like [eslint-plugin-graphql](https://github.com/apollographql/eslint-plugin-graphql). However, strings are inconvenient to manipulate, if you are trying to do things like add extra fields, merge multiple queries together, or other interesting stuff.
|
||||
|
||||
That's where this package comes in - it lets you write your queries with [ES2015 template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) and compile them into an AST with the `gql` tag.
|
||||
|
||||
#### Caching parse results
|
||||
|
||||
This package only has one feature - it caches previous parse results in a simple dictionary. This means that if you call the tag on the same query multiple times, it doesn't waste time parsing it again. It also means you can use `===` to compare queries to check if they are identical.
|
||||
|
||||
|
||||
### Importing graphQL files
|
||||
|
||||
_To add support for importing `.graphql`/`.gql` files, see [Webpack loading and preprocessing](#webpack-loading-and-preprocessing) below._
|
||||
|
||||
Given a file `MyQuery.graphql`
|
||||
|
||||
```graphql
|
||||
query MyQuery {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
If you have configured [the webpack graphql-tag/loader](#webpack-loading-and-preprocessing), you can import modules containing graphQL queries. The imported value will be the pre-built AST.
|
||||
|
||||
```js
|
||||
import MyQuery from 'query.graphql'
|
||||
```
|
||||
|
||||
#### Importing queries by name
|
||||
|
||||
You can also import query and fragment documents by name.
|
||||
|
||||
```graphql
|
||||
query MyQuery1 {
|
||||
...
|
||||
}
|
||||
|
||||
query MyQuery2 {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
And in your JavaScript:
|
||||
|
||||
```javascript
|
||||
import { MyQuery1, MyQuery2 } from 'query.graphql'
|
||||
```
|
||||
|
||||
### Preprocessing queries and fragments
|
||||
|
||||
Preprocessing GraphQL queries and fragments into ASTs at build time can greatly improve load times.
|
||||
|
||||
#### Babel preprocessing
|
||||
|
||||
GraphQL queries can be compiled at build time using [babel-plugin-graphql-tag](https://github.com/gajus/babel-plugin-graphql-tag). Pre-compiling queries decreases script initialization time and reduces bundle sizes by potentially removing the need for `graphql-tag` at runtime.
|
||||
|
||||
#### TypeScript preprocessing
|
||||
|
||||
Try this custom transformer to pre-compile your GraphQL queries in TypeScript: [ts-transform-graphql-tag](https://github.com/firede/ts-transform-graphql-tag).
|
||||
|
||||
#### React Native and Next.js preprocessing
|
||||
|
||||
Preprocessing queries via the webpack loader is not always possible. [babel-plugin-import-graphql](https://www.npmjs.com/package/babel-plugin-import-graphql) supports importing graphql files directly into your JavaScript by preprocessing GraphQL queries into ASTs at compile-time.
|
||||
|
||||
E.g.:
|
||||
|
||||
```javascript
|
||||
import myImportedQuery from './productsQuery.graphql'
|
||||
|
||||
class ProductsPage extends React.Component {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
#### Webpack loading and preprocessing
|
||||
|
||||
Using the included `graphql-tag/loader` it is possible to maintain query logic that is separate from the rest of your application logic. With the loader configured, imported graphQL files will be converted to AST during the webpack build process.
|
||||
|
||||
_**Example webpack configuration**_
|
||||
|
||||
```js
|
||||
{
|
||||
...
|
||||
loaders: [
|
||||
{
|
||||
test: /\.(graphql|gql)$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'graphql-tag/loader'
|
||||
}
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
#### Create React App
|
||||
|
||||
Preprocessing GraphQL imports is supported in **create-react-app** >= v2 using [evenchange4/graphql.macro](https://github.com/evenchange4/graphql.macro).
|
||||
|
||||
For **create-react-app** < v2, you'll either need to eject or use [react-app-rewire-inline-import-graphql-ast](https://www.npmjs.com/package/react-app-rewire-inline-import-graphql-ast).
|
||||
|
||||
#### Testing
|
||||
|
||||
Testing environments that don't support Webpack require additional configuration. For [Jest](https://facebook.github.io/jest/) use [jest-transform-graphql](https://github.com/remind101/jest-transform-graphql).
|
||||
|
||||
#### Support for fragments
|
||||
|
||||
With the webpack loader, you can import fragments by name:
|
||||
|
||||
In a file called `query.gql`:
|
||||
|
||||
```graphql
|
||||
fragment MyFragment1 on MyType1 {
|
||||
...
|
||||
}
|
||||
|
||||
fragment MyFragment2 on MyType2 {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
And in your JavaScript:
|
||||
|
||||
```javascript
|
||||
import { MyFragment1, MyFragment2 } from 'query.gql'
|
||||
```
|
||||
|
||||
Note: If your fragment references other fragments, the resulting document will
|
||||
have multiple fragments in it. In this case you must still specify the fragment name when using the fragment. For example, with `@apollo/client` you would specify the `fragmentName` option when using the fragment for cache operations.
|
||||
|
||||
### Warnings
|
||||
|
||||
This package will emit a warning if you have multiple fragments of the same name. You can disable this with:
|
||||
|
||||
```js
|
||||
import { disableFragmentWarnings } from 'graphql-tag';
|
||||
|
||||
disableFragmentWarnings()
|
||||
```
|
||||
|
||||
### Experimental Fragment Variables
|
||||
|
||||
This package exports an `experimentalFragmentVariables` flag that allows you to use experimental support for [parameterized fragments](https://github.com/facebook/graphql/issues/204).
|
||||
|
||||
You can enable / disable this with:
|
||||
|
||||
```js
|
||||
import { enableExperimentalFragmentVariables, disableExperimentalFragmentVariables } from 'graphql-tag';
|
||||
```
|
||||
|
||||
Enabling this feature allows you declare documents of the form
|
||||
|
||||
```graphql
|
||||
fragment SomeFragment ($arg: String!) on SomeType {
|
||||
someField
|
||||
}
|
||||
```
|
||||
|
||||
### Resources
|
||||
|
||||
You can easily generate and explore a GraphQL AST on [astexplorer.net](https://astexplorer.net/#/drYr8X1rnP/1).
|
||||
136
node_modules/graphql-tag/lib/graphql-tag.umd.js
generated
vendored
Normal file
136
node_modules/graphql-tag/lib/graphql-tag.umd.js
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('graphql')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', 'tslib', 'graphql'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['graphql-tag'] = {}, global.tslib, global.graphql));
|
||||
}(this, (function (exports, tslib, graphql) { 'use strict';
|
||||
|
||||
var docCache = new Map();
|
||||
var fragmentSourceMap = new Map();
|
||||
var printFragmentWarnings = true;
|
||||
var experimentalFragmentVariables = false;
|
||||
function normalize(string) {
|
||||
return string.replace(/[\s,]+/g, ' ').trim();
|
||||
}
|
||||
function cacheKeyFromLoc(loc) {
|
||||
return normalize(loc.source.body.substring(loc.start, loc.end));
|
||||
}
|
||||
function processFragments(ast) {
|
||||
var seenKeys = new Set();
|
||||
var definitions = [];
|
||||
ast.definitions.forEach(function (fragmentDefinition) {
|
||||
if (fragmentDefinition.kind === 'FragmentDefinition') {
|
||||
var fragmentName = fragmentDefinition.name.value;
|
||||
var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc);
|
||||
var sourceKeySet = fragmentSourceMap.get(fragmentName);
|
||||
if (sourceKeySet && !sourceKeySet.has(sourceKey)) {
|
||||
if (printFragmentWarnings) {
|
||||
console.warn("Warning: fragment with name " + fragmentName + " already exists.\n"
|
||||
+ "graphql-tag enforces all fragment names across your application to be unique; read more about\n"
|
||||
+ "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names");
|
||||
}
|
||||
}
|
||||
else if (!sourceKeySet) {
|
||||
fragmentSourceMap.set(fragmentName, sourceKeySet = new Set);
|
||||
}
|
||||
sourceKeySet.add(sourceKey);
|
||||
if (!seenKeys.has(sourceKey)) {
|
||||
seenKeys.add(sourceKey);
|
||||
definitions.push(fragmentDefinition);
|
||||
}
|
||||
}
|
||||
else {
|
||||
definitions.push(fragmentDefinition);
|
||||
}
|
||||
});
|
||||
return tslib.__assign(tslib.__assign({}, ast), { definitions: definitions });
|
||||
}
|
||||
function stripLoc(doc) {
|
||||
var workSet = new Set(doc.definitions);
|
||||
workSet.forEach(function (node) {
|
||||
if (node.loc)
|
||||
delete node.loc;
|
||||
Object.keys(node).forEach(function (key) {
|
||||
var value = node[key];
|
||||
if (value && typeof value === 'object') {
|
||||
workSet.add(value);
|
||||
}
|
||||
});
|
||||
});
|
||||
var loc = doc.loc;
|
||||
if (loc) {
|
||||
delete loc.startToken;
|
||||
delete loc.endToken;
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
function parseDocument(source) {
|
||||
var cacheKey = normalize(source);
|
||||
if (!docCache.has(cacheKey)) {
|
||||
var parsed = graphql.parse(source, {
|
||||
experimentalFragmentVariables: experimentalFragmentVariables,
|
||||
allowLegacyFragmentVariables: experimentalFragmentVariables
|
||||
});
|
||||
if (!parsed || parsed.kind !== 'Document') {
|
||||
throw new Error('Not a valid GraphQL document.');
|
||||
}
|
||||
docCache.set(cacheKey, stripLoc(processFragments(parsed)));
|
||||
}
|
||||
return docCache.get(cacheKey);
|
||||
}
|
||||
function gql(literals) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (typeof literals === 'string') {
|
||||
literals = [literals];
|
||||
}
|
||||
var result = literals[0];
|
||||
args.forEach(function (arg, i) {
|
||||
if (arg && arg.kind === 'Document') {
|
||||
result += arg.loc.source.body;
|
||||
}
|
||||
else {
|
||||
result += arg;
|
||||
}
|
||||
result += literals[i + 1];
|
||||
});
|
||||
return parseDocument(result);
|
||||
}
|
||||
function resetCaches() {
|
||||
docCache.clear();
|
||||
fragmentSourceMap.clear();
|
||||
}
|
||||
function disableFragmentWarnings() {
|
||||
printFragmentWarnings = false;
|
||||
}
|
||||
function enableExperimentalFragmentVariables() {
|
||||
experimentalFragmentVariables = true;
|
||||
}
|
||||
function disableExperimentalFragmentVariables() {
|
||||
experimentalFragmentVariables = false;
|
||||
}
|
||||
var extras = {
|
||||
gql: gql,
|
||||
resetCaches: resetCaches,
|
||||
disableFragmentWarnings: disableFragmentWarnings,
|
||||
enableExperimentalFragmentVariables: enableExperimentalFragmentVariables,
|
||||
disableExperimentalFragmentVariables: disableExperimentalFragmentVariables
|
||||
};
|
||||
(function (gql_1) {
|
||||
gql_1.gql = extras.gql, gql_1.resetCaches = extras.resetCaches, gql_1.disableFragmentWarnings = extras.disableFragmentWarnings, gql_1.enableExperimentalFragmentVariables = extras.enableExperimentalFragmentVariables, gql_1.disableExperimentalFragmentVariables = extras.disableExperimentalFragmentVariables;
|
||||
})(gql || (gql = {}));
|
||||
gql["default"] = gql;
|
||||
var gql$1 = gql;
|
||||
|
||||
exports.default = gql$1;
|
||||
exports.disableExperimentalFragmentVariables = disableExperimentalFragmentVariables;
|
||||
exports.disableFragmentWarnings = disableFragmentWarnings;
|
||||
exports.enableExperimentalFragmentVariables = enableExperimentalFragmentVariables;
|
||||
exports.gql = gql;
|
||||
exports.resetCaches = resetCaches;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
//# sourceMappingURL=graphql-tag.umd.js.map
|
||||
7
node_modules/graphql-tag/lib/graphql-tag.umd.js.flow
generated
vendored
Normal file
7
node_modules/graphql-tag/lib/graphql-tag.umd.js.flow
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// @flow
|
||||
|
||||
import type { DocumentNode } from 'graphql';
|
||||
|
||||
declare export default function gql(literals: any, ...placeholders: any[]): DocumentNode;
|
||||
declare export function resetCaches(): void;
|
||||
declare export function disableFragmentWarnings(): void;
|
||||
1
node_modules/graphql-tag/lib/graphql-tag.umd.js.map
generated
vendored
Normal file
1
node_modules/graphql-tag/lib/graphql-tag.umd.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
15
node_modules/graphql-tag/lib/index.d.ts
generated
vendored
Normal file
15
node_modules/graphql-tag/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { DocumentNode } from 'graphql/language/ast';
|
||||
export declare function gql(literals: string | readonly string[], ...args: any[]): DocumentNode;
|
||||
export declare namespace gql {
|
||||
var _a: typeof import(".").gql;
|
||||
export { _a as default };
|
||||
}
|
||||
export declare function resetCaches(): void;
|
||||
export declare function disableFragmentWarnings(): void;
|
||||
export declare function enableExperimentalFragmentVariables(): void;
|
||||
export declare function disableExperimentalFragmentVariables(): void;
|
||||
export declare namespace gql {
|
||||
const gql: typeof import(".").gql, resetCaches: typeof import(".").resetCaches, disableFragmentWarnings: typeof import(".").disableFragmentWarnings, enableExperimentalFragmentVariables: typeof import(".").enableExperimentalFragmentVariables, disableExperimentalFragmentVariables: typeof import(".").disableExperimentalFragmentVariables;
|
||||
}
|
||||
export default gql;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/graphql-tag/lib/index.d.ts.map
generated
vendored
Normal file
1
node_modules/graphql-tag/lib/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EAGb,MAAM,sBAAsB,CAAC;AA2G9B,wBAAgB,GAAG,CACjB,QAAQ,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EACpC,GAAG,IAAI,EAAE,GAAG,EAAE,gBAmBf;yBArBe,GAAG;;;;AAuBnB,wBAAgB,WAAW,SAG1B;AAED,wBAAgB,uBAAuB,SAEtC;AAED,wBAAgB,mCAAmC,SAElD;AAED,wBAAgB,oCAAoC,SAEnD;AAUD,yBAAiB,GAAG,CAAC;IACZ,MACL,GAAG,0BACH,WAAW,kCACX,uBAAuB,8CACvB,mCAAmC,0DACnC,oCAAoC,yDAC5B,CAAC;CACZ;AAID,eAAe,GAAG,CAAC"}
|
||||
121
node_modules/graphql-tag/lib/index.js
generated
vendored
Normal file
121
node_modules/graphql-tag/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
import { __assign } from "tslib";
|
||||
import { parse } from 'graphql';
|
||||
var docCache = new Map();
|
||||
var fragmentSourceMap = new Map();
|
||||
var printFragmentWarnings = true;
|
||||
var experimentalFragmentVariables = false;
|
||||
function normalize(string) {
|
||||
return string.replace(/[\s,]+/g, ' ').trim();
|
||||
}
|
||||
function cacheKeyFromLoc(loc) {
|
||||
return normalize(loc.source.body.substring(loc.start, loc.end));
|
||||
}
|
||||
function processFragments(ast) {
|
||||
var seenKeys = new Set();
|
||||
var definitions = [];
|
||||
ast.definitions.forEach(function (fragmentDefinition) {
|
||||
if (fragmentDefinition.kind === 'FragmentDefinition') {
|
||||
var fragmentName = fragmentDefinition.name.value;
|
||||
var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc);
|
||||
var sourceKeySet = fragmentSourceMap.get(fragmentName);
|
||||
if (sourceKeySet && !sourceKeySet.has(sourceKey)) {
|
||||
if (printFragmentWarnings) {
|
||||
console.warn("Warning: fragment with name " + fragmentName + " already exists.\n"
|
||||
+ "graphql-tag enforces all fragment names across your application to be unique; read more about\n"
|
||||
+ "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names");
|
||||
}
|
||||
}
|
||||
else if (!sourceKeySet) {
|
||||
fragmentSourceMap.set(fragmentName, sourceKeySet = new Set);
|
||||
}
|
||||
sourceKeySet.add(sourceKey);
|
||||
if (!seenKeys.has(sourceKey)) {
|
||||
seenKeys.add(sourceKey);
|
||||
definitions.push(fragmentDefinition);
|
||||
}
|
||||
}
|
||||
else {
|
||||
definitions.push(fragmentDefinition);
|
||||
}
|
||||
});
|
||||
return __assign(__assign({}, ast), { definitions: definitions });
|
||||
}
|
||||
function stripLoc(doc) {
|
||||
var workSet = new Set(doc.definitions);
|
||||
workSet.forEach(function (node) {
|
||||
if (node.loc)
|
||||
delete node.loc;
|
||||
Object.keys(node).forEach(function (key) {
|
||||
var value = node[key];
|
||||
if (value && typeof value === 'object') {
|
||||
workSet.add(value);
|
||||
}
|
||||
});
|
||||
});
|
||||
var loc = doc.loc;
|
||||
if (loc) {
|
||||
delete loc.startToken;
|
||||
delete loc.endToken;
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
function parseDocument(source) {
|
||||
var cacheKey = normalize(source);
|
||||
if (!docCache.has(cacheKey)) {
|
||||
var parsed = parse(source, {
|
||||
experimentalFragmentVariables: experimentalFragmentVariables,
|
||||
allowLegacyFragmentVariables: experimentalFragmentVariables
|
||||
});
|
||||
if (!parsed || parsed.kind !== 'Document') {
|
||||
throw new Error('Not a valid GraphQL document.');
|
||||
}
|
||||
docCache.set(cacheKey, stripLoc(processFragments(parsed)));
|
||||
}
|
||||
return docCache.get(cacheKey);
|
||||
}
|
||||
export function gql(literals) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (typeof literals === 'string') {
|
||||
literals = [literals];
|
||||
}
|
||||
var result = literals[0];
|
||||
args.forEach(function (arg, i) {
|
||||
if (arg && arg.kind === 'Document') {
|
||||
result += arg.loc.source.body;
|
||||
}
|
||||
else {
|
||||
result += arg;
|
||||
}
|
||||
result += literals[i + 1];
|
||||
});
|
||||
return parseDocument(result);
|
||||
}
|
||||
export function resetCaches() {
|
||||
docCache.clear();
|
||||
fragmentSourceMap.clear();
|
||||
}
|
||||
export function disableFragmentWarnings() {
|
||||
printFragmentWarnings = false;
|
||||
}
|
||||
export function enableExperimentalFragmentVariables() {
|
||||
experimentalFragmentVariables = true;
|
||||
}
|
||||
export function disableExperimentalFragmentVariables() {
|
||||
experimentalFragmentVariables = false;
|
||||
}
|
||||
var extras = {
|
||||
gql: gql,
|
||||
resetCaches: resetCaches,
|
||||
disableFragmentWarnings: disableFragmentWarnings,
|
||||
enableExperimentalFragmentVariables: enableExperimentalFragmentVariables,
|
||||
disableExperimentalFragmentVariables: disableExperimentalFragmentVariables
|
||||
};
|
||||
(function (gql_1) {
|
||||
gql_1.gql = extras.gql, gql_1.resetCaches = extras.resetCaches, gql_1.disableFragmentWarnings = extras.disableFragmentWarnings, gql_1.enableExperimentalFragmentVariables = extras.enableExperimentalFragmentVariables, gql_1.disableExperimentalFragmentVariables = extras.disableExperimentalFragmentVariables;
|
||||
})(gql || (gql = {}));
|
||||
gql["default"] = gql;
|
||||
export default gql;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/graphql-tag/lib/index.js.map
generated
vendored
Normal file
1
node_modules/graphql-tag/lib/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAShC,IAAM,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC;AAGjD,IAAM,iBAAiB,GAAG,IAAI,GAAG,EAAuB,CAAC;AAEzD,IAAI,qBAAqB,GAAG,IAAI,CAAC;AACjC,IAAI,6BAA6B,GAAG,KAAK,CAAC;AAI1C,SAAS,SAAS,CAAC,MAAc;IAC/B,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC/C,CAAC;AAED,SAAS,eAAe,CAAC,GAAa;IACpC,OAAO,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAClE,CAAC;AAKD,SAAS,gBAAgB,CAAC,GAAiB;IACzC,IAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,IAAM,WAAW,GAAqB,EAAE,CAAC;IAEzC,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,UAAA,kBAAkB;QACxC,IAAI,kBAAkB,CAAC,IAAI,KAAK,oBAAoB,EAAE;YACpD,IAAI,YAAY,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC;YACjD,IAAI,SAAS,GAAG,eAAe,CAAC,kBAAkB,CAAC,GAAI,CAAC,CAAC;YAGzD,IAAI,YAAY,GAAG,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAE,CAAC;YACxD,IAAI,YAAY,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;gBAGhD,IAAI,qBAAqB,EAAE;oBACzB,OAAO,CAAC,IAAI,CAAC,8BAA8B,GAAG,YAAY,GAAG,oBAAoB;0BAC7E,iGAAiG;0BACjG,8EAA8E,CAAC,CAAC;iBACrF;aACF;iBAAM,IAAI,CAAC,YAAY,EAAE;gBACxB,iBAAiB,CAAC,GAAG,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC;aAC7D;YAED,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAE5B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;gBAC5B,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBACxB,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;aACtC;SACF;aAAM;YACL,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;SACtC;IACH,CAAC,CAAC,CAAC;IAEH,6BACK,GAAG,KACN,WAAW,aAAA,IACX;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,GAAiB;IACjC,IAAM,OAAO,GAAG,IAAI,GAAG,CAAsB,GAAG,CAAC,WAAW,CAAC,CAAC;IAE9D,OAAO,CAAC,OAAO,CAAC,UAAA,IAAI;QAClB,IAAI,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC,GAAG,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;YAC3B,IAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YACxB,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBACtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAM,GAAG,GAAG,GAAG,CAAC,GAA0B,CAAC;IAC3C,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC,UAAU,CAAC;QACtB,OAAO,GAAG,CAAC,QAAQ,CAAC;KACrB;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,aAAa,CAAC,MAAc;IACnC,IAAI,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QAC3B,IAAM,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE;YAC3B,6BAA6B,+BAAA;YAC7B,4BAA4B,EAAE,6BAA6B;SACrD,CAAC,CAAC;QACV,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE;YACzC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;SAClD;QACD,QAAQ,CAAC,GAAG,CACV,QAAQ,EAGR,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CACnC,CAAC;KACH;IACD,OAAO,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC;AACjC,CAAC;AAGD,MAAM,UAAU,GAAG,CACjB,QAAoC;IACpC,cAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,6BAAc;;IAGd,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;QAChC,QAAQ,GAAG,CAAC,QAAQ,CAAC,CAAC;KACvB;IAED,IAAI,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEzB,IAAI,CAAC,OAAO,CAAC,UAAC,GAAG,EAAE,CAAC;QAClB,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,EAAE;YAClC,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;SAC/B;aAAM;YACL,MAAM,IAAI,GAAG,CAAC;SACf;QACD,MAAM,IAAI,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,QAAQ,CAAC,KAAK,EAAE,CAAC;IACjB,iBAAiB,CAAC,KAAK,EAAE,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,qBAAqB,GAAG,KAAK,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,mCAAmC;IACjD,6BAA6B,GAAG,IAAI,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,oCAAoC;IAClD,6BAA6B,GAAG,KAAK,CAAC;AACxC,CAAC;AAED,IAAM,MAAM,GAAG;IACb,GAAG,KAAA;IACH,WAAW,aAAA;IACX,uBAAuB,yBAAA;IACvB,mCAAmC,qCAAA;IACnC,oCAAoC,sCAAA;CACrC,CAAC;AAEF,WAAiB,KAAG;IAEhB,SAAG,GAKD,MAAM,IALL,EACH,iBAAW,GAIT,MAAM,YAJG,EACX,6BAAuB,GAGrB,MAAM,wBAHe,EACvB,yCAAmC,GAEjC,MAAM,oCAF2B,EACnC,0CAAoC,GAClC,MAAM,qCAD4B,CAC3B;AACb,CAAC,EARgB,GAAG,KAAH,GAAG,QAQnB;AAED,GAAG,CAAC,SAAO,CAAA,GAAG,GAAG,CAAC;AAElB,eAAe,GAAG,CAAC"}
|
||||
409
node_modules/graphql-tag/lib/tests.cjs.js
generated
vendored
Normal file
409
node_modules/graphql-tag/lib/tests.cjs.js
generated
vendored
Normal file
@@ -0,0 +1,409 @@
|
||||
'use strict';
|
||||
|
||||
var tslib = require('tslib');
|
||||
require('source-map-support/register');
|
||||
var chai = require('chai');
|
||||
var graphql = require('graphql');
|
||||
|
||||
var docCache = new Map();
|
||||
var fragmentSourceMap = new Map();
|
||||
var printFragmentWarnings = true;
|
||||
var experimentalFragmentVariables = false;
|
||||
function normalize(string) {
|
||||
return string.replace(/[\s,]+/g, ' ').trim();
|
||||
}
|
||||
function cacheKeyFromLoc(loc) {
|
||||
return normalize(loc.source.body.substring(loc.start, loc.end));
|
||||
}
|
||||
function processFragments(ast) {
|
||||
var seenKeys = new Set();
|
||||
var definitions = [];
|
||||
ast.definitions.forEach(function (fragmentDefinition) {
|
||||
if (fragmentDefinition.kind === 'FragmentDefinition') {
|
||||
var fragmentName = fragmentDefinition.name.value;
|
||||
var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc);
|
||||
var sourceKeySet = fragmentSourceMap.get(fragmentName);
|
||||
if (sourceKeySet && !sourceKeySet.has(sourceKey)) {
|
||||
if (printFragmentWarnings) {
|
||||
console.warn("Warning: fragment with name " + fragmentName + " already exists.\n"
|
||||
+ "graphql-tag enforces all fragment names across your application to be unique; read more about\n"
|
||||
+ "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names");
|
||||
}
|
||||
}
|
||||
else if (!sourceKeySet) {
|
||||
fragmentSourceMap.set(fragmentName, sourceKeySet = new Set);
|
||||
}
|
||||
sourceKeySet.add(sourceKey);
|
||||
if (!seenKeys.has(sourceKey)) {
|
||||
seenKeys.add(sourceKey);
|
||||
definitions.push(fragmentDefinition);
|
||||
}
|
||||
}
|
||||
else {
|
||||
definitions.push(fragmentDefinition);
|
||||
}
|
||||
});
|
||||
return tslib.__assign(tslib.__assign({}, ast), { definitions: definitions });
|
||||
}
|
||||
function stripLoc(doc) {
|
||||
var workSet = new Set(doc.definitions);
|
||||
workSet.forEach(function (node) {
|
||||
if (node.loc)
|
||||
delete node.loc;
|
||||
Object.keys(node).forEach(function (key) {
|
||||
var value = node[key];
|
||||
if (value && typeof value === 'object') {
|
||||
workSet.add(value);
|
||||
}
|
||||
});
|
||||
});
|
||||
var loc = doc.loc;
|
||||
if (loc) {
|
||||
delete loc.startToken;
|
||||
delete loc.endToken;
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
function parseDocument(source) {
|
||||
var cacheKey = normalize(source);
|
||||
if (!docCache.has(cacheKey)) {
|
||||
var parsed = graphql.parse(source, {
|
||||
experimentalFragmentVariables: experimentalFragmentVariables,
|
||||
allowLegacyFragmentVariables: experimentalFragmentVariables
|
||||
});
|
||||
if (!parsed || parsed.kind !== 'Document') {
|
||||
throw new Error('Not a valid GraphQL document.');
|
||||
}
|
||||
docCache.set(cacheKey, stripLoc(processFragments(parsed)));
|
||||
}
|
||||
return docCache.get(cacheKey);
|
||||
}
|
||||
function gql(literals) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (typeof literals === 'string') {
|
||||
literals = [literals];
|
||||
}
|
||||
var result = literals[0];
|
||||
args.forEach(function (arg, i) {
|
||||
if (arg && arg.kind === 'Document') {
|
||||
result += arg.loc.source.body;
|
||||
}
|
||||
else {
|
||||
result += arg;
|
||||
}
|
||||
result += literals[i + 1];
|
||||
});
|
||||
return parseDocument(result);
|
||||
}
|
||||
function resetCaches() {
|
||||
docCache.clear();
|
||||
fragmentSourceMap.clear();
|
||||
}
|
||||
function disableFragmentWarnings() {
|
||||
printFragmentWarnings = false;
|
||||
}
|
||||
function enableExperimentalFragmentVariables() {
|
||||
experimentalFragmentVariables = true;
|
||||
}
|
||||
function disableExperimentalFragmentVariables() {
|
||||
experimentalFragmentVariables = false;
|
||||
}
|
||||
var extras = {
|
||||
gql: gql,
|
||||
resetCaches: resetCaches,
|
||||
disableFragmentWarnings: disableFragmentWarnings,
|
||||
enableExperimentalFragmentVariables: enableExperimentalFragmentVariables,
|
||||
disableExperimentalFragmentVariables: disableExperimentalFragmentVariables
|
||||
};
|
||||
(function (gql_1) {
|
||||
gql_1.gql = extras.gql, gql_1.resetCaches = extras.resetCaches, gql_1.disableFragmentWarnings = extras.disableFragmentWarnings, gql_1.enableExperimentalFragmentVariables = extras.enableExperimentalFragmentVariables, gql_1.disableExperimentalFragmentVariables = extras.disableExperimentalFragmentVariables;
|
||||
})(gql || (gql = {}));
|
||||
gql["default"] = gql;
|
||||
var gql$1 = gql;
|
||||
|
||||
var loader = require('../loader');
|
||||
describe('gql', function () {
|
||||
it('parses queries', function () {
|
||||
chai.assert.equal(gql$1(templateObject_1 || (templateObject_1 = tslib.__makeTemplateObject(["{ testQuery }"], ["{ testQuery }"]))).kind, 'Document');
|
||||
});
|
||||
it('parses queries when called as a function', function () {
|
||||
chai.assert.equal(gql$1('{ testQuery }').kind, 'Document');
|
||||
});
|
||||
it('parses queries with weird substitutions', function () {
|
||||
var obj = Object.create(null);
|
||||
chai.assert.equal(gql$1(templateObject_2 || (templateObject_2 = tslib.__makeTemplateObject(["{ field(input: \"", "\") }"], ["{ field(input: \"", "\") }"])), obj.missing).kind, 'Document');
|
||||
chai.assert.equal(gql$1(templateObject_3 || (templateObject_3 = tslib.__makeTemplateObject(["{ field(input: \"", "\") }"], ["{ field(input: \"", "\") }"])), null).kind, 'Document');
|
||||
chai.assert.equal(gql$1(templateObject_4 || (templateObject_4 = tslib.__makeTemplateObject(["{ field(input: \"", "\") }"], ["{ field(input: \"", "\") }"])), 0).kind, 'Document');
|
||||
});
|
||||
it('allows interpolation of documents generated by the webpack loader', function () {
|
||||
var sameFragment = "fragment SomeFragmentName on SomeType { someField }";
|
||||
var jsSource = loader.call({ cacheable: function () { } }, sameFragment);
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
var document = gql$1(templateObject_5 || (templateObject_5 = tslib.__makeTemplateObject(["query { ...SomeFragmentName } ", ""], ["query { ...SomeFragmentName } ", ""])), module.exports);
|
||||
chai.assert.equal(document.kind, 'Document');
|
||||
chai.assert.equal(document.definitions.length, 2);
|
||||
chai.assert.equal(document.definitions[0].kind, 'OperationDefinition');
|
||||
chai.assert.equal(document.definitions[1].kind, 'FragmentDefinition');
|
||||
});
|
||||
it('parses queries through webpack loader', function () {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, '{ testQuery }');
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
chai.assert.equal(module.exports.kind, 'Document');
|
||||
});
|
||||
it('parses single query through webpack loader', function () {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n ");
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
chai.assert.equal(module.exports.kind, 'Document');
|
||||
chai.assert.exists(module.exports.Q1);
|
||||
chai.assert.equal(module.exports.Q1.kind, 'Document');
|
||||
chai.assert.equal(module.exports.Q1.definitions.length, 1);
|
||||
});
|
||||
it('parses single query and exports as default', function () {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n ");
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
chai.assert.deepEqual(module.exports.definitions, module.exports.Q1.definitions);
|
||||
});
|
||||
it('parses multiple queries through webpack loader', function () {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n query Q2 { testQuery2 }\n ");
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
chai.assert.exists(module.exports.Q1);
|
||||
chai.assert.exists(module.exports.Q2);
|
||||
chai.assert.equal(module.exports.Q1.kind, 'Document');
|
||||
chai.assert.equal(module.exports.Q2.kind, 'Document');
|
||||
chai.assert.equal(module.exports.Q1.definitions.length, 1);
|
||||
chai.assert.equal(module.exports.Q2.definitions.length, 1);
|
||||
});
|
||||
it('parses fragments with variable definitions', function () {
|
||||
gql$1.enableExperimentalFragmentVariables();
|
||||
var parsed = gql$1(templateObject_6 || (templateObject_6 = tslib.__makeTemplateObject(["fragment A ($arg: String!) on Type { testQuery }"], ["fragment A ($arg: String!) on Type { testQuery }"])));
|
||||
chai.assert.equal(parsed.kind, 'Document');
|
||||
chai.assert.exists(parsed.definitions[0].variableDefinitions);
|
||||
gql$1.disableExperimentalFragmentVariables();
|
||||
});
|
||||
it('does not nest queries needlessly in named exports', function () {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n query Q2 { testQuery2 }\n query Q3 { test Query3 }\n ");
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
chai.assert.notExists(module.exports.Q2.Q1);
|
||||
chai.assert.notExists(module.exports.Q3.Q1);
|
||||
chai.assert.notExists(module.exports.Q3.Q2);
|
||||
});
|
||||
it('tracks fragment dependencies from multiple queries through webpack loader', function () {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, "\n fragment F1 on F { testQuery }\n fragment F2 on F { testQuery2 }\n fragment F3 on F { testQuery3 }\n query Q1 { ...F1 }\n query Q2 { ...F2 }\n query Q3 {\n ...F1\n ...F2\n }\n ");
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
chai.assert.exists(module.exports.Q1);
|
||||
chai.assert.exists(module.exports.Q2);
|
||||
chai.assert.exists(module.exports.Q3);
|
||||
var Q1 = module.exports.Q1.definitions;
|
||||
var Q2 = module.exports.Q2.definitions;
|
||||
var Q3 = module.exports.Q3.definitions;
|
||||
chai.assert.equal(Q1.length, 2);
|
||||
chai.assert.equal(Q1[0].name.value, 'Q1');
|
||||
chai.assert.equal(Q1[1].name.value, 'F1');
|
||||
chai.assert.equal(Q2.length, 2);
|
||||
chai.assert.equal(Q2[0].name.value, 'Q2');
|
||||
chai.assert.equal(Q2[1].name.value, 'F2');
|
||||
chai.assert.equal(Q3.length, 3);
|
||||
chai.assert.equal(Q3[0].name.value, 'Q3');
|
||||
chai.assert.equal(Q3[1].name.value, 'F1');
|
||||
chai.assert.equal(Q3[2].name.value, 'F2');
|
||||
var F1 = module.exports.F1.definitions;
|
||||
var F2 = module.exports.F2.definitions;
|
||||
var F3 = module.exports.F3.definitions;
|
||||
chai.assert.equal(F1.length, 1);
|
||||
chai.assert.equal(F1[0].name.value, 'F1');
|
||||
chai.assert.equal(F2.length, 1);
|
||||
chai.assert.equal(F2[0].name.value, 'F2');
|
||||
chai.assert.equal(F3.length, 1);
|
||||
chai.assert.equal(F3[0].name.value, 'F3');
|
||||
});
|
||||
it('tracks fragment dependencies across nested fragments', function () {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, "\n fragment F11 on F { testQuery }\n fragment F22 on F {\n ...F11\n testQuery2\n }\n fragment F33 on F {\n ...F22\n testQuery3\n }\n\n query Q1 {\n ...F33\n }\n\n query Q2 {\n id\n }\n ");
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
chai.assert.exists(module.exports.Q1);
|
||||
chai.assert.exists(module.exports.Q2);
|
||||
var Q1 = module.exports.Q1.definitions;
|
||||
var Q2 = module.exports.Q2.definitions;
|
||||
chai.assert.equal(Q1.length, 4);
|
||||
chai.assert.equal(Q1[0].name.value, 'Q1');
|
||||
chai.assert.equal(Q1[1].name.value, 'F33');
|
||||
chai.assert.equal(Q1[2].name.value, 'F22');
|
||||
chai.assert.equal(Q1[3].name.value, 'F11');
|
||||
chai.assert.equal(Q2.length, 1);
|
||||
var F11 = module.exports.F11.definitions;
|
||||
var F22 = module.exports.F22.definitions;
|
||||
var F33 = module.exports.F33.definitions;
|
||||
chai.assert.equal(F11.length, 1);
|
||||
chai.assert.equal(F11[0].name.value, 'F11');
|
||||
chai.assert.equal(F22.length, 2);
|
||||
chai.assert.equal(F22[0].name.value, 'F22');
|
||||
chai.assert.equal(F22[1].name.value, 'F11');
|
||||
chai.assert.equal(F33.length, 3);
|
||||
chai.assert.equal(F33[0].name.value, 'F33');
|
||||
chai.assert.equal(F33[1].name.value, 'F22');
|
||||
chai.assert.equal(F33[2].name.value, 'F11');
|
||||
});
|
||||
it('correctly imports other files through the webpack loader', function () {
|
||||
var query = "#import \"./fragment_definition.graphql\"\n query {\n author {\n ...authorDetails\n }\n }";
|
||||
var jsSource = loader.call({ cacheable: function () { } }, query);
|
||||
var module = { exports: Object.create(null) };
|
||||
var require = function (path) {
|
||||
chai.assert.equal(path, './fragment_definition.graphql');
|
||||
return gql$1(templateObject_7 || (templateObject_7 = tslib.__makeTemplateObject(["\n fragment authorDetails on Author {\n firstName\n lastName\n }"], ["\n fragment authorDetails on Author {\n firstName\n lastName\n }"])));
|
||||
};
|
||||
Function("module,require", jsSource)(module, require);
|
||||
chai.assert.equal(module.exports.kind, 'Document');
|
||||
var definitions = module.exports.definitions;
|
||||
chai.assert.equal(definitions.length, 2);
|
||||
chai.assert.equal(definitions[0].kind, 'OperationDefinition');
|
||||
chai.assert.equal(definitions[1].kind, 'FragmentDefinition');
|
||||
});
|
||||
it('tracks fragment dependencies across fragments loaded via the webpack loader', function () {
|
||||
var query = "#import \"./fragment_definition.graphql\"\n fragment F111 on F {\n ...F222\n }\n\n query Q1 {\n ...F111\n }\n\n query Q2 {\n a\n }\n ";
|
||||
var jsSource = loader.call({ cacheable: function () { } }, query);
|
||||
var module = { exports: Object.create(null) };
|
||||
var require = function (path) {
|
||||
chai.assert.equal(path, './fragment_definition.graphql');
|
||||
return gql$1(templateObject_8 || (templateObject_8 = tslib.__makeTemplateObject(["\n fragment F222 on F {\n f1\n f2\n }"], ["\n fragment F222 on F {\n f1\n f2\n }"])));
|
||||
};
|
||||
Function("module,require", jsSource)(module, require);
|
||||
chai.assert.exists(module.exports.Q1);
|
||||
chai.assert.exists(module.exports.Q2);
|
||||
var Q1 = module.exports.Q1.definitions;
|
||||
var Q2 = module.exports.Q2.definitions;
|
||||
chai.assert.equal(Q1.length, 3);
|
||||
chai.assert.equal(Q1[0].name.value, 'Q1');
|
||||
chai.assert.equal(Q1[1].name.value, 'F111');
|
||||
chai.assert.equal(Q1[2].name.value, 'F222');
|
||||
chai.assert.equal(Q2.length, 1);
|
||||
});
|
||||
it('does not complain when presented with normal comments', function (done) {
|
||||
chai.assert.doesNotThrow(function () {
|
||||
var query = "#normal comment\n query {\n author {\n ...authorDetails\n }\n }";
|
||||
var jsSource = loader.call({ cacheable: function () { } }, query);
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
chai.assert.equal(module.exports.kind, 'Document');
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('returns the same object for the same query', function () {
|
||||
chai.assert.isTrue(gql$1(templateObject_9 || (templateObject_9 = tslib.__makeTemplateObject(["{ sameQuery }"], ["{ sameQuery }"]))) === gql$1(templateObject_10 || (templateObject_10 = tslib.__makeTemplateObject(["{ sameQuery }"], ["{ sameQuery }"]))));
|
||||
});
|
||||
it('returns the same object for the same query, even with whitespace differences', function () {
|
||||
chai.assert.isTrue(gql$1(templateObject_11 || (templateObject_11 = tslib.__makeTemplateObject(["{ sameQuery }"], ["{ sameQuery }"]))) === gql$1(templateObject_12 || (templateObject_12 = tslib.__makeTemplateObject([" { sameQuery, }"], [" { sameQuery, }"]))));
|
||||
});
|
||||
var fragmentAst = gql$1(templateObject_13 || (templateObject_13 = tslib.__makeTemplateObject(["\n fragment UserFragment on User {\n firstName\n lastName\n }\n"], ["\n fragment UserFragment on User {\n firstName\n lastName\n }\n"])));
|
||||
it('returns the same object for the same fragment', function () {
|
||||
chai.assert.isTrue(gql$1(templateObject_14 || (templateObject_14 = tslib.__makeTemplateObject(["fragment same on Same { sameQuery }"], ["fragment same on Same { sameQuery }"]))) === gql$1(templateObject_15 || (templateObject_15 = tslib.__makeTemplateObject(["fragment same on Same { sameQuery }"], ["fragment same on Same { sameQuery }"]))));
|
||||
});
|
||||
it('returns the same object for the same document with substitution', function () {
|
||||
chai.assert.isTrue(gql$1(templateObject_16 || (templateObject_16 = tslib.__makeTemplateObject(["{ ...UserFragment } ", ""], ["{ ...UserFragment } ", ""])), fragmentAst) === gql$1(templateObject_17 || (templateObject_17 = tslib.__makeTemplateObject(["{ ...UserFragment } ", ""], ["{ ...UserFragment } ", ""])), fragmentAst));
|
||||
});
|
||||
it('can reference a fragment that references as fragment', function () {
|
||||
var secondFragmentAst = gql$1(templateObject_18 || (templateObject_18 = tslib.__makeTemplateObject(["\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n ", "\n "], ["\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n ", "\n "])), fragmentAst);
|
||||
var ast = gql$1(templateObject_19 || (templateObject_19 = tslib.__makeTemplateObject(["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n ", "\n "], ["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n ", "\n "])), secondFragmentAst);
|
||||
chai.assert.deepEqual(ast, gql$1(templateObject_20 || (templateObject_20 = tslib.__makeTemplateObject(["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n fragment UserFragment on User {\n firstName\n lastName\n }\n "], ["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n fragment UserFragment on User {\n firstName\n lastName\n }\n "]))));
|
||||
});
|
||||
describe('fragment warnings', function () {
|
||||
var warnings = [];
|
||||
var oldConsoleWarn = console.warn;
|
||||
beforeEach(function () {
|
||||
gql$1.resetCaches();
|
||||
warnings = [];
|
||||
console.warn = function (w) { return warnings.push(w); };
|
||||
});
|
||||
afterEach(function () {
|
||||
console.warn = oldConsoleWarn;
|
||||
});
|
||||
it('warns if you use the same fragment name for different fragments', function () {
|
||||
var frag1 = gql$1(templateObject_21 || (templateObject_21 = tslib.__makeTemplateObject(["fragment TestSame on Bar { fieldOne }"], ["fragment TestSame on Bar { fieldOne }"])));
|
||||
var frag2 = gql$1(templateObject_22 || (templateObject_22 = tslib.__makeTemplateObject(["fragment TestSame on Bar { fieldTwo }"], ["fragment TestSame on Bar { fieldTwo }"])));
|
||||
chai.assert.isFalse(frag1 === frag2);
|
||||
chai.assert.equal(warnings.length, 1);
|
||||
});
|
||||
it('does not warn if you use the same fragment name for the same fragment', function () {
|
||||
var frag1 = gql$1(templateObject_23 || (templateObject_23 = tslib.__makeTemplateObject(["fragment TestDifferent on Bar { fieldOne }"], ["fragment TestDifferent on Bar { fieldOne }"])));
|
||||
var frag2 = gql$1(templateObject_24 || (templateObject_24 = tslib.__makeTemplateObject(["fragment TestDifferent on Bar { fieldOne }"], ["fragment TestDifferent on Bar { fieldOne }"])));
|
||||
chai.assert.isTrue(frag1 === frag2);
|
||||
chai.assert.equal(warnings.length, 0);
|
||||
});
|
||||
it('does not warn if you use the same embedded fragment in two different queries', function () {
|
||||
var frag1 = gql$1(templateObject_25 || (templateObject_25 = tslib.__makeTemplateObject(["fragment TestEmbedded on Bar { field }"], ["fragment TestEmbedded on Bar { field }"])));
|
||||
var query1 = gql$1(templateObject_26 || (templateObject_26 = tslib.__makeTemplateObject(["{ bar { fieldOne ...TestEmbedded } } ", ""], ["{ bar { fieldOne ...TestEmbedded } } ", ""])), frag1);
|
||||
var query2 = gql$1(templateObject_27 || (templateObject_27 = tslib.__makeTemplateObject(["{ bar { fieldTwo ...TestEmbedded } } ", ""], ["{ bar { fieldTwo ...TestEmbedded } } ", ""])), frag1);
|
||||
chai.assert.isFalse(query1 === query2);
|
||||
chai.assert.equal(warnings.length, 0);
|
||||
});
|
||||
it('does not warn if you use the same fragment name for embedded and non-embedded fragments', function () {
|
||||
var frag1 = gql$1(templateObject_28 || (templateObject_28 = tslib.__makeTemplateObject(["fragment TestEmbeddedTwo on Bar { field }"], ["fragment TestEmbeddedTwo on Bar { field }"])));
|
||||
gql$1(templateObject_29 || (templateObject_29 = tslib.__makeTemplateObject(["{ bar { ...TestEmbedded } } ", ""], ["{ bar { ...TestEmbedded } } ", ""])), frag1);
|
||||
gql$1(templateObject_30 || (templateObject_30 = tslib.__makeTemplateObject(["{ bar { ...TestEmbedded } } fragment TestEmbeddedTwo on Bar { field }"], ["{ bar { ...TestEmbedded } } fragment TestEmbeddedTwo on Bar { field }"])));
|
||||
chai.assert.equal(warnings.length, 0);
|
||||
});
|
||||
});
|
||||
describe('unique fragments', function () {
|
||||
beforeEach(function () {
|
||||
gql$1.resetCaches();
|
||||
});
|
||||
it('strips duplicate fragments from the document', function () {
|
||||
var frag1 = gql$1(templateObject_31 || (templateObject_31 = tslib.__makeTemplateObject(["fragment TestDuplicate on Bar { field }"], ["fragment TestDuplicate on Bar { field }"])));
|
||||
var query1 = gql$1(templateObject_32 || (templateObject_32 = tslib.__makeTemplateObject(["{ bar { fieldOne ...TestDuplicate } } ", " ", ""], ["{ bar { fieldOne ...TestDuplicate } } ", " ", ""])), frag1, frag1);
|
||||
var query2 = gql$1(templateObject_33 || (templateObject_33 = tslib.__makeTemplateObject(["{ bar { fieldOne ...TestDuplicate } } ", ""], ["{ bar { fieldOne ...TestDuplicate } } ", ""])), frag1);
|
||||
chai.assert.equal(query1.definitions.length, 2);
|
||||
chai.assert.equal(query1.definitions[1].kind, 'FragmentDefinition');
|
||||
chai.assert.deepEqual(query1.definitions, query2.definitions);
|
||||
});
|
||||
it('ignores duplicate fragments from second-level imports when using the webpack loader', function () {
|
||||
var load = function (require, query) {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, query);
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("require,module", jsSource)(require, module);
|
||||
return module.exports;
|
||||
};
|
||||
var test_require = function (path) {
|
||||
switch (path) {
|
||||
case './friends.graphql':
|
||||
return load(test_require, [
|
||||
'#import "./person.graphql"',
|
||||
'fragment friends on Hero { friends { ...person } }',
|
||||
].join('\n'));
|
||||
case './enemies.graphql':
|
||||
return load(test_require, [
|
||||
'#import "./person.graphql"',
|
||||
'fragment enemies on Hero { enemies { ...person } }',
|
||||
].join('\n'));
|
||||
case './person.graphql':
|
||||
return load(test_require, 'fragment person on Person { name }\n');
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
};
|
||||
var result = load(test_require, [
|
||||
'#import "./friends.graphql"',
|
||||
'#import "./enemies.graphql"',
|
||||
'query { hero { ...friends ...enemies } }',
|
||||
].join('\n'));
|
||||
chai.assert.equal(result.kind, 'Document');
|
||||
chai.assert.equal(result.definitions.length, 4, 'after deduplication, only 4 fragments should remain');
|
||||
chai.assert.equal(result.definitions[0].kind, 'OperationDefinition');
|
||||
var fragments = result.definitions.slice(1);
|
||||
chai.assert(fragments.every(function (fragment) { return fragment.kind === 'FragmentDefinition'; }));
|
||||
chai.assert(fragments.some(function (fragment) { return fragment.name.value === 'friends'; }));
|
||||
chai.assert(fragments.some(function (fragment) { return fragment.name.value === 'enemies'; }));
|
||||
chai.assert(fragments.some(function (fragment) { return fragment.name.value === 'person'; }));
|
||||
});
|
||||
});
|
||||
});
|
||||
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27, templateObject_28, templateObject_29, templateObject_30, templateObject_31, templateObject_32, templateObject_33;
|
||||
//# sourceMappingURL=tests.cjs.js.map
|
||||
1
node_modules/graphql-tag/lib/tests.cjs.js.map
generated
vendored
Normal file
1
node_modules/graphql-tag/lib/tests.cjs.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/graphql-tag/lib/tests.d.ts
generated
vendored
Normal file
2
node_modules/graphql-tag/lib/tests.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import 'source-map-support/register';
|
||||
//# sourceMappingURL=tests.d.ts.map
|
||||
1
node_modules/graphql-tag/lib/tests.d.ts.map
generated
vendored
Normal file
1
node_modules/graphql-tag/lib/tests.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../src/tests.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC"}
|
||||
288
node_modules/graphql-tag/lib/tests.js
generated
vendored
Normal file
288
node_modules/graphql-tag/lib/tests.js
generated
vendored
Normal file
@@ -0,0 +1,288 @@
|
||||
import { __makeTemplateObject } from "tslib";
|
||||
import 'source-map-support/register';
|
||||
import { assert } from 'chai';
|
||||
import gql from './index';
|
||||
var loader = require('../loader');
|
||||
describe('gql', function () {
|
||||
it('parses queries', function () {
|
||||
assert.equal(gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["{ testQuery }"], ["{ testQuery }"]))).kind, 'Document');
|
||||
});
|
||||
it('parses queries when called as a function', function () {
|
||||
assert.equal(gql('{ testQuery }').kind, 'Document');
|
||||
});
|
||||
it('parses queries with weird substitutions', function () {
|
||||
var obj = Object.create(null);
|
||||
assert.equal(gql(templateObject_2 || (templateObject_2 = __makeTemplateObject(["{ field(input: \"", "\") }"], ["{ field(input: \"", "\") }"])), obj.missing).kind, 'Document');
|
||||
assert.equal(gql(templateObject_3 || (templateObject_3 = __makeTemplateObject(["{ field(input: \"", "\") }"], ["{ field(input: \"", "\") }"])), null).kind, 'Document');
|
||||
assert.equal(gql(templateObject_4 || (templateObject_4 = __makeTemplateObject(["{ field(input: \"", "\") }"], ["{ field(input: \"", "\") }"])), 0).kind, 'Document');
|
||||
});
|
||||
it('allows interpolation of documents generated by the webpack loader', function () {
|
||||
var sameFragment = "fragment SomeFragmentName on SomeType { someField }";
|
||||
var jsSource = loader.call({ cacheable: function () { } }, sameFragment);
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
var document = gql(templateObject_5 || (templateObject_5 = __makeTemplateObject(["query { ...SomeFragmentName } ", ""], ["query { ...SomeFragmentName } ", ""])), module.exports);
|
||||
assert.equal(document.kind, 'Document');
|
||||
assert.equal(document.definitions.length, 2);
|
||||
assert.equal(document.definitions[0].kind, 'OperationDefinition');
|
||||
assert.equal(document.definitions[1].kind, 'FragmentDefinition');
|
||||
});
|
||||
it('parses queries through webpack loader', function () {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, '{ testQuery }');
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
assert.equal(module.exports.kind, 'Document');
|
||||
});
|
||||
it('parses single query through webpack loader', function () {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n ");
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
assert.equal(module.exports.kind, 'Document');
|
||||
assert.exists(module.exports.Q1);
|
||||
assert.equal(module.exports.Q1.kind, 'Document');
|
||||
assert.equal(module.exports.Q1.definitions.length, 1);
|
||||
});
|
||||
it('parses single query and exports as default', function () {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n ");
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
assert.deepEqual(module.exports.definitions, module.exports.Q1.definitions);
|
||||
});
|
||||
it('parses multiple queries through webpack loader', function () {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n query Q2 { testQuery2 }\n ");
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
assert.exists(module.exports.Q1);
|
||||
assert.exists(module.exports.Q2);
|
||||
assert.equal(module.exports.Q1.kind, 'Document');
|
||||
assert.equal(module.exports.Q2.kind, 'Document');
|
||||
assert.equal(module.exports.Q1.definitions.length, 1);
|
||||
assert.equal(module.exports.Q2.definitions.length, 1);
|
||||
});
|
||||
it('parses fragments with variable definitions', function () {
|
||||
gql.enableExperimentalFragmentVariables();
|
||||
var parsed = gql(templateObject_6 || (templateObject_6 = __makeTemplateObject(["fragment A ($arg: String!) on Type { testQuery }"], ["fragment A ($arg: String!) on Type { testQuery }"])));
|
||||
assert.equal(parsed.kind, 'Document');
|
||||
assert.exists(parsed.definitions[0].variableDefinitions);
|
||||
gql.disableExperimentalFragmentVariables();
|
||||
});
|
||||
it('does not nest queries needlessly in named exports', function () {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n query Q2 { testQuery2 }\n query Q3 { test Query3 }\n ");
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
assert.notExists(module.exports.Q2.Q1);
|
||||
assert.notExists(module.exports.Q3.Q1);
|
||||
assert.notExists(module.exports.Q3.Q2);
|
||||
});
|
||||
it('tracks fragment dependencies from multiple queries through webpack loader', function () {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, "\n fragment F1 on F { testQuery }\n fragment F2 on F { testQuery2 }\n fragment F3 on F { testQuery3 }\n query Q1 { ...F1 }\n query Q2 { ...F2 }\n query Q3 {\n ...F1\n ...F2\n }\n ");
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
assert.exists(module.exports.Q1);
|
||||
assert.exists(module.exports.Q2);
|
||||
assert.exists(module.exports.Q3);
|
||||
var Q1 = module.exports.Q1.definitions;
|
||||
var Q2 = module.exports.Q2.definitions;
|
||||
var Q3 = module.exports.Q3.definitions;
|
||||
assert.equal(Q1.length, 2);
|
||||
assert.equal(Q1[0].name.value, 'Q1');
|
||||
assert.equal(Q1[1].name.value, 'F1');
|
||||
assert.equal(Q2.length, 2);
|
||||
assert.equal(Q2[0].name.value, 'Q2');
|
||||
assert.equal(Q2[1].name.value, 'F2');
|
||||
assert.equal(Q3.length, 3);
|
||||
assert.equal(Q3[0].name.value, 'Q3');
|
||||
assert.equal(Q3[1].name.value, 'F1');
|
||||
assert.equal(Q3[2].name.value, 'F2');
|
||||
var F1 = module.exports.F1.definitions;
|
||||
var F2 = module.exports.F2.definitions;
|
||||
var F3 = module.exports.F3.definitions;
|
||||
assert.equal(F1.length, 1);
|
||||
assert.equal(F1[0].name.value, 'F1');
|
||||
assert.equal(F2.length, 1);
|
||||
assert.equal(F2[0].name.value, 'F2');
|
||||
assert.equal(F3.length, 1);
|
||||
assert.equal(F3[0].name.value, 'F3');
|
||||
});
|
||||
it('tracks fragment dependencies across nested fragments', function () {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, "\n fragment F11 on F { testQuery }\n fragment F22 on F {\n ...F11\n testQuery2\n }\n fragment F33 on F {\n ...F22\n testQuery3\n }\n\n query Q1 {\n ...F33\n }\n\n query Q2 {\n id\n }\n ");
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
assert.exists(module.exports.Q1);
|
||||
assert.exists(module.exports.Q2);
|
||||
var Q1 = module.exports.Q1.definitions;
|
||||
var Q2 = module.exports.Q2.definitions;
|
||||
assert.equal(Q1.length, 4);
|
||||
assert.equal(Q1[0].name.value, 'Q1');
|
||||
assert.equal(Q1[1].name.value, 'F33');
|
||||
assert.equal(Q1[2].name.value, 'F22');
|
||||
assert.equal(Q1[3].name.value, 'F11');
|
||||
assert.equal(Q2.length, 1);
|
||||
var F11 = module.exports.F11.definitions;
|
||||
var F22 = module.exports.F22.definitions;
|
||||
var F33 = module.exports.F33.definitions;
|
||||
assert.equal(F11.length, 1);
|
||||
assert.equal(F11[0].name.value, 'F11');
|
||||
assert.equal(F22.length, 2);
|
||||
assert.equal(F22[0].name.value, 'F22');
|
||||
assert.equal(F22[1].name.value, 'F11');
|
||||
assert.equal(F33.length, 3);
|
||||
assert.equal(F33[0].name.value, 'F33');
|
||||
assert.equal(F33[1].name.value, 'F22');
|
||||
assert.equal(F33[2].name.value, 'F11');
|
||||
});
|
||||
it('correctly imports other files through the webpack loader', function () {
|
||||
var query = "#import \"./fragment_definition.graphql\"\n query {\n author {\n ...authorDetails\n }\n }";
|
||||
var jsSource = loader.call({ cacheable: function () { } }, query);
|
||||
var module = { exports: Object.create(null) };
|
||||
var require = function (path) {
|
||||
assert.equal(path, './fragment_definition.graphql');
|
||||
return gql(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n fragment authorDetails on Author {\n firstName\n lastName\n }"], ["\n fragment authorDetails on Author {\n firstName\n lastName\n }"])));
|
||||
};
|
||||
Function("module,require", jsSource)(module, require);
|
||||
assert.equal(module.exports.kind, 'Document');
|
||||
var definitions = module.exports.definitions;
|
||||
assert.equal(definitions.length, 2);
|
||||
assert.equal(definitions[0].kind, 'OperationDefinition');
|
||||
assert.equal(definitions[1].kind, 'FragmentDefinition');
|
||||
});
|
||||
it('tracks fragment dependencies across fragments loaded via the webpack loader', function () {
|
||||
var query = "#import \"./fragment_definition.graphql\"\n fragment F111 on F {\n ...F222\n }\n\n query Q1 {\n ...F111\n }\n\n query Q2 {\n a\n }\n ";
|
||||
var jsSource = loader.call({ cacheable: function () { } }, query);
|
||||
var module = { exports: Object.create(null) };
|
||||
var require = function (path) {
|
||||
assert.equal(path, './fragment_definition.graphql');
|
||||
return gql(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n fragment F222 on F {\n f1\n f2\n }"], ["\n fragment F222 on F {\n f1\n f2\n }"])));
|
||||
};
|
||||
Function("module,require", jsSource)(module, require);
|
||||
assert.exists(module.exports.Q1);
|
||||
assert.exists(module.exports.Q2);
|
||||
var Q1 = module.exports.Q1.definitions;
|
||||
var Q2 = module.exports.Q2.definitions;
|
||||
assert.equal(Q1.length, 3);
|
||||
assert.equal(Q1[0].name.value, 'Q1');
|
||||
assert.equal(Q1[1].name.value, 'F111');
|
||||
assert.equal(Q1[2].name.value, 'F222');
|
||||
assert.equal(Q2.length, 1);
|
||||
});
|
||||
it('does not complain when presented with normal comments', function (done) {
|
||||
assert.doesNotThrow(function () {
|
||||
var query = "#normal comment\n query {\n author {\n ...authorDetails\n }\n }";
|
||||
var jsSource = loader.call({ cacheable: function () { } }, query);
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
assert.equal(module.exports.kind, 'Document');
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('returns the same object for the same query', function () {
|
||||
assert.isTrue(gql(templateObject_9 || (templateObject_9 = __makeTemplateObject(["{ sameQuery }"], ["{ sameQuery }"]))) === gql(templateObject_10 || (templateObject_10 = __makeTemplateObject(["{ sameQuery }"], ["{ sameQuery }"]))));
|
||||
});
|
||||
it('returns the same object for the same query, even with whitespace differences', function () {
|
||||
assert.isTrue(gql(templateObject_11 || (templateObject_11 = __makeTemplateObject(["{ sameQuery }"], ["{ sameQuery }"]))) === gql(templateObject_12 || (templateObject_12 = __makeTemplateObject([" { sameQuery, }"], [" { sameQuery, }"]))));
|
||||
});
|
||||
var fragmentAst = gql(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n fragment UserFragment on User {\n firstName\n lastName\n }\n"], ["\n fragment UserFragment on User {\n firstName\n lastName\n }\n"])));
|
||||
it('returns the same object for the same fragment', function () {
|
||||
assert.isTrue(gql(templateObject_14 || (templateObject_14 = __makeTemplateObject(["fragment same on Same { sameQuery }"], ["fragment same on Same { sameQuery }"]))) === gql(templateObject_15 || (templateObject_15 = __makeTemplateObject(["fragment same on Same { sameQuery }"], ["fragment same on Same { sameQuery }"]))));
|
||||
});
|
||||
it('returns the same object for the same document with substitution', function () {
|
||||
assert.isTrue(gql(templateObject_16 || (templateObject_16 = __makeTemplateObject(["{ ...UserFragment } ", ""], ["{ ...UserFragment } ", ""])), fragmentAst) === gql(templateObject_17 || (templateObject_17 = __makeTemplateObject(["{ ...UserFragment } ", ""], ["{ ...UserFragment } ", ""])), fragmentAst));
|
||||
});
|
||||
it('can reference a fragment that references as fragment', function () {
|
||||
var secondFragmentAst = gql(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n ", "\n "], ["\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n ", "\n "])), fragmentAst);
|
||||
var ast = gql(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n ", "\n "], ["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n ", "\n "])), secondFragmentAst);
|
||||
assert.deepEqual(ast, gql(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n fragment UserFragment on User {\n firstName\n lastName\n }\n "], ["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n fragment UserFragment on User {\n firstName\n lastName\n }\n "]))));
|
||||
});
|
||||
describe('fragment warnings', function () {
|
||||
var warnings = [];
|
||||
var oldConsoleWarn = console.warn;
|
||||
beforeEach(function () {
|
||||
gql.resetCaches();
|
||||
warnings = [];
|
||||
console.warn = function (w) { return warnings.push(w); };
|
||||
});
|
||||
afterEach(function () {
|
||||
console.warn = oldConsoleWarn;
|
||||
});
|
||||
it('warns if you use the same fragment name for different fragments', function () {
|
||||
var frag1 = gql(templateObject_21 || (templateObject_21 = __makeTemplateObject(["fragment TestSame on Bar { fieldOne }"], ["fragment TestSame on Bar { fieldOne }"])));
|
||||
var frag2 = gql(templateObject_22 || (templateObject_22 = __makeTemplateObject(["fragment TestSame on Bar { fieldTwo }"], ["fragment TestSame on Bar { fieldTwo }"])));
|
||||
assert.isFalse(frag1 === frag2);
|
||||
assert.equal(warnings.length, 1);
|
||||
});
|
||||
it('does not warn if you use the same fragment name for the same fragment', function () {
|
||||
var frag1 = gql(templateObject_23 || (templateObject_23 = __makeTemplateObject(["fragment TestDifferent on Bar { fieldOne }"], ["fragment TestDifferent on Bar { fieldOne }"])));
|
||||
var frag2 = gql(templateObject_24 || (templateObject_24 = __makeTemplateObject(["fragment TestDifferent on Bar { fieldOne }"], ["fragment TestDifferent on Bar { fieldOne }"])));
|
||||
assert.isTrue(frag1 === frag2);
|
||||
assert.equal(warnings.length, 0);
|
||||
});
|
||||
it('does not warn if you use the same embedded fragment in two different queries', function () {
|
||||
var frag1 = gql(templateObject_25 || (templateObject_25 = __makeTemplateObject(["fragment TestEmbedded on Bar { field }"], ["fragment TestEmbedded on Bar { field }"])));
|
||||
var query1 = gql(templateObject_26 || (templateObject_26 = __makeTemplateObject(["{ bar { fieldOne ...TestEmbedded } } ", ""], ["{ bar { fieldOne ...TestEmbedded } } ", ""])), frag1);
|
||||
var query2 = gql(templateObject_27 || (templateObject_27 = __makeTemplateObject(["{ bar { fieldTwo ...TestEmbedded } } ", ""], ["{ bar { fieldTwo ...TestEmbedded } } ", ""])), frag1);
|
||||
assert.isFalse(query1 === query2);
|
||||
assert.equal(warnings.length, 0);
|
||||
});
|
||||
it('does not warn if you use the same fragment name for embedded and non-embedded fragments', function () {
|
||||
var frag1 = gql(templateObject_28 || (templateObject_28 = __makeTemplateObject(["fragment TestEmbeddedTwo on Bar { field }"], ["fragment TestEmbeddedTwo on Bar { field }"])));
|
||||
gql(templateObject_29 || (templateObject_29 = __makeTemplateObject(["{ bar { ...TestEmbedded } } ", ""], ["{ bar { ...TestEmbedded } } ", ""])), frag1);
|
||||
gql(templateObject_30 || (templateObject_30 = __makeTemplateObject(["{ bar { ...TestEmbedded } } fragment TestEmbeddedTwo on Bar { field }"], ["{ bar { ...TestEmbedded } } fragment TestEmbeddedTwo on Bar { field }"])));
|
||||
assert.equal(warnings.length, 0);
|
||||
});
|
||||
});
|
||||
describe('unique fragments', function () {
|
||||
beforeEach(function () {
|
||||
gql.resetCaches();
|
||||
});
|
||||
it('strips duplicate fragments from the document', function () {
|
||||
var frag1 = gql(templateObject_31 || (templateObject_31 = __makeTemplateObject(["fragment TestDuplicate on Bar { field }"], ["fragment TestDuplicate on Bar { field }"])));
|
||||
var query1 = gql(templateObject_32 || (templateObject_32 = __makeTemplateObject(["{ bar { fieldOne ...TestDuplicate } } ", " ", ""], ["{ bar { fieldOne ...TestDuplicate } } ", " ", ""])), frag1, frag1);
|
||||
var query2 = gql(templateObject_33 || (templateObject_33 = __makeTemplateObject(["{ bar { fieldOne ...TestDuplicate } } ", ""], ["{ bar { fieldOne ...TestDuplicate } } ", ""])), frag1);
|
||||
assert.equal(query1.definitions.length, 2);
|
||||
assert.equal(query1.definitions[1].kind, 'FragmentDefinition');
|
||||
assert.deepEqual(query1.definitions, query2.definitions);
|
||||
});
|
||||
it('ignores duplicate fragments from second-level imports when using the webpack loader', function () {
|
||||
var load = function (require, query) {
|
||||
var jsSource = loader.call({ cacheable: function () { } }, query);
|
||||
var module = { exports: Object.create(null) };
|
||||
Function("require,module", jsSource)(require, module);
|
||||
return module.exports;
|
||||
};
|
||||
var test_require = function (path) {
|
||||
switch (path) {
|
||||
case './friends.graphql':
|
||||
return load(test_require, [
|
||||
'#import "./person.graphql"',
|
||||
'fragment friends on Hero { friends { ...person } }',
|
||||
].join('\n'));
|
||||
case './enemies.graphql':
|
||||
return load(test_require, [
|
||||
'#import "./person.graphql"',
|
||||
'fragment enemies on Hero { enemies { ...person } }',
|
||||
].join('\n'));
|
||||
case './person.graphql':
|
||||
return load(test_require, 'fragment person on Person { name }\n');
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
;
|
||||
};
|
||||
var result = load(test_require, [
|
||||
'#import "./friends.graphql"',
|
||||
'#import "./enemies.graphql"',
|
||||
'query { hero { ...friends ...enemies } }',
|
||||
].join('\n'));
|
||||
assert.equal(result.kind, 'Document');
|
||||
assert.equal(result.definitions.length, 4, 'after deduplication, only 4 fragments should remain');
|
||||
assert.equal(result.definitions[0].kind, 'OperationDefinition');
|
||||
var fragments = result.definitions.slice(1);
|
||||
assert(fragments.every(function (fragment) { return fragment.kind === 'FragmentDefinition'; }));
|
||||
assert(fragments.some(function (fragment) { return fragment.name.value === 'friends'; }));
|
||||
assert(fragments.some(function (fragment) { return fragment.name.value === 'enemies'; }));
|
||||
assert(fragments.some(function (fragment) { return fragment.name.value === 'person'; }));
|
||||
});
|
||||
});
|
||||
});
|
||||
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27, templateObject_28, templateObject_29, templateObject_30, templateObject_31, templateObject_32, templateObject_33;
|
||||
//# sourceMappingURL=tests.js.map
|
||||
1
node_modules/graphql-tag/lib/tests.js.map
generated
vendored
Normal file
1
node_modules/graphql-tag/lib/tests.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
190
node_modules/graphql-tag/loader.js
generated
vendored
Normal file
190
node_modules/graphql-tag/loader.js
generated
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
"use strict";
|
||||
|
||||
const os = require('os');
|
||||
const gql = require('./main.js');
|
||||
|
||||
// Takes `source` (the source GraphQL query string)
|
||||
// and `doc` (the parsed GraphQL document) and tacks on
|
||||
// the imported definitions.
|
||||
function expandImports(source, doc) {
|
||||
const lines = source.split(/\r\n|\r|\n/);
|
||||
let outputCode = `
|
||||
var names = {};
|
||||
function unique(defs) {
|
||||
return defs.filter(
|
||||
function(def) {
|
||||
if (def.kind !== 'FragmentDefinition') return true;
|
||||
var name = def.name.value
|
||||
if (names[name]) {
|
||||
return false;
|
||||
} else {
|
||||
names[name] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
`;
|
||||
|
||||
lines.some((line) => {
|
||||
if (line[0] === '#' && line.slice(1).split(' ')[0] === 'import') {
|
||||
const importFile = line.slice(1).split(' ')[1];
|
||||
const parseDocument = `require(${importFile})`;
|
||||
const appendDef = `doc.definitions = doc.definitions.concat(unique(${parseDocument}.definitions));`;
|
||||
outputCode += appendDef + os.EOL;
|
||||
}
|
||||
return (line.length !== 0 && line[0] !== '#');
|
||||
});
|
||||
|
||||
return outputCode;
|
||||
}
|
||||
|
||||
module.exports = function(source) {
|
||||
this.cacheable();
|
||||
const doc = gql`${source}`;
|
||||
let headerCode = `
|
||||
var doc = ${JSON.stringify(doc)};
|
||||
doc.loc.source = ${JSON.stringify(doc.loc.source)};
|
||||
`;
|
||||
|
||||
let outputCode = "";
|
||||
|
||||
// Allow multiple query/mutation definitions in a file. This parses out dependencies
|
||||
// at compile time, and then uses those at load time to create minimal query documents
|
||||
// We cannot do the latter at compile time due to how the #import code works.
|
||||
let operationCount = doc.definitions.reduce(function(accum, op) {
|
||||
if (op.kind === "OperationDefinition" || op.kind === "FragmentDefinition") {
|
||||
return accum + 1;
|
||||
}
|
||||
|
||||
return accum;
|
||||
}, 0);
|
||||
|
||||
if (operationCount < 1) {
|
||||
outputCode += `
|
||||
module.exports = doc;
|
||||
`
|
||||
} else {
|
||||
outputCode += `
|
||||
// Collect any fragment/type references from a node, adding them to the refs Set
|
||||
function collectFragmentReferences(node, refs) {
|
||||
if (node.kind === "FragmentSpread") {
|
||||
refs.add(node.name.value);
|
||||
} else if (node.kind === "VariableDefinition") {
|
||||
var type = node.type;
|
||||
if (type.kind === "NamedType") {
|
||||
refs.add(type.name.value);
|
||||
}
|
||||
}
|
||||
|
||||
if (node.selectionSet) {
|
||||
node.selectionSet.selections.forEach(function(selection) {
|
||||
collectFragmentReferences(selection, refs);
|
||||
});
|
||||
}
|
||||
|
||||
if (node.variableDefinitions) {
|
||||
node.variableDefinitions.forEach(function(def) {
|
||||
collectFragmentReferences(def, refs);
|
||||
});
|
||||
}
|
||||
|
||||
if (node.definitions) {
|
||||
node.definitions.forEach(function(def) {
|
||||
collectFragmentReferences(def, refs);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var definitionRefs = {};
|
||||
(function extractReferences() {
|
||||
doc.definitions.forEach(function(def) {
|
||||
if (def.name) {
|
||||
var refs = new Set();
|
||||
collectFragmentReferences(def, refs);
|
||||
definitionRefs[def.name.value] = refs;
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
function findOperation(doc, name) {
|
||||
for (var i = 0; i < doc.definitions.length; i++) {
|
||||
var element = doc.definitions[i];
|
||||
if (element.name && element.name.value == name) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function oneQuery(doc, operationName) {
|
||||
// Copy the DocumentNode, but clear out the definitions
|
||||
var newDoc = {
|
||||
kind: doc.kind,
|
||||
definitions: [findOperation(doc, operationName)]
|
||||
};
|
||||
if (doc.hasOwnProperty("loc")) {
|
||||
newDoc.loc = doc.loc;
|
||||
}
|
||||
|
||||
// Now, for the operation we're running, find any fragments referenced by
|
||||
// it or the fragments it references
|
||||
var opRefs = definitionRefs[operationName] || new Set();
|
||||
var allRefs = new Set();
|
||||
var newRefs = new Set();
|
||||
|
||||
// IE 11 doesn't support "new Set(iterable)", so we add the members of opRefs to newRefs one by one
|
||||
opRefs.forEach(function(refName) {
|
||||
newRefs.add(refName);
|
||||
});
|
||||
|
||||
while (newRefs.size > 0) {
|
||||
var prevRefs = newRefs;
|
||||
newRefs = new Set();
|
||||
|
||||
prevRefs.forEach(function(refName) {
|
||||
if (!allRefs.has(refName)) {
|
||||
allRefs.add(refName);
|
||||
var childRefs = definitionRefs[refName] || new Set();
|
||||
childRefs.forEach(function(childRef) {
|
||||
newRefs.add(childRef);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
allRefs.forEach(function(refName) {
|
||||
var op = findOperation(doc, refName);
|
||||
if (op) {
|
||||
newDoc.definitions.push(op);
|
||||
}
|
||||
});
|
||||
|
||||
return newDoc;
|
||||
}
|
||||
|
||||
module.exports = doc;
|
||||
`
|
||||
|
||||
for (const op of doc.definitions) {
|
||||
if (op.kind === "OperationDefinition" || op.kind === "FragmentDefinition") {
|
||||
if (!op.name) {
|
||||
if (operationCount > 1) {
|
||||
throw new Error("Query/mutation names are required for a document with multiple definitions");
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
const opName = op.name.value;
|
||||
outputCode += `
|
||||
module.exports["${opName}"] = oneQuery(doc, "${opName}");
|
||||
`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const importOutputCode = expandImports(source, doc);
|
||||
const allCode = headerCode + os.EOL + importOutputCode + os.EOL + outputCode + os.EOL;
|
||||
|
||||
return allCode;
|
||||
};
|
||||
3
node_modules/graphql-tag/main.js
generated
vendored
Normal file
3
node_modules/graphql-tag/main.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
// For backwards compatibility, make sure require("graphql-tag") returns
|
||||
// the gql function, rather than an exports object.
|
||||
module.exports = require('./lib/graphql-tag.umd.js').gql;
|
||||
15
node_modules/graphql-tag/node_modules/tslib/CopyrightNotice.txt
generated
vendored
Normal file
15
node_modules/graphql-tag/node_modules/tslib/CopyrightNotice.txt
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
12
node_modules/graphql-tag/node_modules/tslib/LICENSE.txt
generated
vendored
Normal file
12
node_modules/graphql-tag/node_modules/tslib/LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
164
node_modules/graphql-tag/node_modules/tslib/README.md
generated
vendored
Normal file
164
node_modules/graphql-tag/node_modules/tslib/README.md
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
# tslib
|
||||
|
||||
This is a runtime library for [TypeScript](https://www.typescriptlang.org/) that contains all of the TypeScript helper functions.
|
||||
|
||||
This library is primarily used by the `--importHelpers` flag in TypeScript.
|
||||
When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file:
|
||||
|
||||
```ts
|
||||
var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.x = {};
|
||||
exports.y = __assign({}, exports.x);
|
||||
|
||||
```
|
||||
|
||||
will instead be emitted as something like the following:
|
||||
|
||||
```ts
|
||||
var tslib_1 = require("tslib");
|
||||
exports.x = {};
|
||||
exports.y = tslib_1.__assign({}, exports.x);
|
||||
```
|
||||
|
||||
Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead.
|
||||
For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`.
|
||||
|
||||
# Installing
|
||||
|
||||
For the latest stable version, run:
|
||||
|
||||
## npm
|
||||
|
||||
```sh
|
||||
# TypeScript 3.9.2 or later
|
||||
npm install tslib
|
||||
|
||||
# TypeScript 3.8.4 or earlier
|
||||
npm install tslib@^1
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
npm install tslib@1.6.1
|
||||
```
|
||||
|
||||
## yarn
|
||||
|
||||
```sh
|
||||
# TypeScript 3.9.2 or later
|
||||
yarn add tslib
|
||||
|
||||
# TypeScript 3.8.4 or earlier
|
||||
yarn add tslib@^1
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
yarn add tslib@1.6.1
|
||||
```
|
||||
|
||||
## bower
|
||||
|
||||
```sh
|
||||
# TypeScript 3.9.2 or later
|
||||
bower install tslib
|
||||
|
||||
# TypeScript 3.8.4 or earlier
|
||||
bower install tslib@^1
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
bower install tslib@1.6.1
|
||||
```
|
||||
|
||||
## JSPM
|
||||
|
||||
```sh
|
||||
# TypeScript 3.9.2 or later
|
||||
jspm install tslib
|
||||
|
||||
# TypeScript 3.8.4 or earlier
|
||||
jspm install tslib@^1
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
jspm install tslib@1.6.1
|
||||
```
|
||||
|
||||
# Usage
|
||||
|
||||
Set the `importHelpers` compiler option on the command line:
|
||||
|
||||
```
|
||||
tsc --importHelpers file.ts
|
||||
```
|
||||
|
||||
or in your tsconfig.json:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"importHelpers": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### For bower and JSPM users
|
||||
|
||||
You will need to add a `paths` mapping for `tslib`, e.g. For Bower users:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "amd",
|
||||
"importHelpers": true,
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"tslib" : ["bower_components/tslib/tslib.d.ts"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For JSPM users:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "system",
|
||||
"importHelpers": true,
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"tslib" : ["jspm_packages/npm/tslib@2.x.y/tslib.d.ts"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Deployment
|
||||
|
||||
- Choose your new version number
|
||||
- Set it in `package.json` and `bower.json`
|
||||
- Create a tag: `git tag [version]`
|
||||
- Push the tag: `git push --tags`
|
||||
- Create a [release in GitHub](https://github.com/microsoft/tslib/releases)
|
||||
- Run the [publish to npm](https://github.com/microsoft/tslib/actions?query=workflow%3A%22Publish+to+NPM%22) workflow
|
||||
|
||||
Done.
|
||||
|
||||
# Contribute
|
||||
|
||||
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
|
||||
|
||||
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
|
||||
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
|
||||
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
|
||||
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
|
||||
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
|
||||
|
||||
# Documentation
|
||||
|
||||
* [Quick tutorial](http://www.typescriptlang.org/Tutorial)
|
||||
* [Programming handbook](http://www.typescriptlang.org/Handbook)
|
||||
* [Homepage](http://www.typescriptlang.org/)
|
||||
41
node_modules/graphql-tag/node_modules/tslib/SECURITY.md
generated
vendored
Normal file
41
node_modules/graphql-tag/node_modules/tslib/SECURITY.md
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK -->
|
||||
|
||||
## Security
|
||||
|
||||
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
|
||||
|
||||
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
|
||||
|
||||
## Reporting Security Issues
|
||||
|
||||
**Please do not report security vulnerabilities through public GitHub issues.**
|
||||
|
||||
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
|
||||
|
||||
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
|
||||
|
||||
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
|
||||
|
||||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||
|
||||
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
||||
* Full paths of source file(s) related to the manifestation of the issue
|
||||
* The location of the affected source code (tag/branch/commit or direct URL)
|
||||
* Any special configuration required to reproduce the issue
|
||||
* Step-by-step instructions to reproduce the issue
|
||||
* Proof-of-concept or exploit code (if possible)
|
||||
* Impact of the issue, including how an attacker might exploit the issue
|
||||
|
||||
This information will help us triage your report more quickly.
|
||||
|
||||
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
|
||||
|
||||
## Preferred Languages
|
||||
|
||||
We prefer all communications to be in English.
|
||||
|
||||
## Policy
|
||||
|
||||
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
|
||||
|
||||
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
||||
37
node_modules/graphql-tag/node_modules/tslib/modules/index.d.ts
generated
vendored
Normal file
37
node_modules/graphql-tag/node_modules/tslib/modules/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
// Note: named reexports are used instead of `export *` because
|
||||
// TypeScript itself doesn't resolve the `export *` when checking
|
||||
// if a particular helper exists.
|
||||
export {
|
||||
__extends,
|
||||
__assign,
|
||||
__rest,
|
||||
__decorate,
|
||||
__param,
|
||||
__esDecorate,
|
||||
__runInitializers,
|
||||
__propKey,
|
||||
__setFunctionName,
|
||||
__metadata,
|
||||
__awaiter,
|
||||
__generator,
|
||||
__exportStar,
|
||||
__values,
|
||||
__read,
|
||||
__spread,
|
||||
__spreadArrays,
|
||||
__spreadArray,
|
||||
__await,
|
||||
__asyncGenerator,
|
||||
__asyncDelegator,
|
||||
__asyncValues,
|
||||
__makeTemplateObject,
|
||||
__importStar,
|
||||
__importDefault,
|
||||
__classPrivateFieldGet,
|
||||
__classPrivateFieldSet,
|
||||
__classPrivateFieldIn,
|
||||
__createBinding,
|
||||
__addDisposableResource,
|
||||
__disposeResources,
|
||||
} from '../tslib.js';
|
||||
export * as default from '../tslib.js';
|
||||
68
node_modules/graphql-tag/node_modules/tslib/modules/index.js
generated
vendored
Normal file
68
node_modules/graphql-tag/node_modules/tslib/modules/index.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
import tslib from '../tslib.js';
|
||||
const {
|
||||
__extends,
|
||||
__assign,
|
||||
__rest,
|
||||
__decorate,
|
||||
__param,
|
||||
__esDecorate,
|
||||
__runInitializers,
|
||||
__propKey,
|
||||
__setFunctionName,
|
||||
__metadata,
|
||||
__awaiter,
|
||||
__generator,
|
||||
__exportStar,
|
||||
__createBinding,
|
||||
__values,
|
||||
__read,
|
||||
__spread,
|
||||
__spreadArrays,
|
||||
__spreadArray,
|
||||
__await,
|
||||
__asyncGenerator,
|
||||
__asyncDelegator,
|
||||
__asyncValues,
|
||||
__makeTemplateObject,
|
||||
__importStar,
|
||||
__importDefault,
|
||||
__classPrivateFieldGet,
|
||||
__classPrivateFieldSet,
|
||||
__classPrivateFieldIn,
|
||||
__addDisposableResource,
|
||||
__disposeResources,
|
||||
} = tslib;
|
||||
export {
|
||||
__extends,
|
||||
__assign,
|
||||
__rest,
|
||||
__decorate,
|
||||
__param,
|
||||
__esDecorate,
|
||||
__runInitializers,
|
||||
__propKey,
|
||||
__setFunctionName,
|
||||
__metadata,
|
||||
__awaiter,
|
||||
__generator,
|
||||
__exportStar,
|
||||
__createBinding,
|
||||
__values,
|
||||
__read,
|
||||
__spread,
|
||||
__spreadArrays,
|
||||
__spreadArray,
|
||||
__await,
|
||||
__asyncGenerator,
|
||||
__asyncDelegator,
|
||||
__asyncValues,
|
||||
__makeTemplateObject,
|
||||
__importStar,
|
||||
__importDefault,
|
||||
__classPrivateFieldGet,
|
||||
__classPrivateFieldSet,
|
||||
__classPrivateFieldIn,
|
||||
__addDisposableResource,
|
||||
__disposeResources,
|
||||
};
|
||||
export default tslib;
|
||||
3
node_modules/graphql-tag/node_modules/tslib/modules/package.json
generated
vendored
Normal file
3
node_modules/graphql-tag/node_modules/tslib/modules/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
47
node_modules/graphql-tag/node_modules/tslib/package.json
generated
vendored
Normal file
47
node_modules/graphql-tag/node_modules/tslib/package.json
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "tslib",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "https://www.typescriptlang.org/",
|
||||
"version": "2.7.0",
|
||||
"license": "0BSD",
|
||||
"description": "Runtime library for TypeScript helper functions",
|
||||
"keywords": [
|
||||
"TypeScript",
|
||||
"Microsoft",
|
||||
"compiler",
|
||||
"language",
|
||||
"javascript",
|
||||
"tslib",
|
||||
"runtime"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/TypeScript/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/tslib.git"
|
||||
},
|
||||
"main": "tslib.js",
|
||||
"module": "tslib.es6.js",
|
||||
"jsnext:main": "tslib.es6.js",
|
||||
"typings": "tslib.d.ts",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"module": {
|
||||
"types": "./modules/index.d.ts",
|
||||
"default": "./tslib.es6.mjs"
|
||||
},
|
||||
"import": {
|
||||
"node": "./modules/index.js",
|
||||
"default": {
|
||||
"types": "./modules/index.d.ts",
|
||||
"default": "./tslib.es6.mjs"
|
||||
}
|
||||
},
|
||||
"default": "./tslib.js"
|
||||
},
|
||||
"./*": "./*",
|
||||
"./": "./"
|
||||
}
|
||||
}
|
||||
453
node_modules/graphql-tag/node_modules/tslib/tslib.d.ts
generated
vendored
Normal file
453
node_modules/graphql-tag/node_modules/tslib/tslib.d.ts
generated
vendored
Normal file
@@ -0,0 +1,453 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
/**
|
||||
* Used to shim class extends.
|
||||
*
|
||||
* @param d The derived class.
|
||||
* @param b The base class.
|
||||
*/
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
|
||||
/**
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
*
|
||||
* @param t The target object to copy to.
|
||||
* @param sources One or more source objects from which to copy properties
|
||||
*/
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
|
||||
/**
|
||||
* Performs a rest spread on an object.
|
||||
*
|
||||
* @param t The source value.
|
||||
* @param propertyNames The property names excluded from the rest spread.
|
||||
*/
|
||||
export declare function __rest(t: any, propertyNames: (string | symbol)[]): any;
|
||||
|
||||
/**
|
||||
* Applies decorators to a target object
|
||||
*
|
||||
* @param decorators The set of decorators to apply.
|
||||
* @param target The target object.
|
||||
* @param key If specified, the own property to apply the decorators to.
|
||||
* @param desc The property descriptor, defaults to fetching the descriptor from the target object.
|
||||
* @experimental
|
||||
*/
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
|
||||
/**
|
||||
* Creates an observing function decorator from a parameter decorator.
|
||||
*
|
||||
* @param paramIndex The parameter index to apply the decorator to.
|
||||
* @param decorator The parameter decorator to apply. Note that the return value is ignored.
|
||||
* @experimental
|
||||
*/
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
|
||||
/**
|
||||
* Applies decorators to a class or class member, following the native ECMAScript decorator specification.
|
||||
* @param ctor For non-field class members, the class constructor. Otherwise, `null`.
|
||||
* @param descriptorIn The `PropertyDescriptor` to use when unable to look up the property from `ctor`.
|
||||
* @param decorators The decorators to apply
|
||||
* @param contextIn The `DecoratorContext` to clone for each decorator application.
|
||||
* @param initializers An array of field initializer mutation functions into which new initializers are written.
|
||||
* @param extraInitializers An array of extra initializer functions into which new initializers are written.
|
||||
*/
|
||||
export declare function __esDecorate(ctor: Function | null, descriptorIn: object | null, decorators: Function[], contextIn: object, initializers: Function[] | null, extraInitializers: Function[]): void;
|
||||
|
||||
/**
|
||||
* Runs field initializers or extra initializers generated by `__esDecorate`.
|
||||
* @param thisArg The `this` argument to use.
|
||||
* @param initializers The array of initializers to evaluate.
|
||||
* @param value The initial value to pass to the initializers.
|
||||
*/
|
||||
export declare function __runInitializers(thisArg: unknown, initializers: Function[], value?: any): any;
|
||||
|
||||
/**
|
||||
* Converts a computed property name into a `string` or `symbol` value.
|
||||
*/
|
||||
export declare function __propKey(x: any): string | symbol;
|
||||
|
||||
/**
|
||||
* Assigns the name of a function derived from the left-hand side of an assignment.
|
||||
* @param f The function to rename.
|
||||
* @param name The new name for the function.
|
||||
* @param prefix A prefix (such as `"get"` or `"set"`) to insert before the name.
|
||||
*/
|
||||
export declare function __setFunctionName(f: Function, name: string | symbol, prefix?: string): Function;
|
||||
|
||||
/**
|
||||
* Creates a decorator that sets metadata.
|
||||
*
|
||||
* @param metadataKey The metadata key
|
||||
* @param metadataValue The metadata value
|
||||
* @experimental
|
||||
*/
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
|
||||
/**
|
||||
* Converts a generator function into a pseudo-async function, by treating each `yield` as an `await`.
|
||||
*
|
||||
* @param thisArg The reference to use as the `this` value in the generator function
|
||||
* @param _arguments The optional arguments array
|
||||
* @param P The optional promise constructor argument, defaults to the `Promise` property of the global object.
|
||||
* @param generator The generator function
|
||||
*/
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
|
||||
/**
|
||||
* Creates an Iterator object using the body as the implementation.
|
||||
*
|
||||
* @param thisArg The reference to use as the `this` value in the function
|
||||
* @param body The generator state-machine based implementation.
|
||||
*
|
||||
* @see [./docs/generator.md]
|
||||
*/
|
||||
export declare function __generator(thisArg: any, body: Function): any;
|
||||
|
||||
/**
|
||||
* Creates bindings for all enumerable properties of `m` on `exports`
|
||||
*
|
||||
* @param m The source object
|
||||
* @param o The `exports` object.
|
||||
*/
|
||||
export declare function __exportStar(m: any, o: any): void;
|
||||
|
||||
/**
|
||||
* Creates a value iterator from an `Iterable` or `ArrayLike` object.
|
||||
*
|
||||
* @param o The object.
|
||||
* @throws {TypeError} If `o` is neither `Iterable`, nor an `ArrayLike`.
|
||||
*/
|
||||
export declare function __values(o: any): any;
|
||||
|
||||
/**
|
||||
* Reads values from an `Iterable` or `ArrayLike` object and returns the resulting array.
|
||||
*
|
||||
* @param o The object to read from.
|
||||
* @param n The maximum number of arguments to read, defaults to `Infinity`.
|
||||
*/
|
||||
export declare function __read(o: any, n?: number): any[];
|
||||
|
||||
/**
|
||||
* Creates an array from iterable spread.
|
||||
*
|
||||
* @param args The Iterable objects to spread.
|
||||
* @deprecated since TypeScript 4.2 - Use `__spreadArray`
|
||||
*/
|
||||
export declare function __spread(...args: any[][]): any[];
|
||||
|
||||
/**
|
||||
* Creates an array from array spread.
|
||||
*
|
||||
* @param args The ArrayLikes to spread into the resulting array.
|
||||
* @deprecated since TypeScript 4.2 - Use `__spreadArray`
|
||||
*/
|
||||
export declare function __spreadArrays(...args: any[][]): any[];
|
||||
|
||||
/**
|
||||
* Spreads the `from` array into the `to` array.
|
||||
*
|
||||
* @param pack Replace empty elements with `undefined`.
|
||||
*/
|
||||
export declare function __spreadArray(to: any[], from: any[], pack?: boolean): any[];
|
||||
|
||||
/**
|
||||
* Creates an object that signals to `__asyncGenerator` that it shouldn't be yielded,
|
||||
* and instead should be awaited and the resulting value passed back to the generator.
|
||||
*
|
||||
* @param v The value to await.
|
||||
*/
|
||||
export declare function __await(v: any): any;
|
||||
|
||||
/**
|
||||
* Converts a generator function into an async generator function, by using `yield __await`
|
||||
* in place of normal `await`.
|
||||
*
|
||||
* @param thisArg The reference to use as the `this` value in the generator function
|
||||
* @param _arguments The optional arguments array
|
||||
* @param generator The generator function
|
||||
*/
|
||||
export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any;
|
||||
|
||||
/**
|
||||
* Used to wrap a potentially async iterator in such a way so that it wraps the result
|
||||
* of calling iterator methods of `o` in `__await` instances, and then yields the awaited values.
|
||||
*
|
||||
* @param o The potentially async iterator.
|
||||
* @returns A synchronous iterator yielding `__await` instances on every odd invocation
|
||||
* and returning the awaited `IteratorResult` passed to `next` every even invocation.
|
||||
*/
|
||||
export declare function __asyncDelegator(o: any): any;
|
||||
|
||||
/**
|
||||
* Creates a value async iterator from an `AsyncIterable`, `Iterable` or `ArrayLike` object.
|
||||
*
|
||||
* @param o The object.
|
||||
* @throws {TypeError} If `o` is neither `AsyncIterable`, `Iterable`, nor an `ArrayLike`.
|
||||
*/
|
||||
export declare function __asyncValues(o: any): any;
|
||||
|
||||
/**
|
||||
* Creates a `TemplateStringsArray` frozen object from the `cooked` and `raw` arrays.
|
||||
*
|
||||
* @param cooked The cooked possibly-sparse array.
|
||||
* @param raw The raw string content.
|
||||
*/
|
||||
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
|
||||
|
||||
/**
|
||||
* Used to shim default and named imports in ECMAScript Modules transpiled to CommonJS.
|
||||
*
|
||||
* ```js
|
||||
* import Default, { Named, Other } from "mod";
|
||||
* // or
|
||||
* import { default as Default, Named, Other } from "mod";
|
||||
* ```
|
||||
*
|
||||
* @param mod The CommonJS module exports object.
|
||||
*/
|
||||
export declare function __importStar<T>(mod: T): T;
|
||||
|
||||
/**
|
||||
* Used to shim default imports in ECMAScript Modules transpiled to CommonJS.
|
||||
*
|
||||
* ```js
|
||||
* import Default from "mod";
|
||||
* ```
|
||||
*
|
||||
* @param mod The CommonJS module exports object.
|
||||
*/
|
||||
export declare function __importDefault<T>(mod: T): T | { default: T };
|
||||
|
||||
/**
|
||||
* Emulates reading a private instance field.
|
||||
*
|
||||
* @param receiver The instance from which to read the private field.
|
||||
* @param state A WeakMap containing the private field value for an instance.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
*
|
||||
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends object, V>(
|
||||
receiver: T,
|
||||
state: { has(o: T): boolean, get(o: T): V | undefined },
|
||||
kind?: "f"
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates reading a private static field.
|
||||
*
|
||||
* @param receiver The object from which to read the private static field.
|
||||
* @param state The class constructor containing the definition of the static field.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The descriptor that holds the static field value.
|
||||
*
|
||||
* @throws {TypeError} If `receiver` is not `state`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
|
||||
receiver: T,
|
||||
state: T,
|
||||
kind: "f",
|
||||
f: { value: V }
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates evaluating a private instance "get" accessor.
|
||||
*
|
||||
* @param receiver The instance on which to evaluate the private "get" accessor.
|
||||
* @param state A WeakSet used to verify an instance supports the private "get" accessor.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The "get" accessor function to evaluate.
|
||||
*
|
||||
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends object, V>(
|
||||
receiver: T,
|
||||
state: { has(o: T): boolean },
|
||||
kind: "a",
|
||||
f: () => V
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates evaluating a private static "get" accessor.
|
||||
*
|
||||
* @param receiver The object on which to evaluate the private static "get" accessor.
|
||||
* @param state The class constructor containing the definition of the static "get" accessor.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The "get" accessor function to evaluate.
|
||||
*
|
||||
* @throws {TypeError} If `receiver` is not `state`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
|
||||
receiver: T,
|
||||
state: T,
|
||||
kind: "a",
|
||||
f: () => V
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates reading a private instance method.
|
||||
*
|
||||
* @param receiver The instance from which to read a private method.
|
||||
* @param state A WeakSet used to verify an instance supports the private method.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The function to return as the private instance method.
|
||||
*
|
||||
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends object, V extends (...args: any[]) => unknown>(
|
||||
receiver: T,
|
||||
state: { has(o: T): boolean },
|
||||
kind: "m",
|
||||
f: V
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates reading a private static method.
|
||||
*
|
||||
* @param receiver The object from which to read the private static method.
|
||||
* @param state The class constructor containing the definition of the static method.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The function to return as the private static method.
|
||||
*
|
||||
* @throws {TypeError} If `receiver` is not `state`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V extends (...args: any[]) => unknown>(
|
||||
receiver: T,
|
||||
state: T,
|
||||
kind: "m",
|
||||
f: V
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates writing to a private instance field.
|
||||
*
|
||||
* @param receiver The instance on which to set a private field value.
|
||||
* @param state A WeakMap used to store the private field value for an instance.
|
||||
* @param value The value to store in the private field.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
*
|
||||
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
|
||||
*/
|
||||
export declare function __classPrivateFieldSet<T extends object, V>(
|
||||
receiver: T,
|
||||
state: { has(o: T): boolean, set(o: T, value: V): unknown },
|
||||
value: V,
|
||||
kind?: "f"
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates writing to a private static field.
|
||||
*
|
||||
* @param receiver The object on which to set the private static field.
|
||||
* @param state The class constructor containing the definition of the private static field.
|
||||
* @param value The value to store in the private field.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The descriptor that holds the static field value.
|
||||
*
|
||||
* @throws {TypeError} If `receiver` is not `state`.
|
||||
*/
|
||||
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
|
||||
receiver: T,
|
||||
state: T,
|
||||
value: V,
|
||||
kind: "f",
|
||||
f: { value: V }
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates writing to a private instance "set" accessor.
|
||||
*
|
||||
* @param receiver The instance on which to evaluate the private instance "set" accessor.
|
||||
* @param state A WeakSet used to verify an instance supports the private "set" accessor.
|
||||
* @param value The value to store in the private accessor.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The "set" accessor function to evaluate.
|
||||
*
|
||||
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
|
||||
*/
|
||||
export declare function __classPrivateFieldSet<T extends object, V>(
|
||||
receiver: T,
|
||||
state: { has(o: T): boolean },
|
||||
value: V,
|
||||
kind: "a",
|
||||
f: (v: V) => void
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates writing to a private static "set" accessor.
|
||||
*
|
||||
* @param receiver The object on which to evaluate the private static "set" accessor.
|
||||
* @param state The class constructor containing the definition of the static "set" accessor.
|
||||
* @param value The value to store in the private field.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The "set" accessor function to evaluate.
|
||||
*
|
||||
* @throws {TypeError} If `receiver` is not `state`.
|
||||
*/
|
||||
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
|
||||
receiver: T,
|
||||
state: T,
|
||||
value: V,
|
||||
kind: "a",
|
||||
f: (v: V) => void
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Checks for the existence of a private field/method/accessor.
|
||||
*
|
||||
* @param state The class constructor containing the static member, or the WeakMap or WeakSet associated with a private instance member.
|
||||
* @param receiver The object for which to test the presence of the private member.
|
||||
*/
|
||||
export declare function __classPrivateFieldIn(
|
||||
state: (new (...args: any[]) => unknown) | { has(o: any): boolean },
|
||||
receiver: unknown,
|
||||
): boolean;
|
||||
|
||||
/**
|
||||
* Creates a re-export binding on `object` with key `objectKey` that references `target[key]`.
|
||||
*
|
||||
* @param object The local `exports` object.
|
||||
* @param target The object to re-export from.
|
||||
* @param key The property key of `target` to re-export.
|
||||
* @param objectKey The property key to re-export as. Defaults to `key`.
|
||||
*/
|
||||
export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void;
|
||||
|
||||
/**
|
||||
* Adds a disposable resource to a resource-tracking environment object.
|
||||
* @param env A resource-tracking environment object.
|
||||
* @param value Either a Disposable or AsyncDisposable object, `null`, or `undefined`.
|
||||
* @param async When `true`, `AsyncDisposable` resources can be added. When `false`, `AsyncDisposable` resources cannot be added.
|
||||
* @returns The {@link value} argument.
|
||||
*
|
||||
* @throws {TypeError} If {@link value} is not an object, or if either `Symbol.dispose` or `Symbol.asyncDispose` are not
|
||||
* defined, or if {@link value} does not have an appropriate `Symbol.dispose` or `Symbol.asyncDispose` method.
|
||||
*/
|
||||
export declare function __addDisposableResource<T>(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }, value: T, async: boolean): T;
|
||||
|
||||
/**
|
||||
* Disposes all resources in a resource-tracking environment object.
|
||||
* @param env A resource-tracking environment object.
|
||||
* @returns A {@link Promise} if any resources in the environment were marked as `async` when added; otherwise, `void`.
|
||||
*
|
||||
* @throws {SuppressedError} if an error thrown during disposal would have suppressed a prior error from disposal or the
|
||||
* error recorded in the resource-tracking environment object.
|
||||
* @seealso {@link __addDisposableResource}
|
||||
*/
|
||||
export declare function __disposeResources(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }): any;
|
||||
1
node_modules/graphql-tag/node_modules/tslib/tslib.es6.html
generated
vendored
Normal file
1
node_modules/graphql-tag/node_modules/tslib/tslib.es6.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<script src="tslib.es6.js"></script>
|
||||
379
node_modules/graphql-tag/node_modules/tslib/tslib.es6.js
generated
vendored
Normal file
379
node_modules/graphql-tag/node_modules/tslib/tslib.es6.js
generated
vendored
Normal file
@@ -0,0 +1,379 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
||||
|
||||
var extendStatics = function(d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
|
||||
export function __extends(d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
}
|
||||
|
||||
export var __assign = function() {
|
||||
__assign = Object.assign || function __assign(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
return __assign.apply(this, arguments);
|
||||
}
|
||||
|
||||
export function __rest(s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
export function __decorate(decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
}
|
||||
|
||||
export function __param(paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
}
|
||||
|
||||
export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
||||
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
||||
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
||||
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
||||
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
||||
var _, done = false;
|
||||
for (var i = decorators.length - 1; i >= 0; i--) {
|
||||
var context = {};
|
||||
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
||||
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
||||
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
||||
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
||||
if (kind === "accessor") {
|
||||
if (result === void 0) continue;
|
||||
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
||||
if (_ = accept(result.get)) descriptor.get = _;
|
||||
if (_ = accept(result.set)) descriptor.set = _;
|
||||
if (_ = accept(result.init)) initializers.unshift(_);
|
||||
}
|
||||
else if (_ = accept(result)) {
|
||||
if (kind === "field") initializers.unshift(_);
|
||||
else descriptor[key] = _;
|
||||
}
|
||||
}
|
||||
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
||||
done = true;
|
||||
};
|
||||
|
||||
export function __runInitializers(thisArg, initializers, value) {
|
||||
var useValue = arguments.length > 2;
|
||||
for (var i = 0; i < initializers.length; i++) {
|
||||
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
||||
}
|
||||
return useValue ? value : void 0;
|
||||
};
|
||||
|
||||
export function __propKey(x) {
|
||||
return typeof x === "symbol" ? x : "".concat(x);
|
||||
};
|
||||
|
||||
export function __setFunctionName(f, name, prefix) {
|
||||
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
||||
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
||||
};
|
||||
|
||||
export function __metadata(metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
}
|
||||
|
||||
export function __awaiter(thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
}
|
||||
|
||||
export function __generator(thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
||||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
}
|
||||
|
||||
export var __createBinding = Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
});
|
||||
|
||||
export function __exportStar(m, o) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
||||
}
|
||||
|
||||
export function __values(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
}
|
||||
|
||||
export function __read(o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export function __spread() {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export function __spreadArrays() {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
}
|
||||
|
||||
export function __spreadArray(to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
}
|
||||
|
||||
export function __await(v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
}
|
||||
|
||||
export function __asyncGenerator(thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
||||
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
}
|
||||
|
||||
export function __asyncDelegator(o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
||||
}
|
||||
|
||||
export function __asyncValues(o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
}
|
||||
|
||||
export function __makeTemplateObject(cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
var __setModuleDefault = Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
};
|
||||
|
||||
export function __importStar(mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
}
|
||||
|
||||
export function __importDefault(mod) {
|
||||
return (mod && mod.__esModule) ? mod : { default: mod };
|
||||
}
|
||||
|
||||
export function __classPrivateFieldGet(receiver, state, kind, f) {
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
||||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
||||
}
|
||||
|
||||
export function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
||||
if (kind === "m") throw new TypeError("Private method is not writable");
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
||||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
||||
}
|
||||
|
||||
export function __classPrivateFieldIn(state, receiver) {
|
||||
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
|
||||
return typeof state === "function" ? receiver === state : state.has(receiver);
|
||||
}
|
||||
|
||||
export function __addDisposableResource(env, value, async) {
|
||||
if (value !== null && value !== void 0) {
|
||||
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
||||
var dispose, inner;
|
||||
if (async) {
|
||||
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
||||
dispose = value[Symbol.asyncDispose];
|
||||
}
|
||||
if (dispose === void 0) {
|
||||
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
||||
dispose = value[Symbol.dispose];
|
||||
if (async) inner = dispose;
|
||||
}
|
||||
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
||||
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
||||
env.stack.push({ value: value, dispose: dispose, async: async });
|
||||
}
|
||||
else if (async) {
|
||||
env.stack.push({ async: true });
|
||||
}
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
||||
var e = new Error(message);
|
||||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
||||
};
|
||||
|
||||
export function __disposeResources(env) {
|
||||
function fail(e) {
|
||||
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
||||
env.hasError = true;
|
||||
}
|
||||
var r, s = 0;
|
||||
function next() {
|
||||
while (r = env.stack.pop()) {
|
||||
try {
|
||||
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
||||
if (r.dispose) {
|
||||
var result = r.dispose.call(r.value);
|
||||
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
||||
}
|
||||
else s |= 1;
|
||||
}
|
||||
catch (e) {
|
||||
fail(e);
|
||||
}
|
||||
}
|
||||
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
||||
if (env.hasError) throw env.error;
|
||||
}
|
||||
return next();
|
||||
}
|
||||
|
||||
export default {
|
||||
__extends: __extends,
|
||||
__assign: __assign,
|
||||
__rest: __rest,
|
||||
__decorate: __decorate,
|
||||
__param: __param,
|
||||
__metadata: __metadata,
|
||||
__awaiter: __awaiter,
|
||||
__generator: __generator,
|
||||
__createBinding: __createBinding,
|
||||
__exportStar: __exportStar,
|
||||
__values: __values,
|
||||
__read: __read,
|
||||
__spread: __spread,
|
||||
__spreadArrays: __spreadArrays,
|
||||
__spreadArray: __spreadArray,
|
||||
__await: __await,
|
||||
__asyncGenerator: __asyncGenerator,
|
||||
__asyncDelegator: __asyncDelegator,
|
||||
__asyncValues: __asyncValues,
|
||||
__makeTemplateObject: __makeTemplateObject,
|
||||
__importStar: __importStar,
|
||||
__importDefault: __importDefault,
|
||||
__classPrivateFieldGet: __classPrivateFieldGet,
|
||||
__classPrivateFieldSet: __classPrivateFieldSet,
|
||||
__classPrivateFieldIn: __classPrivateFieldIn,
|
||||
__addDisposableResource: __addDisposableResource,
|
||||
__disposeResources: __disposeResources,
|
||||
};
|
||||
378
node_modules/graphql-tag/node_modules/tslib/tslib.es6.mjs
generated
vendored
Normal file
378
node_modules/graphql-tag/node_modules/tslib/tslib.es6.mjs
generated
vendored
Normal file
@@ -0,0 +1,378 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
||||
|
||||
var extendStatics = function(d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
|
||||
export function __extends(d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
}
|
||||
|
||||
export var __assign = function() {
|
||||
__assign = Object.assign || function __assign(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
return __assign.apply(this, arguments);
|
||||
}
|
||||
|
||||
export function __rest(s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
export function __decorate(decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
}
|
||||
|
||||
export function __param(paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
}
|
||||
|
||||
export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
||||
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
||||
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
||||
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
||||
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
||||
var _, done = false;
|
||||
for (var i = decorators.length - 1; i >= 0; i--) {
|
||||
var context = {};
|
||||
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
||||
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
||||
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
||||
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
||||
if (kind === "accessor") {
|
||||
if (result === void 0) continue;
|
||||
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
||||
if (_ = accept(result.get)) descriptor.get = _;
|
||||
if (_ = accept(result.set)) descriptor.set = _;
|
||||
if (_ = accept(result.init)) initializers.unshift(_);
|
||||
}
|
||||
else if (_ = accept(result)) {
|
||||
if (kind === "field") initializers.unshift(_);
|
||||
else descriptor[key] = _;
|
||||
}
|
||||
}
|
||||
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
||||
done = true;
|
||||
};
|
||||
|
||||
export function __runInitializers(thisArg, initializers, value) {
|
||||
var useValue = arguments.length > 2;
|
||||
for (var i = 0; i < initializers.length; i++) {
|
||||
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
||||
}
|
||||
return useValue ? value : void 0;
|
||||
};
|
||||
|
||||
export function __propKey(x) {
|
||||
return typeof x === "symbol" ? x : "".concat(x);
|
||||
};
|
||||
|
||||
export function __setFunctionName(f, name, prefix) {
|
||||
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
||||
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
||||
};
|
||||
|
||||
export function __metadata(metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
}
|
||||
|
||||
export function __awaiter(thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
}
|
||||
|
||||
export function __generator(thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
||||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
}
|
||||
|
||||
export var __createBinding = Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
});
|
||||
|
||||
export function __exportStar(m, o) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
||||
}
|
||||
|
||||
export function __values(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
}
|
||||
|
||||
export function __read(o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export function __spread() {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export function __spreadArrays() {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
}
|
||||
|
||||
export function __spreadArray(to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
}
|
||||
|
||||
export function __await(v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
}
|
||||
|
||||
export function __asyncGenerator(thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
||||
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
}
|
||||
|
||||
export function __asyncDelegator(o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
||||
}
|
||||
|
||||
export function __asyncValues(o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
}
|
||||
|
||||
export function __makeTemplateObject(cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
var __setModuleDefault = Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
};
|
||||
|
||||
export function __importStar(mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
}
|
||||
|
||||
export function __importDefault(mod) {
|
||||
return (mod && mod.__esModule) ? mod : { default: mod };
|
||||
}
|
||||
|
||||
export function __classPrivateFieldGet(receiver, state, kind, f) {
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
||||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
||||
}
|
||||
|
||||
export function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
||||
if (kind === "m") throw new TypeError("Private method is not writable");
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
||||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
||||
}
|
||||
|
||||
export function __classPrivateFieldIn(state, receiver) {
|
||||
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
|
||||
return typeof state === "function" ? receiver === state : state.has(receiver);
|
||||
}
|
||||
|
||||
export function __addDisposableResource(env, value, async) {
|
||||
if (value !== null && value !== void 0) {
|
||||
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
||||
var dispose, inner;
|
||||
if (async) {
|
||||
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
||||
dispose = value[Symbol.asyncDispose];
|
||||
}
|
||||
if (dispose === void 0) {
|
||||
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
||||
dispose = value[Symbol.dispose];
|
||||
if (async) inner = dispose;
|
||||
}
|
||||
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
||||
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
||||
env.stack.push({ value: value, dispose: dispose, async: async });
|
||||
}
|
||||
else if (async) {
|
||||
env.stack.push({ async: true });
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
||||
var e = new Error(message);
|
||||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
||||
};
|
||||
|
||||
export function __disposeResources(env) {
|
||||
function fail(e) {
|
||||
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
||||
env.hasError = true;
|
||||
}
|
||||
var r, s = 0;
|
||||
function next() {
|
||||
while (r = env.stack.pop()) {
|
||||
try {
|
||||
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
||||
if (r.dispose) {
|
||||
var result = r.dispose.call(r.value);
|
||||
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
||||
}
|
||||
else s |= 1;
|
||||
}
|
||||
catch (e) {
|
||||
fail(e);
|
||||
}
|
||||
}
|
||||
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
||||
if (env.hasError) throw env.error;
|
||||
}
|
||||
return next();
|
||||
}
|
||||
|
||||
export default {
|
||||
__extends,
|
||||
__assign,
|
||||
__rest,
|
||||
__decorate,
|
||||
__param,
|
||||
__metadata,
|
||||
__awaiter,
|
||||
__generator,
|
||||
__createBinding,
|
||||
__exportStar,
|
||||
__values,
|
||||
__read,
|
||||
__spread,
|
||||
__spreadArrays,
|
||||
__spreadArray,
|
||||
__await,
|
||||
__asyncGenerator,
|
||||
__asyncDelegator,
|
||||
__asyncValues,
|
||||
__makeTemplateObject,
|
||||
__importStar,
|
||||
__importDefault,
|
||||
__classPrivateFieldGet,
|
||||
__classPrivateFieldSet,
|
||||
__classPrivateFieldIn,
|
||||
__addDisposableResource,
|
||||
__disposeResources,
|
||||
};
|
||||
1
node_modules/graphql-tag/node_modules/tslib/tslib.html
generated
vendored
Normal file
1
node_modules/graphql-tag/node_modules/tslib/tslib.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<script src="tslib.js"></script>
|
||||
429
node_modules/graphql-tag/node_modules/tslib/tslib.js
generated
vendored
Normal file
429
node_modules/graphql-tag/node_modules/tslib/tslib.js
generated
vendored
Normal file
@@ -0,0 +1,429 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
/* global global, define, Symbol, Reflect, Promise, SuppressedError, Iterator */
|
||||
var __extends;
|
||||
var __assign;
|
||||
var __rest;
|
||||
var __decorate;
|
||||
var __param;
|
||||
var __esDecorate;
|
||||
var __runInitializers;
|
||||
var __propKey;
|
||||
var __setFunctionName;
|
||||
var __metadata;
|
||||
var __awaiter;
|
||||
var __generator;
|
||||
var __exportStar;
|
||||
var __values;
|
||||
var __read;
|
||||
var __spread;
|
||||
var __spreadArrays;
|
||||
var __spreadArray;
|
||||
var __await;
|
||||
var __asyncGenerator;
|
||||
var __asyncDelegator;
|
||||
var __asyncValues;
|
||||
var __makeTemplateObject;
|
||||
var __importStar;
|
||||
var __importDefault;
|
||||
var __classPrivateFieldGet;
|
||||
var __classPrivateFieldSet;
|
||||
var __classPrivateFieldIn;
|
||||
var __createBinding;
|
||||
var __addDisposableResource;
|
||||
var __disposeResources;
|
||||
(function (factory) {
|
||||
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
|
||||
}
|
||||
else if (typeof module === "object" && typeof module.exports === "object") {
|
||||
factory(createExporter(root, createExporter(module.exports)));
|
||||
}
|
||||
else {
|
||||
factory(createExporter(root));
|
||||
}
|
||||
function createExporter(exports, previous) {
|
||||
if (exports !== root) {
|
||||
if (typeof Object.create === "function") {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
}
|
||||
else {
|
||||
exports.__esModule = true;
|
||||
}
|
||||
}
|
||||
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
|
||||
}
|
||||
})
|
||||
(function (exporter) {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
|
||||
__extends = function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
|
||||
__assign = Object.assign || function (t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__rest = function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__decorate = function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
|
||||
__param = function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
|
||||
__esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
||||
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
||||
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
||||
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
||||
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
||||
var _, done = false;
|
||||
for (var i = decorators.length - 1; i >= 0; i--) {
|
||||
var context = {};
|
||||
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
||||
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
||||
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
||||
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
||||
if (kind === "accessor") {
|
||||
if (result === void 0) continue;
|
||||
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
||||
if (_ = accept(result.get)) descriptor.get = _;
|
||||
if (_ = accept(result.set)) descriptor.set = _;
|
||||
if (_ = accept(result.init)) initializers.unshift(_);
|
||||
}
|
||||
else if (_ = accept(result)) {
|
||||
if (kind === "field") initializers.unshift(_);
|
||||
else descriptor[key] = _;
|
||||
}
|
||||
}
|
||||
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
||||
done = true;
|
||||
};
|
||||
|
||||
__runInitializers = function (thisArg, initializers, value) {
|
||||
var useValue = arguments.length > 2;
|
||||
for (var i = 0; i < initializers.length; i++) {
|
||||
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
||||
}
|
||||
return useValue ? value : void 0;
|
||||
};
|
||||
|
||||
__propKey = function (x) {
|
||||
return typeof x === "symbol" ? x : "".concat(x);
|
||||
};
|
||||
|
||||
__setFunctionName = function (f, name, prefix) {
|
||||
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
||||
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
||||
};
|
||||
|
||||
__metadata = function (metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
};
|
||||
|
||||
__awaiter = function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
__generator = function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
||||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
|
||||
__exportStar = function(m, o) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
||||
};
|
||||
|
||||
__createBinding = Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
});
|
||||
|
||||
__values = function (o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
|
||||
__read = function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
__spread = function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
__spreadArrays = function () {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
__spreadArray = function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
|
||||
__await = function (v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
};
|
||||
|
||||
__asyncGenerator = function (thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
||||
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
};
|
||||
|
||||
__asyncDelegator = function (o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
||||
};
|
||||
|
||||
__asyncValues = function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
|
||||
__makeTemplateObject = function (cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
var __setModuleDefault = Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
};
|
||||
|
||||
__importStar = function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
|
||||
__importDefault = function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
__classPrivateFieldGet = function (receiver, state, kind, f) {
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
||||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
||||
};
|
||||
|
||||
__classPrivateFieldSet = function (receiver, state, value, kind, f) {
|
||||
if (kind === "m") throw new TypeError("Private method is not writable");
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
||||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
||||
};
|
||||
|
||||
__classPrivateFieldIn = function (state, receiver) {
|
||||
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
|
||||
return typeof state === "function" ? receiver === state : state.has(receiver);
|
||||
};
|
||||
|
||||
__addDisposableResource = function (env, value, async) {
|
||||
if (value !== null && value !== void 0) {
|
||||
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
||||
var dispose, inner;
|
||||
if (async) {
|
||||
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
||||
dispose = value[Symbol.asyncDispose];
|
||||
}
|
||||
if (dispose === void 0) {
|
||||
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
||||
dispose = value[Symbol.dispose];
|
||||
if (async) inner = dispose;
|
||||
}
|
||||
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
||||
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
||||
env.stack.push({ value: value, dispose: dispose, async: async });
|
||||
}
|
||||
else if (async) {
|
||||
env.stack.push({ async: true });
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
||||
var e = new Error(message);
|
||||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
||||
};
|
||||
|
||||
__disposeResources = function (env) {
|
||||
function fail(e) {
|
||||
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
||||
env.hasError = true;
|
||||
}
|
||||
var r, s = 0;
|
||||
function next() {
|
||||
while (r = env.stack.pop()) {
|
||||
try {
|
||||
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
||||
if (r.dispose) {
|
||||
var result = r.dispose.call(r.value);
|
||||
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
||||
}
|
||||
else s |= 1;
|
||||
}
|
||||
catch (e) {
|
||||
fail(e);
|
||||
}
|
||||
}
|
||||
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
||||
if (env.hasError) throw env.error;
|
||||
}
|
||||
return next();
|
||||
};
|
||||
|
||||
exporter("__extends", __extends);
|
||||
exporter("__assign", __assign);
|
||||
exporter("__rest", __rest);
|
||||
exporter("__decorate", __decorate);
|
||||
exporter("__param", __param);
|
||||
exporter("__esDecorate", __esDecorate);
|
||||
exporter("__runInitializers", __runInitializers);
|
||||
exporter("__propKey", __propKey);
|
||||
exporter("__setFunctionName", __setFunctionName);
|
||||
exporter("__metadata", __metadata);
|
||||
exporter("__awaiter", __awaiter);
|
||||
exporter("__generator", __generator);
|
||||
exporter("__exportStar", __exportStar);
|
||||
exporter("__createBinding", __createBinding);
|
||||
exporter("__values", __values);
|
||||
exporter("__read", __read);
|
||||
exporter("__spread", __spread);
|
||||
exporter("__spreadArrays", __spreadArrays);
|
||||
exporter("__spreadArray", __spreadArray);
|
||||
exporter("__await", __await);
|
||||
exporter("__asyncGenerator", __asyncGenerator);
|
||||
exporter("__asyncDelegator", __asyncDelegator);
|
||||
exporter("__asyncValues", __asyncValues);
|
||||
exporter("__makeTemplateObject", __makeTemplateObject);
|
||||
exporter("__importStar", __importStar);
|
||||
exporter("__importDefault", __importDefault);
|
||||
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
|
||||
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
|
||||
exporter("__classPrivateFieldIn", __classPrivateFieldIn);
|
||||
exporter("__addDisposableResource", __addDisposableResource);
|
||||
exporter("__disposeResources", __disposeResources);
|
||||
});
|
||||
59
node_modules/graphql-tag/package.json
generated
vendored
Normal file
59
node_modules/graphql-tag/package.json
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"name": "graphql-tag",
|
||||
"version": "2.12.6",
|
||||
"description": "A JavaScript template literal tag that parses GraphQL queries",
|
||||
"main": "./main.js",
|
||||
"module": "./lib/index.js",
|
||||
"jsnext:main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"prebuild": "rimraf lib",
|
||||
"build": "tsc && rollup -c && npm run flow",
|
||||
"flow": "cp src/index.js.flow lib/graphql-tag.umd.js.flow",
|
||||
"test": "npm run test:ts3 && npm run test:ts4",
|
||||
"test:ts3": "npm i typescript@3.7.x graphql@15.x.x && npm run test:mocha",
|
||||
"test:ts4": "npm i typescript@4.x.x graphql@16.x.x && npm run test:mocha",
|
||||
"test:mocha": "npm run build && mocha lib/tests.cjs.js",
|
||||
"prepublish": "npm run build"
|
||||
},
|
||||
"files": [
|
||||
"lib/",
|
||||
"src/",
|
||||
"loader.js",
|
||||
"main.js"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/apollographql/graphql-tag.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/apollographql/graphql-tag/issues"
|
||||
},
|
||||
"homepage": "https://github.com/apollographql/graphql-tag#readme",
|
||||
"dependencies": {
|
||||
"tslib": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.2.14",
|
||||
"@types/mocha": "^8.2.0",
|
||||
"@types/node": "^14.14.22",
|
||||
"chai": "^4.2.0",
|
||||
"graphql": "^16.0.1",
|
||||
"mocha": "^9.0.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.33.1",
|
||||
"rollup-plugin-sourcemaps": "^0.6.3",
|
||||
"source-map-support": "^0.5.19",
|
||||
"test-all-versions": "^5.0.1",
|
||||
"typescript": "^4.4.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"graphql": "^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
}
|
||||
7
node_modules/graphql-tag/src/index.js.flow
generated
vendored
Normal file
7
node_modules/graphql-tag/src/index.js.flow
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// @flow
|
||||
|
||||
import type { DocumentNode } from 'graphql';
|
||||
|
||||
declare export default function gql(literals: any, ...placeholders: any[]): DocumentNode;
|
||||
declare export function resetCaches(): void;
|
||||
declare export function disableFragmentWarnings(): void;
|
||||
174
node_modules/graphql-tag/src/index.ts
generated
vendored
Normal file
174
node_modules/graphql-tag/src/index.ts
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
import { parse } from 'graphql';
|
||||
|
||||
import {
|
||||
DocumentNode,
|
||||
DefinitionNode,
|
||||
Location,
|
||||
} from 'graphql/language/ast';
|
||||
|
||||
// A map docString -> graphql document
|
||||
const docCache = new Map<string, DocumentNode>();
|
||||
|
||||
// A map fragmentName -> [normalized source]
|
||||
const fragmentSourceMap = new Map<string, Set<string>>();
|
||||
|
||||
let printFragmentWarnings = true;
|
||||
let experimentalFragmentVariables = false;
|
||||
|
||||
// Strip insignificant whitespace
|
||||
// Note that this could do a lot more, such as reorder fields etc.
|
||||
function normalize(string: string) {
|
||||
return string.replace(/[\s,]+/g, ' ').trim();
|
||||
}
|
||||
|
||||
function cacheKeyFromLoc(loc: Location) {
|
||||
return normalize(loc.source.body.substring(loc.start, loc.end));
|
||||
}
|
||||
|
||||
// Take a unstripped parsed document (query/mutation or even fragment), and
|
||||
// check all fragment definitions, checking for name->source uniqueness.
|
||||
// We also want to make sure only unique fragments exist in the document.
|
||||
function processFragments(ast: DocumentNode) {
|
||||
const seenKeys = new Set<string>();
|
||||
const definitions: DefinitionNode[] = [];
|
||||
|
||||
ast.definitions.forEach(fragmentDefinition => {
|
||||
if (fragmentDefinition.kind === 'FragmentDefinition') {
|
||||
var fragmentName = fragmentDefinition.name.value;
|
||||
var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc!);
|
||||
|
||||
// We know something about this fragment
|
||||
let sourceKeySet = fragmentSourceMap.get(fragmentName)!;
|
||||
if (sourceKeySet && !sourceKeySet.has(sourceKey)) {
|
||||
// this is a problem because the app developer is trying to register another fragment with
|
||||
// the same name as one previously registered. So, we tell them about it.
|
||||
if (printFragmentWarnings) {
|
||||
console.warn("Warning: fragment with name " + fragmentName + " already exists.\n"
|
||||
+ "graphql-tag enforces all fragment names across your application to be unique; read more about\n"
|
||||
+ "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names");
|
||||
}
|
||||
} else if (!sourceKeySet) {
|
||||
fragmentSourceMap.set(fragmentName, sourceKeySet = new Set);
|
||||
}
|
||||
|
||||
sourceKeySet.add(sourceKey);
|
||||
|
||||
if (!seenKeys.has(sourceKey)) {
|
||||
seenKeys.add(sourceKey);
|
||||
definitions.push(fragmentDefinition);
|
||||
}
|
||||
} else {
|
||||
definitions.push(fragmentDefinition);
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
...ast,
|
||||
definitions,
|
||||
};
|
||||
}
|
||||
|
||||
function stripLoc(doc: DocumentNode) {
|
||||
const workSet = new Set<Record<string, any>>(doc.definitions);
|
||||
|
||||
workSet.forEach(node => {
|
||||
if (node.loc) delete node.loc;
|
||||
Object.keys(node).forEach(key => {
|
||||
const value = node[key];
|
||||
if (value && typeof value === 'object') {
|
||||
workSet.add(value);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const loc = doc.loc as Record<string, any>;
|
||||
if (loc) {
|
||||
delete loc.startToken;
|
||||
delete loc.endToken;
|
||||
}
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
function parseDocument(source: string) {
|
||||
var cacheKey = normalize(source);
|
||||
if (!docCache.has(cacheKey)) {
|
||||
const parsed = parse(source, {
|
||||
experimentalFragmentVariables,
|
||||
allowLegacyFragmentVariables: experimentalFragmentVariables,
|
||||
} as any);
|
||||
if (!parsed || parsed.kind !== 'Document') {
|
||||
throw new Error('Not a valid GraphQL document.');
|
||||
}
|
||||
docCache.set(
|
||||
cacheKey,
|
||||
// check that all "new" fragments inside the documents are consistent with
|
||||
// existing fragments of the same name
|
||||
stripLoc(processFragments(parsed)),
|
||||
);
|
||||
}
|
||||
return docCache.get(cacheKey)!;
|
||||
}
|
||||
|
||||
// XXX This should eventually disallow arbitrary string interpolation, like Relay does
|
||||
export function gql(
|
||||
literals: string | readonly string[],
|
||||
...args: any[]
|
||||
) {
|
||||
|
||||
if (typeof literals === 'string') {
|
||||
literals = [literals];
|
||||
}
|
||||
|
||||
let result = literals[0];
|
||||
|
||||
args.forEach((arg, i) => {
|
||||
if (arg && arg.kind === 'Document') {
|
||||
result += arg.loc.source.body;
|
||||
} else {
|
||||
result += arg;
|
||||
}
|
||||
result += literals[i + 1];
|
||||
});
|
||||
|
||||
return parseDocument(result);
|
||||
}
|
||||
|
||||
export function resetCaches() {
|
||||
docCache.clear();
|
||||
fragmentSourceMap.clear();
|
||||
}
|
||||
|
||||
export function disableFragmentWarnings() {
|
||||
printFragmentWarnings = false;
|
||||
}
|
||||
|
||||
export function enableExperimentalFragmentVariables() {
|
||||
experimentalFragmentVariables = true;
|
||||
}
|
||||
|
||||
export function disableExperimentalFragmentVariables() {
|
||||
experimentalFragmentVariables = false;
|
||||
}
|
||||
|
||||
const extras = {
|
||||
gql,
|
||||
resetCaches,
|
||||
disableFragmentWarnings,
|
||||
enableExperimentalFragmentVariables,
|
||||
disableExperimentalFragmentVariables,
|
||||
};
|
||||
|
||||
export namespace gql {
|
||||
export const {
|
||||
gql,
|
||||
resetCaches,
|
||||
disableFragmentWarnings,
|
||||
enableExperimentalFragmentVariables,
|
||||
disableExperimentalFragmentVariables,
|
||||
} = extras;
|
||||
}
|
||||
|
||||
gql.default = gql;
|
||||
|
||||
export default gql;
|
||||
491
node_modules/graphql-tag/src/tests.ts
generated
vendored
Normal file
491
node_modules/graphql-tag/src/tests.ts
generated
vendored
Normal file
@@ -0,0 +1,491 @@
|
||||
import 'source-map-support/register';
|
||||
|
||||
import { assert } from 'chai';
|
||||
import { DocumentNode, FragmentDefinitionNode } from 'graphql';
|
||||
|
||||
import gql from './index';
|
||||
const loader = require('../loader');
|
||||
|
||||
describe('gql', () => {
|
||||
it('parses queries', () => {
|
||||
assert.equal(gql`{ testQuery }`.kind, 'Document');
|
||||
});
|
||||
|
||||
it('parses queries when called as a function', () => {
|
||||
assert.equal(gql('{ testQuery }').kind, 'Document');
|
||||
});
|
||||
|
||||
it('parses queries with weird substitutions', () => {
|
||||
const obj = Object.create(null);
|
||||
assert.equal(gql`{ field(input: "${obj.missing}") }`.kind, 'Document');
|
||||
assert.equal(gql`{ field(input: "${null}") }`.kind, 'Document');
|
||||
assert.equal(gql`{ field(input: "${0}") }`.kind, 'Document');
|
||||
});
|
||||
|
||||
it('allows interpolation of documents generated by the webpack loader', () => {
|
||||
const sameFragment = "fragment SomeFragmentName on SomeType { someField }";
|
||||
|
||||
const jsSource = loader.call(
|
||||
{ cacheable() {} },
|
||||
sameFragment,
|
||||
);
|
||||
const module = { exports: Object.create(null) };
|
||||
|
||||
Function("module", jsSource)(module);
|
||||
|
||||
const document = gql`query { ...SomeFragmentName } ${module.exports}`;
|
||||
assert.equal(document.kind, 'Document');
|
||||
assert.equal(document.definitions.length, 2);
|
||||
assert.equal(document.definitions[0].kind, 'OperationDefinition');
|
||||
assert.equal(document.definitions[1].kind, 'FragmentDefinition');
|
||||
});
|
||||
|
||||
it('parses queries through webpack loader', () => {
|
||||
const jsSource = loader.call({ cacheable() {} }, '{ testQuery }');
|
||||
const module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
assert.equal(module.exports.kind, 'Document');
|
||||
});
|
||||
|
||||
it('parses single query through webpack loader', () => {
|
||||
const jsSource = loader.call({ cacheable() {} }, `
|
||||
query Q1 { testQuery }
|
||||
`);
|
||||
const module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
|
||||
assert.equal(module.exports.kind, 'Document');
|
||||
assert.exists(module.exports.Q1);
|
||||
assert.equal(module.exports.Q1.kind, 'Document');
|
||||
assert.equal(module.exports.Q1.definitions.length, 1);
|
||||
});
|
||||
|
||||
it('parses single query and exports as default', () => {
|
||||
const jsSource = loader.call({ cacheable() {} }, `
|
||||
query Q1 { testQuery }
|
||||
`);
|
||||
const module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
assert.deepEqual(module.exports.definitions, module.exports.Q1.definitions);
|
||||
});
|
||||
|
||||
it('parses multiple queries through webpack loader', () => {
|
||||
const jsSource = loader.call({ cacheable() {} }, `
|
||||
query Q1 { testQuery }
|
||||
query Q2 { testQuery2 }
|
||||
`);
|
||||
const module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
|
||||
assert.exists(module.exports.Q1);
|
||||
assert.exists(module.exports.Q2);
|
||||
assert.equal(module.exports.Q1.kind, 'Document');
|
||||
assert.equal(module.exports.Q2.kind, 'Document');
|
||||
assert.equal(module.exports.Q1.definitions.length, 1);
|
||||
assert.equal(module.exports.Q2.definitions.length, 1);
|
||||
});
|
||||
|
||||
it('parses fragments with variable definitions', () => {
|
||||
gql.enableExperimentalFragmentVariables();
|
||||
|
||||
const parsed: any = gql`fragment A ($arg: String!) on Type { testQuery }`;
|
||||
assert.equal(parsed.kind, 'Document');
|
||||
assert.exists(parsed.definitions[0].variableDefinitions);
|
||||
|
||||
gql.disableExperimentalFragmentVariables()
|
||||
});
|
||||
|
||||
// see https://github.com/apollographql/graphql-tag/issues/168
|
||||
it('does not nest queries needlessly in named exports', () => {
|
||||
const jsSource = loader.call({ cacheable() {} }, `
|
||||
query Q1 { testQuery }
|
||||
query Q2 { testQuery2 }
|
||||
query Q3 { test Query3 }
|
||||
`);
|
||||
const module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
|
||||
assert.notExists(module.exports.Q2.Q1);
|
||||
assert.notExists(module.exports.Q3.Q1);
|
||||
assert.notExists(module.exports.Q3.Q2);
|
||||
});
|
||||
|
||||
it('tracks fragment dependencies from multiple queries through webpack loader', () => {
|
||||
const jsSource = loader.call({ cacheable() {} }, `
|
||||
fragment F1 on F { testQuery }
|
||||
fragment F2 on F { testQuery2 }
|
||||
fragment F3 on F { testQuery3 }
|
||||
query Q1 { ...F1 }
|
||||
query Q2 { ...F2 }
|
||||
query Q3 {
|
||||
...F1
|
||||
...F2
|
||||
}
|
||||
`);
|
||||
const module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
|
||||
assert.exists(module.exports.Q1);
|
||||
assert.exists(module.exports.Q2);
|
||||
assert.exists(module.exports.Q3);
|
||||
const Q1 = module.exports.Q1.definitions;
|
||||
const Q2 = module.exports.Q2.definitions;
|
||||
const Q3 = module.exports.Q3.definitions;
|
||||
|
||||
assert.equal(Q1.length, 2);
|
||||
assert.equal(Q1[0].name.value, 'Q1');
|
||||
assert.equal(Q1[1].name.value, 'F1');
|
||||
|
||||
assert.equal(Q2.length, 2);
|
||||
assert.equal(Q2[0].name.value, 'Q2');
|
||||
assert.equal(Q2[1].name.value, 'F2');
|
||||
|
||||
assert.equal(Q3.length, 3);
|
||||
assert.equal(Q3[0].name.value, 'Q3');
|
||||
assert.equal(Q3[1].name.value, 'F1');
|
||||
assert.equal(Q3[2].name.value, 'F2');
|
||||
|
||||
const F1 = module.exports.F1.definitions;
|
||||
const F2 = module.exports.F2.definitions;
|
||||
const F3 = module.exports.F3.definitions;
|
||||
|
||||
assert.equal(F1.length, 1);
|
||||
assert.equal(F1[0].name.value, 'F1');
|
||||
assert.equal(F2.length, 1);
|
||||
assert.equal(F2[0].name.value, 'F2');
|
||||
assert.equal(F3.length, 1);
|
||||
assert.equal(F3[0].name.value, 'F3');
|
||||
|
||||
});
|
||||
|
||||
it('tracks fragment dependencies across nested fragments', () => {
|
||||
const jsSource = loader.call({ cacheable() {} }, `
|
||||
fragment F11 on F { testQuery }
|
||||
fragment F22 on F {
|
||||
...F11
|
||||
testQuery2
|
||||
}
|
||||
fragment F33 on F {
|
||||
...F22
|
||||
testQuery3
|
||||
}
|
||||
|
||||
query Q1 {
|
||||
...F33
|
||||
}
|
||||
|
||||
query Q2 {
|
||||
id
|
||||
}
|
||||
`);
|
||||
|
||||
const module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
|
||||
assert.exists(module.exports.Q1);
|
||||
assert.exists(module.exports.Q2);
|
||||
|
||||
const Q1 = module.exports.Q1.definitions;
|
||||
const Q2 = module.exports.Q2.definitions;
|
||||
|
||||
assert.equal(Q1.length, 4);
|
||||
assert.equal(Q1[0].name.value, 'Q1');
|
||||
assert.equal(Q1[1].name.value, 'F33');
|
||||
assert.equal(Q1[2].name.value, 'F22');
|
||||
assert.equal(Q1[3].name.value, 'F11');
|
||||
|
||||
assert.equal(Q2.length, 1);
|
||||
|
||||
const F11 = module.exports.F11.definitions;
|
||||
const F22 = module.exports.F22.definitions;
|
||||
const F33 = module.exports.F33.definitions;
|
||||
|
||||
assert.equal(F11.length, 1);
|
||||
assert.equal(F11[0].name.value, 'F11');
|
||||
assert.equal(F22.length, 2);
|
||||
assert.equal(F22[0].name.value, 'F22');
|
||||
assert.equal(F22[1].name.value, 'F11');
|
||||
assert.equal(F33.length, 3);
|
||||
assert.equal(F33[0].name.value, 'F33');
|
||||
assert.equal(F33[1].name.value, 'F22');
|
||||
assert.equal(F33[2].name.value, 'F11');
|
||||
});
|
||||
|
||||
it('correctly imports other files through the webpack loader', () => {
|
||||
const query = `#import "./fragment_definition.graphql"
|
||||
query {
|
||||
author {
|
||||
...authorDetails
|
||||
}
|
||||
}`;
|
||||
const jsSource = loader.call({ cacheable() {} }, query);
|
||||
const module = { exports: Object.create(null) };
|
||||
const require = (path: string) => {
|
||||
assert.equal(path, './fragment_definition.graphql');
|
||||
return gql`
|
||||
fragment authorDetails on Author {
|
||||
firstName
|
||||
lastName
|
||||
}`;
|
||||
};
|
||||
Function("module,require", jsSource)(module, require);
|
||||
assert.equal(module.exports.kind, 'Document');
|
||||
const definitions = module.exports.definitions;
|
||||
assert.equal(definitions.length, 2);
|
||||
assert.equal(definitions[0].kind, 'OperationDefinition');
|
||||
assert.equal(definitions[1].kind, 'FragmentDefinition');
|
||||
});
|
||||
|
||||
it('tracks fragment dependencies across fragments loaded via the webpack loader', () => {
|
||||
const query = `#import "./fragment_definition.graphql"
|
||||
fragment F111 on F {
|
||||
...F222
|
||||
}
|
||||
|
||||
query Q1 {
|
||||
...F111
|
||||
}
|
||||
|
||||
query Q2 {
|
||||
a
|
||||
}
|
||||
`;
|
||||
const jsSource = loader.call({ cacheable() {} }, query);
|
||||
const module = { exports: Object.create(null) };
|
||||
const require = (path: string) => {
|
||||
assert.equal(path, './fragment_definition.graphql');
|
||||
return gql`
|
||||
fragment F222 on F {
|
||||
f1
|
||||
f2
|
||||
}`;
|
||||
};
|
||||
Function("module,require", jsSource)(module, require);
|
||||
|
||||
assert.exists(module.exports.Q1);
|
||||
assert.exists(module.exports.Q2);
|
||||
|
||||
const Q1 = module.exports.Q1.definitions;
|
||||
const Q2 = module.exports.Q2.definitions;
|
||||
|
||||
assert.equal(Q1.length, 3);
|
||||
assert.equal(Q1[0].name.value, 'Q1');
|
||||
assert.equal(Q1[1].name.value, 'F111');
|
||||
assert.equal(Q1[2].name.value, 'F222');
|
||||
|
||||
assert.equal(Q2.length, 1);
|
||||
});
|
||||
|
||||
it('does not complain when presented with normal comments', (done) => {
|
||||
assert.doesNotThrow(() => {
|
||||
const query = `#normal comment
|
||||
query {
|
||||
author {
|
||||
...authorDetails
|
||||
}
|
||||
}`;
|
||||
const jsSource = loader.call({ cacheable() {} }, query);
|
||||
const module = { exports: Object.create(null) };
|
||||
Function("module", jsSource)(module);
|
||||
assert.equal(module.exports.kind, 'Document');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('returns the same object for the same query', () => {
|
||||
assert.isTrue(gql`{ sameQuery }` === gql`{ sameQuery }`);
|
||||
});
|
||||
|
||||
it('returns the same object for the same query, even with whitespace differences', () => {
|
||||
assert.isTrue(gql`{ sameQuery }` === gql` { sameQuery, }`);
|
||||
});
|
||||
|
||||
const fragmentAst = gql`
|
||||
fragment UserFragment on User {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
`;
|
||||
|
||||
it('returns the same object for the same fragment', () => {
|
||||
assert.isTrue(gql`fragment same on Same { sameQuery }` ===
|
||||
gql`fragment same on Same { sameQuery }`);
|
||||
});
|
||||
|
||||
it('returns the same object for the same document with substitution', () => {
|
||||
// We know that calling `gql` on a fragment string will always return
|
||||
// the same document, so we can reuse `fragmentAst`
|
||||
assert.isTrue(gql`{ ...UserFragment } ${fragmentAst}` ===
|
||||
gql`{ ...UserFragment } ${fragmentAst}`);
|
||||
});
|
||||
|
||||
it('can reference a fragment that references as fragment', () => {
|
||||
const secondFragmentAst = gql`
|
||||
fragment SecondUserFragment on User {
|
||||
...UserFragment
|
||||
}
|
||||
${fragmentAst}
|
||||
`;
|
||||
|
||||
const ast = gql`
|
||||
{
|
||||
user(id: 5) {
|
||||
...SecondUserFragment
|
||||
}
|
||||
}
|
||||
${secondFragmentAst}
|
||||
`;
|
||||
|
||||
assert.deepEqual(ast, gql`
|
||||
{
|
||||
user(id: 5) {
|
||||
...SecondUserFragment
|
||||
}
|
||||
}
|
||||
fragment SecondUserFragment on User {
|
||||
...UserFragment
|
||||
}
|
||||
fragment UserFragment on User {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
describe('fragment warnings', () => {
|
||||
let warnings = [];
|
||||
const oldConsoleWarn = console.warn;
|
||||
beforeEach(() => {
|
||||
gql.resetCaches();
|
||||
warnings = [];
|
||||
console.warn = (w: string) => warnings.push(w);
|
||||
});
|
||||
afterEach(() => {
|
||||
console.warn = oldConsoleWarn;
|
||||
});
|
||||
|
||||
it('warns if you use the same fragment name for different fragments', () => {
|
||||
const frag1 = gql`fragment TestSame on Bar { fieldOne }`;
|
||||
const frag2 = gql`fragment TestSame on Bar { fieldTwo }`;
|
||||
|
||||
assert.isFalse(frag1 === frag2);
|
||||
assert.equal(warnings.length, 1);
|
||||
});
|
||||
|
||||
it('does not warn if you use the same fragment name for the same fragment', () => {
|
||||
const frag1 = gql`fragment TestDifferent on Bar { fieldOne }`;
|
||||
const frag2 = gql`fragment TestDifferent on Bar { fieldOne }`;
|
||||
|
||||
assert.isTrue(frag1 === frag2);
|
||||
assert.equal(warnings.length, 0);
|
||||
});
|
||||
|
||||
it('does not warn if you use the same embedded fragment in two different queries', () => {
|
||||
const frag1 = gql`fragment TestEmbedded on Bar { field }`;
|
||||
const query1 = gql`{ bar { fieldOne ...TestEmbedded } } ${frag1}`;
|
||||
const query2 = gql`{ bar { fieldTwo ...TestEmbedded } } ${frag1}`;
|
||||
|
||||
assert.isFalse(query1 === query2);
|
||||
assert.equal(warnings.length, 0);
|
||||
});
|
||||
|
||||
it('does not warn if you use the same fragment name for embedded and non-embedded fragments', () => {
|
||||
const frag1 = gql`fragment TestEmbeddedTwo on Bar { field }`;
|
||||
gql`{ bar { ...TestEmbedded } } ${frag1}`;
|
||||
gql`{ bar { ...TestEmbedded } } fragment TestEmbeddedTwo on Bar { field }`;
|
||||
|
||||
assert.equal(warnings.length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('unique fragments', () => {
|
||||
beforeEach(() => {
|
||||
gql.resetCaches();
|
||||
});
|
||||
|
||||
it('strips duplicate fragments from the document', () => {
|
||||
const frag1 = gql`fragment TestDuplicate on Bar { field }`;
|
||||
const query1 = gql`{ bar { fieldOne ...TestDuplicate } } ${frag1} ${frag1}`;
|
||||
const query2 = gql`{ bar { fieldOne ...TestDuplicate } } ${frag1}`;
|
||||
|
||||
assert.equal(query1.definitions.length, 2);
|
||||
assert.equal(query1.definitions[1].kind, 'FragmentDefinition');
|
||||
// We don't test strict equality between the two queries because the source.body parsed from the
|
||||
// document is not the same, but the set of definitions should be.
|
||||
assert.deepEqual(query1.definitions, query2.definitions);
|
||||
});
|
||||
|
||||
it('ignores duplicate fragments from second-level imports when using the webpack loader', () => {
|
||||
// take a require function and a query string, use the webpack loader to process it
|
||||
const load = (
|
||||
require: (path: string) => DocumentNode | null,
|
||||
query: string,
|
||||
): DocumentNode | null => {
|
||||
const jsSource = loader.call({ cacheable() {} }, query);
|
||||
const module = { exports: Object.create(null) };
|
||||
Function("require,module", jsSource)(require, module);
|
||||
return module.exports;
|
||||
}
|
||||
|
||||
const test_require = (path: string) => {
|
||||
switch (path) {
|
||||
case './friends.graphql':
|
||||
return load(test_require, [
|
||||
'#import "./person.graphql"',
|
||||
'fragment friends on Hero { friends { ...person } }',
|
||||
].join('\n'));
|
||||
case './enemies.graphql':
|
||||
return load(test_require, [
|
||||
'#import "./person.graphql"',
|
||||
'fragment enemies on Hero { enemies { ...person } }',
|
||||
].join('\n'));
|
||||
case './person.graphql':
|
||||
return load(test_require, 'fragment person on Person { name }\n');
|
||||
default:
|
||||
return null;
|
||||
};
|
||||
};
|
||||
|
||||
const result = load(test_require, [
|
||||
'#import "./friends.graphql"',
|
||||
'#import "./enemies.graphql"',
|
||||
'query { hero { ...friends ...enemies } }',
|
||||
].join('\n'))!;
|
||||
|
||||
assert.equal(result.kind, 'Document');
|
||||
assert.equal(result.definitions.length, 4, 'after deduplication, only 4 fragments should remain');
|
||||
assert.equal(result.definitions[0].kind, 'OperationDefinition');
|
||||
|
||||
// the rest of the definitions should be fragments and contain one of
|
||||
// each: "friends", "enemies", "person". Order does not matter
|
||||
const fragments = result.definitions.slice(1) as FragmentDefinitionNode[];
|
||||
assert(fragments.every(fragment => fragment.kind === 'FragmentDefinition'))
|
||||
assert(fragments.some(fragment => fragment.name.value === 'friends'))
|
||||
assert(fragments.some(fragment => fragment.name.value === 'enemies'))
|
||||
assert(fragments.some(fragment => fragment.name.value === 'person'))
|
||||
});
|
||||
});
|
||||
|
||||
// How to make this work?
|
||||
// it.only('can reference a fragment passed as a document via shorthand', () => {
|
||||
// const ast = gql`
|
||||
// {
|
||||
// user(id: 5) {
|
||||
// ...${userFragmentDocument}
|
||||
// }
|
||||
// }
|
||||
// `;
|
||||
//
|
||||
// assert.deepEqual(ast, gql`
|
||||
// {
|
||||
// user(id: 5) {
|
||||
// ...UserFragment
|
||||
// }
|
||||
// }
|
||||
// fragment UserFragment on User {
|
||||
// firstName
|
||||
// lastName
|
||||
// }
|
||||
// `);
|
||||
// });
|
||||
});
|
||||
Reference in New Issue
Block a user