@north-light/cli 0.3.756 → 0.3.757

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.
@@ -1,6 +0,0 @@
1
- import type { DatabaseSync } from 'node:sqlite';
2
- /** canvas.db chain step: converts the node-only `legacy_edges` rows into graph rows, then drops it.
3
- * `spawned_by(child, parent)` → `edges(acted-on, parent → child)`.
4
- * `subscribes_to(watcher, object)` → an in-tree watch with one `>` subscription, started `spawn`
5
- * when the object was spawned by the watcher, else `ask`; a passive row listens at next-turn. */
6
- export declare function convertLegacyEdges(db: DatabaseSync): void;
@@ -1,18 +0,0 @@
1
- var n=Object.defineProperty;var s=(e,t)=>n(e,"name",{value:t,configurable:!0});function _(e){if(!e.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'legacy_edges'").get())return;const t=s(d=>e.prepare(d).get().n,"count"),c=t("SELECT COUNT(*) AS n FROM legacy_edges WHERE type = 'spawned_by'"),r=t("SELECT COUNT(*) AS n FROM legacy_edges WHERE type = 'subscribes_to'"),o=t("SELECT COUNT(*) AS n FROM legacy_edges WHERE type NOT IN ('spawned_by', 'subscribes_to')");if(o>0)throw new Error(`convertLegacyEdges: ${o} legacy edge(s) of an unknown type`);const a=e.prepare(`INSERT INTO edges (type, src, dst, written_as, created_at)
2
- SELECT 'acted-on', p.rowid, c.rowid, NULL, e.created
3
- FROM legacy_edges e JOIN objects c ON c.id = e.from_id JOIN objects p ON p.id = e.to_id
4
- WHERE e.type = 'spawned_by'
5
- ON CONFLICT (type, src, dst) DO NOTHING`).run().changes,E=e.prepare(`INSERT INTO watches (watcher, object, in_tree, read_heads_key, created_at)
6
- SELECT w.rowid, o.rowid, 1, NULL, e.created
7
- FROM legacy_edges e JOIN objects w ON w.id = e.from_id JOIN objects o ON o.id = e.to_id
8
- WHERE e.type = 'subscribes_to'
9
- ON CONFLICT (watcher, object) DO UPDATE SET in_tree = 1`).run().changes;if(e.exec(`INSERT INTO watch_subscriptions (watch, pattern, filter_json, config_json, started_by, ends_on, created_at)
10
- SELECT wt.rowid, '>', NULL,
11
- CASE WHEN e.active = 1 THEN NULL ELSE '{"3":"next-turn"}' END,
12
- CASE WHEN EXISTS (SELECT 1 FROM legacy_edges s
13
- WHERE s.type = 'spawned_by' AND s.from_id = e.to_id AND s.to_id = e.from_id)
14
- THEN 'spawn' ELSE 'ask' END,
15
- NULL, e.created
16
- FROM legacy_edges e JOIN objects w ON w.id = e.from_id JOIN objects o ON o.id = e.to_id
17
- JOIN watches wt ON wt.watcher = w.rowid AND wt.object = o.rowid
18
- WHERE e.type = 'subscribes_to'`),a!==c||E!==r)throw new Error(`convertLegacyEdges: converted ${a}/${c} spawned_by and ${E}/${r} subscribes_to rows`);e.exec("DROP TABLE legacy_edges")}s(_,"convertLegacyEdges");export{_ as convertLegacyEdges};