import { GenericObject } from "@mongez/reinforcements"; import { Request } from "../http"; import { FinalOutput, OutputResource, OutputTransformer, OutputValue } from "./types"; export declare class Output { resource: OutputResource; /** * Final data output */ protected data: GenericObject; /** * Disabled keys from being returned in the final output */ protected static disabledKeys: string[]; /** * The only allowed keys */ protected static allowedKeys: string[]; /** * Output shape */ protected output: FinalOutput; /** * Defaults when key is missing from the given data */ protected defaults: {}; /** * Default date format */ protected dateFormat: string; /** * Original resource data */ originalResource: OutputResource; /** * Request object * Injected when output is sent to response * If you're going to use toJSON before sending it to response * Make sure to attach the request object to the output */ request: Request; /** * Constructor */ constructor(resource?: OutputResource); /** * return list of resources for the given array ouf data */ static collect(data: OutputResource[]): Output[]; /** * Set value to the final output */ set(key: string, value: any): this; /** * Get value from final output */ get(key: string, defaultValue?: any): any; /** * Remove a key from the final output */ remove(...keys: string[]): void; /** * Disable the given keys */ static disable(...keys: string[]): typeof Output; /** * Remove the given keys from the disabled keys */ static enable(...keys: string[]): typeof Output; /** * Allow only the given keys */ static allow(...keys: string[]): typeof Output; /** * Reset allowed and disabled keys */ static resetKeys(): typeof Output; /** * Remove the given keys from the allowed keys */ static disallow(...keys: string[]): typeof Output; /** * Get final output data */ get response(): Promise; /** * Boot method * Called before transforming the resource */ protected boot(): Promise; /** * Extend the resource output * Called after transforming the resource */ protected extend(): Promise; /** * Manage the output as localized value and parse the value by using the given output */ protected localized(output: typeof Output): OutputTransformer; /** * Transform resource to object, that's going to be used as the final output */ toJSON(): Promise; /** * Transform final output */ protected transformOutput(): Promise; /** * Check if the given value is valid resource value */ protected isValidResourceValue(value: any): boolean; /** * Check if the given key is disabled */ protected isDisabledKey(key: string): boolean; /** * Check if the given key is allowed */ protected isAllowedKey(key: string): boolean; /** * Transform value */ protected transformValue(value: any, valueType: OutputValue | [string, OutputValue]): Promise; /** * Transform the value of the given key */ transform(key: string, type: OutputValue): Promise; /** * Transform and store the transformed value in the final output of the given key */ opt(key: string, type: OutputValue, setAs?: string): Promise; /** * Get resource id */ get id(): any; /** * Builtin casts */ protected cast(value: any, type: OutputValue): any; /** * Parse the given value */ protected parseDate(value: any, format?: string): import("../utils/date-output").DateOutputReturn; } //# sourceMappingURL=output.d.ts.map