UNPKG

@appsemble/node-utils

Version:

NodeJS utilities used by Appsemble internally.

22 lines (21 loc) 930 B
import { type ContentSecurityPolicy } from '@appsemble/node-utils'; import { type Context } from 'koa'; /** * Render settings as an HTML script tag. * * @param settings The settings to render. This must be a JSON serializable object. * @param statements Custom JavaScript statements to append. * @returns A tuple of the digest and the HTML script tag. The digest should be added to the CSP * `script-src`. */ export declare function createSettings(settings: unknown, statements?: string[]): [digest: string, script: string]; export declare function render(ctx: Context, filename: string, data: Record<string, unknown>): Promise<void>; /** * Convert a CSP key / values pair object into a real content security policy string. * * Any falsy values will be excluded. * * @param csp The CSP object to convert * @returns The CSP object as a string */ export declare function makeCSP(csp: ContentSecurityPolicy): string;