Giter Club home page Giter Club logo

Comments (9)

jthomas avatar jthomas commented on May 29, 2024

This is a good idea. I would need to bump the version number as this would be a breaking change.

We should probably review the API to see what other usability changes we can include if we're going to push out a major version upgrade.

from openwhisk-client-js.

rabbah avatar rabbah commented on May 29, 2024

support both for backward compatibility?

from openwhisk-client-js.

starpit avatar starpit commented on May 29, 2024

as long as we prefer xName to name... this should be sufficient, in terms of backwards compatibility? the only cases i can think of are those that, before, would result in an error, and now will not; e.g. ow.actions.create({name: 'foo'}) would before result in an error, and now succeed...

perhaps that is ok?

from openwhisk-client-js.

rabbah avatar rabbah commented on May 29, 2024

+1 that's better than breaking all the existing actions. since we just forced everyone to get off whisk.js would be nice not to make another forced change.

from openwhisk-client-js.

starpit avatar starpit commented on May 29, 2024

i just added a projection suggestion to the initial feature request comment (i.e. at the top). either ow.x.getXxx or ow.x.get('foo', 'xxx')

if the former, i would start with any of the fields that are of array type. e.g. parameters for all entity types, plus actions packages.

from openwhisk-client-js.

jthomas avatar jthomas commented on May 29, 2024

Supporting Different Parameters

I'm going to support the resource identifiers returned by the platform API to chaining promises together. This will be name in most examples but there are additional edge cases like activationId.

I will maintain support for the existing parameter names for backwards capability.

Support String Parameters

I also might support passing in the identifier as a string, in addition to the object, to simplify simple invocations.

ow.actions.invoke('actionName')

Any objections?

Chaining Promises

Looking at the example above about chaining promises, it will encounter an issue that the API uses inheritance to share a base class and needs the lexical context bound to the invocation. Arrow functions will be needed to resolve this without resorting to function.bind

Promise.all(triggers.map(trigger => ow.triggers.invoke(trigger)))

I don't like the style of having a separate method for interacting with multiple resources. It feels cluttered to me.

I suggest supporting array parameters for the relevant resource methods, as shown here:

ow.actions.list()
  .then(actions => ow.actions.invoke(actions))
  .then(result => ...)

That seems to be a relatively clean way to support interacting with multiple resources without having to remember different API calls.

Thoughts? @starpit @rabbah

from openwhisk-client-js.

starpit avatar starpit commented on May 29, 2024

this all seems reasonable. thanks!

from openwhisk-client-js.

jthomas avatar jthomas commented on May 29, 2024

I've been refactoring the library to make supporting these features easier. id is now supported along with the old style.

Remaining items.

  • update docs with new features
  • support string identifiers
  • support array of identifiers
  • verify changes with integration tests

from openwhisk-client-js.

jthomas avatar jthomas commented on May 29, 2024

This is now ready with v3.3.0.

from openwhisk-client-js.

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.