latticesql 1.16.4 → 1.16.5
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 +1 -0
- package/dist/cli.js +10 -3
- package/dist/index.cjs +10 -3
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -191,6 +191,7 @@ new Lattice(config: LatticeConfigInput, options?: LatticeOptions)
|
|
|
191
191
|
interface LatticeOptions {
|
|
192
192
|
wal?: boolean; // WAL journal mode (default: true — recommended for concurrent reads)
|
|
193
193
|
busyTimeout?: number; // SQLite busy_timeout in ms (default: 5000)
|
|
194
|
+
renderSkipsEmpty?: boolean; // Skip the read + write for spec-less tables on render() (default: false)
|
|
194
195
|
security?: {
|
|
195
196
|
sanitize?: boolean; // Strip control characters from string inputs (default: true)
|
|
196
197
|
auditTables?: string[]; // Tables that emit 'audit' events on write
|
package/dist/cli.js
CHANGED
|
@@ -2608,20 +2608,25 @@ function cleanupEntityContexts(outputDir, entityContexts, currentSlugsByTable, m
|
|
|
2608
2608
|
}
|
|
2609
2609
|
|
|
2610
2610
|
// src/render/engine.ts
|
|
2611
|
+
var NOOP_RENDER = () => "";
|
|
2611
2612
|
var RenderEngine = class {
|
|
2612
2613
|
_schema;
|
|
2613
2614
|
_adapter;
|
|
2614
2615
|
_getTaskContext;
|
|
2615
|
-
|
|
2616
|
+
/** When true, skip the read + write for spec-less (no-op render) tables. */
|
|
2617
|
+
_skipEmpty;
|
|
2618
|
+
constructor(schema, adapter, getTaskContext, options) {
|
|
2616
2619
|
this._schema = schema;
|
|
2617
2620
|
this._adapter = adapter;
|
|
2618
2621
|
this._getTaskContext = getTaskContext ?? (() => "");
|
|
2622
|
+
this._skipEmpty = options?.skipEmpty ?? false;
|
|
2619
2623
|
}
|
|
2620
2624
|
async render(outputDir) {
|
|
2621
2625
|
const start = Date.now();
|
|
2622
2626
|
const filesWritten = [];
|
|
2623
2627
|
const counters = { skipped: 0 };
|
|
2624
2628
|
for (const [name, def] of this._schema.getTables()) {
|
|
2629
|
+
if (this._skipEmpty && def.render === NOOP_RENDER) continue;
|
|
2625
2630
|
let rows = await this._schema.queryTable(this._adapter, name);
|
|
2626
2631
|
if (def.relevanceFilter) {
|
|
2627
2632
|
const ctx = this._getTaskContext();
|
|
@@ -4353,7 +4358,9 @@ var Lattice = class _Lattice {
|
|
|
4353
4358
|
this._adapter = options.adapter ?? buildAdapter(dbPath, options);
|
|
4354
4359
|
this._schema = new SchemaManager();
|
|
4355
4360
|
this._sanitizer = new Sanitizer(options.security);
|
|
4356
|
-
this._render = new RenderEngine(this._schema, this._adapter, () => this._taskContext
|
|
4361
|
+
this._render = new RenderEngine(this._schema, this._adapter, () => this._taskContext, {
|
|
4362
|
+
skipEmpty: options.renderSkipsEmpty ?? false
|
|
4363
|
+
});
|
|
4357
4364
|
this._reverseSync = new ReverseSyncEngine(this._schema, this._adapter);
|
|
4358
4365
|
this._reverseSeedEngine = new ReverseSeedEngine(this._schema, this._adapter);
|
|
4359
4366
|
this._loop = new SyncLoop(this._render);
|
|
@@ -4474,7 +4481,7 @@ var Lattice = class _Lattice {
|
|
|
4474
4481
|
table,
|
|
4475
4482
|
this._schema,
|
|
4476
4483
|
this._adapter
|
|
4477
|
-
) :
|
|
4484
|
+
) : NOOP_RENDER,
|
|
4478
4485
|
outputFile: def.outputFile ?? `.schema-only/${table}.md`,
|
|
4479
4486
|
...renderTemplateName ? { _renderTemplateName: renderTemplateName } : {}
|
|
4480
4487
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -2039,20 +2039,25 @@ function cleanupEntityContexts(outputDir, entityContexts, currentSlugsByTable, m
|
|
|
2039
2039
|
}
|
|
2040
2040
|
|
|
2041
2041
|
// src/render/engine.ts
|
|
2042
|
+
var NOOP_RENDER = () => "";
|
|
2042
2043
|
var RenderEngine = class {
|
|
2043
2044
|
_schema;
|
|
2044
2045
|
_adapter;
|
|
2045
2046
|
_getTaskContext;
|
|
2046
|
-
|
|
2047
|
+
/** When true, skip the read + write for spec-less (no-op render) tables. */
|
|
2048
|
+
_skipEmpty;
|
|
2049
|
+
constructor(schema, adapter, getTaskContext, options) {
|
|
2047
2050
|
this._schema = schema;
|
|
2048
2051
|
this._adapter = adapter;
|
|
2049
2052
|
this._getTaskContext = getTaskContext ?? (() => "");
|
|
2053
|
+
this._skipEmpty = options?.skipEmpty ?? false;
|
|
2050
2054
|
}
|
|
2051
2055
|
async render(outputDir) {
|
|
2052
2056
|
const start = Date.now();
|
|
2053
2057
|
const filesWritten = [];
|
|
2054
2058
|
const counters = { skipped: 0 };
|
|
2055
2059
|
for (const [name, def] of this._schema.getTables()) {
|
|
2060
|
+
if (this._skipEmpty && def.render === NOOP_RENDER) continue;
|
|
2056
2061
|
let rows = await this._schema.queryTable(this._adapter, name);
|
|
2057
2062
|
if (def.relevanceFilter) {
|
|
2058
2063
|
const ctx = this._getTaskContext();
|
|
@@ -4386,7 +4391,9 @@ var Lattice = class _Lattice {
|
|
|
4386
4391
|
this._adapter = options.adapter ?? buildAdapter(dbPath, options);
|
|
4387
4392
|
this._schema = new SchemaManager();
|
|
4388
4393
|
this._sanitizer = new Sanitizer(options.security);
|
|
4389
|
-
this._render = new RenderEngine(this._schema, this._adapter, () => this._taskContext
|
|
4394
|
+
this._render = new RenderEngine(this._schema, this._adapter, () => this._taskContext, {
|
|
4395
|
+
skipEmpty: options.renderSkipsEmpty ?? false
|
|
4396
|
+
});
|
|
4390
4397
|
this._reverseSync = new ReverseSyncEngine(this._schema, this._adapter);
|
|
4391
4398
|
this._reverseSeedEngine = new ReverseSeedEngine(this._schema, this._adapter);
|
|
4392
4399
|
this._loop = new SyncLoop(this._render);
|
|
@@ -4507,7 +4514,7 @@ var Lattice = class _Lattice {
|
|
|
4507
4514
|
table,
|
|
4508
4515
|
this._schema,
|
|
4509
4516
|
this._adapter
|
|
4510
|
-
) :
|
|
4517
|
+
) : NOOP_RENDER,
|
|
4511
4518
|
outputFile: def.outputFile ?? `.schema-only/${table}.md`,
|
|
4512
4519
|
...renderTemplateName ? { _renderTemplateName: renderTemplateName } : {}
|
|
4513
4520
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -746,6 +746,16 @@ interface LatticeOptions {
|
|
|
746
746
|
* backends, or pre-opened connections.
|
|
747
747
|
*/
|
|
748
748
|
adapter?: StorageAdapter;
|
|
749
|
+
/**
|
|
750
|
+
* When true, `render()` skips both the full-table read and the file write
|
|
751
|
+
* for tables registered without a `render` spec — those compile to a no-op
|
|
752
|
+
* that would only emit an empty `.schema-only/<table>.md`. Off by default,
|
|
753
|
+
* preserving the original behavior (the table is still scanned and an empty
|
|
754
|
+
* schema-only file written). Enable this to avoid reading large tables off
|
|
755
|
+
* the wire just to produce empty files. Tables with an explicit `render`
|
|
756
|
+
* (or `outputFile`) are unaffected.
|
|
757
|
+
*/
|
|
758
|
+
renderSkipsEmpty?: boolean;
|
|
749
759
|
}
|
|
750
760
|
/**
|
|
751
761
|
* Retention policy for the change log.
|
package/dist/index.d.ts
CHANGED
|
@@ -746,6 +746,16 @@ interface LatticeOptions {
|
|
|
746
746
|
* backends, or pre-opened connections.
|
|
747
747
|
*/
|
|
748
748
|
adapter?: StorageAdapter;
|
|
749
|
+
/**
|
|
750
|
+
* When true, `render()` skips both the full-table read and the file write
|
|
751
|
+
* for tables registered without a `render` spec — those compile to a no-op
|
|
752
|
+
* that would only emit an empty `.schema-only/<table>.md`. Off by default,
|
|
753
|
+
* preserving the original behavior (the table is still scanned and an empty
|
|
754
|
+
* schema-only file written). Enable this to avoid reading large tables off
|
|
755
|
+
* the wire just to produce empty files. Tables with an explicit `render`
|
|
756
|
+
* (or `outputFile`) are unaffected.
|
|
757
|
+
*/
|
|
758
|
+
renderSkipsEmpty?: boolean;
|
|
749
759
|
}
|
|
750
760
|
/**
|
|
751
761
|
* Retention policy for the change log.
|
package/dist/index.js
CHANGED
|
@@ -1907,20 +1907,25 @@ function cleanupEntityContexts(outputDir, entityContexts, currentSlugsByTable, m
|
|
|
1907
1907
|
}
|
|
1908
1908
|
|
|
1909
1909
|
// src/render/engine.ts
|
|
1910
|
+
var NOOP_RENDER = () => "";
|
|
1910
1911
|
var RenderEngine = class {
|
|
1911
1912
|
_schema;
|
|
1912
1913
|
_adapter;
|
|
1913
1914
|
_getTaskContext;
|
|
1914
|
-
|
|
1915
|
+
/** When true, skip the read + write for spec-less (no-op render) tables. */
|
|
1916
|
+
_skipEmpty;
|
|
1917
|
+
constructor(schema, adapter, getTaskContext, options) {
|
|
1915
1918
|
this._schema = schema;
|
|
1916
1919
|
this._adapter = adapter;
|
|
1917
1920
|
this._getTaskContext = getTaskContext ?? (() => "");
|
|
1921
|
+
this._skipEmpty = options?.skipEmpty ?? false;
|
|
1918
1922
|
}
|
|
1919
1923
|
async render(outputDir) {
|
|
1920
1924
|
const start = Date.now();
|
|
1921
1925
|
const filesWritten = [];
|
|
1922
1926
|
const counters = { skipped: 0 };
|
|
1923
1927
|
for (const [name, def] of this._schema.getTables()) {
|
|
1928
|
+
if (this._skipEmpty && def.render === NOOP_RENDER) continue;
|
|
1924
1929
|
let rows = await this._schema.queryTable(this._adapter, name);
|
|
1925
1930
|
if (def.relevanceFilter) {
|
|
1926
1931
|
const ctx = this._getTaskContext();
|
|
@@ -4262,7 +4267,9 @@ var Lattice = class _Lattice {
|
|
|
4262
4267
|
this._adapter = options.adapter ?? buildAdapter(dbPath, options);
|
|
4263
4268
|
this._schema = new SchemaManager();
|
|
4264
4269
|
this._sanitizer = new Sanitizer(options.security);
|
|
4265
|
-
this._render = new RenderEngine(this._schema, this._adapter, () => this._taskContext
|
|
4270
|
+
this._render = new RenderEngine(this._schema, this._adapter, () => this._taskContext, {
|
|
4271
|
+
skipEmpty: options.renderSkipsEmpty ?? false
|
|
4272
|
+
});
|
|
4266
4273
|
this._reverseSync = new ReverseSyncEngine(this._schema, this._adapter);
|
|
4267
4274
|
this._reverseSeedEngine = new ReverseSeedEngine(this._schema, this._adapter);
|
|
4268
4275
|
this._loop = new SyncLoop(this._render);
|
|
@@ -4383,7 +4390,7 @@ var Lattice = class _Lattice {
|
|
|
4383
4390
|
table,
|
|
4384
4391
|
this._schema,
|
|
4385
4392
|
this._adapter
|
|
4386
|
-
) :
|
|
4393
|
+
) : NOOP_RENDER,
|
|
4387
4394
|
outputFile: def.outputFile ?? `.schema-only/${table}.md`,
|
|
4388
4395
|
...renderTemplateName ? { _renderTemplateName: renderTemplateName } : {}
|
|
4389
4396
|
};
|
package/package.json
CHANGED