-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove mixins and add AsyncAPI TS types (#581)
- Loading branch information
1 parent
0f8bd39
commit a40b685
Showing
83 changed files
with
1,579 additions
and
919 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { BaseModel } from "../base"; | ||
|
||
import { extensions } from "./mixins"; | ||
|
||
import type { BindingInterface } from "../binding"; | ||
import type { ExtensionsInterface } from "../extensions"; | ||
|
||
import type { v2 } from "../../spec-types"; | ||
|
||
export class Binding extends BaseModel<v2.Binding, { protocol: string }> implements BindingInterface { | ||
protocol(): string { | ||
return this._meta.protocol; | ||
} | ||
|
||
version(): string { | ||
return this._json.bindingVersion || 'latest'; | ||
} | ||
|
||
value<T extends Record<string, any> = Record<string, any>>(): T { | ||
const value = { ...this._json }; | ||
delete (value as any).bindingVersion; | ||
return value as unknown as T; | ||
} | ||
|
||
extensions(): ExtensionsInterface { | ||
return extensions(this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Collection } from "../collection"; | ||
|
||
import type { BindingsInterface } from "../bindings"; | ||
import type { BindingInterface } from "../binding"; | ||
|
||
export class Bindings extends Collection<BindingInterface> implements BindingsInterface { | ||
override get(name: string): BindingInterface | undefined { | ||
return this.collections.find(binding => binding.protocol() === name); | ||
}; | ||
|
||
override has(name: string): boolean { | ||
return this.collections.some(binding => binding.protocol() === name); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.