From dad3a01a36b869c508a4cfc84ec0cc9dc1426f5f Mon Sep 17 00:00:00 2001 From: CharlieC3 <2747302+CharlieC3@users.noreply.github.com> Date: Fri, 14 Nov 2025 12:50:13 -0500 Subject: [PATCH 1/4] ci: support npm trusted publishers --- .github/workflows/ci.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9509dc..c66769f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,10 +17,10 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Use Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version-file: '.nvmrc' @@ -57,12 +57,12 @@ jobs: PGPASSWORD: postgres PGDATABASE: postgres steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: fetch-depth: 0 - name: Use Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version-file: '.nvmrc' @@ -94,7 +94,7 @@ jobs: run: npm run test -- --coverage - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 - name: Print integration environment logs run: cat docker-compose-logs.txt @@ -107,6 +107,7 @@ jobs: build-publish: permissions: contents: write + id-token: write issues: write pull-requests: write runs-on: ubuntu-latest @@ -116,14 +117,13 @@ jobs: steps: - name: Generate release bot app token id: generate_token - uses: actions/create-github-app-token@v1 + uses: actions/create-github-app-token@v2 with: app-id: ${{ secrets.HIROSYSTEMS_RELEASE_BOT_ID }} private-key: ${{ secrets.HIROSYSTEMS_RELEASE_BOT_PEM }} - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: - token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }} fetch-depth: 0 persist-credentials: false - name: Get bot user ID @@ -133,7 +133,7 @@ jobs: env: GH_TOKEN: ${{ steps.generate_token.outputs.token }} - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v6 with: node-version-file: '.nvmrc' @@ -144,18 +144,16 @@ jobs: run: npm run build - name: Semantic Release - uses: cycjimmy/semantic-release-action@v4 + uses: cycjimmy/semantic-release-action@9cc899c47e6841430bbaedb43de1560a568dfd16 # v5 # Only run on non-PR events or only PRs that aren't from forks if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} SEMANTIC_RELEASE_PACKAGE: ${{ github.event.repository.name }} GIT_AUTHOR_EMAIL: "${{ steps.bot-user-id.outputs.user-id }}+${{ steps.generate_token.outputs.app-slug }}[bot]@users.noreply.github.com" GIT_COMMITTER_EMAIL: "${{ steps.bot-user-id.outputs.user-id }}+${{ steps.generate_token.outputs.app-slug }}[bot]@users.noreply.github.com" with: - semantic_version: 19 extra_plugins: | @semantic-release/changelog@6.0.3 @semantic-release/git@10.0.1 - conventional-changelog-conventionalcommits@6.1.0 + conventional-changelog-conventionalcommits@9.1.0 From d65b8bc8afdf5ad9188e87891be91d5a8110bbec Mon Sep 17 00:00:00 2001 From: Charlie <2747302+CharlieC3@users.noreply.github.com> Date: Tue, 9 Dec 2025 09:54:25 -0500 Subject: [PATCH 2/4] Upgrade checkout and semantic-release actions --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c66769f..a393c85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Use Node.js uses: actions/setup-node@v6 @@ -57,7 +57,7 @@ jobs: PGPASSWORD: postgres PGDATABASE: postgres steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: fetch-depth: 0 @@ -122,10 +122,10 @@ jobs: app-id: ${{ secrets.HIROSYSTEMS_RELEASE_BOT_ID }} private-key: ${{ secrets.HIROSYSTEMS_RELEASE_BOT_PEM }} - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: fetch-depth: 0 - persist-credentials: false + - name: Get bot user ID id: bot-user-id run: | @@ -144,7 +144,7 @@ jobs: run: npm run build - name: Semantic Release - uses: cycjimmy/semantic-release-action@9cc899c47e6841430bbaedb43de1560a568dfd16 # v5 + uses: cycjimmy/semantic-release-action@b12c8f6015dc215fe37bc154d4ad456dd3833c90 # v6 # Only run on non-PR events or only PRs that aren't from forks if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository env: From 4c8399b8be9f47c33d20577f90aa666262620c67 Mon Sep 17 00:00:00 2001 From: Ryan Mottley Date: Mon, 15 Dec 2025 15:32:17 -0600 Subject: [PATCH 3/4] feat: implement 'isConnected' helper function (#55) --- src/postgres/__tests__/base-pg-store.test.ts | 11 +++++++++++ src/postgres/base-pg-store.ts | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/postgres/__tests__/base-pg-store.test.ts b/src/postgres/__tests__/base-pg-store.test.ts index aa92041..694440a 100644 --- a/src/postgres/__tests__/base-pg-store.test.ts +++ b/src/postgres/__tests__/base-pg-store.test.ts @@ -118,4 +118,15 @@ describe('BasePgStore', () => { expect(sqlTransactionContext.getStore()).toBeUndefined(); expect(db.sql).toEqual(obj); }); + + test('isConnected returns true when the connection is alive', async () => { + const connected = await db.isConnected(); + expect(connected).toBe(true); + }); + + test('isConnected returns false when the connection is not alive', async () => { + jest.spyOn(db, 'sql').mockRejectedValueOnce(new Error('Connection lost')); + const connected = await db.isConnected(); + expect(connected).toBe(false); + }); }); diff --git a/src/postgres/base-pg-store.ts b/src/postgres/base-pg-store.ts index 05d4585..aafed13 100644 --- a/src/postgres/base-pg-store.ts +++ b/src/postgres/base-pg-store.ts @@ -84,6 +84,19 @@ export abstract class BasePgStore { isProdEnv ? this.sql`CONCURRENTLY` : this.sql`` } ${this.sql(viewName)}`; } + + /** + * Checks if the database connection is alive. + * @returns True if connected, false otherwise. + */ + async isConnected(): Promise { + try { + await this.sql`SELECT NOW()`; + return true; + } catch (error) { + return false; + } + } } /** @@ -114,4 +127,7 @@ export abstract class BasePgStoreModule { async refreshMaterializedView(viewName: string): Promise { return this.parent.refreshMaterializedView(viewName); } + async isConnected(): Promise { + return this.parent.isConnected(); + } } From 1082e6ba8e993bd9e23e1ada5c6fd5a30d41464c Mon Sep 17 00:00:00 2001 From: Charlie <2747302+CharlieC3@users.noreply.github.com> Date: Tue, 16 Dec 2025 15:03:55 -0500 Subject: [PATCH 4/4] ci: add registry URL --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a393c85..0a77c81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -136,6 +136,7 @@ jobs: - uses: actions/setup-node@v6 with: node-version-file: '.nvmrc' + registry-url: 'https://registry.npmjs.org' - name: Install deps run: npm ci --audit=false