-
Couldn't load subscription status.
- Fork 138
Plugins Implementation #1794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tconley1428
wants to merge
16
commits into
main
Choose a base branch
from
plugins/initial
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+807
−23
Open
Plugins Implementation #1794
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ac699ec
Initial AI generated framework for plugins
tconley1428 6580484
WIP Plugin shenanigans
tconley1428 ec44d6c
Merge remote-tracking branch 'origin/main' into plugins/initial
tconley1428 0f8361c
Updating to bring more in line with current Python implementation. Wi…
tconley1428 a6f8bfb
Additional plugin work
tconley1428 748a1c9
Ongoing work on simpleplugin
tconley1428 6d16100
Ongoing work on SimplePlugin
tconley1428 03957fd
Merge remote-tracking branch 'origin/main' into plugins/initial
tconley1428 ba37fd8
Fix plugin composition in connection
tconley1428 604e65f
PR Feedback
tconley1428 f85cc33
Linting
tconley1428 b01a63e
Remove no longer needed apikey test, typing has changed
tconley1428 118c0b9
Merge branch 'main' into plugins/initial
tconley1428 7ab11f3
Merge branch 'main' into plugins/initial
tconley1428 bd2dad0
Minor PR changes
tconley1428 6e94e0c
Merge branch 'plugins/initial' of https://github.com/temporalio/sdk-t…
tconley1428 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,19 @@ | ||
| import type { ClientOptions } from './client'; | ||
|
|
||
| /** | ||
| * Plugin to control the configuration of a native connection. | ||
| */ | ||
| export interface ClientPlugin { | ||
| /** | ||
| * Gets the name of this plugin. | ||
| */ | ||
| get name(): string; | ||
|
|
||
| /** | ||
| * Hook called when creating a client to allow modification of configuration. | ||
| * | ||
| * This method is called during client creation and allows plugins to modify | ||
| * the client configuration before the client is fully initialized. | ||
| */ | ||
| configureClient?(options: ClientOptions): ClientOptions; | ||
| } |
This file contains hidden or 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 hidden or 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,35 @@ | ||
| { | ||
| "name": "@temporalio/plugin", | ||
| "version": "1.13.0", | ||
| "description": "Library for plugin creation", | ||
| "main": "lib/index.js", | ||
| "types": "./lib/index.d.ts", | ||
| "keywords": [ | ||
| "temporal", | ||
| "workflow", | ||
| "worker", | ||
| "plugin" | ||
| ], | ||
| "author": "Temporal Technologies Inc. <[email protected]>", | ||
| "license": "MIT", | ||
| "dependencies": {}, | ||
| "bugs": { | ||
| "url": "https://github.com/temporalio/sdk-typescript/issues" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/temporalio/sdk-typescript.git", | ||
| "directory": "packages/plugin" | ||
| }, | ||
| "homepage": "https://github.com/temporalio/sdk-typescript/tree/main/packages/plugin", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "engines": { | ||
| "node": ">= 18.0.0" | ||
| }, | ||
| "files": [ | ||
| "src", | ||
| "lib" | ||
| ] | ||
| } |
This file contains hidden or 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 @@ | ||
| export { SimplePlugin, SimplePluginOptions } from './plugin'; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we ever expect/support a plugin altering the plugin list?
I'm not sure I can think of a reason for doing this, but the current implementation would allow altering the list, but the iteration wouldn't change. e.g. a removed plugin can still alter the options/added plugin will not get a chance to alter the options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't intend to support that. If you have an idea of how to enforce that, we could.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could leverage
Omitto make it clear thatpluginswon't be respected e.g.configureClient?(options: ClientOptions): Omit<ClientOptions, 'plugins'>Running the configurations becomes a little more awkward as you have to destructure
optionseach iteration e.g.It doesn't warn/error if the user tries to alter the plugin list, but any changes they make won't be respected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Omitis a good idea. It seems like I can just change the type in the plugin toOmit<ClientOptions, "plugins">without any other change. They can return something with changed plugins, but expresses the intent