Prerequisites - Installing the layout in Type Refinery
The final layout with two new block definitions at the bottom of the palette on the left (underlined in yellow)
As a prerequisite open TypeRefinery with a default project, one must have your local copy of the brett_blocks repo open in an IDE, and a TypeRefinery worksheet based on the default project (custom Connection blocks cannot connect to a custom Connection object, so a hack is used)
Create a new Send Data Trigger: Drag a Send Data trigger block to the canvas
Create a new Stix_ID block: Drag a green Code block to the canvas. Richt-click the block and select Edit. Separately, copy the contents of the ui_code,html, replace all of the existing code inside the Edit code window, and press submit. Delete the block you were working on and check the pallete, and there is a new Stix_ID block there, drag it and drop it to the canvase. Finally, right-click the new URL object and select Configure, copy the contents of javascript code file and replace the existing javascript code in the Code block, and press the Apply button
Create a New Connection Block: Drag a API Datastore Connection" block onto the canvas, right click it and ensure the correct datastore is selected
Create a new StixORM Get Object Block: Drag a "Run (Nodes and Edges)" block onto the canvas, right-click on the object and select Edit. Separately, copy the contents of the ui_code.html file, and then replace all of the existing code. Press the Submit button, and a new block will appear on the palette. Drag on a new StixORM Import Bundle block from the palette on the left, right-click it and select Configure. Separately copy the contents of the script.py file and replace the current block code. Open the config,json file, and ensure your Requirements field matches the contents in the file.
Finally, drag on a Print and a Print JSON block. Connect the blocks so that
[ ] Send Data -> Connection
[ ] Send Data -> Stix_Id
[ ] Stix_ID-> Get_Object.Stix_ID
[ ] Connection -> Get_Object.Connection
[ ] URL -> Print
[ ] Get_Object.Stix_Object-> Print (JSON)
Press the Run Button on the Send Data block, and the process will fail, In fact, the GetObject block seems to react far more quickly and fails, than the block does in its test harness, where the typedb request takes some time before it succeeds
Expected Behavior
The Expected Behaviour can be demonstrated by the test harness, in the local brett_blocks repo, assuming Poetry was used to install all of the dependencies. Ensuring that a copy of TypeRefinery is running locally on localhost, port 1729. Then running the method try_get_object, pauses for a few second to make the https call, and then writes out an output.json file in the root, where the standard TypeDB ORM Result Object List format (an object-by-object list) shows the Python function works perfectly
Current Behavior
Running that same code, and the block does not wait for the requests library to get a response, and instead fails with the following json output, instead of the Results List format that was expected.
Prerequisites - Installing the layout in Type Refinery
The final layout with two new block definitions at the bottom of the palette on the left (underlined in yellow)
As a prerequisite open TypeRefinery with a default project, one must have your local copy of the brett_blocks repo open in an IDE, and a TypeRefinery worksheet based on the default project (custom Connection blocks cannot connect to a custom Connection object, so a hack is used)
Expected Behavior
The Expected Behaviour can be demonstrated by the test harness, in the local brett_blocks repo, assuming Poetry was used to install all of the dependencies. Ensuring that a copy of TypeRefinery is running locally on localhost, port 1729. Then running the method try_get_object, pauses for a few second to make the https call, and then writes out an output.json file in the root, where the standard TypeDB ORM Result Object List format (an object-by-object list) shows the Python function works perfectly
Current Behavior
Running that same code, and the block does not wait for the requests library to get a response, and instead fails with the following json output, instead of the Results List format that was expected.