import { type AppDefinition, type ResourceDefinition, type Resource as ResourceType } from '@appsemble/types';
import { type PreValidatePropertyFunction } from 'jsonschema';
import { type Context, type DefaultContext, type DefaultState, type ParameterizedContext } from 'koa';
import { type JsonValue } from 'type-fest';
import { type PreparedAsset, TempFile } from './index.js';
export declare function stripResource({ $author, $created, $editor, $ephemeral, $group, $seed, $updated, ...data }: ResourceType): Record<string, unknown>;
/**
 * Works on a resource, which has been processed on the server by the streamParser
 *
 * @param data The resource to be serialized, optionally containing parsed TempFile instance assets
 * @returns An object containing the resource and an array of the assets referenced
 *   from the resource
 */
export declare function serializeServerResource(data: any): JsonValue | {
    resource: JsonValue;
    assets: TempFile[];
};
/**
 * Get the resource definition of an app by name.
 *
 * If there is no match, a 404 HTTP error is thrown.
 *
 * @param appDefinition The app definition to get the resource definition of
 * @param resourceType The name of the resource definition to get.
 * @param ctx Context used to throw back the errors.
 * @param view The view that’s being used.
 * @returns The matching resource definition.
 */
export declare function getResourceDefinition(appDefinition: AppDefinition, resourceType: string, ctx?: Context, view?: string): ResourceDefinition;
/**
 * Extracts the IDs of resource request body.
 *
 * @param ctx The Koa context to extract the body from.
 * @returns A tuple which consists of:
 *
 *   1. One or more resources processed from the request body.
 *   2. A list of newly uploaded assets which should be linked to the resources.
 *   3. preValidateProperty function used for reconstructing resources from a CSV file.
 */
export declare function extractResourceBody(ctx: Context | ParameterizedContext<DefaultState, DefaultContext, any>): [
    Record<string, unknown> | Record<string, unknown>[],
    TempFile[],
    PreValidatePropertyFunction | undefined
];
/**
 * Process an incoming resource request body.
 *
 * This handles JSON schema validation, resource expiration, and asset linking and validation.
 *
 * @param ctx The Koa context to process.
 * @param definition The resource definition to use for processing the request body.
 * @param knownAssetIds A list of asset IDs that are already known to be linked to the resource.
 * @param knownExpires A previously known expires value.
 * @param knownAssetNameIds A list of asset ids with asset names that already exist.
 * @param [isPatch] if the "PATCH" HTTP method is being used.
 * @returns A tuple which consists of:
 *
 *   1. One or more resources processed from the request body.
 *   2. A list of newly uploaded assets which should be linked to the resources.
 *   3. Asset IDs from the `knownAssetIds` array which are no longer used.
 */
export declare function processResourceBody(ctx: Context | ParameterizedContext<DefaultState, DefaultContext, any>, definition: ResourceDefinition, knownAssetIds?: string[], knownExpires?: Date, knownAssetNameIds?: {
    id: string;
    name: string;
}[], isPatch?: boolean): [Record<string, unknown> | Record<string, unknown>[], PreparedAsset[], string[]];
