UNPKG

@appsemble/utils

Version:

Utility functions used in Appsemble internally

26 lines (25 loc) 1.45 kB
import { type AppDefinition, type BlockManifest, type ProjectImplementations, type Remapper } from '@appsemble/types'; import { type ValidatorResult } from 'jsonschema'; import { type Promisable } from 'type-fest'; import { type IdentifiableBlock } from './blockUtils.js'; /** * Check whether or not the given link represents a link related to the Appsemble core. * * @param link The link to check * @returns Whether or not the given link represents a link related to the Appsemble core. */ export declare function isAppLink(link: Remapper | string[] | string): boolean; export type BlockVersionsGetter = (blockMap: IdentifiableBlock[]) => Promisable<BlockManifest[]>; /** * Validate an app definition. * * This check various conditions which can’t be validated using basic JSON schema validation. * * @param definition The app validation to check. * @param getBlockVersions A function for getting block manifests from block versions. * @param controllerImplementations App controller implementations of interfaces. * @param validatorResult If specified, error messages will be applied to this existing validator * result. * @returns A validator result which contains all app validation violations. */ export declare function validateAppDefinition(definition: AppDefinition, getBlockVersions: BlockVersionsGetter, controllerImplementations?: ProjectImplementations, validatorResult?: ValidatorResult): Promise<ValidatorResult>;