@rolexjs/local-platform 1.5.0 → 1.6.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.d.ts +9 -5
- package/dist/index.js +80 -91
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
- package/drizzle/0000_spooky_amazoness.sql +0 -44
- package/drizzle/0001_slimy_joystick.sql +0 -1
- package/drizzle/meta/0000_snapshot.json +0 -275
- package/drizzle/meta/0001_snapshot.json +0 -282
- package/drizzle/meta/_journal.json +0 -20
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Platform, RoleXRepository,
|
|
1
|
+
import { Platform, RoleXRepository, PrototypeRegistry, ContextData } from '@rolexjs/core';
|
|
2
2
|
import { State, Runtime } from '@rolexjs/system';
|
|
3
3
|
import { CommonXDatabase } from '@deepracticex/drizzle';
|
|
4
4
|
|
|
@@ -14,6 +14,10 @@ import { CommonXDatabase } from '@deepracticex/drizzle';
|
|
|
14
14
|
interface LocalPlatformConfig {
|
|
15
15
|
/** Directory for persistent storage. Defaults to ~/.deepractice/rolex. Set to null for in-memory only. */
|
|
16
16
|
dataDir?: string | null;
|
|
17
|
+
/** Directory for ResourceX storage. Defaults to ~/.deepractice/resourcex. Set to null to disable. */
|
|
18
|
+
resourceDir?: string | null;
|
|
19
|
+
/** Prototype sources to settle on genesis. */
|
|
20
|
+
bootstrap?: string[];
|
|
17
21
|
}
|
|
18
22
|
/** Create a local Platform. Persistent by default ($DEEPRACTICE_HOME/rolex), in-memory if dataDir is null. */
|
|
19
23
|
declare function localPlatform(config?: LocalPlatformConfig): Platform;
|
|
@@ -41,7 +45,7 @@ declare function localPlatform(config?: LocalPlatformConfig): Platform;
|
|
|
41
45
|
interface ManifestNode {
|
|
42
46
|
readonly type: string;
|
|
43
47
|
readonly ref?: string;
|
|
44
|
-
readonly
|
|
48
|
+
readonly tag?: string;
|
|
45
49
|
readonly children?: Record<string, ManifestNode>;
|
|
46
50
|
readonly links?: Record<string, string[]>;
|
|
47
51
|
}
|
|
@@ -75,15 +79,15 @@ declare function filesToState(manifest: Manifest, fileContents: Record<string, s
|
|
|
75
79
|
/**
|
|
76
80
|
* SqliteRepository — RoleXRepository backed by SQLite via Drizzle.
|
|
77
81
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
82
|
+
* Single database, four tables: nodes, links, prototypes, contexts.
|
|
83
|
+
* All state in one place — swap the db connection to go from local to cloud.
|
|
80
84
|
*/
|
|
81
85
|
|
|
82
86
|
type DB = CommonXDatabase;
|
|
83
87
|
declare class SqliteRepository implements RoleXRepository {
|
|
84
88
|
private db;
|
|
85
89
|
readonly runtime: Runtime;
|
|
86
|
-
readonly prototype:
|
|
90
|
+
readonly prototype: PrototypeRegistry;
|
|
87
91
|
constructor(db: DB);
|
|
88
92
|
saveContext(roleId: string, data: ContextData): Promise<void>;
|
|
89
93
|
loadContext(roleId: string): Promise<ContextData | null>;
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// src/LocalPlatform.ts
|
|
2
2
|
import { mkdirSync } from "fs";
|
|
3
3
|
import { homedir } from "os";
|
|
4
|
-
import { join
|
|
4
|
+
import { join } from "path";
|
|
5
5
|
import { drizzle } from "@deepracticex/drizzle";
|
|
6
6
|
import { openDatabase } from "@deepracticex/sqlite";
|
|
7
|
+
import { NodeProvider as IssueXNodeProvider } from "@issuexjs/node";
|
|
8
|
+
import { NodeProvider } from "@resourcexjs/node-provider";
|
|
7
9
|
|
|
8
10
|
// src/SqliteRepository.ts
|
|
9
|
-
import { join } from "path";
|
|
10
|
-
import { migrate } from "@deepracticex/drizzle";
|
|
11
11
|
import { sql } from "drizzle-orm";
|
|
12
12
|
|
|
13
13
|
// src/sqliteRuntime.ts
|
|
14
14
|
import { and, eq, isNull } from "drizzle-orm";
|
|
15
15
|
|
|
16
16
|
// src/schema.ts
|
|
17
|
-
import { index,
|
|
17
|
+
import { index, primaryKey, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
|
18
18
|
var nodes = sqliteTable(
|
|
19
19
|
"nodes",
|
|
20
20
|
{
|
|
@@ -47,26 +47,6 @@ var links = sqliteTable(
|
|
|
47
47
|
index("idx_links_to").on(table.toRef)
|
|
48
48
|
]
|
|
49
49
|
);
|
|
50
|
-
var prototypes = sqliteTable("prototypes", {
|
|
51
|
-
id: text("id").primaryKey(),
|
|
52
|
-
source: text("source").notNull()
|
|
53
|
-
});
|
|
54
|
-
var contexts = sqliteTable("contexts", {
|
|
55
|
-
roleId: text("role_id").primaryKey(),
|
|
56
|
-
focusedGoalId: text("focused_goal_id"),
|
|
57
|
-
focusedPlanId: text("focused_plan_id")
|
|
58
|
-
});
|
|
59
|
-
var prototypeMigrations = sqliteTable(
|
|
60
|
-
"prototype_migrations",
|
|
61
|
-
{
|
|
62
|
-
prototypeId: text("prototype_id").notNull(),
|
|
63
|
-
migrationId: text("migration_id").notNull(),
|
|
64
|
-
version: integer("version").notNull(),
|
|
65
|
-
checksum: text("checksum").notNull(),
|
|
66
|
-
executedAt: text("executed_at").notNull()
|
|
67
|
-
},
|
|
68
|
-
(table) => [primaryKey({ columns: [table.prototypeId, table.migrationId] })]
|
|
69
|
-
);
|
|
70
50
|
|
|
71
51
|
// src/sqliteRuntime.ts
|
|
72
52
|
function nextRef(db) {
|
|
@@ -86,16 +66,7 @@ function toStructure(row) {
|
|
|
86
66
|
parent: null,
|
|
87
67
|
// Runtime doesn't use parent as Structure; tree is via parentRef
|
|
88
68
|
...row.information ? { information: row.information } : {},
|
|
89
|
-
...row.tag ? {
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
function projectLinked(db, ref) {
|
|
93
|
-
const row = db.select().from(nodes).where(eq(nodes.ref, ref)).get();
|
|
94
|
-
if (!row) throw new Error(`Node not found: ${ref}`);
|
|
95
|
-
const children = db.select().from(nodes).where(eq(nodes.parentRef, ref)).all();
|
|
96
|
-
return {
|
|
97
|
-
...toStructure(row),
|
|
98
|
-
children: children.map((c) => projectLinked(db, c.ref))
|
|
69
|
+
...row.tag ? { tag: row.tag } : {}
|
|
99
70
|
};
|
|
100
71
|
}
|
|
101
72
|
function projectNode(db, ref) {
|
|
@@ -114,6 +85,15 @@ function projectNode(db, ref) {
|
|
|
114
85
|
} : {}
|
|
115
86
|
};
|
|
116
87
|
}
|
|
88
|
+
function projectLinked(db, ref) {
|
|
89
|
+
const row = db.select().from(nodes).where(eq(nodes.ref, ref)).get();
|
|
90
|
+
if (!row) throw new Error(`Node not found: ${ref}`);
|
|
91
|
+
const children = db.select().from(nodes).where(eq(nodes.parentRef, ref)).all();
|
|
92
|
+
return {
|
|
93
|
+
...toStructure(row),
|
|
94
|
+
children: children.map((c) => projectLinked(db, c.ref))
|
|
95
|
+
};
|
|
96
|
+
}
|
|
117
97
|
function removeSubtree(db, ref) {
|
|
118
98
|
const children = db.select({ ref: nodes.ref }).from(nodes).where(eq(nodes.parentRef, ref)).all();
|
|
119
99
|
for (const child of children) {
|
|
@@ -202,23 +182,11 @@ function createSqliteRuntime(db) {
|
|
|
202
182
|
and(eq(links.fromRef, to.ref), eq(links.toRef, from.ref), eq(links.relation, reverseName))
|
|
203
183
|
).run();
|
|
204
184
|
},
|
|
205
|
-
async
|
|
185
|
+
async tag(node, tagValue) {
|
|
206
186
|
if (!node.ref) throw new Error("Node has no ref");
|
|
207
187
|
const row = db.select().from(nodes).where(eq(nodes.ref, node.ref)).get();
|
|
208
188
|
if (!row) throw new Error(`Node not found: ${node.ref}`);
|
|
209
|
-
|
|
210
|
-
if (!current.includes(tag)) {
|
|
211
|
-
current.push(tag);
|
|
212
|
-
db.update(nodes).set({ tag: JSON.stringify(current) }).where(eq(nodes.ref, node.ref)).run();
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
async removeTag(node, tag) {
|
|
216
|
-
if (!node.ref) throw new Error("Node has no ref");
|
|
217
|
-
const row = db.select().from(nodes).where(eq(nodes.ref, node.ref)).get();
|
|
218
|
-
if (!row) throw new Error(`Node not found: ${node.ref}`);
|
|
219
|
-
const current = row.tag ? JSON.parse(row.tag) : [];
|
|
220
|
-
const filtered = current.filter((t) => t !== tag);
|
|
221
|
-
db.update(nodes).set({ tag: filtered.length > 0 ? JSON.stringify(filtered) : null }).where(eq(nodes.ref, node.ref)).run();
|
|
189
|
+
db.update(nodes).set({ tag: tagValue }).where(eq(nodes.ref, node.ref)).run();
|
|
222
190
|
},
|
|
223
191
|
async project(node) {
|
|
224
192
|
if (!node.ref) throw new Error(`Node has no ref`);
|
|
@@ -232,14 +200,47 @@ function createSqliteRuntime(db) {
|
|
|
232
200
|
}
|
|
233
201
|
|
|
234
202
|
// src/SqliteRepository.ts
|
|
203
|
+
var DDL = [
|
|
204
|
+
sql`CREATE TABLE IF NOT EXISTS nodes (
|
|
205
|
+
ref TEXT PRIMARY KEY,
|
|
206
|
+
id TEXT,
|
|
207
|
+
alias TEXT,
|
|
208
|
+
name TEXT NOT NULL,
|
|
209
|
+
description TEXT DEFAULT '',
|
|
210
|
+
parent_ref TEXT REFERENCES nodes(ref),
|
|
211
|
+
information TEXT,
|
|
212
|
+
tag TEXT
|
|
213
|
+
)`,
|
|
214
|
+
sql`CREATE TABLE IF NOT EXISTS links (
|
|
215
|
+
from_ref TEXT NOT NULL REFERENCES nodes(ref),
|
|
216
|
+
to_ref TEXT NOT NULL REFERENCES nodes(ref),
|
|
217
|
+
relation TEXT NOT NULL,
|
|
218
|
+
PRIMARY KEY (from_ref, to_ref, relation)
|
|
219
|
+
)`,
|
|
220
|
+
sql`CREATE TABLE IF NOT EXISTS prototypes (
|
|
221
|
+
id TEXT PRIMARY KEY,
|
|
222
|
+
source TEXT NOT NULL
|
|
223
|
+
)`,
|
|
224
|
+
sql`CREATE TABLE IF NOT EXISTS contexts (
|
|
225
|
+
role_id TEXT PRIMARY KEY,
|
|
226
|
+
focused_goal_id TEXT,
|
|
227
|
+
focused_plan_id TEXT
|
|
228
|
+
)`,
|
|
229
|
+
// Indexes
|
|
230
|
+
sql`CREATE INDEX IF NOT EXISTS idx_nodes_id ON nodes(id)`,
|
|
231
|
+
sql`CREATE INDEX IF NOT EXISTS idx_nodes_name ON nodes(name)`,
|
|
232
|
+
sql`CREATE INDEX IF NOT EXISTS idx_nodes_parent_ref ON nodes(parent_ref)`,
|
|
233
|
+
sql`CREATE INDEX IF NOT EXISTS idx_links_from ON links(from_ref)`,
|
|
234
|
+
sql`CREATE INDEX IF NOT EXISTS idx_links_to ON links(to_ref)`
|
|
235
|
+
];
|
|
235
236
|
var SqliteRepository = class {
|
|
236
237
|
constructor(db) {
|
|
237
238
|
this.db = db;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
239
|
+
for (const stmt of DDL) {
|
|
240
|
+
db.run(stmt);
|
|
241
|
+
}
|
|
241
242
|
this.runtime = createSqliteRuntime(db);
|
|
242
|
-
this.prototype =
|
|
243
|
+
this.prototype = createPrototypeRegistry(db);
|
|
243
244
|
}
|
|
244
245
|
runtime;
|
|
245
246
|
prototype;
|
|
@@ -260,77 +261,65 @@ var SqliteRepository = class {
|
|
|
260
261
|
};
|
|
261
262
|
}
|
|
262
263
|
};
|
|
263
|
-
function
|
|
264
|
+
function createPrototypeRegistry(db) {
|
|
264
265
|
return {
|
|
265
|
-
|
|
266
|
+
settle(id, source) {
|
|
266
267
|
db.run(sql`INSERT OR REPLACE INTO prototypes (id, source) VALUES (${id}, ${source})`);
|
|
267
268
|
},
|
|
268
|
-
|
|
269
|
+
evict(id) {
|
|
269
270
|
db.run(sql`DELETE FROM prototypes WHERE id = ${id}`);
|
|
270
|
-
db.run(sql`DELETE FROM prototype_migrations WHERE prototype_id = ${id}`);
|
|
271
271
|
},
|
|
272
|
-
|
|
272
|
+
list() {
|
|
273
273
|
const rows = db.all(sql`SELECT id, source FROM prototypes`);
|
|
274
274
|
const result = {};
|
|
275
275
|
for (const row of rows) {
|
|
276
276
|
result[row.id] = row.source;
|
|
277
277
|
}
|
|
278
278
|
return result;
|
|
279
|
-
},
|
|
280
|
-
async recordMigration(prototypeId, migrationId, version, checksum) {
|
|
281
|
-
const executedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
282
|
-
db.run(
|
|
283
|
-
sql`INSERT OR REPLACE INTO prototype_migrations (prototype_id, migration_id, version, checksum, executed_at)
|
|
284
|
-
VALUES (${prototypeId}, ${migrationId}, ${version}, ${checksum}, ${executedAt})`
|
|
285
|
-
);
|
|
286
|
-
},
|
|
287
|
-
async getMigrationHistory(prototypeId) {
|
|
288
|
-
return db.all(
|
|
289
|
-
sql`SELECT prototype_id, migration_id, version, checksum, executed_at
|
|
290
|
-
FROM prototype_migrations
|
|
291
|
-
WHERE prototype_id = ${prototypeId}
|
|
292
|
-
ORDER BY version`
|
|
293
|
-
).map((row) => ({
|
|
294
|
-
prototypeId: row.prototype_id,
|
|
295
|
-
migrationId: row.migration_id,
|
|
296
|
-
version: row.version,
|
|
297
|
-
checksum: row.checksum,
|
|
298
|
-
executedAt: row.executed_at
|
|
299
|
-
}));
|
|
300
|
-
},
|
|
301
|
-
async hasMigration(prototypeId, migrationId) {
|
|
302
|
-
const rows = db.all(
|
|
303
|
-
sql`SELECT COUNT(*) as cnt FROM prototype_migrations
|
|
304
|
-
WHERE prototype_id = ${prototypeId} AND migration_id = ${migrationId}`
|
|
305
|
-
);
|
|
306
|
-
return rows.length > 0 && rows[0].cnt > 0;
|
|
307
279
|
}
|
|
308
280
|
};
|
|
309
281
|
}
|
|
310
282
|
|
|
311
283
|
// src/LocalPlatform.ts
|
|
312
284
|
function deepracticeHome() {
|
|
313
|
-
return process.env.DEEPRACTICE_HOME ??
|
|
285
|
+
return process.env.DEEPRACTICE_HOME ?? join(homedir(), ".deepractice");
|
|
314
286
|
}
|
|
315
287
|
function localPlatform(config = {}) {
|
|
316
|
-
const dataDir = config.dataDir === null ? void 0 : config.dataDir ??
|
|
288
|
+
const dataDir = config.dataDir === null ? void 0 : config.dataDir ?? join(deepracticeHome(), "rolex");
|
|
317
289
|
let dbPath;
|
|
318
290
|
if (dataDir) {
|
|
319
291
|
mkdirSync(dataDir, { recursive: true });
|
|
320
|
-
dbPath =
|
|
292
|
+
dbPath = join(dataDir, "rolex.db");
|
|
321
293
|
} else {
|
|
322
294
|
dbPath = ":memory:";
|
|
323
295
|
}
|
|
324
296
|
const rawDb = openDatabase(dbPath);
|
|
325
297
|
const db = drizzle(rawDb);
|
|
326
298
|
const repository = new SqliteRepository(db);
|
|
299
|
+
const resourcexProvider = config.resourceDir !== null ? new NodeProvider() : void 0;
|
|
300
|
+
const issuexProvider = new IssueXNodeProvider({
|
|
301
|
+
db: {
|
|
302
|
+
run(sql2, ...params) {
|
|
303
|
+
rawDb.prepare(sql2).run(...params);
|
|
304
|
+
},
|
|
305
|
+
get(sql2, ...params) {
|
|
306
|
+
return rawDb.prepare(sql2).get(...params);
|
|
307
|
+
},
|
|
308
|
+
all(sql2, ...params) {
|
|
309
|
+
return rawDb.prepare(sql2).all(...params);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
});
|
|
327
313
|
const initializer = {
|
|
328
314
|
async bootstrap() {
|
|
329
315
|
}
|
|
330
316
|
};
|
|
331
317
|
return {
|
|
332
318
|
repository,
|
|
333
|
-
|
|
319
|
+
resourcexProvider,
|
|
320
|
+
issuexProvider,
|
|
321
|
+
initializer,
|
|
322
|
+
bootstrap: config.bootstrap
|
|
334
323
|
};
|
|
335
324
|
}
|
|
336
325
|
|
|
@@ -357,7 +346,7 @@ function stateToFiles(state) {
|
|
|
357
346
|
const entry = {
|
|
358
347
|
type: node.name,
|
|
359
348
|
...node.ref ? { ref: node.ref } : {},
|
|
360
|
-
...node.
|
|
349
|
+
...node.tag ? { tag: node.tag } : {},
|
|
361
350
|
...node.links && node.links.length > 0 ? { links: buildManifestLinks(node.links) } : {}
|
|
362
351
|
};
|
|
363
352
|
if (node.children && node.children.length > 0) {
|
|
@@ -421,7 +410,7 @@ function filesToState(manifest, fileContents) {
|
|
|
421
410
|
name: node.type,
|
|
422
411
|
description: "",
|
|
423
412
|
parent: null,
|
|
424
|
-
...node.
|
|
413
|
+
...node.tag ? { tag: node.tag } : {},
|
|
425
414
|
...information ? { information } : {},
|
|
426
415
|
...children2.length > 0 ? { children: children2 } : {},
|
|
427
416
|
...nodeLinks.length > 0 ? { links: nodeLinks } : {}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/LocalPlatform.ts","../src/SqliteRepository.ts","../src/sqliteRuntime.ts","../src/schema.ts","../src/manifest.ts"],"sourcesContent":["/**\n * localPlatform — create a Platform backed by SQLite + local filesystem.\n *\n * Storage:\n * {dataDir}/rolex.db — SQLite database (all state: nodes, links, prototypes, contexts)\n *\n * When dataDir is null, runs with in-memory SQLite (useful for tests).\n */\n\nimport { mkdirSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { drizzle } from \"@deepracticex/drizzle\";\nimport { openDatabase } from \"@deepracticex/sqlite\";\nimport type { Platform } from \"@rolexjs/core\";\nimport type { Initializer } from \"@rolexjs/system\";\nimport { SqliteRepository } from \"./SqliteRepository.js\";\n\n// ===== Config =====\n\nexport interface LocalPlatformConfig {\n /** Directory for persistent storage. Defaults to ~/.deepractice/rolex. Set to null for in-memory only. */\n dataDir?: string | null;\n}\n\n// ===== Factory =====\n\n/** Resolve the DEEPRACTICE_HOME base directory. Env > default (~/.deepractice). */\nfunction deepracticeHome(): string {\n return process.env.DEEPRACTICE_HOME ?? join(homedir(), \".deepractice\");\n}\n\n/** Create a local Platform. Persistent by default ($DEEPRACTICE_HOME/rolex), in-memory if dataDir is null. */\nexport function localPlatform(config: LocalPlatformConfig = {}): Platform {\n const dataDir =\n config.dataDir === null ? undefined : (config.dataDir ?? join(deepracticeHome(), \"rolex\"));\n\n // ===== SQLite database =====\n\n let dbPath: string;\n if (dataDir) {\n mkdirSync(dataDir, { recursive: true });\n dbPath = join(dataDir, \"rolex.db\");\n } else {\n dbPath = \":memory:\";\n }\n\n const rawDb = openDatabase(dbPath);\n const db = drizzle(rawDb);\n\n // ===== Repository (all state in one place) =====\n\n const repository = new SqliteRepository(db);\n\n // ===== Initializer =====\n\n const initializer: Initializer = {\n async bootstrap() {},\n };\n\n return {\n repository,\n initializer,\n };\n}\n","/**\n * SqliteRepository — RoleXRepository backed by SQLite via Drizzle.\n *\n * Five tables: nodes, links, prototypes, contexts, prototype_migrations.\n * Schema managed by Drizzle ORM migrations.\n */\n\nimport { join } from \"node:path\";\nimport type { CommonXDatabase } from \"@deepracticex/drizzle\";\nimport { migrate } from \"@deepracticex/drizzle\";\nimport type {\n ContextData,\n MigrationRecord,\n PrototypeRepository,\n RoleXRepository,\n} from \"@rolexjs/core\";\nimport type { Runtime } from \"@rolexjs/system\";\nimport { sql } from \"drizzle-orm\";\nimport { createSqliteRuntime } from \"./sqliteRuntime.js\";\n\ntype DB = CommonXDatabase;\n\n// ===== Repository =====\n\nexport class SqliteRepository implements RoleXRepository {\n readonly runtime: Runtime;\n readonly prototype: PrototypeRepository;\n\n constructor(private db: DB) {\n // Run Drizzle migrations — handles schema creation and evolution\n migrate(db, {\n migrationsFolder: join(import.meta.dirname, \"../drizzle\"),\n });\n\n this.runtime = createSqliteRuntime(db);\n this.prototype = createPrototypeRepository(db);\n }\n\n async saveContext(roleId: string, data: ContextData): Promise<void> {\n this.db.run(\n sql`INSERT OR REPLACE INTO contexts (role_id, focused_goal_id, focused_plan_id)\n VALUES (${roleId}, ${data.focusedGoalId}, ${data.focusedPlanId})`\n );\n }\n\n async loadContext(roleId: string): Promise<ContextData | null> {\n const row = this.db.all<{\n role_id: string;\n focused_goal_id: string | null;\n focused_plan_id: string | null;\n }>(\n sql`SELECT role_id, focused_goal_id, focused_plan_id FROM contexts WHERE role_id = ${roleId}`\n );\n if (row.length === 0) return null;\n return {\n focusedGoalId: row[0].focused_goal_id,\n focusedPlanId: row[0].focused_plan_id,\n };\n }\n}\n\n// ===== Prototype Registry (SQLite-backed) =====\n\nfunction createPrototypeRepository(db: DB): PrototypeRepository {\n return {\n async settle(id: string, source: string) {\n db.run(sql`INSERT OR REPLACE INTO prototypes (id, source) VALUES (${id}, ${source})`);\n },\n\n async evict(id: string) {\n db.run(sql`DELETE FROM prototypes WHERE id = ${id}`);\n db.run(sql`DELETE FROM prototype_migrations WHERE prototype_id = ${id}`);\n },\n\n async list(): Promise<Record<string, string>> {\n const rows = db.all<{ id: string; source: string }>(sql`SELECT id, source FROM prototypes`);\n const result: Record<string, string> = {};\n for (const row of rows) {\n result[row.id] = row.source;\n }\n return result;\n },\n\n async recordMigration(\n prototypeId: string,\n migrationId: string,\n version: number,\n checksum: string\n ) {\n const executedAt = new Date().toISOString();\n db.run(\n sql`INSERT OR REPLACE INTO prototype_migrations (prototype_id, migration_id, version, checksum, executed_at)\n VALUES (${prototypeId}, ${migrationId}, ${version}, ${checksum}, ${executedAt})`\n );\n },\n\n async getMigrationHistory(prototypeId: string): Promise<MigrationRecord[]> {\n return db\n .all<{\n prototype_id: string;\n migration_id: string;\n version: number;\n checksum: string;\n executed_at: string;\n }>(\n sql`SELECT prototype_id, migration_id, version, checksum, executed_at\n FROM prototype_migrations\n WHERE prototype_id = ${prototypeId}\n ORDER BY version`\n )\n .map((row) => ({\n prototypeId: row.prototype_id,\n migrationId: row.migration_id,\n version: row.version,\n checksum: row.checksum,\n executedAt: row.executed_at,\n }));\n },\n\n async hasMigration(prototypeId: string, migrationId: string): Promise<boolean> {\n const rows = db.all<{ cnt: number }>(\n sql`SELECT COUNT(*) as cnt FROM prototype_migrations\n WHERE prototype_id = ${prototypeId} AND migration_id = ${migrationId}`\n );\n return rows.length > 0 && rows[0].cnt > 0;\n },\n };\n}\n","/**\n * SQLite-backed Runtime — single source of truth.\n *\n * Every operation reads/writes directly to SQLite.\n * No in-memory Map, no load/save cycle, no stale refs.\n */\n\nimport type { CommonXDatabase } from \"@deepracticex/drizzle\";\nimport type { Runtime, State, Structure } from \"@rolexjs/system\";\nimport { and, eq, isNull } from \"drizzle-orm\";\nimport { links, nodes } from \"./schema.js\";\n\ntype DB = CommonXDatabase;\n\n// ===== Helpers =====\n\nfunction nextRef(db: DB): string {\n const max = db\n .select({ ref: nodes.ref })\n .from(nodes)\n .all()\n .reduce((max, r) => {\n const n = parseInt(r.ref.slice(1), 10);\n return Number.isNaN(n) ? max : Math.max(max, n);\n }, 0);\n return `n${max + 1}`;\n}\n\nfunction toStructure(row: typeof nodes.$inferSelect): Structure {\n return {\n ref: row.ref,\n ...(row.id ? { id: row.id } : {}),\n ...(row.alias ? { alias: JSON.parse(row.alias) } : {}),\n name: row.name,\n description: row.description ?? \"\",\n parent: null, // Runtime doesn't use parent as Structure; tree is via parentRef\n ...(row.information ? { information: row.information } : {}),\n ...(row.tag ? { tags: JSON.parse(row.tag) } : {}),\n };\n}\n\n// ===== Projection =====\n\n/** Project a linked node with full subtree (no further link-following to prevent cycles). */\nfunction projectLinked(db: DB, ref: string): State {\n const row = db.select().from(nodes).where(eq(nodes.ref, ref)).get();\n if (!row) throw new Error(`Node not found: ${ref}`);\n const children = db.select().from(nodes).where(eq(nodes.parentRef, ref)).all();\n return {\n ...toStructure(row),\n children: children.map((c) => projectLinked(db, c.ref)),\n };\n}\n\n/** Project a node with full subtree and links (top-level only). */\nfunction projectNode(db: DB, ref: string): State {\n const row = db.select().from(nodes).where(eq(nodes.ref, ref)).get();\n if (!row) throw new Error(`Node not found: ${ref}`);\n\n const children = db.select().from(nodes).where(eq(nodes.parentRef, ref)).all();\n const nodeLinks = db.select().from(links).where(eq(links.fromRef, ref)).all();\n\n return {\n ...toStructure(row),\n children: children.map((c) => projectNode(db, c.ref)),\n ...(nodeLinks.length > 0\n ? {\n links: nodeLinks.map((l) => ({\n relation: l.relation,\n target: projectLinked(db, l.toRef),\n })),\n }\n : {}),\n };\n}\n\n// ===== Subtree removal =====\n\nfunction removeSubtree(db: DB, ref: string): void {\n // Remove children first (depth-first)\n const children = db.select({ ref: nodes.ref }).from(nodes).where(eq(nodes.parentRef, ref)).all();\n for (const child of children) {\n removeSubtree(db, child.ref);\n }\n\n // Remove links from/to this node\n db.delete(links).where(eq(links.fromRef, ref)).run();\n db.delete(links).where(eq(links.toRef, ref)).run();\n\n // Remove the node itself\n db.delete(nodes).where(eq(nodes.ref, ref)).run();\n}\n\n// ===== Runtime factory =====\n\nexport function createSqliteRuntime(db: DB): Runtime {\n return {\n async create(parent, type, information, id, alias) {\n // Idempotent: same id under same parent → return existing.\n if (id) {\n const existing = db\n .select()\n .from(nodes)\n .where(and(eq(nodes.id, id), eq(nodes.parentRef, parent?.ref ?? null)))\n .get();\n if (existing) return toStructure(existing);\n }\n const ref = nextRef(db);\n db.insert(nodes)\n .values({\n ref,\n id: id ?? null,\n alias: alias && alias.length > 0 ? JSON.stringify(alias) : null,\n name: type.name,\n description: type.description,\n parentRef: parent?.ref ?? null,\n information: information ?? null,\n tag: null,\n })\n .run();\n return toStructure(db.select().from(nodes).where(eq(nodes.ref, ref)).get()!);\n },\n\n async remove(node) {\n if (!node.ref) return;\n const row = db.select().from(nodes).where(eq(nodes.ref, node.ref)).get();\n if (!row) return;\n\n // Detach from parent's children (implicit via parentRef)\n removeSubtree(db, node.ref);\n },\n\n async transform(source, target, information) {\n if (!source.ref) throw new Error(\"Source node has no ref\");\n const row = db.select().from(nodes).where(eq(nodes.ref, source.ref)).get();\n if (!row) throw new Error(`Source node not found: ${source.ref}`);\n\n const targetParent = target.parent;\n if (!targetParent) {\n throw new Error(`Cannot transform to root structure: ${target.name}`);\n }\n\n const parentRow = db.select().from(nodes).where(eq(nodes.name, targetParent.name)).get();\n if (!parentRow) {\n throw new Error(`No node found for structure: ${targetParent.name}`);\n }\n\n // Reparent + update type in place — subtree preserved\n db.update(nodes)\n .set({\n parentRef: parentRow.ref,\n name: target.name,\n description: target.description,\n ...(information !== undefined ? { information } : {}),\n })\n .where(eq(nodes.ref, source.ref))\n .run();\n\n return toStructure(db.select().from(nodes).where(eq(nodes.ref, source.ref)).get()!);\n },\n\n async link(from, to, relationName, reverseName) {\n if (!from.ref) throw new Error(\"Source node has no ref\");\n if (!to.ref) throw new Error(\"Target node has no ref\");\n\n // Forward: from → to\n const existsForward = db\n .select()\n .from(links)\n .where(\n and(\n eq(links.fromRef, from.ref),\n eq(links.toRef, to.ref),\n eq(links.relation, relationName)\n )\n )\n .get();\n if (!existsForward) {\n db.insert(links).values({ fromRef: from.ref, toRef: to.ref, relation: relationName }).run();\n }\n\n // Reverse: to → from\n const existsReverse = db\n .select()\n .from(links)\n .where(\n and(eq(links.fromRef, to.ref), eq(links.toRef, from.ref), eq(links.relation, reverseName))\n )\n .get();\n if (!existsReverse) {\n db.insert(links).values({ fromRef: to.ref, toRef: from.ref, relation: reverseName }).run();\n }\n },\n\n async unlink(from, to, relationName, reverseName) {\n if (!from.ref || !to.ref) return;\n\n db.delete(links)\n .where(\n and(\n eq(links.fromRef, from.ref),\n eq(links.toRef, to.ref),\n eq(links.relation, relationName)\n )\n )\n .run();\n\n db.delete(links)\n .where(\n and(eq(links.fromRef, to.ref), eq(links.toRef, from.ref), eq(links.relation, reverseName))\n )\n .run();\n },\n\n async addTag(node, tag) {\n if (!node.ref) throw new Error(\"Node has no ref\");\n const row = db.select().from(nodes).where(eq(nodes.ref, node.ref)).get();\n if (!row) throw new Error(`Node not found: ${node.ref}`);\n const current: string[] = row.tag ? JSON.parse(row.tag) : [];\n if (!current.includes(tag)) {\n current.push(tag);\n db.update(nodes)\n .set({ tag: JSON.stringify(current) })\n .where(eq(nodes.ref, node.ref))\n .run();\n }\n },\n\n async removeTag(node, tag) {\n if (!node.ref) throw new Error(\"Node has no ref\");\n const row = db.select().from(nodes).where(eq(nodes.ref, node.ref)).get();\n if (!row) throw new Error(`Node not found: ${node.ref}`);\n const current: string[] = row.tag ? JSON.parse(row.tag) : [];\n const filtered = current.filter((t) => t !== tag);\n db.update(nodes)\n .set({ tag: filtered.length > 0 ? JSON.stringify(filtered) : null })\n .where(eq(nodes.ref, node.ref))\n .run();\n },\n\n async project(node) {\n if (!node.ref) throw new Error(`Node has no ref`);\n return projectNode(db, node.ref);\n },\n\n async roots() {\n const rows = db.select().from(nodes).where(isNull(nodes.parentRef)).all();\n return rows.map(toStructure);\n },\n };\n}\n","/**\n * Drizzle schema — SQLite tables for RoleX.\n *\n * Five tables:\n * nodes — tree backbone (Structure instances)\n * links — cross-branch relations (bidirectional)\n * prototypes — which prototype packages are settled\n * contexts — per-role session focus state\n * prototype_migrations — Flyway-style migration history\n */\n\nimport { index, integer, primaryKey, sqliteTable, text } from \"drizzle-orm/sqlite-core\";\n\n/**\n * nodes — every node in the society graph.\n *\n * Maps 1:1 to the Structure interface:\n * ref → graph-internal reference (primary key)\n * id → user-facing kebab-case identifier\n * alias → JSON array of alternative names\n * name → structure type (\"individual\", \"goal\", \"task\", etc.)\n * description → what this structure is\n * parent_ref → tree parent (self-referencing foreign key)\n * information → Gherkin Feature source text\n * tag → generic label (\"done\", \"abandoned\")\n */\nexport const nodes = sqliteTable(\n \"nodes\",\n {\n ref: text(\"ref\").primaryKey(),\n id: text(\"id\"),\n alias: text(\"alias\"), // JSON array: '[\"Sean\",\"姜山\"]'\n name: text(\"name\").notNull(),\n description: text(\"description\").default(\"\"),\n parentRef: text(\"parent_ref\").references((): any => nodes.ref),\n information: text(\"information\"),\n tag: text(\"tag\"),\n },\n (table) => [\n index(\"idx_nodes_id\").on(table.id),\n index(\"idx_nodes_name\").on(table.name),\n index(\"idx_nodes_parent_ref\").on(table.parentRef),\n ]\n);\n\n/**\n * links — cross-branch relations between nodes.\n *\n * Bidirectional: if A→B is \"membership\", B→A is \"belong\".\n * Both directions stored as separate rows.\n */\nexport const links = sqliteTable(\n \"links\",\n {\n fromRef: text(\"from_ref\")\n .notNull()\n .references(() => nodes.ref),\n toRef: text(\"to_ref\")\n .notNull()\n .references(() => nodes.ref),\n relation: text(\"relation\").notNull(),\n },\n (table) => [\n primaryKey({ columns: [table.fromRef, table.toRef, table.relation] }),\n index(\"idx_links_from\").on(table.fromRef),\n index(\"idx_links_to\").on(table.toRef),\n ]\n);\n\n/**\n * prototypes — which prototype packages are settled.\n */\nexport const prototypes = sqliteTable(\"prototypes\", {\n id: text(\"id\").primaryKey(),\n source: text(\"source\").notNull(),\n});\n\n/**\n * contexts — per-role session focus state.\n */\nexport const contexts = sqliteTable(\"contexts\", {\n roleId: text(\"role_id\").primaryKey(),\n focusedGoalId: text(\"focused_goal_id\"),\n focusedPlanId: text(\"focused_plan_id\"),\n});\n\n/**\n * prototype_migrations — Flyway-style migration history.\n *\n * Records which migrations have been executed for each prototype.\n */\nexport const prototypeMigrations = sqliteTable(\n \"prototype_migrations\",\n {\n prototypeId: text(\"prototype_id\").notNull(),\n migrationId: text(\"migration_id\").notNull(),\n version: integer(\"version\").notNull(),\n checksum: text(\"checksum\").notNull(),\n executedAt: text(\"executed_at\").notNull(),\n },\n (table) => [primaryKey({ columns: [table.prototypeId, table.migrationId] })]\n);\n","/**\n * Manifest — file-based storage format for RoleX entities.\n *\n * Storage layout:\n * role/<id>/\n * individual.json — manifest (tree structure + links)\n * <id>.<type>.feature — node information (Gherkin)\n *\n * organization/<id>/\n * organization.json — manifest (tree structure + links)\n * <id>.<type>.feature — node information (Gherkin)\n *\n * Rules:\n * - Directories: only role/ and organization/ at top level\n * - Files: all [id].[type].feature, flat within the entity directory\n * - Manifest: tree structure in JSON, content in .feature files\n * - Nodes without explicit id default to their type name\n */\n\nimport type { State } from \"@rolexjs/system\";\n\n// ===== Manifest types =====\n\n/** A node in the manifest tree. */\nexport interface ManifestNode {\n readonly type: string;\n readonly ref?: string;\n readonly tags?: readonly string[];\n readonly children?: Record<string, ManifestNode>;\n readonly links?: Record<string, string[]>;\n}\n\n/** Root manifest for an entity (individual or organization). */\nexport interface Manifest {\n readonly id: string;\n readonly type: string;\n readonly ref?: string;\n readonly alias?: readonly string[];\n readonly children?: Record<string, ManifestNode>;\n readonly links?: Record<string, string[]>;\n}\n\n// ===== State → files =====\n\nexport interface FileEntry {\n readonly path: string;\n readonly content: string;\n}\n\n/**\n * Convert a State tree to a manifest + feature files.\n * Returns the manifest and a list of file entries (path → content).\n */\nexport function stateToFiles(state: State): { manifest: Manifest; files: FileEntry[] } {\n const files: FileEntry[] = [];\n\n const collectFiles = (node: State, nodeId: string) => {\n if (node.information) {\n files.push({\n path: `${nodeId}.${node.name}.feature`,\n content: node.information,\n });\n }\n if (node.children) {\n for (const child of node.children) {\n const childId = child.id ?? child.name;\n collectFiles(child, childId);\n }\n }\n };\n\n const rootId = state.id ?? state.name;\n collectFiles(state, rootId);\n\n const buildManifestNode = (node: State): ManifestNode => {\n const entry: ManifestNode = {\n type: node.name,\n ...(node.ref ? { ref: node.ref } : {}),\n ...(node.tags?.length ? { tags: node.tags } : {}),\n ...(node.links && node.links.length > 0 ? { links: buildManifestLinks(node.links) } : {}),\n };\n if (node.children && node.children.length > 0) {\n const children: Record<string, ManifestNode> = {};\n for (const child of node.children) {\n const childId = child.id ?? child.name;\n children[childId] = buildManifestNode(child);\n }\n return { ...entry, children };\n }\n return entry;\n };\n\n const manifestNode = buildManifestNode(state);\n\n const manifest: Manifest = {\n id: rootId,\n type: state.name,\n ...(state.ref ? { ref: state.ref } : {}),\n ...(state.alias ? { alias: state.alias } : {}),\n ...(manifestNode.children ? { children: manifestNode.children } : {}),\n ...(state.links && state.links.length > 0\n ? {\n links: buildManifestLinks(state.links),\n }\n : {}),\n };\n\n return { manifest, files };\n}\n\nfunction buildManifestLinks(\n links: readonly { readonly relation: string; readonly target: State }[]\n): Record<string, string[]> {\n const result: Record<string, string[]> = {};\n for (const link of links) {\n const targetId = link.target.id ?? link.target.name;\n if (!result[link.relation]) {\n result[link.relation] = [];\n }\n result[link.relation].push(targetId);\n }\n return result;\n}\n\n// ===== Files → State =====\n\n/**\n * Convert a manifest + feature file contents to a State tree.\n * fileContents maps filename (e.g. \"role-creation.principle.feature\") to Gherkin text.\n */\nexport function filesToState(manifest: Manifest, fileContents: Record<string, string>): State {\n const buildState = (id: string, node: ManifestNode): State => {\n const filename = `${id}.${node.type}.feature`;\n const information = fileContents[filename];\n\n const children: State[] = [];\n if (node.children) {\n for (const [childId, childNode] of Object.entries(node.children)) {\n children.push(buildState(childId, childNode));\n }\n }\n\n const nodeLinks: { relation: string; target: State }[] = [];\n if (node.links) {\n for (const [relation, targetIds] of Object.entries(node.links)) {\n for (const targetId of targetIds) {\n nodeLinks.push({\n relation,\n target: { id: targetId, name: \"\", description: \"\", parent: null },\n });\n }\n }\n }\n\n return {\n ...(node.ref ? { ref: node.ref } : {}),\n id,\n name: node.type,\n description: \"\",\n parent: null,\n ...(node.tags?.length ? { tags: node.tags } : {}),\n ...(information ? { information } : {}),\n ...(children.length > 0 ? { children } : {}),\n ...(nodeLinks.length > 0 ? { links: nodeLinks } : {}),\n };\n };\n\n const rootFilename = `${manifest.id}.${manifest.type}.feature`;\n const rootInformation = fileContents[rootFilename];\n\n const children: State[] = [];\n if (manifest.children) {\n for (const [childId, childNode] of Object.entries(manifest.children)) {\n children.push(buildState(childId, childNode));\n }\n }\n\n const links: { relation: string; target: State }[] = [];\n if (manifest.links) {\n for (const [relation, targetIds] of Object.entries(manifest.links)) {\n for (const targetId of targetIds) {\n links.push({\n relation,\n target: {\n id: targetId,\n name: \"\",\n description: \"\",\n parent: null,\n },\n });\n }\n }\n }\n\n return {\n ...(manifest.ref ? { ref: manifest.ref } : {}),\n id: manifest.id,\n ...(manifest.alias ? { alias: manifest.alias } : {}),\n name: manifest.type,\n description: \"\",\n parent: null,\n ...(rootInformation ? { information: rootInformation } : {}),\n ...(children.length > 0 ? { children } : {}),\n ...(links.length > 0 ? { links } : {}),\n };\n}\n"],"mappings":";AASA,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,QAAAA,aAAY;AACrB,SAAS,eAAe;AACxB,SAAS,oBAAoB;;;ACN7B,SAAS,YAAY;AAErB,SAAS,eAAe;AAQxB,SAAS,WAAW;;;ACRpB,SAAS,KAAK,IAAI,cAAc;;;ACEhC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,IAAI,CAAC;AAAA,IAC5C,IAAI,SAAS;AAAA,IACb,GAAI,SAAS,QAAQ,EAAE,OAAO,SAAS,MAAM,IAAI,CAAC;AAAA,IAClD,MAAM,SAAS;AAAA,IACf,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,GAAI,kBAAkB,EAAE,aAAa,gBAAgB,IAAI,CAAC;AAAA,IAC1D,GAAI,SAAS,SAAS,IAAI,EAAE,SAAS,IAAI,CAAC;AAAA,IAC1C,GAAIA,OAAM,SAAS,IAAI,EAAE,OAAAA,OAAM,IAAI,CAAC;AAAA,EACtC;AACF;","names":["join","max","join","links","children"]}
|
|
1
|
+
{"version":3,"sources":["../src/LocalPlatform.ts","../src/SqliteRepository.ts","../src/sqliteRuntime.ts","../src/schema.ts","../src/manifest.ts"],"sourcesContent":["/**\n * localPlatform — create a Platform backed by SQLite + local filesystem.\n *\n * Storage:\n * {dataDir}/rolex.db — SQLite database (all state: nodes, links, prototypes, contexts)\n *\n * When dataDir is null, runs with in-memory SQLite (useful for tests).\n */\n\nimport { mkdirSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { drizzle } from \"@deepracticex/drizzle\";\nimport { openDatabase } from \"@deepracticex/sqlite\";\nimport { NodeProvider as IssueXNodeProvider } from \"@issuexjs/node\";\nimport { NodeProvider } from \"@resourcexjs/node-provider\";\nimport type { Platform } from \"@rolexjs/core\";\nimport type { Initializer } from \"@rolexjs/system\";\nimport { SqliteRepository } from \"./SqliteRepository.js\";\n\n// ===== Config =====\n\nexport interface LocalPlatformConfig {\n /** Directory for persistent storage. Defaults to ~/.deepractice/rolex. Set to null for in-memory only. */\n dataDir?: string | null;\n /** Directory for ResourceX storage. Defaults to ~/.deepractice/resourcex. Set to null to disable. */\n resourceDir?: string | null;\n /** Prototype sources to settle on genesis. */\n bootstrap?: string[];\n}\n\n// ===== Factory =====\n\n/** Resolve the DEEPRACTICE_HOME base directory. Env > default (~/.deepractice). */\nfunction deepracticeHome(): string {\n return process.env.DEEPRACTICE_HOME ?? join(homedir(), \".deepractice\");\n}\n\n/** Create a local Platform. Persistent by default ($DEEPRACTICE_HOME/rolex), in-memory if dataDir is null. */\nexport function localPlatform(config: LocalPlatformConfig = {}): Platform {\n const dataDir =\n config.dataDir === null ? undefined : (config.dataDir ?? join(deepracticeHome(), \"rolex\"));\n\n // ===== SQLite database =====\n\n let dbPath: string;\n if (dataDir) {\n mkdirSync(dataDir, { recursive: true });\n dbPath = join(dataDir, \"rolex.db\");\n } else {\n dbPath = \":memory:\";\n }\n\n const rawDb = openDatabase(dbPath);\n const db = drizzle(rawDb);\n\n // ===== Repository (all state in one place) =====\n\n const repository = new SqliteRepository(db);\n\n // ===== ResourceX Provider =====\n\n const resourcexProvider = config.resourceDir !== null ? new NodeProvider() : undefined;\n\n // ===== IssueX Provider =====\n\n const issuexProvider = new IssueXNodeProvider({\n db: {\n run(sql: string, ...params: unknown[]) {\n rawDb.prepare(sql).run(...params);\n },\n get<T = unknown>(sql: string, ...params: unknown[]): T | null {\n return rawDb.prepare(sql).get(...params) as T | null;\n },\n all<T = unknown>(sql: string, ...params: unknown[]): T[] {\n return rawDb.prepare(sql).all(...params) as T[];\n },\n },\n });\n\n // ===== Initializer =====\n\n const initializer: Initializer = {\n async bootstrap() {},\n };\n\n return {\n repository,\n resourcexProvider,\n issuexProvider,\n initializer,\n bootstrap: config.bootstrap,\n };\n}\n","/**\n * SqliteRepository — RoleXRepository backed by SQLite via Drizzle.\n *\n * Single database, four tables: nodes, links, prototypes, contexts.\n * All state in one place — swap the db connection to go from local to cloud.\n */\n\nimport type { CommonXDatabase } from \"@deepracticex/drizzle\";\nimport type { ContextData, PrototypeRegistry, RoleXRepository } from \"@rolexjs/core\";\nimport type { Runtime } from \"@rolexjs/system\";\nimport { sql } from \"drizzle-orm\";\nimport { createSqliteRuntime } from \"./sqliteRuntime.js\";\n\ntype DB = CommonXDatabase;\n\n// ===== DDL =====\n\nconst DDL = [\n sql`CREATE TABLE IF NOT EXISTS nodes (\n ref TEXT PRIMARY KEY,\n id TEXT,\n alias TEXT,\n name TEXT NOT NULL,\n description TEXT DEFAULT '',\n parent_ref TEXT REFERENCES nodes(ref),\n information TEXT,\n tag TEXT\n )`,\n sql`CREATE TABLE IF NOT EXISTS links (\n from_ref TEXT NOT NULL REFERENCES nodes(ref),\n to_ref TEXT NOT NULL REFERENCES nodes(ref),\n relation TEXT NOT NULL,\n PRIMARY KEY (from_ref, to_ref, relation)\n )`,\n sql`CREATE TABLE IF NOT EXISTS prototypes (\n id TEXT PRIMARY KEY,\n source TEXT NOT NULL\n )`,\n sql`CREATE TABLE IF NOT EXISTS contexts (\n role_id TEXT PRIMARY KEY,\n focused_goal_id TEXT,\n focused_plan_id TEXT\n )`,\n // Indexes\n sql`CREATE INDEX IF NOT EXISTS idx_nodes_id ON nodes(id)`,\n sql`CREATE INDEX IF NOT EXISTS idx_nodes_name ON nodes(name)`,\n sql`CREATE INDEX IF NOT EXISTS idx_nodes_parent_ref ON nodes(parent_ref)`,\n sql`CREATE INDEX IF NOT EXISTS idx_links_from ON links(from_ref)`,\n sql`CREATE INDEX IF NOT EXISTS idx_links_to ON links(to_ref)`,\n];\n\n// ===== Repository =====\n\nexport class SqliteRepository implements RoleXRepository {\n readonly runtime: Runtime;\n readonly prototype: PrototypeRegistry;\n\n constructor(private db: DB) {\n // Ensure all tables exist\n for (const stmt of DDL) {\n db.run(stmt);\n }\n\n this.runtime = createSqliteRuntime(db);\n this.prototype = createPrototypeRegistry(db);\n }\n\n async saveContext(roleId: string, data: ContextData): Promise<void> {\n this.db.run(\n sql`INSERT OR REPLACE INTO contexts (role_id, focused_goal_id, focused_plan_id)\n VALUES (${roleId}, ${data.focusedGoalId}, ${data.focusedPlanId})`\n );\n }\n\n async loadContext(roleId: string): Promise<ContextData | null> {\n const row = this.db.all<{\n role_id: string;\n focused_goal_id: string | null;\n focused_plan_id: string | null;\n }>(\n sql`SELECT role_id, focused_goal_id, focused_plan_id FROM contexts WHERE role_id = ${roleId}`\n );\n if (row.length === 0) return null;\n return {\n focusedGoalId: row[0].focused_goal_id,\n focusedPlanId: row[0].focused_plan_id,\n };\n }\n}\n\n// ===== Prototype Registry (SQLite-backed) =====\n\nfunction createPrototypeRegistry(db: DB): PrototypeRegistry {\n return {\n settle(id: string, source: string) {\n db.run(sql`INSERT OR REPLACE INTO prototypes (id, source) VALUES (${id}, ${source})`);\n },\n\n evict(id: string) {\n db.run(sql`DELETE FROM prototypes WHERE id = ${id}`);\n },\n\n list(): Record<string, string> {\n const rows = db.all<{ id: string; source: string }>(sql`SELECT id, source FROM prototypes`);\n const result: Record<string, string> = {};\n for (const row of rows) {\n result[row.id] = row.source;\n }\n return result;\n },\n };\n}\n","/**\n * SQLite-backed Runtime — single source of truth.\n *\n * Every operation reads/writes directly to SQLite.\n * No in-memory Map, no load/save cycle, no stale refs.\n */\n\nimport type { CommonXDatabase } from \"@deepracticex/drizzle\";\nimport type { Runtime, State, Structure } from \"@rolexjs/system\";\nimport { and, eq, isNull } from \"drizzle-orm\";\nimport { links, nodes } from \"./schema.js\";\n\ntype DB = CommonXDatabase;\n\n// ===== Helpers =====\n\nfunction nextRef(db: DB): string {\n const max = db\n .select({ ref: nodes.ref })\n .from(nodes)\n .all()\n .reduce((max, r) => {\n const n = parseInt(r.ref.slice(1), 10);\n return Number.isNaN(n) ? max : Math.max(max, n);\n }, 0);\n return `n${max + 1}`;\n}\n\nfunction toStructure(row: typeof nodes.$inferSelect): Structure {\n return {\n ref: row.ref,\n ...(row.id ? { id: row.id } : {}),\n ...(row.alias ? { alias: JSON.parse(row.alias) } : {}),\n name: row.name,\n description: row.description ?? \"\",\n parent: null, // Runtime doesn't use parent as Structure; tree is via parentRef\n ...(row.information ? { information: row.information } : {}),\n ...(row.tag ? { tag: row.tag } : {}),\n };\n}\n\n// ===== Projection =====\n\nfunction projectNode(db: DB, ref: string): State {\n const row = db.select().from(nodes).where(eq(nodes.ref, ref)).get();\n if (!row) throw new Error(`Node not found: ${ref}`);\n\n const children = db.select().from(nodes).where(eq(nodes.parentRef, ref)).all();\n\n const nodeLinks = db.select().from(links).where(eq(links.fromRef, ref)).all();\n\n return {\n ...toStructure(row),\n children: children.map((c) => projectNode(db, c.ref)),\n ...(nodeLinks.length > 0\n ? {\n links: nodeLinks.map((l) => ({\n relation: l.relation,\n target: projectLinked(db, l.toRef),\n })),\n }\n : {}),\n };\n}\n\n/** Project a node with full subtree but without following links (prevents cycles). */\nfunction projectLinked(db: DB, ref: string): State {\n const row = db.select().from(nodes).where(eq(nodes.ref, ref)).get();\n if (!row) throw new Error(`Node not found: ${ref}`);\n const children = db.select().from(nodes).where(eq(nodes.parentRef, ref)).all();\n return {\n ...toStructure(row),\n children: children.map((c) => projectLinked(db, c.ref)),\n };\n}\n\n// ===== Subtree removal =====\n\nfunction removeSubtree(db: DB, ref: string): void {\n // Remove children first (depth-first)\n const children = db.select({ ref: nodes.ref }).from(nodes).where(eq(nodes.parentRef, ref)).all();\n for (const child of children) {\n removeSubtree(db, child.ref);\n }\n\n // Remove links from/to this node\n db.delete(links).where(eq(links.fromRef, ref)).run();\n db.delete(links).where(eq(links.toRef, ref)).run();\n\n // Remove the node itself\n db.delete(nodes).where(eq(nodes.ref, ref)).run();\n}\n\n// ===== Runtime factory =====\n\nexport function createSqliteRuntime(db: DB): Runtime {\n return {\n async create(parent, type, information, id, alias) {\n // Idempotent: same id under same parent → return existing.\n if (id) {\n const existing = db\n .select()\n .from(nodes)\n .where(and(eq(nodes.id, id), eq(nodes.parentRef, parent?.ref ?? null)))\n .get();\n if (existing) return toStructure(existing);\n }\n const ref = nextRef(db);\n db.insert(nodes)\n .values({\n ref,\n id: id ?? null,\n alias: alias && alias.length > 0 ? JSON.stringify(alias) : null,\n name: type.name,\n description: type.description,\n parentRef: parent?.ref ?? null,\n information: information ?? null,\n tag: null,\n })\n .run();\n return toStructure(db.select().from(nodes).where(eq(nodes.ref, ref)).get()!);\n },\n\n async remove(node) {\n if (!node.ref) return;\n const row = db.select().from(nodes).where(eq(nodes.ref, node.ref)).get();\n if (!row) return;\n\n // Detach from parent's children (implicit via parentRef)\n removeSubtree(db, node.ref);\n },\n\n async transform(source, target, information) {\n if (!source.ref) throw new Error(\"Source node has no ref\");\n const row = db.select().from(nodes).where(eq(nodes.ref, source.ref)).get();\n if (!row) throw new Error(`Source node not found: ${source.ref}`);\n\n const targetParent = target.parent;\n if (!targetParent) {\n throw new Error(`Cannot transform to root structure: ${target.name}`);\n }\n\n const parentRow = db.select().from(nodes).where(eq(nodes.name, targetParent.name)).get();\n if (!parentRow) {\n throw new Error(`No node found for structure: ${targetParent.name}`);\n }\n\n // Reparent + update type in place — subtree preserved\n db.update(nodes)\n .set({\n parentRef: parentRow.ref,\n name: target.name,\n description: target.description,\n ...(information !== undefined ? { information } : {}),\n })\n .where(eq(nodes.ref, source.ref))\n .run();\n\n return toStructure(db.select().from(nodes).where(eq(nodes.ref, source.ref)).get()!);\n },\n\n async link(from, to, relationName, reverseName) {\n if (!from.ref) throw new Error(\"Source node has no ref\");\n if (!to.ref) throw new Error(\"Target node has no ref\");\n\n // Forward: from → to\n const existsForward = db\n .select()\n .from(links)\n .where(\n and(\n eq(links.fromRef, from.ref),\n eq(links.toRef, to.ref),\n eq(links.relation, relationName)\n )\n )\n .get();\n if (!existsForward) {\n db.insert(links).values({ fromRef: from.ref, toRef: to.ref, relation: relationName }).run();\n }\n\n // Reverse: to → from\n const existsReverse = db\n .select()\n .from(links)\n .where(\n and(eq(links.fromRef, to.ref), eq(links.toRef, from.ref), eq(links.relation, reverseName))\n )\n .get();\n if (!existsReverse) {\n db.insert(links).values({ fromRef: to.ref, toRef: from.ref, relation: reverseName }).run();\n }\n },\n\n async unlink(from, to, relationName, reverseName) {\n if (!from.ref || !to.ref) return;\n\n db.delete(links)\n .where(\n and(\n eq(links.fromRef, from.ref),\n eq(links.toRef, to.ref),\n eq(links.relation, relationName)\n )\n )\n .run();\n\n db.delete(links)\n .where(\n and(eq(links.fromRef, to.ref), eq(links.toRef, from.ref), eq(links.relation, reverseName))\n )\n .run();\n },\n\n async tag(node, tagValue) {\n if (!node.ref) throw new Error(\"Node has no ref\");\n const row = db.select().from(nodes).where(eq(nodes.ref, node.ref)).get();\n if (!row) throw new Error(`Node not found: ${node.ref}`);\n db.update(nodes).set({ tag: tagValue }).where(eq(nodes.ref, node.ref)).run();\n },\n\n async project(node) {\n if (!node.ref) throw new Error(`Node has no ref`);\n return projectNode(db, node.ref);\n },\n\n async roots() {\n const rows = db.select().from(nodes).where(isNull(nodes.parentRef)).all();\n return rows.map(toStructure);\n },\n };\n}\n","/**\n * Drizzle schema — SQLite tables for the RoleX runtime graph.\n *\n * Two tables:\n * nodes — tree backbone (Structure instances)\n * links — cross-branch relations (bidirectional)\n */\n\nimport { index, primaryKey, sqliteTable, text } from \"drizzle-orm/sqlite-core\";\n\n/**\n * nodes — every node in the society graph.\n *\n * Maps 1:1 to the Structure interface:\n * ref → graph-internal reference (primary key)\n * id → user-facing kebab-case identifier\n * alias → JSON array of alternative names\n * name → structure type (\"individual\", \"goal\", \"task\", etc.)\n * description → what this structure is\n * parent_ref → tree parent (self-referencing foreign key)\n * information → Gherkin Feature source text\n * tag → generic label (\"done\", \"abandoned\")\n */\nexport const nodes = sqliteTable(\n \"nodes\",\n {\n ref: text(\"ref\").primaryKey(),\n id: text(\"id\"),\n alias: text(\"alias\"), // JSON array: '[\"Sean\",\"姜山\"]'\n name: text(\"name\").notNull(),\n description: text(\"description\").default(\"\"),\n parentRef: text(\"parent_ref\").references((): any => nodes.ref),\n information: text(\"information\"),\n tag: text(\"tag\"),\n },\n (table) => [\n index(\"idx_nodes_id\").on(table.id),\n index(\"idx_nodes_name\").on(table.name),\n index(\"idx_nodes_parent_ref\").on(table.parentRef),\n ]\n);\n\n/**\n * links — cross-branch relations between nodes.\n *\n * Bidirectional: if A→B is \"membership\", B→A is \"belong\".\n * Both directions stored as separate rows.\n */\nexport const links = sqliteTable(\n \"links\",\n {\n fromRef: text(\"from_ref\")\n .notNull()\n .references(() => nodes.ref),\n toRef: text(\"to_ref\")\n .notNull()\n .references(() => nodes.ref),\n relation: text(\"relation\").notNull(),\n },\n (table) => [\n primaryKey({ columns: [table.fromRef, table.toRef, table.relation] }),\n index(\"idx_links_from\").on(table.fromRef),\n index(\"idx_links_to\").on(table.toRef),\n ]\n);\n","/**\n * Manifest — file-based storage format for RoleX entities.\n *\n * Storage layout:\n * role/<id>/\n * individual.json — manifest (tree structure + links)\n * <id>.<type>.feature — node information (Gherkin)\n *\n * organization/<id>/\n * organization.json — manifest (tree structure + links)\n * <id>.<type>.feature — node information (Gherkin)\n *\n * Rules:\n * - Directories: only role/ and organization/ at top level\n * - Files: all [id].[type].feature, flat within the entity directory\n * - Manifest: tree structure in JSON, content in .feature files\n * - Nodes without explicit id default to their type name\n */\n\nimport type { State } from \"@rolexjs/system\";\n\n// ===== Manifest types =====\n\n/** A node in the manifest tree. */\nexport interface ManifestNode {\n readonly type: string;\n readonly ref?: string;\n readonly tag?: string;\n readonly children?: Record<string, ManifestNode>;\n readonly links?: Record<string, string[]>;\n}\n\n/** Root manifest for an entity (individual or organization). */\nexport interface Manifest {\n readonly id: string;\n readonly type: string;\n readonly ref?: string;\n readonly alias?: readonly string[];\n readonly children?: Record<string, ManifestNode>;\n readonly links?: Record<string, string[]>;\n}\n\n// ===== State → files =====\n\nexport interface FileEntry {\n readonly path: string;\n readonly content: string;\n}\n\n/**\n * Convert a State tree to a manifest + feature files.\n * Returns the manifest and a list of file entries (path → content).\n */\nexport function stateToFiles(state: State): { manifest: Manifest; files: FileEntry[] } {\n const files: FileEntry[] = [];\n\n const collectFiles = (node: State, nodeId: string) => {\n if (node.information) {\n files.push({\n path: `${nodeId}.${node.name}.feature`,\n content: node.information,\n });\n }\n if (node.children) {\n for (const child of node.children) {\n const childId = child.id ?? child.name;\n collectFiles(child, childId);\n }\n }\n };\n\n const rootId = state.id ?? state.name;\n collectFiles(state, rootId);\n\n const buildManifestNode = (node: State): ManifestNode => {\n const entry: ManifestNode = {\n type: node.name,\n ...(node.ref ? { ref: node.ref } : {}),\n ...(node.tag ? { tag: node.tag } : {}),\n ...(node.links && node.links.length > 0 ? { links: buildManifestLinks(node.links) } : {}),\n };\n if (node.children && node.children.length > 0) {\n const children: Record<string, ManifestNode> = {};\n for (const child of node.children) {\n const childId = child.id ?? child.name;\n children[childId] = buildManifestNode(child);\n }\n return { ...entry, children };\n }\n return entry;\n };\n\n const manifestNode = buildManifestNode(state);\n\n const manifest: Manifest = {\n id: rootId,\n type: state.name,\n ...(state.ref ? { ref: state.ref } : {}),\n ...(state.alias ? { alias: state.alias } : {}),\n ...(manifestNode.children ? { children: manifestNode.children } : {}),\n ...(state.links && state.links.length > 0\n ? {\n links: buildManifestLinks(state.links),\n }\n : {}),\n };\n\n return { manifest, files };\n}\n\nfunction buildManifestLinks(\n links: readonly { readonly relation: string; readonly target: State }[]\n): Record<string, string[]> {\n const result: Record<string, string[]> = {};\n for (const link of links) {\n const targetId = link.target.id ?? link.target.name;\n if (!result[link.relation]) {\n result[link.relation] = [];\n }\n result[link.relation].push(targetId);\n }\n return result;\n}\n\n// ===== Files → State =====\n\n/**\n * Convert a manifest + feature file contents to a State tree.\n * fileContents maps filename (e.g. \"role-creation.principle.feature\") to Gherkin text.\n */\nexport function filesToState(manifest: Manifest, fileContents: Record<string, string>): State {\n const buildState = (id: string, node: ManifestNode): State => {\n const filename = `${id}.${node.type}.feature`;\n const information = fileContents[filename];\n\n const children: State[] = [];\n if (node.children) {\n for (const [childId, childNode] of Object.entries(node.children)) {\n children.push(buildState(childId, childNode));\n }\n }\n\n const nodeLinks: { relation: string; target: State }[] = [];\n if (node.links) {\n for (const [relation, targetIds] of Object.entries(node.links)) {\n for (const targetId of targetIds) {\n nodeLinks.push({\n relation,\n target: { id: targetId, name: \"\", description: \"\", parent: null },\n });\n }\n }\n }\n\n return {\n ...(node.ref ? { ref: node.ref } : {}),\n id,\n name: node.type,\n description: \"\",\n parent: null,\n ...(node.tag ? { tag: node.tag } : {}),\n ...(information ? { information } : {}),\n ...(children.length > 0 ? { children } : {}),\n ...(nodeLinks.length > 0 ? { links: nodeLinks } : {}),\n };\n };\n\n const rootFilename = `${manifest.id}.${manifest.type}.feature`;\n const rootInformation = fileContents[rootFilename];\n\n const children: State[] = [];\n if (manifest.children) {\n for (const [childId, childNode] of Object.entries(manifest.children)) {\n children.push(buildState(childId, childNode));\n }\n }\n\n const links: { relation: string; target: State }[] = [];\n if (manifest.links) {\n for (const [relation, targetIds] of Object.entries(manifest.links)) {\n for (const targetId of targetIds) {\n links.push({\n relation,\n target: {\n id: targetId,\n name: \"\",\n description: \"\",\n parent: null,\n },\n });\n }\n }\n }\n\n return {\n ...(manifest.ref ? { ref: manifest.ref } : {}),\n id: manifest.id,\n ...(manifest.alias ? { alias: manifest.alias } : {}),\n name: manifest.type,\n description: \"\",\n parent: null,\n ...(rootInformation ? { information: rootInformation } : {}),\n ...(children.length > 0 ? { children } : {}),\n ...(links.length > 0 ? { links } : {}),\n };\n}\n"],"mappings":";AASA,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,eAAe;AACxB,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB,0BAA0B;AACnD,SAAS,oBAAoB;;;ACL7B,SAAS,WAAW;;;ACDpB,SAAS,KAAK,IAAI,cAAc;;;ACDhC,SAAS,OAAO,YAAY,aAAa,YAAY;AAe9C,IAAM,QAAQ;AAAA,EACnB;AAAA,EACA;AAAA,IACE,KAAK,KAAK,KAAK,EAAE,WAAW;AAAA,IAC5B,IAAI,KAAK,IAAI;AAAA,IACb,OAAO,KAAK,OAAO;AAAA;AAAA,IACnB,MAAM,KAAK,MAAM,EAAE,QAAQ;AAAA,IAC3B,aAAa,KAAK,aAAa,EAAE,QAAQ,EAAE;AAAA,IAC3C,WAAW,KAAK,YAAY,EAAE,WAAW,MAAW,MAAM,GAAG;AAAA,IAC7D,aAAa,KAAK,aAAa;AAA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,eAAe,GAAG,SAAS,EAAE,IAAI,SAAS,IAAI;AACpD,QAAM,kBAAkB,aAAa,YAAY;AAEjD,QAAM,WAAoB,CAAC;AAC3B,MAAI,SAAS,UAAU;AACrB,eAAW,CAAC,SAAS,SAAS,KAAK,OAAO,QAAQ,SAAS,QAAQ,GAAG;AACpE,eAAS,KAAK,WAAW,SAAS,SAAS,CAAC;AAAA,IAC9C;AAAA,EACF;AAEA,QAAMD,SAA+C,CAAC;AACtD,MAAI,SAAS,OAAO;AAClB,eAAW,CAAC,UAAU,SAAS,KAAK,OAAO,QAAQ,SAAS,KAAK,GAAG;AAClE,iBAAW,YAAY,WAAW;AAChC,QAAAA,OAAM,KAAK;AAAA,UACT;AAAA,UACA,QAAQ;AAAA,YACN,IAAI;AAAA,YACJ,MAAM;AAAA,YACN,aAAa;AAAA,YACb,QAAQ;AAAA,UACV;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,GAAI,SAAS,MAAM,EAAE,KAAK,SAAS,IAAI,IAAI,CAAC;AAAA,IAC5C,IAAI,SAAS;AAAA,IACb,GAAI,SAAS,QAAQ,EAAE,OAAO,SAAS,MAAM,IAAI,CAAC;AAAA,IAClD,MAAM,SAAS;AAAA,IACf,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,GAAI,kBAAkB,EAAE,aAAa,gBAAgB,IAAI,CAAC;AAAA,IAC1D,GAAI,SAAS,SAAS,IAAI,EAAE,SAAS,IAAI,CAAC;AAAA,IAC1C,GAAIA,OAAM,SAAS,IAAI,EAAE,OAAAA,OAAM,IAAI,CAAC;AAAA,EACtC;AACF;","names":["max","sql","links","children"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rolexjs/local-platform",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Local filesystem Platform for RoleX — stores roles in .rolex/ directories",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,18 +12,19 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
-
"dist"
|
|
16
|
-
"drizzle"
|
|
15
|
+
"dist"
|
|
17
16
|
],
|
|
18
17
|
"scripts": {
|
|
19
18
|
"build": "tsup",
|
|
20
19
|
"clean": "rm -rf dist"
|
|
21
20
|
},
|
|
22
21
|
"dependencies": {
|
|
23
|
-
"@deepracticex/drizzle": "^0.
|
|
22
|
+
"@deepracticex/drizzle": "^0.2.0",
|
|
24
23
|
"@deepracticex/sqlite": "^0.2.0",
|
|
25
|
-
"@
|
|
26
|
-
"@
|
|
24
|
+
"@issuexjs/node": "^0.2.0",
|
|
25
|
+
"@resourcexjs/node-provider": "^2.14.0",
|
|
26
|
+
"@rolexjs/core": "~1.6.0",
|
|
27
|
+
"@rolexjs/system": "~1.6.0",
|
|
27
28
|
"drizzle-orm": "^0.45.1"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {},
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
CREATE TABLE IF NOT EXISTS `contexts` (
|
|
2
|
-
`role_id` text PRIMARY KEY NOT NULL,
|
|
3
|
-
`focused_goal_id` text,
|
|
4
|
-
`focused_plan_id` text
|
|
5
|
-
);
|
|
6
|
-
--> statement-breakpoint
|
|
7
|
-
CREATE TABLE IF NOT EXISTS `links` (
|
|
8
|
-
`from_ref` text NOT NULL,
|
|
9
|
-
`to_ref` text NOT NULL,
|
|
10
|
-
`relation` text NOT NULL,
|
|
11
|
-
PRIMARY KEY(`from_ref`, `to_ref`, `relation`),
|
|
12
|
-
FOREIGN KEY (`from_ref`) REFERENCES `nodes`(`ref`) ON UPDATE no action ON DELETE no action,
|
|
13
|
-
FOREIGN KEY (`to_ref`) REFERENCES `nodes`(`ref`) ON UPDATE no action ON DELETE no action
|
|
14
|
-
);
|
|
15
|
-
--> statement-breakpoint
|
|
16
|
-
CREATE INDEX IF NOT EXISTS `idx_links_from` ON `links` (`from_ref`);--> statement-breakpoint
|
|
17
|
-
CREATE INDEX IF NOT EXISTS `idx_links_to` ON `links` (`to_ref`);--> statement-breakpoint
|
|
18
|
-
CREATE TABLE IF NOT EXISTS `nodes` (
|
|
19
|
-
`ref` text PRIMARY KEY NOT NULL,
|
|
20
|
-
`id` text,
|
|
21
|
-
`alias` text,
|
|
22
|
-
`name` text NOT NULL,
|
|
23
|
-
`description` text DEFAULT '',
|
|
24
|
-
`parent_ref` text,
|
|
25
|
-
`information` text,
|
|
26
|
-
`tag` text,
|
|
27
|
-
FOREIGN KEY (`parent_ref`) REFERENCES `nodes`(`ref`) ON UPDATE no action ON DELETE no action
|
|
28
|
-
);
|
|
29
|
-
--> statement-breakpoint
|
|
30
|
-
CREATE INDEX IF NOT EXISTS `idx_nodes_id` ON `nodes` (`id`);--> statement-breakpoint
|
|
31
|
-
CREATE INDEX IF NOT EXISTS `idx_nodes_name` ON `nodes` (`name`);--> statement-breakpoint
|
|
32
|
-
CREATE INDEX IF NOT EXISTS `idx_nodes_parent_ref` ON `nodes` (`parent_ref`);--> statement-breakpoint
|
|
33
|
-
CREATE TABLE IF NOT EXISTS `prototype_migrations` (
|
|
34
|
-
`prototype_id` text NOT NULL,
|
|
35
|
-
`migration_id` text NOT NULL,
|
|
36
|
-
`checksum` text NOT NULL,
|
|
37
|
-
`executed_at` text NOT NULL,
|
|
38
|
-
PRIMARY KEY(`prototype_id`, `migration_id`)
|
|
39
|
-
);
|
|
40
|
-
--> statement-breakpoint
|
|
41
|
-
CREATE TABLE IF NOT EXISTS `prototypes` (
|
|
42
|
-
`id` text PRIMARY KEY NOT NULL,
|
|
43
|
-
`source` text NOT NULL
|
|
44
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ALTER TABLE `prototype_migrations` ADD `version` integer NOT NULL DEFAULT 0;
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "6",
|
|
3
|
-
"dialect": "sqlite",
|
|
4
|
-
"id": "86f29a5e-3324-4b28-8b2a-b022b6d19fde",
|
|
5
|
-
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
6
|
-
"tables": {
|
|
7
|
-
"contexts": {
|
|
8
|
-
"name": "contexts",
|
|
9
|
-
"columns": {
|
|
10
|
-
"role_id": {
|
|
11
|
-
"name": "role_id",
|
|
12
|
-
"type": "text",
|
|
13
|
-
"primaryKey": true,
|
|
14
|
-
"notNull": true,
|
|
15
|
-
"autoincrement": false
|
|
16
|
-
},
|
|
17
|
-
"focused_goal_id": {
|
|
18
|
-
"name": "focused_goal_id",
|
|
19
|
-
"type": "text",
|
|
20
|
-
"primaryKey": false,
|
|
21
|
-
"notNull": false,
|
|
22
|
-
"autoincrement": false
|
|
23
|
-
},
|
|
24
|
-
"focused_plan_id": {
|
|
25
|
-
"name": "focused_plan_id",
|
|
26
|
-
"type": "text",
|
|
27
|
-
"primaryKey": false,
|
|
28
|
-
"notNull": false,
|
|
29
|
-
"autoincrement": false
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"indexes": {},
|
|
33
|
-
"foreignKeys": {},
|
|
34
|
-
"compositePrimaryKeys": {},
|
|
35
|
-
"uniqueConstraints": {},
|
|
36
|
-
"checkConstraints": {}
|
|
37
|
-
},
|
|
38
|
-
"links": {
|
|
39
|
-
"name": "links",
|
|
40
|
-
"columns": {
|
|
41
|
-
"from_ref": {
|
|
42
|
-
"name": "from_ref",
|
|
43
|
-
"type": "text",
|
|
44
|
-
"primaryKey": false,
|
|
45
|
-
"notNull": true,
|
|
46
|
-
"autoincrement": false
|
|
47
|
-
},
|
|
48
|
-
"to_ref": {
|
|
49
|
-
"name": "to_ref",
|
|
50
|
-
"type": "text",
|
|
51
|
-
"primaryKey": false,
|
|
52
|
-
"notNull": true,
|
|
53
|
-
"autoincrement": false
|
|
54
|
-
},
|
|
55
|
-
"relation": {
|
|
56
|
-
"name": "relation",
|
|
57
|
-
"type": "text",
|
|
58
|
-
"primaryKey": false,
|
|
59
|
-
"notNull": true,
|
|
60
|
-
"autoincrement": false
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
"indexes": {
|
|
64
|
-
"idx_links_from": {
|
|
65
|
-
"name": "idx_links_from",
|
|
66
|
-
"columns": ["from_ref"],
|
|
67
|
-
"isUnique": false
|
|
68
|
-
},
|
|
69
|
-
"idx_links_to": {
|
|
70
|
-
"name": "idx_links_to",
|
|
71
|
-
"columns": ["to_ref"],
|
|
72
|
-
"isUnique": false
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
"foreignKeys": {
|
|
76
|
-
"links_from_ref_nodes_ref_fk": {
|
|
77
|
-
"name": "links_from_ref_nodes_ref_fk",
|
|
78
|
-
"tableFrom": "links",
|
|
79
|
-
"tableTo": "nodes",
|
|
80
|
-
"columnsFrom": ["from_ref"],
|
|
81
|
-
"columnsTo": ["ref"],
|
|
82
|
-
"onDelete": "no action",
|
|
83
|
-
"onUpdate": "no action"
|
|
84
|
-
},
|
|
85
|
-
"links_to_ref_nodes_ref_fk": {
|
|
86
|
-
"name": "links_to_ref_nodes_ref_fk",
|
|
87
|
-
"tableFrom": "links",
|
|
88
|
-
"tableTo": "nodes",
|
|
89
|
-
"columnsFrom": ["to_ref"],
|
|
90
|
-
"columnsTo": ["ref"],
|
|
91
|
-
"onDelete": "no action",
|
|
92
|
-
"onUpdate": "no action"
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
"compositePrimaryKeys": {
|
|
96
|
-
"links_from_ref_to_ref_relation_pk": {
|
|
97
|
-
"columns": ["from_ref", "to_ref", "relation"],
|
|
98
|
-
"name": "links_from_ref_to_ref_relation_pk"
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
"uniqueConstraints": {},
|
|
102
|
-
"checkConstraints": {}
|
|
103
|
-
},
|
|
104
|
-
"nodes": {
|
|
105
|
-
"name": "nodes",
|
|
106
|
-
"columns": {
|
|
107
|
-
"ref": {
|
|
108
|
-
"name": "ref",
|
|
109
|
-
"type": "text",
|
|
110
|
-
"primaryKey": true,
|
|
111
|
-
"notNull": true,
|
|
112
|
-
"autoincrement": false
|
|
113
|
-
},
|
|
114
|
-
"id": {
|
|
115
|
-
"name": "id",
|
|
116
|
-
"type": "text",
|
|
117
|
-
"primaryKey": false,
|
|
118
|
-
"notNull": false,
|
|
119
|
-
"autoincrement": false
|
|
120
|
-
},
|
|
121
|
-
"alias": {
|
|
122
|
-
"name": "alias",
|
|
123
|
-
"type": "text",
|
|
124
|
-
"primaryKey": false,
|
|
125
|
-
"notNull": false,
|
|
126
|
-
"autoincrement": false
|
|
127
|
-
},
|
|
128
|
-
"name": {
|
|
129
|
-
"name": "name",
|
|
130
|
-
"type": "text",
|
|
131
|
-
"primaryKey": false,
|
|
132
|
-
"notNull": true,
|
|
133
|
-
"autoincrement": false
|
|
134
|
-
},
|
|
135
|
-
"description": {
|
|
136
|
-
"name": "description",
|
|
137
|
-
"type": "text",
|
|
138
|
-
"primaryKey": false,
|
|
139
|
-
"notNull": false,
|
|
140
|
-
"autoincrement": false,
|
|
141
|
-
"default": "''"
|
|
142
|
-
},
|
|
143
|
-
"parent_ref": {
|
|
144
|
-
"name": "parent_ref",
|
|
145
|
-
"type": "text",
|
|
146
|
-
"primaryKey": false,
|
|
147
|
-
"notNull": false,
|
|
148
|
-
"autoincrement": false
|
|
149
|
-
},
|
|
150
|
-
"information": {
|
|
151
|
-
"name": "information",
|
|
152
|
-
"type": "text",
|
|
153
|
-
"primaryKey": false,
|
|
154
|
-
"notNull": false,
|
|
155
|
-
"autoincrement": false
|
|
156
|
-
},
|
|
157
|
-
"tag": {
|
|
158
|
-
"name": "tag",
|
|
159
|
-
"type": "text",
|
|
160
|
-
"primaryKey": false,
|
|
161
|
-
"notNull": false,
|
|
162
|
-
"autoincrement": false
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
"indexes": {
|
|
166
|
-
"idx_nodes_id": {
|
|
167
|
-
"name": "idx_nodes_id",
|
|
168
|
-
"columns": ["id"],
|
|
169
|
-
"isUnique": false
|
|
170
|
-
},
|
|
171
|
-
"idx_nodes_name": {
|
|
172
|
-
"name": "idx_nodes_name",
|
|
173
|
-
"columns": ["name"],
|
|
174
|
-
"isUnique": false
|
|
175
|
-
},
|
|
176
|
-
"idx_nodes_parent_ref": {
|
|
177
|
-
"name": "idx_nodes_parent_ref",
|
|
178
|
-
"columns": ["parent_ref"],
|
|
179
|
-
"isUnique": false
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
"foreignKeys": {
|
|
183
|
-
"nodes_parent_ref_nodes_ref_fk": {
|
|
184
|
-
"name": "nodes_parent_ref_nodes_ref_fk",
|
|
185
|
-
"tableFrom": "nodes",
|
|
186
|
-
"tableTo": "nodes",
|
|
187
|
-
"columnsFrom": ["parent_ref"],
|
|
188
|
-
"columnsTo": ["ref"],
|
|
189
|
-
"onDelete": "no action",
|
|
190
|
-
"onUpdate": "no action"
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
"compositePrimaryKeys": {},
|
|
194
|
-
"uniqueConstraints": {},
|
|
195
|
-
"checkConstraints": {}
|
|
196
|
-
},
|
|
197
|
-
"prototype_migrations": {
|
|
198
|
-
"name": "prototype_migrations",
|
|
199
|
-
"columns": {
|
|
200
|
-
"prototype_id": {
|
|
201
|
-
"name": "prototype_id",
|
|
202
|
-
"type": "text",
|
|
203
|
-
"primaryKey": false,
|
|
204
|
-
"notNull": true,
|
|
205
|
-
"autoincrement": false
|
|
206
|
-
},
|
|
207
|
-
"migration_id": {
|
|
208
|
-
"name": "migration_id",
|
|
209
|
-
"type": "text",
|
|
210
|
-
"primaryKey": false,
|
|
211
|
-
"notNull": true,
|
|
212
|
-
"autoincrement": false
|
|
213
|
-
},
|
|
214
|
-
"checksum": {
|
|
215
|
-
"name": "checksum",
|
|
216
|
-
"type": "text",
|
|
217
|
-
"primaryKey": false,
|
|
218
|
-
"notNull": true,
|
|
219
|
-
"autoincrement": false
|
|
220
|
-
},
|
|
221
|
-
"executed_at": {
|
|
222
|
-
"name": "executed_at",
|
|
223
|
-
"type": "text",
|
|
224
|
-
"primaryKey": false,
|
|
225
|
-
"notNull": true,
|
|
226
|
-
"autoincrement": false
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
"indexes": {},
|
|
230
|
-
"foreignKeys": {},
|
|
231
|
-
"compositePrimaryKeys": {
|
|
232
|
-
"prototype_migrations_prototype_id_migration_id_pk": {
|
|
233
|
-
"columns": ["prototype_id", "migration_id"],
|
|
234
|
-
"name": "prototype_migrations_prototype_id_migration_id_pk"
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
|
-
"uniqueConstraints": {},
|
|
238
|
-
"checkConstraints": {}
|
|
239
|
-
},
|
|
240
|
-
"prototypes": {
|
|
241
|
-
"name": "prototypes",
|
|
242
|
-
"columns": {
|
|
243
|
-
"id": {
|
|
244
|
-
"name": "id",
|
|
245
|
-
"type": "text",
|
|
246
|
-
"primaryKey": true,
|
|
247
|
-
"notNull": true,
|
|
248
|
-
"autoincrement": false
|
|
249
|
-
},
|
|
250
|
-
"source": {
|
|
251
|
-
"name": "source",
|
|
252
|
-
"type": "text",
|
|
253
|
-
"primaryKey": false,
|
|
254
|
-
"notNull": true,
|
|
255
|
-
"autoincrement": false
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
"indexes": {},
|
|
259
|
-
"foreignKeys": {},
|
|
260
|
-
"compositePrimaryKeys": {},
|
|
261
|
-
"uniqueConstraints": {},
|
|
262
|
-
"checkConstraints": {}
|
|
263
|
-
}
|
|
264
|
-
},
|
|
265
|
-
"views": {},
|
|
266
|
-
"enums": {},
|
|
267
|
-
"_meta": {
|
|
268
|
-
"schemas": {},
|
|
269
|
-
"tables": {},
|
|
270
|
-
"columns": {}
|
|
271
|
-
},
|
|
272
|
-
"internal": {
|
|
273
|
-
"indexes": {}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "6",
|
|
3
|
-
"dialect": "sqlite",
|
|
4
|
-
"id": "66a1f576-4d19-430a-a848-ed8256da44ae",
|
|
5
|
-
"prevId": "86f29a5e-3324-4b28-8b2a-b022b6d19fde",
|
|
6
|
-
"tables": {
|
|
7
|
-
"contexts": {
|
|
8
|
-
"name": "contexts",
|
|
9
|
-
"columns": {
|
|
10
|
-
"role_id": {
|
|
11
|
-
"name": "role_id",
|
|
12
|
-
"type": "text",
|
|
13
|
-
"primaryKey": true,
|
|
14
|
-
"notNull": true,
|
|
15
|
-
"autoincrement": false
|
|
16
|
-
},
|
|
17
|
-
"focused_goal_id": {
|
|
18
|
-
"name": "focused_goal_id",
|
|
19
|
-
"type": "text",
|
|
20
|
-
"primaryKey": false,
|
|
21
|
-
"notNull": false,
|
|
22
|
-
"autoincrement": false
|
|
23
|
-
},
|
|
24
|
-
"focused_plan_id": {
|
|
25
|
-
"name": "focused_plan_id",
|
|
26
|
-
"type": "text",
|
|
27
|
-
"primaryKey": false,
|
|
28
|
-
"notNull": false,
|
|
29
|
-
"autoincrement": false
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"indexes": {},
|
|
33
|
-
"foreignKeys": {},
|
|
34
|
-
"compositePrimaryKeys": {},
|
|
35
|
-
"uniqueConstraints": {},
|
|
36
|
-
"checkConstraints": {}
|
|
37
|
-
},
|
|
38
|
-
"links": {
|
|
39
|
-
"name": "links",
|
|
40
|
-
"columns": {
|
|
41
|
-
"from_ref": {
|
|
42
|
-
"name": "from_ref",
|
|
43
|
-
"type": "text",
|
|
44
|
-
"primaryKey": false,
|
|
45
|
-
"notNull": true,
|
|
46
|
-
"autoincrement": false
|
|
47
|
-
},
|
|
48
|
-
"to_ref": {
|
|
49
|
-
"name": "to_ref",
|
|
50
|
-
"type": "text",
|
|
51
|
-
"primaryKey": false,
|
|
52
|
-
"notNull": true,
|
|
53
|
-
"autoincrement": false
|
|
54
|
-
},
|
|
55
|
-
"relation": {
|
|
56
|
-
"name": "relation",
|
|
57
|
-
"type": "text",
|
|
58
|
-
"primaryKey": false,
|
|
59
|
-
"notNull": true,
|
|
60
|
-
"autoincrement": false
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
"indexes": {
|
|
64
|
-
"idx_links_from": {
|
|
65
|
-
"name": "idx_links_from",
|
|
66
|
-
"columns": ["from_ref"],
|
|
67
|
-
"isUnique": false
|
|
68
|
-
},
|
|
69
|
-
"idx_links_to": {
|
|
70
|
-
"name": "idx_links_to",
|
|
71
|
-
"columns": ["to_ref"],
|
|
72
|
-
"isUnique": false
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
"foreignKeys": {
|
|
76
|
-
"links_from_ref_nodes_ref_fk": {
|
|
77
|
-
"name": "links_from_ref_nodes_ref_fk",
|
|
78
|
-
"tableFrom": "links",
|
|
79
|
-
"tableTo": "nodes",
|
|
80
|
-
"columnsFrom": ["from_ref"],
|
|
81
|
-
"columnsTo": ["ref"],
|
|
82
|
-
"onDelete": "no action",
|
|
83
|
-
"onUpdate": "no action"
|
|
84
|
-
},
|
|
85
|
-
"links_to_ref_nodes_ref_fk": {
|
|
86
|
-
"name": "links_to_ref_nodes_ref_fk",
|
|
87
|
-
"tableFrom": "links",
|
|
88
|
-
"tableTo": "nodes",
|
|
89
|
-
"columnsFrom": ["to_ref"],
|
|
90
|
-
"columnsTo": ["ref"],
|
|
91
|
-
"onDelete": "no action",
|
|
92
|
-
"onUpdate": "no action"
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
"compositePrimaryKeys": {
|
|
96
|
-
"links_from_ref_to_ref_relation_pk": {
|
|
97
|
-
"columns": ["from_ref", "to_ref", "relation"],
|
|
98
|
-
"name": "links_from_ref_to_ref_relation_pk"
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
"uniqueConstraints": {},
|
|
102
|
-
"checkConstraints": {}
|
|
103
|
-
},
|
|
104
|
-
"nodes": {
|
|
105
|
-
"name": "nodes",
|
|
106
|
-
"columns": {
|
|
107
|
-
"ref": {
|
|
108
|
-
"name": "ref",
|
|
109
|
-
"type": "text",
|
|
110
|
-
"primaryKey": true,
|
|
111
|
-
"notNull": true,
|
|
112
|
-
"autoincrement": false
|
|
113
|
-
},
|
|
114
|
-
"id": {
|
|
115
|
-
"name": "id",
|
|
116
|
-
"type": "text",
|
|
117
|
-
"primaryKey": false,
|
|
118
|
-
"notNull": false,
|
|
119
|
-
"autoincrement": false
|
|
120
|
-
},
|
|
121
|
-
"alias": {
|
|
122
|
-
"name": "alias",
|
|
123
|
-
"type": "text",
|
|
124
|
-
"primaryKey": false,
|
|
125
|
-
"notNull": false,
|
|
126
|
-
"autoincrement": false
|
|
127
|
-
},
|
|
128
|
-
"name": {
|
|
129
|
-
"name": "name",
|
|
130
|
-
"type": "text",
|
|
131
|
-
"primaryKey": false,
|
|
132
|
-
"notNull": true,
|
|
133
|
-
"autoincrement": false
|
|
134
|
-
},
|
|
135
|
-
"description": {
|
|
136
|
-
"name": "description",
|
|
137
|
-
"type": "text",
|
|
138
|
-
"primaryKey": false,
|
|
139
|
-
"notNull": false,
|
|
140
|
-
"autoincrement": false,
|
|
141
|
-
"default": "''"
|
|
142
|
-
},
|
|
143
|
-
"parent_ref": {
|
|
144
|
-
"name": "parent_ref",
|
|
145
|
-
"type": "text",
|
|
146
|
-
"primaryKey": false,
|
|
147
|
-
"notNull": false,
|
|
148
|
-
"autoincrement": false
|
|
149
|
-
},
|
|
150
|
-
"information": {
|
|
151
|
-
"name": "information",
|
|
152
|
-
"type": "text",
|
|
153
|
-
"primaryKey": false,
|
|
154
|
-
"notNull": false,
|
|
155
|
-
"autoincrement": false
|
|
156
|
-
},
|
|
157
|
-
"tag": {
|
|
158
|
-
"name": "tag",
|
|
159
|
-
"type": "text",
|
|
160
|
-
"primaryKey": false,
|
|
161
|
-
"notNull": false,
|
|
162
|
-
"autoincrement": false
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
"indexes": {
|
|
166
|
-
"idx_nodes_id": {
|
|
167
|
-
"name": "idx_nodes_id",
|
|
168
|
-
"columns": ["id"],
|
|
169
|
-
"isUnique": false
|
|
170
|
-
},
|
|
171
|
-
"idx_nodes_name": {
|
|
172
|
-
"name": "idx_nodes_name",
|
|
173
|
-
"columns": ["name"],
|
|
174
|
-
"isUnique": false
|
|
175
|
-
},
|
|
176
|
-
"idx_nodes_parent_ref": {
|
|
177
|
-
"name": "idx_nodes_parent_ref",
|
|
178
|
-
"columns": ["parent_ref"],
|
|
179
|
-
"isUnique": false
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
"foreignKeys": {
|
|
183
|
-
"nodes_parent_ref_nodes_ref_fk": {
|
|
184
|
-
"name": "nodes_parent_ref_nodes_ref_fk",
|
|
185
|
-
"tableFrom": "nodes",
|
|
186
|
-
"tableTo": "nodes",
|
|
187
|
-
"columnsFrom": ["parent_ref"],
|
|
188
|
-
"columnsTo": ["ref"],
|
|
189
|
-
"onDelete": "no action",
|
|
190
|
-
"onUpdate": "no action"
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
"compositePrimaryKeys": {},
|
|
194
|
-
"uniqueConstraints": {},
|
|
195
|
-
"checkConstraints": {}
|
|
196
|
-
},
|
|
197
|
-
"prototype_migrations": {
|
|
198
|
-
"name": "prototype_migrations",
|
|
199
|
-
"columns": {
|
|
200
|
-
"prototype_id": {
|
|
201
|
-
"name": "prototype_id",
|
|
202
|
-
"type": "text",
|
|
203
|
-
"primaryKey": false,
|
|
204
|
-
"notNull": true,
|
|
205
|
-
"autoincrement": false
|
|
206
|
-
},
|
|
207
|
-
"migration_id": {
|
|
208
|
-
"name": "migration_id",
|
|
209
|
-
"type": "text",
|
|
210
|
-
"primaryKey": false,
|
|
211
|
-
"notNull": true,
|
|
212
|
-
"autoincrement": false
|
|
213
|
-
},
|
|
214
|
-
"version": {
|
|
215
|
-
"name": "version",
|
|
216
|
-
"type": "integer",
|
|
217
|
-
"primaryKey": false,
|
|
218
|
-
"notNull": true,
|
|
219
|
-
"autoincrement": false
|
|
220
|
-
},
|
|
221
|
-
"checksum": {
|
|
222
|
-
"name": "checksum",
|
|
223
|
-
"type": "text",
|
|
224
|
-
"primaryKey": false,
|
|
225
|
-
"notNull": true,
|
|
226
|
-
"autoincrement": false
|
|
227
|
-
},
|
|
228
|
-
"executed_at": {
|
|
229
|
-
"name": "executed_at",
|
|
230
|
-
"type": "text",
|
|
231
|
-
"primaryKey": false,
|
|
232
|
-
"notNull": true,
|
|
233
|
-
"autoincrement": false
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
"indexes": {},
|
|
237
|
-
"foreignKeys": {},
|
|
238
|
-
"compositePrimaryKeys": {
|
|
239
|
-
"prototype_migrations_prototype_id_migration_id_pk": {
|
|
240
|
-
"columns": ["prototype_id", "migration_id"],
|
|
241
|
-
"name": "prototype_migrations_prototype_id_migration_id_pk"
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
"uniqueConstraints": {},
|
|
245
|
-
"checkConstraints": {}
|
|
246
|
-
},
|
|
247
|
-
"prototypes": {
|
|
248
|
-
"name": "prototypes",
|
|
249
|
-
"columns": {
|
|
250
|
-
"id": {
|
|
251
|
-
"name": "id",
|
|
252
|
-
"type": "text",
|
|
253
|
-
"primaryKey": true,
|
|
254
|
-
"notNull": true,
|
|
255
|
-
"autoincrement": false
|
|
256
|
-
},
|
|
257
|
-
"source": {
|
|
258
|
-
"name": "source",
|
|
259
|
-
"type": "text",
|
|
260
|
-
"primaryKey": false,
|
|
261
|
-
"notNull": true,
|
|
262
|
-
"autoincrement": false
|
|
263
|
-
}
|
|
264
|
-
},
|
|
265
|
-
"indexes": {},
|
|
266
|
-
"foreignKeys": {},
|
|
267
|
-
"compositePrimaryKeys": {},
|
|
268
|
-
"uniqueConstraints": {},
|
|
269
|
-
"checkConstraints": {}
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
"views": {},
|
|
273
|
-
"enums": {},
|
|
274
|
-
"_meta": {
|
|
275
|
-
"schemas": {},
|
|
276
|
-
"tables": {},
|
|
277
|
-
"columns": {}
|
|
278
|
-
},
|
|
279
|
-
"internal": {
|
|
280
|
-
"indexes": {}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "7",
|
|
3
|
-
"dialect": "sqlite",
|
|
4
|
-
"entries": [
|
|
5
|
-
{
|
|
6
|
-
"idx": 0,
|
|
7
|
-
"version": "6",
|
|
8
|
-
"when": 1772631387631,
|
|
9
|
-
"tag": "0000_spooky_amazoness",
|
|
10
|
-
"breakpoints": true
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"idx": 1,
|
|
14
|
-
"version": "6",
|
|
15
|
-
"when": 1772634146909,
|
|
16
|
-
"tag": "0001_slimy_joystick",
|
|
17
|
-
"breakpoints": true
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|