Coder Social home page Coder Social logo

tenseijs / tensei Goto Github PK

View Code? Open in Web Editor NEW
565.0 9.0 37.0 19.45 MB

๐Ÿš€ Content management and distribution with a touch of elegance.

Home Page: https://tenseijs.com

License: MIT License

JavaScript 2.00% TypeScript 93.39% CSS 1.99% HTML 1.87% Mustache 0.13% Shell 0.03% EJS 0.58%
nodejs reactjs cms headless api graphql express apollo-server

tensei's People

Contributors

annysah avatar bahdcoder avatar bobbylemm avatar ebukaodini avatar ejirocodes avatar hay-bams avatar placeholder30 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

tensei's Issues

check if object belongs to user

Can someone please tell me how can I check if the object belongs to the user or not? Someting like this

Todo.user.id = user.id

Please help me regarding this.... ๐Ÿ™๐Ÿป

Responsive cms sidebar should close on backdrop and menu item click

Bug report

Responsive CMS sidebar does not close on backdrop click and menu item click

Describe the bug

As a user, when viewing my tensei dashboard on smaller devices, the sidebar should automatically close when i click on a menu item. it should also close when i click on the backdrop.

Steps to reproduce the behavior

  1. Go to CMS dashboard and shrink your browser down to mobile view
  2. Click on a sidebar item
  3. Notice the sidebar does not close but the page is changed
  4. Click on the dark backdrop
  5. Notice the sidebar does not close

Expected behavior

Responsive cms sidebar should close on backdrop and menu item click

Screenshots

responsive-tensei-sidebar-view

Code snippets

If applicable, add code samples to help explain your problem.

System

  • Node.js version: v12.20.0
  • NPM version: 6.14.8
  • Tensei version: v0.7.9
  • Database: Sqlite
  • Operating system: Windows / Mac OS

Additional context

Add any other context about the problem here.

Add full support for teams to the @tensei/auth package

Teams should have the following API endpoints:

  • Create team
  • Update team
  • Delete team
  • Get all teams owned by user
  • Get all teams logged in user is a part of
  • Invite a user by email to team
  • Delete a user's invite
  • Remove a user from a team
  • Accept / Deny team invites

Typographical Error.

There is a typo on one of the documentation page.

Please take a comment to try out the mutations and queries specified in the GraphQL explorer, or if you're using Rest, make API calls with a Rest client such as Postman or Insomnia.

Congratulations, you've successfully run your first Tensei app ๐ŸŽ‰.

Email/Password authentication on Administration Panel

Feature request

Administrators should use an email / password pair to get access to the admin panel.

Summary

As an administrator, I should be able to:

  • Register a new account with my first name, last name, email and password
  • Login to my account with my email and password.
  • No longer login with passwordless authentication

Quick summary what's this feature request about.

Why is it needed?

It is more convenient to login with email/password authentication when email sending is not configured yet.

Suggested solution

Some suggestions or tasks to be completed for this feature:

  • Remove all routes in the CMS related to passwordless authentication
  • Remove all resources in the CMS related to passwordless authentication
  • Add register / login routes in the CMS
  • Add first name, last name, and password fields to the Admin resource in the CMS
  • Add first name, last name, and password fields to user registration page
  • Add password to user login page in the CMS
  • Remove all tests in the CMS tests related to passwordless authentication
  • Add tests for the new register / login endpoints on the CMS

Add more security measures to the passwordless authentication in Tensei CMS

When users request a magic link from the administration panel login page, we generate a magic link with a token and send them an email with this token. This token is currently a random string, but it needs to be better.

Let's implement the following operations on the string:

  • We would encrypt the token using standard token encryption before sending in the email. When we receive the email from the user's click, we'll decrypt the token before searching for it in our database.

datetime case mixed up in the Getting Started doc

Bug report

I was using the Getting started docs, I noticed the code reference for posts Screenshot attached had a mixed up for case datetime instead of dateTime.

I noticed this after I tried to import datetime but my vscode auto-import dateTime.

Bug display

Unable to install using npx

I am unable to create a new tensei app
ERROR :

Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: /mnt/d/Learning/tensei/CMS/cms-using-ubuntu/blogging-app/node_modules/sqlite3
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | x64
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp info check checked for "/mnt/d/Learning/tensei/CMS/cms-using-ubuntu/blogging-app/node_modules/sqlite3/lib/binding/napi-v6-linux-x64/node_sqlite3.node" (not found)
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.1/napi-v6-linux-x64.tar.gz
node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.1/napi-v6-linux-x64.tar.gz
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.1/napi-v6-linux-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v88 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.1/napi-v6-linux-x64.tar.gz
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info find Python using Python version 3.8.2 found at "/usr/bin/python3"
gyp http GET https://nodejs.org/download/release/v15.8.0/node-v15.8.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v15.8.0/node-v15.8.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v15.8.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v15.8.0/SHASUMS256.txt
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/home/manjit2003/.nvm/versions/node/v15.8.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/mnt/d/Learning/tensei/CMS/cms-using-ubuntu/blogging-app/node_modules/sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/manjit2003/.nvm/versions/node/v15.8.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/manjit2003/.cache/node-gyp/15.8.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/manjit2003/.cache/node-gyp/15.8.0',
gyp info spawn args   '-Dnode_gyp_dir=/home/manjit2003/.nvm/versions/node/v15.8.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/manjit2003/.cache/node-gyp/15.8.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/mnt/d/Learning/tensei/CMS/cms-using-ubuntu/blogging-app/node_modules/sqlite3',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack     at getNotFoundError (/home/manjit2003/.nvm/versions/node/v15.8.0/lib/node_modules/npm/node_modules/which/which.js:10:17)
gyp ERR! stack     at /home/manjit2003/.nvm/versions/node/v15.8.0/lib/node_modules/npm/node_modules/which/which.js:57:18
gyp ERR! stack     at new Promise (<anonymous>)
gyp ERR! stack     at step (/home/manjit2003/.nvm/versions/node/v15.8.0/lib/node_modules/npm/node_modules/which/which.js:54:21)
gyp ERR! stack     at /home/manjit2003/.nvm/versions/node/v15.8.0/lib/node_modules/npm/node_modules/which/which.js:71:22
gyp ERR! stack     at new Promise (<anonymous>)
gyp ERR! stack     at subStep (/home/manjit2003/.nvm/versions/node/v15.8.0/lib/node_modules/npm/node_modules/which/which.js:69:33)
gyp ERR! stack     at /home/manjit2003/.nvm/versions/node/v15.8.0/lib/node_modules/npm/node_modules/which/which.js:80:22
gyp ERR! stack     at /home/manjit2003/.nvm/versions/node/v15.8.0/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /home/manjit2003/.nvm/versions/node/v15.8.0/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! System Linux 4.4.0-19041-Microsoft
gyp ERR! command "/home/manjit2003/.nvm/versions/node/v15.8.0/bin/node" "/home/manjit2003/.nvm/versions/node/v15.8.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/mnt/d/Learning/tensei/CMS/cms-using-ubuntu/blogging-app/node_modules/sqlite3/lib/binding/napi-v6-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/mnt/d/Learning/tensei/CMS/cms-using-ubuntu/blogging-app/node_modules/sqlite3/lib/binding/napi-v6-linux-x64" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6"
gyp ERR! cwd /mnt/d/Learning/tensei/CMS/cms-using-ubuntu/blogging-app/node_modules/sqlite3
gyp ERR! node -v v15.8.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/home/manjit2003/.nvm/versions/node/v15.8.0/bin/node /home/manjit2003/.nvm/versions/node/v15.8.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/mnt/d/Learning/tensei/CMS/cms-using-ubuntu/blogging-app/node_modules/sqlite3/lib/binding/napi-v6-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/mnt/d/Learning/tensei/CMS/cms-using-ubuntu/blogging-app/node_modules/sqlite3/lib/binding/napi-v6-linux-x64 --napi_version=7 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/mnt/d/Learning/tensei/CMS/cms-using-ubuntu/blogging-app/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:378:20)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1067:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
node-pre-gyp ERR! System Linux 4.4.0-19041-Microsoft
node-pre-gyp ERR! command "/home/manjit2003/.nvm/versions/node/v15.8.0/bin/node" "/mnt/d/Learning/tensei/CMS/cms-using-ubuntu/blogging-app/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /mnt/d/Learning/tensei/CMS/cms-using-ubuntu/blogging-app/node_modules/sqlite3
node-pre-gyp ERR! node -v v15.8.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok

Please help me regarding this ๐Ÿ™

Date, Date Time and Timezones for fields are handled poorly

Bug report

Date, date time, timestamps fields are handled poorly.

Describe the bug

At the moment it is not exactly clear what these fields do and how they operate. They should work seamlessly and as expected by the underlying database.

Expected behaviour

All date related fields should function as expected with no bugs or unexpected behaviour

A clear and concise description of what you expected to happen.

System

  • Node.js version: all
  • NPM version: all
  • Tensei version: v 0.4.0
  • Database: all
  • Operating system: all

Guides link is leading to 404 page

Bug report

Describe the bug

The guides link in the main readme.me is leading to a 404 page
image

https://tenseijs.com/docs

Steps to reproduce the behavior

  1. Go to main page of github
  2. Click on guides
  3. See error

Expected behavior

to see the main page for guides, which i assume it could be the getting-started

Screenshots

image

Code snippets

If applicable, add code samples to help explain your problem.

System

  • Node.js version:
  • NPM version:
  • Tensei version:
  • Database:
  • Operating system:

Additional context

i just found out this app from this video which i liked so i went here with some curiosity, hope this little issue will help

Can't login after implementing DB configuration

Can't login again after implementing DB configuration, I do not know if this is on my side or a bug but here are screenshots

This happened after I tried to login with the same email
Login denied

I copied these login details and still got same error
Details of login from CLI

Also got this error from the CLI
Screenshot from 2021-04-11 12-51-19

Here is my db configuration
Screenshot from 2021-04-11 12-52-34

Deploying to serverless..

Hey brother hope you are in good condition...
I was just wondering if I can deploy the API to NextJs serverless functions on Vercel??
Is this possible??

Request for more examples

Hello, @bahdcoder hope you are going well...

Extremely thank you for such an amazing project.

Just one more request... Can you please add some more examples?
This would be of so much help...

Please consider adding some examples whenever possible...

GraphQL API exposes hidden resources and fields

Bug report

GraphQL API exposes hidden resources and fields

Describe the bug

When I call the hideFromApi() method on a resource, the resource still shows up in graphQL API schema.

  • The resource should be completely shielded, and should not show up.

  • This resource should not also show up in the queries of other related resources.

  • All packages defining resources should be updated to hide / show appropriately

  • Secure this functionality with automated tests

Steps to reproduce the behaviour

  1. Create a resource and mark it as hidden
  2. Visit the graph QL schema. Notice that resource is still present

System

  • Node.js version: all supported versions
  • NPM version: all supported versions
  • Tensei version: v 0.4.0
  • Database: all databases
  • Operating system: all operating systems

Incorrect documentation page title

Bug report

Incorrect documentation page title

Describe the bug

The documentation getting started page has "tailwind css" in it title. This is because the code docs website was focked from tailwind css documentation repo.

Steps to reproduce the behavior

  1. Go to https://tenseijs.com/docs/getting-started
  2. Check the page title

Expected behavior

Title surfix should be " - Open source Node.js Headless CMS"

Screenshots

Screenshot_20210113_005454

graphql `inserts` works, but `insert` failed with `integer` field

Bug report

Describe the bug

graphql inserts works, but insert failed with integer field.

Steps to reproduce the behavior

  1. yarn create tensei-app cats
  2. cd cats
  3. edit index.js as
const { auth } = require('@tensei/auth')
const { graphql } = require('@tensei/graphql')
const { tensei, resource, text, integer } = require('@tensei/core')
tensei()
    .root(__dirname)
    .resources([resource('Cat').fields([text('Name'), integer('Age')])])
    .plugins([auth().plugin(), graphql().plugin()])
    .start()
    .catch(console.error)
  1. yarn dev
  2. goto http://localhost:8810/graphql
  3. mutation { insert_cats( objects:[{ name: "Tom", age: 3 }] ) { id } } works
  4. mutation { insert_cat( object:{ name: "Tom", age: 3 } ) { id } } failed with
{
  "errors": [
    {
      "message": "Validation failed.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "insert_cat"
      ],
      "extensions": {
        "errors": [
          {
            "message": "string validation failed on age",
            "validation": "string",
            "field": "age"
          }
        ],
        "code": "BAD_USER_INPUT",
        "exception": {
          "errors": [
            {
              "message": "string validation failed on age",
              "validation": "string",
              "field": "age"
            }
          ],
          "stacktrace": [
            "UserInputError: Validation failed.",
            "    at Object.context.userInputError (/home/username/test/bug/node_modules/@tensei/graphql/build/index.js:445:67)",
            "    at /home/username/test/bug/node_modules/@tensei/graphql/build/Resolvers.js:59:31",
            "    at processTicksAndRejections (internal/process/task_queues.js:93:5)",
            "    at async /home/username/test/bug/node_modules/@tensei/graphql/build/index.js:446:32"
          ]
        }
      }
    }
  ],
  "data": null
}

Expected behavior

insert one cat

Screenshots

In Graphql Playground, TYPE DETAILS for insert_cat(...):cat!

Screenshot_2021-03-07 Playground - http localhost 8810 graphql(1)

It reads age: String. Is this a mistake?

Code snippets

N/A

System

  • Node.js version: v14.15.4
  • NPM version: 7.6.0
  • Tensei version: 0.7.20
  • Database: sqlite
  • Operating system: Arch Linux

Additional context

N/A

Add support for Sqlite to the `@tensei/knex` package

Add support for Sqlite to the @tensei/knex package

  • Resources and fields should correctly sync to sqlite
  • Indexed fields should sync correctly to sqlite
  • Nullable fields should correctly sync to sqlite
  • Relationships should correctly sync to sqlite

`yarn tensei-sdk g` command not generating complete types.

Bug report

Describe the bug

After setting up authentication on my API, and then running yarn tensei-sdk g command in my client application, the command did not generate complete types for my API. The tensei.auth().socialRedirectUrl() was not present while trying to access the endpoint.

Steps to reproduce the behavior

  1. Set up authentication on your Tensei API.
  2. In your client application:
  • run yarn add @tensei/sdk
  • run the yarn tensei-sdk g or yarn tensei-sdk g the-url-your-api-is-running-on
  • make API requests by creating a client.ts file and adding this
    import { sdk } from '@tensei/sdk' const tensei = sdk() export default tensei
  • import the client.ts file in the file you will like to access the authentication endpoints.
  1. Try accessing the endpoint using tensei.auth().socialRedirectUrl().
  2. See the error given in the terminal.

Expected behavior

The yarn tensei-sdk g command should generate complete types.

Screenshots

29--09

System

  • Node.js version:
  • NPM version: 6:14:13
  • Tensei version: v0.8.5
  • Database: Sqlite, MongoDB, Postgresql, Mysql
  • Operating system: Windows

Improve the plugins life cycle hooks

Bug report

The plugin system needs improvement. There are currently six hooks, but it doesn't look too necessary.

Describe the bug

A better way to handle life cycle hooks for plugins would be to have the beforeDatabaseSetup and setup hooks. Right now these are the only two that might be necessary.

Steps to reproduce the behaviour

  1. Go to the Tensei core.
  2. Look at the registerHooks method
  3. Notice a lot of hooks that no longer applies

Expected behaviour

Hooks for plugins should be easy to use and very necessary

Screenshots

If applicable, add screenshots to help explain your problem.

Code snippets

If applicable, add code samples to help explain your problem.

System

  • Node.js version: v12, v14
  • NPM version: v6
  • Tensei version: v 0.4.0
  • Database: all databases
  • Operating system: All

Additional context

Add any other context about the problem here.

Can we integrate it with Stripe?

Hey @bahdcoder, I was thinking of using this in my next product. But I also have to feature a paywall to users. Is tensei integrable with Stripe or any other payment provider? Btw the lib is amazing... I made the whole backend in 1-2 hours... ๐Ÿš€

Thanks...

Procedure component not adding new items when the 'enter' button is clicked

Bug report

Describe the bug

The Procedure component not adding new items when the 'enter' button is clicked.

Steps to reproduce the behavior

  1. Login to tensei CMS.
  2. Visit the create post page.
  3. Scroll down to the Procedure component at the bottom.
  4. Notice new items cannot be added when the 'enter' button is clicked on.

Expected behavior

The Procedure component should add new items when the 'enter' button is clicked.

Screenshots

18--05

Code snippets

If applicable, add code samples to help explain your problem.

System

  • Node.js version:
  • NPM version: 6:14:13
  • Tensei version: v0.8.5
  • Database: Sqlite, MongoDB, Postgresql, Mysql
  • Operating system: Windows

Additional context

Add any other context about the problem here.

REST API exposes hidden resources and fields

Bug report

REST API exposes hidden resources and fields

Describe the bug

When I call the hideFromApi() method on a resource, the resource still shows up in REST API.

  • The resource should be completely shielded, and should not show up.

  • This resource should not also show up in the queries of other related resources.

Steps to reproduce the behaviour

  1. Create a resource and mark it as hidden
  2. Visit the REST API. Notice that resource is still present

System

  • Node.js version: all supported versions
  • NPM version: all supported versions
  • Tensei version: v 0.4.0
  • Database: all databases
  • Operating system: all operating systems

Rest API not starting

Hello, I just updated the @tensei/rest package. One thing I noticed that tensei is not starting the rest api server. Earlier the api was working perfectly.

Screenshot (80)

Any guess guys why this might be happening?

Here the code :

const { cms } = require("@tensei/cms");
const { auth } = require("@tensei/auth");
const { media, files, file } = require("@tensei/media");
const { graphql } = require("@tensei/graphql");
const { rest } = require("@tensei/rest");

tensei()
  .root(__dirname)

  .resources([
    ActivityResource,
    SchoolResource,
    StudentResource,
    AgeGroupResource,
    StudentGenderResource,
    UserGenderResource,
    UserRoleResource,
    LanguageResource,
    resource("User Permission").fields([
      belongsTo("User"),
      text("Permisson Name"),
      text("url"),
    ]),
  ])
  .plugins([
    welcome(),
    cms().plugin(),

    media().plugin(),
    auth()
      .setup(({ user }) => {
        user.fields([
          text("Name").searchable(),
          text("Contact Number"),
          hasMany("User Permission"),
          date("Birth date"),
          belongsTo("User Gender"),
          belongsTo("User Role"),
          text("Assigned Country"),
          text("Assigned State"),
          text("Assigned District"),
          text("Address"),
          integer("Points"),
        ]);
      })
      .plugin(),
    graphql().plugin(),
    rest().plugin(),
  ])
  .register(({ app }) => {
    app.use(require("cors")());
  })
  .start()

  .catch(console.error);

Tensei server not starting after running the `yarn dev` command.

Bug report

Describe the bug

Unable to start the Tensei server after running the yarn dev command.

Steps to reproduce the behavior

  1. Install a new application using the command npx create-tensei-app your-app-name --template=rest.
  2. Then run yarn dev to start the server.
  3. See the errors in the terminal.

Expected behavior

The server is meant to start properly without any errors and show a link in the terminal to access the server and cms.

Screenshots

29--01
29--02 (2)

System

  • Node.js version:
  • NPM version: 6:14:13
  • Tensei version: v0.8.5
  • Database: Sqlite, MongoDB, Postgresql, Mysql
  • Operating system: Windows

`dev` scripts command is wrong

Bug report

Describe the bug

dev scripts command is wrong

Steps to reproduce the behavior

  1. yarn create tensei-app tensei
  2. cd tensei
  3. yarn dev
  4. got
...
[nodemon] starting `node src/index index.js`
...

Expected behavior

...
[nodemon] starting `node index.js`
...

Screenshots

N/A

Code snippets

N/A

System

  • Node.js version: v14.15.4
  • NPM version: 7.6.0
  • Tensei version: 0.7.20
  • Database: sqlite
  • Operating system: Arch Linux

Additional context

this may fix it

{
    "scripts": {
        "dev": "nodemon index.js",
        "start": "node index.js"
    },
}

Why `Person` give me both `person` and `people` named resources?

Bug report

Describe the bug

Why Person give me both person and people named resources?

Steps to reproduce the behavior

  1. yarn create tensei-app persons
  2. cd persons
  3. edit index.js as
const { auth } = require('@tensei/auth')
const { graphql } = require('@tensei/graphql')
const { tensei, resource, text, integer } = require('@tensei/core')
tensei()
    .root(__dirname)
    .resources([resource('Person').fields([text('Name'), integer('Age')])])
    .plugins([auth().plugin(), graphql().plugin()])
    .start()
    .catch(console.error)
  1. yarn dev
  2. got both person and people named resources

Expected behavior

Got resources named as person only

Screenshots

Screenshot_2021-03-07 Playground - http localhost 8810 graphql

Code snippets

N/A

System

  • Node.js version: v14.15.4
  • NPM version: 7.6.0
  • Tensei version: 0.7.20
  • Database: sqlite
  • Operating system: Arch Linux

Additional context

N/A

Refactor Manager/Repository class to have standard query methods:

The standard methods this manager class should have are:

  • findOneById
  • findOneByField
  • findAllByIds
  • findAllByField
  • updateOneById
  • updateOneByField
  • updateAllByIds
  • updateAllByField
  • deleteOneById
  • deleteOneByField
  • deleteAllByIds
  • deleteAllByField

All of these methods should also be available on the DatabaseRepositoryInterface

Error: Cannot find module 'graphql-parse-resolve-info'

Bug report

Throws an error while running npm run dev

Steps to reproduce the behavior

Found this error when I installed the package as explained on the doc.

  • npx create-tensei-app commerce --rest
  • Run npm run dev

Screenshots

image

CMS Admin Permission Issue

Bug report

Describe the bug

I just started a fresh installation according to quick start. After cms login and redirecting from cmd link it shows errors here:
return window.Tensei.state.admin.admin_permissions.includes(e)

Screenshots

tensei01
tensei02

System

  • Node.js version: v12, v14
  • NPM version: v7.20.5 / yarn: v1.22.5
  • Tensei version: 0.9.0
  • Database: sqlite
  • Operating system: Ubuntu 20

Additional context

Do we have to implement admin permissions somehow?

Configure "from" property in ses/smtp plugin...

Hey @bahdcoder, can you please guide me in sending a mail from a particular email address? I am using SMTP from SES. Here is my code snippet :

    smtp("admin-auth")
      .auth({
        user: "USER",
        pass: "PASS",
        type: "login",
      })
      .port(587)
      .host("*****.ap-south-1.amazonaws.com")
      .plugin(),

How can we define the from property here? As it is always sending email from no-reply@localhost:8810 which further gets soft bounced...

Thank You

Regards,
Manjit Pardeshi

Graphql filtering using where on boolean fields

Bug report

Describe the bug

Using graphql when trying to filter any resource with the where it throws an error - string cannot represent a non-string value
A clear and concise description of what the bug is.

Steps to reproduce the behavior

  1. Go to 'your API Grahpql playground'.
  2. Create a query for a resource and add a filter using where, use a boolean field for comparisons.

Expected behaviour

I expect Graphql to fetch the appropriate result for my query
A clear and concise description of what you expected to happen.

Screenshots

Screenshot 2021-02-15 at 11 35 38

If applicable, add screenshots to help explain your problem.

Code snippets

query {
          products(where: { trending: { _eq: true }}) {
            id
            name
            description
            price
            category {
              name
            }
        }
      }

If applicable, add code samples to help explain your problem.

System

  • Node.js version:
  • NPM version: 6.14.8
  • Tensei version: 0.6.3
  • Database: Sqlite
  • Operating system: MacOS

Additional context

Add any other context about the problem here.

Unable to login with mongodb config

Bug report

Hello @bahdcoder I just made complete backend in Tensei, I was amazing... But now i have changed the db to MongoDb. How ever, I am unable to login now. What could be the reason and what I can do in this matter?

This is my package.json

{
  "name": "tensei-awesome-app",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "@mikro-orm/mongodb": "^4.5.6",
    "@tensei/auth": "^0.8.4",
    "@tensei/cms": "^0.8.4",
    "@tensei/core": "^0.8.4",
    "@tensei/graphql": "^0.8.4",
    "@tensei/media": "^0.8.4"
  },
  "scripts": {
    "dev": "nodemon src/index",
    "start": "node index.js"
  },
  "devDependencies": {
    "@mikro-orm/sqlite": "^4.4.0",
    "nodemon": "^2.0.7"
  }
}

Index.js

const { cms } = require("@tensei/cms");
const { auth } = require("@tensei/auth");
const { media, files, file } = require("@tensei/media");
const { graphql } = require("@tensei/graphql");
const {
  tensei,
  welcome,
  resource,
  text,
  integer,
  hasOne,
  textarea,
  belongsTo,
  belongsToMany,
  hasMany,
  date,
} = require("@tensei/core");

tensei()
  .root(__dirname)
  .plugins([
    welcome(),
    cms().plugin(),
    media().plugin(),
    auth()
      .rolesAndPermissions()
      .plugin(),
    graphql().plugin(),
  ])
  .databaseConfig({
    type: "mongo",
    dbName: "khelo_ka_raja",
    clientUrl:
      "mongodb+srv://mystring",
  })
  .start()

  .catch(console.error);

Everything works just perfectly removing the db config. This also dosent show any error. Can you please help me in this? It would be great as I am in a hurry.

Regards,
@Manjit2003

Automatically changes the password when the field kept blank

Bug report

Describe the bug

Whenever I edit the user for example I have extened the user using

      .setup(({ user }) => {
        user.fields([
          text("Avatar").nullable(),
          select("Role").options(["Student", "Reviewer"]).nullable(),
        ]);
      })

then whenever I try to edit the avatar of user from the cms, i keep the password field blank... But whenever the user trys to log in it shows invalid credentials

Steps to reproduce the behavior

  1. Extend the user table using
      .setup(({ user }) => {
        user.fields([
          text("Avatar").nullable(),
          select("Role").options(["Student", "Reviewer"]).nullable(),
        ]);
      })
  1. Create any user
  2. Then try to login using the credentials, it will login successfully
  3. Then edit the avatar of the user, the password gets changed automatically

Expected behavior

Only the avatar should change, not the password

Refactor request.manager to a method

  • request.manager should be a method. This method should take in a resource, and inject a resource into the Manager instance.

  • That way, the code will look like this:

manager('User').create(request, payload)

manager('User').database().deleteOneById()
  • And we do not have to pass the resource every time we want to use the manager.

Detail view not using resource label

Bug report

Detail view not using resource label

Describe the bug

When I set the label of a resource and visit the detail view on the CMS, I see the wrong label on relationships.

Steps to reproduce the behavior

  1. Create 3 resources and link them with the belongsTo relationship. Add .label() to all resources and give them labels.
  2. Visit the create cms and try creating / editing. Notice it uses the correct labels for relations.
  3. Create a new item and visit detail field. Notice it shows wrong label.

Expected behavior

Relationships on detail view should show correct labels

Screenshots

This is the form view with correct labels:
form-view-relationships-using-correct-labels

This is the detail view with wrong labels:

detail-view-relationships-using-wrong-labels

System

  • Node.js version:
  • NPM version: v12.20.02
  • Tensei version: v0.7.11
  • Database: Sqlite, MongoDB, Postgresql, Mysql
  • Operating system: Windows, Mac

Future plans?

Hello @bahdcoder, hope you are doing great!! I just had a question in my mind... What are your future plans regarding Tensei? You thinking to monetize this just like strapi? Or it will be just like what it is today?
Well Well... The project is doing absolutely great...

Regards,
@Manjit2003

Social authentication with Tensei and React

Tutorial summary

A tutorial on how to setup social authentication with React and

Why is it important

Would give the community a better understanding of how social authentication works in Tensei

Tutorial format

Select all the tutorial formats that apply:

  • Video tutorial
  • Written article

Tutorial suggestions

A basic beautiful starter with React and Tensei, a tutorial that walks through setting up Google or Github authentication.

Implement more secure practices on passwordless authentication

Feature request

Implement more secure practices on passwordless authentication

Please describe your feature request

When users request a magic link from the administration panel login page, we generate a magic link with a token and send them an email with this token. This token is currently a random string, but it needs to be better.

Let's implement the following operations on the string:

We would encrypt the token using standard token encryption before sending in the email. When we receive the email from the user's click, we'll decrypt the token before searching for it in our database.

Summary

Quick summary what's this feature request about.

Why is it needed?

More security on the platform

Suggested solution(s)

A clear and concise description of what you want to happen.

Related issue(s)/PR(s)

Let us know if this is related to any issue/pull request.

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.