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

feat: update to run ci #301

Closed
Closed
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ export const registerResolveImportErrorsRoute = (router: IRouter, config: SavedO
retries: req.body.retries,
objectLimit: maxImportExportSize,
createNewCopies: req.query.createNewCopies,
workspaces,
dataSourceId,
dataSourceTitle,
workspaces,
Expand Down
24 changes: 0 additions & 24 deletions src/core/server/saved_objects/service/lib/repository.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ describe('SavedObjectsRepository', () => {
_source: {
...(registry.isSingleNamespace(type) && { namespace: namespaceId }),
...(registry.isMultiNamespace(type) && { namespaces: [namespaceId ?? 'default'] }),
workspaces,
...(originId && { originId }),
...(permissions && { permissions }),
type,
Expand Down Expand Up @@ -460,14 +459,6 @@ describe('SavedObjectsRepository', () => {
},
};
const workspace = 'foo-workspace';
const permissions = {
read: {
users: ['user1'],
},
write: {
groups: ['groups1'],
},
};

const getMockBulkCreateResponse = (objects, namespace) => {
return {
Expand Down Expand Up @@ -761,18 +752,6 @@ describe('SavedObjectsRepository', () => {
expectClientCallArgsAction(objects, { method: 'create', getId });
});

it(`accepts permissions property when providing permissions info`, async () => {
const objects = [obj1, obj2].map((obj) => ({ ...obj, permissions: permissions }));
await bulkCreateSuccess(objects);
const expected = expect.objectContaining({ permissions });
const body = [expect.any(Object), expected, expect.any(Object), expected];
expect(client.bulk).toHaveBeenCalledWith(
expect.objectContaining({ body }),
expect.anything()
);
client.bulk.mockClear();
});

it(`adds workspaces to request body for any types`, async () => {
await bulkCreateSuccess([obj1, obj2], { workspaces: [workspace] });
const expected = expect.objectContaining({ workspaces: [workspace] });
Expand Down Expand Up @@ -1965,9 +1944,6 @@ describe('SavedObjectsRepository', () => {
...omitWorkspace(obj9),
error: {
...createConflictError(obj9.type, obj9.id),
metadata: {
isNotOverwritable: true,
},
},
},
],
Expand Down
13 changes: 1 addition & 12 deletions src/core/server/saved_objects/service/lib/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,24 +598,13 @@ export class SavedObjectsRepository {
const { type, id, opensearchRequestIndex } = expectedResult.value;
const doc = bulkGetResponse?.body.docs[opensearchRequestIndex];
if (doc?.found) {
let workspaceConflict = false;
if (options.workspaces) {
const transformedObject = this._serializer.rawToSavedObject(doc as SavedObjectsRawDoc);
const filteredWorkspaces = SavedObjectsUtils.filterWorkspacesAccordingToBaseWorkspaces(
options.workspaces,
transformedObject.workspaces
);
if (filteredWorkspaces.length) {
workspaceConflict = true;
}
}
errors.push({
id,
type,
error: {
...errorContent(SavedObjectsErrorHelpers.createConflictError(type, id)),
// @ts-expect-error MultiGetHit._source is optional
...((!this.rawDocExistsInNamespace(doc!, namespace) || workspaceConflict) && {
...(!this.rawDocExistsInNamespace(doc!, namespace) && {
metadata: { isNotOverwritable: true },
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,27 +151,6 @@ function getClauseForWorkspace(workspace: string) {
};
}

/**
* Gets the clause that will filter for the workspace.
*/
function getClauseForWorkspace(workspace: string) {
if (workspace === '*') {
return {
bool: {
must: {
match_all: {},
},
},
};
}

return {
bool: {
must: [{ term: { workspaces: workspace } }],
},
};
}

interface HasReferenceQueryParams {
type: string;
id: string;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading