Skip to content

Commit

Permalink
Merge pull request #726 from swrlab/dev/event-duplications-step-2
Browse files Browse the repository at this point in the history
feat: add more event duplication IDs
  • Loading branch information
frytg authored Sep 10, 2024
2 parents 100302f + fdb2e0e commit 46725f1
Show file tree
Hide file tree
Showing 27 changed files with 130 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ charset = utf-8
end_of_line = lf
indent_style = tab
indent_size = 8
print_width = 111
print_width = 120
trim_trailing_whitespace = true
insert_final_newline = true

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ingest-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
node-version: ${{ env.NODE_VERSION }}

- name: 🛠 Setup Bun
uses: oven-sh/setup-bun@v1
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

Expand All @@ -46,7 +46,7 @@ jobs:
create_credentials_file: true

- name: 📚 Lint Code
run: bun ingest:lint
run: bun lint

- name: 🧪 Run Ingest Tests
env:
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
node-version: ${{ env.NODE_VERSION }}

- name: 🛠 Setup Bun
uses: oven-sh/setup-bun@v1
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ingest-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
types: [closed]

env:
NODE_VERSION: 22
NODE_VERSION: 22.8
IMAGE_NAME: ard-eventhub-europe-west3/ingest
REGISTRY_DOMAIN: europe-west3-docker.pkg.dev

Expand All @@ -35,7 +35,7 @@ jobs:
node-version: ${{ env.NODE_VERSION }}

- name: 🛠 Setup Bun
uses: oven-sh/setup-bun@v1
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

Expand All @@ -49,7 +49,7 @@ jobs:
create_credentials_file: true

- name: 📚 Lint Code
run: bun ingest:lint
run: bun lint

- name: 🧪 Run Ingest Tests
env:
Expand All @@ -62,7 +62,7 @@ jobs:
STAGE: dev
TEST_USER: ${{ secrets.TEST_USER }}
TEST_USER_PW: ${{ secrets.TEST_USER_PW }}
run: bun ingest:test
run: npm run ingest:test

docker:
runs-on: ubuntu-latest
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/linter.yml

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.9.1] - 2024-09-04

- chore: apply linter suggestions
- feat: add more event duplication IDs

## [1.9.0] - 2024-08-19

- feat: enable event duplication for service migrations
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ WORKDIR /web/app
COPY . .

# Install dependencies
RUN bun install
RUN bun install --frozen-lockfile --production

# Load desired node image
FROM node:22-alpine
FROM node:22.8-alpine

# Create app directory
WORKDIR /web/app
Expand Down
3 changes: 2 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
},
"formatter": {
"indentStyle": "tab",
"formatWithErrors": true
"formatWithErrors": true,
"lineWidth": 120
},
"javascript": {
"formatter": {
Expand Down
Binary file modified bun.lockb
Binary file not shown.
File renamed without changes.
File renamed without changes.
24 changes: 23 additions & 1 deletion config/event-duplication.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,27 @@
"crid://wdr.de/Sendung-3c5b688d-5f31-4bb1-91f0-41d72a2e7cd3": "crid://wdr.de/Beitrag-7a56249f-4f7e-4ff4-aaf0-27d7cf50ba13",
"crid://wdr.de/Sendung-165961": "crid://wdr.de/Beitrag-99ed97df-550b-48a4-a544-dcaf03e59c44",
"crid://wdr.de/Sendung-165960": "crid://wdr.de/Beitrag-5552666a-b5e0-48b2-a500-47a58ad2d457",
"crid://wdr.de/Sendung-165959": "crid://wdr.de/Beitrag-78a782d9-d557-4c01-a2f9-99866279190e"
"crid://wdr.de/Sendung-165959": "crid://wdr.de/Beitrag-78a782d9-d557-4c01-a2f9-99866279190e",

"crid://mdr.de/stream/28428-0": "crid://mdr.de/livestream/cms/5ad33a1f-f08e-4c6f-98cf-186df47a12cf/Beitrag",
"crid://mdr.de/stream/28429-0": "crid://mdr.de/livestream/cms/a8e7fd2a-b198-422f-9629-336cf27f13fa/Beitrag",
"crid://mdr.de/stream/28430-0": "crid://mdr.de/livestream/cms/112f1e08-13ce-4e85-8b60-a17929402ae9/Beitrag",
"crid://mdr.de/stream/28434-0": "crid://mdr.de/livestream/cms/MDR Aktuell Radio/Beitrag",
"crid://mdr.de/stream/28431-0": "crid://mdr.de/livestream/cms/MDR Kultur Radio/Beitrag",
"crid://mdr.de/stream/28431-1-0": "crid://mdr.de/livestream/cms/84876c76-d6f4-4b25-bdec-d22e98fb94c4/Beitrag",
"crid://mdr.de/stream/28435-0": "crid://mdr.de/livestream/cms/MDR Klassik/Beitrag",
"crid://mdr.de/stream/28432-0": "crid://mdr.de/livestream/cms/Jump/Beitrag",
"crid://mdr.de/stream/28432-1-0": "crid://mdr.de/livestream/cms/b643d081-4f41-4f90-ada3-7864bcacaf24/Beitrag",
"crid://mdr.de/stream/28432-3-0": "crid://mdr.de/livestream/cms/d760608f-9eb4-4cf3-a405-e8cccb355776/Beitrag",
"crid://mdr.de/stream/28432-2-0": "crid://mdr.de/livestream/cms/5dd1d0cd-2ac6-46f8-b90d-3f5a8f2ca5e5/Beitrag",
"crid://mdr.de/stream/28433-0": "crid://mdr.de/livestream/cms/Sputnik/Beitrag",
"crid://mdr.de/stream/28433-2-0": "crid://mdr.de/livestream/cms/b8121905-6f73-4b83-a06a-b0e5fda562ad/Beitrag",
"crid://mdr.de/stream/28433-7-0": "crid://mdr.de/livestream/cms/f04c8fa2-3e15-4760-988b-5381ceb5f2ab/Beitrag",
"crid://mdr.de/stream/28433-1-0": "crid://mdr.de/livestream/cms/1cd38023-bc46-488c-b6e1-3a947796617b/Beitrag",
"crid://mdr.de/stream/28433-4-0": "crid://mdr.de/livestream/cms/964d26d4-c392-4295-94a8-acec49c0a4d7/Beitrag",
"crid://mdr.de/stream/28433-5-0": "crid://mdr.de/livestream/cms/a2c4d57d-2f48-42f0-ad2e-8a309283e3d9/Beitrag",
"crid://mdr.de/stream/28433-3-0": "crid://mdr.de/livestream/cms/0217ea7c-b6c6-402e-bbe2-cc83358c0c21/Beitrag",
"crid://mdr.de/stream/28433-6-0": "crid://mdr.de/livestream/cms/87710c90-ac51-4231-93c6-7206c9c5c50b/Beitrag",
"crid://mdr.de/stream/10402-0": "crid://mdr.de/livestream/cms/MDR Tweens/Beitrag",
"crid://mdr.de/stream/10401-0": "crid://mdr.de/livestream/cms/9507b3b3-5b04-4540-97c9-758c40ed98c0/Beitrag"
}
4 changes: 2 additions & 2 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// import version from package.json
const { version } = require('../package.json')
const coreIdPrefixes = require('./coreIdPrefixes.json')
const coreIdPrefixes = require('./core-id-prefixes.json')

// load winston logger
const logger = require('../src/utils/logger')
Expand All @@ -32,7 +32,7 @@ if (!process.env.SERVICE_NAME) exitWithError('SERVICE_NAME not found')
// set static envs
const stage = process.env.STAGE.toLowerCase()
const protocol = stage === 'dev' ? 'http' : 'https'
const hostname = stage === 'dev' ? 'localhost' : `eventhub-ingest.ard.de`
const hostname = stage === 'dev' ? 'localhost' : 'eventhub-ingest.ard.de'
const port = process.env.PORT || 8080
const serviceName = process.env.SERVICE_NAME

Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ard-eventhub",
"version": "1.9.0",
"version": "1.9.1",
"description": "ARD system to distribute real-time (live) metadata for primarily radio broadcasts.",
"main": "./src/ingest/index.js",
"engines": {
Expand All @@ -14,7 +14,7 @@
"ingest:cloud": "node ./src/ingest/index.js",
"ingest:test:local": "node --env-file .env ./node_modules/mocha/bin/mocha --recursive './src/**/*.test.js' --timeout 15000 --exit",
"ingest:test": "mocha --recursive './src/**/*.test.js' --timeout 15000 --exit",
"ingest:lint": "biome lint src",
"lint": "biome lint",
"docker:build": "docker build . -t swr/ard-eventhub",
"docker:run": "docker run --env-file .env -p 8080:8080 --name ard-eventhub swr/ard-eventhub",
"docker:scan": "bun docker:build && docker scout quickview",
Expand All @@ -28,15 +28,15 @@
"license": "EUPL-1.2",
"dependencies": {
"@google-cloud/datastore": "^9.1.0",
"@google-cloud/pubsub": "^4.5.0",
"@google-cloud/pubsub": "^4.7.0",
"@google-cloud/secret-manager": "^5.6.0",
"@swrlab/utils": "^2.0.1-beta",
"compression": "^1.7.4",
"dd-trace": "^5.21.0",
"dd-trace": "^5.22.0",
"express": "^4.19.2",
"express-openapi-validator": "^5.3.1",
"firebase-admin": "^12.3.1",
"google-auth-library": "^9.13.0",
"express-openapi-validator": "^5.3.4",
"firebase-admin": "^12.4.0",
"google-auth-library": "^9.14.1",
"jsonwebtoken": "^9.0.2",
"luxon": "^3.5.0",
"slug": "^9.1.0",
Expand All @@ -46,7 +46,7 @@
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@swrlab/style-guide": "swrlab/style-guide",
"@swrlab/style-guide": "^1.0.1",
"chai": "^4.5.0",
"chai-http": "^4.4.0",
"docsify-cli": "^4.4.4",
Expand Down
2 changes: 1 addition & 1 deletion src/ingest/auth/login/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = async (req, res) => {
// send email + password for verification, receive login and user object
try {
login = await firebase.signInWithEmailAndPassword(req.body.email, req.body.password)
} catch (error) {
} catch (_error) {
return response.badRequest(req, res, { status: 500 })
}

Expand Down
2 changes: 1 addition & 1 deletion src/ingest/auth/middleware/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ module.exports = async (req, res, next) => {
})
return res.sendStatus(401)
}

// extract token
;[authorization] = authorization.match(regexp)

Expand All @@ -43,6 +42,7 @@ module.exports = async (req, res, next) => {
level: 'notice',
message: 'user token invalid',
source,
error,
data: { ...req.headers, authorization: 'hidden' },
})
return res.status(403).json(ERROR_JSON)
Expand Down
2 changes: 1 addition & 1 deletion src/ingest/auth/refresh/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = async (req, res) => {
// swap previously received refresh token for new id token
try {
login = await firebase.refreshToken(req.body.refreshToken)
} catch (error) {
} catch (_error) {
return response.badRequest(req, res, { status: 500 })
}

Expand Down
Loading

0 comments on commit 46725f1

Please sign in to comment.