-
Notifications
You must be signed in to change notification settings - Fork 123
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
[PROPOSAL] [CCI] TypeScript
client rewrite. Help wanted
#444
Comments
At the moment, I'm working on the Util method like TypeScript Compiler |
What's been done so far
|
@timursaurus you'll be my hero if you can pull this off! |
The development has been moved to a new repository: https://github.com/timursaurus/opensearch-ts/tree/dev
export class BulkImpl {
constructor(protected transport: Transport) {
this.transport = transport;
}
/**
* The bulk operation lets you add, update, or delete many documents in a single request.
* Compared to individual OpenSearch indexing requests, the bulk operation has significant performance benefits.
* Whenever practical, we recommend batching indexing operations into bulk requests.
* <br/> See Also: {@link https://opensearch.org/docs/latest/api-reference/document-apis/bulk/|OpenSearch - Bulk}
*
* @memberOf API-Document
* @param params
* @param options
* @param callback
*/
//... (overloads)
bulk<TSource = unknown, TContext = unknown>(
params: BulkRequest<TSource>,
options: TransportRequestOptions,
callback: CallbackFn<BulkResponse, TContext>
): TransportRequestCallback {
// implementation
return this.transport(params, options, callback)
}
} We use client.cat.transport 🛑 // <-- not accessible
client.cat.health(...) ✅
client.cat.tasks(...) ✅
client.bulk(...) ✅ export class OpenSearchAPI {
cat: CatImpl
bulk: BulkImpl['bulk']
ping: PingImpl['ping']
constructor (options: ClientOptions) {
this.cat = new CatImpl(options.Transport)
this.bulk = new BulkImpl(options.Transport).bulk
this.ping = new PingImpl(options.Transport).ping
}
}
|
I want to join this issue @timursaurus |
I want to help with this issue |
I'd love to know how I can get started working on this @timursaurus |
What/Why
What are you proposing?
Rewriting the while client from JavaScript to TypeScript, including the test suite.
Additionally, improving (IMO.) the folder structure of the project
Everything is moving to the
src
directory.📁 src
|--
📁 api
|----
📁 internal
<-- better thanapi/api
|------
bulk.ts
|------
cat.ts
|------
...
|----
class OpenSearchAPI
|
|--
📁 transport
|----
📁 aws
|----
📁 connection
|----
📁 pool
|----
Serializer.ts
|----
...
|--
client.ts
If using any Node modules, the
node:
prefix will be used, example:Module path resolving for better Developer Experience (Contributor):
(Opinionated)
Going further, we can also use custom modules names that lead to certain directories, for easier access, and it marks that the module is internal.
The work has been started on my fork-repo (
ts
branch): https://github.com/timursaurus/opensearch-js/tree/tsAt the moment,
3
people are interested in helping to rewrite the client and contacted meIf you're interested in helping, contact me through Telegram (@timursaurus ) or Github. Any help works :)
Or if you have any problems making the PR, or don't know how it works and what to do, I'll guide you through
What users have asked for this feature?
#419 (comment)
#269
#266 (comment)
#266 (comment)
What problems are you trying to solve?
Improving the developer experience, making the development less error prone, avoiding obvious bugs and misalignment between JSDoc and the Client itself, like:
#430
#443 - This has been found recently, when converting the client to TypeScript. Something that's very hard to notice, but type-checking prevents such errors. We made the PR immediately :)
#421
Are there any breaking changes to the API
No.
Are there breaking changes to the User Experience?
Apart from the better Text Editor Intellisense, no.
What will it take to execute?
Time, experience and someone knowledgeable who knows all the quirks of the client
Any remaining open questions?
Help wanted!
The text was updated successfully, but these errors were encountered: