latticesql 0.5.2 → 0.5.4

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/dist/cli.js CHANGED
@@ -503,12 +503,22 @@ var SchemaManager = class {
503
503
  }
504
504
  }
505
505
  }
506
- /** Query all rows from a registered table */
506
+ /**
507
+ * Query all rows from a table.
508
+ * Registered tables (via `define()`) are queried directly.
509
+ * Tables used only in entity contexts (schema managed externally) fall back
510
+ * to a raw SELECT with optional `deleted_at IS NULL` soft-delete filtering.
511
+ */
507
512
  queryTable(adapter, name) {
508
- if (!this._tables.has(name)) {
509
- throw new Error(`Unknown table: "${name}"`);
513
+ if (this._tables.has(name)) {
514
+ return adapter.all(`SELECT * FROM "${name}"`);
515
+ }
516
+ if (this._entityContexts.has(name)) {
517
+ const cols = adapter.all(`PRAGMA table_info("${name}")`);
518
+ const hasDeletedAt = cols.some((c) => c.name === "deleted_at");
519
+ return adapter.all(`SELECT * FROM "${name}"${hasDeletedAt ? " WHERE deleted_at IS NULL" : ""}`);
510
520
  }
511
- return adapter.all(`SELECT * FROM "${name}"`);
521
+ throw new Error(`Unknown table: "${name}"`);
512
522
  }
513
523
  _ensureTable(adapter, name, columns, tableConstraints) {
514
524
  const colDefs = Object.entries(columns).map(([col, type]) => `"${col}" ${type}`).join(", ");
@@ -1162,7 +1172,6 @@ var Lattice = class {
1162
1172
  return this;
1163
1173
  }
1164
1174
  defineEntityContext(table, def) {
1165
- this._assertNotInit("defineEntityContext");
1166
1175
  this._schema.defineEntityContext(table, def);
1167
1176
  return this;
1168
1177
  }
package/dist/index.cjs CHANGED
@@ -238,12 +238,22 @@ var SchemaManager = class {
238
238
  }
239
239
  }
240
240
  }
241
- /** Query all rows from a registered table */
241
+ /**
242
+ * Query all rows from a table.
243
+ * Registered tables (via `define()`) are queried directly.
244
+ * Tables used only in entity contexts (schema managed externally) fall back
245
+ * to a raw SELECT with optional `deleted_at IS NULL` soft-delete filtering.
246
+ */
242
247
  queryTable(adapter, name) {
243
- if (!this._tables.has(name)) {
244
- throw new Error(`Unknown table: "${name}"`);
248
+ if (this._tables.has(name)) {
249
+ return adapter.all(`SELECT * FROM "${name}"`);
250
+ }
251
+ if (this._entityContexts.has(name)) {
252
+ const cols = adapter.all(`PRAGMA table_info("${name}")`);
253
+ const hasDeletedAt = cols.some((c) => c.name === "deleted_at");
254
+ return adapter.all(`SELECT * FROM "${name}"${hasDeletedAt ? " WHERE deleted_at IS NULL" : ""}`);
245
255
  }
246
- return adapter.all(`SELECT * FROM "${name}"`);
256
+ throw new Error(`Unknown table: "${name}"`);
247
257
  }
248
258
  _ensureTable(adapter, name, columns, tableConstraints) {
249
259
  const colDefs = Object.entries(columns).map(([col, type]) => `"${col}" ${type}`).join(", ");
@@ -1122,7 +1132,6 @@ var Lattice = class {
1122
1132
  return this;
1123
1133
  }
1124
1134
  defineEntityContext(table, def) {
1125
- this._assertNotInit("defineEntityContext");
1126
1135
  this._schema.defineEntityContext(table, def);
1127
1136
  return this;
1128
1137
  }
package/dist/index.js CHANGED
@@ -189,12 +189,22 @@ var SchemaManager = class {
189
189
  }
190
190
  }
191
191
  }
192
- /** Query all rows from a registered table */
192
+ /**
193
+ * Query all rows from a table.
194
+ * Registered tables (via `define()`) are queried directly.
195
+ * Tables used only in entity contexts (schema managed externally) fall back
196
+ * to a raw SELECT with optional `deleted_at IS NULL` soft-delete filtering.
197
+ */
193
198
  queryTable(adapter, name) {
194
- if (!this._tables.has(name)) {
195
- throw new Error(`Unknown table: "${name}"`);
199
+ if (this._tables.has(name)) {
200
+ return adapter.all(`SELECT * FROM "${name}"`);
201
+ }
202
+ if (this._entityContexts.has(name)) {
203
+ const cols = adapter.all(`PRAGMA table_info("${name}")`);
204
+ const hasDeletedAt = cols.some((c) => c.name === "deleted_at");
205
+ return adapter.all(`SELECT * FROM "${name}"${hasDeletedAt ? " WHERE deleted_at IS NULL" : ""}`);
196
206
  }
197
- return adapter.all(`SELECT * FROM "${name}"`);
207
+ throw new Error(`Unknown table: "${name}"`);
198
208
  }
199
209
  _ensureTable(adapter, name, columns, tableConstraints) {
200
210
  const colDefs = Object.entries(columns).map(([col, type]) => `"${col}" ${type}`).join(", ");
@@ -1073,7 +1083,6 @@ var Lattice = class {
1073
1083
  return this;
1074
1084
  }
1075
1085
  defineEntityContext(table, def) {
1076
- this._assertNotInit("defineEntityContext");
1077
1086
  this._schema.defineEntityContext(table, def);
1078
1087
  return this;
1079
1088
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "latticesql",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "Persistent structured memory for AI agent systems — SQLite ↔ LLM context bridge",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",