@neo4j-cypher/language-server 2.0.0-next.11 → 2.0.0-next.12

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @neo4j-cypher/language-server
2
2
 
3
+ ## 2.0.0-next.12
4
+
5
+ ### Patch Changes
6
+
7
+ - d85c1e0: Fixes bug with auto-completions
8
+ - Updated dependencies [bccf518]
9
+ - @neo4j-cypher/language-support@2.0.0-next.11
10
+
3
11
  ## 2.0.0-next.11
4
12
 
5
13
  ### Patch Changes
@@ -335,7 +335,7 @@ UNION ALL
335
335
  CALL db.propertyKeys() YIELD propertyKey
336
336
  RETURN COLLECT(propertyKey)[..${tSa}] AS result`,l=nin.resultTransformers.mappedResultTransformer({map(d){return d.toObject().result},collect(d,c){return{labels:d[0],relationshipTypes:d[1],propertyKeys:d[2],summary:c}}});return{query:u,queryConfig:{resultTransformer:l,routing:"READ",database:i}}}var Aon=W4(jTa()),von=W4(yk());function LTa(i){let u=i;return u.startsWith("LIST? OF ")&&(u=u.replace("LIST? OF ","LIST<"),u+=">"),u.replace(/\?/g,"")}function dde(i){return{...i,type:LTa(i.type)}}function qvu(i){return{...i,argumentDescription:i.argumentDescription.map(dde),returnDescription:LTa(i.returnDescription)}}var Hvu={type:"object",properties:{aggregating:{type:"boolean"},argumentDescription:{type:"array",items:{type:"object",properties:{name:{type:"string"},description:{type:"string"},type:{type:"string"},default:{type:"string",nullable:!0},isDeprecated:{type:"boolean",default:!1}},required:["name","description","type","isDeprecated"]}},category:{type:"string"},description:{type:"string"},isBuiltIn:{type:"boolean"},name:{type:"string"},returnDescription:{type:"string"},signature:{type:"string"},isDeprecated:{type:"boolean",default:!1}},required:["aggregating","argumentDescription","category","description","isBuiltIn","isDeprecated","name","returnDescription","signature"],additionalProperties:!0},Vvu=new Aon.default({useDefaults:!0}).compile(Hvu);function Son({executableByMe:i}={executableByMe:!1}){let u=`SHOW FUNCTIONS ${i?"EXECUTABLE BY CURRENT USER":""}
337
337
  YIELD name, category, description, isBuiltIn, argumentDescription, signature, returnDescription, aggregating, isDeprecated`,l=von.resultTransformers.mappedResultTransformer({map(d){let c=d.toObject();return Vvu(c),qvu(c)},collect(d,c){return{functions:d,summary:c}}});return{query:u,queryConfig:{resultTransformer:l,routing:"READ",database:"system"}}}var Ton=W4(jTa()),Ron=W4(yk());var Yvu={type:"object",properties:{admin:{type:"boolean"},argumentDescription:{type:"array",items:{type:"object",properties:{name:{type:"string"},description:{type:"string"},type:{type:"string"},default:{type:"string",nullable:!0},isDeprecated:{type:"boolean",default:!1}},required:["name","description","type","isDeprecated"]}},description:{type:"string"},mode:{type:"string"},name:{type:"string"},option:{type:"object"},returnDescription:{type:"array",items:{type:"object",properties:{name:{type:"string"},description:{type:"string"},type:{type:"string"},isDeprecated:{type:"boolean",default:!1}},required:["name","description","type","isDeprecated"]}},signature:{type:"string"},worksOnSystem:{type:"boolean"}},required:["admin","argumentDescription","description","mode","name","option","returnDescription","signature","worksOnSystem"],additionalProperties:!0},Wvu=new Ton.default({useDefaults:!0}).compile(Yvu);function zvu(i){return{...i,argumentDescription:i.argumentDescription.map(dde),returnDescription:i.returnDescription.map(dde)}}function Ion({executableByMe:i}={executableByMe:!1}){let u=`SHOW PROCEDURES ${i?"EXECUTABLE BY CURRENT USER":""}
338
- YIELD name, description, mode, worksOnSystem, argumentDescription, signature, returnDescription, admin, option`,l=Ron.resultTransformers.mappedResultTransformer({map(d){let c=d.toObject();return Wvu(c),zvu(c)},collect(d,c){return{procedures:d,summary:c}}});return{query:u,queryConfig:{routing:"READ",database:"system",resultTransformer:l}}}var Don=W4(yk());function Non(){let i="SHOW ROLES",u=Don.resultTransformers.mappedResultTransformer({map(l){return l.toObject()},collect(l,d){return{roles:l,summary:d}}});return{query:i,queryConfig:{resultTransformer:u,routing:"READ",database:"system"}}}var Pon=W4(yk());function kon(){let i="SHOW USERS",u=Pon.resultTransformers.mappedResultTransformer({map(l){return l.toObject()},collect(l,d){return{users:l,summary:d}}});return{query:i,queryConfig:{resultTransformer:u,routing:"READ",database:"system"}}}var Sk=class{status="not-started";data;lastFetchStart;errorMessage;connection;onRefetchDone;queryArgs;constructor({prefetchedData:u,queryArgs:l,connection:d,onRefetchDone:c}){this.connection=d,this.queryArgs=l,this.onRefetchDone=c,u&&(this.data=u,this.lastFetchStart=Date.now(),this.status="fetched")}async refetch(){if(this.status!=="fetching"){this.status="fetching",this.lastFetchStart=Date.now(),delete this.errorMessage;try{let u=await this.connection.runSdkQuery(this.queryArgs,{queryType:"system"});this.data=u,this.status="fetched",this.onRefetchDone?.({success:!0,data:u})}catch(u){let l=String(u);this.errorMessage=l,this.status="error",console.error(u),this.onRefetchDone?.({success:!1,errorMessage:l})}}}},pLe=class{connection;events;databases;dataSummary;functions;procedures;users;roles;dbPollingInterval;dbSchema={};constructor(u,l,d){this.connection=l,this.events=d,this.databases=new Sk({connection:l,queryArgs:kje(),prefetchedData:{databases:u},onRefetchDone:c=>{c.success&&(this.dbSchema.databaseNames=c.data.databases.flatMap(_=>_.name),this.dbSchema.aliasNames=c.data.databases.flatMap(_=>_.aliases??[]))}}),this.users=new Sk({connection:l,queryArgs:kon(),onRefetchDone:c=>{c.success&&(this.dbSchema.userNames=c.data.users.map(_=>_.user))}}),this.roles=new Sk({connection:l,queryArgs:Non(),onRefetchDone:c=>{c.success&&(this.dbSchema.roleNames=c.data.roles.map(_=>_.role))}}),this.dataSummary=new Sk({connection:l,queryArgs:iin(l.currentDb),onRefetchDone:c=>{if(c.success){let{labels:_,propertyKeys:A,relationshipTypes:x}=c.data;this.dbSchema.labels=_,this.dbSchema.propertyKeys=A,this.dbSchema.relationshipTypes=x}}}),this.functions=new Sk({connection:l,queryArgs:Son({executableByMe:!0}),onRefetchDone:c=>{if(c.success){let _=c.data.functions.reduce((A,x)=>{let{name:q}=x;return A[q]=x,A},{});this.dbSchema.functions=_}}}),this.procedures=new Sk({connection:l,queryArgs:Ion({executableByMe:!0}),onRefetchDone:c=>{if(c.success){let _=c.data.procedures.reduce((A,x)=>{let{name:q}=x;return A[q]=x,A},{});this.dbSchema.procedures=_}}})}async fetchDbSchema(){await Promise.allSettled([this.databases.refetch(),this.dataSummary.refetch(),this.procedures.refetch(),this.functions.refetch()]),this.events.emit("schemaFetched")}stopBackgroundPolling(){clearInterval(this.dbPollingInterval),this.dbPollingInterval=void 0}startBackgroundPolling(u=30){this.stopBackgroundPolling(),this.fetchDbSchema(),this.dbPollingInterval=setInterval(()=>void this.fetchDbSchema(),u*1e3)}};var xon="2.0.0-next.10";var won={app:"neo4j-sdk",version:xon},Kvu=5e3;function Xvu(i,u){if(u)return i.find(_=>_.name===u)?.name;let l=i.find(_=>_.home),d=i.find(_=>_.default),c=i.find(_=>_.name==="system");return l?.name??d?.name??c?.name??i[0]?.name}var _Le=class{connectedUser;protocolVersion;databases;driver;currentDb;constructor(u,l,d,c,_){this.connectedUser=u,this.protocolVersion=l,this.databases=d,this.driver=c,this.currentDb=Xvu(d,_)}async runCypherQuery({query:u,database:l,abortSignal:d}){let c=this.driver.session({database:l??this.currentDb});d!==void 0&&d.addEventListener("abort",()=>{c.close()});try{return await c.executeWrite(async A=>{let x=A.run(u,{}),q=[],O=!1;for await(let ce of x)if(q.length<Kvu)q.push(ce);else{O=!0;break}let G=await x.summary();return{records:q,summary:G,recordLimitHit:O}},{metadata:{...won,type:"user-direct"}})}finally{await c.close()}}async runSdkQuery({query:u,queryConfig:l},{queryType:d,abortSignal:c}){let _=this.driver.session({database:l?.database??this.currentDb});c!==void 0&&c.addEventListener("abort",()=>{_.close()});try{return await(l.routing==="READ"?_.executeRead.bind(_):_.executeWrite.bind(_))(async x=>{let q=x.run(u,{});return await l.resultTransformer(q)},{metadata:{...won,type:d}})}finally{await _.close()}}async healthcheck(){try{return await this.driver.verifyConnectivity({database:this.currentDb}),!0}catch{return!1}}dispose(){this.driver?.close()}};var Oon=5,jon=3e4,fde=class{connection;metadata;events=new Lon.EventEmitter;driver;reconnectionTimeout;retries=Oon;lastError;async connect(u,l,d,c){try{this.driver=await this.initializeDriver(u,l,d,c)}catch(_){return console.error("Error connecting to Neo4j.",_),{success:!1,retriable:ICa(_),error:DCa(_)}}return{success:!0}}async persistentConnect(u,l,d,c){let _=this.connection!==void 0,A=await this.connection?.healthcheck(),x=this.connection&&c&&this.connection?.currentDb!==c;if(!A||x){_&&!x?(console.error("Connection to Neo4j dropped"),this.disconnect()):x&&this.disconnect();try{return await this.connectAndStartMetadataPoller(u,l,d,c),this.reconnectionTimeout=this.setReconnectionTimeout(u,l,d,c),this.handleSuccessfulConnection()}catch(q){return console.error("Error connecting to Neo4j.",q),this.retries-=1,this.lastError=DCa(q),ICa(q)?this.retries>0?(this.reconnectionTimeout=this.setReconnectionTimeout(u,l,d,c),this.handleNonSuccessfulConnection()):this.handlePermanentlyFailingConnection():this.handlePermanentlyFailingConnection()}}return this.reconnectionTimeout=this.setReconnectionTimeout(u,l,d,c),{success:!0}}disconnect(){this.connection&&console.log("Disconnected from Neo4j"),this.connection?.dispose(),this.metadata?.stopBackgroundPolling(),this.connection=void 0,this.metadata=void 0,this.driver=void 0,clearTimeout(this.reconnectionTimeout)}async connectAndStartMetadataPoller(u,l,d,c){this.driver=this.driver??await this.initializeDriver(u,l,d,c);let{query:_,queryConfig:A}=kje(),{databases:x,summary:q}=await this.driver.executeQuery(_,{},A),O=q.server.protocolVersion?.toString()??"unknown";this.connection=new _Le(l.username,O,x,this.driver,c),this.metadata=new pLe(x,this.connection,this.events),this.metadata.startBackgroundPolling()}async initializeDriver(u,l,d,c){let _=MTa.default.driver(u,MTa.default.auth.basic(l.username,l.password),{userAgent:d.appName,...d.driverConfig});if(await _.verifyConnectivity({database:c}),await _.supportsSessionAuth()&&!await _.verifyAuthentication())throw new Error("Invalid credentials");return _}setReconnectionTimeout(u,l,d,c){return setTimeout(()=>{this.persistentConnect(u,l,d,c)},jon)}handleSuccessfulConnection(){return this.resetRetries(),console.log("Established connection to Neo4j"),this.events.emit("connectionConnected"),{success:!0}}handleNonSuccessfulConnection(){let u=this.formatConnectionErrorFriendlyMessage(this.lastError,!0);return this.events.emit("connectionErrored",u),{success:!1,retriable:!0,error:u}}handlePermanentlyFailingConnection(){this.resetRetries();let u=this.formatConnectionErrorFriendlyMessage(this.lastError,!1);return this.events.emit("connectionFailed",u),{success:!1,retriable:!1,error:u}}formatConnectionErrorFriendlyMessage(u={message:"",friendlyMessage:oX.Default,code:""},l){let d=l?`${u.friendlyMessage}. Retrying in ${jon/1e3} seconds`:u.friendlyMessage;return{...u,friendlyMessage:d}}resetRetries(){this.retries=Oon}};var Mon=W4(Xga());function Fon(i,u){return l=>{let d=i.get(l.textDocument.uri);if(d===void 0)return[];let c=l.position,_=d.offsetAt(c);return OJt(d.getText().slice(0,_),u.metadata?.dbSchema??{},_,l.context.triggerKind===Mon.CompletionTriggerKind.Invoked).map(q=>q.signature?{...q,detail:q.detail+" "+q.signature,signature:void 0}:q)}}var Qvu={signatures:[],activeSignature:void 0,activeParameter:void 0};function Bon(i,u){return l=>{let d=i.get(l.textDocument.uri),c=l.context?.triggerCharacter===")";if(d===void 0||c)return Qvu;let _=l.position,A=d.offsetAt(_);return LJt(d.getText(),u.metadata?.dbSchema??{},A)}}var Gon=W4(Kga());function Uon(i){return u=>{let l=i.get(u.textDocument.uri);if(l===void 0)return{data:[]};let d=UJt(l.getText()),c=new Gon.SemanticTokensBuilder;return d.forEach(A=>{let x=GJt(A.tokenType);x!==void 0&&c.push(A.position.line,A.position.startCharacter,A.length,x,0)}),c.build()}}var gcn=W4(Yon()),bcn=require("path"),QTa=W4(ycn()),Ccn=QTa.default.pool((0,bcn.join)(__dirname,"lintWorker.js"),{minWorkers:2,workerTerminateTimeout:2e3}),Cde;async function OSu(i,u,l){let{document:d}=i,c=d.getText();if(c.length===0){u([]);return}let _=l.metadata?.dbSchema??{},A=qJt(c,_);if(u(A),A.length===0)try{Cde!==void 0&&!Cde.resolved&&Cde.cancel(),Cde=(await Ccn.proxy()).validateSemantics(c,_);let q=await Cde;u(q)}catch(x){x instanceof QTa.default.Promise.CancellationError||console.error(x)}}var Ecn=(0,gcn.default)(OSu,600,{leading:!1,trailing:!0}),hcn=()=>{Ccn.terminate()};var U5=(0,B7.createConnection)(B7.ProposedFeatures.all),Ede=new B7.TextDocuments(NNe),UQ=new fde;U5.onInitialize(()=>({capabilities:{textDocumentSync:B7.TextDocumentSyncKind.Full,completionProvider:{resolveProvider:!1,triggerCharacters:[".",":","{","$",")"]},semanticTokensProvider:{documentSelector:[{language:"cypher"}],legend:SPe,range:!1,full:{delta:!1}},signatureHelpProvider:{triggerCharacters:["(",",",")"]}}}));U5.onInitialized(()=>{U5.client.register(B7.DidChangeConfigurationNotification.type,{section:"neo4j"});let i={documentSelector:[{language:"cypher"}],legend:SPe,range:!1,full:{delta:!1}};U5.client.register(B7.SemanticTokensRegistrationType.type,i)});Ede.onDidChangeContent(i=>Ecn(i,u=>{U5.sendDiagnostics({uri:i.document.uri,diagnostics:u})},UQ));U5.languages.semanticTokens.on(Uon(Ede));U5.onSignatureHelp(Bon(Ede,UQ));U5.onCompletion(Fon(Ede,UQ));U5.onNotification("connectionUpdated",i=>{jSu(i)});U5.onNotification("connectionDisconnected",()=>{Acn()});Ede.listen(U5);U5.listen();U5.onExit(()=>{hcn()});var jSu=i=>{Acn(),UQ.connection===void 0&&i.connect&&i.password&&i.connectURL&&i.user&&UQ.persistentConnect(i.connectURL,{username:i.user,password:i.password},{appName:"cypher-language-server"},i.database)},Acn=()=>{UQ.disconnect()};
338
+ YIELD name, description, mode, worksOnSystem, argumentDescription, signature, returnDescription, admin, option`,l=Ron.resultTransformers.mappedResultTransformer({map(d){let c=d.toObject();return Wvu(c),zvu(c)},collect(d,c){return{procedures:d,summary:c}}});return{query:u,queryConfig:{routing:"READ",database:"system",resultTransformer:l}}}var Don=W4(yk());function Non(){let i="SHOW ROLES",u=Don.resultTransformers.mappedResultTransformer({map(l){return l.toObject()},collect(l,d){return{roles:l,summary:d}}});return{query:i,queryConfig:{resultTransformer:u,routing:"READ",database:"system"}}}var Pon=W4(yk());function kon(){let i="SHOW USERS",u=Pon.resultTransformers.mappedResultTransformer({map(l){return l.toObject()},collect(l,d){return{users:l,summary:d}}});return{query:i,queryConfig:{resultTransformer:u,routing:"READ",database:"system"}}}var Sk=class{status="not-started";data;lastFetchStart;errorMessage;connection;onRefetchDone;queryArgs;constructor({prefetchedData:u,queryArgs:l,connection:d,onRefetchDone:c}){this.connection=d,this.queryArgs=l,this.onRefetchDone=c,u&&(this.data=u,this.lastFetchStart=Date.now(),this.status="fetched")}async refetch(){if(this.status!=="fetching"){this.status="fetching",this.lastFetchStart=Date.now(),delete this.errorMessage;try{let u=await this.connection.runSdkQuery(this.queryArgs,{queryType:"system"});this.data=u,this.status="fetched",this.onRefetchDone?.({success:!0,data:u})}catch(u){let l=String(u);this.errorMessage=l,this.status="error",console.error(u),this.onRefetchDone?.({success:!1,errorMessage:l})}}}},pLe=class{connection;events;databases;dataSummary;functions;procedures;users;roles;dbPollingInterval;dbSchema={};constructor(u,l,d){this.connection=l,this.events=d,this.databases=new Sk({connection:l,queryArgs:kje(),prefetchedData:{databases:u},onRefetchDone:c=>{c.success&&(this.dbSchema.databaseNames=c.data.databases.flatMap(_=>_.name),this.dbSchema.aliasNames=c.data.databases.flatMap(_=>_.aliases??[]))}}),this.users=new Sk({connection:l,queryArgs:kon(),onRefetchDone:c=>{c.success&&(this.dbSchema.userNames=c.data.users.map(_=>_.user))}}),this.roles=new Sk({connection:l,queryArgs:Non(),onRefetchDone:c=>{c.success&&(this.dbSchema.roleNames=c.data.roles.map(_=>_.role))}}),this.dataSummary=new Sk({connection:l,queryArgs:iin(l.currentDb),onRefetchDone:c=>{if(c.success){let{labels:_,propertyKeys:A,relationshipTypes:x}=c.data;this.dbSchema.labels=_,this.dbSchema.propertyKeys=A,this.dbSchema.relationshipTypes=x}}}),this.functions=new Sk({connection:l,queryArgs:Son({executableByMe:!0}),onRefetchDone:c=>{if(c.success){let _=c.data.functions.reduce((A,x)=>{let{name:q}=x;return A[q]=x,A},{});this.dbSchema.functions=_}}}),this.procedures=new Sk({connection:l,queryArgs:Ion({executableByMe:!0}),onRefetchDone:c=>{if(c.success){let _=c.data.procedures.reduce((A,x)=>{let{name:q}=x;return A[q]=x,A},{});this.dbSchema.procedures=_}}})}async fetchDbSchema(){await Promise.allSettled([this.databases.refetch(),this.dataSummary.refetch(),this.procedures.refetch(),this.functions.refetch()]),this.events.emit("schemaFetched")}stopBackgroundPolling(){clearInterval(this.dbPollingInterval),this.dbPollingInterval=void 0}startBackgroundPolling(u=30){this.stopBackgroundPolling(),this.fetchDbSchema(),this.dbPollingInterval=setInterval(()=>void this.fetchDbSchema(),u*1e3)}};var xon="2.0.0-next.11";var won={app:"neo4j-sdk",version:xon},Kvu=5e3;function Xvu(i,u){if(u)return i.find(_=>_.name===u)?.name;let l=i.find(_=>_.home),d=i.find(_=>_.default),c=i.find(_=>_.name==="system");return l?.name??d?.name??c?.name??i[0]?.name}var _Le=class{connectedUser;protocolVersion;databases;driver;currentDb;constructor(u,l,d,c,_){this.connectedUser=u,this.protocolVersion=l,this.databases=d,this.driver=c,this.currentDb=Xvu(d,_)}async runCypherQuery({query:u,database:l,abortSignal:d}){let c=this.driver.session({database:l??this.currentDb});d!==void 0&&d.addEventListener("abort",()=>{c.close()});try{return await c.executeWrite(async A=>{let x=A.run(u,{}),q=[],O=!1;for await(let ce of x)if(q.length<Kvu)q.push(ce);else{O=!0;break}let G=await x.summary();return{records:q,summary:G,recordLimitHit:O}},{metadata:{...won,type:"user-direct"}})}finally{await c.close()}}async runSdkQuery({query:u,queryConfig:l},{queryType:d,abortSignal:c}){let _=this.driver.session({database:l?.database??this.currentDb});c!==void 0&&c.addEventListener("abort",()=>{_.close()});try{return await(l.routing==="READ"?_.executeRead.bind(_):_.executeWrite.bind(_))(async x=>{let q=x.run(u,{});return await l.resultTransformer(q)},{metadata:{...won,type:d}})}finally{await _.close()}}async healthcheck(){try{return await this.driver.verifyConnectivity({database:this.currentDb}),!0}catch{return!1}}dispose(){this.driver?.close()}};var Oon=5,jon=3e4,fde=class{connection;metadata;events=new Lon.EventEmitter;driver;reconnectionTimeout;retries=Oon;lastError;async connect(u,l,d,c){try{this.driver=await this.initializeDriver(u,l,d,c)}catch(_){return console.error("Error connecting to Neo4j.",_),{success:!1,retriable:ICa(_),error:DCa(_)}}return{success:!0}}async persistentConnect(u,l,d,c){let _=this.connection!==void 0,A=await this.connection?.healthcheck(),x=this.connection&&c&&this.connection?.currentDb!==c;if(!A||x){_&&!x?(console.error("Connection to Neo4j dropped"),this.disconnect()):x&&this.disconnect();try{return await this.connectAndStartMetadataPoller(u,l,d,c),this.reconnectionTimeout=this.setReconnectionTimeout(u,l,d,c),this.handleSuccessfulConnection()}catch(q){return console.error("Error connecting to Neo4j.",q),this.retries-=1,this.lastError=DCa(q),ICa(q)?this.retries>0?(this.reconnectionTimeout=this.setReconnectionTimeout(u,l,d,c),this.handleNonSuccessfulConnection()):this.handlePermanentlyFailingConnection():this.handlePermanentlyFailingConnection()}}return this.reconnectionTimeout=this.setReconnectionTimeout(u,l,d,c),{success:!0}}disconnect(){this.connection&&console.log("Disconnected from Neo4j"),this.connection?.dispose(),this.metadata?.stopBackgroundPolling(),this.connection=void 0,this.metadata=void 0,this.driver=void 0,clearTimeout(this.reconnectionTimeout)}async connectAndStartMetadataPoller(u,l,d,c){this.driver=this.driver??await this.initializeDriver(u,l,d,c);let{query:_,queryConfig:A}=kje(),{databases:x,summary:q}=await this.driver.executeQuery(_,{},A),O=q.server.protocolVersion?.toString()??"unknown";this.connection=new _Le(l.username,O,x,this.driver,c),this.metadata=new pLe(x,this.connection,this.events),this.metadata.startBackgroundPolling()}async initializeDriver(u,l,d,c){let _=MTa.default.driver(u,MTa.default.auth.basic(l.username,l.password),{userAgent:d.appName,...d.driverConfig});if(await _.verifyConnectivity({database:c}),await _.supportsSessionAuth()&&!await _.verifyAuthentication())throw new Error("Invalid credentials");return _}setReconnectionTimeout(u,l,d,c){return setTimeout(()=>{this.persistentConnect(u,l,d,c)},jon)}handleSuccessfulConnection(){return this.resetRetries(),console.log("Established connection to Neo4j"),this.events.emit("connectionConnected"),{success:!0}}handleNonSuccessfulConnection(){let u=this.formatConnectionErrorFriendlyMessage(this.lastError,!0);return this.events.emit("connectionErrored",u),{success:!1,retriable:!0,error:u}}handlePermanentlyFailingConnection(){this.resetRetries();let u=this.formatConnectionErrorFriendlyMessage(this.lastError,!1);return this.events.emit("connectionFailed",u),{success:!1,retriable:!1,error:u}}formatConnectionErrorFriendlyMessage(u={message:"",friendlyMessage:oX.Default,code:""},l){let d=l?`${u.friendlyMessage}. Retrying in ${jon/1e3} seconds`:u.friendlyMessage;return{...u,friendlyMessage:d}}resetRetries(){this.retries=Oon}};var Mon=W4(Xga());function Fon(i,u){return l=>{let d=i.get(l.textDocument.uri);if(d===void 0)return[];let c=l.position,_=d.offsetAt(c);return OJt(d.getText().slice(0,_),u.metadata?.dbSchema??{},_,l.context.triggerKind===Mon.CompletionTriggerKind.Invoked).map(q=>q.signature?{...q,detail:q.detail+" "+q.signature,signature:void 0}:q)}}var Qvu={signatures:[],activeSignature:void 0,activeParameter:void 0};function Bon(i,u){return l=>{let d=i.get(l.textDocument.uri),c=l.context?.triggerCharacter===")";if(d===void 0||c)return Qvu;let _=l.position,A=d.offsetAt(_);return LJt(d.getText(),u.metadata?.dbSchema??{},A)}}var Gon=W4(Kga());function Uon(i){return u=>{let l=i.get(u.textDocument.uri);if(l===void 0)return{data:[]};let d=UJt(l.getText()),c=new Gon.SemanticTokensBuilder;return d.forEach(A=>{let x=GJt(A.tokenType);x!==void 0&&c.push(A.position.line,A.position.startCharacter,A.length,x,0)}),c.build()}}var gcn=W4(Yon()),bcn=require("path"),QTa=W4(ycn()),Ccn=QTa.default.pool((0,bcn.join)(__dirname,"lintWorker.js"),{minWorkers:2,workerTerminateTimeout:2e3}),Cde;async function OSu(i,u,l){let{document:d}=i,c=d.getText();if(c.length===0){u([]);return}let _=l.metadata?.dbSchema??{},A=qJt(c,_);if(u(A),A.length===0)try{Cde!==void 0&&!Cde.resolved&&Cde.cancel(),Cde=(await Ccn.proxy()).validateSemantics(c,_);let q=await Cde;u(q)}catch(x){x instanceof QTa.default.Promise.CancellationError||console.error(x)}}var Ecn=(0,gcn.default)(OSu,600,{leading:!1,trailing:!0}),hcn=()=>{Ccn.terminate()};var U5=(0,B7.createConnection)(B7.ProposedFeatures.all),Ede=new B7.TextDocuments(NNe),UQ=new fde;U5.onInitialize(()=>({capabilities:{textDocumentSync:B7.TextDocumentSyncKind.Full,completionProvider:{resolveProvider:!1,triggerCharacters:[".",":","{","$",")"]},semanticTokensProvider:{documentSelector:[{language:"cypher"}],legend:SPe,range:!1,full:{delta:!1}},signatureHelpProvider:{triggerCharacters:["(",",",")"]}}}));U5.onInitialized(()=>{U5.client.register(B7.DidChangeConfigurationNotification.type,{section:"neo4j"});let i={documentSelector:[{language:"cypher"}],legend:SPe,range:!1,full:{delta:!1}};U5.client.register(B7.SemanticTokensRegistrationType.type,i)});Ede.onDidChangeContent(i=>Ecn(i,u=>{U5.sendDiagnostics({uri:i.document.uri,diagnostics:u})},UQ));U5.languages.semanticTokens.on(Uon(Ede));U5.onSignatureHelp(Bon(Ede,UQ));U5.onCompletion(Fon(Ede,UQ));U5.onNotification("connectionUpdated",i=>{jSu(i)});U5.onNotification("connectionDisconnected",()=>{Acn()});Ede.listen(U5);U5.listen();U5.onExit(()=>{hcn()});var jSu=i=>{Acn(),UQ.connection===void 0&&i.connect&&i.password&&i.connectURL&&i.user&&UQ.persistentConnect(i.connectURL,{username:i.user,password:i.password},{appName:"cypher-language-server"},i.database)},Acn=()=>{UQ.disconnect()};
339
339
  /*!
340
340
  * Copyright 2016 The ANTLR Project. All rights reserved.
341
341
  * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "cypher",
17
17
  "language server"
18
18
  ],
19
- "version": "2.0.0-next.11",
19
+ "version": "2.0.0-next.12",
20
20
  "main": "./dist/server.js",
21
21
  "types": "src/server.ts",
22
22
  "repository": {
@@ -34,7 +34,7 @@
34
34
  "cypher-language-server": "./dist/cypher-language-server"
35
35
  },
36
36
  "dependencies": {
37
- "@neo4j-cypher/language-support": "2.0.0-next.10",
37
+ "@neo4j-cypher/language-support": "2.0.0-next.11",
38
38
  "lodash.debounce": "^4.0.8",
39
39
  "neo4j-driver": "^5.3.0",
40
40
  "vscode-languageserver": "^8.1.0",