stepzen-graphiql 2.1.0 → 2.1.3-experimental.0
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 +5 -0
- package/dist/babel-D4jPkB8I.js +15 -0
- package/dist/babel-JpECBl9w.mjs +7255 -0
- package/dist/components/ExplorerPage/ExplorerPage.d.ts +1 -1
- package/dist/components/ExplorerPage/GraphiQLInterface.d.ts +15 -6
- package/dist/components/ExplorerPage/Snippets.d.ts +0 -2
- package/dist/components/ExplorerPage/clearResponse.d.ts +1 -1
- package/dist/components/ExplorerPage/clearTooltip.d.ts +1 -1
- package/dist/estree-C0Hb5Q7V.mjs +4528 -0
- package/dist/estree-U7n5DgHH.js +44 -0
- package/dist/graphql-BTSjQZiC.js +28 -0
- package/dist/graphql-CBsByfto.js +28 -0
- package/dist/graphql-DDJE6tIl.mjs +157 -0
- package/dist/graphql-DrfUc9jr.mjs +1256 -0
- package/dist/graphql-DrfV554J.js +6 -0
- package/dist/graphql-QzAQRYwl.mjs +1221 -0
- package/dist/graphqlMode-DN1ezrYh.js +1 -0
- package/dist/graphqlMode-vV8mnLBW.mjs +262 -0
- package/dist/index-CjC6wsAG.js +1 -0
- package/dist/index-RniHQi68.mjs +84805 -0
- package/dist/index-gvW0eRXD.js +687 -0
- package/dist/index-tHknWeFg.mjs +295 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/jsonMode-BW-tqoSY.js +15 -0
- package/dist/jsonMode-Cj0cONq6.mjs +2002 -0
- package/dist/lib/graphiql-helpers.d.ts +2 -2
- package/dist/lite-Dpvo4tIS.js +1 -0
- package/dist/lite-hj39DC-n.mjs +135 -0
- package/dist/monaco-editor-C-pj7hSk.mjs +17 -0
- package/dist/monaco-editor-CBZFMjO6.js +1 -0
- package/dist/mouseTarget-C-J1vBNL.mjs +9353 -0
- package/dist/mouseTarget-S3azYj9_.js +9 -0
- package/dist/standalone-BhI0QomE.mjs +2458 -0
- package/dist/standalone-YWSF5RH2.js +29 -0
- package/dist/style.css +2 -2
- package/dist/style2.css +1 -0
- package/dist/toggleHighContrast-BK2acAo4.mjs +97805 -0
- package/dist/toggleHighContrast-MyO5wNxT.js +726 -0
- package/package.json +13 -15
- package/dist/Range-CPFFy5pj.mjs +0 -26
- package/dist/Range-CUfOrqgY.js +0 -1
- package/dist/SchemaReference-DNGK8Gti.mjs +0 -146
- package/dist/SchemaReference-PZPPI4-g.js +0 -1
- package/dist/brace-fold-DFRMFuzG.mjs +0 -122
- package/dist/brace-fold-QYFeMqi4.js +0 -1
- package/dist/closebrackets-5W81jIxx.js +0 -2
- package/dist/closebrackets-BJdKNrct.mjs +0 -165
- package/dist/codemirror-CK47QajN.mjs +0 -27
- package/dist/codemirror-DMBo1i5w.js +0 -24
- package/dist/codemirror-DgPcZxSc.mjs +0 -6121
- package/dist/codemirror-P5arRD-4.js +0 -1
- package/dist/comment-DZX4WUX2.js +0 -2
- package/dist/comment-DaZ9yeFw.mjs +0 -150
- package/dist/dialog-BWHlvTdM.js +0 -1
- package/dist/dialog-BvB91RPq.mjs +0 -26
- package/dist/dialog-Ci1bnuc2.mjs +0 -74
- package/dist/dialog-Dh2DOTOu.js +0 -1
- package/dist/foldgutter-CEPGXQXV.mjs +0 -238
- package/dist/foldgutter-lfb5vdue.js +0 -1
- package/dist/forEachState-DA54msa8.mjs +0 -11
- package/dist/forEachState-DY_pA9Bd.js +0 -1
- package/dist/hint-BImUj9vL.mjs +0 -24
- package/dist/hint-BYh7bCzG.js +0 -1
- package/dist/hint-CeNacopx.mjs +0 -123
- package/dist/hint-Cqs-Eq99.js +0 -1
- package/dist/index-BXTilrNr.mjs +0 -11
- package/dist/index-BqePscbb.js +0 -1
- package/dist/index-Of0v8HXf.js +0 -650
- package/dist/index-c_h-B3RW.mjs +0 -89430
- package/dist/info-DKGfeFeR.mjs +0 -99
- package/dist/info-addon-0QldEyjg.js +0 -1
- package/dist/info-addon-BQBJGmtN.mjs +0 -66
- package/dist/info-euxfaXDv.js +0 -1
- package/dist/javascript-BMRweX7z.js +0 -1
- package/dist/javascript-CEIhlHWT.mjs +0 -26
- package/dist/javascript-RO_jaPiE.mjs +0 -707
- package/dist/javascript-poxRzxcy.js +0 -1
- package/dist/jsx-BY-uBax7.js +0 -1
- package/dist/jsx-CZtHOvZL.mjs +0 -414
- package/dist/jump-Bn-VPPJQ.js +0 -1
- package/dist/jump-BrK8-pOa.mjs +0 -85
- package/dist/jump-to-line-V4vHDeSQ.mjs +0 -61
- package/dist/jump-to-line-Zpc7tkYy.js +0 -1
- package/dist/lint-BBDtrEaL.js +0 -1
- package/dist/lint-BEn4QK3F.mjs +0 -216
- package/dist/lint-BgrfL8k7.js +0 -1
- package/dist/lint-CiQwkfWf.mjs +0 -112
- package/dist/lint-DxY_4HRh.js +0 -6
- package/dist/lint-naD3ldhf.mjs +0 -272
- package/dist/matchbrackets-BB4g2Y6d.mjs +0 -87
- package/dist/matchbrackets-DPv_MB7c.js +0 -1
- package/dist/matchbrackets-DhN7zJoS.js +0 -1
- package/dist/matchbrackets-eKECiv9B.mjs +0 -26
- package/dist/mode-CgGO246j.js +0 -1
- package/dist/mode-CwlRWrPi.mjs +0 -73
- package/dist/mode-DyP1DXNa.js +0 -1
- package/dist/mode-indent-9VnFlqY-.mjs +0 -8
- package/dist/mode-indent-m3TP74Ia.js +0 -1
- package/dist/mode-kdpxZ9Hq.mjs +0 -25
- package/dist/mode-r_2HfIrS.js +0 -1
- package/dist/mode-xgi1fEzL.mjs +0 -64
- package/dist/search-BuLFIkN5.mjs +0 -268
- package/dist/search-CclAH4eV.js +0 -2
- package/dist/searchcursor-B9F32jvl.mjs +0 -26
- package/dist/searchcursor-CV26OekK.js +0 -1
- package/dist/searchcursor-DHtNMOPb.mjs +0 -239
- package/dist/searchcursor-eGwb3e2h.js +0 -7
- package/dist/show-hint-BfWoiGzQ.mjs +0 -357
- package/dist/show-hint-CQ_VjC6w.js +0 -1
- package/dist/sublime-C6Rg9CL1.mjs +0 -563
- package/dist/sublime-DFk-sDtd.js +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var S=Object.defineProperty;var v=(t,e,r)=>e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var g=(t,e,r)=>v(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./toggleHighContrast-MyO5wNxT.js"),i=require("./index-gvW0eRXD.js"),K=120*1e3;class M{constructor(e){g(this,"_defaults");g(this,"_idleCheckInterval");g(this,"_lastUsedTime",0);g(this,"_configChangeListener");g(this,"_worker",null);g(this,"_client",null);this._defaults=e,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),30*1e3),this._configChangeListener=this._defaults.onDidChange(()=>{this._stopWorker()})}_stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){if(!this._worker)return;Date.now()-this._lastUsedTime>K&&this._stopWorker()}async _getClient(){if(this._lastUsedTime=Date.now(),!this._client&&!this._worker)try{const{languageId:e,formattingOptions:r,schemas:a,externalFragmentDefinitions:l,completionSettings:d}=this._defaults;this._worker=c.editor.createWebWorker({moduleId:"monaco-graphql/esm/GraphQLWorker.js",label:e,createData:{languageId:e,formattingOptions:r,languageConfig:{schemas:a==null?void 0:a.map(i.getStringSchema),externalFragmentDefinitions:l,fillLeafsOnComplete:d.__experimental__fillLeafsOnComplete}}}),this._client=this._worker.getProxy()}catch(e){console.error("error loading worker",e)}return this._client}async getLanguageServiceWorker(...e){const r=await this._getClient();return await this._worker.withSyncedResources(e),r}}class T{constructor(e,r){g(this,"defaults");g(this,"_worker");g(this,"_disposables",[]);g(this,"_listener",Object.create(null));this.defaults=e,this._worker=r,this._worker=r;let a;const l=o=>{var h;const m=i.getModelLanguageId(o);if(m!==this.defaults.languageId)return;const u=o.uri.toString(),p=(h=e.diagnosticSettings.validateVariablesJSON)==null?void 0:h[u];a=setTimeout(()=>{this._doValidate(o.uri,m,p)},400),this._listener[u]=o.onDidChangeContent(()=>{clearTimeout(a),a=setTimeout(()=>{this._doValidate(o.uri,m,p)},400)})},d=o=>{c.editor.setModelMarkers(o,this.defaults.languageId,[]);const m=o.uri.toString(),u=this._listener[m];u&&(u.dispose(),delete this._listener[m])};this._disposables.push(c.editor.onDidCreateModel(l),{dispose(){clearTimeout(a)}},c.editor.onWillDisposeModel(o=>{d(o)}),c.editor.onDidChangeModelLanguage(o=>{d(o.model),l(o.model)}),{dispose:()=>{for(const o of Object.values(this._listener))o.dispose()}},e.onDidChange(()=>{for(const o of c.editor.getModels())i.getModelLanguageId(o)===this.defaults.languageId&&(d(o),l(o))}));for(const o of c.editor.getModels())i.getModelLanguageId(o)===this.defaults.languageId&&l(o)}dispose(){for(const e of this._disposables)e.dispose();this._disposables=[]}async _doValidate(e,r,a){var o;const l=await this._worker(e);if(!l)return;const d=await l.doValidation(e.toString());if(c.editor.setModelMarkers(c.editor.getModel(e),r,d),a){if(await Promise.resolve().then(()=>require("./toggleHighContrast-MyO5wNxT.js")).then(_=>_.monaco_contribution),!a.length)throw new Error("No variables URI strings provided to validate");const m=await l.doGetVariablesJSONSchema(e.toString());if(!m)return;const u=c.Uri.file(a[0].replace(".json","-schema.json")).toString(),p={uri:u,schema:m,fileMatch:a},h=((o=c.languages.json.jsonDefaults.diagnosticsOptions.schemas)==null?void 0:o.filter(_=>_.uri!==u))||[];c.languages.json.jsonDefaults.setDiagnosticsOptions({schemaValidation:"error",validate:!0,...this.defaults.diagnosticSettings.jsonDiagnosticSettings,schemas:[...h,p],enableSchemaRequest:!1})}}}const n=c.languages.CompletionItemKind,I={[i.CompletionItemKind.Text]:n.Text,[i.CompletionItemKind.Method]:n.Method,[i.CompletionItemKind.Function]:n.Function,[i.CompletionItemKind.Constructor]:n.Constructor,[i.CompletionItemKind.Field]:n.Field,[i.CompletionItemKind.Variable]:n.Variable,[i.CompletionItemKind.Class]:n.Class,[i.CompletionItemKind.Interface]:n.Interface,[i.CompletionItemKind.Module]:n.Module,[i.CompletionItemKind.Property]:n.Property,[i.CompletionItemKind.Unit]:n.Unit,[i.CompletionItemKind.Value]:n.Value,[i.CompletionItemKind.Enum]:n.Enum,[i.CompletionItemKind.Keyword]:n.Keyword,[i.CompletionItemKind.Snippet]:n.Snippet,[i.CompletionItemKind.Color]:n.Color,[i.CompletionItemKind.File]:n.File,[i.CompletionItemKind.Reference]:n.Reference,[i.CompletionItemKind.Folder]:n.Folder,[i.CompletionItemKind.EnumMember]:n.EnumMember,[i.CompletionItemKind.Constant]:n.Constant,[i.CompletionItemKind.Struct]:n.Struct,[i.CompletionItemKind.Event]:n.Event,[i.CompletionItemKind.Operator]:n.Operator,[i.CompletionItemKind.TypeParameter]:n.TypeParameter};function b(t){return t in I?I[t]:n.Text}function x(t){return{range:t.range,kind:b(t.kind),label:t.label,insertText:t.insertText??t.label,insertTextRules:t.insertText?c.languages.CompletionItemInsertTextRule.InsertAsSnippet:void 0,sortText:t.sortText,filterText:t.filterText,documentation:t.documentation,detail:t.detail,command:t.command}}class F{constructor(e){g(this,"_worker");this._worker=e,this._worker=e}get triggerCharacters(){return[":","$"," ","(","@"]}async provideCompletionItems(e,r,a,l){try{return{incomplete:!0,suggestions:(await(await this._worker(e.uri)).doComplete(e.uri.toString(),r)).map(x)}}catch(d){return console.error("Error fetching completion items",d),{suggestions:[]}}}}class O{constructor(e){g(this,"_worker");this._worker=e,this._worker=e}async provideDocumentFormattingEdits(e,r,a){const d=await(await this._worker(e.uri)).doFormat(e.uri.toString());return d?[{range:e.getFullModelRange(),text:d}]:[]}}class L{constructor(e){g(this,"_worker");this._worker=e}async provideHover(e,r,a){const l=e.uri,o=await(await this._worker(e.uri)).doHover(l.toString(),r);return o?{range:o.range,contents:[{value:o.content}]}:{contents:[]}}dispose(){}}function E(t){const e=[],r=[],a=new M(t);e.push(a);const l=(...s)=>{try{return a.getLanguageServiceWorker(...s)}catch{throw new Error("Error fetching graphql language service worker")}};function d(){const{modeConfiguration:s,languageId:f}=t;s.documentFormattingEdits&&r.push(c.languages.registerDocumentFormattingEditProvider(f,new O(l)))}function o(s){const{modeConfiguration:f,languageId:C}=t;w(r),f.completionItems&&r.push(c.languages.registerCompletionItemProvider(C,new F(l))),f.diagnostics&&r.push(new T(s,l)),f.hovers&&r.push(c.languages.registerHoverProvider(C,new L(l))),d()}let{modeConfiguration:m,formattingOptions:u,diagnosticSettings:p,externalFragmentDefinitions:h,schemas:_}=t;return o(t),t.onDidChange(s=>{s.modeConfiguration!==m&&(m=s.modeConfiguration,o(s)),s.formattingOptions!==u&&(u=s.formattingOptions,d()),s.externalFragmentDefinitions!==h&&(h=s.externalFragmentDefinitions,o(s)),s.diagnosticSettings!==p&&(p=s.diagnosticSettings,o(s)),s.schemas!==_&&(_=s.schemas,o(s))}),e.push(k(r)),k(e)}function k(t){return{dispose:()=>w(t)}}function w(t){for(;t.length;)t.pop().dispose()}exports.setupMode=E;
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var T = (t, e, r) => e in t ? M(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var d = (t, e, r) => T(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { e as u, U as x, l as f } from "./toggleHighContrast-BK2acAo4.mjs";
|
|
5
|
+
import { m as F, n as w, o as s } from "./index-RniHQi68.mjs";
|
|
6
|
+
const b = 120 * 1e3;
|
|
7
|
+
class O {
|
|
8
|
+
constructor(e) {
|
|
9
|
+
d(this, "_defaults");
|
|
10
|
+
d(this, "_idleCheckInterval");
|
|
11
|
+
d(this, "_lastUsedTime", 0);
|
|
12
|
+
d(this, "_configChangeListener");
|
|
13
|
+
d(this, "_worker", null);
|
|
14
|
+
d(this, "_client", null);
|
|
15
|
+
this._defaults = e, this._idleCheckInterval = window.setInterval(() => this._checkIfIdle(), 30 * 1e3), this._configChangeListener = this._defaults.onDidChange(() => {
|
|
16
|
+
this._stopWorker();
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
_stopWorker() {
|
|
20
|
+
this._worker && (this._worker.dispose(), this._worker = null), this._client = null;
|
|
21
|
+
}
|
|
22
|
+
dispose() {
|
|
23
|
+
clearInterval(this._idleCheckInterval), this._configChangeListener.dispose(), this._stopWorker();
|
|
24
|
+
}
|
|
25
|
+
_checkIfIdle() {
|
|
26
|
+
if (!this._worker)
|
|
27
|
+
return;
|
|
28
|
+
Date.now() - this._lastUsedTime > b && this._stopWorker();
|
|
29
|
+
}
|
|
30
|
+
async _getClient() {
|
|
31
|
+
if (this._lastUsedTime = Date.now(), !this._client && !this._worker)
|
|
32
|
+
try {
|
|
33
|
+
const { languageId: e, formattingOptions: r, schemas: a, externalFragmentDefinitions: c, completionSettings: l } = this._defaults;
|
|
34
|
+
this._worker = u.createWebWorker({
|
|
35
|
+
moduleId: "monaco-graphql/esm/GraphQLWorker.js",
|
|
36
|
+
label: e,
|
|
37
|
+
createData: {
|
|
38
|
+
languageId: e,
|
|
39
|
+
formattingOptions: r,
|
|
40
|
+
languageConfig: {
|
|
41
|
+
schemas: a == null ? void 0 : a.map(F),
|
|
42
|
+
externalFragmentDefinitions: c,
|
|
43
|
+
fillLeafsOnComplete: l.__experimental__fillLeafsOnComplete
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}), this._client = this._worker.getProxy();
|
|
47
|
+
} catch (e) {
|
|
48
|
+
console.error("error loading worker", e);
|
|
49
|
+
}
|
|
50
|
+
return this._client;
|
|
51
|
+
}
|
|
52
|
+
async getLanguageServiceWorker(...e) {
|
|
53
|
+
const r = await this._getClient();
|
|
54
|
+
return await this._worker.withSyncedResources(e), r;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
class E {
|
|
58
|
+
constructor(e, r) {
|
|
59
|
+
d(this, "defaults");
|
|
60
|
+
d(this, "_worker");
|
|
61
|
+
d(this, "_disposables", []);
|
|
62
|
+
d(this, "_listener", /* @__PURE__ */ Object.create(null));
|
|
63
|
+
this.defaults = e, this._worker = r, this._worker = r;
|
|
64
|
+
let a;
|
|
65
|
+
const c = (o) => {
|
|
66
|
+
var p;
|
|
67
|
+
const g = w(o);
|
|
68
|
+
if (g !== this.defaults.languageId)
|
|
69
|
+
return;
|
|
70
|
+
const h = o.uri.toString(), m = (p = e.diagnosticSettings.validateVariablesJSON) == null ? void 0 : p[h];
|
|
71
|
+
a = setTimeout(() => {
|
|
72
|
+
this._doValidate(o.uri, g, m);
|
|
73
|
+
}, 400), this._listener[h] = o.onDidChangeContent(() => {
|
|
74
|
+
clearTimeout(a), a = setTimeout(() => {
|
|
75
|
+
this._doValidate(o.uri, g, m);
|
|
76
|
+
}, 400);
|
|
77
|
+
});
|
|
78
|
+
}, l = (o) => {
|
|
79
|
+
u.setModelMarkers(o, this.defaults.languageId, []);
|
|
80
|
+
const g = o.uri.toString(), h = this._listener[g];
|
|
81
|
+
h && (h.dispose(), delete this._listener[g]);
|
|
82
|
+
};
|
|
83
|
+
this._disposables.push(u.onDidCreateModel(c), {
|
|
84
|
+
dispose() {
|
|
85
|
+
clearTimeout(a);
|
|
86
|
+
}
|
|
87
|
+
}, u.onWillDisposeModel((o) => {
|
|
88
|
+
l(o);
|
|
89
|
+
}), u.onDidChangeModelLanguage((o) => {
|
|
90
|
+
l(o.model), c(o.model);
|
|
91
|
+
}), {
|
|
92
|
+
dispose: () => {
|
|
93
|
+
for (const o of Object.values(this._listener))
|
|
94
|
+
o.dispose();
|
|
95
|
+
}
|
|
96
|
+
}, e.onDidChange(() => {
|
|
97
|
+
for (const o of u.getModels())
|
|
98
|
+
w(o) === this.defaults.languageId && (l(o), c(o));
|
|
99
|
+
}));
|
|
100
|
+
for (const o of u.getModels())
|
|
101
|
+
w(o) === this.defaults.languageId && c(o);
|
|
102
|
+
}
|
|
103
|
+
dispose() {
|
|
104
|
+
for (const e of this._disposables)
|
|
105
|
+
e.dispose();
|
|
106
|
+
this._disposables = [];
|
|
107
|
+
}
|
|
108
|
+
async _doValidate(e, r, a) {
|
|
109
|
+
var o;
|
|
110
|
+
const c = await this._worker(e);
|
|
111
|
+
if (!c)
|
|
112
|
+
return;
|
|
113
|
+
const l = await c.doValidation(e.toString());
|
|
114
|
+
if (u.setModelMarkers(u.getModel(e), r, l), a) {
|
|
115
|
+
if (await import("./toggleHighContrast-BK2acAo4.mjs").then((_) => _.d), !a.length)
|
|
116
|
+
throw new Error("No variables URI strings provided to validate");
|
|
117
|
+
const g = await c.doGetVariablesJSONSchema(e.toString());
|
|
118
|
+
if (!g)
|
|
119
|
+
return;
|
|
120
|
+
const h = x.file(a[0].replace(".json", "-schema.json")).toString(), m = {
|
|
121
|
+
uri: h,
|
|
122
|
+
schema: g,
|
|
123
|
+
fileMatch: a
|
|
124
|
+
}, p = ((o = f.json.jsonDefaults.diagnosticsOptions.schemas) == null ? void 0 : o.filter((_) => _.uri !== h)) || [];
|
|
125
|
+
f.json.jsonDefaults.setDiagnosticsOptions({
|
|
126
|
+
schemaValidation: "error",
|
|
127
|
+
validate: !0,
|
|
128
|
+
...this.defaults.diagnosticSettings.jsonDiagnosticSettings,
|
|
129
|
+
schemas: [...p, m],
|
|
130
|
+
enableSchemaRequest: !1
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const i = f.CompletionItemKind, S = {
|
|
136
|
+
[s.Text]: i.Text,
|
|
137
|
+
[s.Method]: i.Method,
|
|
138
|
+
[s.Function]: i.Function,
|
|
139
|
+
[s.Constructor]: i.Constructor,
|
|
140
|
+
[s.Field]: i.Field,
|
|
141
|
+
[s.Variable]: i.Variable,
|
|
142
|
+
[s.Class]: i.Class,
|
|
143
|
+
[s.Interface]: i.Interface,
|
|
144
|
+
[s.Module]: i.Module,
|
|
145
|
+
[s.Property]: i.Property,
|
|
146
|
+
[s.Unit]: i.Unit,
|
|
147
|
+
[s.Value]: i.Value,
|
|
148
|
+
[s.Enum]: i.Enum,
|
|
149
|
+
[s.Keyword]: i.Keyword,
|
|
150
|
+
[s.Snippet]: i.Snippet,
|
|
151
|
+
[s.Color]: i.Color,
|
|
152
|
+
[s.File]: i.File,
|
|
153
|
+
[s.Reference]: i.Reference,
|
|
154
|
+
[s.Folder]: i.Folder,
|
|
155
|
+
[s.EnumMember]: i.EnumMember,
|
|
156
|
+
[s.Constant]: i.Constant,
|
|
157
|
+
[s.Struct]: i.Struct,
|
|
158
|
+
[s.Event]: i.Event,
|
|
159
|
+
[s.Operator]: i.Operator,
|
|
160
|
+
[s.TypeParameter]: i.TypeParameter
|
|
161
|
+
};
|
|
162
|
+
function L(t) {
|
|
163
|
+
return t in S ? S[t] : i.Text;
|
|
164
|
+
}
|
|
165
|
+
function P(t) {
|
|
166
|
+
return {
|
|
167
|
+
range: t.range,
|
|
168
|
+
kind: L(t.kind),
|
|
169
|
+
label: t.label,
|
|
170
|
+
insertText: t.insertText ?? t.label,
|
|
171
|
+
insertTextRules: t.insertText ? f.CompletionItemInsertTextRule.InsertAsSnippet : void 0,
|
|
172
|
+
sortText: t.sortText,
|
|
173
|
+
filterText: t.filterText,
|
|
174
|
+
documentation: t.documentation,
|
|
175
|
+
detail: t.detail,
|
|
176
|
+
command: t.command
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
class j {
|
|
180
|
+
constructor(e) {
|
|
181
|
+
d(this, "_worker");
|
|
182
|
+
this._worker = e, this._worker = e;
|
|
183
|
+
}
|
|
184
|
+
get triggerCharacters() {
|
|
185
|
+
return [":", "$", " ", "(", "@"];
|
|
186
|
+
}
|
|
187
|
+
async provideCompletionItems(e, r, a, c) {
|
|
188
|
+
try {
|
|
189
|
+
return {
|
|
190
|
+
incomplete: !0,
|
|
191
|
+
suggestions: (await (await this._worker(e.uri)).doComplete(e.uri.toString(), r)).map(P)
|
|
192
|
+
};
|
|
193
|
+
} catch (l) {
|
|
194
|
+
return console.error("Error fetching completion items", l), { suggestions: [] };
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
class V {
|
|
199
|
+
constructor(e) {
|
|
200
|
+
d(this, "_worker");
|
|
201
|
+
this._worker = e, this._worker = e;
|
|
202
|
+
}
|
|
203
|
+
async provideDocumentFormattingEdits(e, r, a) {
|
|
204
|
+
const l = await (await this._worker(e.uri)).doFormat(e.uri.toString());
|
|
205
|
+
return l ? [
|
|
206
|
+
{
|
|
207
|
+
range: e.getFullModelRange(),
|
|
208
|
+
text: l
|
|
209
|
+
}
|
|
210
|
+
] : [];
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
class W {
|
|
214
|
+
constructor(e) {
|
|
215
|
+
d(this, "_worker");
|
|
216
|
+
this._worker = e;
|
|
217
|
+
}
|
|
218
|
+
async provideHover(e, r, a) {
|
|
219
|
+
const c = e.uri, o = await (await this._worker(e.uri)).doHover(c.toString(), r);
|
|
220
|
+
return o ? {
|
|
221
|
+
range: o.range,
|
|
222
|
+
contents: [{ value: o.content }]
|
|
223
|
+
} : {
|
|
224
|
+
contents: []
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
dispose() {
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function A(t) {
|
|
231
|
+
const e = [], r = [], a = new O(t);
|
|
232
|
+
e.push(a);
|
|
233
|
+
const c = (...n) => {
|
|
234
|
+
try {
|
|
235
|
+
return a.getLanguageServiceWorker(...n);
|
|
236
|
+
} catch {
|
|
237
|
+
throw new Error("Error fetching graphql language service worker");
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
function l() {
|
|
241
|
+
const { modeConfiguration: n, languageId: k } = t;
|
|
242
|
+
n.documentFormattingEdits && r.push(f.registerDocumentFormattingEditProvider(k, new V(c)));
|
|
243
|
+
}
|
|
244
|
+
function o(n) {
|
|
245
|
+
const { modeConfiguration: k, languageId: C } = t;
|
|
246
|
+
v(r), k.completionItems && r.push(f.registerCompletionItemProvider(C, new j(c))), k.diagnostics && r.push(new E(n, c)), k.hovers && r.push(f.registerHoverProvider(C, new W(c))), l();
|
|
247
|
+
}
|
|
248
|
+
let { modeConfiguration: g, formattingOptions: h, diagnosticSettings: m, externalFragmentDefinitions: p, schemas: _ } = t;
|
|
249
|
+
return o(t), t.onDidChange((n) => {
|
|
250
|
+
n.modeConfiguration !== g && (g = n.modeConfiguration, o(n)), n.formattingOptions !== h && (h = n.formattingOptions, l()), n.externalFragmentDefinitions !== p && (p = n.externalFragmentDefinitions, o(n)), n.diagnosticSettings !== m && (m = n.diagnosticSettings, o(n)), n.schemas !== _ && (_ = n.schemas, o(n));
|
|
251
|
+
}), e.push(I(r)), I(e);
|
|
252
|
+
}
|
|
253
|
+
function I(t) {
|
|
254
|
+
return { dispose: () => v(t) };
|
|
255
|
+
}
|
|
256
|
+
function v(t) {
|
|
257
|
+
for (; t.length; )
|
|
258
|
+
t.pop().dispose();
|
|
259
|
+
}
|
|
260
|
+
export {
|
|
261
|
+
A as setupMode
|
|
262
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-gvW0eRXD.js");function j(c){const{schema:p,context:O,roots:P,validate:x,execute:Q,subscribe:I,connectionInitWaitTimeout:v=3e3,onConnect:A,onDisconnect:C,onClose:f,onSubscribe:M,onOperation:S,onNext:h,onError:E,onComplete:_,jsonMessageReviver:N,jsonMessageReplacer:R}=c;return{opened(t,W){const a={connectionInitReceived:!1,acknowledged:!1,subscriptions:{},extra:W};if(t.protocol!==e.GRAPHQL_TRANSPORT_WS_PROTOCOL)return t.close(e.CloseCode.SubprotocolNotAcceptable,"Subprotocol not acceptable"),async(w,T)=>{await(f==null?void 0:f(a,w,T))};const L=v>0&&isFinite(v)?setTimeout(()=>{a.connectionInitReceived||t.close(e.CloseCode.ConnectionInitialisationTimeout,"Connection initialisation timeout")},v):null;return t.onMessage(async function(T){var m;let r;try{r=e.parseMessage(T,N)}catch{return t.close(e.CloseCode.BadRequest,"Invalid message received")}switch(r.type){case e.MessageType.ConnectionInit:{if(a.connectionInitReceived)return t.close(e.CloseCode.TooManyInitialisationRequests,"Too many initialisation requests");a.connectionInitReceived=!0,e.isObject(r.payload)&&(a.connectionParams=r.payload);const s=await(A==null?void 0:A(a));if(s===!1)return t.close(e.CloseCode.Forbidden,"Forbidden");a.acknowledged=!0,await t.send(e.stringifyMessage(e.isObject(s)?{type:e.MessageType.ConnectionAck,payload:s}:{type:e.MessageType.ConnectionAck},R));return}case e.MessageType.Ping:{if(t.onPing)return await t.onPing(r.payload);await t.send(e.stringifyMessage(r.payload?{type:e.MessageType.Pong,payload:r.payload}:{type:e.MessageType.Pong}));return}case e.MessageType.Pong:return await((m=t.onPong)==null?void 0:m.call(t,r.payload));case e.MessageType.Subscribe:{if(!a.acknowledged)return t.close(e.CloseCode.Unauthorized,"Unauthorized");const{id:s,payload:b}=r;if(s in a.subscriptions)return t.close(e.CloseCode.SubscriberAlreadyExists,`Subscriber for ${s} already exists`);a.subscriptions[s]=null;const y={next:async(i,{id:n,payload:u},o)=>{const{errors:g,...l}=i,d=await(h==null?void 0:h(a,n,u,o,i));await t.send(e.stringifyMessage({id:n,type:e.MessageType.Next,payload:d||{...l,...g?{errors:g.map(H=>H.toJSON())}:{}}},R))},error:async(i,{id:n,payload:u})=>{const o=await(E==null?void 0:E(a,n,u,i));await t.send(e.stringifyMessage({id:n,type:e.MessageType.Error,payload:o||i.map(g=>g.toJSON())},R))},complete:async(i,{id:n,payload:u})=>{await(_==null?void 0:_(a,n,u)),i&&await t.send(e.stringifyMessage({id:n,type:e.MessageType.Complete},R))}};try{let i;const n=await(M==null?void 0:M(a,r.id,r.payload));if(n){if(G(n))return s in a.subscriptions?await y.error(n,r):void 0;if(Array.isArray(n))throw new Error("Invalid return value from onSubscribe hook, expected an array of GraphQLError objects");i=n}else{if(!p)throw new Error("The GraphQL schema is not provided");const l={operationName:b.operationName,document:e.parse(b.query),variableValues:b.variables};i={...l,schema:typeof p=="function"?await p(a,s,b,l):p};const d=(x??e.validate)(i.schema,i.document);if(d.length>0)return s in a.subscriptions?await y.error(d,r):void 0}const u=e.getOperationAST(i.document,i.operationName);if(!u)return s in a.subscriptions?await y.error([new e.GraphQLError("Unable to identify operation")],r):void 0;"rootValue"in i||(i.rootValue=P==null?void 0:P[u.operation]),"contextValue"in i||(i.contextValue=typeof O=="function"?await O(a,s,b,i):O);let o;u.operation==="subscription"?o=await(I??e.subscribe)(i):o=await(Q??e.execute)(i);const g=await(S==null?void 0:S(a,s,b,i,o));if(g&&(o=g),e.isAsyncIterable(o))if(!(s in a.subscriptions))e.isAsyncGenerator(o)&&o.return(void 0);else{a.subscriptions[s]=o;try{for await(const l of o)await y.next(l,r,i)}catch(l){const d=l instanceof Error?l:new Error(String(l));await y.error([e.versionInfo.major>=16?new e.GraphQLError(d.message,{originalError:d}):new e.GraphQLError(d.message,null,null,null,null,d)],r),delete a.subscriptions[s]}}else s in a.subscriptions&&await y.next(o,r,i);await y.complete(s in a.subscriptions,r)}finally{delete a.subscriptions[s]}return}case e.MessageType.Complete:{const s=a.subscriptions[r.id];delete a.subscriptions[r.id],e.isAsyncGenerator(s)&&await s.return(void 0);return}default:throw new Error(`Unexpected message of type ${r.type} received`)}}),async(w,T)=>{L&&clearTimeout(L);const r={...a.subscriptions};a.subscriptions={},await Promise.all(Object.values(r).filter(e.isAsyncGenerator).map(m=>m.return(void 0))),a.acknowledged&&await(C==null?void 0:C(a,w,T)),await(f==null?void 0:f(a,w,T))}}}}function q(c){switch(!0){case(c instanceof Set&&c.has(e.GRAPHQL_TRANSPORT_WS_PROTOCOL)):case(Array.isArray(c)&&c.includes(e.GRAPHQL_TRANSPORT_WS_PROTOCOL)):case(typeof c=="string"&&c.split(",").map(p=>p.trim()).includes(e.GRAPHQL_TRANSPORT_WS_PROTOCOL)):return e.GRAPHQL_TRANSPORT_WS_PROTOCOL;default:return!1}}function G(c){return Array.isArray(c)&&c.length>0&&c.every(p=>p instanceof e.GraphQLError)}exports.CloseCode=e.CloseCode;exports.DEPRECATED_GRAPHQL_WS_PROTOCOL=e.DEPRECATED_GRAPHQL_WS_PROTOCOL;exports.GRAPHQL_TRANSPORT_WS_PROTOCOL=e.GRAPHQL_TRANSPORT_WS_PROTOCOL;exports.MessageType=e.MessageType;exports.TerminatedCloseEvent=e.TerminatedCloseEvent;exports.createClient=e.createClient;exports.parseMessage=e.parseMessage;exports.stringifyMessage=e.stringifyMessage;exports.validateMessage=e.validateMessage;exports.areGraphQLErrors=G;exports.handleProtocols=q;exports.makeServer=j;
|