Giter Site home page Giter Site logo

Comments (5)

nachocodoner avatar nachocodoner commented on May 18, 2024 3

I like your proposal. Feels clear to expect similar and consistent interfaces for functions that are alike. I particularly prefer the approach of passing parameters as objects, which enhances versatility and facilitates quick refactoring if needed.

from meteor.

jamauro avatar jamauro commented on May 18, 2024 2

I suppose it should have backwards compatibility so people aren't forced to rewrite their existing code.

@nachocodoner any thoughts on whether it should be a breaking change or not? It would certainly be cleaner from a core code standpoint to make a breaking change but would require developers to make a small change in their code.

Also I think we'll want Meteor.passwordlessLoginWithTokenAnd2faCode to be updated similarly to Meteor.loginWithPassword as part of this issue.


Hey @abhinavtps, thanks for your willingness to jump on this one. Before diving into the solution, let's wait and see if the Meteor team thinks it's worth introducing a breaking change or not. The code will look quite a bit different depending on the answer to that question.

After we have a clearer picture of what's needed, the bulk of the work will need to happen here:

Meteor.loginWithPassword = (selector, password, callback) => {

and here:

Meteor.passwordlessLoginWithTokenAnd2faCode = (selector, token, code, callback) => {

The js doc and .d.ts for these functions will need to be updated as well.

It will also need tests added / updated here: https://github.com/meteor/meteor/blob/devel/packages/accounts-password/password_tests.js to ensure the new proposed way works as expected.

from meteor.

jamauro avatar jamauro commented on May 18, 2024 2

I like that approach.

@abhinavtps see Nacho’s comment above for the desired solution. If you have follow up questions, feel free to use this thread. πŸ™‚

from meteor.

abhinavtps avatar abhinavtps commented on May 18, 2024

Hi @jamauro

This is my first open source, can you please guide me?

I see that updating the function definition of loginWithPassword in https://github.com/meteor/meteor/blob/devel/packages/meteor/meteor.d.ts with an object would suffice like below

function loginWithPassword(
user: { username?: string; email?: string; id?: string } | string,
password: string,
callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError, result?: any) => void
): void;

I think it should not break any existing functionality, is this the expected fix?

from meteor.

nachocodoner avatar nachocodoner commented on May 18, 2024

any thoughts on whether it should be a breaking change or not? It would certainly be cleaner from a core code standpoint to make a breaking change but would require developers to make a small change in their code.

I propose avoiding breaking changes by implementing it with polymorphism, supporting both parameter and object approaches. We'll provide a deprecation log for the parameter approach, warning users about the convention change, to be removed in a future release. What are your thoughts?

from meteor.

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.