-
Notifications
You must be signed in to change notification settings - Fork 37
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
TypeScript Support #42
Comments
@kenazk Finally got around to writing down that feedback! I've been messing around with Pulumi's Typescript / Javascript implementation. I think their vision (as expressed in marketing materials) is exactly right but in my view they've gotten some of the details wrong in a way that I hope Lyra can avoid. The core issue is the complicated relationship between the
Here are my issues:
The net result is something mixed: It is better than DSL becuase I don't have to learn a new syntax, and is better than yaml because it's a real language, but it is distinctly not normal Typescript or Javascript and therefore fails to leverage the full flexibility of the existing abstractions. I think lyra is set up to do better. Here's my proposal:
Bam, there it is, I've coded my infrastructure with javascript, with lyra running under the hood to achieve my desired state. I do not need lyra to understand that I need my subnet to be created before my cluster, because I just did it in code. For lyra to parse and understand it on top of that would be redundant. I'm also using regular javascript language constructs, not anything Lyra specific, which means I could abstract it using my favorite libraries if I wanted. |
@thallgren ^^ |
@nmuldavin the current TypeScript implementation runs as a separate process and communicates with Lyra using grpc. Lyra is in charge of starting that process. Exactly how the packaging will be made is yet TBD but I totally agree that we should interfere as little as possible with existing nodejs packaging. I like your example. Simple and easy to read. But perhaps a bit too simple.
Here's an example of why the type information and the declarative approach is important. Assume that the user has a vpc with subnets. The manifests has been applied an the resources exists in the cloud. Now an attribute in the vpc is changed in the manifest which applied a second time. Two things can happen:
|
This is the declarative syntax that I'm about to implement (same example as in plugins/yamltest.yaml):
|
Thanks for your thorough and well stated response. I think a key point is this one: " 4. Lyra is language neutral and can assemble a workflow from multiple manifests written in different languages, communicating using different types of RPC. " If it were written only for Typescript, there would be no reason not to make it more imperative like my example, but keeping it neutral is a great reason not to. I'm already liking your example a lot better than the Pulumi stuff. Where they fail is their fancy way of implicitly determining resource dependencies from your code. Your example makes the user define inputs and outputs, but I think that's a good thing so that there's less magic going on. It's also implemented with very low level constructs (functions and objects) and is therefore flexible. the In that example you're essentially writing something you could write in
Then use it whenever I need a new deployment it's a 1-liner:
How would you do something similar with Lyra? The reusable logic will need to be abstracted from a single workflow (one could imagine a workflow for updating each service in your cluster, each calling the same |
This commit adds a TypeSet generator for TypeScript. It takes a TypeSet as input and generates a namespace hierachy of TypeScript classes that matches the types in the TypeSet.
@nmuldavin Having an arbitrary function produce a resource body should work just fine. It may, under some circumstances, introduce the slight inconvenience of having to state the actual resource type in the resource. Unless the type is explicitly given in the resource (it's omitted in my example), Lyra will try to infer the type by first looking at the body of the state function. Failing that (and it will fail if the body is just a function call), it will use the qualified name of the resource activity. The qualified name is based on the location of the activity in the workflow (in my example, that will give the names 'aws.vpc', 'aws.subnet', and 'aws.routetable'). |
(lyraproj/lyra#42) Add generation of TypeScript types from TypeSet
Adds ability to express plugins as '.ll' (Lyra Link) files containing a command and an argument or array of arguments expressed as yaml. Both the command and the arguments are subjected to environment expansion. At present, this should be viewed as a quick and dirty fix to enable lyra to start a nodejs executable with a file. Relates to lyraproj#42.
This commit adds a TypeScript example in the form of a NPM package. It contains two TS files, the Aws.ts which is generated from a TypeSet and vpc_with_subnet.ts which contains the actual workflow and also the boiler plate code to start the plugin. Relates to lyraproj#42.
This commit adds a TypeScript example in the form of a NPM package. It contains two TS files, the Aws.ts which is generated from a TypeSet and vpc_with_subnet.ts which contains the actual workflow and also the boiler plate code to start the plugin. Relates to lyraproj#42.
This commit adds a TypeScript example in the form of a NPM package. It contains two TS files, the Aws.ts which is generated from a TypeSet and vpc_with_subnet.ts which contains the actual workflow and also the boiler plate code to start the plugin. Relates to lyraproj#42.
The implementation is done; we'll close this and build new issues around writing and packaging workflows. |
Is your feature request related to a problem? Please describe.
When I am authoring a Workflow manifest, I want to use TypeScript to describe the resources I'm creating so that I can leverage my existing knowledge and skillset.
Describe the solution you'd like
I'd like to be able to describe a set of declarative resources or imperative actions with TypeScript.
Describe alternatives you've considered
None
The text was updated successfully, but these errors were encountered: