@starkeep/storage-sqlite 0.6.2 → 0.7.0
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/index.cjs +15 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -27,7 +27,8 @@ declare const compiler: Kysely<DB>;
|
|
|
27
27
|
*
|
|
28
28
|
* No migration system: this is a fresh-start schema. The user removes
|
|
29
29
|
* ~/.starkeep/data.db (or the local-data-server's STARKEEP_DIR is fresh)
|
|
30
|
-
* before this code runs.
|
|
30
|
+
* before this code runs. One temporary guard is the exception: it adds
|
|
31
|
+
* `shared_app_registry.source_dir` to a registry created before the column.
|
|
31
32
|
*/
|
|
32
33
|
/**
|
|
33
34
|
* Connection settings the query grammar's portability depends on.
|
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,8 @@ declare const compiler: Kysely<DB>;
|
|
|
27
27
|
*
|
|
28
28
|
* No migration system: this is a fresh-start schema. The user removes
|
|
29
29
|
* ~/.starkeep/data.db (or the local-data-server's STARKEEP_DIR is fresh)
|
|
30
|
-
* before this code runs.
|
|
30
|
+
* before this code runs. One temporary guard is the exception: it adds
|
|
31
|
+
* `shared_app_registry.source_dir` to a registry created before the column.
|
|
31
32
|
*/
|
|
32
33
|
/**
|
|
33
34
|
* Connection settings the query grammar's portability depends on.
|
package/dist/index.js
CHANGED
|
@@ -225,8 +225,14 @@ function applyLocalSchemaDdl(db) {
|
|
|
225
225
|
compiler.schema.createTable("shared_app_label_keys").ifNotExists().addColumn("app_id", "text", (c) => c.notNull()).addColumn("key", "text", (c) => c.notNull()).addColumn("description", "text").addColumn("created_at", "text", (c) => c.notNull().defaultTo(sql`(datetime('now'))`)).addPrimaryKeyConstraint("pk_shared_app_label_keys", ["app_id", "key"]).compile().sql
|
|
226
226
|
);
|
|
227
227
|
db.exec(
|
|
228
|
-
compiler.schema.createTable("shared_app_registry").ifNotExists().addColumn("app_id", "text", (c) => c.primaryKey()).addColumn("name", "text", (c) => c.notNull()).addColumn("version", "text", (c) => c.notNull()).addColumn("tier", "text", (c) => c.notNull().defaultTo("app")).addColumn("manifest", "text", (c) => c.notNull()).addColumn("status", "text", (c) => c.notNull().defaultTo("installing")).addColumn("hmac_secret", "text", (c) => c.notNull()).addColumn("installed_at", "text", (c) => c.notNull().defaultTo(sql`(datetime('now'))`)).addColumn("updated_at", "text", (c) => c.notNull().defaultTo(sql`(datetime('now'))`)).compile().sql
|
|
228
|
+
compiler.schema.createTable("shared_app_registry").ifNotExists().addColumn("app_id", "text", (c) => c.primaryKey()).addColumn("name", "text", (c) => c.notNull()).addColumn("version", "text", (c) => c.notNull()).addColumn("tier", "text", (c) => c.notNull().defaultTo("app")).addColumn("manifest", "text", (c) => c.notNull()).addColumn("status", "text", (c) => c.notNull().defaultTo("installing")).addColumn("hmac_secret", "text", (c) => c.notNull()).addColumn("installed_at", "text", (c) => c.notNull().defaultTo(sql`(datetime('now'))`)).addColumn("updated_at", "text", (c) => c.notNull().defaultTo(sql`(datetime('now'))`)).addColumn("source_dir", "text").compile().sql
|
|
229
229
|
);
|
|
230
|
+
const registryColumns = db.prepare("SELECT name FROM pragma_table_info('shared_app_registry')").all();
|
|
231
|
+
if (!registryColumns.some((c) => c.name === "source_dir")) {
|
|
232
|
+
db.exec(
|
|
233
|
+
compiler.schema.alterTable("shared_app_registry").addColumn("source_dir", "text").compile().sql
|
|
234
|
+
);
|
|
235
|
+
}
|
|
230
236
|
db.exec(
|
|
231
237
|
compiler.schema.createTable("shared_app_install_steps").ifNotExists().addColumn("app_id", "text", (c) => c.notNull()).addColumn(
|
|
232
238
|
"operation",
|
|
@@ -808,6 +814,7 @@ var SqliteAppSyncableNamespaceStore = class {
|
|
|
808
814
|
// src/app-syncable/apply.ts
|
|
809
815
|
import { sql as sql2 } from "kysely";
|
|
810
816
|
import { serializeHLC as serializeHLC3, deserializeHLC as deserializeHLC3 } from "@starkeep/protocol-primitives";
|
|
817
|
+
import { requireWellFormedFileIndexRow } from "@starkeep/shared-space-api";
|
|
811
818
|
import {
|
|
812
819
|
buildAppAggregateQuery as buildAppAggregateQuery2,
|
|
813
820
|
buildAppRowQuery as buildAppRowQuery2,
|
|
@@ -848,6 +855,7 @@ var SqliteAppSyncableApplier = class {
|
|
|
848
855
|
`SqliteAppSyncableApplier: table "${entry.table}" not declared for app "${entry.appId}"`
|
|
849
856
|
);
|
|
850
857
|
}
|
|
858
|
+
requireWellFormedFileIndexRow(entry);
|
|
851
859
|
const fullName = appSyncableTableName(entry.appId, entry.table);
|
|
852
860
|
const { pkColumns } = tableInfo;
|
|
853
861
|
if (entry.op === "insert") {
|