-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SavedObjectsUtils.getConvertedObjectId function
Also change document migrator code to use this function instead of using uuidv5 directly.
- Loading branch information
Showing
9 changed files
with
142 additions
and
36 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...core/server/kibana-plugin-core-server.savedobjectsutils.getconvertedobjectid.md
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,28 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsUtils](./kibana-plugin-core-server.savedobjectsutils.md) > [getConvertedObjectId](./kibana-plugin-core-server.savedobjectsutils.getconvertedobjectid.md) | ||
|
||
## SavedObjectsUtils.getConvertedObjectId() method | ||
|
||
Uses a single-namespace object's "legacy ID" to determine what its new ID will be after it is converted to a multi-namespace type. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
static getConvertedObjectId(namespace: string | undefined, type: string, id: string): string; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| namespace | <code>string | undefined</code> | | | ||
| type | <code>string</code> | | | ||
| id | <code>string</code> | | | ||
|
||
<b>Returns:</b> | ||
|
||
`string` | ||
|
||
{<!-- -->string<!-- -->} The ID of the saved object after it is converted. | ||
|
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
21 changes: 21 additions & 0 deletions
21
src/core/server/saved_objects/migrations/core/document_migrator.test.mock.ts
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,21 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
const mockGetConvertedObjectId = jest.fn().mockReturnValue('uuidv5'); | ||
jest.mock('../../service/lib/utils', () => { | ||
const actual = jest.requireActual('../../service/lib/utils'); | ||
return { | ||
...actual, | ||
SavedObjectsUtils: { | ||
...actual.SavedObjectsUtils, | ||
getConvertedObjectId: mockGetConvertedObjectId, | ||
}, | ||
}; | ||
}); | ||
|
||
export { mockGetConvertedObjectId }; |
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
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
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
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
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
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