@bitcobblers/wod-wiki-storage 0.51.2196 → 0.52.2198
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-UN56ET7P.mjs → chunk-7HPAY2MQ.mjs} +5 -4
- package/dist/chunk-7HPAY2MQ.mjs.map +1 -0
- package/dist/{chunk-7ICLFFYU.mjs → chunk-AK7366MO.mjs} +4 -2
- package/dist/chunk-AK7366MO.mjs.map +1 -0
- package/dist/{chunk-PJ7GRYOZ.mjs → chunk-SGZMJ4UK.mjs} +3 -3
- package/dist/{chunk-PJ7GRYOZ.mjs.map → chunk-SGZMJ4UK.mjs.map} +1 -1
- package/dist/{chunk-J6KVDPTL.mjs → chunk-SYGE26AO.mjs} +25 -6
- package/dist/chunk-SYGE26AO.mjs.map +1 -0
- package/dist/idb/index.cjs +23 -4
- package/dist/idb/index.cjs.map +1 -1
- package/dist/idb/index.d.cts +3 -3
- package/dist/idb/index.d.ts +3 -3
- package/dist/idb/index.mjs +3 -3
- package/dist/index.cjs +25 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +5 -5
- package/dist/{policy-BBwCBMtp.d.cts → policy-CIp-4Qhy.d.cts} +1 -1
- package/dist/{policy-C86TCPSM.d.ts → policy-HlkmPine.d.ts} +1 -1
- package/dist/sql/index.cjs +41 -10
- package/dist/sql/index.cjs.map +1 -1
- package/dist/sql/index.d.cts +3 -3
- package/dist/sql/index.d.ts +3 -3
- package/dist/sql/index.mjs +20 -9
- package/dist/sql/index.mjs.map +1 -1
- package/dist/{sync-BDu_Q__z.d.cts → sync-BNkMF5dK.d.cts} +1 -1
- package/dist/{sync-BQ0g8ctt.d.ts → sync-DyTQ8hIc.d.ts} +1 -1
- package/dist/{wire-BO8FM1LJ.d.ts → wire-DPD-vJPP.d.cts} +4 -2
- package/dist/{wire-BO8FM1LJ.d.cts → wire-DPD-vJPP.d.ts} +4 -2
- package/package.json +6 -6
- package/dist/chunk-7ICLFFYU.mjs.map +0 -1
- package/dist/chunk-J6KVDPTL.mjs.map +0 -1
- package/dist/chunk-UN56ET7P.mjs.map +0 -1
package/dist/idb/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IDBPDatabase, IDBPTransaction } from 'idb';
|
|
2
|
-
import { I as IStorage, S as StoreName, a as IReadOnlyStore, b as StoreType, c as IReadWriteStore, d as IStorageTransaction } from '../wire-
|
|
3
|
-
import { U as UserScopeContext } from '../policy-
|
|
4
|
-
import { S as SyncMutation, a as SyncEntry } from '../sync-
|
|
2
|
+
import { I as IStorage, S as StoreName, a as IReadOnlyStore, b as StoreType, c as IReadWriteStore, d as IStorageTransaction } from '../wire-DPD-vJPP.cjs';
|
|
3
|
+
import { U as UserScopeContext } from '../policy-CIp-4Qhy.cjs';
|
|
4
|
+
import { S as SyncMutation, a as SyncEntry } from '../sync-BNkMF5dK.cjs';
|
|
5
5
|
import { D as Database } from '../connection-DxuCLpRc.cjs';
|
|
6
6
|
import '@bitcobblers/wod-wiki-core';
|
|
7
7
|
import '@bitcobblers/wod-wiki-lang';
|
package/dist/idb/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IDBPDatabase, IDBPTransaction } from 'idb';
|
|
2
|
-
import { I as IStorage, S as StoreName, a as IReadOnlyStore, b as StoreType, c as IReadWriteStore, d as IStorageTransaction } from '../wire-
|
|
3
|
-
import { U as UserScopeContext } from '../policy-
|
|
4
|
-
import { S as SyncMutation, a as SyncEntry } from '../sync-
|
|
2
|
+
import { I as IStorage, S as StoreName, a as IReadOnlyStore, b as StoreType, c as IReadWriteStore, d as IStorageTransaction } from '../wire-DPD-vJPP.js';
|
|
3
|
+
import { U as UserScopeContext } from '../policy-HlkmPine.js';
|
|
4
|
+
import { S as SyncMutation, a as SyncEntry } from '../sync-DyTQ8hIc.js';
|
|
5
5
|
import { D as Database } from '../connection-DxuCLpRc.js';
|
|
6
6
|
import '@bitcobblers/wod-wiki-core';
|
|
7
7
|
import '@bitcobblers/wod-wiki-lang';
|
package/dist/idb/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { collectUserScopeContext, isUserOwnedRow, USER_DELETED_SEED_PREFIX } from '../chunk-
|
|
2
|
-
import { readLegacyRows, readRawSyncOps } from '../chunk-
|
|
3
|
-
import { STORE_DEFS, DB_VERSION, stampUserOwned, validateStoredPins, validateStorageRow, rowsEqual, USER_OWNED_STORES, keyFromValue, validateNoteWrite, validateSessionWrite } from '../chunk-
|
|
1
|
+
import { collectUserScopeContext, isUserOwnedRow, USER_DELETED_SEED_PREFIX } from '../chunk-AK7366MO.mjs';
|
|
2
|
+
import { readLegacyRows, readRawSyncOps } from '../chunk-7HPAY2MQ.mjs';
|
|
3
|
+
import { STORE_DEFS, DB_VERSION, stampUserOwned, validateStoredPins, validateStorageRow, rowsEqual, USER_OWNED_STORES, keyFromValue, validateNoteWrite, validateSessionWrite } from '../chunk-SYGE26AO.mjs';
|
|
4
4
|
import '../chunk-XRQKLSOT.mjs';
|
|
5
5
|
import { openDB } from 'idb';
|
|
6
6
|
import { parseDocumentSections, KNOWN_SECTION_WIDGETS, actionableSectionKind, matchDialectFence } from '@bitcobblers/wod-wiki-core';
|
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var wodWikiCore = require('@bitcobblers/wod-wiki-core');
|
|
4
4
|
|
|
5
5
|
// src/schema.ts
|
|
6
|
-
var DB_VERSION =
|
|
6
|
+
var DB_VERSION = 33;
|
|
7
7
|
var COLUMN_TYPES = {
|
|
8
8
|
notes: { date: "number", createdAt: "number" },
|
|
9
9
|
page: { createdAt: "number" },
|
|
@@ -51,6 +51,8 @@ var COLUMN_TYPES = {
|
|
|
51
51
|
},
|
|
52
52
|
block_efforts: { createdAt: "number", isStatic: "boolean" },
|
|
53
53
|
block_equipment: { createdAt: "number", isStatic: "boolean" },
|
|
54
|
+
notebook_links: { createdAt: "number" },
|
|
55
|
+
property_overrides: { updatedAt: "number" },
|
|
54
56
|
meta: {},
|
|
55
57
|
memberships: { createdAt: "number" }
|
|
56
58
|
};
|
|
@@ -167,6 +169,21 @@ var STORE_DEFS = [
|
|
|
167
169
|
{ name: "by-block", keyPath: ["blockContentId"] },
|
|
168
170
|
{ name: "by-user", keyPath: ["userId"] }
|
|
169
171
|
] },
|
|
172
|
+
// 13c. notebook_links (V33) — many-to-many Note & Session <-> Notebook links
|
|
173
|
+
{ name: "notebook_links", keyPath: ["id"], indexes: [
|
|
174
|
+
{ name: "by-notebook", keyPath: ["notebookId"] },
|
|
175
|
+
{ name: "by-note", keyPath: ["noteId"] },
|
|
176
|
+
{ name: "by-target", keyPath: ["targetKind", "targetId"] },
|
|
177
|
+
{ name: "by-notebook-target", keyPath: ["notebookId", "targetKind", "targetId"], unique: true },
|
|
178
|
+
{ name: "by-user", keyPath: ["userId"] }
|
|
179
|
+
] },
|
|
180
|
+
// 13d. property_overrides (V33) — Notebook-scoped Property Note overrides
|
|
181
|
+
{ name: "property_overrides", keyPath: ["id"], indexes: [
|
|
182
|
+
{ name: "by-notebook", keyPath: ["notebookId"] },
|
|
183
|
+
{ name: "by-kind-slug", keyPath: ["kind", "slug"] },
|
|
184
|
+
{ name: "by-owner-note", keyPath: ["ownerNoteId"] },
|
|
185
|
+
{ name: "by-user", keyPath: ["userId"] }
|
|
186
|
+
] },
|
|
170
187
|
// 14. meta
|
|
171
188
|
{ name: "meta", keyPath: ["key"], indexes: [] },
|
|
172
189
|
// 15. memberships (V25, system — survives wipe; truth lives in
|
|
@@ -193,7 +210,9 @@ var USER_OWNED_STORES = [
|
|
|
193
210
|
"block_index",
|
|
194
211
|
"block_efforts",
|
|
195
212
|
"equipment",
|
|
196
|
-
"block_equipment"
|
|
213
|
+
"block_equipment",
|
|
214
|
+
"notebook_links",
|
|
215
|
+
"property_overrides"
|
|
197
216
|
];
|
|
198
217
|
var STAMPABLE = Object.fromEntries(
|
|
199
218
|
USER_OWNED_STORES.map((s) => [s, true])
|
|
@@ -443,7 +462,7 @@ function validateStorageRow(store, value) {
|
|
|
443
462
|
const positive = (field) => typeof row[field] === "number" && Number.isSafeInteger(row[field]) && row[field] > 0;
|
|
444
463
|
const required = (field) => typeof row[field] === "string" && row[field].length > 0;
|
|
445
464
|
if (store === "notes") {
|
|
446
|
-
if (!required("id") || typeof row.title !== "string" || typeof row.rawContent !== "string" || !positive("sourceRevision") || typeof row.createdAt !== "number" || !Number.isFinite(row.createdAt) || "segments" in row || "segmentIds" in row || row.date !== void 0 && (typeof row.date !== "number" || !Number.isFinite(row.date)) || row.seedOrigin !== void 0 && row.seedOrigin !== "seed" && row.seedOrigin !== "user" || row.feedOrigin !== void 0 && row.feedOrigin !== "feed" && row.feedOrigin !== "user" || row.feedOrigin === "feed" && (row.seedOrigin === void 0 || typeof row.feedSourceId !== "string" || row.feedSourceId.length === 0) || row.feedOrigin === "user" && row.seedOrigin === "seed" || row.feedSourceId !== void 0 && row.feedOrigin !== "feed" || row.seedVersion !== void 0 && !(typeof row.seedVersion === "number" && Number.isSafeInteger(row.seedVersion) && row.seedVersion >= 0) || row.tags !== void 0 && (!Array.isArray(row.tags) || !row.tags.every((tag) => typeof tag === "string")) || ["type", "sourceId", "sourcePath", "notebookId", "seedChunkId", "feedSourceId"].some((field) => row[field] !== void 0 && typeof row[field] !== "string")) {
|
|
465
|
+
if (!required("id") || typeof row.title !== "string" || typeof row.rawContent !== "string" || !positive("sourceRevision") || typeof row.createdAt !== "number" || !Number.isFinite(row.createdAt) || "segments" in row || "segmentIds" in row || row.date !== void 0 && (typeof row.date !== "number" || !Number.isFinite(row.date)) || row.seedOrigin !== void 0 && row.seedOrigin !== "seed" && row.seedOrigin !== "user" || row.feedOrigin !== void 0 && row.feedOrigin !== "feed" && row.feedOrigin !== "user" || row.feedOrigin === "feed" && (row.seedOrigin === void 0 || typeof row.feedSourceId !== "string" || row.feedSourceId.length === 0) || row.feedOrigin === "user" && row.seedOrigin === "seed" || row.feedSourceId !== void 0 && row.feedOrigin !== "feed" || row.seedVersion !== void 0 && !(typeof row.seedVersion === "number" && Number.isSafeInteger(row.seedVersion) && row.seedVersion >= 0) || row.tags !== void 0 && (!Array.isArray(row.tags) || !row.tags.every((tag) => typeof tag === "string")) || row.public !== void 0 && typeof row.public !== "boolean" || row.notebookIds !== void 0 && (!Array.isArray(row.notebookIds) || !row.notebookIds.every((nb) => typeof nb === "string")) || row.provenance !== void 0 && (typeof row.provenance !== "object" || row.provenance === null || Array.isArray(row.provenance) || typeof row.provenance.sourceNoteId !== "string") || ["type", "sourceId", "sourcePath", "notebookId", "seedChunkId", "feedSourceId"].some((field) => row[field] !== void 0 && typeof row[field] !== "string")) {
|
|
447
466
|
throw new StorageError(400, "invalid whole Note", "invalid_note_blocks");
|
|
448
467
|
}
|
|
449
468
|
try {
|
|
@@ -468,7 +487,7 @@ function validateStorageRow(store, value) {
|
|
|
468
487
|
throw new StorageError(400, error instanceof Error ? error.message : "invalid revision source", "invalid_note_blocks");
|
|
469
488
|
}
|
|
470
489
|
} else if (store === "sessions") {
|
|
471
|
-
if (!required("noteId") || !required("blockId") || !positive("blockVersion") || ["segmentId", "segmentVersion", "version", "rawContent", "script", "serializedScript", "source", "data", "logs"].some((field) => field in row)) {
|
|
490
|
+
if (!required("noteId") || !required("blockId") || !positive("blockVersion") || row.public !== void 0 && typeof row.public !== "boolean" || row.notebookIds !== void 0 && (!Array.isArray(row.notebookIds) || !row.notebookIds.every((nb) => typeof nb === "string")) || ["segmentId", "segmentVersion", "version", "rawContent", "script", "serializedScript", "source", "data", "logs"].some((field) => field in row)) {
|
|
472
491
|
throw new StorageError(400, "Session requires immutable block pin", "invalid_session_pin");
|
|
473
492
|
}
|
|
474
493
|
} else if (!required("noteId") || !required("blockId") || !positive("blockVersion") || !positive("sourceRevision") || row.id !== `${row.noteId}:${row.blockId}` || !Number.isSafeInteger(row.from) || !Number.isSafeInteger(row.to) || "segmentId" in row || "segmentVersion" in row || !["wod", "query", "widget", "embed"].includes(String(row.dataType)) || typeof row.rawContent !== "string" || typeof row.noteTitle !== "string" || typeof row.from !== "number" || typeof row.to !== "number" || row.from < 0 || row.to <= row.from) {
|
|
@@ -781,6 +800,8 @@ function isUserOwnedRow(store, row, ctx) {
|
|
|
781
800
|
case "efforts":
|
|
782
801
|
case "equipment":
|
|
783
802
|
return !("registrySource" in row && row.registrySource === "bundled");
|
|
803
|
+
case "property_overrides":
|
|
804
|
+
return !("seedOrigin" in row && row.seedOrigin === "seed");
|
|
784
805
|
case "meta":
|
|
785
806
|
return !isSeedMetaKey("key" in row ? row.key : void 0);
|
|
786
807
|
default:
|