UNPKG

@appsemble/lang-sdk

Version:

Language SDK for Appsemble

32 lines (31 loc) 1.22 kB
import { type AppDefinition, type BlockDefinition } from './types/index.js'; export type IdentifiableBlock = Pick<BlockDefinition, 'type' | 'version'>; /** * Normalize a block name by prefixing it with `@appsemble` if necessary. * * @param name The input block name. * @returns The normalized block name. */ export declare function normalizeBlockName(name: string): string; /** * Return a block name without the organization prefix. * * @param name The input block name. * @returns The prettified block name. */ export declare function stripBlockName(name: string): string; /** * Parse a block name into a tuple of organization id and block id. * * @param name The block name to parse. * @returns A tuple containing the organization id and block id. */ export declare function parseBlockName(name: string): [string, string] | undefined; /** * Find unique block types in an app. * * @param definition The app definition to find unique blocks for. * @returns Partial unique blocks. Only the type and version are returned. */ export declare function getAppBlocks(definition: AppDefinition): IdentifiableBlock[]; export declare function prefixBlockURL(block: IdentifiableBlock, url: string): string;