Coder Social home page Coder Social logo

adminjs-nestjs's Introduction

NestJS plugin for AdminJS

This is an official AdminJS plugin which integrates it to nestjs framework.

Version >3.0.0 might not be compatible with Nestjs 7 or lower. If adapter is not working, try downgrading adapter to version 2..

AdminJS

AdminJS is an automatic admin interface which can be plugged into your application. You, as a developer, provide database models (like posts, comments, stores, products or whatever else your application uses), and AdminJS generates UI which allows you (or other trusted users) to manage content.

Check out the example application here: https://adminjs-demo.herokuapp.com/admin/

Or visit AdminJS github page.

Usage

To see example usage see the example-app or visit the Nestjs section under AdminJS project page

License

AdminJS is copyrighted © 2023 rst.software. It is a free software, and may be redistributed under the terms specified in the LICENSE file.

About rst.software

We’re an open, friendly team that helps clients from all over the world to transform their businesses and create astonishing products.

  • We are available for hire.
  • If you want to work for us - check out the career page.

adminjs-nestjs's People

Contributors

adamfrydrychrst avatar almogcohen avatar dziraf avatar jwasiak avatar mathildeduboille avatar mkayander avatar semantic-release-bot avatar serembon avatar simonb407 avatar simur407 avatar thomasgscs avatar tomups avatar wojtek-krysiak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adminjs-nestjs's Issues

`@adminjs/nestjs` is not supporting `swc` builder in NestJs10

After changing the builder to swc app stopped working

// nest-cli.json
{
  "$schema": "https://json.schemastore.org/nest-cli",
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "deleteOutDir": true,
    "builder": "swc",
    "typeCheck": true
  }
}

[Nest] 23394  - 07/07/2023, 2:06:43 PM   ERROR [ExceptionHandler] No "exports" main defined in /node_modules/@adminjs/nestjs/package.json
Error: No "exports" main defined in /node_modules/@adminjs/nestjs/package.json
    at new NodeError (node:internal/errors:399:5)
    at exportsNotFound (node:internal/modules/esm/resolve:361:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:641:13)
    at resolveExports (node:internal/modules/cjs/loader:565:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:634:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1061:27)
    at Function.Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at /dist/configs/admin-dashboard/admin-dashboard.module.js:68:84

And this is my module that is simply being imported in app.module.ts

@Module({
imports: [
  // AdminJS version 7 is ESM-only. In order to import it, you have to use dynamic imports.
  Promise.all([
    import('@adminjs/nestjs'),
    import('@adminjs/typeorm'),
    import('adminjs'),
  ]).then(
    ([{ AdminModule }, { Database, Resource }, { default: AdminJS }]) => {
      AdminJS.registerAdapter({ Resource, Database });

      return AdminModule.createAdminAsync({
        useFactory: () => ({
          adminJsOptions: {
            rootPath: '/admin',
            resources: [
              // resources
            ],
          },
          sessionOptions: {
            resave: true,
            saveUninitialized: true,
            secret: 'secret',
          },
        }),
      });
    },
  ),
],
})
export class AdminDashboardModule {}

Support for Fastify

Currently, Fastify support is not implemented, is there any plan to support fastify?

Using custom components with webpack

I'm using AdminJS within a NestJS application and having trouble using custom components. In addition to the standard nest js setup, I'm using webpack to enable hmr as described here: https://docs.nestjs.com/recipes/hot-reload. When I try the following to replace the dashboard component I get the error Given file "./dashboard.component", doesn't exist.

AdminModule.createAdmin({
  rootPath: '/admin',
  resources: [],
  dashboard: {
    component: AdminJS.bundle('./dashboard.component')
  }
})

I setup an example repo to show this issue here: https://gitlab.com/dkellycollins/nest-admin-example. Is there a recommend way to bundle custom component with this setup?

Custom Action is not working properly

I have created a custom action for my user model to export all users in an Excel file.

for this I have created this action

 actions: {
                  export: {
                    actionType: 'resource',
                    component: false,
                    isAccessible: () => true,
                    handler: async (request, response, context) => {
                      const users = await userModel.find({})
                      const workbook = new ExcelJS.Workbook();
                      const worksheet = workbook.addWorksheet('Users');
                      worksheet.addRow(['first_name', 'last_name', 'phone', 'last_login', 'name', 'email', 'isActive', 'domain_id', 'createdAt']);
                      users.forEach(user => {
                        worksheet.addRow([user.first_name, user.last_name, user.phone, user.last_login, user.name, user.email, user.isActive, user.domain_id, user.createdAt  ]);
                      });
                      response.setHeader('Content-Type', 'text/csv')
                      response.setHeader('Content-Disposition', 'attachment; filename=users.csv')
                      await workbook.csv.write(response);
                      response.end();
                    },
                    guard: 'This will export all users',
                    icon: 'CopyIcon',
                    label: 'Export Users',
                  },
                }

now when I click on the export button it hits the API in the background with 200 status and shows csv format in API response but I don't start downloading or open API response in a new tab or anything that helps the user to download Excel.

I am using exceljs library for exporting users.
I have tried all different methods but nothing helps
I don't want to create a custom component.
if anyone have idea how can I fix this?

Provide a more explanatory example project

Hi, thanks for your work.

I spent hours trying to customise a property in the list without any success, and I'd like some pointers.

My project uses

  • nest.js
  • typescript
  • adminBro

I'm following the docs to the letter.
In the configuration I added:

{ resource: styleModel, options: {
          properties: {
            parentId: {
              components: {
                list: AdminBro.bundle('./components/reference-in-list'),
              },
            }
          }
        } },

My ./components/reference-in-list is defined as the following:

import React from 'react'
import { InputGroup, Label } from '@admin-bro/design-system'
import { BasePropertyProps } from 'admin-bro'

const ReferenceInList: React.FC<BasePropertyProps> = (props) => {
  const { record, property } = props
  const value = record.params[property.name]

  return (
    <InputGroup>
      <Label>{property.name}</Label>
      {value}
    </InputGroup>
    )
}

export default ReferenceInList

All I got is an error:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Is there any special configuration to add when using adminBro with nest.js?
There are no docs on your website for using your product with nest.js and the example-app is very basic.

NestJS 10.2.7 HttpAdapterHost dependency error

NestJS 10.2.7 HttpAdapterHost dependency error

Error:

127  - 10/24/2023, 6:53:51 AM   ERROR [ExceptionHandler] Nest can't resolve dependencies of the AdminModule (?, AbstractLoader, CONFIG_TOKEN). Please make sure that the argument HttpAdapterHost at index [0] is available in the AdminModule context
Potential solutions:
- Is AdminModule a valid NestJS module?
- If HttpAdapterHost is a provider, is it part of the current AdminModule?
- If HttpAdapterHost is exported from a separate @Module, is that module imported within AdminModule?
  @Module({
    imports: [ /* the Module containing HttpAdapterHost */ ]
  })

Error: Nest can't resolve dependencies of the AdminModule (?, AbstractLoader, CONFIG_TOKEN). Please make sure that the argument HttpAdapterHost at index [0] is available in the AdminModule context.

Dependencies:

"dependencies": {
    "@admin-bro/express": "^3.1.0",
    "@admin-bro/nestjs": "^1.1.0",
    "@admin-bro/typeorm": "^1.4.0",
    "@adminjs/nestjs": "^6.0.1",
    "@nestjs/axios": "^3.0.0",
    "@nestjs/cache-manager": "^2.1.0",
    "@nestjs/common": "^10.2.7",
    "@nestjs/config": "^3.1.1",
    "@nestjs/core": "^10.2.7",
    "@nestjs/passport": "^10.0.2",
    "@nestjs/platform-express": "^10.2.7",
    "@nestjs/schedule": "^4.0.0",
    "@nestjs/testing": "^10.2.7",
    "@nestjs/typeorm": "^10.0.0",
    "@nextnm/nestjs-mailgun": "^3.0.1",
    "admin-bro": "^3.3.1",
    "axios": "^1.5.1",
    "cache-manager": "^5.2.4",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.14.0",
    "express-formidable": "^1.2.0",
    "express-session": "^1.17.3",
    "firebase-admin": "^11.11.0",
    "mysql2": "^3.6.2",
    "passport": "0.6.0",
    "passport-firebase-jwt": "^1.2.1",
    "passport-jwt": "^4.0.1",
    "pg": "^8.11.3",
    "reflect-metadata": "^0.1.13",
    "rxjs": "^7.8.1",
    "ssl-checker": "^2.0.8",
    "typeorm": "^0.3.17"
  },
  "devDependencies": {
    "@nestjs/cli": "^10.2.0",
    "@nestjs/schematics": "^10.0.2",
    "@types/express": "^4.17.20",
    "@types/jest": "29.5.6",
    "@types/node": "20.8.8",
    "@types/passport-jwt": "^3.0.11",
    "@types/supertest": "^2.0.15",
    "@typescript-eslint/eslint-plugin": "^6.9.0",
    "@typescript-eslint/parser": "^6.9.0",
    "eslint": "^8.52.0",
    "eslint-config-prettier": "^9.0.0",
    "eslint-plugin-prettier": "^5.0.1",
    "jest": "29.7.0",
    "prettier": "^3.0.3",
    "source-map-support": "^0.5.21",
    "supertest": "^6.3.3",
    "ts-jest": "29.1.1",
    "ts-loader": "^9.5.0",
    "ts-node": "^10.9.1",
    "tsconfig-paths": "4.2.0",
    "typescript": "^5.2.2"
  }

app.module.ts

import { AdminModule } from '@admin-bro/nestjs'
import { Database, Resource } from '@admin-bro/typeorm';
import AdminBro from 'admin-bro'
.....
Resource.validate = validate;
AdminBro.registerAdapter({ Database, Resource });
.....
AdminModule.createAdmin({
      rootPath: '/admin',
      resources: [
          UserEntity
      ]
}),

Incompatible with nestjs 8

ERROR [ExceptionHandler] Nest can't resolve dependencies of the AdminModule (?, AbstractLoader, CONFIG_TOKEN). Please make sure that the argument HttpAdapterHost at index [0] is available in the AdminModule context.

Potential solutions:
- If HttpAdapterHost is a provider, is it part of the current AdminModule?
- If HttpAdapterHost is exported from a separate @Module, is that module imported within AdminModule?
  @Module({
    imports: [ /* the Module containing HttpAdapterHost */ ]
  })

Custom authentication support

I tried to use the adminbro nestjs module with oauth authentication. The auth option does not work for me because the user should be redirected to an identity server to log in, instead showing the login page. Is there a way I can provide my own authentication router? I noticed that it seems possible with the original adminbro library (SoftwareBrothers/adminjs#546) but I'm not sure how to use it with nestjs module.

Incompatitle with nestjs version 8

Describe the bug
cannot start the nest project with adminjs installed

Installed libraries and their versions

Reproduce
when start the project, it throw a error message: Nest cannot resolved AdminModule

Expected behavior
the project should run with adminjs install in nest v8

Broken NestJs middleware

Using NestJs Middleware Consumers is broken with this module. I'm trying to globally add middleware to the admin module with something like:

@Module({
   imports: [
     // whatever
     AdminModule.createAdmin({ 
       adminBroOptions: {
         rootPath: 'admin',
         // etc
       }
     })
  ]
})
export class AppModule implements NestModule {
  confgure(consumer: MiddlewareConsumer) {
     consumer.apply(passport.authenticate('jwt').forRoutes({path: 'admin*', method: RequestMethod.ALL});
  }
}

But the middleware is never executed. I'm reasonably sure this is due to the middleware reordering in express.loader.ts because when I comment it out, the middleware is executed as expected.

Repo needs an update

Hi guys, thanks for you work.

I'm trying to add AdminBro to my nest.js app, and I'm really struggling with the implementation.

What does not help is that this repo is not up-to-date with the latest versions of your docs or libraries:

  • "To see example usage see the example-app or visit the Nestjs section under AdminBro project page": the second link is broken and I can't find a similar documentation page on your current website
  • example-app still uses beta versions of @admin-bro/express, @admin-bro/mongoose, and @admin-bro/nestjs
  • /src/index.ts gives outdated indications, for example:
@Module({
  imports: [  
    // createAdmin options are wrong
    AdminModule.createAdmin({
        rootPath: '/admin',
        resources: [],
    }),
  ],
})

Do you have plans to update this repo soon? It would really help people setting up AdminBro.

I'm currently having a basic error after following your example-app:

/node_modules/admin-bro/lib/admin-bro.js:213
    Database,
    ^

TypeError: Cannot destructure property `Database` of 'undefined' or 'null'.
    at Function.registerAdapter

and I cannot figure out if this is because of my setup or an issue with your libs versions.

Problem using admin-bro-nestjs (or admin-bro-typeorm) without ActiveRecord pattern

Hi guys,

Thanks a lot for your work, AdminBro looks like a super-useful addition to my project. I've set it up correctly, I assume; Without adding the resources (Entities), the admin page loads fine, including trivial authorization etc.
When I add the resources, I get the following error (and as you can see below, I'm registering the adapter):

UnhandledPromiseRejectionWarning: NoResourceAdapterError: There are no adapters supporting one of the resource you provided
    at resources.map.rawResource (<...>/node_modules/admin-bro/lib/backend/utils/resources-factory/resources-factory.js:99:15)

When I was digging a bit deeper, I found that in Resource.ts of admin-bro-typeorm, the entities are expected to have a repository attached (getRepository()), thus to be children of the BaseEntity, which means it's assumed that the project is using the ActiveRecord pattern (https://typeorm.io/#/active-record-data-mapper). Unfortunately, in my project I am forced to use the Data Mapper pattern. Am I making a wrong observation / assumption on the way until here?

If not: Is there a workaround for this, e.g. using the createAdminAsync(...) method, or is this going too deep and is probably an issue to raise in the admin-bro-typeorm repository?
If there is no workaround, that would be very unfortunate of course, since I would love to use it in this project, but in that case I think some documentation about this would make sense.

Thanks a lot in advance!

My code:

import { Module } from "@nestjs/common";
import { TypeOrmModule } from "@nestjs/typeorm";

import { User } from "../database/entities/user.entity";

import { AdminModule } from "@admin-bro/nestjs";
import { Database, Resource } from "@admin-bro/typeorm";
import { validate } from "class-validator";
import AdminBro from "admin-bro";

Resource.validate = validate;
AdminBro.registerAdapter({ Database, Resource });

@Module({
  imports: [
    TypeOrmModule.forRoot(),
    AdminModule.createAdmin({
      adminBroOptions: {
        rootPath: "/admin",
        resources: [ User ],
      },
      auth: {
        authenticate: async (email, password) => Promise.resolve({ email: "test" }),
        cookieName: "test",
        cookiePassword: "testPass",
      },
    })
  ],
  controllers: [],
})
export class AppModule {}

Typegoose Support

Hi guys,

Can anyone assist how this can be configured with nestjs-typegoose, since it pretty much wrapped around mongoose.

Add nestjs v8 support

AdminBro seems to throw [ExceptionHandler] Nest can't resolve dependencies of the AdminModule (?, AbstractLoader, CONFIG_TOKEN). Please make sure that the argument HttpAdapterHost at index [0] is available in the AdminModule context. when upgrading to Nest.js v8.

P.S. The same setup with nestjs v7 works good

package.json

"dependencies": {
    "@admin-bro/express": "^3.1.0",
    "@admin-bro/nestjs": "^1.1.0",
    "@admin-bro/typeorm": "^1.4.0",
    "@nestjs/common": "^8.0.5",
    "@nestjs/config": "^1.0.1",
    "@nestjs/core": "^8.0.5",
    "@nestjs/platform-express": "^8.0.5",
    "@nestjs/typeorm": "8.0.2",
    "admin-bro": "^4.0.1",
    "express": "^4.17.1",
    "express-formidable": "^1.2.0",
    "express-session": "^1.17.2",
    "mongodb": "^4.0.1",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.2.0",
    "typeorm": "^0.2.36"
  },
  "devDependencies": {
    "@nestjs/cli": "^7.6.0",
    "@nestjs/schematics": "^8.0.2",
    "@nestjs/testing": "8.0.5",
    "@types/express": "^4.17.13",
    "@types/jest": "^26.0.24",
    "@types/node": "^16.0.0",
    "@types/supertest": "^2.0.11",
    "@typescript-eslint/eslint-plugin": "^4.28.2",
    "@typescript-eslint/parser": "^4.28.2",
    "eslint": "^7.30.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^3.4.0",
    "jest": "^27.0.6",
    "prettier": "^2.3.2",
    "supertest": "^6.1.3",
    "ts-jest": "^27.0.3",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig-paths": "^3.10.1",
    "typescript": "^4.3.5"
  },

admin.module.ts


@Module({
  imports: [
    AdminBroModule.createAdminAsync({
      imports: [],
      inject: [ConfigService],
      useFactory: (config: ConfigService) => ({
        adminBroOptions: {
          rootPath: '/admin',
          resources: [],
        },
        auth: {
          authenticate: async (email, password) => {
            if (
              config.get('admin.adminPassword') === password &&
              config.get('admin.adminEmail') === email
            ) {
              return {
                password: config.get('admin.adminPassword'),
                email: config.get('admin.adminEmail'),
              };
            }
            return null;
          },
          cookieName: 'cookie',
          cookiePassword: config.get('admin.cookiePassword'),
        },
      }),
    }),
  ],
})
export class AdminModule {}

Error message:

 ERROR [ExceptionHandler] Nest can't resolve dependencies of the AdminModule (?, AbstractLoader, CONFIG_TOKEN). Please make sure that the argument HttpAdapterHost at index [0] is available in the AdminModule context.

 Potential solutions:
 - If HttpAdapterHost is a provider, is it part of the current AdminModule?
 - If HttpAdapterHost is exported from a separate @Module, is that module imported within AdminModule?
   @Module({
     imports: [ /* the Module containing HttpAdapterHost */ ]
   })

 Error: Nest can't resolve dependencies of the AdminModule (?, AbstractLoader, CONFIG_TOKEN). Please make sure that the argument HttpAdapterHost at index [0] is available in the AdminModule context.

 Potential solutions:
 - If HttpAdapterHost is a provider, is it part of the current AdminModule?
 - If HttpAdapterHost is exported from a separate @Module, is that module imported within AdminModule?
   @Module({
     imports: [ /* the Module containing HttpAdapterHost */ ]
   })

     at Injector.lookupComponentInParentModules (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:193:19)
     at async Injector.resolveComponentInstance (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:149:33)
     at async resolveParam (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:103:38)
     at async Promise.all (index 0)
     at async Injector.resolveConstructorParams (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:118:27)
     at async Injector.loadInstance (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:47:9)
     at async Injector.loadProvider (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:69:9)
     at async Promise.all (index 0)
     at async InstanceLoader.createInstancesOfProviders (/usr/src/app/node_modules/@nestjs/core/injector/instance-loader.js:44:9)
     at async /usr/src/app/node_modules/@nestjs/core/injector/instance-loader.js:29:13
 error Command failed with exit code 1.

no exported member 'StyledComponent' during application start

node_modules/@adminjs/design-system/types/src/atoms/avatar/avatar.d.ts:6:58 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

6 export declare const Avatar: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, MarginProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & {
                                                           ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/badge/badge.d.ts:34:50 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

34 declare const Badge: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & Omit<import("styled-system").ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, "color"> & {
                                                    ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/box/box.d.ts:32:48 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

32 declare const Box: import("styled-components").StyledComponent<"section", import("styled-components").DefaultTheme, {
                                                  ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/button/button-css.d.ts:1:21 - error TS2307: Cannot find module '@styled-components' or its corresponding type declarations.

1 import { css } from '@styled-components';
                      ~~~~~~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/button/button.d.ts:11:51 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

11 declare const Button: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
                                                     ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/check-box/check-box.d.ts:2:74 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

2 export declare const CheckboxRadioContainer: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
                                                                           ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/currency-input/currency-input.d.ts:44:58 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

44 declare const CurrencyInput: import("styled-components").StyledComponent<any, import("styled-components").DefaultTheme, object & TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").LayoutProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & {
                                                            ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/illustrations/props.type.d.ts:1:30 - error TS2307: Cannot find module '@styled-components' or its corresponding type declarations.

1 import { DefaultTheme } from '@styled-components';
                               ~~~~~~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/input/input.d.ts:2:21 - error TS2307: Cannot find module '@styled-components' or its corresponding type declarations.

2 import { css } from '@styled-components';
                      ~~~~~~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/input/input.d.ts:58:50 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

58 declare const Input: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & LayoutProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & {
                                                    ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/label/label.d.ts:62:50 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

62 declare const Label: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, Omit<import("styled-system").ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, "color"> & {
                                                    ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/link/link.d.ts:61:49 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

61 declare const Link: import("styled-components").StyledComponent<"a", import("styled-components").DefaultTheme, Omit<import("styled-system").ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, "color"> & {
                                                   ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/overlay/overlay.d.ts:2:59 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

2 export declare const Overlay: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, ZIndexProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>>, never>;
                                                            ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/phone-input/phone-input.d.ts:42:55 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

42 declare const PhoneInput: import("styled-components").StyledComponent<any, import("styled-components").DefaultTheme, object & ReactPhoneInputProps & TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").LayoutProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & {
                                                         ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/section/section.d.ts:29:52 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

29 declare const Section: import("styled-components").StyledComponent<any, import("styled-components").DefaultTheme, object, string | number | symbol>;
                                                      ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/table/table-body.d.ts:5:54 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

5 declare const TableBody: import("styled-components").StyledComponent<"tbody", import("styled-components").DefaultTheme, {}, never>;
                                                       ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/table/table-caption.d.ts:5:57 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

5 declare const TableCaption: import("styled-components").StyledComponent<"caption", import("styled-components").DefaultTheme, {}, never>;
                                                          ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/table/table-cell.d.ts:6:54 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

6 declare const TableCell: import("styled-components").StyledComponent<"td", import("styled-components").DefaultTheme, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> | LayoutProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | (Omit<import("styled-system").ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, "color"> & {
                                                       ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/table/table-head.d.ts:5:54 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

5 declare const TableHead: import("styled-components").StyledComponent<"thead", import("styled-components").DefaultTheme, {}, never>;
                                                       ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/table/table-row.d.ts:5:53 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

5 declare const TableRow: import("styled-components").StyledComponent<"tr", import("styled-components").DefaultTheme, {}, never>;
                                                      ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/table/table.d.ts:89:50 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

89 declare const Table: import("styled-components").StyledComponent<"table", import("styled-components").DefaultTheme, LayoutProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>>, never>;
                                                    ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/text-area/text-area.d.ts:41:53 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

41 declare const TextArea: import("styled-components").StyledComponent<"textarea", import("styled-components").DefaultTheme, TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").LayoutProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & {
                                                       ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/text/text.d.ts:53:49 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

53 declare const Text: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & Omit<import("styled-system").ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, "color"> & {
                                                   ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/tooltip/tooltip-content.d.ts:6:66 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

6 export declare const TooltipContent: import("styled-components").StyledComponent<"section", import("styled-components").DefaultTheme, {
                                                                   ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/typography/caption.d.ts:2:59 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

2 export declare const Caption: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, never>;
                                                            ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/typography/card-title.d.ts:2:61 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

2 export declare const CardTitle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, never>;
                                                              ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/typography/header.d.ts:13:54 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

13 export declare const H1: import("styled-components").StyledComponent<(props: any) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
                                                        ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/typography/header.d.ts:14:54 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

14 export declare const H2: import("styled-components").StyledComponent<(props: any) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
                                                        ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/typography/header.d.ts:15:54 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

15 export declare const H3: import("styled-components").StyledComponent<"h3", import("styled-components").DefaultTheme, TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, never>;
                                                        ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/typography/header.d.ts:16:54 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

16 export declare const H4: import("styled-components").StyledComponent<(props: any) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
                                                        ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/typography/header.d.ts:17:54 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

17 export declare const H5: import("styled-components").StyledComponent<(props: any) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
                                                        ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/typography/header.d.ts:18:54 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

18 export declare const H6: import("styled-components").StyledComponent<(props: any) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
                                                        ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/typography/small-text.d.ts:2:61 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

2 export declare const SmallText: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, never>;
                                                              ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/atoms/typography/title.d.ts:2:57 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

2 export declare const Title: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, never>;
                                                          ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/global.d.ts:1:63 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'GlobalStyleComponent'.

1 export declare const GlobalStyle: import("styled-components").GlobalStyleComponent<{}, import("styled-components").DefaultTheme>;
                                                                ~~~~~~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/molecules/drawer/drawer-content.d.ts:6:65 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

6 export declare const DrawerContent: import("styled-components").StyledComponent<"section", import("styled-components").DefaultTheme, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, never>;
                                                                  ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/molecules/drawer/drawer-footer.d.ts:6:64 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

6 export declare const DrawerFooter: import("styled-components").StyledComponent<"section", import("styled-components").DefaultTheme, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, never>;
                                                                 ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/molecules/drawer/drawer.d.ts:79:51 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

79 declare const Drawer: import("styled-components").StyledComponent<"section", import("styled-components").DefaultTheme, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & LayoutProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & {
                                                     ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/molecules/drop-down/drop-down-item-action.d.ts:2:70 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

2 export declare const DropDownItemAction: import("styled-components").StyledComponent<"section", import("styled-components").DefaultTheme, {
                                                                       ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/molecules/drop-down/drop-down-item.d.ts:19:64 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

19 export declare const DropDownItem: import("styled-components").StyledComponent<"section", import("styled-components").DefaultTheme, {
                                                                  ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/molecules/drop-down/drop-down-menu.d.ts:18:64 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

18 export declare const DropDownMenu: import("styled-components").StyledComponent<"section", import("styled-components").DefaultTheme, {
                                                                  ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/molecules/drop-down/drop-down-trigger.d.ts:5:67 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

5 export declare const DropDownTrigger: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
                                                                    ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/molecules/form-group/form-group.d.ts:105:61 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

105 export declare const FormGroup: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & {
                                                                ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/molecules/form-group/form-message.d.ts:5:56 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

5 declare const FormMessage: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("styled-system").TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & Omit<import("styled-system").ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, "color"> & {
                                                         ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/molecules/form-group/input-group.d.ts:5:55 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

5 declare const InputGroup: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
                                                        ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/molecules/modal/modal-styled.d.ts:2:63 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

2 export declare const ModalStyled: import("styled-components").StyledComponent<"section", import("styled-components").DefaultTheme, {
                                                                ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/molecules/stepper/stepper.d.ts:101:52 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

101 declare const Stepper: import("styled-components").StyledComponent<"section", import("styled-components").DefaultTheme, {
                                                       ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/organisms/button-group/button-group.styled.d.ts:2:21 - error TS2307: Cannot find module '@styled-components' or its corresponding type declarations.

2 import { css } from '@styled-components';
                      ~~~~~~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/organisms/button-group/button-group.styled.d.ts:8:70 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

8 export declare const StyledSingleButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
                                                                       ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/organisms/button-group/button-group.styled.d.ts:23:76 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

23 export declare const StyledDropDownItemAction: import("styled-components").StyledComponent<any, import("styled-components").DefaultTheme, object, string | number | symbol>;
                                                                              ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/organisms/button-group/button-group.styled.d.ts:24:69 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

24 export declare const StyledButtonGroup: import("styled-components").StyledComponent<"section", import("styled-components").DefaultTheme, {
                                                                       ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/organisms/current-user-nav/current-user-nav-styled.d.ts:2:72 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

2 export declare const StyledCurrentUserNav: import("styled-components").StyledComponent<"section", import("styled-components").DefaultTheme, {
                                                                         ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/organisms/navigation/navigation-styled.d.ts:2:68 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'StyledComponent'.

2 export declare const StyledNavigation: import("styled-components").StyledComponent<"section", import("styled-components").DefaultTheme, {
                                                                     ~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/utils/datepicker.styles.d.ts:1:21 - error TS2307: Cannot find module '@styled-components' or its corresponding type declarations.

1 import { css } from '@styled-components';
                      ~~~~~~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/utils/focus-shadow.style.d.ts:1:30 - error TS2307: Cannot find module '@styled-components' or its corresponding type declarations.

1 import { DefaultTheme } from '@styled-components';
                               ~~~~~~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/utils/reset.styles.d.ts:1:21 - error TS2307: Cannot find module '@styled-components' or its corresponding type declarations.

1 import { css } from '@styled-components';
                      ~~~~~~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/utils/reset.styles.d.ts:36:50 - error TS2694: Namespace '"/home/o/Documents/js/ecommerce-backend/node_modules/styled-components/dist/index"' has no exported member 'GlobalStyleComponent'.

36 declare const Reset: import("styled-components").GlobalStyleComponent<object, import("styled-components").DefaultTheme>;
                                                    ~~~~~~~~~~~~~~~~~~~~

node_modules/@adminjs/design-system/types/src/utils/select-styles.d.ts:2:35 - error TS2307: Cannot find module '@styled-components' or its corresponding type declarations.

2 import type { DefaultTheme } from '@styled-components';
                                    ~~~~~~~~~~~~~~~~~~~~

node_modules/libphonenumber-js/index.d.cts:18:8 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./types.d.js")' call instead.

18 } from './types.d.js';

my code

//app.module.ts
import { Module } from '@nestjs/common';

import { ProductModule } from './products/product.module.js';
import { TypeOrmModule } from '@nestjs/typeorm';
import { CategoryModule } from './categories/category.module.js';
import { Product } from './products/product.entity.js';
import { validate } from 'class-validator';

import('adminjs').then(({ AdminJS }) => {
  import('@adminjs/typeorm').then(({ Database, Resource }) => {
    Resource.validate = validate;
    AdminJS.registerAdapter({ Database, Resource });
  });
});

@Module({
  imports: [
    TypeOrmModule.forRoot({
      type: 'mariadb',
      host: process.env.DB_HOST || 'localhost',
      port: parseInt(process.env.DB_PORT) || 3306,
      username: process.env.DB_USERNAME || 'root',
      password: process.env.DB_PASSWORD || 'root',
      database: process.env.DB_DATABASE || 'ecommerce',
      autoLoadEntities: true,
      synchronize: true,
    }),
    import('@adminjs/nestjs').then(({ AdminModule }) =>
      AdminModule.createAdmin({
        adminJsOptions: {
          rootPath: '/admin',
          resources: [
            {
              resource: Product,
            },
          ],
        },
      }),
    ),
    ProductModule,
    CategoryModule,
  ],
})
export class AppModule {}

@admin/nestjs not able to intialize prisma

I am trying to integrate @adminjs/nestjs with my existing nestjs app which uses prisma. I get an error that the modelMap property is not found on dmmf variable.

// error message
[app] Error     9/9/2022, 11:12:02 PM [ExceptionHandler] Cannot read properties of undefined (reading 'modelMap') - {"stack":["TypeError: Cannot read properties of undefined (reading 'modelMap')\n    at InstanceWrapper.useFactory [as metatype] (/src/app.module.ts:49:41)\n    at Injector.instantiateClass (/node_modules/@nestjs/core/injector/injector.js:333:55)\n    at callback (node_modules/@nestjs/core/injector/injector.js:48:41)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at Injector.resolveConstructorParams (/node_modules/@nestjs/core/injector/injector.js:122:24)\n    at Injector.loadInstance (/node_modules/@nestjs/core/injector/injector.js:52:9)\n    at Injector.loadProvider (/node_modules/@nestjs/core/injector/injector.js:74:9)\n    at async Promise.all (index 3)\n    at InstanceLoader.createInstancesOfProviders (/node_modules/@nestjs/core/injector/instance-loader.js:44:9)\n    at /node_modules/@nestjs/core/injector/instance-loader.js:29:13"]} +1ms
// app.module.ts
import {
  MiddlewareConsumer,
  Module,
  RequestMethod,
  ValidationPipe,
} from '@nestjs/common';
import AdminJS from 'adminjs';
import { AdminModule } from '@adminjs/nestjs';
import { APP_INTERCEPTOR, APP_PIPE } from '@nestjs/core';
import { AppController } from './app.controller';
import { Database, Resource } from '@adminjs/prisma';
import { DMMFClass } from '@prisma/client/runtime';
import { DatabaseModule } from '@database/database.module';
import { AuthenticationModule } from '@api/authentication/authentication.module';
import { BusinessModule } from '@api/business/business.module';
import { DocumentVerificationModule } from '@api/document-verification/document-verification.module';
import { AddressVerificationModule } from '@api/address-verification/address-verification.module';
import { PaymentModule } from '@api/payment/payment.module';
import { StoreFrontModule } from '@api/store-front/store-front.module';
import { WebhookModule } from '@api/webhook/webhook.module';
import { SecurityModule } from '@shared/modules/security/security.module';
import { UserModule } from '@api/user/user.module';
import { HttpModule } from '@nestjs/axios';
import { ErrorInterceptor } from '@common/interceptors/error.interceptor';
import { AuthMiddleware } from '@common/middlewares/auth.middleware';
import { CommunicationModule } from './api/communication/communication.module';
import { ReferralCodeModule } from './api/referral-code/referral-code.module';
import { OtpModule } from './api/otp/otp.module';
import { PrismaService } from '@database/prisma.service';

AdminJS.registerAdapter({ Resource, Database });
@Module({
  imports: [
    DatabaseModule,
    AdminModule.createAdminAsync({
      imports: [DatabaseModule],
      inject: [PrismaService],
      useFactory: async (prisma: PrismaService) => {
        const dmmf = (prisma as any)._dmmf as DMMFClass;
        return {
          adminJsOptions: {
            rootPath: '/admin',
            resources: [
              {
                resource: { model: dmmf.modelMap['User'], client: prisma },
                options: {},
              },
            ],
          },
        };
      },
    }),
    HttpModule,
    AuthenticationModule,
    BusinessModule,
    DocumentVerificationModule,
    AddressVerificationModule,
    PaymentModule,
    StoreFrontModule,
    WebhookModule,
    SecurityModule,
    UserModule,
    CommunicationModule,
    ReferralCodeModule,
    OtpModule,
  ],
  controllers: [AppController],
  providers: [
    { provide: APP_INTERCEPTOR, useClass: ErrorInterceptor },
    {
      provide: APP_PIPE,
      useValue: new ValidationPipe({
        whitelist: true,
        transform: true,
        errorHttpStatusCode: 400,
        stopAtFirstError: true,
      }),
    },
  ],
})

Misunderstanding in @admin-bro/nestjs part of documentation

I have a repo made of a NestJS app on which I wanted to install admin bro. I followed the documentation (https://adminbro.com/module-@admin-bro_nestjs.html) but I found some part that are not clearly exposed.
After installing : admin-bro, @admin-bro/nestjs" and then express, @admin-bro/express, express-formidable, I tried to launch my NestJS app and it failed with and error message telling me the package @admin-bro/express is not found.
I didn't first install express-session because I don't pass any "authenticate" object. However I discovered that express-session is actually necessary. Once I installed it, I was able to start my NestJS app.
So, the documentation should not stipulate "if you are passing the "authenticate" object..." as it seems necessary to have express-session even without "authenticate".
Here you have my repository, if you want to check : https://github.com/myriamdbs/blog-backend

Reject value missing in AdminModuleOptions.auth.authenticate

export interface AdminModuleOptions {
    adminBroOptions: AdminBroOptions;
    auth?: {
        authenticate: (email: string, password: string) => Promise<CurrentAdmin>; // here
        cookiePassword: string;
        cookieName: string;
    };
    formidableOptions?: ExpressFormidableOptions;
    sessionOptions?: SessionOptions;
}

There is no documented way to reject the authentication.

From a few issue discussions, I've seen empirically that return false is the way to reject the authentication.
Therefore the typing should be:

(email: string, password: string) => Promise<CurrentAdmin | false>

Throwing a JS error within the authenticate function would be preferable, but the promise rejection is not handled and crashes the server instead.

`reorderRoutes` function fails if the NestJS body-parser middleware is disabled

Hello,

I believe Both the AdminJS application and NestJS come with their own body-parser middleware. Thus, while using this library, the ExpressLoader tries to reorder the routes using the reorderRoutes function. While the reordering works without a problem, if you disable the NestJS express body-parser middleware, the code fails.

NestJS has support for disabling the express body-parser middleware using the options object:

const app = await NestFactory.create<NestExpressApplication>(AppModule, { bodyParser: false });

If you disable the body-parser, then the reorederRoutes function tries the reorder the routes, however it fails due to the spread operator used in the same function. Here is the error message:

....../project/node_modules/@adminjs/nestjs/src/loaders/express.loader.ts:95
        ...jsonParser,
           ^
TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at ExpressLoader.reorderRoutes (....../project/node_modules/@adminjs/nestjs/src/loaders/express.loader.ts:95:12)
    at ExpressLoader.register (....../project/node_modules/@adminjs/nestjs/src/loaders/express.loader.ts:44:10)
    at AdminModule.onModuleInit (....../project/node_modules/@adminjs/nestjs/src/admin.module.ts:132:17)
    at Object.callModuleInitHook (....../project/node_modules/@nestjs/core/hooks/on-module-init.hook.js:51:35)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at NestApplication.callInitHook (....../project/node_modules/@nestjs/core/nest-application-context.js:179:13)
    at NestApplication.init (....../project/node_modules/@nestjs/core/nest-application.js:96:9)

Possible solutions could be checking the value of jsonParser and urlencodedParser, or disabling the reorderRoutes function at all if the body-parser middleware of NestJS is disabled.

For the ones that face with the same issue, I also implemented a simple patch that disables the reorderRoutes function:

Object.defineProperty(
  require('@adminjs/nestjs/build/loaders/express.loader.js').ExpressLoader.prototype,
  'reorderRoutes', {
    value: () => {},
  },
);

I also would like to open a PR if a preferred solution were decided.

@admin-bro/nestjs can't find @admin-bro/express on node:14.17-alpine

Hi !

I'm running a nestjs app (with adminBro) on a docker container node:14.17-alpine.

And I get this error:
The "@admin-bro/express" package is missing. Please, make sure to install this library ($ npm install @admin-bro/express) to take advantage of @admin-bro/nestjs

But my package.json does have both of those libraries:

"@admin-bro/express": "^3.1.0",
"@admin-bro/nestjs": "^1.1.0",

Is there a version requirement I missed ?

Providing entire database with TypeOrm and NestJs

I tried replicating the example given with Mongoose here.

I tried passing a Connection (it's deprecated though) and a DataSource (should work the same way).

AdminModule.createAdminAsync({
      useFactory: () => ({
        adminJsOptions: {
          rootPath: '/admin',
          databases: [DataSource],
        },
        [...]
      }
}

I get the following error: NoDatabaseAdapterError: There are no adapters supporting one of the database you provided. I can interpret this as if the TypeOrm adapter has no support for providing the whole database, but I'm sceptic that's the case.

Anyone configured it successfully?

For now, I'm just listing all entities manually (not as fun).

Problem with Authentication

i tried to use the adminjs with prisma according to the documentation

`

AdminModule.createAdminAsync({
imports: [PrismaModule],
inject: [PrismaService],

useFactory: (prisma:PrismaService) => {

  const dmmf = ((prisma as any)._baseDmmf as DMMFClass)

  return {
    adminJsOptions: {
      rootPath: '/admin',
      resources: [{
        resource: { model: dmmf.modelMap.User, client: prisma },
        options: {},
      }],
    },
    auth: {
      authenticate,
      cookieName: 'adminjs',
      cookiePassword: 'secret'
    },
    sessionOptions: {
      resave: true,
      saveUninitialized: true,
      secret: 'secret'
    },
    
  }
}
}),

AuthModule, UserModule, PrismaModule, CoursesModule, ProfileModule,],
 controllers: [],})

export class AppModule {}

`

i get this error anytime the authentication is added for the endpoint

(node:17912) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'default' of undefined at chunk (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\@adminjs\design-system\build\atoms\box\box.js:47:51) at flatten (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\styled-components\src\utils\flatten.js:68:22) at e.generateAndInjectStyles (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\styled-components\src\models\ComponentStyle.js:91:29) at useInjectedStyle (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\styled-components\src\models\StyledComponent.js:87:22) at propsForElement (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\styled-components\src\models\StyledComponent.js:125:30) at styled.section (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\styled-components\src\models\StyledComponent.js:174:44) at renderWithHooks (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:5662:16) at renderForwardRef (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:5846:18) at renderElement (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:6009:11) at renderNodeDestructiveImpl (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:6108:11)

Support Nest.js 10

I found next error after upgrade Nest.js to version 10.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @nestjs/[email protected]
npm ERR! node_modules/@nestjs/core
npm ERR!   @nestjs/core@"10.0.2" from the root project
npm ERR!   peer @nestjs/core@">=9.0.5" from @adminjs/[email protected]

Using AdminBro alongside NestJS breaks payload validation

When the AdminModule is registered into root AppModule the validation errors are triggered in every other place, all the time as If the request contained no payload. I created a minimal reproduction repository https://github.com/pbn4/adminbro-nestjs-validation-bug/blob/master/src/app.module.ts and here is an example request:

curl -X POST http://localhost:3000/ -d '{"hello": "hello"}' -H "Content-Type: application/json"

Comment out AdminModule import in AppModule and see it working again.

extend request or context to resolve nestjs providers

currently its kinda impossible to resolve nestjs stuff inside i.e handler of actions. would be nice if this would be implemented.

my current workaround for this is to bind a moduleref on the current req obj inside the admin loader:

export class AdminLoader extends AbstractLoader {
  public constructor(private readonly moduleRef: ModuleRef) {
    super()
  }

  register(
    admin: AdminJS,
    httpAdapter: AbstractHttpAdapter<any, any, any>,
    options: AdminModuleOptions
  ) {
    .... lot other stuff

    app.use(options.adminJsOptions.rootPath, function admin(req, res, next) {
      req["resolver"] = moduleRef

      return router(req, res, next)
    })
   }
}

so on every request i can simply do:

const roleService = request.resolver.get(RoleService, {
  strict: false,
})

If there is already a way implemented, would be nice to point this out in the documentation.

Wrong function type at AdminModuleOptions.auth.authenticate interface

At admin-module-options.interface.ts:24 there's a line:
authenticate: (email: string, password: string) => Promise<CurrentAdmin>
The promise return type does not make sense. It should be nullable.
Let's see the usage of this function at login.handler.ts:39:

const adminUser = await auth.authenticate(email, password);
    if (adminUser) {
      req.session.adminUser = adminUser;
      req.session.save((err) => {
        if (err) {
          next(err);
        }
        if (req.session.redirectTo) {
          res.redirect(302, req.session.redirectTo);
        } else {
          res.redirect(302, rootPath);
        }
      });
    } else {
      const login = await admin.renderLogin({
        action: admin.options.loginPath,
        errorMessage: "invalidCredentials",
      });
      res.send(login);
    }

It checks if the result of the function is falsy (nullish). Yet the compiler won't run if we return undefined or null because of the wrong type at the interface.

The correct function type would be:
authenticate: (email: string, password: string) => Promise<CurrentAdmin | null>

Unable to use nestjs and admin-bro in the same app due to body-parser and formidable.

Backend api built with nestjs serves call at /, endpoints looks like /users/me or /auth/login etc.
Before adding AdminBro, call to /auth/login with post body of {"email": "<some-email>", "password": "<some-password>" } works fine.
But when adding a module named Backoffice to my app.module.ts post body is not found when calling /auth/login and throws an exception in the controller.
All calls to AdminBro works fine under /admin

@Module({
    imports: [
      AdminModule.createAdminAsync({
        imports: [
          TypeOrmModule.forRootAsync({
            imports: [SharedModule],
            inject: [ConfigService],
            useFactory: (configService: ConfigService) => configService.typeOrmConfig,
          }),
          UsersModule,
        ],
        inject: [UsersService, ConfigService],
        useFactory: (usersService: UsersService, configService: ConfigService) => {
          return {
            adminBroOptions: {
              rootPath: '/admin',
              resources: AdminBroResources,
            },
            auth: {
              authenticate: async (email, password) => {
                const user = await usersService.findOne({
                  email: email,
                  password: ConfigService.getPasswordsHash(password),
                });
                if (user) {
                  return { email: `${user.firstName}`, title: user.email.split('@')[0] };
                }
                return false;
              },
              cookiePassword: configService.get('COOKIE_SECRET'),
              cookieName: 'backoffice',
            },
          } as AdminModuleOptions;
        },
      }),
    ],
    // providers: [UsersService],
  })
  export class BackofficeModule {}

package.json dependencies used:

"@admin-bro/express": "^3.0.1", 
"@admin-bro/nestjs": "^1.0.0", 
"@admin-bro/typeorm": "^1.3.0", 
"express-formidable": "^1.2.0",

I've narrowed it down to ExpressLoader in this repo which moves jsonParser and urlencodeparser in layer stack below AdminBro router. Commenting this out breaks AdminBro but nestjs api works again.

Documentation

There's absolutely no documentation for using this with NestJS

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.