Skip to content
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

[AUTOCUT] Update opensearch-js to reflect the latest OpenSearch API spec (2024-11-12) #906

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions api/OpenSearchApi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,24 @@ export default class OpenSearchAPI {

};

list: {
help (params?: API.List_Help_Request, options?: TransportRequestOptions): TransportRequestPromise<API.List_Help_Response>;
help (callback: callbackFn<API.List_Help_Response>): TransportRequestCallback;
help (params: API.List_Help_Request, callback: callbackFn<API.List_Help_Response>): TransportRequestCallback;
help (params: API.List_Help_Request, options: TransportRequestOptions, callback: callbackFn<API.List_Help_Response>): TransportRequestCallback;

indices (params?: API.List_Indices_Request, options?: TransportRequestOptions): TransportRequestPromise<API.List_Indices_Response>;
indices (callback: callbackFn<API.List_Indices_Response>): TransportRequestCallback;
indices (params: API.List_Indices_Request, callback: callbackFn<API.List_Indices_Response>): TransportRequestCallback;
indices (params: API.List_Indices_Request, options: TransportRequestOptions, callback: callbackFn<API.List_Indices_Response>): TransportRequestCallback;

shards (params?: API.List_Shards_Request, options?: TransportRequestOptions): TransportRequestPromise<API.List_Shards_Response>;
shards (callback: callbackFn<API.List_Shards_Response>): TransportRequestCallback;
shards (params: API.List_Shards_Request, callback: callbackFn<API.List_Shards_Response>): TransportRequestCallback;
shards (params: API.List_Shards_Request, options: TransportRequestOptions, callback: callbackFn<API.List_Shards_Response>): TransportRequestCallback;

};

ml: {
registerAgents (params?: API.Ml_RegisterAgents_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_RegisterAgents_Response>;
registerAgents (callback: callbackFn<API.Ml_RegisterAgents_Response>): TransportRequestCallback;
Expand Down Expand Up @@ -1326,19 +1344,23 @@ export default class OpenSearchAPI {
};

sql: {
settings (params: API.Sql_Settings_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Sql_Settings_Response>;
settings (params?: API.Sql_Settings_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Sql_Settings_Response>;
settings (callback: callbackFn<API.Sql_Settings_Response>): TransportRequestCallback;
settings (params: API.Sql_Settings_Request, callback: callbackFn<API.Sql_Settings_Response>): TransportRequestCallback;
settings (params: API.Sql_Settings_Request, options: TransportRequestOptions, callback: callbackFn<API.Sql_Settings_Response>): TransportRequestCallback;

query (params: API.Sql_Query_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Sql_Query_Response>;
query (params?: API.Sql_Query_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Sql_Query_Response>;
query (callback: callbackFn<API.Sql_Query_Response>): TransportRequestCallback;
query (params: API.Sql_Query_Request, callback: callbackFn<API.Sql_Query_Response>): TransportRequestCallback;
query (params: API.Sql_Query_Request, options: TransportRequestOptions, callback: callbackFn<API.Sql_Query_Response>): TransportRequestCallback;

explain (params: API.Sql_Explain_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Sql_Explain_Response>;
explain (params?: API.Sql_Explain_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Sql_Explain_Response>;
explain (callback: callbackFn<API.Sql_Explain_Response>): TransportRequestCallback;
explain (params: API.Sql_Explain_Request, callback: callbackFn<API.Sql_Explain_Response>): TransportRequestCallback;
explain (params: API.Sql_Explain_Request, options: TransportRequestOptions, callback: callbackFn<API.Sql_Explain_Response>): TransportRequestCallback;

close (params: API.Sql_Close_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Sql_Close_Response>;
close (params?: API.Sql_Close_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Sql_Close_Response>;
close (callback: callbackFn<API.Sql_Close_Response>): TransportRequestCallback;
close (params: API.Sql_Close_Request, callback: callbackFn<API.Sql_Close_Response>): TransportRequestCallback;
close (params: API.Sql_Close_Request, options: TransportRequestOptions, callback: callbackFn<API.Sql_Close_Response>): TransportRequestCallback;

Expand All @@ -1347,7 +1369,8 @@ export default class OpenSearchAPI {
getStats (params: API.Sql_GetStats_Request, callback: callbackFn<API.Sql_GetStats_Response>): TransportRequestCallback;
getStats (params: API.Sql_GetStats_Request, options: TransportRequestOptions, callback: callbackFn<API.Sql_GetStats_Response>): TransportRequestCallback;

postStats (params: API.Sql_PostStats_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Sql_PostStats_Response>;
postStats (params?: API.Sql_PostStats_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Sql_PostStats_Response>;
postStats (callback: callbackFn<API.Sql_PostStats_Response>): TransportRequestCallback;
postStats (params: API.Sql_PostStats_Request, callback: callbackFn<API.Sql_PostStats_Response>): TransportRequestCallback;
postStats (params: API.Sql_PostStats_Request, options: TransportRequestOptions, callback: callbackFn<API.Sql_PostStats_Response>): TransportRequestCallback;

Expand Down
2 changes: 2 additions & 0 deletions api/OpenSearchApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class OpenSearchAPI {
insights: new(require('./insights/_api'))(this),
ism: new(require('./ism/_api'))(this),
knn: new(require('./knn/_api'))(this),
list: new(require('./list/_api'))(this),
ml: new(require('./ml/_api'))(this),
nodes: new(require('./nodes/_api'))(this),
notifications: new(require('./notifications/_api'))(this),
Expand Down Expand Up @@ -161,6 +162,7 @@ class OpenSearchAPI {
insights: { get() { return this[kApiModules].insights } },
ism: { get() { return this[kApiModules].ism } },
knn: { get() { return this[kApiModules].knn } },
list: { get() { return this[kApiModules].list } },
ml: { get() { return this[kApiModules].ml } },
nodes: { get() { return this[kApiModules].nodes } },
notifications: { get() { return this[kApiModules].notifications } },
Expand Down
4 changes: 3 additions & 1 deletion api/_types/_common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ export type FieldSizeUsage = {

export type FieldValue = boolean | undefined | number | Record<string, any> | string

export type FieldWithDirection = Record<string, SortOrder>

export type FieldWithOrder = Record<string, ScoreSort>

export type FlushStats = {
Expand Down Expand Up @@ -770,7 +772,7 @@ export type SlicesCalculation = 'auto'

export type Sort = SortCombinations | SortCombinations[]

export type SortCombinations = Field | FieldWithOrder | SortOptions
export type SortCombinations = Field | FieldWithDirection | FieldWithOrder | SortOptions

export type SortMode = 'avg' | 'max' | 'median' | 'min' | 'sum'

Expand Down
8 changes: 7 additions & 1 deletion api/_types/_common.mapping.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ export type FieldNamesField = {
enabled: boolean;
}

export type FlatObjectProperty = PropertyBase & {
aggregatable?: boolean;
searchable?: boolean;
type: 'flat_object';
}

export type FlattenedProperty = PropertyBase & {
boost?: number;
depth_limit?: number;
Expand Down Expand Up @@ -331,7 +337,7 @@ export type PercolatorProperty = PropertyBase & {
type: 'percolator';
}

export type Property = BinaryProperty | BooleanProperty | JoinProperty | KeywordProperty | MatchOnlyTextProperty | PercolatorProperty | RankFeatureProperty | RankFeaturesProperty | SearchAsYouTypeProperty | TextProperty | VersionProperty | WildcardProperty | DateNanosProperty | DateProperty | AggregateMetricDoubleProperty | DenseVectorProperty | SparseVectorProperty | FlattenedProperty | NestedProperty | ObjectProperty | CompletionProperty | ConstantKeywordProperty | FieldAliasProperty | HistogramProperty | IpProperty | Murmur3HashProperty | TokenCountProperty | GeoPointProperty | GeoShapeProperty | XyPointProperty | XyShapeProperty | ByteNumberProperty | DoubleNumberProperty | FloatNumberProperty | HalfFloatNumberProperty | IntegerNumberProperty | LongNumberProperty | ScaledFloatNumberProperty | ShortNumberProperty | UnsignedLongNumberProperty | DateRangeProperty | DoubleRangeProperty | FloatRangeProperty | IntegerRangeProperty | IpRangeProperty | LongRangeProperty | KnnVectorProperty
export type Property = BinaryProperty | BooleanProperty | JoinProperty | KeywordProperty | MatchOnlyTextProperty | PercolatorProperty | RankFeatureProperty | RankFeaturesProperty | SearchAsYouTypeProperty | TextProperty | VersionProperty | WildcardProperty | DateNanosProperty | DateProperty | AggregateMetricDoubleProperty | DenseVectorProperty | SparseVectorProperty | FlattenedProperty | FlatObjectProperty | NestedProperty | ObjectProperty | CompletionProperty | ConstantKeywordProperty | FieldAliasProperty | HistogramProperty | IpProperty | Murmur3HashProperty | TokenCountProperty | GeoPointProperty | GeoShapeProperty | XyPointProperty | XyShapeProperty | ByteNumberProperty | DoubleNumberProperty | FloatNumberProperty | HalfFloatNumberProperty | IntegerNumberProperty | LongNumberProperty | ScaledFloatNumberProperty | ShortNumberProperty | UnsignedLongNumberProperty | DateRangeProperty | DoubleRangeProperty | FloatRangeProperty | IntegerRangeProperty | IpRangeProperty | LongRangeProperty | KnnVectorProperty

export type PropertyBase = {
dynamic?: DynamicMapping;
Expand Down
2 changes: 1 addition & 1 deletion api/_types/cluster.allocation_explain.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export type NodeAllocationExplanation = {
node_name: Common.Name;
store?: AllocationStore;
transport_address: Common.TransportAddress;
weight_ranking: number;
weight_ranking?: number;
}

export type NodeDiskUsage = {
Expand Down
15 changes: 13 additions & 2 deletions api/_types/flow_framework.common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* modify the API generator.
*/

import * as Common from './_common'

export type All = boolean

Expand All @@ -40,10 +41,12 @@ export type FlowFrameworkDeleteResponse = {
export type FlowFrameworkGetResponse = {
created_time?: number;
description?: string;
last_provisioned_time?: number;
last_updated_time?: number;
name?: string;
use_case?: string;
user?: user;
version?: version;
workflows?: Record<string, any>;
}

Expand All @@ -57,7 +60,7 @@ export type FlowFrameworkUpdate = {

export type hits = {
hits?: itemsObject[];
max_score?: number;
max_score?: undefined | number;
total?: total;
}

Expand Down Expand Up @@ -93,13 +96,14 @@ export type SearchWorkflowRequest = {

export type shards = {
failed?: number;
skipped?: number;
successful?: number;
total?: number;
}

export type StateHits = {
hits?: StateItems[];
max_score?: number;
max_score?: undefined | number;
total?: total;
}

Expand Down Expand Up @@ -141,6 +145,10 @@ export type version = {

export type WorkflowID = string

export type WorkflowIDResponse = {
workflow_id?: string;
}

export type WorkflowSearchResponse = {
_shards?: shards;
hits?: hits;
Expand Down Expand Up @@ -178,7 +186,10 @@ export type WorkflowStep = {
inputs?: string[];
outputs?: string[];
required_plugins?: string[];
timeout?: Common.Duration;
}

export type WorkflowStepName = string

export type WorkflowSteps = Record<string, WorkflowStep>

62 changes: 49 additions & 13 deletions api/_types/flow_framework.errors.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export type BadRequestError = {
status?: number;
}

export type ConflictError = Record<string, any>
export type ConflictError = {
error?: string;
status?: number;
}

export type DeprovisioningError = {
error: string;
Expand All @@ -35,22 +38,39 @@ export type DuplicateKeyError = {
status?: number;
}

export type FlowFrameworkAPIDisabledError = Record<string, any>
export type FlowFrameworkAPIDisabledError = {
error?: string;
status?: number;
}

export type InvalidParameterError = Record<string, any>
export type InvalidParameterError = {
error?: string;
status?: number;
}

export type InvalidRequestBodyFieldError = {
error?: string;
status?: number;
}

export type InvalidTemplateVersionError = Record<string, any>
export type InvalidTemplateVersionError = {
error?: string;
}

export type MaxWorkflowsLimitError = Record<string, any>
export type MaxWorkflowsLimitError = {
code?: number;
error?: string;
}

export type MissingParameterError = Record<string, any>
export type MissingParameterError = {
error?: string;
status?: number;
}

export type ParameterConflictError = Record<string, any>
export type ParameterConflictError = {
error?: string;
status?: number;
}

export type RequestBodyParsingFailedError = {
error?: string;
Expand All @@ -66,15 +86,31 @@ export type TemplateNameRequiredError = {
error?: string;
}

export type TemplateNotFoundError = Record<string, any>
export type TemplateNotFoundError = {
code?: number;
error?: string;
}

export type UnsupportedFieldUpdateError = Record<string, any>
export type UnsupportedFieldUpdateError = {
error?: string;
}

export type WorkFlowIdNullError = Record<string, any>
export type WorkFlowIdNullError = {
error?: string;
status?: number;
}

export type WorkflowParsingError = Record<string, any>
export type WorkflowParsingError = {
error?: string;
}

export type WorkflowSaveError = Record<string, any>
export type WorkflowSaveError = {
error?: string;
status?: number;
}

export type WorkflowStepsRetrieveError = Record<string, any>
export type WorkflowStepsRetrieveError = {
code?: number;
error?: string;
}

5 changes: 5 additions & 0 deletions api/_types/indices._common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ export type FielddataFrequencyFilter = {

export type IndexCheckOnStartup = 'checksum' | 'false' | 'true'

export type IndexError = {
error?: IndexErrorCause;
status?: number;
}

export type IndexErrorCause = {
index?: Common.IndexName;
index_uuid?: Common.Uuid;
Expand Down
7 changes: 6 additions & 1 deletion api/_types/query._common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,17 @@ export type DataSourceRetrieve = {
status: string;
}

export type ErrorResponse = {
export type Error = {
reason: string;
root_cause: RootCause[];
type: string;
}

export type ErrorResponse = {
error?: Error;
status?: number;
}

export type RootCause = {
reason: string;
type: string;
Expand Down
5 changes: 5 additions & 0 deletions api/_types/security._common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ export type DynamicOptions = {
respect_request_indices_options?: boolean;
}

export type Error = {
message?: string;
status?: 'BAD_REQUEST' | 'CONFLICT' | 'FORBIDDEN' | 'INTERNAL_SERVER_ERROR' | 'NOT_FOUND' | 'NOT_IMPLEMENTED' | 'UNAUTHORIZED';
}

export type GenerateOBOToken = {
authenticationToken?: string;
durationSeconds?: string;
Expand Down
2 changes: 1 addition & 1 deletion api/flowFramework/delete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export type FlowFramework_Delete_Response = ApiResponse & {
body: FlowFramework_Delete_ResponseBody;
}

export type FlowFramework_Delete_ResponseBody = Record<string, any>
export type FlowFramework_Delete_ResponseBody = FlowFramework_Common.FlowFrameworkDeleteResponse

2 changes: 1 addition & 1 deletion api/flowFramework/deprovision.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export type FlowFramework_Deprovision_Response = ApiResponse & {
body: FlowFramework_Deprovision_ResponseBody;
}

export type FlowFramework_Deprovision_ResponseBody = Record<string, any>
export type FlowFramework_Deprovision_ResponseBody = FlowFramework_Common.WorkflowIDResponse

2 changes: 1 addition & 1 deletion api/flowFramework/get.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ export type FlowFramework_Get_Response = ApiResponse & {
body: FlowFramework_Get_ResponseBody;
}

export type FlowFramework_Get_ResponseBody = Record<string, any>
export type FlowFramework_Get_ResponseBody = FlowFramework_Common.FlowFrameworkGetResponse

2 changes: 1 addition & 1 deletion api/flowFramework/getStatus.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export type FlowFramework_GetStatus_Response = ApiResponse & {
body: FlowFramework_GetStatus_ResponseBody;
}

export type FlowFramework_GetStatus_ResponseBody = Record<string, any>
export type FlowFramework_GetStatus_ResponseBody = FlowFramework_Common.WorkFlowStatusFullResponse | FlowFramework_Common.WorkFlowStatusDefaultResponse

2 changes: 1 addition & 1 deletion api/flowFramework/getSteps.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ export type FlowFramework_GetSteps_Response = ApiResponse & {
body: FlowFramework_GetSteps_ResponseBody;
}

export type FlowFramework_GetSteps_ResponseBody = Record<string, any>
export type FlowFramework_GetSteps_ResponseBody = FlowFramework_Common.WorkflowSteps

2 changes: 1 addition & 1 deletion api/flowFramework/provision.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export type FlowFramework_Provision_Response = ApiResponse & {
body: FlowFramework_Provision_ResponseBody;
}

export type FlowFramework_Provision_ResponseBody = Record<string, any>
export type FlowFramework_Provision_ResponseBody = FlowFramework_Common.WorkflowIDResponse

2 changes: 1 addition & 1 deletion api/flowFramework/search.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ export type FlowFramework_Search_Response = ApiResponse & {
body: FlowFramework_Search_ResponseBody;
}

export type FlowFramework_Search_ResponseBody = Record<string, any>
export type FlowFramework_Search_ResponseBody = FlowFramework_Common.WorkflowSearchResponse

2 changes: 1 addition & 1 deletion api/flowFramework/searchState.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ export type FlowFramework_SearchState_Response = ApiResponse & {
body: FlowFramework_SearchState_ResponseBody;
}

export type FlowFramework_SearchState_ResponseBody = Record<string, any>
export type FlowFramework_SearchState_ResponseBody = FlowFramework_Common.WorkflowSearchStateResponse

Loading
Loading