comq 0.5.0 → 0.5.1-dev.1
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/.github/ISSUE_TEMPLATE/bug_report.md +20 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/.github/dependabot.yml +17 -0
- package/.github/workflows/codeql.yml +76 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/LICENSE +1 -1
- package/examples/readme.md +2 -0
- package/features/steps/events.js +6 -2
- package/lerna.json +1 -1
- package/package.json +7 -3
- package/readme.md +2 -2
- package/source/channel.js +1 -1
- package/source/io.js +7 -2
- package/source/shards/channel.js +2 -2
- package/test/channel.test.js +6 -6
- package/test/connection.mock.js +1 -1
- package/test/io.consume.test.js +12 -0
- package/test/io.reply.test.js +4 -4
- package/test/shards/channel.test.js +1 -1
- package/types/channel.d.ts +1 -1
- package/.github/labels.yaml +0 -15
- package/.github/workflows/labels.yaml +0 -18
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: 'fix: '
|
|
5
|
+
labels: Bug
|
|
6
|
+
assignees: temich
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior:
|
|
15
|
+
|
|
16
|
+
**Expected behavior**
|
|
17
|
+
A clear and concise description of what you expected to happen.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "github-actions"
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "weekly"
|
|
7
|
+
target-branch: "dev"
|
|
8
|
+
labels:
|
|
9
|
+
- "dependency"
|
|
10
|
+
- "actions"
|
|
11
|
+
- package-ecosystem: "npm"
|
|
12
|
+
directory: "/"
|
|
13
|
+
schedule:
|
|
14
|
+
interval: "daily"
|
|
15
|
+
target-branch: "dev"
|
|
16
|
+
labels:
|
|
17
|
+
- "dependency"
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
+
# to commit it to your repository.
|
|
3
|
+
#
|
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
+
# or to provide custom queries or build logic.
|
|
6
|
+
#
|
|
7
|
+
# ******** NOTE ********
|
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
+
# supported CodeQL languages.
|
|
11
|
+
#
|
|
12
|
+
name: "CodeQL"
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: [ "main" ]
|
|
17
|
+
pull_request:
|
|
18
|
+
# The branches below must be a subset of the branches above
|
|
19
|
+
branches: [ "main" ]
|
|
20
|
+
schedule:
|
|
21
|
+
- cron: '15 8 * * 3'
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
analyze:
|
|
25
|
+
name: Analyze
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
permissions:
|
|
28
|
+
actions: read
|
|
29
|
+
contents: read
|
|
30
|
+
security-events: write
|
|
31
|
+
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix:
|
|
35
|
+
language: [ 'javascript' ]
|
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
37
|
+
# Use only 'java' to analyze code written in Java, Kotlin or both
|
|
38
|
+
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
|
|
39
|
+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
|
40
|
+
|
|
41
|
+
steps:
|
|
42
|
+
- name: Checkout repository
|
|
43
|
+
uses: actions/checkout@v3
|
|
44
|
+
|
|
45
|
+
# Initializes the CodeQL tools for scanning.
|
|
46
|
+
- name: Initialize CodeQL
|
|
47
|
+
uses: github/codeql-action/init@v2
|
|
48
|
+
with:
|
|
49
|
+
languages: ${{ matrix.language }}
|
|
50
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
51
|
+
# By default, queries listed here will override any specified in a config file.
|
|
52
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
53
|
+
|
|
54
|
+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
|
55
|
+
# queries: security-extended,security-and-quality
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
|
59
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
|
60
|
+
- name: Autobuild
|
|
61
|
+
uses: github/codeql-action/autobuild@v2
|
|
62
|
+
|
|
63
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
64
|
+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
65
|
+
|
|
66
|
+
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
|
67
|
+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
|
68
|
+
|
|
69
|
+
# - run: |
|
|
70
|
+
# echo "Run, Build Application using script"
|
|
71
|
+
# ./location_of_script_within_repo/buildscript.sh
|
|
72
|
+
|
|
73
|
+
- name: Perform CodeQL Analysis
|
|
74
|
+
uses: github/codeql-action/analyze@v2
|
|
75
|
+
with:
|
|
76
|
+
category: "/language:${{matrix.language}}"
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
tema.gurtovoy@gmail.com.
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series
|
|
86
|
+
of actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
|
93
|
+
permanent ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
113
|
+
the community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.0, available at
|
|
119
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
122
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
123
|
+
|
|
124
|
+
[homepage]: https://www.contributor-covenant.org
|
|
125
|
+
|
|
126
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
127
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
|
128
|
+
https://www.contributor-covenant.org/translations.
|
package/LICENSE
CHANGED
package/examples/readme.md
CHANGED
package/features/steps/events.js
CHANGED
|
@@ -115,10 +115,14 @@ Then('all events have been received',
|
|
|
115
115
|
async function consume (group, exchange) {
|
|
116
116
|
this.consumed ??= {}
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
const consumer = async (payload) => {
|
|
119
119
|
this.consumed[group] = payload
|
|
120
120
|
this.eventsConsumedCount++
|
|
121
|
-
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return group === undefined
|
|
124
|
+
? this.io.consume(exchange, consumer)
|
|
125
|
+
: this.io.consume(exchange, group, consumer)
|
|
122
126
|
}
|
|
123
127
|
|
|
124
128
|
/**
|
package/lerna.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comq",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1-dev.1",
|
|
4
4
|
"description": "ComQ",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Artem Gurtovoi",
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/toa-io/comq/issues"
|
|
16
16
|
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"AMQP",
|
|
19
|
+
"RabbitMQ"
|
|
20
|
+
],
|
|
17
21
|
"engines": {
|
|
18
22
|
"node": ">= 12.0.0"
|
|
19
23
|
},
|
|
@@ -23,13 +27,13 @@
|
|
|
23
27
|
"main": "source/index.js",
|
|
24
28
|
"types": "types/index.d.ts",
|
|
25
29
|
"devDependencies": {
|
|
26
|
-
"@cucumber/cucumber": "9.0.
|
|
30
|
+
"@cucumber/cucumber": "9.0.1",
|
|
27
31
|
"@toa.io/command": "0.3.0",
|
|
28
32
|
"@toa.io/mock": "0.3.0",
|
|
29
33
|
"@toa.io/tomato": "0.4.0-dev.2",
|
|
30
34
|
"@toa.io/yaml": "0.4.0-dev.2",
|
|
31
35
|
"@types/amqplib": "0.10.1",
|
|
32
|
-
"@types/jest": "29.
|
|
36
|
+
"@types/jest": "29.5.0",
|
|
33
37
|
"husky": "8.0.3",
|
|
34
38
|
"jest": "29.5.0",
|
|
35
39
|
"randomstring": "1.2.3",
|
package/readme.md
CHANGED
|
@@ -124,8 +124,8 @@ Event message is delivered to a single Consumer within *each group*.
|
|
|
124
124
|
> Typically, the value of `group` refers to the name of a microservice running in multiple
|
|
125
125
|
> instances.
|
|
126
126
|
|
|
127
|
-
If the `group` is `undefined` or omitted, a
|
|
128
|
-
|
|
127
|
+
If the `group` is `undefined` or omitted, a queue for the Consumer is asserted as exclusive with
|
|
128
|
+
auto-generated name.
|
|
129
129
|
|
|
130
130
|
### Example
|
|
131
131
|
|
package/source/channel.js
CHANGED
|
@@ -104,7 +104,7 @@ class Channel {
|
|
|
104
104
|
await this.#publish(exchange, DEFAULT, buffer, options)
|
|
105
105
|
}))
|
|
106
106
|
|
|
107
|
-
async
|
|
107
|
+
async fire (queue, buffer, options) {
|
|
108
108
|
try {
|
|
109
109
|
await this.#publish(DEFAULT, queue, buffer, options)
|
|
110
110
|
} catch (exception) {
|
package/source/io.js
CHANGED
|
@@ -83,7 +83,12 @@ class IO {
|
|
|
83
83
|
|
|
84
84
|
consume = lazy(this, this.#createEventChannel,
|
|
85
85
|
async (exchange, group, callback) => {
|
|
86
|
-
|
|
86
|
+
if (callback === undefined) { // 2 arguments passed
|
|
87
|
+
callback = group
|
|
88
|
+
group = undefined
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const exclusive = group === undefined
|
|
87
92
|
const queue = exclusive ? undefined : io.concat(exchange, group)
|
|
88
93
|
const consumer = this.#getEventConsumer(callback)
|
|
89
94
|
|
|
@@ -184,7 +189,7 @@ class IO {
|
|
|
184
189
|
const buffer = contentType === OCTETS ? reply : encode(reply, contentType)
|
|
185
190
|
const properties = { contentType, correlationId }
|
|
186
191
|
|
|
187
|
-
await this.#replies.
|
|
192
|
+
await this.#replies.fire(message.properties.replyTo, buffer, properties)
|
|
188
193
|
})
|
|
189
194
|
|
|
190
195
|
/**
|
package/source/shards/channel.js
CHANGED
|
@@ -63,8 +63,8 @@ class Channel {
|
|
|
63
63
|
await this.#one((channel) => channel.publish(exchange, buffer, options))
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
async
|
|
67
|
-
await this.#one((channel) => channel.
|
|
66
|
+
async fire (queue, buffer, options) {
|
|
67
|
+
await this.#one((channel) => channel.fire(queue, buffer, options))
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
async seal () {
|
package/test/channel.test.js
CHANGED
|
@@ -283,7 +283,7 @@ describe('send', () => {
|
|
|
283
283
|
})
|
|
284
284
|
})
|
|
285
285
|
|
|
286
|
-
describe('
|
|
286
|
+
describe('fire', () => {
|
|
287
287
|
const queue = generate()
|
|
288
288
|
const buffer = randomBytes(10)
|
|
289
289
|
const options = { contentType: 'application/octet-stream' }
|
|
@@ -294,11 +294,11 @@ describe('throw', () => {
|
|
|
294
294
|
})
|
|
295
295
|
|
|
296
296
|
it('should be', async () => {
|
|
297
|
-
expect(channel.
|
|
297
|
+
expect(channel.fire).toBeDefined()
|
|
298
298
|
})
|
|
299
299
|
|
|
300
300
|
it('should publish a message', async () => {
|
|
301
|
-
await channel.
|
|
301
|
+
await channel.fire(queue, buffer, options)
|
|
302
302
|
|
|
303
303
|
const call = chan.publish.mock.calls[0]
|
|
304
304
|
|
|
@@ -311,7 +311,7 @@ describe('throw', () => {
|
|
|
311
311
|
it('should ignore exceptions', async () => {
|
|
312
312
|
chan.publish.mockImplementation(() => { throw new Error() })
|
|
313
313
|
|
|
314
|
-
await expect(channel.
|
|
314
|
+
await expect(channel.fire(queue, buffer, options)).resolves.not.toThrow()
|
|
315
315
|
})
|
|
316
316
|
|
|
317
317
|
it('should wait for unpause', async () => {
|
|
@@ -342,7 +342,7 @@ describe('throw', () => {
|
|
|
342
342
|
chan.emit('drain')
|
|
343
343
|
})
|
|
344
344
|
|
|
345
|
-
await channel.
|
|
345
|
+
await channel.fire(queue, buffer, options)
|
|
346
346
|
|
|
347
347
|
expect(chan.publish).toHaveBeenCalledTimes(3)
|
|
348
348
|
})
|
|
@@ -900,7 +900,7 @@ describe('transient', () => {
|
|
|
900
900
|
it('should not ignore exceptions on `throw()`', async () => {
|
|
901
901
|
chan.publish.mockImplementation(() => { throw new Error('Channel closed') })
|
|
902
902
|
|
|
903
|
-
await expect(channel.
|
|
903
|
+
await expect(channel.fire(queue, buffer)).rejects.toThrow()
|
|
904
904
|
})
|
|
905
905
|
|
|
906
906
|
it('should expose index', async () => {
|
package/test/connection.mock.js
CHANGED
|
@@ -7,7 +7,7 @@ const channel = /** @type {jest.MockedFunction<(sharded?: boolean, index?: numbe
|
|
|
7
7
|
consume: jest.fn(async () => undefined),
|
|
8
8
|
deliver: jest.fn(async () => undefined),
|
|
9
9
|
send: jest.fn(async () => undefined),
|
|
10
|
-
|
|
10
|
+
fire: jest.fn(async () => undefined),
|
|
11
11
|
subscribe: jest.fn(async () => undefined),
|
|
12
12
|
publish: jest.fn(async () => undefined),
|
|
13
13
|
diagnose: jest.fn(async () => undefined),
|
package/test/io.consume.test.js
CHANGED
|
@@ -84,6 +84,18 @@ describe.each(['omitted', 'undefined'])('exclusive consumption (group is %s)', (
|
|
|
84
84
|
expect(events).toBeDefined()
|
|
85
85
|
expect(events.subscribe).toHaveBeenCalledWith(exchange, undefined, expect.any(Function))
|
|
86
86
|
})
|
|
87
|
+
|
|
88
|
+
it('should pass messages to the consumer', async () => {
|
|
89
|
+
const emit = events.subscribe.mock.calls[0][2]
|
|
90
|
+
const content = generate()
|
|
91
|
+
const contentType = 'text/plain'
|
|
92
|
+
const properties = { contentType }
|
|
93
|
+
const message = { content, properties }
|
|
94
|
+
|
|
95
|
+
await emit(message)
|
|
96
|
+
|
|
97
|
+
expect(consumer).toHaveBeenCalledWith(message.content)
|
|
98
|
+
})
|
|
87
99
|
})
|
|
88
100
|
|
|
89
101
|
/**
|
package/test/io.reply.test.js
CHANGED
|
@@ -91,7 +91,7 @@ describe('reply', () => {
|
|
|
91
91
|
beforeEach(async () => {
|
|
92
92
|
})
|
|
93
93
|
|
|
94
|
-
it('should `
|
|
94
|
+
it('should `fire` reply', async () => {
|
|
95
95
|
await io.reply(queue, produce)
|
|
96
96
|
|
|
97
97
|
requests = await findChannel('request')
|
|
@@ -107,7 +107,7 @@ describe('reply', () => {
|
|
|
107
107
|
const reply = await produce.mock.results[0].value
|
|
108
108
|
const buffer = encode(reply, properties.contentType)
|
|
109
109
|
|
|
110
|
-
expect(replies.
|
|
110
|
+
expect(replies.fire).toHaveBeenCalledWith(properties.replyTo, buffer, expect.anything())
|
|
111
111
|
})
|
|
112
112
|
|
|
113
113
|
it('should throw if producer returned undefined', async () => {
|
|
@@ -177,7 +177,7 @@ describe('encoding', () => {
|
|
|
177
177
|
contentType: properties.contentType
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
expect(replies.
|
|
180
|
+
expect(replies.fire).toHaveBeenCalledWith(properties.replyTo, reply, props)
|
|
181
181
|
})
|
|
182
182
|
|
|
183
183
|
it('should set octet-stream for Buffer reply', async () => {
|
|
@@ -198,7 +198,7 @@ describe('encoding', () => {
|
|
|
198
198
|
|
|
199
199
|
await producer(message)
|
|
200
200
|
|
|
201
|
-
expect(replies.
|
|
201
|
+
expect(replies.fire)
|
|
202
202
|
.toHaveBeenCalledWith(
|
|
203
203
|
expect.any(String),
|
|
204
204
|
buffer,
|
|
@@ -140,7 +140,7 @@ describe.each(['consume', 'subscribe'])('%s', (method) => {
|
|
|
140
140
|
})
|
|
141
141
|
})
|
|
142
142
|
|
|
143
|
-
describe.each(/** @type {string[]} */['send', 'publish', '
|
|
143
|
+
describe.each(/** @type {string[]} */['send', 'publish', 'fire'])('%s', (method) => {
|
|
144
144
|
const label = generate()
|
|
145
145
|
const buffer = randomBytes(8)
|
|
146
146
|
const options = { contentType: generate() }
|
package/types/channel.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare namespace comq {
|
|
|
23
23
|
|
|
24
24
|
publish(exchange: string, buffer: Buffer, options?: Options.Publish): Promise<void>
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
fire(queue: string, buffer: Buffer, options?: Options.Publish): Promise<void>
|
|
27
27
|
|
|
28
28
|
seal(): Promise<void>
|
|
29
29
|
|
package/.github/labels.yaml
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
- name: "Bug"
|
|
2
|
-
description: "Something isn't working"
|
|
3
|
-
color: "d73a4a"
|
|
4
|
-
- name: "Critical"
|
|
5
|
-
description: "Immediate action required"
|
|
6
|
-
color: "ffff00"
|
|
7
|
-
- name: "Docs"
|
|
8
|
-
description: "Documentation improvements"
|
|
9
|
-
color: "0075ca"
|
|
10
|
-
- name: "Feature"
|
|
11
|
-
description: "Feature request"
|
|
12
|
-
color: "73E25B"
|
|
13
|
-
- name: "Improvement"
|
|
14
|
-
description: "Make something better"
|
|
15
|
-
color: "6A1877"
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
name: Labels
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- 'dev'
|
|
7
|
-
paths:
|
|
8
|
-
- '.github/labels.yml'
|
|
9
|
-
- '.github/workflows/labels.yml'
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
labeler:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
steps:
|
|
15
|
-
- name: Checkout
|
|
16
|
-
uses: actions/checkout@v3
|
|
17
|
-
- name: Run Labeler
|
|
18
|
-
uses: crazy-max/ghaction-github-labeler@v4
|