Skip to content

Commit

Permalink
Merge pull request #437 from impresso/develop
Browse files Browse the repository at this point in the history
Release v3.0.2
  • Loading branch information
theorm authored Oct 14, 2024
2 parents a0a45c5 + 680dde7 commit 89a53b7
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 71 deletions.
32 changes: 0 additions & 32 deletions src/services/errors-collector/errors-collector.class.js

This file was deleted.

27 changes: 27 additions & 0 deletions src/services/errors-collector/errors-collector.class.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Params } from '@feathersjs/feathers'
import { SlimUser } from '../../authentication'

interface ErrorsCollectorPayload {
id: string
url: string
errorMessage: string
stackTrace?: string
origin?: string
className?: string
type?: string
}

interface ErrorContext extends ErrorsCollectorPayload {
userId?: string
timestamp: string // ISO 8601
}

/* eslint-disable no-unused-vars */
export default class ErrorsCollector {
async create(data: ErrorsCollectorPayload, params: Params) {
const user: SlimUser | undefined = (params as any).user
const context = { ...data, userId: user?.uid, timestamp: new Date().toISOString() }
const message = `[WebApp Error] ${JSON.stringify(context)}`
console.error(message)
}
}
31 changes: 0 additions & 31 deletions src/services/errors-collector/errors-collector.hooks.js

This file was deleted.

9 changes: 9 additions & 0 deletions src/services/errors-collector/errors-collector.hooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { HookMap } from '@feathersjs/feathers'
import { AppServices, ImpressoApplication } from '../../types'
import { authenticateAround as authenticate } from '../../hooks/authenticate'

export default {
around: {
all: [authenticate({ allowUnauthenticated: true })],
},
} satisfies HookMap<ImpressoApplication, AppServices>
7 changes: 0 additions & 7 deletions src/services/errors-collector/errors-collector.service.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/services/errors-collector/errors-collector.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Application } from '@feathersjs/feathers'
import Service from './errors-collector.class'
import hooks from './errors-collector.hooks'

export default function (app: Application) {
app.use('/errors-collector', new Service())
app.service('errors-collector').hooks(hooks)
}
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CachedSolrClient } from './cachedSolr'
import { Service as LogsService } from './services/logs/logs.class'
import { AuthenticationService } from '@feathersjs/authentication'

interface AppServices {
export interface AppServices {
redisClient?: IRedisClientContainer
rateLimiter?: IRateLimiter
cachedSolr: CachedSolrClient
Expand Down

0 comments on commit 89a53b7

Please sign in to comment.