import EnvoyPluginStorage from './EnvoyPluginStorage'; import EnvoyPluginJob from './EnvoyPluginJob'; import EnvoyJWT from '../util/EnvoyJWT'; import EnvoyUserAPI from './EnvoyUserAPI'; import EnvoyPluginAPI from './EnvoyPluginAPI'; /** * Every Envoy request has a `meta` and `payload`. * @category Request */ export interface EnvoyRequestBody { meta: Meta; payload: Payload; } /** * Sets up all relevant Envoy functions. * Attaches itself to every request object using our {@link middleware}, * to allow for easy access to Envoy functions. * * @category SDK */ export default class EnvoyPluginSDK, Payload = unknown> { /** * Body of the request. * use `meta` or `payload` to access the relevant properties, * instead of this directly. */ private readonly body; /** * Verified that the request comes from Envoy. */ private readonly isVerified; /** * The internally managed plugin access token. * Use the `pluginAPI` instead of this directly. */ private readonly pluginAccessToken; /** * Don't create an instance of this class directly. * * Instead, use {@link middleware} to automatically attach an instance to `req` on every request. * @param body - Request body * @param isVerified - If the request has been verified via {@link EnvoySignatureVerifier} * @param pluginAccessToken - An access token from {@link EnvoyPluginAPI.loginAsPlugin} */ constructor(body: EnvoyRequestBody, isVerified?: boolean, pluginAccessToken?: string | null); /** * The metadata for the request. * Either an {@link EnvoyEventMeta}} or {@link EnvoyRouteMeta}. */ get meta(): Meta; /** * The payload for the request. * For events, it's some Envoy event payload, like an {@link EntryPayload} or {@link InvitePayload}. * For setup step validation URLs, it's the form submitted values for a validation URL. */ get payload(): Payload; /** * Envoy API scoped to the user. * Used only in routes. */ get userAPI(): EnvoyUserAPI; /** * Envoy API scoped to the plugin. * Used to perform storage or job operations. */ get pluginAPI(): EnvoyPluginAPI; /** * A function that returns an instance of EnvoyPluginStorage, * optionally scoped to an install ID. * * Use {@link installStorage} or {@link globalStorage} instead of this directly. */ private get getStorage(); /** * Storage scoped to the install. */ get installStorage(): EnvoyPluginStorage; /** * Storage scoped globally (across installs). */ get globalStorage(): EnvoyPluginStorage; /** * Returns a job based on an ID. */ get getJob(): (jobId: string) => EnvoyPluginJob; /** * Returns the current job's ID. */ get jobId(): string | null; /** * Perform operations on the current job. */ get job(): EnvoyPluginJob; /** * A utility to encode and decode JWTs. * Useful for verifiable communications between plugin endpoints. */ get jwt(): EnvoyJWT; } //# sourceMappingURL=EnvoyPluginSDK.d.ts.map