@appsemble/lang-sdk
Version:
Language SDK for Appsemble
25 lines (24 loc) • 1.42 kB
TypeScript
import { type RemapperContext } from './remap.js';
import { type AppMemberInfo, type Remappers } from './types/index.js';
export interface RemapperExample {
input: unknown;
remapper: unknown;
result: unknown;
history?: unknown[];
skip?: boolean;
}
type CustomRemapperKeys = 'app.id' | 'app.locale' | 'app.url' | 'array.map.1' | 'array.range.1' | 'array.range.map' | 'array.range' | 'array.sort.by' | 'array.sort.desc' | 'array.sort.numeric' | 'date.endOf.quarter' | 'date.endOf.week' | 'date.endOf.weekSun' | 'date.endOf.year' | 'date.endOf' | 'date.set' | 'date.startOf.quarter' | 'date.startOf.week' | 'date.startOf.weekSun' | 'date.startOf.year' | 'date.startOf' | 'if.else' | 'if.then' | 'None';
export type RemapperExampleKeys = CustomRemapperKeys | Exclude<keyof Remappers, 'app' | 'if'>;
export declare const examples: Record<RemapperExampleKeys, RemapperExample>;
/**
* @param remapper The remapper example to use.
* @param options The options specifying how to display the example.
* @returns Example based on the input options.
*/
export declare function schemaExample(remapper: keyof typeof examples, options?: {
input?: 'inline' | 'pretty';
result?: 'inline' | 'pretty';
exclude?: ('input' | 'remapper' | 'result')[];
}): string;
export declare function createExampleContext(url: URL, lang: string, userInfo?: AppMemberInfo, history?: unknown[]): RemapperContext;
export {};