import type * as StackbitTypes from '@stackbit/types'; import type { DocumentWithContext } from './hygraph-entries-converter.js'; import type { ModelWithContext } from './hygraph-schema-converter.js'; /** * Converts a map of {@link StackbitTypes.UpdateOperationFields} into the "data" * parameter expected by the Hygraph's GraphQL create mutation. * * ```js * const data = convertUpdateOperationFields({ * updateOperationFields, * model, * getModelByName, * getModelNameForDocumentId * }); * * const query = gql` * mutation createEntry($data: ModelXCreateInput!) { * createModelX(data: $data) { * id * } * }` * * client.request(query, { data }); * ``` * * @param updateOperationFields Map between field names and {@link StackbitTypes.UpdateOperationField} * @param model The model for the new document * @param getModelByName A function that returns a model for a modelName * @param getModelNameForDocumentId A function that returns a modelName for a documentId */ export declare function convertUpdateOperationFields({ updateOperationFields, model, getModelByName, getModelNameForDocumentId }: { updateOperationFields: Record; model: ModelWithContext; getModelByName: (name: string) => ModelWithContext | undefined; getModelNameForDocumentId: (id: string) => string | undefined; }): Record; /** * Converts an array of {@link StackbitTypes.UpdateOperation} into the "data" * parameter expected by the Hygraph's GraphQL update mutation for a given * document. * * ```js * const data = convertOperations({ * operations, * document, * getModelByName, * getModelNameForDocumentId * }); * * const query = gql` * mutation updateEntry($entryId: String!, $data: ModelXCreateInput!) { * updateModelX(where: {id: $entryId} data: $data) { * id * } * }` * * client.request(query, { data }); * ``` * * @param operations List of {@link StackbitTypes.UpdateOperation} * @param document The document to be updated * @param getModelByName A function that returns a model for a modelName * @param getModelNameForDocumentId A function that returns a modelName for a documentId */ export declare function convertOperations({ operations, document, getModelByName, getModelNameForDocumentId }: { operations: StackbitTypes.UpdateOperation[]; document: DocumentWithContext; getModelByName: (name: string) => ModelWithContext | undefined; getModelNameForDocumentId: (id: string) => string | undefined; }): Record; export type DocumentListFieldItemsForType = StackbitTypes.ExtractByType; //# sourceMappingURL=hygraph-operation-converter.d.ts.map