@@ -23,13 +23,23 @@ async function main() {
23
23
{ id : "B" } ,
24
24
) ;
25
25
26
+ // publish the module on substrate.run
26
27
// const publication = await substrate.module.publish({
27
28
// name: "my reusable graph",
28
29
// nodes: [a, b],
29
30
// inputs: { x, y, z },
30
31
// });
31
32
32
- const p = new Module (
33
+ // update the module on substrate.run
34
+ // const updated = await substrate.module.publish({
35
+ // id: publication.id,
36
+ // name: "my reusable graph (edited)",
37
+ // nodes: [a, b],
38
+ // inputs: { x, y, z },
39
+ // });
40
+
41
+ // using the module from JSON
42
+ const mod = new Module (
33
43
{
34
44
json : substrate . module . serialize ( {
35
45
nodes : [ a , b ] ,
@@ -47,17 +57,29 @@ async function main() {
47
57
{ id : "Module" } ,
48
58
) ;
49
59
60
+ // using the module from publication/module id
61
+ // const mod = new Module({
62
+ // id: publication.id,
63
+ // inputs: { y: "yyy", z: { arr: ["123"] } },
64
+ // });
65
+
66
+ // using the module from publication/module uri
67
+ // const mod = new Module({
68
+ // uri: publication.uri,
69
+ // inputs: { y: "yyy", z: { arr: ["123"] } },
70
+ // });
71
+
50
72
const c = new Box (
51
73
{
52
74
value : {
53
- "1" : p . future . get ( "A.value.z.arr[0]" ) ,
54
- "2" : p . future . get ( "B.value.b" ) ,
75
+ "1" : mod . future . get ( "A.value.z.arr[0]" ) ,
76
+ "2" : mod . future . get ( "B.value.b" ) ,
55
77
} ,
56
78
} ,
57
79
{ id : "C" } ,
58
80
) ;
59
81
60
- const res = await substrate . run ( p , c ) ;
82
+ const res = await substrate . run ( mod , c ) ;
61
83
console . log ( "res" , JSON . stringify ( res . json , null , 2 ) ) ;
62
84
}
63
85
main ( ) ;
0 commit comments