@graphrefly/graphrefly 0.5.0 → 0.6.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/{chunk-ZERWUCGK.js → chunk-V3UACY6A.js} +87 -14
- package/dist/chunk-V3UACY6A.js.map +1 -0
- package/dist/compat/nestjs/index.js +1 -1
- package/dist/extra/index.cjs +86 -13
- package/dist/extra/index.cjs.map +1 -1
- package/dist/extra/index.d.cts +1 -1
- package/dist/extra/index.d.ts +1 -1
- package/dist/extra/index.js +5 -1
- package/dist/{index-C3LRU4jB.d.ts → index-B2jmzVxL.d.ts} +85 -2
- package/dist/{index-Cz8og7-L.d.cts → index-Bk_idZm1.d.cts} +85 -2
- package/dist/index.cjs +88 -13
- 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 +8 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-ZERWUCGK.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -162,6 +162,7 @@ __export(index_exports, {
|
|
|
162
162
|
fromPulsar: () => fromPulsar,
|
|
163
163
|
fromRabbitMQ: () => fromRabbitMQ,
|
|
164
164
|
fromRedisStream: () => fromRedisStream,
|
|
165
|
+
fromSqlite: () => fromSqlite,
|
|
165
166
|
fromStatsD: () => fromStatsD,
|
|
166
167
|
fromSyslog: () => fromSyslog,
|
|
167
168
|
fromTimer: () => fromTimer,
|
|
@@ -273,6 +274,7 @@ __export(index_exports, {
|
|
|
273
274
|
toRedisStream: () => toRedisStream,
|
|
274
275
|
toS3: () => toS3,
|
|
275
276
|
toSSE: () => toSSE,
|
|
277
|
+
toSqlite: () => toSqlite,
|
|
276
278
|
toTempo: () => toTempo,
|
|
277
279
|
toWebSocket: () => toWebSocket,
|
|
278
280
|
tokenBucket: () => tokenBucket,
|
|
@@ -6608,6 +6610,7 @@ __export(extra_exports, {
|
|
|
6608
6610
|
fromPulsar: () => fromPulsar,
|
|
6609
6611
|
fromRabbitMQ: () => fromRabbitMQ,
|
|
6610
6612
|
fromRedisStream: () => fromRedisStream,
|
|
6613
|
+
fromSqlite: () => fromSqlite,
|
|
6611
6614
|
fromStatsD: () => fromStatsD,
|
|
6612
6615
|
fromSyslog: () => fromSyslog,
|
|
6613
6616
|
fromTimer: () => fromTimer,
|
|
@@ -6685,6 +6688,7 @@ __export(extra_exports, {
|
|
|
6685
6688
|
toRedisStream: () => toRedisStream,
|
|
6686
6689
|
toS3: () => toS3,
|
|
6687
6690
|
toSSE: () => toSSE,
|
|
6691
|
+
toSqlite: () => toSqlite,
|
|
6688
6692
|
toTempo: () => toTempo,
|
|
6689
6693
|
toWebSocket: () => toWebSocket,
|
|
6690
6694
|
tokenBucket: () => tokenBucket,
|
|
@@ -7487,7 +7491,7 @@ function toWebSocket(source, socket, opts) {
|
|
|
7487
7491
|
};
|
|
7488
7492
|
const inner = node([source], () => void 0, {
|
|
7489
7493
|
describeKind: "effect",
|
|
7490
|
-
onMessage(msg) {
|
|
7494
|
+
onMessage(msg, _depIndex, _actions) {
|
|
7491
7495
|
if (msg[0] === DATA) {
|
|
7492
7496
|
let serialized;
|
|
7493
7497
|
try {
|
|
@@ -7938,7 +7942,7 @@ function toKafka(source, kafkaProducer, topic2, opts) {
|
|
|
7938
7942
|
const inner = node([source], () => void 0, {
|
|
7939
7943
|
describeKind: "effect",
|
|
7940
7944
|
...rest,
|
|
7941
|
-
onMessage(msg) {
|
|
7945
|
+
onMessage(msg, _depIndex, _actions) {
|
|
7942
7946
|
if (msg[0] === DATA) {
|
|
7943
7947
|
const value = msg[1];
|
|
7944
7948
|
const key = keyExtractor?.(value) ?? null;
|
|
@@ -8037,7 +8041,7 @@ function toRedisStream(source, client, key, opts) {
|
|
|
8037
8041
|
const inner = node([source], () => void 0, {
|
|
8038
8042
|
describeKind: "effect",
|
|
8039
8043
|
...rest,
|
|
8040
|
-
onMessage(msg) {
|
|
8044
|
+
onMessage(msg, _depIndex, _actions) {
|
|
8041
8045
|
if (msg[0] === DATA) {
|
|
8042
8046
|
const value = msg[1];
|
|
8043
8047
|
let fields;
|
|
@@ -8295,7 +8299,7 @@ function toPulsar(source, pulsarProducer, opts) {
|
|
|
8295
8299
|
const inner = node([source], () => void 0, {
|
|
8296
8300
|
describeKind: "effect",
|
|
8297
8301
|
...rest,
|
|
8298
|
-
onMessage(msg) {
|
|
8302
|
+
onMessage(msg, _depIndex, _actions) {
|
|
8299
8303
|
if (msg[0] === DATA) {
|
|
8300
8304
|
const value = msg[1];
|
|
8301
8305
|
let data;
|
|
@@ -8385,7 +8389,7 @@ function toNATS(source, client, subject, opts) {
|
|
|
8385
8389
|
const inner = node([source], () => void 0, {
|
|
8386
8390
|
describeKind: "effect",
|
|
8387
8391
|
...rest,
|
|
8388
|
-
onMessage(msg) {
|
|
8392
|
+
onMessage(msg, _depIndex, _actions) {
|
|
8389
8393
|
if (msg[0] === DATA) {
|
|
8390
8394
|
const value = msg[1];
|
|
8391
8395
|
let data;
|
|
@@ -8479,7 +8483,7 @@ function toRabbitMQ(source, channel, exchange, opts) {
|
|
|
8479
8483
|
const inner = node([source], () => void 0, {
|
|
8480
8484
|
describeKind: "effect",
|
|
8481
8485
|
...rest,
|
|
8482
|
-
onMessage(msg) {
|
|
8486
|
+
onMessage(msg, _depIndex, _actions) {
|
|
8483
8487
|
if (msg[0] === DATA) {
|
|
8484
8488
|
const value = msg[1];
|
|
8485
8489
|
let routingKey;
|
|
@@ -8559,7 +8563,7 @@ function toFile(source, writer, opts) {
|
|
|
8559
8563
|
const inner = node([source], () => void 0, {
|
|
8560
8564
|
describeKind: "effect",
|
|
8561
8565
|
...rest,
|
|
8562
|
-
onMessage(msg) {
|
|
8566
|
+
onMessage(msg, _depIndex, _actions) {
|
|
8563
8567
|
if (msg[0] === DATA) {
|
|
8564
8568
|
const value = msg[1];
|
|
8565
8569
|
let line;
|
|
@@ -8698,7 +8702,7 @@ function toClickHouse(source, client, table, opts) {
|
|
|
8698
8702
|
const inner = node([source], () => void 0, {
|
|
8699
8703
|
describeKind: "effect",
|
|
8700
8704
|
...rest,
|
|
8701
|
-
onMessage(msg) {
|
|
8705
|
+
onMessage(msg, _depIndex, _actions) {
|
|
8702
8706
|
if (msg[0] === DATA) {
|
|
8703
8707
|
const value = msg[1];
|
|
8704
8708
|
try {
|
|
@@ -8794,7 +8798,7 @@ function toS3(source, client, bucket, opts) {
|
|
|
8794
8798
|
const inner = node([source], () => void 0, {
|
|
8795
8799
|
describeKind: "effect",
|
|
8796
8800
|
...rest,
|
|
8797
|
-
onMessage(msg) {
|
|
8801
|
+
onMessage(msg, _depIndex, _actions) {
|
|
8798
8802
|
if (msg[0] === DATA) {
|
|
8799
8803
|
const value = msg[1];
|
|
8800
8804
|
try {
|
|
@@ -8844,7 +8848,7 @@ function toPostgres(source, client, table, opts) {
|
|
|
8844
8848
|
const inner = node([source], () => void 0, {
|
|
8845
8849
|
describeKind: "effect",
|
|
8846
8850
|
...rest,
|
|
8847
|
-
onMessage(msg) {
|
|
8851
|
+
onMessage(msg, _depIndex, _actions) {
|
|
8848
8852
|
if (msg[0] === DATA) {
|
|
8849
8853
|
const value = msg[1];
|
|
8850
8854
|
let query;
|
|
@@ -8878,7 +8882,7 @@ function toMongo(source, collection2, opts) {
|
|
|
8878
8882
|
const inner = node([source], () => void 0, {
|
|
8879
8883
|
describeKind: "effect",
|
|
8880
8884
|
...rest,
|
|
8881
|
-
onMessage(msg) {
|
|
8885
|
+
onMessage(msg, _depIndex, _actions) {
|
|
8882
8886
|
if (msg[0] === DATA) {
|
|
8883
8887
|
const value = msg[1];
|
|
8884
8888
|
let doc;
|
|
@@ -8918,7 +8922,7 @@ function toLoki(source, client, opts) {
|
|
|
8918
8922
|
const inner = node([source], () => void 0, {
|
|
8919
8923
|
describeKind: "effect",
|
|
8920
8924
|
...rest,
|
|
8921
|
-
onMessage(msg) {
|
|
8925
|
+
onMessage(msg, _depIndex, _actions) {
|
|
8922
8926
|
if (msg[0] === DATA) {
|
|
8923
8927
|
const value = msg[1];
|
|
8924
8928
|
let line;
|
|
@@ -8964,7 +8968,7 @@ function toTempo(source, client, opts) {
|
|
|
8964
8968
|
const inner = node([source], () => void 0, {
|
|
8965
8969
|
describeKind: "effect",
|
|
8966
8970
|
...rest,
|
|
8967
|
-
onMessage(msg) {
|
|
8971
|
+
onMessage(msg, _depIndex, _actions) {
|
|
8968
8972
|
if (msg[0] === DATA) {
|
|
8969
8973
|
const value = msg[1];
|
|
8970
8974
|
let spans;
|
|
@@ -9033,6 +9037,75 @@ function checkpointToRedis(graph, client, opts) {
|
|
|
9033
9037
|
};
|
|
9034
9038
|
return graph.autoCheckpoint(adapter, { debounceMs, compactEvery, onError });
|
|
9035
9039
|
}
|
|
9040
|
+
function fromSqlite(db, query, opts) {
|
|
9041
|
+
const { mapRow = (r) => r, params, ...rest } = opts ?? {};
|
|
9042
|
+
return producer(
|
|
9043
|
+
(_d, a) => {
|
|
9044
|
+
let mapped;
|
|
9045
|
+
try {
|
|
9046
|
+
const rows = db.query(query, params);
|
|
9047
|
+
mapped = rows.map(mapRow);
|
|
9048
|
+
} catch (err) {
|
|
9049
|
+
a.down([[ERROR, err instanceof Error ? err : new Error(String(err))]]);
|
|
9050
|
+
return void 0;
|
|
9051
|
+
}
|
|
9052
|
+
batch(() => {
|
|
9053
|
+
for (const item of mapped) {
|
|
9054
|
+
a.down([[DATA, item]]);
|
|
9055
|
+
}
|
|
9056
|
+
a.down([[COMPLETE]]);
|
|
9057
|
+
});
|
|
9058
|
+
return void 0;
|
|
9059
|
+
},
|
|
9060
|
+
{ describeKind: "producer", completeWhenDepsComplete: false, ...rest }
|
|
9061
|
+
);
|
|
9062
|
+
}
|
|
9063
|
+
function toSqlite(source, db, table, opts) {
|
|
9064
|
+
if (table.includes("\0") || table.length === 0) {
|
|
9065
|
+
throw new Error(`toSqlite: invalid table name: ${JSON.stringify(table)}`);
|
|
9066
|
+
}
|
|
9067
|
+
const {
|
|
9068
|
+
toSQL = (v, t) => ({
|
|
9069
|
+
sql: `INSERT INTO "${t.replace(/"/g, '""')}" (data) VALUES (?)`,
|
|
9070
|
+
params: [JSON.stringify(v)]
|
|
9071
|
+
}),
|
|
9072
|
+
onTransportError,
|
|
9073
|
+
...rest
|
|
9074
|
+
} = opts ?? {};
|
|
9075
|
+
const inner = node([source], () => void 0, {
|
|
9076
|
+
describeKind: "effect",
|
|
9077
|
+
...rest,
|
|
9078
|
+
onMessage(msg, _depIndex, _actions) {
|
|
9079
|
+
if (msg[0] === DATA) {
|
|
9080
|
+
const value = msg[1];
|
|
9081
|
+
let query;
|
|
9082
|
+
try {
|
|
9083
|
+
query = toSQL(value, table);
|
|
9084
|
+
} catch (err) {
|
|
9085
|
+
onTransportError?.({
|
|
9086
|
+
stage: "serialize",
|
|
9087
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
9088
|
+
value
|
|
9089
|
+
});
|
|
9090
|
+
return true;
|
|
9091
|
+
}
|
|
9092
|
+
try {
|
|
9093
|
+
db.query(query.sql, query.params);
|
|
9094
|
+
} catch (err) {
|
|
9095
|
+
onTransportError?.({
|
|
9096
|
+
stage: "send",
|
|
9097
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
9098
|
+
value
|
|
9099
|
+
});
|
|
9100
|
+
}
|
|
9101
|
+
return true;
|
|
9102
|
+
}
|
|
9103
|
+
return false;
|
|
9104
|
+
}
|
|
9105
|
+
});
|
|
9106
|
+
return inner.subscribe(() => {
|
|
9107
|
+
});
|
|
9108
|
+
}
|
|
9036
9109
|
|
|
9037
9110
|
// src/extra/checkpoint.ts
|
|
9038
9111
|
var import_node_crypto2 = require("crypto");
|
|
@@ -15548,6 +15621,7 @@ var version = "0.0.0";
|
|
|
15548
15621
|
fromPulsar,
|
|
15549
15622
|
fromRabbitMQ,
|
|
15550
15623
|
fromRedisStream,
|
|
15624
|
+
fromSqlite,
|
|
15551
15625
|
fromStatsD,
|
|
15552
15626
|
fromSyslog,
|
|
15553
15627
|
fromTimer,
|
|
@@ -15659,6 +15733,7 @@ var version = "0.0.0";
|
|
|
15659
15733
|
toRedisStream,
|
|
15660
15734
|
toS3,
|
|
15661
15735
|
toSSE,
|
|
15736
|
+
toSqlite,
|
|
15662
15737
|
toTempo,
|
|
15663
15738
|
toWebSocket,
|
|
15664
15739
|
tokenBucket,
|