@metablock/core
v0.26.8
Published
Metablock core library
Downloads
39
Readme
Metablock Core
Core tooling for metablock applications
- Lightweight with no dependencies
- Includes a client for metablock Rest API.
Metablock API Client
import { Metablock } from "@metablock/core";
const cli = new Metablock({ token: "" });
const user = await cli.user.getUser();
Organizations
The metablock client access the organizations endpoints via cli.orgs component. Check the org REST docs for more detailed information.
Spaces
The metablock client access the organizations endpoints via cli.spaces component. Check the space REST docs for more detailed information.
Blocks
The metablock client access the organizations endpoints via cli.blocks component. Check the block REST docs for more detailed information.
Tools
Urls
Easily create urls for your block.
assetUrl
for the asset uploaded in the block storagedeployUrl
for the current live deployment with sha keyliveUrl
point to same assets asdeployUrl
but without the sha (url does not change across deployment)
Use with a relative path
import { liveUrl } from "@metablock/core";
const url = liveUrl("icons/myicon.svg");
Logger
A simple logger utility for node and the browser
import { getLogger } from "@metablock/core";
const logger = getLogger();
logger.debug("Hi!");
logger.info("Hi!"); // Hi!
const logger2 = getLogger({ level: "debug" });
logger2.debug("Hi!"); // Hi!
const child = logger.child("test");
child.info("Hi!"); // test Hi!
compileOptions(text)
From a text of the form:
entry1: balabla
entry2: another entry
...
return a Object with corresponding key value pairs.