diff --git a/.changeset/fifty-camels-wink.md b/.changeset/fifty-camels-wink.md new file mode 100644 index 000000000..9497f2830 --- /dev/null +++ b/.changeset/fifty-camels-wink.md @@ -0,0 +1,5 @@ +--- +"@asyncapi/gleequore": minor +--- + +Initial release diff --git a/.changeset/tasty-needles-serve.md b/.changeset/tasty-needles-serve.md new file mode 100644 index 000000000..0494f8cb8 --- /dev/null +++ b/.changeset/tasty-needles-serve.md @@ -0,0 +1,11 @@ +--- +"@asyncapi/glee-redis-cluster-adapter": minor +"@asyncapi/glee-web-server-adapter": minor +"@asyncapi/glee-socketio-adapter": minor +"@asyncapi/glee-kafka-adapter": minor +"@asyncapi/glee-mqtt-adapter": minor +"@asyncapi/glee-shared-utils": minor +"@asyncapi/glee-web-adapter": minor +--- + +Initial release of adapters and shared utils library diff --git a/.github/workflows/release-with-changesets.yml b/.github/workflows/release-with-changesets.yml new file mode 100644 index 000000000..0e849831c --- /dev/null +++ b/.github/workflows/release-with-changesets.yml @@ -0,0 +1,129 @@ +# It does magic only if there is a package.json file in the root of the project +name: Release - if Node project + +on: + push: + branches: + - master + +jobs: + test-nodejs: + # We just check the message of the first commit as there is always just one commit because we squash into one before merging + # "commits" contains an array of objects where one of the properties is the commit "message" + # Release workflow will be skipped if release conventional commits are not used + if: | + startsWith( github.repository, 'asyncapi/' ) + name: Test NodeJS release on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + # Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner. + # See: https://github.com/puppeteer/puppeteer/issues/12327 and https://github.com/asyncapi/parser-js/issues/1001 + os: [ubuntu-latest, macos-13, windows-latest] + steps: + - name: Set git to use LF # To once and for all finish the never-ending fight between Unix and Windows + run: | + git config --global core.autocrlf false + git config --global core.eol lf + shell: bash + - name: Checkout repository + uses: actions/checkout@v4 + - name: Check if Node.js project and has package.json + id: packagejson + run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT + shell: bash + - if: steps.packagejson.outputs.exists == 'true' + name: Check package-lock version + uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master + id: lockversion + - if: steps.packagejson.outputs.exists == 'true' + name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "${{ steps.lockversion.outputs.version }}" + - if: steps.lockversion.outputs.version == '18' && matrix.os == 'windows-latest' + name: Install npm cli 8 + shell: bash + # npm cli 10 is buggy because of some cache issues + run: npm install -g npm@8.19.4 + - if: steps.packagejson.outputs.exists == 'true' + name: Install dependencies + shell: bash + run: npm ci + - if: steps.packagejson.outputs.exists == 'true' + name: Run test + run: npm test --if-present + - if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel + name: Report workflow run status to Slack + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,action,workflow + text: "Release workflow failed in testing job" + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} + + release: + needs: [test-nodejs] + name: Publish to any of NPM, GitHub, or Docker Hub + runs-on: ubuntu-latest + steps: + - name: Set git to use LF # To once and for all finish the never-ending fight between Unix and Windows + run: | + git config --global core.autocrlf false + git config --global core.eol lf + - name: Checkout repository + uses: actions/checkout@v4 + - name: Check if Node.js project and has package.json + id: packagejson + run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT + shell: bash + - if: steps.packagejson.outputs.exists == 'true' + name: Check package-lock version + uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master + id: lockversion + - if: steps.packagejson.outputs.exists == 'true' + name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "${{ steps.lockversion.outputs.version }}" + - if: steps.packagejson.outputs.exists == 'true' + name: Install dependencies + shell: bash + run: npm ci + - if: steps.packagejson.outputs.exists == 'true' + name: Build dependency + shell: bash + run: npm run build + - if: steps.packagejson.outputs.exists == 'true' + name: Install changelog + shell: bash + run: npm install @changesets/changelog-git@0.2.0 + - if: steps.packagejson.outputs.exists == 'true' + name: Publish to any of NPM, Github, and Docker Hub + uses: changesets/action@v1 + id: release + with: + version: npx -p @changesets/cli changeset version + commit: version packages + title: "chore(release): version packages" + publish: npx -p @changesets/cli changeset publish + setupGitUser: false + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + GIT_AUTHOR_NAME: asyncapi-bot + GIT_AUTHOR_EMAIL: info@asyncapi.io + GIT_COMMITTER_NAME: asyncapi-bot + GIT_COMMITTER_EMAIL: info@asyncapi.io + - if: failure() # Only, on failure, send a message on the 94_bot-failing-ci Slack channel + name: Report workflow run status to Slack + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,action,workflow + text: "Release workflow failed in release job" + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} \ No newline at end of file diff --git a/.sonarcloud.properties b/.sonarcloud.properties index fe5cb976e..0dd94a6fd 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,2 +1,5 @@ #we need to explicitly exclude them as they're not relevant to the source code -sonar.exclusions=packages/glee/examples/**/*,packages/glee/docs/**/* \ No newline at end of file +sonar.exclusions=packages/glee/examples/**/*,packages/glee/docs/**/*,packages/gleequore/docs/**/* + +# Ignore all duplicated code as it will be removed once we replace Glee's core with GleeQuore +sonar.cpd.exclusions=packages/glee/src/adapters/**/*,packages/*-adapter/**/*,packages/shared-utils/**/*,packages/gleequore/**/* diff --git a/CODEOWNERS b/CODEOWNERS index f83cc223b..901155a99 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -7,4 +7,5 @@ # The default owners are automatically added as reviewers when you open a pull request unless different owners are specified in the file. * @Souvikns @KhudaDad414 @asyncapi-bot-eve -* packages/glee @Souvikns @KhudaDad414 @asyncapi-bot-eve \ No newline at end of file +packages/glee @Souvikns @KhudaDad414 @asyncapi-bot-eve +packages/gleequore @fmvilas @Souvikns @KhudaDad414 @asyncapi-bot-eve \ No newline at end of file diff --git a/packages/glee/docs/reference/classes/adapters_cluster_redis.default.html b/packages/glee/docs/reference/classes/adapters_cluster_redis.default.html index 6cf838256..1bf0c40eb 100644 --- a/packages/glee/docs/reference/classes/adapters_cluster_redis.default.html +++ b/packages/glee/docs/reference/classes/adapters_cluster_redis.default.html @@ -1,4 +1,4 @@ -
Static
captureValue: boolean
+Static
captureValue: boolean
Change the default captureRejections
option on all new EventEmitter
objects.
Static
Readonly
captureValue: Symbol.for('nodejs.rejection')
Installing a listener using this symbol does not change the behavior once an 'error'
event is emitted. Therefore, the process will still crash if no
regular 'error'
listener is installed.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Rest
...args: any[]Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
+
Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
to each.
Returns true
if the event had listeners, false
otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
@@ -107,7 +107,7 @@
Alias for emitter.removeListener()
.
Alias for emitter.removeListener()
.
Rest
...args: any[]Adds the listener
function to the end of the listeners array for the event
named eventName
. No checks are made to see if the listener
has already
@@ -200,10 +200,10 @@
Rest
...args: any[]Sends a message to the remote server.
The message to send.
-Serialize a message into JSON.
The message to serialize.
The serialized message,
-By default EventEmitter
s will print a warning if more than 10
listeners are
+
By default EventEmitter
s will print a warning if more than 10
listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners()
method allows the limit to be
modified for this specific EventEmitter
instance. The value can be set to Infinity
(or 0
) to indicate an unlimited number of listeners.
Static
captureValue: boolean
+Static
captureValue: boolean
Change the default captureRejections
option on all new EventEmitter
objects.
Static
Readonly
captureValue: Symbol.for('nodejs.rejection')
Installing a listener using this symbol does not change the behavior once an 'error'
event is emitted. Therefore, the process will still crash if no
regular 'error'
listener is installed.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Rest
...args: any[]Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
to each.
Returns true
if the event had listeners, false
otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
@@ -100,11 +100,11 @@
Returns the current max listener value for the EventEmitter
which is either
set by emitter.setMaxListeners(n)
or defaults to defaultMaxListeners.
Returns the number of listeners listening for the event named eventName
.
+
Returns the number of listeners listening for the event named eventName
.
If listener
is provided, it will return how many times the listener is found
in the list of the listeners of the event.
The name of the event being listened for
@@ -115,7 +115,7 @@Alias for emitter.removeListener()
.
Alias for emitter.removeListener()
.
Rest
...args: any[]Adds the listener
function to the end of the listeners array for the event
named eventName
. No checks are made to see if the listener
has already
@@ -206,9 +206,9 @@
Returns a reference to the EventEmitter
, so that calls can be chained.
Rest
...args: any[]Sends a message to the remote server.
The message to send.
-By default EventEmitter
s will print a warning if more than 10
listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners()
method allows the limit to be
modified for this specific EventEmitter
instance. The value can be set to Infinity
(or 0
) to indicate an unlimited number of listeners.
Static
captureValue: boolean
+Static
captureValue: boolean
Change the default captureRejections
option on all new EventEmitter
objects.
Static
Readonly
captureValue: Symbol.for('nodejs.rejection')
Installing a listener using this symbol does not change the behavior once an 'error'
event is emitted. Therefore, the process will still crash if no
regular 'error'
listener is installed.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Rest
...args: any[]Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
to each.
Returns true
if the event had listeners, false
otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
@@ -112,11 +112,11 @@
Returns the current max listener value for the EventEmitter
which is either
set by emitter.setMaxListeners(n)
or defaults to defaultMaxListeners.
Returns the number of listeners listening for the event named eventName
.
+
Returns the number of listeners listening for the event named eventName
.
If listener
is provided, it will return how many times the listener is found
in the list of the listeners of the event.
The name of the event being listened for
@@ -127,7 +127,7 @@Alias for emitter.removeListener()
.
Alias for emitter.removeListener()
.
Rest
...args: any[]Adds the listener
function to the end of the listeners array for the event
named eventName
. No checks are made to see if the listener
has already
@@ -218,9 +218,9 @@
Returns a reference to the EventEmitter
, so that calls can be chained.
Rest
...args: any[]Sends a message to the remote server.
The message to send.
-By default EventEmitter
s will print a warning if more than 10
listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners()
method allows the limit to be
modified for this specific EventEmitter
instance. The value can be set to Infinity
(or 0
) to indicate an unlimited number of listeners.
Static
captureValue: boolean
+Static
captureValue: boolean
Change the default captureRejections
option on all new EventEmitter
objects.
Static
Readonly
captureValue: Symbol.for('nodejs.rejection')
Installing a listener using this symbol does not change the behavior once an 'error'
event is emitted. Therefore, the process will still crash if no
regular 'error'
listener is installed.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Rest
...args: any[]Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
+
Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
to each.
Returns true
if the event had listeners, false
otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
@@ -94,11 +94,11 @@
Returns the current max listener value for the EventEmitter
which is either
set by emitter.setMaxListeners(n)
or defaults to defaultMaxListeners.
Returns the number of listeners listening for the event named eventName
.
+
Returns the number of listeners listening for the event named eventName
.
If listener
is provided, it will return how many times the listener is found
in the list of the listeners of the event.
The name of the event being listened for
@@ -109,7 +109,7 @@Alias for emitter.removeListener()
.
Alias for emitter.removeListener()
.
Rest
...args: any[]Adds the listener
function to the end of the listeners array for the event
named eventName
. No checks are made to see if the listener
has already
@@ -200,9 +200,9 @@
Returns a reference to the EventEmitter
, so that calls can be chained.
Rest
...args: any[]Sends a message to the remote server.
The message to send.
-By default EventEmitter
s will print a warning if more than 10
listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners()
method allows the limit to be
modified for this specific EventEmitter
instance. The value can be set to Infinity
(or 0
) to indicate an unlimited number of listeners.
Static
captureValue: boolean
+Static
captureValue: boolean
Change the default captureRejections
option on all new EventEmitter
objects.
Static
Readonly
captureValue: Symbol.for('nodejs.rejection')
Installing a listener using this symbol does not change the behavior once an 'error'
event is emitted. Therefore, the process will still crash if no
regular 'error'
listener is installed.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Rest
...args: any[]Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
to each.
Returns true
if the event had listeners, false
otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
@@ -96,11 +96,11 @@
Returns the current max listener value for the EventEmitter
which is either
set by emitter.setMaxListeners(n)
or defaults to defaultMaxListeners.
Returns the number of listeners listening for the event named eventName
.
+
Returns the number of listeners listening for the event named eventName
.
If listener
is provided, it will return how many times the listener is found
in the list of the listeners of the event.
The name of the event being listened for
@@ -111,7 +111,7 @@Alias for emitter.removeListener()
.
Alias for emitter.removeListener()
.
Rest
...args: any[]Adds the listener
function to the end of the listeners array for the event
named eventName
. No checks are made to see if the listener
has already
@@ -202,9 +202,9 @@
Returns a reference to the EventEmitter
, so that calls can be chained.
Rest
...args: any[]Sends a message to the remote server.
The message to send.
-By default EventEmitter
s will print a warning if more than 10
listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners()
method allows the limit to be
modified for this specific EventEmitter
instance. The value can be set to Infinity
(or 0
) to indicate an unlimited number of listeners.
Static
captureValue: boolean
+Static
captureValue: boolean
Change the default captureRejections
option on all new EventEmitter
objects.
Static
Readonly
captureValue: Symbol.for('nodejs.rejection')
Installing a listener using this symbol does not change the behavior once an 'error'
event is emitted. Therefore, the process will still crash if no
regular 'error'
listener is installed.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Rest
...args: any[]Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
to each.
Returns true
if the event had listeners, false
otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
@@ -95,11 +95,11 @@
Returns the current max listener value for the EventEmitter
which is either
set by emitter.setMaxListeners(n)
or defaults to defaultMaxListeners.
Returns the number of listeners listening for the event named eventName
.
+
Returns the number of listeners listening for the event named eventName
.
If listener
is provided, it will return how many times the listener is found
in the list of the listeners of the event.
The name of the event being listened for
@@ -110,7 +110,7 @@Alias for emitter.removeListener()
.
Alias for emitter.removeListener()
.
Rest
...args: any[]Adds the listener
function to the end of the listeners array for the event
named eventName
. No checks are made to see if the listener
has already
@@ -201,9 +201,9 @@
Returns a reference to the EventEmitter
, so that calls can be chained.
Rest
...args: any[]Sends a message to the remote server.
The message to send.
-By default EventEmitter
s will print a warning if more than 10
listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners()
method allows the limit to be
modified for this specific EventEmitter
instance. The value can be set to Infinity
(or 0
) to indicate an unlimited number of listeners.
Static
captureValue: boolean
+Static
captureValue: boolean
Change the default captureRejections
option on all new EventEmitter
objects.
Static
Readonly
captureValue: Symbol.for('nodejs.rejection')
Installing a listener using this symbol does not change the behavior once an 'error'
event is emitted. Therefore, the process will still crash if no
regular 'error'
listener is installed.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Rest
...args: any[]Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
to each.
Returns true
if the event had listeners, false
otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
@@ -94,11 +94,11 @@
Returns the current max listener value for the EventEmitter
which is either
set by emitter.setMaxListeners(n)
or defaults to defaultMaxListeners.
Returns the number of listeners listening for the event named eventName
.
+
Returns the number of listeners listening for the event named eventName
.
If listener
is provided, it will return how many times the listener is found
in the list of the listeners of the event.
The name of the event being listened for
@@ -109,7 +109,7 @@Alias for emitter.removeListener()
.
Alias for emitter.removeListener()
.
Rest
...args: any[]Adds the listener
function to the end of the listeners array for the event
named eventName
. No checks are made to see if the listener
has already
@@ -200,9 +200,9 @@
Returns a reference to the EventEmitter
, so that calls can be chained.
Rest
...args: any[]Sends a message to the remote server.
The message to send.
-By default EventEmitter
s will print a warning if more than 10
listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners()
method allows the limit to be
modified for this specific EventEmitter
instance. The value can be set to Infinity
(or 0
) to indicate an unlimited number of listeners.
Static
captureValue: boolean
+Static
captureValue: boolean
Change the default captureRejections
option on all new EventEmitter
objects.
Static
Readonly
captureValue: Symbol.for('nodejs.rejection')
Installing a listener using this symbol does not change the behavior once an 'error'
event is emitted. Therefore, the process will still crash if no
regular 'error'
listener is installed.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Rest
...args: any[]Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
to each.
Returns true
if the event had listeners, false
otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
@@ -92,11 +92,11 @@
Returns the current max listener value for the EventEmitter
which is either
set by emitter.setMaxListeners(n)
or defaults to defaultMaxListeners.
Returns the number of listeners listening for the event named eventName
.
+
Returns the number of listeners listening for the event named eventName
.
If listener
is provided, it will return how many times the listener is found
in the list of the listeners of the event.
The name of the event being listened for
@@ -107,7 +107,7 @@Alias for emitter.removeListener()
.
Alias for emitter.removeListener()
.
Rest
...args: any[]Adds the listener
function to the end of the listeners array for the event
named eventName
. No checks are made to see if the listener
has already
@@ -198,9 +198,9 @@
Returns a reference to the EventEmitter
, so that calls can be chained.
Rest
...args: any[]Sends a message to the remote server.
The message to send.
-By default EventEmitter
s will print a warning if more than 10
listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners()
method allows the limit to be
modified for this specific EventEmitter
instance. The value can be set to Infinity
(or 0
) to indicate an unlimited number of listeners.
Static
stackStatic
captureValue: boolean
+Static
captureValue: boolean
Change the default captureRejections
option on all new EventEmitter
objects.
Static
Readonly
captureValue: Symbol.for('nodejs.rejection')
Installing a listener using this symbol does not change the behavior once an 'error'
event is emitted. Therefore, the process will still crash if no
regular 'error'
listener is installed.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Rest
...args: any[]Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
+
Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
to each.
Returns true
if the event had listeners, false
otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
@@ -91,11 +91,11 @@
Returns the current max listener value for the EventEmitter
which is either
set by emitter.setMaxListeners(n)
or defaults to defaultMaxListeners.
Returns the number of listeners listening for the event named eventName
.
+
Returns the number of listeners listening for the event named eventName
.
If listener
is provided, it will return how many times the listener is found
in the list of the listeners of the event.
The name of the event being listened for
@@ -197,9 +197,9 @@Returns a reference to the EventEmitter
, so that calls can be chained.
Rest
...args: any[]Sends a message to the remote server.
The message to send.
-By default EventEmitter
s will print a warning if more than 10
listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners()
method allows the limit to be
modified for this specific EventEmitter
instance. The value can be set to Infinity
(or 0
) to indicate an unlimited number of listeners.
Static
captureValue: boolean
+Static
captureValue: boolean
Change the default captureRejections
option on all new EventEmitter
objects.
Static
Readonly
captureValue: Symbol.for('nodejs.rejection')
Installing a listener using this symbol does not change the behavior once an 'error'
event is emitted. Therefore, the process will still crash if no
regular 'error'
listener is installed.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Rest
...args: any[]Deserializes the serialized message.
+Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
+
Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
to each.
Returns true
if the event had listeners, false
otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
@@ -197,10 +197,10 @@
Rest
...args: any[]Sends a message to the remote server.
The message to send.
-Serialize a message into JSON.
The message to serialize.
The serialized message,
-By default EventEmitter
s will print a warning if more than 10
listeners are
+
By default EventEmitter
s will print a warning if more than 10
listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners()
method allows the limit to be
modified for this specific EventEmitter
instance. The value can be set to Infinity
(or 0
) to indicate an unlimited number of listeners.
Checks whether a channel is associated with this connection.
+Instantiates Glee.
-Optional
options: GleeConfig = {}Static
captureValue: boolean
+Optional
options: GleeConfig = {}Static
captureValue: boolean
Change the default captureRejections
option on all new EventEmitter
objects.
Static
Readonly
captureValue: Symbol.for('nodejs.rejection')
Installing a listener using this symbol does not change the behavior once an 'error'
event is emitted. Therefore, the process will still crash if no
regular 'error'
listener is installed.
Optional
[captureRest
...args: AnyRestAdds a connection adapter.
-Alias for emitter.on(eventName, listener)
.
Optional
[captureRest
...args: AnyRestAdds a connection adapter.
+Alias for emitter.on(eventName, listener)
.
Rest
...args: any[]Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
+
Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
to each.
Returns true
if the event had listeners, false
otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
@@ -98,12 +98,12 @@
Returns the number of listeners listening for the event named eventName
.
+
Returns the number of listeners listening for the event named eventName
.
If listener
is provided, it will return how many times the listener is found
in the list of the listeners of the event.
The name of the event being listened for
@@ -207,17 +207,17 @@Rest
...args: any[]Send a message to the adapters.
The payload of the message you want to send.
-Sets the cluster adapter to use.
-Sets the cluster adapter to use.
+By default EventEmitter
s will print a warning if more than 10
listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners()
method allows the limit to be
modified for this specific EventEmitter
instance. The value can be set to Infinity
(or 0
) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter
, so that calls can be chained.
Synchronizes the other instances in the cluster with the message.
-Use a middleware for inbound messages.
-Rest
...middlewares: GenericMiddleware[]Rest
...middlewares: GenericMiddleware[]Use a middleware for outbound messages.
-Rest
...middlewares: GenericMiddleware[]Rest
...middlewares: GenericMiddleware[]Static
addExperimental
Listens once to the abort
event on the provided signal
.
Use a middleware for inbound messages.
+Rest
...middlewares: GenericMiddleware[]Rest
...middlewares: GenericMiddleware[]Use a middleware for outbound messages.
+Rest
...middlewares: GenericMiddleware[]Rest
...middlewares: GenericMiddleware[]Static
addExperimental
Listens once to the abort
event on the provided signal
.
Listening to the abort
event on abort signals is unsafe and may
lead to resource leaks since another third party with the signal can
call e.stopImmediatePropagation()
. Unfortunately Node.js cannot change
diff --git a/packages/glee/docs/reference/classes/lib_message.default.html b/packages/glee/docs/reference/classes/lib_message.default.html
index e092d873e..6ca0c203d 100644
--- a/packages/glee/docs/reference/classes/lib_message.default.html
+++ b/packages/glee/docs/reference/classes/lib_message.default.html
@@ -1,4 +1,4 @@
-
Static
captureValue: boolean
+Static
captureValue: boolean
Change the default captureRejections
option on all new EventEmitter
objects.
Static
Readonly
captureValue: Symbol.for('nodejs.rejection')
Installing a listener using this symbol does not change the behavior once an 'error'
event is emitted. Therefore, the process will still crash if no
regular 'error'
listener is installed.
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Rest
...args: any[]Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
to each.
Returns the current max listener value for the EventEmitter
which is either
set by emitter.setMaxListeners(n)
or defaults to defaultMaxListeners.
Returns the number of listeners listening for the event named eventName
.
+
Returns the number of listeners listening for the event named eventName
.
If listener
is provided, it will return how many times the listener is found
in the list of the listeners of the event.
The name of the event being listened for
@@ -113,8 +113,8 @@Alias for emitter.removeListener()
.
Alias for emitter.removeListener()
.
Rest
...args: any[]Adds the listener
function to the end of the listeners array for the event
named eventName
. No checks are made to see if the listener
has already
@@ -206,15 +206,15 @@
Returns a reference to the EventEmitter
, so that calls can be chained.
Rest
...args: any[]By default EventEmitter
s will print a warning if more than 10
listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners()
method allows the limit to be
modified for this specific EventEmitter
instance. The value can be set to Infinity
(or 0
) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter
, so that calls can be chained.
Static
addStatic
addExperimental
Listens once to the abort
event on the provided signal
.
Listening to the abort
event on abort signals is unsafe and may
lead to resource leaks since another third party with the signal can
call e.stopImmediatePropagation()
. Unfortunately Node.js cannot change
diff --git a/packages/glee/docs/reference/classes/lib_router.default.html b/packages/glee/docs/reference/classes/lib_router.default.html
index d65a147a6..c54673d91 100644
--- a/packages/glee/docs/reference/classes/lib_router.default.html
+++ b/packages/glee/docs/reference/classes/lib_router.default.html
@@ -1,4 +1,4 @@
-
Adds a normalized middleware to the inbound error middlewares collection.
+Adds a normalized middleware to the inbound error middlewares collection.
The middlewares to add to the collection.
Optional
channel: stringThe scope channel.
-Adds a normalized middleware to the inbound middlewares collection.
The middlewares to add to the collection.
Optional
channel: stringThe scope channel.
-Adds a normalized middleware to the outbound error middlewares collection.
The middlewares to add to the collection.
Optional
channel: stringThe scope channel.
-Adds a normalized middleware to the outbound middlewares collection.
The middlewares to add to the collection.
Optional
channel: stringThe scope channel.
-Returns all the inbound error middlewares.
-Returns all the inbound middlewares.
-Returns all the outbound error middlewares.
-Returns all the outbound middlewares.
-Returns all the inbound error middlewares.
+Returns all the inbound middlewares.
+Returns all the outbound error middlewares.
+Returns all the outbound middlewares.
+Use a middleware for inbound messages. Please, note that when passing a GleeRouter as a param, this function will make use of inbound and outbound middlewares.
-Rest
...middlewares: GenericMiddleware[]Rest
...middlewares: GenericMiddleware[]Use a middleware for outbound messages.
-Rest
...middlewares: GenericMiddleware[]Rest
...middlewares: GenericMiddleware[]Rest
...middlewares: GenericMiddleware[]Rest
...middlewares: GenericMiddleware[]Use a middleware for outbound messages.
+Rest
...middlewares: GenericMiddleware[]Rest
...middlewares: GenericMiddleware[]Static
captureValue: boolean
+Optional
authConfig: anyStatic
captureValue: boolean
Change the default captureRejections
option on all new EventEmitter
objects.
Static
Readonly
captureValue: Symbol.for('nodejs.rejection')
Optional
[captureRest
...args: AnyRestAlias for emitter.on(eventName, listener)
.
Rest
...args: any[]Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
+
Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
to each.
Returns true
if the event had listeners, false
otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
@@ -83,10 +83,10 @@
Returns the current max listener value for the EventEmitter
which is either
set by emitter.setMaxListeners(n)
or defaults to defaultMaxListeners.
Returns the number of listeners listening for the event named eventName
.
+
Returns the number of listeners listening for the event named eventName
.
If listener
is provided, it will return how many times the listener is found
in the list of the listeners of the event.
The name of the event being listened for
@@ -149,7 +149,7 @@The name of the event.
The callback function
Rest
...args: any[]Returns a copy of the array of listeners for the event named eventName
,
+
Returns a copy of the array of listeners for the event named eventName
,
including any wrappers (such as those created by .once()
).
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
diff --git a/packages/glee/docs/reference/functions/docs.default.html b/packages/glee/docs/reference/functions/docs.default.html
index 42ef4d84c..9bfc4b11c 100644
--- a/packages/glee/docs/reference/functions/docs.default.html
+++ b/packages/glee/docs/reference/functions/docs.default.html
@@ -1 +1 @@
-Optional
message: defaultOptional
message: default
Instantiates a Glee Cluster adapter.