Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
liamgriffiths committed Aug 2, 2024
1 parent 93f722d commit efe9952
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions examples/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,23 @@ async function main() {
{ id: "B" },
);

// publish the module on substrate.run
// const publication = await substrate.module.publish({
// name: "my reusable graph",
// nodes: [a, b],
// inputs: { x, y, z },
// });

const p = new Module(
// update the module on substrate.run
// const updated = await substrate.module.publish({
// id: publication.id,
// name: "my reusable graph (edited)",
// nodes: [a, b],
// inputs: { x, y, z },
// });

// using the module from JSON
const mod = new Module(
{
json: substrate.module.serialize({
nodes: [a, b],
Expand All @@ -47,17 +57,29 @@ async function main() {
{ id: "Module" },
);

// using the module from publication/module id
// const mod = new Module({
// id: publication.id,
// inputs: { y: "yyy", z: { arr: ["123"] } },
// });

// using the module from publication/module uri
// const mod = new Module({
// uri: publication.uri,
// inputs: { y: "yyy", z: { arr: ["123"] } },
// });

const c = new Box(
{
value: {
"1": p.future.get("A.value.z.arr[0]"),
"2": p.future.get("B.value.b"),
"1": mod.future.get("A.value.z.arr[0]"),
"2": mod.future.get("B.value.b"),
},
},
{ id: "C" },
);

const res = await substrate.run(p, c);
const res = await substrate.run(mod, c);
console.log("res", JSON.stringify(res.json, null, 2));
}
main();

0 comments on commit efe9952

Please # to comment.