import { type ExistingManifestContextOptions } from "./existing-manifest-context.js"; import type { ManifestComponentDeletion, ManifestScope } from "./manifest-builder.js"; export type FunctionCodeFile = `./${string}.ts` | `/${string}.ts`; /** * Initialization properties for {@link ManifestFunction}. */ export interface ManifestFunctionProps { /** * Unique identifier for this function (e.g. `'gym_today_schedule_fn'`). * * Required. */ apiName: string; /** * Display name shown in the Rippling UI. * * Required. */ name: string; /** * Path to a TypeScript handler source file. The file must export an * `onRipplingEvent` function. Its contents are serialized to `code_draft`. * * Optional. @default `''` */ codeFile?: FunctionCodeFile; /** * Human-readable description of what this function does. * * Required. */ description: string; /** * NPM package dependencies as a `{ packageName: versionRange }` map * (e.g. `{ '@rippling/rippling-sdk': '^0.2.0' }`). * * Optional. @default null */ dependencies?: Record; /** * Raw deployment options object. * * Optional. @default null */ deploymentOptions?: Record; /** * Outbound domain allowlist. Requests to domains not in this list will be blocked. * * Optional. @default null */ allowedDomains?: string[]; /** * Whether this function runs asynchronously (fire-and-forget). * * Optional. @default `false` */ isAsync?: boolean; } /** * Defines a serverless function and registers it with the manifest. * * A `ManifestFunction` packages TypeScript handler code that runs on Rippling's * serverless infrastructure. The handler must export `onRipplingEvent`. * * Functions have two primary uses: * 1. **Rendering SDUI for Custom Apps** — the function returns an SDUI spec * payload that renders as a page tab. Wrap the function in an {@link SduiPage} * and reference it from an {@link App}. * 2. **Workflow / event handlers** — functions invoked from rules, automations, * or callbacks that do not render UI. * * This class is named `ManifestFunction` to avoid collision with the JavaScript * built-in `Function`. It is also re-exported as `Function` from the barrel for * convenience. * * @example * ```ts * const todayScheduleFn = new ManifestFunction(manifest, { * apiName: 'gym_today_schedule_fn', * name: 'Today\'s schedule (SDUI)', * description: 'Searchable grid of class sessions', * codeFile: './functions/gym_today_schedule_fn/code.ts', * dependencies: { * '@rippling/rippling-sdk': '^0.2.0-alpha.33', * }, * isAsync: false, * }); * ``` * * @see {@link SduiPage} — wraps a `ManifestFunction` as a navigable UI surface. */ export declare class ManifestFunction { static readonly componentType: "FUNCTION"; static toDeletionIdentifier(apiName: string): ManifestComponentDeletion; private readonly _apiName; private readonly _name; private readonly _codeFile; private _codeDraft; private readonly _description; private readonly _dependencies; private readonly _deploymentOptions; private readonly _allowedDomains; private readonly _isAsync; /** * @param scope - The manifest to register this function with. * @param props - Initialization properties. */ constructor(scope: ManifestScope, props: ManifestFunctionProps); /** * Loads this function from the active existing-manifest JSON context. */ static loadFromExisting(apiName: string, options?: ExistingManifestContextOptions): ManifestFunction; /** @internal Hydrates a function from existing manifest wire JSON. */ static _fromExistingComponent(scope: ManifestScope, component: Record): ManifestFunction; /** * Returns the api_name of this function (e.g. `'gym_today_schedule_fn'`). */ getApiName(): string; /** * Serializes this function to the wire format consumed by the manifest install endpoint. * * @returns A plain object with `type: 'FUNCTION'`. Empty or unset optional fields are omitted. */ toDict(): Record; } //# sourceMappingURL=manifest-function.d.ts.map