UNPKG

@fntio/infra-client

Version:

Self-hosted AWS access portal: credential vending, target-account trust, and grant-driven private networking as CDK stacks and constructs.

42 lines (41 loc) • 2.42 kB
import type * as lambda from "aws-cdk-lib/aws-lambda"; import type { Construct } from "constructs"; import { PluginCatalogRouteV1, PluginCatalogUiEntryV1, PluginManifestV1 } from "@fntio/infra-client-plugin-sdk"; import type { PluginsConfig } from "../project-config"; export type PluginHandlerSource = lambda.IFunction | ((scope: Construct) => lambda.IFunction); /** What a deployment registers: the shape `definePlugin` (@fntio/infra-client-plugin-cdk) returns. */ export interface PluginRegistration { readonly manifest: PluginManifestV1; /** Built frontend directory; required when the manifest has UI entries. */ readonly assetDirectory?: string; /** Keyed by the `handlerKey` routes name; factories run once, inside the routes construct. */ readonly handlers: Readonly<Record<string, PluginHandlerSource>>; } /** A registration plus everything the stacks derive from it. */ export interface ResolvedPlugin { readonly manifest: PluginManifestV1; readonly assetDirectory?: string; readonly assetHash?: string; /** `/plugin-assets/<id>/<version>-<hash>` — changed bytes never reuse a URL. */ readonly assetPrefix?: string; readonly handlers: Readonly<Record<string, PluginHandlerSource>>; readonly ui?: { readonly user?: PluginCatalogUiEntryV1; readonly admin?: PluginCatalogUiEntryV1; }; readonly routes: readonly PluginCatalogRouteV1[]; /** Content digest of permission/route metadata + the asset hash. */ readonly revision: string; } /** The feature, on: absent from every stack prop when it is off (like `network` / `devShares`). */ export interface ResolvedPlugins { readonly discoveryRefreshSeconds: number; readonly plugins: readonly ResolvedPlugin[]; } /** Synth-time validation of the feature block + registrations; undefined when the feature is off. * Registrations without the feature are an error, never a silent no-op. */ export declare function resolvePlugins(config: PluginsConfig | undefined, registrations?: readonly PluginRegistration[]): ResolvedPlugins | undefined; export declare function resolvePlugin(registration: PluginRegistration): ResolvedPlugin; /** Deterministic content hash of a directory (CDK's own asset fingerprint), 16 hex chars. */ export declare function hashDirectory(dir: string): string; export declare function pluginRevision(manifest: PluginManifestV1, assetHash?: string): string;