@appsemble/node-utils
Version:
NodeJS utilities used by Appsemble internally.
34 lines (33 loc) • 1.58 kB
TypeScript
import { type RemapperContext } from '@appsemble/lang-sdk';
import { type App, type AppsembleMessages } from '@appsemble/types';
import { type DefaultContext, type DefaultState, type ParameterizedContext } from 'koa';
import { type Options } from './server/types.js';
/**
* Get a context for remappers based on an app definition.
*
* This allows to use remappers with the context of an app on the server.
*
* @param app The app for which to get the remapper context.
* @param language The preferred language for the context.
* @param options The API utility options.
* @param context The koa context.
* @returns A localized remapper context for the app.
*/
export declare function getRemapperContext(app: App, language: string, options: Options, context: ParameterizedContext<DefaultState, DefaultContext, any>): Promise<RemapperContext>;
/**
* Patch an app definition of an app inside the `apps` folder.
*
* @param appPath The path to the app to patch.
* @param patches Patches to apply to the YAML.
*/
export declare function patchDefinition(appPath: string, patches: [key: (number | string)[], value: unknown][]): Promise<void>;
/**
* Patch app messages.
*
* The replacements will be deep merged into the original content.
*
* @param appPath The name of the app to patch.
* @param replacements Replacements for the original messages.
*/
export declare function patchMessages(appPath: string, replacements: Record<string, Partial<AppsembleMessages>>): Promise<void>;
export declare function applyAppVariant(appPath: string, appVariant: string): Promise<void>;