-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[Reporting]: Move router + license checks to new platform #66331
Merged
joelgriffith
merged 50 commits into
elastic:master
from
joelgriffith:chore/np-route-migration
May 29, 2020
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
004dd70
WIP: Move routes to new API, license and other checks inbound
joelgriffith 938e14a
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
joelgriffith 500b933
Move license checks over to np licensing observable
joelgriffith b9cc20c
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
joelgriffith 4feb02f
Fix license checks + remove older modules
joelgriffith 02394d5
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
joelgriffith 2b18fe2
Fixing check_license tests, move to TS/Jest
joelgriffith dfd62f3
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
joelgriffith ac361a8
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
joelgriffith 7fab2c6
Fix licensing setup for mocks
joelgriffith 48c88f8
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
joelgriffith 15ece89
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
joelgriffith d58fc14
Move job.test.ts over to np
joelgriffith 6e1667e
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
joelgriffith 007dd57
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
joelgriffith ed1ac8c
WIP: move user checks to higher-order func
joelgriffith c08ea7b
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
joelgriffith 756551f
Move more handler logic over to Response factory vs Boom
joelgriffith 7e6efa2
Major refactor to consolidate types, remove facades, and udpate helpers
joelgriffith 82a1767
Fix validation for dates in immediate exports
joelgriffith bb0e7ee
Linter fix on check license test
joelgriffith ec94204
Fix job generation tests
joelgriffith 39a1313
Move deps => setupDeps
joelgriffith c7cba25
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
joelgriffith b4e54e1
fix api test
tsullivan ee7db9a
fix jobs test
tsullivan e7262f4
authorized_user_pre_routing and tests
tsullivan d69be5f
Fixing duplicate identifiers
joelgriffith 107eca0
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
joelgriffith ca58c89
Merge pull request #1 from tsullivan/chore/np-route-migration
joelgriffith a8f4bcd
Fix licensing implementation changes
joelgriffith 54863d0
Merge branch 'chore/np-route-migration' of https://github.com/joelgri…
joelgriffith 86920d3
WIP: Moving license over to async/observables
joelgriffith 7532d55
Fix disabled-security case
joelgriffith dc57a6f
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
joelgriffith f764bf8
finish auth_user_pre_routing cleanup - no more license check
tsullivan 01fc733
Merge pull request #2 from tsullivan/chore/np-route-migration
joelgriffith 874222f
WIP: Fixing final api tests
joelgriffith dce4083
Trying to get schema differences in alignment
joelgriffith 76904b7
Merge branch 'chore/np-route-migration' of https://github.com/joelgri…
joelgriffith 2a5f9a0
Reverting back to previous generation handler
joelgriffith f7d1134
Fix final API tests
joelgriffith 0aca67c
Final API test fixes, few more hardening tests and better error messages
joelgriffith 7554127
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
joelgriffith 27040a9
Simplify lower-level module implementation (core only interface) + te…
joelgriffith 8ad57ff
Push some core logic into plugin
joelgriffith 4f12c8a
Move some core logic up to plugin
joelgriffith 3ab8095
Marking private setupDeps + downstream fixes
joelgriffith 1cf1546
revert logger as a param
tsullivan fcf9f58
Merge pull request #3 from tsullivan/chore/np-route-migration
joelgriffith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,33 +5,28 @@ | |
*/ | ||
|
||
import { validateUrls } from '../../../../common/validate_urls'; | ||
import { ReportingCore } from '../../../../server'; | ||
import { cryptoFactory } from '../../../../server/lib'; | ||
import { | ||
ConditionalHeaders, | ||
CreateJobFactory, | ||
ESQueueCreateJobFn, | ||
RequestFacade, | ||
} from '../../../../server/types'; | ||
import { CreateJobFactory, ESQueueCreateJobFn } from '../../../../server/types'; | ||
import { JobParamsPDF } from '../../types'; | ||
|
||
export const createJobFactory: CreateJobFactory<ESQueueCreateJobFn< | ||
JobParamsPDF | ||
>> = function createJobFactoryFn(reporting: ReportingCore) { | ||
>> = function createJobFactoryFn(reporting) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for cleaning up this inferrable types! |
||
const config = reporting.getConfig(); | ||
const setupDeps = reporting.getPluginSetupDeps(); | ||
const crypto = cryptoFactory(config.get('encryptionKey')); | ||
|
||
return async function createJobFn( | ||
{ title, relativeUrls, browserTimezone, layout, objectType }: JobParamsPDF, | ||
headers: ConditionalHeaders['headers'], | ||
request: RequestFacade | ||
context, | ||
req | ||
) { | ||
const serializedEncryptedHeaders = await crypto.encrypt(headers); | ||
const serializedEncryptedHeaders = await crypto.encrypt(req.headers); | ||
|
||
validateUrls(relativeUrls); | ||
|
||
return { | ||
basePath: request.getBasePath(), | ||
basePath: setupDeps.basePath(req), | ||
browserTimezone, | ||
forceNow: new Date().toISOString(), | ||
headers: serializedEncryptedHeaders, | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed now so we can pass long certain job-status messages (they were incorrectly being sent as application/json, and I think hapi was fixing that under-the-hood)