import { type LixKeyValue } from "../key-value/schema-definition.js"; import type { NewStateByVersion } from "../engine/entity-views/types.js"; /** * A Blob with an attached `._lix` property for easy access to some lix properties. * * For example, the `._lix` property provides immediate access to essential metadata * like `id` and `name` without needing to parse the file. This is particularly useful * for scenarios where you need to identify a Lix file before fully opening it. * * @example * // With `._lix`, the ID is instantly available: * const blob = await newLixFile(); * console.log(blob._lix.id); // e.g., "z2k9j6d" * * @example * // Without `._lix`, you would need to open the lix to get its ID: * const blob = await newLixFile(); * // Open the lix to access its metadata * const lix = await openLix({ blob }); * const id = await lix.db.selectFrom("key_value") * .where("key", "=", "lix_id") * .select("value") * .executeTakeFirst(); * await lix.close(); * */ export interface NewLixBlob extends Blob { _lix: { id: string; name: string; }; } /** * Creates a new Lix file as a {@link NewLixBlob}. * * This function bootstraps an in-memory SQLite database with the necessary * schema and metadata to represent a valid Lix project. The resulting * blob is ready to be persisted to disk, IndexedDB, or other storage. * * The returned blob has a `._lix` property for immediate access to the * lix identifier and name without needing to open the file. * * @example * ```ts * // Create a new lix file with default values * const blob = await newLixFile(); * console.log(blob._lix.id); // e.g. "z2k9j6d" * console.log(blob._lix.name); // e.g. "blue-gorilla" * ``` * * @example * ```ts * // Create a new lix file with specific key-values * const blob = await newLixFile({ * keyValues: [ * { key: "lix_name", value: "my-project", lixcol_version_id: "global" }, * { key: "lix_id", value: "custom-id", lixcol_version_id: "global" }, * { key: "my_custom_key", value: "my_custom_value", lixcol_version_id: "global" } * ], * }); * console.log(blob._lix.id); // "custom-id" * console.log(blob._lix.name); // "my-project" * ``` */ export declare function newLixFile(args?: { /** * Pre-populates the key-value store of the new lix file. * * Use this to set initial values for `lix_id`, `lix_name`, or other custom keys. * If `lix_id` or `lix_name` are not provided, they will be generated automatically. * * The `lixcol_version_id` defaults to the active version. * * @example * keyValues: [ * { key: "lix_name", value: "my-project", lixcol_version_id: "global" }, * { key: "lix_id", value: "custom-id", lixcol_version_id: "global" }, * { key: "my_custom_key", value: "my_custom_value", lixcol_version_id: "global" }, * ] */ keyValues?: NewStateByVersion[]; }): Promise; //# sourceMappingURL=new-lix.d.ts.map