process-graph 1.0.5 → 1.1.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/README.md +85 -17
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +92 -0
- package/dist/cli.d.ts +512 -0
- package/dist/cli.js +3 -0
- package/dist/control-aDk9560d.js +294 -0
- package/dist/detail-panel-B1ZmMuJT.js +341 -0
- package/dist/dist-BpCBmnMl.js +582 -0
- package/dist/dist-HLlW8vgT.js +1388 -0
- package/dist/dist-IjrgWhHQ.js +3 -0
- package/dist/errors-BZe5WzCn.js +19 -0
- package/dist/exit-codes-0ultCqdS.js +23 -0
- package/dist/graphql-C1j5wQFz.d.ts +631 -0
- package/dist/index-CCfe0csl.d.ts +353 -0
- package/dist/index-CmZOswkx.d.ts +512 -0
- package/dist/index-CoA6vXqe.d.ts +404 -0
- package/dist/index-CptUHq6F.d.ts +58 -0
- package/dist/index-CrM5qWUA.d.ts +110 -0
- package/dist/index-DhbvDgK4.d.ts +1582 -0
- package/dist/index-DricKcyl.d.ts +421 -0
- package/dist/index.d.ts +111 -4
- package/dist/index.js +929 -5
- package/dist/layout-CCM-KBdp.js +307 -0
- package/dist/layout.d.ts +8 -0
- package/dist/layout.js +2 -0
- package/dist/node-AchI1T-K.js +40 -0
- package/dist/open-CyRXJ4bt.js +29 -0
- package/dist/parse-CuipC_2K.js +41 -0
- package/dist/queries-CCexJAE2.js +2202 -0
- package/dist/react-flow/style.css +658 -0
- package/dist/react-flow.d.ts +173 -0
- package/dist/react-flow.js +450 -0
- package/dist/react.d.ts +2 -0
- package/dist/react.js +107 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/router-D4gtTlXm.js +188 -0
- package/dist/schema-CVnS6HiX.js +234 -0
- package/dist/selection-BW_xXWOy.js +314 -0
- package/dist/source/github/node.d.ts +16 -0
- package/dist/source/github/node.js +2 -0
- package/dist/source/github.d.ts +49 -0
- package/dist/source/github.js +201 -0
- package/dist/source-DRDpEA8Q.js +1316 -0
- package/dist/status-Bm1CGu9C.js +11 -0
- package/dist/store/node.d.ts +24 -0
- package/dist/store/node.js +2 -0
- package/dist/store/wasm/worker.d.ts +16 -0
- package/dist/store/wasm/worker.js +98 -0
- package/dist/store/wasm.d.ts +9 -0
- package/dist/store/wasm.js +11 -0
- package/dist/store-BcR70CaO.js +1287 -0
- package/dist/store.d.ts +1328 -0
- package/dist/store.js +238 -0
- package/dist/ui/style.css +351 -0
- package/dist/ui.d.ts +235 -0
- package/dist/ui.js +2 -0
- package/dist/validate-DF3mQZww.js +125 -0
- package/package.json +148 -13
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region ../../core/graph/domain/dist/status.js
|
|
2
|
+
/** The derived states of an element, in the order the derivation considers them. */
|
|
3
|
+
const statuses = [
|
|
4
|
+
"done",
|
|
5
|
+
"unknown",
|
|
6
|
+
"skipped",
|
|
7
|
+
"ready",
|
|
8
|
+
"blocked"
|
|
9
|
+
];
|
|
10
|
+
//#endregion
|
|
11
|
+
export { statuses as t };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { b as GraphStore } from "../index-DhbvDgK4.js";
|
|
2
|
+
import { DatabaseSyncOptions } from "node:sqlite";
|
|
3
|
+
import { NodeSQLiteDatabase } from "drizzle-orm/node-sqlite";
|
|
4
|
+
//#region ../../adapters/graph/sqlite-node/dist/open.d.ts
|
|
5
|
+
/** An open store and the handles behind it. */
|
|
6
|
+
interface NodeGraphStore {
|
|
7
|
+
/** The store, to serve with `createGraphStoreRouter`. */
|
|
8
|
+
readonly store: GraphStore;
|
|
9
|
+
/** The Drizzle database the store runs on, for tools that read the tables directly. */
|
|
10
|
+
readonly db: NodeSQLiteDatabase;
|
|
11
|
+
/** Closes the database. The store must not be used afterwards. */
|
|
12
|
+
readonly close: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Opens a graph store on a SQLite database file, creating the file when it does not exist. The schema is migrated on the store's first operation.
|
|
16
|
+
*
|
|
17
|
+
* A file database is switched to write-ahead logging, so readers in other processes (a command line beside a server) are not blocked by a writer. Each process's change feed sees only its own writes.
|
|
18
|
+
* @param path - The database file, or `":memory:"` for a private database that lives as long as the store.
|
|
19
|
+
* @param options - `node:sqlite` options passed through unchanged, such as `timeout` for how long a write waits for another process's lock.
|
|
20
|
+
* @returns The store, its database and a way to close it.
|
|
21
|
+
*/
|
|
22
|
+
export declare const openNodeGraphStore: (path: string, options?: DatabaseSyncOptions) => NodeGraphStore;
|
|
23
|
+
//#endregion
|
|
24
|
+
export type { NodeGraphStore };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region ../../adapters/graph/sqlite-wasm/dist/worker.d.ts
|
|
2
|
+
/** Which database a worker serves. */
|
|
3
|
+
export interface GraphStoreWorkerOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The database's name. It names the OPFS `opfs-sahpool` pool (and so its directory), the Web Lock that serialises tabs, and the channel changes are shared on, so every worker in the origin given the same name serves the same database.
|
|
6
|
+
*/
|
|
7
|
+
readonly name: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Serves the graph store from inside a dedicated worker, to the page that started it, over oRPC's message-port transport. Call it once at the top level of the worker module; connect from the page with `connectGraphStore`.
|
|
11
|
+
*
|
|
12
|
+
* The SQLite module starts initialising at once and the first store operation waits for it. The database is opened only inside each store operation, under a Web Lock shared by every tab, so tabs take turns rather than failing; see `openWorkerDatabase`. Changes committed in any tab reach every tab's `changes` subscribers through a `BroadcastChannel`.
|
|
13
|
+
* @param options - Which database to serve.
|
|
14
|
+
*/
|
|
15
|
+
export declare const serveGraphStoreInWorker: (options: GraphStoreWorkerOptions) => void;
|
|
16
|
+
//#endregion
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { O as storeChangeSchema, h as ChangeFeed, t as createSqliteGraphStore } from "../../store-BcR70CaO.js";
|
|
2
|
+
import { t as createGraphStoreRouter } from "../../router-D4gtTlXm.js";
|
|
3
|
+
import sqlite3InitModule from "@sqlite.org/sqlite-wasm";
|
|
4
|
+
import { RPCHandler } from "@orpc/server/message-port";
|
|
5
|
+
import { drizzle } from "drizzle-orm/sqlite-proxy";
|
|
6
|
+
//#region ../../adapters/graph/sqlite-wasm/dist/database.js
|
|
7
|
+
/**
|
|
8
|
+
* Opens a database on the `opfs-sahpool` VFS so that any number of tabs, each with its own worker, can use it with no cross-origin isolation headers.
|
|
9
|
+
*
|
|
10
|
+
* A pool holds its OPFS sync access handles exclusively, so only one worker in the origin can have it open at a time. Each store operation therefore takes an exclusive Web Lock named after the pool, unpauses the pool (reacquiring its handles), opens the file, runs, then closes the file and pauses the pool (releasing them) before the lock is released. A Drizzle transaction is several statements, so the lock covers the whole store operation rather than each statement. The choice and the evidence for it are recorded in https://github.com/ExaDev/process-graph/issues/22.
|
|
11
|
+
* @param sqlite3 - The SQLite module, initialising; the first operation waits for it.
|
|
12
|
+
* @param location - The pool and file.
|
|
13
|
+
* @returns The database and its exclusivity.
|
|
14
|
+
*/
|
|
15
|
+
const openWorkerDatabase = (sqlite3, location) => {
|
|
16
|
+
let pool;
|
|
17
|
+
let open;
|
|
18
|
+
const db = drizzle(async (statement, params, method) => {
|
|
19
|
+
if (method === "get") throw new Error("The graph store's worker database does not serve get");
|
|
20
|
+
if (open === void 0) throw new Error("The database was used outside a store operation; only the store's exclusive section may run statements");
|
|
21
|
+
const rows = open.exec(statement, {
|
|
22
|
+
bind: params,
|
|
23
|
+
rowMode: "array",
|
|
24
|
+
returnValue: "resultRows"
|
|
25
|
+
});
|
|
26
|
+
return Promise.resolve({ rows });
|
|
27
|
+
});
|
|
28
|
+
const exclusive = async (operation) => navigator.locks.request(location.pool, { mode: "exclusive" }, async () => {
|
|
29
|
+
const installing = pool === void 0;
|
|
30
|
+
pool ??= sqlite3.then(async (module) => module.installOpfsSAHPoolVfs({ name: location.pool }));
|
|
31
|
+
const held = await pool;
|
|
32
|
+
if (!installing) await held.unpauseVfs();
|
|
33
|
+
open = new held.OpfsSAHPoolDb(location.file);
|
|
34
|
+
try {
|
|
35
|
+
return await operation();
|
|
36
|
+
} finally {
|
|
37
|
+
open.close();
|
|
38
|
+
open = void 0;
|
|
39
|
+
held.pauseVfs();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
db,
|
|
44
|
+
exclusive
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../../adapters/graph/sqlite-wasm/dist/feed.js
|
|
49
|
+
/**
|
|
50
|
+
* A change feed shared by every worker serving the same database in this origin: each change committed here is published locally and posted on a `BroadcastChannel`, and each change another worker posts there is published locally. Every tab's subscribers therefore hear every tab's writes.
|
|
51
|
+
*/
|
|
52
|
+
var BroadcastChangeFeed = class extends ChangeFeed {
|
|
53
|
+
#channel;
|
|
54
|
+
/**
|
|
55
|
+
* @param name - The channel name, one per database, so two databases in one origin do not hear each other.
|
|
56
|
+
*/
|
|
57
|
+
constructor(name) {
|
|
58
|
+
super();
|
|
59
|
+
this.#channel = new BroadcastChannel(name);
|
|
60
|
+
this.#channel.addEventListener("message", (event) => {
|
|
61
|
+
const parsed = storeChangeSchema.safeParse(event.data);
|
|
62
|
+
if (parsed.success) super.publish(parsed.data);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Publishes a change committed in this worker, here and to every other worker on the channel.
|
|
67
|
+
* @param change - The committed change.
|
|
68
|
+
*/
|
|
69
|
+
publish(change) {
|
|
70
|
+
super.publish(change);
|
|
71
|
+
this.#channel.postMessage(change);
|
|
72
|
+
}
|
|
73
|
+
/** Stops hearing and posting changes. */
|
|
74
|
+
close() {
|
|
75
|
+
this.#channel.close();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region ../../adapters/graph/sqlite-wasm/dist/worker.js
|
|
80
|
+
/**
|
|
81
|
+
* Serves the graph store from inside a dedicated worker, to the page that started it, over oRPC's message-port transport. Call it once at the top level of the worker module; connect from the page with `connectGraphStore`.
|
|
82
|
+
*
|
|
83
|
+
* The SQLite module starts initialising at once and the first store operation waits for it. The database is opened only inside each store operation, under a Web Lock shared by every tab, so tabs take turns rather than failing; see `openWorkerDatabase`. Changes committed in any tab reach every tab's `changes` subscribers through a `BroadcastChannel`.
|
|
84
|
+
* @param options - Which database to serve.
|
|
85
|
+
*/
|
|
86
|
+
const serveGraphStoreInWorker = (options) => {
|
|
87
|
+
const { db, exclusive } = openWorkerDatabase(sqlite3InitModule(), {
|
|
88
|
+
pool: options.name,
|
|
89
|
+
file: "/graph.sqlite3"
|
|
90
|
+
});
|
|
91
|
+
new RPCHandler(createGraphStoreRouter(createSqliteGraphStore({
|
|
92
|
+
db,
|
|
93
|
+
exclusive,
|
|
94
|
+
feed: new BroadcastChangeFeed(options.name)
|
|
95
|
+
}))).upgrade(self);
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
export { serveGraphStoreInWorker };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Q as GraphStoreClient } from "../index-DhbvDgK4.js";
|
|
2
|
+
//#region ../../adapters/graph/sqlite-wasm/dist/client.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* A client for the graph store a worker serves with `serveGraphStoreInWorker`. Every procedure of the contract is available, with its abort signal and typed errors, as if the store were in the page.
|
|
5
|
+
* @param worker - The dedicated worker running the store.
|
|
6
|
+
* @returns The store's oRPC client.
|
|
7
|
+
*/
|
|
8
|
+
export declare const connectGraphStore: (worker: Readonly<Worker>) => GraphStoreClient;
|
|
9
|
+
//#endregion
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createORPCClient } from "@orpc/client";
|
|
2
|
+
import { RPCLink } from "@orpc/client/message-port";
|
|
3
|
+
//#region ../../adapters/graph/sqlite-wasm/dist/client.js
|
|
4
|
+
/**
|
|
5
|
+
* A client for the graph store a worker serves with `serveGraphStoreInWorker`. Every procedure of the contract is available, with its abort signal and typed errors, as if the store were in the page.
|
|
6
|
+
* @param worker - The dedicated worker running the store.
|
|
7
|
+
* @returns The store's oRPC client.
|
|
8
|
+
*/
|
|
9
|
+
const connectGraphStore = (worker) => createORPCClient(new RPCLink({ port: worker }));
|
|
10
|
+
//#endregion
|
|
11
|
+
export { connectGraphStore };
|