stepzen-graphiql 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -0
- package/dist/GraphiQLExplorer.d.ts +10 -0
- package/dist/Range-CPFFy5pj.mjs +26 -0
- package/dist/Range-CUfOrqgY.js +1 -0
- package/dist/SchemaReference-94TE3IPs.mjs +146 -0
- package/dist/SchemaReference-DKgkDdcV.js +1 -0
- package/dist/brace-fold-9JQ5QTIN.mjs +122 -0
- package/dist/brace-fold-CUTcWTRf.js +1 -0
- package/dist/closebrackets-BL_z-rKi.mjs +165 -0
- package/dist/closebrackets-DHbhKDzk.js +2 -0
- package/dist/codemirror-CxfyhJc1.mjs +27 -0
- package/dist/codemirror-DMBo1i5w.js +24 -0
- package/dist/codemirror-DgPcZxSc.mjs +6121 -0
- package/dist/codemirror-Kv5dN_jU.js +1 -0
- package/dist/comment-CAsllqoy.js +2 -0
- package/dist/comment-DscvXuhU.mjs +150 -0
- package/dist/components/ExplorerPage/ExplorerHeader.d.ts +3 -0
- package/dist/components/ExplorerPage/ExplorerPage.d.ts +8 -0
- package/dist/components/ExplorerPage/GraphiQLInterface.d.ts +60 -0
- package/dist/components/ExplorerPage/Snippets.d.ts +17 -0
- package/dist/components/ExplorerPage/clearTooltip.d.ts +1 -0
- package/dist/components/exporterPlugin/CodeExporter.d.ts +93 -0
- package/dist/components/exporterPlugin/index.d.ts +7 -0
- package/dist/components/exporterPlugin/snippets/__helpers__/getOptionCombinations.d.ts +2 -0
- package/dist/components/exporterPlugin/snippets/index.d.ts +2 -0
- package/dist/components/exporterPlugin/snippets/javascript/fetch.d.ts +3 -0
- package/dist/components/exporterPlugin/snippets/javascript/reactApollo.d.ts +3 -0
- package/dist/components/exporterPlugin/toposort.d.ts +2 -0
- package/dist/components/exporterPlugin/useExporterPlugin.d.ts +19 -0
- package/dist/components/exporterPlugin/utils/capitalizeFirstLetter.d.ts +1 -0
- package/dist/components/exporterPlugin/utils/index.d.ts +7 -0
- package/dist/components/exporterPlugin/utils/jsCommentsFactory.d.ts +1 -0
- package/dist/contexts/EnvironmentContext.d.ts +37 -0
- package/dist/contexts/endpoint.d.ts +39 -0
- package/dist/dialog-BF69fCJO.js +1 -0
- package/dist/dialog-Ci1bnuc2.mjs +74 -0
- package/dist/dialog-Dh2DOTOu.js +1 -0
- package/dist/dialog-nXZjpybF.mjs +26 -0
- package/dist/foldgutter-DiGsqcNo.mjs +238 -0
- package/dist/foldgutter-Do6XNu8o.js +1 -0
- package/dist/forEachState-DA54msa8.mjs +11 -0
- package/dist/forEachState-DY_pA9Bd.js +1 -0
- package/dist/hint-BNpE1H1l.js +1 -0
- package/dist/hint-BQ9WwQj_.mjs +123 -0
- package/dist/hint-dA98kXsJ.js +1 -0
- package/dist/hint-ptEpgPx0.mjs +24 -0
- package/dist/index-BeOZF5ut.js +650 -0
- package/dist/index-GG9J9CZE.js +1 -0
- package/dist/index-Iqk59VQ1.mjs +89463 -0
- package/dist/index-_X52-Rov.mjs +11 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +4 -0
- package/dist/info-BhA0aX7P.js +1 -0
- package/dist/info-DavOVk27.mjs +99 -0
- package/dist/info-addon-BppfpWGs.js +1 -0
- package/dist/info-addon-jclzOzZb.mjs +66 -0
- package/dist/javascript-Bk78gZXV.js +1 -0
- package/dist/javascript-HLYdFIhF.mjs +26 -0
- package/dist/javascript-RO_jaPiE.mjs +707 -0
- package/dist/javascript-poxRzxcy.js +1 -0
- package/dist/jsx-C8WdRUVV.mjs +414 -0
- package/dist/jsx-LzpFIybc.js +1 -0
- package/dist/jump-BR4c9I5u.mjs +85 -0
- package/dist/jump-C3iGjDkY.js +1 -0
- package/dist/jump-to-line-BZOuAkwy.js +1 -0
- package/dist/jump-to-line-pXiAP2DT.mjs +61 -0
- package/dist/lib/constants.d.ts +6 -0
- package/dist/lib/graphiql-helpers.d.ts +86 -0
- package/dist/lib/helpers.d.ts +53 -0
- package/dist/lint-Aw1wLmnw.mjs +112 -0
- package/dist/lint-Bf0wS1Ab.js +1 -0
- package/dist/lint-DL7I1P7I.mjs +272 -0
- package/dist/lint-GZ9x3Nii.js +6 -0
- package/dist/lint-L3DNAS-R.mjs +216 -0
- package/dist/lint-azLq6zoS.js +1 -0
- package/dist/matchbrackets-BB4g2Y6d.mjs +87 -0
- package/dist/matchbrackets-DJZ2jVlm.js +1 -0
- package/dist/matchbrackets-DNVziiaa.mjs +26 -0
- package/dist/matchbrackets-DPv_MB7c.js +1 -0
- package/dist/mode-Bad_JbYc.js +1 -0
- package/dist/mode-BuM4vqHx.js +1 -0
- package/dist/mode-C9FNlffS.js +1 -0
- package/dist/mode-CtmJdiWw.mjs +73 -0
- package/dist/mode-CxFmwOoU.mjs +25 -0
- package/dist/mode-DQHzanY6.mjs +64 -0
- package/dist/mode-indent-9VnFlqY-.mjs +8 -0
- package/dist/mode-indent-m3TP74Ia.js +1 -0
- package/dist/search-BUZtJ7Zg.mjs +268 -0
- package/dist/search-DxgAMk6j.js +2 -0
- package/dist/searchcursor-BrHSjZde.mjs +26 -0
- package/dist/searchcursor-Cf1_qqgl.js +1 -0
- package/dist/searchcursor-DHtNMOPb.mjs +239 -0
- package/dist/searchcursor-eGwb3e2h.js +7 -0
- package/dist/show-hint-CYURLLrO.js +1 -0
- package/dist/show-hint-CmHZP7k_.mjs +357 -0
- package/dist/style.css +9 -0
- package/dist/sublime-BKhMEkpg.js +6 -0
- package/dist/sublime-Dmy11GSm.mjs +563 -0
- package/dist/types/config.d.ts +7 -0
- package/package.json +111 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { GraphQLArgument, GraphQLField, GraphQLSchema, GraphQLType } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* Compile arguments dictionary for a field
|
|
4
|
+
* @param field current field object
|
|
5
|
+
* @param duplicateArgCounts map for deduping argument name collisions
|
|
6
|
+
* @param allArgsDict dictionary of all arguments
|
|
7
|
+
*/
|
|
8
|
+
export declare const getFieldArgsDict: (field: GraphQLField<any, any>, duplicateArgCounts: Record<string, number>, allArgsDict?: Record<string, GraphQLArgument>) => Record<string, GraphQLArgument>;
|
|
9
|
+
/**
|
|
10
|
+
* Generate variables string
|
|
11
|
+
* @param dict dictionary of arguments
|
|
12
|
+
*/
|
|
13
|
+
export declare const getArgsToVarsStr: (dict: Record<string, GraphQLArgument>) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Generate types string
|
|
16
|
+
* @param dict dictionary of arguments
|
|
17
|
+
*/
|
|
18
|
+
export declare const getVarsToTypesStr: (dict: Record<string, GraphQLArgument>) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Generate a example value for a given a GraphQL type
|
|
21
|
+
* @param type GraphQL type
|
|
22
|
+
*/
|
|
23
|
+
export declare const getSampleValueOfType: (type: GraphQLType) => any;
|
|
24
|
+
export declare const getSampleVars: (dict: Record<string, GraphQLArgument>) => {
|
|
25
|
+
[k: string]: any;
|
|
26
|
+
};
|
|
27
|
+
export declare class GqlGenerator {
|
|
28
|
+
private gqlSchema;
|
|
29
|
+
private depthLimit;
|
|
30
|
+
private includeDeprecatedFields;
|
|
31
|
+
constructor(gqlSchema: GraphQLSchema, depthLimit?: number, includeDeprecatedFields?: boolean);
|
|
32
|
+
/**
|
|
33
|
+
* Generate a selection for the specified field
|
|
34
|
+
*
|
|
35
|
+
* @param fieldName name of a field on a GraphQL type
|
|
36
|
+
* @param parentTypeName name of the parent GraphQL type
|
|
37
|
+
* @param parentFieldName name of the parent field
|
|
38
|
+
* @param argumentsDict dictionary of arguments from all fields
|
|
39
|
+
* @param duplicateArgCounts map for deduping argument name collisions
|
|
40
|
+
* @param crossReferenceKeyList list of the cross reference
|
|
41
|
+
* @param curDepth current depth of field
|
|
42
|
+
* @param fromUnion adds additional depth for unions to avoid empty child
|
|
43
|
+
*/
|
|
44
|
+
generateFieldSelection({ fieldName, parentTypeName, parentFieldName, argumentsDict, duplicateArgCounts, crossReferenceKeyList, // [`${parentFieldName}To${fieldName}Key`]
|
|
45
|
+
curDepth, fromUnion, }: {
|
|
46
|
+
fieldName: string;
|
|
47
|
+
parentTypeName: string;
|
|
48
|
+
parentFieldName?: string;
|
|
49
|
+
argumentsDict?: Record<string, GraphQLArgument>;
|
|
50
|
+
duplicateArgCounts?: Record<string, number>;
|
|
51
|
+
crossReferenceKeyList?: string[];
|
|
52
|
+
curDepth?: number;
|
|
53
|
+
fromUnion?: boolean;
|
|
54
|
+
}): {
|
|
55
|
+
selection: string;
|
|
56
|
+
argumentsDict: Record<string, GraphQLArgument>;
|
|
57
|
+
};
|
|
58
|
+
generateSampleOperation(): {
|
|
59
|
+
query: string;
|
|
60
|
+
variables: Record<string, any>;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export declare const generateSampleOperation: ({ schema, depthLimit, includeDeprecatedFields, }: {
|
|
64
|
+
schema: GraphQLSchema;
|
|
65
|
+
depthLimit?: number | undefined;
|
|
66
|
+
includeDeprecatedFields?: boolean | undefined;
|
|
67
|
+
}) => {
|
|
68
|
+
query: string;
|
|
69
|
+
variables: Record<string, any>;
|
|
70
|
+
};
|
|
71
|
+
export declare function isSameSchema(left: GraphQLSchema | undefined, right: GraphQLSchema | undefined): boolean;
|
|
72
|
+
export declare function parseAndPrint(str: string): {
|
|
73
|
+
parsedString: string;
|
|
74
|
+
queryName: string;
|
|
75
|
+
} | undefined;
|
|
76
|
+
export declare function validateHistoricalQuery(queryObject: {
|
|
77
|
+
query: string;
|
|
78
|
+
variables: string;
|
|
79
|
+
headers: string;
|
|
80
|
+
operationName: string;
|
|
81
|
+
}, schema?: GraphQLSchema): {
|
|
82
|
+
query: string;
|
|
83
|
+
variables: string;
|
|
84
|
+
headers: string;
|
|
85
|
+
operationName: string;
|
|
86
|
+
} | undefined;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Environment } from '../contexts/EnvironmentContext';
|
|
2
|
+
export declare const toSearchString: (query: Record<string, string | string[] | undefined>) => string;
|
|
3
|
+
export declare const checkForSpecialCharacters: (domain: string) => boolean;
|
|
4
|
+
export declare const createCurlVariables: (req: {
|
|
5
|
+
query_data: string[];
|
|
6
|
+
header_data: string[];
|
|
7
|
+
json: JSON;
|
|
8
|
+
path_data: string;
|
|
9
|
+
url: string;
|
|
10
|
+
method: string;
|
|
11
|
+
}) => {
|
|
12
|
+
query: string;
|
|
13
|
+
headers: string[];
|
|
14
|
+
headerParams: string[];
|
|
15
|
+
};
|
|
16
|
+
export declare const buildEndpointUrl: (ep: string, environment: Environment) => string;
|
|
17
|
+
export declare const findKey: (previousState: {
|
|
18
|
+
[key: number]: string;
|
|
19
|
+
}, name: string, fieldValue: string, entryType: string) => {};
|
|
20
|
+
export declare const introspect: (req: {
|
|
21
|
+
query_data: string[];
|
|
22
|
+
header_data: string[];
|
|
23
|
+
json: JSON;
|
|
24
|
+
path_data: string;
|
|
25
|
+
url: string;
|
|
26
|
+
method: string;
|
|
27
|
+
}, restEndpoint: string) => string;
|
|
28
|
+
export declare function isPublicEndpoint(ep: string, environment: Environment): boolean;
|
|
29
|
+
export declare function isJsonString(str: string): boolean;
|
|
30
|
+
export declare function isValidHttpUrl(string: string): boolean;
|
|
31
|
+
export declare const removeQueryParams: (url: string) => string;
|
|
32
|
+
/**
|
|
33
|
+
* Sanitize callback URL to avoid open redirect to 3rd party origins.
|
|
34
|
+
* - a valid relative URL => return it as is
|
|
35
|
+
* - a valid absolute URL on the current origin => return it as a relative URL
|
|
36
|
+
* - all other cases => return `/`
|
|
37
|
+
*
|
|
38
|
+
* @param callbackPath relative or absolure URL
|
|
39
|
+
* @returns a relative URL that is safe to use in `router.push()`
|
|
40
|
+
*/
|
|
41
|
+
export declare const makeSafeCallbackPath: (callbackPath: string) => string;
|
|
42
|
+
export declare const validateIPaddress: (ipaddress: string) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Map a zenserv domain to a dashboard domain (intended to automatically
|
|
45
|
+
* redirect from dashboard.ibm.stepzen.com to region-specific domains in
|
|
46
|
+
* production).
|
|
47
|
+
*
|
|
48
|
+
* @param domain zenserv domain, e.g. `us-east-a.ibm.stepzen.net`
|
|
49
|
+
* @returns dashboard domain, e.g. `us-east-a.dashboard.ibm.stepzen.com` or
|
|
50
|
+
* `undefined` if no match is found (which implies the current
|
|
51
|
+
* dashboard domain is just fine)
|
|
52
|
+
*/
|
|
53
|
+
export declare const parseJsonOrDefault: <T>(jsonString: string | null | undefined, defaultValue: T) => T;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { C as g } from "./codemirror-CxfyhJc1.mjs";
|
|
2
|
+
import { x as w, N as C, E as S, y as E, K as D, z as Q, A as b, B as L, o as N, D as G, F as P } from "./index-Iqk59VQ1.mjs";
|
|
3
|
+
import { R, P as d } from "./Range-CPFFy5pj.mjs";
|
|
4
|
+
function T(t, a, s, c, o) {
|
|
5
|
+
const n = w.filter((e) => !(e === C || e === S));
|
|
6
|
+
return s && Array.prototype.push.apply(n, s), E(t, a, n).filter((e) => {
|
|
7
|
+
if (e.message.includes("Unknown directive") && e.nodes) {
|
|
8
|
+
const r = e.nodes[0];
|
|
9
|
+
if (r && r.kind === D.DIRECTIVE) {
|
|
10
|
+
const l = r.name.value;
|
|
11
|
+
if (l === "arguments" || l === "argumentDefinitions")
|
|
12
|
+
return !1;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return !0;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const m = {
|
|
19
|
+
Error: "Error",
|
|
20
|
+
Warning: "Warning"
|
|
21
|
+
}, h = {
|
|
22
|
+
[m.Error]: 1,
|
|
23
|
+
[m.Warning]: 2
|
|
24
|
+
}, f = (t, a) => {
|
|
25
|
+
if (!t)
|
|
26
|
+
throw new Error(a);
|
|
27
|
+
};
|
|
28
|
+
function I(t, a = null, s, c, o) {
|
|
29
|
+
var n, i;
|
|
30
|
+
let e = null, r = "";
|
|
31
|
+
o && (r = typeof o == "string" ? o : o.reduce((u, p) => u + Q(p) + `
|
|
32
|
+
|
|
33
|
+
`, ""));
|
|
34
|
+
const l = r ? `${t}
|
|
35
|
+
|
|
36
|
+
${r}` : t;
|
|
37
|
+
try {
|
|
38
|
+
e = b(l);
|
|
39
|
+
} catch (u) {
|
|
40
|
+
if (u instanceof L) {
|
|
41
|
+
const p = k((i = (n = u.locations) === null || n === void 0 ? void 0 : n[0]) !== null && i !== void 0 ? i : { line: 0 }, l);
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
severity: h.Error,
|
|
45
|
+
message: u.message,
|
|
46
|
+
source: "GraphQL: Syntax",
|
|
47
|
+
range: p
|
|
48
|
+
}
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
throw u;
|
|
52
|
+
}
|
|
53
|
+
return V(e, a, s);
|
|
54
|
+
}
|
|
55
|
+
function V(t, a = null, s, c) {
|
|
56
|
+
if (!a)
|
|
57
|
+
return [];
|
|
58
|
+
const o = T(a, t, s).flatMap((i) => v(i, h.Error, "Validation")), n = E(a, t, [
|
|
59
|
+
P
|
|
60
|
+
]).flatMap((i) => v(i, h.Warning, "Deprecation"));
|
|
61
|
+
return o.concat(n);
|
|
62
|
+
}
|
|
63
|
+
function v(t, a, s) {
|
|
64
|
+
if (!t.nodes)
|
|
65
|
+
return [];
|
|
66
|
+
const c = [];
|
|
67
|
+
for (const [o, n] of t.nodes.entries()) {
|
|
68
|
+
const i = n.kind !== "Variable" && "name" in n && n.name !== void 0 ? n.name : "variable" in n && n.variable !== void 0 ? n.variable : n;
|
|
69
|
+
if (i) {
|
|
70
|
+
f(t.locations, "GraphQL validation error requires locations.");
|
|
71
|
+
const e = t.locations[o], r = x(i), l = e.column + (r.end - r.start);
|
|
72
|
+
c.push({
|
|
73
|
+
source: `GraphQL: ${s}`,
|
|
74
|
+
message: t.message,
|
|
75
|
+
severity: a,
|
|
76
|
+
range: new R(new d(e.line - 1, e.column - 1), new d(e.line - 1, l))
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return c;
|
|
81
|
+
}
|
|
82
|
+
function k(t, a) {
|
|
83
|
+
const s = N(), c = s.startState(), o = a.split(`
|
|
84
|
+
`);
|
|
85
|
+
f(o.length >= t.line, "Query text must have more lines than where the error happened");
|
|
86
|
+
let n = null;
|
|
87
|
+
for (let l = 0; l < t.line; l++)
|
|
88
|
+
for (n = new G(o[l]); !n.eol() && s.token(n, c) !== "invalidchar"; )
|
|
89
|
+
;
|
|
90
|
+
f(n, "Expected Parser stream to be available.");
|
|
91
|
+
const i = t.line - 1, e = n.getStartOfToken(), r = n.getCurrentPosition();
|
|
92
|
+
return new R(new d(i, e), new d(i, r));
|
|
93
|
+
}
|
|
94
|
+
function x(t) {
|
|
95
|
+
const s = t.loc;
|
|
96
|
+
return f(s, "Expected ASTNode to have a location."), s;
|
|
97
|
+
}
|
|
98
|
+
const y = ["error", "warning", "information", "hint"], A = {
|
|
99
|
+
"GraphQL: Validation": "validation",
|
|
100
|
+
"GraphQL: Deprecation": "deprecation",
|
|
101
|
+
"GraphQL: Syntax": "syntax"
|
|
102
|
+
};
|
|
103
|
+
g.registerHelper("lint", "graphql", (t, a) => {
|
|
104
|
+
const { schema: s, validationRules: c, externalFragments: o } = a;
|
|
105
|
+
return I(t, s, c, void 0, o).map((e) => ({
|
|
106
|
+
message: e.message,
|
|
107
|
+
severity: e.severity ? y[e.severity - 1] : y[0],
|
|
108
|
+
type: e.source ? A[e.source] : void 0,
|
|
109
|
+
from: g.Pos(e.range.start.line, e.range.start.character),
|
|
110
|
+
to: g.Pos(e.range.end.line, e.range.end.character)
|
|
111
|
+
}));
|
|
112
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const H=require("./index-BeOZF5ut.js"),P=require("./codemirror-DMBo1i5w.js");function W(v,m){for(var l=0;l<m.length;l++){const f=m[l];if(typeof f!="string"&&!Array.isArray(f)){for(const p in f)if(p!=="default"&&!(p in v)){const g=Object.getOwnPropertyDescriptor(f,p);g&&Object.defineProperty(v,p,g.get?g:{enumerable:!0,get:()=>f[p]})}}}return Object.freeze(Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}))}var x={exports:{}},E;function U(){return E||(E=1,function(v,m){(function(l){l(P.requireCodemirror())})(function(l){var f="CodeMirror-lint-markers",p="CodeMirror-lint-line-";function g(t,e,r){var n=document.createElement("div");n.className="CodeMirror-lint-tooltip cm-s-"+t.options.theme,n.appendChild(r.cloneNode(!0)),t.state.lint.options.selfContain?t.getWrapperElement().appendChild(n):document.body.appendChild(n);function i(o){if(!n.parentNode)return l.off(document,"mousemove",i);var a=Math.max(0,o.clientY-n.offsetHeight-5),s=Math.max(0,Math.min(o.clientX+5,n.ownerDocument.defaultView.innerWidth-n.offsetWidth));n.style.top=a+"px",n.style.left=s+"px"}return l.on(document,"mousemove",i),i(e),n.style.opacity!=null&&(n.style.opacity=1),n}function L(t){t.parentNode&&t.parentNode.removeChild(t)}function b(t){t.parentNode&&(t.style.opacity==null&&L(t),t.style.opacity=0,setTimeout(function(){L(t)},600))}function O(t,e,r,n){var i=g(t,e,r);function o(){l.off(n,"mouseout",o),i&&(b(i),i=null)}var a=setInterval(function(){if(i)for(var s=n;;s=s.parentNode){if(s&&s.nodeType==11&&(s=s.host),s==document.body)return;if(!s){o();break}}if(!i)return clearInterval(a)},400);l.on(n,"mouseout",o)}function _(t,e,r){this.marked=[],e instanceof Function&&(e={getAnnotations:e}),(!e||e===!0)&&(e={}),this.options={},this.linterOptions=e.options||{};for(var n in y)this.options[n]=y[n];for(var n in e)y.hasOwnProperty(n)?e[n]!=null&&(this.options[n]=e[n]):e.options||(this.linterOptions[n]=e[n]);this.timeout=null,this.hasGutter=r,this.onMouseOver=function(i){q(t,i)},this.waitingFor=0}var y={highlightLines:!1,tooltips:!0,delay:500,lintOnChange:!0,getAnnotations:null,async:!1,selfContain:null,formatAnnotation:null,onUpdateLinting:null};function T(t){var e=t.state.lint;e.hasGutter&&t.clearGutter(f),e.options.highlightLines&&A(t);for(var r=0;r<e.marked.length;++r)e.marked[r].clear();e.marked.length=0}function A(t){t.eachLine(function(e){var r=e.wrapClass&&/\bCodeMirror-lint-line-\w+\b/.exec(e.wrapClass);r&&t.removeLineClass(e,"wrap",r[0])})}function F(t,e,r,n,i){var o=document.createElement("div"),a=o;return o.className="CodeMirror-lint-marker CodeMirror-lint-marker-"+r,n&&(a=o.appendChild(document.createElement("div")),a.className="CodeMirror-lint-marker CodeMirror-lint-marker-multiple"),i!=!1&&l.on(a,"mouseover",function(s){O(t,s,e,a)}),o}function D(t,e){return t=="error"?t:e}function G(t){for(var e=[],r=0;r<t.length;++r){var n=t[r],i=n.from.line;(e[i]||(e[i]=[])).push(n)}return e}function M(t){var e=t.severity;e||(e="error");var r=document.createElement("div");return r.className="CodeMirror-lint-message CodeMirror-lint-message-"+e,typeof t.messageHTML<"u"?r.innerHTML=t.messageHTML:r.appendChild(document.createTextNode(t.message)),r}function I(t,e){var r=t.state.lint,n=++r.waitingFor;function i(){n=-1,t.off("change",i)}t.on("change",i),e(t.getValue(),function(o,a){t.off("change",i),r.waitingFor==n&&(a&&o instanceof l&&(o=a),t.operation(function(){k(t,o)}))},r.linterOptions,t)}function C(t){var e=t.state.lint;if(e){var r=e.options,n=r.getAnnotations||t.getHelper(l.Pos(0,0),"lint");if(n)if(r.async||n.async)I(t,n);else{var i=n(t.getValue(),e.linterOptions,t);if(!i)return;i.then?i.then(function(o){t.operation(function(){k(t,o)})}):t.operation(function(){k(t,i)})}}}function k(t,e){var r=t.state.lint;if(r){var n=r.options;T(t);for(var i=G(e),o=0;o<i.length;++o){var a=i[o];if(a){for(var s=null,d=r.hasGutter&&document.createDocumentFragment(),h=0;h<a.length;++h){var u=a[h],c=u.severity;c||(c="error"),s=D(s,c),n.formatAnnotation&&(u=n.formatAnnotation(u)),r.hasGutter&&d.appendChild(M(u)),u.to&&r.marked.push(t.markText(u.from,u.to,{className:"CodeMirror-lint-mark CodeMirror-lint-mark-"+c,__annotation:u}))}r.hasGutter&&t.setGutterMarker(o,f,F(t,d,s,a.length>1,n.tooltips)),n.highlightLines&&t.addLineClass(o,"wrap",p+s)}}n.onUpdateLinting&&n.onUpdateLinting(e,i,t)}}function w(t){var e=t.state.lint;e&&(clearTimeout(e.timeout),e.timeout=setTimeout(function(){C(t)},e.options.delay))}function j(t,e,r){for(var n=r.target||r.srcElement,i=document.createDocumentFragment(),o=0;o<e.length;o++){var a=e[o];i.appendChild(M(a))}O(t,r,i,n)}function q(t,e){var r=e.target||e.srcElement;if(/\bCodeMirror-lint-mark-/.test(r.className)){for(var n=r.getBoundingClientRect(),i=(n.left+n.right)/2,o=(n.top+n.bottom)/2,a=t.findMarksAt(t.coordsChar({left:i,top:o},"client")),s=[],d=0;d<a.length;++d){var h=a[d].__annotation;h&&s.push(h)}s.length&&j(t,s,e)}}l.defineOption("lint",!1,function(t,e,r){if(r&&r!=l.Init&&(T(t),t.state.lint.options.lintOnChange!==!1&&t.off("change",w),l.off(t.getWrapperElement(),"mouseover",t.state.lint.onMouseOver),clearTimeout(t.state.lint.timeout),delete t.state.lint),e){for(var n=t.getOption("gutters"),i=!1,o=0;o<n.length;++o)n[o]==f&&(i=!0);var a=t.state.lint=new _(t,e,i);a.options.lintOnChange&&t.on("change",w),a.options.tooltips!=!1&&a.options.tooltips!="gutter"&&l.on(t.getWrapperElement(),"mouseover",a.onMouseOver),C(t)}}),l.defineExtension("performLint",function(){C(this)})})}()),x.exports}var N=U();const R=H.getDefaultExportFromCjs(N),V=W({__proto__:null,default:R},[N]);exports.lint=V;
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { C as Q } from "./codemirror-CxfyhJc1.mjs";
|
|
2
|
+
import { b as $, d as I, i as q, k as C, w as M } from "./index-Iqk59VQ1.mjs";
|
|
3
|
+
function v(e) {
|
|
4
|
+
l = e, N = e.length, i = c = k = -1, s(), E();
|
|
5
|
+
const n = j();
|
|
6
|
+
return d("EOF"), n;
|
|
7
|
+
}
|
|
8
|
+
let l, N, i, c, k, r, u;
|
|
9
|
+
function j() {
|
|
10
|
+
const e = i, n = [];
|
|
11
|
+
if (d("{"), !w("}")) {
|
|
12
|
+
do
|
|
13
|
+
n.push(D());
|
|
14
|
+
while (w(","));
|
|
15
|
+
d("}");
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
kind: "Object",
|
|
19
|
+
start: e,
|
|
20
|
+
end: k,
|
|
21
|
+
members: n
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function D() {
|
|
25
|
+
const e = i, n = u === "String" ? B() : null;
|
|
26
|
+
d("String"), d(":");
|
|
27
|
+
const t = L();
|
|
28
|
+
return {
|
|
29
|
+
kind: "Member",
|
|
30
|
+
start: e,
|
|
31
|
+
end: k,
|
|
32
|
+
key: n,
|
|
33
|
+
value: t
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function H() {
|
|
37
|
+
const e = i, n = [];
|
|
38
|
+
if (d("["), !w("]")) {
|
|
39
|
+
do
|
|
40
|
+
n.push(L());
|
|
41
|
+
while (w(","));
|
|
42
|
+
d("]");
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
kind: "Array",
|
|
46
|
+
start: e,
|
|
47
|
+
end: k,
|
|
48
|
+
values: n
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function L() {
|
|
52
|
+
switch (u) {
|
|
53
|
+
case "[":
|
|
54
|
+
return H();
|
|
55
|
+
case "{":
|
|
56
|
+
return j();
|
|
57
|
+
case "String":
|
|
58
|
+
case "Number":
|
|
59
|
+
case "Boolean":
|
|
60
|
+
case "Null":
|
|
61
|
+
const e = B();
|
|
62
|
+
return E(), e;
|
|
63
|
+
}
|
|
64
|
+
d("Value");
|
|
65
|
+
}
|
|
66
|
+
function B() {
|
|
67
|
+
return { kind: u, start: i, end: c, value: JSON.parse(l.slice(i, c)) };
|
|
68
|
+
}
|
|
69
|
+
function d(e) {
|
|
70
|
+
if (u === e) {
|
|
71
|
+
E();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
let n;
|
|
75
|
+
if (u === "EOF")
|
|
76
|
+
n = "[end of file]";
|
|
77
|
+
else if (c - i > 1)
|
|
78
|
+
n = "`" + l.slice(i, c) + "`";
|
|
79
|
+
else {
|
|
80
|
+
const t = l.slice(i).match(/^.+?\b/);
|
|
81
|
+
n = "`" + (t ? t[0] : l[i]) + "`";
|
|
82
|
+
}
|
|
83
|
+
throw m(`Expected ${e} but found ${n}.`);
|
|
84
|
+
}
|
|
85
|
+
class V extends Error {
|
|
86
|
+
constructor(n, t) {
|
|
87
|
+
super(n), this.position = t;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function m(e) {
|
|
91
|
+
return new V(e, { start: i, end: c });
|
|
92
|
+
}
|
|
93
|
+
function w(e) {
|
|
94
|
+
if (u === e)
|
|
95
|
+
return E(), !0;
|
|
96
|
+
}
|
|
97
|
+
function s() {
|
|
98
|
+
return c < N && (c++, r = c === N ? 0 : l.charCodeAt(c)), r;
|
|
99
|
+
}
|
|
100
|
+
function E() {
|
|
101
|
+
for (k = c; r === 9 || r === 10 || r === 13 || r === 32; )
|
|
102
|
+
s();
|
|
103
|
+
if (r === 0) {
|
|
104
|
+
u = "EOF";
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
switch (i = c, r) {
|
|
108
|
+
case 34:
|
|
109
|
+
return u = "String", J();
|
|
110
|
+
case 45:
|
|
111
|
+
case 48:
|
|
112
|
+
case 49:
|
|
113
|
+
case 50:
|
|
114
|
+
case 51:
|
|
115
|
+
case 52:
|
|
116
|
+
case 53:
|
|
117
|
+
case 54:
|
|
118
|
+
case 55:
|
|
119
|
+
case 56:
|
|
120
|
+
case 57:
|
|
121
|
+
return u = "Number", U();
|
|
122
|
+
case 102:
|
|
123
|
+
if (l.slice(i, i + 5) !== "false")
|
|
124
|
+
break;
|
|
125
|
+
c += 4, s(), u = "Boolean";
|
|
126
|
+
return;
|
|
127
|
+
case 110:
|
|
128
|
+
if (l.slice(i, i + 4) !== "null")
|
|
129
|
+
break;
|
|
130
|
+
c += 3, s(), u = "Null";
|
|
131
|
+
return;
|
|
132
|
+
case 116:
|
|
133
|
+
if (l.slice(i, i + 4) !== "true")
|
|
134
|
+
break;
|
|
135
|
+
c += 3, s(), u = "Boolean";
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
u = l[i], s();
|
|
139
|
+
}
|
|
140
|
+
function J() {
|
|
141
|
+
for (s(); r !== 34 && r > 31; )
|
|
142
|
+
if (r === 92)
|
|
143
|
+
switch (r = s(), r) {
|
|
144
|
+
case 34:
|
|
145
|
+
case 47:
|
|
146
|
+
case 92:
|
|
147
|
+
case 98:
|
|
148
|
+
case 102:
|
|
149
|
+
case 110:
|
|
150
|
+
case 114:
|
|
151
|
+
case 116:
|
|
152
|
+
s();
|
|
153
|
+
break;
|
|
154
|
+
case 117:
|
|
155
|
+
s(), g(), g(), g(), g();
|
|
156
|
+
break;
|
|
157
|
+
default:
|
|
158
|
+
throw m("Bad character escape sequence.");
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
if (c === N)
|
|
162
|
+
throw m("Unterminated string.");
|
|
163
|
+
s();
|
|
164
|
+
}
|
|
165
|
+
if (r === 34) {
|
|
166
|
+
s();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
throw m("Unterminated string.");
|
|
170
|
+
}
|
|
171
|
+
function g() {
|
|
172
|
+
if (r >= 48 && r <= 57 || r >= 65 && r <= 70 || r >= 97 && r <= 102)
|
|
173
|
+
return s();
|
|
174
|
+
throw m("Expected hexadecimal digit.");
|
|
175
|
+
}
|
|
176
|
+
function U() {
|
|
177
|
+
r === 45 && s(), r === 48 ? s() : y(), r === 46 && (s(), y()), (r === 69 || r === 101) && (r = s(), (r === 43 || r === 45) && s(), y());
|
|
178
|
+
}
|
|
179
|
+
function y() {
|
|
180
|
+
if (r < 48 || r > 57)
|
|
181
|
+
throw m("Expected decimal digit.");
|
|
182
|
+
do
|
|
183
|
+
s();
|
|
184
|
+
while (r >= 48 && r <= 57);
|
|
185
|
+
}
|
|
186
|
+
Q.registerHelper("lint", "graphql-variables", (e, n, t) => {
|
|
187
|
+
if (!e)
|
|
188
|
+
return [];
|
|
189
|
+
let f;
|
|
190
|
+
try {
|
|
191
|
+
f = v(e);
|
|
192
|
+
} catch (o) {
|
|
193
|
+
if (o instanceof V)
|
|
194
|
+
return [O(t, o.position, o.message)];
|
|
195
|
+
throw o;
|
|
196
|
+
}
|
|
197
|
+
const { variableToType: a } = n;
|
|
198
|
+
return a ? _(t, a, f) : [];
|
|
199
|
+
});
|
|
200
|
+
function _(e, n, t) {
|
|
201
|
+
var f;
|
|
202
|
+
const a = [];
|
|
203
|
+
for (const o of t.members)
|
|
204
|
+
if (o) {
|
|
205
|
+
const p = (f = o.key) === null || f === void 0 ? void 0 : f.value, h = n[p];
|
|
206
|
+
if (h)
|
|
207
|
+
for (const [x, G] of b(h, o.value))
|
|
208
|
+
a.push(O(e, x, G));
|
|
209
|
+
else
|
|
210
|
+
a.push(O(e, o.key, `Variable "$${p}" does not appear in any GraphQL query.`));
|
|
211
|
+
}
|
|
212
|
+
return a;
|
|
213
|
+
}
|
|
214
|
+
function b(e, n) {
|
|
215
|
+
if (!e || !n)
|
|
216
|
+
return [];
|
|
217
|
+
if (e instanceof $)
|
|
218
|
+
return n.kind === "Null" ? [[n, `Type "${e}" is non-nullable and cannot be null.`]] : b(e.ofType, n);
|
|
219
|
+
if (n.kind === "Null")
|
|
220
|
+
return [];
|
|
221
|
+
if (e instanceof I) {
|
|
222
|
+
const t = e.ofType;
|
|
223
|
+
if (n.kind === "Array") {
|
|
224
|
+
const f = n.values || [];
|
|
225
|
+
return F(f, (a) => b(t, a));
|
|
226
|
+
}
|
|
227
|
+
return b(t, n);
|
|
228
|
+
}
|
|
229
|
+
if (e instanceof q) {
|
|
230
|
+
if (n.kind !== "Object")
|
|
231
|
+
return [[n, `Type "${e}" must be an Object.`]];
|
|
232
|
+
const t = /* @__PURE__ */ Object.create(null), f = F(n.members, (a) => {
|
|
233
|
+
var o;
|
|
234
|
+
const p = (o = a == null ? void 0 : a.key) === null || o === void 0 ? void 0 : o.value;
|
|
235
|
+
t[p] = !0;
|
|
236
|
+
const h = e.getFields()[p];
|
|
237
|
+
if (!h)
|
|
238
|
+
return [
|
|
239
|
+
[
|
|
240
|
+
a.key,
|
|
241
|
+
`Type "${e}" does not have a field "${p}".`
|
|
242
|
+
]
|
|
243
|
+
];
|
|
244
|
+
const x = h ? h.type : void 0;
|
|
245
|
+
return b(x, a.value);
|
|
246
|
+
});
|
|
247
|
+
for (const a of Object.keys(e.getFields())) {
|
|
248
|
+
const o = e.getFields()[a];
|
|
249
|
+
!t[a] && o.type instanceof $ && !o.defaultValue && f.push([
|
|
250
|
+
n,
|
|
251
|
+
`Object of type "${e}" is missing required field "${a}".`
|
|
252
|
+
]);
|
|
253
|
+
}
|
|
254
|
+
return f;
|
|
255
|
+
}
|
|
256
|
+
return e.name === "Boolean" && n.kind !== "Boolean" || e.name === "String" && n.kind !== "String" || e.name === "ID" && n.kind !== "Number" && n.kind !== "String" || e.name === "Float" && n.kind !== "Number" || e.name === "Int" && (n.kind !== "Number" || (n.value | 0) !== n.value) ? [[n, `Expected value of type "${e}".`]] : (e instanceof C || e instanceof M) && (n.kind !== "String" && n.kind !== "Number" && n.kind !== "Boolean" && n.kind !== "Null" || P(e.parseValue(n.value))) ? [[n, `Expected value of type "${e}".`]] : [];
|
|
257
|
+
}
|
|
258
|
+
function O(e, n, t) {
|
|
259
|
+
return {
|
|
260
|
+
message: t,
|
|
261
|
+
severity: "error",
|
|
262
|
+
type: "validation",
|
|
263
|
+
from: e.posFromIndex(n.start),
|
|
264
|
+
to: e.posFromIndex(n.end)
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function P(e) {
|
|
268
|
+
return e == null || e !== e;
|
|
269
|
+
}
|
|
270
|
+
function F(e, n) {
|
|
271
|
+
return Array.prototype.concat.apply([], e.map(n));
|
|
272
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";const h=require("./codemirror-Kv5dN_jU.js"),l=require("./index-BeOZF5ut.js"),g=require("./Range-CUfOrqgY.js");function R(t,i,a,u,r){const n=l.specifiedRules.filter(e=>!(e===l.NoUnusedFragmentsRule||e===l.ExecutableDefinitionsRule));return a&&Array.prototype.push.apply(n,a),l.validate(t,i,n).filter(e=>{if(e.message.includes("Unknown directive")&&e.nodes){const s=e.nodes[0];if(s&&s.kind===l.Kind.DIRECTIVE){const c=s.name.value;if(c==="arguments"||c==="argumentDefinitions")return!1}}return!0})}const v={Error:"Error",Warning:"Warning"},m={[v.Error]:1,[v.Warning]:2},f=(t,i)=>{if(!t)throw new Error(i)};function w(t,i=null,a,u,r){var n,o;let e=null,s="";r&&(s=typeof r=="string"?r:r.reduce((d,p)=>d+l.print(p)+`
|
|
2
|
+
|
|
3
|
+
`,""));const c=s?`${t}
|
|
4
|
+
|
|
5
|
+
${s}`:t;try{e=l.parse(c)}catch(d){if(d instanceof l.GraphQLError){const p=S((o=(n=d.locations)===null||n===void 0?void 0:n[0])!==null&&o!==void 0?o:{line:0},c);return[{severity:m.Error,message:d.message,source:"GraphQL: Syntax",range:p}]}throw d}return C(e,i,a)}function C(t,i=null,a,u){if(!i)return[];const r=R(i,t,a).flatMap(o=>y(o,m.Error,"Validation")),n=l.validate(i,t,[l.NoDeprecatedCustomRule]).flatMap(o=>y(o,m.Warning,"Deprecation"));return r.concat(n)}function y(t,i,a){if(!t.nodes)return[];const u=[];for(const[r,n]of t.nodes.entries()){const o=n.kind!=="Variable"&&"name"in n&&n.name!==void 0?n.name:"variable"in n&&n.variable!==void 0?n.variable:n;if(o){f(t.locations,"GraphQL validation error requires locations.");const e=t.locations[r],s=P(o),c=e.column+(s.end-s.start);u.push({source:`GraphQL: ${a}`,message:t.message,severity:i,range:new g.Range(new g.Position(e.line-1,e.column-1),new g.Position(e.line-1,c))})}}return u}function S(t,i){const a=l.onlineParser(),u=a.startState(),r=i.split(`
|
|
6
|
+
`);f(r.length>=t.line,"Query text must have more lines than where the error happened");let n=null;for(let c=0;c<t.line;c++)for(n=new l.CharacterStream(r[c]);!n.eol()&&a.token(n,u)!=="invalidchar";);f(n,"Expected Parser stream to be available.");const o=t.line-1,e=n.getStartOfToken(),s=n.getCurrentPosition();return new g.Range(new g.Position(o,e),new g.Position(o,s))}function P(t){const a=t.loc;return f(a,"Expected ASTNode to have a location."),a}const E=["error","warning","information","hint"],Q={"GraphQL: Validation":"validation","GraphQL: Deprecation":"deprecation","GraphQL: Syntax":"syntax"};h.CodeMirror.registerHelper("lint","graphql",(t,i)=>{const{schema:a,validationRules:u,externalFragments:r}=i;return w(t,a,u,void 0,r).map(e=>({message:e.message,severity:e.severity?E[e.severity-1]:E[0],type:e.source?Q[e.source]:void 0,from:h.CodeMirror.Pos(e.range.start.line,e.range.start.character),to:h.CodeMirror.Pos(e.range.end.line,e.range.end.character)}))});
|