-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Migrate remaining parts of server-side SO domain to packages #139305
Migrate remaining parts of server-side SO domain to packages #139305
Conversation
27c7723
to
08efcb2
Compare
c2c4e3e
to
cf84faf
Compare
Pinging @elastic/kibana-core (Team:Core) |
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.
LGTM
@jeramysoucy Once this PR merges, you should be unblocked on #134395. |
packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/internal_mocks.ts
Outdated
Show resolved
Hide resolved
packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/internal_mocks.ts
Outdated
Show resolved
Hide resolved
"name": "@kbn/core-saved-objects-api-server-internal", | ||
"private": true, | ||
"version": "1.0.0", | ||
"main": "./target_node/index.js", |
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.
"main": "./target_node/index.js", | |
"main": "./target_node/index.js", | |
"author": "Kibana Core", |
packages/core/saved-objects/core-saved-objects-api-server-mocks/package.json
Show resolved
Hide resolved
packages/core/saved-objects/core-saved-objects-import-export-server-internal/package.json
Show resolved
Hide resolved
packages/core/saved-objects/core-saved-objects-import-export-server-mocks/package.json
Show resolved
Hide resolved
packages/core/saved-objects/core-saved-objects-migration-server-internal/package.json
Show resolved
Hide resolved
packages/core/saved-objects/core-saved-objects-migration-server-mocks/package.json
Show resolved
Hide resolved
packages/core/saved-objects/core-saved-objects-server-internal/package.json
Show resolved
Hide resolved
packages/core/saved-objects/core-saved-objects-server-mocks/package.json
Show resolved
Hide resolved
packages/core/usage-data/core-usage-data-base-server-internal/package.json
Show resolved
Hide resolved
This package contains internal base types and constants for Core's server-side `usage-data` domain that are used | ||
across some other domains. | ||
|
||
The purpose of the package is mostly to break the cyclic dependency between the `core-usage-data` and `savedObjects` services. |
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.
aside: Are we going to standardize on using the *-base-*
package name tag for extra packages we need to break cyclic dependencies?
If so, can we generally assume that these packages won’t have associated public types packages?
At the end, in the audit and clean up phase, we should consider adding another folder for shared
service dependencies and move the packages to those. WDYT?
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.
Good question. Regarding standardization, tbh I'm even starting to think that the current structure / suffix/prefix naming may not be the best one. But let's finish the migration the way the started it, and we then should discuss a bit regarding what we think we may want to improve.
packages/core/saved-objects/core-saved-objects-api-server-mocks/README.md
Show resolved
Hide resolved
export type { | ||
SavedObjectsRepository, | ||
SavedObjectsExporter, | ||
SavedObjectsExportError, |
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.
SavedObjectExportError
is public. Is there a reason we don't have public type packages for import
/export
?
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.
SavedObjectExportError is public
Yea, and no... tbh it wasn't supposed to be public, but some consumers started using it, so.. here we are.
SavedObjectExportError
(and the import counterpart) are concrete implementations atm, without an explicit type equivalent. I basically didn't want to increase the changes of this PR, as introducing a type would mean adapting the existing external usages.
But I can take another look
Is there a reason we don't have public type packages for import/export
I regrouped all the public types of all sub domains in the same @kbn/core-saved-objects-server
package. Because it was easier, but also because we effectively have some cyclic dependencies between the public types of the subdomains IIRC.
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.
ya, the cyclic dependencies would've meant we need somewhere common to share these types from.
RegisterDeprecationsConfig, | ||
} from '@kbn/core-deprecations-server'; | ||
|
||
export type { |
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.
We need to update #135961 with the remaining work to migrate the deprecations service.
@@ -0,0 +1,5 @@ | |||
# @kbn/core-saved-objects-server-mocks | |||
|
|||
This package contains the mocks for core's server-side savedObjects service. |
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.
I'm starting to think we'll need a core-dev-only README
in the root packages/core/saved-objects
folder as an index to where all the sub-domain services and mocks are within the package architecture.
For now, we can use core/server/server
, core/server/mocks
, core/server/index
and core/server/types
(if we have to) as a lookup guide.
OTOH, these root files will likely move to their own packages later on and we could extend their README's.
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.
I've gone through the code and changes and left a few comments and nits. Nothing stands out to me that would prevent merging and CI seems to agree.
Nice work migrating the massive domain!
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Public APIs missing exports
Unknown metric groupsAPI count
ESLint disabled in files
ESLint disabled line counts
References to deprecated APIs
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
…#139305) * create empty packages * create empty mock packages * start moving client/repository implementation * finish moving client/repo code * move import/export code * move migration code * create empty mocks package * start moving service code * continue fixing stuff, create yet another package * create usage-data package for internal contract * create core-deprecations-server package * fix last problems * fix mock package * start fixing usages * fix index exports * start fixing unit tests for new packages * lint * fix invalid char * fix more violations and test failures * fix more package tests * adapt more test files * one more fix * adapt repo tests * fix last (?) package tests * fix moment mocking * expose import/export error types again * remove test mocking * adapt imports * export as type * trying to fix the schema check task * duplicating usage collection types for now * fix stack trace assertion * fix duplicate import from different paths * [CI] Auto-commit changed files from 'node scripts/generate packages_build_manifest' * update readme's * move mocks to a dedicated folder * self review * move test_utils to integration tests * update package files * rename mocks * manually adapting exclude Co-authored-by: kibanamachine <[email protected]>
Summary
Fix #135820
Follow-up of #136722, #137183 and #137448
This PR migrates the remaining parts of Core's server-side SO domain to packages.
The PR introduces the following SO packages:
@kbn/core-saved-objects-api-server-internal
@kbn/core-saved-objects-api-server-mocks
@kbn/core-saved-objects-import-export-server-internal
@kbn/core-saved-objects-import-export-server-mocks
@kbn/core-saved-objects-migration-server-internal
@kbn/core-saved-objects-migration-server-mocks
@kbn/core-saved-objects-server-internal
@kbn/core-saved-objects-server-mocks
And the following packages that were required because of the cyclic / bidirectional dependencies against the SO service:
@kbn/core-usage-data-base-server-internal
@kbn/core-usage-data-server
@kbn/core-deprecations-server