8000 GRPC Client for Chalk Typescript Client by kelvin-chalk · Pull Request #64 · chalk-ai/chalk-ts · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

GRPC Client for Chalk Typescript Client #64

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

Merged
merged 34 commits into from
May 9, 2025
Merged

Conversation

kelvin-chalk
Copy link
Contributor
@kelvin-chalk kelvin-chalk commented May 6, 2025

This introduces a GPRC Client for the Chalk TS Client. This includes several major refactors of our code:

  • Consolidates more types into the _interface module, then sunders it into a directory with multiple subfiles
  • Refactors the ChalkClient so that there is a ChalkHTTPClient that contains more functions (the grpc client only supports the critical OnlineQuery, OnlineQueryBulk, and OnlineQueryMulti function)
  • Adds generated Typescript Files for our proto messages

Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
src/_http.ts Outdated
Copy link
Contributor Author
@kelvin-chalk kelvin-chalk May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This got sundered into multiple files - _services/_http.ts and _services/_credentials.ts contain the major classes this contained, and several types got moved to _interface/_index.ts

@@ -132,81 +139,6 @@ export type ChalkOnlineQueryResponseStatusKind =
| "partial_success"
| "error";

export type ChalkErrorCode =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most of the types removed here got moved into subfiles - this file was just getting impossible to navigate

import { parseOnlineQueryResponse } from "./_response";

export interface ChalkClientOpts {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got moved to _interface/_options.ts

@@ -0,0 +1,429 @@
import { ChalkError, isChalkError } from "../_errors";
Copy link
Contributor Author
@kelvin-chalk kelvin-chalk May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file just a fraction of the _http.ts original file.

10000
this.credentials = null;
}

async getEngineUrlFromCredentials(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while most of this file is just moving the file, this function is new.

Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
this.queryClient = this.queryClient = new QueryServiceClient(
stripProtocol(endpoint),
ChannelCredentials.createInsecure(),
{ "grpc.enable_retries": maxNetworkRetries }
Copy link
Contributor Author
@kelvin-chalk kelvin-chalk May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the maxNetworkRetries correctly :)

Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
Signed-off-by: Kelvin Lu <kelvin@chalk.ai>
@kelvin-chalk kelvin-chalk merged commit 7483a12 into main May 9, 2025
5 checks passed
@kelvin-chalk kelvin-chalk deleted the 273/grpc-client branch May 9, 2025 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0