import { AnyMongoAbility } from '@casl/ability'; import { OpenAPIV3 } from 'openapi-police'; /** * Rebase a obj.$ref value, following the rules: * * #/definitions/ to #/components/schemas//definitions/ * #/definitions/ to #/components/schemas//definitions/ * #/properties/ to #/components/schemas//properties/ * #/properties/ to #/components/schemas//definitions/ * # to #/components/schemas/ * to #/components/schemas/ * * @export * @param {string} schemaName * @param {*} obj * @returns {*} the modified obj with rebased $ref property */ export declare function refsRebaser(schemaName: string, obj: any): any; /** * Recursively move all OpenAPI spec schemas' definitions properties and rebase $refs accordingly * * @export * @param {*} fullSpec - the full OpenAPI spec object eventually containing definitions properties * @returns {*} - the transformed spec with rebased definitions */ export declare function rebaseOASDefinitions(fullSpec: any): OpenAPIV3.Document; /** * Remove $schema property from a JSON Schema * * @param obj - the JSON Schema object * @returns Object - the JSON Schema without $schema definition property */ export declare function removeSchemaDeclaration(obj: any): any; /** * Types for counting occurrences of schemas and parameters in openapi specs */ export interface OccurrencesTable { schemas: Occurrence | {}; parameters: Occurrence | {}; responses: Occurrence | {}; } export interface Occurrence { count: number; referencedBy: string[]; } /** * Remove all schema definitions from spec.components.schemas, from spec.components.parameters, * and from spec.components.responses when there isn't any $ref pointing to them. * The function modifies the document passed in input. * * @param spec - the OpenAPIV3.Document to "clean" * @returns the clean OpenAPIV3.Document */ export declare function removeUnusedSchemas(spec: OpenAPIV3.Document): OpenAPIV3.Document; export declare function checkAbility(ability: AnyMongoAbility, resource: string, action: string, data?: any, filterFields?: boolean, filterData?: boolean): any; export interface CSVOptions { fields: string[] | { [key: string]: string; }; unwind?: string; forceUnwind?: boolean; separator?: string; decimal?: string; quotes?: boolean; escape?: string; eol?: string; dateFormat?: string; timezone?: string; header: boolean; filename?: string; } export declare function toCSV(data: any[], options: CSVOptions): string;