@bitcobblers/wod-wiki-storage 0.37.2137 → 0.37.2140
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/{chunk-Y3CYPF2E.mjs → chunk-7BDO6DD4.mjs} +20 -4
- package/dist/chunk-7BDO6DD4.mjs.map +1 -0
- package/dist/index.cjs +18 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/sql/index.cjs +31 -4
- package/dist/sql/index.cjs.map +1 -1
- package/dist/sql/index.d.cts +1 -1
- package/dist/sql/index.d.ts +1 -1
- package/dist/sql/index.mjs +14 -3
- package/dist/sql/index.mjs.map +1 -1
- package/dist/{wire-CiFcjo6_.d.cts → wire-CKJDK_Nq.d.cts} +5 -3
- package/dist/{wire-CiFcjo6_.d.ts → wire-CKJDK_Nq.d.ts} +5 -3
- package/package.json +6 -6
- package/dist/chunk-Y3CYPF2E.mjs.map +0 -1
package/dist/sql/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as SqlConnection, D as Database } from '../connection-DxuCLpRc.cjs';
|
|
2
2
|
export { L as LibsqlClient, a as SqlRow, b as SqlStatement, c as SqlValue, l as libsqlDatabase } from '../connection-DxuCLpRc.cjs';
|
|
3
|
-
import { a as StoreDef, R as RangeDTO, K as KeyDTO, e as DomainQueryResult, T as TxOp, I as IStorage, S as StoreName, b as IReadOnlyStore, c as StoreType, d as IReadWriteStore, D as DomainQuery, f as IStorageTransaction } from '../wire-
|
|
3
|
+
import { a as StoreDef, R as RangeDTO, K as KeyDTO, e as DomainQueryResult, T as TxOp, I as IStorage, S as StoreName, b as IReadOnlyStore, c as StoreType, d as IReadWriteStore, D as DomainQuery, f as IStorageTransaction } from '../wire-CKJDK_Nq.cjs';
|
|
4
4
|
import '@libsql/client';
|
|
5
5
|
import '@bitcobblers/wod-wiki-core';
|
|
6
6
|
import '@bitcobblers/wod-wiki-lang';
|
package/dist/sql/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as SqlConnection, D as Database } from '../connection-DxuCLpRc.js';
|
|
2
2
|
export { L as LibsqlClient, a as SqlRow, b as SqlStatement, c as SqlValue, l as libsqlDatabase } from '../connection-DxuCLpRc.js';
|
|
3
|
-
import { a as StoreDef, R as RangeDTO, K as KeyDTO, e as DomainQueryResult, T as TxOp, I as IStorage, S as StoreName, b as IReadOnlyStore, c as StoreType, d as IReadWriteStore, D as DomainQuery, f as IStorageTransaction } from '../wire-
|
|
3
|
+
import { a as StoreDef, R as RangeDTO, K as KeyDTO, e as DomainQueryResult, T as TxOp, I as IStorage, S as StoreName, b as IReadOnlyStore, c as StoreType, d as IReadWriteStore, D as DomainQuery, f as IStorageTransaction } from '../wire-CKJDK_Nq.js';
|
|
4
4
|
import '@libsql/client';
|
|
5
5
|
import '@bitcobblers/wod-wiki-core';
|
|
6
6
|
import '@bitcobblers/wod-wiki-lang';
|
package/dist/sql/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { STORE_DEFS, extractKeyPart, validateStorageRow, isRange, DB_VERSION, rowsEqual, validateStoredPins, DOMAIN_PROJECTION_VERSION, bufferToOps, stampUserOwned, bufferedGet, overlayRows, rangeFromIDB, isDirty, keyFromValue, bufferSlot, COLUMN_TYPES, keyInRange, compareKeys } from '../chunk-
|
|
1
|
+
import { STORE_DEFS, extractKeyPart, validateStorageRow, isRange, DB_VERSION, rowsEqual, validateStoredPins, DOMAIN_PROJECTION_VERSION, bufferToOps, stampUserOwned, bufferedGet, overlayRows, rangeFromIDB, isDirty, keyFromValue, bufferSlot, COLUMN_TYPES, keyInRange, compareKeys } from '../chunk-7BDO6DD4.mjs';
|
|
2
2
|
import { libsqlDatabase } from '../chunk-6ZTAWTAP.mjs';
|
|
3
3
|
export { libsqlDatabase } from '../chunk-6ZTAWTAP.mjs';
|
|
4
4
|
import { StorageError } from '../chunk-XRQKLSOT.mjs';
|
|
@@ -63,6 +63,16 @@ function decodeRowJson(text2, binaryField) {
|
|
|
63
63
|
// src/sql/store.ts
|
|
64
64
|
var SCHEMA_TABLE = "_wodwiki_schema";
|
|
65
65
|
var SCHEMA_KEY = "schema";
|
|
66
|
+
var ADDED_STORES_BY_VERSION = {
|
|
67
|
+
31: ["equipment", "block_equipment"]
|
|
68
|
+
};
|
|
69
|
+
function additiveStoresSince(stored) {
|
|
70
|
+
const added = /* @__PURE__ */ new Set();
|
|
71
|
+
for (const [version, names] of Object.entries(ADDED_STORES_BY_VERSION)) {
|
|
72
|
+
if (Number(version) > stored) for (const name of names) added.add(name);
|
|
73
|
+
}
|
|
74
|
+
return added;
|
|
75
|
+
}
|
|
66
76
|
var BINARY_FIELD = { attachments: "data" };
|
|
67
77
|
var binaryFieldOf = (def) => BINARY_FIELD[def.name];
|
|
68
78
|
function storeDefinition(name) {
|
|
@@ -544,7 +554,7 @@ async function initializeStore(db) {
|
|
|
544
554
|
await tx.exec(
|
|
545
555
|
`CREATE TABLE IF NOT EXISTS "${SCHEMA_TABLE}" ("key" TEXT PRIMARY KEY, "value" TEXT NOT NULL)`
|
|
546
556
|
);
|
|
547
|
-
const ignored = (name) => name.startsWith("_wodwiki_") || name.startsWith("sqlite_");
|
|
557
|
+
const ignored = (name) => name.startsWith("_wodwiki_") || name.startsWith("sqlite_") || name === "domain_note" || name === "query_block";
|
|
548
558
|
const storeTables = new Set(STORE_DEFS.map((d) => d.name));
|
|
549
559
|
for (const def of STORE_DEFS) {
|
|
550
560
|
const multi = def.indexes.find((i) => i.multiEntry);
|
|
@@ -571,7 +581,8 @@ async function initializeStore(db) {
|
|
|
571
581
|
if (stored < DB_VERSION) {
|
|
572
582
|
const missing = [...storeTables].filter((name) => !tableNames.has(name));
|
|
573
583
|
const unexpected = [...tableNames].filter((name) => name !== SCHEMA_TABLE && !storeTables.has(name));
|
|
574
|
-
|
|
584
|
+
const additive = additiveStoresSince(stored);
|
|
585
|
+
if (stored < 30 || unexpected.length > 0 || missing.some((name) => !additive.has(name))) {
|
|
575
586
|
throw new StorageError(
|
|
576
587
|
500,
|
|
577
588
|
`database schema v${stored} is incompatible with v${DB_VERSION} (missing tables: ${missing.join(", ") || "none"}; unrecognized tables: ${unexpected.join(", ") || "none"}); recreation required using an explicitly disposable database`,
|