-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Timur Bolotov <[email protected]>
- Loading branch information
0 parents
commit 6983dff
Showing
14 changed files
with
1,286 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# coverage output | ||
coverage.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# mac files | ||
.DS_Store | ||
|
||
# vim swap files | ||
*.swp | ||
|
||
#Jetbrains editor folder | ||
.idea | ||
|
||
# opensearch repo or binary files | ||
opensearch* | ||
!opensearch_dashboards* | ||
!opensearchDashboards* | ||
|
||
# documentation | ||
docs/ | ||
|
||
# temporary | ||
tmp/ | ||
|
||
test/benchmarks/macro/fixtures/* | ||
|
||
*-junit.xml | ||
|
||
.cache | ||
|
||
test/bundlers/**/bundle.js | ||
test/bundlers/parcel-test/.parcel-cache |
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,2 @@ | ||
|
||
|
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,33 @@ | ||
{ | ||
"name": "@opensearch-project/opensearch", | ||
"version": "1.0.0", | ||
"description": "The official OpenSearch client for Node.js", | ||
"type": "module", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "vitest", | ||
"build:esm": "tsc -p tsconfig.esm.json", | ||
"build:cjs": "tsc -p tsconfig.cjs.json", | ||
"build": "" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/timursaurus/opensearch-ts.git" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/timursaurus/opensearch-ts/issues" | ||
}, | ||
"homepage": "https://github.com/timursaurus/opensearch-ts#readme", | ||
"devDependencies": { | ||
"@types/debug": "^4.1.7", | ||
"vitest": "^0.29.7" | ||
}, | ||
"dependencies": { | ||
"debug": "^4.3.4", | ||
"querystring": "^0.2.1", | ||
"secure-json-parse": "^2.7.0" | ||
} | ||
} |
Empty file.
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,202 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
*/ | ||
|
||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
// import { ApiResponse, Context } from '@/types/transport'; | ||
// import { ErrorCause, ErrorResponseBase } from '@/types/internal'; | ||
|
||
export class OpenSearchClientError extends Error { | ||
name: string; | ||
constructor(message: string) { | ||
super(message); | ||
this.name = 'OpenSearchClientError'; | ||
} | ||
} | ||
|
||
// export class TimeoutError< | ||
// TResponse = Record<string, unknown>, | ||
// TContext = Context | ||
// > extends OpenSearchClientError { | ||
// name: string; | ||
// message: string; | ||
// meta?: ApiResponse<TResponse, TContext>; | ||
// constructor(message: string, meta?: ApiResponse<TResponse, TContext>) { | ||
// super(message); | ||
// Error.captureStackTrace(this, TimeoutError); | ||
// this.name = 'TimeoutError'; | ||
// this.message = message ?? 'Timeout Error'; | ||
// this.meta = meta; | ||
// } | ||
// } | ||
|
||
// export class ConnectionError< | ||
// TResponse = Record<string, unknown>, | ||
// TContext = Context | ||
// > extends OpenSearchClientError { | ||
// name: string; | ||
// message: string; | ||
// meta?: ApiResponse<TResponse, TContext>; | ||
// constructor(message: string, meta?: ApiResponse<TResponse, TContext>) { | ||
// super(message); | ||
// Error.captureStackTrace(this, ConnectionError); | ||
// this.name = 'ConnectionError'; | ||
// this.message = message ?? 'Connection Error'; | ||
// this.meta = meta; | ||
// } | ||
// } | ||
|
||
// export class NoLivingConnectionsError< | ||
// TResponse = Record<string, unknown>, | ||
// TContext = Context | ||
// > extends OpenSearchClientError { | ||
// name: string; | ||
// message: string; | ||
// meta: ApiResponse<TResponse, TContext>; | ||
|
||
// constructor(message: string, meta: ApiResponse<TResponse, TContext>) { | ||
// super(message); | ||
// Error.captureStackTrace(this, NoLivingConnectionsError); | ||
// this.name = 'NoLivingConnectionsError'; | ||
// this.message = | ||
// message ?? | ||
// 'Given the configuration, the ConnectionPool was not able to find a usable Connection for this request.'; | ||
// this.meta = meta; | ||
// } | ||
// } | ||
|
||
export class SerializationError extends OpenSearchClientError { | ||
name: string; | ||
message: string; | ||
data: Record<string, unknown>; | ||
constructor(message: string, data: Record<string, unknown>) { | ||
super(message); | ||
Error.captureStackTrace(this, SerializationError); | ||
this.name = 'SerializationError'; | ||
this.message = message ?? 'Serialization Error'; | ||
this.data = data; | ||
} | ||
} | ||
|
||
export class DeserializationError extends OpenSearchClientError { | ||
name: string; | ||
message: string; | ||
data: string; | ||
constructor(message: string, data: string) { | ||
super(message); | ||
Error.captureStackTrace(this, DeserializationError); | ||
this.name = 'DeserializationError'; | ||
this.message = message ?? 'Deserialization Error'; | ||
this.data = data; | ||
} | ||
} | ||
|
||
// export class ConfigurationError extends OpenSearchClientError { | ||
// constructor(message: string) { | ||
// super(message); | ||
// Error.captureStackTrace(this, ConfigurationError); | ||
// this.name = 'ConfigurationError'; | ||
// this.message = message ?? 'Configuration Error'; | ||
// } | ||
// } | ||
|
||
// export class ResponseError< | ||
// TResponse = Record<string, unknown>, | ||
// TContext = Context | ||
// > extends OpenSearchClientError { | ||
// name: string; | ||
// message: string; | ||
// meta: ApiResponse<TResponse, TContext>; | ||
// constructor(meta: ApiResponse) { | ||
// super('Response Error'); | ||
// Error.captureStackTrace(this, ResponseError); | ||
// this.name = 'ResponseError'; | ||
// if (meta.body?.error?.type) { | ||
// const error = meta.body.error as ErrorCause; | ||
// if (Array.isArray(error.root_cause)) { | ||
// this.message = `${error.type}: ${error.root_cause | ||
// .map((entry) => `[${entry.type}] Reason: ${entry.reason}`) | ||
// .join('; ')}`; | ||
// } else { | ||
// this.message = error.type; | ||
// } | ||
// } else { | ||
// this.message = 'Response Error'; | ||
// } | ||
// this.meta = meta as ApiResponse<TResponse, TContext>; | ||
// } | ||
|
||
// get body() { | ||
// return this.meta.body; | ||
// } | ||
|
||
// get statusCode() { | ||
// const body = this.meta.body as ErrorResponseBase; | ||
// if (typeof body === 'object' && typeof body.status === 'number') { | ||
// return body.status; | ||
// } | ||
// return this.meta.statusCode; | ||
// } | ||
|
||
// get headers() { | ||
// return this.meta.headers; | ||
// } | ||
|
||
// toString() { | ||
// return JSON.stringify(this.meta.body); | ||
// } | ||
// } | ||
|
||
// export class RequestAbortedError< | ||
// TResponse = Record<string, unknown>, | ||
// TContext = Context | ||
// > extends OpenSearchClientError { | ||
// name: string; | ||
// message: string; | ||
// meta?: ApiResponse<TResponse, TContext>; | ||
// constructor(message: string, meta?: ApiResponse<TResponse, TContext>) { | ||
// super(message); | ||
// Error.captureStackTrace(this, RequestAbortedError); | ||
// this.name = 'RequestAbortedError'; | ||
// this.message = message || 'Request aborted'; | ||
// this.meta = meta; | ||
// } | ||
// } | ||
|
||
// export class NotCompatibleError< | ||
// TResponse = Record<string, unknown>, | ||
// TContext = Context | ||
// > extends OpenSearchClientError { | ||
// meta: ApiResponse<TResponse, TContext>; | ||
// constructor(meta: ApiResponse<TResponse, TContext>) { | ||
// super('Not Compatible Error'); | ||
// Error.captureStackTrace(this, NotCompatibleError); | ||
// this.name = 'NotCompatibleError'; | ||
// this.message = 'The client noticed that the server is not a supported distribution'; | ||
// this.meta = meta; | ||
// } | ||
// } |
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,30 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
*/ | ||
|
||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
export const kJsonOptions = Symbol('Secure JSON parse options'); |
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 @@ | ||
export * from './serializer' |
Oops, something went wrong.