neo4j / neo4j-javascript-driver

Neo4j Bolt driver for JavaScript
https://neo4j.com/docs/javascript-manual/current/
Apache License 2.0
839 stars 148 forks source link

Introduce explicity resource management to Driver and Session objects #1154

Closed bigmontz closed 8 months ago

bigmontz commented 8 months ago

This is a TC39 proposal which is already implemented in Typescript 5.2, core-js, babel and other polyfill tools.

This feature enables the user create the driver or a session with the await using keywords and then do not have to close the resource afterwards, since this resources will be closed after leaving the block which were created at.

For example:

await using driver = neo4j.driver(uri, authToken)
await using session = driver.session()

await session.executeRead(tx => "RETURN 1")

Since Deno is more strict with typescript, small fixes had to be done in the driver.

A package.json file was added to the neo4j-driver-deno folder for making easier to integrate the test runners to the environments.