diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1612587 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,17 @@ +name: Release + +on: + push: + branches: [ master ] + + workflow_dispatch: {} + +jobs: + release: + name: Node.js + uses: artusjs/github-actions/.github/workflows/node-release.yml@v1 + secrets: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + GIT_TOKEN: ${{ secrets.GIT_TOKEN }} + with: + checkTest: false diff --git a/lib/connection.js b/lib/connection.js index 489a739..29c60a5 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -4,41 +4,40 @@ const Operator = require('./operator'); const kWrapToRDS = Symbol('kWrapToRDS'); class RDSConnection extends Operator { - #conn; constructor(conn) { super(); - this.#conn = conn; - if (!this.#conn[kWrapToRDS]) { + this.conn = conn; + if (!this.conn[kWrapToRDS]) { [ 'query', 'beginTransaction', 'commit', 'rollback', ].forEach(key => { - this.#conn[key] = promisify(this.#conn[key]); + this.conn[key] = promisify(this.conn[key]); }); - this.#conn[kWrapToRDS] = true; + this.conn[kWrapToRDS] = true; } } release() { - return this.#conn.release(); + return this.conn.release(); } async _query(sql) { - return await this.#conn.query(sql); + return await this.conn.query(sql); } async beginTransaction() { - return await this.#conn.beginTransaction(); + return await this.conn.beginTransaction(); } async commit() { - return await this.#conn.commit(); + return await this.conn.commit(); } async rollback() { - return await this.#conn.rollback(); + return await this.conn.rollback(); } } diff --git a/lib/transaction.js b/lib/transaction.js index cc8f22f..299f146 100644 --- a/lib/transaction.js +++ b/lib/transaction.js @@ -1,43 +1,42 @@ const Operator = require('./operator'); class RDSTransaction extends Operator { - #conn; isCommit = false; isRollback = false; constructor(conn) { super(); - this.#conn = conn; + this.conn = conn; } async commit() { this.#check(); try { - return await this.#conn.commit(); + return await this.conn.commit(); } finally { this.isCommit = true; - this.#conn.release(); - this.#conn = null; + this.conn.release(); + this.conn = null; } } async rollback() { this.#check(); try { - return await this.#conn.rollback(); + return await this.conn.rollback(); } finally { this.isRollback = true; - this.#conn.release(); - this.#conn = null; + this.conn.release(); + this.conn = null; } } async _query(sql) { this.#check(); - return await this.#conn._query(sql); + return await this.conn._query(sql); } #check() { - if (!this.#conn) { + if (!this.conn) { throw new Error('transaction was commit or rollback'); } }