[Reporting]: Move router + license checks to new platform#66331
[Reporting]: Move router + license checks to new platform#66331joelgriffith merged 50 commits intoelastic:masterfrom joelgriffith:chore/np-route-migration
Conversation
| security: server.newPlatform.setup.plugins.security as SecurityPluginSetup, | ||
| usageCollection: server.newPlatform.setup.plugins.usageCollection, | ||
| __LEGACY, | ||
| licensing: { |
There was a problem hiding this comment.
Need to verify this is working properly as I'm not fully versed on how this works
| exportTypeId: string, | ||
| jobParams: JobParamsType, | ||
| user: string, | ||
| username: string, |
There was a problem hiding this comment.
Change here helped me tighten down types in downstream modules
|
Ack: will review tomorrow. |
| 'application/pdf', | ||
| CONTENT_TYPE_CSV, | ||
| 'image/png', | ||
| 'text/plain', |
There was a problem hiding this comment.
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)
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
There was a problem hiding this comment.
Needed since new config schema doesn't have an API for this
|
Pushed up a larger delta for job-status tests, still more that needs to be done but the rest should be relatively quick since we have patterns in place for how to do this. |
…ffith/kibana into chore/np-route-migration
x-pack/legacy/plugins/reporting/server/routes/generation.test.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/reporting/server/routes/generation.test.ts
Outdated
Show resolved
Hide resolved
| export const createJobFactory: CreateJobFactory<ESQueueCreateJobFn< | ||
| JobParamsPDF | ||
| >> = function createJobFactoryFn(reporting: ReportingCore) { | ||
| >> = function createJobFactoryFn(reporting) { |
There was a problem hiding this comment.
Thank you for cleaning up this inferrable types!
|
|
||
| constructor(private logger: LevelLogger, private config: ReportingConfig) {} | ||
|
|
||
| legacySetup( |
|
Once this is green, my plan is to:
|
tsullivan
left a comment
There was a problem hiding this comment.
LGTM
Thank you SO much for the work you have put into this, @joelgriffith. This PR a major, major improvement.
Approved elsewhere, not sure why GH is having this block merge
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
|
Backport [7.9]: #67818 |
…) (#67818) * [Reporting]: Move router + license checks to new platform (#66331) * WIP: Move routes to new API, license and other checks inbound * Move license checks over to np licensing observable * Fix license checks + remove older modules * Fixing check_license tests, move to TS/Jest * Fix licensing setup for mocks * Move job.test.ts over to np * WIP: move user checks to higher-order func * Move more handler logic over to Response factory vs Boom * Major refactor to consolidate types, remove facades, and udpate helpers * Fix validation for dates in immediate exports * Linter fix on check license test * Fix job generation tests * Move deps => setupDeps * fix api test * fix jobs test * authorized_user_pre_routing and tests * Fixing duplicate identifiers * Fix licensing implementation changes * WIP: Moving license over to async/observables * Fix disabled-security case * finish auth_user_pre_routing cleanup - no more license check * WIP: Fixing final api tests * Trying to get schema differences in alignment * Reverting back to previous generation handler * Fix final API tests * Final API test fixes, few more hardening tests and better error messages * Simplify lower-level module implementation (core only interface) + test updates * Push some core logic into plugin * Move some core logic up to plugin * Marking private setupDeps + downstream fixes * revert logger as a param Co-authored-by: Timothy Sullivan <tsullivan@elastic.co> # Conflicts: # x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/create_job/index.ts # x-pack/legacy/plugins/reporting/server/routes/generation.ts * Add back in legacy /viz /search and /dashboard routes * Add back in and fix compatibility shim/tests
Moves our routes and relevant factories/classes to new platform idioms. Most of the fundamental pieces are in place, but there is still work needing to be done: