@nicia-ai/typegraph 0.21.0 → 0.22.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 +33 -33
- package/dist/backend/postgres/index.js +4 -4
- package/dist/backend/sqlite/index.cjs +14 -14
- package/dist/backend/sqlite/index.d.cts +11 -0
- package/dist/backend/sqlite/index.d.ts +11 -0
- package/dist/backend/sqlite/index.js +4 -4
- package/dist/backend/sqlite/libsql.cjs +7 -7
- package/dist/backend/sqlite/libsql.js +4 -4
- package/dist/backend/sqlite/local.cjs +26 -9
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.js +21 -5
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-FQCQM3KG.cjs → chunk-3JK66E3I.cjs} +4 -2
- package/dist/chunk-3JK66E3I.cjs.map +1 -0
- package/dist/{chunk-SMMOAVJ5.js → chunk-3PPEHLGK.js} +3 -3
- package/dist/{chunk-SMMOAVJ5.js.map → chunk-3PPEHLGK.js.map} +1 -1
- package/dist/{chunk-UQVBVBVG.js → chunk-5ZMMHUWR.js} +53 -7
- package/dist/chunk-5ZMMHUWR.js.map +1 -0
- package/dist/{chunk-4XNE2JG3.js → chunk-753F33CV.js} +4 -2
- package/dist/chunk-753F33CV.js.map +1 -0
- package/dist/{chunk-CQL6FOTT.cjs → chunk-GUYI6VAS.cjs} +43 -24
- package/dist/chunk-GUYI6VAS.cjs.map +1 -0
- package/dist/{chunk-NRNJ52AA.js → chunk-NSLTDXVH.js} +26 -7
- package/dist/chunk-NSLTDXVH.js.map +1 -0
- package/dist/{chunk-2X7P7AD5.cjs → chunk-PEE4EWXZ.cjs} +22 -22
- package/dist/{chunk-2X7P7AD5.cjs.map → chunk-PEE4EWXZ.cjs.map} +1 -1
- package/dist/{chunk-Q73OWTJY.cjs → chunk-SCXOGKLD.cjs} +112 -66
- package/dist/chunk-SCXOGKLD.cjs.map +1 -0
- package/dist/index.cjs +135 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -1
- package/dist/index.d.ts +45 -1
- package/dist/index.js +115 -36
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +16 -16
- package/dist/indexes/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-4XNE2JG3.js.map +0 -1
- package/dist/chunk-CQL6FOTT.cjs.map +0 -1
- package/dist/chunk-FQCQM3KG.cjs.map +0 -1
- package/dist/chunk-NRNJ52AA.js.map +0 -1
- package/dist/chunk-Q73OWTJY.cjs.map +0 -1
- package/dist/chunk-UQVBVBVG.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DatabaseOperationError, UniquenessError } from './chunk-WFMTAEEN.js';
|
|
2
|
-
import { buildPostgresNodeIndexBuilders, buildPostgresEdgeIndexBuilders, buildSqliteNodeIndexBuilders, buildSqliteEdgeIndexBuilders } from './chunk-
|
|
3
|
-
import { tsvectorStrategy, fts5Strategy, MAX_PG_IDENTIFIER_LENGTH, quotedTableName, quotedColumn, edgeColumnList, sqlNull, nodeColumnList } from './chunk-
|
|
2
|
+
import { buildPostgresNodeIndexBuilders, buildPostgresEdgeIndexBuilders, buildSqliteNodeIndexBuilders, buildSqliteEdgeIndexBuilders } from './chunk-3PPEHLGK.js';
|
|
3
|
+
import { tsvectorStrategy, fts5Strategy, MAX_PG_IDENTIFIER_LENGTH, quotedTableName, quotedColumn, edgeColumnList, sqlNull, nodeColumnList } from './chunk-753F33CV.js';
|
|
4
4
|
import { customType, pgTable, timestamp, integer, jsonb, text, primaryKey, index, boolean, getTableConfig as getTableConfig$1 } from 'drizzle-orm/pg-core';
|
|
5
5
|
import { sqliteTable, text as text$1, integer as integer$1, primaryKey as primaryKey$1, index as index$1, blob, getTableConfig } from 'drizzle-orm/sqlite-core';
|
|
6
6
|
import { sql, getTableName } from 'drizzle-orm';
|
|
@@ -503,8 +503,17 @@ function flattenSqlChunk(chunk) {
|
|
|
503
503
|
return chunk;
|
|
504
504
|
}
|
|
505
505
|
if (typeof chunk === "object" && chunk !== null) {
|
|
506
|
-
if ("
|
|
507
|
-
return chunk.
|
|
506
|
+
if ("name" in chunk && typeof chunk.name === "string") {
|
|
507
|
+
return `"${chunk.name}"`;
|
|
508
|
+
}
|
|
509
|
+
if ("value" in chunk) {
|
|
510
|
+
const value = chunk.value;
|
|
511
|
+
if (typeof value === "string") {
|
|
512
|
+
return value;
|
|
513
|
+
}
|
|
514
|
+
if (Array.isArray(value)) {
|
|
515
|
+
return value.map((part) => flattenSqlChunk(part)).join("");
|
|
516
|
+
}
|
|
508
517
|
}
|
|
509
518
|
if ("queryChunks" in chunk && Array.isArray(chunk.queryChunks)) {
|
|
510
519
|
return chunk.queryChunks.map((part) => flattenSqlChunk(part)).join("");
|
|
@@ -1835,6 +1844,30 @@ function buildUpsertEmbeddingPostgres(tables3, params, timestamp2) {
|
|
|
1835
1844
|
${column(embeddings3.updatedAt)} = ${timestamp2}
|
|
1836
1845
|
`;
|
|
1837
1846
|
}
|
|
1847
|
+
function buildUpsertEmbeddingSqlite(tables3, params, timestamp2) {
|
|
1848
|
+
const { embeddings: embeddings3 } = tables3;
|
|
1849
|
+
const embeddingJson = JSON.stringify(params.embedding);
|
|
1850
|
+
assertFiniteNumberArray(params.embedding, "embedding");
|
|
1851
|
+
const columns = sql.raw(
|
|
1852
|
+
`"${embeddings3.graphId.name}", "${embeddings3.nodeKind.name}", "${embeddings3.nodeId.name}", "${embeddings3.fieldPath.name}", "${embeddings3.embedding.name}", "${embeddings3.dimensions.name}", "${embeddings3.createdAt.name}", "${embeddings3.updatedAt.name}"`
|
|
1853
|
+
);
|
|
1854
|
+
const conflictColumns = sql.raw(
|
|
1855
|
+
`"${embeddings3.graphId.name}", "${embeddings3.nodeKind.name}", "${embeddings3.nodeId.name}", "${embeddings3.fieldPath.name}"`
|
|
1856
|
+
);
|
|
1857
|
+
const column = (target) => sql.raw(`"${target.name}"`);
|
|
1858
|
+
return sql`
|
|
1859
|
+
INSERT INTO ${embeddings3} (${columns})
|
|
1860
|
+
VALUES (
|
|
1861
|
+
${params.graphId}, ${params.nodeKind}, ${params.nodeId}, ${params.fieldPath},
|
|
1862
|
+
vec_f32(${embeddingJson}), ${params.dimensions}, ${timestamp2}, ${timestamp2}
|
|
1863
|
+
)
|
|
1864
|
+
ON CONFLICT (${conflictColumns})
|
|
1865
|
+
DO UPDATE SET
|
|
1866
|
+
${column(embeddings3.embedding)} = vec_f32(${embeddingJson}),
|
|
1867
|
+
${column(embeddings3.dimensions)} = ${params.dimensions},
|
|
1868
|
+
${column(embeddings3.updatedAt)} = ${timestamp2}
|
|
1869
|
+
`;
|
|
1870
|
+
}
|
|
1838
1871
|
function buildDeleteEmbedding(tables3, params) {
|
|
1839
1872
|
const { embeddings: embeddings3 } = tables3;
|
|
1840
1873
|
return sql`
|
|
@@ -2037,7 +2070,20 @@ function createCommonOperationStrategy(tables3, dialect, fulltextStrategy) {
|
|
|
2037
2070
|
};
|
|
2038
2071
|
}
|
|
2039
2072
|
function createSqliteOperationStrategy(tables3, fulltextStrategy) {
|
|
2040
|
-
|
|
2073
|
+
const common = createCommonOperationStrategy(
|
|
2074
|
+
tables3,
|
|
2075
|
+
"sqlite",
|
|
2076
|
+
fulltextStrategy
|
|
2077
|
+
);
|
|
2078
|
+
return {
|
|
2079
|
+
...common,
|
|
2080
|
+
buildUpsertEmbedding(params, timestamp2) {
|
|
2081
|
+
return buildUpsertEmbeddingSqlite(tables3, params, timestamp2);
|
|
2082
|
+
},
|
|
2083
|
+
buildDeleteEmbedding(params) {
|
|
2084
|
+
return buildDeleteEmbedding(tables3, params);
|
|
2085
|
+
}
|
|
2086
|
+
};
|
|
2041
2087
|
}
|
|
2042
2088
|
function createPostgresOperationStrategy(tables3, fulltextStrategy) {
|
|
2043
2089
|
const common = createCommonOperationStrategy(
|
|
@@ -2248,5 +2294,5 @@ function compileQueryWithDialect(db, query, backendName) {
|
|
|
2248
2294
|
}
|
|
2249
2295
|
|
|
2250
2296
|
export { POSTGRES_CAPABILITIES, POSTGRES_ROW_MAPPER_CONFIG, SQLITE_CAPABILITIES, SQLITE_ROW_MAPPER_CONFIG, compileQueryWithDialect, createCommonOperationBackend, createEdgeRowMapper, createNodeRowMapper, createPostgresOperationStrategy, createPostgresTables, createPostgresVectorIndex, createSchemaVersionRowMapper, createSqliteOperationStrategy, createSqliteTables, createSqliteVectorIndex, createUniqueRowMapper, dropPostgresVectorIndex, dropSqliteVectorIndex, edges, edges2, embeddings, embeddings2, formatPostgresTimestamp, generatePostgresDDL, generatePostgresMigrationSQL, generateSqliteDDL, generateSqliteMigrationSQL, generateVectorIndexName, nodes, nodes2, nowIso, schemaVersions, schemaVersions2, tables, tables2, uniques, uniques2, wrapWithManagedClose };
|
|
2251
|
-
//# sourceMappingURL=chunk-
|
|
2252
|
-
//# sourceMappingURL=chunk-
|
|
2297
|
+
//# sourceMappingURL=chunk-5ZMMHUWR.js.map
|
|
2298
|
+
//# sourceMappingURL=chunk-5ZMMHUWR.js.map
|