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

adds strict types to Alerting Client #53821

Merged
merged 28 commits into from
Jan 6, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
dcd574e
added createdAt and updatedAt fields in alerting
gmmorris Dec 24, 2019
1721ec2
use the SavedObjets updated_at instead of a new field in alerting
gmmorris Dec 24, 2019
430fe9b
Merge branch 'master' into alerting/created_at-and-updated_at
gmmorris Dec 27, 2019
f6b0dfb
added concrete types on AlertClients public APIs
gmmorris Dec 27, 2019
36ea491
removed generics in AlertsClient
gmmorris Dec 30, 2019
be3b3a2
Merge branch 'master' into alerting/client-types
gmmorris Dec 30, 2019
b6c9385
Merge branch 'master' into alerting/created_at-and-updated_at
elasticmachine Dec 30, 2019
e8dbc15
added missing assetion
gmmorris Jan 2, 2020
27f54c0
Merge branch 'alerting/created_at-and-updated_at' of github.com:gmmor…
gmmorris Jan 2, 2020
fe1902e
Merge branch 'master' into alerting/created_at-and-updated_at
gmmorris Jan 2, 2020
fa3e74f
Merge branch 'master' into alerting/client-types
gmmorris Jan 2, 2020
1fb5735
used createdAt in place of empty updatedAt
gmmorris Jan 3, 2020
2f50541
fixed misuse of null on updatedAt
gmmorris Jan 3, 2020
1457a5a
Merge branch 'alerting/created_at-and-updated_at' into alerting/clien…
gmmorris Jan 3, 2020
19063db
cleaned up tests
gmmorris Jan 3, 2020
5a4057d
fixed tests
gmmorris Jan 3, 2020
954a71a
fixed tests
gmmorris Jan 3, 2020
c4817e5
Merge branch 'alerting/created_at-and-updated_at' into alerting/clien…
gmmorris Jan 3, 2020
db0d578
Merge branch 'master' into alerting/created_at-and-updated_at
elasticmachine Jan 3, 2020
924393f
updatedAt should equal createdAt on creation
gmmorris Jan 3, 2020
dbd61a7
Merge branch 'alerting/created_at-and-updated_at' of github.com:gmmor…
gmmorris Jan 3, 2020
cf24b03
Merge branch 'master' into alerting/created_at-and-updated_at
gmmorris Jan 3, 2020
b04189e
Merge branch 'alerting/created_at-and-updated_at' into alerting/clien…
gmmorris Jan 3, 2020
6dff233
removed assertions for updatedAt in non-update operations
gmmorris Jan 3, 2020
543c057
Merge branch 'alerting/created_at-and-updated_at' into alerting/clien…
gmmorris Jan 3, 2020
d0452b2
Merge branch 'master' into alerting/client-types
gmmorris Jan 3, 2020
ae0314d
Merge branch 'master' into alerting/client-types
gmmorris Jan 3, 2020
8f5c13d
Merge branch 'master' into alerting/client-types
gmmorris Jan 6, 2020
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
3 changes: 3 additions & 0 deletions x-pack/legacy/plugins/alerting/mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
"updatedBy": {
"type": "keyword"
},
"createdAt": {
"type": "date"
},
"apiKey": {
"type": "binary"
},
Expand Down
27 changes: 27 additions & 0 deletions x-pack/legacy/plugins/alerting/server/alerts_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ describe('create()', () => {
params: {
bar: true,
},
createdAt: '2019-02-12T21:01:22.479Z',
actions: [
{
group: 'default',
Expand Down Expand Up @@ -160,6 +161,7 @@ describe('create()', () => {
},
],
"alertTypeId": "123",
"createdAt": 2019-02-12T21:01:22.479Z,
"id": "1",
"params": Object {
"bar": true,
Expand All @@ -168,6 +170,7 @@ describe('create()', () => {
"interval": "10s",
},
"scheduledTaskId": "task-123",
"updatedAt": null,
}
`);
expect(savedObjectsClient.create).toHaveBeenCalledTimes(1);
Expand All @@ -189,6 +192,7 @@ describe('create()', () => {
"apiKey": null,
"apiKeyOwner": null,
"consumer": "bar",
"createdAt": "2019-02-12T21:01:22.479Z",
"createdBy": "elastic",
"enabled": true,
"muteAll": false,
Expand Down Expand Up @@ -311,6 +315,7 @@ describe('create()', () => {
params: {
bar: true,
},
createdAt: new Date().toISOString(),
actions: [
{
group: 'default',
Expand Down Expand Up @@ -407,6 +412,7 @@ describe('create()', () => {
},
],
"alertTypeId": "123",
"createdAt": 2019-02-12T21:01:22.479Z,
"id": "1",
"params": Object {
"bar": true,
Expand All @@ -415,6 +421,7 @@ describe('create()', () => {
"interval": "10s",
},
"scheduledTaskId": "task-123",
"updatedAt": null,
}
`);
expect(savedObjectsClient.bulkGet).toHaveBeenCalledWith([
Expand Down Expand Up @@ -460,6 +467,7 @@ describe('create()', () => {
params: {
bar: true,
},
createdAt: new Date().toISOString(),
actions: [
{
group: 'default',
Expand Down Expand Up @@ -493,6 +501,7 @@ describe('create()', () => {
},
],
"alertTypeId": "123",
"createdAt": 2019-02-12T21:01:22.479Z,
"enabled": false,
"id": "1",
"params": Object {
Expand All @@ -501,6 +510,7 @@ describe('create()', () => {
"schedule": Object {
"interval": 10000,
},
"updatedAt": null,
}
`);
expect(savedObjectsClient.create).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -806,6 +816,7 @@ describe('create()', () => {
apiKey: Buffer.from('123:abc').toString('base64'),
apiKeyOwner: 'elastic',
createdBy: 'elastic',
createdAt: '2019-02-12T21:01:22.479Z',
updatedBy: 'elastic',
enabled: true,
schedule: { interval: '10s' },
Expand Down Expand Up @@ -1248,13 +1259,15 @@ describe('get()', () => {
},
],
"alertTypeId": "123",
"createdAt": 2019-02-12T21:01:22.479Z,
"id": "1",
"params": Object {
"bar": true,
},
"schedule": Object {
"interval": "10s",
},
"updatedAt": null,
}
`);
expect(savedObjectsClient.get).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -1347,13 +1360,15 @@ describe('find()', () => {
},
],
"alertTypeId": "123",
"createdAt": 2019-02-12T21:01:22.479Z,
"id": "1",
"params": Object {
"bar": true,
},
"schedule": Object {
"interval": "10s",
},
"updatedAt": null,
},
],
"page": 1,
Expand Down Expand Up @@ -1476,7 +1491,9 @@ describe('update()', () => {
},
],
scheduledTaskId: 'task-123',
createdAt: new Date().toISOString(),
},
updated_at: new Date().toISOString(),
references: [
{
name: 'action_0',
Expand Down Expand Up @@ -1517,6 +1534,7 @@ describe('update()', () => {
},
},
],
"createdAt": 2019-02-12T21:01:22.479Z,
"enabled": true,
"id": "1",
"params": Object {
Expand All @@ -1526,6 +1544,7 @@ describe('update()', () => {
"interval": "10s",
},
"scheduledTaskId": "task-123",
"updatedAt": 2019-02-12T21:01:22.479Z,
}
`);
expect(savedObjectsClient.update).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -1624,6 +1643,7 @@ describe('update()', () => {
params: {
bar: true,
},
createdAt: new Date().toISOString(),
actions: [
{
group: 'default',
Expand Down Expand Up @@ -1652,6 +1672,7 @@ describe('update()', () => {
],
scheduledTaskId: 'task-123',
},
updated_at: new Date().toISOString(),
references: [
{
name: 'action_0',
Expand Down Expand Up @@ -1732,6 +1753,7 @@ describe('update()', () => {
},
},
],
"createdAt": 2019-02-12T21:01:22.479Z,
"enabled": true,
"id": "1",
"params": Object {
Expand All @@ -1741,6 +1763,7 @@ describe('update()', () => {
"interval": "10s",
},
"scheduledTaskId": "task-123",
"updatedAt": 2019-02-12T21:01:22.479Z,
}
`);
expect(savedObjectsClient.bulkGet).toHaveBeenCalledWith([
Expand Down Expand Up @@ -1799,6 +1822,7 @@ describe('update()', () => {
params: {
bar: true,
},
createdAt: new Date().toISOString(),
actions: [
{
group: 'default',
Expand All @@ -1812,6 +1836,7 @@ describe('update()', () => {
apiKey: Buffer.from('123:abc').toString('base64'),
scheduledTaskId: 'task-123',
},
updated_at: new Date().toISOString(),
references: [
{
name: 'action_0',
Expand Down Expand Up @@ -1853,6 +1878,7 @@ describe('update()', () => {
},
],
"apiKey": "MTIzOmFiYw==",
"createdAt": 2019-02-12T21:01:22.479Z,
"enabled": true,
"id": "1",
"params": Object {
Expand All @@ -1862,6 +1888,7 @@ describe('update()', () => {
"interval": "10s",
},
"scheduledTaskId": "task-123",
"updatedAt": 2019-02-12T21:01:22.479Z,
}
`);
expect(savedObjectsClient.update).toHaveBeenCalledTimes(1);
Expand Down
Loading