Skip to content

Commit 4c809d2

Browse files
committed
fix: remove node module uri prefix
1 parent a790382 commit 4c809d2

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/stream.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { hostname } from 'node:os'
1+
import { hostname } from 'os'
22
import { ack, createClient, initStreams, readAckDelete } from './redis.js'
33
import type {
44
RedisStreamOptions,
@@ -8,7 +8,7 @@ import type {
88
StreamEntry,
99
} from './types.js'
1010

11-
export { RedisStreamOptions }
11+
export { RedisStreamOptions, RedisClient, RedisOptions } from './types'
1212

1313
const allowedKeys = {
1414
stream: 1,
@@ -268,6 +268,11 @@ export class RedisStream {
268268
await this.maybeUnblock()
269269
}
270270

271+
/**
272+
* Flush any acknowledgements that were added potentially after the stream finished.
273+
* @param client
274+
* @returns
275+
*/
271276
public async flush(client?: RedisClient) {
272277
if (!this.pendingAcks.size) return
273278
let c = client

src/test.util.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { RedisClient, StreamEntry, XEntryResult } from './types.js'
22
import { afterAll } from 'vitest'
33
import mkDebug from 'debug'
4-
import { randomInt } from 'node:crypto'
4+
import { randomInt } from 'crypto'
55
import Chance from 'chance'
66

77
const seed = Number(process.env.TEST_SEED) || randomInt(Date.now())

src/types.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export type XEntryBufferResult = [StreamKey, StreamEntryKeyValueBuffers]
1616
export type XStreamResultBuffer = [StreamKey, StreamEntryKeyValueBuffers[]]
1717
export type XBatchResultBuffer = XStreamResult[]
1818

19-
export { Redis as RedisClient }
19+
export type RedisClient = Redis
20+
export { RedisOptions }
2021

2122
export class RedisStreamAbortedError extends Error {
2223
message = 'RedisStream Aborted with unprocessed results'
@@ -51,13 +52,13 @@ export interface RedisStreamOptions {
5152
* The IORedis client connection (reader).
5253
* NOTE: by default this connection becomes a "reader" when block > 0
5354
*/
54-
redis?: Redis | string | RedisOptions
55+
redis?: RedisClient | string | RedisOptions
5556
/**
5657
* The IORedis control client connection (writer).
5758
* NOTE: by default this connection becomes a "writer" when block = 0 or Infinity
5859
* Only allowed if block = 0 or Infinity
5960
*/
60-
redisControl?: Redis | string | RedisOptions
61+
redisControl?: RedisClient | string | RedisOptions
6162
/**
6263
* Return buffers with each xread operation
6364
* This applies to entry id and kv results

0 commit comments

Comments
 (0)