1.0.2 • Published 2 years ago

ilograph-typescript v1.0.2

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

Ilograph for TypeScript

This library allows you to define Ilograph workspaces using TypeScript, and to get the corresponding YAML workspace definition as an export. This exported YAML can then be used to either update your workspace in the Ilograph Web-UI or as an input to the Ilograph CLI.

Usage

First, you'll need to create an instance of the Workspace class:

const workspace = new Workspace();

Next, you can define your resource model:

const resourceA = new Resource({
    name: 'A'
});

const resourceB = new Resource({
    name: 'B',
});

workspace.resources.push(resourceA);
workspace.resources.push(resourceB);

Now you can add either relational perspectives:

const relationalPerspective = new RelationalPerspective({
    name: "relations"
});
relationalPerspective.addRelation(resourceA, resourceB, { label: "uses"});
workspace.perspectives.push(relationalPerspective);

Or sequence perspectives:

const sequencePerspective = new SequencePerspective({name: "sequence"});
sequencePerspective.start(resourceA);
sequencePerspective.to(resourceB);
workspace.perspectives.push(sequencePerspective);

And finally, you can export the resulting yaml using the toYAML function on the workspace:

console.log(workspace.toYAML());

A full example can be found under sample

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago