Skip to content

Latest commit

 

History

History

metablock-core

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Metablock Core

Core tooling for metablock applications

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.

  1. assetUrl for the asset uploaded in the block storage
  2. deployUrl for the current live deployment with sha key
  3. liveUrl point to same assets as deployUrl 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.