mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-06-29 07:41:35 +00:00
module config, blueprint id (#993)
This commit is contained in:
@ -30,6 +30,7 @@ import {
|
||||
import {instantiateStepper, Stepper} from "./stepper";
|
||||
import log from "loglevel";
|
||||
import {waitService} from "./helpers/waitService";
|
||||
import {ModuleConfig} from "./moduleConfig";
|
||||
|
||||
const bs58 = require('bs58')
|
||||
|
||||
@ -213,15 +214,17 @@ export class FluenceClient {
|
||||
/**
|
||||
* Send a script to add module to a relay. Waiting for a response from a relay.
|
||||
*/
|
||||
async addModule(name: string, moduleBase64: string, nodeId?: string, ttl?: number): Promise<void> {
|
||||
let config = {
|
||||
name: name,
|
||||
mem_pages_count: 100,
|
||||
logger_enabled: true,
|
||||
wasi: {
|
||||
envs: {},
|
||||
preopened_files: ["/tmp"],
|
||||
mapped_dirs: {},
|
||||
async addModule(name: string, moduleBase64: string, config?: ModuleConfig, nodeId?: string, ttl?: number): Promise<void> {
|
||||
if (!config) {
|
||||
config = {
|
||||
name: name,
|
||||
mem_pages_count: 100,
|
||||
logger_enabled: true,
|
||||
wasi: {
|
||||
envs: {},
|
||||
preopened_files: ["/tmp"],
|
||||
mapped_dirs: {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,12 +240,12 @@ export class FluenceClient {
|
||||
/**
|
||||
* Send a script to add module to a relay. Waiting for a response from a relay.
|
||||
*/
|
||||
async addBlueprint(name: string, dependencies: string[], nodeId?: string, ttl?: number): Promise<string> {
|
||||
async addBlueprint(name: string, dependencies: string[], blueprintId?: string, nodeId?: string, ttl?: number): Promise<string> {
|
||||
let returnValue = "blueprint_id";
|
||||
let call = (nodeId: string) => `(call "${nodeId}" ("dist" "add_blueprint") [blueprint] ${returnValue})`
|
||||
|
||||
let data = new Map()
|
||||
data.set("blueprint", { name: name, dependencies: dependencies })
|
||||
data.set("blueprint", { name: name, dependencies: dependencies, id: blueprintId })
|
||||
|
||||
return this.requestResponse("addBlueprint", call, returnValue, data, (args: any[]) => args[0] as string, nodeId, ttl)
|
||||
}
|
||||
|
Reference in New Issue
Block a user