UNPKG

@teqfw/core

Version:

Core functionalities for plugin scanning, local configuration management, and command-line utilities for building modern web applications with the Tequila Framework.

82 lines (75 loc) 2.79 kB
/** * Interface for managing data in a store. * * This interface provides a contract for performing CRUD operations and * data composition within a storage system, such as a database or in-memory store. * * @interface TeqFw_Core_Shared_Api_Model */ export default class TeqFw_Core_Shared_Api_Model { /** * Composes a new entity DTO. * * This method creates a complete entity data transfer object (DTO) using * the provided initial data. * * @param {Object} dto - Initial data for composing the entity. * @returns {Object} - The composed entity DTO. */ composeEntity(dto) {} /** * Composes a new list item DTO. * * This method creates a lightweight DTO suitable for list presentations * based on the provided data. * * @param {Object} dto - Initial data for composing the item. * @returns {Object} - The composed item DTO. */ composeItem(dto) {} /** * Creates a new entry in the store. * * This method adds a new record to the storage system based on the provided options. * * @param {Object} opts - Options for creating the entry. Typically includes data and metadata. * @returns {Object} - Result of the create operation, often including the new entity's ID. */ async create(opts) {} /** * Deletes a record from the store. * * This method removes a record identified by the given options. * * @param {Object} opts - Options for deleting the record. Typically includes the record's ID or key. * @returns {Object} - Result of the delete operation, such as the number of records deleted. */ async delete(opts) {} /** * Retrieves a list of records from the store. * * This method fetches multiple records based on the given criteria. * * @param {Object} opts - Options for listing records, such as filters, sorting, or pagination. * @returns {Promise<Object[]>} - An array of retrieved records. */ async list(opts) {} /** * Reads a record from the store. * * This method fetches a single record identified by the given options. * * @param {Object} opts - Options for reading the record, such as an ID or key. * @returns {Object} - The retrieved record or result of the read operation. */ async read(opts) {} /** * Updates an existing entry in the store. * * This method modifies an existing record based on the provided options and data. * * @param {Object} opts - Options for the update operation, typically including the record's ID and updated fields. * @returns {Object} - Result of the update operation, often including the updated entity. */ async update(opts) {} }