feathersjs-ecosystem / feathers-objection

Feathers database adapter for Objection.js, an ORM based on KnexJS SQL query builder for Postgres, Redshift, MSSQL, MySQL, MariaDB, SQLite3, and Oracle. Forked from feathers-knex.
MIT License
98 stars 49 forks source link

Getting Ready for Feathers v5 Dove #171

Open marshallswain opened 2 years ago

marshallswain commented 2 years ago

The following changes are needed to fully prepare feathers-objection for Feathers v5 Dove:

ramsestom commented 1 year ago

Is this plugin still planned to be made fully compatible with Feathers v5 dove (and integrated back into feathers cli as an option when generating services)?

dekelev commented 1 year ago

@ramsestom It might already work with Feather v5. I'm not aware of any breaking-changes and it seems that the list from @marshallswain is mostly about TypeScript and tests. I'm not using FeathersJS in my current projects, but any PRs are welcome.

dekelev commented 1 year ago

While upgrading dependencies, I've tried running the tests with Feathers v5 and it didn't work. Looks like the AdapterService class that it is extending doesn't exist anymore. As much as I'd like to help, I'm not into TypeScript development these days and also haven't used FeathersJS for the past 2 years, so unless I get a PR regarding this upgrade, this library will remain unsupported in FeathersJS v5 (same for other plugins that I contributed in the past - feathers-cassandra, feathers-service-tests-cassandra, feathers-http-disributed, feathers-opentracing, feathers-kong, feathers-stripe-webhooks, feathers-hubspot-webhooks).

marshallswain commented 1 year ago

@dekelev I think that it got moved to @feathersjs/adapter-commons and renamed to AdapterBase. Does this look like the right class? https://github.com/feathersjs/feathers/blob/dove/packages/adapter-commons/src/service.ts#L22-L29

dekelev commented 1 year ago

Thanks @marshallswain , I tried that now and got this error on invalid service object that was trying to initialize for the tests. Any idea why it's failing?

image image
dekelev commented 1 year ago

I had to remove the underscore from the service method names. It works now, but some tests are failing on code related to the FeathersError class. This import is not defined anymore:

import errors from '@feathersjs/errors';

It works when importing each class in separate.

dekelev commented 1 year ago

Any idea where's the filterQuery base service method? It's not defined in the old place (this.filterQuery).

marshallswain commented 1 year ago

Try importing it from @feathersjs/adapter-commons, as well. https://github.com/feathersjs/feathers/blob/dove/packages/adapter-commons/src/query.ts#L137

marshallswain commented 1 year ago

import errors from '@feathersjs/errors';

I think it's now

import * as errors from '@feathersjs/errors' 

if you want them all.

dekelev commented 1 year ago

Got it, thanks

dekelev commented 1 year ago
image

Is the whitelist option deprecated? Was it replaced by something else?

marshallswain commented 1 year ago

@dekelev, Two solutions replaced it. If you're using @feathersjs/schema or @feathersjs/typebox, the query validators replace the need for whitelist. If you're not using the new validators, you can find the replacement for the whitelist here: https://feathersjs.com/guides/migrating.html#custom-filters-operators

dekelev commented 1 year ago

Thanks! I'll check it out

nickdex commented 1 year ago

@dekelev Can you push your branch? I’ll see if I can help 🙂

dekelev commented 1 year ago

Sure, I'll push it soon. It's still a mess and I haven't got time to work on it since last week.

dekelev commented 1 year ago

I pushed the feathers-dove branch.