Coder Social home page Coder Social logo

Comments (2)

tpmccallum avatar tpmccallum commented on May 18, 2024

/api/multipart/run/:wasm_id/:function_name

When using multipart as part of a wasm executable's function execution the following logic needs to be implemented

URL

  • when the caller passes a url as the value of form's text key, check to see what the fetch returns
  • if the URL (as seen above) returns a text/plain or application/json body, then pass this into SSVM as string
  • if the URL returns anything else, pass this into SSVM as as Buffer

File

  • when the caller passes a file as shown below fetch the file as Buffer (default fetch type of nodejs fs readFile is Buffer)
--form 'first_file=@/Users/tpmccallum/data.txt'
  • ask about whether or not it would be preferred if the default Buffer is converted to String before being passed into SSVM NAPI

Order of arguments being passed into SSVM NAPI

The caller can pass any number of arguments into the Joey request, these will be passed into SSVM NAPI by Joey. The order and the data type of these arguments will be known by the Rust Wasm application (there is always an implicit agreement/understanding between the caller and the Rust Wasm code that they are calling)

  • Need to test that the order in which multipart data is given in the HTTP request is maintained right through to Nodejs's Formidable middleware
    For example, if a caller provides two URLs, one which is string and the other which is Buffer, does Nodejs's Formidable middleware process these in the order given?
    It is possible that the middleware will provide them in the order that they are fetched (smaller data gets in first) or in no particular order at all. If this is the case Joey will not be able to pass multiple parameters into SSVM NAPI in the right order. It may be necessary to use pre-defined explicit naming convention for keys used in multipart data requests.
    For example
--form 'joey_remote_data_url_1=https://raw.githubusercontent.com/tpmccallum/test_endpoint2/master/raw_file_example.txt'
--form 'joey_remote_data_url_2=https://raw.githubusercontent.com/tpmccallum/test_endpoint2/master/raw_file_example.txt'

from wasm-joey.

tpmccallum avatar tpmccallum commented on May 18, 2024

This is now implemented and working.
There are no race conditions due to some new custom code
The data types and order are always maintained and ssvm is able to execute any combination of multipart requests
https://web.postman.co/collections/4967217-84b93d68-2073-4f51-bde3-68f19de57c62?version=latest&workspace=6683d8e5-f543-4751-8871-aeceebf90811#b0be4952-8322-4eff-bb09-959d6fff9de9

from wasm-joey.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.