import type { FromLixSchemaDefinition } from "../schema-definition/definition.js"; /** * Represents a key-value pair in Lix. * * The value can be any JSON-serializable type (string, number, boolean, object, array, null). * * **Important SQLite Limitation with Boolean Values:** * SQLite does not have a native boolean type. When storing JSON values: * - `true` is stored as `1` * - `false` is stored as `0` * * This is a fundamental limitation of SQLite's JSON implementation. There is no way * to distinguish between a boolean `true` and the number `1` after retrieval. * * When querying boolean values, use loose equality (`==`) or handle the numeric representation. * * @example * ```typescript * await lix.db.insertInto("key_value").values({ * key: "lix_sync_enabled", * value: true // Will be stored as 1 in SQLite * }).execute(); * * await lix.db.insertInto("key_value").values({ * key: "lix_server_url", * value: "https://api.example.com" * }).execute(); * ``` * * @example * ```typescript * const result = await lix.db * .selectFrom("key_value") * .where("key", "=", "lix_sync_enabled") * .select("value") * .executeTakeFirst(); * * // result.value will be 1 (not true) * const isEnabled = result?.value == true; // Use loose equality * const isEnabled = result?.value === 1; // Or compare numeric value * ``` * * @example * ```typescript * // Common Lix system keys * // "lix_id" - Unique identifier for the Lix instance * // "lix_name" - Human-readable name for the Lix instance * // "lix_server_url" - URL of the sync server * // "lix_deterministic_mode" - Boolean flag for deterministic ID generation * // "lix_telemetry" - Telemetry setting ("on" or "off") * ``` */ export type LixKeyValue = FromLixSchemaDefinition & { value: any; }; export declare const LixKeyValueSchema: { readonly "x-lix-key": "lix_key_value"; readonly "x-lix-version": "1.0"; readonly "x-lix-primary-key": readonly ["/key"]; readonly "x-lix-override-lixcols": { readonly lixcol_file_id: "\"lix\""; readonly lixcol_plugin_key: "\"lix_sdk\""; }; readonly type: "object"; readonly properties: { readonly key: { readonly type: "string"; }; readonly value: any; }; readonly required: readonly ["key", "value"]; readonly additionalProperties: false; }; //# sourceMappingURL=schema-definition.d.ts.map