Git Product home page Git Product logo

Comments (2)

devinivy avatar devinivy commented on September 22, 2024

Hi! It's me again :)
Dogwater is structured so that each model is only available to the plugin that registered it. If you registered models to the root server (outside a plugin), then those models will only be available outside of a plugin. As I hinted earlier, passing true to request.collections() sidesteps this sandboxing constraint. I checked and played with the dogwater tests to ensure this functionality is working as intended. So, it leads me to the question– is the route registered inside of a plugin?

It turns out that by default, nes creates a route specifically for authenticating the socket connection (see auth section with info on "direct" authentication here). Because that route is created by the nes plugin (which naturally doesn't register any dogwater models), there is no access to dogwater models inside your validateFunc (where request is a request to the route created by nes)!

In short, this is a good reason to use request.collections(true) to get access to all waterline models, ignoring plugin boundaries. A route created by nes will otherwise not be able to access any models. It's a pretty rare case! This is exactly why I added that flag, though.

I think your instinct is good– in general models will only be used by the plugins that register them using server.dogwater(), so passing that flag to request.collections() is typically not necessary. If you find yourself having to use that flag often, there could be some issues with your plugin architecture creating too many inter-plugin dependencies.

from dogwater.

finedays avatar finedays commented on September 22, 2024

Thanks a lot :) I will let it sink and work more with both and see should I redesign the plugin architecture.

from dogwater.

Related Issues (20)

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.