Skip to content

[6.x] Switch to Yarn (#15485)#15955

Merged
kimjoar merged 2 commits intoelastic:6.xfrom
kimjoar:backport/6.x/pr-15485
Jan 10, 2018
Merged

[6.x] Switch to Yarn (#15485)#15955
kimjoar merged 2 commits intoelastic:6.xfrom
kimjoar:backport/6.x/pr-15485

Conversation

@kimjoar
Copy link
Copy Markdown
Contributor

@kimjoar kimjoar commented Jan 10, 2018

Backports the following commits to 6.x:

@kimjoar kimjoar added the backport This PR is a backport of another PR label Jan 10, 2018
* switch to yarn

* cleanup misc references to npm

* [yarn] loosen dependency ranges so yarn will merge more deps

* fix linting error now that moment uses ESM

* [licenses] font-awesome changed the format of its license id

* Use local yarn

* Misc fixes

* eslintignore built yarn file

* Remove mkdir which doesn't do what it should do

* Check build without upgrading lots of versions

* Fix license check

* too many moments

* Better description

* Review fixes

* Lock to angular@1.6.5

* More specific version locks

* Revert "More specific version locks"

This reverts commit 11ef811.

* Revert "Lock to angular@1.6.5"

This reverts commit 3ade68c.

* rm yarn.lock; yarn

* Forcing a specific version of React, Angular, Moment

* Using vendored version of yarn in ci

* Use --frozen-lockfile

* fixes
@kimjoar kimjoar force-pushed the backport/6.x/pr-15485 branch from b465cab to 3a6e977 Compare January 10, 2018 15:03
@kimjoar kimjoar merged commit a817517 into elastic:6.x Jan 10, 2018
abhishekbhatia1710 added a commit that referenced this pull request Mar 31, 2026
…t, and async generation (#257046)

## Summary

- **LeadDataClient abstraction** : Extracted all Elasticsearch CRUD
operations (create, find, get-by-id, dismiss, bulk-update, status,
delete) into a dedicated `LeadDataClient` with snake_case ↔ camelCase
transform layer between index mappings and API types
- **Async generate endpoint** — Refactored `POST /generate` to return an
`executionUuid` immediately and run the pipeline (entity retrieval ->
observation modules -> scoring -> synthesis -> persistence) in the
background
- **Six new API routes** : Added `GET /{id}`, `GET /status`, `POST
/{id}/_dismiss`, `POST /bulk_update`, `POST /enable`, and `POST
/disable` with Zod-validated schemas, versioned routing, and proper
authorization
- **Shared Zod schemas** : Moved all request/response schemas to common
types (generateLeadsRequestSchema, findLeadsRequestSchema,
getLeadByIdRequestSchema, dismissLeadRequestSchema,
bulkUpdateLeadsRequestSchema, generateLeadsResponseSchema)
- **Refactored GET /leads** : Now delegates to
`LeadDataClient.findLeads` with page/perPage/sortField/sortOrder/status
query params
- **Unit tests** : Added tests for LeadDataClient (createLeads,
findLeads, getLeadById, dismissLead, bulkUpdateLeads, getStatus,
deleteAllLeads) and all route handlers (get_leads, get_lead_by_id,
get_lead_generation_status, dismiss_lead, bulk_update_leads, enable,
disable)

Enable and disable routes are placeholder stubs pending Task Manager
wiring (#15955).

Relates to: elastic/security-team#15953

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [ ] Flaky Test Runner was used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the guidelines
- [ ] Review the backport guidelines and apply applicable `backport:*`
labels.


## Testing Steps

**Manual verification** Start Kibana locally and test the API endpoints
below.

## API Examples

### Generate leads (async)
```bash
curl -X POST "http://localhost:5601/internal/entity_analytics/leads/generate" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -H "elastic-api-version: 1" \
  -u <....> \
  -d '{"connectorId": "optional-connector-id"}'
```
Returns: `{ "executionUuid": "abc-123-..." }`

### Find leads
```bash
curl -X GET "http://localhost:5601/internal/entity_analytics/leads?page=1&perPage=10&sortField=priority&sortOrder=desc" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: `{ "leads": [...], "total": 42, "page": 1, "perPage": 10 }`

### Get lead by ID
```bash
curl -X GET "http://localhost:5601/internal/entity_analytics/leads/{id}" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: full `leadSchema` object

### Get status
```bash
curl -X GET "http://localhost:5601/internal/entity_analytics/leads/status" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: `{ "isEnabled": false, "indexExists": true, "totalLeads": 42,
"lastRun": "..." }`

### Dismiss a lead
```bash
curl -X POST "http://localhost:5601/internal/entity_analytics/leads/{id}/_dismiss" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: `{ "success": true }`

### Bulk update
```bash
curl -X POST "http://localhost:5601/internal/entity_analytics/leads/bulk_update" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -H "elastic-api-version: 1" \
  -u <....> \
  -d '{"ids": ["id-1", "id-2"], "status": "dismissed"}'
```
Returns: `{ "updated": 2 }`

### Enable scheduled generation
```bash
curl -X POST "http://localhost:5601/internal/entity_analytics/leads/enable" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: `{ "success": true }`

### Disable scheduled generation
```bash
curl -X POST "http://localhost:5601/internal/entity_analytics/leads/disable" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: `{ "success": true }`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Jared Burgett <147995946+jaredburgettelastic@users.noreply.github.com>
Co-authored-by: jaredburgettelastic <jared.burgett@elastic.co>
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Apr 1, 2026
…t, and async generation (elastic#257046)

## Summary

- **LeadDataClient abstraction** : Extracted all Elasticsearch CRUD
operations (create, find, get-by-id, dismiss, bulk-update, status,
delete) into a dedicated `LeadDataClient` with snake_case ↔ camelCase
transform layer between index mappings and API types
- **Async generate endpoint** — Refactored `POST /generate` to return an
`executionUuid` immediately and run the pipeline (entity retrieval ->
observation modules -> scoring -> synthesis -> persistence) in the
background
- **Six new API routes** : Added `GET /{id}`, `GET /status`, `POST
/{id}/_dismiss`, `POST /bulk_update`, `POST /enable`, and `POST
/disable` with Zod-validated schemas, versioned routing, and proper
authorization
- **Shared Zod schemas** : Moved all request/response schemas to common
types (generateLeadsRequestSchema, findLeadsRequestSchema,
getLeadByIdRequestSchema, dismissLeadRequestSchema,
bulkUpdateLeadsRequestSchema, generateLeadsResponseSchema)
- **Refactored GET /leads** : Now delegates to
`LeadDataClient.findLeads` with page/perPage/sortField/sortOrder/status
query params
- **Unit tests** : Added tests for LeadDataClient (createLeads,
findLeads, getLeadById, dismissLead, bulkUpdateLeads, getStatus,
deleteAllLeads) and all route handlers (get_leads, get_lead_by_id,
get_lead_generation_status, dismiss_lead, bulk_update_leads, enable,
disable)

Enable and disable routes are placeholder stubs pending Task Manager
wiring (elastic#15955).

Relates to: elastic/security-team#15953

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [ ] Flaky Test Runner was used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the guidelines
- [ ] Review the backport guidelines and apply applicable `backport:*`
labels.


## Testing Steps

**Manual verification** Start Kibana locally and test the API endpoints
below.

## API Examples

### Generate leads (async)
```bash
curl -X POST "http://localhost:5601/internal/entity_analytics/leads/generate" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -H "elastic-api-version: 1" \
  -u <....> \
  -d '{"connectorId": "optional-connector-id"}'
```
Returns: `{ "executionUuid": "abc-123-..." }`

### Find leads
```bash
curl -X GET "http://localhost:5601/internal/entity_analytics/leads?page=1&perPage=10&sortField=priority&sortOrder=desc" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: `{ "leads": [...], "total": 42, "page": 1, "perPage": 10 }`

### Get lead by ID
```bash
curl -X GET "http://localhost:5601/internal/entity_analytics/leads/{id}" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: full `leadSchema` object

### Get status
```bash
curl -X GET "http://localhost:5601/internal/entity_analytics/leads/status" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: `{ "isEnabled": false, "indexExists": true, "totalLeads": 42,
"lastRun": "..." }`

### Dismiss a lead
```bash
curl -X POST "http://localhost:5601/internal/entity_analytics/leads/{id}/_dismiss" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: `{ "success": true }`

### Bulk update
```bash
curl -X POST "http://localhost:5601/internal/entity_analytics/leads/bulk_update" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -H "elastic-api-version: 1" \
  -u <....> \
  -d '{"ids": ["id-1", "id-2"], "status": "dismissed"}'
```
Returns: `{ "updated": 2 }`

### Enable scheduled generation
```bash
curl -X POST "http://localhost:5601/internal/entity_analytics/leads/enable" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: `{ "success": true }`

### Disable scheduled generation
```bash
curl -X POST "http://localhost:5601/internal/entity_analytics/leads/disable" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: `{ "success": true }`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Jared Burgett <147995946+jaredburgettelastic@users.noreply.github.com>
Co-authored-by: jaredburgettelastic <jared.burgett@elastic.co>
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Apr 2, 2026
…t, and async generation (elastic#257046)

## Summary

- **LeadDataClient abstraction** : Extracted all Elasticsearch CRUD
operations (create, find, get-by-id, dismiss, bulk-update, status,
delete) into a dedicated `LeadDataClient` with snake_case ↔ camelCase
transform layer between index mappings and API types
- **Async generate endpoint** — Refactored `POST /generate` to return an
`executionUuid` immediately and run the pipeline (entity retrieval ->
observation modules -> scoring -> synthesis -> persistence) in the
background
- **Six new API routes** : Added `GET /{id}`, `GET /status`, `POST
/{id}/_dismiss`, `POST /bulk_update`, `POST /enable`, and `POST
/disable` with Zod-validated schemas, versioned routing, and proper
authorization
- **Shared Zod schemas** : Moved all request/response schemas to common
types (generateLeadsRequestSchema, findLeadsRequestSchema,
getLeadByIdRequestSchema, dismissLeadRequestSchema,
bulkUpdateLeadsRequestSchema, generateLeadsResponseSchema)
- **Refactored GET /leads** : Now delegates to
`LeadDataClient.findLeads` with page/perPage/sortField/sortOrder/status
query params
- **Unit tests** : Added tests for LeadDataClient (createLeads,
findLeads, getLeadById, dismissLead, bulkUpdateLeads, getStatus,
deleteAllLeads) and all route handlers (get_leads, get_lead_by_id,
get_lead_generation_status, dismiss_lead, bulk_update_leads, enable,
disable)

Enable and disable routes are placeholder stubs pending Task Manager
wiring (elastic#15955).

Relates to: elastic/security-team#15953

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [ ] Flaky Test Runner was used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the guidelines
- [ ] Review the backport guidelines and apply applicable `backport:*`
labels.


## Testing Steps

**Manual verification** Start Kibana locally and test the API endpoints
below.

## API Examples

### Generate leads (async)
```bash
curl -X POST "http://localhost:5601/internal/entity_analytics/leads/generate" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -H "elastic-api-version: 1" \
  -u <....> \
  -d '{"connectorId": "optional-connector-id"}'
```
Returns: `{ "executionUuid": "abc-123-..." }`

### Find leads
```bash
curl -X GET "http://localhost:5601/internal/entity_analytics/leads?page=1&perPage=10&sortField=priority&sortOrder=desc" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: `{ "leads": [...], "total": 42, "page": 1, "perPage": 10 }`

### Get lead by ID
```bash
curl -X GET "http://localhost:5601/internal/entity_analytics/leads/{id}" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: full `leadSchema` object

### Get status
```bash
curl -X GET "http://localhost:5601/internal/entity_analytics/leads/status" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: `{ "isEnabled": false, "indexExists": true, "totalLeads": 42,
"lastRun": "..." }`

### Dismiss a lead
```bash
curl -X POST "http://localhost:5601/internal/entity_analytics/leads/{id}/_dismiss" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: `{ "success": true }`

### Bulk update
```bash
curl -X POST "http://localhost:5601/internal/entity_analytics/leads/bulk_update" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -H "elastic-api-version: 1" \
  -u <....> \
  -d '{"ids": ["id-1", "id-2"], "status": "dismissed"}'
```
Returns: `{ "updated": 2 }`

### Enable scheduled generation
```bash
curl -X POST "http://localhost:5601/internal/entity_analytics/leads/enable" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: `{ "success": true }`

### Disable scheduled generation
```bash
curl -X POST "http://localhost:5601/internal/entity_analytics/leads/disable" \
  -H "kbn-xsrf: true" \
  -H "elastic-api-version: 1" \
  -u <....>
```
Returns: `{ "success": true }`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Jared Burgett <147995946+jaredburgettelastic@users.noreply.github.com>
Co-authored-by: jaredburgettelastic <jared.burgett@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants