@nitra/nats 3.0.5 → 3.0.6
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/package.json +1 -1
- package/src/consumer.js +1 -1
- package/src/stream.js +1 -2
- package/src/worker.js +2 -3
package/package.json
CHANGED
package/src/consumer.js
CHANGED
package/src/stream.js
CHANGED
|
@@ -2,10 +2,9 @@ import { jsm } from './nats.js'
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Перевіряє наявність або створює JetStream stream.
|
|
5
|
-
* @param {string} subject - subject у форматі project:subject (для валідації)
|
|
6
5
|
* @returns {Promise<void>}
|
|
7
6
|
*/
|
|
8
|
-
export async function ensureStream(
|
|
7
|
+
export async function ensureStream() {
|
|
9
8
|
try {
|
|
10
9
|
await jsm.streams.info('stream')
|
|
11
10
|
console.debug('✅ Stream already exists')
|
package/src/worker.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { js, jc } from './nats.js'
|
|
2
|
-
import { state } from './utils.js'
|
|
3
|
-
import { checkSubjectFormat } from './utils.js'
|
|
2
|
+
import { state, checkSubjectFormat } from './utils.js'
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Зчитує одне повідомлення з JetStream для вказаного subject.
|
|
@@ -13,7 +12,7 @@ export async function read(subject) {
|
|
|
13
12
|
let consumer
|
|
14
13
|
try {
|
|
15
14
|
consumer = await js.consumers.get('stream', `durable_${subject}`)
|
|
16
|
-
} catch
|
|
15
|
+
} catch {
|
|
17
16
|
console.error('consumer not found for subject:', subject)
|
|
18
17
|
return {}
|
|
19
18
|
}
|