latticesql 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/dist/cli.js +1217 -818
- package/dist/index.cjs +41 -3
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +41 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -986,6 +986,19 @@ var SchemaManager = class {
|
|
|
986
986
|
redefineEntityContext(table, def) {
|
|
987
987
|
this._entityContexts.set(table, def);
|
|
988
988
|
}
|
|
989
|
+
/**
|
|
990
|
+
* Remove a table from the registry — the inverse of {@link define}. Clears the
|
|
991
|
+
* table def, its primary-key, any multi-render, and its entity context. A no-op
|
|
992
|
+
* if the table was never defined. Used by the GUI's soft table-delete to drop a
|
|
993
|
+
* runtime-registered table without a full reopen; the physical SQL table is left
|
|
994
|
+
* intact by the caller so the delete stays revertible.
|
|
995
|
+
*/
|
|
996
|
+
undefine(table) {
|
|
997
|
+
this._tables.delete(table);
|
|
998
|
+
this._tablePK.delete(table);
|
|
999
|
+
this._multis.delete(table);
|
|
1000
|
+
this._entityContexts.delete(table);
|
|
1001
|
+
}
|
|
989
1002
|
getTables() {
|
|
990
1003
|
return this._tables;
|
|
991
1004
|
}
|
|
@@ -3364,7 +3377,9 @@ function writeIdentity(identity) {
|
|
|
3364
3377
|
var PREFERENCES_FILENAME = "preferences.json";
|
|
3365
3378
|
var DEFAULT_PREFERENCES = {
|
|
3366
3379
|
show_system_tables: false,
|
|
3367
|
-
analytics: true
|
|
3380
|
+
analytics: true,
|
|
3381
|
+
voice_provider: "auto",
|
|
3382
|
+
aggressiveness: 0.5
|
|
3368
3383
|
};
|
|
3369
3384
|
function readPreferences() {
|
|
3370
3385
|
const dir = ensureConfigDir();
|
|
@@ -3372,9 +3387,12 @@ function readPreferences() {
|
|
|
3372
3387
|
if (!(0, import_node_fs9.existsSync)(path2)) return { ...DEFAULT_PREFERENCES };
|
|
3373
3388
|
try {
|
|
3374
3389
|
const parsed = JSON.parse((0, import_node_fs9.readFileSync)(path2, "utf8"));
|
|
3390
|
+
const agg = typeof parsed.aggressiveness === "number" ? parsed.aggressiveness : NaN;
|
|
3375
3391
|
return {
|
|
3376
3392
|
show_system_tables: typeof parsed.show_system_tables === "boolean" ? parsed.show_system_tables : DEFAULT_PREFERENCES.show_system_tables,
|
|
3377
|
-
analytics: typeof parsed.analytics === "boolean" ? parsed.analytics : DEFAULT_PREFERENCES.analytics
|
|
3393
|
+
analytics: typeof parsed.analytics === "boolean" ? parsed.analytics : DEFAULT_PREFERENCES.analytics,
|
|
3394
|
+
voice_provider: parsed.voice_provider === "openai" || parsed.voice_provider === "elevenlabs" || parsed.voice_provider === "auto" ? parsed.voice_provider : DEFAULT_PREFERENCES.voice_provider,
|
|
3395
|
+
aggressiveness: Number.isFinite(agg) ? Math.min(1, Math.max(0, agg)) : DEFAULT_PREFERENCES.aggressiveness
|
|
3378
3396
|
};
|
|
3379
3397
|
} catch {
|
|
3380
3398
|
return { ...DEFAULT_PREFERENCES };
|
|
@@ -3384,7 +3402,12 @@ function writePreferences(prefs) {
|
|
|
3384
3402
|
const dir = ensureConfigDir();
|
|
3385
3403
|
const path2 = (0, import_node_path10.join)(dir, PREFERENCES_FILENAME);
|
|
3386
3404
|
const body = JSON.stringify(
|
|
3387
|
-
{
|
|
3405
|
+
{
|
|
3406
|
+
show_system_tables: prefs.show_system_tables,
|
|
3407
|
+
analytics: prefs.analytics,
|
|
3408
|
+
voice_provider: prefs.voice_provider,
|
|
3409
|
+
aggressiveness: prefs.aggressiveness
|
|
3410
|
+
},
|
|
3388
3411
|
null,
|
|
3389
3412
|
2
|
|
3390
3413
|
);
|
|
@@ -4525,6 +4548,21 @@ var Lattice = class _Lattice {
|
|
|
4525
4548
|
}
|
|
4526
4549
|
return this;
|
|
4527
4550
|
}
|
|
4551
|
+
/**
|
|
4552
|
+
* Remove a runtime-registered table from the live schema registry — the
|
|
4553
|
+
* inverse of {@link defineLate}. The table stops being listed/queryable
|
|
4554
|
+
* WITHOUT a full reopen (which would dispose this instance and invalidate any
|
|
4555
|
+
* captured `db`/feed references mid-operation — see the GUI's soft table
|
|
4556
|
+
* delete). Does NOT drop the physical SQL table or its rows; the caller keeps
|
|
4557
|
+
* them so the delete remains revertible. A no-op if the table isn't
|
|
4558
|
+
* registered.
|
|
4559
|
+
*/
|
|
4560
|
+
unregisterTable(table) {
|
|
4561
|
+
this._schema.undefine(table);
|
|
4562
|
+
this._columnCache.delete(table);
|
|
4563
|
+
this._changelogTables.delete(table);
|
|
4564
|
+
return this;
|
|
4565
|
+
}
|
|
4528
4566
|
_registerTable(table, def) {
|
|
4529
4567
|
const columns = def.rewardTracking ? { ...def.columns, _reward_total: "REAL DEFAULT 0", _reward_count: "INTEGER DEFAULT 0" } : def.columns;
|
|
4530
4568
|
const renderTemplateName = _resolveTemplateName(def.render);
|
package/dist/index.d.cts
CHANGED
|
@@ -1727,6 +1727,16 @@ declare class Lattice {
|
|
|
1727
1727
|
* Throws if called before `init()` (use `define()` instead).
|
|
1728
1728
|
*/
|
|
1729
1729
|
defineLate(table: string, def: TableDefinition): Promise<this>;
|
|
1730
|
+
/**
|
|
1731
|
+
* Remove a runtime-registered table from the live schema registry — the
|
|
1732
|
+
* inverse of {@link defineLate}. The table stops being listed/queryable
|
|
1733
|
+
* WITHOUT a full reopen (which would dispose this instance and invalidate any
|
|
1734
|
+
* captured `db`/feed references mid-operation — see the GUI's soft table
|
|
1735
|
+
* delete). Does NOT drop the physical SQL table or its rows; the caller keeps
|
|
1736
|
+
* them so the delete remains revertible. A no-op if the table isn't
|
|
1737
|
+
* registered.
|
|
1738
|
+
*/
|
|
1739
|
+
unregisterTable(table: string): this;
|
|
1730
1740
|
private _registerTable;
|
|
1731
1741
|
defineMulti(name: string, def: MultiTableDefinition): this;
|
|
1732
1742
|
defineEntityContext(table: string, def: EntityContextDefinition): this;
|
|
@@ -3028,6 +3038,19 @@ interface UserPreferences {
|
|
|
3028
3038
|
* any future runtime telemetry is disabled. See {@link analyticsEnabled}.
|
|
3029
3039
|
*/
|
|
3030
3040
|
analytics: boolean;
|
|
3041
|
+
/**
|
|
3042
|
+
* Preferred speech-to-text provider for the assistant's voice notes. This is
|
|
3043
|
+
* a USER preference, not a workspace secret — it lives here (machine-local) so
|
|
3044
|
+
* it persists across workspaces and never appears in any workspace's `secrets`
|
|
3045
|
+
* object. `'auto'` infers from whichever provider key is configured.
|
|
3046
|
+
*/
|
|
3047
|
+
voice_provider: 'auto' | 'openai' | 'elevenlabs';
|
|
3048
|
+
/**
|
|
3049
|
+
* Inference aggressiveness (0 = conservative … 1 = aggressive). Drives the
|
|
3050
|
+
* assistant's sampling temperature and how liberally ingest links/extracts.
|
|
3051
|
+
* A user preference, machine-local (see `voice_provider`).
|
|
3052
|
+
*/
|
|
3053
|
+
aggressiveness: number;
|
|
3031
3054
|
}
|
|
3032
3055
|
/**
|
|
3033
3056
|
* Read machine-local user preferences. Returns defaults if the file is
|
package/dist/index.d.ts
CHANGED
|
@@ -1727,6 +1727,16 @@ declare class Lattice {
|
|
|
1727
1727
|
* Throws if called before `init()` (use `define()` instead).
|
|
1728
1728
|
*/
|
|
1729
1729
|
defineLate(table: string, def: TableDefinition): Promise<this>;
|
|
1730
|
+
/**
|
|
1731
|
+
* Remove a runtime-registered table from the live schema registry — the
|
|
1732
|
+
* inverse of {@link defineLate}. The table stops being listed/queryable
|
|
1733
|
+
* WITHOUT a full reopen (which would dispose this instance and invalidate any
|
|
1734
|
+
* captured `db`/feed references mid-operation — see the GUI's soft table
|
|
1735
|
+
* delete). Does NOT drop the physical SQL table or its rows; the caller keeps
|
|
1736
|
+
* them so the delete remains revertible. A no-op if the table isn't
|
|
1737
|
+
* registered.
|
|
1738
|
+
*/
|
|
1739
|
+
unregisterTable(table: string): this;
|
|
1730
1740
|
private _registerTable;
|
|
1731
1741
|
defineMulti(name: string, def: MultiTableDefinition): this;
|
|
1732
1742
|
defineEntityContext(table: string, def: EntityContextDefinition): this;
|
|
@@ -3028,6 +3038,19 @@ interface UserPreferences {
|
|
|
3028
3038
|
* any future runtime telemetry is disabled. See {@link analyticsEnabled}.
|
|
3029
3039
|
*/
|
|
3030
3040
|
analytics: boolean;
|
|
3041
|
+
/**
|
|
3042
|
+
* Preferred speech-to-text provider for the assistant's voice notes. This is
|
|
3043
|
+
* a USER preference, not a workspace secret — it lives here (machine-local) so
|
|
3044
|
+
* it persists across workspaces and never appears in any workspace's `secrets`
|
|
3045
|
+
* object. `'auto'` infers from whichever provider key is configured.
|
|
3046
|
+
*/
|
|
3047
|
+
voice_provider: 'auto' | 'openai' | 'elevenlabs';
|
|
3048
|
+
/**
|
|
3049
|
+
* Inference aggressiveness (0 = conservative … 1 = aggressive). Drives the
|
|
3050
|
+
* assistant's sampling temperature and how liberally ingest links/extracts.
|
|
3051
|
+
* A user preference, machine-local (see `voice_provider`).
|
|
3052
|
+
*/
|
|
3053
|
+
aggressiveness: number;
|
|
3031
3054
|
}
|
|
3032
3055
|
/**
|
|
3033
3056
|
* Read machine-local user preferences. Returns defaults if the file is
|
package/dist/index.js
CHANGED
|
@@ -844,6 +844,19 @@ var SchemaManager = class {
|
|
|
844
844
|
redefineEntityContext(table, def) {
|
|
845
845
|
this._entityContexts.set(table, def);
|
|
846
846
|
}
|
|
847
|
+
/**
|
|
848
|
+
* Remove a table from the registry — the inverse of {@link define}. Clears the
|
|
849
|
+
* table def, its primary-key, any multi-render, and its entity context. A no-op
|
|
850
|
+
* if the table was never defined. Used by the GUI's soft table-delete to drop a
|
|
851
|
+
* runtime-registered table without a full reopen; the physical SQL table is left
|
|
852
|
+
* intact by the caller so the delete stays revertible.
|
|
853
|
+
*/
|
|
854
|
+
undefine(table) {
|
|
855
|
+
this._tables.delete(table);
|
|
856
|
+
this._tablePK.delete(table);
|
|
857
|
+
this._multis.delete(table);
|
|
858
|
+
this._entityContexts.delete(table);
|
|
859
|
+
}
|
|
847
860
|
getTables() {
|
|
848
861
|
return this._tables;
|
|
849
862
|
}
|
|
@@ -3230,7 +3243,9 @@ function writeIdentity(identity) {
|
|
|
3230
3243
|
var PREFERENCES_FILENAME = "preferences.json";
|
|
3231
3244
|
var DEFAULT_PREFERENCES = {
|
|
3232
3245
|
show_system_tables: false,
|
|
3233
|
-
analytics: true
|
|
3246
|
+
analytics: true,
|
|
3247
|
+
voice_provider: "auto",
|
|
3248
|
+
aggressiveness: 0.5
|
|
3234
3249
|
};
|
|
3235
3250
|
function readPreferences() {
|
|
3236
3251
|
const dir = ensureConfigDir();
|
|
@@ -3238,9 +3253,12 @@ function readPreferences() {
|
|
|
3238
3253
|
if (!existsSync9(path2)) return { ...DEFAULT_PREFERENCES };
|
|
3239
3254
|
try {
|
|
3240
3255
|
const parsed = JSON.parse(readFileSync6(path2, "utf8"));
|
|
3256
|
+
const agg = typeof parsed.aggressiveness === "number" ? parsed.aggressiveness : NaN;
|
|
3241
3257
|
return {
|
|
3242
3258
|
show_system_tables: typeof parsed.show_system_tables === "boolean" ? parsed.show_system_tables : DEFAULT_PREFERENCES.show_system_tables,
|
|
3243
|
-
analytics: typeof parsed.analytics === "boolean" ? parsed.analytics : DEFAULT_PREFERENCES.analytics
|
|
3259
|
+
analytics: typeof parsed.analytics === "boolean" ? parsed.analytics : DEFAULT_PREFERENCES.analytics,
|
|
3260
|
+
voice_provider: parsed.voice_provider === "openai" || parsed.voice_provider === "elevenlabs" || parsed.voice_provider === "auto" ? parsed.voice_provider : DEFAULT_PREFERENCES.voice_provider,
|
|
3261
|
+
aggressiveness: Number.isFinite(agg) ? Math.min(1, Math.max(0, agg)) : DEFAULT_PREFERENCES.aggressiveness
|
|
3244
3262
|
};
|
|
3245
3263
|
} catch {
|
|
3246
3264
|
return { ...DEFAULT_PREFERENCES };
|
|
@@ -3250,7 +3268,12 @@ function writePreferences(prefs) {
|
|
|
3250
3268
|
const dir = ensureConfigDir();
|
|
3251
3269
|
const path2 = join9(dir, PREFERENCES_FILENAME);
|
|
3252
3270
|
const body = JSON.stringify(
|
|
3253
|
-
{
|
|
3271
|
+
{
|
|
3272
|
+
show_system_tables: prefs.show_system_tables,
|
|
3273
|
+
analytics: prefs.analytics,
|
|
3274
|
+
voice_provider: prefs.voice_provider,
|
|
3275
|
+
aggressiveness: prefs.aggressiveness
|
|
3276
|
+
},
|
|
3254
3277
|
null,
|
|
3255
3278
|
2
|
|
3256
3279
|
);
|
|
@@ -4391,6 +4414,21 @@ var Lattice = class _Lattice {
|
|
|
4391
4414
|
}
|
|
4392
4415
|
return this;
|
|
4393
4416
|
}
|
|
4417
|
+
/**
|
|
4418
|
+
* Remove a runtime-registered table from the live schema registry — the
|
|
4419
|
+
* inverse of {@link defineLate}. The table stops being listed/queryable
|
|
4420
|
+
* WITHOUT a full reopen (which would dispose this instance and invalidate any
|
|
4421
|
+
* captured `db`/feed references mid-operation — see the GUI's soft table
|
|
4422
|
+
* delete). Does NOT drop the physical SQL table or its rows; the caller keeps
|
|
4423
|
+
* them so the delete remains revertible. A no-op if the table isn't
|
|
4424
|
+
* registered.
|
|
4425
|
+
*/
|
|
4426
|
+
unregisterTable(table) {
|
|
4427
|
+
this._schema.undefine(table);
|
|
4428
|
+
this._columnCache.delete(table);
|
|
4429
|
+
this._changelogTables.delete(table);
|
|
4430
|
+
return this;
|
|
4431
|
+
}
|
|
4394
4432
|
_registerTable(table, def) {
|
|
4395
4433
|
const columns = def.rewardTracking ? { ...def.columns, _reward_total: "REAL DEFAULT 0", _reward_count: "INTEGER DEFAULT 0" } : def.columns;
|
|
4396
4434
|
const renderTemplateName = _resolveTemplateName(def.render);
|
package/package.json
CHANGED