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

Add notifications plugin, offering basic email service #143303

Merged
merged 61 commits into from
Nov 3, 2022
Merged
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
2a93a37
Adding unsecured actions client
ymao1 Oct 13, 2022
dc9829e
Merge remote-tracking branch 'remotes/ymao/actions/unsecured-client' …
gsoldevila Oct 13, 2022
2fe5ce5
Removing isESOCanEncrypt check
ymao1 Oct 13, 2022
dbed0a8
Only getting actions client when needed in executor
ymao1 Oct 13, 2022
4af9bc6
Merge remote-tracking branch 'remotes/ymao/actions/unsecured-client' …
gsoldevila Oct 13, 2022
c3ce0b1
First draft
gsoldevila Oct 13, 2022
00c611d
Changing to feature id allowlist. Adding unit tests
ymao1 Oct 14, 2022
b0fba11
Merge branch 'main' of https://github.com/elastic/kibana into actions…
ymao1 Oct 14, 2022
baf051a
Removing execution id
ymao1 Oct 14, 2022
96b696f
Cleanup
ymao1 Oct 14, 2022
6cf7a3a
Fixing unit tests
ymao1 Oct 14, 2022
74aa62d
Merge remote-tracking branch 'remotes/ymao/actions/unsecured-client' …
gsoldevila Oct 17, 2022
fa4a356
Merge branch 'main' of https://github.com/elastic/kibana into actions…
ymao1 Oct 17, 2022
8865a80
Removing slack from allowlist
ymao1 Oct 17, 2022
7c884ae
Make getUnsecuredActionsClient synchronous
ymao1 Oct 17, 2022
f4c1851
Add comment
ymao1 Oct 17, 2022
3b7a388
Merge remote-tracking branch 'remotes/ymao/actions/unsecured-client' …
gsoldevila Oct 17, 2022
4b7f482
Misc enhancements following PR comments
gsoldevila Oct 17, 2022
9a58040
Merge branch 'main' of https://github.com/elastic/kibana into actions…
ymao1 Oct 18, 2022
47f1ca9
Adding functional tests
ymao1 Oct 18, 2022
c87baee
Fixing types
ymao1 Oct 18, 2022
28c6632
Fixing tests
ymao1 Oct 18, 2022
db2dc2a
Merge branch 'main' of https://github.com/elastic/kibana into actions…
ymao1 Oct 18, 2022
d5bf4ff
Merge branch 'main' of https://github.com/elastic/kibana into actions…
ymao1 Oct 19, 2022
026646a
Removing unnecessary Promise.all
ymao1 Oct 19, 2022
ea31342
Merge remote-tracking branch 'remotes/ymao/actions/unsecured-client' …
gsoldevila Oct 19, 2022
802dfa0
Cleanup
ymao1 Oct 19, 2022
c048225
Misc fixes and simplifications
gsoldevila Oct 19, 2022
f149cac
Merge remote-tracking branch 'remotes/ymao/actions/unsecured-client' …
gsoldevila Oct 20, 2022
cd500db
Add missing tsconfig.json
gsoldevila Oct 20, 2022
a293085
[CI] Auto-commit changed files from 'node scripts/build_plugin_list_d…
kibanamachine Oct 20, 2022
ff65387
Merge branch 'main' into kbn-140743-notifications-api-mvp
gsoldevila Oct 20, 2022
e241d0d
Add dependency to Actions plugin in tsconfig.json
gsoldevila Oct 20, 2022
0079193
Merge branch 'main' into kbn-140743-notifications-api-mvp
gsoldevila Oct 20, 2022
7f358bf
Separate setup logic from start logic
gsoldevila Oct 20, 2022
8929996
Fix bulkEnqueueExecution params structure
gsoldevila Oct 24, 2022
fd4b2ef
Update README
gsoldevila Oct 24, 2022
c344a61
Add UTs
gsoldevila Oct 24, 2022
b02bd81
Merge branch 'main' into kbn-140743-notifications-api-mvp
gsoldevila Oct 24, 2022
53575d9
Check license type >platinum for email notifications
gsoldevila Oct 25, 2022
52e7c8c
Merge branch 'main' into kbn-140743-notifications-api-mvp
gsoldevila Oct 25, 2022
f214324
Fix incorrect UTs
gsoldevila Oct 26, 2022
e0dd0f7
Import types when possible
gsoldevila Oct 26, 2022
8218cc4
Misc enhancements and code cleanup
gsoldevila Oct 26, 2022
0ccf326
Transform factory => provider, update start contract
gsoldevila Oct 27, 2022
a561085
Merge branch 'main' into kbn-140743-notifications-api-mvp
gsoldevila Oct 27, 2022
2d26740
Fix merge-related issues
gsoldevila Oct 27, 2022
3ed6752
Code cleanup, update README
gsoldevila Oct 27, 2022
9dbe577
Fix TS error
gsoldevila Oct 27, 2022
0238877
Support list of spaces for each related SO
gsoldevila Oct 28, 2022
06ff938
Merge branch 'main' into kbn-140743-notifications-api-mvp
gsoldevila Oct 28, 2022
dc4c9a6
Accept single spaceId for related SOs. Add convenience mocks
gsoldevila Nov 2, 2022
2654fee
Merge branch 'main' into kbn-140743-notifications-api-mvp
gsoldevila Nov 2, 2022
1467966
Merge branch 'main' into kbn-140743-notifications-api-mvp
gsoldevila Nov 2, 2022
091eb74
Merge branch 'main' into kbn-140743-notifications-api-mvp
gsoldevila Nov 2, 2022
d6e46f5
Fix CI types error
gsoldevila Nov 2, 2022
8d026c5
Address PR remarks
gsoldevila Nov 3, 2022
f275913
Merge branch 'main' into kbn-140743-notifications-api-mvp
gsoldevila Nov 3, 2022
56f99c9
Merge branch 'main' into kbn-140743-notifications-api-mvp
gsoldevila Nov 3, 2022
3aef92a
Address PR remarks #2
gsoldevila Nov 3, 2022
439b3e7
Merge branch 'main' into kbn-140743-notifications-api-mvp
gsoldevila Nov 3, 2022
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
Prev Previous commit
Next Next commit
Fix CI types error
gsoldevila committed Nov 2, 2022
commit d6e46f5db5becbf02d73411f29e48acab4a469a4
Original file line number Diff line number Diff line change
@@ -6,8 +6,7 @@
*/

import type { IUnsecuredActionsClient } from '@kbn/actions-plugin/server';
import type { RelatedSavedObjects } from '@kbn/actions-plugin/server/lib/related_saved_objects';
import type { EmailService, PlainTextEmail, RelatedSavedObject } from './types';
import type { EmailService, PlainTextEmail } from './types';

export class ConnectorsEmailService implements EmailService {
constructor(
@@ -25,13 +24,11 @@ export class ConnectorsEmailService implements EmailService {
message: params.message,
},
...(params.context?.relatedObjects?.length && {
relatedSavedObjects: this._getRelatedSavedObjects(params.context!.relatedObjects!),
relatedSavedObjects: params.context!.relatedObjects!.map(
({ id, type, spaceId: namespace }) => ({ id, type, namespace })
),
}),
}));
return await this.actionsClient.bulkEnqueueExecution(this.requesterId, actions);
}

private _getRelatedSavedObjects(relatedObjects: RelatedSavedObject[]): RelatedSavedObjects {
return relatedObjects.map(({ id, type, spaceId: namespace }) => ({ id, type, namespace }));
}
}
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
*/

import { Subject } from 'rxjs';
import { licenseMock } from '@kbn/licensing-plugin/common/licensing.mock';
import { licensingMock } from '@kbn/licensing-plugin/server/mocks';
import { loggerMock } from '@kbn/logging-mocks';
import { LicensedEmailService } from './licensed_email_service';
import type { ILicense } from '@kbn/licensing-plugin/server';
@@ -18,8 +18,8 @@ const emailServiceMock: EmailService = {
sendPlainTextEmail: jest.fn(),
};

const validLicense = licenseMock.createLicenseMock();
const invalidLicense = licenseMock.createLicenseMock();
const validLicense = licensingMock.createLicenseMock();
const invalidLicense = licensingMock.createLicenseMock();
invalidLicense.type = 'basic';
invalidLicense.check = jest.fn(() => ({
state: 'invalid',
6 changes: 4 additions & 2 deletions x-pack/plugins/notifications/tsconfig.json
Original file line number Diff line number Diff line change
@@ -13,7 +13,9 @@
"public/**/*",
"common/**/*"
],
"references": [
{ "path": "../actions/tsconfig.json" }
"kbn_references": [
{ "path": "../../../src/core/tsconfig.json" },
{ "path": "../actions/tsconfig.json" },
{ "path": "../licensing/tsconfig.json" }
]
}