Initial Sample.
This commit is contained in:
18
graphql-subscription/node_modules/@apollo/client/react/parser/index.d.ts
generated
vendored
Normal file
18
graphql-subscription/node_modules/@apollo/client/react/parser/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { DocumentNode, VariableDefinitionNode } from "graphql";
|
||||
export declare enum DocumentType {
|
||||
Query = 0,
|
||||
Mutation = 1,
|
||||
Subscription = 2
|
||||
}
|
||||
export interface IDocumentDefinition {
|
||||
type: DocumentType;
|
||||
name: string;
|
||||
variables: ReadonlyArray<VariableDefinitionNode>;
|
||||
}
|
||||
export declare function operationName(type: DocumentType): string;
|
||||
export declare function parser(document: DocumentNode): IDocumentDefinition;
|
||||
export declare namespace parser {
|
||||
var resetCache: () => void;
|
||||
}
|
||||
export declare function verifyDocumentType(document: DocumentNode, type: DocumentType): void;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
109
graphql-subscription/node_modules/@apollo/client/react/parser/index.js
generated
vendored
Normal file
109
graphql-subscription/node_modules/@apollo/client/react/parser/index.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
import { invariant } from "../../utilities/globals/index.js";
|
||||
import { AutoCleanedWeakCache, cacheSizes, } from "../../utilities/index.js";
|
||||
import { registerGlobalCache } from "../../utilities/caching/getMemoryInternals.js";
|
||||
export var DocumentType;
|
||||
(function (DocumentType) {
|
||||
DocumentType[DocumentType["Query"] = 0] = "Query";
|
||||
DocumentType[DocumentType["Mutation"] = 1] = "Mutation";
|
||||
DocumentType[DocumentType["Subscription"] = 2] = "Subscription";
|
||||
})(DocumentType || (DocumentType = {}));
|
||||
var cache;
|
||||
export function operationName(type) {
|
||||
var name;
|
||||
switch (type) {
|
||||
case DocumentType.Query:
|
||||
name = "Query";
|
||||
break;
|
||||
case DocumentType.Mutation:
|
||||
name = "Mutation";
|
||||
break;
|
||||
case DocumentType.Subscription:
|
||||
name = "Subscription";
|
||||
break;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
// This parser is mostly used to safety check incoming documents.
|
||||
export function parser(document) {
|
||||
if (!cache) {
|
||||
cache = new AutoCleanedWeakCache(cacheSizes.parser || 1000 /* defaultCacheSizes.parser */);
|
||||
}
|
||||
var cached = cache.get(document);
|
||||
if (cached)
|
||||
return cached;
|
||||
var variables, type, name;
|
||||
invariant(!!document && !!document.kind, 59, document);
|
||||
var fragments = [];
|
||||
var queries = [];
|
||||
var mutations = [];
|
||||
var subscriptions = [];
|
||||
for (var _i = 0, _a = document.definitions; _i < _a.length; _i++) {
|
||||
var x = _a[_i];
|
||||
if (x.kind === "FragmentDefinition") {
|
||||
fragments.push(x);
|
||||
continue;
|
||||
}
|
||||
if (x.kind === "OperationDefinition") {
|
||||
switch (x.operation) {
|
||||
case "query":
|
||||
queries.push(x);
|
||||
break;
|
||||
case "mutation":
|
||||
mutations.push(x);
|
||||
break;
|
||||
case "subscription":
|
||||
subscriptions.push(x);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
invariant(!fragments.length ||
|
||||
queries.length ||
|
||||
mutations.length ||
|
||||
subscriptions.length, 60);
|
||||
invariant(
|
||||
queries.length + mutations.length + subscriptions.length <= 1,
|
||||
61,
|
||||
document,
|
||||
queries.length,
|
||||
subscriptions.length,
|
||||
mutations.length
|
||||
);
|
||||
type = queries.length ? DocumentType.Query : DocumentType.Mutation;
|
||||
if (!queries.length && !mutations.length)
|
||||
type = DocumentType.Subscription;
|
||||
var definitions = queries.length ? queries
|
||||
: mutations.length ? mutations
|
||||
: subscriptions;
|
||||
invariant(definitions.length === 1, 62, document, definitions.length);
|
||||
var definition = definitions[0];
|
||||
variables = definition.variableDefinitions || [];
|
||||
if (definition.name && definition.name.kind === "Name") {
|
||||
name = definition.name.value;
|
||||
}
|
||||
else {
|
||||
name = "data"; // fallback to using data if no name
|
||||
}
|
||||
var payload = { name: name, type: type, variables: variables };
|
||||
cache.set(document, payload);
|
||||
return payload;
|
||||
}
|
||||
parser.resetCache = function () {
|
||||
cache = undefined;
|
||||
};
|
||||
if (globalThis.__DEV__ !== false) {
|
||||
registerGlobalCache("parser", function () { return (cache ? cache.size : 0); });
|
||||
}
|
||||
export function verifyDocumentType(document, type) {
|
||||
var operation = parser(document);
|
||||
var requiredOperationName = operationName(type);
|
||||
var usedOperationName = operationName(operation.type);
|
||||
invariant(
|
||||
operation.type === type,
|
||||
63,
|
||||
requiredOperationName,
|
||||
requiredOperationName,
|
||||
usedOperationName
|
||||
);
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/react/parser/index.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/react/parser/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
graphql-subscription/node_modules/@apollo/client/react/parser/package.json
generated
vendored
Normal file
8
graphql-subscription/node_modules/@apollo/client/react/parser/package.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "@apollo/client/react/parser",
|
||||
"type": "module",
|
||||
"main": "parser.cjs",
|
||||
"module": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"sideEffects": false
|
||||
}
|
||||
122
graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs
generated
vendored
Normal file
122
graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var globals = require('../../utilities/globals');
|
||||
var utilities = require('../../utilities');
|
||||
require('tslib');
|
||||
|
||||
var globalCaches = {};
|
||||
function registerGlobalCache(name, getSize) {
|
||||
globalCaches[name] = getSize;
|
||||
}
|
||||
|
||||
exports.DocumentType = void 0;
|
||||
(function (DocumentType) {
|
||||
DocumentType[DocumentType["Query"] = 0] = "Query";
|
||||
DocumentType[DocumentType["Mutation"] = 1] = "Mutation";
|
||||
DocumentType[DocumentType["Subscription"] = 2] = "Subscription";
|
||||
})(exports.DocumentType || (exports.DocumentType = {}));
|
||||
var cache;
|
||||
function operationName(type) {
|
||||
var name;
|
||||
switch (type) {
|
||||
case exports.DocumentType.Query:
|
||||
name = "Query";
|
||||
break;
|
||||
case exports.DocumentType.Mutation:
|
||||
name = "Mutation";
|
||||
break;
|
||||
case exports.DocumentType.Subscription:
|
||||
name = "Subscription";
|
||||
break;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
function parser(document) {
|
||||
if (!cache) {
|
||||
cache = new utilities.AutoCleanedWeakCache(utilities.cacheSizes.parser || 1000 );
|
||||
}
|
||||
var cached = cache.get(document);
|
||||
if (cached)
|
||||
return cached;
|
||||
var variables, type, name;
|
||||
globals.invariant(!!document && !!document.kind, 59, document);
|
||||
var fragments = [];
|
||||
var queries = [];
|
||||
var mutations = [];
|
||||
var subscriptions = [];
|
||||
for (var _i = 0, _a = document.definitions; _i < _a.length; _i++) {
|
||||
var x = _a[_i];
|
||||
if (x.kind === "FragmentDefinition") {
|
||||
fragments.push(x);
|
||||
continue;
|
||||
}
|
||||
if (x.kind === "OperationDefinition") {
|
||||
switch (x.operation) {
|
||||
case "query":
|
||||
queries.push(x);
|
||||
break;
|
||||
case "mutation":
|
||||
mutations.push(x);
|
||||
break;
|
||||
case "subscription":
|
||||
subscriptions.push(x);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
globals.invariant(!fragments.length ||
|
||||
queries.length ||
|
||||
mutations.length ||
|
||||
subscriptions.length, 60);
|
||||
globals.invariant(
|
||||
queries.length + mutations.length + subscriptions.length <= 1,
|
||||
61,
|
||||
document,
|
||||
queries.length,
|
||||
subscriptions.length,
|
||||
mutations.length
|
||||
);
|
||||
type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
|
||||
if (!queries.length && !mutations.length)
|
||||
type = exports.DocumentType.Subscription;
|
||||
var definitions = queries.length ? queries
|
||||
: mutations.length ? mutations
|
||||
: subscriptions;
|
||||
globals.invariant(definitions.length === 1, 62, document, definitions.length);
|
||||
var definition = definitions[0];
|
||||
variables = definition.variableDefinitions || [];
|
||||
if (definition.name && definition.name.kind === "Name") {
|
||||
name = definition.name.value;
|
||||
}
|
||||
else {
|
||||
name = "data";
|
||||
}
|
||||
var payload = { name: name, type: type, variables: variables };
|
||||
cache.set(document, payload);
|
||||
return payload;
|
||||
}
|
||||
parser.resetCache = function () {
|
||||
cache = undefined;
|
||||
};
|
||||
if (globalThis.__DEV__ !== false) {
|
||||
registerGlobalCache("parser", function () { return (cache ? cache.size : 0); });
|
||||
}
|
||||
function verifyDocumentType(document, type) {
|
||||
var operation = parser(document);
|
||||
var requiredOperationName = operationName(type);
|
||||
var usedOperationName = operationName(operation.type);
|
||||
globals.invariant(
|
||||
operation.type === type,
|
||||
63,
|
||||
requiredOperationName,
|
||||
requiredOperationName,
|
||||
usedOperationName
|
||||
);
|
||||
}
|
||||
|
||||
exports.operationName = operationName;
|
||||
exports.parser = parser;
|
||||
exports.verifyDocumentType = verifyDocumentType;
|
||||
//# sourceMappingURL=parser.cjs.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
122
graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs.native.js
generated
vendored
Normal file
122
graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs.native.js
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var globals = require('../../utilities/globals');
|
||||
var utilities = require('../../utilities');
|
||||
require('tslib');
|
||||
|
||||
var globalCaches = {};
|
||||
function registerGlobalCache(name, getSize) {
|
||||
globalCaches[name] = getSize;
|
||||
}
|
||||
|
||||
exports.DocumentType = void 0;
|
||||
(function (DocumentType) {
|
||||
DocumentType[DocumentType["Query"] = 0] = "Query";
|
||||
DocumentType[DocumentType["Mutation"] = 1] = "Mutation";
|
||||
DocumentType[DocumentType["Subscription"] = 2] = "Subscription";
|
||||
})(exports.DocumentType || (exports.DocumentType = {}));
|
||||
var cache;
|
||||
function operationName(type) {
|
||||
var name;
|
||||
switch (type) {
|
||||
case exports.DocumentType.Query:
|
||||
name = "Query";
|
||||
break;
|
||||
case exports.DocumentType.Mutation:
|
||||
name = "Mutation";
|
||||
break;
|
||||
case exports.DocumentType.Subscription:
|
||||
name = "Subscription";
|
||||
break;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
function parser(document) {
|
||||
if (!cache) {
|
||||
cache = new utilities.AutoCleanedWeakCache(utilities.cacheSizes.parser || 1000 );
|
||||
}
|
||||
var cached = cache.get(document);
|
||||
if (cached)
|
||||
return cached;
|
||||
var variables, type, name;
|
||||
globals.invariant(!!document && !!document.kind, 59, document);
|
||||
var fragments = [];
|
||||
var queries = [];
|
||||
var mutations = [];
|
||||
var subscriptions = [];
|
||||
for (var _i = 0, _a = document.definitions; _i < _a.length; _i++) {
|
||||
var x = _a[_i];
|
||||
if (x.kind === "FragmentDefinition") {
|
||||
fragments.push(x);
|
||||
continue;
|
||||
}
|
||||
if (x.kind === "OperationDefinition") {
|
||||
switch (x.operation) {
|
||||
case "query":
|
||||
queries.push(x);
|
||||
break;
|
||||
case "mutation":
|
||||
mutations.push(x);
|
||||
break;
|
||||
case "subscription":
|
||||
subscriptions.push(x);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
globals.invariant(!fragments.length ||
|
||||
queries.length ||
|
||||
mutations.length ||
|
||||
subscriptions.length, 60);
|
||||
globals.invariant(
|
||||
queries.length + mutations.length + subscriptions.length <= 1,
|
||||
61,
|
||||
document,
|
||||
queries.length,
|
||||
subscriptions.length,
|
||||
mutations.length
|
||||
);
|
||||
type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
|
||||
if (!queries.length && !mutations.length)
|
||||
type = exports.DocumentType.Subscription;
|
||||
var definitions = queries.length ? queries
|
||||
: mutations.length ? mutations
|
||||
: subscriptions;
|
||||
globals.invariant(definitions.length === 1, 62, document, definitions.length);
|
||||
var definition = definitions[0];
|
||||
variables = definition.variableDefinitions || [];
|
||||
if (definition.name && definition.name.kind === "Name") {
|
||||
name = definition.name.value;
|
||||
}
|
||||
else {
|
||||
name = "data";
|
||||
}
|
||||
var payload = { name: name, type: type, variables: variables };
|
||||
cache.set(document, payload);
|
||||
return payload;
|
||||
}
|
||||
parser.resetCache = function () {
|
||||
cache = undefined;
|
||||
};
|
||||
if (globalThis.__DEV__ !== false) {
|
||||
registerGlobalCache("parser", function () { return (cache ? cache.size : 0); });
|
||||
}
|
||||
function verifyDocumentType(document, type) {
|
||||
var operation = parser(document);
|
||||
var requiredOperationName = operationName(type);
|
||||
var usedOperationName = operationName(operation.type);
|
||||
globals.invariant(
|
||||
operation.type === type,
|
||||
63,
|
||||
requiredOperationName,
|
||||
requiredOperationName,
|
||||
usedOperationName
|
||||
);
|
||||
}
|
||||
|
||||
exports.operationName = operationName;
|
||||
exports.parser = parser;
|
||||
exports.verifyDocumentType = verifyDocumentType;
|
||||
//# sourceMappingURL=parser.cjs.map
|
||||
Reference in New Issue
Block a user