Skip to content

Commit

Permalink
fix merge issue
Browse files Browse the repository at this point in the history
Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am committed Oct 13, 2023
1 parent 1e5c81e commit 2b38868
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 51 deletions.
2 changes: 1 addition & 1 deletion src/core/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ export interface CoreSetup<TPluginsStart extends object = object, TStart = unkno
export type StartServicesAccessor<
TPluginsStart extends object = object,
TStart = unknown
> = () => Promise<[CoreStart, TPluginsStart, TStart]>;
> = () => Promise<[CoreStart, TPluginsStart, TStart]>;

/**
* Context passed to the plugins `start` method.
Expand Down
10 changes: 6 additions & 4 deletions src/core/server/saved_objects/service/lib/repository.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ describe('SavedObjectsRepository', () => {
return {
// NOTE: OpenSearch returns more fields (_index, _type) but the SavedObjectsRepository method ignores these
found: true,
_id: `${registry.isSingleNamespace(type) && namespaceId ? `${namespaceId}:` : ''
}${type}:${id}`,
_id: `${
registry.isSingleNamespace(type) && namespaceId ? `${namespaceId}:` : ''
}${type}:${id}`,
...mockVersionProps,
_source: {
...(registry.isSingleNamespace(type) && { namespace: namespaceId }),
Expand Down Expand Up @@ -1443,8 +1444,9 @@ describe('SavedObjectsRepository', () => {
const getMockBulkUpdateResponse = (objects, options, includeOriginId) => ({
items: objects.map(({ type, id }) => ({
update: {
_id: `${registry.isSingleNamespace(type) && options?.namespace ? `${options?.namespace}:` : ''
}${type}:${id}`,
_id: `${
registry.isSingleNamespace(type) && options?.namespace ? `${options?.namespace}:` : ''
}${type}:${id}`,
...mockVersionProps,
get: {
_source: {
Expand Down
70 changes: 33 additions & 37 deletions src/core/server/saved_objects/service/lib/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,13 @@ export class SavedObjectsRepository {
}));
const bulkGetResponse = bulkGetDocs.length
? await this.client.mget(
{
body: {
docs: bulkGetDocs,
{
body: {
docs: bulkGetDocs,
},
},
},
{ ignore: [404] }
)
{ ignore: [404] }
)
: undefined;

let bulkRequestIndexCounter = 0;
Expand Down Expand Up @@ -562,9 +562,9 @@ export class SavedObjectsRepository {

const bulkResponse = bulkCreateParams.length
? await this.client.bulk({
refresh,
body: bulkCreateParams,
})
refresh,
body: bulkCreateParams,
})
: undefined;

return {
Expand Down Expand Up @@ -643,13 +643,13 @@ export class SavedObjectsRepository {
}));
const bulkGetResponse = bulkGetDocs.length
? await this.client.mget(
{
body: {
docs: bulkGetDocs,
{
body: {
docs: bulkGetDocs,
},
},
},
{ ignore: [404] }
)
{ ignore: [404] }
)
: undefined;

const errors: SavedObjectsCheckConflictsResponse['errors'] = [];
Expand Down Expand Up @@ -804,11 +804,7 @@ export class SavedObjectsRepository {
}

/**
<<<<<<< HEAD
* Deletes all objects from the provided workspace. It used when delete a workspace.
=======
* Deletes all objects from the provided workspace. It used when deleting a workspace.
>>>>>>> 7773811875 ([API] Delete saved objects by workspace (#216))
*
* @param {string} workspace
* @param options SavedObjectsDeleteByWorkspaceOptions
Expand Down Expand Up @@ -1063,13 +1059,13 @@ export class SavedObjectsRepository {
}));
const bulkGetResponse = bulkGetDocs.length
? await this.client.mget(
{
body: {
docs: bulkGetDocs,
{
body: {
docs: bulkGetDocs,
},
},
},
{ ignore: [404] }
)
{ ignore: [404] }
)
: undefined;

return {
Expand Down Expand Up @@ -1696,15 +1692,15 @@ export class SavedObjectsRepository {
}));
const bulkGetResponse = bulkGetDocs.length
? await this.client.mget(
{
body: {
docs: bulkGetDocs,
{
body: {
docs: bulkGetDocs,
},
},
},
{
ignore: [404],
}
)
{
ignore: [404],
}
)
: undefined;

let bulkUpdateRequestIndexCounter = 0;
Expand Down Expand Up @@ -1787,10 +1783,10 @@ export class SavedObjectsRepository {
const { refresh = DEFAULT_REFRESH_SETTING } = options;
const bulkUpdateResponse = bulkUpdateParams.length
? await this.client.bulk({
refresh,
body: bulkUpdateParams,
_source_includes: ['originId'],
})
refresh,
body: bulkUpdateParams,
_source_includes: ['originId'],
})
: undefined;

return {
Expand Down
9 changes: 0 additions & 9 deletions src/core/server/saved_objects/service/saved_objects_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,6 @@ export interface SavedObjectsUpdateResponse<T = unknown>
references: SavedObjectReference[] | undefined;
}

/**
*
* @public
*/
export interface SavedObjectsDeleteByWorkspaceOptions extends SavedObjectsBaseOptions {
/** The OpenSearch supports only boolean flag for this operation */
refresh?: boolean;
}

/**
*
* @public
Expand Down

0 comments on commit 2b38868

Please sign in to comment.