Skip to content

Commit

Permalink
refactor: merge latest v1 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Amgelo563 committed Jul 11, 2024
2 parents ff95b33 + e46f6d5 commit ac9d071
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 16 deletions.
12 changes: 6 additions & 6 deletions apps/docs/docs/features/events/event-bus.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: 📣 Event Buses
---

# 📣 Event Buses

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# 📣 Event Buses

`EventBuses` are objects responsible for containing and notifying subscribed `EventSubscribers` about events. These
events can be emitted internally, typically via an EventEmitter, or externally, via `EventBus#emit()`.

Expand Down Expand Up @@ -58,7 +58,7 @@ await bot.getEventManager()
```ts
import { EventBus } from '@nyx-discord/core';

class MyInterfaceEventBus implements EventBus {
class MyInterfaceEventBus implements EventBus<MyEventsArgs> {
// ...
}

Expand Down Expand Up @@ -98,8 +98,8 @@ Read the [📩 Event Subscribers](./event-subscriber) documentation for more det
To ensure type safety when emitting events, event buses take a generic type of `Record<string, unknown[]>`, that
represents the events that the bus emits, and their arguments.

A typed event bus will also cause a type error when trying to add a `EventSubscriber` whose arguments don't match any
event that the bus emits.
A typed event bus will also cause a type error when trying to add a `EventSubscriber` whose arguments for the
event they listen don't match the event arguments on the bus.

```ts
import { BasicEventBus } from '@nyx-discord/framework';
Expand Down Expand Up @@ -239,7 +239,7 @@ await bot.getEventManager()
```ts
import { EventEmitterBus } from '@nyx-discord/core';

class MyEventEmitterBus implements EventEmitterBus<MyEventArgs> {
class MyEventEmitterBus implements EventEmitterBus<MyEventsArgs> {
// ...
}

Expand Down
14 changes: 6 additions & 8 deletions apps/docs/docs/features/events/event-subscriber.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -493,19 +493,17 @@ meaning that external objects can read the collection, but not modify it.
:::

```ts
import { PriorityEnum } from '@nyx-discord/core';
import type { PriorityEnum } from '@nyx-discord/core';
import { AbstractEventSubscriber } from '@nyx-discord/framework';
import { Collection } from '@discordjs/collection';

class MyEventSubscriber extends AbstractEventSubscriber {
protected readonly event = 'someEvent';
protected readonly event = 'someEvent';

// highlight-start
protected readonly meta = new Collection < Identifier, unknown > ([
['someKey', 'someValue']
]);
// highlight-end
// highlight-start
protected readonly meta = new Collection<Identifier, unknown>([
['someKey', 'someValue']
]);
// highlight-end
}

// a plugin can now read it via:
Expand Down
26 changes: 26 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.5.1](https://github.com/nyx-discord/nyx/compare/@nyx-discord/[email protected]...@nyx-discord/[email protected]) (2024-02-19)

### Bug Fixes

- fix MetadatableCustomIdBuilder omitting non empty token ([4d5d4c5](https://github.com/nyx-discord/nyx/commit/4d5d4c5f1ffba0662383507b2acb752c93d29272))

## [1.5.0](https://github.com/nyx-discord/nyx/compare/@nyx-discord/[email protected]...@nyx-discord/[email protected]) (2024-02-19)

### Features

- add SessionManager[#resolve](https://github.com/nyx-discord/nyx/issues/resolve)() ([99007a1](https://github.com/nyx-discord/nyx/commit/99007a1a4d6dba4df9a6e08f2831c59410b09381))

### Bug Fixes

- filter empty string if there's only metadata in a built MetadatableCustomId ([126d334](https://github.com/nyx-discord/nyx/commit/126d3349d7c6a939c881cb8afe814612618b9d8d))

## [1.4.0](https://github.com/nyx-discord/nyx/compare/@nyx-discord/[email protected]...@nyx-discord/[email protected]) (2024-02-13)

### Features

- add PaginationCustomIdBuilder next and previous page methods ([5f7abad](https://github.com/nyx-discord/nyx/commit/5f7abad5ab7e7db8096d2d63e7a37e8d95783ee9))

### Bug Fixes

- fix MetadatableCustomIdBuilder meta methods changing non metadata tokens ([a0bb9d2](https://github.com/nyx-discord/nyx/commit/a0bb9d224c5da16e86b674363650ac475747c561))

## [1.3.0](https://github.com/nyx-discord/nyx/compare/@nyx-discord/[email protected]...@nyx-discord/[email protected]) (2024-01-14)

### Features
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nyx-discord/core",
"version": "1.3.0",
"version": "1.5.1",
"description": "The core of nyx. Contains the object interfaces and contracts that make up the framework.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
25 changes: 25 additions & 0 deletions packages/framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,31 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.5.1](https://github.com/nyx-discord/nyx/compare/@nyx-discord/[email protected]...@nyx-discord/[email protected]) (2024-02-19)

**Note:** Version bump only for package @nyx-discord/framework

## [1.5.0](https://github.com/nyx-discord/nyx/compare/@nyx-discord/[email protected]...@nyx-discord/[email protected]) (2024-02-19)

### Features

- add SessionManager[#resolve](https://github.com/nyx-discord/nyx/issues/resolve)() ([99007a1](https://github.com/nyx-discord/nyx/commit/99007a1a4d6dba4df9a6e08f2831c59410b09381))
- make AbstractSession[#self](https://github.com/nyx-discord/nyx/issues/self)End() reason optional ([9908b38](https://github.com/nyx-discord/nyx/commit/9908b384073a152559c4c86ace0434369a59b176))

### Bug Fixes

- handle undefined return type in SessionRepository ([9e8bea9](https://github.com/nyx-discord/nyx/commit/9e8bea92abe8862d5e6feb4d3a627d6e878d61e6))

## [1.4.0](https://github.com/nyx-discord/nyx/compare/@nyx-discord/[email protected]...@nyx-discord/[email protected]) (2024-02-13)

### Features

- add ActionRowWrapper[#edit](https://github.com/nyx-discord/nyx/issues/edit)Component() ([39f7bf0](https://github.com/nyx-discord/nyx/commit/39f7bf05aedeab03e6473b249a6c9e8913f18888))

### Bug Fixes

- fix ActionRowWrapper[#edit](https://github.com/nyx-discord/nyx/issues/edit)Where() editing unmatched entries ([dec24e5](https://github.com/nyx-discord/nyx/commit/dec24e59fd3a23804de8d44865d9bbcf350842f6))

## [1.3.0](https://github.com/nyx-discord/nyx/compare/@nyx-discord/[email protected]...@nyx-discord/[email protected]) (2024-01-19)

### Features
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nyx-discord/framework",
"version": "1.3.0",
"version": "1.5.1",
"description": "The default implementation of nyx framework.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit ac9d071

Please sign in to comment.