Skip to content

Commit

Permalink
Rename resolve aliasTargetId to alias_target_id
Browse files Browse the repository at this point in the history
  • Loading branch information
jportner committed Aug 9, 2021
1 parent 2e2fa20 commit 1c95043
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [ResolvedSimpleSavedObject](./kibana-plugin-core-public.resolvedsimplesavedobject.md) &gt; [aliasTargetId](./kibana-plugin-core-public.resolvedsimplesavedobject.aliastargetid.md)
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [ResolvedSimpleSavedObject](./kibana-plugin-core-public.resolvedsimplesavedobject.md) &gt; [alias\_target\_id](./kibana-plugin-core-public.resolvedsimplesavedobject.alias_target_id.md)

## ResolvedSimpleSavedObject.aliasTargetId property
## ResolvedSimpleSavedObject.alias\_target\_id property

The ID of the object that the legacy URL alias points to. This is only defined when the outcome is `'aliasMatch'` or `'conflict'`<!-- -->.

<b>Signature:</b>

```typescript
aliasTargetId?: SavedObjectsResolveResponse['aliasTargetId'];
alias_target_id?: SavedObjectsResolveResponse['alias_target_id'];
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface ResolvedSimpleSavedObject<T = unknown>

| Property | Type | Description |
| --- | --- | --- |
| [aliasTargetId](./kibana-plugin-core-public.resolvedsimplesavedobject.aliastargetid.md) | <code>SavedObjectsResolveResponse['aliasTargetId']</code> | The ID of the object that the legacy URL alias points to. This is only defined when the outcome is <code>'aliasMatch'</code> or <code>'conflict'</code>. |
| [alias\_target\_id](./kibana-plugin-core-public.resolvedsimplesavedobject.alias_target_id.md) | <code>SavedObjectsResolveResponse['alias_target_id']</code> | The ID of the object that the legacy URL alias points to. This is only defined when the outcome is <code>'aliasMatch'</code> or <code>'conflict'</code>. |
| [outcome](./kibana-plugin-core-public.resolvedsimplesavedobject.outcome.md) | <code>SavedObjectsResolveResponse['outcome']</code> | The outcome for a successful <code>resolve</code> call is one of the following values:<!-- -->\* <code>'exactMatch'</code> -- One document exactly matched the given ID. \* <code>'aliasMatch'</code> -- One document with a legacy URL alias matched the given ID; in this case the <code>saved_object.id</code> field is different than the given ID. \* <code>'conflict'</code> -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the <code>saved_object</code> object is the exact match, and the <code>saved_object.id</code> field is the same as the given ID. |
| [saved\_object](./kibana-plugin-core-public.resolvedsimplesavedobject.saved_object.md) | <code>SimpleSavedObject&lt;T&gt;</code> | The saved object that was found. |

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsResolveResponse](./kibana-plugin-core-public.savedobjectsresolveresponse.md) &gt; [aliasTargetId](./kibana-plugin-core-public.savedobjectsresolveresponse.aliastargetid.md)
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsResolveResponse](./kibana-plugin-core-public.savedobjectsresolveresponse.md) &gt; [alias\_target\_id](./kibana-plugin-core-public.savedobjectsresolveresponse.alias_target_id.md)

## SavedObjectsResolveResponse.aliasTargetId property
## SavedObjectsResolveResponse.alias\_target\_id property

The ID of the object that the legacy URL alias points to. This is only defined when the outcome is `'aliasMatch'` or `'conflict'`<!-- -->.

<b>Signature:</b>

```typescript
aliasTargetId?: string;
alias_target_id?: string;
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface SavedObjectsResolveResponse<T = unknown>

| Property | Type | Description |
| --- | --- | --- |
| [aliasTargetId](./kibana-plugin-core-public.savedobjectsresolveresponse.aliastargetid.md) | <code>string</code> | The ID of the object that the legacy URL alias points to. This is only defined when the outcome is <code>'aliasMatch'</code> or <code>'conflict'</code>. |
| [alias\_target\_id](./kibana-plugin-core-public.savedobjectsresolveresponse.alias_target_id.md) | <code>string</code> | The ID of the object that the legacy URL alias points to. This is only defined when the outcome is <code>'aliasMatch'</code> or <code>'conflict'</code>. |
| [outcome](./kibana-plugin-core-public.savedobjectsresolveresponse.outcome.md) | <code>'exactMatch' &#124; 'aliasMatch' &#124; 'conflict'</code> | The outcome for a successful <code>resolve</code> call is one of the following values:<!-- -->\* <code>'exactMatch'</code> -- One document exactly matched the given ID. \* <code>'aliasMatch'</code> -- One document with a legacy URL alias matched the given ID; in this case the <code>saved_object.id</code> field is different than the given ID. \* <code>'conflict'</code> -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the <code>saved_object</code> object is the exact match, and the <code>saved_object.id</code> field is the same as the given ID. |
| [saved\_object](./kibana-plugin-core-public.savedobjectsresolveresponse.saved_object.md) | <code>SavedObject&lt;T&gt;</code> | The saved object that was found. |

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsResolveResponse](./kibana-plugin-core-server.savedobjectsresolveresponse.md) &gt; [aliasTargetId](./kibana-plugin-core-server.savedobjectsresolveresponse.aliastargetid.md)
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsResolveResponse](./kibana-plugin-core-server.savedobjectsresolveresponse.md) &gt; [alias\_target\_id](./kibana-plugin-core-server.savedobjectsresolveresponse.alias_target_id.md)

## SavedObjectsResolveResponse.aliasTargetId property
## SavedObjectsResolveResponse.alias\_target\_id property

The ID of the object that the legacy URL alias points to. This is only defined when the outcome is `'aliasMatch'` or `'conflict'`<!-- -->.

<b>Signature:</b>

```typescript
aliasTargetId?: string;
alias_target_id?: string;
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface SavedObjectsResolveResponse<T = unknown>

| Property | Type | Description |
| --- | --- | --- |
| [aliasTargetId](./kibana-plugin-core-server.savedobjectsresolveresponse.aliastargetid.md) | <code>string</code> | The ID of the object that the legacy URL alias points to. This is only defined when the outcome is <code>'aliasMatch'</code> or <code>'conflict'</code>. |
| [alias\_target\_id](./kibana-plugin-core-server.savedobjectsresolveresponse.alias_target_id.md) | <code>string</code> | The ID of the object that the legacy URL alias points to. This is only defined when the outcome is <code>'aliasMatch'</code> or <code>'conflict'</code>. |
| [outcome](./kibana-plugin-core-server.savedobjectsresolveresponse.outcome.md) | <code>'exactMatch' &#124; 'aliasMatch' &#124; 'conflict'</code> | The outcome for a successful <code>resolve</code> call is one of the following values:<!-- -->\* <code>'exactMatch'</code> -- One document exactly matched the given ID. \* <code>'aliasMatch'</code> -- One document with a legacy URL alias matched the given ID; in this case the <code>saved_object.id</code> field is different than the given ID. \* <code>'conflict'</code> -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the <code>saved_object</code> object is the exact match, and the <code>saved_object.id</code> field is the same as the given ID. |
| [saved\_object](./kibana-plugin-core-server.savedobjectsresolveresponse.saved_object.md) | <code>SavedObject&lt;T&gt;</code> | The saved object that was found. |

4 changes: 2 additions & 2 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ export type ResolveDeprecationResponse = {

// @public
export interface ResolvedSimpleSavedObject<T = unknown> {
aliasTargetId?: SavedObjectsResolveResponse['aliasTargetId'];
alias_target_id?: SavedObjectsResolveResponse['alias_target_id'];
outcome: SavedObjectsResolveResponse['outcome'];
saved_object: SimpleSavedObject<T>;
}
Expand Down Expand Up @@ -1520,7 +1520,7 @@ export type SavedObjectsNamespaceType = 'single' | 'multiple' | 'multiple-isolat

// @public (undocumented)
export interface SavedObjectsResolveResponse<T = unknown> {
aliasTargetId?: string;
alias_target_id?: string;
outcome: 'exactMatch' | 'aliasMatch' | 'conflict';
saved_object: SavedObject<T>;
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/public/saved_objects/saved_objects_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('SavedObjectsClient', () => {
http.fetch.mockResolvedValue({
saved_object: doc,
outcome: 'conflict',
aliasTargetId: 'another-id',
alias_target_id: 'another-id',
} as SavedObjectsResolveResponse);
});
});
Expand Down Expand Up @@ -201,7 +201,7 @@ describe('SavedObjectsClient', () => {
expect(result.saved_object.type).toBe(doc.type);
expect(result.saved_object.get('title')).toBe('Example title');
expect(result.outcome).toBe('conflict');
expect(result.aliasTargetId).toBe('another-id');
expect(result.alias_target_id).toBe('another-id');
});
});

Expand Down
10 changes: 7 additions & 3 deletions src/core/public/saved_objects/saved_objects_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,13 @@ export class SavedObjectsClient {

const path = `${this.getPath(['resolve'])}/${type}/${id}`;
const request: Promise<SavedObjectsResolveResponse<T>> = this.savedObjectsFetch(path, {});
return request.then(({ saved_object: savedObject, outcome, aliasTargetId }) => {
const simpleSavedObject = new SimpleSavedObject<T>(this, savedObject);
return { saved_object: simpleSavedObject, outcome, aliasTargetId };
return request.then((resolveResponse) => {
const simpleSavedObject = new SimpleSavedObject<T>(this, resolveResponse.saved_object);
return {
saved_object: simpleSavedObject,
outcome: resolveResponse.outcome,
alias_target_id: resolveResponse.alias_target_id,
};
});
};

Expand Down
2 changes: 1 addition & 1 deletion src/core/public/saved_objects/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ export interface ResolvedSimpleSavedObject<T = unknown> {
/**
* The ID of the object that the legacy URL alias points to. This is only defined when the outcome is `'aliasMatch'` or `'conflict'`.
*/
aliasTargetId?: SavedObjectsResolveResponse['aliasTargetId'];
alias_target_id?: SavedObjectsResolveResponse['alias_target_id'];
}
4 changes: 2 additions & 2 deletions src/core/server/saved_objects/service/lib/repository.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3459,7 +3459,7 @@ describe('SavedObjectsRepository', () => {
expect(result).toEqual({
saved_object: expect.objectContaining({ type, id: aliasTargetId }),
outcome: 'aliasMatch',
aliasTargetId,
alias_target_id: aliasTargetId,
});
};

Expand Down Expand Up @@ -3501,7 +3501,7 @@ describe('SavedObjectsRepository', () => {
expect(result).toEqual({
saved_object: expect.objectContaining({ type, id }),
outcome: 'conflict',
aliasTargetId,
alias_target_id: aliasTargetId,
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/saved_objects/service/lib/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ export class SavedObjectsRepository {
// @ts-expect-error MultiGetHit._source is optional
saved_object: getSavedObjectFromSource(this._registry, type, id, exactMatchDoc),
outcome: 'conflict',
aliasTargetId: legacyUrlAlias.targetId,
alias_target_id: legacyUrlAlias.targetId,
};
outcomeStatString = REPOSITORY_RESOLVE_OUTCOME_STATS.CONFLICT;
} else if (foundExactMatch) {
Expand All @@ -1160,7 +1160,7 @@ export class SavedObjectsRepository {
aliasMatchDoc
),
outcome: 'aliasMatch',
aliasTargetId: legacyUrlAlias.targetId,
alias_target_id: legacyUrlAlias.targetId,
};
outcomeStatString = REPOSITORY_RESOLVE_OUTCOME_STATS.ALIAS_MATCH;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export interface SavedObjectsResolveResponse<T = unknown> {
/**
* The ID of the object that the legacy URL alias points to. This is only defined when the outcome is `'aliasMatch'` or `'conflict'`.
*/
aliasTargetId?: string;
alias_target_id?: string;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3033,7 +3033,7 @@ export interface SavedObjectsResolveImportErrorsOptions {

// @public (undocumented)
export interface SavedObjectsResolveResponse<T = unknown> {
aliasTargetId?: string;
alias_target_id?: string;
outcome: 'exactMatch' | 'aliasMatch' | 'conflict';
saved_object: SavedObject<T>;
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/spaces_oss/public/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export interface SpacesApiUiComponent {
* that there is a conflict, and it includes a button that will redirect the user to object B when clicked.
*
* Consumers need to determine the local path for the new URL on their own, based on the object ID that was used to call
* `SavedObjectsClient.resolve()` (A) and the `aliasTargetId` value in the response (B). For example...
* `SavedObjectsClient.resolve()` (A) and the `alias_target_id` value in the response (B). For example...
*
* A is `workpad-123` and B is `workpad-e08b9bdb-ec14-4339-94c4-063bddfd610e`.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ export function resolveTestSuiteFactory(esArchiver: any, supertest: SuperTest<an
if (!testCase.failure) {
expect(response.body.outcome).to.eql(expectedOutcome);
if (expectedOutcome === 'conflict' || expectedOutcome === 'aliasMatch') {
expect(response.body.aliasTargetId).to.eql(expectedAliasTargetId);
expect(response.body.alias_target_id).to.eql(expectedAliasTargetId);
} else {
expect(response.body.aliasTargetId).to.eql(undefined);
expect(response.body.alias_target_id).to.eql(undefined);
}
}
}
Expand Down

0 comments on commit 1c95043

Please sign in to comment.