@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
|
@@ -126,6 +126,7 @@ __export(extra_exports, {
|
|
|
126
126
|
fromPulsar: () => fromPulsar,
|
|
127
127
|
fromRabbitMQ: () => fromRabbitMQ,
|
|
128
128
|
fromRedisStream: () => fromRedisStream,
|
|
129
|
+
fromSqlite: () => fromSqlite,
|
|
129
130
|
fromStatsD: () => fromStatsD,
|
|
130
131
|
fromSyslog: () => fromSyslog,
|
|
131
132
|
fromTimer: () => fromTimer,
|
|
@@ -203,6 +204,7 @@ __export(extra_exports, {
|
|
|
203
204
|
toRedisStream: () => toRedisStream,
|
|
204
205
|
toS3: () => toS3,
|
|
205
206
|
toSSE: () => toSSE,
|
|
207
|
+
toSqlite: () => toSqlite,
|
|
206
208
|
toTempo: () => toTempo,
|
|
207
209
|
toWebSocket: () => toWebSocket,
|
|
208
210
|
tokenBucket: () => tokenBucket,
|
|
@@ -1005,7 +1007,7 @@ function toWebSocket(source, socket, opts) {
|
|
|
1005
1007
|
};
|
|
1006
1008
|
const inner = node([source], () => void 0, {
|
|
1007
1009
|
describeKind: "effect",
|
|
1008
|
-
onMessage(msg) {
|
|
1010
|
+
onMessage(msg, _depIndex, _actions) {
|
|
1009
1011
|
if (msg[0] === DATA) {
|
|
1010
1012
|
let serialized;
|
|
1011
1013
|
try {
|
|
@@ -1456,7 +1458,7 @@ function toKafka(source, kafkaProducer, topic, opts) {
|
|
|
1456
1458
|
const inner = node([source], () => void 0, {
|
|
1457
1459
|
describeKind: "effect",
|
|
1458
1460
|
...rest,
|
|
1459
|
-
onMessage(msg) {
|
|
1461
|
+
onMessage(msg, _depIndex, _actions) {
|
|
1460
1462
|
if (msg[0] === DATA) {
|
|
1461
1463
|
const value = msg[1];
|
|
1462
1464
|
const key = keyExtractor?.(value) ?? null;
|
|
@@ -1555,7 +1557,7 @@ function toRedisStream(source, client, key, opts) {
|
|
|
1555
1557
|
const inner = node([source], () => void 0, {
|
|
1556
1558
|
describeKind: "effect",
|
|
1557
1559
|
...rest,
|
|
1558
|
-
onMessage(msg) {
|
|
1560
|
+
onMessage(msg, _depIndex, _actions) {
|
|
1559
1561
|
if (msg[0] === DATA) {
|
|
1560
1562
|
const value = msg[1];
|
|
1561
1563
|
let fields;
|
|
@@ -1813,7 +1815,7 @@ function toPulsar(source, pulsarProducer, opts) {
|
|
|
1813
1815
|
const inner = node([source], () => void 0, {
|
|
1814
1816
|
describeKind: "effect",
|
|
1815
1817
|
...rest,
|
|
1816
|
-
onMessage(msg) {
|
|
1818
|
+
onMessage(msg, _depIndex, _actions) {
|
|
1817
1819
|
if (msg[0] === DATA) {
|
|
1818
1820
|
const value = msg[1];
|
|
1819
1821
|
let data;
|
|
@@ -1903,7 +1905,7 @@ function toNATS(source, client, subject, opts) {
|
|
|
1903
1905
|
const inner = node([source], () => void 0, {
|
|
1904
1906
|
describeKind: "effect",
|
|
1905
1907
|
...rest,
|
|
1906
|
-
onMessage(msg) {
|
|
1908
|
+
onMessage(msg, _depIndex, _actions) {
|
|
1907
1909
|
if (msg[0] === DATA) {
|
|
1908
1910
|
const value = msg[1];
|
|
1909
1911
|
let data;
|
|
@@ -1997,7 +1999,7 @@ function toRabbitMQ(source, channel, exchange, opts) {
|
|
|
1997
1999
|
const inner = node([source], () => void 0, {
|
|
1998
2000
|
describeKind: "effect",
|
|
1999
2001
|
...rest,
|
|
2000
|
-
onMessage(msg) {
|
|
2002
|
+
onMessage(msg, _depIndex, _actions) {
|
|
2001
2003
|
if (msg[0] === DATA) {
|
|
2002
2004
|
const value = msg[1];
|
|
2003
2005
|
let routingKey;
|
|
@@ -2077,7 +2079,7 @@ function toFile(source, writer, opts) {
|
|
|
2077
2079
|
const inner = node([source], () => void 0, {
|
|
2078
2080
|
describeKind: "effect",
|
|
2079
2081
|
...rest,
|
|
2080
|
-
onMessage(msg) {
|
|
2082
|
+
onMessage(msg, _depIndex, _actions) {
|
|
2081
2083
|
if (msg[0] === DATA) {
|
|
2082
2084
|
const value = msg[1];
|
|
2083
2085
|
let line;
|
|
@@ -2216,7 +2218,7 @@ function toClickHouse(source, client, table, opts) {
|
|
|
2216
2218
|
const inner = node([source], () => void 0, {
|
|
2217
2219
|
describeKind: "effect",
|
|
2218
2220
|
...rest,
|
|
2219
|
-
onMessage(msg) {
|
|
2221
|
+
onMessage(msg, _depIndex, _actions) {
|
|
2220
2222
|
if (msg[0] === DATA) {
|
|
2221
2223
|
const value = msg[1];
|
|
2222
2224
|
try {
|
|
@@ -2312,7 +2314,7 @@ function toS3(source, client, bucket, opts) {
|
|
|
2312
2314
|
const inner = node([source], () => void 0, {
|
|
2313
2315
|
describeKind: "effect",
|
|
2314
2316
|
...rest,
|
|
2315
|
-
onMessage(msg) {
|
|
2317
|
+
onMessage(msg, _depIndex, _actions) {
|
|
2316
2318
|
if (msg[0] === DATA) {
|
|
2317
2319
|
const value = msg[1];
|
|
2318
2320
|
try {
|
|
@@ -2362,7 +2364,7 @@ function toPostgres(source, client, table, opts) {
|
|
|
2362
2364
|
const inner = node([source], () => void 0, {
|
|
2363
2365
|
describeKind: "effect",
|
|
2364
2366
|
...rest,
|
|
2365
|
-
onMessage(msg) {
|
|
2367
|
+
onMessage(msg, _depIndex, _actions) {
|
|
2366
2368
|
if (msg[0] === DATA) {
|
|
2367
2369
|
const value = msg[1];
|
|
2368
2370
|
let query;
|
|
@@ -2396,7 +2398,7 @@ function toMongo(source, collection, opts) {
|
|
|
2396
2398
|
const inner = node([source], () => void 0, {
|
|
2397
2399
|
describeKind: "effect",
|
|
2398
2400
|
...rest,
|
|
2399
|
-
onMessage(msg) {
|
|
2401
|
+
onMessage(msg, _depIndex, _actions) {
|
|
2400
2402
|
if (msg[0] === DATA) {
|
|
2401
2403
|
const value = msg[1];
|
|
2402
2404
|
let doc;
|
|
@@ -2436,7 +2438,7 @@ function toLoki(source, client, opts) {
|
|
|
2436
2438
|
const inner = node([source], () => void 0, {
|
|
2437
2439
|
describeKind: "effect",
|
|
2438
2440
|
...rest,
|
|
2439
|
-
onMessage(msg) {
|
|
2441
|
+
onMessage(msg, _depIndex, _actions) {
|
|
2440
2442
|
if (msg[0] === DATA) {
|
|
2441
2443
|
const value = msg[1];
|
|
2442
2444
|
let line;
|
|
@@ -2482,7 +2484,7 @@ function toTempo(source, client, opts) {
|
|
|
2482
2484
|
const inner = node([source], () => void 0, {
|
|
2483
2485
|
describeKind: "effect",
|
|
2484
2486
|
...rest,
|
|
2485
|
-
onMessage(msg) {
|
|
2487
|
+
onMessage(msg, _depIndex, _actions) {
|
|
2486
2488
|
if (msg[0] === DATA) {
|
|
2487
2489
|
const value = msg[1];
|
|
2488
2490
|
let spans;
|
|
@@ -2551,6 +2553,75 @@ function checkpointToRedis(graph, client, opts) {
|
|
|
2551
2553
|
};
|
|
2552
2554
|
return graph.autoCheckpoint(adapter, { debounceMs, compactEvery, onError });
|
|
2553
2555
|
}
|
|
2556
|
+
function fromSqlite(db, query, opts) {
|
|
2557
|
+
const { mapRow = (r) => r, params, ...rest } = opts ?? {};
|
|
2558
|
+
return producer(
|
|
2559
|
+
(_d, a) => {
|
|
2560
|
+
let mapped;
|
|
2561
|
+
try {
|
|
2562
|
+
const rows = db.query(query, params);
|
|
2563
|
+
mapped = rows.map(mapRow);
|
|
2564
|
+
} catch (err) {
|
|
2565
|
+
a.down([[ERROR, err instanceof Error ? err : new Error(String(err))]]);
|
|
2566
|
+
return void 0;
|
|
2567
|
+
}
|
|
2568
|
+
batch(() => {
|
|
2569
|
+
for (const item of mapped) {
|
|
2570
|
+
a.down([[DATA, item]]);
|
|
2571
|
+
}
|
|
2572
|
+
a.down([[COMPLETE]]);
|
|
2573
|
+
});
|
|
2574
|
+
return void 0;
|
|
2575
|
+
},
|
|
2576
|
+
{ describeKind: "producer", completeWhenDepsComplete: false, ...rest }
|
|
2577
|
+
);
|
|
2578
|
+
}
|
|
2579
|
+
function toSqlite(source, db, table, opts) {
|
|
2580
|
+
if (table.includes("\0") || table.length === 0) {
|
|
2581
|
+
throw new Error(`toSqlite: invalid table name: ${JSON.stringify(table)}`);
|
|
2582
|
+
}
|
|
2583
|
+
const {
|
|
2584
|
+
toSQL = (v, t) => ({
|
|
2585
|
+
sql: `INSERT INTO "${t.replace(/"/g, '""')}" (data) VALUES (?)`,
|
|
2586
|
+
params: [JSON.stringify(v)]
|
|
2587
|
+
}),
|
|
2588
|
+
onTransportError,
|
|
2589
|
+
...rest
|
|
2590
|
+
} = opts ?? {};
|
|
2591
|
+
const inner = node([source], () => void 0, {
|
|
2592
|
+
describeKind: "effect",
|
|
2593
|
+
...rest,
|
|
2594
|
+
onMessage(msg, _depIndex, _actions) {
|
|
2595
|
+
if (msg[0] === DATA) {
|
|
2596
|
+
const value = msg[1];
|
|
2597
|
+
let query;
|
|
2598
|
+
try {
|
|
2599
|
+
query = toSQL(value, table);
|
|
2600
|
+
} catch (err) {
|
|
2601
|
+
onTransportError?.({
|
|
2602
|
+
stage: "serialize",
|
|
2603
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
2604
|
+
value
|
|
2605
|
+
});
|
|
2606
|
+
return true;
|
|
2607
|
+
}
|
|
2608
|
+
try {
|
|
2609
|
+
db.query(query.sql, query.params);
|
|
2610
|
+
} catch (err) {
|
|
2611
|
+
onTransportError?.({
|
|
2612
|
+
stage: "send",
|
|
2613
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
2614
|
+
value
|
|
2615
|
+
});
|
|
2616
|
+
}
|
|
2617
|
+
return true;
|
|
2618
|
+
}
|
|
2619
|
+
return false;
|
|
2620
|
+
}
|
|
2621
|
+
});
|
|
2622
|
+
return inner.subscribe(() => {
|
|
2623
|
+
});
|
|
2624
|
+
}
|
|
2554
2625
|
|
|
2555
2626
|
// src/extra/checkpoint.ts
|
|
2556
2627
|
import { randomBytes } from "crypto";
|
|
@@ -5531,6 +5602,8 @@ export {
|
|
|
5531
5602
|
toTempo,
|
|
5532
5603
|
checkpointToS3,
|
|
5533
5604
|
checkpointToRedis,
|
|
5605
|
+
fromSqlite,
|
|
5606
|
+
toSqlite,
|
|
5534
5607
|
MemoryCheckpointAdapter,
|
|
5535
5608
|
DictCheckpointAdapter,
|
|
5536
5609
|
FileCheckpointAdapter,
|
|
@@ -5605,4 +5678,4 @@ export {
|
|
|
5605
5678
|
workerSelf,
|
|
5606
5679
|
extra_exports
|
|
5607
5680
|
};
|
|
5608
|
-
//# sourceMappingURL=chunk-
|
|
5681
|
+
//# sourceMappingURL=chunk-V3UACY6A.js.map
|