• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

safe-global / safe-events-service / 6195845991

15 Sep 2023 08:36AM UTC coverage: 89.356%. Remained the same
6195845991

push

github

Uxio0
Set version 0.4.0

69 of 78 branches covered (0.0%)

Branch coverage included in aggregate %.

250 of 279 relevant lines covered (89.61%)

6.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.91
/src/admin/adminjs.ts
1
import { Webhook } from '../routes/webhook/entities/webhook.entity';
4✔
2
import { AuthModule } from './auth/auth.module';
4✔
3
import { AuthService } from './auth/auth.service';
4✔
4

5
async function buildAdminJsModule() {
6
  // Nest.js does not support ESM modules
7
  // This workaround is better than modifying tsconfig.json module resolution as
8
  // it brings issues with another libraries
9
  // https://stackoverflow.com/a/75287028/724991
10

11
  const { AdminJS } = await (eval(`import('adminjs')`) as Promise<any>);
4✔
12
  const AdminJSTypeorm = await (eval(
4✔
13
    `import('@adminjs/typeorm')`,
14
  ) as Promise<any>);
15
  AdminJS.registerAdapter({
4✔
16
    Resource: AdminJSTypeorm.Resource,
17
    Database: AdminJSTypeorm.Database,
18
  });
19
  const { AdminModule } = await (eval(
4✔
20
    `import('@adminjs/nestjs')`,
21
  ) as Promise<any>);
22
  return AdminModule.createAdminAsync({
4✔
23
    imports: [AuthModule],
24
    inject: [AuthService],
25
    useFactory: (authService: AuthService) => ({
4✔
26
      adminJsOptions: {
27
        rootPath: '/admin',
28
        resources: [Webhook],
29
      },
30
      auth: {
31
        authenticate: (email: string, password: string) =>
32
          authService.authenticate(email, password),
×
33
        cookieName: 'adminjs',
34
        cookiePassword: 'secret',
35
      },
36
      sessionOptions: {
37
        resave: true,
38
        saveUninitialized: true,
39
        secret: 'secret',
40
      },
41
    }),
42
  });
43
}
44

45
export const AdminJsModule = buildAdminJsModule();
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc