@nicia-ai/typegraph 0.12.0 → 0.14.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/backend/postgres/index.cjs +28 -28
- package/dist/backend/postgres/index.d.cts +1 -1
- package/dist/backend/postgres/index.d.ts +1 -1
- package/dist/backend/postgres/index.js +4 -4
- package/dist/backend/sqlite/index.cjs +14 -14
- package/dist/backend/sqlite/index.d.cts +1 -1
- package/dist/backend/sqlite/index.d.ts +1 -1
- package/dist/backend/sqlite/index.js +4 -4
- package/dist/backend/sqlite/local.cjs +7 -7
- package/dist/backend/sqlite/local.d.cts +1 -1
- package/dist/backend/sqlite/local.d.ts +1 -1
- package/dist/backend/sqlite/local.js +4 -4
- package/dist/{chunk-U3452TEU.js → chunk-6GWJH6AR.js} +15 -27
- package/dist/chunk-6GWJH6AR.js.map +1 -0
- package/dist/{chunk-52WSY6G5.js → chunk-BNIBR5U2.js} +70 -31
- package/dist/chunk-BNIBR5U2.js.map +1 -0
- package/dist/{chunk-54WJF3DW.js → chunk-GNIYZKBI.js} +29 -3
- package/dist/chunk-GNIYZKBI.js.map +1 -0
- package/dist/{chunk-2XPKLHHH.cjs → chunk-KE2BL3JZ.cjs} +74 -35
- package/dist/chunk-KE2BL3JZ.cjs.map +1 -0
- package/dist/{chunk-PYV4ADC6.js → chunk-KLOSTZDQ.js} +141 -13
- package/dist/chunk-KLOSTZDQ.js.map +1 -0
- package/dist/{chunk-JQDWEX6V.cjs → chunk-LELLOHJK.cjs} +22 -34
- package/dist/chunk-LELLOHJK.cjs.map +1 -0
- package/dist/{chunk-2WVFEIHR.cjs → chunk-MME3H4ZF.cjs} +40 -2
- package/dist/chunk-MME3H4ZF.cjs.map +1 -0
- package/dist/{chunk-NZMKJHE2.cjs → chunk-OEKH5PWL.cjs} +15 -15
- package/dist/{chunk-NZMKJHE2.cjs.map → chunk-OEKH5PWL.cjs.map} +1 -1
- package/dist/{chunk-7VITUTRA.cjs → chunk-QFZ5QB2J.cjs} +140 -12
- package/dist/chunk-QFZ5QB2J.cjs.map +1 -0
- package/dist/{chunk-J4SICP3X.js → chunk-RVUEBUBH.js} +3 -3
- package/dist/{chunk-J4SICP3X.js.map → chunk-RVUEBUBH.js.map} +1 -1
- package/dist/index.cjs +483 -597
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -9
- package/dist/index.d.ts +12 -9
- package/dist/index.js +445 -559
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +16 -16
- package/dist/indexes/index.js +2 -2
- package/dist/interchange/index.d.cts +3 -3
- package/dist/interchange/index.d.ts +3 -3
- package/dist/{manager-DGSnJa1v.d.cts → manager-oh2mTMvy.d.cts} +1 -1
- package/dist/{manager-BCLhWysp.d.ts → manager-qRSdnKEO.d.ts} +1 -1
- package/dist/profiler/index.cjs +6 -6
- package/dist/profiler/index.cjs.map +1 -1
- package/dist/profiler/index.d.cts +3 -3
- package/dist/profiler/index.d.ts +3 -3
- package/dist/profiler/index.js +6 -6
- package/dist/profiler/index.js.map +1 -1
- package/dist/schema/index.cjs +20 -20
- package/dist/schema/index.d.cts +4 -4
- package/dist/schema/index.d.ts +4 -4
- package/dist/schema/index.js +2 -2
- package/dist/{store-BcnA11lH.d.ts → store-B9ItxA-Q.d.ts} +56 -17
- package/dist/{store-NEa4EFFD.d.cts → store-BJPIoe8u.d.cts} +56 -17
- package/dist/{types-1YJKodRv.d.ts → types-5t_MIcvv.d.ts} +12 -6
- package/dist/{types-GLkwvQvS.d.cts → types-Ckfwgv9l.d.cts} +12 -6
- package/package.json +1 -1
- package/dist/chunk-2WVFEIHR.cjs.map +0 -1
- package/dist/chunk-2XPKLHHH.cjs.map +0 -1
- package/dist/chunk-52WSY6G5.js.map +0 -1
- package/dist/chunk-54WJF3DW.js.map +0 -1
- package/dist/chunk-7VITUTRA.cjs.map +0 -1
- package/dist/chunk-JQDWEX6V.cjs.map +0 -1
- package/dist/chunk-PYV4ADC6.js.map +0 -1
- package/dist/chunk-U3452TEU.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkKE2BL3JZ_cjs = require('../../chunk-KE2BL3JZ.cjs');
|
|
4
4
|
require('../../chunk-44SXEVF4.cjs');
|
|
5
|
-
require('../../chunk-
|
|
6
|
-
require('../../chunk-
|
|
5
|
+
require('../../chunk-LELLOHJK.cjs');
|
|
6
|
+
require('../../chunk-MME3H4ZF.cjs');
|
|
7
7
|
require('../../chunk-P5CNM325.cjs');
|
|
8
8
|
var drizzleOrm = require('drizzle-orm');
|
|
9
9
|
|
|
@@ -31,7 +31,7 @@ function createPgPreparedStatement(pgClient, sqlText) {
|
|
|
31
31
|
function createPostgresExecutionAdapter(db) {
|
|
32
32
|
const pgClient = resolvePgClient(db);
|
|
33
33
|
function compile(query) {
|
|
34
|
-
return
|
|
34
|
+
return chunkKE2BL3JZ_cjs.compileQueryWithDialect(db, query, "PostgreSQL");
|
|
35
35
|
}
|
|
36
36
|
if (pgClient === void 0) {
|
|
37
37
|
return {
|
|
@@ -86,10 +86,10 @@ var POSTGRES_CHECK_UNIQUE_BATCH_CHUNK_SIZE = Math.max(
|
|
|
86
86
|
1,
|
|
87
87
|
POSTGRES_MAX_BIND_PARAMETERS - CHECK_UNIQUE_BATCH_FIXED_PARAM_COUNT
|
|
88
88
|
);
|
|
89
|
-
var toNodeRow =
|
|
90
|
-
var toEdgeRow =
|
|
91
|
-
var toUniqueRow =
|
|
92
|
-
var toSchemaVersionRow =
|
|
89
|
+
var toNodeRow = chunkKE2BL3JZ_cjs.createNodeRowMapper(chunkKE2BL3JZ_cjs.POSTGRES_ROW_MAPPER_CONFIG);
|
|
90
|
+
var toEdgeRow = chunkKE2BL3JZ_cjs.createEdgeRowMapper(chunkKE2BL3JZ_cjs.POSTGRES_ROW_MAPPER_CONFIG);
|
|
91
|
+
var toUniqueRow = chunkKE2BL3JZ_cjs.createUniqueRowMapper(chunkKE2BL3JZ_cjs.POSTGRES_ROW_MAPPER_CONFIG);
|
|
92
|
+
var toSchemaVersionRow = chunkKE2BL3JZ_cjs.createSchemaVersionRowMapper(chunkKE2BL3JZ_cjs.POSTGRES_ROW_MAPPER_CONFIG);
|
|
93
93
|
function toEmbeddingRow(row) {
|
|
94
94
|
let embedding;
|
|
95
95
|
if (typeof row.embedding === "string") {
|
|
@@ -107,12 +107,12 @@ function toEmbeddingRow(row) {
|
|
|
107
107
|
field_path: row.field_path,
|
|
108
108
|
embedding,
|
|
109
109
|
dimensions: row.dimensions,
|
|
110
|
-
created_at:
|
|
111
|
-
updated_at:
|
|
110
|
+
created_at: chunkKE2BL3JZ_cjs.formatPostgresTimestamp(row.created_at) ?? "",
|
|
111
|
+
updated_at: chunkKE2BL3JZ_cjs.formatPostgresTimestamp(row.updated_at) ?? ""
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
var POSTGRES_VECTOR_CAPABILITIES = {
|
|
115
|
-
...
|
|
115
|
+
...chunkKE2BL3JZ_cjs.POSTGRES_CAPABILITIES,
|
|
116
116
|
vector: {
|
|
117
117
|
supported: true,
|
|
118
118
|
metrics: ["cosine", "l2", "inner_product"],
|
|
@@ -122,14 +122,14 @@ var POSTGRES_VECTOR_CAPABILITIES = {
|
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
124
|
function createPostgresBackend(db, options = {}) {
|
|
125
|
-
const tables2 = options.tables ??
|
|
125
|
+
const tables2 = options.tables ?? chunkKE2BL3JZ_cjs.tables2;
|
|
126
126
|
const executionAdapter = createPostgresExecutionAdapter(db);
|
|
127
127
|
const tableNames = {
|
|
128
128
|
nodes: drizzleOrm.getTableName(tables2.nodes),
|
|
129
129
|
edges: drizzleOrm.getTableName(tables2.edges),
|
|
130
130
|
embeddings: drizzleOrm.getTableName(tables2.embeddings)
|
|
131
131
|
};
|
|
132
|
-
const operationStrategy =
|
|
132
|
+
const operationStrategy = chunkKE2BL3JZ_cjs.createPostgresOperationStrategy(tables2);
|
|
133
133
|
const operations = createPostgresOperationBackend({
|
|
134
134
|
db,
|
|
135
135
|
executionAdapter,
|
|
@@ -174,7 +174,7 @@ function createPostgresOperationBackend(options) {
|
|
|
174
174
|
async function execRun(query) {
|
|
175
175
|
await db.execute(query);
|
|
176
176
|
}
|
|
177
|
-
const commonBackend =
|
|
177
|
+
const commonBackend = chunkKE2BL3JZ_cjs.createCommonOperationBackend({
|
|
178
178
|
batchConfig: {
|
|
179
179
|
checkUniqueBatchChunkSize: POSTGRES_CHECK_UNIQUE_BATCH_CHUNK_SIZE,
|
|
180
180
|
edgeInsertBatchSize: POSTGRES_EDGE_INSERT_BATCH_SIZE,
|
|
@@ -187,7 +187,7 @@ function createPostgresOperationBackend(options) {
|
|
|
187
187
|
execGet,
|
|
188
188
|
execRun
|
|
189
189
|
},
|
|
190
|
-
nowIso:
|
|
190
|
+
nowIso: chunkKE2BL3JZ_cjs.nowIso,
|
|
191
191
|
operationStrategy,
|
|
192
192
|
rowMappers: {
|
|
193
193
|
toEdgeRow,
|
|
@@ -210,7 +210,7 @@ function createPostgresOperationBackend(options) {
|
|
|
210
210
|
tableNames,
|
|
211
211
|
// === Embedding Operations ===
|
|
212
212
|
async upsertEmbedding(params) {
|
|
213
|
-
const timestamp =
|
|
213
|
+
const timestamp = chunkKE2BL3JZ_cjs.nowIso();
|
|
214
214
|
const query = operationStrategy.buildUpsertEmbedding(params, timestamp);
|
|
215
215
|
await execRun(query);
|
|
216
216
|
},
|
|
@@ -249,7 +249,7 @@ function createPostgresOperationBackend(options) {
|
|
|
249
249
|
...params.indexParams?.efConstruction === void 0 ? {} : { hnswEfConstruction: params.indexParams.efConstruction },
|
|
250
250
|
...params.indexParams?.lists === void 0 ? {} : { ivfflatLists: params.indexParams.lists }
|
|
251
251
|
};
|
|
252
|
-
const result = await
|
|
252
|
+
const result = await chunkKE2BL3JZ_cjs.createPostgresVectorIndex(db, indexOptions);
|
|
253
253
|
if (!result.success) {
|
|
254
254
|
throw new Error(
|
|
255
255
|
result.message ?? "Failed to create PostgreSQL vector index"
|
|
@@ -259,13 +259,13 @@ function createPostgresOperationBackend(options) {
|
|
|
259
259
|
async dropVectorIndex(params) {
|
|
260
260
|
const metrics = POSTGRES_VECTOR_CAPABILITIES.vector?.metrics ?? ["cosine"];
|
|
261
261
|
for (const metric of metrics) {
|
|
262
|
-
const indexName =
|
|
262
|
+
const indexName = chunkKE2BL3JZ_cjs.generateVectorIndexName(
|
|
263
263
|
params.graphId,
|
|
264
264
|
params.nodeKind,
|
|
265
265
|
params.fieldPath,
|
|
266
266
|
metric
|
|
267
267
|
);
|
|
268
|
-
const result = await
|
|
268
|
+
const result = await chunkKE2BL3JZ_cjs.dropPostgresVectorIndex(db, indexName);
|
|
269
269
|
if (!result.success) {
|
|
270
270
|
throw new Error(
|
|
271
271
|
result.message ?? "Failed to drop PostgreSQL vector index"
|
|
@@ -295,39 +295,39 @@ function createTransactionBackend(options) {
|
|
|
295
295
|
|
|
296
296
|
Object.defineProperty(exports, "createPostgresTables", {
|
|
297
297
|
enumerable: true,
|
|
298
|
-
get: function () { return
|
|
298
|
+
get: function () { return chunkKE2BL3JZ_cjs.createPostgresTables; }
|
|
299
299
|
});
|
|
300
300
|
Object.defineProperty(exports, "edges", {
|
|
301
301
|
enumerable: true,
|
|
302
|
-
get: function () { return
|
|
302
|
+
get: function () { return chunkKE2BL3JZ_cjs.edges2; }
|
|
303
303
|
});
|
|
304
304
|
Object.defineProperty(exports, "embeddings", {
|
|
305
305
|
enumerable: true,
|
|
306
|
-
get: function () { return
|
|
306
|
+
get: function () { return chunkKE2BL3JZ_cjs.embeddings2; }
|
|
307
307
|
});
|
|
308
308
|
Object.defineProperty(exports, "generatePostgresDDL", {
|
|
309
309
|
enumerable: true,
|
|
310
|
-
get: function () { return
|
|
310
|
+
get: function () { return chunkKE2BL3JZ_cjs.generatePostgresDDL; }
|
|
311
311
|
});
|
|
312
312
|
Object.defineProperty(exports, "generatePostgresMigrationSQL", {
|
|
313
313
|
enumerable: true,
|
|
314
|
-
get: function () { return
|
|
314
|
+
get: function () { return chunkKE2BL3JZ_cjs.generatePostgresMigrationSQL; }
|
|
315
315
|
});
|
|
316
316
|
Object.defineProperty(exports, "nodes", {
|
|
317
317
|
enumerable: true,
|
|
318
|
-
get: function () { return
|
|
318
|
+
get: function () { return chunkKE2BL3JZ_cjs.nodes2; }
|
|
319
319
|
});
|
|
320
320
|
Object.defineProperty(exports, "schemaVersions", {
|
|
321
321
|
enumerable: true,
|
|
322
|
-
get: function () { return
|
|
322
|
+
get: function () { return chunkKE2BL3JZ_cjs.schemaVersions2; }
|
|
323
323
|
});
|
|
324
324
|
Object.defineProperty(exports, "tables", {
|
|
325
325
|
enumerable: true,
|
|
326
|
-
get: function () { return
|
|
326
|
+
get: function () { return chunkKE2BL3JZ_cjs.tables2; }
|
|
327
327
|
});
|
|
328
328
|
Object.defineProperty(exports, "uniques", {
|
|
329
329
|
enumerable: true,
|
|
330
|
-
get: function () { return
|
|
330
|
+
get: function () { return chunkKE2BL3JZ_cjs.uniques2; }
|
|
331
331
|
});
|
|
332
332
|
exports.createPostgresBackend = createPostgresBackend;
|
|
333
333
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GraphBackend } from '../../types-
|
|
1
|
+
import { G as GraphBackend } from '../../types-Ckfwgv9l.cjs';
|
|
2
2
|
import { PgDatabase, PgQueryResultHKT } from 'drizzle-orm/pg-core';
|
|
3
3
|
import { P as PostgresTables } from '../../ddl-BJg93HDN.cjs';
|
|
4
4
|
export { C as CreatePostgresTablesOptions, b as PostgresTableNames, c as createPostgresTables, e as edges, d as embeddings, f as generatePostgresDDL, h as generatePostgresMigrationSQL, n as nodes, s as schemaVersions, t as tables, u as uniques } from '../../ddl-BJg93HDN.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GraphBackend } from '../../types-
|
|
1
|
+
import { G as GraphBackend } from '../../types-5t_MIcvv.js';
|
|
2
2
|
import { PgDatabase, PgQueryResultHKT } from 'drizzle-orm/pg-core';
|
|
3
3
|
import { P as PostgresTables } from '../../ddl-CsfWcl_B.js';
|
|
4
4
|
export { C as CreatePostgresTablesOptions, b as PostgresTableNames, c as createPostgresTables, e as edges, d as embeddings, f as generatePostgresDDL, h as generatePostgresMigrationSQL, n as nodes, s as schemaVersions, t as tables, u as uniques } from '../../ddl-CsfWcl_B.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createNodeRowMapper, POSTGRES_ROW_MAPPER_CONFIG, createEdgeRowMapper, createUniqueRowMapper, createSchemaVersionRowMapper, POSTGRES_CAPABILITIES, tables2, createPostgresOperationStrategy, createCommonOperationBackend, nowIso, generateVectorIndexName, dropPostgresVectorIndex, createPostgresVectorIndex, compileQueryWithDialect, formatPostgresTimestamp } from '../../chunk-
|
|
2
|
-
export { createPostgresTables, edges2 as edges, embeddings2 as embeddings, generatePostgresDDL, generatePostgresMigrationSQL, nodes2 as nodes, schemaVersions2 as schemaVersions, tables2 as tables, uniques2 as uniques } from '../../chunk-
|
|
1
|
+
import { createNodeRowMapper, POSTGRES_ROW_MAPPER_CONFIG, createEdgeRowMapper, createUniqueRowMapper, createSchemaVersionRowMapper, POSTGRES_CAPABILITIES, tables2, createPostgresOperationStrategy, createCommonOperationBackend, nowIso, generateVectorIndexName, dropPostgresVectorIndex, createPostgresVectorIndex, compileQueryWithDialect, formatPostgresTimestamp } from '../../chunk-BNIBR5U2.js';
|
|
2
|
+
export { createPostgresTables, edges2 as edges, embeddings2 as embeddings, generatePostgresDDL, generatePostgresMigrationSQL, nodes2 as nodes, schemaVersions2 as schemaVersions, tables2 as tables, uniques2 as uniques } from '../../chunk-BNIBR5U2.js';
|
|
3
3
|
import '../../chunk-SJ2QMDXY.js';
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
4
|
+
import '../../chunk-6GWJH6AR.js';
|
|
5
|
+
import '../../chunk-GNIYZKBI.js';
|
|
6
6
|
import '../../chunk-K7SQ3SWP.js';
|
|
7
7
|
import { getTableName } from 'drizzle-orm';
|
|
8
8
|
|
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkOEKH5PWL_cjs = require('../../chunk-OEKH5PWL.cjs');
|
|
4
|
+
var chunkKE2BL3JZ_cjs = require('../../chunk-KE2BL3JZ.cjs');
|
|
5
5
|
require('../../chunk-44SXEVF4.cjs');
|
|
6
|
-
require('../../chunk-
|
|
7
|
-
require('../../chunk-
|
|
6
|
+
require('../../chunk-LELLOHJK.cjs');
|
|
7
|
+
require('../../chunk-MME3H4ZF.cjs');
|
|
8
8
|
require('../../chunk-P5CNM325.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
Object.defineProperty(exports, "createSqliteBackend", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkOEKH5PWL_cjs.createSqliteBackend; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "createSqliteTables", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkKE2BL3JZ_cjs.createSqliteTables; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "edges", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkKE2BL3JZ_cjs.edges; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "embeddings", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkKE2BL3JZ_cjs.embeddings; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "generateSqliteDDL", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkKE2BL3JZ_cjs.generateSqliteDDL; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "generateSqliteMigrationSQL", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkKE2BL3JZ_cjs.generateSqliteMigrationSQL; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "nodes", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkKE2BL3JZ_cjs.nodes; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "schemaVersions", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunkKE2BL3JZ_cjs.schemaVersions; }
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "tables", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunkKE2BL3JZ_cjs.tables; }
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "uniques", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunkKE2BL3JZ_cjs.uniques; }
|
|
51
51
|
});
|
|
52
52
|
//# sourceMappingURL=index.cjs.map
|
|
53
53
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GraphBackend } from '../../types-
|
|
1
|
+
import { G as GraphBackend } from '../../types-Ckfwgv9l.cjs';
|
|
2
2
|
import { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
|
|
3
3
|
import { S as SqliteTables } from '../../sqlite-DVca_IIy.cjs';
|
|
4
4
|
export { C as CreateSqliteTablesOptions, a as SqliteTableNames, c as createSqliteTables, e as edges, b as embeddings, n as nodes, s as schemaVersions, t as tables, u as uniques } from '../../sqlite-DVca_IIy.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GraphBackend } from '../../types-
|
|
1
|
+
import { G as GraphBackend } from '../../types-5t_MIcvv.js';
|
|
2
2
|
import { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
|
|
3
3
|
import { S as SqliteTables } from '../../sqlite-H01wIXvB.js';
|
|
4
4
|
export { C as CreateSqliteTablesOptions, a as SqliteTableNames, c as createSqliteTables, e as edges, b as embeddings, n as nodes, s as schemaVersions, t as tables, u as uniques } from '../../sqlite-H01wIXvB.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { createSqliteBackend } from '../../chunk-
|
|
2
|
-
export { createSqliteTables, edges, embeddings, generateSqliteDDL, generateSqliteMigrationSQL, nodes, schemaVersions, tables, uniques } from '../../chunk-
|
|
1
|
+
export { createSqliteBackend } from '../../chunk-RVUEBUBH.js';
|
|
2
|
+
export { createSqliteTables, edges, embeddings, generateSqliteDDL, generateSqliteMigrationSQL, nodes, schemaVersions, tables, uniques } from '../../chunk-BNIBR5U2.js';
|
|
3
3
|
import '../../chunk-SJ2QMDXY.js';
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
4
|
+
import '../../chunk-6GWJH6AR.js';
|
|
5
|
+
import '../../chunk-GNIYZKBI.js';
|
|
6
6
|
import '../../chunk-K7SQ3SWP.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkOEKH5PWL_cjs = require('../../chunk-OEKH5PWL.cjs');
|
|
4
|
+
var chunkKE2BL3JZ_cjs = require('../../chunk-KE2BL3JZ.cjs');
|
|
5
5
|
var chunk44SXEVF4_cjs = require('../../chunk-44SXEVF4.cjs');
|
|
6
|
-
require('../../chunk-
|
|
7
|
-
require('../../chunk-
|
|
6
|
+
require('../../chunk-LELLOHJK.cjs');
|
|
7
|
+
require('../../chunk-MME3H4ZF.cjs');
|
|
8
8
|
require('../../chunk-P5CNM325.cjs');
|
|
9
9
|
var Database = require('better-sqlite3');
|
|
10
10
|
var betterSqlite3 = require('drizzle-orm/better-sqlite3');
|
|
@@ -53,14 +53,14 @@ function createDatabase(path) {
|
|
|
53
53
|
}
|
|
54
54
|
function createLocalSqliteBackend(options = {}) {
|
|
55
55
|
const path = options.path ?? ":memory:";
|
|
56
|
-
const tables2 = options.tables ??
|
|
56
|
+
const tables2 = options.tables ?? chunkKE2BL3JZ_cjs.tables;
|
|
57
57
|
const sqlite = createDatabase(path);
|
|
58
58
|
const db = betterSqlite3.drizzle(sqlite);
|
|
59
|
-
const ddlStatements =
|
|
59
|
+
const ddlStatements = chunkKE2BL3JZ_cjs.generateSqliteDDL(tables2);
|
|
60
60
|
for (const statement of ddlStatements) {
|
|
61
61
|
sqlite.exec(statement);
|
|
62
62
|
}
|
|
63
|
-
const backend =
|
|
63
|
+
const backend = chunkOEKH5PWL_cjs.createSqliteBackend(db, {
|
|
64
64
|
executionProfile: {
|
|
65
65
|
isSync: true
|
|
66
66
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
2
|
-
import { G as GraphBackend } from '../../types-
|
|
2
|
+
import { G as GraphBackend } from '../../types-Ckfwgv9l.cjs';
|
|
3
3
|
import { S as SqliteTables } from '../../sqlite-DVca_IIy.cjs';
|
|
4
4
|
import 'drizzle-orm';
|
|
5
5
|
import '../../types-DMzKq0d5.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
2
|
-
import { G as GraphBackend } from '../../types-
|
|
2
|
+
import { G as GraphBackend } from '../../types-5t_MIcvv.js';
|
|
3
3
|
import { S as SqliteTables } from '../../sqlite-H01wIXvB.js';
|
|
4
4
|
import 'drizzle-orm';
|
|
5
5
|
import '../../types-DMzKq0d5.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createSqliteBackend } from '../../chunk-
|
|
2
|
-
import { tables, generateSqliteDDL } from '../../chunk-
|
|
1
|
+
import { createSqliteBackend } from '../../chunk-RVUEBUBH.js';
|
|
2
|
+
import { tables, generateSqliteDDL } from '../../chunk-BNIBR5U2.js';
|
|
3
3
|
import { ConfigurationError } from '../../chunk-SJ2QMDXY.js';
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
4
|
+
import '../../chunk-6GWJH6AR.js';
|
|
5
|
+
import '../../chunk-GNIYZKBI.js';
|
|
6
6
|
import '../../chunk-K7SQ3SWP.js';
|
|
7
7
|
import Database from 'better-sqlite3';
|
|
8
8
|
import { drizzle } from 'drizzle-orm/better-sqlite3';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getDialect, EDGE_META_KEYS, NODE_META_KEYS } from './chunk-
|
|
1
|
+
import { NODE_INDEX_TYPE_MARKER, getDialect, EDGE_INDEX_TYPE_MARKER, fnv1aBase36, MAX_PG_IDENTIFIER_LENGTH, TRUNCATED_IDENTIFIER_MAX_LENGTH, IDENTIFIER_COMPONENT_MAX_LENGTH, EDGE_META_KEYS, NODE_META_KEYS } from './chunk-GNIYZKBI.js';
|
|
2
2
|
import { createSchemaIntrospector, jsonPointer, normalizeJsonPointer, parseJsonPointer, resolveFieldTypeInfoAtJsonPointer } from './chunk-K7SQ3SWP.js';
|
|
3
3
|
import { sql } from 'drizzle-orm';
|
|
4
4
|
import { CasingCache } from 'drizzle-orm/casing';
|
|
@@ -223,7 +223,7 @@ function escapeStringLiteral(value) {
|
|
|
223
223
|
|
|
224
224
|
// src/indexes/ddl.ts
|
|
225
225
|
function generateIndexDDL(index, dialect, options = {}) {
|
|
226
|
-
if (index.__type ===
|
|
226
|
+
if (index.__type === NODE_INDEX_TYPE_MARKER) {
|
|
227
227
|
return generateNodeIndexDDL(index, dialect, options);
|
|
228
228
|
}
|
|
229
229
|
return generateEdgeIndexDDL(index, dialect, options);
|
|
@@ -240,7 +240,7 @@ function generateTableIndexDDL(index, dialect, tableName, options) {
|
|
|
240
240
|
const ifNotExists = options.ifNotExists ?? true;
|
|
241
241
|
const propsColumn = sql.raw('"props"');
|
|
242
242
|
const systemColumn = (column) => sql.raw(quoteIdentifier(column));
|
|
243
|
-
const keys = index.__type ===
|
|
243
|
+
const keys = index.__type === NODE_INDEX_TYPE_MARKER ? compileNodeIndexKeys(index, dialect, propsColumn, systemColumn).keys : compileEdgeIndexKeys(index, dialect, propsColumn, systemColumn).keys;
|
|
244
244
|
const whereSql = index.where ? sqlToInlineString(
|
|
245
245
|
compileIndexWhere(
|
|
246
246
|
{
|
|
@@ -340,7 +340,7 @@ function defineNodeIndex(node, config) {
|
|
|
340
340
|
coveringFields
|
|
341
341
|
});
|
|
342
342
|
return {
|
|
343
|
-
__type:
|
|
343
|
+
__type: NODE_INDEX_TYPE_MARKER,
|
|
344
344
|
node,
|
|
345
345
|
nodeKind: node.kind,
|
|
346
346
|
fields,
|
|
@@ -390,7 +390,7 @@ function defineEdgeIndex(edge, config) {
|
|
|
390
390
|
coveringFields
|
|
391
391
|
});
|
|
392
392
|
return {
|
|
393
|
-
__type:
|
|
393
|
+
__type: EDGE_INDEX_TYPE_MARKER,
|
|
394
394
|
edge,
|
|
395
395
|
edgeKind: edge.kind,
|
|
396
396
|
fields,
|
|
@@ -753,7 +753,7 @@ function resolveEdgeFieldTypeInfoOrThrow(edgeKind, pointer, schemaIntrospector)
|
|
|
753
753
|
return resolved;
|
|
754
754
|
}
|
|
755
755
|
function generateDefaultIndexName(parts) {
|
|
756
|
-
const hash =
|
|
756
|
+
const hash = fnv1aBase36(
|
|
757
757
|
JSON.stringify({
|
|
758
758
|
kind: parts.kind,
|
|
759
759
|
kindName: parts.kindName,
|
|
@@ -777,26 +777,14 @@ function generateDefaultIndexName(parts) {
|
|
|
777
777
|
hash
|
|
778
778
|
].filter((part) => part !== void 0);
|
|
779
779
|
const joined = nameParts.join("_");
|
|
780
|
-
return joined.length <=
|
|
780
|
+
return joined.length <= MAX_PG_IDENTIFIER_LENGTH ? joined : `${joined.slice(0, TRUNCATED_IDENTIFIER_MAX_LENGTH)}_${hash}`;
|
|
781
781
|
}
|
|
782
782
|
function sanitizeIdentifierComponent(value) {
|
|
783
|
-
return value.toLowerCase().replaceAll(/[^a-z0-9_]+/g, "_").replaceAll(/^_+|_+$/g, "").slice(0,
|
|
784
|
-
}
|
|
785
|
-
function fnv1aBase36Hash(input) {
|
|
786
|
-
let hash = 2166136261;
|
|
787
|
-
for (const character of input) {
|
|
788
|
-
const codePoint = character.codePointAt(0);
|
|
789
|
-
if (codePoint === void 0) {
|
|
790
|
-
continue;
|
|
791
|
-
}
|
|
792
|
-
hash ^= codePoint;
|
|
793
|
-
hash = Math.imul(hash, 16777619);
|
|
794
|
-
}
|
|
795
|
-
return (hash >>> 0).toString(36);
|
|
783
|
+
return value.toLowerCase().replaceAll(/[^a-z0-9_]+/g, "_").replaceAll(/^_+|_+$/g, "").slice(0, IDENTIFIER_COMPONENT_MAX_LENGTH);
|
|
796
784
|
}
|
|
797
785
|
function buildPostgresNodeIndexBuilders(table, indexes) {
|
|
798
786
|
const nodeIndexes = indexes.filter(
|
|
799
|
-
(index) => index.__type ===
|
|
787
|
+
(index) => index.__type === NODE_INDEX_TYPE_MARKER
|
|
800
788
|
);
|
|
801
789
|
return nodeIndexes.map((index$1) => {
|
|
802
790
|
const propsColumn = sql`${table.props}`;
|
|
@@ -823,7 +811,7 @@ function buildPostgresNodeIndexBuilders(table, indexes) {
|
|
|
823
811
|
}
|
|
824
812
|
function buildPostgresEdgeIndexBuilders(table, indexes) {
|
|
825
813
|
const edgeIndexes = indexes.filter(
|
|
826
|
-
(index) => index.__type ===
|
|
814
|
+
(index) => index.__type === EDGE_INDEX_TYPE_MARKER
|
|
827
815
|
);
|
|
828
816
|
return edgeIndexes.map((index$1) => {
|
|
829
817
|
const propsColumn = sql`${table.props}`;
|
|
@@ -930,7 +918,7 @@ function getPostgresEdgeSystemColumn(table, column) {
|
|
|
930
918
|
}
|
|
931
919
|
function buildSqliteNodeIndexBuilders(table, indexes) {
|
|
932
920
|
const nodeIndexes = indexes.filter(
|
|
933
|
-
(index) => index.__type ===
|
|
921
|
+
(index) => index.__type === NODE_INDEX_TYPE_MARKER
|
|
934
922
|
);
|
|
935
923
|
return nodeIndexes.map((index) => {
|
|
936
924
|
const propsColumn = sql`${table.props}`;
|
|
@@ -957,7 +945,7 @@ function buildSqliteNodeIndexBuilders(table, indexes) {
|
|
|
957
945
|
}
|
|
958
946
|
function buildSqliteEdgeIndexBuilders(table, indexes) {
|
|
959
947
|
const edgeIndexes = indexes.filter(
|
|
960
|
-
(index) => index.__type ===
|
|
948
|
+
(index) => index.__type === EDGE_INDEX_TYPE_MARKER
|
|
961
949
|
);
|
|
962
950
|
return edgeIndexes.map((index) => {
|
|
963
951
|
const propsColumn = sql`${table.props}`;
|
|
@@ -1070,7 +1058,7 @@ function assertNonEmpty2(values, label) {
|
|
|
1070
1058
|
|
|
1071
1059
|
// src/indexes/profiler.ts
|
|
1072
1060
|
function toDeclaredIndex(index) {
|
|
1073
|
-
if (index.__type ===
|
|
1061
|
+
if (index.__type === NODE_INDEX_TYPE_MARKER) {
|
|
1074
1062
|
return toDeclaredNodeIndex(index);
|
|
1075
1063
|
}
|
|
1076
1064
|
return toDeclaredEdgeIndex(index);
|
|
@@ -1124,5 +1112,5 @@ function notWhere(predicate) {
|
|
|
1124
1112
|
}
|
|
1125
1113
|
|
|
1126
1114
|
export { andWhere, buildPostgresEdgeIndexBuilders, buildPostgresNodeIndexBuilders, buildSqliteEdgeIndexBuilders, buildSqliteNodeIndexBuilders, defineEdgeIndex, defineNodeIndex, generateEdgeIndexDDL, generateIndexDDL, generateNodeIndexDDL, notWhere, orWhere, toDeclaredIndex, toDeclaredIndexes };
|
|
1127
|
-
//# sourceMappingURL=chunk-
|
|
1128
|
-
//# sourceMappingURL=chunk-
|
|
1115
|
+
//# sourceMappingURL=chunk-6GWJH6AR.js.map
|
|
1116
|
+
//# sourceMappingURL=chunk-6GWJH6AR.js.map
|