Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: @lunoxjs/drizzle and drizzle auth user provider #55

Merged
merged 7 commits into from
Mar 4, 2024
Merged

Conversation

axmad386
Copy link
Member

  • wip(lunox-drizzle): drizzle DatabaseManager
  • feat(lunox-drizzle): incorrect type for migrator in config
  • chore(lunox-drizzle): ignore generated drizzle folder
  • chore(lunox-drizzle): export serviceprovider and facade
  • feat(lunox-auth): user provider drizzle

Copy link
Member Author

@axmad386 axmad386 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test result:

❯ pnpm test

> lunox-monorepo@2.0.0-next test /home/dmuggle/GIT/lunox
> pnpm --filter '@lunoxjs/*' --bail test

Scope: 17 of 22 workspace projects
packages/lunox-core test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-core
│  ✓ test/Feature/response.test.ts > Response Test > response().json() should return json)
[1 lines collapsed]
│  ✓ test/Feature/response.test.ts > Response Test > response().download() should work
│2 ✓ test/Feature/formdata.test.ts > Formdata Testing > can parse form data
│  ✓ test/Feature/response.test.ts > Response Test > response() without explicit json will infer type automatically
│3 ✓ test/Feature/response.test.ts > Response Test > response().download() should work
│  ✓ test/Feature/response.test.ts > Response Test > response().download() should work
│4 ✓ test/Feature/formdata.test.ts > Formdata Testing > can parse form data
│  ✓ test/Feature/formdata.test.ts > Formdata Testing > can parse form data
│5 ✓ test/Feature/formdata.test.ts > Formdata Testing > can parse form data with []t methoda
│  ✓ test/Feature/formdata.test.ts > Formdata Testing > can parse form data with []t methoda
│6 ✓ test/Feature/formdata.test.ts > Formdata Testing > can parse form data with put methoda
│  ✓ test/Feature/formdata.test.ts > Formdata Testing > can parse form data with put methoda
│7 ✓ test/Feature/request.test.ts > Request Test > access request-1 should return query data
│  ✓ test/Feature/request.test.ts > Request Test > access request-1 should return query data
│8 ✓ test/Feature/encrypter.test.ts > Encrypter Testing > can encrypt and decrypt object
│  ✓ test/Feature/encrypter.test.ts > Encrypter Testing > can encrypt and decrypt object
│9 ✓ test/Feature/encrypter.test.ts > Encrypter Testing > can encrypt and decrypt string
│  ✓ test/Feature/encrypter.test.ts > Encrypter Testing > can encrypt and decrypt string
[10 lines collapsed]crypter.test.ts > Encrypter Testing > save time attack comparison
│  ✓ test/Feature/encrypter.test.ts > Encrypter Testing > save time attack comparison
│ 1✓ test/Feature/router.test.ts > Router Testing > can access web routes
│  ✓ test/Feature/router.test.ts > Router Testing > can access web routes
│ 2✓ test/Feature/router.test.ts > Router Testing > can access api routessl with request-2 should not conflictced parent instance
│  ✓ test/Feature/router.test.ts > Router Testing > can access api routessl with request-2 should not conflictced parent instance
│ 3✓ test/Feature/router.test.ts > Router Testing > can access post routesl with request-2 should not conflictced parent instanceance
│  ✓ test/Feature/router.test.ts > Router Testing > can access post routesl with request-2 should not conflictced parent instanceance
│  ✓ test/Feature/request.test.ts > Request Test > access request-1 paralel with request-2 should not conflictced parent instanceance
│  ✓ test/Unit/get_class_methods.test.ts > Helper get_class_method Testing > can get class methods from instanced parent instanceance
│  ✓ test/Unit/get_class_methods.test.ts > Helper get_class_method Testing > can get class methods from child and parent instanceance
│  ✓ test/Unit/get_class_methods.test.ts > Helper get_class_method Testing > can get class methods from child and 2nd parent instance
│  ✓ test/Feature/application.test.ts > Application Testing > can run application
│  Test Files  7 passed (7)
│       Tests  18 passed (18)
│    Start at  16:58:18
└─ Done in 3.6s3.11s (transform 148ms, setup 0ms, collect 2.73s, tests 2.46s, environment 2ms, prepare 1.11s)
packages/lunox-drizzle test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-drizzle
└─ Running...
packages/lunox-eloquent test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-eloquent
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeorm
│  ✓ test/Feature/facade.test.ts > Facade Test > can read database config
└─ Running...
packages/lunox-eloquent test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-eloquentdle error
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeorm
│  ✓ test/Feature/facade.test.ts > Facade Test > can insert data
└─ Running...
packages/lunox-eloquent test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-eloquentdle error
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeorm
│  ✓ test/Feature/facade.test.ts > Facade Test > can get data using sql query builder
└─ Running...
packages/lunox-eloquent test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-eloquentdle error
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeorm
│  ✓ test/Feature/facade.test.ts > Facade Test > can get data using relational query
└─ Running...
packages/lunox-eloquent test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-eloquentdle error
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeorm
│  Test Files  1 passed (1)
└─ Running...
packages/lunox-eloquent test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-eloquentdle error
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeorm
│       Tests  4 passed (4)
└─ Running...
packages/lunox-eloquent test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-eloquentdle error
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeorm
│    Start at  16:58:22
└─ Running...
packages/lunox-eloquent test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-eloquentdle error
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeorm
│    Duration  3.40s (transform 703ms, setup 0ms, collect 1.09s, tests 448ms, environment 0ms, prepare 414ms)
└─ Running...
packages/lunox-eloquent test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-eloquentdle error
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeorm
│ stdout | unknown test
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeormndle error
│ reseting migrations...
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeormndle error05ms, environment 0ms, prepare 358ms)
│ stdout | unknown test
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeormndle error05ms, environment 0ms, prepare 358ms)
│ reset migrations done
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeormndle error05ms, environment 0ms, prepare 358ms)
│ rerun migrations..
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeormndle error05ms, environment 0ms, prepare 358ms)
│ stdout | unknown test
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeormndle error05ms, environment 0ms, prepare 358ms)
│ Batch 1 run: 1 migrations
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeormndle error05ms, environment 0ms, prepare 358ms)
│  ✓ test/Feature/sqlite.test.ts > Database Connection > success: read database config
│  ✓ test/Feature/sqlite.test.ts > Database Connection > success: sqlite file generated
│  ✓ test/Feature/sqlite.test.ts > Read Database Data > success: read user table
│  ✓ test/Feature/sqlite.test.ts > Read Database Data > success: insert user
│  Test Files  1 passed (1)
│       Tests  4 passed (4)
│    Start at  16:58:22
│    Duration  3.96s (transform 649ms, setup 1ms, collect 2.05s, tests 247ms, environment 0ms, prepare 351ms)
│  ✓ test/Feature/eloquent.test.ts > eloquent model feature test > can insert model via save method
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeorm
│  ✓ test/Feature/sqlite.test.ts > Database Connection > success: read database config
│  ✓ test/Feature/sqlite.test.ts > Database Connection > success: sqlite file generated
│  ✓ test/Feature/sqlite.test.ts > Read Database Data > success: read user table
│  ✓ test/Feature/sqlite.test.ts > Read Database Data > success: insert user, environment 0ms, prepare 358ms)
│  Test Files  1 passed (1)
│       Tests  4 passed (4)
│    Start at  16:58:22
│    Duration  3.96s (transform 649ms, setup 1ms, collect 2.05s, tests 247ms, environment 0ms, prepare 351ms)
│  ✓ test/Feature/eloquent.test.ts > eloquent model feature test > can insert model to database
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeorm
│  ✓ test/Feature/sqlite.test.ts > Database Connection > success: read database config
│  ✓ test/Feature/sqlite.test.ts > Database Connection > success: sqlite file generated
│  ✓ test/Feature/sqlite.test.ts > Read Database Data > success: read user table
│  ✓ test/Feature/sqlite.test.ts > Read Database Data > success: insert user, environment 0ms, prepare 358ms)
│  Test Files  1 passed (1)
│       Tests  4 passed (4)
│    Start at  16:58:22
│    Duration  3.96s (transform 649ms, setup 1ms, collect 2.05s, tests 247ms, environment 0ms, prepare 351ms)
[1 lines collapsed]
packages/lunox-zod test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-zod
│  ✓ test/Feature/handle-error.test.ts > Handle Error > can handle error
│  Test Files  1 passed (1)
│       Tests  1 passed (1)
│    Start at  16:58:22
│    Duration  2.80s (transform 565ms, setup 0ms, collect 882ms, tests 205ms, environment 0ms, prepare 358ms)
└─ Done in 3.8s
│  ✓ test/Feature/eloquent.test.ts > eloquent model feature test > hidden attribute should be hidden from json but still accessible from model insta…
└─ Running...
packages/lunox-typeorm test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-typeorm
│  ✓ test/Feature/sqlite.test.ts > Database Connection > success: read database config
│  ✓ test/Feature/sqlite.test.ts > Database Connection > success: sqlite file generated
│  ✓ test/Feature/sqlite.test.ts > Read Database Data > success: read user table
│  ✓ test/Feature/sqlite.test.ts > Read Database Data > success: insert user
│  Test Files  1 passed (1)
│       Tests  4 passed (4)
│    Start at  16:58:22
│    Duration  3.96s (transform 649ms, setup 1ms, collect 2.05s, tests 247ms, environment 0ms, prepare 351ms)
└2 Done in 4.8s
│ reseting migrations... vitest
│3stdout | unknown test
│ stdout | unknown test
│4reset migrations done
│ reset migrations done
│5rerun migrations..
│ rerun migrations..
│6stdout | unknown testionstest.ts > eloquent model feature test > can insert model via save method
│ stdout | unknown testionstest.ts > eloquent model feature test > can insert model via save method
│7Batch 1 run: 1 migrationstest.ts > eloquent model feature test > can insert model via save method
│ Batch 1 run: 1 migrationstest.ts > eloquent model feature test > can insert model via save method
│8 ✓ test/Feature/eloquent.test.ts > eloquent model feature test > can insert model via save method
│  ✓ test/Feature/eloquent.test.ts > eloquent model feature test > can insert model via save method
└─ Done in 5.1sre/eloquent.test.ts > eloquent model feature test > can insert model to database
│  ✓ test/Feature/eloquent.test.ts > eloquent model feature test > hidden attribute should be hidden from json but still accessible from model insta…
│  ✓ test/Feature/eloquent.test.ts > eloquent model feature test > can access custom attribute via getter
│  ✓ test/Feature/eloquent.test.ts > eloquent model feature test > appended attribute should be available on json
│  ✓ test/Feature/eloquent.test.ts > eloquent model feature test > can update model via save method
│  Test Files  1 passed (1)
│       Tests  6 passed (6)
│    Start at  16:58:22
│    Duration  4.24s (transform 728ms, setup 0ms, collect 1.45s, tests 1.03s, environment 0ms, prepare 316ms)
packages/lunox-auth test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-auth
│  ✓ test/Feature/auth.session.drizzle.test.ts > Auth Session Test > can run Application
└─ Running...
packages/lunox-event test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-event
│  ✓ test/Feature/event.typeorm.test.ts > General test > can get list event listeners
[1 lines collapsed]
│  ✓ test/Feature/event.typeorm.test.ts > Using Sqlite Database > dispatch event with delay
│2 ✓ test/Feature/event.typeorm.test.ts > Using Mysql Database > data not truncated on when stored on QueueJobFailed
│  ✓ test/Feature/event.typeorm.test.ts > Using Sqlite Database > data not truncated on when stored on QueueJobFailed
│3 ✓ test/Feature/event.typeorm.test.ts > Using Sqlite Database > dispatch event with delay
│  ✓ test/Feature/event.typeorm.test.ts > Using Sqlite Database > dispatch event with delay
│  ✓ test/Feature/auth.session.drizzle.test.ts > Auth Session Test > can attempt login via drizzle providerJobFailed
└─ Running...
packages/lunox-event test$ vitestest.ts > Using Postgres Database > data not truncated on when stored on QueueJobFailed
[3 lines collapsed]
│  ✓ test/Feature/event.typeorm.test.ts > Using Sqlite Database > dispatch event with delay
│  ✓ test/Feature/event.typeorm.test.ts > Using Mysql Database > data not truncated on when stored on QueueJobFailed
│  ✓ test/Feature/auth.session.eloquent.test.ts > Auth Session Test > can run Applicationy
└─ Running...
packages/lunox-event test$ vitestest.ts > Using Postgres Database > dispatch event with delay
[3 lines collapsed]
│  ✓ test/Feature/event.typeorm.test.ts > Using Sqlite Database > dispatch event with delay
│  ✓ test/Feature/event.typeorm.test.ts > Using Mysql Database > data not truncated on when stored on QueueJobFailed
│  ✓ test/Feature/auth.session.eloquent.test.ts > Auth Session Test > can attempt login via eloquent provider
└─ Running...
packages/lunox-event test$ vitestest.ts > Using Postgres Database > dispatch event with delay
[3 lines collapsed]
│  ✓ test/Feature/event.typeorm.test.ts > Using Sqlite Database > dispatch event with delay
│  ✓ test/Feature/event.typeorm.test.ts > Using Mysql Database > data not truncated on when stored on QueueJobFailed
│  ✓ test/Feature/auth.session.typeorm.test.ts > Auth Session Test > can run Applicationay
└─ Running...
packages/lunox-event test$ vitestest.ts > Using Postgres Database > dispatch event with delay
[3 lines collapsed]
│  ✓ test/Feature/event.typeorm.test.ts > Using Sqlite Database > dispatch event with delay
│  ✓ test/Feature/event.typeorm.test.ts > Using Mysql Database > data not truncated on when stored on QueueJobFailed
│  ✓ test/Feature/auth.session.typeorm.test.ts > Auth Session Test > can attempt login via eloquent provider
└─ Running...
packages/lunox-event test$ vitestest.ts > Using Postgres Database > dispatch event with delay
[3 lines collapsed]
│  ✓ test/Feature/event.typeorm.test.ts > Using Sqlite Database > dispatch event with delay
│  ✓ test/Feature/event.typeorm.test.ts > Using Mysql Database > data not truncated on when stored on QueueJobFailed
│  Test Files  3 passed (3)eorm.test.ts > Using Mysql Database > dispatch event with delay
└─ Running...
packages/lunox-event test$ vitestest.ts > Using Postgres Database > dispatch event with delay
[3 lines collapsed]
│  ✓ test/Feature/event.typeorm.test.ts > Using Sqlite Database > dispatch event with delay
│  ✓ test/Feature/event.typeorm.test.ts > Using Mysql Database > data not truncated on when stored on QueueJobFailed
│       Tests  6 passed (6)eorm.test.ts > Using Mysql Database > dispatch event with delay
└─ Running...
packages/lunox-event test$ vitestest.ts > Using Postgres Database > dispatch event with delay
[3 lines collapsed]
│  ✓ test/Feature/event.typeorm.test.ts > Using Sqlite Database > dispatch event with delay
│  ✓ test/Feature/event.typeorm.test.ts > Using Mysql Database > data not truncated on when stored on QueueJobFailed
│    Start at  16:58:26.typeorm.test.ts > Using Mysql Database > dispatch event with delay
└─ Running...
packages/lunox-event test$ vitestest.ts > Using Postgres Database > dispatch event with delay
[3 lines collapsed]
│  ✓ test/Feature/event.typeorm.test.ts > Using Sqlite Database > dispatch event with delay
│  ✓ test/Feature/event.typeorm.test.ts > Using Mysql Database > data not truncated on when stored on QueueJobFailed
[1 lines collapsed]
│  ✓ test/Feature/event.typeorm.test.ts > Using Postgres Database > data not truncated on when stored on QueueJobFailed
│  ✓ test/Feature/event.typeorm.test.ts > Using Postgres Database > dispatch event with delay
│  ✓ test/Feature/event.typeorm.test.ts > Using Postgres Database > dispatch event but failed with retries
│  Test Files  1 passed (1)
│       Tests  8 passed (8)
│    Start at  16:58:26
│    Duration  3.26s (transform 548ms, setup 0ms, collect 1.82s, tests 837ms, environment 0ms, prepare 159ms)
└─ Done in 3.9s
│    Duration  4.21s (transform 86ms, setup 1ms, collect 2.30s, tests 1.39s, environment 0ms, prepare 190ms)
└─ Running...
packages/lunox-event test$ vitest
[3 lines collapsed]
│  ✓ test/Feature/event.typeorm.test.ts > Using Sqlite Database > dispatch event with delay
│  ✓ test/Feature/event.typeorm.test.ts > Using Mysql Database > data not truncated on when stored on QueueJobFailed
└─ Done in 4.8sre/event.typeorm.test.ts > Using Mysql Database > dispatch event with delay
│  ✓ test/Feature/event.typeorm.test.ts > Using Postgres Database > data not truncated on when stored on QueueJobFailed
│  ✓ test/Feature/event.typeorm.test.ts > Using Postgres Database > dispatch event with delay
│  ✓ test/Feature/event.typeorm.test.ts > Using Postgres Database > dispatch event but failed with retries
│  Test Files  1 passed (1)
│       Tests  8 passed (8)
│    Start at  16:58:26
│    Duration  3.26s (transform 548ms, setup 0ms, collect 1.82s, tests 837ms, environment 0ms, prepare 159ms)
└─ Done in 3.9s
packages/lunox-mail test$ vitest
│  RUN  v0.34.6 /home/dmuggle/GIT/lunox/packages/lunox-mail
│  ✓ test/Feature/mail.test.ts > Mail Manager Test > success: can read mail config
│ stderr | test/Feature/mail.test.ts > Mail Manager Test > success: send mail using queue
│ WebSocket server error: Port is already in use
│  ✓ test/Feature/mail.test.ts > Mail Manager Test > success: send mail using queue
│  ✓ test/Feature/mail.test.ts > Mail Manager Test > success: send batch mail using queue
│  Test Files  1 passed (1)
│       Tests  3 passed | 1 skipped (4)
│    Start at  16:58:31
│    Duration  3.71s (transform 390ms, setup 0ms, collect 1.49s, tests 1.64s, environment 0ms, prepare 120ms)
└─ Done in 4.2s

@axmad386 axmad386 merged commit 0d9ccfd into next Mar 4, 2024
@axmad386 axmad386 deleted the drizzle branch March 4, 2024 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant