@nicia-ai/typegraph 0.12.0 → 0.13.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.cjs +55 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +55 -23
- package/dist/index.js.map +1 -1
- package/dist/interchange/index.d.cts +1 -1
- package/dist/interchange/index.d.ts +1 -1
- package/dist/profiler/index.d.cts +1 -1
- package/dist/profiler/index.d.ts +1 -1
- package/dist/{store-BcnA11lH.d.ts → store-6-vH0ZIj.d.ts} +19 -0
- package/dist/{store-NEa4EFFD.d.cts → store-Bmdt_dS6.d.cts} +19 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8917,6 +8917,35 @@ function createEdgeCollection(config) {
|
|
|
8917
8917
|
executeHardDelete: executeEdgeHardDelete2,
|
|
8918
8918
|
matchesTemporalMode
|
|
8919
8919
|
} = config;
|
|
8920
|
+
const mapRows = (rows) => rows.map((row) => narrowEdge(rowToEdge2(row)));
|
|
8921
|
+
async function findEdgesFrom(from, target) {
|
|
8922
|
+
const rows = await target.findEdgesByKind({
|
|
8923
|
+
graphId,
|
|
8924
|
+
kind,
|
|
8925
|
+
fromKind: from.kind,
|
|
8926
|
+
fromId: from.id,
|
|
8927
|
+
excludeDeleted: true
|
|
8928
|
+
});
|
|
8929
|
+
return mapRows(rows);
|
|
8930
|
+
}
|
|
8931
|
+
async function findEdgesTo(to, target) {
|
|
8932
|
+
const rows = await target.findEdgesByKind({
|
|
8933
|
+
graphId,
|
|
8934
|
+
kind,
|
|
8935
|
+
toKind: to.kind,
|
|
8936
|
+
toId: to.id,
|
|
8937
|
+
excludeDeleted: true
|
|
8938
|
+
});
|
|
8939
|
+
return mapRows(rows);
|
|
8940
|
+
}
|
|
8941
|
+
function buildFindByEndpointsOptions(options) {
|
|
8942
|
+
const result = {};
|
|
8943
|
+
if (options?.matchOn !== void 0)
|
|
8944
|
+
result.matchOn = options.matchOn;
|
|
8945
|
+
if (options?.props !== void 0)
|
|
8946
|
+
result.props = options.props;
|
|
8947
|
+
return result;
|
|
8948
|
+
}
|
|
8920
8949
|
return {
|
|
8921
8950
|
async create(from, to, props, options) {
|
|
8922
8951
|
const result = await executeEdgeCreate2(
|
|
@@ -8972,24 +9001,32 @@ function createEdgeCollection(config) {
|
|
|
8972
9001
|
return narrowEdge(result);
|
|
8973
9002
|
},
|
|
8974
9003
|
async findFrom(from) {
|
|
8975
|
-
|
|
8976
|
-
graphId,
|
|
8977
|
-
kind,
|
|
8978
|
-
fromKind: from.kind,
|
|
8979
|
-
fromId: from.id,
|
|
8980
|
-
excludeDeleted: true
|
|
8981
|
-
});
|
|
8982
|
-
return rows.map((row) => narrowEdge(rowToEdge2(row)));
|
|
9004
|
+
return findEdgesFrom(from, backend);
|
|
8983
9005
|
},
|
|
8984
9006
|
async findTo(to) {
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
}
|
|
8992
|
-
|
|
9007
|
+
return findEdgesTo(to, backend);
|
|
9008
|
+
},
|
|
9009
|
+
batchFindFrom(from) {
|
|
9010
|
+
return { executeOn: (target) => findEdgesFrom(from, target) };
|
|
9011
|
+
},
|
|
9012
|
+
batchFindTo(to) {
|
|
9013
|
+
return { executeOn: (target) => findEdgesTo(to, target) };
|
|
9014
|
+
},
|
|
9015
|
+
batchFindByEndpoints(from, to, options) {
|
|
9016
|
+
return {
|
|
9017
|
+
executeOn: async (target) => {
|
|
9018
|
+
const result = await config.executeFindByEndpoints(
|
|
9019
|
+
kind,
|
|
9020
|
+
from.kind,
|
|
9021
|
+
from.id,
|
|
9022
|
+
to.kind,
|
|
9023
|
+
to.id,
|
|
9024
|
+
target,
|
|
9025
|
+
buildFindByEndpointsOptions(options)
|
|
9026
|
+
);
|
|
9027
|
+
return result === void 0 ? [] : [narrowEdge(result)];
|
|
9028
|
+
}
|
|
9029
|
+
};
|
|
8993
9030
|
},
|
|
8994
9031
|
async delete(id) {
|
|
8995
9032
|
await executeEdgeDelete2(id, backend);
|
|
@@ -9023,7 +9060,7 @@ function createEdgeCollection(config) {
|
|
|
9023
9060
|
if (options?.limit !== void 0) params.limit = options.limit;
|
|
9024
9061
|
if (options?.offset !== void 0) params.offset = options.offset;
|
|
9025
9062
|
const rows = await backend.findEdgesByKind(params);
|
|
9026
|
-
return rows
|
|
9063
|
+
return mapRows(rows);
|
|
9027
9064
|
},
|
|
9028
9065
|
async count(options) {
|
|
9029
9066
|
const mode = options?.temporalMode ?? defaultTemporalMode;
|
|
@@ -9152,11 +9189,6 @@ function createEdgeCollection(config) {
|
|
|
9152
9189
|
await deleteAll(backend);
|
|
9153
9190
|
},
|
|
9154
9191
|
async findByEndpoints(from, to, options) {
|
|
9155
|
-
const findOptions = {};
|
|
9156
|
-
if (options?.matchOn !== void 0)
|
|
9157
|
-
findOptions.matchOn = options.matchOn;
|
|
9158
|
-
if (options?.props !== void 0)
|
|
9159
|
-
findOptions.props = options.props;
|
|
9160
9192
|
const result = await config.executeFindByEndpoints(
|
|
9161
9193
|
kind,
|
|
9162
9194
|
from.kind,
|
|
@@ -9164,7 +9196,7 @@ function createEdgeCollection(config) {
|
|
|
9164
9196
|
to.kind,
|
|
9165
9197
|
to.id,
|
|
9166
9198
|
backend,
|
|
9167
|
-
|
|
9199
|
+
buildFindByEndpointsOptions(options)
|
|
9168
9200
|
);
|
|
9169
9201
|
return result === void 0 ? void 0 : narrowEdge(result);
|
|
9170
9202
|
},
|