sekejap 0.16.0 → 0.16.2

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/index.d.ts CHANGED
@@ -18,6 +18,21 @@ export declare class Db {
18
18
  query(sql: string): string
19
19
  /** Parameterized SELECT ($1, $2, …); `paramsJson` is a JSON array string. */
20
20
  queryParams(sql: string, paramsJson: string): string
21
+ /**
22
+ * Parameterized mutating statement ($1, $2, …); `paramsJson` is a JSON array
23
+ * string. Returns affected rows. The typed layer's update/delete lower here.
24
+ */
25
+ executeParams(sql: string, paramsJson: string): number
26
+ /**
27
+ * Subscribe to the change feed. `callback` is invoked once per committed
28
+ * mutation (a transaction fires once, at COMMIT) with a JSON string
29
+ * `{"collections":[…],"keys":[…],"edge_types":[…]}`. Returns a subscription
30
+ * id; pass it to [`unwatch`] to stop. The napi ThreadsafeFunction marshals
31
+ * the call onto the JS event loop, so no manual threading is needed.
32
+ */
33
+ watch(callback: (arg: string) => any): number
34
+ /** Stop a change-feed subscription created by [`watch`]. */
35
+ unwatch(id: number): void
21
36
  /** Compile a query once for repeated execution — a prepared statement. */
22
37
  prepare(sql: string): PreparedStatement
23
38
  /**
@@ -35,6 +50,89 @@ export declare class Db {
35
50
  edgeCount(): number
36
51
  /** Compact: truncate WAL, rewrite payloads/topology, reclaim RAM. */
37
52
  compact(): void
53
+ /**
54
+ * Open an existing database in paged mode: identity/topology served from
55
+ * memory-mapped files — small open time and resident memory at any size.
56
+ */
57
+ static openPaged(path: string): Db
58
+ /** Open an existing database read-only. */
59
+ static openReadOnly(path: string): Db
60
+ /** A node's raw JSON payload, or null. */
61
+ get(slug: string): string | null
62
+ /** True if the node exists. */
63
+ contains(slug: string): boolean
64
+ /** Delete a node (and its edges). */
65
+ remove(slug: string): void
66
+ /**
67
+ * Store many nodes in one batch (single disk sync).
68
+ * `pairsJson` is a JSON array of `[slug, payloadJson]` pairs.
69
+ */
70
+ putMany(pairsJson: string): number
71
+ /** Begin a bulk-load scope (defer the per-write disk sync). Pair with `endBulk`. */
72
+ beginBulk(): void
73
+ /** End a bulk-load scope: one disk sync for the whole batch. */
74
+ endBulk(): void
75
+ /** Store an embedding under a named field of a node. */
76
+ putVector(slug: string, field: string, data: Array<number>): void
77
+ /** The stored embedding for a node's field, or null. */
78
+ getVector(slug: string, field: string): Array<number> | null
79
+ /** Create an edge with JSON attributes (primitives ride fast columns). */
80
+ linkMeta(from: string, to: string, edgeType: string, metaJson: string): void
81
+ /**
82
+ * Create many edges in one batch (single disk sync).
83
+ * `edgesJson` is a JSON array of `[from, to, edgeType]` triples.
84
+ */
85
+ linkMany(edgesJson: string): void
86
+ /** Remove a directed edge. */
87
+ unlink(from: string, to: string, edgeType: string): void
88
+ /**
89
+ * Remove edges matching attribute equality conditions (`propsJson` is a
90
+ * JSON object). Returns how many were removed.
91
+ */
92
+ unlinkWhere(from: string, to: string, edgeType: string, propsJson: string): number
93
+ /**
94
+ * Update attributes on matching edges: `propsJson` selects, `setsJson`
95
+ * assigns. Returns how many were updated.
96
+ */
97
+ updateEdge(from: string, to: string, edgeType: string, propsJson: string, setsJson: string): number
98
+ /**
99
+ * Edges leaving a node, as a JSON-array string of
100
+ * `{from, to, type, meta}` objects.
101
+ */
102
+ edgesFrom(slug: string): string
103
+ /** Edges arriving at a node, same shape as `edgesFrom`. */
104
+ edgesTo(slug: string): string
105
+ /** Edges from one collection to another, same shape as `edgesFrom`. */
106
+ edgesBetween(fromCollection: string, toCollection: string): string
107
+ /** All collection names. */
108
+ collectionNames(): Array<string>
109
+ /** Every node slug. */
110
+ allSlugs(): Array<string>
111
+ /** DDL string for a collection schema, or null. */
112
+ schemaDdl(collection: string): string | null
113
+ /**
114
+ * Ranked text search over a BM25-indexed field: JSON-array string of
115
+ * `[slug, score]` pairs, best first.
116
+ */
117
+ bm25Search(field: string, query: string, topK: number): string
118
+ /**
119
+ * The query plan for a statement, as a JSON-array string (one step per
120
+ * element). `analyze = true` also executes it and adds per-step timings.
121
+ */
122
+ explain(sql: string, analyze?: boolean | undefined | null): string
123
+ /** Run a SHOW statement (`SHOW TABLES`, `SHOW EDGES`, …); JSON-array string. */
124
+ show(sql: string): string
125
+ /** Shrink resident memory to the live working set (never drops indexes). */
126
+ trimMemory(): void
127
+ /** Per-structure resident-memory estimate, as a JSON object string. */
128
+ memoryReport(): string
129
+ /** Override HNSW search breadth (`efSearch`); null restores the default. */
130
+ setHnswEfSearch(ef?: number | undefined | null): void
131
+ /**
132
+ * Close the database and release its lock. Further calls error (or no-op
133
+ * for count/list getters). Safe to call twice.
134
+ */
135
+ close(): void
38
136
  }
39
137
  /** A prepared (compiled) query — from `Db.prepare`, run with `Db.queryPrepared`. */
40
138
  export declare class PreparedStatement { }
package/package.json CHANGED
@@ -1,24 +1,76 @@
1
1
  {
2
2
  "name": "sekejap",
3
- "version": "0.16.0",
4
- "description": "Embedded graph-first multi-model database — Node.js binding",
3
+ "version": "0.16.2",
4
+ "description": "Embedded graph-first multi-model database — Node.js & React Native binding",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "repository": "github:sekejapdb/sekejap",
7
- "homepage": "https://sekejap.zebflow.com",
8
- "keywords": ["database", "graph", "vector", "spatial", "embedded", "multi-model"],
7
+ "homepage": "https://sekejap.life",
8
+ "keywords": [
9
+ "database",
10
+ "graph",
11
+ "vector",
12
+ "spatial",
13
+ "embedded",
14
+ "multi-model",
15
+ "typescript",
16
+ "react-native"
17
+ ],
9
18
  "main": "index.js",
10
19
  "types": "index.d.ts",
11
- "files": ["index.js", "index.d.ts", "*.node", "README.md"],
20
+ "exports": {
21
+ ".": {
22
+ "types": "./index.d.ts",
23
+ "default": "./index.js"
24
+ },
25
+ "./orm": {
26
+ "types": "./dist/index.d.ts",
27
+ "default": "./dist/index.js"
28
+ },
29
+ "./orm/react": {
30
+ "types": "./dist/react.d.ts",
31
+ "default": "./dist/react.js"
32
+ }
33
+ },
34
+ "files": [
35
+ "index.js",
36
+ "index.d.ts",
37
+ "*.node",
38
+ "dist/",
39
+ "README.md"
40
+ ],
12
41
  "napi": {
13
42
  "name": "sekejap"
14
43
  },
15
- "engines": { "node": ">= 16" },
16
- "os": ["darwin", "linux", "win32"],
17
- "cpu": ["x64", "arm64"],
44
+ "engines": {
45
+ "node": ">= 16"
46
+ },
47
+ "os": [
48
+ "darwin",
49
+ "linux",
50
+ "win32"
51
+ ],
52
+ "cpu": [
53
+ "x64",
54
+ "arm64"
55
+ ],
18
56
  "scripts": {
19
- "build": "napi build --platform --release"
57
+ "build": "napi build --platform --release",
58
+ "build:orm": "tsc -p orm/tsconfig.build.json",
59
+ "test:orm": "tsx orm/orm.test.ts"
60
+ },
61
+ "peerDependencies": {
62
+ "react": ">=17"
63
+ },
64
+ "peerDependenciesMeta": {
65
+ "react": {
66
+ "optional": true
67
+ }
20
68
  },
21
69
  "devDependencies": {
22
- "@napi-rs/cli": "^2.18.0"
70
+ "@napi-rs/cli": "^2.18.0",
71
+ "@types/node": "^20.19.43",
72
+ "@types/react": "^18.3.31",
73
+ "tsx": "^4.19.0",
74
+ "typescript": "^5.6.3"
23
75
  }
24
76
  }
Binary file
Binary file
Binary file
Binary file
Binary file