UNPKG

godprotocol

Version:

A distributed computing environment for Web 4.0 — integrating AI, decentralisation, and virtual computation.

236 lines (207 loc) 5.03 kB
import twain from "./functions/twain.js"; import display from "./functions/display.js"; import net from "./functions/net.js"; import quit from "./functions/exit.js"; import render from "./functions/render.js"; import import_ from "./functions/import_.js"; import get_uid from "./functions/get_uid.js"; import hash from "./functions/hash.js"; import servers from "./functions/servers.js"; import local from "./functions/local.js"; import store, {retrieve} from "./functions/store.js"; import type_of, {instance_of} from "./functions/typeof.js"; import super_ from "./functions/super_.js"; import spawn from "./functions/spawn.js"; import { emit, listen } from "./functions/event.js"; import folder from "godprotocol/callables/functions/folder.js"; import parse from "godprotocol/callables/functions/parse.js"; import assert from "godprotocol/callables/functions/assert.js"; import env from "godprotocol/callables/functions/env.js"; import wait from "godprotocol/callables/functions/wait.js"; import query from "godprotocol/callables/functions/query.js"; const register = async (account) => { let set = account.vm.set; set('spawn', { callable: spawn, config: { parameters: [ {name: 'spawn', position: 0} ] } }) set("display", { callable: display, config: { parameters: [{ name: "data", position: 0, spread: true }], }, }); set("assert", { callable: assert, config: { parameters: [{ name: "predicate", position: 0}], }, }); set("query", { callable: query, config: { parameters: [{ name: "object", position: 0}, { name: "filter", position: 0}], }, }); set("wait", { callable: wait, config: { parameters: [{ name: "duration", position: 0}], }, }); set("env", { callable: env, config: { parameters: [], }, }); set("Twain", { callable: twain, config: { parameters: [{ name: "instance", position: 0 }], }, }); set("get_uid", { callable: get_uid, config: { parameters: [{ name: "object", position: 0 }], }, }); set("listen", { callable: listen, config: { parameters: [ { name: "name", position: 0 }, { name: "handler", position: 1 }, { name: "key", position: 2 } ], }, }); set("emit", { callable: emit, config: { parameters: [ { name: "name", position: 0 }, { name: "args", position: 1 }, { name: "key", position: 2 } ], }, }); set("folder", { callable: folder, config: { parameters: [ { name: "name", position: 0 }, { name: "options", position: 1 }, ], }, }); set("get_uid", { callable: get_uid, config: { parameters: [{ name: "object", position: 0 }], }, }); set("super", { callable: super_, config: { parameters: [{name:'args', spread: true}, { name: "index", position: 0 }, { name: "object", position: 0 }], }, }); set("local", { callable: local, config: { parameters: [ { name: "name_address", position: 0 }, { name: "args", position: 1 } ], }, }); set("hash", { callable: hash, config: { parameters: [{ name: "object", position: 0 }], }, }); set("typeof", { callable: type_of, config: { parameters: [{ name: "object", position: 0 }], }, }); set("instanceof", { callable: instance_of, config: { parameters: [{ name: "object", position: 0 }], }, }); set("store", { callable: store, config: { parameters: [ { name: "object", position: 0 }, { name: "validation", position: 1 }, ], }, }); set("retrieve", { callable: retrieve, config: { parameters: [ { name: "address", position: 0 }, { name: "_id", position: 1 }, ], }, }); set("servers", { callable: servers, config: { parameters: [{ name: "account", position: 0 }], }, }); set("parse", { callable: parse, config: { parameters: [{ name: "address", position: 0 }, {name: "options", position: 1}], }, }); set("net", { callable: net, config: { parameters: [ { name: "path", position: 0 }, { name: "payload", position: 1 }, { name: "account", position: 2 }, { name: "server", position: 3 }, ], }, }); set("exit", { callable: quit, config: { parameters: [{ name: "code", position: 0 }], }, }); set("render", { callable: render, config: { parameters: [ { name: "object", position: 0 }, { name: "parent", position: 1 }, { name: "query_selector", position: 2 }, { name: "rerender", position: 3 } ], }, }); set("import", { callable: import_, config: { parameters: [{ name: "address", position: 0 }, { name: "identifiers", position: 1 }], }, }); }; export default register;